mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
ports/stm32: Update GPU driver.
This commit is contained in:
parent
8a1f579ee5
commit
26b04e5b05
@ -79,8 +79,10 @@ int omv_gpu_draw_image(image_t *src_img,
|
|||||||
const uint8_t *alpha_palette,
|
const uint8_t *alpha_palette,
|
||||||
image_hint_t hint) {
|
image_hint_t hint) {
|
||||||
OMV_PROFILE_START();
|
OMV_PROFILE_START();
|
||||||
|
if (color_palette || alpha_palette) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if ((dst_rect->w != src_rect->w) || (dst_rect->h != src_rect->h)) {
|
|
||||||
// Create command list.
|
// Create command list.
|
||||||
#if OMV_GPU_NEMA_MM_STATIC
|
#if OMV_GPU_NEMA_MM_STATIC
|
||||||
nema_buffer_t bo = {
|
nema_buffer_t bo = {
|
||||||
@ -103,16 +105,17 @@ int omv_gpu_draw_image(image_t *src_img,
|
|||||||
}
|
}
|
||||||
// Set up destination texture.
|
// Set up destination texture.
|
||||||
nema_tex_format_t dst_pixfmt = omv_gpu_pixfmt(dst_img->pixfmt);
|
nema_tex_format_t dst_pixfmt = omv_gpu_pixfmt(dst_img->pixfmt);
|
||||||
nema_bind_dst_tex((uintptr_t) dst_img->data, dst_rect->w, dst_rect->h, dst_pixfmt, -1);
|
nema_bind_dst_tex((uintptr_t) dst_img->data, dst_img->w, dst_img->h, dst_pixfmt, -1);
|
||||||
|
|
||||||
// Set up source texture.
|
// Set up source texture.
|
||||||
nema_tex_format_t src_pixfmt = omv_gpu_pixfmt(src_img->pixfmt);
|
nema_tex_format_t src_pixfmt = omv_gpu_pixfmt(src_img->pixfmt);
|
||||||
nema_bind_src_tex((uintptr_t) src_img->data, src_rect->w, src_rect->h, src_pixfmt, -1, blit_mode);
|
nema_bind_src_tex((uintptr_t) src_img->data, src_img->w, src_img->h, src_pixfmt, -1, blit_mode);
|
||||||
|
|
||||||
// Configure operations.
|
// Configure operations.
|
||||||
nema_set_blend_blit(NEMA_BL_SRC);
|
nema_set_blend_blit(NEMA_BL_SRC);
|
||||||
nema_set_clip(0, 0, dst_rect->w, dst_rect->h);
|
nema_set_clip(0, 0, dst_rect->w, dst_rect->h);
|
||||||
nema_blit_rect_fit(0, 0, dst_rect->w, dst_rect->h);
|
nema_blit_subrect_fit(dst_rect->x, dst_rect->y, dst_rect->w, dst_rect->h,
|
||||||
|
src_rect->x, src_rect->y, src_rect->w, src_rect->h);
|
||||||
|
|
||||||
// Flush source image
|
// Flush source image
|
||||||
SCB_CleanDCache_by_Addr(src_img->data, image_size(src_img));
|
SCB_CleanDCache_by_Addr(src_img->data, image_size(src_img));
|
||||||
@ -125,11 +128,6 @@ int omv_gpu_draw_image(image_t *src_img,
|
|||||||
|
|
||||||
// Invalidate the destination image.
|
// Invalidate the destination image.
|
||||||
SCB_InvalidateDCache_by_Addr(dst_img->data, image_size(dst_img));
|
SCB_InvalidateDCache_by_Addr(dst_img->data, image_size(dst_img));
|
||||||
|
|
||||||
} else {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
OMV_PROFILE_PRINT();
|
OMV_PROFILE_PRINT();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -145,7 +145,7 @@ void nema_host_free(void *ptr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void *nema_host_malloc(unsigned size) {
|
void *nema_host_malloc(unsigned size) {
|
||||||
return malloc(size);
|
return aligned_alloc(__SCB_DCACHE_LINE_SIZE, (size + (__SCB_DCACHE_LINE_SIZE - 1)) & ~(__SCB_DCACHE_LINE_SIZE - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
int nema_mutex_lock(int mutex_id) {
|
int nema_mutex_lock(int mutex_id) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user