backend/native: Move DrmFormatBuf to cogl-drm-formats

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3480>
This commit is contained in:
Bilal Elmoussaoui
2024-01-03 13:36:42 +01:00
parent 786a9d9072
commit cebde5c2d1
6 changed files with 43 additions and 45 deletions

View File

@ -28,6 +28,7 @@
#include "backends/native/meta-device-pool.h"
#include "backends/native/meta-kms-utils.h"
#include "common/meta-cogl-drm-formats.h"
#include "meta-private-enum-types.h"

View File

@ -20,7 +20,6 @@
#include "backends/native/meta-kms-utils.h"
#include <drm_fourcc.h>
#include <glib.h>
float
@ -61,36 +60,4 @@ meta_calculate_drm_mode_vblank_duration_us (const drmModeModeInfo *drm_mode)
return value;
}
/**
* meta_drm_format_to_string:
* @tmp: temporary buffer
* @drm_format: DRM fourcc pixel format
*
* Returns a pointer to a string naming the given pixel format,
* usually a pointer to the temporary buffer but not always.
* Invalid formats may return nonsense names.
*
* When calling this, allocate one MetaDrmFormatBuf on the stack to
* be used as the temporary buffer.
*/
const char *
meta_drm_format_to_string (MetaDrmFormatBuf *tmp,
uint32_t drm_format)
{
int i;
if (drm_format == DRM_FORMAT_INVALID)
return "INVALID";
G_STATIC_ASSERT (sizeof (tmp->s) == 5);
for (i = 0; i < 4; i++)
{
char c = (drm_format >> (i * 8)) & 0xff;
tmp->s[i] = g_ascii_isgraph (c) ? c : '.';
}
tmp->s[i] = 0;
return tmp->s;
}

View File

@ -23,16 +23,8 @@
#include "core/util-private.h"
typedef struct _MetaDrmFormatBuf
{
char s[5];
} MetaDrmFormatBuf;
META_EXPORT_TEST
float meta_calculate_drm_mode_refresh_rate (const drmModeModeInfo *drm_mode);
META_EXPORT_TEST
int64_t meta_calculate_drm_mode_vblank_duration_us (const drmModeModeInfo *drm_mode);
const char * meta_drm_format_to_string (MetaDrmFormatBuf *tmp,
uint32_t drm_format);