Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

buffer: wlr_buffer_impl.get_data_ptr limitations #2864

Closed
emersion opened this issue Apr 17, 2021 · 2 comments
Closed

buffer: wlr_buffer_impl.get_data_ptr limitations #2864

emersion opened this issue Apr 17, 2021 · 2 comments
Labels

Comments

@emersion
Copy link
Member

emersion commented Apr 17, 2021

We've introduced wlr_buffer_impl.get_data_ptr for the purposes of the Pixman renderer. This works well enough but has some limitations:

  1. The caller has no easy way to figure out the format in which pixels are laid out: Pixman renderer #2661 (comment). We've worked around this in the Pixman renderer by calling get_dmabuf/get_shm just to get the format.
  2. It's not possible to safely wrap client wl_shm buffers inside a wlr_buffer. The commit "buffer: introduce wlr_shm_client_buffer" in Cache and re-use DMA-BUF textures #2851 does it anyways, but doesn't call wl_shm_buffer_begin_access nor wl_shm_buffer_end_access. Calling these before and after any access to the buffer data is necessary to prevent clients from SIGBUS'ing the compositor (by truncating their mmap'ed shm file). Wrapping a wl_shm client buffer in a wlr_buffer is desirable for screencopy purposes and for improving our buffer handling which is currently GL-centric.

cc @bl4ckb0ne

@emersion
Copy link
Member Author

Some previous thoughts on the matter: #2399 (comment)

emersion added a commit to emersion/wlroots that referenced this issue Apr 26, 2021
Allow wlr_buffer_impl.get_data_ptr to return a format.

This allows the Pixman renderer to not care about get_dmabuf/get_shm,
and only care about get_data_ptr. This will also help with [1], because
client wl_shm buffers can't implement get_shm.

[1]: swaywm#2892

References: swaywm#2864
emersion added a commit that referenced this issue Apr 27, 2021
Allow wlr_buffer_impl.get_data_ptr to return a format.

This allows the Pixman renderer to not care about get_dmabuf/get_shm,
and only care about get_data_ptr. This will also help with [1], because
client wl_shm buffers can't implement get_shm.

[1]: #2892

References: #2864
@emersion
Copy link
Member Author

(1) has been addressed in #2894. (2) remains.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

1 participant