mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-25 22:25:58 +01:00
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.
This commit is contained in:
parent
6c54c34713
commit
dbc7a5cada
1 changed files with 3 additions and 2 deletions
|
@ -11,6 +11,7 @@
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include "wlr-screencopy-unstable-v1-protocol.h"
|
#include "wlr-screencopy-unstable-v1-protocol.h"
|
||||||
#include "render/pixel_format.h"
|
#include "render/pixel_format.h"
|
||||||
|
#include "render/wlr_renderer.h"
|
||||||
|
|
||||||
#define SCREENCOPY_MANAGER_VERSION 3
|
#define SCREENCOPY_MANAGER_VERSION 3
|
||||||
|
|
||||||
|
@ -208,12 +209,12 @@ static bool frame_shm_copy(struct wlr_screencopy_frame_v1 *frame,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
if (!wlr_renderer_begin_with_buffer(renderer, src_buffer)) {
|
if (!renderer_bind_buffer(renderer, src_buffer)) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
ok = wlr_renderer_read_pixels(renderer, format,
|
ok = wlr_renderer_read_pixels(renderer, format,
|
||||||
stride, width, height, x, y, 0, 0, data);
|
stride, width, height, x, y, 0, 0, data);
|
||||||
wlr_renderer_end(renderer);
|
renderer_bind_buffer(renderer, NULL);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
wlr_buffer_end_data_ptr_access(frame->buffer);
|
wlr_buffer_end_data_ptr_access(frame->buffer);
|
||||||
|
|
Loading…
Reference in a new issue