#define __DRI_IMAGE_FORMAT_SXRGB8 0x1016
#define __DRI_IMAGE_FORMAT_ABGR16161616 0x1017
#define __DRI_IMAGE_FORMAT_XBGR16161616 0x1018
+#define __DRI_IMAGE_FORMAT_ARGB4444 0x1019
+#define __DRI_IMAGE_FORMAT_XRGB4444 0x101a
+#define __DRI_IMAGE_FORMAT_ABGR4444 0x101b
+#define __DRI_IMAGE_FORMAT_XBGR4444 0x101c
+#define __DRI_IMAGE_FORMAT_XRGB1555 0x101d
+#define __DRI_IMAGE_FORMAT_ABGR1555 0x101e
+#define __DRI_IMAGE_FORMAT_XBGR1555 0x101f
#define __DRI_IMAGE_USE_SHARE 0x0001
#define __DRI_IMAGE_USE_SCANOUT 0x0002
{11, 5, 0, -1},
{5, 6, 5, 0},
},
+ {
+ "ARGB1555",
+ WL_DRM_FORMAT_ARGB1555,
+ WL_SHM_FORMAT_ARGB1555,
+ __DRI_IMAGE_FORMAT_ARGB1555,
+ __DRI_IMAGE_FORMAT_ABGR1555,
+ 16,
+ {10, 5, 0, 15},
+ {5, 5, 5, 1},
+ },
+ {
+ "XRGB1555",
+ WL_DRM_FORMAT_XRGB1555,
+ WL_SHM_FORMAT_XRGB1555,
+ __DRI_IMAGE_FORMAT_XRGB1555,
+ __DRI_IMAGE_FORMAT_XBGR1555,
+ 16,
+ {10, 5, 0, -1},
+ {5, 5, 5, 0},
+ },
+ {
+ "ARGB4444",
+ WL_DRM_FORMAT_ARGB4444,
+ WL_SHM_FORMAT_ARGB4444,
+ __DRI_IMAGE_FORMAT_ARGB4444,
+ __DRI_IMAGE_FORMAT_XBGR4444,
+ 16,
+ {8, 4, 0, 12},
+ {4, 4, 4, 4},
+ },
+ {
+ "XRGB4444",
+ WL_DRM_FORMAT_XRGB4444,
+ WL_SHM_FORMAT_XRGB4444,
+ __DRI_IMAGE_FORMAT_XRGB4444,
+ __DRI_IMAGE_FORMAT_XBGR4444,
+ 16,
+ {8, 4, 0, -1},
+ {4, 4, 4, 0},
+ },
};
static int
case PIPE_FORMAT_R10G10B10A2_UNORM:
image_format = __DRI_IMAGE_FORMAT_ABGR2101010;
break;
+ case PIPE_FORMAT_R5G5B5A1_UNORM:
+ image_format = __DRI_IMAGE_FORMAT_ABGR1555;
+ break;
+ case PIPE_FORMAT_B4G4R4A4_UNORM:
+ image_format = __DRI_IMAGE_FORMAT_ARGB4444;
+ break;
+ case PIPE_FORMAT_R4G4B4A4_UNORM:
+ image_format = __DRI_IMAGE_FORMAT_ABGR4444;
+ break;
default:
image_format = __DRI_IMAGE_FORMAT_NONE;
break;
{ DRM_FORMAT_ARGB1555, __DRI_IMAGE_FORMAT_ARGB1555,
__DRI_IMAGE_COMPONENTS_RGBA, PIPE_FORMAT_B5G5R5A1_UNORM, 1,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_ARGB1555 } } },
+ { DRM_FORMAT_ABGR1555, __DRI_IMAGE_FORMAT_ABGR1555,
+ __DRI_IMAGE_COMPONENTS_RGBA, PIPE_FORMAT_R5G5B5A1_UNORM, 1,
+ { { 0, 0, 0, __DRI_IMAGE_FORMAT_ABGR1555 } } },
+ { DRM_FORMAT_ARGB4444, __DRI_IMAGE_FORMAT_ARGB4444,
+ __DRI_IMAGE_COMPONENTS_RGBA, PIPE_FORMAT_B4G4R4A4_UNORM, 1,
+ { { 0, 0, 0, __DRI_IMAGE_FORMAT_ARGB4444 } } },
+ { DRM_FORMAT_ABGR4444, __DRI_IMAGE_FORMAT_ABGR4444,
+ __DRI_IMAGE_COMPONENTS_RGBA, PIPE_FORMAT_R4G4B4A4_UNORM, 1,
+ { { 0, 0, 0, __DRI_IMAGE_FORMAT_ABGR4444 } } },
{ DRM_FORMAT_RGB565, __DRI_IMAGE_FORMAT_RGB565,
__DRI_IMAGE_COMPONENTS_RGB, PIPE_FORMAT_B5G6R5_UNORM, 1,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_RGB565 } } },
/* MESA_FORMAT_RGBA_FLOAT16 */
{{ 0, 0, 0, 0},
{ 0, 16, 32, 48 }},
+ /* MESA_FORMAT_B5G5R5A1_UNORM */
+ {{ 0x00007C00, 0x000003E0, 0x0000001F, 0x00008000 },
+ { 10, 5, 0, 15 }},
+ /* MESA_FORMAT_R5G5B5A1_UNORM */
+ {{ 0x0000001F, 0x000003E0, 0x00007C00, 0x00008000 },
+ { 0, 5, 10, 15 }},
+ /* MESA_FORMAT_B4G4R4A4_UNORM */
+ {{ 0x00000F00, 0x000000F0, 0x0000000F, 0x0000F000 },
+ { 8, 4, 0, 12 }},
+ /* MESA_FORMAT_R4G4B4A4_UNORM */
+ {{ 0x0000000F, 0x000000F0, 0x00000F00, 0x0000F000 },
+ { 0, 4, 8, 12 }},
};
const uint32_t * masks;
masks = format_table[8].masks;
shifts = format_table[8].shifts;
break;
+ case MESA_FORMAT_B5G5R5A1_UNORM:
+ masks = format_table[11].masks;
+ shifts = format_table[11].shifts;
+ break;
+ case MESA_FORMAT_R5G5B5A1_UNORM:
+ masks = format_table[12].masks;
+ shifts = format_table[12].shifts;
+ break;
+ case MESA_FORMAT_B4G4R4A4_UNORM:
+ masks = format_table[13].masks;
+ shifts = format_table[13].shifts;
+ break;
+ case MESA_FORMAT_R4G4B4A4_UNORM:
+ masks = format_table[14].masks;
+ shifts = format_table[14].shifts;
+ break;
default:
fprintf(stderr, "[%s:%u] Unknown framebuffer type %s (%d).\n",
__func__, __LINE__,
/* Required by Android, for HAL_PIXEL_FORMAT_RGBX_8888. */
MESA_FORMAT_R8G8B8X8_SRGB,
+
+ MESA_FORMAT_B5G5R5A1_UNORM,
+ MESA_FORMAT_R5G5B5A1_UNORM,
+ MESA_FORMAT_B4G4R4A4_UNORM,
+ MESA_FORMAT_R4G4B4A4_UNORM,
};
static const enum pipe_format pipe_formats[] = {
PIPE_FORMAT_B10G10R10A2_UNORM,
PIPE_FORMAT_RGBX8888_UNORM,
PIPE_FORMAT_RGBA8888_SRGB,
PIPE_FORMAT_RGBX8888_SRGB,
+ PIPE_FORMAT_B5G5R5A1_UNORM,
+ PIPE_FORMAT_R5G5B5A1_UNORM,
+ PIPE_FORMAT_B4G4R4A4_UNORM,
+ PIPE_FORMAT_R4G4B4A4_UNORM,
};
__DRIconfig **configs = NULL;
uint8_t depth_bits_array[5];
(mesa_formats[format] == MESA_FORMAT_R8G8B8A8_UNORM ||
mesa_formats[format] == MESA_FORMAT_R8G8B8X8_UNORM ||
mesa_formats[format] == MESA_FORMAT_R8G8B8A8_SRGB ||
- mesa_formats[format] == MESA_FORMAT_R8G8B8X8_SRGB))
+ mesa_formats[format] == MESA_FORMAT_R8G8B8X8_SRGB ||
+ mesa_formats[format] == MESA_FORMAT_R5G5B5A1_UNORM ||
+ mesa_formats[format] == MESA_FORMAT_R4G4B4A4_UNORM))
continue;
if (!allow_rgb10 &&
stvis->color_format = PIPE_FORMAT_B5G6R5_UNORM;
break;
+ case 0x00007C00:
+ assert(!mode->sRGBCapable);
+ if (mode->alphaMask)
+ stvis->color_format = PIPE_FORMAT_B5G5R5A1_UNORM;
+ else
+ stvis->color_format = PIPE_FORMAT_B5G5R5X1_UNORM;
+ break;
+
+ case 0x0000001F:
+ assert(!mode->sRGBCapable);
+ if (mode->alphaMask)
+ stvis->color_format = PIPE_FORMAT_R5G5B5A1_UNORM;
+ else
+ stvis->color_format = PIPE_FORMAT_R5G5B5X1_UNORM;
+ break;
+
+ case 0x00000F00:
+ assert(!mode->sRGBCapable);
+ if (mode->alphaMask)
+ stvis->color_format = PIPE_FORMAT_B4G4R4A4_UNORM;
+ else
+ stvis->color_format = PIPE_FORMAT_B4G4R4X4_UNORM;
+ break;
+
+ case 0x0000000F:
+ assert(!mode->sRGBCapable);
+ if (mode->alphaMask)
+ stvis->color_format = PIPE_FORMAT_R4G4B4A4_UNORM;
+ else
+ stvis->color_format = PIPE_FORMAT_R4G4B4X4_UNORM;
+ break;
+
default:
assert(!"unsupported visual: invalid red mask");
return;
.internal_format = GL_RGB5_A1,
},
{
+ .image_format = __DRI_IMAGE_FORMAT_ABGR1555,
+ .mesa_format = MESA_FORMAT_R5G5B5A1_UNORM,
+ .internal_format = GL_RGB5_A1,
+ },
+ {
.image_format = __DRI_IMAGE_FORMAT_XRGB8888,
.mesa_format = MESA_FORMAT_B8G8R8X8_UNORM,
.internal_format = GL_RGB8,
.internal_format = GL_RG16,
},
#endif
+ {
+ .image_format = __DRI_IMAGE_FORMAT_ARGB4444,
+ .mesa_format = MESA_FORMAT_B4G4R4A4_UNORM,
+ .internal_format = GL_RGBA4,
+ },
+ {
+ .image_format = __DRI_IMAGE_FORMAT_ABGR4444,
+ .mesa_format = MESA_FORMAT_R4G4B4A4_UNORM,
+ .internal_format = GL_RGBA4,
+ },
};
uint32_t
case PIPE_FORMAT_R16G16B16X16_FLOAT:
image_format = __DRI_IMAGE_FORMAT_XBGR16161616F;
break;
+ case PIPE_FORMAT_B5G6R5_UNORM:
+ image_format = __DRI_IMAGE_FORMAT_RGB565;
+ break;
case PIPE_FORMAT_B5G5R5A1_UNORM:
image_format = __DRI_IMAGE_FORMAT_ARGB1555;
break;
- case PIPE_FORMAT_B5G6R5_UNORM:
- image_format = __DRI_IMAGE_FORMAT_RGB565;
+ case PIPE_FORMAT_R5G5B5A1_UNORM:
+ image_format = __DRI_IMAGE_FORMAT_ABGR1555;
+ break;
+ case PIPE_FORMAT_B4G4R4A4_UNORM:
+ image_format = __DRI_IMAGE_FORMAT_ARGB4444;
+ break;
+ case PIPE_FORMAT_R4G4B4A4_UNORM:
+ image_format = __DRI_IMAGE_FORMAT_ABGR4444;
break;
case PIPE_FORMAT_BGRX8888_UNORM:
image_format = __DRI_IMAGE_FORMAT_XRGB8888;
case __DRI_IMAGE_FORMAT_ABGR2101010: return DRM_FORMAT_ABGR2101010;
case __DRI_IMAGE_FORMAT_XBGR16161616F: return DRM_FORMAT_XBGR16161616F;
case __DRI_IMAGE_FORMAT_ABGR16161616F: return DRM_FORMAT_ABGR16161616F;
+ case __DRI_IMAGE_FORMAT_ARGB1555: return DRM_FORMAT_ARGB1555;
+ case __DRI_IMAGE_FORMAT_ABGR1555: return DRM_FORMAT_ABGR1555;
+ case __DRI_IMAGE_FORMAT_ARGB4444: return DRM_FORMAT_ARGB4444;
+ case __DRI_IMAGE_FORMAT_ABGR4444: return DRM_FORMAT_ABGR4444;
}
return 0;
}