Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1174926ybt; Sun, 14 Jun 2020 13:07:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4dTRcT7r8l4M+MFtFctC9WpTs/OY43HlgPVHs99T/KEsnjhqqvS9fbGevNkfnqUS3gudK X-Received: by 2002:a05:6402:1bdc:: with SMTP id ch28mr20401962edb.19.1592165262747; Sun, 14 Jun 2020 13:07:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592165262; cv=none; d=google.com; s=arc-20160816; b=Aa6ILaCnqLR2t9Rb7rB+if3aNqB7An63LzcKOsLzeKsEcHWSHtzp+gawKuCdH5gh/+ 934W7AvQr0YNiARZU0AnwhtWnpGA1UpOS58rdy24tNPsdPNOhIsoWjxuVAUqC9bQ5N0W utVcqhDazvvMbfQDGyFZ7PjPqfax1hV90HnonET0ajnqwgexPvhirSgfWsL0A4dCZjIH H3C5MZhaiJ4rj5X0g82R0PHIECEGWCCig84rJ7ci5ennkVpW5SK5OUjRu+i0lx5fJABP dFPhBFJlVTEj20a45IHH2voX7SWXrRCVk//ohlp2cGnPi1oHHaJf2oEPMMow3DFKbCD/ +0Tg== 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=hJ6GC13zka0pJMo4tc0WgRU/nRZXx91afeYjyr29+3A=; b=BeOSnKUKDrjkk0FOH6zXqxj5I5urhlQN2whj3jWKvfr6EqDqMFoYA5l+mIVezX5FwO ucLenuRmyMs+kKYpKEEHKYopDR3V3yTa80193/XO8YPABmHSU4b2sVbPBgavN/49aJQH yrN+mKuQIb4BShC5+GkztkVcg0MOe2qKCp3RcfK+wIUhO71QEzyiW+PWipaeju4Q3ZSe rYK/9X5cxhM/h7rbVqDAp9R/VCQDooo0lf8gbP316nGOsjSAwd/aKqV3yobTOmKtjG7i bm5kh0Ka18nyw23kDgfxznvuFOqVKGWtiw7cHegImX+66kddo3QlGE/iyM0j6HJy/xUN BPUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@es-iitr-ac-in.20150623.gappssmtp.com header.s=20150623 header.b=W0Nk0PHb; 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 l8si7787623edn.346.2020.06.14.13.07.20; Sun, 14 Jun 2020 13:07:42 -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=W0Nk0PHb; 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 S1727954AbgFNUDQ (ORCPT + 99 others); Sun, 14 Jun 2020 16:03:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726844AbgFNUDN (ORCPT ); Sun, 14 Jun 2020 16:03:13 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CECE7C08C5C2 for ; Sun, 14 Jun 2020 13:03:13 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id g12so5899235pll.10 for ; Sun, 14 Jun 2020 13:03:13 -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=hJ6GC13zka0pJMo4tc0WgRU/nRZXx91afeYjyr29+3A=; b=W0Nk0PHbG0fBlaoxWA33a9ok01/c9qerIIoTJNwj+Z4D5/4TCldY+z4n7Rmi+QbcNR qsCe+JE7/zlF3SamQ/+8r+wkVBt36H8vugSPb6zmhbDBdwS0hEOcQ3BB1u2n725mofgf 4qUQR5gFYDof9s7d/HGLAqJs2A25cUpjrYbOcAlRE3+mWA5NmIKMTITVqGPKC9pc/sg7 uZk/1OYHVHq5pQy3+RDj8V+sk+LXrilmxRJW+PhkXSf//h/xeSqlqX0COz0mM1rbF/Os hr0F9FVaCVx6XzJ7sUfpgrl9g2/FbD4in2QkXyRfH35ypu2Xeq3m8wXBML0jjOlVl3xD PTsA== 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=hJ6GC13zka0pJMo4tc0WgRU/nRZXx91afeYjyr29+3A=; b=GXnNTscWm0YqoxBL1vRlcDxCqkg94KUvANlrKg2xpn2uZvrk9sCCiyvKQHgPQL+QQ0 Ao/oNtDEPwtNJNEvqsBOfqOHqrn5YUlYz+tz4Xu6e4uztkmIWmLqL7uXsZH/n966BLhO xccGYYNDXNvEIYaqlNWYfE2Z0YFkk74PrLkglbXpQzyYKVpX3s4Ys86RkydfifRKiOKs h90aC9OO/+UDfBbGKMvqFHn3bTTILoPMAJX61ENo4jWMcZqx5jDE/6nEgL0a7Gqb+ny8 zrGbNaC0a1JQx7lFtnxxpBi8m/BPUMX3AtUIcQy2XEALEiQDi942gLKk2+7hJf5R919d uq2w== X-Gm-Message-State: AOAM531rr8Y+BspYxMpcW8qwx5NW/yKY68JBmG/1/FhcC0Gic4hMUzDe bQFcSfcyMhg7NdS4MmZ4nAYz1v3JxZ6rbw== X-Received: by 2002:a17:90a:ed8f:: with SMTP id k15mr7881790pjy.63.1592164993242; Sun, 14 Jun 2020 13:03:13 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.178]) by smtp.gmail.com with ESMTPSA id y12sm1143912pfm.158.2020.06.14.13.03.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 13:03:12 -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 1/2] media: tpg: Add function to return colors' order of test image Date: Mon, 15 Jun 2020 01:32:38 +0530 Message-Id: <20200614200239.18453-2-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 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 --- drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 32 +++++++++++++++++-- include/media/tpg/v4l2-tpg.h | 1 + 2 files changed, 31 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 50f1e0b28b25..c8257e860c6e 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,32 @@ void tpg_gen_text(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2], } EXPORT_SYMBOL_GPL(tpg_gen_text); +char *tpg_g_color_order(const struct tpg_data *tpg) +{ + switch (tpg->pattern) { + case TPG_PAT_75_COLORBAR: + return "Left to right: white, yellow, cyan, green, magenta, red, blue, black"; + case TPG_PAT_100_COLORBAR: + return "Left to right: white, yellow, cyan, green, magenta, red, blue, black"; + case TPG_PAT_CSC_COLORBAR: + return "Left to right: white, yellow, cyan, green, magenta, red, blue, black"; + case TPG_PAT_100_HCOLORBAR: + return "Top to bottom: 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; + } +} + 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 eb191e85d363..4f79cac87b85 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); +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