aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index 8e396850513c..51d9f9f1d7f2 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}