drm/radeon: add a way to revoke hyper-z access
Signed-off-by: Marek Olšák <maraeo@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
c17c2f892e
commit
43861f713c
|
@ -162,13 +162,27 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
case RADEON_INFO_WANT_HYPERZ:
|
case RADEON_INFO_WANT_HYPERZ:
|
||||||
mutex_lock(&dev->struct_mutex);
|
/* The "value" here is both an input and output parameter.
|
||||||
if (rdev->hyperz_filp)
|
* If the input value is 1, filp requests hyper-z access.
|
||||||
value = 0;
|
* If the input value is 0, filp revokes its hyper-z access.
|
||||||
else {
|
*
|
||||||
rdev->hyperz_filp = filp;
|
* When returning, the value is 1 if filp owns hyper-z access,
|
||||||
value = 1;
|
* 0 otherwise. */
|
||||||
|
if (value >= 2) {
|
||||||
|
DRM_DEBUG_KMS("WANT_HYPERZ: invalid value %d\n", value);
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
mutex_lock(&dev->struct_mutex);
|
||||||
|
if (value == 1) {
|
||||||
|
/* wants hyper-z */
|
||||||
|
if (!rdev->hyperz_filp)
|
||||||
|
rdev->hyperz_filp = filp;
|
||||||
|
} else if (value == 0) {
|
||||||
|
/* revokes hyper-z */
|
||||||
|
if (rdev->hyperz_filp == filp)
|
||||||
|
rdev->hyperz_filp = NULL;
|
||||||
|
}
|
||||||
|
value = rdev->hyperz_filp == filp ? 1 : 0;
|
||||||
mutex_unlock(&dev->struct_mutex);
|
mutex_unlock(&dev->struct_mutex);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue