Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp73342iof; Sun, 5 Jun 2022 21:31:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznJT11jVzern5JNUZU6rO+kuF+gYj9mN6Bx4PjoKoWzui6gV7fPu2fxD1fGf3sNFNZGZxt X-Received: by 2002:a17:90b:4c88:b0:1e6:71da:5eb0 with SMTP id my8-20020a17090b4c8800b001e671da5eb0mr25874942pjb.185.1654489899670; Sun, 05 Jun 2022 21:31:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654489899; cv=none; d=google.com; s=arc-20160816; b=hT7EeYD4TN5o+z+V+VHHTKwE8ligvKLEkVVMmGbdR8AJCj/Cj+zMeD9aKcPJQaK4OT E4t/M6tcZdf0c3gxPipVeqzv/RoDoqXL8lP5fJNieRvhIBdRRmm9lVRlScoZDy/+jW/C KPc8VItbKvgt5dvldkZtzpXc/nRTHae4lkIxF3fWgI6EwEVFwpP3nYCaqB5BUBNboLsF mW83Im575+HhkzaNqBY2acLb6x5VbNbvm7UF9nxpXIMFk05keP2ompJbtTnK5SPg/V2Q VCvfSI/2bOs56I3EDR+ISFr+YSYZ1e6HYj2uL5fHnjmQWW67TR4w4tNHNf47+bkSOPnR pNaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=5bhrsVbOt2m6AZ0xVRCzidiDFV620CkfVfQEKPk5euQ=; b=f9TCA3JUw5t1fxiT6WdWvOPjDtv39nxpa0la/3MicjD25WjIbNGdmORnoZXInuTXLh hHVUI/kshjNioK6SssoLOQB7D862XSDklLIuwO+YtyPkWk36yK5lh1tcuWeDfZ3PuyiW Xx09Hslh4MMqmaXkLDhAYfAbTDQ0mr7swkCmXgk7NUrOMd6Gx2BtDfYOjrIhsiqVGHQl XfG71zdNxVesMRl6NjobogT796ypFEBF0BwmzNfuJEOgzpp2obSz9CIdYrN7n/lG6RwE SGKkvvIHewdfDL8xxuiCBYmlMwGXZhm1AcVjyX+LmzE+ZVstpXpKM9F/IBTZWTJc3/HX H0bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=GJyBuTsV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id bm12-20020a656e8c000000b0039d678a64e2si19680696pgb.232.2022.06.05.21.31.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 21:31:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=GJyBuTsV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E53C91209C; Sun, 5 Jun 2022 20:57:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237375AbiFBRIM (ORCPT + 99 others); Thu, 2 Jun 2022 13:08:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236798AbiFBRIL (ORCPT ); Thu, 2 Jun 2022 13:08:11 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 615415D1AA for ; Thu, 2 Jun 2022 10:08:09 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id m32-20020a05600c3b2000b0039756bb41f2so3081401wms.3 for ; Thu, 02 Jun 2022 10:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=5bhrsVbOt2m6AZ0xVRCzidiDFV620CkfVfQEKPk5euQ=; b=GJyBuTsVd74HWVHwaPxWWXx24QFGP0g30a3CVD6NI1PguzZ0ZFv3Ofr8YV+JE7GOin GLr84vVIJZxX3KTnUf7JsE2m7R+uHXFbJxBAe/1qs/aSRVwgplSb04tI2ekuXt/X/Cpl XABtcP0oqp3vmgo3TivEdvltUiC0y6UO+JIEO7Yw4NcTNE6W6Ma38uTZoMwztxgS1591 2NAZQsTVCFJ3niSvdIziaxGCqeN7M2HZEQuTA3uKFRX61uC3s0ojzd1QAVbFOKwEpqpL eIzbOCIVSzFSleXYXbYcJqPixqK3hEe1+dpC8NjocG8+5YyiIRo+ZoV3x2qTaEFFnvIT rqsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=5bhrsVbOt2m6AZ0xVRCzidiDFV620CkfVfQEKPk5euQ=; b=BKRtDKHDUVbgwqIXUoKfSU1hHFYCNCOBxR9/6cX1XAggmgpASwiGstfgPLqibVEAey 26a4apwt+qkY5JXJV8c6lzAxi2Vlfz6xgOSgQSg0wqpAW0/wMsm1g0EHv8bXqTI1U2dO qF7HwrlUDNYQPxoILXgp6I2OvrV8QTYLIkW14Rh9QYI2iAU0PPiM0Af3XjdoasNswj1Z eAF+IueQXnRq3QizcPW9Q3wiXBxllS45BF2+0uYUji8HndUoaiodi2DFajq8pk9opetW 5z8K0yVcl+YROwjbeYX0M4BGV1Ga/ts/j0wPC83pZD0sR2lb0rabwuF58sYL+hJ0MHDp od3Q== X-Gm-Message-State: AOAM5324y11AmlFOqzhXl858d5rijuRZzn8FC0GzpyvGouIuxfKRM+AN /6AVhVqVA/7p2Q82fqkX0ZJRJg6yNzWOe+QNiHxJ4Q== X-Received: by 2002:a05:600c:3549:b0:397:8f09:1abe with SMTP id i9-20020a05600c354900b003978f091abemr4855227wmq.107.1654189687735; Thu, 02 Jun 2022 10:08:07 -0700 (PDT) MIME-Version: 1.0 References: <20220530102017.471865-1-jose.exposito89@gmail.com> <20220530102017.471865-2-jose.exposito89@gmail.com> In-Reply-To: From: David Gow Date: Thu, 2 Jun 2022 10:07:56 -0700 Message-ID: Subject: Re: [RFC PATCH 1/1] drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb332() To: Javier Martinez Canillas Cc: =?UTF-8?B?Sm9zw6kgRXhww7NzaXRv?= , tzimmermann@suse.de, maarten.lankhorst@linux.intel.com, mripard@kernel.org, David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, Linux Kernel Mailing List , Daniel Latypov , KUnit Development Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 2, 2022 at 9:27 AM Javier Martinez Canillas wrote: > > Hello Jos=C3=A9, > > On 5/30/22 12:20, Jos=C3=A9 Exp=C3=B3sito wrote: > > Test the conversion from XRGB8888 to RGB332. > > > > What is tested? > > > > - Different values for the X in XRGB8888 to make sure it is ignored > > - Different clip values: Single pixel and full and partial buffer > > - Well know colors: White, black, red, green, blue, magenta, yellow > > and cyan > > - Other colors: Randomly picked > > - Destination pitch > > > > Suggested-by: Javier Martinez Canillas > > Signed-off-by: Jos=C3=A9 Exp=C3=B3sito > > --- > > Thanks a lot for working on this! It's very cool to see the first KUnit > tests added to DRM :) > > > drivers/gpu/drm/Kconfig | 12 ++ > > drivers/gpu/drm/Makefile | 3 + > > drivers/gpu/drm/drm_format_helper_test.c | 166 +++++++++++++++++++++++ > > 3 files changed, 181 insertions(+) > > create mode 100644 drivers/gpu/drm/drm_format_helper_test.c > > > > diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig > > index e88c497fa010..d92be6faef15 100644 > > --- a/drivers/gpu/drm/Kconfig > > +++ b/drivers/gpu/drm/Kconfig > > @@ -76,6 +76,18 @@ config DRM_KMS_HELPER > > help > > CRTC helpers for KMS drivers. > > > > +config DRM_FORMAR_HELPER_TEST > > I wonder if we want this level of detail for the test Kconfig symbols. > Maybe we could just have a DRM_KUNIT_TEST symbol that will enable all > the KUnit test suites for DRM ? > > > + bool "drm_format_helper tests" if !KUNIT_ALL_TESTS > > + depends on DRM && KUNIT=3Dy > > + select DRM_KMS_HELPER > > Daniel didn't like this `select DRM_KMS_HELPER` and I think that we can a= void > it if instead drm_format_helper_test.c is included in drm_format_helper.c= , i.e: > > diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_fo= rmat_helper.c > index a3ccd8bc966f..d63e02da528f 100644 > --- a/drivers/gpu/drm/drm_format_helper.c > +++ b/drivers/gpu/drm/drm_format_helper.c > @@ -692,3 +692,7 @@ void drm_fb_xrgb8888_to_mono(void *dst, unsigned int = dst_pitch, const void *vadd > kfree(src32); > } > EXPORT_SYMBOL(drm_fb_xrgb8888_to_mono); > + > +#ifdef DRM_KUNIT_TEST > +#include "drm_format_helper_test.c" > +#endif > > This also has the advantage that will allow to have KUnit tests for the s= tatic > functions that are only available in the drm_format_helper.c compilation = unit. > > > obj-$(CONFIG_DRM_DEBUG_SELFTEST) +=3D selftests/ > > +obj-$(CONFIG_DRM_FORMAR_HELPER_TEST) +=3D drm_kms_helper.o \ > > + drm_format_helper_test.o > > And doing that will also allow you to get rid of this, since just selecti= ng > CONFIG_DRM_KUNIT_TEST=3Dy would be enough for the tests built and run by = KUnit. > This is definitely something other KUnit tests (apparmor, elf, etc) are doing, and it's generally fine. You do lose the ability to build the tests as a separate module, though. (This is not usually a big problem, but there are some cases where it's useful.) That being said, I don't think 'select' is enough of a problem that you should feel the need to refactor in this way just to avoid it. Given most of the other DRM drivers (as well as DRM_DEBUG_SELFTEST) are select-ing DRM_KMS_HELPER, it seems like a sensible enough thing to continue doing for the KUnit test. As Daniel pointed out, as a hidden option it was clearly always meant to be select-ed anyway. Cheers, -- David