Skip to content

Instantly share code, notes, and snippets.

@ssvb
ssvb / sunxi-pmu-irq.patch
Created January 12, 2013 00:20
Try to register performance monitoring unit irq for Allwinner A10
diff --git a/arch/arm/mach-sun4i/devices.c b/arch/arm/mach-sun4i/devices.c
index ff56e9a..e4425f8 100644
--- a/arch/arm/mach-sun4i/devices.c
+++ b/arch/arm/mach-sun4i/devices.c
@@ -35,6 +35,7 @@
#include <asm/mach/arch.h>
#include <asm/mach/time.h>
#include <asm/setup.h>
+#include <asm/pmu.h>
#include <mach/hardware.h>
@ssvb
ssvb / gist:4520736
Created January 12, 2013 22:18
DRI2 communication with Mali r3p0 blob
The trace of DRI2 communication:
MaliDRI2CreateBuffer attachment=1 buffer=0xc09250, offs=0, name=83
MaliDRI2CreateBuffer attachment=0 buffer=0xc09290, offs=150, name=84
MaliDRI2ScheduleSwap (front->attachment=0,front->name=84) (back->attachment=1,back->name=83) 0xc09290 0xc09250
MaliDRI2CreateBuffer attachment=1 buffer=0xd130f8, offs=300, name=85
MaliDRI2CreateBuffer attachment=0 buffer=0xd06200, offs=450, name=86
MaliDRI2DestroyBuffer attachment=1 buffer=0xc09250
MaliDRI2DestroyBuffer attachment=0 buffer=0xc09290
MaliDRI2ScheduleSwap (front->attachment=0,front->name=86) (back->attachment=1,back->name=85) 0xd06200 0xd130f8
#!/bin/sh
make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- mrproper
make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- sun4i_defconfig
make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- menuconfig
make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- -j8 uImage || exit 1
make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- -j8 modules || exit 1
make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- modules_install INSTALL_MOD_PATH=/mnt/arm-nfs-root
scp arch/arm/boot/uImage root@sun4i:/mnt/mmcblk0p1/uImage
../sunxi-tools/fex2bin mele_a1000.fex script.bin
@ssvb
ssvb / teardemo.c
Created January 30, 2013 18:55
VSYNC test for Allwinner A10 display controller
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <assert.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <sys/ioctl.h>
#include <linux/fb.h>
@ssvb
ssvb / gist:5207485
Created March 20, 2013 19:06
xf86-video-sunxifb 16bpp xorg.conf
Section "Device"
Identifier "Allwinner A10/A13 FBDEV 1"
Driver "sunxifb"
Option "fbdev" "/dev/fb0"
EndSection
Section "Screen"
Identifier "Sunxi Screen"
Device "Allwinner A10/A13 FBDEV 1"
DefaultDepth 16
@ssvb
ssvb / gist:5273581
Created March 29, 2013 20:54
'Crush' test from TestU01 for the Allwinner A10 hardware PRNG accelerator
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Starting Crush
Version: TestU01 1.2.3
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
***********************************************************
Test smarsa_SerialOver calling smultin_MultinomialOver
***********************************************************
@ssvb
ssvb / gist:5276498
Created March 30, 2013 12:22
Benchmark for Allwinner A10 SRAM
In the kernel:
diff --git a/drivers/char/sun4i_g2d/g2d_driver.c b/drivers/char/sun4i_g2d/g2d_driver.c
index be4efe2..33c43ba 100644
--- a/drivers/char/sun4i_g2d/g2d_driver.c
+++ b/drivers/char/sun4i_g2d/g2d_driver.c
@@ -317,15 +317,11 @@ int g2d_mmap(struct file *file, struct vm_area_struct * vma)
unsigned long mypfn;
unsigned long vmsize = vma->vm_end-vma->vm_start;
@ssvb
ssvb / gist:5281249
Created March 31, 2013 16:47
Branch prediction rate doing 'dd if=/dev/sda of=/dev/null' (with the same usb flash) for Atom, Cortex-A8 and Cortex-A15
======= Intel Atom N450 ==========
atom ~ # perf stat dd if=/dev/sdb of=/dev/null bs=1M
7839+1 records in
7839+1 records out
8220834816 bytes (8.2 GB) copied, 411.443 s, 20.0 MB/s
Performance counter stats for 'dd if=/dev/sdb of=/dev/null bs=1M':
35503.879851 task-clock # 0.086 CPUs utilized
@ssvb
ssvb / release-sunxi-disp-layers.c
Created April 17, 2013 14:30
A hack to forcefully release the leaked sunxi disp layers.
#include <stdint.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/fb.h>
#define DISP_CMD_LAYER_RELEASE 0x41
int fd;
int layer_release(int layer_id)
@ssvb
ssvb / gist:5422200
Created April 19, 2013 18:24
Perf top for cedarx/vlc video playback (http://linux-sunxi.org/VLC)
AUDIO: 44100 Hz, 2 ch, s16le, 192.0 kbit/13.60% (ratio: 23999->176400)
Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio))
Apparently 44100 Hz -> 48000 Hz sample rate conversion can be
ridiculously slow and heavily taxing the CPU.
PerfTop: 8051 irqs/sec kernel:19.1% exact: 0.0% [4000Hz cycles], (all, 1 CPU)
--------------------------------------------------------------------------------------------------------------------------------
65.32% libsamplerate.so.0.1.7 [.] 0x000045a0