mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-18 06:47:31 -04:00
Merge branch 'output-adaptive-sync' into 'master'
output: Replace wlr_output_adaptive_sync_status with bool See merge request wlroots/wlroots!4222
This commit is contained in:
commit
8fa643f951
8 changed files with 15 additions and 32 deletions
|
|
@ -311,8 +311,7 @@ static bool atomic_crtc_commit(struct wlr_drm_connector *conn,
|
||||||
state->primary_fb->wlr_buf->height, &state->base->damage, &fb_damage_clips);
|
state->primary_fb->wlr_buf->height, &state->base->damage, &fb_damage_clips);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool prev_vrr_enabled =
|
bool prev_vrr_enabled = output->adaptive_sync_enabled;
|
||||||
output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED;
|
|
||||||
bool vrr_enabled = prev_vrr_enabled;
|
bool vrr_enabled = prev_vrr_enabled;
|
||||||
if ((state->base->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED)) {
|
if ((state->base->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED)) {
|
||||||
if (!drm_connector_supports_vrr(conn)) {
|
if (!drm_connector_supports_vrr(conn)) {
|
||||||
|
|
@ -387,9 +386,7 @@ static bool atomic_crtc_commit(struct wlr_drm_connector *conn,
|
||||||
commit_blob(drm, &crtc->gamma_lut, gamma_lut);
|
commit_blob(drm, &crtc->gamma_lut, gamma_lut);
|
||||||
|
|
||||||
if (vrr_enabled != prev_vrr_enabled) {
|
if (vrr_enabled != prev_vrr_enabled) {
|
||||||
output->adaptive_sync_status = vrr_enabled ?
|
output->adaptive_sync_enabled = vrr_enabled;
|
||||||
WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED :
|
|
||||||
WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED;
|
|
||||||
wlr_drm_conn_log(conn, WLR_DEBUG, "VRR %s",
|
wlr_drm_conn_log(conn, WLR_DEBUG, "VRR %s",
|
||||||
vrr_enabled ? "enabled" : "disabled");
|
vrr_enabled ? "enabled" : "disabled");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -126,9 +126,7 @@ static bool legacy_crtc_commit(struct wlr_drm_connector *conn,
|
||||||
"drmModeObjectSetProperty(VRR_ENABLED) failed");
|
"drmModeObjectSetProperty(VRR_ENABLED) failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
output->adaptive_sync_status = state->base->adaptive_sync_enabled ?
|
output->adaptive_sync_enabled = state->base->adaptive_sync_enabled;
|
||||||
WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED :
|
|
||||||
WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED;
|
|
||||||
wlr_drm_conn_log(conn, WLR_DEBUG, "VRR %s",
|
wlr_drm_conn_log(conn, WLR_DEBUG, "VRR %s",
|
||||||
state->base->adaptive_sync_enabled ? "enabled" : "disabled");
|
state->base->adaptive_sync_enabled ? "enabled" : "disabled");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -355,8 +355,7 @@ static bool crtc_commit(struct wlr_drm_connector *conn,
|
||||||
*ptr = primary_fb_damage_clips;
|
*ptr = primary_fb_damage_clips;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool prev_vrr_enabled =
|
bool prev_vrr_enabled = output->adaptive_sync_enabled;
|
||||||
output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED;
|
|
||||||
bool vrr_enabled = prev_vrr_enabled;
|
bool vrr_enabled = prev_vrr_enabled;
|
||||||
if ((state->base->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) &&
|
if ((state->base->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) &&
|
||||||
drm_connector_supports_vrr(conn)) {
|
drm_connector_supports_vrr(conn)) {
|
||||||
|
|
@ -483,9 +482,7 @@ out:
|
||||||
commit_blob(drm, &crtc->gamma_lut, gamma_lut);
|
commit_blob(drm, &crtc->gamma_lut, gamma_lut);
|
||||||
|
|
||||||
if (vrr_enabled != prev_vrr_enabled) {
|
if (vrr_enabled != prev_vrr_enabled) {
|
||||||
output->adaptive_sync_status = vrr_enabled ?
|
output->adaptive_sync_enabled = vrr_enabled;
|
||||||
WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED :
|
|
||||||
WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED;
|
|
||||||
wlr_drm_conn_log(conn, WLR_DEBUG, "VRR %s",
|
wlr_drm_conn_log(conn, WLR_DEBUG, "VRR %s",
|
||||||
vrr_enabled ? "enabled" : "disabled");
|
vrr_enabled ? "enabled" : "disabled");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,7 @@ static bool output_test(struct wlr_output *wlr_output,
|
||||||
// Adaptive sync is effectively always enabled when using the Wayland
|
// Adaptive sync is effectively always enabled when using the Wayland
|
||||||
// backend. This is not something we have control over, so we set the state
|
// backend. This is not something we have control over, so we set the state
|
||||||
// to enabled on creating the output and never allow changing it.
|
// to enabled on creating the output and never allow changing it.
|
||||||
assert(wlr_output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED);
|
assert(wlr_output->adaptive_sync_enabled);
|
||||||
if (state->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) {
|
if (state->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) {
|
||||||
if (!state->adaptive_sync_enabled) {
|
if (!state->adaptive_sync_enabled) {
|
||||||
wlr_log(WLR_DEBUG, "Disabling adaptive sync is not supported");
|
wlr_log(WLR_DEBUG, "Disabling adaptive sync is not supported");
|
||||||
|
|
@ -777,7 +777,7 @@ static struct wlr_wl_output *output_create(struct wlr_wl_backend *backend,
|
||||||
backend->event_loop, &state);
|
backend->event_loop, &state);
|
||||||
wlr_output_state_finish(&state);
|
wlr_output_state_finish(&state);
|
||||||
|
|
||||||
wlr_output->adaptive_sync_status = WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED;
|
wlr_output->adaptive_sync_enabled = true;
|
||||||
|
|
||||||
size_t output_num = ++last_output_num;
|
size_t output_num = ++last_output_num;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ static bool output_test(struct wlr_output *wlr_output,
|
||||||
// _VARIABLE_REFRESH window property like mesa automatically does. We don't
|
// _VARIABLE_REFRESH window property like mesa automatically does. We don't
|
||||||
// have any control beyond that, so we set the state to enabled on creating
|
// have any control beyond that, so we set the state to enabled on creating
|
||||||
// the output and never allow changing it (just like the Wayland backend).
|
// the output and never allow changing it (just like the Wayland backend).
|
||||||
assert(wlr_output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED);
|
assert(wlr_output->adaptive_sync_enabled);
|
||||||
if (state->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) {
|
if (state->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) {
|
||||||
if (!state->adaptive_sync_enabled) {
|
if (!state->adaptive_sync_enabled) {
|
||||||
wlr_log(WLR_DEBUG, "Disabling adaptive sync is not supported");
|
wlr_log(WLR_DEBUG, "Disabling adaptive sync is not supported");
|
||||||
|
|
@ -637,7 +637,7 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) {
|
||||||
xcb_change_property(x11->xcb, XCB_PROP_MODE_REPLACE, output->win,
|
xcb_change_property(x11->xcb, XCB_PROP_MODE_REPLACE, output->win,
|
||||||
x11->atoms.variable_refresh, XCB_ATOM_CARDINAL, 32, 1,
|
x11->atoms.variable_refresh, XCB_ATOM_CARDINAL, 32, 1,
|
||||||
&enabled);
|
&enabled);
|
||||||
wlr_output->adaptive_sync_status = WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED;
|
wlr_output->adaptive_sync_enabled = true;
|
||||||
|
|
||||||
wlr_x11_output_set_title(wlr_output, NULL);
|
wlr_x11_output_set_title(wlr_output, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,11 +48,6 @@ struct wlr_output_cursor {
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum wlr_output_adaptive_sync_status {
|
|
||||||
WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED,
|
|
||||||
WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum wlr_output_state_field {
|
enum wlr_output_state_field {
|
||||||
WLR_OUTPUT_STATE_BUFFER = 1 << 0,
|
WLR_OUTPUT_STATE_BUFFER = 1 << 0,
|
||||||
WLR_OUTPUT_STATE_DAMAGE = 1 << 1,
|
WLR_OUTPUT_STATE_DAMAGE = 1 << 1,
|
||||||
|
|
@ -146,7 +141,7 @@ struct wlr_output {
|
||||||
float scale;
|
float scale;
|
||||||
enum wl_output_subpixel subpixel;
|
enum wl_output_subpixel subpixel;
|
||||||
enum wl_output_transform transform;
|
enum wl_output_transform transform;
|
||||||
enum wlr_output_adaptive_sync_status adaptive_sync_status;
|
bool adaptive_sync_enabled;
|
||||||
uint32_t render_format;
|
uint32_t render_format;
|
||||||
|
|
||||||
bool needs_frame;
|
bool needs_frame;
|
||||||
|
|
@ -459,7 +454,7 @@ void wlr_output_state_set_transform(struct wlr_output_state *state,
|
||||||
enum wl_output_transform transform);
|
enum wl_output_transform transform);
|
||||||
/**
|
/**
|
||||||
* Enables or disable adaptive sync for an output (ie. variable refresh rate).
|
* Enables or disable adaptive sync for an output (ie. variable refresh rate).
|
||||||
* Compositors can inspect `wlr_output.adaptive_sync_status` to query the
|
* Compositors can inspect `wlr_output.adaptive_sync_enabled` to query the
|
||||||
* effective status. Backends that don't support adaptive sync will reject the
|
* effective status. Backends that don't support adaptive sync will reject the
|
||||||
* output commit.
|
* output commit.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -532,13 +532,10 @@ static uint32_t output_compare_state(struct wlr_output *output,
|
||||||
output->transform == state->transform) {
|
output->transform == state->transform) {
|
||||||
fields |= WLR_OUTPUT_STATE_TRANSFORM;
|
fields |= WLR_OUTPUT_STATE_TRANSFORM;
|
||||||
}
|
}
|
||||||
if (state->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) {
|
if (state->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED &&
|
||||||
bool enabled =
|
output->adaptive_sync_enabled != state->adaptive_sync_enabled) {
|
||||||
output->adaptive_sync_status != WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED;
|
|
||||||
if (enabled == state->adaptive_sync_enabled) {
|
|
||||||
fields |= WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED;
|
fields |= WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if ((state->committed & WLR_OUTPUT_STATE_RENDER_FORMAT) &&
|
if ((state->committed & WLR_OUTPUT_STATE_RENDER_FORMAT) &&
|
||||||
output->render_format == state->render_format) {
|
output->render_format == state->render_format) {
|
||||||
fields |= WLR_OUTPUT_STATE_RENDER_FORMAT;
|
fields |= WLR_OUTPUT_STATE_RENDER_FORMAT;
|
||||||
|
|
|
||||||
|
|
@ -159,8 +159,7 @@ struct wlr_output_configuration_head_v1 *
|
||||||
config_head->state.custom_mode.refresh = output->refresh;
|
config_head->state.custom_mode.refresh = output->refresh;
|
||||||
config_head->state.transform = output->transform;
|
config_head->state.transform = output->transform;
|
||||||
config_head->state.scale = output->scale;
|
config_head->state.scale = output->scale;
|
||||||
config_head->state.adaptive_sync_enabled =
|
config_head->state.adaptive_sync_enabled = output->adaptive_sync_enabled;
|
||||||
output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED;
|
|
||||||
return config_head;
|
return config_head;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue