forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/gpu/drm/qxl/qxl_ioctl.c
....@@ -23,6 +23,9 @@
2323 * Alon Levy
2424 */
2525
26
+#include <linux/pci.h>
27
+#include <linux/uaccess.h>
28
+
2629 #include "qxl_drv.h"
2730 #include "qxl_object.h"
2831
....@@ -33,7 +36,7 @@
3336 static int qxl_alloc_ioctl(struct drm_device *dev, void *data,
3437 struct drm_file *file_priv)
3538 {
36
- struct qxl_device *qdev = dev->dev_private;
39
+ struct qxl_device *qdev = to_qxl(dev);
3740 struct drm_qxl_alloc *qxl_alloc = data;
3841 int ret;
3942 struct qxl_bo *qobj;
....@@ -61,7 +64,7 @@
6164 static int qxl_map_ioctl(struct drm_device *dev, void *data,
6265 struct drm_file *file_priv)
6366 {
64
- struct qxl_device *qdev = dev->dev_private;
67
+ struct qxl_device *qdev = to_qxl(dev);
6568 struct drm_qxl_map *qxl_map = data;
6669
6770 return qxl_mode_dumb_mmap(file_priv, &qdev->ddev, qxl_map->handle,
....@@ -85,6 +88,7 @@
8588 apply_reloc(struct qxl_device *qdev, struct qxl_reloc_info *info)
8689 {
8790 void *reloc_page;
91
+
8892 reloc_page = qxl_bo_kmap_atomic_page(qdev, info->dst_bo, info->dst_offset & PAGE_MASK);
8993 *(uint64_t *)(reloc_page + (info->dst_offset & ~PAGE_MASK)) = qxl_bo_physical_address(qdev,
9094 info->src_bo,
....@@ -121,7 +125,7 @@
121125 qobj = gem_to_qxl_bo(gobj);
122126
123127 ret = qxl_release_list_add(release, qobj);
124
- drm_gem_object_put_unlocked(gobj);
128
+ drm_gem_object_put(gobj);
125129 if (ret)
126130 return ret;
127131
....@@ -162,8 +166,7 @@
162166 if (cmd->command_size > PAGE_SIZE - sizeof(union qxl_release_info))
163167 return -EINVAL;
164168
165
- if (!access_ok(VERIFY_READ,
166
- u64_to_user_ptr(cmd->command),
169
+ if (!access_ok(u64_to_user_ptr(cmd->command),
167170 cmd->command_size))
168171 return -EFAULT;
169172
....@@ -189,6 +192,7 @@
189192
190193 {
191194 struct qxl_drawable *draw = fb_cmd;
195
+
192196 draw->mm_time = qdev->rom->mm_clock;
193197 }
194198
....@@ -272,7 +276,7 @@
272276 static int qxl_execbuffer_ioctl(struct drm_device *dev, void *data,
273277 struct drm_file *file_priv)
274278 {
275
- struct qxl_device *qdev = dev->dev_private;
279
+ struct qxl_device *qdev = to_qxl(dev);
276280 struct drm_qxl_execbuffer *execbuffer = data;
277281 struct drm_qxl_command user_cmd;
278282 int cmd_num;
....@@ -297,7 +301,7 @@
297301 static int qxl_update_area_ioctl(struct drm_device *dev, void *data,
298302 struct drm_file *file)
299303 {
300
- struct qxl_device *qdev = dev->dev_private;
304
+ struct qxl_device *qdev = to_qxl(dev);
301305 struct drm_qxl_update_area *update_area = data;
302306 struct qxl_rect area = {.left = update_area->left,
303307 .top = update_area->top,
....@@ -318,7 +322,7 @@
318322
319323 qobj = gem_to_qxl_bo(gobj);
320324
321
- ret = qxl_bo_reserve(qobj, false);
325
+ ret = qxl_bo_reserve(qobj);
322326 if (ret)
323327 goto out;
324328
....@@ -340,14 +344,14 @@
340344 qxl_bo_unreserve(qobj);
341345
342346 out:
343
- drm_gem_object_put_unlocked(gobj);
347
+ drm_gem_object_put(gobj);
344348 return ret;
345349 }
346350
347351 static int qxl_getparam_ioctl(struct drm_device *dev, void *data,
348352 struct drm_file *file_priv)
349353 {
350
- struct qxl_device *qdev = dev->dev_private;
354
+ struct qxl_device *qdev = to_qxl(dev);
351355 struct drm_qxl_getparam *param = data;
352356
353357 switch (param->param) {
....@@ -366,7 +370,7 @@
366370 static int qxl_clientcap_ioctl(struct drm_device *dev, void *data,
367371 struct drm_file *file_priv)
368372 {
369
- struct qxl_device *qdev = dev->dev_private;
373
+ struct qxl_device *qdev = to_qxl(dev);
370374 struct drm_qxl_clientcap *param = data;
371375 int byte, idx;
372376
....@@ -387,7 +391,7 @@
387391 static int qxl_alloc_surf_ioctl(struct drm_device *dev, void *data,
388392 struct drm_file *file)
389393 {
390
- struct qxl_device *qdev = dev->dev_private;
394
+ struct qxl_device *qdev = to_qxl(dev);
391395 struct drm_qxl_alloc_surf *param = data;
392396 struct qxl_bo *qobj;
393397 int handle;