mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-21 14:42:25 +00:00
backend/wayland: Account for shm buffer offset
If we are trying directly scan-out a shm buffer, we create a temporary buffer pool to instantiate a wl_buffer from, created in accordance to our buffers size. If the buffer has an offset, it will end up out of bounds of the created pool. Extend the temporary pool by the buffer offset to compensate. Matching the original pool size does matter unless we want to optimize away the temporary pool to reduce mappings in the parent compositor.
This commit is contained in:
parent
3f314bc183
commit
63fabecee2
@ -197,7 +197,7 @@ static struct wl_buffer *import_shm(struct wlr_wl_backend *wl,
|
|||||||
struct wlr_shm_attributes *shm) {
|
struct wlr_shm_attributes *shm) {
|
||||||
enum wl_shm_format wl_shm_format = convert_drm_format_to_wl_shm(shm->format);
|
enum wl_shm_format wl_shm_format = convert_drm_format_to_wl_shm(shm->format);
|
||||||
uint32_t size = shm->stride * shm->height;
|
uint32_t size = shm->stride * shm->height;
|
||||||
struct wl_shm_pool *pool = wl_shm_create_pool(wl->shm, shm->fd, size);
|
struct wl_shm_pool *pool = wl_shm_create_pool(wl->shm, shm->fd, shm->offset + size);
|
||||||
if (pool == NULL) {
|
if (pool == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user