summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vivante.c15
-rw-r--r--src/vivante_accel.c23
-rw-r--r--src/vivante_accel.h8
3 files changed, 45 insertions, 1 deletions
diff --git a/src/vivante.c b/src/vivante.c
index 8127d3b..ff42a79 100644
--- a/src/vivante.c
+++ b/src/vivante.c
@@ -405,12 +405,16 @@ static Bool vivante_CloseScreen(CLOSE_SCREEN_ARGS_DECL)
vivante_dri2_CloseScreen(CLOSE_SCREEN_ARGS);
#endif
+#ifdef VIVANTE_BATCH
vivante_unmap_from_gpu(vivante, vivante->batch_info,
vivante->batch_handle);
+#endif
vivante_accel_shutdown(vivante);
+#ifdef VIVANTE_BATCH
drm_armada_bo_put(vivante->batch_bo);
+#endif
free(vivante);
@@ -576,8 +580,10 @@ Bool vivante_ScreenInit(ScreenPtr pScreen, struct drm_armada_bufmgr *mgr)
vivante->drm_fd = GET_DRM_INFO(pScrn)->fd;
vivante->scrnIndex = pScrn->scrnIndex;
- xorg_list_init(&vivante->batch_list);
vivante->bufmgr = mgr;
+
+#ifdef VIVANTE_BATCH
+ xorg_list_init(&vivante->batch_list);
vivante->batch_bo = drm_armada_bo_dumb_create(mgr, 64, 64, 32);
if (!vivante->batch_bo) {
xf86DrvMsg(vivante->scrnIndex, X_ERROR,
@@ -592,10 +598,12 @@ Bool vivante_ScreenInit(ScreenPtr pScreen, struct drm_armada_bufmgr *mgr)
strerror(errno));
goto fail;
}
+#endif
if (!vivante_accel_init(vivante))
goto fail;
+#ifdef VIVANTE_BATCH
if (!vivante_map_bo_to_gpu(vivante, vivante->batch_bo,
&vivante->batch_info,
&vivante->batch_handle))
@@ -608,6 +616,7 @@ Bool vivante_ScreenInit(ScreenPtr pScreen, struct drm_armada_bufmgr *mgr)
// "vivante: created batch at v%p p0x%08x max idx %u\n",
// vivante->batch_ptr, vivante->batch_handle,
// vivante->batch_idx_max);
+#endif
vivante_set_screen_priv(pScreen, vivante);
@@ -656,12 +665,16 @@ Bool vivante_ScreenInit(ScreenPtr pScreen, struct drm_armada_bufmgr *mgr)
return TRUE;
fail:
+#ifdef VIVANTE_BATCH
if (vivante->batch_info)
vivante_unmap_from_gpu(vivante, vivante->batch_info,
vivante->batch_handle);
+#endif
vivante_accel_shutdown(vivante);
+#ifdef VIVANTE_BATCH
if (vivante->batch_bo)
drm_armada_bo_put(vivante->batch_bo);
+#endif
free(vivante);
return FALSE;
}
diff --git a/src/vivante_accel.c b/src/vivante_accel.c
index c94ae88..9999d72 100644
--- a/src/vivante_accel.c
+++ b/src/vivante_accel.c
@@ -69,6 +69,7 @@ static void vivante_disable_alpha_blend(struct vivante *vivante)
+#ifdef VIVANTE_BATCH
struct vivante_batch {
struct xorg_list node;
struct xorg_list head;
@@ -248,6 +249,24 @@ static void vivante_batch_commit(struct vivante *vivante)
error:
vivante_error(vivante, "batch blit", err);
}
+#else
+void
+vivante_batch_wait_commit(struct vivante *vivante, struct vivante_pixmap *vPix)
+{
+ if (vPix->need_stall && vivante->need_stall) {
+ vivante_commit(vivante, TRUE);
+ vivante->need_stall = FALSE;
+ }
+}
+
+static void
+vivante_batch_add(struct vivante *vivante, struct vivante_pixmap *vPix)
+{
+ vivante->need_stall = TRUE;
+ vivante->need_commit = TRUE;
+ vPix->need_stall = TRUE;
+}
+#endif
enum gpuid {
@@ -270,6 +289,7 @@ gal_prepare_gpu(struct vivante *vivante, struct vivante_pixmap *vPix,
}
#endif
+#ifdef VIVANTE_BATCH
/*
* If we don't have a batch already in place, then add one now.
* This gives us a chance to error out and fallback to CPU based
@@ -282,6 +302,7 @@ gal_prepare_gpu(struct vivante *vivante, struct vivante_pixmap *vPix,
}
vivante_batch_wait(vivante, vPix);
+#endif
if (vPix->owner != GPU && !vivante_map_gpu(vivante, vPix))
return FALSE;
@@ -322,8 +343,10 @@ void vivante_commit(struct vivante *vivante, Bool stall)
{
gceSTATUS err;
+#ifdef VIVANTE_BATCH
if (vivante->batch)
vivante_batch_commit(vivante);
+#endif
err = gco2D_Flush(vivante->e2d);
if (err != gcvSTATUS_OK)
diff --git a/src/vivante_accel.h b/src/vivante_accel.h
index debc7d7..51bbdbf 100644
--- a/src/vivante_accel.h
+++ b/src/vivante_accel.h
@@ -47,6 +47,7 @@ struct vivante {
gcoHAL hal;
gco2D e2d;
unsigned max_rect_count;
+#ifdef VIVANTE_BATCH
struct drm_armada_bo *batch_bo;
int32_t *batch_ptr;
void *batch_info;
@@ -56,6 +57,9 @@ struct vivante {
int32_t batch_serial;
struct xorg_list batch_list;
struct vivante_batch *batch;
+#else
+ Bool need_stall;
+#endif
Bool need_commit;
Bool force_fallback;
@@ -97,8 +101,12 @@ struct vivante_pixmap {
gceSURF_FORMAT pict_format;
gctPOINTER info;
+#ifdef VIVANTE_BATCH
struct xorg_list batch_node;
struct vivante_batch *batch;
+#else
+ Bool need_stall;
+#endif
enum {
NONE,