Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1591277ybt; Thu, 18 Jun 2020 12:18:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwL/QCwfaUFJ055M+1n80v00dKncsu0w3PeYsSLS7M/90svCCkKYu6NxU/y84ahJBSR3Qge X-Received: by 2002:a05:6402:3c2:: with SMTP id t2mr5527150edw.361.1592507902960; Thu, 18 Jun 2020 12:18:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592507902; cv=none; d=google.com; s=arc-20160816; b=tjUwWf6HHjdLudIhCO/liLJLVn/8Bx3rgdi4MqrmiFd/ILr/tGP0rAfoYosVSugkkB rgYUtC8TF3mcSd0TRUu/mAOMGos0aODe42pNeYoR0WTFMebxhG0BpMGdIBPjmbGKE4t9 Qvg0zLLgLz3tsGLfSj2OW57EMeDEhO7ZXiYdnNENU6ZNZNYYbTFs22Gi7XzLSgqaoe8M /gnpZdhfMHD+LObaPobPCS1wC/u3hOS6gmGeHsL/HAB8xXqCKFcgNAjr646BpRBnfWKG gxV8zJZyICqk09HRhMqDAfRwhUDP59D06vNqwML85o/X3uqGrvns2vItu3F11nVxB1P1 oolw== 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=H1wsNmA8Mngd+wHBq55NeILzfWgtbgUC8EqZWS9mmiw=; b=XqzjdtoKmB6h/CMvN+Fc5SXIfcRL7+25hvCTOWR78fdvdyaqT1pzs06JE2oTpUYphj oqSbhMV0iiUlSrP3MI8UMxoSkbsh5wHPPr3GMp54eAgWVEPG5tSEXPV6LJk3SrcEnjEg eFAB3wQd13vA51Sbsf7ryuo5bVprSfdATnElB8R62uu80jBJyebA2J9fPL696DbYwDm2 5qVE0BTgjE1BbyMGh5/PkryYInGzp4BzWDGyUpykcwZHBJy/BPGB2yV7ZFVhCQt2XC4J 354H3mtQZZ1jBCRGiiEDu2VxQ3hsxMK0HLqZpjydwR0pyYeAyx0mdUoJQ6/rGjtns7WH JDrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@es-iitr-ac-in.20150623.gappssmtp.com header.s=20150623 header.b=LsUufmD3; 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 w26si2401944edq.285.2020.06.18.12.18.00; Thu, 18 Jun 2020 12:18:22 -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=LsUufmD3; 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 S1730012AbgFRTFb (ORCPT + 99 others); Thu, 18 Jun 2020 15:05:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729808AbgFRTFa (ORCPT ); Thu, 18 Jun 2020 15:05:30 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57865C06174E for ; Thu, 18 Jun 2020 12:05:30 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id p3so641828pgh.3 for ; Thu, 18 Jun 2020 12:05:30 -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=H1wsNmA8Mngd+wHBq55NeILzfWgtbgUC8EqZWS9mmiw=; b=LsUufmD3ym6mZjvWAcpJ1LfnDw8Yaw+duReCoBt4aU9VvlIMClQOcjv5kUEK5dYK83 AXEhbj5sM3DWtaxsTmQQdEnUrY06Hje+K+QKq8nXNkkuRsFmi8U/daKDvdZGlFSDYOpe nzcavmYvW0KgEjfdegUerh7uR47EH1c24M1yf/c+L/xuKKyrl6zvb3pWEDm2i7u1jtaA N2xjwGFMHnseA2AP6l/gnbQYx54yhKd0+jwnHbzhC2CrDnjZlSRaIgIx0l/Ar58g6MEg 1z40wJENnC7/xzfYTN0O7QWoyPEoH7p2N9nUPOObuAWwvKqU1bBDe7wLgHjRDhOaH//M QaSg== 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=H1wsNmA8Mngd+wHBq55NeILzfWgtbgUC8EqZWS9mmiw=; b=WUs19URkxiX+TyvxvH5aW3hARg+lnd/nXlCDA05SD151h76IXuQdxhY/x3hj2x9/53 LkWgN7Ww2vEx5KgaA1pZ302xwHWy5XPo3fme1gIQQKp01uT9AVdmpE+s7xQusnx91ROD e+FDZymjLp7SxMk9telGLZa4qcqsYp0wyo3+qOB7u0Iagm6T8GUFVFHh2HaKIEp6qVHt BTz9USyMADfkpxH83Ve1j3SKoEUZj6MsdH/dY3Ano22wJM0HrTd5K/J5QYglWO9oXfQw wvnIjpwcca3HKus9+OrHl4zoECDzs4eZjztEVQLNaBAye2DQniFmEeWRATwtMdaF87Tx nzqw== X-Gm-Message-State: AOAM5314JzRyhkuw0KsHRL4PAXhgKm1daD9HY1H3U5hgP1eRbogDyR5s 8SP62WMxcQ8vYID2i/NYVaoHGA== X-Received: by 2002:a63:1624:: with SMTP id w36mr58613pgl.144.1592507129761; Thu, 18 Jun 2020 12:05:29 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.178]) by smtp.gmail.com with ESMTPSA id j36sm3291290pgj.39.2020.06.18.12.05.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2020 12:05:29 -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 v3 1/2] media: tpg: Add function to return colors' order of test image Date: Fri, 19 Jun 2020 00:35:05 +0530 Message-Id: <20200618190506.11892-2-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200618190506.11892-1-kgupta@es.iitr.ac.in> References: <20200618190506.11892-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 | 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..31e6044a4104 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) +{ + #define COLORBAR(order) #order "white, yellow, cyan, green, magenta, red, blue, black" + + switch (tpg->pattern) { + case TPG_PAT_75_COLORBAR: + case TPG_PAT_100_COLORBAR: + case TPG_PAT_CSC_COLORBAR: + return COLORBAR(Left to right:); + case TPG_PAT_100_HCOLORBAR: + return COLORBAR(Top to bottom:); + 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