Miouyouyou / RockMyy

Build scripts and patches used to cross-compile 5.6-rcX kernels for RK3288 boards
MIT License
32 stars 8 forks source link

Can we use Chromebit userspace drivers? #11

Closed kingio closed 4 years ago

kingio commented 5 years ago

I noticed that my Chromebit has libmali.so -> 1.4 Midgard-"r22p0-01rel0". Since it has RK3288, the same as Asus TinkerBoard. Could i reuse it's libs to get hardware acceleration working on the tinkerboard?

(i've tried Armbian images, TinkerOS v2.0.7-8 and i never get chrome with video hardware acc working).

My attempt was:

  1. Copy libmali.so from Chromebit and place it to /home/linaro/mali_test in TinkerBoard
  2. Run LD_LIBRARY_PATH=/home/linaro/mali_test /etc/chrome

Output: file /dev/mali0 is not of a compatible version (user 11.4, kernel 10.6)

What else should i grab to make it work? Or can i bypass that compatibility check to see if it works anyway?

I could share the libs if they fit for your project too. I've also seen that they have rk3288_vpu module rather than rockchip_vpu.

Miouyouyou commented 5 years ago

Good question.

In order to use these drivers, you might need to apply the latest Mali GPL Kernel driver. https://developer.arm.com/products/software/mali-drivers/midgard-kernel

Here's a modified version of my main script, that does the job :


export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-

export KERNEL_GIT_URL='git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git'

if [ -z ${MAKEOPTS+x} ]; then
    export MAKEOPTS=-j16
fi

export KERNEL_SERIES=v4.19
export KERNEL_BRANCH=v4.19
export LOCALVERSION=-RockMyyX
export MALI_VERSION=r28p0-01rel0
export MALI_BASE_URL=https://developer.arm.com/-/media/Files/downloads/mali-drivers/kernel/mali-midgard-gpu

export GITHUB_REPO=Miouyouyou/RockMyy
export GIT_BRANCH=master

export DTB_FILES="
rk3288-evb-act8846.dtb
rk3288-evb-rk808.dtb
rk3288-fennec.dtb
rk3288-firefly-beta.dtb
rk3288-firefly-reload.dtb
rk3288-firefly.dtb
rk3288-tinker.dtb
rk3288-miqi.dtb
rk3288-popmetal.dtb
rk3288-r89.dtb
rk3288-rock2-square.dtb
rk3288-veyron-brain.dtb
rk3288-veyron-jaq.dtb
rk3288-veyron-jerry.dtb
rk3288-veyron-mickey.dtb
rk3288-veyron-minnie.dtb
rk3288-veyron-pinky.dtb
rk3288-veyron-speedy.dtb
"

export PATCHES_DIR=patches
export KERNEL_PATCHES_DIR=$PATCHES_DIR/kernel/$KERNEL_SERIES
export KERNEL_PATCHES_DTS_DIR=$KERNEL_PATCHES_DIR/DTS
export MALI_PATCHES_DIR=$PATCHES_DIR/Midgard/$MALI_VERSION
export KERNEL_DOCUMENTATION_PATCHES_DIR=$KERNEL_PATCHES_DIR/Documentation
export CONFIG_FILE_PATH=config/$KERNEL_SERIES/config-latest

export BASE_FILES_URL=https://raw.githubusercontent.com/$GITHUB_REPO/$GIT_BRANCH
export KERNEL_PATCHES_DIR_URL=$BASE_FILES_URL/$KERNEL_PATCHES_DIR
export KERNEL_DTS_PATCHES_DIR_URL=$BASE_FILES_URL/$KERNEL_PATCHES_DTS_DIR
export KERNEL_DOCUMENTATION_PATCHES_DIR_URL=$BASE_FILES_URL/$KERNEL_DOCUMENTATION_PATCHES_DIR
export MALI_PATCHES_DIR_URL=$BASE_FILES_URL/$MALI_PATCHES_DIR
export CONFIG_FILE_URL=$BASE_FILES_URL/config/$KERNEL_SERIES/config-latest

export KERNEL_PATCHES="
0001-drivers-Integrating-Mali-Midgard-video-and-gpu-drive.patch
0002-clk-rockchip-add-all-known-operating-points-to-the-a.patch
0003-clk-rockchip-rk3288-prefer-vdpu-for-vcodec-clock-sou.patch
0005-drivers-mmc-dw-mci-rockchip-Handle-ASUS-Tinkerboard.patch
0006-soc-rockchip-power-domain-export-idle-request.patch
0007-drivers-wifi-ath9k-reverse-do-not-use-bulk-on-EP3-and-EP4.patch
0008-rockchip-dwc2-usb-partial-power-down.patch
0009-drivers-clk-rk3288-support-for-dedicating-NPLL-to-a-.patch
0010-drm-dw_hdmi-rockchip-better-clock-selection-logic-an.patch
0011-block-partitions-efi-Ignore-GPT-flags-on-Veyron-Chro.patch
0012-block-partitions-efi-Ignore-bizarre-Chromebook-GPT-p.patch
0013-mmc-Added-a-flag-to-disable-cache-flush-during-reset.patch
0100-media-Add-JPEG_RAW-format.patch
0101-media-Add-controls-for-JPEG-quantization-tables.patch
"

export KERNEL_DTS_PATCHES="
0001-dts-rk3288-miqi-Enabling-the-Mali-GPU-node.patch
0002-ARM-dts-rockchip-fix-the-regulator-s-voltage-range-o.patch
0003-ARM-dts-rockchip-add-the-MiQi-board-s-fan-definition.patch
0004-ARM-dts-rockchip-add-support-for-1800-MHz-operation-.patch
0005-Readapt-ARM-dts-rockchip-miqi-add-turbo-mode-operati.patch
0006-ARM-DTSI-rk3288-Missing-GRF-handles.patch
0007-RK3288-DTSI-rk3288-Add-missing-SPI2-pinctrl.patch
0008-Added-support-for-Tinkerboard-s-SPI-interface.patch
0009-ARM-DTSI-rk3288-Adding-cells-addresses-and-size.patch
0010-ARM-DTSI-rk3288-Adding-missing-EDP-power-domain.patch
0011-ARM-DTSI-rk3288-Adding-missing-VOPB-registers.patch
0012-ARM-DTSI-rk3288-Fixed-the-SPDIF-node-address.patch
0013-ARM-DTS-rk3288-tinker-Enabling-SDIO-and-Wifi.patch
0014-ARM-DTS-rk3288-tinker-Setup-the-Bluetooth-UART-pins.patch
0015-ARM-DTS-rk3288-tinker-Improving-the-CPU-max-volt.patch
0016-ARM-DTS-rk3288-tinker-Setting-up-the-SD-regulato.patch
0017-ARM-DTS-rk3288-tinker-Defined-the-I2C-interfaces.patch
0018-ARM-DTS-rk3288-tinker-Defining-the-SPI-interface.patch
0019-ARM-DTS-rk3288-tinker-Defining-SDMMC-properties.patch
0026-ARM-DTSI-rk3288-Set-the-VPU-MMU-power-domains.patch
0027-ARM-dtsi-The-VPU-service-as-defined-in-the-V4L2-driv.patch
0028-dts-rk3288-veyron-chromebook-dedicate-npll-to-VOP0-H.patch
0029-dts-rk3288-support-for-dedicating-npll-to-a-vop.patch
0030-arm-dts-veyron-Added-a-flag-to-disable-cache-flush-d.patch
"

export KERNEL_DOCUMENTATION_PATCHES="
0001-dt-bindings-clock-rk3288-cru-Add-property-to-dedicat.patch
0002-dt-bindings-display-rockchip-dw_hdmi-Add-property-fo.patch
"

export MALI_PATCHES="
0001-Mali-midgard-r19p0-fixes-for-4.13-kernels.patch
0004-Don-t-be-TOO-severe-when-looking-for-the-IRQ-names.patch
0005-Added-the-new-compatible-list-mainly-used-by-Rockchi.patch
0006-gpu-arm-Midgard-setup_timer-timer_setup.patch
0007-drivers-gpu-Arm-Midgard-Replace-ACCESS_ONCE-by-READ_.patch
0008-gpu-arm-midgard-Remove-sys_close-references.patch
0009-GPU-ARM-Midgard-Adapt-to-the-new-mmap-call-checks.patch
"

# -- Helper functions

function die_on_error {
    if [ ! $? = 0 ]; then
        echo $1
        exit 1
    fi
}

function download_patches {
    base_url=$1
    patches=${@:2}
    for patch in $patches; do
        wget $base_url/$patch ||
        { echo "Could not download $patch"; exit 1; }
    done
}

function download_and_apply_patches {
    base_url=$1
    patches=${@:2}
    download_patches $base_url $patches
    git apply $patches
    die_on_error "Could not apply the downloaded patches"
    rm $patches
}

function copy_and_apply_patches {
    patch_base_dir=$1
    patches=${@:2}

    apply_dir=$PWD
    cd $patch_base_dir
    cp $patches $apply_dir ||
    { echo "Could not copy $patch"; exit 1; }
    cd $apply_dir
    git apply $patches
    die_on_error "Could not apply the copied patches"
    rm $patches
}

# Get the kernel

# If we haven't already clone the Linux Kernel tree, clone it and move
# into the linux folder created during the cloning.
if [ ! -d "linux" ]; then
  git clone --depth 1 --branch $KERNEL_BRANCH $KERNEL_GIT_URL linux
  die_on_error "Could not git the kernel"
fi
cd linux
export SRC_DIR=$PWD

# Check if the tree is patched
if [ ! -e "PATCHED" ]; then
    # If not, cleanup, apply the patches, commit and mark the tree as
    # patched

    # Remove all untracked files. These are residues from failed runs
    git clean -fdx &&
    # Rewind modified files to their initial state.
    git checkout -- .

    # Download, prepare and copy the Mali Kernel-Space drivers.
    # Some TGZ are AWFULLY packaged with everything having 0777 rights.

    wget "$MALI_BASE_URL/TX011-SW-99002-$MALI_VERSION.tgz" &&
    tar zxvf TX011-SW-99002-$MALI_VERSION.tgz &&
    cd TX011-SW-99002-$MALI_VERSION &&
    find . -type 'f' -exec chmod 0644 {} ';' && # Every file   should have -rw-r--r-- rights
    find . -type 'd' -exec chmod 0755 {} ';' && # Every folder should have drwxr-xr-x rights
    find . -name 'sconscript' -exec rm {} ';' && # Remove sconscript files. Useless.
    cd driver/product/kernel &&
    cp -r drivers/gpu/arm  $SRC_DIR/drivers/gpu/ && # Copy the Midgard code
    cd $SRC_DIR &&
    rm -r TX011-SW-99002-$MALI_VERSION TX011-SW-99002-$MALI_VERSION.tgz

    # Download and apply the various kernel and Mali kernel-space driver patches
    if [ ! -d "../patches" ]; then
        download_and_apply_patches $KERNEL_PATCHES_DIR_URL $KERNEL_PATCHES
        download_and_apply_patches $KERNEL_DTS_PATCHES_DIR_URL $KERNEL_DTS_PATCHES
        download_and_apply_patches $KERNEL_DOCUMENTATION_PATCHES_DIR_URL $KERNEL_DOCUMENTATION_PATCHES
        #download_and_apply_patches $MALI_PATCHES_DIR_URL $MALI_PATCHES
    else
        copy_and_apply_patches ../$KERNEL_PATCHES_DIR $KERNEL_PATCHES
        copy_and_apply_patches ../$KERNEL_PATCHES_DTS_DIR $KERNEL_DTS_PATCHES
        copy_and_apply_patches ../$KERNEL_DOCUMENTATION_PATCHES_DIR $KERNEL_DOCUMENTATION_PATCHES
        #copy_and_apply_patches ../$MALI_PATCHES_DIR $MALI_PATCHES
    fi

    # Cleanup, get the configuration file and mark the tree as patched
    echo "RockMyy" > PATCHED &&
    git add . &&
    git commit -m "Apply ALL THE PATCHES !"
fi

# Download a .config file if none present
if [ ! -e ".config" ]; then
    make mrproper
    if [ ! -f "../$CONFIG_FILE_PATH" ]; then
        wget -O .config $CONFIG_FILE_URL
    else
        cp "../$CONFIG_FILE_PATH" .config
    fi
    die_on_error "Could not get the configuration file..."
fi

if [ -z ${MAKE_CONFIG+x} ]; then
  export MAKE_CONFIG=oldconfig
fi

make $MAKE_CONFIG
make $DTB_FILES zImage modules $MAKEOPTS
die_on_error "Compilation failed"

if [ -z ${DONT_INSTALL_IN_TMP+x} ]; then
    # Kernel compiled
    # This will just copy the kernel files and libraries in /tmp
    # This part is only useful if you're cross-compiling the kernel, of course
    export INSTALL_MOD_PATH=/tmp/RockMyy-Build
    export INSTALL_PATH=$INSTALL_MOD_PATH/boot
    export INSTALL_HDR_PATH=$INSTALL_MOD_PATH/usr
    mkdir -p $INSTALL_MOD_PATH $INSTALL_PATH $INSTALL_HDR_PATH
    make modules_install &&
    make install &&
    make INSTALL_HDR_PATH=$INSTALL_HDR_PATH headers_install && # This command IGNORES predefined variables
    cp arch/arm/boot/zImage $INSTALL_PATH &&
    cp arch/arm/boot/dts/*.dtb $INSTALL_PATH
fi

Just press Enter to configure the new Mali configuration options and then you'll have your kernel stuff in /tmp/RockMyy-Build/{boot,lib,usr} with boot containing the kernel image and DTB files, lib the modules and usr the user-space headers used by some applications. The modules will include the Mali kernel driver r28p0. Give it a try and tell me how it fares.

How you install them on your system depends on your system (I got no Chromebook to test this on).

Note that the script works as a standalone script. Meaning that you can just save it somewhere, run it on a machine with Internet access available and it will do its own thing.

That said, while RK3288 chips are similar, Armbian developers got some issues with Mali drivers working on some specific RK3288 and not others (e.g. It worked on Asus Tinkerboard but not on some MQMaker MiQi devices, ...).

Still, that would be awesome if that worked.

kingio commented 5 years ago

WoW! Thanks!

Note that the script works as a standalone script. Meaning that you can just save it somewhere, run it on a machine with Internet access available and it will do its own thing.

¿Wouldn't it require to be ARM?

Edit: I'm getting the following error :o

ERROR: The DDK is not compatible with any of the Mali GPUs on the system.
The DDK was built for 0x750 r0p0 status range [1..1], but none of the GPUs matched:

/dev/mali0 is not present so kernel space driver didn't load.

I tried applying your prebuilt kernel from https://github.com/Miouyouyou/RockMyy-Build and /dev/mali0 is present again, but hardware acc stills not.

Base image: TinkerOS 2.0.7 es2gears: 1.4 Midgard-"r9p0-05rel0" :S To test it i use:

  1. https://www.youtube.com/watch?v=LXb3EKWsInQ 1080p60 if it shows youtube loading circle from time to time, vpu it's not working
  2. https://webglsamples.org/aquarium/aquarium.html If it has < 40fps (current 15fps) acc is off no matter what browser may say in chrome://gpu

Chrome startup flags are: --use-gl=egl --enable-accelerated-video --ignore-gpu-blacklist

Also it randomly shutdowns the entire device :S (temps are ok)

Miouyouyou commented 5 years ago

The script cross-compile an ARMv7 kernel on a x86 machine, so the machine don't need to be ARM.
And given that most ARM machines use eMMC or cheap SD cards, I wouldn't recommend doing a full compilation on such ARM platform, for performances and storage wearing reasons.

Concerning the errors :

  1. Check with uname -a that you're running the right kernel.

  2. If es2gears display something like r9p0 then it's not using the right mali.so , IMHO. Be careful with libmali.so since most softwares don't look for the libmali.so, they look for libGLES2.so, libEGL.so and other libraries. You can do ldd /usr/bin/es2gears with LD_LIBRARY_PATH set correctly to determine which libraries are actually loaded when the es2gears is run.

  3. The VPU is independent of the GPU and my kernel do not include the VPU driver, since I never got it working correctly with mainline kernels. Search for Ezecquiel Garcia VPU on your favorite search engine and you should find his Github profile. He's trying to port the VPU driver to mainline kernels and maybe he did it by now.

  4. If you want to test OpenGL and EGL, glmark2-es2-drm in a console, as root, might be the quickest solution.

  5. If /dev/mali0 is not available, do a dmesg | grep -i mali. Also, when copying the newly compiled kernel files, be sure to copy the modules in /lib, else the kernel will be without its modules.

  6. If you're using r20+ Mali binary drivers, only try with the kernel compiled with the provided special script will work, since it's most likely that these drivers use the new IOCTL API, and I don't think that the r19p0 has full support of this new API.

kingio commented 5 years ago

Oh i thought you were making great progress on the vpu thing. Isn't useful for your research this script? https://forum.armbian.com/topic/7262-rk3288-media-script-tinkerboard-miqi/ They claim full vpu support

Miouyouyou commented 5 years ago

Some VPU code for mainline kernels have been sent by @hizukiayaka on the LKML, so I'll take a look at it this week and see how I can integrate this into RockMyy patches, in order to get, at least, VPU support through the MPP libraries.

The scripts you mentioned just install the requires user-space libraries to use the VPU. However, you need kernel space support too.

You can see it as a client/server thing.
The client is the software using the user-space libraries.
The server is the kernel with the drivers.

You need full support of the VPU protocol in your client.
And then you need full support of the VPU protocol AND operations in your server.

The way it works, roughly, is that the client will send the encoded frame to the kernel, acting as the "VPU server". The server will get the encoded frame, actually send it to the VPU hardware, get the decoded frame and send it back to the client. Then the client will displlay the decoded frame on the screen.

Now, if you got a VPU client but the server has no support of the protocol, it will just send you something like "Bad request" and the client will get nothing.

So, without the analogy, you need a software with the right protocol support (V4L2, MPP, ...) AND you need the kernel driver that will take the encoded frames and actually send them to the VPU, by writing a lot of things in various registers to get the work done, and get the result (through DMA mechanisms).

Anyway, who knows, you might have full support in a few weeks.

kingio commented 5 years ago

Thank you for taking your time to reply & explain me how does this work! So it's like 3 steps rather than 2 that must have VPU code/support no? Kernel -------------------> UserSpace ------------> App (ex: Chromium) no support ---------------- some support -------- no support ezequiel|Miouyouyou? ---- rockchip? ------------- google?

Yep i found Ezequiel: https://patchwork.kernel.org/project/linux-rockchip/list/?submitter=179601 I see he has started adding jpeg support and vp8/9 & h264 support may come later.

I also see or think that i see kernel support from google in chromiumos: https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-4.4/drivers/media/platform/rockchip-vpu/rockchip_vpu.c

kingio commented 5 years ago

@Miouyouyou i've been able to talk with Ezequiel, he said is working on making the VPU driver but for ChromiumOS kernel and that it won't work for normal linux kernel :(

Tonymac32 commented 5 years ago

@kingio the Armbian scripts are for userspace VPU on vendor 4.4 kernel. That said, with Kernel support, should work on mainline. The trick is getting the driver working. My thought is that Rockchip is starting to look toward pushing to a new kernel, but want the community to do most of the work first. ;-)

kingio commented 5 years ago

@Tonymac32 Sorry for the questions as they are probably obvious but not for me: If kodi does have hardware acceleration for this board, why can't the code be copied and used for any other application / v4l2?

Tonymac32 commented 5 years ago

If Kodi is running in Linux, probably. If Kodi is running on Android, no.

In any case you have to have the kernel driver working first.

On Wed, Jan 23, 2019, 7:58 AM Carlos Domínguez <notifications@github.com wrote:

@Tonymac32 https://github.com/Tonymac32 Sorry for the questions as they are probably obvious but not for me: If kodi does have hardware acceleration for this board, why can't the code be copied and used for any other application / v4l2?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Miouyouyou/RockMyy/issues/11#issuecomment-456792162, or mute the thread https://github.com/notifications/unsubscribe-auth/AUEygrsTvl1Sj1otet7ORzSC0NmjS9VJks5vGFyCgaJpZM4ZmqEv .

Miouyouyou commented 5 years ago

You can try the VPU driver with the following branch : https://github.com/Miouyouyou/RockMyy/tree/RandyLi-Patches-Test

kingio commented 5 years ago

i'm glad to see this moving forward! I knew you would break any barrier!

I built the kernel and this is what i got so far:

I'm sure i did something wrong, but UI is working so i don't know how it can't find the gpu : s

Tonymac32 commented 5 years ago

UI doesn't need Mali out of the box. did you put the device tree in the right place, and are you sure it's calling for the proper device tree?

@Miouyouyou I could jump Armbian's Dev kernel up to the 5.0 RC, then this should be an easier task with less "what if"

Miouyouyou commented 5 years ago

Did you load the right DTB file ? Does your extlinux.conf (or other boot system configuration file) loads up rk3288-tinker.dts ?

@Tonymac32 Hmm, give it a good try before, network wise. SSH on my Tinkerboard is shaky. However, I can do a full apt upgrade without issues so... yeah, check that up. Then, if that works, I guess upgrading it to 5.0-RC might be nice, indeed.

Still, on the worse case, I'll play with MPP and MPV this week-end.

@hizukiayaka What is the best setup for MPP and MPV with MPP-Service ?

Tonymac32 commented 5 years ago

@Miouyouyou of course. :-) Is it only SSH or networking in general? Remember "Dev" is dev for a reason, I'll be using a UART adapter anyway. Now that Next is 4.19 and seems quite stable, I'm not too worried about the stability of Dev while we get things like this figured out.

Miouyouyou commented 5 years ago

Yeah, seems to be only SSH here. It "just drops" and then get into a "I won't talk to you mode >:(" until I plug the network cable "off and on again"... It might just be some network configuration mess up with DHCP and all.

Miouyouyou commented 5 years ago

However, downloading packages from Debian repositories work fine and without issues.

Tonymac32 commented 5 years ago

@Miouyouyou I had to do some patch cleanups for RC3, however I successfully made a Bionic image, ran the armbian media script, and am watching a 1080P movie in full screen. That said, I haven't checked to see who is doing the decoding, cpu is sitting at 21% though. :-) The changes were pushed to the Armbian build system, rockchip-dev.

kingio commented 5 years ago

I don't find the extlinux.conf and i checked the files at /boot/ but i don't find any "text" one referencing a dtb. i will keep searching inside the sd card.

Edit: As i don't know how to force it properly, i edited the boot.cmd adding a setenv fdtfile "rk3288-tinker.dtb" after all ifs that set the same var. If i run cat /proc/device-tree/model it shows "Rockchip RK3288 Tinker Board". All previous commands still throw the same output.

Miouyouyou commented 5 years ago

Just to be sure, do a find /boot rk3288-tinker.dtb

Also, throw the result of dmesg | grep -i mali

kingio commented 5 years ago

ls -l /boot/rk3288-tinker.dtb -> root root 41573 Jan 22 20:53 dmesg | grep -i mali -> ``

Miouyouyou commented 5 years ago

There might be multiple rk3288-tinker.dtb in /boot, be sure to use find to check out if you don't have multiple versions of this file.

kingio commented 5 years ago

I tried it but, shows all files and says "no such file or directory". Doing locate rk3288-tinker.dtb returns:

(When i replaced the kernel, i copy&pasted the new /boot/ folder contents inside /boot/ & /boot/dtb-4.19.14-rockchip/)

I will now also apply the /boot/ folder to /usr/lib/linux-image-next-rockchip now.

Edit: After replacing all dtb from that folder the board didn't start on the first try, but on the second. Still the same output on all commands.

Miouyouyou commented 5 years ago

Okay, what's the output of dmesg ?

kingio commented 5 years ago

https://pastebin.com/wWMxVmEv

Miouyouyou commented 5 years ago

And lsmod ?

kingio commented 5 years ago

It's empty :o

Miouyouyou commented 5 years ago

Ah, you used the version I packaged and put on my server... Maybe I forgot something in the package, I'll have a look.

Miouyouyou commented 5 years ago

And just to be sure, if you do ls /lib/modules what do you have ?

kingio commented 5 years ago

It shows 2 folders:

Miouyouyou commented 5 years ago

If you do a find /lib/modules -iname "*mali*" do you get something ?

kingio commented 5 years ago

Yesss, on both folders i get a /kernel/drivers/gpu/arm/midgard/mali_kbase.ko

Miouyouyou commented 5 years ago

If you do modprobe mali_kbase then look at dmesg | tail what do you get ?

kingio commented 5 years ago
modprobe: ERROR: ../libkmod/libkmod.c:586 could not open moddep file /lib/modules/5.0.0-rc2-RockMyy-HighFive-VPU-Beta/modules.dep.bin
FATAL: Module mali_kbase not found in directory /lib/modules/5.0.0-rc2-RockMyy-HighFive-VPU-Beta

An ls to mali_kbase.ko reveals that it's 0 bytes : S

Miouyouyou commented 5 years ago

I just checked the archive and it weight 12MB in it, so something might have gone wrong during the copy. Delete the folder rm -r /lib/modules/5.0.0-rc2-RockMyy-HighFive-VPU-Beta.

(If you type this by hand, I recommend you do to this instead : ls /lib/modules/5.0.0-rc2-RockMyy-HighFive-VPU-Beta Then "Up arrow" and replace ls by rm -r so that there's less risk that you blow up everything by mistake when typing.)

Miouyouyou commented 5 years ago

Then download the archive : wget https://miouyouyou.fr/RockMyy/builds/RockMyy-5.0.0-rc2-HighFive-VPU-Beta.tar.xz on the Tinkerboard, again unpack it tar xvf 5.0.0-rc2-RockMyy-HighFive-VPU-Beta.tar.xz And copy the modules back sudo cp -r lib/* /lib/

Or try the latest rockchip-dev kernel from Armbian, they've incorporated my patches too, which enable the VPU.

Note that the patches only enable the "MPP service".

kingio commented 5 years ago

GPU has shown up now!

It's listed in dmesg and also in /dev/ as video0 and vpu_service :)

Miouyouyou commented 5 years ago

Alright ! Now, you'll have to find a version of MPP which works with vpu_service.

I'll strongly suggest you ask the fellows at #linux-rockchip on irc.freenode.net for RKMPP related stuff, since it's quite daunting. Also, understand that they might take like a day to answer, so you might want to prepare a PC (or the Tinkerboard) to lurk on the channel, or just use the logs at https://irclog.whitequark.org/linux-rockchip/

The MPP project is here : https://github.com/rockchip-linux/mpp

Miouyouyou commented 5 years ago

Also, you might want to give glmark2 a shot for GPU testing.

kingio commented 5 years ago

I tried using glmark2-es2-drm as you said previously but kept showing the same error, so i installed glmark2-es2. That one works but throws a libEGL warning: DRI2: failed to authenticate, so frames are 4-11fps

Miouyouyou commented 5 years ago

Are you in a terminal when you're using glmark2-es2-drm ? Also, do a

ldd `which glmark2-es2-drm`
kingio commented 5 years ago

Yes, i'm in terminal. Is there any other way to run it? I thought it was a command ups. https://pastebin.com/BhCaLtRi

Miouyouyou commented 5 years ago

what's the output of ls /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2 ?

When I say a terminal, I mean the one you when using CTRL+ALT+F1 (or F2, if F1 is used by X11). Turns out that X11 monopolize the DRM output of the terminal you're using. So you have to switch to another if you want to use DRM applications.

kingio commented 5 years ago

Inside the desktop i opened a terminal, i didn't know that CTL+ALT+FX opened a full screen terminal. I tried running glmark there but i get the same error. ls output: root root 18bytes libGLESv2.so.2 -> libEGLv2.so.2.0.0

Miouyouyou commented 5 years ago

Hmm, try : ls -l /usr/lib/arm-linux-gnueabihf/libGL* And also ls -l /usr/lib/arm-linux-gnueabihf/libmali*

Note that you need the Mali user-space binary drivers or the Panfrost GPL drivers to get accelerated OpenGL output through DRM.

For the Mali user-space binary driver, I don't remember if the Tinkerboard needs the r0p0 or the r1p0. Try this one https://github.com/rockchip-linux/rk-rootfs-build/blob/master/packages/armhf/libmali/libmali-rk-midgard-t76x-r14p0-r1p0_1.6-1_armhf.deb . If it doesn't work, purge the package and try this one https://github.com/rockchip-linux/rk-rootfs-build/blob/master/packages/armhf/libmali/libmali-rk-midgard-t76x-r14p0-r0p0_1.6-1_armhf.deb

Miouyouyou commented 5 years ago

For panfrost, it might be a bit more complex : https://gitlab.freedesktop.org/panfrost/mesa A Debian package of panfrost mesa "might" exist somewhere.

kingio commented 5 years ago

Uh, it's clearly that, sorry for wasting your time:

king@tinkerboard:~$ ls -l /usr/lib/arm-linux-gnueabihf/libEGL*
lrwxrwxrwx 1 root root     20 May 22  2018 /usr/lib/arm-linux-gnueabihf/libEGL_mesa.so.0 -> libEGL_mesa.so.0.0.0
-rw-r--r-- 1 root root 138200 May 22  2018 /usr/lib/arm-linux-gnueabihf/libEGL_mesa.so.0.0.0
lrwxrwxrwx 1 root root     15 Aug 15 06:20 /usr/lib/arm-linux-gnueabihf/libEGL.so -> libEGL.so.1.0.0
lrwxrwxrwx 1 root root     15 Aug 15 06:20 /usr/lib/arm-linux-gnueabihf/libEGL.so.1 -> libEGL.so.1.0.0
-rw-r--r-- 1 root root  46784 Aug 15 06:20 /usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0
king@tinkerboard:~$ ls -l /usr/lib/arm-linux-gnueabihf/libmali*
ls: cannot access '/usr/lib/arm-linux-gnueabihf/libmali*': No such file or directory

Going to install the debs.

Edit: Running dmesg | grep -i mali shows r0p0. Command to install no matter what cries: dpkg -i --force-overwrite libmali-rk-midgard-t76x-r14p0-r0p0_1.6-1_armhf.deb

Miouyouyou commented 5 years ago

It's okay. Be sure to install one of the debs, and only install the other (after uninstalled the previous one) if the first failed.

kingio commented 5 years ago

After installing the r0p0 es2 does not longer work:

On tty1:

king@tinkerboard:~$ glmark2-es2-drm
Error: Failed to find a suitable DRM device
Error: main: Could not initialize canvas
Segmentation fault
king@tinkerboard:~$ glmark2-es2
Error: main: Could not initialize canvas

On terminal inside desktop:

king@tinkerboard:~$ glmark2-es2-drm
Error: Failed to find a suitable DRM device
Error: main: Could not initialize canvas
Segmentation fault
king@tinkerboard:~$ glmark2-es2
Error: eglInitialize() failed with error: 0x3001
Error: eglInitialize() failed with error: 0x3001
Error: main: Could not initialize canvas

ls now returns:

@tinkerboard:~$ ls -l /usr/lib/arm-linux-gnueabihf/libmali*
lrwxrwxrwx 1 root root 10 Dec 15  2017 /usr/lib/arm-linux-gnueabihf/libmali.so -> libMali.so

@tinkerboard:~$ ls -l /usr/lib/arm-linux-gnueabihf/libMali*
lrwxrwxrwx 1 root root       10 Dec 15  2017 /usr/lib/arm-linux-gnueabihf/libMaliOpenCL.so -> libMali.so
-rw-r--r-- 1 root root 17585856 Dec 15  2017 /usr/lib/arm-linux-gnueabihf/libMali.so
Miouyouyou commented 5 years ago

Which glmark2 did you try ? The one packaged by Debian is quite old, IIRC. Try recompiling it from the Git, if you can, just to be sure.

sudo apt install libjpeg-dev libpng-dev pkg-config libudev-dev libdrm-dev libegl1-mesa-dev libgles2-mesa-dev libgbm-dev
git clone --depth 1 https://github.com/glmark2/glmark2
cd glmark2
./waf configure --with-flavors=drm-glesv2
./waf
sudo ./waf install

This should do the trick.