mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
backend/drm: remove mode arg from drm_connector_set_mode
All of the information is in wlr_output_state.
This commit is contained in:
parent
7aba881c47
commit
218955ce95
3 changed files with 20 additions and 30 deletions
|
@ -128,7 +128,7 @@ static void handle_session_active(struct wl_listener *listener, void *data) {
|
|||
.mode_type = WLR_OUTPUT_STATE_MODE_FIXED,
|
||||
.mode = mode,
|
||||
};
|
||||
drm_connector_set_mode(conn, &state, mode);
|
||||
drm_connector_set_mode(conn, &state);
|
||||
}
|
||||
} else {
|
||||
wlr_log(WLR_INFO, "DRM fd paused");
|
||||
|
|
|
@ -427,21 +427,6 @@ static bool drm_connector_test(struct wlr_output *output) {
|
|||
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) {
|
||||
struct wlr_drm_connector *conn = get_drm_connector_from_output(output);
|
||||
struct wlr_drm_backend *drm = conn->backend;
|
||||
|
@ -517,23 +502,21 @@ static bool drm_connector_commit(struct wlr_output *output) {
|
|||
|
||||
if (output->pending.committed &
|
||||
(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) ?
|
||||
output->pending.enabled : output->enabled;
|
||||
if (!enable) {
|
||||
wlr_mode = NULL;
|
||||
}
|
||||
if ((state.committed & WLR_OUTPUT_STATE_MODE) &&
|
||||
state.mode_type == WLR_OUTPUT_STATE_MODE_CUSTOM) {
|
||||
drmModeModeInfo mode = {0};
|
||||
drm_connector_state_mode(conn, &output->pending, &mode);
|
||||
|
||||
if (output->pending.committed & WLR_OUTPUT_STATE_MODE) {
|
||||
assert(enable);
|
||||
wlr_mode = drm_connector_get_pending_mode(conn);
|
||||
if (wlr_mode == NULL) {
|
||||
state.mode_type = WLR_OUTPUT_STATE_MODE_FIXED;
|
||||
state.mode = wlr_drm_connector_add_mode(output, &mode);
|
||||
if (state.mode == NULL) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!drm_connector_set_mode(conn, &output->pending, wlr_mode)) {
|
||||
if (!drm_connector_set_mode(conn, &state)) {
|
||||
return false;
|
||||
}
|
||||
} 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 = 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,
|
||||
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_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_mode = wlr_mode;
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ void scan_drm_connectors(struct wlr_drm_backend *state);
|
|||
int handle_drm_event(int fd, uint32_t mask, void *data);
|
||||
void destroy_drm_connector(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_supports_vrr(struct wlr_drm_connector *conn);
|
||||
size_t drm_crtc_get_gamma_lut_size(struct wlr_drm_backend *drm,
|
||||
|
|
Loading…
Reference in a new issue