aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Stoeckl <code@mstoeckl.com>2023-09-11 19:59:41 -0400
committerManuel Stoeckl <code@mstoeckl.com>2023-09-11 20:25:07 -0400
commitdbc7a5cada37d192821e1104b356ff891b8bd787 (patch)
treea78629a957b89944d1b04444e654500e926f3d60
parent6c54c3471354a3ec55dddaa47beb8a28819944ae (diff)
screencopy_v1: only bind, not render with, buffer in shm copy path
wlr_renderer_read_pixels does not need to be called inside a render pass; rather, it only needs to have the correct buffer bound to the renderer. This commit optimizes the implementation of frame_shm_copy(...) by only binding the source buffer instead of starting a no-op render pass with it.
-rw-r--r--types/wlr_screencopy_v1.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/types/wlr_screencopy_v1.c b/types/wlr_screencopy_v1.c
index bb90d35a..a421954b 100644
--- a/types/wlr_screencopy_v1.c
+++ b/types/wlr_screencopy_v1.c
@@ -11,6 +11,7 @@
#include <wlr/util/log.h>
#include "wlr-screencopy-unstable-v1-protocol.h"
#include "render/pixel_format.h"
+#include "render/wlr_renderer.h"
#define SCREENCOPY_MANAGER_VERSION 3
@@ -208,12 +209,12 @@ static bool frame_shm_copy(struct wlr_screencopy_frame_v1 *frame,
}
bool ok = false;
- if (!wlr_renderer_begin_with_buffer(renderer, src_buffer)) {
+ if (!renderer_bind_buffer(renderer, src_buffer)) {
goto out;
}
ok = wlr_renderer_read_pixels(renderer, format,
stride, width, height, x, y, 0, 0, data);
- wlr_renderer_end(renderer);
+ renderer_bind_buffer(renderer, NULL);
out:
wlr_buffer_end_data_ptr_access(frame->buffer);