summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Versace <chad.versace@intel.com>2016-06-27 11:33:36 -0700
committerChad Versace <chad.versace@intel.com>2016-06-29 13:44:23 -0700
commitd3a147ba401c9a493ddfe4538909dc7a0ef506ef (patch)
tree285c0172cface62a85d8733302af557406b37008
parentb928ff6f62144e20f4260cc1bb897f84b97dc925 (diff)
i965: Use drmIoctl for DRM_I915_GETPARAM (v2)
Stop using drmCommandWriteRead for such a simple ioctl. v2: Handle errno correctly. [ickle] Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index f724a56dbd2c..1c71e09e7ad1 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -972,17 +972,18 @@ static const __DRIextension *intelRobustScreenExtensions[] = {
static int
intel_get_param(struct intel_screen *screen, int param, int *value)
{
- int ret;
+ int ret = 0;
struct drm_i915_getparam gp;
memset(&gp, 0, sizeof(gp));
gp.param = param;
gp.value = value;
- ret = drmCommandWriteRead(screen->driScrnPriv->fd,
- DRM_I915_GETPARAM, &gp, sizeof(gp));
- if (ret < 0 && ret != -EINVAL)
- _mesa_warning(NULL, "drm_i915_getparam: %d", ret);
+ if (drmIoctl(screen->driScrnPriv->fd, DRM_IOCTL_I915_GETPARAM, &gp) == -1) {
+ ret = -errno;
+ if (ret != -EINVAL)
+ _mesa_warning(NULL, "drm_i915_getparam: %d", ret);
+ }
return ret;
}