drm/vmwgfx: Make all surfaces shareable
Subsystems (3)
PATCH 1/2 drm/vmwgfx: Make all surfaces shareable
From: Maaz Mombasawala <[email protected]>
There is no real need to have a separate pool for shareable and non-shareable surfaces. Make all surfaces shareable, regardless of whether the drm_vmw_surface_flag_shareable has been specified.
Signed-off-by Maaz Mombasawala <[email protected]>
Reviewed-by Martin Krastev <[email protected]>
Signed-off-by Maaz Mombasawala (VMware) <[email protected]>
--- drivers/gpu/drm/vmwgfx/ttm_object.c | 6 +++--- drivers/gpu/drm/vmwgfx/ttm_object.h | 3 +-- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 17 ++++++----------- include/uapi/drm/vmwgfx_drm.h | 5 +++-- 4 files changed, 13 insertions(+), 18 deletions(-)
drivers/gpu/drm/vmwgfx/ttm_object.c +3 -3
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: GPL-2.0 OR MIT */ /************************************************************************** * -* Copyright (c) 2009-2022 VMware, Inc., Palo Alto, CA., USA +* Copyright (c) 2009-2023 VMware, Inc., Palo Alto, CA., USA * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a
@@ -648,7 +648,6 @@ int ttm_prime_handle_to_fd(struct ttm_object_file *tfile,* @tfile: struct ttm_object_file identifying the caller * @size: The size of the dma_bufs we export. * @prime: The object to be initialized. -* @shareable: See ttm_base_object_init * @type: See ttm_base_object_init * @refcount_release: See ttm_base_object_init *
@@ -656,10 +655,11 @@ int ttm_prime_handle_to_fd(struct ttm_object_file *tfile,* for data sharing between processes and devices. */ int ttm_prime_object_init (struct ttm_object_file *tfile,size_t size, -struct ttm_prime_object *prime,bool shareable, +struct ttm_prime_object *prime,enum ttm_object_type type,void (*refcount_release) (struct ttm_base_object **)) { +bool shareable = !!(type ==VMW_RES_SURFACE );mutex_init (&prime->mutex); prime->size =PAGE_ALIGN (size); prime->real_type = type;
drivers/gpu/drm/vmwgfx/ttm_object.h +1 -2
@@ -1,6 +1,6 @@/************************************************************************** * -* Copyright (c) 2006-2022 VMware, Inc., Palo Alto, CA., USA +* Copyright (c) 2006-2023 VMware, Inc., Palo Alto, CA., USA * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a
@@ -288,7 +288,6 @@ extern void ttm_object_device_release(struct ttm_object_device **p_tdev);extern int ttm_prime_object_init (struct ttm_object_file *tfile,size_t size,struct ttm_prime_object *prime, -bool shareable,enum ttm_object_type type,void (*refcount_release) (struct ttm_base_object **));
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +6 -11
@@ -836,8 +836,6 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data, srf->snooper.image =NULL ; } - user_srf->prime.base.shareable = false; - user_srf->prime.base.tfile =NULL ;if (drm_is_primary_client (file_priv)) user_srf->master =drm_file_get_master (file_priv);
@@ -851,10 +849,10 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data, goto out_unlock;/* -* A gb-aware client referencing a shared surface will -* expect a backup buffer to be present. +* A gb-aware client referencing a surface will expect a backup +* buffer to be present. */ -if (dev_priv->has_mob && req->shareable) { +if (dev_priv->has_mob) {uint32_t backup_handle; ret = vmw_gem_object_create_with_handle(dev_priv,
@@ -875,8 +873,9 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data, } tmp =vmw_resource_reference (&srf->res); - ret =ttm_prime_object_init (tfile, res->guest_memory_size, &user_srf->prime, - req->shareable,VMW_RES_SURFACE , + ret =ttm_prime_object_init (tfile, res->guest_memory_size, + &user_srf->prime, +VMW_RES_SURFACE , &vmw_user_surface_base_release);if (unlikely (ret !=0 )) {
@@ -1557,8 +1556,6 @@ vmw_gb_surface_define_internal(struct drm_device *dev, tmp =vmw_resource_reference (res); ret =ttm_prime_object_init (tfile, res->guest_memory_size, &user_srf->prime, - req->base.drm_surface_flags & - drm_vmw_surface_flag_shareable,VMW_RES_SURFACE , &vmw_user_surface_base_release);
@@ -2060,8 +2057,6 @@ int vmw_gb_surface_define(struct vmw_private *dev_priv, } *srf_out = &user_srf->srf; - user_srf->prime.base.shareable = false; - user_srf->prime.base.tfile =NULL ; srf = &user_srf->srf; srf->metadata = *req;
include/uapi/drm/vmwgfx_drm.h +3 -2
@@ -1,6 +1,6 @@/************************************************************************** * -* Copyright © 2009-2022 VMware, Inc., Palo Alto, CA., USA +* Copyright © 2009-2023 VMware, Inc., Palo Alto, CA., USA * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a
@@ -902,7 +902,8 @@ struct drm_vmw_shader_arg {/** * enum drm_vmw_surface_flags * -* @drm_vmw_surface_flag_shareable: Whether the surface is shareable +* @drm_vmw_surface_flag_shareable: Deprecated - all userspace surfaces are +* shareable. * @drm_vmw_surface_flag_scanout: Whether the surface is a scanout * surface. * @drm_vmw_surface_flag_create_buffer: Create a backup buffer if none is
Signature · 1 line
2.34.1
PATCH 2/2 drm/vmwgfx: Add SPDX header to vmwgfx_drm.h
From: Maaz Mombasawala <[email protected]>
Update vmwgfx_drm.h with SPDX-License-Identifier:
(GPL-2.0 WITH Linux-syscall-note) OR MIT
Signed-off-by Maaz Mombasawala <[email protected]>
Reviewed-by Martin Krastev <[email protected]>
Signed-off-by Maaz Mombasawala (VMware) <[email protected]>
--- include/uapi/drm/vmwgfx_drm.h | 1 + 1 file changed, 1 insertion(+)
include/uapi/drm/vmwgfx_drm.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT */ /************************************************************************** * * Copyright © 2009-2023 VMware, Inc., Palo Alto, CA., USA
Signature · 1 line
2.34.1