ret = g2d_get_userdata(g2d_dev, ctx, task, &data);
if (ret < 0) {
+ /* release hwfc buffer */
+ if (IS_HWFC(task->flags) && (task->bufidx >= 0))
+ hwfc_set_valid_buffer(task->bufidx, -1);
g2d_put_free_task(g2d_dev, task);
break;
}
if (IS_HWFC(task->flags)) {
struct g2d_task *ptask;
unsigned long flags;
- u32 idx;
target->buffer_type = G2D_BUFTYPE_DMABUF;
* avoid overwriting the buffer index and job id while MFC is
* running.
*/
- ret = hwfc_get_valid_buffer(&idx);
+ ret = hwfc_get_valid_buffer(&task->bufidx);
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);
+ BUG_ON(task->bufidx >= ctx->hwfc_info->buffer_count);
spin_lock_irqsave(&task->g2d_dev->lock_task, flags);
ptask = ptask->next;
continue;
}
- if ((ptask->job_id == idx) &&
+ if ((ptask->job_id == task->bufidx) &&
!is_task_state_idle(ptask)) {
dev_err(dev, "%s: The %d task is not idle\n",
- __func__, idx);
+ __func__, task->bufidx);
spin_unlock_irqrestore(
&task->g2d_dev->lock_task, flags);
ptask = ptask->next;
}
- g2d_stamp_task(task, G2D_STAMP_STATE_HWFCBUF, idx);
+ g2d_stamp_task(task, G2D_STAMP_STATE_HWFCBUF, task->bufidx);
- task->job_id = idx;
+ task->job_id = task->bufidx;
spin_unlock_irqrestore(&task->g2d_dev->lock_task, flags);
data->num_buffers = 1;
data->buffer[0].dmabuf.offset = 0;
- data->buffer[0].length = (__u32)ctx->hwfc_info->bufs[idx]->size;
+ data->buffer[0].length =
+ (__u32)ctx->hwfc_info->bufs[task->bufidx]->size;
}
if (target->buffer_type == G2D_BUFTYPE_EMPTY) {