Re: [PATCH v2 3/9] media: Rename stateful codec control macros

From: Ezequiel Garcia
Date: Sat Nov 14 2020 - 20:13:03 EST


On Sat, 2020-11-14 at 13:53 +0100, Hans Verkuil wrote:
> On 13/11/2020 22:51, Ezequiel Garcia wrote:
> > For historical reasons, stateful codec controls are named
> > as {}_MPEG_{}. While we can't at this point sanely
> > change all control IDs (such as V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER),
> > we can least change the more meaningful macros such as classes
> > macros.
> >
> > Signed-off-by: Ezequiel Garcia <ezequiel@xxxxxxxxxxxxx>
> > ---
> > .../userspace-api/media/v4l/dev-mem2mem.rst | 2 +-
> > .../media/v4l/ext-ctrls-codec.rst | 4 +-
> > .../media/v4l/extended-controls.rst | 8 +-
> > .../media/v4l/vidioc-g-ext-ctrls.rst | 6 +-
> > drivers/media/common/cx2341x.c | 4 +-
> > drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 2 +-
> > drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 2 +-
> > drivers/media/v4l2-core/v4l2-ctrls.c | 4 +-
> > include/media/fwht-ctrls.h | 2 +-
> > include/media/h264-ctrls.h | 16 +-
> > include/media/hevc-ctrls.h | 10 +-
> > include/media/mpeg2-ctrls.h | 4 +-
> > include/media/vp8-ctrls.h | 2 +-
> > include/uapi/linux/v4l2-controls.h | 409 +++++++++---------
> > 14 files changed, 242 insertions(+), 233 deletions(-)
> >
>
> <snip>
>
> > @@ -1177,4 +1177,13 @@ enum v4l2_detect_md_mode {
> > #define V4L2_CID_DETECT_MD_THRESHOLD_GRID (V4L2_CID_DETECT_CLASS_BASE + 3)
> > #define V4L2_CID_DETECT_MD_REGION_GRID (V4L2_CID_DETECT_CLASS_BASE + 4)
> >
> > +/* MPEG-compression definitions kept for backwards compatibility */
> > +#ifndef __KERNEL__
> > +#define V4L2_CTRL_CLASS_MPEG V4L2_CTRL_CLASS_CODEC
> > +#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1)
> > +#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
> > +#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
> > +#define V4L2_CID_MPEG_MFC51_BASE (V4L2_CTRL_CLASS_MPEG | 0x1100)
>
> Don't copy the offset value here, just keep this as a straight aliases, e.g.:
>
> #define V4L2_CID_MPEG_MFC51_BASE V4L2_CID_CODEC_MFC51_BASE
>
> It's safer that way.
>

Yes, indeed.

Thanks,
Ezequiel