From patchwork Sun Dec 3 00:05:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 749815 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="C455Y+/p" Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12EEC107 for ; Sat, 2 Dec 2023 16:05:38 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-50bf37fd2bbso1358e87.0 for ; Sat, 02 Dec 2023 16:05:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701561936; x=1702166736; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yhduEdY9rfFEo5t7qo9Oszbc0IZqRQzEBjCv6mdoXAM=; b=C455Y+/pWz8uzedYpKZWlkBiA0liLdy7NKBBMEKQRiFEgLsXzZN8F32P/uWWL/QTB2 kiUaaOyMNEjYZxQzcTXTZkV9bnKbdz/yOr3JTFP1GNdocsaJlcylcBdMSBgnPDi4Q5Pv iqSJcJOMhTKZvfBrRivC8MiwtvWNXCSVUiJJGN4rvT6TqXw742j9bMIQ7O1mrt65Mreg /l711lUJmxAeVrxeLPyTBSmiv9Y5fo4sqLLvGY+ttt9dZ1QyaIHE93pa7R1EEFUoSzfG gkkdLv4wC7XUDcdR5RBjQgn4aRCa+koYNKFP+QhqCS9bSO+XoRcNydF1Ardp8uSjgPKJ ATsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701561936; x=1702166736; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yhduEdY9rfFEo5t7qo9Oszbc0IZqRQzEBjCv6mdoXAM=; b=V21hszzYlO7nj479XFcSxnu610ib5xly+8hDChA5Yl1tys+lC6lC4MpD8Kz5G9/AEU itFZRHbLIamBgmHkWPRO2OgKJB4vyzP5ejmRHAvWteZmT2J2VXkm8CPJjpG6ogouSLlk LcuZE5+wBq8svlTSDwxqTjiLd8jw3T8Y0236rtRBUN4DudMncmDOyIF/2wrZZPY3IyA6 Hd04m8bU37lneE6PYgfaY1XUdMO5zVM2ZwJC6JtyfS+mMTzFodMc+gzDqkzRtho+XZxR AOVv76m77jMY+It5Iun/Q0uqm9w1vSCABk1wZNQEmsub1W7EbGLVMGfQky5Gfhjmc3ST opQQ== X-Gm-Message-State: AOJu0Yz7bc9jfcsO+nR6dWFWPFU0SZTIfW2U2PKuXjn0hEpyKpqMLQXX T3fvaYBYT5rfG6g6fWUg2IWCYw== X-Google-Smtp-Source: AGHT+IEnH09BN8lJCnFzv/1AEwB1sYe5O3yf8kfOev9tVf+ZhwPkF/62e21L4u2Nl2L7UYNUJg5kQg== X-Received: by 2002:ac2:4f05:0:b0:50b:d764:76de with SMTP id k5-20020ac24f05000000b0050bd76476demr3115828lfr.109.1701561936482; Sat, 02 Dec 2023 16:05:36 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id t2-20020a19ad02000000b0050bc5edfa45sm826273lfc.85.2023.12.02.16.05.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 16:05:35 -0800 (PST) From: Dmitry Baryshkov To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: Rob Clark , Abhinav Kumar , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH RESEND 2/5] drm/msm/dpu: finalise global state object Date: Sun, 3 Dec 2023 03:05:29 +0300 Message-Id: <20231203000532.1290480-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231203000532.1290480-1-dmitry.baryshkov@linaro.org> References: <20231203000532.1290480-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add calls to finalise global state object and corresponding lock. Fixes: de3916c70a24 ("drm/msm/dpu: Track resources in global state") Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index fe7267b3bff5..73f70e67cfef 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -385,6 +385,12 @@ static int dpu_kms_global_obj_init(struct dpu_kms *dpu_kms) return 0; } +static void dpu_kms_global_obj_fini(struct dpu_kms *dpu_kms) +{ + drm_atomic_private_obj_fini(&dpu_kms->global_state); + drm_modeset_lock_fini(&dpu_kms->global_state_lock); +} + static int dpu_kms_parse_data_bus_icc_path(struct dpu_kms *dpu_kms) { struct icc_path *path0; @@ -826,6 +832,8 @@ static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms) dpu_rm_destroy(&dpu_kms->rm); dpu_kms->rm_init = false; + dpu_kms_global_obj_fini(dpu_kms); + dpu_kms->catalog = NULL; if (dpu_kms->hw_mdp) From patchwork Sun Dec 3 00:05:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 749814 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VUo5hyzY" Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 778CC119 for ; Sat, 2 Dec 2023 16:05:39 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-50bba815f30so4536679e87.2 for ; Sat, 02 Dec 2023 16:05:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701561938; x=1702166738; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2wetDbrUp7wzaYT8YoqkILZjkdOZaiSrBcUzXNmocOY=; b=VUo5hyzYfw2dS0ZBXBC+KHJcssz2uazcbf9JELAqX7XgRYAv1bpQsiyitguq223ulU k45afYaAIJaywlT5YkFh2G7ROCtx6lKq2oFoNezHRFjqJ7B4aMLNNfnp2UjOGj5keIQo WCib9X59Qlob8QDmA1TY8gnBHOmGNo8qAyOAodxULkFHQfBJlSgvHtxGp2fbT9aJ4ynF bLuOmJ46dgmLJD12MxwXeG0VuAlhuikhW4Ok/L+t24W+dQbOTu7X2KzrXbWOq/Z+CUjd 6uebXVmejqUcKGVYPAYc/KIKPyviVNFwVSKntYsR4zHxQV+6YDEpnLFd7Yn+xd4DhEsq +Hdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701561938; x=1702166738; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2wetDbrUp7wzaYT8YoqkILZjkdOZaiSrBcUzXNmocOY=; b=uhe6vcMqGhDKsPW3esEFjCRQfMmL0lfrUk5Qv5vlKfA8h0r3EW7ce5sGXbHX11XU3Z PFu8hNHf7RdFdpwOHR5mkD9nGKkAHcJUFxTZ8KYu+LW0U5XTct+akiNHOQTBB4SzAZZf yyYhGVRYQnVH14lSxxGd/DXEeB9aTs+v1gtpGX8VNns1l4m+nxTKPDG1a354idG0+ZxM a1b6K40V5Fp5K9t5K++OewV71FTHrZawrJ4bC2a67U3JLNd6tcy2OIUF9t2exaXNRjDK qMG5UAqauiLs4scfE+yIu45I1z6/utPs6uALVvqSmjejCUulpNCDvemHL5VMSYp3LB0D JIgw== X-Gm-Message-State: AOJu0Yz3zMJotSYl/eSqSmdfMZgX653uwpidv2KBfZf3EJiqSF0FJz24 HsgIHA7uPENRQggY5CmcIssY0w== X-Google-Smtp-Source: AGHT+IESMi4Mgc++6MpM8bxtFAp/InWMKWQpyiMp3iYt0NBXebRAcZmsAaZhn2GmXTCD2zsL9XK8hQ== X-Received: by 2002:a05:6512:6c5:b0:50b:d944:bfcc with SMTP id u5-20020a05651206c500b0050bd944bfccmr1144212lff.142.1701561937829; Sat, 02 Dec 2023 16:05:37 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id t2-20020a19ad02000000b0050bc5edfa45sm826273lfc.85.2023.12.02.16.05.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 16:05:37 -0800 (PST) From: Dmitry Baryshkov To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: Rob Clark , Abhinav Kumar , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH RESEND 4/5] drm/msm/mdp5: migrate SMP dumping to using atomic_print_state Date: Sun, 3 Dec 2023 03:05:31 +0300 Message-Id: <20231203000532.1290480-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231203000532.1290480-1-dmitry.baryshkov@linaro.org> References: <20231203000532.1290480-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The Shared Memory Pool (SMP) state is a part of the MDP5's private object state. Use existing infrastructure, atomic_print_state() callback, to dump SMP state (which also makes it included into debugfs/dri/N/state). This allows us to drop the custom debugfs file too. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/disp/mdp5/mdp5_irq.c | 2 -- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 46 ++++++------------------ drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c | 12 ++----- drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.h | 4 ++- 4 files changed, 15 insertions(+), 49 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_irq.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_irq.c index 43443a435d59..b40ed3a847c8 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_irq.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_irq.c @@ -31,8 +31,6 @@ static void mdp5_irq_error_handler(struct mdp_irq *irq, uint32_t irqstatus) if (dumpstate && __ratelimit(&rs)) { struct drm_printer p = drm_info_printer(mdp5_kms->dev->dev); drm_state_dump(mdp5_kms->dev, &p); - if (mdp5_kms->smp) - mdp5_smp_dump(mdp5_kms->smp, &p); } } diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index ec933d597e20..cd46c2b0ec0c 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -119,9 +119,19 @@ static void mdp5_global_destroy_state(struct drm_private_obj *obj, kfree(mdp5_state); } +static void mdp5_global_print_state(struct drm_printer *p, + const struct drm_private_state *state) +{ + struct mdp5_global_state *mdp5_state = to_mdp5_global_state(state); + + if (mdp5_state->mdp5_kms->smp) + mdp5_smp_dump(mdp5_state->mdp5_kms->smp, p, mdp5_state); +} + static const struct drm_private_state_funcs mdp5_global_state_funcs = { .atomic_duplicate_state = mdp5_global_duplicate_state, .atomic_destroy_state = mdp5_global_destroy_state, + .atomic_print_state = mdp5_global_print_state, }; static int mdp5_global_obj_init(struct mdp5_kms *mdp5_kms) @@ -226,39 +236,6 @@ static void mdp5_kms_destroy(struct msm_kms *kms) mdp5_destroy(mdp5_kms); } -#ifdef CONFIG_DEBUG_FS -static int smp_show(struct seq_file *m, void *arg) -{ - struct drm_info_node *node = m->private; - struct drm_device *dev = node->minor->dev; - struct msm_drm_private *priv = dev->dev_private; - struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(priv->kms)); - struct drm_printer p = drm_seq_file_printer(m); - - if (!mdp5_kms->smp) { - drm_printf(&p, "no SMP pool\n"); - return 0; - } - - mdp5_smp_dump(mdp5_kms->smp, &p); - - return 0; -} - -static struct drm_info_list mdp5_debugfs_list[] = { - {"smp", smp_show }, -}; - -static int mdp5_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor) -{ - drm_debugfs_create_files(mdp5_debugfs_list, - ARRAY_SIZE(mdp5_debugfs_list), - minor->debugfs_root, minor); - - return 0; -} -#endif - static const struct mdp_kms_funcs kms_funcs = { .base = { .hw_init = mdp5_hw_init, @@ -277,9 +254,6 @@ static const struct mdp_kms_funcs kms_funcs = { .get_format = mdp_get_format, .set_split_display = mdp5_set_split_display, .destroy = mdp5_kms_destroy, -#ifdef CONFIG_DEBUG_FS - .debugfs_init = mdp5_kms_debugfs_init, -#endif }, .set_irqmask = mdp5_set_irqmask, }; diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c index b68682c1b5bc..ab5e3ba5aa2f 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c @@ -325,22 +325,17 @@ void mdp5_smp_complete_commit(struct mdp5_smp *smp, struct mdp5_smp_state *state state->released = 0; } -void mdp5_smp_dump(struct mdp5_smp *smp, struct drm_printer *p) +void mdp5_smp_dump(struct mdp5_smp *smp, struct drm_printer *p, + struct mdp5_global_state *global_state) { struct mdp5_kms *mdp5_kms = get_kms(smp); struct mdp5_hw_pipe_state *hwpstate; struct mdp5_smp_state *state; - struct mdp5_global_state *global_state; int total = 0, i, j; drm_printf(p, "name\tinuse\tplane\n"); drm_printf(p, "----\t-----\t-----\n"); - if (drm_can_sleep()) - drm_modeset_lock(&mdp5_kms->glob_state_lock, NULL); - - global_state = mdp5_get_existing_global_state(mdp5_kms); - /* grab these *after* we hold the state_lock */ hwpstate = &global_state->hwpipe; state = &global_state->smp; @@ -365,9 +360,6 @@ void mdp5_smp_dump(struct mdp5_smp *smp, struct drm_printer *p) drm_printf(p, "TOTAL:\t%d\t(of %d)\n", total, smp->blk_cnt); drm_printf(p, "AVAIL:\t%d\n", smp->blk_cnt - bitmap_weight(state->state, smp->blk_cnt)); - - if (drm_can_sleep()) - drm_modeset_unlock(&mdp5_kms->glob_state_lock); } void mdp5_smp_destroy(struct mdp5_smp *smp) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.h b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.h index ba5618e136c3..7a24c887760b 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.h +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.h @@ -70,7 +70,9 @@ struct mdp5_smp *mdp5_smp_init(struct mdp5_kms *mdp5_kms, const struct mdp5_smp_block *cfg); void mdp5_smp_destroy(struct mdp5_smp *smp); -void mdp5_smp_dump(struct mdp5_smp *smp, struct drm_printer *p); +struct mdp5_global_state; +void mdp5_smp_dump(struct mdp5_smp *smp, struct drm_printer *p, + struct mdp5_global_state *global_state); uint32_t mdp5_smp_calculate(struct mdp5_smp *smp, const struct mdp_format *format,