backend/drm: store drm prop lists as structs

This makes modifying the property lists slightly easier.
This commit is contained in:
Kirill Primak 2024-06-18 17:29:48 +03:00 committed by Simon Zeni
parent 47c578945c
commit 5201836868
5 changed files with 57 additions and 67 deletions

View file

@ -29,7 +29,7 @@ struct wlr_drm_plane {
struct wlr_drm_format_set formats;
union wlr_drm_plane_props props;
struct wlr_drm_plane_props props;
uint32_t initial_crtc_id;
struct liftoff_plane *liftoff;
@ -71,7 +71,7 @@ struct wlr_drm_crtc {
struct wlr_drm_plane *primary;
struct wlr_drm_plane *cursor;
union wlr_drm_crtc_props props;
struct wlr_drm_crtc_props props;
};
struct wlr_drm_backend {
@ -181,7 +181,7 @@ struct wlr_drm_connector {
struct wlr_drm_crtc *crtc;
uint32_t possible_crtcs;
union wlr_drm_connector_props props;
struct wlr_drm_connector_props props;
bool cursor_enabled;
int cursor_x, cursor_y;

View file

@ -11,70 +11,61 @@
* https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html#kms-properties
*/
union wlr_drm_connector_props {
struct {
uint32_t edid;
uint32_t dpms;
uint32_t link_status; // not guaranteed to exist
uint32_t path;
uint32_t vrr_capable; // not guaranteed to exist
uint32_t subconnector; // not guaranteed to exist
uint32_t non_desktop;
uint32_t panel_orientation; // not guaranteed to exist
uint32_t content_type; // not guaranteed to exist
uint32_t max_bpc; // not guaranteed to exist
struct wlr_drm_connector_props {
uint32_t edid;
uint32_t dpms;
uint32_t link_status; // not guaranteed to exist
uint32_t path;
uint32_t vrr_capable; // not guaranteed to exist
uint32_t subconnector; // not guaranteed to exist
uint32_t non_desktop;
uint32_t panel_orientation; // not guaranteed to exist
uint32_t content_type; // not guaranteed to exist
uint32_t max_bpc; // not guaranteed to exist
// atomic-modesetting only
// atomic-modesetting only
uint32_t crtc_id;
};
uint32_t props[4];
uint32_t crtc_id;
};
union wlr_drm_crtc_props {
struct {
// Neither of these are guaranteed to exist
uint32_t vrr_enabled;
uint32_t gamma_lut;
uint32_t gamma_lut_size;
struct wlr_drm_crtc_props {
// Neither of these are guaranteed to exist
uint32_t vrr_enabled;
uint32_t gamma_lut;
uint32_t gamma_lut_size;
// atomic-modesetting only
// atomic-modesetting only
uint32_t active;
uint32_t mode_id;
};
uint32_t props[6];
uint32_t active;
uint32_t mode_id;
};
union wlr_drm_plane_props {
struct {
uint32_t type;
uint32_t rotation; // Not guaranteed to exist
uint32_t in_formats; // Not guaranteed to exist
struct wlr_drm_plane_props {
uint32_t type;
uint32_t rotation; // Not guaranteed to exist
uint32_t in_formats; // Not guaranteed to exist
// atomic-modesetting only
// atomic-modesetting only
uint32_t src_x;
uint32_t src_y;
uint32_t src_w;
uint32_t src_h;
uint32_t crtc_x;
uint32_t crtc_y;
uint32_t crtc_w;
uint32_t crtc_h;
uint32_t fb_id;
uint32_t crtc_id;
uint32_t fb_damage_clips;
uint32_t hotspot_x;
uint32_t hotspot_y;
};
uint32_t props[16];
uint32_t src_x;
uint32_t src_y;
uint32_t src_w;
uint32_t src_h;
uint32_t crtc_x;
uint32_t crtc_y;
uint32_t crtc_w;
uint32_t crtc_h;
uint32_t fb_id;
uint32_t crtc_id;
uint32_t fb_damage_clips;
uint32_t hotspot_x;
uint32_t hotspot_y;
};
bool get_drm_connector_props(int fd, uint32_t id,
union wlr_drm_connector_props *out);
bool get_drm_crtc_props(int fd, uint32_t id, union wlr_drm_crtc_props *out);
bool get_drm_plane_props(int fd, uint32_t id, union wlr_drm_plane_props *out);
struct wlr_drm_connector_props *out);
bool get_drm_crtc_props(int fd, uint32_t id, struct wlr_drm_crtc_props *out);
bool get_drm_plane_props(int fd, uint32_t id, struct wlr_drm_plane_props *out);
bool get_drm_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret);
void *get_drm_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len);