From patchwork Thu Feb 8 15:20:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 770968 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D23D87B3CE for ; Thu, 8 Feb 2024 15:20:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707405648; cv=none; b=DwHYIu+mbghit4IElF+GtGZAWhOnshQbFLlfs/EF39obFlJnC7sIQlEuozO95dcODSIwheujjqCs02pyyxqx4C8ToGma5rGhawp0XM48C8mBoqrO27EWxPqL/HCB5HQbIAaTrJ697QWgavxNi9hfwlrsf5gj9d3cWj3UHTLBf3o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707405648; c=relaxed/simple; bh=zjZbYdMAqyu+oLAUzHy6Hmx+VEZSTigImPrKgFvEAZw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QZIroTpS5CGmhXPZKJdeVXAp26QMyTl38w0NBep5+rjlA9GTcff5axRjZTG/FSix0V+zqtgEX942ANAJRMeS4o0/5c+v4g/xv4Z/GhoZ0jNp2Ae7gSi7BCddV3EwcRfXLs9P55eAm/HvZd9+qz6TRB+FY/NnxDt9mApi5aHENXs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=AuzVgP5J; arc=none smtp.client-ip=209.85.208.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="AuzVgP5J" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2d0bc402c8eso10066691fa.1 for ; Thu, 08 Feb 2024 07:20:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707405645; x=1708010445; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=D67SHaFW97kK6G1v5sE/VNmdoJi9sv44R3pWMndVFYQ=; b=AuzVgP5J6vXfNvbOftVkn9Eqr4M6tPkb7v5wYrz4LYZS+zrSnzZ2yM1/1uMPDUxc47 BzZxtaoqmTRKoA8hXdRdjj1duQPcTD6L8DysFa9IIdnqhsDlPzQYVAbh4HKi5bYj0cFB DGinqdWsnG92Z2BCSyByFF8haVYI8tGkot9KZg/v4D7F3fyuK/LdEhvvOqfezFfTNgsm IlF/A8Zokf94a/qPHGRhQ5/z0y7ECZ8gHGS27A/QTGcdR1Oa3J6HVOTeBCR6OeSD03qA MgN+Vdw3rg/rdpGuEtBEXpbY24izrO40XETH5Vp/oimYQPJgpGPb7fLoPTnvAZeykMP+ 9hbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707405645; x=1708010445; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D67SHaFW97kK6G1v5sE/VNmdoJi9sv44R3pWMndVFYQ=; b=j+Re9e//ahNGB1br/orh5W9zmUGoIivGjN8NpU2F6LaygNmGv68eSrwgGZj52YFOhX 6HdhofH7LIMw/1U8u1DtseUAsUBSqIukvgBZUwzDFUN12gY9OVnAMYTPGR/09Glj36na UomROm0oFsZbLooWnfgjD3SxYlrScHnCWmJZo3UfxEBEfbqLMhXKr7GPbvd3A5++Jh1w D+6Y1Q144kb6OdzffTAb7Q+JE8nxltvVanzkh8UE9Q7GZj858CTTE80E6IqeePRXQgSC NqihFnhe7FUwnO8EpiwjBzt8OP50vYTrto9RUmBxK63s3Uid/bNwxZWmRUfJO6dUXavs WiqA== X-Gm-Message-State: AOJu0YwfLFvcK5SXNKFhQ+LIprtjdxnlccgBI5ewElwjx18u603reTKN Cf80JSWRAdaBZBCK8JnDcvQLA/ozqfccHZIjRvv981eTMTA1JzUlSAfrMT5g3qE= X-Google-Smtp-Source: AGHT+IH9A/ZhsSGXhJI3AvEfUGwKLfOMvZISJTSd9vZctnai1z9WUucY5FBPn2uD81GHgLA8a1cEzQ== X-Received: by 2002:a2e:90d0:0:b0:2d0:b3c7:ce03 with SMTP id o16-20020a2e90d0000000b002d0b3c7ce03mr1267781ljg.8.1707405644921; Thu, 08 Feb 2024 07:20:44 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCURdqkJ2WRSXfdyEBttXogks7xwVwn87M1KqdeOYrfXikpeA61qO9FWjLDMnE6ovGiSqrAgcWDxoLA0EcAEDQ5ZyJsP4MJcYwt0zGGkZBvxcl+yG53txbu/iiTkUgmoUkpl4sMhl/gx+fdUmc4jlTCecEcPMRjbuNUe8or+SM5I821P/r4zUvXbWPJijLpxtGrQR/WPKFXh5MfcQHkZrFQu9WuFhJK6mrY1wJrGWihfJYCWEwXKsZluatJ5qSOAhuMYYkEipNBAOcCZtwfJ9qX8AB+cQox2AcSBw3OS5Hg2i/PVSKjPQU8lzXoinK24uUXDjxrRdNeamIFk+hc= Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id y4-20020a2e9d44000000b002d0d1caf26bsm22116ljj.7.2024.02.08.07.20.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 07:20:44 -0800 (PST) From: Dmitry Baryshkov Date: Thu, 08 Feb 2024 17:20:43 +0200 Subject: [PATCH v4 3/5] drm/msm/dpu: drop dpu_encoder_phys_ops.atomic_mode_set Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240208-fd_remove_phys_ops_atomic_mode_set-v4-3-caf5dcd125c0@linaro.org> References: <20240208-fd_remove_phys_ops_atomic_mode_set-v4-0-caf5dcd125c0@linaro.org> In-Reply-To: <20240208-fd_remove_phys_ops_atomic_mode_set-v4-0-caf5dcd125c0@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=9079; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=zjZbYdMAqyu+oLAUzHy6Hmx+VEZSTigImPrKgFvEAZw=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBlxPFKrsE8LWDGMW9/nvqV4MfCMOgGTrO0ueVzR R0wCthAr8qJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZcTxSgAKCRCLPIo+Aiko 1SVqB/9cI+TTRJMkCqPPSd4FnVJasvzalLfLfSvZX/EWpGJkcizbEF1+rGdSf2Bf9bXXjXGzt/Y W2iV5XBhVce/i22hjCqLtG4G+ricH7BXLo0UDs8OoejQrlE8axMhEbkyMuuxm1ZXyH11CgvVQ4c KXT2UzPKiylPKgxjU8jxw3HqlChTn5kdkcIKubiyNXnGFbci5N2iWldJlRvcc7nsIO4/93065Aw KofzXRs2Kx6Kf7nBlNnBkey+0PmRQWg0OaE4OofPLD/URmMPWX++dxKMXrQlvCmPLmP4EBRmOPV ju/6/WaH/1IHBx9D7XFuU2RvzTRfYquVfP0aeTNFZGRZ9h0+ X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A The atomic_mode_set() callback only sets the phys_enc's IRQ data. As the INTF and WB are statically allocated to each encoder/phys_enc, drop the atomic_mode_set callback and set the IRQs during encoder init. For the CMD panel usecase some of IRQ indexes depend on the selected resources. Move setting them to the irq_enable() callback. Reviewed-by: Abhinav Kumar Tested-by: Abhinav Kumar # sc7280 Signed-off-by: Dmitry Baryshkov Tested-by: Paloma Arellano --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 -- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h | 5 ---- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 32 ++++++++++------------ .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 13 ++------- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 11 +------- 5 files changed, 17 insertions(+), 46 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 6cf2e186a350..2da50ce0c999 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -1152,8 +1152,6 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc, phys->hw_ctl = to_dpu_hw_ctl(hw_ctl[i]); phys->cached_mode = crtc_state->adjusted_mode; - if (phys->ops.atomic_mode_set) - phys->ops.atomic_mode_set(phys, crtc_state, conn_state); } } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h index 8c5b0c853572..7eb8bdfe6bbe 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h @@ -69,8 +69,6 @@ struct dpu_encoder_phys; * @is_master: Whether this phys_enc is the current master * encoder. Can be switched at enable time. Based * on split_role and current mode (CMD/VID). - * @atomic_mode_set: DRM Call. Set a DRM mode. - * This likely caches the mode, for use at enable. * @enable: DRM Call. Enable a DRM mode. * @disable: DRM Call. Disable mode. * @atomic_check: DRM Call. Atomic check new DRM state. @@ -96,9 +94,6 @@ struct dpu_encoder_phys; struct dpu_encoder_phys_ops { void (*prepare_commit)(struct dpu_encoder_phys *encoder); bool (*is_master)(struct dpu_encoder_phys *encoder); - void (*atomic_mode_set)(struct dpu_encoder_phys *encoder, - struct drm_crtc_state *crtc_state, - struct drm_connector_state *conn_state); void (*enable)(struct dpu_encoder_phys *encoder); void (*disable)(struct dpu_encoder_phys *encoder); int (*atomic_check)(struct dpu_encoder_phys *encoder, diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c index de826f9745e5..fc1d5736d7fc 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c @@ -142,23 +142,6 @@ static void dpu_encoder_phys_cmd_underrun_irq(void *arg) dpu_encoder_underrun_callback(phys_enc->parent, phys_enc); } -static void dpu_encoder_phys_cmd_atomic_mode_set( - struct dpu_encoder_phys *phys_enc, - struct drm_crtc_state *crtc_state, - struct drm_connector_state *conn_state) -{ - phys_enc->irq[INTR_IDX_CTL_START] = phys_enc->hw_ctl->caps->intr_start; - - phys_enc->irq[INTR_IDX_PINGPONG] = phys_enc->hw_pp->caps->intr_done; - - if (phys_enc->has_intf_te) - phys_enc->irq[INTR_IDX_RDPTR] = phys_enc->hw_intf->cap->intr_tear_rd_ptr; - else - phys_enc->irq[INTR_IDX_RDPTR] = phys_enc->hw_pp->caps->intr_rdptr; - - phys_enc->irq[INTR_IDX_UNDERRUN] = phys_enc->hw_intf->cap->intr_underrun; -} - static int _dpu_encoder_phys_cmd_handle_ppdone_timeout( struct dpu_encoder_phys *phys_enc) { @@ -297,6 +280,14 @@ static void dpu_encoder_phys_cmd_irq_enable(struct dpu_encoder_phys *phys_enc) phys_enc->hw_pp->idx - PINGPONG_0, phys_enc->vblank_refcount); + phys_enc->irq[INTR_IDX_CTL_START] = phys_enc->hw_ctl->caps->intr_start; + phys_enc->irq[INTR_IDX_PINGPONG] = phys_enc->hw_pp->caps->intr_done; + + if (phys_enc->has_intf_te) + phys_enc->irq[INTR_IDX_RDPTR] = phys_enc->hw_intf->cap->intr_tear_rd_ptr; + else + phys_enc->irq[INTR_IDX_RDPTR] = phys_enc->hw_pp->caps->intr_rdptr; + dpu_core_irq_register_callback(phys_enc->dpu_kms, phys_enc->irq[INTR_IDX_PINGPONG], dpu_encoder_phys_cmd_pp_tx_done_irq, @@ -327,6 +318,10 @@ static void dpu_encoder_phys_cmd_irq_disable(struct dpu_encoder_phys *phys_enc) dpu_core_irq_unregister_callback(phys_enc->dpu_kms, phys_enc->irq[INTR_IDX_UNDERRUN]); dpu_encoder_phys_cmd_control_vblank_irq(phys_enc, false); dpu_core_irq_unregister_callback(phys_enc->dpu_kms, phys_enc->irq[INTR_IDX_PINGPONG]); + + phys_enc->irq[INTR_IDX_CTL_START] = 0; + phys_enc->irq[INTR_IDX_PINGPONG] = 0; + phys_enc->irq[INTR_IDX_RDPTR] = 0; } static void dpu_encoder_phys_cmd_tearcheck_config( @@ -706,7 +701,6 @@ static void dpu_encoder_phys_cmd_init_ops( struct dpu_encoder_phys_ops *ops) { ops->is_master = dpu_encoder_phys_cmd_is_master; - ops->atomic_mode_set = dpu_encoder_phys_cmd_atomic_mode_set; ops->enable = dpu_encoder_phys_cmd_enable; ops->disable = dpu_encoder_phys_cmd_disable; ops->control_vblank_irq = dpu_encoder_phys_cmd_control_vblank_irq; @@ -745,6 +739,8 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init(struct drm_device *dev, dpu_encoder_phys_cmd_init_ops(&phys_enc->ops); phys_enc->intf_mode = INTF_MODE_CMD; + phys_enc->irq[INTR_IDX_UNDERRUN] = phys_enc->hw_intf->cap->intr_underrun; + cmd_enc->stream_sel = 0; if (!phys_enc->hw_intf) { diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c index 9743ec43d862..bc4ac7e2e4ba 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c @@ -349,16 +349,6 @@ static bool dpu_encoder_phys_vid_needs_single_flush( return phys_enc->split_role != ENC_ROLE_SOLO; } -static void dpu_encoder_phys_vid_atomic_mode_set( - struct dpu_encoder_phys *phys_enc, - struct drm_crtc_state *crtc_state, - struct drm_connector_state *conn_state) -{ - phys_enc->irq[INTR_IDX_VSYNC] = phys_enc->hw_intf->cap->intr_vsync; - - phys_enc->irq[INTR_IDX_UNDERRUN] = phys_enc->hw_intf->cap->intr_underrun; -} - static int dpu_encoder_phys_vid_control_vblank_irq( struct dpu_encoder_phys *phys_enc, bool enable) @@ -686,7 +676,6 @@ static int dpu_encoder_phys_vid_get_frame_count( static void dpu_encoder_phys_vid_init_ops(struct dpu_encoder_phys_ops *ops) { ops->is_master = dpu_encoder_phys_vid_is_master; - ops->atomic_mode_set = dpu_encoder_phys_vid_atomic_mode_set; ops->enable = dpu_encoder_phys_vid_enable; ops->disable = dpu_encoder_phys_vid_disable; ops->control_vblank_irq = dpu_encoder_phys_vid_control_vblank_irq; @@ -725,6 +714,8 @@ struct dpu_encoder_phys *dpu_encoder_phys_vid_init(struct drm_device *dev, dpu_encoder_phys_vid_init_ops(&phys_enc->ops); phys_enc->intf_mode = INTF_MODE_VIDEO; + phys_enc->irq[INTR_IDX_VSYNC] = phys_enc->hw_intf->cap->intr_vsync; + phys_enc->irq[INTR_IDX_UNDERRUN] = phys_enc->hw_intf->cap->intr_underrun; DPU_DEBUG_VIDENC(phys_enc, "created intf idx:%d\n", p->hw_intf->idx); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c index 602013725484..a0a28230fc31 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c @@ -539,15 +539,6 @@ static void dpu_encoder_phys_wb_irq_disable(struct dpu_encoder_phys *phys) dpu_core_irq_unregister_callback(phys->dpu_kms, phys->irq[INTR_IDX_WB_DONE]); } -static void dpu_encoder_phys_wb_atomic_mode_set( - struct dpu_encoder_phys *phys_enc, - struct drm_crtc_state *crtc_state, - struct drm_connector_state *conn_state) -{ - - phys_enc->irq[INTR_IDX_WB_DONE] = phys_enc->hw_wb->caps->intr_wb_done; -} - static void _dpu_encoder_phys_wb_handle_wbdone_timeout( struct dpu_encoder_phys *phys_enc) { @@ -784,7 +775,6 @@ static bool dpu_encoder_phys_wb_is_valid_for_commit(struct dpu_encoder_phys *phy static void dpu_encoder_phys_wb_init_ops(struct dpu_encoder_phys_ops *ops) { ops->is_master = dpu_encoder_phys_wb_is_master; - ops->atomic_mode_set = dpu_encoder_phys_wb_atomic_mode_set; ops->enable = dpu_encoder_phys_wb_enable; ops->disable = dpu_encoder_phys_wb_disable; ops->atomic_check = dpu_encoder_phys_wb_atomic_check; @@ -831,6 +821,7 @@ struct dpu_encoder_phys *dpu_encoder_phys_wb_init(struct drm_device *dev, dpu_encoder_phys_wb_init_ops(&phys_enc->ops); phys_enc->intf_mode = INTF_MODE_WB_LINE; + phys_enc->irq[INTR_IDX_WB_DONE] = phys_enc->hw_wb->caps->intr_wb_done; atomic_set(&wb_enc->wbirq_refcount, 0);