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

buffer: add format param to get_data_ptr #2894

Merged
merged 2 commits into from
Apr 27, 2021

Conversation

emersion
Copy link
Member

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.

References: #2864

cc @bl4ckb0ne

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
@bl4ckb0ne
Copy link
Contributor

Should the format be a member of wlr_buffer? Otherwise LGTM

@emersion
Copy link
Member Author

emersion commented Apr 27, 2021

Oh, that's a good point, I forgot we discussed about that.

The only reason why it maybe doesn't make sense to have it as a member of wlr_buffer is if the buffer is opaque or if it doesn't have a single fixed format. Some potential edge-cases:

  • A solid color wl_buffer without any backing storage.
  • A 3D view wl_buffer, as seen in zxr_composite_buffer_v1.
  • A virtual wl_buffer which mirrors the contents of an output or toplevel. Could be useful for e.g. phosh's UI.

It's not yet clear to me all buffer types will have a format. OTOH it doesn't make sense for a buffer to implement get_data_ptr without having a format. Maybe it would be better to wait a little before baking the assumption that all buffers have a format into wlr_buffer.

@bl4ckb0ne
Copy link
Contributor

I think the wlr_buffer api is in dire need of more tinkering, but I agree that we don't know all of the edge cases for now.

I'd be ok to merge this now as it is, because it fixes more than one issue. We can always come back later and improve :)

@emersion emersion added the breaking Breaking change in public API label Apr 27, 2021
@emersion
Copy link
Member Author

Right. It's not a big deal because this is only a breaking change for internal wlroots APIs and for third-party wlr_buffer_impl.get_data_ptr implementors, and I'm not aware of any yet.

@emersion emersion merged commit 3a04fb4 into swaywm:master Apr 27, 2021
@emersion emersion deleted the get-data-ptr-format branch April 27, 2021 18:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking Breaking change in public API
Development

Successfully merging this pull request may close these issues.

None yet

2 participants