Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2012800ybi; Sat, 13 Jul 2019 05:04:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhTBacBrlGQDwMRSRLh7T3hE3i1j0/sazF8U8n1FaaZN0sXH14DLrqCoNzkIeoigfopiPb X-Received: by 2002:a65:6415:: with SMTP id a21mr8217895pgv.98.1563019498835; Sat, 13 Jul 2019 05:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563019498; cv=none; d=google.com; s=arc-20160816; b=reWmm+K8an35xcXrsDGM4nKPx8W20IitakeWsg2kOTK4IUlEdSMXlhFLLPL11u5+LP 6VuxyGyqA+ktDVW9eNQHQvMQ4el5j4oIXyTm93lFGtFtNHwG78MRV22KOE2vZ3xbEPnY 6MGH2ZOPPZQgR3AlfBYdHV2MeV8x3PFwnVFA69DYZieJ2sY9mLULSDnLVxzWNsoiePfe 0WYR5rkXUd6hdTVuT485f0WMx4F2Oso3n8qozTpRTWjjUXmNI+eNcP5aDInkWB/vR2bW SVaL7r8K9r6K3uBcalCPiWU6FCzmB+Lf7F4wgBpRzYvEKahIIX3GW6mOo6M16J/rJQ25 URcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ZSwMABmGQAZrucIG+5wnN1jDBeDy54vc//cUxgIs9xE=; b=uS6HtThCE2CDCqokznahN7l81W8EFdBogv5+d+euatbxH1jwaz7oQA9HjwEooqyZC6 eWsBuddRdTzqHjCyYrp4oAQ0QchJxgQJOyt6GEeXuwNdsms/kErgSBg3XBxWayqwrHQF MZcE1TIwX9n8OaCEYag8NdZzIjIF3iLepuyRKNJ5l6Hc/AsOds+s9/dQID+QgFq0N8wG dxe0YzKH7gDLE8QKbSJrivDyAvAUMdwh3nj51gMImCWIaK8y4Z0QTkmguIkxOCYw+RNg mdWveweOMQZcmVs6xTdigTivFfPvERV5SfONqq7h4rrfWJzND5x6pCN7ik6x69UvEMkC MXyw== 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=siol.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j191si10661547pgc.73.2019.07.13.05.04.31; Sat, 13 Jul 2019 05:04:58 -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=siol.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727781AbfGMMED (ORCPT + 99 others); Sat, 13 Jul 2019 08:04:03 -0400 Received: from mailoutvs7.siol.net ([185.57.226.198]:35153 "EHLO mail.siol.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727739AbfGMMEC (ORCPT ); Sat, 13 Jul 2019 08:04:02 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Zimbra) with ESMTP id 5CF29520E52; Sat, 13 Jul 2019 14:03:59 +0200 (CEST) X-Virus-Scanned: amavisd-new at psrvmta12.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta12.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id bZRhldBXFahl; Sat, 13 Jul 2019 14:03:59 +0200 (CEST) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Zimbra) with ESMTPS id 0566252059A; Sat, 13 Jul 2019 14:03:59 +0200 (CEST) Received: from localhost.localdomain (cpe-194-152-11-237.cable.triera.net [194.152.11.237]) (Authenticated sender: 031275009) by mail.siol.net (Zimbra) with ESMTPSA id AC240520778; Sat, 13 Jul 2019 14:03:56 +0200 (CEST) From: Jernej Skrabec To: maxime.ripard@bootlin.com, wens@csie.org Cc: airlied@linux.ie, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH 1/3] drm/sun4i: Introduce color encoding and range properties Date: Sat, 13 Jul 2019 14:03:44 +0200 Message-Id: <20190713120346.30349-2-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190713120346.30349-1-jernej.skrabec@siol.net> References: <20190713120346.30349-1-jernej.skrabec@siol.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to correctly convert YUV color space to RGB, we have to know color encoding and range. Introduce these two properties using helper method. Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun= 4i/sun8i_vi_layer.c index bd0e6a52d1d8..240a800217df 100644 --- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c +++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c @@ -441,6 +441,7 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct= drm_device *drm, struct sun8i_mixer *mixer, int index) { + u32 supported_encodings, supported_ranges; struct sun8i_vi_layer *layer; unsigned int plane_cnt; int ret; @@ -469,6 +470,22 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struc= t drm_device *drm, return ERR_PTR(ret); } =20 + supported_encodings =3D BIT(DRM_COLOR_YCBCR_BT601) | + BIT(DRM_COLOR_YCBCR_BT709); + + supported_ranges =3D BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) | + BIT(DRM_COLOR_YCBCR_FULL_RANGE); + + ret =3D drm_plane_create_color_properties(&layer->plane, + supported_encodings, + supported_ranges, + DRM_COLOR_YCBCR_BT709, + DRM_COLOR_YCBCR_LIMITED_RANGE); + if (ret) { + dev_err(drm->dev, "Couldn't add encoding and range properties!\n"); + return ERR_PTR(ret); + } + drm_plane_helper_add(&layer->plane, &sun8i_vi_layer_helper_funcs); layer->mixer =3D mixer; layer->channel =3D index; --=20 2.22.0