From: Pawel Osciak <posc...@chromium.org>

When a resolution change point is reached, queue an event to signal the
userspace that a new set of buffers is required before decoding can
continue.

Signed-off-by: Pawel Osciak <posc...@chromium.org>
Signed-off-by: Arun Kumar K <arun...@samsung.com>
---
 drivers/media/platform/s5p-mfc/s5p_mfc.c     |    6 ++++++
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c |    2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 4ee5a02..2efa758 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -308,6 +308,7 @@ static void s5p_mfc_handle_frame(struct s5p_mfc_ctx *ctx,
        struct s5p_mfc_buf *src_buf;
        unsigned long flags;
        unsigned int res_change;
+       struct v4l2_event ev;
 
        dst_frame_status = s5p_mfc_hw_call(dev->mfc_ops, get_dspl_status, dev)
                                & S5P_FIMV_DEC_STATUS_DECODING_STATUS_MASK;
@@ -339,6 +340,11 @@ static void s5p_mfc_handle_frame(struct s5p_mfc_ctx *ctx,
                if (ctx->state == MFCINST_RES_CHANGE_FLUSH) {
                        s5p_mfc_handle_frame_all_extracted(ctx);
                        ctx->state = MFCINST_RES_CHANGE_END;
+
+                       memset(&ev, 0, sizeof(struct v4l2_event));
+                       ev.type = V4L2_EVENT_RESOLUTION_CHANGE;
+                       v4l2_event_queue_fh(&ctx->fh, &ev);
+
                        goto leave_handle_frame;
                } else {
                        s5p_mfc_handle_frame_all_extracted(ctx);
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index 4586186..dd0ec6f 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -851,6 +851,8 @@ static int vidioc_subscribe_event(struct v4l2_fh *fh,
        switch (sub->type) {
        case V4L2_EVENT_EOS:
                return v4l2_event_subscribe(fh, sub, 2, NULL);
+       case V4L2_EVENT_RESOLUTION_CHANGE:
+               return v4l2_event_subscribe(fh, sub, 2, NULL);
        default:
                return -EINVAL;
        }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to