* [PATCH v5 0/2] Add resolution change event
@ 2014-05-14 6:59 Arun Kumar K
2014-05-14 6:59 ` [PATCH v5 1/2] [media] v4l: Add source " Arun Kumar K
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Arun Kumar K @ 2014-05-14 6:59 UTC (permalink / raw)
To: linux-media, linux-samsung-soc
Cc: k.debski, s.nawrocki, hverkuil, laurent.pinchart, posciak,
arunkk.samsung
This patchset adds a source_change event to the v4l2-events.
This can be used for notifying the userspace about runtime
format changes happening on video nodes / pads like resolution
change in video decoder.
Changes from v4
--------------
- Addressed comments from Hans
https://patchwork.linuxtv.org/patch/23892/
https://patchwork.linuxtv.org/patch/23893/
Changes from v3
--------------
- Addressed comments from Laurent / Hans
https://patchwork.kernel.org/patch/4135731/
Changes from v2
---------------
- Event can be subscribed on specific pad / port as
suggested by Hans.
Changes from v1
---------------
- Addressed review comments from Hans and Laurent
https://patchwork.kernel.org/patch/4000951/
Arun Kumar K (1):
[media] v4l: Add source change event
Pawel Osciak (1):
[media] s5p-mfc: Add support for resolution change event
Documentation/DocBook/media/v4l/vidioc-dqevent.xml | 33 ++++++++++++++++++
.../DocBook/media/v4l/vidioc-subscribe-event.xml | 20 +++++++++++
drivers/media/platform/s5p-mfc/s5p_mfc.c | 8 +++++
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 2 ++
drivers/media/v4l2-core/v4l2-event.c | 36 ++++++++++++++++++++
include/media/v4l2-event.h | 4 +++
include/uapi/linux/videodev2.h | 8 +++++
7 files changed, 111 insertions(+)
--
1.7.9.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v5 1/2] [media] v4l: Add source change event
2014-05-14 6:59 [PATCH v5 0/2] Add resolution change event Arun Kumar K
@ 2014-05-14 6:59 ` Arun Kumar K
2014-05-14 9:05 ` Sylwester Nawrocki
2014-05-14 6:59 ` [PATCH v5 2/2] [media] s5p-mfc: Add support for resolution " Arun Kumar K
2014-05-14 7:11 ` [PATCH v5 0/2] Add " Hans Verkuil
2 siblings, 1 reply; 7+ messages in thread
From: Arun Kumar K @ 2014-05-14 6:59 UTC (permalink / raw)
To: linux-media, linux-samsung-soc
Cc: k.debski, s.nawrocki, hverkuil, laurent.pinchart, posciak,
arunkk.samsung
This event indicates that the video device has encountered
a source parameter change during runtime. This can typically be a
resolution change detected by a video decoder OR a format change
detected by an input connector.
This needs to be nofified to the userspace and the application may
be expected to reallocate buffers before proceeding. The application
can subscribe to events on a specific pad or input port which
it is interested in.
Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
---
Documentation/DocBook/media/v4l/vidioc-dqevent.xml | 33 ++++++++++++++++++
.../DocBook/media/v4l/vidioc-subscribe-event.xml | 20 +++++++++++
drivers/media/v4l2-core/v4l2-event.c | 36 ++++++++++++++++++++
include/media/v4l2-event.h | 4 +++
include/uapi/linux/videodev2.h | 8 +++++
5 files changed, 101 insertions(+)
diff --git a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
index 89891ad..820f86e 100644
--- a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
@@ -242,6 +242,22 @@
</tgroup>
</table>
+ <table frame="none" pgwide="1" id="v4l2-event-src-change">
+ <title>struct <structname>v4l2_event_src_change</structname></title>
+ <tgroup cols="3">
+ &cs-str;
+ <tbody valign="top">
+ <row>
+ <entry>__u32</entry>
+ <entry><structfield>changes</structfield></entry>
+ <entry>
+ A bitmask that tells what has changed. See <xref linkend="src-changes-flags" />.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
<table pgwide="1" frame="none" id="changes-flags">
<title>Changes</title>
<tgroup cols="3">
@@ -270,6 +286,23 @@
</tbody>
</tgroup>
</table>
+
+ <table pgwide="1" frame="none" id="src-changes-flags">
+ <title>Source Changes</title>
+ <tgroup cols="3">
+ &cs-def;
+ <tbody valign="top">
+ <row>
+ <entry><constant>V4L2_EVENT_SRC_CH_RESOLUTION</constant></entry>
+ <entry>0x0001</entry>
+ <entry>This event gets triggered when a resolution change is
+ detected at an input. This can come from an input connector or
+ from a video decoder.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
</refsect1>
<refsect1>
&return-value;
diff --git a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
index 5c70b61..f016254 100644
--- a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
@@ -155,6 +155,26 @@
</entry>
</row>
<row>
+ <entry><constant>V4L2_EVENT_SOURCE_CHANGE</constant></entry>
+ <entry>5</entry>
+ <entry>
+ <para>This event is triggered when a source parameter change is
+ detected during runtime by the video device. It can be a
+ runtime resolution change triggered by a video decoder or the
+ format change happening on an input connector.
+ This event requires that the <structfield>id</structfield>
+ matches the input index (when used with a video device node)
+ or the pad index (when used with a subdevice node) from which
+ you want to receive events.</para>
+
+ <para>This event has a &v4l2-event-source-change; associated
+ with it. The <structfield>changes</structfield> bitfield denotes
+ what has changed for the subscribed pad. If multiple events
+ occurred before application could dequeue them, then the changes
+ will have the ORed value of all the events generated.</para>
+ </entry>
+ </row>
+ <row>
<entry><constant>V4L2_EVENT_PRIVATE_START</constant></entry>
<entry>0x08000000</entry>
<entry>Base event number for driver-private events.</entry>
diff --git a/drivers/media/v4l2-core/v4l2-event.c b/drivers/media/v4l2-core/v4l2-event.c
index 86dcb54..8761aab 100644
--- a/drivers/media/v4l2-core/v4l2-event.c
+++ b/drivers/media/v4l2-core/v4l2-event.c
@@ -318,3 +318,39 @@ int v4l2_event_subdev_unsubscribe(struct v4l2_subdev *sd, struct v4l2_fh *fh,
return v4l2_event_unsubscribe(fh, sub);
}
EXPORT_SYMBOL_GPL(v4l2_event_subdev_unsubscribe);
+
+static void v4l2_event_src_replace(struct v4l2_event *old,
+ const struct v4l2_event *new)
+{
+ u32 old_changes = old->u.src_change.changes;
+
+ old->u.src_change = new->u.src_change;
+ old->u.src_change.changes |= old_changes;
+}
+
+static void v4l2_event_src_merge(const struct v4l2_event *old,
+ struct v4l2_event *new)
+{
+ new->u.src_change.changes |= old->u.src_change.changes;
+}
+
+static const struct v4l2_subscribed_event_ops v4l2_event_src_ch_ops = {
+ .replace = v4l2_event_src_replace,
+ .merge = v4l2_event_src_merge,
+};
+
+int v4l2_src_change_event_subscribe(struct v4l2_fh *fh,
+ const struct v4l2_event_subscription *sub)
+{
+ if (sub->type == V4L2_EVENT_SOURCE_CHANGE)
+ return v4l2_event_subscribe(fh, sub, 0, &v4l2_event_src_ch_ops);
+ return -EINVAL;
+}
+EXPORT_SYMBOL_GPL(v4l2_src_change_event_subscribe);
+
+int v4l2_src_change_event_subdev_subscribe(struct v4l2_subdev *sd,
+ struct v4l2_fh *fh, struct v4l2_event_subscription *sub)
+{
+ return v4l2_src_change_event_subscribe(fh, sub);
+}
+EXPORT_SYMBOL_GPL(v4l2_src_change_event_subdev_subscribe);
diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h
index be05d01..1ab9045 100644
--- a/include/media/v4l2-event.h
+++ b/include/media/v4l2-event.h
@@ -132,4 +132,8 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh,
void v4l2_event_unsubscribe_all(struct v4l2_fh *fh);
int v4l2_event_subdev_unsubscribe(struct v4l2_subdev *sd, struct v4l2_fh *fh,
struct v4l2_event_subscription *sub);
+int v4l2_src_change_event_subscribe(struct v4l2_fh *fh,
+ const struct v4l2_event_subscription *sub);
+int v4l2_src_change_event_subdev_subscribe(struct v4l2_subdev *sd,
+ struct v4l2_fh *fh, struct v4l2_event_subscription *sub);
#endif /* V4L2_EVENT_H */
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index ea468ee..b923d91 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -1765,6 +1765,7 @@ struct v4l2_streamparm {
#define V4L2_EVENT_EOS 2
#define V4L2_EVENT_CTRL 3
#define V4L2_EVENT_FRAME_SYNC 4
+#define V4L2_EVENT_SOURCE_CHANGE 5
#define V4L2_EVENT_PRIVATE_START 0x08000000
/* Payload for V4L2_EVENT_VSYNC */
@@ -1796,12 +1797,19 @@ struct v4l2_event_frame_sync {
__u32 frame_sequence;
};
+#define V4L2_EVENT_SRC_CH_RESOLUTION (1 << 0)
+
+struct v4l2_event_src_change {
+ __u32 changes;
+};
+
struct v4l2_event {
__u32 type;
union {
struct v4l2_event_vsync vsync;
struct v4l2_event_ctrl ctrl;
struct v4l2_event_frame_sync frame_sync;
+ struct v4l2_event_src_change src_change;
__u8 data[64];
} u;
__u32 pending;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v5 2/2] [media] s5p-mfc: Add support for resolution change event
2014-05-14 6:59 [PATCH v5 0/2] Add resolution change event Arun Kumar K
2014-05-14 6:59 ` [PATCH v5 1/2] [media] v4l: Add source " Arun Kumar K
@ 2014-05-14 6:59 ` Arun Kumar K
2014-05-14 9:10 ` Sylwester Nawrocki
2014-05-14 9:23 ` Kamil Debski
2014-05-14 7:11 ` [PATCH v5 0/2] Add " Hans Verkuil
2 siblings, 2 replies; 7+ messages in thread
From: Arun Kumar K @ 2014-05-14 6:59 UTC (permalink / raw)
To: linux-media, linux-samsung-soc
Cc: k.debski, s.nawrocki, hverkuil, laurent.pinchart, posciak,
arunkk.samsung
From: Pawel Osciak <posciak@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 <posciak@chromium.org>
Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
---
drivers/media/platform/s5p-mfc/s5p_mfc.c | 8 ++++++++
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 2 ++
2 files changed, 10 insertions(+)
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 6b04f17..f3a4576 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -349,8 +349,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);
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index 4586186..326d8db 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_SOURCE_CHANGE:
+ return v4l2_src_change_event_subscribe(fh, sub);
default:
return -EINVAL;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v5 0/2] Add resolution change event
2014-05-14 6:59 [PATCH v5 0/2] Add resolution change event Arun Kumar K
2014-05-14 6:59 ` [PATCH v5 1/2] [media] v4l: Add source " Arun Kumar K
2014-05-14 6:59 ` [PATCH v5 2/2] [media] s5p-mfc: Add support for resolution " Arun Kumar K
@ 2014-05-14 7:11 ` Hans Verkuil
2 siblings, 0 replies; 7+ messages in thread
From: Hans Verkuil @ 2014-05-14 7:11 UTC (permalink / raw)
To: Arun Kumar K, linux-media, linux-samsung-soc
Cc: k.debski, s.nawrocki, laurent.pinchart, posciak, arunkk.samsung
On 05/14/2014 08:59 AM, Arun Kumar K wrote:
> This patchset adds a source_change event to the v4l2-events.
> This can be used for notifying the userspace about runtime
> format changes happening on video nodes / pads like resolution
> change in video decoder.
Looks good. I'll merge this after the weekend if there are no more comments.
Regards,
Hans
>
> Changes from v4
> --------------
> - Addressed comments from Hans
> https://patchwork.linuxtv.org/patch/23892/
> https://patchwork.linuxtv.org/patch/23893/
>
> Changes from v3
> --------------
> - Addressed comments from Laurent / Hans
> https://patchwork.kernel.org/patch/4135731/
>
> Changes from v2
> ---------------
> - Event can be subscribed on specific pad / port as
> suggested by Hans.
>
> Changes from v1
> ---------------
> - Addressed review comments from Hans and Laurent
> https://patchwork.kernel.org/patch/4000951/
>
> Arun Kumar K (1):
> [media] v4l: Add source change event
>
> Pawel Osciak (1):
> [media] s5p-mfc: Add support for resolution change event
>
> Documentation/DocBook/media/v4l/vidioc-dqevent.xml | 33 ++++++++++++++++++
> .../DocBook/media/v4l/vidioc-subscribe-event.xml | 20 +++++++++++
> drivers/media/platform/s5p-mfc/s5p_mfc.c | 8 +++++
> drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 2 ++
> drivers/media/v4l2-core/v4l2-event.c | 36 ++++++++++++++++++++
> include/media/v4l2-event.h | 4 +++
> include/uapi/linux/videodev2.h | 8 +++++
> 7 files changed, 111 insertions(+)
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v5 1/2] [media] v4l: Add source change event
2014-05-14 6:59 ` [PATCH v5 1/2] [media] v4l: Add source " Arun Kumar K
@ 2014-05-14 9:05 ` Sylwester Nawrocki
0 siblings, 0 replies; 7+ messages in thread
From: Sylwester Nawrocki @ 2014-05-14 9:05 UTC (permalink / raw)
To: Arun Kumar K
Cc: linux-media, linux-samsung-soc, k.debski, hverkuil,
laurent.pinchart, posciak, arunkk.samsung
Hi Arun,
On 14/05/14 08:59, Arun Kumar K wrote:
> This event indicates that the video device has encountered
> a source parameter change during runtime. This can typically be a
> resolution change detected by a video decoder OR a format change
> detected by an input connector.
>
> This needs to be nofified to the userspace and the application may
> be expected to reallocate buffers before proceeding. The application
> can subscribe to events on a specific pad or input port which
> it is interested in.
>
> Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
This looks like a nice API enhancement.
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
> Documentation/DocBook/media/v4l/vidioc-dqevent.xml | 33 ++++++++++++++++++
> .../DocBook/media/v4l/vidioc-subscribe-event.xml | 20 +++++++++++
> drivers/media/v4l2-core/v4l2-event.c | 36 ++++++++++++++++++++
> include/media/v4l2-event.h | 4 +++
> include/uapi/linux/videodev2.h | 8 +++++
> 5 files changed, 101 insertions(+)
>
> diff --git a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
> index 89891ad..820f86e 100644
> --- a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
> +++ b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
> @@ -242,6 +242,22 @@
> </tgroup>
> </table>
>
> + <table frame="none" pgwide="1" id="v4l2-event-src-change">
> + <title>struct <structname>v4l2_event_src_change</structname></title>
> + <tgroup cols="3">
> + &cs-str;
> + <tbody valign="top">
> + <row>
> + <entry>__u32</entry>
> + <entry><structfield>changes</structfield></entry>
> + <entry>
> + A bitmask that tells what has changed. See <xref linkend="src-changes-flags" />.
> + </entry>
> + </row>
> + </tbody>
> + </tgroup>
> + </table>
> +
> <table pgwide="1" frame="none" id="changes-flags">
> <title>Changes</title>
> <tgroup cols="3">
> @@ -270,6 +286,23 @@
> </tbody>
> </tgroup>
> </table>
> +
> + <table pgwide="1" frame="none" id="src-changes-flags">
> + <title>Source Changes</title>
> + <tgroup cols="3">
> + &cs-def;
> + <tbody valign="top">
> + <row>
> + <entry><constant>V4L2_EVENT_SRC_CH_RESOLUTION</constant></entry>
> + <entry>0x0001</entry>
> + <entry>This event gets triggered when a resolution change is
> + detected at an input. This can come from an input connector or
> + from a video decoder.
> + </entry>
> + </row>
> + </tbody>
> + </tgroup>
> + </table>
> </refsect1>
> <refsect1>
> &return-value;
> diff --git a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
> index 5c70b61..f016254 100644
> --- a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
> +++ b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
> @@ -155,6 +155,26 @@
> </entry>
> </row>
> <row>
> + <entry><constant>V4L2_EVENT_SOURCE_CHANGE</constant></entry>
> + <entry>5</entry>
> + <entry>
> + <para>This event is triggered when a source parameter change is
> + detected during runtime by the video device. It can be a
> + runtime resolution change triggered by a video decoder or the
> + format change happening on an input connector.
> + This event requires that the <structfield>id</structfield>
> + matches the input index (when used with a video device node)
> + or the pad index (when used with a subdevice node) from which
> + you want to receive events.</para>
> +
> + <para>This event has a &v4l2-event-source-change; associated
> + with it. The <structfield>changes</structfield> bitfield denotes
> + what has changed for the subscribed pad. If multiple events
> + occurred before application could dequeue them, then the changes
> + will have the ORed value of all the events generated.</para>
> + </entry>
> + </row>
> + <row>
> <entry><constant>V4L2_EVENT_PRIVATE_START</constant></entry>
> <entry>0x08000000</entry>
> <entry>Base event number for driver-private events.</entry>
> diff --git a/drivers/media/v4l2-core/v4l2-event.c b/drivers/media/v4l2-core/v4l2-event.c
> index 86dcb54..8761aab 100644
> --- a/drivers/media/v4l2-core/v4l2-event.c
> +++ b/drivers/media/v4l2-core/v4l2-event.c
> @@ -318,3 +318,39 @@ int v4l2_event_subdev_unsubscribe(struct v4l2_subdev *sd, struct v4l2_fh *fh,
> return v4l2_event_unsubscribe(fh, sub);
> }
> EXPORT_SYMBOL_GPL(v4l2_event_subdev_unsubscribe);
> +
> +static void v4l2_event_src_replace(struct v4l2_event *old,
> + const struct v4l2_event *new)
> +{
> + u32 old_changes = old->u.src_change.changes;
> +
> + old->u.src_change = new->u.src_change;
> + old->u.src_change.changes |= old_changes;
> +}
> +
> +static void v4l2_event_src_merge(const struct v4l2_event *old,
> + struct v4l2_event *new)
> +{
> + new->u.src_change.changes |= old->u.src_change.changes;
> +}
> +
> +static const struct v4l2_subscribed_event_ops v4l2_event_src_ch_ops = {
> + .replace = v4l2_event_src_replace,
> + .merge = v4l2_event_src_merge,
> +};
> +
> +int v4l2_src_change_event_subscribe(struct v4l2_fh *fh,
> + const struct v4l2_event_subscription *sub)
> +{
> + if (sub->type == V4L2_EVENT_SOURCE_CHANGE)
> + return v4l2_event_subscribe(fh, sub, 0, &v4l2_event_src_ch_ops);
> + return -EINVAL;
> +}
> +EXPORT_SYMBOL_GPL(v4l2_src_change_event_subscribe);
> +
> +int v4l2_src_change_event_subdev_subscribe(struct v4l2_subdev *sd,
> + struct v4l2_fh *fh, struct v4l2_event_subscription *sub)
> +{
> + return v4l2_src_change_event_subscribe(fh, sub);
> +}
> +EXPORT_SYMBOL_GPL(v4l2_src_change_event_subdev_subscribe);
> diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h
> index be05d01..1ab9045 100644
> --- a/include/media/v4l2-event.h
> +++ b/include/media/v4l2-event.h
> @@ -132,4 +132,8 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh,
> void v4l2_event_unsubscribe_all(struct v4l2_fh *fh);
> int v4l2_event_subdev_unsubscribe(struct v4l2_subdev *sd, struct v4l2_fh *fh,
> struct v4l2_event_subscription *sub);
> +int v4l2_src_change_event_subscribe(struct v4l2_fh *fh,
> + const struct v4l2_event_subscription *sub);
> +int v4l2_src_change_event_subdev_subscribe(struct v4l2_subdev *sd,
> + struct v4l2_fh *fh, struct v4l2_event_subscription *sub);
> #endif /* V4L2_EVENT_H */
> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> index ea468ee..b923d91 100644
> --- a/include/uapi/linux/videodev2.h
> +++ b/include/uapi/linux/videodev2.h
> @@ -1765,6 +1765,7 @@ struct v4l2_streamparm {
> #define V4L2_EVENT_EOS 2
> #define V4L2_EVENT_CTRL 3
> #define V4L2_EVENT_FRAME_SYNC 4
> +#define V4L2_EVENT_SOURCE_CHANGE 5
> #define V4L2_EVENT_PRIVATE_START 0x08000000
>
> /* Payload for V4L2_EVENT_VSYNC */
> @@ -1796,12 +1797,19 @@ struct v4l2_event_frame_sync {
> __u32 frame_sequence;
> };
>
> +#define V4L2_EVENT_SRC_CH_RESOLUTION (1 << 0)
> +
> +struct v4l2_event_src_change {
> + __u32 changes;
> +};
> +
> struct v4l2_event {
> __u32 type;
> union {
> struct v4l2_event_vsync vsync;
> struct v4l2_event_ctrl ctrl;
> struct v4l2_event_frame_sync frame_sync;
> + struct v4l2_event_src_change src_change;
> __u8 data[64];
> } u;
> __u32 pending;
>
--
Sylwester Nawrocki
Samsung R&D Institute Poland
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v5 2/2] [media] s5p-mfc: Add support for resolution change event
2014-05-14 6:59 ` [PATCH v5 2/2] [media] s5p-mfc: Add support for resolution " Arun Kumar K
@ 2014-05-14 9:10 ` Sylwester Nawrocki
2014-05-14 9:23 ` Kamil Debski
1 sibling, 0 replies; 7+ messages in thread
From: Sylwester Nawrocki @ 2014-05-14 9:10 UTC (permalink / raw)
To: Arun Kumar K
Cc: linux-media, linux-samsung-soc, k.debski, hverkuil,
laurent.pinchart, posciak, arunkk.samsung
On 14/05/14 08:59, Arun Kumar K wrote:
> From: Pawel Osciak <posciak@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 <posciak@chromium.org>
> Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
> drivers/media/platform/s5p-mfc/s5p_mfc.c | 8 ++++++++
> drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 2 ++
> 2 files changed, 10 insertions(+)
>
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
> index 6b04f17..f3a4576 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
> @@ -349,8 +349,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);
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> index 4586186..326d8db 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_SOURCE_CHANGE:
> + return v4l2_src_change_event_subscribe(fh, sub);
> default:
> return -EINVAL;
> }
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH v5 2/2] [media] s5p-mfc: Add support for resolution change event
2014-05-14 6:59 ` [PATCH v5 2/2] [media] s5p-mfc: Add support for resolution " Arun Kumar K
2014-05-14 9:10 ` Sylwester Nawrocki
@ 2014-05-14 9:23 ` Kamil Debski
1 sibling, 0 replies; 7+ messages in thread
From: Kamil Debski @ 2014-05-14 9:23 UTC (permalink / raw)
To: 'Arun Kumar K', linux-media, linux-samsung-soc
Cc: Sylwester Nawrocki, hverkuil, laurent.pinchart, posciak,
arunkk.samsung
Hi,
Thank you for this patch.
> From: Arun Kumar K [mailto:arunkk.samsung@gmail.com] On Behalf Of Arun
> Kumar K
> Sent: Wednesday, May 14, 2014 9:00 AM
> To: linux-media@vger.kernel.org; linux-samsung-soc@vger.kernel.org
> Cc: k.debski@samsung.com; s.nawrocki@samsung.com; hverkuil@xs4all.nl;
> laurent.pinchart@ideasonboard.com; posciak@chromium.org;
> arunkk.samsung@gmail.com
> Subject: [PATCH v5 2/2] [media] s5p-mfc: Add support for resolution
> change event
>
> From: Pawel Osciak <posciak@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 <posciak@chromium.org>
> Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
Acked-by: Kamil Debski <k.debski@samsung.com>
> ---
> drivers/media/platform/s5p-mfc/s5p_mfc.c | 8 ++++++++
> drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 2 ++
> 2 files changed, 10 insertions(+)
>
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c
> b/drivers/media/platform/s5p-mfc/s5p_mfc.c
> index 6b04f17..f3a4576 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
> @@ -349,8 +349,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);
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> index 4586186..326d8db 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_SOURCE_CHANGE:
> + return v4l2_src_change_event_subscribe(fh, sub);
> default:
> return -EINVAL;
> }
> --
> 1.7.9.5
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-05-14 9:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-14 6:59 [PATCH v5 0/2] Add resolution change event Arun Kumar K
2014-05-14 6:59 ` [PATCH v5 1/2] [media] v4l: Add source " Arun Kumar K
2014-05-14 9:05 ` Sylwester Nawrocki
2014-05-14 6:59 ` [PATCH v5 2/2] [media] s5p-mfc: Add support for resolution " Arun Kumar K
2014-05-14 9:10 ` Sylwester Nawrocki
2014-05-14 9:23 ` Kamil Debski
2014-05-14 7:11 ` [PATCH v5 0/2] Add " Hans Verkuil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).