mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 04:45:58 +01:00
output: fail commits if adaptive sync cannot be enabled
Previously, adaptive sync was just a hint and wouldn't make any atomic commit fail if the backend didn't support it. The main reason is wlr_output_test wasn't supported at the time. Now that we have a way for compositors to test whether a change can work, let's remove the exception for adaptive sync and convert it to a regular output state field.
This commit is contained in:
parent
26e1812ab3
commit
8c70245d5f
6 changed files with 22 additions and 8 deletions
|
@ -254,8 +254,10 @@ static bool atomic_crtc_commit(struct wlr_drm_connector *conn,
|
||||||
bool prev_vrr_enabled =
|
bool prev_vrr_enabled =
|
||||||
output->adaptive_sync_status == WLR_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)) {
|
if (!drm_connector_supports_vrr(conn)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
vrr_enabled = state->base->adaptive_sync_enabled;
|
vrr_enabled = state->base->adaptive_sync_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,8 @@ static const uint32_t COMMIT_OUTPUT_STATE =
|
||||||
WLR_OUTPUT_STATE_BUFFER |
|
WLR_OUTPUT_STATE_BUFFER |
|
||||||
WLR_OUTPUT_STATE_MODE |
|
WLR_OUTPUT_STATE_MODE |
|
||||||
WLR_OUTPUT_STATE_ENABLED |
|
WLR_OUTPUT_STATE_ENABLED |
|
||||||
WLR_OUTPUT_STATE_GAMMA_LUT;
|
WLR_OUTPUT_STATE_GAMMA_LUT |
|
||||||
|
WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED;
|
||||||
|
|
||||||
static const uint32_t SUPPORTED_OUTPUT_STATE =
|
static const uint32_t SUPPORTED_OUTPUT_STATE =
|
||||||
WLR_OUTPUT_STATE_BACKEND_OPTIONAL | COMMIT_OUTPUT_STATE;
|
WLR_OUTPUT_STATE_BACKEND_OPTIONAL | COMMIT_OUTPUT_STATE;
|
||||||
|
@ -489,6 +490,12 @@ static bool drm_connector_test(struct wlr_output *output,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((state->committed & WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED) &&
|
||||||
|
state->adaptive_sync_enabled &&
|
||||||
|
!drm_connector_supports_vrr(conn)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
struct wlr_drm_connector_state pending = {0};
|
struct wlr_drm_connector_state pending = {0};
|
||||||
drm_connector_state_init(&pending, conn, state);
|
drm_connector_state_init(&pending, conn, state);
|
||||||
|
|
||||||
|
|
|
@ -115,8 +115,10 @@ static bool legacy_crtc_commit(struct wlr_drm_connector *conn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)) {
|
if (!drm_connector_supports_vrr(conn)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (drmModeObjectSetProperty(drm->fd, crtc->id, DRM_MODE_OBJECT_CRTC,
|
if (drmModeObjectSetProperty(drm->fd, crtc->id, DRM_MODE_OBJECT_CRTC,
|
||||||
crtc->props.vrr_enabled,
|
crtc->props.vrr_enabled,
|
||||||
state->base->adaptive_sync_enabled) != 0) {
|
state->base->adaptive_sync_enabled) != 0) {
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
static const uint32_t SUPPORTED_OUTPUT_STATE =
|
static const uint32_t SUPPORTED_OUTPUT_STATE =
|
||||||
WLR_OUTPUT_STATE_BACKEND_OPTIONAL |
|
WLR_OUTPUT_STATE_BACKEND_OPTIONAL |
|
||||||
WLR_OUTPUT_STATE_BUFFER |
|
WLR_OUTPUT_STATE_BUFFER |
|
||||||
WLR_OUTPUT_STATE_MODE;
|
WLR_OUTPUT_STATE_MODE |
|
||||||
|
WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED;
|
||||||
|
|
||||||
static void parse_xcb_setup(struct wlr_output *output,
|
static void parse_xcb_setup(struct wlr_output *output,
|
||||||
xcb_connection_t *xcb) {
|
xcb_connection_t *xcb) {
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
WLR_OUTPUT_STATE_SCALE | \
|
WLR_OUTPUT_STATE_SCALE | \
|
||||||
WLR_OUTPUT_STATE_TRANSFORM | \
|
WLR_OUTPUT_STATE_TRANSFORM | \
|
||||||
WLR_OUTPUT_STATE_RENDER_FORMAT | \
|
WLR_OUTPUT_STATE_RENDER_FORMAT | \
|
||||||
WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED | \
|
|
||||||
WLR_OUTPUT_STATE_SUBPIXEL)
|
WLR_OUTPUT_STATE_SUBPIXEL)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -301,7 +301,10 @@ void wlr_output_set_transform(struct wlr_output *output,
|
||||||
enum wl_output_transform transform);
|
enum wl_output_transform transform);
|
||||||
/**
|
/**
|
||||||
* Enables or disables adaptive sync (ie. variable refresh rate) on this
|
* Enables or disables adaptive sync (ie. variable refresh rate) on this
|
||||||
* output. This is just a hint, the backend is free to ignore this setting.
|
* output. On some backends, this is just a hint and may be ignored.
|
||||||
|
* Compositors can inspect `wlr_output.adaptive_sync_status` to query the
|
||||||
|
* effective status. Backends that don't support adaptive sync will reject
|
||||||
|
* the output commit.
|
||||||
*
|
*
|
||||||
* When enabled, compositors can submit frames a little bit later than the
|
* When enabled, compositors can submit frames a little bit later than the
|
||||||
* deadline without dropping a frame.
|
* deadline without dropping a frame.
|
||||||
|
|
Loading…
Reference in a new issue