diff --git a/src/backends/native/meta-crtc-kms.c b/src/backends/native/meta-crtc-kms.c index f853f697a..3498f922a 100644 --- a/src/backends/native/meta-crtc-kms.c +++ b/src/backends/native/meta-crtc-kms.c @@ -428,23 +428,6 @@ meta_crtc_kms_get_kms_crtc (MetaCrtcKms *crtc_kms) return crtc_kms->kms_crtc; } -/** - * meta_crtc_kms_supports_format: - * @crtc_kms: a #MetaCrtcKms - * @drm_format: a DRM pixel format - * - * Returns true if the CRTC supports the format on its primary plane. - */ -gboolean -meta_crtc_kms_supports_format (MetaCrtcKms *crtc_kms, - uint32_t drm_format) -{ - g_return_val_if_fail (crtc_kms->assigned_primary_plane, FALSE); - - return meta_kms_plane_is_format_supported (crtc_kms->assigned_primary_plane, - drm_format); -} - MetaCrtcKms * meta_crtc_kms_from_kms_crtc (MetaKmsCrtc *kms_crtc) { diff --git a/src/backends/native/meta-crtc-kms.h b/src/backends/native/meta-crtc-kms.h index 10b4b86dc..c132b9907 100644 --- a/src/backends/native/meta-crtc-kms.h +++ b/src/backends/native/meta-crtc-kms.h @@ -47,10 +47,6 @@ void meta_crtc_kms_set_mode (MetaCrtcKms *crtc_kms, META_EXPORT_TEST MetaKmsCrtc * meta_crtc_kms_get_kms_crtc (MetaCrtcKms *crtc_kms); -gboolean -meta_crtc_kms_supports_format (MetaCrtcKms *crtc_kms, - uint32_t drm_format); - const MetaGammaLut * meta_crtc_kms_peek_gamma_lut (MetaCrtcKms *crtc_kms); MetaCrtcKms * meta_crtc_kms_from_kms_crtc (MetaKmsCrtc *kms_crtc); diff --git a/src/backends/native/meta-onscreen-native.c b/src/backends/native/meta-onscreen-native.c index 0e0c0da63..68b043e15 100644 --- a/src/backends/native/meta-onscreen-native.c +++ b/src/backends/native/meta-onscreen-native.c @@ -1928,6 +1928,7 @@ choose_onscreen_egl_config (CoglOnscreen *onscreen, EGLDisplay egl_display = cogl_renderer_egl->edpy; MetaEgl *egl = meta_onscreen_native_get_egl (onscreen_native); MetaCrtcKms *crtc_kms = META_CRTC_KMS (onscreen_native->crtc); + MetaKmsPlane *kms_plane = meta_crtc_kms_get_assigned_primary_plane (crtc_kms); EGLint attrs[MAX_EGL_CONFIG_ATTRIBS]; g_autoptr (GError) local_error = NULL; static const uint32_t alphaless_10bpc_formats[] = { @@ -1945,6 +1946,8 @@ choose_onscreen_egl_config (CoglOnscreen *onscreen, GBM_FORMAT_ARGB8888, }; + g_return_val_if_fail (META_IS_KMS_PLANE (kms_plane), FALSE); + cogl_display_egl_determine_attributes (cogl_display, &cogl_display->onscreen_template->config, attrs); @@ -1953,7 +1956,7 @@ choose_onscreen_egl_config (CoglOnscreen *onscreen, * formats without alpha are renderable */ if (!should_surface_be_sharable (onscreen) && - meta_renderer_native_choose_gbm_format (crtc_kms, + meta_renderer_native_choose_gbm_format (kms_plane, egl, egl_display, attrs, @@ -1964,7 +1967,7 @@ choose_onscreen_egl_config (CoglOnscreen *onscreen, error)) return TRUE; - if (meta_renderer_native_choose_gbm_format (crtc_kms, + if (meta_renderer_native_choose_gbm_format (kms_plane, egl, egl_display, attrs, diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c index dc08824c1..dedd84466 100644 --- a/src/backends/native/meta-renderer-native.c +++ b/src/backends/native/meta-renderer-native.c @@ -56,6 +56,7 @@ #include "backends/native/meta-device-pool.h" #include "backends/native/meta-kms-cursor-manager.h" #include "backends/native/meta-kms-device.h" +#include "backends/native/meta-kms-plane.h" #include "backends/native/meta-kms-utils.h" #include "backends/native/meta-kms.h" #include "backends/native/meta-onscreen-native.h" @@ -407,7 +408,7 @@ choose_egl_config_from_gbm_format (MetaEgl *egl, } gboolean -meta_renderer_native_choose_gbm_format (MetaCrtcKms *crtc_kms, +meta_renderer_native_choose_gbm_format (MetaKmsPlane *kms_plane, MetaEgl *egl, EGLDisplay egl_display, EGLint *attributes, @@ -423,7 +424,8 @@ meta_renderer_native_choose_gbm_format (MetaCrtcKms *crtc_kms, { g_clear_error (error); - if (crtc_kms && !meta_crtc_kms_supports_format (crtc_kms, formats[i])) + if (kms_plane && + !meta_kms_plane_is_format_supported (kms_plane, formats[i])) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "KMS CRTC doesn't support format"); @@ -1649,9 +1651,12 @@ create_secondary_egl_config (MetaEgl *egl, for (l = meta_gpu_get_crtcs (META_GPU (gpu_kms)); l; l = l->next) { - MetaCrtc *crtc = l->data; + MetaCrtcKms *crtc_kms = META_CRTC_KMS (l->data); + MetaKmsPlane *kms_plane = + meta_crtc_kms_get_assigned_primary_plane (crtc_kms); - if (!meta_crtc_kms_supports_format (META_CRTC_KMS (crtc), gles3_formats[i])) + if (!meta_kms_plane_is_format_supported (kms_plane, + gles3_formats[i])) break; } diff --git a/src/backends/native/meta-renderer-native.h b/src/backends/native/meta-renderer-native.h index 6cbad0b48..6c88099fc 100644 --- a/src/backends/native/meta-renderer-native.h +++ b/src/backends/native/meta-renderer-native.h @@ -76,7 +76,7 @@ gboolean meta_renderer_native_has_addfb2 (MetaRendererNative *renderer_native); MetaRendererNativeMode meta_renderer_native_get_mode (MetaRendererNative *renderer_native); -gboolean meta_renderer_native_choose_gbm_format (MetaCrtcKms *crtc_kms, +gboolean meta_renderer_native_choose_gbm_format (MetaKmsPlane *kms_plane, MetaEgl *egl, EGLDisplay egl_display, EGLint *attributes, diff --git a/src/wayland/meta-wayland-dma-buf.c b/src/wayland/meta-wayland-dma-buf.c index 4b91242c6..f713c5968 100644 --- a/src/wayland/meta-wayland-dma-buf.c +++ b/src/wayland/meta-wayland-dma-buf.c @@ -1289,6 +1289,7 @@ ensure_scanout_tranche (MetaWaylandDmaBufSurfaceFeedback *surface_feedback, MetaBackend *backend = meta_context_get_backend (context); MetaWaylandDmaBufFeedback *feedback = surface_feedback->feedback; MetaCrtcKms *crtc_kms; + MetaKmsPlane *kms_plane; MetaWaylandDmaBufTranche *tranche; GList *el; int i; @@ -1297,7 +1298,11 @@ ensure_scanout_tranche (MetaWaylandDmaBufSurfaceFeedback *surface_feedback, MetaWaylandDmaBufTrancheFlags flags; g_return_if_fail (META_IS_CRTC_KMS (crtc)); + crtc_kms = META_CRTC_KMS (crtc); + kms_plane = meta_crtc_kms_get_assigned_primary_plane (crtc_kms); + + g_return_if_fail (META_IS_KMS_PLANE (kms_plane)); el = g_list_find_custom (feedback->tranches, NULL, find_scanout_tranche_func); if (el) @@ -1344,7 +1349,7 @@ ensure_scanout_tranche (MetaWaylandDmaBufSurfaceFeedback *surface_feedback, if (format.drm_modifier != DRM_FORMAT_MOD_INVALID) continue; - if (!meta_crtc_kms_supports_format (crtc_kms, format.drm_format)) + if (!meta_kms_plane_is_format_supported (kms_plane, format.drm_format)) continue; g_array_append_val (formats, format);