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 tzimmermann@suse.de
Reviewed-by: Javier Martinez Canillas javierm@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;
drm_gem_vram_unpin(gbo);gbo = drm_gem_vram_of_gem(obj);
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]);
drm_gem_vram_unpin(gbo);gbo = drm_gem_vram_of_gem(obj);
... 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.