backend/drm: remove mode arg from drm_connector_set_mode

All of the information is in wlr_output_state.
This commit is contained in:
Simon Ser 2021-04-06 17:44:31 +02:00 committed by Kenny Levinsen
parent 7aba881c47
commit 218955ce95
3 changed files with 20 additions and 30 deletions

View file

@ -128,7 +128,7 @@ static void handle_session_active(struct wl_listener *listener, void *data) {
.mode_type = WLR_OUTPUT_STATE_MODE_FIXED, .mode_type = WLR_OUTPUT_STATE_MODE_FIXED,
.mode = mode, .mode = mode,
}; };
drm_connector_set_mode(conn, &state, mode); drm_connector_set_mode(conn, &state);
} }
} else { } else {
wlr_log(WLR_INFO, "DRM fd paused"); wlr_log(WLR_INFO, "DRM fd paused");

View file

@ -427,21 +427,6 @@ static bool drm_connector_test(struct wlr_output *output) {
return true; return true;
} }
static struct wlr_output_mode *drm_connector_get_pending_mode(
struct wlr_drm_connector *conn) {
struct wlr_output *output = &conn->output;
switch (output->pending.mode_type) {
case WLR_OUTPUT_STATE_MODE_FIXED:
return output->pending.mode;
case WLR_OUTPUT_STATE_MODE_CUSTOM:;
drmModeModeInfo mode = {0};
drm_connector_state_mode(conn, &output->pending, &mode);
return wlr_drm_connector_add_mode(output, &mode);
}
abort();
}
static bool drm_connector_commit_buffer(struct wlr_output *output) { static bool drm_connector_commit_buffer(struct wlr_output *output) {
struct wlr_drm_connector *conn = get_drm_connector_from_output(output); struct wlr_drm_connector *conn = get_drm_connector_from_output(output);
struct wlr_drm_backend *drm = conn->backend; struct wlr_drm_backend *drm = conn->backend;
@ -517,23 +502,21 @@ static bool drm_connector_commit(struct wlr_output *output) {
if (output->pending.committed & if (output->pending.committed &
(WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_ENABLED)) { (WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_ENABLED)) {
struct wlr_output_mode *wlr_mode = output->current_mode; struct wlr_output_state state = output->pending;
bool enable = (output->pending.committed & WLR_OUTPUT_STATE_ENABLED) ? if ((state.committed & WLR_OUTPUT_STATE_MODE) &&
output->pending.enabled : output->enabled; state.mode_type == WLR_OUTPUT_STATE_MODE_CUSTOM) {
if (!enable) { drmModeModeInfo mode = {0};
wlr_mode = NULL; drm_connector_state_mode(conn, &output->pending, &mode);
}
if (output->pending.committed & WLR_OUTPUT_STATE_MODE) { state.mode_type = WLR_OUTPUT_STATE_MODE_FIXED;
assert(enable); state.mode = wlr_drm_connector_add_mode(output, &mode);
wlr_mode = drm_connector_get_pending_mode(conn); if (state.mode == NULL) {
if (wlr_mode == NULL) {
return false; return false;
} }
} }
if (!drm_connector_set_mode(conn, &output->pending, wlr_mode)) { if (!drm_connector_set_mode(conn, &state)) {
return false; return false;
} }
} else if (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) { } else if (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
@ -730,15 +713,22 @@ static void attempt_enable_needs_modeset(struct wlr_drm_backend *drm) {
.mode_type = WLR_OUTPUT_STATE_MODE_FIXED, .mode_type = WLR_OUTPUT_STATE_MODE_FIXED,
.mode = conn->desired_mode, .mode = conn->desired_mode,
}; };
drm_connector_set_mode(conn, &state, conn->desired_mode); drm_connector_set_mode(conn, &state);
} }
} }
} }
bool drm_connector_set_mode(struct wlr_drm_connector *conn, bool drm_connector_set_mode(struct wlr_drm_connector *conn,
const struct wlr_output_state *state, struct wlr_output_mode *wlr_mode) { const struct wlr_output_state *state) {
struct wlr_drm_backend *drm = conn->backend; struct wlr_drm_backend *drm = conn->backend;
struct wlr_output_mode *wlr_mode = NULL;
if (drm_connector_state_active(conn, state)) {
assert(state->committed & WLR_OUTPUT_STATE_MODE);
assert(state->mode_type == WLR_OUTPUT_STATE_MODE_FIXED);
wlr_mode = state->mode;
}
conn->desired_enabled = wlr_mode != NULL; conn->desired_enabled = wlr_mode != NULL;
conn->desired_mode = wlr_mode; conn->desired_mode = wlr_mode;

View file

@ -144,7 +144,7 @@ void scan_drm_connectors(struct wlr_drm_backend *state);
int handle_drm_event(int fd, uint32_t mask, void *data); int handle_drm_event(int fd, uint32_t mask, void *data);
void destroy_drm_connector(struct wlr_drm_connector *conn); void destroy_drm_connector(struct wlr_drm_connector *conn);
bool drm_connector_set_mode(struct wlr_drm_connector *conn, bool drm_connector_set_mode(struct wlr_drm_connector *conn,
const struct wlr_output_state *state, struct wlr_output_mode *mode); const struct wlr_output_state *state);
bool drm_connector_is_cursor_visible(struct wlr_drm_connector *conn); bool drm_connector_is_cursor_visible(struct wlr_drm_connector *conn);
bool drm_connector_supports_vrr(struct wlr_drm_connector *conn); bool drm_connector_supports_vrr(struct wlr_drm_connector *conn);
size_t drm_crtc_get_gamma_lut_size(struct wlr_drm_backend *drm, size_t drm_crtc_get_gamma_lut_size(struct wlr_drm_backend *drm,