From f52aa596d4993c102fa0f9583cd9ba5487d0456f Mon Sep 17 00:00:00 2001 From: Mario Kleiner Date: Fri, 15 Dec 2017 23:05:04 +0100 Subject: st/dri2: Add format translations for BGR[A/X]1010102 formats. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mario Kleiner Reviewed-by: Marek Olšák Signed-off-by: Marek Olšák --- src/gallium/state_trackers/dri/dri2.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/gallium/state_trackers/dri/dri2.c') diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c index 3388b17da53..c0f0921337b 100644 --- a/src/gallium/state_trackers/dri/dri2.c +++ b/src/gallium/state_trackers/dri/dri2.c @@ -55,6 +55,8 @@ #endif static const int fourcc_formats[] = { + __DRI_IMAGE_FOURCC_ARGB2101010, + __DRI_IMAGE_FOURCC_XRGB2101010, __DRI_IMAGE_FOURCC_ARGB8888, __DRI_IMAGE_FOURCC_ABGR8888, __DRI_IMAGE_FOURCC_SARGB8888, @@ -105,6 +107,14 @@ static int convert_fourcc(int format, int *dri_components_p) format = __DRI_IMAGE_FORMAT_XBGR8888; dri_components = __DRI_IMAGE_COMPONENTS_RGB; break; + case __DRI_IMAGE_FOURCC_ARGB2101010: + format = __DRI_IMAGE_FORMAT_ARGB2101010; + dri_components = __DRI_IMAGE_COMPONENTS_RGBA; + break; + case __DRI_IMAGE_FOURCC_XRGB2101010: + format = __DRI_IMAGE_FORMAT_XRGB2101010; + dri_components = __DRI_IMAGE_COMPONENTS_RGB; + break; case __DRI_IMAGE_FOURCC_R8: format = __DRI_IMAGE_FORMAT_R8; dri_components = __DRI_IMAGE_COMPONENTS_R; @@ -170,6 +180,12 @@ static int convert_to_fourcc(int format) case __DRI_IMAGE_FORMAT_XBGR8888: format = __DRI_IMAGE_FOURCC_XBGR8888; break; + case __DRI_IMAGE_FORMAT_ARGB2101010: + format = __DRI_IMAGE_FOURCC_ARGB2101010; + break; + case __DRI_IMAGE_FORMAT_XRGB2101010: + format = __DRI_IMAGE_FOURCC_XRGB2101010; + break; case __DRI_IMAGE_FORMAT_R8: format = __DRI_IMAGE_FOURCC_R8; break; @@ -202,6 +218,12 @@ static enum pipe_format dri2_format_to_pipe_format (int format) case __DRI_IMAGE_FORMAT_ABGR8888: pf = PIPE_FORMAT_RGBA8888_UNORM; break; + case __DRI_IMAGE_FORMAT_XRGB2101010: + pf = PIPE_FORMAT_B10G10R10X2_UNORM; + break; + case __DRI_IMAGE_FORMAT_ARGB2101010: + pf = PIPE_FORMAT_B10G10R10A2_UNORM; + break; case __DRI_IMAGE_FORMAT_R8: pf = PIPE_FORMAT_R8_UNORM; break; @@ -260,6 +282,12 @@ static enum pipe_format fourcc_to_pipe_format(int fourcc) case __DRI_IMAGE_FOURCC_XBGR8888: pf = PIPE_FORMAT_RGBX8888_UNORM; break; + case __DRI_IMAGE_FOURCC_ARGB2101010: + pf = PIPE_FORMAT_B10G10R10A2_UNORM; + break; + case __DRI_IMAGE_FOURCC_XRGB2101010: + pf = PIPE_FORMAT_B10G10R10X2_UNORM; + break; case __DRI_IMAGE_FOURCC_NV12: pf = PIPE_FORMAT_NV12; -- cgit v1.2.3