Skip to content

Instantly share code, notes, and snippets.

View notro's full-sized avatar

Noralf Trønnes notro

View GitHub Profile
@notro
notro / drm-gud-Backport-driver-to-v5.10.patch
Created November 25, 2023 16:30
drm/gud: Backport driver to v5.10
From 51ffc57dcbb7f81ad3e24e28c7756f2b29f65980 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org>
Date: Sat, 25 Nov 2023 17:20:13 +0100
Subject: [PATCH 4/4] drm/gud: Backport driver to v5.10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
GUD was released as part of Linux v5.13.
This patch makes the necessary changes to make it compile on 5.10.
From 694299489e9a1e7b95245c4adff272b980f7f852 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org>
Date: Fri, 2 Sep 2022 13:19:15 +0200
Subject: [PATCH 3/3] HACK: drm/vc4: Keep the VEC clock running all the time
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Workaround to prevent crash on Pi4 when running command:
diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c
index 55f6f490877c..4493f1c80af7 100644
--- a/drivers/gpu/drm/vc4/vc4_vec.c
+++ b/drivers/gpu/drm/vc4/vc4_vec.c
@@ -543,8 +543,6 @@ static void vc4_vec_encoder_disable(struct drm_encoder *encoder,
VEC_DAC_MISC_DAC_PWRDN |
VEC_DAC_MISC_LDO_PWRDN);
- clk_disable_unprepare(vec->clock);
-
This command is run through ssh:
$ modetest -M vc4 -a -P 61@68:720x480 -s 45:720x480i
The kernel messages appears on the serial console.
This is the delimiter between runs:
####################################################################################################
Kernel build
------------
I have some build scripts that sets things up for me so the kernel behaves mostly the same on mainline as downstream for the things I care about.
32-bit kernel.
pi@build-server:~/tinydrm.gud-gadget/workdirs/tv_norm_gadget/linux$ git log --oneline
9a2fc02f49d1 (HEAD -> drm-misc-next, tag: patchbase) Support DT overlays + spi dma
pi@pi4t:~ $ modetest -M vc4 -c
Connectors:
id encoder status name size (mm) modes encoders
45 0 unknown Composite-1 0x0 2 44
modes:
index name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot
#0 720x576i 25.00 720 732 795 864 576 580 586 625 13500 flags: interlace; type: driver
#1 720x480i 29.97 720 739 801 858 480 488 494 525 13500 flags: interlace; type: driver
props:
@notro
notro / gist:a11be18408e9daddbf84b318f949e8e1
Created April 28, 2022 11:52
Ubuntu 22.04 replug GUD USB, DEBUG log
This file has been truncated, but you can view the full file.
april 28 13:43:59 pi-ubuntu-x86 gnome-shell[1085]: Running GNOME Shell (using mutter 42.0) as a Wayland display server
april 28 13:43:59 pi-ubuntu-x86 gnome-shell[1085]: BACKEND: Opening and taking control of device file '/dev/dri/card0'
april 28 13:43:59 pi-ubuntu-x86 gnome-shell[1085]: Device '/dev/dri/card0' prefers shadow buffer
april 28 13:43:59 pi-ubuntu-x86 gnome-shell[1085]: KMS: Read CRTC 45 state: active: 1, mode: 1366x768, changed: yes
april 28 13:43:59 pi-ubuntu-x86 gnome-shell[1085]: KMS: Read CRTC 60 state: active: 0, mode: (nil), changed: no
april 28 13:43:59 pi-ubuntu-x86 gnome-shell[1085]: KMS: Read CRTC 75 state: active: 0, mode: (nil), changed: no
april 28 13:43:59 pi-ubuntu-x86 gnome-shell[1085]: Added device '/dev/dri/card0' (i915) using atomic mode setting.
april 28 13:43:59 pi-ubuntu-x86 gnome-shell[1085]: KMS: Adding common modes to connector 77 on /dev/dri/card0
april 28 13:43:59 pi-ubuntu-x86 gnome-shell[1085]: BACKEND: Acquiring device file '/dev/dri/card0'
april 28 13:43:59 pi-ubun
@notro
notro / gist:8b069f6d2df0d162281f8f1b772245f5
Created April 28, 2022 11:11
Ubuntu 22.04 replug GUD USB
pi@pi-ubuntu-x86:~$ journalctl -l --no-pager --boot /usr/bin/gnome-shell
april 28 13:02:31 pi-ubuntu-x86 gnome-shell[1088]: Running GNOME Shell (using mutter 42.0) as a Wayland display server
april 28 13:02:31 pi-ubuntu-x86 gnome-shell[1088]: Device '/dev/dri/card0' prefers shadow buffer
april 28 13:02:31 pi-ubuntu-x86 gnome-shell[1088]: Added device '/dev/dri/card0' (i915) using atomic mode setting.
april 28 13:02:31 pi-ubuntu-x86 gnome-shell[1088]: Created gbm renderer for '/dev/dri/card0'
april 28 13:02:31 pi-ubuntu-x86 gnome-shell[1088]: Boot VGA GPU /dev/dri/card0 selected as primary
april 28 13:02:33 pi-ubuntu-x86 gnome-shell[1088]: Using public X11 display :0, (using :1 for managed services)
april 28 13:02:33 pi-ubuntu-x86 gnome-shell[1088]: Using Wayland display name 'wayland-0'
april 28 13:02:33 pi-ubuntu-x86 gnome-shell[1088]: Unset XDG_SESSION_ID, getCurrentSessionProxy() called outside a user session. Asking logind directly.
april 28 13:02:33 pi-ubuntu-x86 gnome-shell[1088]: Will monitor session 1
#!/usr/bin/env python3
# SPDX-License-Identifier: CC0-1.0
import ctypes
class panel_mipi_dbi_config(ctypes.BigEndianStructure):
_fields_ = [
('magic', ctypes.c_char * 15),
From eecdff3fc1612de09958414344658b0ea6099e0c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org>
Date: Wed, 24 Mar 2021 18:06:59 +0100
Subject: [PATCH 6/6] Use dma_buf_map_memcpy_to(), fix vunmap
---
drivers/gpu/drm/gud/gud_gadget.c | 43 ++++++++++++++++----------------
1 file changed, 21 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/gud/gud_gadget.c b/drivers/gpu/drm/gud/gud_gadget.c