aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/drm/drm.c4
-rw-r--r--backend/headless/output.c11
-rw-r--r--backend/wayland/output.c4
-rw-r--r--backend/x11/output.c4
-rw-r--r--include/wlr/interfaces/wlr_output.h2
-rw-r--r--types/wlr_output.c10
6 files changed, 18 insertions, 17 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 43453072..7153761a 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -586,7 +586,7 @@ static bool drm_connector_commit(struct wlr_output *output) {
return true;
}
-static void drm_connector_rollback(struct wlr_output *output) {
+static void drm_connector_rollback_render(struct wlr_output *output) {
struct wlr_drm_backend *drm = get_drm_backend_from_backend(output->backend);
wlr_egl_unset_current(&drm->renderer.egl);
}
@@ -1024,7 +1024,7 @@ static const struct wlr_output_impl output_impl = {
.attach_render = drm_connector_attach_render,
.test = drm_connector_test,
.commit = drm_connector_commit,
- .rollback = drm_connector_rollback,
+ .rollback_render = drm_connector_rollback_render,
.get_gamma_size = drm_connector_get_gamma_size,
.export_dmabuf = drm_connector_export_dmabuf,
};
diff --git a/backend/headless/output.c b/backend/headless/output.c
index 822afac9..32c2a7fd 100644
--- a/backend/headless/output.c
+++ b/backend/headless/output.c
@@ -140,13 +140,12 @@ static bool output_commit(struct wlr_output *wlr_output) {
return true;
}
-static void output_rollback(struct wlr_output *wlr_output) {
+static void output_rollback_render(struct wlr_output *wlr_output) {
struct wlr_headless_output *output =
headless_output_from_output(wlr_output);
- if (wlr_output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
- wlr_egl_unset_current(output->backend->egl);
- }
+ assert(wlr_egl_is_current(output->backend->egl));
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ wlr_egl_unset_current(output->backend->egl);
}
static void output_destroy(struct wlr_output *wlr_output) {
@@ -162,7 +161,7 @@ static const struct wlr_output_impl output_impl = {
.destroy = output_destroy,
.attach_render = output_attach_render,
.commit = output_commit,
- .rollback = output_rollback,
+ .rollback_render = output_rollback_render,
};
bool wlr_output_is_headless(struct wlr_output *wlr_output) {
diff --git a/backend/wayland/output.c b/backend/wayland/output.c
index f446ac3c..bd17fa20 100644
--- a/backend/wayland/output.c
+++ b/backend/wayland/output.c
@@ -301,7 +301,7 @@ static bool output_commit(struct wlr_output *wlr_output) {
return true;
}
-static void output_rollback(struct wlr_output *wlr_output) {
+static void output_rollback_render(struct wlr_output *wlr_output) {
struct wlr_wl_output *output =
get_wl_output_from_output(wlr_output);
wlr_egl_unset_current(&output->backend->egl);
@@ -436,7 +436,7 @@ static const struct wlr_output_impl output_impl = {
.attach_render = output_attach_render,
.test = output_test,
.commit = output_commit,
- .rollback = output_rollback,
+ .rollback_render = output_rollback_render,
.set_cursor = output_set_cursor,
.move_cursor = output_move_cursor,
};
diff --git a/backend/x11/output.c b/backend/x11/output.c
index 953c2ba2..07374b61 100644
--- a/backend/x11/output.c
+++ b/backend/x11/output.c
@@ -160,7 +160,7 @@ static bool output_commit(struct wlr_output *wlr_output) {
return true;
}
-static void output_rollback(struct wlr_output *wlr_output) {
+static void output_rollback_render(struct wlr_output *wlr_output) {
struct wlr_x11_output *output = get_x11_output_from_output(wlr_output);
wlr_egl_unset_current(&output->x11->egl);
}
@@ -170,7 +170,7 @@ static const struct wlr_output_impl output_impl = {
.attach_render = output_attach_render,
.test = output_test,
.commit = output_commit,
- .rollback = output_rollback,
+ .rollback_render = output_rollback_render,
};
struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) {
diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h
index 8913cf41..13c9e6dc 100644
--- a/include/wlr/interfaces/wlr_output.h
+++ b/include/wlr/interfaces/wlr_output.h
@@ -23,7 +23,7 @@ struct wlr_output_impl {
bool (*attach_render)(struct wlr_output *output, int *buffer_age);
bool (*test)(struct wlr_output *output);
bool (*commit)(struct wlr_output *output);
- void (*rollback)(struct wlr_output *output);
+ void (*rollback_render)(struct wlr_output *output);
size_t (*get_gamma_size)(struct wlr_output *output);
bool (*export_dmabuf)(struct wlr_output *output,
struct wlr_dmabuf_attributes *attribs);
diff --git a/types/wlr_output.c b/types/wlr_output.c
index c2e9dba7..a0ba8bd4 100644
--- a/types/wlr_output.c
+++ b/types/wlr_output.c
@@ -638,11 +638,13 @@ bool wlr_output_commit(struct wlr_output *output) {
}
void wlr_output_rollback(struct wlr_output *output) {
- output_state_clear(&output->pending);
-
- if (output->impl->rollback) {
- output->impl->rollback(output);
+ if (output->impl->rollback_render &&
+ (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) &&
+ output->pending.buffer_type == WLR_OUTPUT_STATE_BUFFER_RENDER) {
+ output->impl->rollback_render(output);
}
+
+ output_state_clear(&output->pending);
}
void wlr_output_attach_buffer(struct wlr_output *output,