drm/vmwgfx: consolidate ttm object creation and populate
Subsystems (3)
Dave Airlie
maintainerPATCH 1/1 drm/vmwgfx: consolidate ttm object creation and populate
From: Dave Airlie <[email protected]>
These two functions has the same code in them, create a common helper function instead.
Signed-off-by Dave Airlie <[email protected]>
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 4 ++ drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | 60 ++-------------------- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 32 ++++++++++++ 3 files changed, 39 insertions(+), 57 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +4 -0
@@ -1023,6 +1023,10 @@ extern int vmw_bo_map_dma(struct ttm_buffer_object *bo);extern void vmw_bo_unmap_dma (struct ttm_buffer_object *bo);extern const struct vmw_sg_table *vmw_bo_sg_table (struct ttm_buffer_object *bo); +extern int vmw_bo_create_and_populate (struct vmw_private *dev_priv, +unsigned long bo_size, +struct ttm_buffer_object **bo_p); +extern void vmw_piter_start (struct vmw_piter *viter,const struct vmw_sg_table *vsgt,unsigned long p_offs);
drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +3 -57
93 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +32 -0
@@ -854,3 +854,35 @@ struct ttm_bo_driver vmw_bo_driver = { .swap_notify = vmw_swap_notify, .io_mem_reserve = &vmw_ttm_io_mem_reserve, }; + +int vmw_bo_create_and_populate (struct vmw_private *dev_priv, +unsigned long bo_size, +struct ttm_buffer_object **bo_p) +{ +struct ttm_operation_ctx ctx = { + .interruptible = false, + .no_wait_gpu = false + }; +struct ttm_buffer_object *bo; +int ret; + + ret =ttm_bo_create (&dev_priv->bdev, bo_size, + ttm_bo_type_device, + &vmw_sys_ne_placement, +0 , false, &bo); + +if (unlikely (ret !=0 )) +return ret; + + ret =ttm_bo_reserve (bo, false, true,NULL ); +BUG_ON (ret !=0 ); + ret = vmw_bo_driver.ttm_tt_populate (bo->ttm, &ctx); +if (likely (ret ==0 )) + ret =vmw_bo_map_dma (bo); + +ttm_bo_unreserve (bo); + +if (likely (ret ==0 )) + *bo_p = bo; +return ret; +}
Signature · 6 lines
2.26.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel