]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00178642-1 gpu-viv: fix suspend/resume issue for #304
authorRichard Zhao <richard.zhao@freescale.com>
Sun, 1 Apr 2012 08:49:30 +0000 (16:49 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:34:21 +0000 (08:34 +0200)
Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Acked-by: Lily Zhang
drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c
drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c

index 572c7281997435ff0aa8ad4c58ec4d806fef6b2e..e341b6e25ae39892cf749bb01b7e382ce774448c 100644 (file)
@@ -1156,6 +1156,40 @@ gckCOMMAND_Commit(
         + Command->reservedTail
         - commandBufferObject->startOffset;
 
+    /* Get the current offset. */
+    offset = Command->offset;
+
+    /* Compute number of bytes left in current kernel command queue. */
+    bytes = Command->pageSize - offset;
+
+    /* Query the size of WAIT/LINK command sequence. */
+    gcmkONERROR(gckHARDWARE_WaitLink(
+        hardware,
+        gcvNULL,
+        offset,
+        &waitLinkBytes,
+        gcvNULL,
+        gcvNULL
+        ));
+
+    /* Is there enough space in the current command queue? */
+    if (bytes < waitLinkBytes)
+    {
+        /* No, create a new one. */
+        gcmkONERROR(_NewQueue(Command));
+
+        /* Get the new current offset. */
+        offset = Command->offset;
+
+        /* Recompute the number of bytes in the new kernel command queue. */
+        bytes = Command->pageSize - offset;
+        gcmkASSERT(bytes >= waitLinkBytes);
+    }
+
+    /* Compute the location if WAIT/LINK command sequence. */
+    waitLinkPhysical = (gctUINT8_PTR) Command->physical + offset;
+    waitLinkLogical  = (gctUINT8_PTR) Command->logical  + offset;
+
     /* Context switch required? */
     if (Context == gcvNULL)
     {
@@ -1729,40 +1763,6 @@ gckCOMMAND_Commit(
     gcmkONERROR(_ProcessHints(Command, ProcessID, commandBufferObject));
 #endif
 
-    /* Get the current offset. */
-    offset = Command->offset;
-
-    /* Compute number of bytes left in current kernel command queue. */
-    bytes = Command->pageSize - offset;
-
-    /* Query the size of WAIT/LINK command sequence. */
-    gcmkONERROR(gckHARDWARE_WaitLink(
-        hardware,
-        gcvNULL,
-        offset,
-        &waitLinkBytes,
-        gcvNULL,
-        gcvNULL
-        ));
-
-    /* Is there enough space in the current command queue? */
-    if (bytes < waitLinkBytes)
-    {
-        /* No, create a new one. */
-        gcmkONERROR(_NewQueue(Command));
-
-        /* Get the new current offset. */
-        offset = Command->offset;
-
-        /* Recompute the number of bytes in the new kernel command queue. */
-        bytes = Command->pageSize - offset;
-        gcmkASSERT(bytes >= waitLinkBytes);
-    }
-
-    /* Compute the location if WAIT/LINK command sequence. */
-    waitLinkPhysical = (gctUINT8_PTR) Command->physical + offset;
-    waitLinkLogical  = (gctUINT8_PTR) Command->logical  + offset;
-
     /* Determine the location to jump to for the command buffer being
     ** scheduled. */
     if (Command->newQueue)
@@ -1980,7 +1980,21 @@ gckCOMMAND_Commit(
     }
 
     /* Submit events. */
-    gcmkONERROR(gckEVENT_Submit(Command->kernel->eventObj, gcvTRUE, gcvFALSE));
+    status = (gckEVENT_Submit(Command->kernel->eventObj, gcvTRUE, gcvFALSE));
+
+    if (status == gcvSTATUS_INTERRUPTED || status == gcvSTATUS_TIMEOUT)
+    {
+        gcmkTRACE(
+            gcvLEVEL_INFO,
+            "%s(%d): Intterupted in gckEVENT_Submit",
+            __FUNCTION__, __LINE__
+            );
+        status = gcvSTATUS_OK;
+    }
+    else
+    {
+        gcmkONERROR(status);
+    }
 
     /* Unmap the command buffer pointer. */
     if (commandBufferMapped)
index 467f4f3b28200b3a524e4e2f157e41cd87dfd072..825c88d78dc8e7fca12bb9c11347e825a78b4f1d 100644 (file)
@@ -6633,7 +6633,7 @@ gckOS_AcquireSemaphore(
     /* Acquire the semaphore. */
     if (down_interruptible((struct semaphore *) Semaphore))
     {
-        gcmkONERROR(gcvSTATUS_TIMEOUT);
+        gcmkONERROR(gcvSTATUS_INTERRUPTED);
     }
 
     /* Success. */