summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMario Kleiner <[email protected]>2017-12-15 23:05:07 +0100
committerMarek Olšák <[email protected]>2018-01-03 22:57:57 +0100
commite5ff036c6751c39ee008ca7db47b3ce4d7a38a15 (patch)
tree47a3ffd491ade4a01713e81cef97a37ba82035b5 /src/gallium
parentef99597d959c5814c2d9288b9e0ddf5f57d2854f (diff)
st/dri: Add support for BGR[A/X]1010102 formats.
Exposes RGBA 10 10 10 2 and 10 10 10 0 visuals and fbconfigs for rendering. Signed-off-by: Mario Kleiner <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/dri/dri_screen.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index 1ca511612ad..46ca8fabcd2 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -108,6 +108,8 @@ static const __DRIconfig **
dri_fill_in_modes(struct dri_screen *screen)
{
static const mesa_format mesa_formats[] = {
+ MESA_FORMAT_B10G10R10A2_UNORM,
+ MESA_FORMAT_B10G10R10X2_UNORM,
MESA_FORMAT_B8G8R8A8_UNORM,
MESA_FORMAT_B8G8R8X8_UNORM,
MESA_FORMAT_B8G8R8A8_SRGB,
@@ -136,6 +138,8 @@ dri_fill_in_modes(struct dri_screen *screen)
MESA_FORMAT_R8G8B8X8_UNORM,
};
static const enum pipe_format pipe_formats[] = {
+ PIPE_FORMAT_B10G10R10A2_UNORM,
+ PIPE_FORMAT_B10G10R10X2_UNORM,
PIPE_FORMAT_BGRA8888_UNORM,
PIPE_FORMAT_BGRX8888_UNORM,
PIPE_FORMAT_BGRA8888_SRGB,
@@ -221,7 +225,7 @@ dri_fill_in_modes(struct dri_screen *screen)
if (dri_loader_get_cap(screen, DRI_LOADER_CAP_RGBA_ORDERING))
num_formats = ARRAY_SIZE(mesa_formats);
else
- num_formats = ARRAY_SIZE(mesa_formats) - 2;
+ num_formats = ARRAY_SIZE(mesa_formats) - 2; /* all - RGBA_ORDERING formats */
/* Add configs. */
for (format = 0; format < num_formats; format++) {
@@ -289,6 +293,15 @@ dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen,
/* Deduce the color format. */
switch (mode->redMask) {
+ case 0x3FF00000:
+ if (mode->alphaMask) {
+ assert(mode->alphaMask == 0xC0000000);
+ stvis->color_format = PIPE_FORMAT_B10G10R10A2_UNORM;
+ } else {
+ stvis->color_format = PIPE_FORMAT_B10G10R10X2_UNORM;
+ }
+ break;
+
case 0x00FF0000:
if (mode->alphaMask) {
assert(mode->alphaMask == 0xFF000000);