From patchwork Tue Jul 9 13:48:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13728080 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1DF55C3DA47 for ; Tue, 9 Jul 2024 13:48:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7EC1D10E559; Tue, 9 Jul 2024 13:48:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="oELmUd66"; dkim-atps=neutral Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id DE87210E559 for ; Tue, 9 Jul 2024 13:48:29 +0000 (UTC) Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-52eafa1717bso2481345e87.2 for ; Tue, 09 Jul 2024 06:48:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720532908; x=1721137708; darn=lists.freedesktop.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=E3rqoSXZHGMGmxvjGDiiPCjvj8LcgIFTaqvOfNwnFjg=; b=oELmUd66PK5xSM23Hntfrl7bg7D6lqgpaIIA1c4bZKSpvHPcNNdDmsTQYZjRPEdNxB e/HM4TmU1+TF7zQOm9keZ/at0HUdcUhT9g3v5JeYEZG+pNstSPBiljcaw+CZg2RWlyZn jh3hcmoRIPKVnAienoiLll/EFXN2Wwmql0w7NiLq8rLdKHBI+f8vSZXz/HYnHqfwh7Do x/iUruEeqfD/YZmb6CU4gQIgM4RqGi3wthDMdBfIk35EuCl21+Vk3byF1HPa600qD3bW WRzWytTkG9tgXu56GxgrgRXkFhleLqAjO/jE5svTtc+fX/yYkyZLJm4zbzBsohiZvZZt hNZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720532908; x=1721137708; 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=E3rqoSXZHGMGmxvjGDiiPCjvj8LcgIFTaqvOfNwnFjg=; b=guvZbz7yFjYtoIuBJA4DXkZb5W777JHYdCKVbJv+Ct4eDgsODQ6xq4R284vopQQOJk TsfF5OLISQBxrGSi9Js1wtU6xT0dQ24tG39+eQ5+MuuMvlqd0Z//aTHexrXK1JYHaFdn zVZo3dCRUa3SRLQ1IZbL8lbBl/7pXraWYFJWMrv7CfCbk4C2+cB6XYCAIAqUlEM/C7aM zyeTv50h4cl1/8vCtBC0UsC1rlhejfjDmGwvy6RTH4acD57KJPrGfTE/XN5OjzYWDoyk 141Qwfw+XIjchQnPUizJaB9UgTuQrr2Bxrv16yIOCewrPNgSFWCFYvP+Mbf94JEQB6n7 kHNw== X-Forwarded-Encrypted: i=1; AJvYcCUHm9sBko/T2uv5v4vNVM/bt9M7zj6wgxqgbPn0kZoQggnbTGE3rJWV82K84IA48faN7QBUhbWXW36g6ne8MVrmSeJ9OBdm+HGHtNYIpr0/ X-Gm-Message-State: AOJu0Yw+EC6qzyg2WXapbGrQRPKnzcFNX6NExoxm7kQ8phyGT0KGZHw9 X+OJSCRJ98cOqLAFBJ2xoV1wrV9jw7sCYugkjDQgKexnZo73ECW67otZlwUq/0c= X-Google-Smtp-Source: AGHT+IEJOKC9CKr3gPG/ltR1Yag3QnJkvqhSLl98qea8/8qeL+x+wytN3L9Buqxyh3K51KaCWlt2Iw== X-Received: by 2002:a05:6512:ea5:b0:52c:dbe6:f5f9 with SMTP id 2adb3069b0e04-52eb9990e79mr1811035e87.12.1720532907990; Tue, 09 Jul 2024 06:48:27 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52eb8e4959csm250297e87.82.2024.07.09.06.48.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 06:48:27 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 09 Jul 2024 16:48:22 +0300 Subject: [PATCH 1/2] drm/msm/dpu1: don't choke on disabling the writeback connector MIME-Version: 1.0 Message-Id: <20240709-dpu-fix-wb-v1-1-448348bfd4cb@linaro.org> References: <20240709-dpu-fix-wb-v1-0-448348bfd4cb@linaro.org> In-Reply-To: <20240709-dpu-fix-wb-v1-0-448348bfd4cb@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Jordan Crouse , Chandan Uddaraju , Rajesh Yadav , Sravanthi Kollukuduru , Archit Taneja Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jeykumar Sankaran , stable@vger.kernel.org, Leonard Lausen X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1664; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=+E5EN258CmnPr6iL8KBqJO5+7w/22exHf4+Ix8HRjHU=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmjT+ot0Pj4iBt23/EIWWepNxdc5knallwOTMKB koOGNPvKYCJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZo0/qAAKCRCLPIo+Aiko 1QKrCACjWqffsbS74ss5192ue6vxtSpLZimoCu02BjWnVbJm7yBYjEdISlCFKotHf0tVu/dW71C WhQy92Bej8KFlfXpBgnE/GvMqMDyQN7azFM/rcRWqJl/nKSbia/Fw5sKXHmNAQonGSBXEZWF0WP V7HsgrG016SbytVD0wPJiZaY/HfWxWsn8qZgpS1m4PRrNnPt0cM6JOF9WLaZLs27utpEm6yDD8X uPv2DI1F+EcsA+UQPo3hBTZnJv+GnghVf2SQqatQT64R/lPa+S+Uza7IbvvYpQcrrdf/rHB4dR7 IJcfpheofCTjzvSWLvpf7s2AX5bmdzxZG2fv60b6kEFW0n+m X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In order to prevent any errors on connector being disabled, move the state->crtc check upfront. This should fix the issues during suspend when the writeback connector gets forcebly disabled. Fixes: 71174f362d67 ("drm/msm/dpu: move writeback's atomic_check to dpu_writeback.c") Cc: stable@vger.kernel.org Reported-by: Leonard Lausen Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/57 Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c index 16f144cbc0c9..5c172bcf3419 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c @@ -39,6 +39,13 @@ static int dpu_wb_conn_atomic_check(struct drm_connector *connector, DPU_DEBUG("[atomic_check:%d]\n", connector->base.id); + crtc = conn_state->crtc; + if (!crtc) + return 0; + + if (!conn_state->writeback_job || !conn_state->writeback_job->fb) + return 0; + if (!conn_state || !conn_state->connector) { DPU_ERROR("invalid connector state\n"); return -EINVAL; @@ -47,13 +54,6 @@ static int dpu_wb_conn_atomic_check(struct drm_connector *connector, return -EINVAL; } - crtc = conn_state->crtc; - if (!crtc) - return 0; - - if (!conn_state->writeback_job || !conn_state->writeback_job->fb) - return 0; - crtc_state = drm_atomic_get_crtc_state(state, crtc); if (IS_ERR(crtc_state)) return PTR_ERR(crtc_state); From patchwork Tue Jul 9 13:48:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13728081 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6D80FC2BD09 for ; Tue, 9 Jul 2024 13:48:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C311D10E55D; Tue, 9 Jul 2024 13:48:31 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="WKyxT1WX"; dkim-atps=neutral Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2F73810E55F for ; Tue, 9 Jul 2024 13:48:31 +0000 (UTC) Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-52e99060b41so5554599e87.2 for ; Tue, 09 Jul 2024 06:48:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720532909; x=1721137709; darn=lists.freedesktop.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=IVsuhaP11rLzifuOYfoCT/JsmgFit3NDN+KhNk6m6Fg=; b=WKyxT1WX5qBwpSKrNTCZ3KJK27dqHRB8wEtCrs4m8VISWI+gJ6Bm9h0oJv8zzo1SAd EPGo15AcF33qgj89cAHUHcHiBH8MB5GNcSYBRO4cIHmHBGCthV1bxeq4LoXjp2sRBCF3 3PMUx+uYOSEThy3/sh4mlOnZafLS2NtXEQ5kJZZpA9xwC7ysD9l/o7q35nqOjlRQCues r0uX3BFTZvxDqEqQwCLIAYjH0iQILwJY/y0RNp9Qct3Fmx9GYwwl4Y9mIWABms3EaUXd nb92XXfglsIgQJsNTmh/VO5t7YLqcfM0+KjIfwcwfR09lzabnbKx8A258/V1/nxh/FXV Vofw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720532909; x=1721137709; 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=IVsuhaP11rLzifuOYfoCT/JsmgFit3NDN+KhNk6m6Fg=; b=ap81yInBpxzN2yKWjxxKsBHP8O0OlYApej1Kj/mwqSjt2kxzwIxnWkhQsRNa5qR/Ep cSLraen4nOopl9uHVXQRtnC7KPK9FISUQfNLU9dikCoaVfmoSjWDwGrXTGVFVQPnlnrq GS/P0uITskYc5sFr9YWUWvuIIH6ffiY9PLyK9eQkgXcicDvQhwagSUuItujltVqb5vSc eAapcVefIBagFTFodlXQizNsnneNFgPJqrAGXkZ7Uo8/YjFiPVZhIjjYaH80UIGD3+P3 OOzk19GYT+FumW2suSurni4Rn+VEEdUIKpjYeD1g3OLLnz9a1p2YjjdN9zqIiYnp3Xbq frMQ== X-Forwarded-Encrypted: i=1; AJvYcCVVq0ynPbcShEdBy+qX6q5iSmfjJiaPqrzKyeqc10vO8Pys+XCLux2JuEujWPyhgKjXlNdr+ACxduawNNcr08O2rnPj0QmRJUQl5ka2fUMF X-Gm-Message-State: AOJu0YzyObuqEuPq0zFraMpQU6TGMKmt6j3JjyGTvcNNjH1lcA5JBlmG dfPjCO0uC2YCPGCw0gIZFQZvl7b/oZvWW9BNKjlRkcfJTcFK28oMGivzK1Otuws= X-Google-Smtp-Source: AGHT+IEaDUQIyebHpQsxc8nw3fDHAFZgaEz1nXPH9SPNxdY+OR16Je0rKup8mDiVn9/F2IwT3VnrBg== X-Received: by 2002:a05:6512:752:b0:52e:95dd:a8ed with SMTP id 2adb3069b0e04-52eb99a199fmr1263558e87.35.1720532909315; Tue, 09 Jul 2024 06:48:29 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52eb8e4959csm250297e87.82.2024.07.09.06.48.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 06:48:28 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 09 Jul 2024 16:48:23 +0300 Subject: [PATCH 2/2] drm/msm/dpu: don't play tricks with debug macros MIME-Version: 1.0 Message-Id: <20240709-dpu-fix-wb-v1-2-448348bfd4cb@linaro.org> References: <20240709-dpu-fix-wb-v1-0-448348bfd4cb@linaro.org> In-Reply-To: <20240709-dpu-fix-wb-v1-0-448348bfd4cb@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Jordan Crouse , Chandan Uddaraju , Rajesh Yadav , Sravanthi Kollukuduru , Archit Taneja Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jeykumar Sankaran X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2037; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=5MmuIH9/ptcSX8goq+NiIFoXU3SW2qDd+IHPfO869oE=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ1qv/Qof//Jj7Pw+y0yYutVkmev9z8YY/z7xmP0Fk3LWV ffpgZ6djMYsDIxcDLJiiiw+BS1TYzYlh33YMbUeZhArE8gUBi5OAZjI+V3s/wzDDrWdCnywurzf +9I25rTUQxqHj591S21Ikv/lmOR4tLmB85VMXOFJHeea6mWCTKmbunc7rTqW6HTPcNcfqefx/1w sPsV0ZNm/ce7XP3MriNPsowT7rrr49z6Mkzp4Xmu84t04572XTU7tgdb3rxY2Hltx+66hzoxLzS 1PJpcci9xg0b7YN6MoZveaKX4eR3d+ddk8e7vG5ucL590X3HFkfXShVu5RSQ8P4SzzAJbg7T3sA ho8zOv5XpY9qwtaOddC8yBXaCh/Cscp3shKzbLAxc4zw+Rc1wgnca3mT2iIT1pdL6ni7nO7Zcv3 F+qfI5lus5j7xG5a8PuYtMEZ7rO207veRnHd+Pth3SdNAA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" DPU debugging macros need to be converted to a proper drm_debug_* macros, however this is a going an intrusive patch, not suitable for a fix. Wire DPU_DEBUG and DPU_DEBUG_DRIVER to always use DRM_DEBUG_DRIVER to make sure that DPU debugging messages always end up in the drm debug messages and are controlled via the usual drm.debug mask. Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support") Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h index e2adc937ea63..935ff6fd172c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h @@ -31,24 +31,14 @@ * @fmt: Pointer to format string */ #define DPU_DEBUG(fmt, ...) \ - do { \ - if (drm_debug_enabled(DRM_UT_KMS)) \ - DRM_DEBUG(fmt, ##__VA_ARGS__); \ - else \ - pr_debug(fmt, ##__VA_ARGS__); \ - } while (0) + DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__) /** * DPU_DEBUG_DRIVER - macro for hardware driver logging * @fmt: Pointer to format string */ #define DPU_DEBUG_DRIVER(fmt, ...) \ - do { \ - if (drm_debug_enabled(DRM_UT_DRIVER)) \ - DRM_ERROR(fmt, ##__VA_ARGS__); \ - else \ - pr_debug(fmt, ##__VA_ARGS__); \ - } while (0) + DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__) #define DPU_ERROR(fmt, ...) pr_err("[dpu error]" fmt, ##__VA_ARGS__) #define DPU_ERROR_RATELIMITED(fmt, ...) pr_err_ratelimited("[dpu error]" fmt, ##__VA_ARGS__)