If rga get the mmu error, we must unlock the lock
or it will lead the next frame timeout.
Change-Id: I377217ea417de8e4d3f4ff63e478db1370951e62
Signed-off-by: Zikim,Wei <wzq@rock-chips.com>
(cherry picked from commit
f453db8699919760a2297a7d2512f3c03c3edf25)
\r
static int rga_mmu_buf_get_try(struct rga_mmu_buf_t *t, uint32_t size)\r
{\r
\r
static int rga_mmu_buf_get_try(struct rga_mmu_buf_t *t, uint32_t size)\r
{\r
- mutex_lock(&rga_service.lock);\r
- if((t->back - t->front) > t->size) {\r
- if(t->front + size > t->back - t->size)\r
- return -1;\r
- }\r
- else {\r
- if((t->front + size) > t->back)\r
- return -1;\r
-\r
- if(t->front + size > t->size) {\r
- if (size > (t->back - t->size)) {\r
- return -1;\r
- }\r
- t->front = 0;\r
- }\r
- }\r
- mutex_unlock(&rga_service.lock);\r
-\r
- return 0;\r
+ int ret = 0;\r
+\r
+ mutex_lock(&rga_service.lock);\r
+ if ((t->back - t->front) > t->size) {\r
+ if(t->front + size > t->back - t->size) {\r
+ ret = -ENOMEM;\r
+ goto out;\r
+ }\r
+ } else {\r
+ if ((t->front + size) > t->back) {\r
+ ret = -ENOMEM;\r
+ goto out;\r
+ }\r
+ if (t->front + size > t->size) {\r
+ if (size > (t->back - t->size)) {\r
+ ret = -ENOMEM;\r
+ goto out;\r
+ }\r
+ t->front = 0;\r
+ }\r
+ }\r
+\r
+out:\r
+ mutex_unlock(&rga_service.lock);\r
+ return ret;\r
}\r
\r
static int rga_mem_size_cal(unsigned long Mem, uint32_t MemSize, unsigned long *StartAddr)\r
}\r
\r
static int rga_mem_size_cal(unsigned long Mem, uint32_t MemSize, unsigned long *StartAddr)\r