summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2011-10-04 20:13:28 +0200
committerDave Airlie <airlied@redhat.com>2011-10-05 10:17:20 +0100
commitb37a6b9ad002a6c123a6924668dfef5c5fb0b700 (patch)
treeab1df2dec40546ec69fff9b6837cf5711cc7fb34 /drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c
parent0cff60c625131c64847debc2b4cee33ba33e8d8f (diff)
downloadtalos-obmc-linux-b37a6b9ad002a6c123a6924668dfef5c5fb0b700.tar.gz
talos-obmc-linux-b37a6b9ad002a6c123a6924668dfef5c5fb0b700.zip
vmwgfx: minor dmabuf utilities cleanup
Add / fix some function comments. Don't move out an fbdev framebuffer when unused. Just unpin. Only have a single function that computes a SVGAGuestPtr from the buffer's current placement, and make it more versatile by accepting a struct ttm_buffer_object Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c86
1 files changed, 36 insertions, 50 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c
index 5668ad980cb5..7f744a82892a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c
@@ -32,10 +32,16 @@
/**
- * Validate a buffer to placement.
+ * vmw_dmabuf_to_placement - Validate a buffer to placement.
*
- * May only be called by the current master as this function takes the
- * its lock in write mode.
+ * @dev_priv: Driver private.
+ * @buf: DMA buffer to move.
+ * @pin: Pin buffer if true.
+ * @interruptible: Use interruptible wait.
+ *
+ * May only be called by the current master since it assumes that the
+ * master lock is the current master's lock.
+ * This function takes the master's lock in write mode.
*
* Returns
* -ERESTARTSYS if interrupted by a signal.
@@ -67,10 +73,11 @@ err:
}
/**
- * Move a buffer to vram or gmr.
+ * vmw_dmabuf_to_vram_or_gmr - Move a buffer to vram or gmr.
*
- * May only be called by the current master as this function takes the
- * its lock in write mode.
+ * May only be called by the current master since it assumes that the
+ * master lock is the current master's lock.
+ * This function takes the master's lock in write mode.
*
* @dev_priv: Driver private.
* @buf: DMA buffer to move.
@@ -134,10 +141,11 @@ err:
}
/**
- * Move a buffer to vram.
+ * vmw_dmabuf_to_vram - Move a buffer to vram.
*
- * May only be called by the current master as this function takes the
- * its lock in write mode.
+ * May only be called by the current master since it assumes that the
+ * master lock is the current master's lock.
+ * This function takes the master's lock in write mode.
*
* @dev_priv: Driver private.
* @buf: DMA buffer to move.
@@ -164,10 +172,11 @@ int vmw_dmabuf_to_vram(struct vmw_private *dev_priv,
}
/**
- * Move a buffer to start of vram.
+ * vmw_dmabuf_to_start_of_vram - Move a buffer to start of vram.
*
- * May only be called by the current master as this function takes the
- * its lock in write mode.
+ * May only be called by the current master since it assumes that the
+ * master lock is the current master's lock.
+ * This function takes the master's lock in write mode.
*
* @dev_priv: Driver private.
* @buf: DMA buffer to move.
@@ -219,11 +228,13 @@ err_unlock:
return ret;
}
+
/**
- * Unpin the buffer given buffer, does not move the buffer.
+ * vmw_dmabuf_upin - Unpin the buffer given buffer, does not move the buffer.
*
- * May only be called by the current master as this function takes the
- * its lock in write mode.
+ * May only be called by the current master since it assumes that the
+ * master lock is the current master's lock.
+ * This function takes the master's lock in write mode.
*
* @dev_priv: Driver private.
* @buf: DMA buffer to unpin.
@@ -246,47 +257,22 @@ int vmw_dmabuf_unpin(struct vmw_private *dev_priv,
interruptible);
}
+
/**
- * Move a buffer to system memory, does not pin the buffer.
- *
- * May only be called by the current master as this function takes the
- * its lock in write mode.
- *
- * @dev_priv: Driver private.
- * @buf: DMA buffer to move.
- * @interruptible: Use interruptible wait.
+ * vmw_bo_get_guest_ptr - Get the guest ptr representing the current placement
+ * of a buffer.
*
- * Returns
- * -ERESTARTSYS if interrupted by a signal.
+ * @bo: Pointer to a struct ttm_buffer_object. Must be pinned or reserved.
+ * @ptr: SVGAGuestPtr returning the result.
*/
-int vmw_dmabuf_to_system(struct vmw_private *dev_priv,
- struct vmw_dma_buffer *buf,
- bool interruptible)
-{
- return vmw_dmabuf_to_placement(dev_priv, buf,
- &vmw_sys_placement,
- interruptible);
-}
-
-void vmw_dmabuf_get_id_offset(struct vmw_dma_buffer *buf,
- uint32_t *gmrId, uint32_t *offset)
-{
- if (buf->base.mem.mem_type == TTM_PL_VRAM) {
- *gmrId = SVGA_GMR_FRAMEBUFFER;
- *offset = buf->base.offset;
- } else {
- *gmrId = buf->base.mem.start;
- *offset = 0;
- }
-}
-
-void vmw_dmabuf_get_guest_ptr(struct vmw_dma_buffer *buf, SVGAGuestPtr *ptr)
+void vmw_bo_get_guest_ptr(const struct ttm_buffer_object *bo,
+ SVGAGuestPtr *ptr)
{
- if (buf->base.mem.mem_type == TTM_PL_VRAM) {
+ if (bo->mem.mem_type == TTM_PL_VRAM) {
ptr->gmrId = SVGA_GMR_FRAMEBUFFER;
- ptr->offset = buf->base.offset;
+ ptr->offset = bo->offset;
} else {
- ptr->gmrId = buf->base.mem.start;
+ ptr->gmrId = bo->mem.start;
ptr->offset = 0;
}
}
OpenPOWER on IntegriCloud