Skip to content

Instantly share code, notes, and snippets.

@valpackett
valpackett / .config
Created January 7, 2025 00:40
mt8167 mainline dev .config for reference
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm64 6.13.0-rc3 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="clang version 19.1.6"
CONFIG_GCC_VERSION=0
CONFIG_CC_IS_CLANG=y
CONFIG_CLANG_VERSION=190106
CONFIG_AS_IS_LLVM=y
CONFIG_AS_VERSION=190106
@valpackett
valpackett / simpledrm-mtk-atags.patch
Created December 29, 2024 06:09
simpledrm hack to parse ATAGS for dynamic fb address
diff --git i/drivers/gpu/drm/tiny/simpledrm.c w/drivers/gpu/drm/tiny/simpledrm.c
index 5d9ab8adf8005..78f0b4b8d3df6 100644
--- i/drivers/gpu/drm/tiny/simpledrm.c
+++ w/drivers/gpu/drm/tiny/simpledrm.c
@@ -3,6 +3,7 @@
#include <linux/aperture.h>
#include <linux/clk.h>
#include <linux/of_clk.h>
+#include <linux/of_fdt.h>
#include <linux/minmax.h>
@valpackett
valpackett / out.txt
Created October 17, 2024 21:01
Versioned struct generation in Zig
$ zig test versioned_structs.zig ^0^ 17:58
v1:
field 0 is data_len type is i32
field 1 is data_ptr type is *const u8
example value: ver.MakeStruct(.{ .{ ... }, .{ ... }, .{ ... } },1){ .data_len = 420, .data_ptr = u8@deadbeef }
v69:
field 0 is data_len type is i32
@valpackett
valpackett / reaperdemo.c
Created March 23, 2023 05:28
FreeBSD reaper API demo
#include <sys/procctl.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sysexits.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
#include <signal.h>
@valpackett
valpackett / thread.log
Created November 9, 2020 21:38
Thread ID testing on FreeBSD
% cc -pthread -o /tmp/tid tids.c && truss /tmp/tid
[…]
__sysctl("vm.overcommit",2,0x7fffffffa314,0x7fffffffa308,0x0,0) = 0 (0x0)
mmap(0x0,2097152,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(21),-1,0x0) = 34374418432 (0x800e00000)
mmap(0x0,2097152,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(12),-1,0x0) = 34410536960 (0x803072000)
mmap(0x0,4194304,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(21),-1,0x0) = 34422652928 (0x803c00000)
__sysctl("kern.usrstack",2,0x800ac8108,0x7fffffffc228,0x0,0) = 0 (0x0)
getrlimit(RLIMIT_STACK,{ cur=536870912,max=536870912 }) = 0 (0x0)
thr_self(0x803084000) = 0 (0x0)
mmap(0x7fffdfffd000,4096,PROT_NONE,MAP_ANON,-1,0x0) = 140736951472128 (0x7fffdfffd000)
@valpackett
valpackett / tokio-wayland-loop.rs
Created May 30, 2020 21:41
tokio-wayland-loop.rs
use smithay_client_toolkit::reexports::client::{
EventQueue, Interface, Main, MessageGroup, Proxy, ProxyMap,
};
/// Tokio task for polling the Wayland socket, dispatching the callbacks.
/// This makes wayland_event_chan work.
pub async fn wayland_loop(event_queue: &mut EventQueue) -> Result<(), Box<dyn std::error::Error>> {
use std::task::Poll;
let fd = event_queue.display().get_connection_fd();
@valpackett
valpackett / dpcd-eve.patch
Created April 9, 2020 12:04
Patch forcing DPCD backlight on Pixelbook
diff --git i/drivers/gpu/drm/i915/intel_dp_aux_backlight.c w/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
index 357136f17..7de91a4a5 100644
--- i/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
+++ w/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
@@ -252,8 +252,12 @@ intel_dp_aux_display_control_capable(struct intel_connector *connector)
* the panel can support backlight control over the aux channel
*/
if (intel_dp->edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP &&
- (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP) &&
- !(intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP)) {
diff --git i/include/wayfire/config/option-types.hpp w/include/wayfire/config/option-types.hpp
index ec49728..7e30648 100644
--- i/include/wayfire/config/option-types.hpp
+++ w/include/wayfire/config/option-types.hpp
@@ -1,12 +1,24 @@
#pragma once
+#if __has_include(<optional>)
+#include <optional>
+#else
CPU FUNCTION
1 -> i915_gem_userptr_ioctl arg: fffffe00cd374000
1 | i915_gem_userptr_ioctl:entry
1 -> linux_access_ok
1 <- linux_access_ok
1 -> i915_gem_object_alloc
1 -> uma_zalloc_arg
1 -> memset
1 -> memset_erms
1 <- memset_erms
module Main
data Printable : Type where
Pr : Show a => a -> Printable
Show Printable where
show (Pr p) = show p
hello : (f: Bool) -> Printable
hello False = Pr 10