From patchwork Thu Jun 13 19:17:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 13697345 X-Patchwork-Delegate: kieran@bingham.xyz Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [195.130.137.89]) (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 E3E2A15253B for ; Thu, 13 Jun 2024 19:18:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.137.89 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718306298; cv=none; b=ScJZwm4cijtJvH/r07SS0xIvEYQ0XnoggsnFaKyCRGOqtCgGTAR/50xDmGRocnYICvMJBoLOnb5H+jcaH9ld2ITJfvSOPRX9vGGa6R0BjDBrwPHr+IhDmNyVbYwRUnHhtifVRCyrLhuRkBrYAY1E3hnpWWxnZ90QmlyEHjzexWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718306298; c=relaxed/simple; bh=Rg4B6D/bwEKjMcrukcRStwxKfCFviBM5ZIM1wC7n26A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=b63LekkH9pvOrU4xi7W8sPkeuvB9hMugXT0R9VbDhrUm+d7uIiZZOvARy7W6GyUAPddXsuSXMLCkohg4UkHAjK/yx6BEwegfXQd1vTM1OHsauqmRCqw/MmTPMi88Zs9vTdRuydG/QMSvMzdwD96DQluTSBTmlZDcajr7GdfPMO4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.137.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:be2a:f066:50f0:dff7]) by laurent.telenet-ops.be with bizsmtp id b7J62C0073w30qz017J6YW; Thu, 13 Jun 2024 21:18:08 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1sHpwS-00Ax6j-CJ; Thu, 13 Jun 2024 21:18:06 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1sHpxW-00FL8T-CT; Thu, 13 Jun 2024 21:18:06 +0200 From: Geert Uytterhoeven To: Jocelyn Falempe , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: Helge Deller , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 1/7] drm/panic: Fix uninitialized drm_scanout_buffer.set_pixel() crash Date: Thu, 13 Jun 2024 21:17:59 +0200 Message-Id: <4c250d21880ca0b97e41da7b6a101bdf07e9d015.1718305355.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 No implementations of drm_plane_helper_funcs.get_scanout_buffer() fill in the optional drm_scanout_buffer.set_pixel() member. Hence the member may contain non-zero garbage, causing a crash when deferencing it during drm panic. Fix this by pre-initializing the drm_scanout_buffer object before calling drm_plane_helper_funcs.get_scanout_buffer(). Fixes: 24d07f114e4ec760 ("drm/panic: Add a set_pixel() callback to drm_scanout_buffer") Signed-off-by: Geert Uytterhoeven Reviewed-by: Jocelyn Falempe --- v2: - New. --- drivers/gpu/drm/drm_panic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c index 293d4dcbc80da7ba..fc04ed4e0b399f55 100644 --- a/drivers/gpu/drm/drm_panic.c +++ b/drivers/gpu/drm/drm_panic.c @@ -582,7 +582,7 @@ static void draw_panic_dispatch(struct drm_scanout_buffer *sb) static void draw_panic_plane(struct drm_plane *plane) { - struct drm_scanout_buffer sb; + struct drm_scanout_buffer sb = { }; int ret; unsigned long flags; From patchwork Thu Jun 13 19:18:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 13697344 X-Patchwork-Delegate: kieran@bingham.xyz Received: from andre.telenet-ops.be (andre.telenet-ops.be [195.130.132.53]) (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 E5B32153565 for ; Thu, 13 Jun 2024 19:18:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.132.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718306298; cv=none; b=L3kOUN5odElnmUiV/40lGIDLSzxPUFxPA3EYeu72IEpEEv45Flkr73ZGV/ok7UycLbu3m1gpxrkai4XbnXFLWyXlXzm0Qfbw5121Z+xuIhJTQAx1/Le7T4wDkTh8W7B4gi4L4vx6AM1kEJTbCFRiExWzPffor8UtBLwPs9XyksE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718306298; c=relaxed/simple; bh=/mZa73zwDKX0V9S42wBjaR1oVGDw4zIOxpP9TGhCG7g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UrXfzxAdMGQ3vhWzISaDmhsIwrv+IjoQdwlWqtfHsDIOwqe2tjbxklvvqkKUZsLz8UBXWAJbsJxQEWLTK4rcWM1AxtF94opOesyEYwh8mhTSX/rypydHfBAAJeK6rQ1B0Iss+VpCY3AAqktFT49ggoAEnWhlGddVH+UIcLGwKLw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.132.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:be2a:f066:50f0:dff7]) by andre.telenet-ops.be with bizsmtp id b7J62C00A3w30qz017J6rJ; Thu, 13 Jun 2024 21:18:08 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1sHpwS-00Ax6l-DD; Thu, 13 Jun 2024 21:18:06 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1sHpxW-00FL8W-Dz; Thu, 13 Jun 2024 21:18:06 +0200 From: Geert Uytterhoeven To: Jocelyn Falempe , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: Helge Deller , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 2/7] drm/panic: Fix off-by-one logo size checks Date: Thu, 13 Jun 2024 21:18:00 +0200 Message-Id: <1c9d02463cef3eac22cfac3ac6d1adad369f367b.1718305355.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Logos that are either just as wide or just as high as the display work fine. Fixes: bf9fb17c6672868d ("drm/panic: Add a drm panic handler") Signed-off-by: Geert Uytterhoeven Reviewed-by: Jocelyn Falempe --- v2: - Rebased. --- drivers/gpu/drm/drm_panic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c index fc04ed4e0b399f55..814ef5c20c08ee42 100644 --- a/drivers/gpu/drm/drm_panic.c +++ b/drivers/gpu/drm/drm_panic.c @@ -472,7 +472,7 @@ static void draw_panic_static_user(struct drm_scanout_buffer *sb) drm_panic_fill(sb, &r_screen, bg_color); if ((r_msg.x1 >= drm_rect_width(&r_logo) || r_msg.y1 >= drm_rect_height(&r_logo)) && - drm_rect_width(&r_logo) < sb->width && drm_rect_height(&r_logo) < sb->height) { + drm_rect_width(&r_logo) <= sb->width && drm_rect_height(&r_logo) <= sb->height) { draw_txt_rectangle(sb, font, logo, logo_lines, false, &r_logo, fg_color); } draw_txt_rectangle(sb, font, panic_msg, msg_lines, true, &r_msg, fg_color); From patchwork Thu Jun 13 19:18:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 13697350 X-Patchwork-Delegate: geert@linux-m68k.org Received: from albert.telenet-ops.be (albert.telenet-ops.be [195.130.137.90]) (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 2F63B154430 for ; Thu, 13 Jun 2024 19:18:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.137.90 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718306300; cv=none; b=Pd+iX3ZbPQIH7OEe8TXoItHhj7ucvOcpHtlFtyiHLonzKq7IHDFxq39ZkaGVpWREa5qd4cUV3ICsWGWX877tBv7jWuv4VkXjiPRIUZRWlHSLXrEDjXX8Ve3UB1onasjXFu0qP0quirCkNUxlPUNt3TwXlDdnLlreCAhjFN0PiIA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718306300; c=relaxed/simple; bh=UxAu9ZpRkWvWbNN1J/6zVy6HrV4IEqX1PYFL/kiWvDU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MRqPBDM7TYiJCaRbmPXvsfZ+ZMTL6ll/Ib/F3XwapzBNezjgIW4QB0xK9W4CCH7A7zmAWyx8/P/pZyjasmt6E0PEbRInls20y0LA4HbGESQcng0DzjR6aJ4sjNtSKR+HLmxo736Nfgix2NAoS7xsUXMILGy1tlx5zdPUlJDVokU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.137.90 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:be2a:f066:50f0:dff7]) by albert.telenet-ops.be with bizsmtp id b7J62C00K3w30qz067J6PC; Thu, 13 Jun 2024 21:18:08 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1sHpwS-00Ax6q-EI; Thu, 13 Jun 2024 21:18:06 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1sHpxW-00FL8b-F6; Thu, 13 Jun 2024 21:18:06 +0200 From: Geert Uytterhoeven To: Jocelyn Falempe , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: Helge Deller , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 3/7] lib/fonts: Fix visiblity of SUN12x22 and TER16x32 if DRM_PANIC Date: Thu, 13 Jun 2024 21:18:01 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When CONFIG_FONTS ("Select compiled-in fonts") is not enabled, the user should not be asked about any fonts. However, when CONFIG_DRM_PANIC is enabled, the user is still asked about the Sparc console 12x22 and Terminus 16x32 fonts. Fix this by moving the "|| DRM_PANIC" to where it belongs. Split the dependency in two rules to improve readability. Fixes: b94605a3889b9084 ("lib/fonts: Allow to select fonts for drm_panic") Signed-off-by: Geert Uytterhoeven Reviewed-by: Jocelyn Falempe --- v2: - New. --- lib/fonts/Kconfig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/fonts/Kconfig b/lib/fonts/Kconfig index befcb463f7381d1a..3ac26bdbc3ff01a3 100644 --- a/lib/fonts/Kconfig +++ b/lib/fonts/Kconfig @@ -105,7 +105,8 @@ config FONT_SUN8x16 config FONT_SUN12x22 bool "Sparc console 12x22 font (not supported by all drivers)" - depends on (FRAMEBUFFER_CONSOLE && (!SPARC && FONTS || SPARC)) || DRM_PANIC + depends on FRAMEBUFFER_CONSOLE || DRM_PANIC + depends on !SPARC && FONTS help This is the high resolution console font for Sun machines with very big letters (like the letters used in the SPARC PROM). If the @@ -113,7 +114,8 @@ config FONT_SUN12x22 config FONT_TER16x32 bool "Terminus 16x32 font (not supported by all drivers)" - depends on (FRAMEBUFFER_CONSOLE && (!SPARC && FONTS || SPARC)) || DRM_PANIC + depends on FRAMEBUFFER_CONSOLE || DRM_PANIC + depends on !SPARC && FONTS || SPARC help Terminus Font is a clean, fixed width bitmap font, designed for long (8 and more hours per day) work with computers. From patchwork Thu Jun 13 19:18:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 13697351 X-Patchwork-Delegate: kieran@bingham.xyz Received: from gauss.telenet-ops.be (gauss.telenet-ops.be [195.130.132.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C31F130AC8 for ; Thu, 13 Jun 2024 19:18:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.132.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718306305; cv=none; b=e2XMBV5ufYkiLPerW9XaQk0bLEQo0iyeJ0/GU6vUtEIQuPQwj8bTsJyl3o6EG2jsgKRf/oFIhXlagdmqTFe5pMARqUReU2n0CDF/7HKBuJnenQUUpp43gPNN/Nk/1F/I5tfAbi6abV78jTSHy0RStyMUunpkeFfIN2CImxr6QvA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718306305; c=relaxed/simple; bh=FnN05GM8vDYZMAvxvHkfN+j13yu2M7/BW/pNimOsW8w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UAoPi6yNmOMmSob1N9BarP7jJ/L/gsM4FXhG0mEk7dFtZzbxnPLbhgiYJBbvQfpB1GyhskYr+S3Bnvxw82UZl8Q6vhlvWaeFoFltTfvZcQ0LmgzJDPN1TycY+EDGVf5Bn0IfYU70g1aLpIeYHUpM4H2XdqalGVOO1Y7uZrymrPk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.132.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from michel.telenet-ops.be (michel.telenet-ops.be [IPv6:2a02:1800:110:4::f00:18]) by gauss.telenet-ops.be (Postfix) with ESMTPS id 4W0XHq5rH7z4x2Z2 for ; Thu, 13 Jun 2024 21:18:15 +0200 (CEST) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:be2a:f066:50f0:dff7]) by michel.telenet-ops.be with bizsmtp id b7J62C00A3w30qz067J6ad; Thu, 13 Jun 2024 21:18:08 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1sHpwS-00Ax6x-Fm; Thu, 13 Jun 2024 21:18:06 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1sHpxW-00FL8f-GF; Thu, 13 Jun 2024 21:18:06 +0200 From: Geert Uytterhoeven To: Jocelyn Falempe , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: Helge Deller , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 4/7] drm/panic: Spelling s/formater/formatter/ Date: Thu, 13 Jun 2024 21:18:02 +0200 Message-Id: <5a11f8caf8759aaa22d421034d3047368e9d5f33.1718305355.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fix a misspelling of "formatter". Fixes: 54034bebb22fd4be ("drm/panic: Add a kmsg panic screen") Signed-off-by: Geert Uytterhoeven Reviewed-by: Jocelyn Falempe --- v2: - New. --- drivers/gpu/drm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index a9972ce05d7e6fe4..e3c51009d9b476b3 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -138,7 +138,7 @@ config DRM_PANIC_DEBUG If in doubt, say "N". config DRM_PANIC_SCREEN - string "Panic screen formater" + string "Panic screen formatter" default "user" depends on DRM_PANIC help From patchwork Thu Jun 13 19:18:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 13697349 X-Patchwork-Delegate: kieran@bingham.xyz Received: from baptiste.telenet-ops.be (baptiste.telenet-ops.be [195.130.132.51]) (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 9C90515444E for ; Thu, 13 Jun 2024 19:18:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.132.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718306299; cv=none; b=Ng1r4ts/cUVAhGKpgyeNXrOtSm9tYCptVbVVxcbHNv3JAbYbfLW1tReJx6icBKl6+NA1PktHqekkXl9XBT7uqlSLAsi+VmY/4naiwIW1O6Ak7H80t5vIuQFgczpAYCPGSaI1YrF3Bo+YACBOBbAkJQX9LApqEXBbAdLyg3oX4J4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718306299; c=relaxed/simple; bh=wTfhc+5qe9USjIEvskfQ4A/ZHi14nOoEz6awhHKpCrE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kh0M+Rmiwymtiz7KL54zKvEPTBb7lb8ZReYF8qwoM8yhyyk6TLdy/WzICe7MIzUUNgS1BTLzsBQpXUGCIGH+dRDZTNW3RzIQHNrnuQTBwBy7Cqro/2dI+89eMqZW46lVF4bZDefavwgY+P7XQhPMJT7JzKtjdaFOJUC9WVCxUpA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.132.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:be2a:f066:50f0:dff7]) by baptiste.telenet-ops.be with bizsmtp id b7J62C00T3w30qz017J6ok; Thu, 13 Jun 2024 21:18:09 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1sHpwS-00Ax71-Gm; Thu, 13 Jun 2024 21:18:06 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1sHpxW-00FL8j-H0; Thu, 13 Jun 2024 21:18:06 +0200 From: Geert Uytterhoeven To: Jocelyn Falempe , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: Helge Deller , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 5/7] drm/panic: Convert to drm_fb_clip_offset() Date: Thu, 13 Jun 2024 21:18:03 +0200 Message-Id: <3121082eb4beb461773ebb6f656ed9b4286967ee.1718305355.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use the drm_fb_clip_offset() helper instead of open-coding the same operation. Signed-off-by: Geert Uytterhoeven Reviewed-by: Jocelyn Falempe --- DRM_PANIC already selects DRM_KMS_HELPER. v2: - New. --- drivers/gpu/drm/drm_panic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c index 814ef5c20c08ee42..5b0acf8c86e402a8 100644 --- a/drivers/gpu/drm/drm_panic.c +++ b/drivers/gpu/drm/drm_panic.c @@ -285,7 +285,7 @@ static void drm_panic_blit(struct drm_scanout_buffer *sb, struct drm_rect *clip, return drm_panic_blit_pixel(sb, clip, sbuf8, spitch, fg_color); map = sb->map[0]; - iosys_map_incr(&map, clip->y1 * sb->pitch[0] + clip->x1 * sb->format->cpp[0]); + iosys_map_incr(&map, drm_fb_clip_offset(sb->pitch[0], sb->format, clip)); switch (sb->format->cpp[0]) { case 2: @@ -373,7 +373,7 @@ static void drm_panic_fill(struct drm_scanout_buffer *sb, struct drm_rect *clip, return drm_panic_fill_pixel(sb, clip, color); map = sb->map[0]; - iosys_map_incr(&map, clip->y1 * sb->pitch[0] + clip->x1 * sb->format->cpp[0]); + iosys_map_incr(&map, drm_fb_clip_offset(sb->pitch[0], sb->format, clip)); switch (sb->format->cpp[0]) { case 2: From patchwork Thu Jun 13 19:18:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 13697346 X-Patchwork-Delegate: kieran@bingham.xyz Received: from andre.telenet-ops.be (andre.telenet-ops.be [195.130.132.53]) (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 E5AF61534EC for ; Thu, 13 Jun 2024 19:18:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.132.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718306298; cv=none; b=Xq+jbpdDkUkzmBttDnz0p05ngQKFpL72gkW09DuEHoj9hV7yo1C/NN6+KyuGRw8JYdRHWDDMJ9VW6zNeXNNJE/rO0OvWBBU20lcyYbTaiujdx87iukUNAVATh9JTFCAjPtKT8vp1vm/qdpXtb1b5UA9EIlx1S2iol5iXfIOkxo0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718306298; c=relaxed/simple; bh=1gl9Qdl+e+Gxc6KhMzCUTue4x7qBw6QoLAZQjk+A1tE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HUsb93kHnVC04Qq9Jwpmkccizx3ks8SP4fYNi4wvSNnOqZYxyAxAycvooZ4Js82xdzxiyiR4Ea6MjS6cIk/Nd1iAnVbBbRExnOhmsyvssUUcU6pnmSk0ySlIqS7kVE/2tn7Z3iW8SldRXHZ8aqOBg7p5iicKxIe0QfaT50Jrm/Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.132.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:be2a:f066:50f0:dff7]) by andre.telenet-ops.be with bizsmtp id b7J62C00F3w30qz017J6rL; Thu, 13 Jun 2024 21:18:08 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1sHpwS-00Ax76-IT; Thu, 13 Jun 2024 21:18:06 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1sHpxW-00FL8q-Id; Thu, 13 Jun 2024 21:18:06 +0200 From: Geert Uytterhoeven To: Jocelyn Falempe , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: Helge Deller , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 6/7] drm/panic: Rename logo to logo_ascii Date: Thu, 13 Jun 2024 21:18:04 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Rename variables related to the ASCII logo, to prepare for the advent of support for graphical logos. Signed-off-by: Geert Uytterhoeven Reviewed-by: Jocelyn Falempe --- v2: - Rebased. --- drivers/gpu/drm/drm_panic.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c index 5b0acf8c86e402a8..f7e22b69bb25d3be 100644 --- a/drivers/gpu/drm/drm_panic.c +++ b/drivers/gpu/drm/drm_panic.c @@ -78,7 +78,7 @@ static struct drm_panic_line panic_msg[] = { PANIC_LINE("Please reboot your computer."), }; -static const struct drm_panic_line logo[] = { +static const struct drm_panic_line logo_ascii[] = { PANIC_LINE(" .--. _"), PANIC_LINE(" |o_o | | |"), PANIC_LINE(" |:_/ | | |"), @@ -447,7 +447,7 @@ static void draw_txt_rectangle(struct drm_scanout_buffer *sb, static void draw_panic_static_user(struct drm_scanout_buffer *sb) { size_t msg_lines = ARRAY_SIZE(panic_msg); - size_t logo_lines = ARRAY_SIZE(logo); + size_t logo_ascii_lines = ARRAY_SIZE(logo_ascii); u32 fg_color = convert_from_xrgb8888(CONFIG_DRM_PANIC_FOREGROUND_COLOR, sb->format->format); u32 bg_color = convert_from_xrgb8888(CONFIG_DRM_PANIC_BACKGROUND_COLOR, sb->format->format); const struct font_desc *font = get_default_font(sb->width, sb->height, NULL, NULL); @@ -459,8 +459,8 @@ static void draw_panic_static_user(struct drm_scanout_buffer *sb) r_screen = DRM_RECT_INIT(0, 0, sb->width, sb->height); r_logo = DRM_RECT_INIT(0, 0, - get_max_line_len(logo, logo_lines) * font->width, - logo_lines * font->height); + get_max_line_len(logo_ascii, logo_ascii_lines) * font->width, + logo_ascii_lines * font->height); r_msg = DRM_RECT_INIT(0, 0, min(get_max_line_len(panic_msg, msg_lines) * font->width, sb->width), min(msg_lines * font->height, sb->height)); @@ -473,7 +473,8 @@ static void draw_panic_static_user(struct drm_scanout_buffer *sb) if ((r_msg.x1 >= drm_rect_width(&r_logo) || r_msg.y1 >= drm_rect_height(&r_logo)) && drm_rect_width(&r_logo) <= sb->width && drm_rect_height(&r_logo) <= sb->height) { - draw_txt_rectangle(sb, font, logo, logo_lines, false, &r_logo, fg_color); + draw_txt_rectangle(sb, font, logo_ascii, logo_ascii_lines, false, &r_logo, + fg_color); } draw_txt_rectangle(sb, font, panic_msg, msg_lines, true, &r_msg, fg_color); } From patchwork Thu Jun 13 19:18:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 13697348 Received: from xavier.telenet-ops.be (xavier.telenet-ops.be [195.130.132.52]) (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 0322915382E for ; Thu, 13 Jun 2024 19:18:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.132.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718306299; cv=none; b=uCCWQoppH1ypXrbNSnr01sX48zLGR/i/bEi+ei8sjadO8LdjJrGNu24n6QpmNBuHvttJUfUdU4PHMN6dHcyjJwXR1lkrDvXctTlczZYuijGlivFxUynTsWwORK6tFkbY0iK6T5ISfUF81RX2S8vQWyjfvWW9uBzrtBLtmo4/HiE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718306299; c=relaxed/simple; bh=Sa5ge7CcXmGHW0duWK1aTVxhD/buIL/3bSCNBiMvBNs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AFmiQ7rQjsMLuvaVWY2ot++UT1XOW4bw4SFkZp225IX+Dbt3mbjmehIXxu176cA14w2WEI9TzQzAjzs3RY+9z3DnvLL7EHvjA1/6EGsja/kRqSB/HoFyzziQIz5Svcmzs1Bs/Okf4w97l1c2fNzPp9OdbwLlbP/lA8kiBY8cGuM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.132.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:be2a:f066:50f0:dff7]) by xavier.telenet-ops.be with bizsmtp id b7J62C00H3w30qz017J6ml; Thu, 13 Jun 2024 21:18:08 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1sHpwS-00Ax78-JJ; Thu, 13 Jun 2024 21:18:06 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1sHpxW-00FL8v-JP; Thu, 13 Jun 2024 21:18:06 +0200 From: Geert Uytterhoeven To: Jocelyn Falempe , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: Helge Deller , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 7/7] drm/panic: Add support for drawing a monochrome graphical logo Date: Thu, 13 Jun 2024 21:18:05 +0200 Message-Id: <3f1a5f56213f3e4584773eb2813e212b2dff6d14.1718305355.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Re-use the existing support for boot-up logos to draw a monochrome graphical logo in the DRM panic handler. When no suitable graphical logo is available, the code falls back to the ASCII art penguin logo. Note that all graphical boot-up logos are freed during late kernel initialization, hence a copy must be made for later use. Signed-off-by: Geert Uytterhoeven Reviewed-by: Jocelyn Falempe --- v2: - Rebased, - Inline trivial draw_logo_mono(). --- drivers/gpu/drm/drm_panic.c | 65 +++++++++++++++++++++++++++++++++---- drivers/video/logo/Kconfig | 2 ++ 2 files changed, 60 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c index f7e22b69bb25d3be..af30f243b2802ad7 100644 --- a/drivers/gpu/drm/drm_panic.c +++ b/drivers/gpu/drm/drm_panic.c @@ -7,11 +7,15 @@ */ #include +#include #include #include #include +#include #include +#include #include +#include #include #include @@ -88,6 +92,42 @@ static const struct drm_panic_line logo_ascii[] = { PANIC_LINE(" \\___)=(___/"), }; +#ifdef CONFIG_LOGO +static const struct linux_logo *logo_mono; + +static int drm_panic_setup_logo(void) +{ + const struct linux_logo *logo = fb_find_logo(1); + const unsigned char *logo_data; + struct linux_logo *logo_dup; + + if (!logo || logo->type != LINUX_LOGO_MONO) + return 0; + + /* The logo is __init, so we must make a copy for later use */ + logo_data = kmemdup(logo->data, + size_mul(DIV_ROUND_UP(logo->width, BITS_PER_BYTE), logo->height), + GFP_KERNEL); + if (!logo_data) + return -ENOMEM; + + logo_dup = kmemdup(logo, sizeof(*logo), GFP_KERNEL); + if (!logo_dup) { + kfree(logo_data); + return -ENOMEM; + } + + logo_dup->data = logo_data; + logo_mono = logo_dup; + + return 0; +} + +device_initcall(drm_panic_setup_logo); +#else +#define logo_mono ((const struct linux_logo *)NULL) +#endif + /* * Color conversion */ @@ -452,15 +492,22 @@ static void draw_panic_static_user(struct drm_scanout_buffer *sb) u32 bg_color = convert_from_xrgb8888(CONFIG_DRM_PANIC_BACKGROUND_COLOR, sb->format->format); const struct font_desc *font = get_default_font(sb->width, sb->height, NULL, NULL); struct drm_rect r_screen, r_logo, r_msg; + unsigned int logo_width, logo_height; if (!font) return; r_screen = DRM_RECT_INIT(0, 0, sb->width, sb->height); - r_logo = DRM_RECT_INIT(0, 0, - get_max_line_len(logo_ascii, logo_ascii_lines) * font->width, - logo_ascii_lines * font->height); + if (logo_mono) { + logo_width = logo_mono->width; + logo_height = logo_mono->height; + } else { + logo_width = get_max_line_len(logo_ascii, logo_ascii_lines) * font->width; + logo_height = logo_ascii_lines * font->height; + } + + r_logo = DRM_RECT_INIT(0, 0, logo_width, logo_height); r_msg = DRM_RECT_INIT(0, 0, min(get_max_line_len(panic_msg, msg_lines) * font->width, sb->width), min(msg_lines * font->height, sb->height)); @@ -471,10 +518,14 @@ static void draw_panic_static_user(struct drm_scanout_buffer *sb) /* Fill with the background color, and draw text on top */ drm_panic_fill(sb, &r_screen, bg_color); - if ((r_msg.x1 >= drm_rect_width(&r_logo) || r_msg.y1 >= drm_rect_height(&r_logo)) && - drm_rect_width(&r_logo) <= sb->width && drm_rect_height(&r_logo) <= sb->height) { - draw_txt_rectangle(sb, font, logo_ascii, logo_ascii_lines, false, &r_logo, - fg_color); + if ((r_msg.x1 >= logo_width || r_msg.y1 >= logo_height) && + logo_width <= sb->width && logo_height <= sb->height) { + if (logo_mono) + drm_panic_blit(sb, &r_logo, logo_mono->data, DIV_ROUND_UP(logo_width, 8), + fg_color); + else + draw_txt_rectangle(sb, font, logo_ascii, logo_ascii_lines, false, &r_logo, + fg_color); } draw_txt_rectangle(sb, font, panic_msg, msg_lines, true, &r_msg, fg_color); } diff --git a/drivers/video/logo/Kconfig b/drivers/video/logo/Kconfig index b7d94d1dd1585a84..ce6bb753522d215d 100644 --- a/drivers/video/logo/Kconfig +++ b/drivers/video/logo/Kconfig @@ -8,6 +8,8 @@ menuconfig LOGO depends on FB_CORE || SGI_NEWPORT_CONSOLE help Enable and select frame buffer bootup logos. + Monochrome logos will also be used by the DRM panic handler, if + enabled. if LOGO