[igt-dev] [PATCH i-g-t v2 07/13] igt: fb: Account for all planes bpp

Maxime Ripard maxime.ripard at bootlin.com
Mon Jan 21 13:10:37 UTC 2019


On Thu, Jan 10, 2019 at 11:21:24AM +0100, Paul Kocialkowski wrote:
> On Tue, 2019-01-08 at 16:19 +0100, Maxime Ripard wrote:
> > When allocating a dumb buffer for a format with multiple plane, we need to
> > account for all plane's bpp in order to allocate the proper size.
> > 
> > Let's add all the planes bpp and use the result to allocate our buffer.
> 
> As discussed off-list, this approach doesn't work well when multiple
> planes and sub-sampling are involved, causing over-allocation.
> 
> For instance, NV12 requires at least width * height * 1.5.
> The bpp for the second plane is 16 but with four times less pixels due
> to sub-sampling. Here, this would amount to width * height * 3 at
> least, so over-allocating.
> 
> I think dividing each plane's bpp by the sub-sampling before adding it
> should work (with a round-up division to be on the safe side for cases
> where bpp cannot be exactly dividided by hsub * vsub in the future).
> 
> What do you think?

It sounds great, thanks!
Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/igt-dev/attachments/20190121/44d145bd/attachment.sig>


More information about the igt-dev mailing list