Revert "[COMMON] g2d: move setting hwfc data"
authorhyesoo.yu <hyesoo.yu@samsung.com>
Thu, 24 Aug 2017 01:19:56 +0000 (10:19 +0900)
committerSeungchul Kim <sc377.kim@samsung.com>
Mon, 28 May 2018 05:27:38 +0000 (14:27 +0900)
This reverts commit 713b7ef688f8b3e3276f073bf8c3c620d30f31e9.

Change-Id: If0f3894a02f7fdec90b229040658d7c2d8096b58
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
drivers/gpu/exynos/g2d/g2d_uapi_process.c

index 41f874c9b36e7994290ed52287fe3299783a2388..5a4ebc1e94cd683bb5f8b401d859342de8c34a98 100644 (file)
@@ -209,8 +209,50 @@ static int g2d_get_dmabuf(struct g2d_task *task,
                        return PTR_ERR(dmabuf);
                }
        } else {
-               dmabuf = ctx->hwfc_info->bufs[task->job_id];
+               struct g2d_task *ptask;
+               unsigned long flags;
+               u32 idx;
+
+               /*
+                * The index from repeater driver used on both buffer index and
+                * job id, and this index is managed by repeater driver to
+                * avoid overwriting the buffer index and job id while MFC is
+                * running.
+                */
+               hwfc_get_valid_buffer(&idx);
+               BUG_ON(idx >= ctx->hwfc_info->buffer_count);
+
+               spin_lock_irqsave(&task->g2d_dev->lock_task, flags);
+
+               ptask = task->g2d_dev->tasks;
+
+               while (ptask != NULL) {
+                       if (ptask == task) {
+                               ptask = ptask->next;
+                               continue;
+                       }
+                       if ((ptask->job_id == idx) &&
+                                       !is_task_state_idle(ptask)) {
+                               dev_err(dev, "%s: The task using that job #%d is not idle\n",
+                               __func__, idx);
+
+                               spin_unlock_irqrestore(
+                                       &task->g2d_dev->lock_task, flags);
+                               return ret;
+                       }
+                       ptask = ptask->next;
+               }
+               task->job_id = idx;
+
+               spin_unlock_irqrestore(&task->g2d_dev->lock_task, flags);
+
+               dmabuf = ctx->hwfc_info->bufs[idx];
                get_dma_buf(dmabuf);
+
+               data->dmabuf.offset = 0;
+               data->length = dmabuf->size;
+
+               g2d_stamp_task(task, G2D_STAMP_STATE_HWFCBUF);
        }
 
        if (dmabuf->size < data->dmabuf.offset) {
@@ -645,61 +687,9 @@ static int g2d_get_target(struct g2d_device *g2d_dev, struct g2d_context *ctx,
                return -EINVAL;
        }
 
-       if (IS_HWFC(task->flags)) {
-               struct g2d_task *ptask;
-               unsigned long flags;
-               u32 idx;
-
+       if (IS_HWFC(task->flags))
                target->buffer_type = G2D_BUFTYPE_DMABUF;
 
-               /*
-                * The index from repeater driver used on both buffer index and
-                * job id, and this index is managed by repeater driver to
-                * avoid overwriting the buffer index and job id while MFC is
-                * running.
-                */
-               ret = hwfc_get_valid_buffer(&idx);
-               if (ret < 0) {
-                       dev_err(dev, "%s: Failed to get valid buffer from repeater\n",
-                               __func__);
-                       return ret;
-               }
-
-               BUG_ON(idx >= ctx->hwfc_info->buffer_count);
-
-               spin_lock_irqsave(&task->g2d_dev->lock_task, flags);
-
-               ptask = task->g2d_dev->tasks;
-
-               while (ptask != NULL) {
-                       if (ptask == task) {
-                               ptask = ptask->next;
-                               continue;
-                       }
-                       if ((ptask->job_id == idx) &&
-                                       !is_task_state_idle(ptask)) {
-                               dev_err(dev, "%s: The %d task is not idle\n",
-                               __func__, idx);
-
-                               spin_unlock_irqrestore(
-                                       &task->g2d_dev->lock_task, flags);
-
-                               return -EINVAL;
-                       }
-                       ptask = ptask->next;
-               }
-
-               task->job_id = idx;
-
-               spin_unlock_irqrestore(&task->g2d_dev->lock_task, flags);
-
-               data->num_buffers = 1;
-               data->buffer[0].dmabuf.offset = 0;
-               data->buffer[0].length = ctx->hwfc_info->bufs[idx]->size;
-
-               g2d_stamp_task(task, G2D_STAMP_STATE_HWFCBUF);
-       }
-
        if (target->buffer_type == G2D_BUFTYPE_EMPTY) {
                dev_err(dev, "%s: target has no buffer - flags: %#x\n",
                        __func__, task->flags);