* [PATCH] drm: fix pixel size of NV12 / NV16 pixel formats
@ 2016-04-28 8:40 Fabien Dessenne
2016-04-28 11:02 ` Ville Syrjälä
0 siblings, 1 reply; 2+ messages in thread
From: Fabien Dessenne @ 2016-04-28 8:40 UTC (permalink / raw)
To: dri-devel; +Cc: Vincent Abriou, kernel, Benjamin Gaignard
With NV12, NV21, NV16 and NV61 formats, the size of one pixel from the
UV plane (plane #1) is one byte.
Indeed, these pixel formats use 4:2:x chroma subsampling: the chroma
pixels are sampled at half the luma: for 2 pixels, there are 1 Cb +
1 Cr = 2 bytes.
So for plane #1, the correct size is actually 1 byte per pixel.
Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
---
drivers/gpu/drm/drm_crtc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 3313f7e..572c6fa 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -5618,10 +5618,6 @@ int drm_format_plane_cpp(uint32_t format, int plane)
case DRM_FORMAT_UYVY:
case DRM_FORMAT_VYUY:
return 2;
- case DRM_FORMAT_NV12:
- case DRM_FORMAT_NV21:
- case DRM_FORMAT_NV16:
- case DRM_FORMAT_NV61:
case DRM_FORMAT_NV24:
case DRM_FORMAT_NV42:
return plane ? 2 : 1;
@@ -5635,6 +5631,10 @@ int drm_format_plane_cpp(uint32_t format, int plane)
case DRM_FORMAT_YVU422:
case DRM_FORMAT_YUV444:
case DRM_FORMAT_YVU444:
+ case DRM_FORMAT_NV12:
+ case DRM_FORMAT_NV21:
+ case DRM_FORMAT_NV16:
+ case DRM_FORMAT_NV61:
return 1;
default:
drm_fb_get_bpp_depth(format, &depth, &bpp);
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm: fix pixel size of NV12 / NV16 pixel formats
2016-04-28 8:40 [PATCH] drm: fix pixel size of NV12 / NV16 pixel formats Fabien Dessenne
@ 2016-04-28 11:02 ` Ville Syrjälä
0 siblings, 0 replies; 2+ messages in thread
From: Ville Syrjälä @ 2016-04-28 11:02 UTC (permalink / raw)
To: Fabien Dessenne; +Cc: Benjamin Gaignard, Vincent Abriou, kernel, dri-devel
On Thu, Apr 28, 2016 at 10:40:39AM +0200, Fabien Dessenne wrote:
> With NV12, NV21, NV16 and NV61 formats, the size of one pixel from the
> UV plane (plane #1) is one byte.
>
> Indeed, these pixel formats use 4:2:x chroma subsampling: the chroma
> pixels are sampled at half the luma: for 2 pixels, there are 1 Cb +
> 1 Cr = 2 bytes.
You just said it, it's 2 bytes. NAK
> So for plane #1, the correct size is actually 1 byte per pixel.
>
> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
> ---
> drivers/gpu/drm/drm_crtc.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 3313f7e..572c6fa 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -5618,10 +5618,6 @@ int drm_format_plane_cpp(uint32_t format, int plane)
> case DRM_FORMAT_UYVY:
> case DRM_FORMAT_VYUY:
> return 2;
> - case DRM_FORMAT_NV12:
> - case DRM_FORMAT_NV21:
> - case DRM_FORMAT_NV16:
> - case DRM_FORMAT_NV61:
> case DRM_FORMAT_NV24:
> case DRM_FORMAT_NV42:
> return plane ? 2 : 1;
> @@ -5635,6 +5631,10 @@ int drm_format_plane_cpp(uint32_t format, int plane)
> case DRM_FORMAT_YVU422:
> case DRM_FORMAT_YUV444:
> case DRM_FORMAT_YVU444:
> + case DRM_FORMAT_NV12:
> + case DRM_FORMAT_NV21:
> + case DRM_FORMAT_NV16:
> + case DRM_FORMAT_NV61:
> return 1;
> default:
> drm_fb_get_bpp_depth(format, &depth, &bpp);
> --
> 1.9.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-28 11:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-28 8:40 [PATCH] drm: fix pixel size of NV12 / NV16 pixel formats Fabien Dessenne
2016-04-28 11:02 ` Ville Syrjälä
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.