[mutter] renderer-native: Get the GBM buffer format from EGL to match the framebuffer
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] renderer-native: Get the GBM buffer format from EGL to match the framebuffer
- Date: Thu, 15 Oct 2020 07:55:11 +0000 (UTC)
commit df76d3deece5623e271a4fcaf3519159413bf981
Author: Daniel van Vugt <daniel van vugt canonical com>
Date: Mon Oct 12 16:57:45 2020 +0800
renderer-native: Get the GBM buffer format from EGL to match the framebuffer
This eliminates two locations where the format was hardcoded.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1491
src/backends/native/meta-renderer-native.c | 33 ++++++++++++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 75bbe3e258..87a690532b 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -444,6 +444,27 @@ get_supported_kms_formats (CoglOnscreen *onscreen)
return meta_crtc_kms_copy_drm_format_list (crtc_kms);
}
+static uint32_t
+get_gbm_format_from_egl (MetaEgl *egl,
+ EGLDisplay egl_display,
+ EGLConfig egl_config)
+{
+ uint32_t gbm_format;
+ EGLint native_visual_id;
+
+ if (meta_egl_get_config_attrib (egl,
+ egl_display,
+ egl_config,
+ EGL_NATIVE_VISUAL_ID,
+ &native_visual_id,
+ NULL))
+ gbm_format = (uint32_t) native_visual_id;
+ else
+ g_assert_not_reached ();
+
+ return gbm_format;
+}
+
static gboolean
init_secondary_gpu_state_gpu_copy_mode (MetaRendererNative *renderer_native,
CoglOnscreen *onscreen,
@@ -460,13 +481,17 @@ init_secondary_gpu_state_gpu_copy_mode (MetaRendererNative *renderer_nat
EGLSurface egl_surface;
MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state;
MetaGpuKms *gpu_kms;
+ uint32_t format;
width = cogl_framebuffer_get_width (framebuffer);
height = cogl_framebuffer_get_height (framebuffer);
+ format = get_gbm_format_from_egl (egl,
+ renderer_gpu_data->egl_display,
+ renderer_gpu_data->secondary.egl_config);
gbm_surface = gbm_surface_create (renderer_gpu_data->gbm.device,
width, height,
- GBM_FORMAT_XRGB8888,
+ format,
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
if (!gbm_surface)
{
@@ -2201,13 +2226,17 @@ meta_renderer_native_create_surface_gbm (CoglOnscreen *onscreen,
struct gbm_surface *new_gbm_surface = NULL;
EGLNativeWindowType egl_native_window;
EGLSurface new_egl_surface;
- uint32_t format = GBM_FORMAT_XRGB8888;
+ uint32_t format;
GArray *modifiers;
renderer_gpu_data =
meta_renderer_native_get_gpu_data (renderer_native,
onscreen_native->render_gpu);
+ format = get_gbm_format_from_egl (egl,
+ cogl_renderer_egl->edpy,
+ cogl_display_egl->egl_config);
+
if (renderer_native->use_modifiers)
modifiers = get_supported_modifiers (onscreen, format);
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]