drm-buffer: Handle both XR24 and AR24 in legacy path
drmModeAddFB() doesn't take a format, but depth and bits per pixel.
These can be used to determine whether there should be an alpha channel
or not, and is roughly assumed to result in either XR24 or AR24 if one
passes 24 or 32 as depth, with 32 as bpp.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3926>
(cherry picked from commit 86c9d602cd
)
This commit is contained in:
parent
a113753ecb
commit
e9dbc4f6e4
1 changed files with 19 additions and 3 deletions
|
@ -122,7 +122,11 @@ meta_drm_buffer_do_ensure_fb_id (MetaDrmBuffer *buffer,
|
||||||
&fb_id,
|
&fb_id,
|
||||||
0))
|
0))
|
||||||
{
|
{
|
||||||
if (fb_args->format != DRM_FORMAT_XRGB8888)
|
uint8_t depth;
|
||||||
|
uint8_t bpp;
|
||||||
|
|
||||||
|
if (fb_args->format != DRM_FORMAT_XRGB8888 &&
|
||||||
|
fb_args->format != DRM_FORMAT_ARGB8888)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_IO_ERROR,
|
G_IO_ERROR,
|
||||||
|
@ -135,11 +139,23 @@ meta_drm_buffer_do_ensure_fb_id (MetaDrmBuffer *buffer,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (fb_args->format)
|
||||||
|
{
|
||||||
|
case DRM_FORMAT_XRGB8888:
|
||||||
|
depth = 24;
|
||||||
|
bpp = 32;
|
||||||
|
break;
|
||||||
|
case DRM_FORMAT_ARGB8888:
|
||||||
|
depth = 32;
|
||||||
|
bpp = 32;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (drmModeAddFB (fd,
|
if (drmModeAddFB (fd,
|
||||||
fb_args->width,
|
fb_args->width,
|
||||||
fb_args->height,
|
fb_args->height,
|
||||||
24,
|
depth,
|
||||||
32,
|
bpp,
|
||||||
fb_args->strides[0],
|
fb_args->strides[0],
|
||||||
fb_args->handles[0],
|
fb_args->handles[0],
|
||||||
&fb_id))
|
&fb_id))
|
||||||
|
|
Loading…
Reference in a new issue