diff options
author | Lepton Wu <[email protected]> | 2018-04-05 12:38:48 -0700 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2018-04-23 12:35:29 +1000 |
commit | 6c5abb68c79d4acf71112b5ba4924a5af2d1e5c9 (patch) | |
tree | 606b1ebdf26afaf59b881640904d050c513bd4d3 | |
parent | a8420e253038fd4ef063af4ee370038075ee7aeb (diff) |
virgl: disable virgl when no 3D for virtio gpu.
If users are running mesa under old version of qemu or have turned off
GL at runtime, virtio gpu driver actually doesn't work. Adds a detection
here so mesa can fall back to software rendering.
v2:
- move detection from loader to virgl (Ilia, Emil)
Signed-off-by: Lepton Wu <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
-rw-r--r-- | src/gallium/winsys/virgl/drm/virgl_drm_winsys.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c index cf3c3bac4b4..4198ed7feb3 100644 --- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c +++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c @@ -800,8 +800,15 @@ virgl_drm_winsys_create(int drmFD) { struct virgl_drm_winsys *qdws; int ret; + int gl = 0; struct drm_virtgpu_getparam getparam = {0}; + getparam.param = VIRTGPU_PARAM_3D_FEATURES; + getparam.value = (uint64_t)(uintptr_t)≷ + ret = drmIoctl(drmFD, DRM_IOCTL_VIRTGPU_GETPARAM, &getparam); + if (ret < 0 || !gl) + return NULL; + qdws = CALLOC_STRUCT(virgl_drm_winsys); if (!qdws) return NULL; @@ -914,6 +921,10 @@ virgl_drm_screen_create(int fd) int dup_fd = fcntl(fd, F_DUPFD_CLOEXEC, 3); vws = virgl_drm_winsys_create(dup_fd); + if (!vws) { + close(dup_fd); + goto unlock; + } pscreen = virgl_create_screen(vws); if (pscreen) { |