From patchwork Fri Jun 26 13:51:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramalingam C X-Patchwork-Id: 6681251 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E0C40C05AC for ; Fri, 26 Jun 2015 14:00:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ED643204A7 for ; Fri, 26 Jun 2015 14:00:42 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id EBBC52049C for ; Fri, 26 Jun 2015 14:00:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 65C3A7A13D; Fri, 26 Jun 2015 07:00:41 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id CDDFC7A13D for ; Fri, 26 Jun 2015 07:00:39 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 26 Jun 2015 07:00:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,685,1427785200"; d="scan'208";a="750978797" Received: from ramaling-desktop.iind.intel.com ([10.223.26.95]) by fmsmga002.fm.intel.com with ESMTP; 26 Jun 2015 07:00:35 -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:21:59 +0530 Message-Id: <1435326722-24633-16-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 15/18] drm/i915: MEDIA_RR support in DSI DRRS module 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 Content based DRRS support is implemented in DSI DRRS module also. Signed-off-by: Ramalingam C --- drivers/gpu/drm/i915/intel_dsi_drrs.c | 60 +++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dsi_drrs.c b/drivers/gpu/drm/i915/intel_dsi_drrs.c index d4bb70a..4ff06b8 100644 --- a/drivers/gpu/drm/i915/intel_dsi_drrs.c +++ b/drivers/gpu/drm/i915/intel_dsi_drrs.c @@ -19,6 +19,7 @@ #include "intel_drv.h" #include "intel_dsi.h" +#include "intel_drrs.h" /* * VLV and CHV platform code @@ -50,9 +51,19 @@ static void intel_mipi_drrs_work_fn(struct work_struct *__work) struct dsi_drrs *dsi_drrs = &intel_dsi->dsi_drrs; struct dsi_mnp *dsi_mnp; struct drm_display_mode *prev_mode = NULL; + bool resume_idleness_detection = false; bool fallback_attempt = false; int ret, retry_cnt = 3; + if (work->target_rr_type == DRRS_MEDIA_RR) { + ret = dsi_drrs->ops->mnp_calculate_for_mode( + intel_encoder, &dsi_drrs->mnp[DRRS_MEDIA_RR], + drrs->connector->panel.target_mode); + if (ret < 0) { + DRM_ERROR("mnp calculation failed\n"); + goto out; + } + } init: dsi_mnp = &dsi_drrs->mnp[work->target_rr_type]; DRM_DEBUG("Refresh rate Type: %d-->%d\n", @@ -60,6 +71,10 @@ init: work->target_rr_type); DRM_DEBUG("Target RR: %d\n", work->target_mode->vrefresh); + if (drrs->drrs_state.current_rr_type == DRRS_MEDIA_RR && + work->target_rr_type == DRRS_HIGH_RR) + resume_idleness_detection = true; + retry: if (!intel_crtc || !intel_crtc->active) goto out; @@ -87,6 +102,11 @@ retry: /* TODO: Update drain ladency with watermark */ + if (resume_idleness_detection) { + intel_disable_idleness_drrs(drrs); + intel_enable_idleness_drrs(drrs); + } + } else if (ret == -ETIMEDOUT && retry_cnt) { /* Timed out. But still attempts are allowed */ @@ -111,10 +131,14 @@ retry: work->target_rr_type = drrs->drrs_state.target_rr_type; drm_mode_destroy(intel_encoder->base.dev, work->target_mode); - if (work->target_rr_type == DRRS_HIGH_RR) + if (work->target_rr_type == DRRS_HIGH_RR) { prev_mode = drrs->connector->panel.fixed_mode; - else if (work->target_rr_type == DRRS_LOW_RR) + resume_idleness_detection = true; + } else if (work->target_rr_type == DRRS_LOW_RR) { prev_mode = drrs->connector->panel.downclock_mode; + } else if (work->target_rr_type == DRRS_MEDIA_RR) { + prev_mode = drrs->connector->panel.target_mode; + } work->target_mode = drm_mode_duplicate(intel_encoder->base.dev, prev_mode); @@ -137,6 +161,37 @@ out: work->work_completed = true; } +/* + * As a part of Media playback request filtering + * we validate the incoming request wrt deferred works + * of MIPI PLL programming + */ +bool intel_dsi_is_mp_drrs_req(struct i915_drrs *drrs, + struct drm_display_mode *mode) +{ + struct intel_dsi *intel_dsi = + enc_to_intel_dsi(&drrs->connector->encoder->base); + struct dsi_drrs *dsi_drrs = &intel_dsi->dsi_drrs; + struct intel_mipi_drrs_work *work = dsi_drrs->mipi_drrs_work; + bool ret = false; + + if (work_busy(&work->work.work)) { + if (work->target_mode->vrefresh != mode->vrefresh || + drrs->drrs_state.current_rr_type != DRRS_MEDIA_RR) + + /* + * First condition: Deferred work is in place to change + * the DRRS state. Hence this call is valid Media + * playback DRRS request. + * + * Second Condition: Might be same as deffered work but + * this is from media playback request. So honor it. + */ + ret = true; + } + return ret; +} + /* Whether DRRS_HR_STATE is pending in the dsi deferred work */ bool intel_dsi_is_drrs_hr_state_pending(struct i915_drrs *drrs) { @@ -350,6 +405,7 @@ struct drrs_encoder_ops drrs_dsi_ops = { .exit = intel_dsi_drrs_exit, .set_drrs_state = intel_dsi_set_drrs_state, .is_drrs_hr_state_pending = intel_dsi_is_drrs_hr_state_pending, + .is_mp_drrs_req = intel_dsi_is_mp_drrs_req, }; /* Call back Function for Intel_drrs module to get the dsi func ptr */