From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 E8ECB481FD0; Wed, 9 Sep 2026 09:00:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788944446; cv=none; b=aQvUqpUlGflCsrhDn+efxn7vLS/eGmfPE/BIb2zuO1vjB/2LSVQOvOT+yxQxp7GWTo2ca9jZyXGx5OsBJphGQEez2eFfOFUUjCsYvWvoSv7OEPm1fn6R9Jc75swVipnVNvEOilBPQaOzyfZITfT1I8zllYZfhMbO3nQ3kwEnjj0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788944446; c=relaxed/simple; bh=65gGAd0DGX78A1Z+eR7KkAMXqcGOFZFCKrTRm3tNYtk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MFnCaA+20AJxPpMPUP3UADIp/oZv5dn4/w/IM80elyIDHkR9Im2LbvY2qOZIHlA6IM8aZNuA8EPTmGvQQ2fqR6Z/VtzYSlD6jsO5yg9etIFPkCUwLKeH1rBWxz/jHyI5ZMehCf5USoLotmvDRXEs6VN/B8Qt3OSs1uHsz5JggDU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=aSziHAkR; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=LWafGJkO; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=x8z7j4cP; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=/rZ/tfq7; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="aSziHAkR"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="LWafGJkO"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="x8z7j4cP"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="/rZ/tfq7" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0D4601F867; Wed, 9 Sep 2026 08:58:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788944326; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W6OQbTiGH9vzNm4zuJ/xs76Vvn/TIePcgZTE52GlKWo=; b=aSziHAkRb5piAJLxkwgpHw1HhSDZcPFqyItrBIbej47ZcBP9bSRJhcuFQHywEOovYy426R r+li74NbGhzg+qYQOQwyHETiidk3O7SZsGSDzWKiY8kKUZfL5Eo6C+AGK0/4nIcrtU5sN6 WEa7DWogHdJvmXrM1RYLd7Bv4abeUmk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788944326; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W6OQbTiGH9vzNm4zuJ/xs76Vvn/TIePcgZTE52GlKWo=; b=LWafGJkOWWL9t72TH/GL70N2vTYhlEC+4h1mnimNzXnEMHB686TtE9/b6BI/0LqTwhd1rR tvH/rXCjFICQQLBQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=x8z7j4cP; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="/rZ/tfq7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788944322; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W6OQbTiGH9vzNm4zuJ/xs76Vvn/TIePcgZTE52GlKWo=; b=x8z7j4cP/eUsu6nnkUN6kr8bRho84NvW/ezUiaz9euuIOy8hvLYd+qC2QDxMDMk5KKYGnZ ae8cO45v6XgzWctQItW9LELKCED874JxAX/1zEYaKIWFcewvJRZWytpA87jOvzGUBTLmvX feV5fA7YXLqISAKI8Xb6TtpNwAxfilY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788944322; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W6OQbTiGH9vzNm4zuJ/xs76Vvn/TIePcgZTE52GlKWo=; b=/rZ/tfq7g1vW4WFAbFeaWxPvSlpU8ppNMMwog1z33zDu7pdzYu2dXtYDj9ENH+vbzgSNfY v0U1/zoqwPYfecCQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D1A5B13964; Wed, 9 Sep 2026 08:58:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id WGnBMbwfoWoVUQAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 08:58:36 +0000 From: Thomas Zimmermann To: jfalempe@redhat.com, javierm@redhat.com, airlied@gmail.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, geert@linux-m68k.org, rdunlap@infradead.org Cc: dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org, amd-gfx@lists.freedesktop.org, rust-for-linux@vger.kernel.org, linux-hyperv@vger.kernel.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, nouveau@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, virtualization@lists.linux.dev, sashiko-reviews@lists.linux.dev, Thomas Zimmermann Subject: [PATCH v4 09/14] drm/panic: Split draw_panic_plane() Date: Wed, 9 Sep 2026 10:55:24 +0200 Message-ID: <20260909085826.64529-10-tzimmermann@suse.de> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909085826.64529-1-tzimmermann@suse.de> References: <20260909085826.64529-1-tzimmermann@suse.de> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Level: X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 0D4601F867 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:dkim,suse.de:email,suse.de:mid]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_TWELVE(0.00)[21]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; FREEMAIL_TO(0.00)[redhat.com,gmail.com,linux.intel.com,kernel.org,linux-m68k.org,infradead.org]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLo585esf9b7txaosbn5shab9z)]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Flag: NO X-Spam-Score: -3.01 Move locking and parameters from draw_panic_plane() into the new helper drm_panic_display_panic_screen(). Call draw_panic_plane() from there. The new helper drm_panic_display_panic_screen() is now the DRM core's interface for displaying a panic screen. The code remaining in draw_panic_plane() still does all the heavy lifting. It will become a plane helper for DRM drivers. v2: - use panic_type argument in draw_panic_plane() (Sashiko) Signed-off-by: Thomas Zimmermann Reviewed-by: Jocelyn Falempe --- drivers/gpu/drm/drm_panic.c | 62 ++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c index ce4606cac7e2..809d51ad78a8 100644 --- a/drivers/gpu/drm/drm_panic.c +++ b/drivers/gpu/drm/drm_panic.c @@ -936,42 +936,25 @@ static void drm_panic_clear_description(void) desc_line->txt = NULL; } -static void draw_panic_plane(struct drm_plane *plane, const char *description) +static void draw_panic_plane(struct drm_plane *plane, const char *description, + enum drm_panic_type panic_type, u32 fg_color, u32 bg_color, + unsigned int qr_version) { struct drm_scanout_buffer sb = { }; int ret; - unsigned long flags; -#if defined(CONFIG_DRM_PANIC_FOREGROUND_COLOR) - u32 fg_color = CONFIG_DRM_PANIC_FOREGROUND_COLOR; -#else - u32 fg_color = 0x00ffffff; -#endif -#if defined(CONFIG_DRM_PANIC_BACKGROUND_COLOR) - u32 bg_color = CONFIG_DRM_PANIC_BACKGROUND_COLOR; -#else - u32 bg_color = 0x00000000; -#endif -#if IS_ENABLED(CONFIG_DRM_PANIC_SCREEN_QR_CODE) - unsigned int qr_version = panic_qr_version; -#else - unsigned int qr_version = 0; -#endif - - if (!drm_panic_trylock(plane->dev, flags)) - return; ret = plane->helper_private->get_scanout_buffer(plane, &sb); if (ret || !drm_panic_is_format_supported(sb.format)) - goto unlock; + return; /* One of these should be set, or it can't draw pixels */ if (!sb.set_pixel && !sb.pages && iosys_map_is_null(&sb.map[0])) - goto unlock; + return; drm_panic_set_description(description); - ret = draw_panic_dispatch(&sb, drm_panic_type, fg_color, bg_color, qr_version); + ret = draw_panic_dispatch(&sb, panic_type, fg_color, bg_color, qr_version); if (!ret) { /* * Only flush if we have a panic screen to display. Otherwise @@ -982,9 +965,33 @@ static void draw_panic_plane(struct drm_plane *plane, const char *description) } drm_panic_clear_description(); +} -unlock: - drm_panic_unlock(plane->dev, flags); +static void drm_panic_display_panic_screen(struct drm_plane *plane, const char *description) +{ +#if defined(CONFIG_DRM_PANIC_FOREGROUND_COLOR) + u32 fg_color = CONFIG_DRM_PANIC_FOREGROUND_COLOR; +#else + u32 fg_color = 0x00ffffff; +#endif +#if defined(CONFIG_DRM_PANIC_BACKGROUND_COLOR) + u32 bg_color = CONFIG_DRM_PANIC_BACKGROUND_COLOR; +#else + u32 bg_color = 0x00000000; +#endif +#if IS_ENABLED(CONFIG_DRM_PANIC_SCREEN_QR_CODE) + unsigned int qr_version = panic_qr_version; +#else + unsigned int qr_version = 0; +#endif + struct drm_device *dev = plane->dev; + unsigned long flags; + + if (drm_panic_trylock(dev, flags)) { + draw_panic_plane(plane, description, drm_panic_type, + fg_color, bg_color, qr_version); + drm_panic_unlock(dev, flags); + } } static struct drm_plane *to_drm_plane(struct kmsg_dumper *kd) @@ -997,10 +1004,9 @@ static void drm_panic(struct kmsg_dumper *dumper, struct kmsg_dump_detail *detai struct drm_plane *plane = to_drm_plane(dumper); if (detail->reason == KMSG_DUMP_PANIC) - draw_panic_plane(plane, detail->description); + drm_panic_display_panic_screen(plane, detail->description); } - /* * DEBUG FS, This is currently unsafe. * Create one file per plane, so it's possible to debug one plane at a time. @@ -1017,7 +1023,7 @@ static ssize_t debugfs_trigger_write(struct file *file, const char __user *user_ if (kstrtobool_from_user(user_buf, count, &run) == 0 && run) { struct drm_plane *plane = file->private_data; - draw_panic_plane(plane, "Test from debugfs"); + drm_panic_display_panic_screen(plane, "Test from debugfs"); } return count; } -- 2.55.0