diff options
author | Marek Olšák <maraeo@gmail.com> | 2010-08-06 21:36:34 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-08-09 18:20:31 -0400 |
commit | 43861f713c17223cd0fa87dcb57308b7cde7c10a (patch) | |
tree | 2f6a62798d84a1f1b61ec8a2fba9ee06e4c815de /drivers/gpu/drm/radeon | |
parent | c17c2f892e23a3c70281a4e79bd7c2c226b1a561 (diff) |
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>
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_kms.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 948a2f454e42..b1c8ace5f080 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c | |||
@@ -162,13 +162,27 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |||
162 | return -EINVAL; | 162 | return -EINVAL; |
163 | } | 163 | } |
164 | case RADEON_INFO_WANT_HYPERZ: | 164 | case RADEON_INFO_WANT_HYPERZ: |
165 | /* The "value" here is both an input and output parameter. | ||
166 | * If the input value is 1, filp requests hyper-z access. | ||
167 | * If the input value is 0, filp revokes its hyper-z access. | ||
168 | * | ||
169 | * When returning, the value is 1 if filp owns hyper-z access, | ||
170 | * 0 otherwise. */ | ||
171 | if (value >= 2) { | ||
172 | DRM_DEBUG_KMS("WANT_HYPERZ: invalid value %d\n", value); | ||
173 | return -EINVAL; | ||
174 | } | ||
165 | mutex_lock(&dev->struct_mutex); | 175 | mutex_lock(&dev->struct_mutex); |
166 | if (rdev->hyperz_filp) | 176 | if (value == 1) { |
167 | value = 0; | 177 | /* wants hyper-z */ |
168 | else { | 178 | if (!rdev->hyperz_filp) |
169 | rdev->hyperz_filp = filp; | 179 | rdev->hyperz_filp = filp; |
170 | value = 1; | 180 | } else if (value == 0) { |
181 | /* revokes hyper-z */ | ||
182 | if (rdev->hyperz_filp == filp) | ||
183 | rdev->hyperz_filp = NULL; | ||
171 | } | 184 | } |
185 | value = rdev->hyperz_filp == filp ? 1 : 0; | ||
172 | mutex_unlock(&dev->struct_mutex); | 186 | mutex_unlock(&dev->struct_mutex); |
173 | break; | 187 | break; |
174 | default: | 188 | default: |