Commit bbc56faf authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

media: v4l: vsp1: Turn frame end completion status into a bitfield

We will soon need to return more than a boolean completion status from
the vsp1_dlm_irq_frame_end() IRQ handler. Turn the return value into a
bitfield to prepare for that. No functional change is introduced here.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: default avatarKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 5a4d566a
...@@ -616,14 +616,18 @@ void vsp1_dl_list_commit(struct vsp1_dl_list *dl) ...@@ -616,14 +616,18 @@ void vsp1_dl_list_commit(struct vsp1_dl_list *dl)
* vsp1_dlm_irq_frame_end - Display list handler for the frame end interrupt * vsp1_dlm_irq_frame_end - Display list handler for the frame end interrupt
* @dlm: the display list manager * @dlm: the display list manager
* *
* Return true if the previous display list has completed at frame end, or false * Return a set of flags that indicates display list completion status.
* if it has been delayed by one frame because the display list commit raced *
* with the frame end interrupt. The function always returns true in header mode * The VSP1_DL_FRAME_END_COMPLETED flag indicates that the previous display list
* as display list processing is then not continuous and races never occur. * has completed at frame end. If the flag is not returned display list
*/ * completion has been delayed by one frame because the display list commit
bool vsp1_dlm_irq_frame_end(struct vsp1_dl_manager *dlm) * raced with the frame end interrupt. The function always returns with the flag
* set in header mode as display list processing is then not continuous and
* races never occur.
*/
unsigned int vsp1_dlm_irq_frame_end(struct vsp1_dl_manager *dlm)
{ {
bool completed = false; unsigned int flags = 0;
spin_lock(&dlm->lock); spin_lock(&dlm->lock);
...@@ -634,7 +638,7 @@ bool vsp1_dlm_irq_frame_end(struct vsp1_dl_manager *dlm) ...@@ -634,7 +638,7 @@ bool vsp1_dlm_irq_frame_end(struct vsp1_dl_manager *dlm)
if (dlm->singleshot) { if (dlm->singleshot) {
__vsp1_dl_list_put(dlm->active); __vsp1_dl_list_put(dlm->active);
dlm->active = NULL; dlm->active = NULL;
completed = true; flags |= VSP1_DL_FRAME_END_COMPLETED;
goto done; goto done;
} }
...@@ -655,7 +659,7 @@ bool vsp1_dlm_irq_frame_end(struct vsp1_dl_manager *dlm) ...@@ -655,7 +659,7 @@ bool vsp1_dlm_irq_frame_end(struct vsp1_dl_manager *dlm)
__vsp1_dl_list_put(dlm->active); __vsp1_dl_list_put(dlm->active);
dlm->active = dlm->queued; dlm->active = dlm->queued;
dlm->queued = NULL; dlm->queued = NULL;
completed = true; flags |= VSP1_DL_FRAME_END_COMPLETED;
} }
/* /*
...@@ -672,7 +676,7 @@ bool vsp1_dlm_irq_frame_end(struct vsp1_dl_manager *dlm) ...@@ -672,7 +676,7 @@ bool vsp1_dlm_irq_frame_end(struct vsp1_dl_manager *dlm)
done: done:
spin_unlock(&dlm->lock); spin_unlock(&dlm->lock);
return completed; return flags;
} }
/* Hardware Setup */ /* Hardware Setup */
......
...@@ -20,6 +20,8 @@ struct vsp1_dl_fragment; ...@@ -20,6 +20,8 @@ struct vsp1_dl_fragment;
struct vsp1_dl_list; struct vsp1_dl_list;
struct vsp1_dl_manager; struct vsp1_dl_manager;
#define VSP1_DL_FRAME_END_COMPLETED BIT(0)
void vsp1_dlm_setup(struct vsp1_device *vsp1); void vsp1_dlm_setup(struct vsp1_device *vsp1);
struct vsp1_dl_manager *vsp1_dlm_create(struct vsp1_device *vsp1, struct vsp1_dl_manager *vsp1_dlm_create(struct vsp1_device *vsp1,
...@@ -27,7 +29,7 @@ struct vsp1_dl_manager *vsp1_dlm_create(struct vsp1_device *vsp1, ...@@ -27,7 +29,7 @@ struct vsp1_dl_manager *vsp1_dlm_create(struct vsp1_device *vsp1,
unsigned int prealloc); unsigned int prealloc);
void vsp1_dlm_destroy(struct vsp1_dl_manager *dlm); void vsp1_dlm_destroy(struct vsp1_dl_manager *dlm);
void vsp1_dlm_reset(struct vsp1_dl_manager *dlm); void vsp1_dlm_reset(struct vsp1_dl_manager *dlm);
bool vsp1_dlm_irq_frame_end(struct vsp1_dl_manager *dlm); unsigned int vsp1_dlm_irq_frame_end(struct vsp1_dl_manager *dlm);
struct vsp1_dl_list *vsp1_dl_list_get(struct vsp1_dl_manager *dlm); struct vsp1_dl_list *vsp1_dl_list_get(struct vsp1_dl_manager *dlm);
void vsp1_dl_list_put(struct vsp1_dl_list *dl); void vsp1_dl_list_put(struct vsp1_dl_list *dl);
......
...@@ -34,12 +34,13 @@ ...@@ -34,12 +34,13 @@
*/ */
static void vsp1_du_pipeline_frame_end(struct vsp1_pipeline *pipe, static void vsp1_du_pipeline_frame_end(struct vsp1_pipeline *pipe,
bool completed) unsigned int completion)
{ {
struct vsp1_drm_pipeline *drm_pipe = to_vsp1_drm_pipeline(pipe); struct vsp1_drm_pipeline *drm_pipe = to_vsp1_drm_pipeline(pipe);
if (drm_pipe->du_complete) if (drm_pipe->du_complete)
drm_pipe->du_complete(drm_pipe->du_private, completed); drm_pipe->du_complete(drm_pipe->du_private,
completion & VSP1_DL_FRAME_END_COMPLETED);
} }
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
......
...@@ -315,17 +315,17 @@ bool vsp1_pipeline_ready(struct vsp1_pipeline *pipe) ...@@ -315,17 +315,17 @@ bool vsp1_pipeline_ready(struct vsp1_pipeline *pipe)
void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe) void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe)
{ {
bool completed; unsigned int flags;
if (pipe == NULL) if (pipe == NULL)
return; return;
/* /*
* If the DL commit raced with the frame end interrupt, the commit ends * If the DL commit raced with the frame end interrupt, the commit ends
* up being postponed by one frame. @completed represents whether the * up being postponed by one frame. The returned flags tell whether the
* active frame was finished or postponed. * active frame was finished or postponed.
*/ */
completed = vsp1_dlm_irq_frame_end(pipe->output->dlm); flags = vsp1_dlm_irq_frame_end(pipe->output->dlm);
if (pipe->hgo) if (pipe->hgo)
vsp1_hgo_frame_end(pipe->hgo); vsp1_hgo_frame_end(pipe->hgo);
...@@ -338,7 +338,7 @@ void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe) ...@@ -338,7 +338,7 @@ void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe)
* frame_end to account for vblank events. * frame_end to account for vblank events.
*/ */
if (pipe->frame_end) if (pipe->frame_end)
pipe->frame_end(pipe, completed); pipe->frame_end(pipe, flags);
pipe->sequence++; pipe->sequence++;
} }
......
...@@ -118,7 +118,7 @@ struct vsp1_pipeline { ...@@ -118,7 +118,7 @@ struct vsp1_pipeline {
enum vsp1_pipeline_state state; enum vsp1_pipeline_state state;
wait_queue_head_t wq; wait_queue_head_t wq;
void (*frame_end)(struct vsp1_pipeline *pipe, bool completed); void (*frame_end)(struct vsp1_pipeline *pipe, unsigned int completion);
struct mutex lock; struct mutex lock;
struct kref kref; struct kref kref;
......
...@@ -444,7 +444,7 @@ static void vsp1_video_pipeline_run(struct vsp1_pipeline *pipe) ...@@ -444,7 +444,7 @@ static void vsp1_video_pipeline_run(struct vsp1_pipeline *pipe)
} }
static void vsp1_video_pipeline_frame_end(struct vsp1_pipeline *pipe, static void vsp1_video_pipeline_frame_end(struct vsp1_pipeline *pipe,
bool completed) unsigned int completion)
{ {
struct vsp1_device *vsp1 = pipe->output->entity.vsp1; struct vsp1_device *vsp1 = pipe->output->entity.vsp1;
enum vsp1_pipeline_state state; enum vsp1_pipeline_state state;
...@@ -452,7 +452,7 @@ static void vsp1_video_pipeline_frame_end(struct vsp1_pipeline *pipe, ...@@ -452,7 +452,7 @@ static void vsp1_video_pipeline_frame_end(struct vsp1_pipeline *pipe,
unsigned int i; unsigned int i;
/* M2M Pipelines should never call here with an incomplete frame. */ /* M2M Pipelines should never call here with an incomplete frame. */
WARN_ON_ONCE(!completed); WARN_ON_ONCE(!(completion & VSP1_DL_FRAME_END_COMPLETED));
spin_lock_irqsave(&pipe->irqlock, flags); spin_lock_irqsave(&pipe->irqlock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment