mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
backend/drm: drop enum wlr_drm_connector_status
We can just use libdrm's drmModeConnection enum instead.
This commit is contained in:
parent
08973d2430
commit
f244094682
2 changed files with 13 additions and 19 deletions
|
@ -707,7 +707,7 @@ static bool drm_connector_set_mode(struct wlr_drm_connector *conn,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conn->status != WLR_DRM_CONN_CONNECTED) {
|
if (conn->status != DRM_MODE_CONNECTED) {
|
||||||
wlr_drm_conn_log(conn, WLR_ERROR,
|
wlr_drm_conn_log(conn, WLR_ERROR,
|
||||||
"Cannot modeset a disconnected output");
|
"Cannot modeset a disconnected output");
|
||||||
return false;
|
return false;
|
||||||
|
@ -905,7 +905,7 @@ static void drm_connector_destroy_output(struct wlr_output *output) {
|
||||||
|
|
||||||
dealloc_crtc(conn);
|
dealloc_crtc(conn);
|
||||||
|
|
||||||
conn->status = WLR_DRM_CONN_DISCONNECTED;
|
conn->status = DRM_MODE_DISCONNECTED;
|
||||||
conn->desired_enabled = false;
|
conn->desired_enabled = false;
|
||||||
conn->possible_crtcs = 0;
|
conn->possible_crtcs = 0;
|
||||||
conn->pending_page_flip_crtc = 0;
|
conn->pending_page_flip_crtc = 0;
|
||||||
|
@ -1084,7 +1084,7 @@ static void realloc_crtcs(struct wlr_drm_backend *drm) {
|
||||||
|
|
||||||
// Only search CRTCs for user-enabled outputs (that are already
|
// Only search CRTCs for user-enabled outputs (that are already
|
||||||
// connected or in need of a modeset)
|
// connected or in need of a modeset)
|
||||||
if (conn->status == WLR_DRM_CONN_CONNECTED && conn->desired_enabled) {
|
if (conn->status == DRM_MODE_CONNECTED && conn->desired_enabled) {
|
||||||
connector_constraints[i] = conn->possible_crtcs;
|
connector_constraints[i] = conn->possible_crtcs;
|
||||||
} else {
|
} else {
|
||||||
// Will always fail to match anything
|
// Will always fail to match anything
|
||||||
|
@ -1115,7 +1115,7 @@ static void realloc_crtcs(struct wlr_drm_backend *drm) {
|
||||||
*/
|
*/
|
||||||
for (size_t i = 0; i < num_outputs; ++i) {
|
for (size_t i = 0; i < num_outputs; ++i) {
|
||||||
struct wlr_drm_connector *conn = connectors[i];
|
struct wlr_drm_connector *conn = connectors[i];
|
||||||
if (conn->status == WLR_DRM_CONN_CONNECTED && conn->output.enabled &&
|
if (conn->status == DRM_MODE_CONNECTED && conn->output.enabled &&
|
||||||
connector_match[i] == -1) {
|
connector_match[i] == -1) {
|
||||||
wlr_log(WLR_DEBUG, "Could not match a CRTC for previously connected output; "
|
wlr_log(WLR_DEBUG, "Could not match a CRTC for previously connected output; "
|
||||||
"keeping old configuration");
|
"keeping old configuration");
|
||||||
|
@ -1151,7 +1151,7 @@ static void realloc_crtcs(struct wlr_drm_backend *drm) {
|
||||||
conn->crtc = &drm->crtcs[connector_match[i]];
|
conn->crtc = &drm->crtcs[connector_match[i]];
|
||||||
|
|
||||||
// Only realloc buffers if we have actually been modeset
|
// Only realloc buffers if we have actually been modeset
|
||||||
if (conn->status != WLR_DRM_CONN_CONNECTED || !conn->output.enabled) {
|
if (conn->status != DRM_MODE_CONNECTED || !conn->output.enabled) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
wlr_output_damage_whole(&conn->output);
|
wlr_output_damage_whole(&conn->output);
|
||||||
|
@ -1224,7 +1224,7 @@ void scan_drm_connectors(struct wlr_drm_backend *drm,
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_conn->backend = drm;
|
wlr_conn->backend = drm;
|
||||||
wlr_conn->status = WLR_DRM_CONN_DISCONNECTED;
|
wlr_conn->status = DRM_MODE_DISCONNECTED;
|
||||||
wlr_conn->id = drm_conn->connector_id;
|
wlr_conn->id = drm_conn->connector_id;
|
||||||
|
|
||||||
const char *conn_name =
|
const char *conn_name =
|
||||||
|
@ -1271,7 +1271,7 @@ void scan_drm_connectors(struct wlr_drm_backend *drm,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wlr_conn->status == WLR_DRM_CONN_DISCONNECTED &&
|
if (wlr_conn->status == DRM_MODE_DISCONNECTED &&
|
||||||
drm_conn->connection == DRM_MODE_CONNECTED) {
|
drm_conn->connection == DRM_MODE_CONNECTED) {
|
||||||
wlr_log(WLR_INFO, "'%s' connected", wlr_conn->name);
|
wlr_log(WLR_INFO, "'%s' connected", wlr_conn->name);
|
||||||
wlr_log(WLR_DEBUG, "Current CRTC: %d",
|
wlr_log(WLR_DEBUG, "Current CRTC: %d",
|
||||||
|
@ -1377,9 +1377,9 @@ void scan_drm_connectors(struct wlr_drm_backend *drm,
|
||||||
wlr_output_update_enabled(&wlr_conn->output, wlr_conn->crtc != NULL);
|
wlr_output_update_enabled(&wlr_conn->output, wlr_conn->crtc != NULL);
|
||||||
wlr_conn->desired_enabled = true;
|
wlr_conn->desired_enabled = true;
|
||||||
|
|
||||||
wlr_conn->status = WLR_DRM_CONN_CONNECTED;
|
wlr_conn->status = DRM_MODE_CONNECTED;
|
||||||
new_outputs[new_outputs_len++] = wlr_conn;
|
new_outputs[new_outputs_len++] = wlr_conn;
|
||||||
} else if (wlr_conn->status == WLR_DRM_CONN_CONNECTED &&
|
} else if (wlr_conn->status == DRM_MODE_CONNECTED &&
|
||||||
drm_conn->connection != DRM_MODE_CONNECTED) {
|
drm_conn->connection != DRM_MODE_CONNECTED) {
|
||||||
wlr_log(WLR_INFO, "'%s' disconnected", wlr_conn->name);
|
wlr_log(WLR_INFO, "'%s' disconnected", wlr_conn->name);
|
||||||
disconnect_drm_connector(wlr_conn);
|
disconnect_drm_connector(wlr_conn);
|
||||||
|
@ -1469,7 +1469,7 @@ static void handle_page_flip(int fd, unsigned seq,
|
||||||
|
|
||||||
conn->pending_page_flip_crtc = 0;
|
conn->pending_page_flip_crtc = 0;
|
||||||
|
|
||||||
if (conn->status != WLR_DRM_CONN_CONNECTED || conn->crtc == NULL) {
|
if (conn->status != DRM_MODE_CONNECTED || conn->crtc == NULL) {
|
||||||
wlr_drm_conn_log(conn, WLR_DEBUG,
|
wlr_drm_conn_log(conn, WLR_DEBUG,
|
||||||
"Ignoring page-flip event for disabled connector");
|
"Ignoring page-flip event for disabled connector");
|
||||||
return;
|
return;
|
||||||
|
@ -1532,7 +1532,7 @@ int handle_drm_event(int fd, uint32_t mask, void *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void disconnect_drm_connector(struct wlr_drm_connector *conn) {
|
static void disconnect_drm_connector(struct wlr_drm_connector *conn) {
|
||||||
if (conn->status == WLR_DRM_CONN_DISCONNECTED) {
|
if (conn->status == DRM_MODE_DISCONNECTED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1540,7 +1540,7 @@ static void disconnect_drm_connector(struct wlr_drm_connector *conn) {
|
||||||
// our wlr_drm_connector.
|
// our wlr_drm_connector.
|
||||||
wlr_output_destroy(&conn->output);
|
wlr_output_destroy(&conn->output);
|
||||||
|
|
||||||
assert(conn->status == WLR_DRM_CONN_DISCONNECTED);
|
assert(conn->status == DRM_MODE_DISCONNECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroy_drm_connector(struct wlr_drm_connector *conn) {
|
void destroy_drm_connector(struct wlr_drm_connector *conn) {
|
||||||
|
|
|
@ -90,12 +90,6 @@ struct wlr_drm_backend {
|
||||||
struct wlr_drm_format_set mgpu_formats;
|
struct wlr_drm_format_set mgpu_formats;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum wlr_drm_connector_status {
|
|
||||||
// Connector is available but no output is plugged in
|
|
||||||
WLR_DRM_CONN_DISCONNECTED,
|
|
||||||
WLR_DRM_CONN_CONNECTED,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct wlr_drm_mode {
|
struct wlr_drm_mode {
|
||||||
struct wlr_output_mode wlr_mode;
|
struct wlr_output_mode wlr_mode;
|
||||||
drmModeModeInfo drm_mode;
|
drmModeModeInfo drm_mode;
|
||||||
|
@ -113,7 +107,7 @@ struct wlr_drm_connector {
|
||||||
|
|
||||||
struct wlr_drm_backend *backend;
|
struct wlr_drm_backend *backend;
|
||||||
char name[24];
|
char name[24];
|
||||||
enum wlr_drm_connector_status status;
|
drmModeConnection status;
|
||||||
bool desired_enabled;
|
bool desired_enabled;
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
uint64_t max_bpc;
|
uint64_t max_bpc;
|
||||||
|
|
Loading…
Reference in a new issue