pixel-formats: Rename addfb_legacy_depth

'depth' isn't actually used to determine the bit depth of meaningful
components generally, but specifically to determine whether we can use
the legacy drmModeAddFB (pre-AddFB2) with those formats.

Rename the member to make it more clear what it's used for.

Signed-off-by: Daniel Stone <daniels@collabora.com>
dev
Daniel Stone 3 years ago committed by Pekka Paalanen
parent d37d73a9a0
commit c54eace91d
  1. 6
      libweston/backend-drm/fb.c
  2. 10
      libweston/pixel-formats.c
  3. 2
      libweston/pixel-formats.h

@ -98,7 +98,7 @@ drm_fb_addfb(struct drm_backend *b, struct drm_fb *fb)
/* Legacy AddFB can't always infer the format from depth/bpp alone, so
* check if our format is one of the lucky ones. */
if (!fb->format->depth || !fb->format->bpp)
if (!fb->format->addfb_legacy_depth || !fb->format->bpp)
return ret;
/* Cannot fall back to AddFB for multi-planar formats either. */
@ -106,7 +106,7 @@ drm_fb_addfb(struct drm_backend *b, struct drm_fb *fb)
return ret;
ret = drmModeAddFB(fb->fd, fb->width, fb->height,
fb->format->depth, fb->format->bpp,
fb->format->addfb_legacy_depth, fb->format->bpp,
fb->strides[0], fb->handles[0], &fb->fb_id);
return ret;
}
@ -134,7 +134,7 @@ drm_fb_create_dumb(struct drm_backend *b, int width, int height,
goto err_fb;
}
if (!fb->format->depth || !fb->format->bpp) {
if (!fb->format->addfb_legacy_depth || !fb->format->bpp) {
weston_log("format 0x%lx is not compatible with dumb buffers\n",
(unsigned long) format);
goto err_fb;

@ -129,7 +129,7 @@ static const struct pixel_format_info pixel_format_table[] = {
{
DRM_FORMAT(XRGB1555),
BITS_RGBA_FIXED(5, 5, 5, 0),
.depth = 15,
.addfb_legacy_depth = 15,
.bpp = 16,
},
{
@ -175,7 +175,7 @@ static const struct pixel_format_info pixel_format_table[] = {
{
DRM_FORMAT(RGB565),
BITS_RGBA_FIXED(5, 6, 5, 0),
.depth = 16,
.addfb_legacy_depth = 16,
.bpp = 16,
# if __BYTE_ORDER == __LITTLE_ENDIAN
GL_FORMAT(GL_RGB),
@ -200,7 +200,7 @@ static const struct pixel_format_info pixel_format_table[] = {
{
DRM_FORMAT(XRGB8888),
BITS_RGBA_FIXED(8, 8, 8, 0),
.depth = 24,
.addfb_legacy_depth = 24,
.bpp = 32,
GL_FORMAT(GL_BGRA_EXT),
GL_TYPE(GL_UNSIGNED_BYTE),
@ -214,7 +214,7 @@ static const struct pixel_format_info pixel_format_table[] = {
DRM_FORMAT(ARGB8888),
BITS_RGBA_FIXED(8, 8, 8, 8),
.opaque_substitute = DRM_FORMAT_XRGB8888,
.depth = 32,
.addfb_legacy_depth = 32,
.bpp = 32,
GL_FORMAT(GL_BGRA_EXT),
GL_TYPE(GL_UNSIGNED_BYTE),
@ -288,7 +288,7 @@ static const struct pixel_format_info pixel_format_table[] = {
{
DRM_FORMAT(XRGB2101010),
BITS_RGBA_FIXED(10, 10, 10, 0),
.depth = 30,
.addfb_legacy_depth = 30,
.bpp = 32,
#if __BYTE_ORDER == __LITTLE_ENDIAN
PIXMAN_FMT(x2r10g10b10),

@ -76,7 +76,7 @@ struct pixel_format_info {
/** If set, this format can be used with the legacy drmModeAddFB()
* function (not AddFB2), using this and the bpp member. */
int depth;
int addfb_legacy_depth;
/** See 'depth' member above. */
int bpp;

Loading…
Cancel
Save