crtc-kms: Get rid of meta_crtc_kms_supports_format

Instead get the assigned primary plane and use
meta_kms_plane_is_format_supported.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3512>
This commit is contained in:
Sebastian Wick 2024-01-10 15:14:35 +01:00 committed by Robert Mader
parent 60fd80b616
commit fbf68bf88c
6 changed files with 21 additions and 29 deletions

View File

@ -428,23 +428,6 @@ meta_crtc_kms_get_kms_crtc (MetaCrtcKms *crtc_kms)
return crtc_kms->kms_crtc; 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 * MetaCrtcKms *
meta_crtc_kms_from_kms_crtc (MetaKmsCrtc *kms_crtc) meta_crtc_kms_from_kms_crtc (MetaKmsCrtc *kms_crtc)
{ {

View File

@ -47,10 +47,6 @@ void meta_crtc_kms_set_mode (MetaCrtcKms *crtc_kms,
META_EXPORT_TEST META_EXPORT_TEST
MetaKmsCrtc * meta_crtc_kms_get_kms_crtc (MetaCrtcKms *crtc_kms); 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); const MetaGammaLut * meta_crtc_kms_peek_gamma_lut (MetaCrtcKms *crtc_kms);
MetaCrtcKms * meta_crtc_kms_from_kms_crtc (MetaKmsCrtc *kms_crtc); MetaCrtcKms * meta_crtc_kms_from_kms_crtc (MetaKmsCrtc *kms_crtc);

View File

@ -1928,6 +1928,7 @@ choose_onscreen_egl_config (CoglOnscreen *onscreen,
EGLDisplay egl_display = cogl_renderer_egl->edpy; EGLDisplay egl_display = cogl_renderer_egl->edpy;
MetaEgl *egl = meta_onscreen_native_get_egl (onscreen_native); MetaEgl *egl = meta_onscreen_native_get_egl (onscreen_native);
MetaCrtcKms *crtc_kms = META_CRTC_KMS (onscreen_native->crtc); 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]; EGLint attrs[MAX_EGL_CONFIG_ATTRIBS];
g_autoptr (GError) local_error = NULL; g_autoptr (GError) local_error = NULL;
static const uint32_t alphaless_10bpc_formats[] = { static const uint32_t alphaless_10bpc_formats[] = {
@ -1945,6 +1946,8 @@ choose_onscreen_egl_config (CoglOnscreen *onscreen,
GBM_FORMAT_ARGB8888, GBM_FORMAT_ARGB8888,
}; };
g_return_val_if_fail (META_IS_KMS_PLANE (kms_plane), FALSE);
cogl_display_egl_determine_attributes (cogl_display, cogl_display_egl_determine_attributes (cogl_display,
&cogl_display->onscreen_template->config, &cogl_display->onscreen_template->config,
attrs); attrs);
@ -1953,7 +1956,7 @@ choose_onscreen_egl_config (CoglOnscreen *onscreen,
* formats without alpha are renderable * formats without alpha are renderable
*/ */
if (!should_surface_be_sharable (onscreen) && if (!should_surface_be_sharable (onscreen) &&
meta_renderer_native_choose_gbm_format (crtc_kms, meta_renderer_native_choose_gbm_format (kms_plane,
egl, egl,
egl_display, egl_display,
attrs, attrs,
@ -1964,7 +1967,7 @@ choose_onscreen_egl_config (CoglOnscreen *onscreen,
error)) error))
return TRUE; return TRUE;
if (meta_renderer_native_choose_gbm_format (crtc_kms, if (meta_renderer_native_choose_gbm_format (kms_plane,
egl, egl,
egl_display, egl_display,
attrs, attrs,

View File

@ -56,6 +56,7 @@
#include "backends/native/meta-device-pool.h" #include "backends/native/meta-device-pool.h"
#include "backends/native/meta-kms-cursor-manager.h" #include "backends/native/meta-kms-cursor-manager.h"
#include "backends/native/meta-kms-device.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-utils.h"
#include "backends/native/meta-kms.h" #include "backends/native/meta-kms.h"
#include "backends/native/meta-onscreen-native.h" #include "backends/native/meta-onscreen-native.h"
@ -407,7 +408,7 @@ choose_egl_config_from_gbm_format (MetaEgl *egl,
} }
gboolean gboolean
meta_renderer_native_choose_gbm_format (MetaCrtcKms *crtc_kms, meta_renderer_native_choose_gbm_format (MetaKmsPlane *kms_plane,
MetaEgl *egl, MetaEgl *egl,
EGLDisplay egl_display, EGLDisplay egl_display,
EGLint *attributes, EGLint *attributes,
@ -423,7 +424,8 @@ meta_renderer_native_choose_gbm_format (MetaCrtcKms *crtc_kms,
{ {
g_clear_error (error); 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, g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"KMS CRTC doesn't support format"); "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) 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; break;
} }

View File

@ -76,7 +76,7 @@ gboolean meta_renderer_native_has_addfb2 (MetaRendererNative *renderer_native);
MetaRendererNativeMode meta_renderer_native_get_mode (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, MetaEgl *egl,
EGLDisplay egl_display, EGLDisplay egl_display,
EGLint *attributes, EGLint *attributes,

View File

@ -1289,6 +1289,7 @@ ensure_scanout_tranche (MetaWaylandDmaBufSurfaceFeedback *surface_feedback,
MetaBackend *backend = meta_context_get_backend (context); MetaBackend *backend = meta_context_get_backend (context);
MetaWaylandDmaBufFeedback *feedback = surface_feedback->feedback; MetaWaylandDmaBufFeedback *feedback = surface_feedback->feedback;
MetaCrtcKms *crtc_kms; MetaCrtcKms *crtc_kms;
MetaKmsPlane *kms_plane;
MetaWaylandDmaBufTranche *tranche; MetaWaylandDmaBufTranche *tranche;
GList *el; GList *el;
int i; int i;
@ -1297,7 +1298,11 @@ ensure_scanout_tranche (MetaWaylandDmaBufSurfaceFeedback *surface_feedback,
MetaWaylandDmaBufTrancheFlags flags; MetaWaylandDmaBufTrancheFlags flags;
g_return_if_fail (META_IS_CRTC_KMS (crtc)); g_return_if_fail (META_IS_CRTC_KMS (crtc));
crtc_kms = META_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); el = g_list_find_custom (feedback->tranches, NULL, find_scanout_tranche_func);
if (el) if (el)
@ -1344,7 +1349,7 @@ ensure_scanout_tranche (MetaWaylandDmaBufSurfaceFeedback *surface_feedback,
if (format.drm_modifier != DRM_FORMAT_MOD_INVALID) if (format.drm_modifier != DRM_FORMAT_MOD_INVALID)
continue; 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; continue;
g_array_append_val (formats, format); g_array_append_val (formats, format);