Commit 8815a94f authored by Emil Velikov's avatar Emil Velikov Committed by Thomas Hellstrom

drm/vmwgfx: move the require_exist handling together

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: default avatarEmil Velikov <emil.velikov@collabora.com>
Reviewed-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
parent a26ca967
...@@ -934,16 +934,12 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv, ...@@ -934,16 +934,12 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
uint32_t handle; uint32_t handle;
struct ttm_base_object *base; struct ttm_base_object *base;
int ret; int ret;
bool require_exist = false;
if (handle_type == DRM_VMW_HANDLE_PRIME) { if (handle_type == DRM_VMW_HANDLE_PRIME) {
ret = ttm_prime_fd_to_handle(tfile, u_handle, &handle); ret = ttm_prime_fd_to_handle(tfile, u_handle, &handle);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
return ret; return ret;
} else { } else {
if (unlikely(drm_is_render_client(file_priv)))
require_exist = true;
handle = u_handle; handle = u_handle;
} }
...@@ -960,6 +956,8 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv, ...@@ -960,6 +956,8 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
} }
if (handle_type != DRM_VMW_HANDLE_PRIME) { if (handle_type != DRM_VMW_HANDLE_PRIME) {
bool require_exist = false;
user_srf = container_of(base, struct vmw_user_surface, user_srf = container_of(base, struct vmw_user_surface,
prime.base); prime.base);
...@@ -971,6 +969,9 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv, ...@@ -971,6 +969,9 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
user_srf->master != file_priv->master) user_srf->master != file_priv->master)
require_exist = true; 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, ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL,
require_exist); require_exist);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment