[media] s5p-mfc: Add support for resolution change event
authorPawel Osciak <posciak@chromium.org>
Wed, 14 May 2014 06:59:43 +0000 (03:59 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Fri, 23 May 2014 22:51:10 +0000 (19:51 -0300)
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 <posciak@chromium.org>
Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/platform/s5p-mfc/s5p_mfc.c
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c

index d5f634d0ba05937f5b51bb9e4ef1f3da167d692d..41723180d10cb7f6528b8cd33122df1314e18ca3 100644 (file)
@@ -342,8 +342,16 @@ static void s5p_mfc_handle_frame(struct s5p_mfc_ctx *ctx,
        /* All frames remaining in the buffer have been extracted  */
        if (dst_frame_status == S5P_FIMV_DEC_STATUS_DECODING_EMPTY) {
                if (ctx->state == MFCINST_RES_CHANGE_FLUSH) {
+                       static const struct v4l2_event ev_src_ch = {
+                               .type = V4L2_EVENT_SOURCE_CHANGE,
+                               .u.src_change.changes =
+                                       V4L2_EVENT_SRC_CH_RESOLUTION,
+                       };
+
                        s5p_mfc_handle_frame_all_extracted(ctx);
                        ctx->state = MFCINST_RES_CHANGE_END;
+                       v4l2_event_queue_fh(&ctx->fh, &ev_src_ch);
+
                        goto leave_handle_frame;
                } else {
                        s5p_mfc_handle_frame_all_extracted(ctx);
index 6a8697e9ba235eac72a651baceae7fd04ea1e535..4d93835dec9dd5bc14fcd182f497e53c503da1f2 100644 (file)
@@ -867,6 +867,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_SOURCE_CHANGE:
+               return v4l2_src_change_event_subscribe(fh, sub);
        default:
                return -EINVAL;
        }