summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Kleiner <[email protected]>2017-12-15 23:05:08 +0100
committerMarek Olšák <[email protected]>2018-01-03 22:57:57 +0100
commit2d8e1a6a277cb1684d76210351147f5e7858c8b2 (patch)
tree5e776a4a62cdd7c432d77950654743fde52bce1c
parente5ff036c6751c39ee008ca7db47b3ce4d7a38a15 (diff)
st/dri: Add option to control exposure of 10 bpc color configs.
Some clients may not like rgb10 fbconfigs and visuals. Support driconf option 'allow_rgb10_configs' on gallium to allow per application enable/disable. The option defaults to enabled. Signed-off-by: Mario Kleiner <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
-rw-r--r--src/gallium/auxiliary/pipe-loader/driinfo_gallium.h1
-rw-r--r--src/gallium/state_trackers/dri/dri_screen.c8
2 files changed, 9 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
index 003a3d7089e..505aae402ee 100644
--- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
+++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
@@ -32,4 +32,5 @@ DRI_CONF_SECTION_END
DRI_CONF_SECTION_MISCELLANEOUS
DRI_CONF_ALWAYS_HAVE_DEPTH_BUFFER("false")
DRI_CONF_GLSL_ZERO_INIT("false")
+ DRI_CONF_ALLOW_RGB10_CONFIGS("true")
DRI_CONF_SECTION_END
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index 46ca8fabcd2..adce2ff36db 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -158,6 +158,7 @@ dri_fill_in_modes(struct dri_screen *screen)
struct pipe_screen *p_screen = screen->base.screen;
boolean pf_z16, pf_x8z24, pf_z24x8, pf_s8z24, pf_z24s8, pf_z32;
boolean mixed_color_depth;
+ boolean allow_rgb10;
static const GLenum back_buffer_modes[] = {
__DRI_ATTRIB_SWAP_NONE, __DRI_ATTRIB_SWAP_UNDEFINED,
@@ -174,6 +175,8 @@ dri_fill_in_modes(struct dri_screen *screen)
depth_buffer_factor = 1;
}
+ allow_rgb10 = driQueryOptionb(&screen->dev->option_cache, "allow_rgb10_configs");
+
msaa_samples_max = (screen->st_api->feature_mask & ST_API_FEATURE_MS_VISUALS_MASK)
? MSAA_VISUAL_MAX_SAMPLES : 1;
@@ -233,6 +236,11 @@ dri_fill_in_modes(struct dri_screen *screen)
unsigned num_msaa_modes = 0; /* includes a single-sample mode */
uint8_t msaa_modes[MSAA_VISUAL_MAX_SAMPLES];
+ if (!allow_rgb10 &&
+ (mesa_formats[format] == MESA_FORMAT_B10G10R10A2_UNORM ||
+ mesa_formats[format] == MESA_FORMAT_B10G10R10X2_UNORM))
+ continue;
+
if (!p_screen->is_format_supported(p_screen, pipe_formats[format],
PIPE_TEXTURE_2D, 0,
PIPE_BIND_RENDER_TARGET))