From patchwork Thu Feb 15 05:32:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniele Castagna X-Patchwork-Id: 10220565 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7DFCA6055C for ; Thu, 15 Feb 2018 08:36:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C165290B4 for ; Thu, 15 Feb 2018 08:36:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 608D1290B8; Thu, 15 Feb 2018 08:36:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D83DD290B4 for ; Thu, 15 Feb 2018 08:36:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D5DDE6E20D; Thu, 15 Feb 2018 08:36:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt0-f195.google.com (mail-qt0-f195.google.com [209.85.216.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id E62036E07A for ; Thu, 15 Feb 2018 05:33:16 +0000 (UTC) Received: by mail-qt0-f195.google.com with SMTP id f4so10573153qtj.6 for ; Wed, 14 Feb 2018 21:33:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=m8quRYyY9JQgQh3gMnsH06JG4awEhifJud6fgp7pR4Y=; b=PO8wwZEI/kv5jTnDqUR23MxivF7MDUqTltpFnd2f0auwGN47xe5bBg3wmmQdt3ukJS PwhjuzwIl7YDkqIQxQCLqjYAzC2P2S2iCMwzUHQKNKEotFKRTR92xZwqjb791mhgOd4M 7X4fFlOeofpUcMS7EQ5iwLqWNi+DdhrhDUXRKR6ZlSOcIblMS5yoggw4bctgdK98Gofh uOM6NIByb26Ke3+tknR3ou8N79WaIXg/vX7iyl9kD3SO4kycpQgUFClipNotQ7u0vZc2 9Tphc/wxZTSIQKd+i1BNKya1jlYiK3EoofgQwcSu15kEN5aHzgDs+8GjJHLJuthfBkoL j5IA== X-Gm-Message-State: APf1xPAV9RoRZ23YFRwW1gd5mZQEWTZW4LEH4O6ntg1myanEdV9ejrvG 9gm9ic1N1U2QeK+jphDjLwfi32+yDS4= X-Google-Smtp-Source: AH8x225sKJg5s8HaDgPg+tDoH5mL/UAOWOmy/AKwl9mC/AecxPBJA4LfD6M1vSBm2OoOlpMwlZtAvQ== X-Received: by 10.237.55.132 with SMTP id j4mr2460383qtb.324.1518672795340; Wed, 14 Feb 2018 21:33:15 -0800 (PST) Received: from dcastagna1.nyc.corp.google.com ([2620:0:1003:101a:749d:49f2:f0b1:dd83]) by smtp.gmail.com with ESMTPSA id l62sm13808198qkl.23.2018.02.14.21.33.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Feb 2018 21:33:14 -0800 (PST) From: Daniele Castagna To: dri-devel@lists.freedesktop.org Subject: [PATCH 03/10] drm: Add Plane CTM property Date: Thu, 15 Feb 2018 00:32:53 -0500 Message-Id: <20180215053300.70482-4-dcastagna@chromium.org> X-Mailer: git-send-email 2.16.1.291.g4437f3f132-goog In-Reply-To: <20180215053300.70482-1-dcastagna@chromium.org> References: <20180215053300.70482-1-dcastagna@chromium.org> X-Mailman-Approved-At: Thu, 15 Feb 2018 08:36:05 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "uma.shankar at intel.com (Uma Shankar)" Add a blob property for plane CSC usage. (am from https://patchwork.kernel.org/patch/9971339/) Change-Id: I688ce7c95c20d307cb0aa35c5eba5ce2e1e88314 Signed-off-by: Uma Shankar --- drivers/gpu/drm/drm_atomic.c | 10 ++++++++++ drivers/gpu/drm/drm_atomic_helper.c | 3 +++ drivers/gpu/drm/drm_mode_config.c | 6 ++++++ include/drm/drm_mode_config.h | 6 ++++++ include/drm/drm_plane.h | 8 ++++++++ 5 files changed, 33 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 4a06ff2fd1a5e..d4b8c6cc84128 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -770,6 +770,14 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, val, -1, &replaced); state->color_mgmt_changed |= replaced; return ret; + } else if (property == config->plane_ctm_property) { + ret = drm_atomic_replace_property_blob_from_id(dev, + &state->ctm, + val, + sizeof(struct drm_color_ctm), + &replaced); + state->color_mgmt_changed |= replaced; + return ret; } else { return -EINVAL; } @@ -831,6 +839,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane, } else if (property == config->plane_degamma_lut_property) { *val = (state->degamma_lut) ? state->degamma_lut->base.id : 0; + } else if (property == config->plane_ctm_property) { + *val = (state->ctm) ? state->ctm->base.id : 0; } else { return -EINVAL; } diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index d3eaf4d397681..17e137a529a0e 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3493,6 +3493,8 @@ void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, if (state->degamma_lut) drm_property_reference_blob(state->degamma_lut); + if (state->ctm) + drm_property_reference_blob(state->ctm); state->color_mgmt_changed = false; } EXPORT_SYMBOL(__drm_atomic_helper_plane_duplicate_state); @@ -3540,6 +3542,7 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state) drm_crtc_commit_put(state->commit); drm_property_unreference_blob(state->degamma_lut); + drm_property_unreference_blob(state->ctm); } EXPORT_SYMBOL(__drm_atomic_helper_plane_destroy_state); diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c index 7d8e74715b565..c8763977413e7 100644 --- a/drivers/gpu/drm/drm_mode_config.c +++ b/drivers/gpu/drm/drm_mode_config.c @@ -361,6 +361,12 @@ static int drm_mode_create_standard_properties(struct drm_device *dev) if (!prop) return -ENOMEM; dev->mode_config.plane_degamma_lut_size_property = prop; + prop = drm_property_create(dev, + DRM_MODE_PROP_BLOB, + "PLANE_CTM", 0); + if (!prop) + return -ENOMEM; + dev->mode_config.plane_ctm_property = prop; return 0; } diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index dcec93d062b4d..ad7235ced531b 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -734,6 +734,12 @@ struct drm_mode_config { * size of the degamma LUT as supported by the driver (read-only). */ struct drm_property *plane_degamma_lut_size_property; + /** + * @plane_ctm_property: Optional CRTC property to set the + * matrix used to convert colors after the lookup in the + * degamma LUT. + */ + struct drm_property *plane_ctm_property; /** * @ctm_property: Optional CRTC property to set the * matrix used to convert colors after the lookup in the diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 2f8f5db77a406..21aecc9c91a09 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -139,6 +139,14 @@ struct drm_plane_state { */ struct drm_property_blob *degamma_lut; + /** + * @ctm: + * + * Color transformation matrix. See drm_plane_enable_color_mgmt(). The + * blob (if not NULL) is a &struct drm_color_ctm. + */ + struct drm_property_blob *ctm; + struct drm_atomic_state *state; bool color_mgmt_changed : 1;