mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
spa: libcamera: source: store the request pointer in ring buffer
The request will be needed later, so store that directly in the completion ring buffer for easy access. This is fine even though `impl::requestComplete()` calls `Request::reuse()` because only the request cookie is used in `libcamera_on_fd_events()` and that remains constant during the lifetime of a request object.
This commit is contained in:
parent
68627c5563
commit
099292d63d
1 changed files with 5 additions and 3 deletions
|
|
@ -80,7 +80,7 @@ struct port {
|
|||
uint32_t n_buffers = 0;
|
||||
struct spa_list queue;
|
||||
struct spa_ringbuffer ring = SPA_RINGBUFFER_INIT();
|
||||
uint32_t ring_ids[MAX_BUFFERS];
|
||||
libcamera::Request *ring_ids[MAX_BUFFERS];
|
||||
|
||||
static constexpr uint64_t info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||
SPA_PORT_CHANGE_MASK_PROPS | SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
|
|
@ -1044,9 +1044,11 @@ void libcamera_on_fd_events(struct spa_source *source)
|
|||
spa_log_error(impl->log, "nothing is queued");
|
||||
return;
|
||||
}
|
||||
buffer_id = port->ring_ids[index & MASK_BUFFERS];
|
||||
|
||||
auto *request = port->ring_ids[index & MASK_BUFFERS];
|
||||
spa_ringbuffer_read_update(&port->ring, index + 1);
|
||||
|
||||
buffer_id = request->cookie();
|
||||
b = &port->buffers[buffer_id];
|
||||
spa_list_append(&port->queue, &b->link);
|
||||
|
||||
|
|
@ -1288,7 +1290,7 @@ void impl::requestComplete(libcamera::Request *request)
|
|||
request->reuse(libcamera::Request::ReuseFlag::ReuseBuffers);
|
||||
|
||||
spa_ringbuffer_get_write_index(&port->ring, &index);
|
||||
port->ring_ids[index & MASK_BUFFERS] = buffer_id;
|
||||
port->ring_ids[index & MASK_BUFFERS] = request;
|
||||
spa_ringbuffer_write_update(&port->ring, index + 1);
|
||||
|
||||
if (spa_system_eventfd_write(impl->system, impl->source.fd, 1) < 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue