From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org, g.liakhovetski@gmx.de,
sakari.ailus@iki.fi, riverful.kim@samsung.com,
sw0312.kim@samsung.com, m.szyprowski@samsung.com,
Kyungmin Park <kyungmin.park@samsung.com>
Subject: Re: [PATCH/RFC v3 4/4] v4l: Update subdev drivers to handle framesamples parameter
Date: Mon, 12 Dec 2011 15:39:59 +0100 [thread overview]
Message-ID: <4EE6123F.1040709@samsung.com> (raw)
In-Reply-To: <201112120131.24192.laurent.pinchart@ideasonboard.com>
Hi Laurent,
On 12/12/2011 01:31 AM, Laurent Pinchart wrote:
> On Friday 09 December 2011 18:59:52 Sylwester Nawrocki wrote:
>> Update the sub-device drivers having a devnode enabled so they properly
>> handle the new framesamples field of struct v4l2_mbus_framefmt.
>> These drivers don't support compressed (entropy encoded) formats so the
>> framesamples field is simply initialized to 0, altogether with the
>> reserved structure member.
>>
>> There is a few other drivers that expose a devnode (mt9p031, mt9t001,
>> mt9v032), but they already implicitly initialize the new data structure
>> field to 0, so they don't need to be touched.
>>
>> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>> ---
>> Hi,
>>
>> In this version the whole reserved field in struct v4l2_mbus_framefmt
>> is also cleared, rather than setting only framesamples to 0.
>>
>> The omap3isp driver changes have been only compile tested.
>>
>> Thanks,
>> Sylwester
>> ---
>> drivers/media/video/noon010pc30.c | 5 ++++-
>> drivers/media/video/omap3isp/ispccdc.c | 2 ++
>> drivers/media/video/omap3isp/ispccp2.c | 2 ++
>> drivers/media/video/omap3isp/ispcsi2.c | 2 ++
>> drivers/media/video/omap3isp/isppreview.c | 2 ++
>> drivers/media/video/omap3isp/ispresizer.c | 2 ++
>> drivers/media/video/s5k6aa.c | 2 ++
>> 7 files changed, 16 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/media/video/noon010pc30.c
>> b/drivers/media/video/noon010pc30.c index 50838bf..5af9b60 100644
>> --- a/drivers/media/video/noon010pc30.c
>> +++ b/drivers/media/video/noon010pc30.c
>> @@ -519,13 +519,14 @@ static int noon010_get_fmt(struct v4l2_subdev *sd,
>> struct v4l2_subdev_fh *fh, mf = &fmt->format;
>>
>> mutex_lock(&info->lock);
>> + memset(mf, 0, sizeof(mf));
>> mf->width = info->curr_win->width;
>> mf->height = info->curr_win->height;
>> mf->code = info->curr_fmt->code;
>> mf->colorspace = info->curr_fmt->colorspace;
>> mf->field = V4L2_FIELD_NONE;
>> -
>> mutex_unlock(&info->lock);
>> +
>> return 0;
>> }
>>
>> @@ -546,12 +547,14 @@ static const struct noon010_format
>> *noon010_try_fmt(struct v4l2_subdev *sd, static int noon010_set_fmt(struct
>> v4l2_subdev *sd, struct v4l2_subdev_fh *fh, struct v4l2_subdev_format
>> *fmt)
>> {
>> + const int offset = offsetof(struct v4l2_mbus_framefmt, framesamples);
>> struct noon010_info *info = to_noon010(sd);
>> const struct noon010_frmsize *size = NULL;
>> const struct noon010_format *nf;
>> struct v4l2_mbus_framefmt *mf;
>> int ret = 0;
>>
>> + memset(&fmt->format + offset, 0, sizeof(fmt->format) - offset);
>
> I'm not sure this is a good idea, as it will break when a new field will be
> added to struct v4l2_mbus_framefmt.
I'm not sure it will break. Now there everything cleared after (and including)
framesamples field.
struct v4l2_mbus_framefmt {
__u32 width;
__u32 height;
__u32 code;
__u32 field;
__u32 colorspace;
__u32 framesamples;
__u32 reserved[6];
};
Assuming we convert reserved[0] to new_field
struct v4l2_mbus_framefmt {
__u32 width;
__u32 height;
__u32 code;
__u32 field;
__u32 colorspace;
__u32 framesamples;
__u32 new_field;
__u32 reserved[5];
};
the code:
const int offset = offsetof(struct v4l2_mbus_framefmt, framesamples);
memset(&fmt->format + offset, 0, sizeof(fmt->format) - offset);
would still clear 7 u32' at the structure end, wouldn't it?
>
> Wouldn't it be better to zero the whoel structure in the callers instead ?
--
Regards
Sylwester
next prev parent reply other threads:[~2011-12-12 14:40 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-01 10:20 [RFC v2] v4l2: Compressed data formats on the video bus Sylwester Nawrocki
2011-12-01 10:20 ` [PATCH/RFC v2 1/4] v4l: Add new framesamples field to struct v4l2_mbus_framefmt Sylwester Nawrocki
2011-12-01 10:20 ` [PATCH/RFC v2 2/4] m5mols: Add support for buffer size configuration for compressed formats Sylwester Nawrocki
2011-12-01 10:20 ` [PATCH/RFC v2 3/4] s5p-fimc: Add support for media bus framesamples parameter Sylwester Nawrocki
2011-12-01 10:20 ` [PATCH/RFC v2 4/4] v4l: Update subdev drivers to handle " Sylwester Nawrocki
2011-12-06 16:12 ` Laurent Pinchart
2011-12-06 17:36 ` Sylwester Nawrocki
2011-12-09 17:59 ` [PATCH/RFC v3 " Sylwester Nawrocki
2011-12-12 0:31 ` Laurent Pinchart
2011-12-12 14:39 ` Sylwester Nawrocki [this message]
2011-12-14 12:23 ` [PATCH/RFC v4 0/2] v4l2: Extend media bus format with framesamples field Sylwester Nawrocki
2011-12-14 12:23 ` [PATCHv4 1/2] v4l: Add new framesamples field to struct v4l2_mbus_framefmt Sylwester Nawrocki
2011-12-21 0:20 ` Laurent Pinchart
2011-12-22 11:35 ` Sylwester Nawrocki
2011-12-26 12:53 ` Sakari Ailus
2011-12-28 17:09 ` Sylwester Nawrocki
2011-12-31 13:16 ` Sakari Ailus
2012-01-01 18:56 ` Sylwester Nawrocki
2012-01-04 12:21 ` Sakari Ailus
2012-01-04 22:51 ` Sylwester Nawrocki
2012-01-06 15:44 ` Sakari Ailus
2012-01-11 13:20 ` Laurent Pinchart
2012-01-06 14:04 ` Sylwester Nawrocki
2011-12-14 12:23 ` [PATCHv4 2/2] v4l: Update subdev drivers to handle framesamples parameter Sylwester Nawrocki
2011-12-15 10:14 ` [PATCHv5] " Sylwester Nawrocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EE6123F.1040709@samsung.com \
--to=s.nawrocki@samsung.com \
--cc=g.liakhovetski@gmx.de \
--cc=kyungmin.park@samsung.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=riverful.kim@samsung.com \
--cc=sakari.ailus@iki.fi \
--cc=sw0312.kim@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.