From c41ad5e822a18fa58103770f471c80d5723bb1ce Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Fri, 3 Jul 2020 14:23:45 +0800 Subject: [PATCH 17/74] pixman-renderer: Support yuv formats Support yuy2/yv12/i420/nv12/nv16. Signed-off-by: Jeffy Chen --- libweston/pixel-formats.c | 11 +++++++++++ meson.build | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/libweston/pixel-formats.c b/libweston/pixel-formats.c index 9064cb6..172e6cc 100644 --- a/libweston/pixel-formats.c +++ b/libweston/pixel-formats.c @@ -337,6 +337,7 @@ static const struct pixel_format_info pixel_format_table[] = { SAMPLER_TYPE(EGL_TEXTURE_Y_XUXV_WL), .num_planes = 1, .hsub = 2, + PIXMAN_FMT(yuy2), }, { DRM_FORMAT(YVYU), @@ -366,6 +367,9 @@ static const struct pixel_format_info pixel_format_table[] = { .num_planes = 2, .hsub = 2, .vsub = 2, +#ifdef HAVE_PIXMAN_NV12 + PIXMAN_FMT(nv12), +#endif }, { DRM_FORMAT(NV21), @@ -381,6 +385,9 @@ static const struct pixel_format_info pixel_format_table[] = { .num_planes = 2, .hsub = 2, .vsub = 1, +#ifdef HAVE_PIXMAN_NV16 + PIXMAN_FMT(nv16), +#endif }, { DRM_FORMAT(NV61), @@ -437,6 +444,9 @@ static const struct pixel_format_info pixel_format_table[] = { .num_planes = 3, .hsub = 2, .vsub = 2, +#ifdef HAVE_PIXMAN_I420 + PIXMAN_FMT(i420), +#endif }, { DRM_FORMAT(YVU420), @@ -445,6 +455,7 @@ static const struct pixel_format_info pixel_format_table[] = { .chroma_order = ORDER_VU, .hsub = 2, .vsub = 2, + PIXMAN_FMT(yv12), }, { DRM_FORMAT(YUV422), diff --git a/meson.build b/meson.build index c9c58e0..d867771 100644 --- a/meson.build +++ b/meson.build @@ -161,6 +161,16 @@ dep_libdrm = dependency('libdrm', version: '>= 2.4.95') dep_libdrm_headers = dep_libdrm.partial_dependency(compile_args: true) dep_threads = dependency('threads') +if cc.has_header_symbol('pixman.h', 'PIXMAN_nv12', dependencies : dep_pixman) + config_h.set('HAVE_PIXMAN_NV12', 1) +endif +if cc.has_header_symbol('pixman.h', 'PIXMAN_i420', dependencies : dep_pixman) + config_h.set('HAVE_PIXMAN_I420', 1) +endif +if cc.has_header_symbol('pixman.h', 'PIXMAN_nv16', dependencies : dep_pixman) + config_h.set('HAVE_PIXMAN_NV16', 1) +endif + dep_libdrm_version = dep_libdrm.version() if dep_libdrm_version.version_compare('>=2.4.107') message('Found libdrm with human format modifier support.') -- 2.20.1