public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-media@vger.kernel.org
Cc: laurent.pinchart@ideasonboard.com, Samu Onkalo <samu.onkalo@intel.com>
Subject: [yavta PATCH 1/1] cache maintenance skip feature
Date: Sat, 23 Jan 2016 23:49:54 +0200	[thread overview]
Message-ID: <1453585794-18833-1-git-send-email-sakari.ailus@linux.intel.com> (raw)

From: Samu Onkalo <samu.onkalo@intel.com>

Add options to skip cache maintenance.
--dqbuf-skip-cache
--qbuf-skip-cache

Signed-off-by: Samu Onkalo <samu.onkalo@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
This patch depends on my earlier patch "Fix --data-prefix option
documentation".

 yavta.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/yavta.c b/yavta.c
index b21c3b3..ec4acd6 100644
--- a/yavta.c
+++ b/yavta.c
@@ -73,6 +73,8 @@ struct device
 	unsigned int width;
 	unsigned int height;
 	uint32_t buffer_output_flags;
+	uint32_t buffer_qbuf_flags;
+	uint32_t buffer_dqbuf_flags;
 	uint32_t timestamp_type;
 
 	unsigned char num_planes;
@@ -1010,6 +1012,8 @@ static int video_queue_buffer(struct device *dev, int index, enum buffer_fill_mo
 		}
 	}
 
+	buf.flags |= dev->buffer_qbuf_flags;
+
 	if (video_is_mplane(dev)) {
 		buf.m.planes = planes;
 		buf.length = dev->num_planes;
@@ -1662,6 +1666,7 @@ static int video_do_capture(struct device *dev, unsigned int nframes,
 		buf.memory = dev->memtype;
 		buf.length = VIDEO_MAX_PLANES;
 		buf.m.planes = planes;
+		buf.flags = dev->buffer_dqbuf_flags;
 
 		ret = ioctl(dev->fd, VIDIOC_DQBUF, &buf);
 		if (ret < 0) {
@@ -1781,6 +1786,7 @@ static void usage(const char *argv0)
 	printf("-u, --userptr			Use the user pointers streaming method\n");
 	printf("-w, --set-control 'ctrl value'	Set control 'ctrl' to 'value'\n");
 	printf("    --data-prefix		Write portions of buffer data before data_offset\n");
+	printf("    --[d]qbuf-skip-cache        Skip cache maintenance\n");
 	printf("    --buffer-size		Buffer size in bytes\n");
 	printf("    --enum-formats		Enumerate formats\n");
 	printf("    --enum-inputs		Enumerate inputs\n");
@@ -1814,6 +1820,8 @@ static void usage(const char *argv0)
 #define OPT_PREMULTIPLIED	269
 #define OPT_QUEUE_LATE		270
 #define OPT_DATA_PREFIX		271
+#define OPT_DQBUF_NO_CACHE      272
+#define OPT_QBUF_NO_CACHE	273
 
 static struct option opts[] = {
 	{"buffer-size", 1, 0, OPT_BUFFER_SIZE},
@@ -1822,6 +1830,7 @@ static struct option opts[] = {
 	{"check-overrun", 0, 0, 'C'},
 	{"data-prefix", 0, 0, OPT_DATA_PREFIX},
 	{"delay", 1, 0, 'd'},
+	{"dqbuf-skip-cache", 0, 0, OPT_DQBUF_NO_CACHE},
 	{"enum-formats", 0, 0, OPT_ENUM_FORMATS},
 	{"enum-inputs", 0, 0, OPT_ENUM_INPUTS},
 	{"fd", 1, 0, OPT_FD},
@@ -1838,6 +1847,7 @@ static struct option opts[] = {
 	{"offset", 1, 0, OPT_USERPTR_OFFSET},
 	{"pause", 0, 0, 'p'},
 	{"premultiplied", 0, 0, OPT_PREMULTIPLIED},
+	{"qbuf-skip-cache", 0, 0, OPT_QBUF_NO_CACHE},
 	{"quality", 1, 0, 'q'},
 	{"queue-late", 0, 0, OPT_QUEUE_LATE},
 	{"get-control", 1, 0, 'r'},
@@ -2089,6 +2099,12 @@ int main(int argc, char *argv[])
 		case OPT_DATA_PREFIX:
 			dev.write_data_prefix = true;
 			break;
+		case OPT_DQBUF_NO_CACHE:
+			dev.buffer_dqbuf_flags |= V4L2_BUF_FLAG_NO_CACHE_INVALIDATE;
+			break;
+		case OPT_QBUF_NO_CACHE:
+			dev.buffer_qbuf_flags |= V4L2_BUF_FLAG_NO_CACHE_INVALIDATE;
+			break;
 		default:
 			printf("Invalid option -%c\n", c);
 			printf("Run %s -h for help.\n", argv[0]);
-- 
1.7.9.5


             reply	other threads:[~2016-01-23 21:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-23 21:49 Sakari Ailus [this message]
2016-01-24 20:09 ` [yavta PATCH 1/1] cache maintenance skip feature Laurent Pinchart
2016-02-02 23:22   ` Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1453585794-18833-1-git-send-email-sakari.ailus@linux.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=samu.onkalo@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox