From patchwork Wed Jul 24 07:48:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jocelyn Falempe X-Patchwork-Id: 13740645 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 8B4F1C3DA61 for ; Wed, 24 Jul 2024 07:52:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E080A10E3AF; Wed, 24 Jul 2024 07:52:58 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="EZ5qpxlz"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4CD5510E3AF for ; Wed, 24 Jul 2024 07:52:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721807574; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=PHg0Ef8smficbOkuW7WJsl35HKf6Jokhkg4l/gaxSKk=; b=EZ5qpxlzjIzOof1HFM8jpVG+IcIhXAiVt5ZPGFX8r77/blreRdr6NvUjN67IMWzOAo2wAw VF2l5LOLnjWezTsgyZYdcsS+ouHSJt4pF99hUBU3UKBTqmVLGd2U6QiJ0rWd4LVv81rsH+ 1xmBM/cvtnbrA7lQSbm2YazBjOItjCI= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-607-95lhK-JBPrWh-MkaGO2akg-1; Wed, 24 Jul 2024 03:52:51 -0400 X-MC-Unique: 95lhK-JBPrWh-MkaGO2akg-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5682A1955F06; Wed, 24 Jul 2024 07:52:48 +0000 (UTC) Received: from hydra.redhat.com (unknown [10.39.192.4]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 210241955D44; Wed, 24 Jul 2024 07:52:41 +0000 (UTC) From: Jocelyn Falempe To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , "Bjorn Roy Baron" , Benno Lossin , Andreas Hindborg , Alice Ryhl , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, rust-for-linux@vger.kernel.org, Danilo Krummrich Cc: Jocelyn Falempe Subject: [PATCH v5 0/4] drm/panic: Add a QR code panic screen Date: Wed, 24 Jul 2024 09:48:41 +0200 Message-ID: <20240724075227.541245-1-jfalempe@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 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" This series adds a new panic screen, with the kmsg data embedded in a QR code. The main advantage of QR code, is that you can copy/paste the debug data to a bug report. The QR code encoder is written in rust, and is very specific to drm panic. The reason is that it is called in a panic handler, and thus can't allocate memory, or use locking. The rust code uses a few rust core API, and provides only two C entry points. There is no particular reason to do it in rust, I just wanted to learn rust, and see if it can work in the kernel. If you want to see what it looks like, I've put a few screenshots here: https://github.com/kdj0c/panic_report/issues/1 v2: * Rewrite the rust comments with Markdown (Alice Ryhl) * Mark drm_panic_qr_generate() as unsafe (Alice Ryhl) * Use CStr directly, and remove the call to as_str_unchecked() (Alice Ryhl) * Add a check for data_len <= data_size (Greg KH) v3: * Fix all rust comments (typo, punctuation) (Miguel Ojeda) * Change the wording of safety comments (Alice Ryhl) * Add a link to the javascript decoder in the Kconfig (Greg KH) * Fix data_size and tmp_size check in drm_panic_qr_generate() v4: * Fix the logic to find next line and skip the '\n' (Alic Ryhl) * Remove __LOG_PREFIX as it's not used (Alice Ryhl) v5: * Move drm_panic_[init|exit]() prototype to drm_crtc_internal.h (Daniel Vetter) Jocelyn Falempe (4): drm/panic: Add integer scaling to blit() drm/rect: Add drm_rect_overlap() drm/panic: Simplify logo handling drm/panic: Add a QR code panic screen drivers/gpu/drm/Kconfig | 31 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_crtc_internal.h | 4 + drivers/gpu/drm/drm_drv.c | 3 + drivers/gpu/drm/drm_panic.c | 340 +++++++-- drivers/gpu/drm/drm_panic_qr.rs | 1003 +++++++++++++++++++++++++++ include/drm/drm_rect.h | 15 + 7 files changed, 1358 insertions(+), 39 deletions(-) create mode 100644 drivers/gpu/drm/drm_panic_qr.rs base-commit: 19cc4b7d75b52df2b4fbb76428a6b0dda3d248bc