mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
backend/native: Move DrmFormatBuf to cogl-drm-formats
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3480>
This commit is contained in:
parent
786a9d9072
commit
cebde5c2d1
@ -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"
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -24,6 +24,40 @@
|
||||
|
||||
#include "common/meta-cogl-drm-formats.h"
|
||||
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
const MetaFormatInfo *
|
||||
meta_format_info_from_drm_format (uint32_t drm_format)
|
||||
{
|
||||
|
@ -29,6 +29,14 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _MetaDrmFormatBuf
|
||||
{
|
||||
char s[5];
|
||||
} MetaDrmFormatBuf;
|
||||
|
||||
const char * meta_drm_format_to_string (MetaDrmFormatBuf *tmp,
|
||||
uint32_t drm_format);
|
||||
|
||||
typedef struct _MetaFormatInfo
|
||||
{
|
||||
uint32_t drm_format;
|
||||
|
@ -359,9 +359,7 @@ meta_wayland_dma_buf_realize_texture (MetaWaylandBuffer *buffer,
|
||||
MetaMultiTextureFormat multi_format;
|
||||
CoglPixelFormat cogl_format;
|
||||
const MetaFormatInfo *format_info;
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
MetaDrmFormatBuf format_buf;
|
||||
#endif
|
||||
|
||||
if (buffer->dma_buf.texture)
|
||||
return TRUE;
|
||||
@ -378,7 +376,6 @@ meta_wayland_dma_buf_realize_texture (MetaWaylandBuffer *buffer,
|
||||
cogl_format = format_info->cogl_format;
|
||||
multi_format = format_info->multi_texture_format;
|
||||
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
meta_topic (META_DEBUG_WAYLAND,
|
||||
"[dma-buf] wl_buffer@%u DRM format %s "
|
||||
"-> MetaMultiTextureFormat %s / CoglPixelFormat %s",
|
||||
@ -386,7 +383,6 @@ meta_wayland_dma_buf_realize_texture (MetaWaylandBuffer *buffer,
|
||||
meta_drm_format_to_string (&format_buf, dma_buf->drm_format),
|
||||
meta_multi_texture_format_to_string (multi_format),
|
||||
cogl_pixel_format_to_string (cogl_format));
|
||||
#endif
|
||||
|
||||
if (multi_format == META_MULTI_TEXTURE_FORMAT_SIMPLE)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user