aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-10 12:59:41 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-10 12:59:41 -0500
commit3e81277a6edd6b568c3a091a372dfe6368697b21 (patch)
treec3a4a2dc72a6b499d8c0f2a962d695bf300960c6
parent1c9dbd4615fd751e5e0b99807a3c7c8612e28e20 (diff)
parent60ccb31bd680469ee0db92b0b6594d79bd13ff87 (diff)
Merge tag 'drm-fixes-for-v4.14-rc9' of git://people.freedesktop.org/~airlied/linux
Pull drm fixes from Dave Airlie: "Last few patches to wrap up. Two i915 fixes that are on their way to stable, one vmware black screen bug, and one const patch that I was going to drop, but it was clearly a pretty safe one liner" * tag 'drm-fixes-for-v4.14-rc9' of git://people.freedesktop.org/~airlied/linux: drm/i915: Deconstruct struct sgt_dma initialiser drm/i915: Reject unknown syncobj flags drm/vmwgfx: Fix Ubuntu 17.10 Wayland black screen issue drm/vmwgfx: constify vmw_fence_ops
-rw-r--r--drivers/gpu/drm/i915/i915_gem_execbuffer.c8
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.c25
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.c2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_fence.c2
-rw-r--r--include/uapi/drm/i915_drm.h1
5 files changed, 20 insertions, 18 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 4ac454ae54d7..83876a1c8d98 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -2094,6 +2094,11 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args,
2094 goto err; 2094 goto err;
2095 } 2095 }
2096 2096
2097 if (fence.flags & __I915_EXEC_FENCE_UNKNOWN_FLAGS) {
2098 err = -EINVAL;
2099 goto err;
2100 }
2101
2097 syncobj = drm_syncobj_find(file, fence.handle); 2102 syncobj = drm_syncobj_find(file, fence.handle);
2098 if (!syncobj) { 2103 if (!syncobj) {
2099 DRM_DEBUG("Invalid syncobj handle provided\n"); 2104 DRM_DEBUG("Invalid syncobj handle provided\n");
@@ -2101,6 +2106,9 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args,
2101 goto err; 2106 goto err;
2102 } 2107 }
2103 2108
2109 BUILD_BUG_ON(~(ARCH_KMALLOC_MINALIGN - 1) &
2110 ~__I915_EXEC_FENCE_UNKNOWN_FLAGS);
2111
2104 fences[n] = ptr_pack_bits(syncobj, fence.flags, 2); 2112 fences[n] = ptr_pack_bits(syncobj, fence.flags, 2);
2105 } 2113 }
2106 2114
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index e2410eb5d96e..ad524cb0f6fc 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -832,10 +832,14 @@ static void gen8_ppgtt_clear_4lvl(struct i915_address_space *vm,
832 } 832 }
833} 833}
834 834
835struct sgt_dma { 835static inline struct sgt_dma {
836 struct scatterlist *sg; 836 struct scatterlist *sg;
837 dma_addr_t dma, max; 837 dma_addr_t dma, max;
838}; 838} sgt_dma(struct i915_vma *vma) {
839 struct scatterlist *sg = vma->pages->sgl;
840 dma_addr_t addr = sg_dma_address(sg);
841 return (struct sgt_dma) { sg, addr, addr + sg->length };
842}
839 843
840struct gen8_insert_pte { 844struct gen8_insert_pte {
841 u16 pml4e; 845 u16 pml4e;
@@ -916,11 +920,7 @@ static void gen8_ppgtt_insert_3lvl(struct i915_address_space *vm,
916 u32 unused) 920 u32 unused)
917{ 921{
918 struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(vm); 922 struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(vm);
919 struct sgt_dma iter = { 923 struct sgt_dma iter = sgt_dma(vma);
920 .sg = vma->pages->sgl,
921 .dma = sg_dma_address(iter.sg),
922 .max = iter.dma + iter.sg->length,
923 };
924 struct gen8_insert_pte idx = gen8_insert_pte(vma->node.start); 924 struct gen8_insert_pte idx = gen8_insert_pte(vma->node.start);
925 925
926 gen8_ppgtt_insert_pte_entries(ppgtt, &ppgtt->pdp, &iter, &idx, 926 gen8_ppgtt_insert_pte_entries(ppgtt, &ppgtt->pdp, &iter, &idx,
@@ -933,11 +933,7 @@ static void gen8_ppgtt_insert_4lvl(struct i915_address_space *vm,
933 u32 unused) 933 u32 unused)
934{ 934{
935 struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(vm); 935 struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(vm);
936 struct sgt_dma iter = { 936 struct sgt_dma iter = sgt_dma(vma);
937 .sg = vma->pages->sgl,
938 .dma = sg_dma_address(iter.sg),
939 .max = iter.dma + iter.sg->length,
940 };
941 struct i915_page_directory_pointer **pdps = ppgtt->pml4.pdps; 937 struct i915_page_directory_pointer **pdps = ppgtt->pml4.pdps;
942 struct gen8_insert_pte idx = gen8_insert_pte(vma->node.start); 938 struct gen8_insert_pte idx = gen8_insert_pte(vma->node.start);
943 939
@@ -1632,13 +1628,10 @@ static void gen6_ppgtt_insert_entries(struct i915_address_space *vm,
1632 unsigned act_pt = first_entry / GEN6_PTES; 1628 unsigned act_pt = first_entry / GEN6_PTES;
1633 unsigned act_pte = first_entry % GEN6_PTES; 1629 unsigned act_pte = first_entry % GEN6_PTES;
1634 const u32 pte_encode = vm->pte_encode(0, cache_level, flags); 1630 const u32 pte_encode = vm->pte_encode(0, cache_level, flags);
1635 struct sgt_dma iter; 1631 struct sgt_dma iter = sgt_dma(vma);
1636 gen6_pte_t *vaddr; 1632 gen6_pte_t *vaddr;
1637 1633
1638 vaddr = kmap_atomic_px(ppgtt->pd.page_table[act_pt]); 1634 vaddr = kmap_atomic_px(ppgtt->pd.page_table[act_pt]);
1639 iter.sg = vma->pages->sgl;
1640 iter.dma = sg_dma_address(iter.sg);
1641 iter.max = iter.dma + iter.sg->length;
1642 do { 1635 do {
1643 vaddr[act_pte] = pte_encode | GEN6_PTE_ADDR_ENCODE(iter.dma); 1636 vaddr[act_pte] = pte_encode | GEN6_PTE_ADDR_ENCODE(iter.dma);
1644 1637
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index e84fee3ec4f3..184340d486c3 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -721,7 +721,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
721 * allocation taken by fbdev 721 * allocation taken by fbdev
722 */ 722 */
723 if (!(dev_priv->capabilities & SVGA_CAP_3D)) 723 if (!(dev_priv->capabilities & SVGA_CAP_3D))
724 mem_size *= 2; 724 mem_size *= 3;
725 725
726 dev_priv->max_mob_pages = mem_size * 1024 / PAGE_SIZE; 726 dev_priv->max_mob_pages = mem_size * 1024 / PAGE_SIZE;
727 dev_priv->prim_bb_mem = 727 dev_priv->prim_bb_mem =
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
index 3bbad22b3748..d6b1c509ae01 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
@@ -224,7 +224,7 @@ out:
224 return ret; 224 return ret;
225} 225}
226 226
227static struct dma_fence_ops vmw_fence_ops = { 227static const struct dma_fence_ops vmw_fence_ops = {
228 .get_driver_name = vmw_fence_get_driver_name, 228 .get_driver_name = vmw_fence_get_driver_name,
229 .get_timeline_name = vmw_fence_get_timeline_name, 229 .get_timeline_name = vmw_fence_get_timeline_name,
230 .enable_signaling = vmw_fence_enable_signaling, 230 .enable_signaling = vmw_fence_enable_signaling,
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 6598fb76d2c2..9816590d3ad2 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -829,6 +829,7 @@ struct drm_i915_gem_exec_fence {
829 829
830#define I915_EXEC_FENCE_WAIT (1<<0) 830#define I915_EXEC_FENCE_WAIT (1<<0)
831#define I915_EXEC_FENCE_SIGNAL (1<<1) 831#define I915_EXEC_FENCE_SIGNAL (1<<1)
832#define __I915_EXEC_FENCE_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SIGNAL << 1))
832 __u32 flags; 833 __u32 flags;
833}; 834};
834 835