MGS-3255: gpu-viv: implement command commit worker
authorXianzhong <xianzhong.li@nxp.com>
Sat, 16 Dec 2017 23:31:09 +0000 (07:31 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Tue, 20 Mar 2018 19:51:49 +0000 (14:51 -0500)
i.MX8QM dual GPU SW workaround since no command sharing HW fix in B0,
optimized driver to improve GPU benchmark with better performance.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_context.c
drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_context.h
drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_kernel_buffer.h

index b20aaf5..1551da9 100644 (file)
@@ -2625,7 +2625,6 @@ gckCONTEXT_Update(
     gcsCONTEXT_PTR buffer;
     gcsSTATE_MAP_PTR map;
     gctBOOL needCopy = gcvFALSE;
-    gcsSTATE_DELTA_PTR nDelta;
     gcsSTATE_DELTA_PTR uDelta = gcvNULL;
     gcsSTATE_DELTA_PTR kDelta = gcvNULL;
     gcsSTATE_DELTA_RECORD_PTR record;
@@ -2676,20 +2675,18 @@ gckCONTEXT_Update(
         = (gctUINT32)gcmPTR2INT32(Context);
 #endif
 
-    /* Are there any pending deltas? */
-    if (buffer->deltaCount != 0)
+    if (StateDelta != gcvNULL)
     {
         /* Get the state map. */
         map = Context->map;
 
         /* Get the first delta item. */
-        uDelta = buffer->delta;
+        uDelta = StateDelta;
 
         /* Reset the vertex stream count. */
         elementCount = 0;
 
         /* Merge all pending deltas. */
-        for (i = 0; i < buffer->deltaCount; i += 1)
         {
             /* Get access to the state delta. */
             gcmkONERROR(gckKERNEL_OpenUserData(
@@ -2807,13 +2804,6 @@ gckCONTEXT_Update(
                 elementCount = kDelta->elementCount;
             }
 
-            /* Dereference delta. */
-            kDelta->refCount -= 1;
-            gcmkASSERT(kDelta->refCount >= 0);
-
-            /* Get the next state delta. */
-            nDelta = gcmUINT64_TO_PTR(kDelta->next);
-
             if (dirtyRecordArraySize)
             {
                 /* Get access to the state records. */
@@ -2834,9 +2824,6 @@ gckCONTEXT_Update(
                 uDelta, gcmSIZEOF(gcsSTATE_DELTA),
                 (gctPOINTER *) &kDelta
                 ));
-
-            /* Update the user delta pointer. */
-            uDelta = nDelta;
         }
 
         /* Hardware disables all input attribute when the attribute 0 is programmed,
@@ -2973,73 +2960,8 @@ gckCONTEXT_Update(
                 nop += 2;
             }
         }
-        /* Reset pending deltas. */
-        buffer->deltaCount = 0;
-        buffer->delta      = gcvNULL;
     }
 
-    if (StateDelta)
-    {
-        /* Set state delta user pointer. */
-        uDelta = StateDelta;
-
-        /* Get access to the state delta. */
-        gcmkONERROR(gckKERNEL_OpenUserData(
-            kernel, needCopy,
-            &_stateDelta,
-            uDelta, gcmSIZEOF(gcsSTATE_DELTA),
-            (gctPOINTER *) &kDelta
-            ));
-
-        /* State delta cannot be attached to anything yet. */
-        if (kDelta->refCount != 0)
-        {
-            gcmkTRACE(
-                gcvLEVEL_ERROR,
-                "%s(%d): kDelta->refCount = %d (has to be 0).\n",
-                __FUNCTION__, __LINE__,
-                kDelta->refCount
-                );
-        }
-
-        /* Attach to all contexts. */
-        buffer = Context->buffer;
-
-        do
-        {
-            /* Attach to the context if nothing is attached yet. If a delta
-               is allready attached, all we need to do is to increment
-               the number of deltas in the context. */
-            if (buffer->delta == gcvNULL)
-            {
-                buffer->delta = uDelta;
-            }
-
-            /* Update reference count. */
-            kDelta->refCount += 1;
-
-            /* Update counters. */
-            buffer->deltaCount += 1;
-
-            /* Get the next context buffer. */
-            buffer = buffer->next;
-
-            if (buffer == gcvNULL)
-            {
-                gcmkONERROR(gcvSTATUS_NOT_FOUND);
-            }
-        }
-        while (Context->buffer != buffer);
-
-        /* Close access to the current state delta. */
-        gcmkONERROR(gckKERNEL_CloseUserData(
-            kernel, needCopy,
-            gcvTRUE,
-            uDelta, gcmSIZEOF(gcsSTATE_DELTA),
-            (gctPOINTER *) &kDelta
-            ));
-
-    }
     /* Schedule an event to mark the context buffer as available. */
     gcmkONERROR(gckEVENT_Signal(
         buffer->eventObj, buffer->signal, gcvKERNEL_PIXEL
index 6a90926..ea80365 100644 (file)
@@ -100,12 +100,6 @@ typedef struct _gcsCONTEXT
     gctPOINTER                  link2D;
     gctPOINTER                  link3D;
 
-    /* The number of pending state deltas. */
-    gctUINT                     deltaCount;
-
-    /* Pointer to the first delta to be applied. */
-    gcsSTATE_DELTA_PTR          delta;
-
     /* Next context buffer. */
     gcsCONTEXT_PTR              next;
 }
index 9e3c58a..f22573d 100644 (file)
@@ -112,9 +112,6 @@ typedef struct _gcsSTATE_DELTA
        the overflow.*/
     gctUINT                     id;
 
-    /* The number of contexts pending modification by the delta. */
-    gctINT                      refCount;
-
     /* Vertex element count for the delta buffer. */
     gctUINT                     elementCount;
 
@@ -123,6 +120,7 @@ typedef struct _gcsSTATE_DELTA
 
     /* Record array; holds all modified states in gcsSTATE_DELTA_RECORD. */
     gctUINT64                   recordArray;
+    gctUINT                     recordSize;
 
     /* Map entry ID is used for map entry validation. If map entry ID does not
        match the main state delta ID, the entry and the corresponding state are
@@ -133,10 +131,6 @@ typedef struct _gcsSTATE_DELTA
     /* If the map entry ID matches the main state delta ID, index points to
        the state record in the record array. */
     gctUINT64                   mapEntryIndex;
-
-    /* Previous and next state deltas in gcsSTATE_DELTA. */
-    gctUINT64                   prev;
-    gctUINT64                   next;
 }
 gcsSTATE_DELTA;