Re: [PATCH 4/8] dumbfb: Fix pitch for tri-planar formats

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/08/2020 05:18, Laurent Pinchart wrote:
> The BO pitches are unconditionally set to the frame buffer pitch, for
> all planes. This is correct for semiplanar YUV formats, as they
> subsample chroma horizontally by two but combined U and V in a single
> plane, cancelling each other. For fully planar YUV formats, however, the
> horizontal subsampling need to be taken into account to compute the
> pitch. Fix it.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
> ---
>  kms++/src/dumbframebuffer.cpp | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/kms++/src/dumbframebuffer.cpp b/kms++/src/dumbframebuffer.cpp
> index 18f3f152943d..4c3c03164a90 100644
> --- a/kms++/src/dumbframebuffer.cpp
> +++ b/kms++/src/dumbframebuffer.cpp
> @@ -42,6 +42,14 @@ DumbFramebuffer::DumbFramebuffer(Card& card, uint32_t width, uint32_t height, Pi
>  		struct drm_mode_create_dumb creq = drm_mode_create_dumb();
>  		creq.width = width;
>  		creq.height = height / pi.ysub;
> +		/*
> +		 * For fully planar YUV buffers, the chroma planes don't combine
> +		 * U and V components, their width must thus be divided by the
> +		 * horizontal subsampling factor.
> +		 */
> +		if (format_info.type == PixelColorType::YUV &&
> +		    format_info.num_planes == 3)
> +			creq.width /= pi.xsub;

This feels a bit of a hack... I think we should somehow have the relevant information in the
PixelFormatInfo. Having the same plane info, { 8, 2, 2 }, for both NV12 UV plane and YUV420 U and V
planes doesn't sound correct.

Should NV12's UV plane be { 16, 2, 2 }? Subsampled formats are confusing... =)

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux