From patchwork Wed Oct 18 22:29:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Sripada, Radhakrishna" X-Patchwork-Id: 10015383 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 40E14603FF for ; Wed, 18 Oct 2017 22:27:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33C3328CB3 for ; Wed, 18 Oct 2017 22:27:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2856028D17; Wed, 18 Oct 2017 22:27:43 +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 97CCD28CB3 for ; Wed, 18 Oct 2017 22:27:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DD6556E0AB; Wed, 18 Oct 2017 22:27:41 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id 42BCB6E0AB for ; Wed, 18 Oct 2017 22:27:40 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Oct 2017 15:27:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,398,1503385200"; d="scan'208";a="324875394" Received: from invictus.jf.intel.com ([10.54.75.152]) by fmsmga004.fm.intel.com with ESMTP; 18 Oct 2017 15:27:28 -0700 From: "Sripada, Radhakrishna" To: intel-gfx@lists.freedesktop.org Date: Wed, 18 Oct 2017 15:29:48 -0700 Message-Id: <20171018222949.11140-1-radhakrishna.sripada@intel.com> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 Cc: Paulo Zanoni Subject: [Intel-gfx] [RFC 1/2] drm/i915: Add connector property to force bpc X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Currently the user space does not have a way to force the bpc. The default bpc to be programmed is decided by the driver and is run against connector limitations. Creating a new property for the userspace to recommend a certain color depth while scanning out the pixels. Cc: Ville Syrjälä Cc: Paulo Zanoni Cc: Manasi Navare Signed-off-by: Radhakrishna Sripada --- drivers/gpu/drm/i915/i915_drv.h | 7 +++++++ drivers/gpu/drm/i915/intel_atomic.c | 7 +++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ drivers/gpu/drm/i915/intel_hdmi.c | 1 + drivers/gpu/drm/i915/intel_modes.c | 29 +++++++++++++++++++++++++++++ 5 files changed, 46 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 2783f07c6fc4..e58856f7b08a 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2521,6 +2521,7 @@ struct drm_i915_private { struct drm_property *broadcast_rgb_property; struct drm_property *force_audio_property; + struct drm_property *force_bpc_property; /* hda/i915 audio component */ struct i915_audio_component *audio_component; @@ -2858,6 +2859,12 @@ enum hdmi_force_audio { HDMI_AUDIO_ON, /* force turn on HDMI audio */ }; +enum connector_force_bpc { + INTEL_FORCE_BPC_AUTO, + INTEL_FORCE_BPC_8, + INTEL_FORCE_BPC_10, + INTEL_FORCE_BPC_12, +}; #define I915_GTT_OFFSET_NONE ((u32)-1) /* diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c index 36d4e635e4ce..10a74669f49a 100644 --- a/drivers/gpu/drm/i915/intel_atomic.c +++ b/drivers/gpu/drm/i915/intel_atomic.c @@ -58,6 +58,8 @@ int intel_digital_connector_atomic_get_property(struct drm_connector *connector, *val = intel_conn_state->force_audio; else if (property == dev_priv->broadcast_rgb_property) *val = intel_conn_state->broadcast_rgb; + else if (property == dev_priv->force_bpc_property) + *val = intel_conn_state->force_bpc; else { DRM_DEBUG_ATOMIC("Unknown property %s\n", property->name); return -EINVAL; @@ -95,6 +97,11 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector, return 0; } + if (property == dev_priv->force_bpc_property) { + intel_conn_state->force_bpc = val; + return 0; + } + DRM_DEBUG_ATOMIC("Unknown property %s\n", property->name); return -EINVAL; } diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 77117e188b04..654e76d19514 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -341,6 +341,7 @@ struct intel_digital_connector_state { enum hdmi_force_audio force_audio; int broadcast_rgb; + enum connector_force_bpc force_bpc; }; #define to_intel_digital_connector_state(x) container_of(x, struct intel_digital_connector_state, base) @@ -1708,6 +1709,7 @@ int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter); void intel_attach_force_audio_property(struct drm_connector *connector); void intel_attach_broadcast_rgb_property(struct drm_connector *connector); void intel_attach_aspect_ratio_property(struct drm_connector *connector); +void intel_attach_force_bpc_property(struct drm_connector *connector); /* intel_overlay.c */ diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 50214e342401..a2d6d97cc730 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -1798,6 +1798,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c intel_attach_force_audio_property(connector); intel_attach_broadcast_rgb_property(connector); intel_attach_aspect_ratio_property(connector); + intel_attach_force_bpc_property(connector); connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE; } diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c index 28a778b785ac..d7be44a951e8 100644 --- a/drivers/gpu/drm/i915/intel_modes.c +++ b/drivers/gpu/drm/i915/intel_modes.c @@ -151,3 +151,32 @@ intel_attach_aspect_ratio_property(struct drm_connector *connector) connector->dev->mode_config.aspect_ratio_property, DRM_MODE_PICTURE_ASPECT_NONE); } + +static const struct drm_prop_enum_list force_bpc_names[] = { + { INTEL_FORCE_BPC_AUTO, "Automatic" }, + { INTEL_FORCE_BPC_8, "8 bpc" }, + { INTEL_FORCE_BPC_10, "10 bpc" }, + { INTEL_FORCE_BPC_12, "12 bpc" }, +}; + +void +intel_attach_force_bpc_property(struct drm_connector *connector) +{ + struct drm_device *dev = connector->dev; + struct drm_i915_private *dev_priv = to_i915(dev); + struct drm_property *prop; + + prop = dev_priv->force_bpc_property; + if (prop == NULL) { + prop = drm_property_create_enum(dev, DRM_MODE_PROP_ENUM, + "bpc", + force_bpc_names, + ARRAY_SIZE(force_bpc_names)); + if (prop == NULL) + return; + + dev_priv->force_bpc_property = prop; + } + + drm_object_attach_property(&connector->base, prop, 0); +}