From patchwork Tue Feb 27 10:04:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jocelyn Falempe X-Patchwork-Id: 13573450 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 4EF84C5478C for ; Tue, 27 Feb 2024 10:05:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 64D4710EFD8; Tue, 27 Feb 2024 10:05:47 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="YC2LqUdH"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3772F10EF1A for ; Tue, 27 Feb 2024 10:05:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709028342; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f5O2zzpo13qnw1gW1hqiKPok8SjHJFhf7Z7HmpcKYOw=; b=YC2LqUdHpQ7C3yy2vIcv9UexGeXcRsIVYSU0ZQxlBYR5F2sPttdLULnjUq4VciXaktlCiU j5wJBIi/A2SOG1MRejZBJhWSTT9X0bTaQYv3mDF6PEtFR/LwPJ5IuKlthd8E5fNoRou/wT HBeOqm6R2Y5TPDtbrbk6pyydLpk9DFk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-622-_dQM5muOMmuL3wmEYiIL3A-1; Tue, 27 Feb 2024 05:05:38 -0500 X-MC-Unique: _dQM5muOMmuL3wmEYiIL3A-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 97B3C8A67E5; Tue, 27 Feb 2024 10:05:37 +0000 (UTC) Received: from hydra.redhat.com (unknown [10.39.192.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id D043339CAC; Tue, 27 Feb 2024 10:05:35 +0000 (UTC) From: Jocelyn Falempe To: dri-devel@lists.freedesktop.org, tzimmermann@suse.de, airlied@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, daniel@ffwll.ch, javierm@redhat.com, bluescreen_avenger@verizon.net, noralf@tronnes.org Cc: gpiccoli@igalia.com, Jocelyn Falempe Subject: [PATCH v8 5/8] drm/simpledrm: Add drm_panic support Date: Tue, 27 Feb 2024 11:04:16 +0100 Message-ID: <20240227100459.194478-6-jfalempe@redhat.com> In-Reply-To: <20240227100459.194478-1-jfalempe@redhat.com> References: <20240227100459.194478-1-jfalempe@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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" Add support for the drm_panic module, which displays a user-friendly message to the screen when a kernel panic occurs. v8: * Replace get_scanout_buffer() with drm_panic_set_buffer() (Thomas Zimmermann) Signed-off-by: Jocelyn Falempe --- drivers/gpu/drm/tiny/simpledrm.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c index 7ce1c4617675..a2190995354a 100644 --- a/drivers/gpu/drm/tiny/simpledrm.c +++ b/drivers/gpu/drm/tiny/simpledrm.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #define DRIVER_NAME "simpledrm" @@ -735,6 +736,20 @@ static const struct drm_connector_funcs simpledrm_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; +static void simpledrm_init_panic_buffer(struct drm_plane *plane) +{ + struct simpledrm_device *sdev = simpledrm_device_of_dev(plane->dev); + struct drm_framebuffer fb; + + /* Fake framebuffer struct for drm_panic_set_buffer */ + fb.width = sdev->mode.hdisplay; + fb.height = sdev->mode.vdisplay; + fb.format = sdev->format; + fb.pitches[0] = sdev->pitch; + + drm_panic_set_buffer(plane->panic_scanout, &fb, &sdev->screen_base); +} + static const struct drm_mode_config_funcs simpledrm_mode_config_funcs = { .fb_create = drm_gem_fb_create_with_dirty, .atomic_check = drm_atomic_helper_check, @@ -945,6 +960,8 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv, return ERR_PTR(ret); drm_plane_helper_add(primary_plane, &simpledrm_primary_plane_helper_funcs); drm_plane_enable_fb_damage_clips(primary_plane); + drm_panic_register(primary_plane); + simpledrm_init_panic_buffer(primary_plane); /* CRTC */