From patchwork Tue Aug 30 05:00:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nabendu Maiti X-Patchwork-Id: 9304823 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 159E6607F0 for ; Tue, 30 Aug 2016 04:49:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0074128AB5 for ; Tue, 30 Aug 2016 04:49:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E98C528AC0; Tue, 30 Aug 2016 04:49:19 +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 8DF9628AB5 for ; Tue, 30 Aug 2016 04:49:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 30E0E6E5A4; Tue, 30 Aug 2016 04:49:19 +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 3FA7F6E584 for ; Tue, 30 Aug 2016 04:49:14 +0000 (UTC) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 29 Aug 2016 21:49:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.30,254,1470726000"; d="scan'208"; a="1043215673" Received: from dispdev.iind.intel.com ([10.223.25.80]) by orsmga002.jf.intel.com with ESMTP; 29 Aug 2016 21:49:14 -0700 From: Nabendu Maiti To: intel-gfx@lists.freedesktop.org Date: Tue, 30 Aug 2016 10:30:58 +0530 Message-Id: <1472533261-30306-5-git-send-email-nabendu.bikash.maiti@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1472533261-30306-1-git-send-email-nabendu.bikash.maiti@intel.com> References: <1472533261-30306-1-git-send-email-nabendu.bikash.maiti@intel.com> Subject: [Intel-gfx] [PATCH 4/7] drm/i915: Adding atomic fitting mode property for GEN9 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-Virus-Scanned: ClamAV using ClamSMTP Pipe scaler Fitting mode property is added as crtc atomic property. Signed-off-by: Nabendu Maiti --- drivers/gpu/drm/drm_atomic.c | 5 ++++ drivers/gpu/drm/drm_crtc.c | 8 ++++++ drivers/gpu/drm/i915/intel_display.c | 47 ++++++++++-------------------------- include/drm/drm_crtc.h | 2 ++ 4 files changed, 28 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 066f010..3fddfa4 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -499,6 +499,9 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc, } else if (property == config->prop_pipe_src_h) { state->src_h = val; state->pipescaler_changed = true; + } else if (property == config->prop_fitting_mode) { + state->fitting_mode = val; + state->pipescaler_changed = true; } else if (crtc->funcs->atomic_set_property) return crtc->funcs->atomic_set_property(crtc, state, property, val); else @@ -545,6 +548,8 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc, *val = state->src_w; else if (property == config->prop_pipe_src_h) *val = state->src_h; + else if (property == config->prop_fitting_mode) + *val = state->fitting_mode; else if (crtc->funcs->atomic_get_property) return crtc->funcs->atomic_get_property(crtc, state, property, val); else diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 6fd6dd8..b24e839 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -381,6 +381,8 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, config->prop_pipe_src_w, 0); drm_object_attach_property(&crtc->base, config->prop_pipe_src_h, 0); + drm_object_attach_property(&crtc->base, + config->prop_fitting_mode, 0); } return 0; @@ -959,6 +961,12 @@ static int drm_mode_create_standard_properties(struct drm_device *dev) return -ENOMEM; dev->mode_config.prop_pipe_src_h = prop; + prop = drm_property_create_range(dev, DRM_MODE_PROP_ATOMIC, + "SCALER_MODE", 0, INT_MAX); + if (!prop) + return -ENOMEM; + dev->mode_config.prop_fitting_mode = prop; + return 0; } diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index ff5dea8..e3ecb8b 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -12551,48 +12551,25 @@ static bool check_single_encoder_cloning(struct drm_atomic_state *state, static int skylake_pfiter_calculate(struct drm_crtc *crtc, struct drm_crtc_state *crtc_state) { - struct drm_device *dev = crtc->dev; struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc_state *pipe_config = to_intel_crtc_state(crtc_state); bool mode_changed = needs_modeset(crtc_state); - struct intel_connector *intel_connector; int ret = 0; - struct drm_display_mode *adjusted_mode = - &intel_crtc->config->base.adjusted_mode; - - for_each_intel_connector(dev, intel_connector) { - if (!(intel_connector) || !(intel_connector->encoder) || - (intel_connector->encoder->base.crtc != crtc)) - continue; - if (((pipe_config->pipe_src_w != - intel_crtc->config->pipe_src_w) || - (pipe_config->pipe_src_h != - intel_crtc->config->pipe_src_h)) && (!mode_changed)) - pipe_config->update_pipe = true; - - if ((pipe_config->pipe_scaling_mode != - intel_connector->panel.fitting_mode) && - (!mode_changed)) { - if ((adjusted_mode->hdisplay != - pipe_config->pipe_src_w) || - (adjusted_mode->vdisplay != - pipe_config->pipe_src_h)) { - pipe_config->pipe_scaling_mode = - intel_connector->panel.fitting_mode; - pipe_config->update_pipe = true; - } - } + if (((pipe_config->pipe_scaling_mode != + intel_crtc->config->pipe_scaling_mode) || + (pipe_config->pipe_src_w != intel_crtc->config->pipe_src_w) || + (pipe_config->pipe_src_h != intel_crtc->config->pipe_src_h)) && + (!mode_changed)) { + pipe_config->update_pipe = true; + } - if ((mode_changed) || (pipe_config->update_pipe)) { - ret = skl_update_scaler_crtc(pipe_config); - if (ret) - break; + if ((mode_changed) || (pipe_config->update_pipe)) { + ret = skl_update_scaler_crtc(pipe_config); + if (!ret) intel_pch_panel_fitting(intel_crtc, pipe_config, - intel_connector->panel.fitting_mode); - break; - } + pipe_config->pipe_scaling_mode); } return ret; } @@ -14054,6 +14031,8 @@ static int intel_atomic_check(struct drm_device *dev, } pipe_config->pipe_src_w = crtc_state->src_w; pipe_config->pipe_src_h = crtc_state->src_h; + pipe_config->pipe_scaling_mode = + crtc_state->fitting_mode; crtc_state->pipescaler_changed = false; } diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 4d6b580..e245746 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -200,6 +200,7 @@ struct drm_crtc_state { bool pipescaler_changed; u32 src_w, src_h; + u32 fitting_mode; }; /** @@ -1948,6 +1949,7 @@ struct drm_mode_config { /* pipe scaler properties */ struct drm_property *prop_pipe_src_w; struct drm_property *prop_pipe_src_h; + struct drm_property *prop_fitting_mode; /** * @dvi_i_subconnector_property: Optional DVI-I property to