aboutsummaryrefslogtreecommitdiff
path: root/backend/drm/drm.c
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/drm.c
parentc11c6c45685c96e1b525b2f944bc278be20c119e (diff)
backend/drm: add support for wlr_swapchain buffer age
Diffstat (limited to 'backend/drm/drm.c')
-rw-r--r--backend/drm/drm.c14
1 files changed, 12 insertions, 2 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));