+/*
+ * The index of entries in this table is used as a bitmask in
+ * dri2_dpy->formats, which tracks the formats supported by our server.
+ */
+static const struct dri2_wl_visual {
+ const char *format_name;
+ uint32_t wl_drm_format;
+ uint32_t wl_shm_format;
+ int dri_image_format;
+ /* alt_dri_image_format is a substitute wl_buffer format to use for a
+ * wl-server unsupported dri_image_format, ie. some other dri_image_format in
+ * the table, of the same precision but with different channel ordering, or
+ * __DRI_IMAGE_FORMAT_NONE if an alternate format is not needed or supported.
+ * The code checks if alt_dri_image_format can be used as a fallback for a
+ * dri_image_format for a given wl-server implementation.
+ */
+ int alt_dri_image_format;
+ int bpp;
+ unsigned int rgba_masks[4];
+} dri2_wl_visuals[] = {
+ {
+ "XRGB2101010",
+ WL_DRM_FORMAT_XRGB2101010, WL_SHM_FORMAT_XRGB2101010,
+ __DRI_IMAGE_FORMAT_XRGB2101010, __DRI_IMAGE_FORMAT_XBGR2101010, 32,
+ { 0x3ff00000, 0x000ffc00, 0x000003ff, 0x00000000 }
+ },
+ {
+ "ARGB2101010",
+ WL_DRM_FORMAT_ARGB2101010, WL_SHM_FORMAT_ARGB2101010,
+ __DRI_IMAGE_FORMAT_ARGB2101010, __DRI_IMAGE_FORMAT_ABGR2101010, 32,
+ { 0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000 }
+ },
+ {
+ "XBGR2101010",
+ WL_DRM_FORMAT_XBGR2101010, WL_SHM_FORMAT_XBGR2101010,
+ __DRI_IMAGE_FORMAT_XBGR2101010, __DRI_IMAGE_FORMAT_XRGB2101010, 32,
+ { 0x000003ff, 0x000ffc00, 0x3ff00000, 0x00000000 }
+ },
+ {
+ "ABGR2101010",
+ WL_DRM_FORMAT_ABGR2101010, WL_SHM_FORMAT_ABGR2101010,
+ __DRI_IMAGE_FORMAT_ABGR2101010, __DRI_IMAGE_FORMAT_ARGB2101010, 32,
+ { 0x000003ff, 0x000ffc00, 0x3ff00000, 0xc0000000 }
+ },
+ {
+ "XRGB8888",
+ WL_DRM_FORMAT_XRGB8888, WL_SHM_FORMAT_XRGB8888,
+ __DRI_IMAGE_FORMAT_XRGB8888, __DRI_IMAGE_FORMAT_NONE, 32,
+ { 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000 }
+ },
+ {
+ "ARGB8888",
+ WL_DRM_FORMAT_ARGB8888, WL_SHM_FORMAT_ARGB8888,
+ __DRI_IMAGE_FORMAT_ARGB8888, __DRI_IMAGE_FORMAT_NONE, 32,
+ { 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 }
+ },
+ {
+ "RGB565",
+ WL_DRM_FORMAT_RGB565, WL_SHM_FORMAT_RGB565,
+ __DRI_IMAGE_FORMAT_RGB565, __DRI_IMAGE_FORMAT_NONE, 16,
+ { 0xf800, 0x07e0, 0x001f, 0x0000 }
+ },