glamor: Work around GEM usage v2

KMS drivers are not required to support GEM. In particular, vmwgfx
doesn't support flink and handles and names are identical.
Getting a bo name should really be part of a lower level API, if needed,
but in the mean time work around this by setting the name identical to
the handle if GEM isn't supported.

This fixes modesetting driver dri2 on vmwgfx.

Reviewed-by: Deepak Rawat <drawat@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
(cherry picked from commit 9f02855e7a)
This commit is contained in:
Thomas Hellstrom 2018-06-20 19:23:48 +02:00 committed by Adam Jackson
parent ba6a928381
commit 820ce7cb8b
1 changed files with 12 additions and 2 deletions

View File

@ -99,8 +99,18 @@ glamor_get_flink_name(int fd, int handle, int *name)
struct drm_gem_flink flink;
flink.handle = handle;
if (ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink) < 0)
return FALSE;
if (ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink) < 0) {
/*
* Assume non-GEM kernels have names identical to the handle
*/
if (errno == ENODEV) {
*name = handle;
return TRUE;
} else {
return FALSE;
}
}
*name = flink.name;
return TRUE;
}