Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2008 Advanced Micro Devices, Inc. |
| 3 | * Copyright 2008 Red Hat Inc. |
| 4 | * Copyright 2009 Jerome Glisse. |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * copy of this software and associated documentation files (the "Software"), |
| 8 | * to deal in the Software without restriction, including without limitation |
| 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 10 | * and/or sell copies of the Software, and to permit persons to whom the |
| 11 | * Software is furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in |
| 14 | * all copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 22 | * OTHER DEALINGS IN THE SOFTWARE. |
| 23 | * |
| 24 | * Authors: Dave Airlie |
| 25 | * Alex Deucher |
| 26 | * Jerome Glisse |
| 27 | */ |
| 28 | #include "drmP.h" |
| 29 | #include "drm_sarea.h" |
| 30 | #include "radeon.h" |
| 31 | #include "radeon_drm.h" |
Marek Olšák | 6759a0a | 2012-08-09 16:34:17 +0200 | [diff] [blame] | 32 | #include "radeon_asic.h" |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 33 | |
Dave Airlie | 6a9ee8a | 2010-02-01 15:38:10 +1000 | [diff] [blame] | 34 | #include <linux/vga_switcheroo.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 35 | #include <linux/slab.h> |
Dave Airlie | 6a9ee8a | 2010-02-01 15:38:10 +1000 | [diff] [blame] | 36 | |
Alex Deucher | f482a14 | 2012-07-17 14:02:34 -0400 | [diff] [blame] | 37 | /** |
| 38 | * radeon_driver_unload_kms - Main unload function for KMS. |
| 39 | * |
| 40 | * @dev: drm dev pointer |
| 41 | * |
| 42 | * This is the main unload function for KMS (all asics). |
| 43 | * It calls radeon_modeset_fini() to tear down the |
| 44 | * displays, and radeon_device_fini() to tear down |
| 45 | * the rest of the device (CP, writeback, etc.). |
| 46 | * Returns 0 on success. |
| 47 | */ |
Jerome Glisse | cf0fe45 | 2009-12-09 18:21:55 +0100 | [diff] [blame] | 48 | int radeon_driver_unload_kms(struct drm_device *dev) |
| 49 | { |
| 50 | struct radeon_device *rdev = dev->dev_private; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 51 | |
Jerome Glisse | cf0fe45 | 2009-12-09 18:21:55 +0100 | [diff] [blame] | 52 | if (rdev == NULL) |
| 53 | return 0; |
Alex Deucher | c491707 | 2012-07-31 17:14:35 -0400 | [diff] [blame^] | 54 | radeon_acpi_fini(rdev); |
Jerome Glisse | cf0fe45 | 2009-12-09 18:21:55 +0100 | [diff] [blame] | 55 | radeon_modeset_fini(rdev); |
| 56 | radeon_device_fini(rdev); |
| 57 | kfree(rdev); |
| 58 | dev->dev_private = NULL; |
| 59 | return 0; |
| 60 | } |
| 61 | |
Alex Deucher | f482a14 | 2012-07-17 14:02:34 -0400 | [diff] [blame] | 62 | /** |
| 63 | * radeon_driver_load_kms - Main load function for KMS. |
| 64 | * |
| 65 | * @dev: drm dev pointer |
| 66 | * @flags: device flags |
| 67 | * |
| 68 | * This is the main load function for KMS (all asics). |
| 69 | * It calls radeon_device_init() to set up the non-display |
| 70 | * parts of the chip (asic init, CP, writeback, etc.), and |
| 71 | * radeon_modeset_init() to set up the display parts |
| 72 | * (crtcs, encoders, hotplug detect, etc.). |
| 73 | * Returns 0 on success, error on failure. |
| 74 | */ |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 75 | int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) |
| 76 | { |
| 77 | struct radeon_device *rdev; |
Alberto Milone | d7a2952 | 2010-07-06 11:40:24 -0400 | [diff] [blame] | 78 | int r, acpi_status; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 79 | |
| 80 | rdev = kzalloc(sizeof(struct radeon_device), GFP_KERNEL); |
| 81 | if (rdev == NULL) { |
| 82 | return -ENOMEM; |
| 83 | } |
| 84 | dev->dev_private = (void *)rdev; |
| 85 | |
| 86 | /* update BUS flag */ |
Dave Airlie | 8410ea3 | 2010-12-15 03:16:38 +1000 | [diff] [blame] | 87 | if (drm_pci_device_is_agp(dev)) { |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 88 | flags |= RADEON_IS_AGP; |
Jon Mason | 58b6542 | 2011-06-27 16:07:50 +0000 | [diff] [blame] | 89 | } else if (pci_is_pcie(dev->pdev)) { |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 90 | flags |= RADEON_IS_PCIE; |
| 91 | } else { |
| 92 | flags |= RADEON_IS_PCI; |
| 93 | } |
| 94 | |
Jerome Glisse | 6cf8a3f | 2009-09-10 21:46:48 +0200 | [diff] [blame] | 95 | /* radeon_device_init should report only fatal error |
| 96 | * like memory allocation failure or iomapping failure, |
| 97 | * or memory manager initialization failure, it must |
| 98 | * properly initialize the GPU MC controller and permit |
| 99 | * VRAM allocation |
| 100 | */ |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 101 | r = radeon_device_init(rdev, dev, dev->pdev, flags); |
| 102 | if (r) { |
Jerome Glisse | cf0fe45 | 2009-12-09 18:21:55 +0100 | [diff] [blame] | 103 | dev_err(&dev->pdev->dev, "Fatal error during GPU init\n"); |
| 104 | goto out; |
Jerome Glisse | 6cf8a3f | 2009-09-10 21:46:48 +0200 | [diff] [blame] | 105 | } |
Alberto Milone | d7a2952 | 2010-07-06 11:40:24 -0400 | [diff] [blame] | 106 | |
Jerome Glisse | 6cf8a3f | 2009-09-10 21:46:48 +0200 | [diff] [blame] | 107 | /* Again modeset_init should fail only on fatal error |
| 108 | * otherwise it should provide enough functionalities |
| 109 | * for shadowfb to run |
| 110 | */ |
| 111 | r = radeon_modeset_init(rdev); |
Jerome Glisse | cf0fe45 | 2009-12-09 18:21:55 +0100 | [diff] [blame] | 112 | if (r) |
| 113 | dev_err(&dev->pdev->dev, "Fatal error during modeset init\n"); |
Luca Tettamanti | fda4b25 | 2012-07-30 21:20:35 +0200 | [diff] [blame] | 114 | |
| 115 | /* Call ACPI methods: require modeset init |
| 116 | * but failure is not fatal |
| 117 | */ |
| 118 | if (!r) { |
| 119 | acpi_status = radeon_acpi_init(rdev); |
| 120 | if (acpi_status) |
| 121 | dev_dbg(&dev->pdev->dev, |
| 122 | "Error during ACPI methods call\n"); |
| 123 | } |
| 124 | |
Jerome Glisse | cf0fe45 | 2009-12-09 18:21:55 +0100 | [diff] [blame] | 125 | out: |
| 126 | if (r) |
| 127 | radeon_driver_unload_kms(dev); |
| 128 | return r; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 129 | } |
| 130 | |
Alex Deucher | f482a14 | 2012-07-17 14:02:34 -0400 | [diff] [blame] | 131 | /** |
| 132 | * radeon_set_filp_rights - Set filp right. |
| 133 | * |
| 134 | * @dev: drm dev pointer |
| 135 | * @owner: drm file |
| 136 | * @applier: drm file |
| 137 | * @value: value |
| 138 | * |
| 139 | * Sets the filp rights for the device (all asics). |
| 140 | */ |
Marek Olšák | 9eba4a9 | 2011-01-05 05:46:48 +0100 | [diff] [blame] | 141 | static void radeon_set_filp_rights(struct drm_device *dev, |
| 142 | struct drm_file **owner, |
| 143 | struct drm_file *applier, |
| 144 | uint32_t *value) |
| 145 | { |
| 146 | mutex_lock(&dev->struct_mutex); |
| 147 | if (*value == 1) { |
| 148 | /* wants rights */ |
| 149 | if (!*owner) |
| 150 | *owner = applier; |
| 151 | } else if (*value == 0) { |
| 152 | /* revokes rights */ |
| 153 | if (*owner == applier) |
| 154 | *owner = NULL; |
| 155 | } |
| 156 | *value = *owner == applier ? 1 : 0; |
| 157 | mutex_unlock(&dev->struct_mutex); |
| 158 | } |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 159 | |
| 160 | /* |
Marek Olšák | 9eba4a9 | 2011-01-05 05:46:48 +0100 | [diff] [blame] | 161 | * Userspace get information ioctl |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 162 | */ |
Alex Deucher | f482a14 | 2012-07-17 14:02:34 -0400 | [diff] [blame] | 163 | /** |
| 164 | * radeon_info_ioctl - answer a device specific request. |
| 165 | * |
| 166 | * @rdev: radeon device pointer |
| 167 | * @data: request object |
| 168 | * @filp: drm filp |
| 169 | * |
| 170 | * This function is used to pass device specific parameters to the userspace |
| 171 | * drivers. Examples include: pci device id, pipeline parms, tiling params, |
| 172 | * etc. (all asics). |
| 173 | * Returns 0 on success, -EINVAL on failure. |
| 174 | */ |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 175 | int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) |
| 176 | { |
| 177 | struct radeon_device *rdev = dev->dev_private; |
Marek Olšák | 6759a0a | 2012-08-09 16:34:17 +0200 | [diff] [blame] | 178 | struct drm_radeon_info *info = data; |
Jerome Glisse | bc35afd | 2010-05-12 18:01:13 +0200 | [diff] [blame] | 179 | struct radeon_mode_info *minfo = &rdev->mode_info; |
Marek Olšák | 6759a0a | 2012-08-09 16:34:17 +0200 | [diff] [blame] | 180 | uint32_t value, *value_ptr; |
| 181 | uint64_t value64, *value_ptr64; |
Jerome Glisse | bc35afd | 2010-05-12 18:01:13 +0200 | [diff] [blame] | 182 | struct drm_crtc *crtc; |
| 183 | int i, found; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 184 | |
Marek Olšák | 6759a0a | 2012-08-09 16:34:17 +0200 | [diff] [blame] | 185 | /* TIMESTAMP is a 64-bit value, needs special handling. */ |
| 186 | if (info->request == RADEON_INFO_TIMESTAMP) { |
| 187 | if (rdev->family >= CHIP_R600) { |
| 188 | value_ptr64 = (uint64_t*)((unsigned long)info->value); |
| 189 | if (rdev->family >= CHIP_TAHITI) { |
| 190 | value64 = si_get_gpu_clock(rdev); |
| 191 | } else { |
| 192 | value64 = r600_get_gpu_clock(rdev); |
| 193 | } |
| 194 | |
| 195 | if (DRM_COPY_TO_USER(value_ptr64, &value64, sizeof(value64))) { |
| 196 | DRM_ERROR("copy_to_user %s:%u\n", __func__, __LINE__); |
| 197 | return -EFAULT; |
| 198 | } |
| 199 | return 0; |
| 200 | } else { |
| 201 | DRM_DEBUG_KMS("timestamp is r6xx+ only!\n"); |
| 202 | return -EINVAL; |
| 203 | } |
| 204 | } |
| 205 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 206 | value_ptr = (uint32_t *)((unsigned long)info->value); |
Marek Olšák | 6759a0a | 2012-08-09 16:34:17 +0200 | [diff] [blame] | 207 | if (DRM_COPY_FROM_USER(&value, value_ptr, sizeof(value))) { |
| 208 | DRM_ERROR("copy_from_user %s:%u\n", __func__, __LINE__); |
Dr. David Alan Gilbert | d8ab355 | 2010-08-02 09:43:52 +1000 | [diff] [blame] | 209 | return -EFAULT; |
Marek Olšák | 6759a0a | 2012-08-09 16:34:17 +0200 | [diff] [blame] | 210 | } |
Dr. David Alan Gilbert | d8ab355 | 2010-08-02 09:43:52 +1000 | [diff] [blame] | 211 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 212 | switch (info->request) { |
| 213 | case RADEON_INFO_DEVICE_ID: |
| 214 | value = dev->pci_device; |
| 215 | break; |
| 216 | case RADEON_INFO_NUM_GB_PIPES: |
| 217 | value = rdev->num_gb_pipes; |
| 218 | break; |
Alex Deucher | f779b3e | 2009-08-19 19:11:39 -0400 | [diff] [blame] | 219 | case RADEON_INFO_NUM_Z_PIPES: |
| 220 | value = rdev->num_z_pipes; |
| 221 | break; |
Jerome Glisse | 733289c | 2009-09-16 15:24:21 +0200 | [diff] [blame] | 222 | case RADEON_INFO_ACCEL_WORKING: |
Alex Deucher | 148a03b | 2010-06-03 19:00:03 -0400 | [diff] [blame] | 223 | /* xf86-video-ati 6.13.0 relies on this being false for evergreen */ |
| 224 | if ((rdev->family >= CHIP_CEDAR) && (rdev->family <= CHIP_HEMLOCK)) |
| 225 | value = false; |
| 226 | else |
| 227 | value = rdev->accel_working; |
Jerome Glisse | 733289c | 2009-09-16 15:24:21 +0200 | [diff] [blame] | 228 | break; |
Jerome Glisse | bc35afd | 2010-05-12 18:01:13 +0200 | [diff] [blame] | 229 | case RADEON_INFO_CRTC_FROM_ID: |
| 230 | for (i = 0, found = 0; i < rdev->num_crtc; i++) { |
| 231 | crtc = (struct drm_crtc *)minfo->crtcs[i]; |
| 232 | if (crtc && crtc->base.id == value) { |
Alex Deucher | 0baf2d8 | 2010-07-21 14:05:35 -0400 | [diff] [blame] | 233 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
| 234 | value = radeon_crtc->crtc_id; |
Jerome Glisse | bc35afd | 2010-05-12 18:01:13 +0200 | [diff] [blame] | 235 | found = 1; |
| 236 | break; |
| 237 | } |
| 238 | } |
| 239 | if (!found) { |
Dave Airlie | d9fdaaf | 2010-08-02 10:42:55 +1000 | [diff] [blame] | 240 | DRM_DEBUG_KMS("unknown crtc id %d\n", value); |
Jerome Glisse | bc35afd | 2010-05-12 18:01:13 +0200 | [diff] [blame] | 241 | return -EINVAL; |
| 242 | } |
| 243 | break; |
Alex Deucher | 148a03b | 2010-06-03 19:00:03 -0400 | [diff] [blame] | 244 | case RADEON_INFO_ACCEL_WORKING2: |
| 245 | value = rdev->accel_working; |
| 246 | break; |
Alex Deucher | e7aeeba | 2010-06-04 13:10:12 -0400 | [diff] [blame] | 247 | case RADEON_INFO_TILING_CONFIG: |
Michel Dänzer | c1b2f69 | 2012-03-20 17:18:26 -0400 | [diff] [blame] | 248 | if (rdev->family >= CHIP_TAHITI) |
| 249 | value = rdev->config.si.tile_config; |
| 250 | else if (rdev->family >= CHIP_CAYMAN) |
Alex Deucher | fecf1d0 | 2011-03-02 20:07:29 -0500 | [diff] [blame] | 251 | value = rdev->config.cayman.tile_config; |
| 252 | else if (rdev->family >= CHIP_CEDAR) |
Alex Deucher | e7aeeba | 2010-06-04 13:10:12 -0400 | [diff] [blame] | 253 | value = rdev->config.evergreen.tile_config; |
| 254 | else if (rdev->family >= CHIP_RV770) |
| 255 | value = rdev->config.rv770.tile_config; |
| 256 | else if (rdev->family >= CHIP_R600) |
| 257 | value = rdev->config.r600.tile_config; |
| 258 | else { |
Dave Airlie | d9fdaaf | 2010-08-02 10:42:55 +1000 | [diff] [blame] | 259 | DRM_DEBUG_KMS("tiling config is r6xx+ only!\n"); |
Alex Deucher | e7aeeba | 2010-06-04 13:10:12 -0400 | [diff] [blame] | 260 | return -EINVAL; |
| 261 | } |
Alex Deucher | b824b36 | 2010-08-12 08:25:47 -0400 | [diff] [blame] | 262 | break; |
Dave Airlie | ab9e1f5 | 2010-07-13 11:11:11 +1000 | [diff] [blame] | 263 | case RADEON_INFO_WANT_HYPERZ: |
Marek Olšák | 43861f7 | 2010-08-07 03:36:34 +0200 | [diff] [blame] | 264 | /* The "value" here is both an input and output parameter. |
| 265 | * If the input value is 1, filp requests hyper-z access. |
| 266 | * If the input value is 0, filp revokes its hyper-z access. |
| 267 | * |
| 268 | * When returning, the value is 1 if filp owns hyper-z access, |
| 269 | * 0 otherwise. */ |
| 270 | if (value >= 2) { |
| 271 | DRM_DEBUG_KMS("WANT_HYPERZ: invalid value %d\n", value); |
| 272 | return -EINVAL; |
Dave Airlie | ab9e1f5 | 2010-07-13 11:11:11 +1000 | [diff] [blame] | 273 | } |
Marek Olšák | 9eba4a9 | 2011-01-05 05:46:48 +0100 | [diff] [blame] | 274 | radeon_set_filp_rights(dev, &rdev->hyperz_filp, filp, &value); |
| 275 | break; |
| 276 | case RADEON_INFO_WANT_CMASK: |
| 277 | /* The same logic as Hyper-Z. */ |
| 278 | if (value >= 2) { |
| 279 | DRM_DEBUG_KMS("WANT_CMASK: invalid value %d\n", value); |
| 280 | return -EINVAL; |
Marek Olšák | 43861f7 | 2010-08-07 03:36:34 +0200 | [diff] [blame] | 281 | } |
Marek Olšák | 9eba4a9 | 2011-01-05 05:46:48 +0100 | [diff] [blame] | 282 | radeon_set_filp_rights(dev, &rdev->cmask_filp, filp, &value); |
Alex Deucher | e7aeeba | 2010-06-04 13:10:12 -0400 | [diff] [blame] | 283 | break; |
Alex Deucher | 58bbf01 | 2011-01-24 17:14:26 -0500 | [diff] [blame] | 284 | case RADEON_INFO_CLOCK_CRYSTAL_FREQ: |
| 285 | /* return clock value in KHz */ |
| 286 | value = rdev->clock.spll.reference_freq * 10; |
| 287 | break; |
Dave Airlie | 486af18 | 2011-03-01 14:32:27 +1000 | [diff] [blame] | 288 | case RADEON_INFO_NUM_BACKENDS: |
Michel Dänzer | c1b2f69 | 2012-03-20 17:18:26 -0400 | [diff] [blame] | 289 | if (rdev->family >= CHIP_TAHITI) |
| 290 | value = rdev->config.si.max_backends_per_se * |
| 291 | rdev->config.si.max_shader_engines; |
| 292 | else if (rdev->family >= CHIP_CAYMAN) |
Alex Deucher | fecf1d0 | 2011-03-02 20:07:29 -0500 | [diff] [blame] | 293 | value = rdev->config.cayman.max_backends_per_se * |
| 294 | rdev->config.cayman.max_shader_engines; |
| 295 | else if (rdev->family >= CHIP_CEDAR) |
Dave Airlie | 486af18 | 2011-03-01 14:32:27 +1000 | [diff] [blame] | 296 | value = rdev->config.evergreen.max_backends; |
| 297 | else if (rdev->family >= CHIP_RV770) |
| 298 | value = rdev->config.rv770.max_backends; |
| 299 | else if (rdev->family >= CHIP_R600) |
| 300 | value = rdev->config.r600.max_backends; |
| 301 | else { |
| 302 | return -EINVAL; |
| 303 | } |
| 304 | break; |
Alex Deucher | 6565945 | 2011-04-26 13:27:43 -0400 | [diff] [blame] | 305 | case RADEON_INFO_NUM_TILE_PIPES: |
Michel Dänzer | c1b2f69 | 2012-03-20 17:18:26 -0400 | [diff] [blame] | 306 | if (rdev->family >= CHIP_TAHITI) |
| 307 | value = rdev->config.si.max_tile_pipes; |
| 308 | else if (rdev->family >= CHIP_CAYMAN) |
Alex Deucher | 6565945 | 2011-04-26 13:27:43 -0400 | [diff] [blame] | 309 | value = rdev->config.cayman.max_tile_pipes; |
| 310 | else if (rdev->family >= CHIP_CEDAR) |
| 311 | value = rdev->config.evergreen.max_tile_pipes; |
| 312 | else if (rdev->family >= CHIP_RV770) |
| 313 | value = rdev->config.rv770.max_tile_pipes; |
| 314 | else if (rdev->family >= CHIP_R600) |
| 315 | value = rdev->config.r600.max_tile_pipes; |
| 316 | else { |
| 317 | return -EINVAL; |
| 318 | } |
| 319 | break; |
Alex Deucher | 8aeb96f | 2011-05-03 19:28:02 -0400 | [diff] [blame] | 320 | case RADEON_INFO_FUSION_GART_WORKING: |
| 321 | value = 1; |
| 322 | break; |
Alex Deucher | e55b942 | 2011-07-15 19:53:52 +0000 | [diff] [blame] | 323 | case RADEON_INFO_BACKEND_MAP: |
Michel Dänzer | c1b2f69 | 2012-03-20 17:18:26 -0400 | [diff] [blame] | 324 | if (rdev->family >= CHIP_TAHITI) |
| 325 | value = rdev->config.si.backend_map; |
| 326 | else if (rdev->family >= CHIP_CAYMAN) |
Alex Deucher | e55b942 | 2011-07-15 19:53:52 +0000 | [diff] [blame] | 327 | value = rdev->config.cayman.backend_map; |
| 328 | else if (rdev->family >= CHIP_CEDAR) |
| 329 | value = rdev->config.evergreen.backend_map; |
| 330 | else if (rdev->family >= CHIP_RV770) |
| 331 | value = rdev->config.rv770.backend_map; |
| 332 | else if (rdev->family >= CHIP_R600) |
| 333 | value = rdev->config.r600.backend_map; |
| 334 | else { |
| 335 | return -EINVAL; |
| 336 | } |
| 337 | break; |
Jerome Glisse | 721604a | 2012-01-05 22:11:05 -0500 | [diff] [blame] | 338 | case RADEON_INFO_VA_START: |
| 339 | /* this is where we report if vm is supported or not */ |
| 340 | if (rdev->family < CHIP_CAYMAN) |
| 341 | return -EINVAL; |
| 342 | value = RADEON_VA_RESERVED_SIZE; |
| 343 | break; |
| 344 | case RADEON_INFO_IB_VM_MAX_SIZE: |
| 345 | /* this is where we report if vm is supported or not */ |
| 346 | if (rdev->family < CHIP_CAYMAN) |
| 347 | return -EINVAL; |
| 348 | value = RADEON_IB_VM_MAX_SIZE; |
| 349 | break; |
Tom Stellard | 609c1e1 | 2012-03-20 17:17:55 -0400 | [diff] [blame] | 350 | case RADEON_INFO_MAX_PIPES: |
Michel Dänzer | c1b2f69 | 2012-03-20 17:18:26 -0400 | [diff] [blame] | 351 | if (rdev->family >= CHIP_TAHITI) |
Alex Deucher | 1a8ca75 | 2012-06-01 18:58:22 -0400 | [diff] [blame] | 352 | value = rdev->config.si.max_cu_per_sh; |
Michel Dänzer | c1b2f69 | 2012-03-20 17:18:26 -0400 | [diff] [blame] | 353 | else if (rdev->family >= CHIP_CAYMAN) |
Tom Stellard | 609c1e1 | 2012-03-20 17:17:55 -0400 | [diff] [blame] | 354 | value = rdev->config.cayman.max_pipes_per_simd; |
| 355 | else if (rdev->family >= CHIP_CEDAR) |
| 356 | value = rdev->config.evergreen.max_pipes; |
| 357 | else if (rdev->family >= CHIP_RV770) |
| 358 | value = rdev->config.rv770.max_pipes; |
| 359 | else if (rdev->family >= CHIP_R600) |
| 360 | value = rdev->config.r600.max_pipes; |
| 361 | else { |
| 362 | return -EINVAL; |
| 363 | } |
| 364 | break; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 365 | default: |
Dave Airlie | d9fdaaf | 2010-08-02 10:42:55 +1000 | [diff] [blame] | 366 | DRM_DEBUG_KMS("Invalid request %d\n", info->request); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 367 | return -EINVAL; |
| 368 | } |
| 369 | if (DRM_COPY_TO_USER(value_ptr, &value, sizeof(uint32_t))) { |
Marek Olšák | 6759a0a | 2012-08-09 16:34:17 +0200 | [diff] [blame] | 370 | DRM_ERROR("copy_to_user %s:%u\n", __func__, __LINE__); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 371 | return -EFAULT; |
| 372 | } |
| 373 | return 0; |
| 374 | } |
| 375 | |
| 376 | |
| 377 | /* |
| 378 | * Outdated mess for old drm with Xorg being in charge (void function now). |
| 379 | */ |
Alex Deucher | f482a14 | 2012-07-17 14:02:34 -0400 | [diff] [blame] | 380 | /** |
| 381 | * radeon_driver_firstopen_kms - drm callback for first open |
| 382 | * |
| 383 | * @dev: drm dev pointer |
| 384 | * |
| 385 | * Nothing to be done for KMS (all asics). |
| 386 | * Returns 0 on success. |
| 387 | */ |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 388 | int radeon_driver_firstopen_kms(struct drm_device *dev) |
| 389 | { |
| 390 | return 0; |
| 391 | } |
| 392 | |
Alex Deucher | f482a14 | 2012-07-17 14:02:34 -0400 | [diff] [blame] | 393 | /** |
| 394 | * radeon_driver_firstopen_kms - drm callback for last close |
| 395 | * |
| 396 | * @dev: drm dev pointer |
| 397 | * |
| 398 | * Switch vga switcheroo state after last close (all asics). |
| 399 | */ |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 400 | void radeon_driver_lastclose_kms(struct drm_device *dev) |
| 401 | { |
Dave Airlie | 6a9ee8a | 2010-02-01 15:38:10 +1000 | [diff] [blame] | 402 | vga_switcheroo_process_delayed_switch(); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 403 | } |
| 404 | |
Alex Deucher | f482a14 | 2012-07-17 14:02:34 -0400 | [diff] [blame] | 405 | /** |
| 406 | * radeon_driver_open_kms - drm callback for open |
| 407 | * |
| 408 | * @dev: drm dev pointer |
| 409 | * @file_priv: drm file |
| 410 | * |
| 411 | * On device open, init vm on cayman+ (all asics). |
| 412 | * Returns 0 on success, error on failure. |
| 413 | */ |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 414 | int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) |
| 415 | { |
Jerome Glisse | 721604a | 2012-01-05 22:11:05 -0500 | [diff] [blame] | 416 | struct radeon_device *rdev = dev->dev_private; |
| 417 | |
| 418 | file_priv->driver_priv = NULL; |
| 419 | |
| 420 | /* new gpu have virtual address space support */ |
| 421 | if (rdev->family >= CHIP_CAYMAN) { |
| 422 | struct radeon_fpriv *fpriv; |
| 423 | int r; |
| 424 | |
| 425 | fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL); |
| 426 | if (unlikely(!fpriv)) { |
| 427 | return -ENOMEM; |
| 428 | } |
| 429 | |
| 430 | r = radeon_vm_init(rdev, &fpriv->vm); |
| 431 | if (r) { |
| 432 | radeon_vm_fini(rdev, &fpriv->vm); |
| 433 | kfree(fpriv); |
| 434 | return r; |
| 435 | } |
| 436 | |
| 437 | file_priv->driver_priv = fpriv; |
| 438 | } |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 439 | return 0; |
| 440 | } |
| 441 | |
Alex Deucher | f482a14 | 2012-07-17 14:02:34 -0400 | [diff] [blame] | 442 | /** |
| 443 | * radeon_driver_postclose_kms - drm callback for post close |
| 444 | * |
| 445 | * @dev: drm dev pointer |
| 446 | * @file_priv: drm file |
| 447 | * |
| 448 | * On device post close, tear down vm on cayman+ (all asics). |
| 449 | */ |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 450 | void radeon_driver_postclose_kms(struct drm_device *dev, |
| 451 | struct drm_file *file_priv) |
| 452 | { |
Jerome Glisse | 721604a | 2012-01-05 22:11:05 -0500 | [diff] [blame] | 453 | struct radeon_device *rdev = dev->dev_private; |
| 454 | |
| 455 | /* new gpu have virtual address space support */ |
| 456 | if (rdev->family >= CHIP_CAYMAN && file_priv->driver_priv) { |
| 457 | struct radeon_fpriv *fpriv = file_priv->driver_priv; |
| 458 | |
| 459 | radeon_vm_fini(rdev, &fpriv->vm); |
| 460 | kfree(fpriv); |
| 461 | file_priv->driver_priv = NULL; |
| 462 | } |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 463 | } |
| 464 | |
Alex Deucher | f482a14 | 2012-07-17 14:02:34 -0400 | [diff] [blame] | 465 | /** |
| 466 | * radeon_driver_preclose_kms - drm callback for pre close |
| 467 | * |
| 468 | * @dev: drm dev pointer |
| 469 | * @file_priv: drm file |
| 470 | * |
| 471 | * On device pre close, tear down hyperz and cmask filps on r1xx-r5xx |
| 472 | * (all asics). |
| 473 | */ |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 474 | void radeon_driver_preclose_kms(struct drm_device *dev, |
| 475 | struct drm_file *file_priv) |
| 476 | { |
Dave Airlie | ab9e1f5 | 2010-07-13 11:11:11 +1000 | [diff] [blame] | 477 | struct radeon_device *rdev = dev->dev_private; |
| 478 | if (rdev->hyperz_filp == file_priv) |
| 479 | rdev->hyperz_filp = NULL; |
Marek Olšák | dca0d61 | 2011-01-27 22:46:15 +0100 | [diff] [blame] | 480 | if (rdev->cmask_filp == file_priv) |
| 481 | rdev->cmask_filp = NULL; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 482 | } |
| 483 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 484 | /* |
| 485 | * VBlank related functions. |
| 486 | */ |
Alex Deucher | f482a14 | 2012-07-17 14:02:34 -0400 | [diff] [blame] | 487 | /** |
| 488 | * radeon_get_vblank_counter_kms - get frame count |
| 489 | * |
| 490 | * @dev: drm dev pointer |
| 491 | * @crtc: crtc to get the frame count from |
| 492 | * |
| 493 | * Gets the frame count on the requested crtc (all asics). |
| 494 | * Returns frame count on success, -EINVAL on failure. |
| 495 | */ |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 496 | u32 radeon_get_vblank_counter_kms(struct drm_device *dev, int crtc) |
| 497 | { |
Michel Dänzer | 7ed220d | 2009-08-13 11:10:51 +0200 | [diff] [blame] | 498 | struct radeon_device *rdev = dev->dev_private; |
| 499 | |
Dave Airlie | 9c950a4 | 2010-04-23 13:21:58 +1000 | [diff] [blame] | 500 | if (crtc < 0 || crtc >= rdev->num_crtc) { |
Michel Dänzer | 7ed220d | 2009-08-13 11:10:51 +0200 | [diff] [blame] | 501 | DRM_ERROR("Invalid crtc %d\n", crtc); |
| 502 | return -EINVAL; |
| 503 | } |
| 504 | |
| 505 | return radeon_get_vblank_counter(rdev, crtc); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 506 | } |
| 507 | |
Alex Deucher | f482a14 | 2012-07-17 14:02:34 -0400 | [diff] [blame] | 508 | /** |
| 509 | * radeon_enable_vblank_kms - enable vblank interrupt |
| 510 | * |
| 511 | * @dev: drm dev pointer |
| 512 | * @crtc: crtc to enable vblank interrupt for |
| 513 | * |
| 514 | * Enable the interrupt on the requested crtc (all asics). |
| 515 | * Returns 0 on success, -EINVAL on failure. |
| 516 | */ |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 517 | int radeon_enable_vblank_kms(struct drm_device *dev, int crtc) |
| 518 | { |
Michel Dänzer | 7ed220d | 2009-08-13 11:10:51 +0200 | [diff] [blame] | 519 | struct radeon_device *rdev = dev->dev_private; |
Christian Koenig | fb98257 | 2012-05-17 01:33:30 +0200 | [diff] [blame] | 520 | unsigned long irqflags; |
| 521 | int r; |
Michel Dänzer | 7ed220d | 2009-08-13 11:10:51 +0200 | [diff] [blame] | 522 | |
Dave Airlie | 9c950a4 | 2010-04-23 13:21:58 +1000 | [diff] [blame] | 523 | if (crtc < 0 || crtc >= rdev->num_crtc) { |
Michel Dänzer | 7ed220d | 2009-08-13 11:10:51 +0200 | [diff] [blame] | 524 | DRM_ERROR("Invalid crtc %d\n", crtc); |
| 525 | return -EINVAL; |
| 526 | } |
| 527 | |
Christian Koenig | fb98257 | 2012-05-17 01:33:30 +0200 | [diff] [blame] | 528 | spin_lock_irqsave(&rdev->irq.lock, irqflags); |
Michel Dänzer | 7ed220d | 2009-08-13 11:10:51 +0200 | [diff] [blame] | 529 | rdev->irq.crtc_vblank_int[crtc] = true; |
Christian Koenig | fb98257 | 2012-05-17 01:33:30 +0200 | [diff] [blame] | 530 | r = radeon_irq_set(rdev); |
| 531 | spin_unlock_irqrestore(&rdev->irq.lock, irqflags); |
| 532 | return r; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 533 | } |
| 534 | |
Alex Deucher | f482a14 | 2012-07-17 14:02:34 -0400 | [diff] [blame] | 535 | /** |
| 536 | * radeon_disable_vblank_kms - disable vblank interrupt |
| 537 | * |
| 538 | * @dev: drm dev pointer |
| 539 | * @crtc: crtc to disable vblank interrupt for |
| 540 | * |
| 541 | * Disable the interrupt on the requested crtc (all asics). |
| 542 | */ |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 543 | void radeon_disable_vblank_kms(struct drm_device *dev, int crtc) |
| 544 | { |
Michel Dänzer | 7ed220d | 2009-08-13 11:10:51 +0200 | [diff] [blame] | 545 | struct radeon_device *rdev = dev->dev_private; |
Christian Koenig | fb98257 | 2012-05-17 01:33:30 +0200 | [diff] [blame] | 546 | unsigned long irqflags; |
Michel Dänzer | 7ed220d | 2009-08-13 11:10:51 +0200 | [diff] [blame] | 547 | |
Dave Airlie | 9c950a4 | 2010-04-23 13:21:58 +1000 | [diff] [blame] | 548 | if (crtc < 0 || crtc >= rdev->num_crtc) { |
Michel Dänzer | 7ed220d | 2009-08-13 11:10:51 +0200 | [diff] [blame] | 549 | DRM_ERROR("Invalid crtc %d\n", crtc); |
| 550 | return; |
| 551 | } |
| 552 | |
Christian Koenig | fb98257 | 2012-05-17 01:33:30 +0200 | [diff] [blame] | 553 | spin_lock_irqsave(&rdev->irq.lock, irqflags); |
Michel Dänzer | 7ed220d | 2009-08-13 11:10:51 +0200 | [diff] [blame] | 554 | rdev->irq.crtc_vblank_int[crtc] = false; |
Michel Dänzer | 7ed220d | 2009-08-13 11:10:51 +0200 | [diff] [blame] | 555 | radeon_irq_set(rdev); |
Christian Koenig | fb98257 | 2012-05-17 01:33:30 +0200 | [diff] [blame] | 556 | spin_unlock_irqrestore(&rdev->irq.lock, irqflags); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 557 | } |
| 558 | |
Alex Deucher | f482a14 | 2012-07-17 14:02:34 -0400 | [diff] [blame] | 559 | /** |
| 560 | * radeon_get_vblank_timestamp_kms - get vblank timestamp |
| 561 | * |
| 562 | * @dev: drm dev pointer |
| 563 | * @crtc: crtc to get the timestamp for |
| 564 | * @max_error: max error |
| 565 | * @vblank_time: time value |
| 566 | * @flags: flags passed to the driver |
| 567 | * |
| 568 | * Gets the timestamp on the requested crtc based on the |
| 569 | * scanout position. (all asics). |
| 570 | * Returns postive status flags on success, negative error on failure. |
| 571 | */ |
Mario Kleiner | f5a8020 | 2010-10-23 04:42:17 +0200 | [diff] [blame] | 572 | int radeon_get_vblank_timestamp_kms(struct drm_device *dev, int crtc, |
| 573 | int *max_error, |
| 574 | struct timeval *vblank_time, |
| 575 | unsigned flags) |
| 576 | { |
| 577 | struct drm_crtc *drmcrtc; |
| 578 | struct radeon_device *rdev = dev->dev_private; |
| 579 | |
| 580 | if (crtc < 0 || crtc >= dev->num_crtcs) { |
| 581 | DRM_ERROR("Invalid crtc %d\n", crtc); |
| 582 | return -EINVAL; |
| 583 | } |
| 584 | |
| 585 | /* Get associated drm_crtc: */ |
| 586 | drmcrtc = &rdev->mode_info.crtcs[crtc]->base; |
| 587 | |
| 588 | /* Helper routine in DRM core does all the work: */ |
| 589 | return drm_calc_vbltimestamp_from_scanoutpos(dev, crtc, max_error, |
| 590 | vblank_time, flags, |
| 591 | drmcrtc); |
| 592 | } |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 593 | |
| 594 | /* |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 595 | * IOCTL. |
| 596 | */ |
| 597 | int radeon_dma_ioctl_kms(struct drm_device *dev, void *data, |
| 598 | struct drm_file *file_priv) |
| 599 | { |
| 600 | /* Not valid in KMS. */ |
| 601 | return -EINVAL; |
| 602 | } |
| 603 | |
| 604 | #define KMS_INVALID_IOCTL(name) \ |
| 605 | int name(struct drm_device *dev, void *data, struct drm_file *file_priv)\ |
| 606 | { \ |
| 607 | DRM_ERROR("invalid ioctl with kms %s\n", __func__); \ |
| 608 | return -EINVAL; \ |
| 609 | } |
| 610 | |
| 611 | /* |
| 612 | * All these ioctls are invalid in kms world. |
| 613 | */ |
| 614 | KMS_INVALID_IOCTL(radeon_cp_init_kms) |
| 615 | KMS_INVALID_IOCTL(radeon_cp_start_kms) |
| 616 | KMS_INVALID_IOCTL(radeon_cp_stop_kms) |
| 617 | KMS_INVALID_IOCTL(radeon_cp_reset_kms) |
| 618 | KMS_INVALID_IOCTL(radeon_cp_idle_kms) |
| 619 | KMS_INVALID_IOCTL(radeon_cp_resume_kms) |
| 620 | KMS_INVALID_IOCTL(radeon_engine_reset_kms) |
| 621 | KMS_INVALID_IOCTL(radeon_fullscreen_kms) |
| 622 | KMS_INVALID_IOCTL(radeon_cp_swap_kms) |
| 623 | KMS_INVALID_IOCTL(radeon_cp_clear_kms) |
| 624 | KMS_INVALID_IOCTL(radeon_cp_vertex_kms) |
| 625 | KMS_INVALID_IOCTL(radeon_cp_indices_kms) |
| 626 | KMS_INVALID_IOCTL(radeon_cp_texture_kms) |
| 627 | KMS_INVALID_IOCTL(radeon_cp_stipple_kms) |
| 628 | KMS_INVALID_IOCTL(radeon_cp_indirect_kms) |
| 629 | KMS_INVALID_IOCTL(radeon_cp_vertex2_kms) |
| 630 | KMS_INVALID_IOCTL(radeon_cp_cmdbuf_kms) |
| 631 | KMS_INVALID_IOCTL(radeon_cp_getparam_kms) |
| 632 | KMS_INVALID_IOCTL(radeon_cp_flip_kms) |
| 633 | KMS_INVALID_IOCTL(radeon_mem_alloc_kms) |
| 634 | KMS_INVALID_IOCTL(radeon_mem_free_kms) |
| 635 | KMS_INVALID_IOCTL(radeon_mem_init_heap_kms) |
| 636 | KMS_INVALID_IOCTL(radeon_irq_emit_kms) |
| 637 | KMS_INVALID_IOCTL(radeon_irq_wait_kms) |
| 638 | KMS_INVALID_IOCTL(radeon_cp_setparam_kms) |
| 639 | KMS_INVALID_IOCTL(radeon_surface_alloc_kms) |
| 640 | KMS_INVALID_IOCTL(radeon_surface_free_kms) |
| 641 | |
| 642 | |
| 643 | struct drm_ioctl_desc radeon_ioctls_kms[] = { |
Dave Airlie | 1b2f148 | 2010-08-14 20:20:34 +1000 | [diff] [blame] | 644 | DRM_IOCTL_DEF_DRV(RADEON_CP_INIT, radeon_cp_init_kms, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
| 645 | DRM_IOCTL_DEF_DRV(RADEON_CP_START, radeon_cp_start_kms, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
| 646 | DRM_IOCTL_DEF_DRV(RADEON_CP_STOP, radeon_cp_stop_kms, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
| 647 | DRM_IOCTL_DEF_DRV(RADEON_CP_RESET, radeon_cp_reset_kms, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
| 648 | DRM_IOCTL_DEF_DRV(RADEON_CP_IDLE, radeon_cp_idle_kms, DRM_AUTH), |
| 649 | DRM_IOCTL_DEF_DRV(RADEON_CP_RESUME, radeon_cp_resume_kms, DRM_AUTH), |
| 650 | DRM_IOCTL_DEF_DRV(RADEON_RESET, radeon_engine_reset_kms, DRM_AUTH), |
| 651 | DRM_IOCTL_DEF_DRV(RADEON_FULLSCREEN, radeon_fullscreen_kms, DRM_AUTH), |
| 652 | DRM_IOCTL_DEF_DRV(RADEON_SWAP, radeon_cp_swap_kms, DRM_AUTH), |
| 653 | DRM_IOCTL_DEF_DRV(RADEON_CLEAR, radeon_cp_clear_kms, DRM_AUTH), |
| 654 | DRM_IOCTL_DEF_DRV(RADEON_VERTEX, radeon_cp_vertex_kms, DRM_AUTH), |
| 655 | DRM_IOCTL_DEF_DRV(RADEON_INDICES, radeon_cp_indices_kms, DRM_AUTH), |
| 656 | DRM_IOCTL_DEF_DRV(RADEON_TEXTURE, radeon_cp_texture_kms, DRM_AUTH), |
| 657 | DRM_IOCTL_DEF_DRV(RADEON_STIPPLE, radeon_cp_stipple_kms, DRM_AUTH), |
| 658 | DRM_IOCTL_DEF_DRV(RADEON_INDIRECT, radeon_cp_indirect_kms, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
| 659 | DRM_IOCTL_DEF_DRV(RADEON_VERTEX2, radeon_cp_vertex2_kms, DRM_AUTH), |
| 660 | DRM_IOCTL_DEF_DRV(RADEON_CMDBUF, radeon_cp_cmdbuf_kms, DRM_AUTH), |
| 661 | DRM_IOCTL_DEF_DRV(RADEON_GETPARAM, radeon_cp_getparam_kms, DRM_AUTH), |
| 662 | DRM_IOCTL_DEF_DRV(RADEON_FLIP, radeon_cp_flip_kms, DRM_AUTH), |
| 663 | DRM_IOCTL_DEF_DRV(RADEON_ALLOC, radeon_mem_alloc_kms, DRM_AUTH), |
| 664 | DRM_IOCTL_DEF_DRV(RADEON_FREE, radeon_mem_free_kms, DRM_AUTH), |
| 665 | DRM_IOCTL_DEF_DRV(RADEON_INIT_HEAP, radeon_mem_init_heap_kms, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
| 666 | DRM_IOCTL_DEF_DRV(RADEON_IRQ_EMIT, radeon_irq_emit_kms, DRM_AUTH), |
| 667 | DRM_IOCTL_DEF_DRV(RADEON_IRQ_WAIT, radeon_irq_wait_kms, DRM_AUTH), |
| 668 | DRM_IOCTL_DEF_DRV(RADEON_SETPARAM, radeon_cp_setparam_kms, DRM_AUTH), |
| 669 | DRM_IOCTL_DEF_DRV(RADEON_SURF_ALLOC, radeon_surface_alloc_kms, DRM_AUTH), |
| 670 | DRM_IOCTL_DEF_DRV(RADEON_SURF_FREE, radeon_surface_free_kms, DRM_AUTH), |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 671 | /* KMS */ |
Dave Airlie | 1b2f148 | 2010-08-14 20:20:34 +1000 | [diff] [blame] | 672 | DRM_IOCTL_DEF_DRV(RADEON_GEM_INFO, radeon_gem_info_ioctl, DRM_AUTH|DRM_UNLOCKED), |
| 673 | DRM_IOCTL_DEF_DRV(RADEON_GEM_CREATE, radeon_gem_create_ioctl, DRM_AUTH|DRM_UNLOCKED), |
| 674 | DRM_IOCTL_DEF_DRV(RADEON_GEM_MMAP, radeon_gem_mmap_ioctl, DRM_AUTH|DRM_UNLOCKED), |
| 675 | DRM_IOCTL_DEF_DRV(RADEON_GEM_SET_DOMAIN, radeon_gem_set_domain_ioctl, DRM_AUTH|DRM_UNLOCKED), |
| 676 | DRM_IOCTL_DEF_DRV(RADEON_GEM_PREAD, radeon_gem_pread_ioctl, DRM_AUTH|DRM_UNLOCKED), |
| 677 | DRM_IOCTL_DEF_DRV(RADEON_GEM_PWRITE, radeon_gem_pwrite_ioctl, DRM_AUTH|DRM_UNLOCKED), |
| 678 | DRM_IOCTL_DEF_DRV(RADEON_GEM_WAIT_IDLE, radeon_gem_wait_idle_ioctl, DRM_AUTH|DRM_UNLOCKED), |
| 679 | DRM_IOCTL_DEF_DRV(RADEON_CS, radeon_cs_ioctl, DRM_AUTH|DRM_UNLOCKED), |
| 680 | DRM_IOCTL_DEF_DRV(RADEON_INFO, radeon_info_ioctl, DRM_AUTH|DRM_UNLOCKED), |
| 681 | DRM_IOCTL_DEF_DRV(RADEON_GEM_SET_TILING, radeon_gem_set_tiling_ioctl, DRM_AUTH|DRM_UNLOCKED), |
| 682 | DRM_IOCTL_DEF_DRV(RADEON_GEM_GET_TILING, radeon_gem_get_tiling_ioctl, DRM_AUTH|DRM_UNLOCKED), |
| 683 | DRM_IOCTL_DEF_DRV(RADEON_GEM_BUSY, radeon_gem_busy_ioctl, DRM_AUTH|DRM_UNLOCKED), |
Jerome Glisse | 721604a | 2012-01-05 22:11:05 -0500 | [diff] [blame] | 684 | DRM_IOCTL_DEF_DRV(RADEON_GEM_VA, radeon_gem_va_ioctl, DRM_AUTH|DRM_UNLOCKED), |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 685 | }; |
| 686 | int radeon_max_kms_ioctl = DRM_ARRAY_SIZE(radeon_ioctls_kms); |