kms/plane: Find property IDs to be used for atomic modesetting

Currently undiscovered, as we haven't enabled the atomic modesetting
capability, but lets get the infrastructure to get the property IDs in
place.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
This commit is contained in:
Jonas Ådahl 2020-07-13 23:27:30 +02:00 committed by Marge Bot
parent 11966dc6cb
commit a9ae202327
2 changed files with 120 additions and 0 deletions

View File

@ -26,6 +26,22 @@
#include "backends/native/meta-kms-plane.h"
#include "backends/native/meta-kms-types.h"
typedef enum _MetaKmsPlaneProp
{
META_KMS_PLANE_PROP_TYPE = 0,
META_KMS_PLANE_PROP_SRC_X,
META_KMS_PLANE_PROP_SRC_Y,
META_KMS_PLANE_PROP_SRC_W,
META_KMS_PLANE_PROP_SRC_H,
META_KMS_PLANE_PROP_CRTC_X,
META_KMS_PLANE_PROP_CRTC_Y,
META_KMS_PLANE_PROP_CRTC_W,
META_KMS_PLANE_PROP_CRTC_H,
META_KMS_PLANE_PROP_FB_ID,
META_KMS_PLANE_PROP_CRTC_ID,
META_KMS_PLANE_N_PROPS
} MetaKmsPlaneProp;
MetaKmsPlane * meta_kms_plane_new (MetaKmsPlaneType type,
MetaKmsImplDevice *impl_device,
drmModePlane *drm_plane,
@ -34,4 +50,10 @@ MetaKmsPlane * meta_kms_plane_new (MetaKmsPlaneType type,
MetaKmsPlane * meta_kms_plane_new_fake (MetaKmsPlaneType type,
MetaKmsCrtc *crtc);
uint32_t meta_kms_plane_get_prop_id (MetaKmsPlane *plane,
MetaKmsPlaneProp prop);
const char * meta_kms_plane_get_prop_name (MetaKmsPlane *plane,
MetaKmsPlaneProp prop);
#endif /* META_KMS_PLANE_PRIVATE_H */

View File

@ -30,6 +30,11 @@
#include "backends/native/meta-kms-impl-device.h"
#include "backends/native/meta-kms-update-private.h"
typedef struct _MetaKmsPlanePropTable
{
MetaKmsProp props[META_KMS_PLANE_N_PROPS];
} MetaKmsPlanePropTable;
struct _MetaKmsPlane
{
GObject parent;
@ -52,6 +57,8 @@ struct _MetaKmsPlane
*/
GHashTable *formats_modifiers;
MetaKmsPlanePropTable prop_table;
MetaKmsDevice *device;
};
@ -77,6 +84,20 @@ meta_kms_plane_get_plane_type (MetaKmsPlane *plane)
return plane->type;
}
uint32_t
meta_kms_plane_get_prop_id (MetaKmsPlane *plane,
MetaKmsPlaneProp prop)
{
return plane->prop_table.props[prop].prop_id;
}
const char *
meta_kms_plane_get_prop_name (MetaKmsPlane *plane,
MetaKmsPlaneProp prop)
{
return plane->prop_table.props[prop].name;
}
void
meta_kms_plane_update_set_rotation (MetaKmsPlane *plane,
MetaKmsPlaneAssignment *plane_assignment,
@ -363,6 +384,81 @@ init_formats (MetaKmsPlane *plane,
}
}
static void
init_properties (MetaKmsPlane *plane,
MetaKmsImplDevice *impl_device,
drmModePlane *drm_plane,
drmModeObjectProperties *drm_plane_props)
{
MetaKmsPlanePropTable *prop_table = &plane->prop_table;
*prop_table = (MetaKmsPlanePropTable) {
.props = {
[META_KMS_PLANE_PROP_TYPE] =
{
.name = "type",
.type = DRM_MODE_PROP_ENUM,
},
[META_KMS_PLANE_PROP_SRC_X] =
{
.name = "SRC_X",
.type = DRM_MODE_PROP_RANGE,
},
[META_KMS_PLANE_PROP_SRC_Y] =
{
.name = "SRC_Y",
.type = DRM_MODE_PROP_RANGE,
},
[META_KMS_PLANE_PROP_SRC_W] =
{
.name = "SRC_W",
.type = DRM_MODE_PROP_RANGE,
},
[META_KMS_PLANE_PROP_SRC_H] =
{
.name = "SRC_H",
.type = DRM_MODE_PROP_RANGE,
},
[META_KMS_PLANE_PROP_CRTC_X] =
{
.name = "CRTC_X",
.type = DRM_MODE_PROP_SIGNED_RANGE,
},
[META_KMS_PLANE_PROP_CRTC_Y] =
{
.name = "CRTC_Y",
.type = DRM_MODE_PROP_SIGNED_RANGE,
},
[META_KMS_PLANE_PROP_CRTC_W] =
{
.name = "CRTC_W",
.type = DRM_MODE_PROP_RANGE,
},
[META_KMS_PLANE_PROP_CRTC_H] =
{
.name = "CRTC_H",
.type = DRM_MODE_PROP_RANGE,
},
[META_KMS_PLANE_PROP_FB_ID] =
{
.name = "FB_ID",
.type = DRM_MODE_PROP_OBJECT,
},
[META_KMS_PLANE_PROP_CRTC_ID] =
{
.name = "CRTC_ID",
.type = DRM_MODE_PROP_OBJECT,
},
}
};
meta_kms_impl_device_init_prop_table (impl_device,
drm_plane_props->props,
drm_plane_props->count_props,
plane->prop_table.props,
META_KMS_PLANE_N_PROPS);
}
MetaKmsPlane *
meta_kms_plane_new (MetaKmsPlaneType type,
MetaKmsImplDevice *impl_device,
@ -380,6 +476,8 @@ meta_kms_plane_new (MetaKmsPlaneType type,
init_rotations (plane, impl_device, drm_plane_props);
init_formats (plane, impl_device, drm_plane, drm_plane_props);
init_properties (plane, impl_device, drm_plane, drm_plane_props);
return plane;
}