Merge pull request #2579 from openmv/stm32_gpu_driver
Some checks failed
🔎 Check Code Formatting / formatting-check (push) Has been cancelled
🔥 Firmware Build / build-firmware (ARDUINO_GIGA) (push) Has been cancelled
🔥 Firmware Build / build-firmware (ARDUINO_NANO_33_BLE_SENSE) (push) Has been cancelled
🔥 Firmware Build / build-firmware (ARDUINO_NANO_RP2040_CONNECT) (push) Has been cancelled
🔥 Firmware Build / build-firmware (ARDUINO_NICLA_VISION) (push) Has been cancelled
🔥 Firmware Build / build-firmware (ARDUINO_PORTENTA_H7) (push) Has been cancelled
🔥 Firmware Build / build-firmware (OPENMV2) (push) Has been cancelled
🔥 Firmware Build / build-firmware (OPENMV3) (push) Has been cancelled
🔥 Firmware Build / build-firmware (OPENMV4) (push) Has been cancelled
🔥 Firmware Build / build-firmware (OPENMV4P) (push) Has been cancelled
🔥 Firmware Build / build-firmware (OPENMVPT) (push) Has been cancelled
🔥 Firmware Build / build-firmware (OPENMV_RT1060) (push) Has been cancelled
🔥 Firmware Build / code-size-report (push) Has been cancelled
🔥 Firmware Build / stable-release (push) Has been cancelled
🔥 Firmware Build / development-release (push) Has been cancelled

ports/stm32: Update GPU driver.
This commit is contained in:
Ibrahim Abdelkader 2025-01-10 09:22:54 +02:00 committed by GitHub
commit 6e038b7ceb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 47 additions and 49 deletions

View File

@ -79,8 +79,10 @@ int omv_gpu_draw_image(image_t *src_img,
const uint8_t *alpha_palette,
image_hint_t hint) {
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.
#if OMV_GPU_NEMA_MM_STATIC
nema_buffer_t bo = {
@ -103,16 +105,17 @@ int omv_gpu_draw_image(image_t *src_img,
}
// Set up destination texture.
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.
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.
nema_set_blend_blit(NEMA_BL_SRC);
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
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.
SCB_InvalidateDCache_by_Addr(dst_img->data, image_size(dst_img));
} else {
return -1;
}
OMV_PROFILE_PRINT();
return 0;
}

View File

@ -145,7 +145,7 @@ void nema_host_free(void *ptr) {
}
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) {