Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp526639ybt; Fri, 26 Jun 2020 05:28:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmBL6opaku2dl6mwv0AA41+kkPkwB2GBvyGBmVTYhm48HlW2ofL0GqAapxpG0OCfSo9DXm X-Received: by 2002:aa7:d457:: with SMTP id q23mr983261edr.376.1593174537047; Fri, 26 Jun 2020 05:28:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593174537; cv=none; d=google.com; s=arc-20160816; b=u7n48IcuZeE1QTWTaxmQ8kLxnJGVDHrQ3Q283attocsAB2kIqi17Hq6Xe+Nsjri4an fIlUvptXELDkt6ete4TNhN0WJ/Nl4ilPa49B0EupNgWjr25l5wfi2jKy8jpsYMyUNinm bwEhkVVflz8I8b60KkT/f2GoC21VdBYnRN3JoFAhhcN+kElxsJ6r1tfB/QTSPHoQX8GO BJdvMBuN1SCXRpt+K/NCUbTPZTsbGyyvTN+GfQdchnqdZMS4q1Imh7riDqrBoFBPsSSw kl6yagNH5R5aj3lLvPqMJoekQvaVc8tZctp+zOR7d+UnLV+nGYJ1x20Tff8suAHkf0mn jOcg== 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=p5f1RM1G3Lr7GaMJ5iGuAFQEEYFL5B+QSi2APysRKNI=; b=XAEwkL+j65q0mgt2K97oGb4S97utVY3SqBDYu/oTDPm5v/ov5MT9KwYwoQOW/zIIOJ z2DzC+twxeN3Ldx8VYu5YwJS9mb0Xz+0Qx5T31e/5dr++UrnC+2Ke0hVBqVEMJ/Bg9gK Nrsqj1O/AsTlMfu8zORP3L5T/u29V7oXNYShuxGD7Mw05M7e7YQsSnSgjbXeTcLUNF+s 6YOop2RztCjI/RrEsYGhOKXcKmChkqoeVtcRf+JxqFOHJdSyOahpeRLbSaxA7+wBeaNN cR4o0oGoAjRoOre2s+H4Wq36VRL4Eo+e0WoemHOqiNQ49gsnBxQeKgdkJ6FnAIwPQNFx /d7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@es-iitr-ac-in.20150623.gappssmtp.com header.s=20150623 header.b=a23iiNBa; 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 do16si20530051ejc.166.2020.06.26.05.28.34; Fri, 26 Jun 2020 05:28:57 -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=a23iiNBa; 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 S1728634AbgFZLgr (ORCPT + 99 others); Fri, 26 Jun 2020 07:36:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726417AbgFZLgq (ORCPT ); Fri, 26 Jun 2020 07:36:46 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CB71C08C5C1 for ; Fri, 26 Jun 2020 04:36:46 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id u5so4537466pfn.7 for ; Fri, 26 Jun 2020 04:36:46 -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=p5f1RM1G3Lr7GaMJ5iGuAFQEEYFL5B+QSi2APysRKNI=; b=a23iiNBaUxL3nW/AdO8Tdz30NunqMdaEjkbQV+kC377vXiyaJJROWrwwhmHJux5NCA 4XWAIla57xiMXoZpx6VtZCmxiross13juEzHaII9vr/i53sqZiHDOITbistEULWkxq7F vEUPTctcHK009mdbDTzynlxYuwLU/RMKsmW4A6ilSjQV1zwbh8mvchSaMf7UKZNTj5Or sw/cV5HhKBrCVeWwJqHMbA/0ML/jdELRb/KEwTAe2ipUSB5SzgNwuJwvIECt3Ng7PSJd 92qCB/BnZVCpP2+wo88rHAvsWcaVKOM3Nuz0ZUkZYmQy3ulAPPxwlTr3OQVOtocyxJ2Z P+zA== 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=p5f1RM1G3Lr7GaMJ5iGuAFQEEYFL5B+QSi2APysRKNI=; b=YBZT+QHooov8hODvsPamNJUxxlDaWNbd/pKxlauj11QAPjMq9o7egZ/TdcfRoZfOPi Ee2qZEM01/gCRDMgfJE7qtXJfG9PMzlbxc4TB3J1qnvQBjSKUS0KVetqm3/loq8yf52r qRhpuR9GnlVji6PNeY1KCvqqKecuRph7BbKdUdjcjpchoVbwcV/Vp3o/4/Qlda6LwQrG xqKH6Gn9+EeDhA4WRT5PVvxBGtASLaSw2kh6RDUpl7G49cJ6YU1grdXPvig9WAkqdu4q g+8vBg60RzvLZS0nzhD4YYcOjn6hlCVovLGSDEo2bYVkCl/PpDpdg3c9fBwDKAVBbtKy T27w== X-Gm-Message-State: AOAM5330z/C7AtzReBwthyIK/PFpHvt2BCt3crpIfqTkAr0RnfDWX5Ie jrC1O8w5iFzcOjwvlqy00299Vn9o9xigIA== X-Received: by 2002:a62:5210:: with SMTP id g16mr2299849pfb.204.1593171405479; Fri, 26 Jun 2020 04:36:45 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.178]) by smtp.gmail.com with ESMTPSA id s9sm22578194pgo.22.2020.06.26.04.36.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2020 04:36:44 -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 v6 2/3] media: tpg: Add function to return colors' order of test image Date: Fri, 26 Jun 2020 17:06:17 +0530 Message-Id: <20200626113618.15280-3-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200626113618.15280-1-kgupta@es.iitr.ac.in> References: <20200626113618.15280-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 Currently there is no method to know the correct order of the colors for a test image generated by tpg. Write a function that returns a string of colors' order given a tpg. It returns a NULL pointer in case of test patterns which do not have a well defined colors' order. Hence add a NULL check for text in tpg_gen_text(). Signed-off-by: Kaaira Gupta Reviewed-by: Kieran Bingham --- drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 30 +++++++++++++++++-- include/media/tpg/v4l2-tpg.h | 1 + 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c index dde22a4cbd6c..c46ddd902675 100644 --- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c +++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c @@ -1959,12 +1959,14 @@ void tpg_gen_text(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2], unsigned step = V4L2_FIELD_HAS_T_OR_B(tpg->field) ? 2 : 1; unsigned div = step; unsigned first = 0; - unsigned len = strlen(text); + unsigned len; unsigned p; - if (font8x16 == NULL || basep == NULL) + if (font8x16 == NULL || basep == NULL || text == NULL) return; + len = strlen(text); + /* Checks if it is possible to show string */ if (y + 16 >= tpg->compose.height || x + 8 >= tpg->compose.width) return; @@ -2006,6 +2008,30 @@ void tpg_gen_text(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2], } EXPORT_SYMBOL_GPL(tpg_gen_text); +const char *tpg_g_color_order(const struct tpg_data *tpg) +{ + switch (tpg->pattern) { + case TPG_PAT_75_COLORBAR: + case TPG_PAT_100_COLORBAR: + case TPG_PAT_CSC_COLORBAR: + case TPG_PAT_100_HCOLORBAR: + return "white, yellow, cyan, green, magenta, red, blue, black"; + case TPG_PAT_BLACK: + return "Black"; + case TPG_PAT_WHITE: + return "White"; + case TPG_PAT_RED: + return "Red"; + case TPG_PAT_GREEN: + return "Green"; + case TPG_PAT_BLUE: + return "Blue"; + default: + return NULL; + } +} +EXPORT_SYMBOL_GPL(tpg_g_color_order); + void tpg_update_mv_step(struct tpg_data *tpg) { int factor = tpg->mv_hor_mode > TPG_MOVE_NONE ? -1 : 1; diff --git a/include/media/tpg/v4l2-tpg.h b/include/media/tpg/v4l2-tpg.h index 9749ed409856..0b0ddb87380e 100644 --- a/include/media/tpg/v4l2-tpg.h +++ b/include/media/tpg/v4l2-tpg.h @@ -252,6 +252,7 @@ void tpg_fillbuffer(struct tpg_data *tpg, v4l2_std_id std, bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc); void tpg_s_crop_compose(struct tpg_data *tpg, const struct v4l2_rect *crop, const struct v4l2_rect *compose); +const char *tpg_g_color_order(const struct tpg_data *tpg); static inline void tpg_s_pattern(struct tpg_data *tpg, enum tpg_pattern pattern) { -- 2.17.1