aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hellstrom <[email protected]>2014-02-20 14:32:07 +0100
committerThomas Hellstrom <[email protected]>2014-02-28 11:11:21 +0100
commitf5e681f3fae6b95b76bb068b367f5f96c58073c8 (patch)
tree7558e383ee59dd16d28db6df2233eca24663120d
parent085f61bd4eb4e75c705cc82ce8c2ecacff6b8383 (diff)
winsys/svga: Avoid calling drm getparam for max surface size on older kernels
This avoids the kernel driver spewing out errors about the param not being supported. Also correct the max surface size used when the kernel does not support the query. Reported-by: Brian Paul <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Charmaine Lee <[email protected]> Cc: "10.1" <[email protected]>
-rw-r--r--src/gallium/winsys/svga/drm/vmw_screen_ioctl.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c b/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c
index b7bedb1c26c..2866a29f402 100644
--- a/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c
+++ b/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c
@@ -762,7 +762,7 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws)
int ret;
uint32_t *cap_buffer;
drmVersionPtr version;
- boolean drm_gb_capable;
+ boolean have_drm_2_5;
VMW_FUNC;
@@ -770,7 +770,7 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws)
if (!version)
goto out_no_version;
- drm_gb_capable = version->version_major > 2 ||
+ have_drm_2_5 = version->version_major > 2 ||
(version->version_major == 2 && version->version_minor > 4);
memset(&gp_arg, 0, sizeof(gp_arg));
@@ -803,7 +803,7 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws)
vws->base.have_gb_objects =
!!(gp_arg.value & (uint64_t) SVGA_CAP_GBOBJECTS);
- if (vws->base.have_gb_objects && !drm_gb_capable)
+ if (vws->base.have_gb_objects && !have_drm_2_5)
goto out_no_3d;
if (vws->base.have_gb_objects) {
@@ -839,11 +839,12 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws)
memset(&gp_arg, 0, sizeof(gp_arg));
gp_arg.param = DRM_VMW_PARAM_MAX_SURF_MEMORY;
- ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_GET_PARAM,
- &gp_arg, sizeof(gp_arg));
- if (ret) {
+ if (have_drm_2_5)
+ ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_GET_PARAM,
+ &gp_arg, sizeof(gp_arg));
+ if (!have_drm_2_5 || ret) {
/* Just guess a large enough value, around 800mb. */
- vws->ioctl.max_surface_memory = 0x300000000;
+ vws->ioctl.max_surface_memory = 0x30000000;
} else {
vws->ioctl.max_surface_memory = gp_arg.value;
}