Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2013637imu; Fri, 14 Dec 2018 04:31:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/WF1NrMPRC0/DV0fLv1B0p2dKRbamlWYfhNxtZyNNL6Um1t0q9MAcdEkC63DIgswDZsnyEQ X-Received: by 2002:a17:902:830a:: with SMTP id bd10mr2696012plb.321.1544790666160; Fri, 14 Dec 2018 04:31:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544790666; cv=none; d=google.com; s=arc-20160816; b=GRW0evLSuOdlFimC7HTxIehCCCFjs+TxIQlxbT6f6G95x3bJGbMX8HF7eMGMHrFV3D SmYQoSXRFI0GZ6MwnE7RHNWCM8jnC6gFVIzwcjwIJlPDs+g0D2uQdLl4A6xsINVQN2ay Jp7jMRJdjc2r3B9a0ncRuCIczMVFszGj3PALkLjyOvi1Hhs86rXnbCa2F0R2YKHKvWpD DeaC6YwwSpcyRXuPRBBJG2iW6INQuExcwKiNNfzTFbw3RksWBFgWble7r7Kypx4KBYt0 2LCZbwk+Xl275UsXj2UFx23JdsMc2RBdUqLJiuGoHU7KnFsqdTOtLdg2Q7yu/nsxibfF /cEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=a2N5VOvZWHZAlGz6ubg4AiofWLoy1epYm7MVF33mNnc=; b=OOo+kI+8ZpuazAbX6syPsCfHEeJkQ+6NxGpfnqBUUWWx3NvQYtTCxXcY3rrInLKc4J ADlEyTsSyM8HlVC7e0ZYq/bnwvg+L+DptSoRX1rtc0MKGpGi2PG3Je9ODIHtxv+7v70u OfSiNxYHoVSRSKjL+fSlvolgGCBP1IUJApNS2/N0zlMpTH+aFTBq6INaD/ScJ76lDIlT y5PYOQnW+v2kxPO+DRPFAsq/6xlKK6Aonj91U3nLwiMmFAQh4SDQrDWSXyulxDg3iRCX tRsfTr9UtBxI7gaPUjtMkhviKagzR9tyi/s4bk77Fg6DA0H2fqrDWESJhJH6xJI2wDBH GCmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=B6Ibf4Xo; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j22si3901836pfi.252.2018.12.14.04.30.51; Fri, 14 Dec 2018 04:31:06 -0800 (PST) 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; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=B6Ibf4Xo; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730522AbeLNMKl (ORCPT + 99 others); Fri, 14 Dec 2018 07:10:41 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:49227 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731630AbeLNMKh (ORCPT ); Fri, 14 Dec 2018 07:10:37 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181214121036euoutp018fa3d385ef080ad5b49d2be63192f6a9~wMc6z9v632527425274euoutp01b for ; Fri, 14 Dec 2018 12:10:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181214121036euoutp018fa3d385ef080ad5b49d2be63192f6a9~wMc6z9v632527425274euoutp01b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1544789436; bh=a2N5VOvZWHZAlGz6ubg4AiofWLoy1epYm7MVF33mNnc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B6Ibf4XoBqa9N6kvaObeMB6tTh9CrU/1clMbQlYn9m8oCqd6lVUzs6EczhUQYiEEY uZFkqYWNTosHXtfACrqJYY2qu09iZkZJTtp2PkPFbJns7zuAy9tiwMXZ0dHoNM0nt4 f1Xf4YWv7iUwUIinqob8Np4ihrjMDpDCfMYIWczg= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181214121035eucas1p12bed885eb8619e309d4d09646695c2f4~wMc58FU0C0507605076eucas1p1l; Fri, 14 Dec 2018 12:10:35 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 9C.9B.04441.ABD931C5; Fri, 14 Dec 2018 12:10:34 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181214121034eucas1p14b05676ff59998f760296f9ed33ba3dc~wMc5MZ4xG1069910699eucas1p1a; Fri, 14 Dec 2018 12:10:34 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20181214121034eusmtrp2b56d5ccdbe535cf6fdf8cf308a3a6398~wMc48qAux1165211652eusmtrp2g; Fri, 14 Dec 2018 12:10:34 +0000 (GMT) X-AuditID: cbfec7f2-5c9ff70000001159-6a-5c139dba57aa Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 6B.CC.04284.9BD931C5; Fri, 14 Dec 2018 12:10:33 +0000 (GMT) Received: from AMDC2034.DIGITAL.local (unknown [106.120.51.41]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181214121033eusmtip26d55cb18db455cf2423aa6794cd8d31d~wMc4M1_U03233032330eusmtip2v; Fri, 14 Dec 2018 12:10:33 +0000 (GMT) From: Christoph Manszewski To: dri-devel@lists.freedesktop.org Cc: Christoph Manszewski , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , David Airlie , Kukjin Kim , Krzysztof Kozlowski , Maarten Lankhorst , Maxime Ripard , Sean Paul , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Bartlomiej Zolnierkiewicz , Marek Szyprowski , Andrzej Hajda Subject: [PATCH 2/6] drm: color_mgmt: Split create_color_properties function Date: Fri, 14 Dec 2018 13:10:17 +0100 Message-Id: <1544789421-5265-3-git-send-email-c.manszewski@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544789421-5265-1-git-send-email-c.manszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSeUhUURTG585b5jk18XxKXrJ1KqXFLSouGGEQ9IKwhOiPMmomH6PkjPKe WwWVmpJbuSANuUaLMeU2jloTlJk0DdVIGmaKS0ySa1am4JI1zzfSf79zv+8753C4FMa8ItZQ MYYEjjdoYtWkEm96PesIsJZ5RQb/6N+FemocBMpz2OWo3lhLINuz+wB9nJ4kUeFAPo6G+z/g 6KZzDEPt7XUK9D5tXIHMzi4CdVpLSWRsfy5H1W19CnTnZyOOBkdeANRX1AaQsWiEDGPY8seX WLMpi2SbZwYJttwewQ7k2ORsw70rrM3ao2BvWEyAnTKvP+ZxUrkviouNSeL4oP1nldF3s8fJ +JbglJpi7VVg888GHhSkd8P+5g4iGygphn4I4GJ6CykKDP0bwAqnShKmXEJOhWI5YZ5ZwCSh CsDuxUx34UoMOkuX4iS9B/b2/Vpib3oz/FNgAqIJo60E/O6ck4uCF30E9rZN4iLj9FaYlWsi RFbRh2BLux1I49bDz44sTGQPmoUPrPeWG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27OfmHYyX NgYfYhTgYFTi4T0wRShGiDWxrLgy9xCjBAezkghvWKtwjBBvSmJlVWpRfnxRaU5q8SFGU6Cj JjJLiSbnA+M7ryTe0NTQ3MLS0NzY3NjMQkmc97xBZZSQQHpiSWp2ampBahFMHxMHp1QDY//3 3R2z/4ZynVm7cUoBg/gOASfPV8e5HuhnrIhNcXSQ83OsvHRsUWx15HyDaLPLzzvt3JY8ufzH 7mz9/I5rp7pDGn7qXW//zcbJkKpiYbJmduAePY05zSx6mvt2VDa8f7In7l7QPQ+OUy7n0057 /xT/G3v3lXqY1bKv87iSYtlutK+6Pef5HSWW4oxEQy3mouJEAM3Wb2W3AgAA X-CMS-MailID: 20181214121034eucas1p14b05676ff59998f760296f9ed33ba3dc X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20181214121034eucas1p14b05676ff59998f760296f9ed33ba3dc X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181214121034eucas1p14b05676ff59998f760296f9ed33ba3dc References: <1544789421-5265-1-git-send-email-c.manszewski@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Split drm_plane_create_color_properties into two separate functions. This allows to create range and encoding property independently. Signed-off-by: Christoph Manszewski --- drivers/gpu/drm/drm_color_mgmt.c | 93 +++++++++++++++++++++++++++++++--------- include/drm/drm_color_mgmt.h | 8 ++++ 2 files changed, 81 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c index 581cc3788223..416cc9c8560b 100644 --- a/drivers/gpu/drm/drm_color_mgmt.c +++ b/drivers/gpu/drm/drm_color_mgmt.c @@ -396,29 +396,24 @@ const char *drm_get_color_range_name(enum drm_color_range range) } /** - * drm_plane_create_color_properties - color encoding related plane properties + * drm_plane_create_encoding_property - color encoding related plane property * @plane: plane object * @supported_encodings: bitfield indicating supported color encodings - * @supported_ranges: bitfileld indicating supported color ranges * @default_encoding: default color encoding - * @default_range: default color range * - * Create and attach plane specific COLOR_ENCODING and COLOR_RANGE - * properties to @plane. The supported encodings and ranges should - * be provided in supported_encodings and supported_ranges bitmasks. - * Each bit set in the bitmask indicates that its number as enum - * value is supported. + * Create and attach plane specific COLOR_ENCODING property to @plane. + * The supported encodings be provided in supported_encodings bitmask. + * Each bit set in the bitmask indicates that its number as enum value + * is supported. */ -int drm_plane_create_color_properties(struct drm_plane *plane, - u32 supported_encodings, - u32 supported_ranges, - enum drm_color_encoding default_encoding, - enum drm_color_range default_range) + +int drm_plane_create_encoding_property(struct drm_plane *plane, + u32 supported_encodings, + enum drm_color_encoding default_encoding) { struct drm_device *dev = plane->dev; struct drm_property *prop; - struct drm_prop_enum_list enum_list[max_t(int, DRM_COLOR_ENCODING_MAX, - DRM_COLOR_RANGE_MAX)]; + struct drm_prop_enum_list enum_list[DRM_COLOR_ENCODING_MAX]; int i, len; if (WARN_ON(supported_encodings == 0 || @@ -426,11 +421,6 @@ int drm_plane_create_color_properties(struct drm_plane *plane, (supported_encodings & BIT(default_encoding)) == 0)) return -EINVAL; - if (WARN_ON(supported_ranges == 0 || - (supported_ranges & -BIT(DRM_COLOR_RANGE_MAX)) != 0 || - (supported_ranges & BIT(default_range)) == 0)) - return -EINVAL; - len = 0; for (i = 0; i < DRM_COLOR_ENCODING_MAX; i++) { if ((supported_encodings & BIT(i)) == 0) @@ -450,6 +440,36 @@ int drm_plane_create_color_properties(struct drm_plane *plane, if (plane->state) plane->state->color_encoding = default_encoding; + return 0; +} +EXPORT_SYMBOL(drm_plane_create_encoding_property); + +/** + * drm_plane_create_range_property - color range related plane property + * @plane: plane object + * @supported_ranges: bitfileld indicating supported color ranges + * @default_range: default color range + * + * Create and attach plane specific COLOR_RANGE property to @plane. + * The supported ranges should be provided in supported_ranges bitmask. + * Each bit set in the bitmask indicates that its number as enum value + * is supported. + */ + +int drm_plane_create_range_property(struct drm_plane *plane, + u32 supported_ranges, + enum drm_color_range default_range) +{ + struct drm_device *dev = plane->dev; + struct drm_property *prop; + struct drm_prop_enum_list enum_list[DRM_COLOR_RANGE_MAX]; + int i, len; + + if (WARN_ON(supported_ranges == 0 || + (supported_ranges & -BIT(DRM_COLOR_RANGE_MAX)) != 0 || + (supported_ranges & BIT(default_range)) == 0)) + return -EINVAL; + len = 0; for (i = 0; i < DRM_COLOR_RANGE_MAX; i++) { if ((supported_ranges & BIT(i)) == 0) @@ -471,4 +491,37 @@ int drm_plane_create_color_properties(struct drm_plane *plane, return 0; } +EXPORT_SYMBOL(drm_plane_create_range_property); + +/** + * drm_plane_create_color_properties - color encoding related plane properties + * @plane: plane object + * @supported_encodings: bitfield indicating supported color encodings + * @supported_ranges: bitfileld indicating supported color ranges + * @default_encoding: default color encoding + * @default_range: default color range + * + * Create and attach plane specific COLOR_ENCODING and COLOR_RANGE + * properties to @plane. The supported encodings and ranges should + * be provided in supported_encodings and supported_ranges bitmasks. + * Each bit set in the bitmask indicates that its number as enum + * value is supported. + */ + +int drm_plane_create_color_properties(struct drm_plane *plane, + u32 supported_encodings, + u32 supported_ranges, + enum drm_color_encoding default_encoding, + enum drm_color_range default_range) +{ + int ret; + + ret = drm_plane_create_encoding_property(plane, supported_encodings, + default_encoding); + if (ret) + return ret; + + return drm_plane_create_range_property(plane, supported_ranges, + default_range); +} EXPORT_SYMBOL(drm_plane_create_color_properties); diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h index 52f6d5221a0d..fca8d3fabcd9 100644 --- a/include/drm/drm_color_mgmt.h +++ b/include/drm/drm_color_mgmt.h @@ -66,6 +66,14 @@ enum drm_color_range { DRM_COLOR_FULL_RANGE = DRM_COLOR_YCBCR_FULL_RANGE, }; +int drm_plane_create_encoding_property(struct drm_plane *plane, + u32 supported_encodings, + enum drm_color_encoding default_encoding); + +int drm_plane_create_range_property(struct drm_plane *plane, + u32 supported_ranges, + enum drm_color_range default_range); + int drm_plane_create_color_properties(struct drm_plane *plane, u32 supported_encodings, u32 supported_ranges, -- 2.7.4