Commit f1d34bfd authored by Thomas Hellstrom's avatar Thomas Hellstrom

drm/vmwgfx: Replace vmw_dma_buffer with vmw_buffer_object

Initially vmware buffer objects were only used as DMA buffers, so the name
DMA buffer was a natural one. However, currently they are used also as
dumb buffers and MOBs backing guest backed objects so renaming them to
buffer objects is logical. Particularly since there is a dmabuf subsystem
in the kernel where a dma buffer means something completely different.

This also renames user-space api structures and IOCTL names
correspondingly, but the old names remain defined for now and the ABI
hasn't changed.

There are a couple of minor style changes to make checkpatch happy.
Signed-off-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: default avatarSinclair Yeh <syeh@vmware.com>
Reviewed-by: default avatarDeepak Rawat <drawat@vmware.com>
parent 07c13bb7
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \ vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \
vmwgfx_fb.o vmwgfx_ioctl.o vmwgfx_resource.o vmwgfx_buffer.o \ vmwgfx_fb.o vmwgfx_ioctl.o vmwgfx_resource.o vmwgfx_ttm_buffer.o \
vmwgfx_fifo.o vmwgfx_irq.o vmwgfx_ldu.o vmwgfx_ttm_glue.o \ vmwgfx_fifo.o vmwgfx_irq.o vmwgfx_ldu.o vmwgfx_ttm_glue.o \
vmwgfx_overlay.o vmwgfx_marker.o vmwgfx_gmrid_manager.o \ vmwgfx_overlay.o vmwgfx_marker.o vmwgfx_gmrid_manager.o \
vmwgfx_fence.o vmwgfx_dmabuf.o vmwgfx_scrn.o vmwgfx_context.o \ vmwgfx_fence.o vmwgfx_bo.o vmwgfx_scrn.o vmwgfx_context.o \
vmwgfx_surface.o vmwgfx_prime.o vmwgfx_mob.o vmwgfx_shader.o \ vmwgfx_surface.o vmwgfx_prime.o vmwgfx_mob.o vmwgfx_shader.o \
vmwgfx_cmdbuf_res.o vmwgfx_cmdbuf.o vmwgfx_stdu.o \ vmwgfx_cmdbuf_res.o vmwgfx_cmdbuf.o vmwgfx_stdu.o \
vmwgfx_cotable.o vmwgfx_so.o vmwgfx_binding.o vmwgfx_msg.o \ vmwgfx_cotable.o vmwgfx_so.o vmwgfx_binding.o vmwgfx_msg.o \
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
/** /**
* vmw_dmabuf_pin_in_placement - Validate a buffer to placement. * vmw_bo_pin_in_placement - Validate a buffer to placement.
* *
* @dev_priv: Driver private. * @dev_priv: Driver private.
* @buf: DMA buffer to move. * @buf: DMA buffer to move.
...@@ -42,10 +42,10 @@ ...@@ -42,10 +42,10 @@
* Returns * Returns
* -ERESTARTSYS if interrupted by a signal. * -ERESTARTSYS if interrupted by a signal.
*/ */
int vmw_dmabuf_pin_in_placement(struct vmw_private *dev_priv, int vmw_bo_pin_in_placement(struct vmw_private *dev_priv,
struct vmw_dma_buffer *buf, struct vmw_buffer_object *buf,
struct ttm_placement *placement, struct ttm_placement *placement,
bool interruptible) bool interruptible)
{ {
struct ttm_operation_ctx ctx = {interruptible, false }; struct ttm_operation_ctx ctx = {interruptible, false };
struct ttm_buffer_object *bo = &buf->base; struct ttm_buffer_object *bo = &buf->base;
...@@ -79,7 +79,7 @@ int vmw_dmabuf_pin_in_placement(struct vmw_private *dev_priv, ...@@ -79,7 +79,7 @@ int vmw_dmabuf_pin_in_placement(struct vmw_private *dev_priv,
} }
/** /**
* vmw_dmabuf_pin_in_vram_or_gmr - Move a buffer to vram or gmr. * vmw_bo_pin_in_vram_or_gmr - Move a buffer to vram or gmr.
* *
* This function takes the reservation_sem in write mode. * This function takes the reservation_sem in write mode.
* Flushes and unpins the query bo to avoid failures. * Flushes and unpins the query bo to avoid failures.
...@@ -92,9 +92,9 @@ int vmw_dmabuf_pin_in_placement(struct vmw_private *dev_priv, ...@@ -92,9 +92,9 @@ int vmw_dmabuf_pin_in_placement(struct vmw_private *dev_priv,
* Returns * Returns
* -ERESTARTSYS if interrupted by a signal. * -ERESTARTSYS if interrupted by a signal.
*/ */
int vmw_dmabuf_pin_in_vram_or_gmr(struct vmw_private *dev_priv, int vmw_bo_pin_in_vram_or_gmr(struct vmw_private *dev_priv,
struct vmw_dma_buffer *buf, struct vmw_buffer_object *buf,
bool interruptible) bool interruptible)
{ {
struct ttm_operation_ctx ctx = {interruptible, false }; struct ttm_operation_ctx ctx = {interruptible, false };
struct ttm_buffer_object *bo = &buf->base; struct ttm_buffer_object *bo = &buf->base;
...@@ -134,7 +134,7 @@ int vmw_dmabuf_pin_in_vram_or_gmr(struct vmw_private *dev_priv, ...@@ -134,7 +134,7 @@ int vmw_dmabuf_pin_in_vram_or_gmr(struct vmw_private *dev_priv,
} }
/** /**
* vmw_dmabuf_pin_in_vram - Move a buffer to vram. * vmw_bo_pin_in_vram - Move a buffer to vram.
* *
* This function takes the reservation_sem in write mode. * This function takes the reservation_sem in write mode.
* Flushes and unpins the query bo to avoid failures. * Flushes and unpins the query bo to avoid failures.
...@@ -146,16 +146,16 @@ int vmw_dmabuf_pin_in_vram_or_gmr(struct vmw_private *dev_priv, ...@@ -146,16 +146,16 @@ int vmw_dmabuf_pin_in_vram_or_gmr(struct vmw_private *dev_priv,
* Returns * Returns
* -ERESTARTSYS if interrupted by a signal. * -ERESTARTSYS if interrupted by a signal.
*/ */
int vmw_dmabuf_pin_in_vram(struct vmw_private *dev_priv, int vmw_bo_pin_in_vram(struct vmw_private *dev_priv,
struct vmw_dma_buffer *buf, struct vmw_buffer_object *buf,
bool interruptible) bool interruptible)
{ {
return vmw_dmabuf_pin_in_placement(dev_priv, buf, &vmw_vram_placement, return vmw_bo_pin_in_placement(dev_priv, buf, &vmw_vram_placement,
interruptible); interruptible);
} }
/** /**
* vmw_dmabuf_pin_in_start_of_vram - Move a buffer to start of vram. * vmw_bo_pin_in_start_of_vram - Move a buffer to start of vram.
* *
* This function takes the reservation_sem in write mode. * This function takes the reservation_sem in write mode.
* Flushes and unpins the query bo to avoid failures. * Flushes and unpins the query bo to avoid failures.
...@@ -167,9 +167,9 @@ int vmw_dmabuf_pin_in_vram(struct vmw_private *dev_priv, ...@@ -167,9 +167,9 @@ int vmw_dmabuf_pin_in_vram(struct vmw_private *dev_priv,
* Returns * Returns
* -ERESTARTSYS if interrupted by a signal. * -ERESTARTSYS if interrupted by a signal.
*/ */
int vmw_dmabuf_pin_in_start_of_vram(struct vmw_private *dev_priv, int vmw_bo_pin_in_start_of_vram(struct vmw_private *dev_priv,
struct vmw_dma_buffer *buf, struct vmw_buffer_object *buf,
bool interruptible) bool interruptible)
{ {
struct ttm_operation_ctx ctx = {interruptible, false }; struct ttm_operation_ctx ctx = {interruptible, false };
struct ttm_buffer_object *bo = &buf->base; struct ttm_buffer_object *bo = &buf->base;
...@@ -226,7 +226,7 @@ int vmw_dmabuf_pin_in_start_of_vram(struct vmw_private *dev_priv, ...@@ -226,7 +226,7 @@ int vmw_dmabuf_pin_in_start_of_vram(struct vmw_private *dev_priv,
} }
/** /**
* vmw_dmabuf_unpin - Unpin the buffer given buffer, does not move the buffer. * vmw_bo_unpin - Unpin the buffer given buffer, does not move the buffer.
* *
* This function takes the reservation_sem in write mode. * This function takes the reservation_sem in write mode.
* *
...@@ -237,9 +237,9 @@ int vmw_dmabuf_pin_in_start_of_vram(struct vmw_private *dev_priv, ...@@ -237,9 +237,9 @@ int vmw_dmabuf_pin_in_start_of_vram(struct vmw_private *dev_priv,
* Returns * Returns
* -ERESTARTSYS if interrupted by a signal. * -ERESTARTSYS if interrupted by a signal.
*/ */
int vmw_dmabuf_unpin(struct vmw_private *dev_priv, int vmw_bo_unpin(struct vmw_private *dev_priv,
struct vmw_dma_buffer *buf, struct vmw_buffer_object *buf,
bool interruptible) bool interruptible)
{ {
struct ttm_buffer_object *bo = &buf->base; struct ttm_buffer_object *bo = &buf->base;
int ret; int ret;
...@@ -288,7 +288,7 @@ void vmw_bo_get_guest_ptr(const struct ttm_buffer_object *bo, ...@@ -288,7 +288,7 @@ void vmw_bo_get_guest_ptr(const struct ttm_buffer_object *bo,
* @pin: Whether to pin or unpin. * @pin: Whether to pin or unpin.
* *
*/ */
void vmw_bo_pin_reserved(struct vmw_dma_buffer *vbo, bool pin) void vmw_bo_pin_reserved(struct vmw_buffer_object *vbo, bool pin)
{ {
struct ttm_operation_ctx ctx = { false, true }; struct ttm_operation_ctx ctx = { false, true };
struct ttm_place pl; struct ttm_place pl;
...@@ -326,14 +326,14 @@ void vmw_bo_pin_reserved(struct vmw_dma_buffer *vbo, bool pin) ...@@ -326,14 +326,14 @@ void vmw_bo_pin_reserved(struct vmw_dma_buffer *vbo, bool pin)
/* /*
* vmw_dma_buffer_unmap - Tear down a cached buffer object map. * vmw_buffer_object_unmap - Tear down a cached buffer object map.
* *
* @vbo: The buffer object whose map we are tearing down. * @vbo: The buffer object whose map we are tearing down.
* *
* This function tears down a cached map set up using * This function tears down a cached map set up using
* vmw_dma_buffer_map_and_cache(). * vmw_buffer_object_map_and_cache().
*/ */
void vmw_dma_buffer_unmap(struct vmw_dma_buffer *vbo) void vmw_buffer_object_unmap(struct vmw_buffer_object *vbo)
{ {
if (vbo->map.bo == NULL) if (vbo->map.bo == NULL)
return; return;
...@@ -343,7 +343,7 @@ void vmw_dma_buffer_unmap(struct vmw_dma_buffer *vbo) ...@@ -343,7 +343,7 @@ void vmw_dma_buffer_unmap(struct vmw_dma_buffer *vbo)
/* /*
* vmw_dma_buffer_map_and_cache - Map a buffer object and cache the map * vmw_buffer_object_map_and_cache - Map a buffer object and cache the map
* *
* @vbo: The buffer object to map * @vbo: The buffer object to map
* Return: A kernel virtual address or NULL if mapping failed. * Return: A kernel virtual address or NULL if mapping failed.
...@@ -357,7 +357,7 @@ void vmw_dma_buffer_unmap(struct vmw_dma_buffer *vbo) ...@@ -357,7 +357,7 @@ void vmw_dma_buffer_unmap(struct vmw_dma_buffer *vbo)
* 3) Buffer object destruction * 3) Buffer object destruction
* *
*/ */
void *vmw_dma_buffer_map_and_cache(struct vmw_dma_buffer *vbo) void *vmw_buffer_object_map_and_cache(struct vmw_buffer_object *vbo)
{ {
struct ttm_buffer_object *bo = &vbo->base; struct ttm_buffer_object *bo = &vbo->base;
bool not_used; bool not_used;
......
...@@ -38,7 +38,7 @@ struct vmw_user_context { ...@@ -38,7 +38,7 @@ struct vmw_user_context {
struct vmw_cmdbuf_res_manager *man; struct vmw_cmdbuf_res_manager *man;
struct vmw_resource *cotables[SVGA_COTABLE_DX10_MAX]; struct vmw_resource *cotables[SVGA_COTABLE_DX10_MAX];
spinlock_t cotable_lock; spinlock_t cotable_lock;
struct vmw_dma_buffer *dx_query_mob; struct vmw_buffer_object *dx_query_mob;
}; };
static void vmw_user_context_free(struct vmw_resource *res); static void vmw_user_context_free(struct vmw_resource *res);
...@@ -900,7 +900,7 @@ vmw_context_binding_state(struct vmw_resource *ctx) ...@@ -900,7 +900,7 @@ vmw_context_binding_state(struct vmw_resource *ctx)
* specified in the parameter. 0 otherwise. * specified in the parameter. 0 otherwise.
*/ */
int vmw_context_bind_dx_query(struct vmw_resource *ctx_res, int vmw_context_bind_dx_query(struct vmw_resource *ctx_res,
struct vmw_dma_buffer *mob) struct vmw_buffer_object *mob)
{ {
struct vmw_user_context *uctx = struct vmw_user_context *uctx =
container_of(ctx_res, struct vmw_user_context, res); container_of(ctx_res, struct vmw_user_context, res);
...@@ -908,7 +908,7 @@ int vmw_context_bind_dx_query(struct vmw_resource *ctx_res, ...@@ -908,7 +908,7 @@ int vmw_context_bind_dx_query(struct vmw_resource *ctx_res,
if (mob == NULL) { if (mob == NULL) {
if (uctx->dx_query_mob) { if (uctx->dx_query_mob) {
uctx->dx_query_mob->dx_query_ctx = NULL; uctx->dx_query_mob->dx_query_ctx = NULL;
vmw_dmabuf_unreference(&uctx->dx_query_mob); vmw_bo_unreference(&uctx->dx_query_mob);
uctx->dx_query_mob = NULL; uctx->dx_query_mob = NULL;
} }
...@@ -922,7 +922,7 @@ int vmw_context_bind_dx_query(struct vmw_resource *ctx_res, ...@@ -922,7 +922,7 @@ int vmw_context_bind_dx_query(struct vmw_resource *ctx_res,
mob->dx_query_ctx = ctx_res; mob->dx_query_ctx = ctx_res;
if (!uctx->dx_query_mob) if (!uctx->dx_query_mob)
uctx->dx_query_mob = vmw_dmabuf_reference(mob); uctx->dx_query_mob = vmw_bo_reference(mob);
return 0; return 0;
} }
...@@ -932,7 +932,7 @@ int vmw_context_bind_dx_query(struct vmw_resource *ctx_res, ...@@ -932,7 +932,7 @@ int vmw_context_bind_dx_query(struct vmw_resource *ctx_res,
* *
* @ctx_res: The context resource * @ctx_res: The context resource
*/ */
struct vmw_dma_buffer * struct vmw_buffer_object *
vmw_context_get_dx_query_mob(struct vmw_resource *ctx_res) vmw_context_get_dx_query_mob(struct vmw_resource *ctx_res)
{ {
struct vmw_user_context *uctx = struct vmw_user_context *uctx =
......
...@@ -390,7 +390,7 @@ static int vmw_cotable_resize(struct vmw_resource *res, size_t new_size) ...@@ -390,7 +390,7 @@ static int vmw_cotable_resize(struct vmw_resource *res, size_t new_size)
struct ttm_operation_ctx ctx = { false, false }; struct ttm_operation_ctx ctx = { false, false };
struct vmw_private *dev_priv = res->dev_priv; struct vmw_private *dev_priv = res->dev_priv;
struct vmw_cotable *vcotbl = vmw_cotable(res); struct vmw_cotable *vcotbl = vmw_cotable(res);
struct vmw_dma_buffer *buf, *old_buf = res->backup; struct vmw_buffer_object *buf, *old_buf = res->backup;
struct ttm_buffer_object *bo, *old_bo = &res->backup->base; struct ttm_buffer_object *bo, *old_bo = &res->backup->base;
size_t old_size = res->backup_size; size_t old_size = res->backup_size;
size_t old_size_read_back = vcotbl->size_read_back; size_t old_size_read_back = vcotbl->size_read_back;
...@@ -415,8 +415,8 @@ static int vmw_cotable_resize(struct vmw_resource *res, size_t new_size) ...@@ -415,8 +415,8 @@ static int vmw_cotable_resize(struct vmw_resource *res, size_t new_size)
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
ret = vmw_dmabuf_init(dev_priv, buf, new_size, &vmw_mob_ne_placement, ret = vmw_bo_init(dev_priv, buf, new_size, &vmw_mob_ne_placement,
true, vmw_dmabuf_bo_free); true, vmw_bo_bo_free);
if (ret) { if (ret) {
DRM_ERROR("Failed initializing new cotable MOB.\n"); DRM_ERROR("Failed initializing new cotable MOB.\n");
return ret; return ret;
...@@ -482,7 +482,7 @@ static int vmw_cotable_resize(struct vmw_resource *res, size_t new_size) ...@@ -482,7 +482,7 @@ static int vmw_cotable_resize(struct vmw_resource *res, size_t new_size)
/* Let go of the old mob. */ /* Let go of the old mob. */
list_del(&res->mob_head); list_del(&res->mob_head);
list_add_tail(&res->mob_head, &buf->res_list); list_add_tail(&res->mob_head, &buf->res_list);
vmw_dmabuf_unreference(&old_buf); vmw_bo_unreference(&old_buf);
res->id = vcotbl->type; res->id = vcotbl->type;
return 0; return 0;
...@@ -491,7 +491,7 @@ static int vmw_cotable_resize(struct vmw_resource *res, size_t new_size) ...@@ -491,7 +491,7 @@ static int vmw_cotable_resize(struct vmw_resource *res, size_t new_size)
ttm_bo_kunmap(&old_map); ttm_bo_kunmap(&old_map);
out_wait: out_wait:
ttm_bo_unreserve(bo); ttm_bo_unreserve(bo);
vmw_dmabuf_unreference(&buf); vmw_bo_unreference(&buf);
return ret; return ret;
} }
......
...@@ -153,9 +153,9 @@ ...@@ -153,9 +153,9 @@
static const struct drm_ioctl_desc vmw_ioctls[] = { static const struct drm_ioctl_desc vmw_ioctls[] = {
VMW_IOCTL_DEF(VMW_GET_PARAM, vmw_getparam_ioctl, VMW_IOCTL_DEF(VMW_GET_PARAM, vmw_getparam_ioctl,
DRM_AUTH | DRM_RENDER_ALLOW), DRM_AUTH | DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_ALLOC_DMABUF, vmw_dmabuf_alloc_ioctl, VMW_IOCTL_DEF(VMW_ALLOC_DMABUF, vmw_bo_alloc_ioctl,
DRM_AUTH | DRM_RENDER_ALLOW), DRM_AUTH | DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_UNREF_DMABUF, vmw_dmabuf_unref_ioctl, VMW_IOCTL_DEF(VMW_UNREF_DMABUF, vmw_bo_unref_ioctl,
DRM_RENDER_ALLOW), DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_CURSOR_BYPASS, VMW_IOCTL_DEF(VMW_CURSOR_BYPASS,
vmw_kms_cursor_bypass_ioctl, vmw_kms_cursor_bypass_ioctl,
...@@ -219,7 +219,7 @@ static const struct drm_ioctl_desc vmw_ioctls[] = { ...@@ -219,7 +219,7 @@ static const struct drm_ioctl_desc vmw_ioctls[] = {
vmw_gb_surface_reference_ioctl, vmw_gb_surface_reference_ioctl,
DRM_AUTH | DRM_RENDER_ALLOW), DRM_AUTH | DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_SYNCCPU, VMW_IOCTL_DEF(VMW_SYNCCPU,
vmw_user_dmabuf_synccpu_ioctl, vmw_user_bo_synccpu_ioctl,
DRM_RENDER_ALLOW), DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_CREATE_EXTENDED_CONTEXT, VMW_IOCTL_DEF(VMW_CREATE_EXTENDED_CONTEXT,
vmw_extended_context_define_ioctl, vmw_extended_context_define_ioctl,
...@@ -321,7 +321,7 @@ static void vmw_print_capabilities(uint32_t capabilities) ...@@ -321,7 +321,7 @@ static void vmw_print_capabilities(uint32_t capabilities)
static int vmw_dummy_query_bo_create(struct vmw_private *dev_priv) static int vmw_dummy_query_bo_create(struct vmw_private *dev_priv)
{ {
int ret; int ret;
struct vmw_dma_buffer *vbo; struct vmw_buffer_object *vbo;
struct ttm_bo_kmap_obj map; struct ttm_bo_kmap_obj map;
volatile SVGA3dQueryResult *result; volatile SVGA3dQueryResult *result;
bool dummy; bool dummy;
...@@ -335,9 +335,9 @@ static int vmw_dummy_query_bo_create(struct vmw_private *dev_priv) ...@@ -335,9 +335,9 @@ static int vmw_dummy_query_bo_create(struct vmw_private *dev_priv)
if (!vbo) if (!vbo)
return -ENOMEM; return -ENOMEM;
ret = vmw_dmabuf_init(dev_priv, vbo, PAGE_SIZE, ret = vmw_bo_init(dev_priv, vbo, PAGE_SIZE,
&vmw_sys_ne_placement, false, &vmw_sys_ne_placement, false,
&vmw_dmabuf_bo_free); &vmw_bo_bo_free);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
return ret; return ret;
...@@ -358,7 +358,7 @@ static int vmw_dummy_query_bo_create(struct vmw_private *dev_priv) ...@@ -358,7 +358,7 @@ static int vmw_dummy_query_bo_create(struct vmw_private *dev_priv)
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
DRM_ERROR("Dummy query buffer map failed.\n"); DRM_ERROR("Dummy query buffer map failed.\n");
vmw_dmabuf_unreference(&vbo); vmw_bo_unreference(&vbo);
} else } else
dev_priv->dummy_query_bo = vbo; dev_priv->dummy_query_bo = vbo;
...@@ -460,7 +460,7 @@ static void vmw_release_device_early(struct vmw_private *dev_priv) ...@@ -460,7 +460,7 @@ static void vmw_release_device_early(struct vmw_private *dev_priv)
BUG_ON(dev_priv->pinned_bo != NULL); BUG_ON(dev_priv->pinned_bo != NULL);
vmw_dmabuf_unreference(&dev_priv->dummy_query_bo); vmw_bo_unreference(&dev_priv->dummy_query_bo);
if (dev_priv->cman) if (dev_priv->cman)
vmw_cmdbuf_remove_pool(dev_priv->cman); vmw_cmdbuf_remove_pool(dev_priv->cman);
......
...@@ -86,7 +86,7 @@ struct vmw_fpriv { ...@@ -86,7 +86,7 @@ struct vmw_fpriv {
bool gb_aware; bool gb_aware;
}; };
struct vmw_dma_buffer { struct vmw_buffer_object {
struct ttm_buffer_object base; struct ttm_buffer_object base;
struct list_head res_list; struct list_head res_list;
s32 pin_count; s32 pin_count;
...@@ -120,7 +120,7 @@ struct vmw_resource { ...@@ -120,7 +120,7 @@ struct vmw_resource {
unsigned long backup_size; unsigned long backup_size;
bool res_dirty; /* Protected by backup buffer reserved */ bool res_dirty; /* Protected by backup buffer reserved */
bool backup_dirty; /* Protected by backup buffer reserved */ bool backup_dirty; /* Protected by backup buffer reserved */
struct vmw_dma_buffer *backup; struct vmw_buffer_object *backup;
unsigned long backup_offset; unsigned long backup_offset;
unsigned long pin_count; /* Protected by resource reserved */ unsigned long pin_count; /* Protected by resource reserved */
const struct vmw_res_func *func; const struct vmw_res_func *func;
...@@ -304,7 +304,7 @@ struct vmw_sw_context{ ...@@ -304,7 +304,7 @@ struct vmw_sw_context{
uint32_t cmd_bounce_size; uint32_t cmd_bounce_size;
struct list_head resource_list; struct list_head resource_list;
struct list_head ctx_resource_list; /* For contexts and cotables */ struct list_head ctx_resource_list; /* For contexts and cotables */
struct vmw_dma_buffer *cur_query_bo; struct vmw_buffer_object *cur_query_bo;
struct list_head res_relocations; struct list_head res_relocations;
uint32_t *buf_start; uint32_t *buf_start;
struct vmw_res_cache_entry res_cache[vmw_res_max]; struct vmw_res_cache_entry res_cache[vmw_res_max];
...@@ -315,7 +315,7 @@ struct vmw_sw_context{ ...@@ -315,7 +315,7 @@ struct vmw_sw_context{
bool staged_bindings_inuse; bool staged_bindings_inuse;
struct list_head staged_cmd_res; struct list_head staged_cmd_res;
struct vmw_resource_val_node *dx_ctx_node; struct vmw_resource_val_node *dx_ctx_node;
struct vmw_dma_buffer *dx_query_mob; struct vmw_buffer_object *dx_query_mob;
struct vmw_resource *dx_query_ctx; struct vmw_resource *dx_query_ctx;
struct vmw_cmdbuf_res_manager *man; struct vmw_cmdbuf_res_manager *man;
}; };
...@@ -513,8 +513,8 @@ struct vmw_private { ...@@ -513,8 +513,8 @@ struct vmw_private {
* are protected by the cmdbuf mutex. * are protected by the cmdbuf mutex.
*/ */
struct vmw_dma_buffer *dummy_query_bo; struct vmw_buffer_object *dummy_query_bo;
struct vmw_dma_buffer *pinned_bo; struct vmw_buffer_object *pinned_bo;
uint32_t query_cid; uint32_t query_cid;
uint32_t query_cid_valid; uint32_t query_cid_valid;
bool dummy_query_bo_pinned; bool dummy_query_bo_pinned;
...@@ -623,43 +623,43 @@ extern int vmw_user_lookup_handle(struct vmw_private *dev_priv, ...@@ -623,43 +623,43 @@ extern int vmw_user_lookup_handle(struct vmw_private *dev_priv,
struct ttm_object_file *tfile, struct ttm_object_file *tfile,
uint32_t handle, uint32_t handle,
struct vmw_surface **out_surf, struct vmw_surface **out_surf,
struct vmw_dma_buffer **out_buf); struct vmw_buffer_object **out_buf);
extern int vmw_user_resource_lookup_handle( extern int vmw_user_resource_lookup_handle(
struct vmw_private *dev_priv, struct vmw_private *dev_priv,
struct ttm_object_file *tfile, struct ttm_object_file *tfile,
uint32_t handle, uint32_t handle,
const struct vmw_user_resource_conv *converter, const struct vmw_user_resource_conv *converter,
struct vmw_resource **p_res); struct vmw_resource **p_res);
extern void vmw_dmabuf_bo_free(struct ttm_buffer_object *bo); extern void vmw_bo_bo_free(struct ttm_buffer_object *bo);
extern int vmw_dmabuf_init(struct vmw_private *dev_priv, extern int vmw_bo_init(struct vmw_private *dev_priv,
struct vmw_dma_buffer *vmw_bo, struct vmw_buffer_object *vmw_bo,
size_t size, struct ttm_placement *placement, size_t size, struct ttm_placement *placement,
bool interuptable, bool interuptable,
void (*bo_free) (struct ttm_buffer_object *bo)); void (*bo_free)(struct ttm_buffer_object *bo));
extern int vmw_user_dmabuf_verify_access(struct ttm_buffer_object *bo, extern int vmw_user_bo_verify_access(struct ttm_buffer_object *bo,
struct ttm_object_file *tfile); struct ttm_object_file *tfile);
extern int vmw_user_dmabuf_alloc(struct vmw_private *dev_priv, extern int vmw_user_bo_alloc(struct vmw_private *dev_priv,
struct ttm_object_file *tfile, struct ttm_object_file *tfile,
uint32_t size, uint32_t size,
bool shareable, bool shareable,
uint32_t *handle, uint32_t *handle,
struct vmw_dma_buffer **p_dma_buf, struct vmw_buffer_object **p_dma_buf,
struct ttm_base_object **p_base); struct ttm_base_object **p_base);
extern int vmw_user_dmabuf_reference(struct ttm_object_file *tfile, extern int vmw_user_bo_reference(struct ttm_object_file *tfile,
struct vmw_dma_buffer *dma_buf, struct vmw_buffer_object *dma_buf,
uint32_t *handle); uint32_t *handle);
extern int vmw_dmabuf_alloc_ioctl(struct drm_device *dev, void *data, extern int vmw_bo_alloc_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
extern int vmw_dmabuf_unref_ioctl(struct drm_device *dev, void *data, extern int vmw_bo_unref_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
extern int vmw_user_dmabuf_synccpu_ioctl(struct drm_device *dev, void *data, extern int vmw_user_bo_synccpu_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
extern uint32_t vmw_dmabuf_validate_node(struct ttm_buffer_object *bo, extern uint32_t vmw_bo_validate_node(struct ttm_buffer_object *bo,
uint32_t cur_validate_node); uint32_t cur_validate_node);
extern void vmw_dmabuf_validate_clear(struct ttm_buffer_object *bo); extern void vmw_bo_validate_clear(struct ttm_buffer_object *bo);
extern int vmw_user_dmabuf_lookup(struct ttm_object_file *tfile, extern int vmw_user_bo_lookup(struct ttm_object_file *tfile,
uint32_t id, struct vmw_dma_buffer **out, uint32_t id, struct vmw_buffer_object **out,
struct ttm_base_object **base); struct ttm_base_object **base);
extern int vmw_stream_claim_ioctl(struct drm_device *dev, void *data, extern int vmw_stream_claim_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
extern int vmw_stream_unref_ioctl(struct drm_device *dev, void *data, extern int vmw_stream_unref_ioctl(struct drm_device *dev, void *data,
...@@ -670,43 +670,43 @@ extern int vmw_user_stream_lookup(struct vmw_private *dev_priv, ...@@ -670,43 +670,43 @@ extern int vmw_user_stream_lookup(struct vmw_private *dev_priv,
struct vmw_resource **out); struct vmw_resource **out);
extern void vmw_resource_unreserve(struct vmw_resource *res, extern void vmw_resource_unreserve(struct vmw_resource *res,
bool switch_backup, bool switch_backup,
struct vmw_dma_buffer *new_backup, struct vmw_buffer_object *new_backup,
unsigned long new_backup_offset); unsigned long new_backup_offset);
extern void vmw_resource_move_notify(struct ttm_buffer_object *bo, extern void vmw_resource_move_notify(struct ttm_buffer_object *bo,
struct ttm_mem_reg *mem); struct ttm_mem_reg *mem);
extern void vmw_query_move_notify(struct ttm_buffer_object *bo, extern void vmw_query_move_notify(struct ttm_buffer_object *bo,
struct ttm_mem_reg *mem); struct ttm_mem_reg *mem);
extern void vmw_resource_swap_notify(struct ttm_buffer_object *bo); extern void vmw_resource_swap_notify(struct ttm_buffer_object *bo);
extern int vmw_query_readback_all(struct vmw_dma_buffer *dx_query_mob); extern int vmw_query_readback_all(struct vmw_buffer_object *dx_query_mob);
extern void vmw_fence_single_bo(struct ttm_buffer_object *bo, extern void vmw_fence_single_bo(struct ttm_buffer_object *bo,
struct vmw_fence_obj *fence); struct vmw_fence_obj *fence);
extern void vmw_resource_evict_all(struct vmw_private *dev_priv); extern void vmw_resource_evict_all(struct vmw_private *dev_priv);
/** /**
* DMA buffer helper routines - vmwgfx_dmabuf.c * Buffer object helper functions - vmwgfx_bo.c
*/ */
extern int vmw_dmabuf_pin_in_placement(struct vmw_private *vmw_priv, extern int vmw_bo_pin_in_placement(struct vmw_private *vmw_priv,
struct vmw_dma_buffer *bo, struct vmw_buffer_object *bo,
struct ttm_placement *placement, struct ttm_placement *placement,
bool interruptible);
extern int vmw_bo_pin_in_vram(struct vmw_private *dev_priv,
struct vmw_buffer_object *buf,
bool interruptible);
extern int vmw_bo_pin_in_vram_or_gmr(struct vmw_private *dev_priv,
struct vmw_buffer_object *buf,
bool interruptible);
extern int vmw_bo_pin_in_start_of_vram(struct vmw_private *vmw_priv,
struct vmw_buffer_object *bo,
bool interruptible); bool interruptible);
extern int vmw_dmabuf_pin_in_vram(struct vmw_private *dev_priv, extern int vmw_bo_unpin(struct vmw_private *vmw_priv,
struct vmw_dma_buffer *buf, struct vmw_buffer_object *bo,
bool interruptible); bool interruptible);
extern int vmw_dmabuf_pin_in_vram_or_gmr(struct vmw_private *dev_priv,
struct vmw_dma_buffer *buf,
bool interruptible);
extern int vmw_dmabuf_pin_in_start_of_vram(struct vmw_private *vmw_priv,
struct vmw_dma_buffer *bo,
bool interruptible);
extern int vmw_dmabuf_unpin(struct vmw_private *vmw_priv,
struct vmw_dma_buffer *bo,
bool interruptible);
extern void vmw_bo_get_guest_ptr(const struct ttm_buffer_object *buf, extern void vmw_bo_get_guest_ptr(const struct ttm_buffer_object *buf,
SVGAGuestPtr *ptr); SVGAGuestPtr *ptr);
extern void vmw_bo_pin_reserved(struct vmw_dma_buffer *bo, bool pin); extern void vmw_bo_pin_reserved(struct vmw_buffer_object *bo, bool pin);
extern void *vmw_dma_buffer_map_and_cache(struct vmw_dma_buffer *vbo); extern void *vmw_buffer_object_map_and_cache(struct vmw_buffer_object *vbo);
extern void vmw_dma_buffer_unmap(struct vmw_dma_buffer *vbo); extern void vmw_buffer_object_unmap(struct vmw_buffer_object *vbo);
/** /**
* Misc Ioctl functionality - vmwgfx_ioctl.c * Misc Ioctl functionality - vmwgfx_ioctl.c
...@@ -758,7 +758,7 @@ extern void vmw_ttm_global_release(struct vmw_private *dev_priv); ...@@ -758,7 +758,7 @@ extern void vmw_ttm_global_release(struct vmw_private *dev_priv);
extern int vmw_mmap(struct file *filp, struct vm_area_struct *vma); extern int vmw_mmap(struct file *filp, struct vm_area_struct *vma);
/** /**
* TTM buffer object driver - vmwgfx_buffer.c * TTM buffer object driver - vmwgfx_ttm_buffer.c
*/ */
extern const size_t vmw_tt_size; extern const size_t vmw_tt_size;
...@@ -1041,8 +1041,8 @@ vmw_context_binding_state(struct vmw_resource *ctx); ...@@ -1041,8 +1041,8 @@ vmw_context_binding_state(struct vmw_resource *ctx);
extern void vmw_dx_context_scrub_cotables(struct vmw_resource *ctx, extern void vmw_dx_context_scrub_cotables(struct vmw_resource *ctx,
bool readback); bool readback);
extern int vmw_context_bind_dx_query(struct vmw_resource *ctx_res, extern int vmw_context_bind_dx_query(struct vmw_resource *ctx_res,
struct vmw_dma_buffer *mob); struct vmw_buffer_object *mob);
extern struct vmw_dma_buffer * extern struct vmw_buffer_object *
vmw_context_get_dx_query_mob(struct vmw_resource *ctx_res); vmw_context_get_dx_query_mob(struct vmw_resource *ctx_res);
...@@ -1243,9 +1243,9 @@ static inline struct vmw_surface *vmw_surface_reference(struct vmw_surface *srf) ...@@ -1243,9 +1243,9 @@ static inline struct vmw_surface *vmw_surface_reference(struct vmw_surface *srf)
return srf; return srf;
} }
static inline void vmw_dmabuf_unreference(struct vmw_dma_buffer **buf) static inline void vmw_bo_unreference(struct vmw_buffer_object **buf)
{ {
struct vmw_dma_buffer *tmp_buf = *buf; struct vmw_buffer_object *tmp_buf = *buf;
*buf = NULL; *buf = NULL;
if (tmp_buf != NULL) { if (tmp_buf != NULL) {
...@@ -1255,7 +1255,8 @@ static inline void vmw_dmabuf_unreference(struct vmw_dma_buffer **buf) ...@@ -1255,7 +1255,8 @@ static inline void vmw_dmabuf_unreference(struct vmw_dma_buffer **buf)
} }
} }
static inline struct vmw_dma_buffer *vmw_dmabuf_reference(struct vmw_dma_buffer *buf) static inline struct vmw_buffer_object *
vmw_bo_reference(struct vmw_buffer_object *buf)
{ {
if (ttm_bo_reference(&buf->base)) if (ttm_bo_reference(&buf->base))
return buf; return buf;
......
This diff is collapsed.
...@@ -42,7 +42,7 @@ struct vmw_fb_par { ...@@ -42,7 +42,7 @@ struct vmw_fb_par {
void *vmalloc; void *vmalloc;
struct mutex bo_mutex; struct mutex bo_mutex;
struct vmw_dma_buffer *vmw_bo; struct vmw_buffer_object *vmw_bo;
unsigned bo_size; unsigned bo_size;
struct drm_framebuffer *set_fb; struct drm_framebuffer *set_fb;
struct drm_display_mode *set_mode; struct drm_display_mode *set_mode;
...@@ -184,7 +184,7 @@ static void vmw_fb_dirty_flush(struct work_struct *work) ...@@ -184,7 +184,7 @@ static void vmw_fb_dirty_flush(struct work_struct *work)
struct drm_clip_rect clip; struct drm_clip_rect clip;
struct drm_framebuffer *cur_fb; struct drm_framebuffer *cur_fb;
u8 *src_ptr, *dst_ptr; u8 *src_ptr, *dst_ptr;
struct vmw_dma_buffer *vbo = par->vmw_bo; struct vmw_buffer_object *vbo = par->vmw_bo;
void *virtual; void *virtual;
if (!READ_ONCE(par->dirty.active)) if (!READ_ONCE(par->dirty.active))
...@@ -197,7 +197,7 @@ static void vmw_fb_dirty_flush(struct work_struct *work) ...@@ -197,7 +197,7 @@ static void vmw_fb_dirty_flush(struct work_struct *work)
(void) ttm_read_lock(&vmw_priv->reservation_sem, false); (void) ttm_read_lock(&vmw_priv->reservation_sem, false);
(void) ttm_bo_reserve(&vbo->base, false, false, NULL); (void) ttm_bo_reserve(&vbo->base, false, false, NULL);
virtual = vmw_dma_buffer_map_and_cache(vbo); virtual = vmw_buffer_object_map_and_cache(vbo);
if (!virtual) if (!virtual)
goto out_unreserve; goto out_unreserve;
...@@ -391,9 +391,9 @@ static void vmw_fb_imageblit(struct fb_info *info, const struct fb_image *image) ...@@ -391,9 +391,9 @@ static void vmw_fb_imageblit(struct fb_info *info, const struct fb_image *image)
*/ */
static int vmw_fb_create_bo(struct vmw_private *vmw_priv, static int vmw_fb_create_bo(struct vmw_private *vmw_priv,
size_t size, struct vmw_dma_buffer **out) size_t size, struct vmw_buffer_object **out)
{ {
struct vmw_dma_buffer *vmw_bo; struct vmw_buffer_object *vmw_bo;
int ret; int ret;
(void) ttm_write_lock(&vmw_priv->reservation_sem, false); (void) ttm_write_lock(&vmw_priv->reservation_sem, false);
...@@ -404,10 +404,10 @@ static int vmw_fb_create_bo(struct vmw_private *vmw_priv, ...@@ -404,10 +404,10 @@ static int vmw_fb_create_bo(struct vmw_private *vmw_priv,
goto err_unlock; goto err_unlock;
} }
ret = vmw_dmabuf_init(vmw_priv, vmw_bo, size, ret = vmw_bo_init(vmw_priv, vmw_bo, size,
&vmw_sys_placement, &vmw_sys_placement,
false, false,
&vmw_dmabuf_bo_free); &vmw_bo_bo_free);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
goto err_unlock; /* init frees the buffer on failure */ goto err_unlock; /* init frees the buffer on failure */
...@@ -491,7 +491,7 @@ static int vmw_fb_kms_detach(struct vmw_fb_par *par, ...@@ -491,7 +491,7 @@ static int vmw_fb_kms_detach(struct vmw_fb_par *par,
} }
if (par->vmw_bo && detach_bo && unref_bo) if (par->vmw_bo && detach_bo && unref_bo)
vmw_dmabuf_unreference(&par->vmw_bo); vmw_bo_unreference(&par->vmw_bo);
return 0; return 0;
} }
......
...@@ -377,8 +377,8 @@ int vmw_present_readback_ioctl(struct drm_device *dev, void *data, ...@@ -377,8 +377,8 @@ int vmw_present_readback_ioctl(struct drm_device *dev, void *data,
} }
vfb = vmw_framebuffer_to_vfb(fb); vfb = vmw_framebuffer_to_vfb(fb);
if (!vfb->dmabuf) { if (!vfb->bo) {
DRM_ERROR("Framebuffer not dmabuf backed.\n"); DRM_ERROR("Framebuffer not buffer backed.\n");
ret = -EINVAL; ret = -EINVAL;
goto out_no_ttm_lock; goto out_no_ttm_lock;
} }
......
This diff is collapsed.
...@@ -90,7 +90,7 @@ struct vmw_kms_dirty { ...@@ -90,7 +90,7 @@ struct vmw_kms_dirty {
#define vmw_framebuffer_to_vfbs(x) \ #define vmw_framebuffer_to_vfbs(x) \
container_of(x, struct vmw_framebuffer_surface, base.base) container_of(x, struct vmw_framebuffer_surface, base.base)
#define vmw_framebuffer_to_vfbd(x) \ #define vmw_framebuffer_to_vfbd(x) \
container_of(x, struct vmw_framebuffer_dmabuf, base.base) container_of(x, struct vmw_framebuffer_bo, base.base)
/** /**
* Base class for framebuffers * Base class for framebuffers
...@@ -102,7 +102,7 @@ struct vmw_framebuffer { ...@@ -102,7 +102,7 @@ struct vmw_framebuffer {
struct drm_framebuffer base; struct drm_framebuffer base;
int (*pin)(struct vmw_framebuffer *fb); int (*pin)(struct vmw_framebuffer *fb);
int (*unpin)(struct vmw_framebuffer *fb); int (*unpin)(struct vmw_framebuffer *fb);
bool dmabuf; bool bo;
struct ttm_base_object *user_obj; struct ttm_base_object *user_obj;
uint32_t user_handle; uint32_t user_handle;
}; };
...@@ -117,15 +117,15 @@ struct vmw_clip_rect { ...@@ -117,15 +117,15 @@ struct vmw_clip_rect {
struct vmw_framebuffer_surface { struct vmw_framebuffer_surface {
struct vmw_framebuffer base; struct vmw_framebuffer base;
struct vmw_surface *surface; struct vmw_surface *surface;
struct vmw_dma_buffer *buffer; struct vmw_buffer_object *buffer;
struct list_head head; struct list_head head;
bool is_dmabuf_proxy; /* true if this is proxy surface for DMA buf */ bool is_bo_proxy; /* true if this is proxy surface for DMA buf */
}; };
struct vmw_framebuffer_dmabuf { struct vmw_framebuffer_bo {
struct vmw_framebuffer base; struct vmw_framebuffer base;
struct vmw_dma_buffer *buffer; struct vmw_buffer_object *buffer;
}; };
...@@ -161,18 +161,18 @@ struct vmw_crtc_state { ...@@ -161,18 +161,18 @@ struct vmw_crtc_state {
* *
* @base DRM plane object * @base DRM plane object
* @surf Display surface for STDU * @surf Display surface for STDU
* @dmabuf display dmabuf for SOU * @bo display bo for SOU
* @content_fb_type Used by STDU. * @content_fb_type Used by STDU.
* @dmabuf_size Size of the dmabuf, used by Screen Object Display Unit * @bo_size Size of the bo, used by Screen Object Display Unit
* @pinned pin count for STDU display surface * @pinned pin count for STDU display surface
*/ */
struct vmw_plane_state { struct vmw_plane_state {
struct drm_plane_state base; struct drm_plane_state base;
struct vmw_surface *surf; struct vmw_surface *surf;
struct vmw_dma_buffer *dmabuf; struct vmw_buffer_object *bo;
int content_fb_type; int content_fb_type;
unsigned long dmabuf_size; unsigned long bo_size;
int pinned; int pinned;
...@@ -209,7 +209,7 @@ struct vmw_display_unit { ...@@ -209,7 +209,7 @@ struct vmw_display_unit {
struct drm_plane cursor; struct drm_plane cursor;
struct vmw_surface *cursor_surface; struct vmw_surface *cursor_surface;
struct vmw_dma_buffer *cursor_dmabuf; struct vmw_buffer_object *cursor_bo;
size_t cursor_age; size_t cursor_age;
int cursor_x; int cursor_x;
...@@ -243,7 +243,7 @@ struct vmw_display_unit { ...@@ -243,7 +243,7 @@ struct vmw_display_unit {
struct vmw_validation_ctx { struct vmw_validation_ctx {
struct vmw_resource *res; struct vmw_resource *res;
struct vmw_dma_buffer *buf; struct vmw_buffer_object *buf;
}; };
#define vmw_crtc_to_du(x) \ #define vmw_crtc_to_du(x) \
...@@ -291,14 +291,14 @@ int vmw_kms_helper_dirty(struct vmw_private *dev_priv, ...@@ -291,14 +291,14 @@ int vmw_kms_helper_dirty(struct vmw_private *dev_priv,
struct vmw_kms_dirty *dirty); struct vmw_kms_dirty *dirty);
int vmw_kms_helper_buffer_prepare(struct vmw_private *dev_priv, int vmw_kms_helper_buffer_prepare(struct vmw_private *dev_priv,
struct vmw_dma_buffer *buf, struct vmw_buffer_object *buf,
bool interruptible, bool interruptible,
bool validate_as_mob, bool validate_as_mob,
bool for_cpu_blit); bool for_cpu_blit);
void vmw_kms_helper_buffer_revert(struct vmw_dma_buffer *buf); void vmw_kms_helper_buffer_revert(struct vmw_buffer_object *buf);
void vmw_kms_helper_buffer_finish(struct vmw_private *dev_priv, void vmw_kms_helper_buffer_finish(struct vmw_private *dev_priv,
struct drm_file *file_priv, struct drm_file *file_priv,
struct vmw_dma_buffer *buf, struct vmw_buffer_object *buf,
struct vmw_fence_obj **out_fence, struct vmw_fence_obj **out_fence,
struct drm_vmw_fence_rep __user * struct drm_vmw_fence_rep __user *
user_fence_rep); user_fence_rep);
...@@ -316,7 +316,7 @@ int vmw_kms_readback(struct vmw_private *dev_priv, ...@@ -316,7 +316,7 @@ int vmw_kms_readback(struct vmw_private *dev_priv,
uint32_t num_clips); uint32_t num_clips);
struct vmw_framebuffer * struct vmw_framebuffer *
vmw_kms_new_framebuffer(struct vmw_private *dev_priv, vmw_kms_new_framebuffer(struct vmw_private *dev_priv,
struct vmw_dma_buffer *dmabuf, struct vmw_buffer_object *bo,
struct vmw_surface *surface, struct vmw_surface *surface,
bool only_2d, bool only_2d,
const struct drm_mode_fb_cmd2 *mode_cmd); const struct drm_mode_fb_cmd2 *mode_cmd);
...@@ -384,11 +384,11 @@ void vmw_du_connector_destroy_state(struct drm_connector *connector, ...@@ -384,11 +384,11 @@ void vmw_du_connector_destroy_state(struct drm_connector *connector,
*/ */
int vmw_kms_ldu_init_display(struct vmw_private *dev_priv); int vmw_kms_ldu_init_display(struct vmw_private *dev_priv);
int vmw_kms_ldu_close_display(struct vmw_private *dev_priv); int vmw_kms_ldu_close_display(struct vmw_private *dev_priv);
int vmw_kms_ldu_do_dmabuf_dirty(struct vmw_private *dev_priv, int vmw_kms_ldu_do_bo_dirty(struct vmw_private *dev_priv,
struct vmw_framebuffer *framebuffer, struct vmw_framebuffer *framebuffer,
unsigned flags, unsigned color, unsigned int flags, unsigned int color,
struct drm_clip_rect *clips, struct drm_clip_rect *clips,
unsigned num_clips, int increment); unsigned int num_clips, int increment);
int vmw_kms_update_proxy(struct vmw_resource *res, int vmw_kms_update_proxy(struct vmw_resource *res,
const struct drm_clip_rect *clips, const struct drm_clip_rect *clips,
unsigned num_clips, unsigned num_clips,
...@@ -408,14 +408,14 @@ int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv, ...@@ -408,14 +408,14 @@ int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv,
unsigned num_clips, int inc, unsigned num_clips, int inc,
struct vmw_fence_obj **out_fence, struct vmw_fence_obj **out_fence,
struct drm_crtc *crtc); struct drm_crtc *crtc);
int vmw_kms_sou_do_dmabuf_dirty(struct vmw_private *dev_priv, int vmw_kms_sou_do_bo_dirty(struct vmw_private *dev_priv,
struct vmw_framebuffer *framebuffer, struct vmw_framebuffer *framebuffer,
struct drm_clip_rect *clips, struct drm_clip_rect *clips,
struct drm_vmw_rect *vclips, struct drm_vmw_rect *vclips,
unsigned num_clips, int increment, unsigned int num_clips, int increment,
bool interruptible, bool interruptible,
struct vmw_fence_obj **out_fence, struct vmw_fence_obj **out_fence,
struct drm_crtc *crtc); struct drm_crtc *crtc);
int vmw_kms_sou_readback(struct vmw_private *dev_priv, int vmw_kms_sou_readback(struct vmw_private *dev_priv,
struct drm_file *file_priv, struct drm_file *file_priv,
struct vmw_framebuffer *vfb, struct vmw_framebuffer *vfb,
......
...@@ -547,11 +547,11 @@ int vmw_kms_ldu_close_display(struct vmw_private *dev_priv) ...@@ -547,11 +547,11 @@ int vmw_kms_ldu_close_display(struct vmw_private *dev_priv)
} }
int vmw_kms_ldu_do_dmabuf_dirty(struct vmw_private *dev_priv, int vmw_kms_ldu_do_bo_dirty(struct vmw_private *dev_priv,
struct vmw_framebuffer *framebuffer, struct vmw_framebuffer *framebuffer,
unsigned flags, unsigned color, unsigned int flags, unsigned int color,
struct drm_clip_rect *clips, struct drm_clip_rect *clips,
unsigned num_clips, int increment) unsigned int num_clips, int increment)
{ {
size_t fifo_size; size_t fifo_size;
int i; int i;
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#define VMW_OVERLAY_CAP_MASK (SVGA_FIFO_CAP_VIDEO | SVGA_FIFO_CAP_ESCAPE) #define VMW_OVERLAY_CAP_MASK (SVGA_FIFO_CAP_VIDEO | SVGA_FIFO_CAP_ESCAPE)
struct vmw_stream { struct vmw_stream {
struct vmw_dma_buffer *buf; struct vmw_buffer_object *buf;
bool claimed; bool claimed;
bool paused; bool paused;
struct drm_vmw_control_stream_arg saved; struct drm_vmw_control_stream_arg saved;
...@@ -94,7 +94,7 @@ static inline void fill_flush(struct vmw_escape_video_flush *cmd, ...@@ -94,7 +94,7 @@ static inline void fill_flush(struct vmw_escape_video_flush *cmd,
* -ERESTARTSYS if interrupted by a signal. * -ERESTARTSYS if interrupted by a signal.
*/ */
static int vmw_overlay_send_put(struct vmw_private *dev_priv, static int vmw_overlay_send_put(struct vmw_private *dev_priv,
struct vmw_dma_buffer *buf, struct vmw_buffer_object *buf,
struct drm_vmw_control_stream_arg *arg, struct drm_vmw_control_stream_arg *arg,
bool interruptible) bool interruptible)
{ {
...@@ -225,16 +225,16 @@ static int vmw_overlay_send_stop(struct vmw_private *dev_priv, ...@@ -225,16 +225,16 @@ static int vmw_overlay_send_stop(struct vmw_private *dev_priv,
* used with GMRs instead of being locked to vram. * used with GMRs instead of being locked to vram.
*/ */
static int vmw_overlay_move_buffer(struct vmw_private *dev_priv, static int vmw_overlay_move_buffer(struct vmw_private *dev_priv,
struct vmw_dma_buffer *buf, struct vmw_buffer_object *buf,
bool pin, bool inter) bool pin, bool inter)
{ {
if (!pin) if (!pin)
return vmw_dmabuf_unpin(dev_priv, buf, inter); return vmw_bo_unpin(dev_priv, buf, inter);
if (dev_priv->active_display_unit == vmw_du_legacy) if (dev_priv->active_display_unit == vmw_du_legacy)
return vmw_dmabuf_pin_in_vram(dev_priv, buf, inter); return vmw_bo_pin_in_vram(dev_priv, buf, inter);
return vmw_dmabuf_pin_in_vram_or_gmr(dev_priv, buf, inter); return vmw_bo_pin_in_vram_or_gmr(dev_priv, buf, inter);
} }
/** /**
...@@ -278,7 +278,7 @@ static int vmw_overlay_stop(struct vmw_private *dev_priv, ...@@ -278,7 +278,7 @@ static int vmw_overlay_stop(struct vmw_private *dev_priv,
} }
if (!pause) { if (!pause) {
vmw_dmabuf_unreference(&stream->buf); vmw_bo_unreference(&stream->buf);
stream->paused = false; stream->paused = false;
} else { } else {
stream->paused = true; stream->paused = true;
...@@ -297,7 +297,7 @@ static int vmw_overlay_stop(struct vmw_private *dev_priv, ...@@ -297,7 +297,7 @@ static int vmw_overlay_stop(struct vmw_private *dev_priv,
* -ERESTARTSYS if interrupted. * -ERESTARTSYS if interrupted.
*/ */
static int vmw_overlay_update_stream(struct vmw_private *dev_priv, static int vmw_overlay_update_stream(struct vmw_private *dev_priv,
struct vmw_dma_buffer *buf, struct vmw_buffer_object *buf,
struct drm_vmw_control_stream_arg *arg, struct drm_vmw_control_stream_arg *arg,
bool interruptible) bool interruptible)
{ {
...@@ -347,7 +347,7 @@ static int vmw_overlay_update_stream(struct vmw_private *dev_priv, ...@@ -347,7 +347,7 @@ static int vmw_overlay_update_stream(struct vmw_private *dev_priv,
} }
if (stream->buf != buf) if (stream->buf != buf)
stream->buf = vmw_dmabuf_reference(buf); stream->buf = vmw_bo_reference(buf);
stream->saved = *arg; stream->saved = *arg;
/* stream is no longer stopped/paused */ /* stream is no longer stopped/paused */
stream->paused = false; stream->paused = false;
...@@ -466,7 +466,7 @@ int vmw_overlay_ioctl(struct drm_device *dev, void *data, ...@@ -466,7 +466,7 @@ int vmw_overlay_ioctl(struct drm_device *dev, void *data,
struct vmw_overlay *overlay = dev_priv->overlay_priv; struct vmw_overlay *overlay = dev_priv->overlay_priv;
struct drm_vmw_control_stream_arg *arg = struct drm_vmw_control_stream_arg *arg =
(struct drm_vmw_control_stream_arg *)data; (struct drm_vmw_control_stream_arg *)data;
struct vmw_dma_buffer *buf; struct vmw_buffer_object *buf;
struct vmw_resource *res; struct vmw_resource *res;
int ret; int ret;
...@@ -484,13 +484,13 @@ int vmw_overlay_ioctl(struct drm_device *dev, void *data, ...@@ -484,13 +484,13 @@ int vmw_overlay_ioctl(struct drm_device *dev, void *data,
goto out_unlock; goto out_unlock;
} }
ret = vmw_user_dmabuf_lookup(tfile, arg->handle, &buf, NULL); ret = vmw_user_bo_lookup(tfile, arg->handle, &buf, NULL);
if (ret) if (ret)
goto out_unlock; goto out_unlock;
ret = vmw_overlay_update_stream(dev_priv, buf, arg, true); ret = vmw_overlay_update_stream(dev_priv, buf, arg, true);
vmw_dmabuf_unreference(&buf); vmw_bo_unreference(&buf);
out_unlock: out_unlock:
mutex_unlock(&overlay->mutex); mutex_unlock(&overlay->mutex);
......
This diff is collapsed.
...@@ -66,7 +66,7 @@ struct vmw_kms_sou_readback_blit { ...@@ -66,7 +66,7 @@ struct vmw_kms_sou_readback_blit {
SVGAFifoCmdBlitScreenToGMRFB body; SVGAFifoCmdBlitScreenToGMRFB body;
}; };
struct vmw_kms_sou_dmabuf_blit { struct vmw_kms_sou_bo_blit {
uint32 header; uint32 header;
SVGAFifoCmdBlitGMRFBToScreen body; SVGAFifoCmdBlitGMRFBToScreen body;
}; };
...@@ -83,7 +83,7 @@ struct vmw_screen_object_unit { ...@@ -83,7 +83,7 @@ struct vmw_screen_object_unit {
struct vmw_display_unit base; struct vmw_display_unit base;
unsigned long buffer_size; /**< Size of allocated buffer */ unsigned long buffer_size; /**< Size of allocated buffer */
struct vmw_dma_buffer *buffer; /**< Backing store buffer */ struct vmw_buffer_object *buffer; /**< Backing store buffer */
bool defined; bool defined;
}; };
...@@ -240,8 +240,8 @@ static void vmw_sou_crtc_mode_set_nofb(struct drm_crtc *crtc) ...@@ -240,8 +240,8 @@ static void vmw_sou_crtc_mode_set_nofb(struct drm_crtc *crtc)
} }
if (vfb) { if (vfb) {
sou->buffer = vps->dmabuf; sou->buffer = vps->bo;
sou->buffer_size = vps->dmabuf_size; sou->buffer_size = vps->bo_size;
ret = vmw_sou_fifo_create(dev_priv, sou, crtc->x, crtc->y, ret = vmw_sou_fifo_create(dev_priv, sou, crtc->x, crtc->y,
&crtc->mode); &crtc->mode);
...@@ -408,10 +408,10 @@ vmw_sou_primary_plane_cleanup_fb(struct drm_plane *plane, ...@@ -408,10 +408,10 @@ vmw_sou_primary_plane_cleanup_fb(struct drm_plane *plane,
struct drm_crtc *crtc = plane->state->crtc ? struct drm_crtc *crtc = plane->state->crtc ?
plane->state->crtc : old_state->crtc; plane->state->crtc : old_state->crtc;
if (vps->dmabuf) if (vps->bo)
vmw_dmabuf_unpin(vmw_priv(crtc->dev), vps->dmabuf, false); vmw_bo_unpin(vmw_priv(crtc->dev), vps->bo, false);
vmw_dmabuf_unreference(&vps->dmabuf); vmw_bo_unreference(&vps->bo);
vps->dmabuf_size = 0; vps->bo_size = 0;
vmw_du_plane_cleanup_fb(plane, old_state); vmw_du_plane_cleanup_fb(plane, old_state);
} }
...@@ -440,8 +440,8 @@ vmw_sou_primary_plane_prepare_fb(struct drm_plane *plane, ...@@ -440,8 +440,8 @@ vmw_sou_primary_plane_prepare_fb(struct drm_plane *plane,
if (!new_fb) { if (!new_fb) {
vmw_dmabuf_unreference(&vps->dmabuf); vmw_bo_unreference(&vps->bo);
vps->dmabuf_size = 0; vps->bo_size = 0;
return 0; return 0;
} }
...@@ -449,22 +449,22 @@ vmw_sou_primary_plane_prepare_fb(struct drm_plane *plane, ...@@ -449,22 +449,22 @@ vmw_sou_primary_plane_prepare_fb(struct drm_plane *plane,
size = new_state->crtc_w * new_state->crtc_h * 4; size = new_state->crtc_w * new_state->crtc_h * 4;
dev_priv = vmw_priv(crtc->dev); dev_priv = vmw_priv(crtc->dev);
if (vps->dmabuf) { if (vps->bo) {
if (vps->dmabuf_size == size) { if (vps->bo_size == size) {
/* /*
* Note that this might temporarily up the pin-count * Note that this might temporarily up the pin-count
* to 2, until cleanup_fb() is called. * to 2, until cleanup_fb() is called.
*/ */
return vmw_dmabuf_pin_in_vram(dev_priv, vps->dmabuf, return vmw_bo_pin_in_vram(dev_priv, vps->bo,
true); true);
} }
vmw_dmabuf_unreference(&vps->dmabuf); vmw_bo_unreference(&vps->bo);
vps->dmabuf_size = 0; vps->bo_size = 0;
} }
vps->dmabuf = kzalloc(sizeof(*vps->dmabuf), GFP_KERNEL); vps->bo = kzalloc(sizeof(*vps->bo), GFP_KERNEL);
if (!vps->dmabuf) if (!vps->bo)
return -ENOMEM; return -ENOMEM;
vmw_svga_enable(dev_priv); vmw_svga_enable(dev_priv);
...@@ -473,22 +473,22 @@ vmw_sou_primary_plane_prepare_fb(struct drm_plane *plane, ...@@ -473,22 +473,22 @@ vmw_sou_primary_plane_prepare_fb(struct drm_plane *plane,
* resume the overlays, this is preferred to failing to alloc. * resume the overlays, this is preferred to failing to alloc.
*/ */
vmw_overlay_pause_all(dev_priv); vmw_overlay_pause_all(dev_priv);
ret = vmw_dmabuf_init(dev_priv, vps->dmabuf, size, ret = vmw_bo_init(dev_priv, vps->bo, size,
&vmw_vram_ne_placement, &vmw_vram_ne_placement,
false, &vmw_dmabuf_bo_free); false, &vmw_bo_bo_free);
vmw_overlay_resume_all(dev_priv); vmw_overlay_resume_all(dev_priv);
if (ret) { if (ret) {
vps->dmabuf = NULL; /* vmw_dmabuf_init frees on error */ vps->bo = NULL; /* vmw_bo_init frees on error */
return ret; return ret;
} }
vps->dmabuf_size = size; vps->bo_size = size;
/* /*
* TTM already thinks the buffer is pinned, but make sure the * TTM already thinks the buffer is pinned, but make sure the
* pin_count is upped. * pin_count is upped.
*/ */
return vmw_dmabuf_pin_in_vram(dev_priv, vps->dmabuf, true); return vmw_bo_pin_in_vram(dev_priv, vps->bo, true);
} }
...@@ -512,10 +512,10 @@ vmw_sou_primary_plane_atomic_update(struct drm_plane *plane, ...@@ -512,10 +512,10 @@ vmw_sou_primary_plane_atomic_update(struct drm_plane *plane,
vclips.w = crtc->mode.hdisplay; vclips.w = crtc->mode.hdisplay;
vclips.h = crtc->mode.vdisplay; vclips.h = crtc->mode.vdisplay;
if (vfb->dmabuf) if (vfb->bo)
ret = vmw_kms_sou_do_dmabuf_dirty(dev_priv, vfb, NULL, ret = vmw_kms_sou_do_bo_dirty(dev_priv, vfb, NULL,
&vclips, 1, 1, true, &vclips, 1, 1, true,
&fence, crtc); &fence, crtc);
else else
ret = vmw_kms_sou_do_surface_dirty(dev_priv, vfb, NULL, ret = vmw_kms_sou_do_surface_dirty(dev_priv, vfb, NULL,
&vclips, NULL, 0, 0, &vclips, NULL, 0, 0,
...@@ -775,11 +775,11 @@ int vmw_kms_sou_init_display(struct vmw_private *dev_priv) ...@@ -775,11 +775,11 @@ int vmw_kms_sou_init_display(struct vmw_private *dev_priv)
return 0; return 0;
} }
static int do_dmabuf_define_gmrfb(struct vmw_private *dev_priv, static int do_bo_define_gmrfb(struct vmw_private *dev_priv,
struct vmw_framebuffer *framebuffer) struct vmw_framebuffer *framebuffer)
{ {
struct vmw_dma_buffer *buf = struct vmw_buffer_object *buf =
container_of(framebuffer, struct vmw_framebuffer_dmabuf, container_of(framebuffer, struct vmw_framebuffer_bo,
base)->buffer; base)->buffer;
int depth = framebuffer->base.format->depth; int depth = framebuffer->base.format->depth;
struct { struct {
...@@ -970,13 +970,13 @@ int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv, ...@@ -970,13 +970,13 @@ int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv,
} }
/** /**
* vmw_sou_dmabuf_fifo_commit - Callback to submit a set of readback clips. * vmw_sou_bo_fifo_commit - Callback to submit a set of readback clips.
* *
* @dirty: The closure structure. * @dirty: The closure structure.
* *
* Commits a previously built command buffer of readback clips. * Commits a previously built command buffer of readback clips.
*/ */
static void vmw_sou_dmabuf_fifo_commit(struct vmw_kms_dirty *dirty) static void vmw_sou_bo_fifo_commit(struct vmw_kms_dirty *dirty)
{ {
if (!dirty->num_hits) { if (!dirty->num_hits) {
vmw_fifo_commit(dirty->dev_priv, 0); vmw_fifo_commit(dirty->dev_priv, 0);
...@@ -984,20 +984,20 @@ static void vmw_sou_dmabuf_fifo_commit(struct vmw_kms_dirty *dirty) ...@@ -984,20 +984,20 @@ static void vmw_sou_dmabuf_fifo_commit(struct vmw_kms_dirty *dirty)
} }
vmw_fifo_commit(dirty->dev_priv, vmw_fifo_commit(dirty->dev_priv,
sizeof(struct vmw_kms_sou_dmabuf_blit) * sizeof(struct vmw_kms_sou_bo_blit) *
dirty->num_hits); dirty->num_hits);
} }
/** /**
* vmw_sou_dmabuf_clip - Callback to encode a readback cliprect. * vmw_sou_bo_clip - Callback to encode a readback cliprect.
* *
* @dirty: The closure structure * @dirty: The closure structure
* *
* Encodes a BLIT_GMRFB_TO_SCREEN cliprect. * Encodes a BLIT_GMRFB_TO_SCREEN cliprect.
*/ */
static void vmw_sou_dmabuf_clip(struct vmw_kms_dirty *dirty) static void vmw_sou_bo_clip(struct vmw_kms_dirty *dirty)
{ {
struct vmw_kms_sou_dmabuf_blit *blit = dirty->cmd; struct vmw_kms_sou_bo_blit *blit = dirty->cmd;
blit += dirty->num_hits; blit += dirty->num_hits;
blit->header = SVGA_CMD_BLIT_GMRFB_TO_SCREEN; blit->header = SVGA_CMD_BLIT_GMRFB_TO_SCREEN;
...@@ -1012,10 +1012,10 @@ static void vmw_sou_dmabuf_clip(struct vmw_kms_dirty *dirty) ...@@ -1012,10 +1012,10 @@ static void vmw_sou_dmabuf_clip(struct vmw_kms_dirty *dirty)
} }
/** /**
* vmw_kms_do_dmabuf_dirty - Dirty part of a dma-buffer backed framebuffer * vmw_kms_do_bo_dirty - Dirty part of a buffer-object backed framebuffer
* *
* @dev_priv: Pointer to the device private structure. * @dev_priv: Pointer to the device private structure.
* @framebuffer: Pointer to the dma-buffer backed framebuffer. * @framebuffer: Pointer to the buffer-object backed framebuffer.
* @clips: Array of clip rects. * @clips: Array of clip rects.
* @vclips: Alternate array of clip rects. Either @clips or @vclips must * @vclips: Alternate array of clip rects. Either @clips or @vclips must
* be NULL. * be NULL.
...@@ -1025,12 +1025,12 @@ static void vmw_sou_dmabuf_clip(struct vmw_kms_dirty *dirty) ...@@ -1025,12 +1025,12 @@ static void vmw_sou_dmabuf_clip(struct vmw_kms_dirty *dirty)
* @out_fence: If non-NULL, will return a ref-counted pointer to a * @out_fence: If non-NULL, will return a ref-counted pointer to a
* struct vmw_fence_obj. The returned fence pointer may be NULL in which * struct vmw_fence_obj. The returned fence pointer may be NULL in which
* case the device has already synchronized. * case the device has already synchronized.
* @crtc: If crtc is passed, perform dmabuf dirty on that crtc only. * @crtc: If crtc is passed, perform bo dirty on that crtc only.
* *
* Returns 0 on success, negative error code on failure. -ERESTARTSYS if * Returns 0 on success, negative error code on failure. -ERESTARTSYS if
* interrupted. * interrupted.
*/ */
int vmw_kms_sou_do_dmabuf_dirty(struct vmw_private *dev_priv, int vmw_kms_sou_do_bo_dirty(struct vmw_private *dev_priv,
struct vmw_framebuffer *framebuffer, struct vmw_framebuffer *framebuffer,
struct drm_clip_rect *clips, struct drm_clip_rect *clips,
struct drm_vmw_rect *vclips, struct drm_vmw_rect *vclips,
...@@ -1039,8 +1039,8 @@ int vmw_kms_sou_do_dmabuf_dirty(struct vmw_private *dev_priv, ...@@ -1039,8 +1039,8 @@ int vmw_kms_sou_do_dmabuf_dirty(struct vmw_private *dev_priv,
struct vmw_fence_obj **out_fence, struct vmw_fence_obj **out_fence,
struct drm_crtc *crtc) struct drm_crtc *crtc)
{ {
struct vmw_dma_buffer *buf = struct vmw_buffer_object *buf =
container_of(framebuffer, struct vmw_framebuffer_dmabuf, container_of(framebuffer, struct vmw_framebuffer_bo,
base)->buffer; base)->buffer;
struct vmw_kms_dirty dirty; struct vmw_kms_dirty dirty;
int ret; int ret;
...@@ -1050,14 +1050,14 @@ int vmw_kms_sou_do_dmabuf_dirty(struct vmw_private *dev_priv, ...@@ -1050,14 +1050,14 @@ int vmw_kms_sou_do_dmabuf_dirty(struct vmw_private *dev_priv,
if (ret) if (ret)
return ret; return ret;
ret = do_dmabuf_define_gmrfb(dev_priv, framebuffer); ret = do_bo_define_gmrfb(dev_priv, framebuffer);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
goto out_revert; goto out_revert;
dirty.crtc = crtc; dirty.crtc = crtc;
dirty.fifo_commit = vmw_sou_dmabuf_fifo_commit; dirty.fifo_commit = vmw_sou_bo_fifo_commit;
dirty.clip = vmw_sou_dmabuf_clip; dirty.clip = vmw_sou_bo_clip;
dirty.fifo_reserve_size = sizeof(struct vmw_kms_sou_dmabuf_blit) * dirty.fifo_reserve_size = sizeof(struct vmw_kms_sou_bo_blit) *
num_clips; num_clips;
ret = vmw_kms_helper_dirty(dev_priv, framebuffer, clips, vclips, ret = vmw_kms_helper_dirty(dev_priv, framebuffer, clips, vclips,
0, 0, num_clips, increment, &dirty); 0, 0, num_clips, increment, &dirty);
...@@ -1116,12 +1116,12 @@ static void vmw_sou_readback_clip(struct vmw_kms_dirty *dirty) ...@@ -1116,12 +1116,12 @@ static void vmw_sou_readback_clip(struct vmw_kms_dirty *dirty)
/** /**
* vmw_kms_sou_readback - Perform a readback from the screen object system to * vmw_kms_sou_readback - Perform a readback from the screen object system to
* a dma-buffer backed framebuffer. * a buffer-object backed framebuffer.
* *
* @dev_priv: Pointer to the device private structure. * @dev_priv: Pointer to the device private structure.
* @file_priv: Pointer to a struct drm_file identifying the caller. * @file_priv: Pointer to a struct drm_file identifying the caller.
* Must be set to NULL if @user_fence_rep is NULL. * Must be set to NULL if @user_fence_rep is NULL.
* @vfb: Pointer to the dma-buffer backed framebuffer. * @vfb: Pointer to the buffer-object backed framebuffer.
* @user_fence_rep: User-space provided structure for fence information. * @user_fence_rep: User-space provided structure for fence information.
* Must be set to non-NULL if @file_priv is non-NULL. * Must be set to non-NULL if @file_priv is non-NULL.
* @vclips: Array of clip rects. * @vclips: Array of clip rects.
...@@ -1139,8 +1139,8 @@ int vmw_kms_sou_readback(struct vmw_private *dev_priv, ...@@ -1139,8 +1139,8 @@ int vmw_kms_sou_readback(struct vmw_private *dev_priv,
uint32_t num_clips, uint32_t num_clips,
struct drm_crtc *crtc) struct drm_crtc *crtc)
{ {
struct vmw_dma_buffer *buf = struct vmw_buffer_object *buf =
container_of(vfb, struct vmw_framebuffer_dmabuf, base)->buffer; container_of(vfb, struct vmw_framebuffer_bo, base)->buffer;
struct vmw_kms_dirty dirty; struct vmw_kms_dirty dirty;
int ret; int ret;
...@@ -1149,7 +1149,7 @@ int vmw_kms_sou_readback(struct vmw_private *dev_priv, ...@@ -1149,7 +1149,7 @@ int vmw_kms_sou_readback(struct vmw_private *dev_priv,
if (ret) if (ret)
return ret; return ret;
ret = do_dmabuf_define_gmrfb(dev_priv, vfb); ret = do_bo_define_gmrfb(dev_priv, vfb);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
goto out_revert; goto out_revert;
......
...@@ -159,7 +159,7 @@ static int vmw_gb_shader_init(struct vmw_private *dev_priv, ...@@ -159,7 +159,7 @@ static int vmw_gb_shader_init(struct vmw_private *dev_priv,
SVGA3dShaderType type, SVGA3dShaderType type,
uint8_t num_input_sig, uint8_t num_input_sig,
uint8_t num_output_sig, uint8_t num_output_sig,
struct vmw_dma_buffer *byte_code, struct vmw_buffer_object *byte_code,
void (*res_free) (struct vmw_resource *res)) void (*res_free) (struct vmw_resource *res))
{ {
struct vmw_shader *shader = vmw_res_to_shader(res); struct vmw_shader *shader = vmw_res_to_shader(res);
...@@ -178,7 +178,7 @@ static int vmw_gb_shader_init(struct vmw_private *dev_priv, ...@@ -178,7 +178,7 @@ static int vmw_gb_shader_init(struct vmw_private *dev_priv,
res->backup_size = size; res->backup_size = size;
if (byte_code) { if (byte_code) {
res->backup = vmw_dmabuf_reference(byte_code); res->backup = vmw_bo_reference(byte_code);
res->backup_offset = offset; res->backup_offset = offset;
} }
shader->size = size; shader->size = size;
...@@ -723,7 +723,7 @@ int vmw_shader_destroy_ioctl(struct drm_device *dev, void *data, ...@@ -723,7 +723,7 @@ int vmw_shader_destroy_ioctl(struct drm_device *dev, void *data,
} }
static int vmw_user_shader_alloc(struct vmw_private *dev_priv, static int vmw_user_shader_alloc(struct vmw_private *dev_priv,
struct vmw_dma_buffer *buffer, struct vmw_buffer_object *buffer,
size_t shader_size, size_t shader_size,
size_t offset, size_t offset,
SVGA3dShaderType shader_type, SVGA3dShaderType shader_type,
...@@ -801,7 +801,7 @@ static int vmw_user_shader_alloc(struct vmw_private *dev_priv, ...@@ -801,7 +801,7 @@ static int vmw_user_shader_alloc(struct vmw_private *dev_priv,
static struct vmw_resource *vmw_shader_alloc(struct vmw_private *dev_priv, static struct vmw_resource *vmw_shader_alloc(struct vmw_private *dev_priv,
struct vmw_dma_buffer *buffer, struct vmw_buffer_object *buffer,
size_t shader_size, size_t shader_size,
size_t offset, size_t offset,
SVGA3dShaderType shader_type) SVGA3dShaderType shader_type)
...@@ -862,12 +862,12 @@ static int vmw_shader_define(struct drm_device *dev, struct drm_file *file_priv, ...@@ -862,12 +862,12 @@ static int vmw_shader_define(struct drm_device *dev, struct drm_file *file_priv,
{ {
struct vmw_private *dev_priv = vmw_priv(dev); struct vmw_private *dev_priv = vmw_priv(dev);
struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
struct vmw_dma_buffer *buffer = NULL; struct vmw_buffer_object *buffer = NULL;
SVGA3dShaderType shader_type; SVGA3dShaderType shader_type;
int ret; int ret;
if (buffer_handle != SVGA3D_INVALID_ID) { if (buffer_handle != SVGA3D_INVALID_ID) {
ret = vmw_user_dmabuf_lookup(tfile, buffer_handle, ret = vmw_user_bo_lookup(tfile, buffer_handle,
&buffer, NULL); &buffer, NULL);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
DRM_ERROR("Could not find buffer for shader " DRM_ERROR("Could not find buffer for shader "
...@@ -906,7 +906,7 @@ static int vmw_shader_define(struct drm_device *dev, struct drm_file *file_priv, ...@@ -906,7 +906,7 @@ static int vmw_shader_define(struct drm_device *dev, struct drm_file *file_priv,
ttm_read_unlock(&dev_priv->reservation_sem); ttm_read_unlock(&dev_priv->reservation_sem);
out_bad_arg: out_bad_arg:
vmw_dmabuf_unreference(&buffer); vmw_bo_unreference(&buffer);
return ret; return ret;
} }
...@@ -983,7 +983,7 @@ int vmw_compat_shader_add(struct vmw_private *dev_priv, ...@@ -983,7 +983,7 @@ int vmw_compat_shader_add(struct vmw_private *dev_priv,
struct list_head *list) struct list_head *list)
{ {
struct ttm_operation_ctx ctx = { false, true }; struct ttm_operation_ctx ctx = { false, true };
struct vmw_dma_buffer *buf; struct vmw_buffer_object *buf;
struct ttm_bo_kmap_obj map; struct ttm_bo_kmap_obj map;
bool is_iomem; bool is_iomem;
int ret; int ret;
...@@ -997,8 +997,8 @@ int vmw_compat_shader_add(struct vmw_private *dev_priv, ...@@ -997,8 +997,8 @@ int vmw_compat_shader_add(struct vmw_private *dev_priv,
if (unlikely(!buf)) if (unlikely(!buf))
return -ENOMEM; return -ENOMEM;
ret = vmw_dmabuf_init(dev_priv, buf, size, &vmw_sys_ne_placement, ret = vmw_bo_init(dev_priv, buf, size, &vmw_sys_ne_placement,
true, vmw_dmabuf_bo_free); true, vmw_bo_bo_free);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
goto out; goto out;
...@@ -1031,7 +1031,7 @@ int vmw_compat_shader_add(struct vmw_private *dev_priv, ...@@ -1031,7 +1031,7 @@ int vmw_compat_shader_add(struct vmw_private *dev_priv,
res, list); res, list);
vmw_resource_unreference(&res); vmw_resource_unreference(&res);
no_reserve: no_reserve:
vmw_dmabuf_unreference(&buf); vmw_bo_unreference(&buf);
out: out:
return ret; return ret;
} }
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
enum stdu_content_type { enum stdu_content_type {
SAME_AS_DISPLAY = 0, SAME_AS_DISPLAY = 0,
SEPARATE_SURFACE, SEPARATE_SURFACE,
SEPARATE_DMA SEPARATE_BO
}; };
/** /**
...@@ -58,7 +58,7 @@ enum stdu_content_type { ...@@ -58,7 +58,7 @@ enum stdu_content_type {
* @bottom: Bottom side of bounding box. * @bottom: Bottom side of bounding box.
* @fb_left: Left side of the framebuffer/content bounding box * @fb_left: Left side of the framebuffer/content bounding box
* @fb_top: Top of the framebuffer/content bounding box * @fb_top: Top of the framebuffer/content bounding box
* @buf: DMA buffer when DMA-ing between buffer and screen targets. * @buf: buffer object when DMA-ing between buffer and screen targets.
* @sid: Surface ID when copying between surface and screen targets. * @sid: Surface ID when copying between surface and screen targets.
*/ */
struct vmw_stdu_dirty { struct vmw_stdu_dirty {
...@@ -68,7 +68,7 @@ struct vmw_stdu_dirty { ...@@ -68,7 +68,7 @@ struct vmw_stdu_dirty {
s32 fb_left, fb_top; s32 fb_left, fb_top;
u32 pitch; u32 pitch;
union { union {
struct vmw_dma_buffer *buf; struct vmw_buffer_object *buf;
u32 sid; u32 sid;
}; };
}; };
...@@ -508,14 +508,14 @@ static int vmw_stdu_crtc_page_flip(struct drm_crtc *crtc, ...@@ -508,14 +508,14 @@ static int vmw_stdu_crtc_page_flip(struct drm_crtc *crtc,
/** /**
* vmw_stdu_dmabuf_clip - Callback to encode a suface DMA command cliprect * vmw_stdu_bo_clip - Callback to encode a suface DMA command cliprect
* *
* @dirty: The closure structure. * @dirty: The closure structure.
* *
* Encodes a surface DMA command cliprect and updates the bounding box * Encodes a surface DMA command cliprect and updates the bounding box
* for the DMA. * for the DMA.
*/ */
static void vmw_stdu_dmabuf_clip(struct vmw_kms_dirty *dirty) static void vmw_stdu_bo_clip(struct vmw_kms_dirty *dirty)
{ {
struct vmw_stdu_dirty *ddirty = struct vmw_stdu_dirty *ddirty =
container_of(dirty, struct vmw_stdu_dirty, base); container_of(dirty, struct vmw_stdu_dirty, base);
...@@ -543,14 +543,14 @@ static void vmw_stdu_dmabuf_clip(struct vmw_kms_dirty *dirty) ...@@ -543,14 +543,14 @@ static void vmw_stdu_dmabuf_clip(struct vmw_kms_dirty *dirty)
} }
/** /**
* vmw_stdu_dmabuf_fifo_commit - Callback to fill in and submit a DMA command. * vmw_stdu_bo_fifo_commit - Callback to fill in and submit a DMA command.
* *
* @dirty: The closure structure. * @dirty: The closure structure.
* *
* Fills in the missing fields in a DMA command, and optionally encodes * Fills in the missing fields in a DMA command, and optionally encodes
* a screen target update command, depending on transfer direction. * a screen target update command, depending on transfer direction.
*/ */
static void vmw_stdu_dmabuf_fifo_commit(struct vmw_kms_dirty *dirty) static void vmw_stdu_bo_fifo_commit(struct vmw_kms_dirty *dirty)
{ {
struct vmw_stdu_dirty *ddirty = struct vmw_stdu_dirty *ddirty =
container_of(dirty, struct vmw_stdu_dirty, base); container_of(dirty, struct vmw_stdu_dirty, base);
...@@ -594,13 +594,13 @@ static void vmw_stdu_dmabuf_fifo_commit(struct vmw_kms_dirty *dirty) ...@@ -594,13 +594,13 @@ static void vmw_stdu_dmabuf_fifo_commit(struct vmw_kms_dirty *dirty)
/** /**
* vmw_stdu_dmabuf_cpu_clip - Callback to encode a CPU blit * vmw_stdu_bo_cpu_clip - Callback to encode a CPU blit
* *
* @dirty: The closure structure. * @dirty: The closure structure.
* *
* This function calculates the bounding box for all the incoming clips. * This function calculates the bounding box for all the incoming clips.
*/ */
static void vmw_stdu_dmabuf_cpu_clip(struct vmw_kms_dirty *dirty) static void vmw_stdu_bo_cpu_clip(struct vmw_kms_dirty *dirty)
{ {
struct vmw_stdu_dirty *ddirty = struct vmw_stdu_dirty *ddirty =
container_of(dirty, struct vmw_stdu_dirty, base); container_of(dirty, struct vmw_stdu_dirty, base);
...@@ -624,14 +624,14 @@ static void vmw_stdu_dmabuf_cpu_clip(struct vmw_kms_dirty *dirty) ...@@ -624,14 +624,14 @@ static void vmw_stdu_dmabuf_cpu_clip(struct vmw_kms_dirty *dirty)
/** /**
* vmw_stdu_dmabuf_cpu_commit - Callback to do a CPU blit from DMAbuf * vmw_stdu_bo_cpu_commit - Callback to do a CPU blit from buffer object
* *
* @dirty: The closure structure. * @dirty: The closure structure.
* *
* For the special case when we cannot create a proxy surface in a * For the special case when we cannot create a proxy surface in a
* 2D VM, we have to do a CPU blit ourselves. * 2D VM, we have to do a CPU blit ourselves.
*/ */
static void vmw_stdu_dmabuf_cpu_commit(struct vmw_kms_dirty *dirty) static void vmw_stdu_bo_cpu_commit(struct vmw_kms_dirty *dirty)
{ {
struct vmw_stdu_dirty *ddirty = struct vmw_stdu_dirty *ddirty =
container_of(dirty, struct vmw_stdu_dirty, base); container_of(dirty, struct vmw_stdu_dirty, base);
...@@ -652,7 +652,7 @@ static void vmw_stdu_dmabuf_cpu_commit(struct vmw_kms_dirty *dirty) ...@@ -652,7 +652,7 @@ static void vmw_stdu_dmabuf_cpu_commit(struct vmw_kms_dirty *dirty)
if (width == 0 || height == 0) if (width == 0 || height == 0)
return; return;
/* Assume we are blitting from Guest (dmabuf) to Host (display_srf) */ /* Assume we are blitting from Guest (bo) to Host (display_srf) */
dst_pitch = stdu->display_srf->base_size.width * stdu->cpp; dst_pitch = stdu->display_srf->base_size.width * stdu->cpp;
dst_bo = &stdu->display_srf->res.backup->base; dst_bo = &stdu->display_srf->res.backup->base;
dst_offset = ddirty->top * dst_pitch + ddirty->left * stdu->cpp; dst_offset = ddirty->top * dst_pitch + ddirty->left * stdu->cpp;
...@@ -712,13 +712,13 @@ static void vmw_stdu_dmabuf_cpu_commit(struct vmw_kms_dirty *dirty) ...@@ -712,13 +712,13 @@ static void vmw_stdu_dmabuf_cpu_commit(struct vmw_kms_dirty *dirty)
} }
/** /**
* vmw_kms_stdu_dma - Perform a DMA transfer between a dma-buffer backed * vmw_kms_stdu_dma - Perform a DMA transfer between a buffer-object backed
* framebuffer and the screen target system. * framebuffer and the screen target system.
* *
* @dev_priv: Pointer to the device private structure. * @dev_priv: Pointer to the device private structure.
* @file_priv: Pointer to a struct drm-file identifying the caller. May be * @file_priv: Pointer to a struct drm-file identifying the caller. May be
* set to NULL, but then @user_fence_rep must also be set to NULL. * set to NULL, but then @user_fence_rep must also be set to NULL.
* @vfb: Pointer to the dma-buffer backed framebuffer. * @vfb: Pointer to the buffer-object backed framebuffer.
* @clips: Array of clip rects. Either @clips or @vclips must be NULL. * @clips: Array of clip rects. Either @clips or @vclips must be NULL.
* @vclips: Alternate array of clip rects. Either @clips or @vclips must * @vclips: Alternate array of clip rects. Either @clips or @vclips must
* be NULL. * be NULL.
...@@ -747,8 +747,8 @@ int vmw_kms_stdu_dma(struct vmw_private *dev_priv, ...@@ -747,8 +747,8 @@ int vmw_kms_stdu_dma(struct vmw_private *dev_priv,
bool interruptible, bool interruptible,
struct drm_crtc *crtc) struct drm_crtc *crtc)
{ {
struct vmw_dma_buffer *buf = struct vmw_buffer_object *buf =
container_of(vfb, struct vmw_framebuffer_dmabuf, base)->buffer; container_of(vfb, struct vmw_framebuffer_bo, base)->buffer;
struct vmw_stdu_dirty ddirty; struct vmw_stdu_dirty ddirty;
int ret; int ret;
bool cpu_blit = !(dev_priv->capabilities & SVGA_CAP_3D); bool cpu_blit = !(dev_priv->capabilities & SVGA_CAP_3D);
...@@ -770,8 +770,8 @@ int vmw_kms_stdu_dma(struct vmw_private *dev_priv, ...@@ -770,8 +770,8 @@ int vmw_kms_stdu_dma(struct vmw_private *dev_priv,
ddirty.fb_left = ddirty.fb_top = S32_MAX; ddirty.fb_left = ddirty.fb_top = S32_MAX;
ddirty.pitch = vfb->base.pitches[0]; ddirty.pitch = vfb->base.pitches[0];
ddirty.buf = buf; ddirty.buf = buf;
ddirty.base.fifo_commit = vmw_stdu_dmabuf_fifo_commit; ddirty.base.fifo_commit = vmw_stdu_bo_fifo_commit;
ddirty.base.clip = vmw_stdu_dmabuf_clip; ddirty.base.clip = vmw_stdu_bo_clip;
ddirty.base.fifo_reserve_size = sizeof(struct vmw_stdu_dma) + ddirty.base.fifo_reserve_size = sizeof(struct vmw_stdu_dma) +
num_clips * sizeof(SVGA3dCopyBox) + num_clips * sizeof(SVGA3dCopyBox) +
sizeof(SVGA3dCmdSurfaceDMASuffix); sizeof(SVGA3dCmdSurfaceDMASuffix);
...@@ -780,8 +780,8 @@ int vmw_kms_stdu_dma(struct vmw_private *dev_priv, ...@@ -780,8 +780,8 @@ int vmw_kms_stdu_dma(struct vmw_private *dev_priv,
if (cpu_blit) { if (cpu_blit) {
ddirty.base.fifo_commit = vmw_stdu_dmabuf_cpu_commit; ddirty.base.fifo_commit = vmw_stdu_bo_cpu_commit;
ddirty.base.clip = vmw_stdu_dmabuf_cpu_clip; ddirty.base.clip = vmw_stdu_bo_cpu_clip;
ddirty.base.fifo_reserve_size = 0; ddirty.base.fifo_reserve_size = 0;
} }
...@@ -927,7 +927,7 @@ int vmw_kms_stdu_surface_dirty(struct vmw_private *dev_priv, ...@@ -927,7 +927,7 @@ int vmw_kms_stdu_surface_dirty(struct vmw_private *dev_priv,
if (ret) if (ret)
return ret; return ret;
if (vfbs->is_dmabuf_proxy) { if (vfbs->is_bo_proxy) {
ret = vmw_kms_update_proxy(srf, clips, num_clips, inc); ret = vmw_kms_update_proxy(srf, clips, num_clips, inc);
if (ret) if (ret)
goto out_finish; goto out_finish;
...@@ -1075,7 +1075,7 @@ vmw_stdu_primary_plane_cleanup_fb(struct drm_plane *plane, ...@@ -1075,7 +1075,7 @@ vmw_stdu_primary_plane_cleanup_fb(struct drm_plane *plane,
* @new_state: info on the new plane state, including the FB * @new_state: info on the new plane state, including the FB
* *
* This function allocates a new display surface if the content is * This function allocates a new display surface if the content is
* backed by a DMA. The display surface is pinned here, and it'll * backed by a buffer object. The display surface is pinned here, and it'll
* be unpinned in .cleanup_fb() * be unpinned in .cleanup_fb()
* *
* Returns 0 on success * Returns 0 on success
...@@ -1105,13 +1105,13 @@ vmw_stdu_primary_plane_prepare_fb(struct drm_plane *plane, ...@@ -1105,13 +1105,13 @@ vmw_stdu_primary_plane_prepare_fb(struct drm_plane *plane,
} }
vfb = vmw_framebuffer_to_vfb(new_fb); vfb = vmw_framebuffer_to_vfb(new_fb);
new_vfbs = (vfb->dmabuf) ? NULL : vmw_framebuffer_to_vfbs(new_fb); new_vfbs = (vfb->bo) ? NULL : vmw_framebuffer_to_vfbs(new_fb);
if (new_vfbs && new_vfbs->surface->base_size.width == hdisplay && if (new_vfbs && new_vfbs->surface->base_size.width == hdisplay &&
new_vfbs->surface->base_size.height == vdisplay) new_vfbs->surface->base_size.height == vdisplay)
new_content_type = SAME_AS_DISPLAY; new_content_type = SAME_AS_DISPLAY;
else if (vfb->dmabuf) else if (vfb->bo)
new_content_type = SEPARATE_DMA; new_content_type = SEPARATE_BO;
else else
new_content_type = SEPARATE_SURFACE; new_content_type = SEPARATE_SURFACE;
...@@ -1124,10 +1124,10 @@ vmw_stdu_primary_plane_prepare_fb(struct drm_plane *plane, ...@@ -1124,10 +1124,10 @@ vmw_stdu_primary_plane_prepare_fb(struct drm_plane *plane,
display_base_size.depth = 1; display_base_size.depth = 1;
/* /*
* If content buffer is a DMA buf, then we have to construct * If content buffer is a buffer object, then we have to
* surface info * construct surface info
*/ */
if (new_content_type == SEPARATE_DMA) { if (new_content_type == SEPARATE_BO) {
switch (new_fb->format->cpp[0]*8) { switch (new_fb->format->cpp[0]*8) {
case 32: case 32:
...@@ -1212,12 +1212,12 @@ vmw_stdu_primary_plane_prepare_fb(struct drm_plane *plane, ...@@ -1212,12 +1212,12 @@ vmw_stdu_primary_plane_prepare_fb(struct drm_plane *plane,
vps->content_fb_type = new_content_type; vps->content_fb_type = new_content_type;
/* /*
* This should only happen if the DMA buf is too large to create a * This should only happen if the buffer object is too large to create a
* proxy surface for. * proxy surface for.
* If we are a 2D VM with a DMA buffer then we have to use CPU blit * If we are a 2D VM with a buffer object then we have to use CPU blit
* so cache these mappings * so cache these mappings
*/ */
if (vps->content_fb_type == SEPARATE_DMA && if (vps->content_fb_type == SEPARATE_BO &&
!(dev_priv->capabilities & SVGA_CAP_3D)) !(dev_priv->capabilities & SVGA_CAP_3D))
vps->cpp = new_fb->pitches[0] / new_fb->width; vps->cpp = new_fb->pitches[0] / new_fb->width;
...@@ -1276,7 +1276,7 @@ vmw_stdu_primary_plane_atomic_update(struct drm_plane *plane, ...@@ -1276,7 +1276,7 @@ vmw_stdu_primary_plane_atomic_update(struct drm_plane *plane,
if (ret) if (ret)
DRM_ERROR("Failed to bind surface to STDU.\n"); DRM_ERROR("Failed to bind surface to STDU.\n");
if (vfb->dmabuf) if (vfb->bo)
ret = vmw_kms_stdu_dma(dev_priv, NULL, vfb, NULL, NULL, ret = vmw_kms_stdu_dma(dev_priv, NULL, vfb, NULL, NULL,
&vclips, 1, 1, true, false, &vclips, 1, 1, true, false,
crtc); crtc);
......
...@@ -842,12 +842,12 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data, ...@@ -842,12 +842,12 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
if (dev_priv->has_mob && req->shareable) { if (dev_priv->has_mob && req->shareable) {
uint32_t backup_handle; uint32_t backup_handle;
ret = vmw_user_dmabuf_alloc(dev_priv, tfile, ret = vmw_user_bo_alloc(dev_priv, tfile,
res->backup_size, res->backup_size,
true, true,
&backup_handle, &backup_handle,
&res->backup, &res->backup,
&user_srf->backup_base); &user_srf->backup_base);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
vmw_resource_unreference(&res); vmw_resource_unreference(&res);
goto out_unlock; goto out_unlock;
...@@ -1317,14 +1317,14 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data, ...@@ -1317,14 +1317,14 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data,
if (req->buffer_handle != SVGA3D_INVALID_ID) { if (req->buffer_handle != SVGA3D_INVALID_ID) {
ret = vmw_user_dmabuf_lookup(tfile, req->buffer_handle, ret = vmw_user_bo_lookup(tfile, req->buffer_handle,
&res->backup, &res->backup,
&user_srf->backup_base); &user_srf->backup_base);
if (ret == 0) { if (ret == 0) {
if (res->backup->base.num_pages * PAGE_SIZE < if (res->backup->base.num_pages * PAGE_SIZE <
res->backup_size) { res->backup_size) {
DRM_ERROR("Surface backup buffer is too small.\n"); DRM_ERROR("Surface backup buffer is too small.\n");
vmw_dmabuf_unreference(&res->backup); vmw_bo_unreference(&res->backup);
ret = -EINVAL; ret = -EINVAL;
goto out_unlock; goto out_unlock;
} else { } else {
...@@ -1332,13 +1332,13 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data, ...@@ -1332,13 +1332,13 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data,
} }
} }
} else if (req->drm_surface_flags & drm_vmw_surface_flag_create_buffer) } else if (req->drm_surface_flags & drm_vmw_surface_flag_create_buffer)
ret = vmw_user_dmabuf_alloc(dev_priv, tfile, ret = vmw_user_bo_alloc(dev_priv, tfile,
res->backup_size, res->backup_size,
req->drm_surface_flags & req->drm_surface_flags &
drm_vmw_surface_flag_shareable, drm_vmw_surface_flag_shareable,
&backup_handle, &backup_handle,
&res->backup, &res->backup,
&user_srf->backup_base); &user_srf->backup_base);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
vmw_resource_unreference(&res); vmw_resource_unreference(&res);
...@@ -1414,8 +1414,7 @@ int vmw_gb_surface_reference_ioctl(struct drm_device *dev, void *data, ...@@ -1414,8 +1414,7 @@ int vmw_gb_surface_reference_ioctl(struct drm_device *dev, void *data,
} }
mutex_lock(&dev_priv->cmdbuf_mutex); /* Protect res->backup */ mutex_lock(&dev_priv->cmdbuf_mutex); /* Protect res->backup */
ret = vmw_user_dmabuf_reference(tfile, srf->res.backup, ret = vmw_user_bo_reference(tfile, srf->res.backup, &backup_handle);
&backup_handle);
mutex_unlock(&dev_priv->cmdbuf_mutex); mutex_unlock(&dev_priv->cmdbuf_mutex);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
......
...@@ -798,7 +798,7 @@ static int vmw_verify_access(struct ttm_buffer_object *bo, struct file *filp) ...@@ -798,7 +798,7 @@ static int vmw_verify_access(struct ttm_buffer_object *bo, struct file *filp)
struct ttm_object_file *tfile = struct ttm_object_file *tfile =
vmw_fpriv((struct drm_file *)filp->private_data)->tfile; vmw_fpriv((struct drm_file *)filp->private_data)->tfile;
return vmw_user_dmabuf_verify_access(bo, tfile); return vmw_user_bo_verify_access(bo, tfile);
} }
static int vmw_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem) static int vmw_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
......
...@@ -40,6 +40,7 @@ extern "C" { ...@@ -40,6 +40,7 @@ extern "C" {
#define DRM_VMW_GET_PARAM 0 #define DRM_VMW_GET_PARAM 0
#define DRM_VMW_ALLOC_DMABUF 1 #define DRM_VMW_ALLOC_DMABUF 1
#define DRM_VMW_ALLOC_BO 1
#define DRM_VMW_UNREF_DMABUF 2 #define DRM_VMW_UNREF_DMABUF 2
#define DRM_VMW_HANDLE_CLOSE 2 #define DRM_VMW_HANDLE_CLOSE 2
#define DRM_VMW_CURSOR_BYPASS 3 #define DRM_VMW_CURSOR_BYPASS 3
...@@ -356,9 +357,9 @@ struct drm_vmw_fence_rep { ...@@ -356,9 +357,9 @@ struct drm_vmw_fence_rep {
/*************************************************************************/ /*************************************************************************/
/** /**
* DRM_VMW_ALLOC_DMABUF * DRM_VMW_ALLOC_BO
* *
* Allocate a DMA buffer that is visible also to the host. * Allocate a buffer object that is visible also to the host.
* NOTE: The buffer is * NOTE: The buffer is
* identified by a handle and an offset, which are private to the guest, but * identified by a handle and an offset, which are private to the guest, but
* useable in the command stream. The guest kernel may translate these * useable in the command stream. The guest kernel may translate these
...@@ -366,27 +367,28 @@ struct drm_vmw_fence_rep { ...@@ -366,27 +367,28 @@ struct drm_vmw_fence_rep {
* be zero at all times, or it may disappear from the interface before it is * be zero at all times, or it may disappear from the interface before it is
* fixed. * fixed.
* *
* The DMA buffer may stay user-space mapped in the guest at all times, * The buffer object may stay user-space mapped in the guest at all times,
* and is thus suitable for sub-allocation. * and is thus suitable for sub-allocation.
* *
* DMA buffers are mapped using the mmap() syscall on the drm device. * Buffer objects are mapped using the mmap() syscall on the drm device.
*/ */
/** /**
* struct drm_vmw_alloc_dmabuf_req * struct drm_vmw_alloc_bo_req
* *
* @size: Required minimum size of the buffer. * @size: Required minimum size of the buffer.
* *
* Input data to the DRM_VMW_ALLOC_DMABUF Ioctl. * Input data to the DRM_VMW_ALLOC_BO Ioctl.
*/ */
struct drm_vmw_alloc_dmabuf_req { struct drm_vmw_alloc_bo_req {
__u32 size; __u32 size;
__u32 pad64; __u32 pad64;
}; };
#define drm_vmw_alloc_dmabuf_req drm_vmw_alloc_bo_req
/** /**
* struct drm_vmw_dmabuf_rep * struct drm_vmw_bo_rep
* *
* @map_handle: Offset to use in the mmap() call used to map the buffer. * @map_handle: Offset to use in the mmap() call used to map the buffer.
* @handle: Handle unique to this buffer. Used for unreferencing. * @handle: Handle unique to this buffer. Used for unreferencing.
...@@ -395,50 +397,32 @@ struct drm_vmw_alloc_dmabuf_req { ...@@ -395,50 +397,32 @@ struct drm_vmw_alloc_dmabuf_req {
* @cur_gmr_offset: Offset to use in the command stream when this buffer is * @cur_gmr_offset: Offset to use in the command stream when this buffer is
* referenced. See note above. * referenced. See note above.
* *
* Output data from the DRM_VMW_ALLOC_DMABUF Ioctl. * Output data from the DRM_VMW_ALLOC_BO Ioctl.
*/ */
struct drm_vmw_dmabuf_rep { struct drm_vmw_bo_rep {
__u64 map_handle; __u64 map_handle;
__u32 handle; __u32 handle;
__u32 cur_gmr_id; __u32 cur_gmr_id;
__u32 cur_gmr_offset; __u32 cur_gmr_offset;
__u32 pad64; __u32 pad64;
}; };
#define drm_vmw_dmabuf_rep drm_vmw_bo_rep
/** /**
* union drm_vmw_dmabuf_arg * union drm_vmw_alloc_bo_arg
* *
* @req: Input data as described above. * @req: Input data as described above.
* @rep: Output data as described above. * @rep: Output data as described above.
* *
* Argument to the DRM_VMW_ALLOC_DMABUF Ioctl. * Argument to the DRM_VMW_ALLOC_BO Ioctl.
*/ */
union drm_vmw_alloc_dmabuf_arg { union drm_vmw_alloc_bo_arg {
struct drm_vmw_alloc_dmabuf_req req; struct drm_vmw_alloc_bo_req req;
struct drm_vmw_dmabuf_rep rep; struct drm_vmw_bo_rep rep;
};
/*************************************************************************/
/**
* DRM_VMW_UNREF_DMABUF - Free a DMA buffer.
*
*/
/**
* struct drm_vmw_unref_dmabuf_arg
*
* @handle: Handle indicating what buffer to free. Obtained from the
* DRM_VMW_ALLOC_DMABUF Ioctl.
*
* Argument to the DRM_VMW_UNREF_DMABUF Ioctl.
*/
struct drm_vmw_unref_dmabuf_arg {
__u32 handle;
__u32 pad64;
}; };
#define drm_vmw_alloc_dmabuf_arg drm_vmw_alloc_bo_arg
/*************************************************************************/ /*************************************************************************/
/** /**
...@@ -1103,9 +1087,8 @@ union drm_vmw_extended_context_arg { ...@@ -1103,9 +1087,8 @@ union drm_vmw_extended_context_arg {
* DRM_VMW_HANDLE_CLOSE - Close a user-space handle and release its * DRM_VMW_HANDLE_CLOSE - Close a user-space handle and release its
* underlying resource. * underlying resource.
* *
* Note that this ioctl is overlaid on the DRM_VMW_UNREF_DMABUF Ioctl. * Note that this ioctl is overlaid on the deprecated DRM_VMW_UNREF_DMABUF
* The ioctl arguments therefore need to be identical in layout. * Ioctl.
*
*/ */
/** /**
...@@ -1119,7 +1102,7 @@ struct drm_vmw_handle_close_arg { ...@@ -1119,7 +1102,7 @@ struct drm_vmw_handle_close_arg {
__u32 handle; __u32 handle;
__u32 pad64; __u32 pad64;
}; };
#define drm_vmw_unref_dmabuf_arg drm_vmw_handle_close_arg
#if defined(__cplusplus) #if defined(__cplusplus)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment