mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
data: clean up fd and data management
Do not send the offset and size in the add_mem call, just send the fd and the flags. The area that we need to map from this to find the meta, chunk and data are sent in a separate call. This should make it possible to truncate the memory to a larger size to dynamically allocate more shared memory for a client. Remove the Id data type, it's not needed. Don't automatically map memory in remote.c Pass the original memory type from server to client. Handle DmaBuf mem in video-play now that the server passed it on.
This commit is contained in:
parent
541553be1c
commit
08814bd808
7 changed files with 100 additions and 119 deletions
|
|
@ -544,8 +544,7 @@ spa_proxy_node_port_set_io(struct spa_node *node,
|
|||
direction, port_id,
|
||||
memid,
|
||||
t->data.MemFd,
|
||||
mem->fd, mem->flags,
|
||||
0, mem->offset + mem->size);
|
||||
mem->fd, mem->flags);
|
||||
|
||||
pw_client_node_resource_port_set_io(this->resource,
|
||||
this->seq,
|
||||
|
|
@ -634,7 +633,7 @@ spa_proxy_node_port_use_buffers(struct spa_node *node,
|
|||
|
||||
mb[i].buffer = &b->buffer;
|
||||
mb[i].mem_id = n_mem++;
|
||||
mb[i].offset = 0;
|
||||
mb[i].offset = SPA_PTRDIFF(baseptr, m->ptr + m->offset);
|
||||
mb[i].size = data_size;
|
||||
|
||||
pw_client_node_resource_port_add_mem(this->resource,
|
||||
|
|
@ -642,9 +641,7 @@ spa_proxy_node_port_use_buffers(struct spa_node *node,
|
|||
port_id,
|
||||
mb[i].mem_id,
|
||||
t->data.MemFd,
|
||||
m->fd, m->flags,
|
||||
SPA_PTRDIFF(baseptr, m->ptr + m->offset),
|
||||
data_size);
|
||||
m->fd, m->flags);
|
||||
|
||||
for (j = 0; j < buffers[i]->n_metas; j++)
|
||||
memcpy(&b->buffer.metas[j], &buffers[i]->metas[j], sizeof(struct spa_meta));
|
||||
|
|
@ -663,8 +660,7 @@ spa_proxy_node_port_use_buffers(struct spa_node *node,
|
|||
n_mem,
|
||||
d->type,
|
||||
d->fd,
|
||||
d->flags, d->mapoffset, d->maxsize);
|
||||
b->buffer.datas[j].type = t->data.Id;
|
||||
d->flags);
|
||||
b->buffer.datas[j].data = SPA_UINT32_TO_PTR(n_mem);
|
||||
n_mem++;
|
||||
} else if (d->type == t->data.MemPtr) {
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ static bool client_node_demarshal_port_add_mem(void *object, void *data, size_t
|
|||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t direction, port_id, mem_id, type, memfd_idx, flags, offset, sz;
|
||||
uint32_t direction, port_id, mem_id, type, memfd_idx, flags;
|
||||
int memfd;
|
||||
|
||||
spa_pod_parser_init(&prs, data, size, 0);
|
||||
|
|
@ -309,9 +309,7 @@ static bool client_node_demarshal_port_add_mem(void *object, void *data, size_t
|
|||
"i", &mem_id,
|
||||
"I", &type,
|
||||
"i", &memfd_idx,
|
||||
"i", &flags,
|
||||
"i", &offset,
|
||||
"i", &sz, NULL) < 0)
|
||||
"i", &flags, NULL) < 0)
|
||||
return false;
|
||||
|
||||
memfd = pw_protocol_native_get_proxy_fd(proxy, memfd_idx);
|
||||
|
|
@ -320,7 +318,7 @@ static bool client_node_demarshal_port_add_mem(void *object, void *data, size_t
|
|||
port_id,
|
||||
mem_id,
|
||||
type,
|
||||
memfd, flags, offset, sz);
|
||||
memfd, flags);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -564,7 +562,7 @@ client_node_marshal_port_add_mem(void *object,
|
|||
uint32_t port_id,
|
||||
uint32_t mem_id,
|
||||
uint32_t type,
|
||||
int memfd, uint32_t flags, uint32_t offset, uint32_t size)
|
||||
int memfd, uint32_t flags)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
|
@ -577,9 +575,7 @@ client_node_marshal_port_add_mem(void *object,
|
|||
"i", mem_id,
|
||||
"I", type,
|
||||
"i", pw_protocol_native_add_resource_fd(resource, memfd),
|
||||
"i", flags,
|
||||
"i", offset,
|
||||
"i", size);
|
||||
"i", flags);
|
||||
|
||||
pw_protocol_native_end_resource(resource, b);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue