From: Thomas Zimmermann <tzimmermann@suse.de>
To: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
airlied@linux.ie, daniel@ffwll.ch, noralf@tronnes.org,
rodrigosiqueiramelo@gmail.com, melissa.srw@gmail.com,
hamohammed.sa@gmail.com
Cc: Thomas Zimmermann <tzimmermann@suse.de>, dri-devel@lists.freedesktop.org
Subject: [PATCH v2 3/5] drm/gem: Clear mapping addresses for unused framebuffer planes
Date: Sun, 25 Jul 2021 19:44:36 +0200 [thread overview]
Message-ID: <20210725174438.24493-4-tzimmermann@suse.de> (raw)
In-Reply-To: <20210725174438.24493-1-tzimmermann@suse.de>
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 <tzimmermann@suse.de>
---
drivers/gpu/drm/drm_gem_framebuffer_helper.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
index 243affbad437..02928607a716 100644
--- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c
+++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
@@ -336,8 +336,10 @@ int drm_gem_fb_vmap(struct drm_framebuffer *fb,
for (i = 0; i < DRM_FORMAT_MAX_PLANES; ++i) {
obj = drm_gem_fb_get_obj(fb, i);
- if (!obj)
+ if (!obj) {
+ dma_buf_map_clear(&map[i]);
continue;
+ }
ret = drm_gem_vmap(obj, &map[i]);
if (ret)
goto err_drm_gem_vunmap;
@@ -377,6 +379,8 @@ void drm_gem_fb_vunmap(struct drm_framebuffer *fb,
obj = drm_gem_fb_get_obj(fb, i);
if (!obj)
continue;
+ if (dma_buf_map_is_null(&map[i]))
+ continue;
drm_gem_vunmap(obj, &map[i]);
}
}
--
2.32.0
next prev parent reply other threads:[~2021-07-25 17:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-25 17:44 [PATCH v2 0/5] drm: Provide framebuffer vmap helpers Thomas Zimmermann
2021-07-25 17:44 ` [PATCH v2 1/5] drm: Define DRM_FORMAT_MAX_PLANES Thomas Zimmermann
2021-07-25 19:49 ` Sam Ravnborg
2021-07-26 18:03 ` Thomas Zimmermann
2021-07-25 17:44 ` [PATCH v2 2/5] drm/gem: Provide drm_gem_fb_{vmap,vunmap}() Thomas Zimmermann
2021-07-25 19:55 ` Sam Ravnborg
2021-07-25 17:44 ` Thomas Zimmermann [this message]
2021-07-25 19:58 ` [PATCH v2 3/5] drm/gem: Clear mapping addresses for unused framebuffer planes Sam Ravnborg
2021-07-25 17:44 ` [PATCH v2 4/5] drm/gud: Map framebuffer BOs with drm_gem_fb_vmap() Thomas Zimmermann
2021-07-25 20:03 ` Sam Ravnborg
2021-07-25 17:44 ` [PATCH v2 5/5] drm/vkms: Map output " Thomas Zimmermann
2021-07-25 20:03 ` Sam Ravnborg
2021-07-26 21:26 ` Rodrigo Siqueira
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210725174438.24493-4-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hamohammed.sa@gmail.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=melissa.srw@gmail.com \
--cc=mripard@kernel.org \
--cc=noralf@tronnes.org \
--cc=rodrigosiqueiramelo@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).