mbox series

[00/11] media: cedrus: Format handling improvements and 10-bit HEVC support

Message ID 20221024201515.34129-1-jernej.skrabec@gmail.com
Headers show
Series media: cedrus: Format handling improvements and 10-bit HEVC support | expand

Message

Jernej Škrabec Oct. 24, 2022, 8:15 p.m. UTC
While my first intention was to just add 10-bit HEVC handling, I noticed
a few format handling issues and a bit of redundancy in some cases. Final
result is that driver now sticks to stateless decoder rules better.

Format handling improvements:
1. Default format selection is now based on HW capabilities. Before, MPEG2
   was hardcoded but some Cedrus variants don't actually support it.
2. Controls are registered only if related codec is supported by HW.
3. Untiled output format is preferred, if supported, over tiled one. All
   display engine cores support untiled format, but only first generation
   supports tiled one.

I hope this makes Cedrus eligible for destaging.

Best regards,
Jernej

Jernej Skrabec (11):
  media: cedrus: remove superfluous call
  media: cedrus: Add format reset helpers
  media: cedrus: use helper to set default formats
  media: cedrus: Add helper for checking capabilities
  media: cedrus: Filter controls based on capability
  media: cedrus: set codec ops immediately
  media: cedrus: Remove cedrus_codec enum
  media: cedrus: prefer untiled capture format
  media: cedrus: initialize controls a bit later
  media: cedrus: Adjust buffer size based on control values
  media: cedrus: h265: Support decoding 10-bit frames

 drivers/staging/media/sunxi/cedrus/cedrus.c   |  97 +++++-----
 drivers/staging/media/sunxi/cedrus/cedrus.h   |  22 +--
 .../staging/media/sunxi/cedrus/cedrus_dec.c   |   4 +-
 .../staging/media/sunxi/cedrus/cedrus_h264.c  |   2 +-
 .../staging/media/sunxi/cedrus/cedrus_h265.c  |  37 +++-
 .../staging/media/sunxi/cedrus/cedrus_hw.c    |  18 +-
 .../staging/media/sunxi/cedrus/cedrus_hw.h    |   2 +-
 .../staging/media/sunxi/cedrus/cedrus_mpeg2.c |   2 +-
 .../staging/media/sunxi/cedrus/cedrus_regs.h  |  16 ++
 .../staging/media/sunxi/cedrus/cedrus_video.c | 166 ++++++++++--------
 .../staging/media/sunxi/cedrus/cedrus_video.h |   2 +
 .../staging/media/sunxi/cedrus/cedrus_vp8.c   |   2 +-
 12 files changed, 225 insertions(+), 145 deletions(-)

--
2.38.1

Comments

Paul Kocialkowski Oct. 25, 2022, 3:35 p.m. UTC | #1
On Tue 25 Oct 22, 17:28, Jernej Škrabec wrote:
> Dne torek, 25. oktober 2022 ob 17:22:59 CEST je Paul Kocialkowski napisal(a):
> > Hi Jernej,
> > 
> > On Tue 25 Oct 22, 17:17, Jernej Škrabec wrote:
> > > Dne torek, 25. oktober 2022 ob 08:30:28 CEST je Dan Carpenter napisal(a):
> > > > On Mon, Oct 24, 2022 at 10:15:08PM +0200, Jernej Skrabec wrote:
> > > > > There is several different Cedrus cores with varying capabilities, so
> > > > > some operations like listing formats depends on checks if feature is
> > > > > supported or not.
> > > > > 
> > > > > Currently check for capabilities is only in format enumeration helper,
> > > > > but it will be used also elsewhere later. Let's convert this check to
> > > > > helper and while at it, also simplify it. There is no need to check if
> > > > > capability mask is zero, condition will still work properly.
> > > > 
> > > > Sure.  That's true.  Out of curiousity, can
> > > > cedrus_formats[i].capabilities
> > > > be zero?  Because it feels like that's what should be checked.
> > > 
> > > Yes, it can be. It's the case for V4L2_PIX_FMT_NV12_32L32. All variants
> > > supports it, so there is no special capability needed in order to be
> > > listed. What would you check in such case? Condition still works for this
> > > case.
> > I think the problem is that (bits & 0) == 0 is always true.
> > So if the input caps are 0, we need to make sure to return false.
> 
> No. If format (or any other) capabilities are 0, means they are supported by 
> all variants and it's expected from cedrus_is_capable() to return true.

Mhh, yeah. Not sure what I was thinking. Sorry for the noise.

Paul