mem: Add tag to memmap

Add a tag field when creating a memmap so that we can do lookup on it.
This makes it easier to implement the tracking of mappings for io areas.
Remove custom io memory tracking and use the tags.

Add flags to spa_chunk to make data corrupted. The flags on the buffer
stay constant for the life of the buffer. Add flags to mark memory
readable and writable. Mark memory readonly in v4l2-source.

Pass the daemon activation area to the client in the transport event.
This never changes and need to be handled differently from the other
activation areas.

Use the right flags when importing memory.

Add the (desired) memory type to mempool_alloc.

improve some debug.
This commit is contained in:
Wim Taymans 2019-07-25 12:10:05 +02:00
parent 5aa0ff21c6
commit 18776b155b
14 changed files with 256 additions and 183 deletions

View file

@ -1202,6 +1202,9 @@ static int mmap_read(struct impl *this)
d[0].chunk->offset = 0;
d[0].chunk->size = buf.bytesused;
d[0].chunk->stride = port->fmt.fmt.pix.bytesperline;
d[0].chunk->flags = 0;
if (buf.flags & V4L2_BUF_FLAG_ERROR)
d[0].flags |= SPA_CHUNK_FLAG_CORRUPTED;
SPA_FLAG_SET(b->flags, BUFFER_FLAG_OUTSTANDING);
@ -1399,6 +1402,7 @@ mmap_init(struct impl *this,
d[0].chunk->offset = 0;
d[0].chunk->size = 0;
d[0].chunk->stride = port->fmt.fmt.pix.bytesperline;
d[0].chunk->flags = 0;
if (port->export_buf) {
struct v4l2_exportbuffer expbuf;
@ -1412,11 +1416,13 @@ mmap_init(struct impl *this,
continue;
}
d[0].type = SPA_DATA_DmaBuf;
d[0].flags = SPA_DATA_FLAG_READABLE;
d[0].fd = expbuf.fd;
d[0].data = NULL;
SPA_FLAG_SET(b->flags, BUFFER_FLAG_ALLOCATED);
} else {
d[0].type = SPA_DATA_MemPtr;
d[0].flags = SPA_DATA_FLAG_READABLE;
d[0].fd = -1;
d[0].data = mmap(NULL,
b->v4l2_buffer.length,