Merge pull request #4473 from HiassofT/le10-rpi-gbm

RPi: switch to gbm/v4l2
This commit is contained in:
CvH 2020-07-19 09:49:48 +02:00 committed by GitHub
commit 34b76cf1be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 25 additions and 243 deletions

View File

@ -17,13 +17,8 @@ PKG_CMAKE_OPTS_TARGET="-DBUILD_SHARED_LIBS=1 \
-DSKIP_PYTHON_WRAPPER=1 \ -DSKIP_PYTHON_WRAPPER=1 \
-DHAVE_IMX_API=0 \ -DHAVE_IMX_API=0 \
-DHAVE_AOCEC_API=0 -DHAVE_AMLOGIC_API=0 \ -DHAVE_AOCEC_API=0 -DHAVE_AMLOGIC_API=0 \
-DHAVE_GIT_BIN=0" -DHAVE_GIT_BIN=0 \
-DHAVE_RPI_LIB=0"
if [ "$KODIPLAYER_DRIVER" = "bcm2835-driver" ]; then
PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET bcm2835-driver"
else
PKG_CMAKE_OPTS_TARGET+=" -DHAVE_RPI_LIB=0"
fi
# libX11 and xrandr to read the sink's EDID, used to determine the PC's HDMI physical address # libX11 and xrandr to read the sink's EDID, used to determine the PC's HDMI physical address
if [ "$DISPLAYSERVER" = "x11" ]; then if [ "$DISPLAYSERVER" = "x11" ]; then
@ -36,13 +31,6 @@ else
PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_TARGET -DHAVE_LINUX_API=0" PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_TARGET -DHAVE_LINUX_API=0"
fi fi
pre_configure_target() {
if [ "$KODIPLAYER_DRIVER" = "bcm2835-driver" ]; then
# detecting RPi support fails without -lvchiq_arm
export LDFLAGS="$LDFLAGS -lvchiq_arm"
fi
}
post_makeinstall_target() { post_makeinstall_target() {
# Remove the Python3 demo - useless for us # Remove the Python3 demo - useless for us
rm -f $INSTALL/usr/bin/pyCecClient rm -f $INSTALL/usr/bin/pyCecClient

View File

@ -20,33 +20,21 @@ else
fi fi
makeinstall_target() { makeinstall_target() {
# Install vendor header files # Install vendor header files except proprietary GL headers
mkdir -p ${SYSROOT_PREFIX}/usr/include mkdir -p ${SYSROOT_PREFIX}/usr/include
if [ "${OPENGLES}" = "bcm2835-driver" ]; then for f in $(cd ${PKG_FLOAT}/opt/vc/include; ls | grep -v "GL"); do
cp -PRv ${PKG_FLOAT}/opt/vc/include/* ${SYSROOT_PREFIX}/usr/include cp -PRv ${PKG_FLOAT}/opt/vc/include/$f ${SYSROOT_PREFIX}/usr/include
else done
for f in $(cd ${PKG_FLOAT}/opt/vc/include; ls | grep -v "GL"); do
cp -PRv ${PKG_FLOAT}/opt/vc/include/$f ${SYSROOT_PREFIX}/usr/include
done
fi
# Install EGL, OpenGL ES, Open VG, etc. vendor libs & pkgconfigs # Install vendor libs & pkgconfigs except proprietary GL libs
mkdir -p ${SYSROOT_PREFIX}/usr/lib mkdir -p ${SYSROOT_PREFIX}/usr/lib
if [ "${OPENGLES}" = "bcm2835-driver" ]; then for f in $(cd ${PKG_FLOAT}/opt/vc/lib; ls *.so *.a | grep -Ev "^lib(EGL|GL)"); do
cp -PRv ${PKG_FLOAT}/opt/vc/lib/*.so ${SYSROOT_PREFIX}/usr/lib cp -PRv ${PKG_FLOAT}/opt/vc/lib/$f ${SYSROOT_PREFIX}/usr/lib
ln -sf ${SYSROOT_PREFIX}/usr/lib/libbrcmEGL.so ${SYSROOT_PREFIX}/usr/lib/libEGL.so done
ln -sf ${SYSROOT_PREFIX}/usr/lib/libbrcmGLESv2.so ${SYSROOT_PREFIX}/usr/lib/libGLESv2.so mkdir -p ${SYSROOT_PREFIX}/usr/lib/pkgconfig
cp -PRv ${PKG_FLOAT}/opt/vc/lib/*.a ${SYSROOT_PREFIX}/usr/lib for f in $(cd ${PKG_FLOAT}/opt/vc/lib/pkgconfig; ls | grep -v "gl"); do
cp -PRv ${PKG_FLOAT}/opt/vc/lib/pkgconfig ${SYSROOT_PREFIX}/usr/lib cp -PRv ${PKG_FLOAT}/opt/vc/lib/pkgconfig/$f ${SYSROOT_PREFIX}/usr/lib/pkgconfig
else
for f in $(cd ${PKG_FLOAT}/opt/vc/lib; ls *.so *.a | grep -Ev "^lib(EGL|GL)"); do
cp -PRv ${PKG_FLOAT}/opt/vc/lib/$f ${SYSROOT_PREFIX}/usr/lib
done done
mkdir -p ${SYSROOT_PREFIX}/usr/lib/pkgconfig
for f in $(cd ${PKG_FLOAT}/opt/vc/lib/pkgconfig; ls | grep -v "gl"); do
cp -PRv ${PKG_FLOAT}/opt/vc/lib/pkgconfig/$f ${SYSROOT_PREFIX}/usr/lib/pkgconfig
done
fi
# Update prefix in vendor pkgconfig files # Update prefix in vendor pkgconfig files
for PKG_CONFIGS in $(find "${SYSROOT_PREFIX}/usr/lib" -type f -name "*.pc" 2>/dev/null); do for PKG_CONFIGS in $(find "${SYSROOT_PREFIX}/usr/lib" -type f -name "*.pc" 2>/dev/null); do
@ -58,19 +46,11 @@ makeinstall_target() {
ln -sf ${SYSROOT_PREFIX}/usr/lib ${SYSROOT_PREFIX}/opt/vc/lib ln -sf ${SYSROOT_PREFIX}/usr/lib ${SYSROOT_PREFIX}/opt/vc/lib
ln -sf ${SYSROOT_PREFIX}/usr/include ${SYSROOT_PREFIX}/opt/vc/include ln -sf ${SYSROOT_PREFIX}/usr/include ${SYSROOT_PREFIX}/opt/vc/include
# Install EGL, OpenGL ES and other vendor libs # Install vendor libs except proprietary GL
mkdir -p ${INSTALL}/usr/lib mkdir -p ${INSTALL}/usr/lib
if [ "${OPENGLES}" = "bcm2835-driver" ]; then for f in $(cd ${PKG_FLOAT}/opt/vc/lib; ls *.so | grep -Ev "^lib(EGL|GL)"); do
cp -PRv ${PKG_FLOAT}/opt/vc/lib/*.so ${INSTALL}/usr/lib cp -PRv ${PKG_FLOAT}/opt/vc/lib/$f ${INSTALL}/usr/lib
ln -sf /usr/lib/libbrcmEGL.so ${INSTALL}/usr/lib/libEGL.so done
ln -sf /usr/lib/libbrcmEGL.so ${INSTALL}/usr/lib/libEGL.so.1
ln -sf /usr/lib/libbrcmGLESv2.so ${INSTALL}/usr/lib/libGLESv2.so
ln -sf /usr/lib/libbrcmGLESv2.so ${INSTALL}/usr/lib/libGLESv2.so.2
else
for f in $(cd ${PKG_FLOAT}/opt/vc/lib; ls *.so | grep -Ev "^lib(EGL|GL)"); do
cp -PRv ${PKG_FLOAT}/opt/vc/lib/$f ${INSTALL}/usr/lib
done
fi
# Install useful tools # Install useful tools
mkdir -p ${INSTALL}/usr/bin mkdir -p ${INSTALL}/usr/bin
@ -88,9 +68,3 @@ makeinstall_target() {
ln -sf /usr/lib ${INSTALL}/opt/vc/lib ln -sf /usr/lib ${INSTALL}/opt/vc/lib
} }
post_install() {
# unbind Framebuffer console
if [ "${OPENGLES}" = "bcm2835-driver" ]; then
enable_service unbind-console.service
fi
}

View File

@ -26,10 +26,6 @@ case $KODI_VENDOR in
;; ;;
esac esac
if [ "$KODIPLAYER_DRIVER" = bcm2835-driver -a "$KODI_VENDOR" = "default" ]; then
PKG_PATCH_DIRS+=" rpi-hevc"
fi
configure_package() { configure_package() {
# Single threaded LTO is very slow so rely on Kodi for parallel LTO support # Single threaded LTO is very slow so rely on Kodi for parallel LTO support
if [ "$LTO_SUPPORT" = "yes" ] && ! build_with_debug; then if [ "$LTO_SUPPORT" = "yes" ] && ! build_with_debug; then
@ -197,9 +193,7 @@ configure_package() {
if [ ! "$KODIPLAYER_DRIVER" = default ]; then if [ ! "$KODIPLAYER_DRIVER" = default ]; then
PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $KODIPLAYER_DRIVER libinput libxkbcommon" PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $KODIPLAYER_DRIVER libinput libxkbcommon"
if [ "$KODIPLAYER_DRIVER" = bcm2835-driver ]; then if [ "$OPENGLES_SUPPORT" = yes -a "$KODIPLAYER_DRIVER" = "$OPENGLES" ]; then
KODI_PLAYER="-DCORE_PLATFORM_NAME=rbpi"
elif [ "$OPENGLES_SUPPORT" = yes -a "$KODIPLAYER_DRIVER" = "$OPENGLES" ]; then
KODI_PLAYER="-DCORE_PLATFORM_NAME=gbm -DGBM_RENDER_SYSTEM=gles" KODI_PLAYER="-DCORE_PLATFORM_NAME=gbm -DGBM_RENDER_SYSTEM=gles"
CFLAGS="$CFLAGS -DEGL_NO_X11" CFLAGS="$CFLAGS -DEGL_NO_X11"
CXXFLAGS="$CXXFLAGS -DEGL_NO_X11" CXXFLAGS="$CXXFLAGS -DEGL_NO_X11"

View File

@ -1,49 +0,0 @@
From 372718db53f3397dc0e972985202416fffe15ff4 Mon Sep 17 00:00:00 2001
From: popcornmix <popcornmix@gmail.com>
Date: Thu, 7 May 2015 15:35:43 +0100
Subject: [PATCH] rbp: Support zero copy interface with hevc acceleration
---
.../VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 9 +++++++++
xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp | 5 +++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
index 0af254029e..e1263012aa 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
@@ -366,6 +366,15 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
if (m_decoderState == STATE_NONE)
{
m_decoderState = STATE_HW_SINGLE;
+#ifdef TARGET_RASPBERRY_PI
+ int num_threads = CServiceBroker::GetCPUInfo()->GetCPUCount() * 3 / 2;
+ num_threads = std::max(1, std::min(num_threads, 16));
+ if (pCodec->id == AV_CODEC_ID_HEVC)
+ num_threads = 8;
+ m_pCodecContext->thread_count = num_threads;
+ m_pCodecContext->thread_safe_callbacks = 0;
+ CLog::Log(LOGDEBUG, "CDVDVideoCodecFFmpeg - open frame threaded with %d threads", num_threads);
+#endif
}
else
{
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp
index 28eff23f16..779a839690 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp
@@ -298,8 +298,9 @@ CDVDVideoCodec::VCReturn CDecoder::Decode(AVCodecContext* avctx, AVFrame* frame)
CGPUMEM *m_gmem = (CGPUMEM *)av_buffer_get_opaque(frame->buf[0]);
assert(m_gmem);
- // need to flush ARM cache so GPU can see it
- m_gmem->Flush();
+ // need to flush ARM cache so GPU can see it (HEVC will have already done this)
+ if (avctx->codec_id != AV_CODEC_ID_HEVC)
+ m_gmem->Flush();
m_renderBuffer = static_cast<CMMALYUVBuffer*>(m_gmem->m_opaque);
assert(m_renderBuffer && m_renderBuffer->mmal_buffer);
if (m_renderBuffer)
--
2.20.1

View File

@ -1,62 +0,0 @@
From 115a3328123c060b9e4d5f35c3774aa17c73276a Mon Sep 17 00:00:00 2001
From: popcornmix <popcornmix@gmail.com>
Date: Mon, 26 Jun 2017 20:17:09 +0100
Subject: [PATCH] MMAL: Add hevc support by allowing 4 planes
---
xbmc/cores/VideoPlayer/Buffers/VideoBuffer.h | 2 +-
xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp | 3 +++
.../VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp | 3 +++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/xbmc/cores/VideoPlayer/Buffers/VideoBuffer.h b/xbmc/cores/VideoPlayer/Buffers/VideoBuffer.h
index 1c1ba21c48..86a71bb558 100644
--- a/xbmc/cores/VideoPlayer/Buffers/VideoBuffer.h
+++ b/xbmc/cores/VideoPlayer/Buffers/VideoBuffer.h
@@ -23,7 +23,7 @@ extern "C" {
struct YuvImage
{
- static const int MAX_PLANES = 3;
+ static const int MAX_PLANES = 4;
uint8_t* plane[MAX_PLANES];
int planesize[MAX_PLANES];
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp
index 779a839690..a1a1ab1795 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp
@@ -77,6 +77,8 @@ void CMMALYUVBuffer::GetStrides(int(&strides)[YuvImage::MAX_PLANES])
strides[0] = geo.getStrideY();
strides[1] = geo.getStrideC();
strides[2] = geo.getStrideC();
+ if (geo.getStripes() > 1)
+ strides[3] = geo.getHeightY() + geo.getHeightC(); // abuse: strides[3] = stripe stride
}
void CMMALYUVBuffer::SetDimensions(int width, int height, const int (&strides)[YuvImage::MAX_PLANES], const int (&planeOffsets)[YuvImage::MAX_PLANES])
@@ -284,6 +286,7 @@ CDVDVideoCodec::VCReturn CDecoder::Decode(AVCodecContext* avctx, AVFrame* frame)
if (frame)
{
if ((frame->format != AV_PIX_FMT_YUV420P && frame->format != AV_PIX_FMT_YUV420P10 && frame->format != AV_PIX_FMT_YUV420P12 && frame->format != AV_PIX_FMT_YUV420P14 && frame->format != AV_PIX_FMT_YUV420P16 &&
+ frame->format != AV_PIX_FMT_SAND128 && frame->format != AV_PIX_FMT_SAND64_10 && frame->format != AV_PIX_FMT_SAND64_16 &&
frame->format != AV_PIX_FMT_BGR0 && frame->format != AV_PIX_FMT_RGB565LE) ||
frame->buf[1] != nullptr || frame->buf[0] == nullptr)
{
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp
index 9b23ddb7fa..e55babf4d3 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp
@@ -192,6 +192,9 @@ std::vector<CMMALPool::MMALEncodingTable> CMMALPool::mmal_encoding_table =
{ AV_PIX_FMT_YUV420P12,MMAL_ENCODING_I420_16, },
{ AV_PIX_FMT_YUV420P14,MMAL_ENCODING_I420_16, },
{ AV_PIX_FMT_YUV420P16,MMAL_ENCODING_I420_16, },
+ { AV_PIX_FMT_SAND128, MMAL_ENCODING_YUVUV128 },
+ { AV_PIX_FMT_SAND64_10,MMAL_ENCODING_YUVUV64_16 },
+ { AV_PIX_FMT_SAND64_16,MMAL_ENCODING_YUVUV64_16 },
{ AV_PIX_FMT_RGBA, MMAL_ENCODING_RGBA, },
{ AV_PIX_FMT_BGRA, MMAL_ENCODING_BGRA },
{ AV_PIX_FMT_RGB0, MMAL_ENCODING_RGBA },
--
2.20.1

View File

@ -9,13 +9,8 @@
# Memory (System/GPU configuration ) # Memory (System/GPU configuration )
################################################################################ ################################################################################
# Default GPU memory split (do not change if you do not know what you are doing) # Default GPU memory split
gpu_mem=128 gpu_mem=76
# Configure GPU memory based on SDRAM size - overrides above setting
gpu_mem_256=112
gpu_mem_512=160
gpu_mem_1024=256
################################################################################ ################################################################################
# For overclocking and various other settings, see: # For overclocking and various other settings, see:
@ -24,15 +19,6 @@
# Set 'force_turbo=1' to disable dynamic overclocking and enable overclocking always. # Set 'force_turbo=1' to disable dynamic overclocking and enable overclocking always.
force_turbo=0 force_turbo=0
# Make display smaller to stop text spilling off the screen
#
# Note that the overscan settings only affect the splash screen and not Kodi.
#
# If you experience overscan/underscan issues the best solution is to adjust
# your TV settings ("full pixel", "1-1 pixel" etc.). Alternatively, there is a
# calibration menu in the Kodi GUI.
# disable_overscan=1
# Force HDMI even if unplugged or powered off # Force HDMI even if unplugged or powered off
# hdmi_force_hotplug=1 # hdmi_force_hotplug=1
@ -41,14 +27,6 @@ force_turbo=0
# rebooting. # rebooting.
hdmi_ignore_cec_init=1 hdmi_ignore_cec_init=1
################################################################################
# License keys to enable GPU hardware decoding for various codecs
# to obtain keys visit the shop at http://www.raspberrypi.com
################################################################################
# decode_MPG2=0x00000000
# decode_WVC1=0x00000000
################################################################################ ################################################################################
# End of default configuration # End of default configuration
################################################################################ ################################################################################

View File

@ -2,3 +2,5 @@
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) # Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
# WARNING: DO NOT EDIT THIS FILE - IT WILL BE OVERWRITTEN WHEN UPGRADING! # WARNING: DO NOT EDIT THIS FILE - IT WILL BE OVERWRITTEN WHEN UPGRADING!
dtoverlay=vc4-kms-v3d
disable_overscan=1

View File

@ -1,38 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
################################################################################
# Bootloader configuration - config.txt
################################################################################
################################################################################
# Memory (System/GPU configuration )
################################################################################
# Default GPU memory split
gpu_mem=76
################################################################################
# For overclocking and various other settings, see:
# https://www.raspberrypi.org/documentation/configuration/config-txt.md
################################################################################
# Set 'force_turbo=1' to disable dynamic overclocking and enable overclocking always.
force_turbo=0
# Force HDMI even if unplugged or powered off
# hdmi_force_hotplug=1
# Doesn't sent initial active source message.
# Avoids bringing CEC (enabled TV) out of standby and channel switch when
# rebooting.
hdmi_ignore_cec_init=1
################################################################################
# End of default configuration
################################################################################
################################################################################
# Include distribution specific config file if it exists.
################################################################################
[all]
include distroconfig.txt

View File

@ -10,8 +10,3 @@
# additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware)
FIRMWARE="${FIRMWARE} rpi-eeprom" FIRMWARE="${FIRMWARE} rpi-eeprom"
OPENGLES="mesa"
GRAPHIC_DRIVERS="vc4"
KODIPLAYER_DRIVER="mesa"
KODI_VENDOR="default"

View File

@ -74,7 +74,7 @@
OPENGL="no" OPENGL="no"
# OpenGL-ES implementation to use (no / bcm2835-driver / mesa) # OpenGL-ES implementation to use (no / bcm2835-driver / mesa)
OPENGLES="bcm2835-driver" OPENGLES="mesa"
# Displayserver to use (x11 / no) # Displayserver to use (x11 / no)
DISPLAYSERVER="no" DISPLAYSERVER="no"
@ -85,13 +85,13 @@
# Xorg Graphic drivers to use (all / vc4 / none) # Xorg Graphic drivers to use (all / vc4 / none)
# Space separated list is supported, # Space separated list is supported,
# e.g. GRAPHIC_DRIVERS="vc4" # e.g. GRAPHIC_DRIVERS="vc4"
GRAPHIC_DRIVERS="" GRAPHIC_DRIVERS="vc4"
# Use a vendor specific KODI repo # Use a vendor specific KODI repo
KODI_VENDOR="default" KODI_VENDOR="default"
# KODI Player implementation to use (default / bcm2835-driver / mesa) # KODI Player implementation to use (default / bcm2835-driver / mesa)
KODIPLAYER_DRIVER="bcm2835-driver" KODIPLAYER_DRIVER="mesa"
# use the kernel CEC framework for libcec (yes / no) # use the kernel CEC framework for libcec (yes / no)
CEC_FRAMEWORK_SUPPORT="yes" CEC_FRAMEWORK_SUPPORT="yes"