diff options
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | 48 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c | 5 | ||||
-rw-r--r-- | include/drm/vmwgfx_drm.h | 7 |
5 files changed, 5 insertions, 59 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index a99400f10531..39be79619068 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | |||
@@ -411,7 +411,6 @@ extern void vmw_fifo_commit(struct vmw_private *dev_priv, uint32_t bytes); | |||
411 | extern int vmw_fifo_send_fence(struct vmw_private *dev_priv, | 411 | extern int vmw_fifo_send_fence(struct vmw_private *dev_priv, |
412 | uint32_t *sequence); | 412 | uint32_t *sequence); |
413 | extern void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason); | 413 | extern void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason); |
414 | extern int vmw_fifo_mmap(struct file *filp, struct vm_area_struct *vma); | ||
415 | extern bool vmw_fifo_have_3d(struct vmw_private *dev_priv); | 414 | extern bool vmw_fifo_have_3d(struct vmw_private *dev_priv); |
416 | extern bool vmw_fifo_have_pitchlock(struct vmw_private *dev_priv); | 415 | extern bool vmw_fifo_have_pitchlock(struct vmw_private *dev_priv); |
417 | 416 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c index d031c555fa47..aae01b9ae4dc 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | |||
@@ -491,51 +491,3 @@ int vmw_fifo_send_fence(struct vmw_private *dev_priv, uint32_t *sequence) | |||
491 | out_err: | 491 | out_err: |
492 | return ret; | 492 | return ret; |
493 | } | 493 | } |
494 | |||
495 | /** | ||
496 | * Map the first page of the FIFO read-only to user-space. | ||
497 | */ | ||
498 | |||
499 | static int vmw_fifo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | ||
500 | { | ||
501 | int ret; | ||
502 | unsigned long address = (unsigned long)vmf->virtual_address; | ||
503 | |||
504 | if (address != vma->vm_start) | ||
505 | return VM_FAULT_SIGBUS; | ||
506 | |||
507 | ret = vm_insert_pfn(vma, address, vma->vm_pgoff); | ||
508 | if (likely(ret == -EBUSY || ret == 0)) | ||
509 | return VM_FAULT_NOPAGE; | ||
510 | else if (ret == -ENOMEM) | ||
511 | return VM_FAULT_OOM; | ||
512 | |||
513 | return VM_FAULT_SIGBUS; | ||
514 | } | ||
515 | |||
516 | static struct vm_operations_struct vmw_fifo_vm_ops = { | ||
517 | .fault = vmw_fifo_vm_fault, | ||
518 | .open = NULL, | ||
519 | .close = NULL | ||
520 | }; | ||
521 | |||
522 | int vmw_fifo_mmap(struct file *filp, struct vm_area_struct *vma) | ||
523 | { | ||
524 | struct drm_file *file_priv; | ||
525 | struct vmw_private *dev_priv; | ||
526 | |||
527 | file_priv = filp->private_data; | ||
528 | dev_priv = vmw_priv(file_priv->minor->dev); | ||
529 | |||
530 | if (vma->vm_pgoff != (dev_priv->mmio_start >> PAGE_SHIFT) || | ||
531 | (vma->vm_end - vma->vm_start) != PAGE_SIZE) | ||
532 | return -EINVAL; | ||
533 | |||
534 | vma->vm_flags &= ~(VM_WRITE | VM_MAYWRITE); | ||
535 | vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_SHARED; | ||
536 | vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); | ||
537 | vma->vm_page_prot = ttm_io_prot(TTM_PL_FLAG_UNCACHED, | ||
538 | vma->vm_page_prot); | ||
539 | vma->vm_ops = &vmw_fifo_vm_ops; | ||
540 | return 0; | ||
541 | } | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c index f1b9175bee94..74b1dc8a7cdd 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | |||
@@ -45,9 +45,6 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data, | |||
45 | case DRM_VMW_PARAM_3D: | 45 | case DRM_VMW_PARAM_3D: |
46 | param->value = vmw_fifo_have_3d(dev_priv) ? 1 : 0; | 46 | param->value = vmw_fifo_have_3d(dev_priv) ? 1 : 0; |
47 | break; | 47 | break; |
48 | case DRM_VMW_PARAM_FIFO_OFFSET: | ||
49 | param->value = dev_priv->mmio_start; | ||
50 | break; | ||
51 | case DRM_VMW_PARAM_HW_CAPS: | 48 | case DRM_VMW_PARAM_HW_CAPS: |
52 | param->value = dev_priv->capabilities; | 49 | param->value = dev_priv->capabilities; |
53 | break; | 50 | break; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c index 1e8eedd901e0..d3c11f5184f3 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c | |||
@@ -34,9 +34,8 @@ int vmw_mmap(struct file *filp, struct vm_area_struct *vma) | |||
34 | struct vmw_private *dev_priv; | 34 | struct vmw_private *dev_priv; |
35 | 35 | ||
36 | if (unlikely(vma->vm_pgoff < VMWGFX_FILE_PAGE_OFFSET)) { | 36 | if (unlikely(vma->vm_pgoff < VMWGFX_FILE_PAGE_OFFSET)) { |
37 | if (vmw_fifo_mmap(filp, vma) == 0) | 37 | DRM_ERROR("Illegal attempt to mmap old fifo space.\n"); |
38 | return 0; | 38 | return -EINVAL; |
39 | return drm_mmap(filp, vma); | ||
40 | } | 39 | } |
41 | 40 | ||
42 | file_priv = filp->private_data; | 41 | file_priv = filp->private_data; |
diff --git a/include/drm/vmwgfx_drm.h b/include/drm/vmwgfx_drm.h index c0b226bc367b..490db458d5db 100644 --- a/include/drm/vmwgfx_drm.h +++ b/include/drm/vmwgfx_drm.h | |||
@@ -65,10 +65,9 @@ | |||
65 | #define DRM_VMW_PARAM_NUM_STREAMS 0 | 65 | #define DRM_VMW_PARAM_NUM_STREAMS 0 |
66 | #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1 | 66 | #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1 |
67 | #define DRM_VMW_PARAM_3D 2 | 67 | #define DRM_VMW_PARAM_3D 2 |
68 | #define DRM_VMW_PARAM_FIFO_OFFSET 3 | 68 | #define DRM_VMW_PARAM_HW_CAPS 3 |
69 | #define DRM_VMW_PARAM_HW_CAPS 4 | 69 | #define DRM_VMW_PARAM_FIFO_CAPS 4 |
70 | #define DRM_VMW_PARAM_FIFO_CAPS 5 | 70 | #define DRM_VMW_PARAM_MAX_FB_SIZE 5 |
71 | #define DRM_VMW_PARAM_MAX_FB_SIZE 6 | ||
72 | 71 | ||
73 | /** | 72 | /** |
74 | * struct drm_vmw_getparam_arg | 73 | * struct drm_vmw_getparam_arg |