aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index 8e396850513c..41b95ed6dbcd 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -538,8 +538,11 @@ static void vmw_apply_relocations(struct vmw_sw_context *sw_context)
538 reloc = &sw_context->relocs[i]; 538 reloc = &sw_context->relocs[i];
539 validate = &sw_context->val_bufs[reloc->index]; 539 validate = &sw_context->val_bufs[reloc->index];
540 bo = validate->bo; 540 bo = validate->bo;
541 reloc->location->offset += bo->offset; 541 if (bo->mem.mem_type == TTM_PL_VRAM) {
542 reloc->location->gmrId = vmw_dmabuf_gmr(bo); 542 reloc->location->offset += bo->offset;
543 reloc->location->gmrId = SVGA_GMR_FRAMEBUFFER;
544 } else
545 reloc->location->gmrId = bo->mem.start;
543 } 546 }
544 vmw_free_relocations(sw_context); 547 vmw_free_relocations(sw_context);
545} 548}
@@ -563,25 +566,14 @@ static int vmw_validate_single_buffer(struct vmw_private *dev_priv,
563{ 566{
564 int ret; 567 int ret;
565 568
566 if (vmw_dmabuf_gmr(bo) != SVGA_GMR_NULL)
567 return 0;
568
569 /** 569 /**
570 * Put BO in VRAM, only if there is space. 570 * Put BO in VRAM if there is space, otherwise as a GMR.
571 * If there is no space in VRAM and GMR ids are all used up,
572 * start evicting GMRs to make room. If the DMA buffer can't be
573 * used as a GMR, this will return -ENOMEM.
571 */ 574 */
572 575
573 ret = ttm_bo_validate(bo, &vmw_vram_sys_placement, true, false, false); 576 ret = ttm_bo_validate(bo, &vmw_vram_gmr_placement, true, false, false);
574 if (unlikely(ret == -ERESTARTSYS))
575 return ret;
576
577 /**
578 * Otherwise, set it up as GMR.
579 */
580
581 if (vmw_dmabuf_gmr(bo) != SVGA_GMR_NULL)
582 return 0;
583
584 ret = vmw_gmr_bind(dev_priv, bo);
585 if (likely(ret == 0 || ret == -ERESTARTSYS)) 577 if (likely(ret == 0 || ret == -ERESTARTSYS))
586 return ret; 578 return ret;
587 579
@@ -590,6 +582,7 @@ static int vmw_validate_single_buffer(struct vmw_private *dev_priv,
590 * previous contents. 582 * previous contents.
591 */ 583 */
592 584
585 DRM_INFO("Falling through to VRAM.\n");
593 ret = ttm_bo_validate(bo, &vmw_vram_placement, true, false, false); 586 ret = ttm_bo_validate(bo, &vmw_vram_placement, true, false, false);
594 return ret; 587 return ret;
595} 588}
@@ -660,8 +653,7 @@ int vmw_execbuf_ioctl(struct drm_device *dev, void *data,
660 ret = vmw_cmd_check_all(dev_priv, sw_context, cmd, arg->command_size); 653 ret = vmw_cmd_check_all(dev_priv, sw_context, cmd, arg->command_size);
661 if (unlikely(ret != 0)) 654 if (unlikely(ret != 0))
662 goto out_err; 655 goto out_err;
663 ret = ttm_eu_reserve_buffers(&sw_context->validate_nodes, 656 ret = ttm_eu_reserve_buffers(&sw_context->validate_nodes);
664 dev_priv->val_seq++);
665 if (unlikely(ret != 0)) 657 if (unlikely(ret != 0))
666 goto out_err; 658 goto out_err;
667 659
@@ -698,6 +690,7 @@ int vmw_execbuf_ioctl(struct drm_device *dev, void *data,
698 690
699 fence_rep.error = ret; 691 fence_rep.error = ret;
700 fence_rep.fence_seq = (uint64_t) sequence; 692 fence_rep.fence_seq = (uint64_t) sequence;
693 fence_rep.pad64 = 0;
701 694
702 user_fence_rep = (struct drm_vmw_fence_rep __user *) 695 user_fence_rep = (struct drm_vmw_fence_rep __user *)
703 (unsigned long)arg->fence_rep; 696 (unsigned long)arg->fence_rep;