From patchwork Fri Jun 26 13:52:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramalingam C X-Patchwork-Id: 6681281 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 560329F39B for ; Fri, 26 Jun 2015 14:01:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5A888204AB for ; Fri, 26 Jun 2015 14:01:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 52E7E204A7 for ; Fri, 26 Jun 2015 14:01:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A29A07A144; Fri, 26 Jun 2015 07:01:03 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B7647A144 for ; Fri, 26 Jun 2015 07:01:02 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 26 Jun 2015 07:01:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,685,1427785200"; d="scan'208";a="750979138" Received: from ramaling-desktop.iind.intel.com ([10.223.26.95]) by fmsmga002.fm.intel.com with ESMTP; 26 Jun 2015 07:00:46 -0700 From: Ramalingam C To: intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, chris@chris-wilson.co.uk, rodrigo.vivi@intel.com Date: Fri, 26 Jun 2015 19:22:02 +0530 Message-Id: <1435326722-24633-19-git-send-email-ramalingam.c@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1435326722-24633-1-git-send-email-ramalingam.c@intel.com> References: <1435326722-24633-1-git-send-email-ramalingam.c@intel.com> Cc: paulo.r.zanoni@intel.com Subject: [Intel-gfx] [RFC PATCH 18/18] drm/i915: Connector property for DRRS capability 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP DRRS capability on each connector is exposed to userspace through drm connector property. In this change one drm property is created and attached with each connector. And when DRRS is successfully initialized for a connector, drrs connector property is set with appropriate value. Signed-off-by: Ramalingam C --- drivers/gpu/drm/i915/intel_dp.c | 1 + drivers/gpu/drm/i915/intel_drrs.c | 5 +++++ drivers/gpu/drm/i915/intel_drv.h | 6 ++++++ drivers/gpu/drm/i915/intel_dsi.c | 8 ++++++++ drivers/gpu/drm/i915/intel_modes.c | 28 ++++++++++++++++++++++++++++ 5 files changed, 48 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 9ded4d1..22001b6 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -5063,6 +5063,7 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect intel_attach_force_audio_property(connector); intel_attach_broadcast_rgb_property(connector); + intel_attach_drrs_capability_property(connector); intel_dp->color_range_auto = true; if (is_edp(intel_dp)) { diff --git a/drivers/gpu/drm/i915/intel_drrs.c b/drivers/gpu/drm/i915/intel_drrs.c index 9634254..89f2d39 100644 --- a/drivers/gpu/drm/i915/intel_drrs.c +++ b/drivers/gpu/drm/i915/intel_drrs.c @@ -684,6 +684,11 @@ int intel_drrs_init(struct drm_device *dev, mutex_init(&drrs->drrs_mutex); drrs->resume_idleness_detection = false; drrs->drrs_state.current_rr_type = DRRS_HIGH_RR; + + /* DRRS connector property */ + drm_object_property_set_value(&intel_connector->base.base, + intel_connector->drrs_capability_property, + drrs->drrs_state.type); DRM_INFO("SEAMLESS DRRS supported on this panel.\n"); return 0; diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 3a5cff8..97a5af8 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -231,6 +231,9 @@ struct intel_connector { void *port; /* store this opaque as its illegal to dereference it */ struct intel_dp *mst_port; + + /* DRRS capability */ + struct drm_property *drrs_capability_property; }; typedef struct dpll { @@ -1266,6 +1269,9 @@ 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); +/* DRRS function */ +void intel_attach_drrs_capability_property(struct drm_connector *connector); + /* intel_overlay.c */ void intel_setup_overlay(struct drm_device *dev); diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c index 503f3de..2efad4b 100644 --- a/drivers/gpu/drm/i915/intel_dsi.c +++ b/drivers/gpu/drm/i915/intel_dsi.c @@ -968,6 +968,13 @@ static void intel_dsi_encoder_destroy(struct drm_encoder *encoder) intel_encoder_destroy(encoder); } +static void +intel_dsi_add_properties(struct intel_dsi *intel_dsi, + struct drm_connector *connector) +{ + intel_attach_drrs_capability_property(connector); +} + static const struct drm_encoder_funcs intel_dsi_funcs = { .destroy = intel_dsi_encoder_destroy, }; @@ -1091,6 +1098,7 @@ void intel_dsi_init(struct drm_device *dev) connector->interlace_allowed = false; connector->doublescan_allowed = false; + intel_dsi_add_properties(intel_dsi, connector); intel_connector_attach_encoder(intel_connector, intel_encoder); drm_connector_register(connector); diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c index 0e860f3..f6c466c 100644 --- a/drivers/gpu/drm/i915/intel_modes.c +++ b/drivers/gpu/drm/i915/intel_modes.c @@ -126,3 +126,31 @@ intel_attach_broadcast_rgb_property(struct drm_connector *connector) drm_object_attach_property(&connector->base, prop, 0); } + +static const struct drm_prop_enum_list drrs_capability_names[] = { + { DRRS_NOT_SUPPORTED, "Off" }, + { STATIC_DRRS_SUPPORT, "Off-Static" }, + { SEAMLESS_DRRS_SUPPORT, "Seamless-HW" }, + { SEAMLESS_DRRS_SUPPORT_SW, "Seamless-SW" }, +}; + +void intel_attach_drrs_capability_property(struct drm_connector *connector) +{ + struct drm_device *dev = connector->dev; + struct intel_connector *intel_connector = to_intel_connector(connector); + struct drm_property *prop; + + prop = intel_connector->drrs_capability_property; + if (prop == NULL) { + prop = drm_property_create_enum(dev, 0, + "drrs_capability", + drrs_capability_names, + ARRAY_SIZE(drrs_capability_names)); + if (prop == NULL) { + DRM_ERROR("Drm property enum creation failed\n"); + return; + } + intel_connector->drrs_capability_property = prop; + } + drm_object_attach_property(&connector->base, prop, DRRS_NOT_SUPPORTED); +}