aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-07-27 18:37:40 +0200
committerSimon Ser <contact@emersion.fr>2020-11-15 22:48:42 +0100
commit68a8d9905513c0277037cc74325bb2ea507ac012 (patch)
tree43f0893b608cf251e5f9ba15263f2d34d0d5c26c /backend/drm
parentc11c6c45685c96e1b525b2f944bc278be20c119e (diff)
backend/drm: add support for wlr_swapchain buffer age
Diffstat (limited to 'backend/drm')
-rw-r--r--backend/drm/drm.c14
-rw-r--r--backend/drm/renderer.c6
2 files changed, 13 insertions, 7 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index ecd98fda..bd482be3 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -27,6 +27,7 @@
#include "backend/drm/drm.h"
#include "backend/drm/iface.h"
#include "backend/drm/util.h"
+#include "render/swapchain.h"
#include "util/signal.h"
bool check_drm_features(struct wlr_drm_backend *drm) {
@@ -331,6 +332,15 @@ static bool drm_connector_attach_render(struct wlr_output *output,
return drm_surface_make_current(&conn->crtc->primary->surf, buffer_age);
}
+static void drm_plane_set_committed(struct wlr_drm_plane *plane) {
+ drm_fb_move(&plane->queued_fb, &plane->pending_fb);
+
+ struct wlr_buffer *queued = plane->queued_fb.wlr_buf;
+ if (queued != NULL) {
+ wlr_swapchain_set_buffer_submitted(plane->surf.swapchain, queued);
+ }
+}
+
static bool drm_crtc_commit(struct wlr_drm_connector *conn, uint32_t flags) {
struct wlr_drm_backend *drm =
get_drm_backend_from_backend(conn->output.backend);
@@ -338,9 +348,9 @@ static bool drm_crtc_commit(struct wlr_drm_connector *conn, uint32_t flags) {
bool ok = drm->iface->crtc_commit(drm, conn, flags);
if (ok && !(flags & DRM_MODE_ATOMIC_TEST_ONLY)) {
memcpy(&crtc->current, &crtc->pending, sizeof(struct wlr_drm_crtc_state));
- drm_fb_move(&crtc->primary->queued_fb, &crtc->primary->pending_fb);
+ drm_plane_set_committed(crtc->primary);
if (crtc->cursor != NULL) {
- drm_fb_move(&crtc->cursor->queued_fb, &crtc->cursor->pending_fb);
+ drm_plane_set_committed(crtc->cursor);
}
} else {
memcpy(&crtc->pending, &crtc->current, sizeof(struct wlr_drm_crtc_state));
diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c
index b78cf7e2..1d6a3277 100644
--- a/backend/drm/renderer.c
+++ b/backend/drm/renderer.c
@@ -137,7 +137,7 @@ static void finish_drm_surface(struct wlr_drm_surface *surf) {
bool drm_surface_make_current(struct wlr_drm_surface *surf,
int *buffer_age) {
wlr_buffer_unlock(surf->back_buffer);
- surf->back_buffer = wlr_swapchain_acquire(surf->swapchain);
+ surf->back_buffer = wlr_swapchain_acquire(surf->swapchain, buffer_age);
if (surf->back_buffer == NULL) {
wlr_log(WLR_ERROR, "Failed to acquire swapchain buffer");
return false;
@@ -151,10 +151,6 @@ bool drm_surface_make_current(struct wlr_drm_surface *surf,
return false;
}
- // TODO: damage tracking
- if (buffer_age != NULL) {
- *buffer_age = -1;
- }
return true;
}