diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2018-06-20 19:23:48 +0200 |
---|---|---|
committer | Lyude Paul <lyude@redhat.com> | 2018-06-27 15:12:31 -0400 |
commit | 9f02855e7a1b7a3c1e2ee7bfbc73e87c29126920 (patch) | |
tree | 388924a9327af68ce9683c7a15c7d25cdf9f8850 /glamor | |
parent | dc90b1c3c328f1d0b022a234b69ef32bda7ccb01 (diff) |
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>
Diffstat (limited to 'glamor')
-rw-r--r-- | glamor/glamor_egl.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index 5a3b7f193..b33d8ef15 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -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; } |