summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+cubox@arm.linux.org.uk>2013-08-28 11:15:25 +0100
committerRussell King <rmk@arm.linux.org.uk>2013-10-29 19:21:10 +0000
commita0f8988f4eceefd5a9d30f17de971c070acb49b0 (patch)
tree5dc442af8605dce3ab1e4b8e5f3fd589c8de76af
parentebf342580709fc974f6be49edb59bfd82af54111 (diff)
downloadxf86-video-armada-a0f8988f4eceefd5a9d30f17de971c070acb49b0.tar.gz
xf86-video-armada-a0f8988f4eceefd5a9d30f17de971c070acb49b0.tar.xz
Only call vivante_map_gpu() if the pixmap isn't already mapped to the GPU.
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
-rw-r--r--src/vivante_accel.c8
-rw-r--r--src/vivante_utils.c47
2 files changed, 26 insertions, 29 deletions
diff --git a/src/vivante_accel.c b/src/vivante_accel.c
index bbfd934..f86a35f 100644
--- a/src/vivante_accel.c
+++ b/src/vivante_accel.c
@@ -277,9 +277,15 @@ gal_prepare_gpu(struct vivante *vivante, struct vivante_pixmap *vPix,
vivante_batch_wait(vivante, vPix);
- if (!vivante_map_gpu(vivante, vPix))
+ if (vPix->owner != GPU && !vivante_map_gpu(vivante, vPix))
return FALSE;
+ /*
+ * This should never happen - if it does, and we proceeed, we will
+ * take the machine out, so assert and kill ourselves instead.
+ */
+ assert(vPix->handle != 0 && vPix->handle != -1);
+
switch (id) {
case GPU2D_Target:
err = gco2D_SetTarget(vivante->e2d, vPix->handle, vPix->pitch,
diff --git a/src/vivante_utils.c b/src/vivante_utils.c
index ffe9785..04a01cc 100644
--- a/src/vivante_utils.c
+++ b/src/vivante_utils.c
@@ -84,7 +84,7 @@ PixmapPtr vivante_drawable_pixmap_deltas(DrawablePtr pDrawable, int *x, int *y)
/*
- * Unmap a bo from the GPU. Note that we must wait for any outstanding
+ * Unmap a pixmap from the GPU. Note that we must wait for any outstanding
* GPU operations to complete before unmapping the pixmap from the GPU.
*/
void vivante_unmap_gpu(struct vivante *vivante, struct vivante_pixmap *vPix)
@@ -107,41 +107,34 @@ void vivante_unmap_gpu(struct vivante *vivante, struct vivante_pixmap *vPix)
}
/*
- * Map a bo to the GPU, and mark the GPU as owning this BO.
+ * Map a pixmap to the GPU, and mark the GPU as owning this BO.
*/
Bool vivante_map_gpu(struct vivante *vivante, struct vivante_pixmap *vPix)
{
- if (vPix->owner != GPU) {
- struct drm_armada_bo *bo = vPix->bo;
+ struct drm_armada_bo *bo = vPix->bo;
#ifdef DEBUG_CHECK_DRAWABLE_USE
- assert(vPix->in_use == 0);
+ assert(vPix->in_use == 0);
#endif
- if (bo->type == DRM_ARMADA_BO_SHMEM) {
- gceSTATUS err;
- gctUINT32 addr;
-
- err = gcoOS_MapUserMemory(vivante->os, bo->ptr, bo->size,
- &vPix->info, &addr);
- if (err != gcvSTATUS_OK) {
- vivante_error(vivante, "gcoOS_MapUserMemory", err);
- return FALSE;
- }
+
+ if (bo->type == DRM_ARMADA_BO_SHMEM) {
+ gceSTATUS err;
+ gctUINT32 addr;
+
+ err = gcoOS_MapUserMemory(vivante->os, bo->ptr, bo->size,
+ &vPix->info, &addr);
+ if (err != gcvSTATUS_OK) {
+ vivante_error(vivante, "gcoOS_MapUserMemory", err);
+ return FALSE;
+ }
#ifdef DEBUG_MAP
- dbg("Mapped vPix %p bo %p to 0x%08x\n", vPix, bo, addr);
+ dbg("Mapped vPix %p bo %p to 0x%08x\n", vPix, bo, addr);
#endif
- vPix->handle = addr;
- }
- vPix->owner = GPU;
+ vPix->handle = addr;
}
-
- /*
- * This should never happen - if it does, and we proceeed, we will
- * take the machine out, so assert and kill ourselves instead.
- */
- assert(vPix->handle != 0 && vPix->handle != -1);
+ vPix->owner = GPU;
return TRUE;
}
@@ -295,10 +288,8 @@ static void dump_pix(struct vivante *vivante, struct vivante_pixmap *vPix,
close(fd);
}
- if (vPix->owner == GPU && vPix->bo->type == DRM_ARMADA_BO_SHMEM) {
- vPix->owner = CPU;
+ if (vPix->owner == GPU && vPix->bo->type == DRM_ARMADA_BO_SHMEM)
vivante_map_gpu(vivante, vPix);
- }
}
void dump_Drawable(DrawablePtr pDraw, const char *fmt, ...)