crtc/kms: Use MetaKmsPlane to check supported rotations and formats

Instead of manually retrieving supported transforms and formats from the
primary plane of the CRTC, use the MetaKmsPlane abstraction to find the
primary plane of the CRTC and check compatibility using the
MetaKmsPlane API. This removes the last user of direct KMS API usage
except for applying configuration.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
This commit is contained in:
Jonas Ådahl
2019-03-09 18:23:28 +01:00
committed by Georges Basile Stavracas Neto
parent aba689312f
commit d84c7269b2
8 changed files with 273 additions and 262 deletions

View File

@ -25,6 +25,7 @@
#include "backends/native/meta-backend-native.h"
#include "backends/native/meta-kms-impl-device.h"
#include "backends/native/meta-kms-impl.h"
#include "backends/native/meta-kms-plane.h"
#include "backends/native/meta-kms-private.h"
struct _MetaKmsDevice
@ -81,6 +82,32 @@ meta_kms_device_get_crtcs (MetaKmsDevice *device)
return device->crtcs;
}
static GList *
meta_kms_device_get_planes (MetaKmsDevice *device)
{
return device->planes;
}
MetaKmsPlane *
meta_kms_device_get_primary_plane_for (MetaKmsDevice *device,
MetaKmsCrtc *crtc)
{
GList *l;
for (l = meta_kms_device_get_planes (device); l; l = l->next)
{
MetaKmsPlane *plane = l->data;
if (meta_kms_plane_get_plane_type (plane) != META_KMS_PLANE_TYPE_PRIMARY)
continue;
if (meta_kms_plane_is_usable_with (plane, crtc))
return plane;
}
return NULL;
}
typedef struct _CreateImplDeviceData
{
MetaKmsDevice *device;