Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp354925imm; Wed, 18 Jul 2018 03:24:24 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe4Ex5/pEaRYnBd5sDDWsyU7TZzWriHiMP/xakSi+UnEW4iauGSiKkGWUCHLtrEpqWOndfg X-Received: by 2002:a63:8042:: with SMTP id j63-v6mr5206295pgd.230.1531909464210; Wed, 18 Jul 2018 03:24:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531909464; cv=none; d=google.com; s=arc-20160816; b=LwBSMglh0CCmIkQ1WlbJsYTY/mBgkKmIjt1JSQqpqWf3EcWyrPLZylDewHIWKkx4Kj z+oc+ZWcBxn1aVqdlqZAoaXADcRRdUcOtW5fCldrXstZ4ROrMG8kt3BpXcTcYj7mNsv6 NziJCoV67mIzsVb7rygS+pp+GZ0b8pSEecBBpY5bJvlW4LAhAZlkX5z99dw89ARLjwzK szAwzks0LBMuzb8iMD7gCxfEQa+Q6af64AmeljOHyIJyujcCfqY+wwFduDjutpEr6KPx d7iIl16uKa2y2XyW6lA/SkhtyZCYP7Da1ndpFqyyf0uDFywvZ75HtMSlHw32nAsvAuVP k67A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=4+0/r/p3s8hywUVocF5O6Mqho59qcS8etJ0yASnCxyI=; b=bV8i6EaIeQ8LyK+6glsL0gSKo2gldsWEE0rgDqy7pjno68dDgIowUHQRd5lwiogHbk kZjI9RGvxpCXz4Pzn7Mt0UsPlY7SePXNFn8hsufznhua6BwpumypkLKWzW6M1ucHJgpc mAPa+ujp6CQ7M/Bd8SCyizmEzf1qX2sJVC+Q6b4TJns66LToNRaqxibanzK7sbH5Ojx1 57mWk3EGz7oh/c/BFU4eiUL47rAA9oMf+0Hitbfg9/7wPWp86RC6Ld21cBwp0NhAjHOA +aHQK8Dw9ekXcpUOOaaxojQBLc1EYR3YsppeNO9G81vMK0rSF9VxzzONxPTpWJYhN8OE CAVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l196-v6si2934476pga.38.2018.07.18.03.24.09; Wed, 18 Jul 2018 03:24:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730974AbeGRK7t (ORCPT + 99 others); Wed, 18 Jul 2018 06:59:49 -0400 Received: from mga04.intel.com ([192.55.52.120]:35977 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726064AbeGRK7t (ORCPT ); Wed, 18 Jul 2018 06:59:49 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jul 2018 03:22:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,369,1526367600"; d="scan'208";a="57446251" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by orsmga007.jf.intel.com with SMTP; 18 Jul 2018 03:21:52 -0700 Received: by stinkbox (sSMTP sendmail emulation); Wed, 18 Jul 2018 13:21:52 +0300 Date: Wed, 18 Jul 2018 13:21:52 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Brian Starkey Cc: Ayan Kumar Halder , airlied@linux.ie, liviu.dudau@arm.com, dri-devel@lists.freedesktop.org, peter.ujfalusi@ti.com, laurent.pinchart@ideasonboard.com, afd@ti.com, maxime.ripard@bootlin.com, linux-rockchip@lists.infradead.org, wens@csie.org, tomi.valkeinen@ti.com, malidp@foss.arm.com, intel-gfx@lists.freedesktop.org, rodrigo.vivi@intel.com, nd@arm.com, linux-arm-kernel@lists.infradead.org, sre@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/5] drm/fourcc: Add is_yuv field to drm_format_info to denote if the format is yuv Message-ID: <20180718102152.GV5565@intel.com> References: <1531847626-22248-1-git-send-email-ayan.halder@arm.com> <20180718091202.GA27151@DESKTOP-E1NTVVP.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180718091202.GA27151@DESKTOP-E1NTVVP.localdomain> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 18, 2018 at 10:12:02AM +0100, Brian Starkey wrote: > Hi Ayan, > > On Tue, Jul 17, 2018 at 06:13:42PM +0100, Ayan Kumar Halder wrote: > >A lot of drivers duplicate the function to check if a format is yuv or not. > >If we add a field (to denote whether the format is yuv or not) in the > >drm_format_info table, all the drivers can use this field and it will > >prevent duplication of similar logic. > > This looks like a good idea to me. > > I wonder if the two "has_alpha" and "is_yuv" bools should be bitfields > to reduce the footprint (not sure what the general DRM attitude to > bitfields is), but either way: There are quite a few of these so tighter packing (of the other fields as well perhaps) might be a decent idea. For the series (except for the omapdrm patch which I'll leave for Tomi): Reviewed-by: Ville Syrj?l? > > Reviewed-by: Brian Starkey > > > > >Signed-off-by: Ayan Kumar halder > >--- > > drivers/gpu/drm/drm_fourcc.c | 42 +++++++++++++++++++++--------------------- > > include/drm/drm_fourcc.h | 2 ++ > > 2 files changed, 23 insertions(+), 21 deletions(-) > > > >diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c > >index 5ca6395..35c1e27 100644 > >--- a/drivers/gpu/drm/drm_fourcc.c > >+++ b/drivers/gpu/drm/drm_fourcc.c > >@@ -152,27 +152,27 @@ const struct drm_format_info *__drm_format_info(u32 format) > > { .format = DRM_FORMAT_XBGR8888_A8, .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true }, > > { .format = DRM_FORMAT_RGBX8888_A8, .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true }, > > { .format = DRM_FORMAT_BGRX8888_A8, .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true }, > >- { .format = DRM_FORMAT_YUV410, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4 }, > >- { .format = DRM_FORMAT_YVU410, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4 }, > >- { .format = DRM_FORMAT_YUV411, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1 }, > >- { .format = DRM_FORMAT_YVU411, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1 }, > >- { .format = DRM_FORMAT_YUV420, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2 }, > >- { .format = DRM_FORMAT_YVU420, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2 }, > >- { .format = DRM_FORMAT_YUV422, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1 }, > >- { .format = DRM_FORMAT_YVU422, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1 }, > >- { .format = DRM_FORMAT_YUV444, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1 }, > >- { .format = DRM_FORMAT_YVU444, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1 }, > >- { .format = DRM_FORMAT_NV12, .depth = 0, .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2 }, > >- { .format = DRM_FORMAT_NV21, .depth = 0, .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2 }, > >- { .format = DRM_FORMAT_NV16, .depth = 0, .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1 }, > >- { .format = DRM_FORMAT_NV61, .depth = 0, .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1 }, > >- { .format = DRM_FORMAT_NV24, .depth = 0, .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1 }, > >- { .format = DRM_FORMAT_NV42, .depth = 0, .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1 }, > >- { .format = DRM_FORMAT_YUYV, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 }, > >- { .format = DRM_FORMAT_YVYU, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 }, > >- { .format = DRM_FORMAT_UYVY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 }, > >- { .format = DRM_FORMAT_VYUY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 }, > >- { .format = DRM_FORMAT_AYUV, .depth = 0, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true }, > >+ { .format = DRM_FORMAT_YUV410, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true }, > >+ { .format = DRM_FORMAT_YVU410, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true }, > >+ { .format = DRM_FORMAT_YUV411, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true }, > >+ { .format = DRM_FORMAT_YVU411, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true }, > >+ { .format = DRM_FORMAT_YUV420, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true }, > >+ { .format = DRM_FORMAT_YVU420, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true }, > >+ { .format = DRM_FORMAT_YUV422, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true }, > >+ { .format = DRM_FORMAT_YVU422, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true }, > >+ { .format = DRM_FORMAT_YUV444, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true }, > >+ { .format = DRM_FORMAT_YVU444, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true }, > >+ { .format = DRM_FORMAT_NV12, .depth = 0, .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true }, > >+ { .format = DRM_FORMAT_NV21, .depth = 0, .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true }, > >+ { .format = DRM_FORMAT_NV16, .depth = 0, .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true }, > >+ { .format = DRM_FORMAT_NV61, .depth = 0, .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true }, > >+ { .format = DRM_FORMAT_NV24, .depth = 0, .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true }, > >+ { .format = DRM_FORMAT_NV42, .depth = 0, .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true }, > >+ { .format = DRM_FORMAT_YUYV, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true }, > >+ { .format = DRM_FORMAT_YVYU, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true }, > >+ { .format = DRM_FORMAT_UYVY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true }, > >+ { .format = DRM_FORMAT_VYUY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true }, > >+ { .format = DRM_FORMAT_AYUV, .depth = 0, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true }, > > }; > > > > unsigned int i; > >diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h > >index 3e86408..f9c1584 100644 > >--- a/include/drm/drm_fourcc.h > >+++ b/include/drm/drm_fourcc.h > >@@ -39,6 +39,7 @@ struct drm_mode_fb_cmd2; > > * @hsub: Horizontal chroma subsampling factor > > * @vsub: Vertical chroma subsampling factor > > * @has_alpha: Does the format embeds an alpha component? > >+ * @is_yuv: Is it a YUV format? > > */ > > struct drm_format_info { > > u32 format; > >@@ -48,6 +49,7 @@ struct drm_format_info { > > u8 hsub; > > u8 vsub; > > bool has_alpha; > >+ bool is_yuv; > > }; > > > > /** > >-- > >2.7.4 > > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Ville Syrj?l? Intel