emersion / xdg-desktop-portal-wlr

xdg-desktop-portal backend for wlroots
MIT License
580 stars 54 forks source link

screencast: calculate spa buffer sizes #258

Closed columbarius closed 1 year ago

columbarius commented 1 year ago

Modern GPUs support many modifiers which increases the size required for the param_buffer. Instead of randomly bumping the hardcoded value we should calculate the required space dynamically.

emersion commented 1 year ago

The docs say:

It is also possible to dynamically grow the memory as needed.

Can we use that instead?

columbarius commented 1 year ago

Then we would have to use a separate buffer for each param since a realloc would invalidate previous pointers to that memory or we could try to create the params and when that fails increase the buffersize and create them again.

emersion commented 1 year ago

No, I mean that this doc sentence hints that PipeWire has an API to dynamically allocate the buffers.

columbarius commented 1 year ago

Ahh I see there is a new builder api (spa_pod_dynamic_builder) in PipeWire. Will take a look at it. Thx.

columbarius commented 1 year ago

Implemented #260 just to realize, while trying to figure out the minimum PipeWire version, that after the second reallocation we have dangling pointers. See: https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/d3a1b9fe31ba5978fa50299921fd4481f125dba2

emersion commented 1 year ago

I think we can avoid this by using different builders for each param object?

columbarius commented 1 year ago

Yes, updated #260

columbarius commented 1 year ago

Superseeded by #260