From patchwork Mon Jun 18 13:32:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sravanthi Kollukuduru X-Patchwork-Id: 10471441 X-Patchwork-Delegate: agross@codeaurora.org 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 049F26032A for ; Mon, 18 Jun 2018 13:33:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7CA2286D7 for ; Mon, 18 Jun 2018 13:33:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC21828751; Mon, 18 Jun 2018 13:33:41 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73178286D7 for ; Mon, 18 Jun 2018 13:33:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934232AbeFRNdk (ORCPT ); Mon, 18 Jun 2018 09:33:40 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:39188 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933585AbeFRNdk (ORCPT ); Mon, 18 Jun 2018 09:33:40 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 87EFB60B1E; Mon, 18 Jun 2018 13:33:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1529328819; bh=VBrEMuharu9e5SEE8hpsgzmMwfm3mrTKdjsuTTqhJlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KNe6AaJzNO1mPAw12KnqjrjcfYVUPcQWnd2vLqQiNFKUL5c/9P8+qvQm3xtsYuJ9S bFd6t72cvKX970t9KqMQjb9arU/wyvxgad/Bc/spUhHunX6Xuyls7aKMYH8rj4htb4 Ovpd2K6NYOpuw+U96IpP2xJt9ow1KlI9B80gcXPQ= Received: from skolluku-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: skolluku@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 3059960B22; Mon, 18 Jun 2018 13:33:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1529328818; bh=VBrEMuharu9e5SEE8hpsgzmMwfm3mrTKdjsuTTqhJlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G9sqTdkApEJMc/9IrU8F/FPOVPnRzKVm+hM0BZR8At1SM0jeeoywKwH64AL9c20QX zjvTSdiwMX8KhcQfULtQ6in67y3Knh8OKDCeAB+GmzrbNnfi6Y/WS42VBzgE+zQKsq uOKPtdRuqySmJlmrdH3MHAhleBVtLVrQIRvNc8Wo= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 3059960B22 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=skolluku@codeaurora.org From: Sravanthi Kollukuduru To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org Cc: Jeykumar Sankaran , robdclark@gmail.com, seanpaul@chromium.org, hoegsberg@chromium.org, Sravanthi Kollukuduru Subject: [DPU PATCH v2 04/14] drm/msm/dpu: program master-slave encoders explicitly Date: Mon, 18 Jun 2018 19:02:42 +0530 Message-Id: <1529328772-5022-5-git-send-email-skolluku@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1529328772-5022-1-git-send-email-skolluku@codeaurora.org> References: <1529328772-5022-1-git-send-email-skolluku@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jeykumar Sankaran Identify slave-master encoders and program them explicitly. changes in v2: - none Signed-off-by: Jeykumar Sankaran Signed-off-by: Sravanthi Kollukuduru --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 41 ++++++++++++++++------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 11a1045..e98cf70 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -184,6 +184,7 @@ struct dpu_encoder_virt { unsigned int num_phys_encs; struct dpu_encoder_phys *phys_encs[MAX_PHYS_ENCODERS_PER_VIRTUAL]; struct dpu_encoder_phys *cur_master; + struct dpu_encoder_phys *cur_slave; struct dpu_hw_pingpong *hw_pp[MAX_CHANNELS_PER_ENC]; bool intfs_swapped; @@ -1170,35 +1171,48 @@ void dpu_encoder_virt_restore(struct drm_encoder *drm_enc) static void dpu_encoder_virt_enable(struct drm_encoder *drm_enc) { struct dpu_encoder_virt *dpu_enc = NULL; + struct dpu_encoder_phys *phys = NULL; int i, ret = 0; - struct drm_display_mode *cur_mode = NULL; if (!drm_enc) { DPU_ERROR("invalid encoder\n"); return; } dpu_enc = to_dpu_encoder_virt(drm_enc); - cur_mode = &dpu_enc->base.crtc->state->adjusted_mode; DPU_DEBUG_ENC(dpu_enc, "\n"); - DPU_EVT32(DRMID(drm_enc), cur_mode->hdisplay, cur_mode->vdisplay); dpu_enc->cur_master = NULL; + dpu_enc->cur_slave = NULL; for (i = 0; i < dpu_enc->num_phys_encs; i++) { - struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i]; + phys = dpu_enc->phys_encs[i]; + + if (!phys || !phys->ops.is_master) + continue; - if (phys && phys->ops.is_master && phys->ops.is_master(phys)) { - DPU_DEBUG_ENC(dpu_enc, "master is now idx %d\n", i); + if (phys->ops.is_master(phys)) { + DPU_DEBUG_ENC(dpu_enc, "master is at idx %d\n", i); dpu_enc->cur_master = phys; - break; + } else { + DPU_DEBUG_ENC(dpu_enc, "slave is at idx %d\n", i); + dpu_enc->cur_slave = phys; } } if (!dpu_enc->cur_master) { - DPU_ERROR("virt encoder has no master! num_phys %d\n", i); + DPU_ERROR("virt encoder has no master identified\n"); return; } + /* always enable slave encoder before master */ + phys = dpu_enc->cur_slave; + if (phys && phys->ops.enable) + phys->ops.enable(phys); + + phys = dpu_enc->cur_master; + if (phys && phys->ops.enable) + phys->ops.enable(phys); + ret = dpu_encoder_resource_control(drm_enc, DPU_ENC_RC_EVENT_KICKOFF); if (ret) { DPU_ERROR_ENC(dpu_enc, "dpu resource control failed: %d\n", @@ -1207,25 +1221,16 @@ static void dpu_encoder_virt_enable(struct drm_encoder *drm_enc) } for (i = 0; i < dpu_enc->num_phys_encs; i++) { - struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i]; - + phys = dpu_enc->phys_encs[i]; if (!phys) continue; - if (phys != dpu_enc->cur_master) { - if (phys->ops.enable) - phys->ops.enable(phys); - } - if (dpu_enc->misr_enable && (dpu_enc->disp_info.capabilities & MSM_DISPLAY_CAP_VID_MODE) && phys->ops.setup_misr) phys->ops.setup_misr(phys, true, dpu_enc->misr_frame_count); } - if (dpu_enc->cur_master->ops.enable) - dpu_enc->cur_master->ops.enable(dpu_enc->cur_master); - _dpu_encoder_virt_enable_helper(drm_enc); }