Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1175001ybt; Sun, 14 Jun 2020 13:07:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5A83GKtD/SrzF2rsU0TAFzoMFWO6dQho933kiJxubsBeZUksNUl8JV2MTmioOOj0sdwUN X-Received: by 2002:a17:906:f74a:: with SMTP id jp10mr22662942ejb.43.1592165272724; Sun, 14 Jun 2020 13:07:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592165272; cv=none; d=google.com; s=arc-20160816; b=X4paRgwTEvRVUtNLKVbL3/npQQjcpdl5SjJCjQ1CYwheFAS5sQ1jSXn4KGNCRV9Bh6 JTfDnLxJqHQnMtfLpNoAuEoMa1M3A0hjMRYgs3r03huBAGamjE/Ol9kewvHjsyUJlbdl bla1fvwa4vNc2FAzxB9ZJ2FqIfJN0lccTrRw7JMQvN7umYH6qfnPCZn+TfME3VjkhjDe X0ezMd+qNpQG1TRofPyOfZgfLhm1Z2VmoeEbyR7KdvcuGBluqvfAWASaTSGnlp6pbXQP rrJ3UHkLsU6/S1WXiodmgiO8k3qjxqDRIq/dL8ISQD3JuyDHchqis04l8G2WlL9ZrUvy 9pHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=j4gk06Hqfw5/lTrfdtNI0K7/BTFaECtSfVdtHzYyVFQ=; b=DkWDFlIp2ZBhTZakV8baDbDwSr98zzFLOtl2qMy8tPPBVHGX4X53564ehFsCimyx6h DpaK6eEcuI5zREhqA+7mbUpLRAxJofcWhcYlOOinMUKI/CaPrO1qZipeN210CULwgiIu 73lCuoyqtB0YEdU3vcYJnk1Zb+hZ1VGCNUm1Lb2/VsZWBJvt0g0bEMaZKnqsK2vSD+Vi 5O5Autj/0O9lIQsiKrGJUmrisrUb7lgt7NqLbIFLmC2ljz55JflGHNNkdtqVoPOlCwBJ 1btriMp0SBwookpgK5lRKRiKJ+Pck9voMIraIBX1VNBYuJVbFXUDSSQ6hule7VCCdA/B j66A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@es-iitr-ac-in.20150623.gappssmtp.com header.s=20150623 header.b=gSIYPCob; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=iitr.ac.in Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o17si7745781edz.304.2020.06.14.13.07.30; Sun, 14 Jun 2020 13:07:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@es-iitr-ac-in.20150623.gappssmtp.com header.s=20150623 header.b=gSIYPCob; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=iitr.ac.in Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727969AbgFNUDU (ORCPT + 99 others); Sun, 14 Jun 2020 16:03:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727948AbgFNUDT (ORCPT ); Sun, 14 Jun 2020 16:03:19 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E656EC08C5C3 for ; Sun, 14 Jun 2020 13:03:18 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id s88so6120609pjb.5 for ; Sun, 14 Jun 2020 13:03:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=j4gk06Hqfw5/lTrfdtNI0K7/BTFaECtSfVdtHzYyVFQ=; b=gSIYPCobLz01tJ5DfPPQY1feRfgzjX8OzPdqtK6rV/OmqzpRkx2CLY3mIjAwsFWSws 8bIT17usBHTfFovlsS/Wi+bJqnb7p8ScV3BD0xFqfSqRhWLqvbJ8OittjHqJKbLrd0MV /mwSRNkR4rFsoXxzcT/xRnuHcDCpP1feelfzWgWf4I1QdCrotACHWG2ffwyzzqK20ymv Md3A709qwkG+IGfQBLDRG150KFsl0pcxmMGD/QhWOIRgPvsOwhaVNLdBVXjY6/LKn4TD r7xGQRl655Uy2CkKRddZPpxyzHWHEej0Sm88b4aqOBYRoJtWorWkuOYBic0jA0WUUUBq sUBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=j4gk06Hqfw5/lTrfdtNI0K7/BTFaECtSfVdtHzYyVFQ=; b=kORzczjxZzvDIkoIOtk5i96JfJoT0VaxY+Ci6Av2QBf2/H9kSjd2FDhQQKqpP397Q9 bhzJXDTPnDso+8/poseYb0PXT2ytg8Knn/r1UdwSPc4KMz2Vy+SrV3tFx0sS9SxORwwW Kc2/Xhzdug33tBh/2JljQPY/Y51yMJRtuxCb6bmbu2emXyhvrO0M2hxRun1Np+ezODdS mOF1QKxHnD5Hzdcr2baF+HHqIHsPl+F1jWxj3rNtVGPTHEzdjNpDa5QGrCQbBOQjtfLg ciIX/Np+v3EsWyC8d9WCz0Y1jNSyStGq3dPeuvbjWEN6UTso+2WSmKW3ostvqWZ+kGIH zNrQ== X-Gm-Message-State: AOAM530crGFbTNlNB4BDLyq5URoZWunLqnMNQiBCUEIKZ1Z66YtMKWga f8G+DmLYgJjrZPGqRcHV6gZHgQ== X-Received: by 2002:a17:90a:de1:: with SMTP id 88mr9072986pjv.124.1592164997299; Sun, 14 Jun 2020 13:03:17 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.178]) by smtp.gmail.com with ESMTPSA id 205sm11857378pfc.206.2020.06.14.13.03.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 13:03:16 -0700 (PDT) From: Kaaira Gupta To: Helen Koike , Shuah Khan , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham , hverkuil@xs4all.nl Cc: Kaaira Gupta Subject: [PATCH v2 2/2] media: vimc: Add a control to show test pattern colors' order Date: Mon, 15 Jun 2020 01:32:39 +0530 Message-Id: <20200614200239.18453-3-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200614200239.18453-1-kgupta@es.iitr.ac.in> References: <20200614200239.18453-1-kgupta@es.iitr.ac.in> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a control in VIMC to show the correct order of the colors for a given test pattern. The control can be accessed by using show_colors_order in v4l2-ctl Signed-off-by: Kaaira Gupta --- drivers/media/test-drivers/vimc/Kconfig | 2 ++ drivers/media/test-drivers/vimc/vimc-common.h | 1 + drivers/media/test-drivers/vimc/vimc-sensor.c | 34 +++++++++++++++++++ 3 files changed, 37 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-common.h b/drivers/media/test-drivers/vimc/vimc-common.h index ae163dec2459..52376ba6146b 100644 --- a/drivers/media/test-drivers/vimc/vimc-common.h +++ b/drivers/media/test-drivers/vimc/vimc-common.h @@ -20,6 +20,7 @@ #define VIMC_CID_VIMC_CLASS (0x00f00000 | 1) #define VIMC_CID_TEST_PATTERN (VIMC_CID_VIMC_BASE + 0) #define VIMC_CID_MEAN_WIN_SIZE (VIMC_CID_VIMC_BASE + 1) +#define VIMC_TEST_PATTERN_ORDER (VIMC_CID_VIMC_BASE + 2) #define VIMC_FRAME_MAX_WIDTH 4096 #define VIMC_FRAME_MAX_HEIGHT 2160 diff --git a/drivers/media/test-drivers/vimc/vimc-sensor.c b/drivers/media/test-drivers/vimc/vimc-sensor.c index a2f09ac9a360..da625f6accce 100644 --- a/drivers/media/test-drivers/vimc/vimc-sensor.c +++ b/drivers/media/test-drivers/vimc/vimc-sensor.c @@ -5,6 +5,7 @@ * Copyright (C) 2015-2017 Helen Koike */ +#include #include #include #include @@ -19,6 +20,7 @@ struct vimc_sen_device { struct v4l2_subdev sd; struct tpg_data tpg; u8 *frame; + bool show_colors_order; /* The active format */ struct v4l2_mbus_framefmt mbus_format; struct v4l2_ctrl_handler hdl; @@ -185,10 +187,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; struct vimc_sen_device *vsen = container_of(ved, struct vimc_sen_device, ved); tpg_fill_plane_buffer(&vsen->tpg, 0, 0, vsen->frame); + if (vsen->show_colors_order) { + tpg_calc_text_basep(&vsen->tpg, basep, 0, vsen->frame); + str = tpg_g_color_order(&vsen->tpg); + tpg_gen_text(&vsen->tpg, basep, 1, 1, str); + } + return vsen->frame; } @@ -200,6 +210,14 @@ static int vimc_sen_s_stream(struct v4l2_subdev *sd, int enable) if (enable) { const struct vimc_pix_map *vpix; unsigned int frame_size; + 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); /* Calculate the frame size */ vpix = vimc_pix_map_by_code(vsen->mbus_format.code); @@ -269,6 +287,9 @@ static int vimc_sen_s_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_SATURATION: tpg_s_saturation(&vsen->tpg, ctrl->val); break; + case VIMC_TEST_PATTERN_ORDER: + vsen->show_colors_order = ctrl->val; + break; default: return -EINVAL; } @@ -307,6 +328,17 @@ static const struct v4l2_ctrl_config vimc_sen_ctrl_test_pattern = { .qmenu = tpg_pattern_strings, }; +static const struct v4l2_ctrl_config vimc_sen_ctrl_order = { + .ops = &vimc_sen_ctrl_ops, + .id = VIMC_TEST_PATTERN_ORDER, + .name = "Show Colors Order", + .type = V4L2_CTRL_TYPE_BOOLEAN, + .min = 0, + .max = 1, + .step = 1, + .def = 1, +}; + static struct vimc_ent_device *vimc_sen_add(struct vimc_device *vimc, const char *vcfg_name) { @@ -323,6 +355,7 @@ static struct vimc_ent_device *vimc_sen_add(struct vimc_device *vimc, v4l2_ctrl_new_custom(&vsen->hdl, &vimc_sen_ctrl_class, NULL); v4l2_ctrl_new_custom(&vsen->hdl, &vimc_sen_ctrl_test_pattern, NULL); + v4l2_ctrl_new_custom(&vsen->hdl, &vimc_sen_ctrl_order, NULL); v4l2_ctrl_new_std(&vsen->hdl, &vimc_sen_ctrl_ops, V4L2_CID_VFLIP, 0, 1, 1, 0); v4l2_ctrl_new_std(&vsen->hdl, &vimc_sen_ctrl_ops, @@ -362,6 +395,7 @@ static struct vimc_ent_device *vimc_sen_add(struct vimc_device *vimc, /* Initialize the frame format */ vsen->mbus_format = fmt_default; + vsen->show_colors_order = vimc_sen_ctrl_order.def; return &vsen->ved; -- 2.17.1