mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
backend/drm: take wlr_output_state as arg in crtc_commit
Stop assuming that the state to be applied is in output->pending in crtc_commit. This will allow us to remove ephemeral fields in wlr_drm_crtc, which are used scratch fields to stash temporary per-commit data.
This commit is contained in:
parent
69d4cf19b5
commit
8f90d7f8f5
4 changed files with 20 additions and 17 deletions
|
@ -164,7 +164,8 @@ error:
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool atomic_crtc_commit(struct wlr_drm_backend *drm,
|
static bool atomic_crtc_commit(struct wlr_drm_backend *drm,
|
||||||
struct wlr_drm_connector *conn, uint32_t flags) {
|
struct wlr_drm_connector *conn, const struct wlr_output_state *state,
|
||||||
|
uint32_t flags) {
|
||||||
struct wlr_output *output = &conn->output;
|
struct wlr_output *output = &conn->output;
|
||||||
struct wlr_drm_crtc *crtc = conn->crtc;
|
struct wlr_drm_crtc *crtc = conn->crtc;
|
||||||
|
|
||||||
|
@ -176,19 +177,19 @@ static bool atomic_crtc_commit(struct wlr_drm_backend *drm,
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t gamma_lut = crtc->gamma_lut;
|
uint32_t gamma_lut = crtc->gamma_lut;
|
||||||
if (output->pending.committed & WLR_OUTPUT_STATE_GAMMA_LUT) {
|
if (state->committed & WLR_OUTPUT_STATE_GAMMA_LUT) {
|
||||||
// Fallback to legacy gamma interface when gamma properties are not
|
// Fallback to legacy gamma interface when gamma properties are not
|
||||||
// available (can happen on older Intel GPUs that support gamma but not
|
// available (can happen on older Intel GPUs that support gamma but not
|
||||||
// degamma).
|
// degamma).
|
||||||
if (crtc->props.gamma_lut == 0) {
|
if (crtc->props.gamma_lut == 0) {
|
||||||
if (!drm_legacy_crtc_set_gamma(drm, crtc,
|
if (!drm_legacy_crtc_set_gamma(drm, crtc,
|
||||||
output->pending.gamma_lut_size,
|
state->gamma_lut_size,
|
||||||
output->pending.gamma_lut)) {
|
state->gamma_lut)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!create_gamma_lut_blob(drm, output->pending.gamma_lut_size,
|
if (!create_gamma_lut_blob(drm, state->gamma_lut_size,
|
||||||
output->pending.gamma_lut, &gamma_lut)) {
|
state->gamma_lut, &gamma_lut)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,9 +198,9 @@ static bool atomic_crtc_commit(struct wlr_drm_backend *drm,
|
||||||
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 ((output->pending.committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) &&
|
if ((state->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) &&
|
||||||
drm_connector_supports_vrr(conn)) {
|
drm_connector_supports_vrr(conn)) {
|
||||||
vrr_enabled = output->pending.adaptive_sync_enabled;
|
vrr_enabled = state->adaptive_sync_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crtc->pending_modeset) {
|
if (crtc->pending_modeset) {
|
||||||
|
|
|
@ -330,7 +330,7 @@ static void drm_plane_set_committed(struct wlr_drm_plane *plane) {
|
||||||
static bool drm_crtc_commit(struct wlr_drm_connector *conn, uint32_t flags) {
|
static bool drm_crtc_commit(struct wlr_drm_connector *conn, uint32_t flags) {
|
||||||
struct wlr_drm_backend *drm = conn->backend;
|
struct wlr_drm_backend *drm = conn->backend;
|
||||||
struct wlr_drm_crtc *crtc = conn->crtc;
|
struct wlr_drm_crtc *crtc = conn->crtc;
|
||||||
bool ok = drm->iface->crtc_commit(drm, conn, flags);
|
bool ok = drm->iface->crtc_commit(drm, conn, &conn->output.pending, flags);
|
||||||
if (ok && !(flags & DRM_MODE_ATOMIC_TEST_ONLY)) {
|
if (ok && !(flags & DRM_MODE_ATOMIC_TEST_ONLY)) {
|
||||||
memcpy(&crtc->current, &crtc->pending, sizeof(struct wlr_drm_crtc_state));
|
memcpy(&crtc->current, &crtc->pending, sizeof(struct wlr_drm_crtc_state));
|
||||||
drm_plane_set_committed(crtc->primary);
|
drm_plane_set_committed(crtc->primary);
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
#include "backend/drm/util.h"
|
#include "backend/drm/util.h"
|
||||||
|
|
||||||
static bool legacy_crtc_commit(struct wlr_drm_backend *drm,
|
static bool legacy_crtc_commit(struct wlr_drm_backend *drm,
|
||||||
struct wlr_drm_connector *conn, uint32_t flags) {
|
struct wlr_drm_connector *conn, const struct wlr_output_state *state,
|
||||||
|
uint32_t flags) {
|
||||||
struct wlr_output *output = &conn->output;
|
struct wlr_output *output = &conn->output;
|
||||||
struct wlr_drm_crtc *crtc = conn->crtc;
|
struct wlr_drm_crtc *crtc = conn->crtc;
|
||||||
struct wlr_drm_plane *cursor = crtc->cursor;
|
struct wlr_drm_plane *cursor = crtc->cursor;
|
||||||
|
@ -51,27 +52,27 @@ static bool legacy_crtc_commit(struct wlr_drm_backend *drm,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (output->pending.committed & WLR_OUTPUT_STATE_GAMMA_LUT) {
|
if (state->committed & WLR_OUTPUT_STATE_GAMMA_LUT) {
|
||||||
if (!drm_legacy_crtc_set_gamma(drm, crtc,
|
if (!drm_legacy_crtc_set_gamma(drm, crtc,
|
||||||
output->pending.gamma_lut_size, output->pending.gamma_lut)) {
|
state->gamma_lut_size, state->gamma_lut)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((output->pending.committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) &&
|
if ((state->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) &&
|
||||||
drm_connector_supports_vrr(conn)) {
|
drm_connector_supports_vrr(conn)) {
|
||||||
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,
|
||||||
output->pending.adaptive_sync_enabled) != 0) {
|
state->adaptive_sync_enabled) != 0) {
|
||||||
wlr_drm_conn_log_errno(conn, WLR_ERROR,
|
wlr_drm_conn_log_errno(conn, WLR_ERROR,
|
||||||
"drmModeObjectSetProperty(VRR_ENABLED) failed");
|
"drmModeObjectSetProperty(VRR_ENABLED) failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
output->adaptive_sync_status = output->pending.adaptive_sync_enabled ?
|
output->adaptive_sync_status = state->adaptive_sync_enabled ?
|
||||||
WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED :
|
WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED :
|
||||||
WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED;
|
WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED;
|
||||||
wlr_drm_conn_log(conn, WLR_DEBUG, "VRR %s",
|
wlr_drm_conn_log(conn, WLR_DEBUG, "VRR %s",
|
||||||
output->pending.adaptive_sync_enabled ? "enabled" : "disabled");
|
state->adaptive_sync_enabled ? "enabled" : "disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor != NULL && drm_connector_is_cursor_visible(conn)) {
|
if (cursor != NULL && drm_connector_is_cursor_visible(conn)) {
|
||||||
|
|
|
@ -15,7 +15,8 @@ struct wlr_drm_crtc;
|
||||||
struct wlr_drm_interface {
|
struct wlr_drm_interface {
|
||||||
// Commit al pending changes on a CRTC.
|
// Commit al pending changes on a CRTC.
|
||||||
bool (*crtc_commit)(struct wlr_drm_backend *drm,
|
bool (*crtc_commit)(struct wlr_drm_backend *drm,
|
||||||
struct wlr_drm_connector *conn, uint32_t flags);
|
struct wlr_drm_connector *conn, const struct wlr_output_state *state,
|
||||||
|
uint32_t flags);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const struct wlr_drm_interface atomic_iface;
|
extern const struct wlr_drm_interface atomic_iface;
|
||||||
|
|
Loading…
Reference in a new issue