aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2014-03-12 15:42:31 -0400
committerThomas Hellstrom <thellstrom@vmware.com>2014-03-13 02:51:32 -0400
commit4b0c82529b92cda4723cf1d09e1e2ee9b9ae96f1 (patch)
treee1c6a7028a0f4b3b3387ef4c582ccf075b30ac9d /drivers/gpu
parent45db98e54242f3ae94bdcfbfe754e743252eb168 (diff)
drm/vmwgfx: Fix a surface reference corner-case in legacy emulation mode
If running on a gb-object capable device with a non-gb capable surface exporter (X server) and a gb capable surface referencing client (GL driver), the referencing client expects to find a shareable backing buffer attached to the surface at reference time. This may not be the case if the surface has not yet been validated. This would cause the surface reference IOCTL to return an error. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_surface.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 82468d902915..e7af580ab977 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -830,6 +830,24 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
830 if (unlikely(ret != 0)) 830 if (unlikely(ret != 0))
831 goto out_unlock; 831 goto out_unlock;
832 832
833 /*
834 * A gb-aware client referencing a shared surface will
835 * expect a backup buffer to be present.
836 */
837 if (dev_priv->has_mob && req->shareable) {
838 uint32_t backup_handle;
839
840 ret = vmw_user_dmabuf_alloc(dev_priv, tfile,
841 res->backup_size,
842 true,
843 &backup_handle,
844 &res->backup);
845 if (unlikely(ret != 0)) {
846 vmw_resource_unreference(&res);
847 goto out_unlock;
848 }
849 }
850
833 tmp = vmw_resource_reference(&srf->res); 851 tmp = vmw_resource_reference(&srf->res);
834 ret = ttm_prime_object_init(tfile, res->backup_size, &user_srf->prime, 852 ret = ttm_prime_object_init(tfile, res->backup_size, &user_srf->prime,
835 req->shareable, VMW_RES_SURFACE, 853 req->shareable, VMW_RES_SURFACE,