mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kaaira Gupta <kgupta@es.iitr.ac.in>
To: linux-media@vger.kernel.org,
	Helen Koike <helen.koike@collabora.com>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-kernel@vger.kernel.org, kieran.bingham@ideasonboard.com,
	laurent.pinchart@ideasonboard.com
Subject: [RFC PATCH] vimc: Add colors' order over test image
Date: Sun, 7 Jun 2020 19:23:25 +0530	[thread overview]
Message-ID: <20200607135325.GA16838@kaaira-HP-Pavilion-Notebook> (raw)

Currently there is no method to know if the test image generated by vimc
is correct (except for comparing it with a known 'correct' image). Add
text over the test image, representing the correct order of colors.

I have sent it as an RFC because we can add the text as an optional
control, and maybe we can print some other useful information as well
(like vivid does).

Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
---
 drivers/media/test-drivers/vimc/Kconfig       | 2 ++
 drivers/media/test-drivers/vimc/vimc-core.c   | 9 +++++++++
 drivers/media/test-drivers/vimc/vimc-sensor.c | 8 ++++++++
 3 files changed, 19 insertions(+)

diff --git a/drivers/media/test-drivers/vimc/Kconfig b/drivers/media/test-drivers/vimc/Kconfig
index 4068a67585f9..da4b2ad6e40c 100644
--- a/drivers/media/test-drivers/vimc/Kconfig
+++ b/drivers/media/test-drivers/vimc/Kconfig
@@ -2,6 +2,8 @@
 config VIDEO_VIMC
 	tristate "Virtual Media Controller Driver (VIMC)"
 	depends on VIDEO_DEV && VIDEO_V4L2
+	select FONT_SUPPORT
+	select FONT_8x16
 	select MEDIA_CONTROLLER
 	select VIDEO_V4L2_SUBDEV_API
 	select VIDEOBUF2_VMALLOC
diff --git a/drivers/media/test-drivers/vimc/vimc-core.c b/drivers/media/test-drivers/vimc/vimc-core.c
index 11210aaa2551..8142bfbcbd49 100644
--- a/drivers/media/test-drivers/vimc/vimc-core.c
+++ b/drivers/media/test-drivers/vimc/vimc-core.c
@@ -5,10 +5,12 @@
  * Copyright (C) 2015-2017 Helen Koike <helen.fornazier@gmail.com>
  */
 
+#include <linux/font.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <media/media-device.h>
+#include <media/tpg/v4l2-tpg.h>
 #include <media/v4l2-device.h>
 
 #include "vimc-common.h"
@@ -265,7 +267,14 @@ static int vimc_probe(struct platform_device *pdev)
 {
 	struct vimc_device *vimc;
 	int ret;
+	const struct font_desc *font = find_font("VGA8x16");
 
+	if (font == NULL) {
+		pr_err("vimc: could not find font\n");
+		return -ENODEV;
+	}
+
+	tpg_set_font(font->data);
 	dev_dbg(&pdev->dev, "probe");
 
 	vimc = kzalloc(sizeof(*vimc), GFP_KERNEL);
diff --git a/drivers/media/test-drivers/vimc/vimc-sensor.c b/drivers/media/test-drivers/vimc/vimc-sensor.c
index a2f09ac9a360..4b13955c502a 100644
--- a/drivers/media/test-drivers/vimc/vimc-sensor.c
+++ b/drivers/media/test-drivers/vimc/vimc-sensor.c
@@ -185,10 +185,18 @@ static const struct v4l2_subdev_pad_ops vimc_sen_pad_ops = {
 static void *vimc_sen_process_frame(struct vimc_ent_device *ved,
 				    const void *sink_frame)
 {
+	u8 *basep[TPG_MAX_PLANES][2];
+	char str[100];
 	struct vimc_sen_device *vsen = container_of(ved, struct vimc_sen_device,
 						    ved);
 
+	tpg_calc_text_basep(&vsen->tpg, basep, 0, vsen->frame);
 	tpg_fill_plane_buffer(&vsen->tpg, 0, 0, vsen->frame);
+
+	snprintf(str, sizeof(str),
+		 "Order: white, yellow, cyan, green, magenta, red, blue, black");
+	tpg_gen_text(&vsen->tpg, basep, 1, 1, str);
+
 	return vsen->frame;
 }
 
-- 
2.17.1


             reply	other threads:[~2020-06-07 13:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-07 13:53 Kaaira Gupta [this message]
2020-06-08  7:10 ` Dafna Hirschfeld
2020-06-08  9:33   ` Hans Verkuil
2020-06-08 12:12     ` Laurent Pinchart
2020-06-08 12:44       ` Hans Verkuil

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=20200607135325.GA16838@kaaira-HP-Pavilion-Notebook \
    --to=kgupta@es.iitr.ac.in \
    --cc=helen.koike@collabora.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=skhan@linuxfoundation.org \
    /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

all inboxes | Powered by JetHome®