dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: daniel@ffwll.ch, airlied@linux.ie, sam@ravnborg.org,
	mripard@kernel.org, maarten.lankhorst@linux.intel.com,
	christian.koenig@amd.com, ville.syrjala@linux.intel.com
Cc: Thomas Zimmermann <tzimmermann@suse.de>, dri-devel@lists.freedesktop.org
Subject: [PATCH v2 03/10] drm/client: Depend on GEM object kmap ref-counting
Date: Fri, 20 Nov 2020 11:25:38 +0100	[thread overview]
Message-ID: <20201120102545.4047-4-tzimmermann@suse.de> (raw)
In-Reply-To: <20201120102545.4047-1-tzimmermann@suse.de>

DRM client's vmap/vunmap functions don't allow for multiple vmap
operations. Calling drm_client_buffer_vmap() twice returns the same
mapping, then calling drm_client_buffer_vunmap() twice already unmaps
on the first call. This leads to unbalanced vmap refcounts. Fix this
by calling drm_gem_vmap() unconditionally in drm_client_buffer_vmap().

All drivers that support DRM clients have to implement correct ref-
counting for their vmap operations, or not vunmap at all. This is the
case for drivers that use CMA, SHMEM and VRAM helpers, and QXL. Other
drivers are not affected.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_client.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
index fe573acf1067..ce45e380f4a2 100644
--- a/drivers/gpu/drm/drm_client.c
+++ b/drivers/gpu/drm/drm_client.c
@@ -314,9 +314,6 @@ drm_client_buffer_vmap(struct drm_client_buffer *buffer, struct dma_buf_map *map
 	struct dma_buf_map *map = &buffer->map;
 	int ret;
 
-	if (dma_buf_map_is_set(map))
-		goto out;
-
 	/*
 	 * FIXME: The dependency on GEM here isn't required, we could
 	 * convert the driver handle to a dma-buf instead and use the
@@ -329,7 +326,6 @@ drm_client_buffer_vmap(struct drm_client_buffer *buffer, struct dma_buf_map *map
 	if (ret)
 		return ret;
 
-out:
 	*map_copy = *map;
 
 	return 0;
-- 
2.29.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2020-11-20 10:25 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20 10:25 [PATCH v2 00/10] drm/fb-helper: Various fixes and cleanups Thomas Zimmermann
2020-11-20 10:25 ` [PATCH v2 01/10] drm/fb-helper: Call dirty helper after writing to fbdev Thomas Zimmermann
2020-11-23 19:20   ` Sam Ravnborg
2020-11-20 10:25 ` [PATCH v2 02/10] drm/fb-helper: Unmap client buffer during shutdown Thomas Zimmermann
2020-11-23 19:20   ` Sam Ravnborg
2020-11-20 10:25 ` Thomas Zimmermann [this message]
2020-11-20 10:25 ` [PATCH v2 04/10] drm/fb-helper: Rename dirty worker to damage worker Thomas Zimmermann
2020-11-23 19:22   ` Sam Ravnborg
2020-11-20 10:25 ` [PATCH v2 05/10] drm/fb-helper: Return early in dirty worker Thomas Zimmermann
2020-11-23 19:23   ` Sam Ravnborg
2020-11-24  9:54     ` Thomas Zimmermann
2020-11-20 10:25 ` [PATCH v2 06/10] drm/fb-helper: Separate shadow-buffer flushing and calling dirty callback Thomas Zimmermann
2020-11-23 19:24   ` Sam Ravnborg
2020-11-20 10:25 ` [PATCH v2 07/10] drm/fb-helper: Move damage blit code and its setup into separate routine Thomas Zimmermann
2020-11-22 14:18   ` [drm/fb] 6a1b34c0a3: WARNING:at_drivers/gpu/drm/drm_fb_helper.c:#drm_fb_helper_damage_work kernel test robot
2020-11-23  8:04     ` Thomas Zimmermann
2020-11-24  1:58       ` Xing Zhengjun
2020-11-24  7:44         ` Thomas Zimmermann
2020-11-24  9:56         ` Thomas Zimmermann
2020-11-23 19:25   ` [PATCH v2 07/10] drm/fb-helper: Move damage blit code and its setup into separate routine Sam Ravnborg
2020-11-20 10:25 ` [PATCH v2 08/10] drm/fb-helper: Restore damage area upon errors Thomas Zimmermann
2020-11-23 19:26   ` Sam Ravnborg
2020-11-20 10:25 ` [PATCH v2 09/10] drm/fb-helper: Copy dma-buf map before flushing shadow fb Thomas Zimmermann
2020-11-23 19:27   ` Sam Ravnborg
2020-11-20 10:25 ` [PATCH v2 10/10] drm/fb-helper: Acquire modeset lock around shadow-buffer flushing Thomas Zimmermann
2020-11-23 19:27   ` Sam Ravnborg
2020-11-23  9:18 ` [PATCH v2 00/10] drm/fb-helper: Various fixes and cleanups Maxime Ripard

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=20201120102545.4047-4-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@linux.ie \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=ville.syrjala@linux.intel.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).