Hi Am 16.05.22 um 15:34 schrieb Javier Martinez Canillas:
On 5/9/22 10:16, Thomas Zimmermann wrote:Only handle color planes that exist in a framebuffer's color format. Ignore non-existing planes.Signed-off-by: Thomas Zimmermann <tzimmerm...@suse.de> ---Reviewed-by: Javier Martinez Canillas <javi...@redhat.com>@@ -673,7 +679,10 @@ drm_gem_vram_plane_helper_prepare_fb(struct drm_plane *plane, err_drm_gem_vram_unpin: while (i) { --i; - gbo = drm_gem_vram_of_gem(new_state->fb->obj[i]); + obj = drm_gem_fb_get_obj(fb, i); + if (!obj) + continue; + gbo = drm_gem_vram_of_gem(obj); drm_gem_vram_unpin(gbo);The code in this error path to unpin the GEM vram objects...} return ret; @@ -694,16 +703,19 @@ void drm_gem_vram_plane_helper_cleanup_fb(struct drm_plane *plane, struct drm_plane_state *old_state) { - size_t i; + struct drm_framebuffer *fb = old_state->fb; struct drm_gem_vram_object *gbo; + struct drm_gem_object *obj; + unsigned int i;- if (!old_state->fb)+ if (!fb) return;- for (i = 0; i < ARRAY_SIZE(old_state->fb->obj); ++i) {- if (!old_state->fb->obj[i]) + for (i = 0; i < fb->format->num_planes; ++i) { + obj = drm_gem_fb_get_obj(fb, i); + if (!obj) continue; - gbo = drm_gem_vram_of_gem(old_state->fb->obj[i]); + gbo = drm_gem_vram_of_gem(obj); drm_gem_vram_unpin(gbo);... and this, seems to be basically the same. So maybe as a follow-up you can do a similar cleanup like you did in patch 1/4 and use a helper function to handle both.
I was thinking the same when I wrote this patch and somehow decided against it. But since you also mention it, I'm going to add this change to the patchset.
Best regards Thomas
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
OpenPGP_signature
Description: OpenPGP digital signature