Raspicam: Enable zero copy for the two raw capture apps
authorDave Stevenson <dave.stevenson@raspberrypi.org>
Mon, 27 Feb 2017 16:38:17 +0000 (16:38 +0000)
committerpopcornmix <popcornmix@gmail.com>
Wed, 5 Apr 2017 13:30:10 +0000 (14:30 +0100)
raspiyuv and raspividyuv are both shifting a fair amount
of data around and currently doing a copy through VCHI.
Enable zero copy to reduce this overhead. This does add
a dependency on VCSM, but that has been in the standard
builds for several years.

host_applications/linux/apps/raspicam/RaspiStillYUV.c
host_applications/linux/apps/raspicam/RaspiVidYUV.c

index d95bafc949d2f54278171f906e8cf08ddb8b2b9b..ac178a3fc7c2af795afc2f1e3e6eb5eae71da7ce 100644 (file)
@@ -57,7 +57,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <unistd.h>
 #include <errno.h>
 
-#define VERSION_STRING "v1.3.6"
+#define VERSION_STRING "v1.3.7"
 
 #include "bcm_host.h"
 #include "interface/vcos/vcos.h"
@@ -835,6 +835,13 @@ static MMAL_STATUS_T create_camera_component(RASPISTILLYUV_STATE *state)
 
    still_port->buffer_num = still_port->buffer_num_recommended;
 
+   status = mmal_port_parameter_set_boolean(video_port, MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE);
+   if (status != MMAL_SUCCESS)
+   {
+      vcos_log_error("Failed to select zero copy");
+      goto error;
+   }
+
    status = mmal_port_format_commit(still_port);
 
    if (status != MMAL_SUCCESS )
index af9c4320dc73e9081b4f98a58a83d7b2eb28db75..def50cf4515b73b2e8fd829a42f6283d75b77143 100644 (file)
@@ -58,7 +58,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <memory.h>
 #include <sysexits.h>
 
-#define VERSION_STRING "v1.3.13"
+#define VERSION_STRING "v1.3.14"
 
 #include "bcm_host.h"
 #include "interface/vcos/vcos.h"
@@ -942,6 +942,13 @@ static MMAL_STATUS_T create_camera_component(RASPIVIDYUV_STATE *state)
    if (video_port->buffer_num < VIDEO_OUTPUT_BUFFERS_NUM)
       video_port->buffer_num = VIDEO_OUTPUT_BUFFERS_NUM;
 
+   status = mmal_port_parameter_set_boolean(video_port, MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE);
+   if (status != MMAL_SUCCESS)
+   {
+      vcos_log_error("Failed to select zero copy");
+      goto error;
+   }
+
    // Set the encode format on the still  port
 
    format = still_port->format;