mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-13 08:22:16 -04:00
render/pixel_format: drop wlr_pixel_format_info.opaque_substitute
Move this away from struct wlr_pixel_format_info. The next commit will generate the pixel_format_info table from kdfs, computing a compatible opaque format needs to be done separately from retrieving pixel format metadata (and is not yet supported).
This commit is contained in:
parent
2d95d8d292
commit
34ffeaa4ef
2 changed files with 28 additions and 22 deletions
|
|
@ -10,7 +10,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
|
|||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_ARGB8888,
|
||||
.opaque_substitute = DRM_FORMAT_XRGB8888,
|
||||
.bytes_per_block = 4,
|
||||
},
|
||||
{
|
||||
|
|
@ -19,7 +18,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
|
|||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_ABGR8888,
|
||||
.opaque_substitute = DRM_FORMAT_XBGR8888,
|
||||
.bytes_per_block = 4,
|
||||
},
|
||||
{
|
||||
|
|
@ -28,7 +26,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
|
|||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_RGBA8888,
|
||||
.opaque_substitute = DRM_FORMAT_RGBX8888,
|
||||
.bytes_per_block = 4,
|
||||
},
|
||||
{
|
||||
|
|
@ -37,7 +34,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
|
|||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_BGRA8888,
|
||||
.opaque_substitute = DRM_FORMAT_BGRX8888,
|
||||
.bytes_per_block = 4,
|
||||
},
|
||||
{
|
||||
|
|
@ -90,7 +86,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
|
|||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_RGBA4444,
|
||||
.opaque_substitute = DRM_FORMAT_RGBX4444,
|
||||
.bytes_per_block = 2,
|
||||
},
|
||||
{
|
||||
|
|
@ -99,7 +94,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
|
|||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_BGRA4444,
|
||||
.opaque_substitute = DRM_FORMAT_BGRX4444,
|
||||
.bytes_per_block = 2,
|
||||
},
|
||||
{
|
||||
|
|
@ -108,7 +102,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
|
|||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_RGBA5551,
|
||||
.opaque_substitute = DRM_FORMAT_RGBX5551,
|
||||
.bytes_per_block = 2,
|
||||
},
|
||||
{
|
||||
|
|
@ -117,7 +110,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
|
|||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_BGRA5551,
|
||||
.opaque_substitute = DRM_FORMAT_BGRX5551,
|
||||
.bytes_per_block = 2,
|
||||
},
|
||||
{
|
||||
|
|
@ -126,7 +118,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
|
|||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_ARGB1555,
|
||||
.opaque_substitute = DRM_FORMAT_XRGB1555,
|
||||
.bytes_per_block = 2,
|
||||
},
|
||||
{
|
||||
|
|
@ -143,7 +134,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
|
|||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_ARGB2101010,
|
||||
.opaque_substitute = DRM_FORMAT_XRGB2101010,
|
||||
.bytes_per_block = 4,
|
||||
},
|
||||
{
|
||||
|
|
@ -152,7 +142,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
|
|||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_ABGR2101010,
|
||||
.opaque_substitute = DRM_FORMAT_XBGR2101010,
|
||||
.bytes_per_block = 4,
|
||||
},
|
||||
{
|
||||
|
|
@ -161,7 +150,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
|
|||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_ABGR16161616F,
|
||||
.opaque_substitute = DRM_FORMAT_XBGR16161616F,
|
||||
.bytes_per_block = 8,
|
||||
},
|
||||
{
|
||||
|
|
@ -174,7 +162,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
|
|||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_ABGR16161616,
|
||||
.opaque_substitute = DRM_FORMAT_XBGR16161616,
|
||||
.bytes_per_block = 8,
|
||||
},
|
||||
{
|
||||
|
|
@ -374,9 +361,33 @@ bool pixel_format_is_ycbcr(uint32_t format) {
|
|||
}
|
||||
|
||||
uint32_t pixel_format_get_opaque_substitute(uint32_t fmt) {
|
||||
const struct wlr_pixel_format_info *info = drm_get_pixel_format_info(fmt);
|
||||
if (info == NULL) {
|
||||
return DRM_FORMAT_INVALID;
|
||||
switch (fmt) {
|
||||
case DRM_FORMAT_ARGB8888:
|
||||
return DRM_FORMAT_XRGB8888;
|
||||
case DRM_FORMAT_ABGR8888:
|
||||
return DRM_FORMAT_XBGR8888;
|
||||
case DRM_FORMAT_RGBA8888:
|
||||
return DRM_FORMAT_RGBX8888;
|
||||
case DRM_FORMAT_BGRA8888:
|
||||
return DRM_FORMAT_BGRX8888;
|
||||
case DRM_FORMAT_RGBA4444:
|
||||
return DRM_FORMAT_RGBX4444;
|
||||
case DRM_FORMAT_BGRA4444:
|
||||
return DRM_FORMAT_BGRX4444;
|
||||
case DRM_FORMAT_RGBA5551:
|
||||
return DRM_FORMAT_RGBX5551;
|
||||
case DRM_FORMAT_BGRA5551:
|
||||
return DRM_FORMAT_BGRX5551;
|
||||
case DRM_FORMAT_ARGB1555:
|
||||
return DRM_FORMAT_XRGB1555;
|
||||
case DRM_FORMAT_ARGB2101010:
|
||||
return DRM_FORMAT_XRGB2101010;
|
||||
case DRM_FORMAT_ABGR2101010:
|
||||
return DRM_FORMAT_XBGR2101010;
|
||||
case DRM_FORMAT_ABGR16161616F:
|
||||
return DRM_FORMAT_XBGR16161616F;
|
||||
case DRM_FORMAT_ABGR16161616:
|
||||
return DRM_FORMAT_XBGR16161616;
|
||||
}
|
||||
return info->opaque_substitute;
|
||||
return DRM_FORMAT_INVALID;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue