staging: vc04_services: Support sending data to MMAL ports
authorDave Stevenson <dave.stevenson@raspberrypi.org>
Mon, 24 Sep 2018 17:26:02 +0000 (18:26 +0100)
committerDom Cobley <popcornmix@gmail.com>
Mon, 19 Feb 2024 11:32:51 +0000 (11:32 +0000)
Add the ability to send data to ports. This only supports
zero copy mode as the required bulk transfer setup calls
are not done.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c

index 9e7524c..da89823 100644 (file)
@@ -419,11 +419,19 @@ buffer_from_host(struct vchiq_mmal_instance *instance,
        m.u.buffer_from_host.buffer_header.data =
                (u32)(unsigned long)buf->buffer;
        m.u.buffer_from_host.buffer_header.alloc_size = buf->buffer_size;
-       m.u.buffer_from_host.buffer_header.length = 0;  /* nothing used yet */
-       m.u.buffer_from_host.buffer_header.offset = 0;  /* no offset */
-       m.u.buffer_from_host.buffer_header.flags = 0;   /* no flags */
-       m.u.buffer_from_host.buffer_header.pts = MMAL_TIME_UNKNOWN;
-       m.u.buffer_from_host.buffer_header.dts = MMAL_TIME_UNKNOWN;
+       if (port->type == MMAL_PORT_TYPE_OUTPUT) {
+               m.u.buffer_from_host.buffer_header.length = 0;
+               m.u.buffer_from_host.buffer_header.offset = 0;
+               m.u.buffer_from_host.buffer_header.flags = 0;
+               m.u.buffer_from_host.buffer_header.pts = MMAL_TIME_UNKNOWN;
+               m.u.buffer_from_host.buffer_header.dts = MMAL_TIME_UNKNOWN;
+       } else {
+               m.u.buffer_from_host.buffer_header.length = buf->length;
+               m.u.buffer_from_host.buffer_header.offset = 0;
+               m.u.buffer_from_host.buffer_header.flags = buf->mmal_flags;
+               m.u.buffer_from_host.buffer_header.pts = buf->pts;
+               m.u.buffer_from_host.buffer_header.dts = buf->dts;
+       }
 
        /* clear buffer type specific data */
        memset(&m.u.buffer_from_host.buffer_header_type_specific, 0,