summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2019-11-15 09:18:10 +0200
committerMarge Bot <eric+marge@anholt.net>2019-12-17 09:28:25 +0000
commit75caae2268f5c70b1f3005df8618876341ac14fd (patch)
tree5816d7bae4e1d7779345743043f76bb1802042fd
parent8b6b5ce6691c80f3254964b746499d5ca75b59b1 (diff)
i965: expose MESA_FORMAT_B8G8R8X8_SRGB visual
Patch adds BGRX sRGB visuals, required format translation information to the __DRI_IMAGE_FOURCC_SXRGB8888 format and makes all BGRX visuals sRGB capable just like is done with BGRA. squashed patches from Yevhenii Kolesnikov: dri: Add __DRI_IMAGE_FOURCC_SXRGB8888 conversion i965: force visuals without alpha bits to use sRGB Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1501 Cc: <mesa-stable@lists.freedesktop.org> Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3077> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3077>
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 04217b3e6cf..64f1d888442 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -218,6 +218,9 @@ static const struct intel_image_format intel_image_formats[] = {
{ __DRI_IMAGE_FOURCC_SARGB8888, __DRI_IMAGE_COMPONENTS_RGBA, 1,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_SARGB8, 4 } } },
+ { __DRI_IMAGE_FOURCC_SXRGB8888, __DRI_IMAGE_COMPONENTS_RGB, 1,
+ { { 0, 0, 0, __DRI_IMAGE_FORMAT_SXRGB8, 4 } } },
+
{ DRM_FORMAT_XRGB8888, __DRI_IMAGE_COMPONENTS_RGB, 1,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_XRGB8888, 4 }, } },
@@ -1334,12 +1337,13 @@ intel_query_dma_buf_formats(__DRIscreen *_screen, int max,
int num_formats = 0, i;
for (i = 0; i < ARRAY_SIZE(intel_image_formats); i++) {
- /* These two formats are valid DRI formats but do not exist in
- * drm_fourcc.h in the Linux kernel. We don't want to accidentally
- * advertise them through the EGL layer.
+ /* These formats are valid DRI formats but do not exist in drm_fourcc.h
+ * in the Linux kernel. We don't want to accidentally advertise them
+ * them through the EGL layer.
*/
if (intel_image_formats[i].fourcc == __DRI_IMAGE_FOURCC_SARGB8888 ||
- intel_image_formats[i].fourcc == __DRI_IMAGE_FOURCC_SABGR8888)
+ intel_image_formats[i].fourcc == __DRI_IMAGE_FOURCC_SABGR8888 ||
+ intel_image_formats[i].fourcc == __DRI_IMAGE_FOURCC_SXRGB8888)
continue;
if (!intel_image_format_is_supported(&screen->devinfo,
@@ -1759,12 +1763,14 @@ intelCreateBuffer(__DRIscreen *dri_screen,
} else if (mesaVis->redBits == 5) {
rgbFormat = mesaVis->redMask == 0x1f ? MESA_FORMAT_R5G6B5_UNORM
: MESA_FORMAT_B5G6R5_UNORM;
+ } else if (mesaVis->alphaBits == 0) {
+ rgbFormat = mesaVis->redMask == 0xff ? MESA_FORMAT_R8G8B8X8_SRGB
+ : MESA_FORMAT_B8G8R8X8_SRGB;
+ fb->Visual.sRGBCapable = true;
} else if (mesaVis->sRGBCapable) {
rgbFormat = mesaVis->redMask == 0xff ? MESA_FORMAT_R8G8B8A8_SRGB
: MESA_FORMAT_B8G8R8A8_SRGB;
- } else if (mesaVis->alphaBits == 0) {
- rgbFormat = mesaVis->redMask == 0xff ? MESA_FORMAT_R8G8B8X8_UNORM
- : MESA_FORMAT_B8G8R8X8_UNORM;
+ fb->Visual.sRGBCapable = true;
} else {
rgbFormat = mesaVis->redMask == 0xff ? MESA_FORMAT_R8G8B8A8_SRGB
: MESA_FORMAT_B8G8R8A8_SRGB;
@@ -2222,6 +2228,7 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
MESA_FORMAT_B8G8R8X8_UNORM,
MESA_FORMAT_B8G8R8A8_SRGB,
+ MESA_FORMAT_B8G8R8X8_SRGB,
/* For 10 bpc, 30 bit depth framebuffers. */
MESA_FORMAT_B10G10R10A2_UNORM,