All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Hellström (VMware)" <thomas_os@shipmail.org>
To: dri-devel@lists.freedesktop.org
Cc: Thomas Hellstrom <thellstrom@vmware.com>,
	linux-graphics-maintainer@vmware.com,
	Emil Velikov <emil.velikov@collabora.com>
Subject: [PATCH 4/9] drm/vmwgfx: move the require_exist handling together
Date: Wed, 15 Jan 2020 12:53:24 +0100	[thread overview]
Message-ID: <20200115115329.2836-4-thomas_os@shipmail.org> (raw)
In-Reply-To: <20200115115329.2836-1-thomas_os@shipmail.org>

From: Emil Velikov <emil.velikov@collabora.com>

Move the render_client hunk for require_exist alongside the rest.
Keeping all the reasons why an existing object is needed, in a single
place makes it easier to follow.

Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 32b9131b2bae..590bde993946 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -934,16 +934,12 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
 	uint32_t handle;
 	struct ttm_base_object *base;
 	int ret;
-	bool require_exist = false;
 
 	if (handle_type == DRM_VMW_HANDLE_PRIME) {
 		ret = ttm_prime_fd_to_handle(tfile, u_handle, &handle);
 		if (unlikely(ret != 0))
 			return ret;
 	} else {
-		if (unlikely(drm_is_render_client(file_priv)))
-			require_exist = true;
-
 		handle = u_handle;
 	}
 
@@ -960,6 +956,8 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
 	}
 
 	if (handle_type != DRM_VMW_HANDLE_PRIME) {
+		bool require_exist = false;
+
 		user_srf = container_of(base, struct vmw_user_surface,
 					prime.base);
 
@@ -971,6 +969,9 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
 		    user_srf->master != file_priv->master)
 			require_exist = true;
 
+		if (unlikely(drm_is_render_client(file_priv)))
+			require_exist = true;
+
 		ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL,
 					 require_exist);
 		if (unlikely(ret != 0)) {
-- 
2.21.0

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

  parent reply	other threads:[~2020-01-15 11:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15 11:53 [PATCH 1/9] drm/vmwgfx: Don't use the HB port if memory encryption is active Thomas Hellström (VMware)
2020-01-15 11:53 ` [PATCH 2/9] drm/vmwgfx: Call vmw_driver_{load, unload}() before registering device Thomas Hellström (VMware)
2020-01-15 11:53 ` [PATCH 3/9] drm/vmwgfx: Replace deprecated PTR_RET Thomas Hellström (VMware)
2020-01-15 11:53 ` Thomas Hellström (VMware) [this message]
2020-01-15 11:53 ` [PATCH 5/9] drm/vmwgfx: check master authentication in surface_ref ioctls Thomas Hellström (VMware)
2020-01-15 11:53 ` [PATCH 6/9] drm/vmwgfx: drop DRM_AUTH for render ioctls Thomas Hellström (VMware)
2020-01-15 11:53 ` [PATCH 7/9] drm/vmwgfx: prevent memory leak in vmw_cmdbuf_res_add Thomas Hellström (VMware)
2020-01-15 11:53 ` [PATCH 8/9] drm/vmwgfx: add ioctl for messaging from/to guest userspace to/from host Thomas Hellström (VMware)
2020-01-15 11:53 ` [PATCH 9/9] drm/vmwgfx: Bump driver minor version Thomas Hellström (VMware)

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=20200115115329.2836-4-thomas_os@shipmail.org \
    --to=thomas_os@shipmail.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.velikov@collabora.com \
    --cc=linux-graphics-maintainer@vmware.com \
    --cc=thellstrom@vmware.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.