OpenGL and SGX-PVR drivers on custom hardware

35 views
Skip to first unread message

Daniel Gorsulowski

unread,
Oct 11, 2016, 7:36:20 AM10/11/16
to BeagleBoard
Hello!
Im working on custom Hardware, related to Beaglebone black. The main part is equal to this board, so I hope you can help me.
The major hardware difference is, there is a LVDS transmitter in place of the HDMI transmitter.
The major software difference is: I'm using an old ELDK 5.3 toolchain and RootFS - details follow.

My problem is:
I build the kernel and the SGX modules, everything seems fine, including the installation on target. But executing tests, i.e. pvr2d_test, sgx_init_test, sgx_*_test causes segmentation faults.
(And I dont't know if this correlates with my other issue: Qt5 EGLFS apps show nothing but a black screen without error messages)

My steps are:
I'm following http://elinux.org/BeagleBoardDebian#SGX_BeagleBone.2FBeagleBone_Black
git clone https://github.com/RobertCNelson/bb-kernel.git
cd bb
-kernel
git checkout origin
/am33x-v4.1 -b bb300
git am
../0001-add-bb300-board-support.patch
./build_kernel.sh
./sgx_build_modules.sh

sudo tar xf deploy
/GFX_5.01.01.02_es8.x.tar.gz -C /tftpboot/bb300/linux/rootfs/
sed
-i -e 's\distro=$(lsb_release -si)\distro=Ubuntu\' /tftpboot/bb300/linux/rootfs/opt/gfxinstall/sgx-install.sh
sudo tar xf deploy/4.1.3324-modules.tar.gz -C /tftpboot/bb300/linux/rootfs/ --exclude=lib/modules/4.1.3324/kernel/crypto --exclude=lib/modules/4.1.3324/kernel/drivers/bluetooth --exclude=lib/modules/4.1.3324/kernel/net/bluetooth




0001-add-bb300-board-support.patch:
diff --git a/.gitignore b/.gitignore
index c16aff6
..7cfbbe2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
 
.CC
 recipe
.sh
-system.sh
+#system.sh
 KERNEL
 dl
 deploy
@@ -12,3 +12,4 @@ patches/previous_defconfig
 patches
/bisect_defconfig
 patches
/HEAD_omap2plus_defconfig
 patches
/MOD_omap2plus_defconfig
+patches/ref_bb300_defconfig
diff
--git a/build_kernel.sh b/build_kernel.sh
index
10a58b1..0fd4cb8 100755
--- a/build_kernel.sh
+++ b/build_kernel.sh
@@ -71,10 +71,10 @@ make_kernel () {
 
     unset address
 
-    ##uImage, if you really really want a uImage, zreladdr needs to be defined on the build line going forward...
-    ##make sure to install your distro's version of mkimage
-    #image="uImage"
-    #address="LOADADDR=${ZRELADDR}"
+    #uImage, if you really really want a uImage, zreladdr needs to be defined on the build line going forward...
+    #make sure to install your distro's version of mkimage
+    image="uImage"
+    address="LOADADDR=${ZRELADDR}"
 
     cd
"${DIR}/KERNEL" || exit
     echo
"-----------------------------"
diff
--git a/patch.sh b/patch.sh
index
4e9a8b5..7634dd4 100644
--- a/patch.sh
+++ b/patch.sh
@@ -612,6 +612,23 @@ sgx () {
     
fi
 
}
 
+bb300 () {
+    echo "dir: bb300"
+    #regenerate="enable"
+    if [ "x${regenerate}" = "xenable" ] ; then
+        start_cleanup
+    fi
+
+    ${git} "${DIR}/patches/bb300/0001-reset-is_reset-and-clear_reset-api-s.patch"
+    ${git} "${DIR}/patches/bb300/0003-arm-add-bb300-board-support.patch"
+
+    if [ "x${regenerate}" = "xenable" ] ; then
+        number=2
+        cleanup
+    fi
+}
+
 
###
 reverts
 backports
@@ -622,6 +639,7 @@ bbb_overlays
 beaglebone
 quieter
 sgx
+bb300
 
 packaging
() {
     echo
"dir: packaging"
diff
--git a/patches/defconfig b/patches/defconfig
index
4688ec4..a96e82b 100644
--- a/patches/defconfig
+++ b/patches/defconfig
@@ -1,17 +1,13 @@
 
#
 
# Automatically generated file; DO NOT EDIT.
-# Linux/arm 4.1.22 Kernel Configuration
+# Linux/arm 4.1.33 Kernel Configuration
 
#
 CONFIG_ARM
=y
 CONFIG_ARM_HAS_SG_CHAIN
=y
...
   
>>> cut, let me know if you need it <<<
...
diff
--git a/patches/bb300/0001-reset-is_reset-and-clear_reset-api-s.patch b/patches/bb300/0001-reset-is_reset-and-clear_reset-api-s.patch
new file mode 100644
index
0000000..9fd5977
--- /dev/null
+++ b/patches/bb300/0001-reset-is_reset-and-clear_reset-api-s.patch
@@ -0,0 +1,94 @@
+From c2fcba10eac12885dbe50c8fd5ce5d0653e92cf3 Mon Sep 17 00:00:00 2001
+From: Daniel G <daniel.g@xxx.eu>
+Date: Fri, 7 Oct 2016 09:10:33 +0200
+Subject: [PATCH 1/3] reset: is_reset and clear_reset api's
+
+Enhance reset framework with "is_reset" and "clear_reset" api'
s.
+is_reset - used by client driver to know reset status
+clear_reset - used by client driver to clear reset status
+
+These functionalities may sometimes be achieved by using existing api
+like deassert. But in some scenarios, steps to achieve reset requires
+clearing reset, deassert reset, enabling clock to module and then
+checking reset status. Here enabling clock module is coming in between
+reset procedure, hence enhance framework with additional api's.
+
+Signed-off-by: Afzal Mohammed <af...@ti.com>
+---
+ drivers/reset/core.c             | 32 ++++++++++++++++++++++++++++++++
+ include/linux/reset-controller.h |  2 ++
+ include/linux/reset.h            |  2 ++
+ 3 files changed, 36 insertions(+)
+
+diff --git a/drivers/reset/core.c b/drivers/reset/core.c
+index 7955e00..e72c530 100644
+--- a/drivers/reset/core.c
++++ b/drivers/reset/core.c
+@@ -126,6 +126,38 @@ int reset_control_deassert(struct reset_control *rstc)
+ EXPORT_SYMBOL_GPL(reset_control_deassert);
+
+ /**
++ * reset_control_is_reset - check reset status
++ * @rstc: reset controller
++ *
++ * Returns a boolean or negative error code
++ *
++ */
++int reset_control_is_reset(struct reset_control *rstc)
++{
++    if (rstc->rcdev->ops->is_reset)
++        return rstc->rcdev->ops->is_reset(rstc->rcdev, rstc->id);
++
++    return -ENOSYS;
++}
++EXPORT_SYMBOL_GPL(reset_control_is_reset);
++
++/**
++ * reset_control_clear_reset - clear the reset
++ * @rstc: reset controller
++ *
++ * Returns zero on success or negative error code
++ *
++ */
++int reset_control_clear_reset(struct reset_control *rstc)
++{
++    if (rstc->rcdev->ops->clear_reset)
++        return rstc->rcdev->ops->clear_reset(rstc->rcdev, rstc->id);
++
++    return -ENOSYS;
++}
++EXPORT_SYMBOL_GPL(reset_control_clear_reset);
++
++/**
+  * reset_control_status - returns a negative errno if not supported, a
+  * positive value if the reset line is asserted, or zero if the reset
+  * line is not asserted.
+diff --git a/include/linux/reset-controller.h b/include/linux/reset-controller.h
+index ce6b962..a10b855 100644
+--- a/include/linux/reset-controller.h
++++ b/include/linux/reset-controller.h
+@@ -18,6 +18,8 @@ struct reset_control_ops {
+     int (*reset)(struct reset_controller_dev *rcdev, unsigned long id);
+     int (*assert)(struct reset_controller_dev *rcdev, unsigned long id);
+     int (*deassert)(struct reset_controller_dev *rcdev, unsigned long id);
++    int (*is_reset)(struct reset_controller_dev *rcdev, unsigned long id);
++    int (*clear_reset)(struct reset_controller_dev *rcdev, unsigned long i);
+     int (*status)(struct reset_controller_dev *rcdev, unsigned long id);
+ };
+
+diff --git a/include/linux/reset.h b/include/linux/reset.h
+index da5602b..f6c8bea 100644
+--- a/include/linux/reset.h
++++ b/include/linux/reset.h
+@@ -10,6 +10,8 @@ struct reset_control;
+ int reset_control_reset(struct reset_control *rstc);
+ int reset_control_assert(struct reset_control *rstc);
+ int reset_control_deassert(struct reset_control *rstc);
++int reset_control_is_reset(struct reset_control *rstc);
++int reset_control_clear_reset(struct reset_control *rstc);
+ int reset_control_status(struct reset_control *rstc);
+
+ struct reset_control *reset_control_get(struct device *dev, const char *id);
+--
+2.10.1
+
diff --git a/patches/bb300/0003-arm-add-bb300-board-support.patch b/patches/bb300/0003-arm-add-bb300-board-support.patch
new file mode 100644
index 0000000..8549f15
--- /dev/null
+++ b/patches/bb300/0003-arm-add-bb300-board-support.patch
@@ -0,0 +1,7176 @@
+From 37a2a4b149ddf7b2ec651c064a685230a913a867 Mon Sep 17 00:00:00 2001
+From: Daniel G <dani...@xxx.eu>
+Date: Mon, 10 Oct 2016 11:46:30 +0200
+Subject: [PATCH 3/3] arm: add bb300 board support
+
+Signed-off-by: Daniel G <dani...@xxx.eu>
+---
+ arch/arm/boot/dts/Makefile          |    3 +-
+ arch/arm/boot/dts/bb300.dts         |  787 +++++++++
+ arch/arm/configs/bb300_defconfig    | 3180 +++++++++++++++++++++++++++++++++++
+ 4 files changed, 7127 insertions(+), 1 deletion(-)
+ create mode 100644 arch/arm/boot/dts/bb300.dts
+ create mode 100644 arch/arm/configs/bb300_defconfig
+
+diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
+index dad450c..69960a7 100644
+--- a/arch/arm/boot/dts/Makefile
++++ b/arch/arm/boot/dts/Makefile
+@@ -435,7 +435,8 @@ dtb-$(CONFIG_SOC_AM33XX) += \
+     am335x-nano.dtb \
+     am335x-pepper.dtb \
+     am335x-lxm.dtb \
+-    am335x-chiliboard.dtb
++    am335x-chiliboard.dtb \
++    bb300.dtb
+ dtb-$(CONFIG_ARCH_OMAP4) += \
+     omap4-duovero-parlor.dtb \
+     omap4-panda.dtb \
+diff --git a/arch/arm/boot/dts/bb300.dts b/arch/arm/boot/dts/bb300.dts
+new file mode 100644
+index 0000000..3de4d74
+--- /dev/null
++++ b/arch/arm/boot/dts/bb300.dts
+@@ -0,0 +1,787 @@
++/*
++ * Copyright (C) 2016 esd GmbH - http://www.esd.eu
++ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ */
++
++/*
++ * BB300 device-tree
++ * for kernel 4.4
++ */
++
++/dts-v1/;
++
++#include "am33xx.dtsi"
++
++/ {
++    model = "esd BB300";
++    compatible = "esd,bb300", "ti,am33xx";
...
    >>> cut, let me know if you need it <<<
...
+diff --git a/arch/arm/configs/bb300_defconfig b/arch/arm/configs/bb300_defconfig
+new file mode 100644
+index 0000000..a96e82b
+--- /dev/null
++++ b/arch/arm/configs/bb300_defconfig
+@@ -0,0 +1,3180 @@
++#
++# Automatically generated file; DO NOT EDIT.
++# Linux/arm 4.1.33 Kernel Configuration
++#
...
    >>> cut, let me know if you need it <<<
...
diff --git a/system.sh b/system.sh
new file mode 100644
index 0000000..c88364b
--- /dev/null
+++ b/system.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+#copy as "system.sh" and tweak for your system
+
+ARCH=$(uname -m)
+
+#ARM Native gcc compiler (running gcc on arm target)
+if [ "x${ARCH}" = "xarmv7l" ] ; then
+    #Native arm gcc compiler
+    CC=
+fi
+
+###REQUIRED:
+
+#ARM GCC CROSS Compiler:
+#if CC is not set, a known working linaro based gcc compiler will be downloaded and utilized.
+#CC=<enter full path>/bin/arm-none-eabi-
+#CC=<enter full path>/bin/arm-linux-gnueabi-
+#CC=<enter full path>/bin/arm-linux-gnueabihf-
+CC=/opt/eldk_530/armv7a/sysroots/i686-eldk-linux/usr/bin/armv7a-vfp-neon-linux-gnueabi/arm-linux-gnueabi-
+
+ZRELADDR=0x80008000
+
+###OPTIONAL:
+
+###OPTIONAL: LINUX_GIT: specify location of locally cloned git tree.
+#
+#LINUX_GIT=/home/user/linux-stable/
+
+###OPTIONAL: MMC: (REQUIRED FOR RUNNING: tools/install_kernel.sh)
+#Note: This operates on raw disks, NOT PARTITIONS..
+#
+#WRONG: MMC=/dev/mmcblk0p1
+#CORRECT: MMC=/dev/mmcblk0
+#
+#WRONG: MMC=/dev/sde1
+#CORRECT: MMC=/dev/sde
+#
+#MMC=/dev/sde
+
+###ADVANCED: RUN_BISECT: used with ./scripts/bisect.sh
+#
+#RUN_BISECT=1
+
+###ADVANCED: AUTO_BUILD: Easier integration with Jenkins/Buildbot/etc..
+#
+AUTO_BUILD=1
diff --git a/version.sh b/version.sh
index 6d015d7..ad1e02d 100644
--- a/version.sh
+++ b/version.sh
@@ -2,10 +2,13 @@
 #
 ARCH=$(uname -m)
 
-config="omap2plus_defconfig"
+#config="omap2plus_defconfig"
+config="bb300_defconfig"
 
-build_prefix="-bone"
-branch_prefix="am33x-v"
+#build_prefix="-bone"
+#branch_prefix="am33x-v"
+build_prefix=""
+branch_prefix=""
 branch_postfix=""
 
 #arm
@@ -16,7 +19,7 @@ KERNEL_ARCH=arm
 #toolchain="gcc_linaro_gnueabi_4_6"
 #toolchain="gcc_linaro_gnueabihf_4_7"
 #toolchain="gcc_linaro_gnueabihf_4_8"
-toolchain="gcc_linaro_gnueabihf_4_9"
+#toolchain="gcc_linaro_gnueabihf_4_9"
 #toolchain="gcc_linaro_gnueabihf_5"
 #arm64
 #KERNEL_ARCH=arm64
--
2.10.1




On target I execute:
cd /opt/gfxinstall
./sgx-install.sh




After rebooting, the gfx_check.sh output is:
WSEGL settings
[default]
WindowSystem=libpvrPVR2D_FRONTWSEGL.so
#WindowSystem=libpvrPVR2D_FLIPWSEGL.so

------
ARM CPU information
processor      
: 0
model name      
: ARMv7 Processor rev 2 (v7l)
BogoMIPS        : 548.86
Features        : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32
CPU implementer
: 0x41
CPU architecture
: 7
CPU variant    
: 0x3
CPU part        
: 0xc08
CPU revision    
: 2

Hardware        : Generic AM33XX (Flattened Device Tree)
Revision        : 0000
Serial          : 0000000000000000
------
SGX driver information
Version SGX_DDK_Linux_CustomerTI sgxddk 1.10@2359475 (release) /data/home/danielg/opt/prj/svn/holzher/hh300/trunk/qt/qt5/OpenGL/bb-kernel/ignore/ti-sdk-pvr/Graphics_SDK/GFX_Linux_KM
System Version String: SGX revision = 125
------
Framebuffer settings
------
Rotation settings
0
------
Kernel Module information
Module                  Size  Used by
omaplfb                
11378  1
pvrsrvkm              
174115  5 omaplfb
------
Boot settings
ip
=10.0.18.160:10.0.0.190:10.0.0.79:255.255.0.0:bb3xx-GA000011::off panic=1 root=/dev/nfs rw nfsroot=10.0.0.190:/tftpboot/hh300/linux/rootfs console=ttyO0,115200 quiet video=1024x768@60 bd_type=ppc315
------
Linux Kernel version
Linux bb3xx 4.1.3324 #1 SMP Mon Oct 10 12:58:52 CEST 2016 armv7l GNU/Linux



stracing sgx_init_test gives:
root@bb3xx:~# strace sgx_init_test
execve
("/usr/local/bin/sgx_init_test", ["sgx_init_test"], [/* 27 vars */]) = 0
brk
(0)                                  = 0x17c6000
uname
({sys="Linux", node="bb3xx", ...}) = 0
mmap2
(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6fbe000
...
   
>>> cut, let me know if you need it <<<
...
open
("/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
read
(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\200Q\231K4\0\0\0"..., 512) = 512
fstat64
(3, {st_mode=S_IFREG|0644, st_size=1488554, ...}) = 0
mmap2
(0x4b988000, 153752, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x4b988000
mprotect
(0x4b9a6000, 28672, PROT_NONE)  = 0
mmap2
(0x4b9ad000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1d) = 0x4b9ad000
close
(3)                                = 0
mmap2
(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f58000
set_tls
(0xb6f58800, 0xb6f58ed8, 0x4b837058, 0xb6f58800, 0x4b837058) = 0
mprotect
(0x4b97d000, 8192, PROT_READ)   = 0
mprotect
(0x4b9cb000, 4096, PROT_READ)   = 0
mprotect
(0x4b9e5000, 4096, PROT_READ)   = 0
mprotect
(0x4b849000, 4096, PROT_READ)   = 0
mprotect
(0xb6f80000, 4096, PROT_READ)   = 0
mprotect
(0xb6fb1000, 8192, PROT_READ)   = 0
mprotect
(0x12000, 4096, PROT_READ)      = 0
mprotect
(0x4b836000, 4096, PROT_READ)   = 0
munmap
(0xb6fb4000, 38807)               = 0
set_tid_address
(0xb6f583a8)             = 1483
set_robust_list
(0xb6f583b0, 12)         = 0
futex
(0xbef97558, FUTEX_WAKE_PRIVATE, 1) = 0
futex
(0xbef97558, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, 4b9cc000) = -1 EAGAIN (Resource temporarily unavailable)
rt_sigaction
(SIGRTMIN, {0x4b9b539c, [], SA_SIGINFO|0x4000000}, NULL, 8) = 0
rt_sigaction
(SIGRT_1, {0x4b9b5240, [], SA_RESTART|SA_SIGINFO|0x4000000}, NULL, 8) = 0
rt_sigprocmask
(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit
(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} ---
+++ killed by SIGSEGV +++
Segmentation fault



Reply all
Reply to author
Forward
0 new messages