Commit f0c16087 authored by Shirish S's avatar Shirish S Committed by Alex Deucher

drm/amd/display: update NV12/NV21 as the YUV format

This patch updates the YUV format supported to
NV12 and NV21 and hence updates the offsets.

BUG: SWDEV-119421
TEST: (On Chromium OS for Stoney Only)
    * Executed below tests to see YUV(underlay) & RGB planes on eDP
    plane_test --format XR24 --size 500x100 -p --format NV12 --size
    500x500
Signed-off-by: default avatarShirish S <shirish.s@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 630e3573
...@@ -456,6 +456,7 @@ static void fill_plane_attributes_from_fb( ...@@ -456,6 +456,7 @@ static void fill_plane_attributes_from_fb(
{ {
uint64_t tiling_flags; uint64_t tiling_flags;
uint64_t fb_location = 0; uint64_t fb_location = 0;
unsigned int awidth;
const struct drm_framebuffer *fb = &amdgpu_fb->base; const struct drm_framebuffer *fb = &amdgpu_fb->base;
struct drm_format_name_buf format_name; struct drm_format_name_buf format_name;
...@@ -484,10 +485,10 @@ static void fill_plane_attributes_from_fb( ...@@ -484,10 +485,10 @@ static void fill_plane_attributes_from_fb(
case DRM_FORMAT_ABGR2101010: case DRM_FORMAT_ABGR2101010:
surface->format = SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010; surface->format = SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010;
break; break;
case DRM_FORMAT_YUV420: case DRM_FORMAT_NV21:
surface->format = SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr; surface->format = SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr;
break; break;
case DRM_FORMAT_YVU420: case DRM_FORMAT_NV12:
surface->format = SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb; surface->format = SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb;
break; break;
default: default:
...@@ -510,24 +511,25 @@ static void fill_plane_attributes_from_fb( ...@@ -510,24 +511,25 @@ static void fill_plane_attributes_from_fb(
surface->color_space = COLOR_SPACE_SRGB; surface->color_space = COLOR_SPACE_SRGB;
} else { } else {
awidth = ALIGN(fb->width, 64);
surface->address.type = PLN_ADDR_TYPE_VIDEO_PROGRESSIVE; surface->address.type = PLN_ADDR_TYPE_VIDEO_PROGRESSIVE;
surface->address.video_progressive.luma_addr.low_part surface->address.video_progressive.luma_addr.low_part
= lower_32_bits(fb_location); = lower_32_bits(fb_location);
surface->address.video_progressive.chroma_addr.low_part surface->address.video_progressive.chroma_addr.low_part
= lower_32_bits(fb_location) + = lower_32_bits(fb_location) +
(fb->width * fb->height); (awidth * fb->height);
surface->plane_size.video.luma_size.x = 0; surface->plane_size.video.luma_size.x = 0;
surface->plane_size.video.luma_size.y = 0; surface->plane_size.video.luma_size.y = 0;
surface->plane_size.video.luma_size.width = fb->width; surface->plane_size.video.luma_size.width = awidth;
surface->plane_size.video.luma_size.height = fb->height; surface->plane_size.video.luma_size.height = fb->height;
/* TODO: unhardcode */ /* TODO: unhardcode */
surface->plane_size.video.luma_pitch = ALIGN(fb->width, 64); surface->plane_size.video.luma_pitch = awidth;
surface->plane_size.video.chroma_size.x = 0; surface->plane_size.video.chroma_size.x = 0;
surface->plane_size.video.chroma_size.y = 0; surface->plane_size.video.chroma_size.y = 0;
surface->plane_size.video.chroma_size.width = fb->width / 2; surface->plane_size.video.chroma_size.width = awidth;
surface->plane_size.video.chroma_size.height = fb->height / 2; surface->plane_size.video.chroma_size.height = fb->height;
surface->plane_size.video.chroma_pitch = ALIGN(fb->width, 64) / 2; surface->plane_size.video.chroma_pitch = awidth / 2;
/* TODO: unhardcode */ /* TODO: unhardcode */
surface->color_space = COLOR_SPACE_YCBCR709; surface->color_space = COLOR_SPACE_YCBCR709;
...@@ -1662,8 +1664,8 @@ static uint32_t rgb_formats[] = { ...@@ -1662,8 +1664,8 @@ static uint32_t rgb_formats[] = {
}; };
static uint32_t yuv_formats[] = { static uint32_t yuv_formats[] = {
DRM_FORMAT_YUV420, DRM_FORMAT_NV12,
DRM_FORMAT_YVU420, DRM_FORMAT_NV21,
}; };
int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm, int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment