From: Steve Longerbeam <slongerbeam@gmail.com>
To: Hans Verkuil <hverkuil@xs4all.nl>,
Philipp Zabel <p.zabel@pengutronix.de>,
linux-media@vger.kernel.org
Cc: kernel@pengutronix.de
Subject: Re: [PATCH 3/3] media: imx: fix media bus format enumeration
Date: Fri, 25 Oct 2019 15:59:32 -0700 [thread overview]
Message-ID: <3ec9cffd-578d-2cd7-325d-98f1f087694e@gmail.com> (raw)
In-Reply-To: <6547e18f-e3d5-4e80-4e20-5eaf9ee0b86c@gmail.com>
Hi Hans, Philipp,
On 10/25/19 2:48 PM, Steve Longerbeam wrote:
> Hi Hans,
>
> On 9/27/19 12:33 AM, Hans Verkuil wrote:
>> On 9/12/19 6:01 PM, Philipp Zabel wrote:
>>> Iterate over all media bus formats, not just over the first format in
>>> each imx_media_pixfmt entry.
>>>
>>> Before:
>>>
>>> $ v4l2-ctl -d $(media-ctl -e ipu1_csi0) --list-subdev-mbus-codes 0
>>> ioctl: VIDIOC_SUBDEV_ENUM_MBUS_CODE (pad=0)
>>> 0x2006: MEDIA_BUS_FMT_UYVY8_2X8
>>> 0x2008: MEDIA_BUS_FMT_YUYV8_2X8
>>> 0x1008: MEDIA_BUS_FMT_RGB565_2X8_LE
>>> 0x100a: MEDIA_BUS_FMT_RGB888_1X24
>>> 0x100d: MEDIA_BUS_FMT_ARGB8888_1X32
>>> 0x3001: MEDIA_BUS_FMT_SBGGR8_1X8
>>> 0x3013: MEDIA_BUS_FMT_SGBRG8_1X8
>>> 0x3002: MEDIA_BUS_FMT_SGRBG8_1X8
>>> 0x3014: MEDIA_BUS_FMT_SRGGB8_1X8
>>> 0x3007: MEDIA_BUS_FMT_SBGGR10_1X10
>>> 0x300e: MEDIA_BUS_FMT_SGBRG10_1X10
>>> 0x300a: MEDIA_BUS_FMT_SGRBG10_1X10
>>> 0x300f: MEDIA_BUS_FMT_SRGGB10_1X10
>>> 0x2001: MEDIA_BUS_FMT_Y8_1X8
>>> 0x200a: MEDIA_BUS_FMT_Y10_1X10
>>>
>>> After:
>>>
>>> $ v4l2-ctl -d $(media-ctl -e ipu1_csi0) --list-subdev-mbus-codes 0
>>> ioctl: VIDIOC_SUBDEV_ENUM_MBUS_CODE (pad=0)
>>> 0x2006: MEDIA_BUS_FMT_UYVY8_2X8
>>> 0x200f: MEDIA_BUS_FMT_UYVY8_1X16
>>> 0x2008: MEDIA_BUS_FMT_YUYV8_2X8
>>> 0x2011: MEDIA_BUS_FMT_YUYV8_1X16
>>> 0x1008: MEDIA_BUS_FMT_RGB565_2X8_LE
>>> 0x100a: MEDIA_BUS_FMT_RGB888_1X24
>>> 0x100c: MEDIA_BUS_FMT_RGB888_2X12_LE
>>> 0x100d: MEDIA_BUS_FMT_ARGB8888_1X32
>>> 0x3001: MEDIA_BUS_FMT_SBGGR8_1X8
>>> 0x3013: MEDIA_BUS_FMT_SGBRG8_1X8
>>> 0x3002: MEDIA_BUS_FMT_SGRBG8_1X8
>>> 0x3014: MEDIA_BUS_FMT_SRGGB8_1X8
>>> 0x3007: MEDIA_BUS_FMT_SBGGR10_1X10
>>> 0x3008: MEDIA_BUS_FMT_SBGGR12_1X12
>>> 0x3019: MEDIA_BUS_FMT_SBGGR14_1X14
>>> 0x301d: MEDIA_BUS_FMT_SBGGR16_1X16
>>> 0x300e: MEDIA_BUS_FMT_SGBRG10_1X10
>>> 0x3010: MEDIA_BUS_FMT_SGBRG12_1X12
>>> 0x301a: MEDIA_BUS_FMT_SGBRG14_1X14
>>> 0x301e: MEDIA_BUS_FMT_SGBRG16_1X16
>>> 0x300a: MEDIA_BUS_FMT_SGRBG10_1X10
>>> 0x3011: MEDIA_BUS_FMT_SGRBG12_1X12
>>> 0x301b: MEDIA_BUS_FMT_SGRBG14_1X14
>>> 0x301f: MEDIA_BUS_FMT_SGRBG16_1X16
>>> 0x300f: MEDIA_BUS_FMT_SRGGB10_1X10
>>> 0x3012: MEDIA_BUS_FMT_SRGGB12_1X12
>>> 0x301c: MEDIA_BUS_FMT_SRGGB14_1X14
>>> 0x3020: MEDIA_BUS_FMT_SRGGB16_1X16
>>> 0x2001: MEDIA_BUS_FMT_Y8_1X8
>>> 0x200a: MEDIA_BUS_FMT_Y10_1X10
>>> 0x2013: MEDIA_BUS_FMT_Y12_1X12
>>>
>>> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
>>> ---
>>> drivers/staging/media/imx/imx-media-utils.c | 19 +++++++++++++++----
>>> 1 file changed, 15 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/staging/media/imx/imx-media-utils.c
>>> b/drivers/staging/media/imx/imx-media-utils.c
>>> index d61a8f4533dc..5f8604db4dd4 100644
>>> --- a/drivers/staging/media/imx/imx-media-utils.c
>>> +++ b/drivers/staging/media/imx/imx-media-utils.c
>>> @@ -254,7 +254,7 @@ static int enum_format(u32 *fourcc, u32 *code,
>>> u32 index,
>>> bool allow_bayer)
>>> {
>> This function is becoming confusing. I think you should add some
>> comments explaining
>> what the function does. Specifically the fourcc and code arguments.
>>
>> Can both be non-NULL? Or only one of the two? I think that if fourcc
>> is non-NULL you
>> enumerate over the V4L2 pixelformats, if code is non-NULL, then you
>> enumerate over
>> the mediabus codes.
>>
>> If so, then I think it would be easier to understand if you just make
>> two functions:
>> enum_formats and enum_codes, rather than trying to merge them into one.
>
> I don't think the function is that confusing, but I'm fine with
> splitting it into enum_formats() and enum_codes().
>
> I do agree it needs some comments describing how it works. I think my
> suggestion to rename the index that counts entries that match the
> search criteria to "match_index" will also help to follow the code.
>
I added a comment block for find_format() and enum_format() in my
media-tree github fork:
git@github.com:slongerbeam/mediatree.git, branch imx/philipp-pixfmts-cleanup
Steve
prev parent reply other threads:[~2019-10-25 22:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-12 16:01 [PATCH 1/3] media: imx: enable V4L2_PIX_FMT_XBGR32, _BGRX32, and _RGBX32 Philipp Zabel
2019-09-12 16:01 ` [PATCH 2/3] media: imx: fix and simplify pixel format enumeration Philipp Zabel
2019-09-14 3:36 ` kbuild test robot
2019-09-27 8:03 ` Hans Verkuil
2019-10-25 21:43 ` Steve Longerbeam
2019-09-12 16:01 ` [PATCH 3/3] media: imx: fix media bus " Philipp Zabel
2019-09-14 3:49 ` kbuild test robot
2019-09-27 7:33 ` Hans Verkuil
2019-10-25 21:48 ` Steve Longerbeam
2019-10-25 22:59 ` Steve Longerbeam [this message]
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=3ec9cffd-578d-2cd7-325d-98f1f087694e@gmail.com \
--to=slongerbeam@gmail.com \
--cc=hverkuil@xs4all.nl \
--cc=kernel@pengutronix.de \
--cc=linux-media@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox