From e97b20f3ca5e874d6944e5f914bd32b2321afa72 Mon Sep 17 00:00:00 2001 From: Jose Maria Casanova Crespo Date: Wed, 9 Nov 2022 13:10:12 +0100 Subject: [PATCH] v3d: Also expose DRM_FORMAT_MOD_BROADCOM_SAND128 with PIPE_FORMAT_P030 Now we can display h265-10bit decoded frames formats on Raspberry Pi 4 devices on GL/ES applications. v2: Don't expose LINEAR or UIF formats for P030 format. Reviewed-by: Iago Toral Quiroga Part-of: --- src/gallium/drivers/v3d/v3d_screen.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c index 7ab7435..cded12b 100644 --- a/src/gallium/drivers/v3d/v3d_screen.c +++ b/src/gallium/drivers/v3d/v3d_screen.c @@ -763,9 +763,21 @@ v3d_screen_query_dmabuf_modifiers(struct pipe_screen *pscreen, int i; int num_modifiers = ARRAY_SIZE(v3d_available_modifiers); - /* Expose DRM_FORMAT_MOD_BROADCOM_SAND128 only for PIPE_FORMAT_NV12 */ - if (format != PIPE_FORMAT_NV12) + /* Expose DRM_FORMAT_MOD_BROADCOM_SAND128 only for PIPE_FORMAT_NV12 + * and PIPE_FORMAT_P030, in the case of P030 we don't expose LINEAR + * or UIF. + */ + if (format != PIPE_FORMAT_NV12 && format != PIPE_FORMAT_P030) { num_modifiers--; + } else if (format == PIPE_FORMAT_P030 ) { + *count = 1; + if (modifiers && max > 0) { + modifiers[0] = DRM_FORMAT_MOD_BROADCOM_SAND128; + if (external_only) + external_only[0] = true; + } + return; + } if (!modifiers) { *count = num_modifiers; @@ -787,18 +799,21 @@ v3d_screen_is_dmabuf_modifier_supported(struct pipe_screen *pscreen, bool *external_only) { int i; - bool is_sand_col128 = (format == PIPE_FORMAT_NV12) && + bool is_sand_col128 = (format == PIPE_FORMAT_NV12 || format == PIPE_FORMAT_P030) && (fourcc_mod_broadcom_mod(modifier) == DRM_FORMAT_MOD_BROADCOM_SAND128); if (is_sand_col128) { if (external_only) *external_only = true; return true; + } else if (format == PIPE_FORMAT_P030) { + /* For PIPE_FORMAT_P030 we don't expose LINEAR or UIF. */ + return false; } /* We don't want to generally allow DRM_FORMAT_MOD_BROADCOM_SAND128 * modifier, that is the last v3d_available_modifiers. We only accept - * it in the case of having a PIPE_FORMAT_NV12. + * it in the case of having a PIPE_FORMAT_NV12 or PIPE_FORMAT_P030. */ assert(v3d_available_modifiers[ARRAY_SIZE(v3d_available_modifiers) - 1] == DRM_FORMAT_MOD_BROADCOM_SAND128); -- 2.7.4