Skip to content

Commit 0ec77bd

Browse files
author
Thomas Zimmermann
committed
drm/gem: Clear mapping addresses for unused framebuffer planes
Set the returned mapping address to NULL if a framebuffer plane does not have a BO associated with it. Likewise, ignore mappings of NULL during framebuffer unmap operations. Allows users of the functions to perform unmap operations of certain BOs by themselfes. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent f6424ec commit 0ec77bd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/gpu/drm/drm_gem_framebuffer_helper.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,10 @@ int drm_gem_fb_vmap(struct drm_framebuffer *fb,
335335

336336
for (i = 0; i < DRM_FORMAT_MAX_PLANES; ++i) {
337337
obj = drm_gem_fb_get_obj(fb, i);
338-
if (!obj)
338+
if (!obj) {
339+
dma_buf_map_clear(&map[i]);
339340
continue;
341+
}
340342
ret = drm_gem_vmap(obj, &map[i]);
341343
if (ret)
342344
goto err_drm_gem_vunmap;
@@ -376,6 +378,8 @@ void drm_gem_fb_vunmap(struct drm_framebuffer *fb,
376378
obj = drm_gem_fb_get_obj(fb, i);
377379
if (!obj)
378380
continue;
381+
if (dma_buf_map_is_null(&map[i]))
382+
continue;
379383
drm_gem_vunmap(obj, &map[i]);
380384
}
381385
}

0 commit comments

Comments
 (0)