first commit

This commit is contained in:
Your Name
2026-02-07 20:22:48 +08:00
commit 1b9711d5e4
2270 changed files with 805872 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
Section "Device"
Identifier "Rockchip Graphics"
Driver "modesetting"
### Use Rockchip RGA 2D HW accel
# Option "AccelMethod" "exa"
### Use GPU HW accel
Option "AccelMethod" "glamor"
Option "DRI" "2"
### Set to "always" to avoid tearing, could lead to up 50% performance loss
Option "FlipFB" "always"
### Limit flip rate and drop frames for "FlipFB" to reduce performance lost
Option "MaxFlipRate" "25"
Option "NoEDID" "true"
EndSection
Section "Screen"
Identifier "Default Screen"
Device "Rockchip Graphics"
Monitor "Default Monitor"
EndSection
### Valid values for rotation are "normal", "left", "right"
Section "Monitor"
Identifier "Default Monitor"
Option "Rotate" "normal"
EndSection

View File

@@ -0,0 +1,23 @@
Section "Device"
Identifier "Rockchip Graphics"
## Use armsoc driver
# Driver "armsoc"
## End armsoc configuration
## Use modesetting and glamor
Driver "modesetting"
Option "AccelMethod" "glamor" ### "glamor" to enable 3D acceleration, "none" to disable.
Option "DRI" "2"
Option "Dri2Vsync" "true"
## End glamor configuration
EndSection
Section "Screen"
Identifier "Default Screen"
SubSection "Display"
Depth 24
# Modes "1920x1080" "1280x1024" "1024x768" "800x600"
EndSubSection
EndSection

View File

@@ -0,0 +1,2 @@
# Set "performance" GPU devfreq governor, "simple_ondemand" works bad in recent kernels
devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu/governor = performance

View File

@@ -0,0 +1,2 @@
KERNEL=="mali*", MODE="0660", GROUP="video"

View File

@@ -0,0 +1,3 @@
KERNEL=="vpu_service", MODE="0660", GROUP="video"
KERNEL=="rkvdec", MODE="0660", GROUP="video"
KERNEL=="rga", MODE="0660", GROUP="video"

Binary file not shown.

141
external/packages/bsp/rk3399/mpv.conf vendored Normal file
View File

@@ -0,0 +1,141 @@
#
# mpv configuration file
#
# Warning:
#
# The commented example options usually do _not_ set the default values. Call
# mpv with --list-options to see the default values for most options. There is
# no builtin or example mpv.conf with all the defaults.
#
#
# Configuration files are read system-wide from /usr/local/etc/mpv.conf
# and per-user from ~/.config/mpv/mpv.conf, where per-user settings override
# system-wide settings, all of which are overridden by the command line.
#
# Configuration file settings and the command line options use the same
# underlying mechanisms. Most options can be put into the configuration file
# by dropping the preceding '--'. See the man page for a complete list of
# options.
#
# Lines starting with '#' are comments and are ignored.
#
# See the CONFIGURATION FILES section in the man page
# for a detailed description of the syntax.
#
# Profiles should be placed at the bottom of the configuration file to ensure
# that settings wanted as defaults are not restricted to specific profiles.
##################
# video settings #
##################
# Start in fullscreen mode by default.
#fs=yes
# force starting with centered window
#geometry=50%:50%
# don't allow a new window to have a size larger than 90% of the screen size
#autofit-larger=90%x90%
# Do not close the window on exit.
#keep-open=yes
# Do not wait with showing the video window until it has loaded. (This will
# resize the window once video is loaded. Also always shows a window with
# audio.)
#force-window=immediate
# Disable the On Screen Controller (OSC).
#osc=no
# Keep the player window on top of all other windows.
#ontop=yes
# Specify high quality video rendering preset (for --vo=gpu only)
# Can cause performance problems with some drivers and GPUs.
#profile=gpu-hq
# Force video to lock on the display's refresh rate, and change video and audio
# speed to some degree to ensure synchronous playback - can cause problems
# with some drivers and desktop environments.
#video-sync=display-resample
# Enable hardware decoding if available. Often, this does not work with all
# video outputs, but should work well with default settings on most systems.
# If performance or energy usage is an issue, forcing the vdpau or vaapi VOs
# may or may not help.
hwdec=rkmpp
# Specify default video output.
vo=xv
##################
# audio settings #
##################
# Specify default audio device. You can list devices with: --audio-device=help
# The option takes the device string (the stuff between the '...').
#audio-device=alsa/default
# Do not filter audio to keep pitch when changing playback speed.
#audio-pitch-correction=no
# Output 5.1 audio natively, and upmix/downmix audio with a different format.
#audio-channels=5.1
# Disable any automatic remix, _if_ the audio output accepts the audio format.
# of the currently played file. See caveats mentioned in the manpage.
# (The default is "auto-safe", see manpage.)
#audio-channels=auto
##################
# other settings #
##################
# Pretend to be a web browser. Might fix playback with some streaming sites,
# but also will break with shoutcast streams.
#user-agent="Mozilla/5.0"
# cache settings
#
# Use 150MB input cache by default. The cache is enabled for network streams only.
#cache-default=153600
#
# Use 150MB input cache for everything, even local files.
#cache=153600
#
# Disable the behavior that the player will pause if the cache goes below a
# certain fill size.
#cache-pause=no
#
# Read ahead about 5 seconds of audio and video packets.
#demuxer-readahead-secs=5.0
#
# Raise readahead from demuxer-readahead-secs to this value if a cache is active.
#cache-secs=50.0
# Display English subtitles if available.
#slang=en
# Play Finnish audio if available, fall back to English otherwise.
#alang=fi,en
# Change subtitle encoding. For Arabic subtitles use 'cp1256'.
# If the file seems to be valid UTF-8, prefer UTF-8.
# (You can add '+' in front of the codepage to force it.)
#sub-codepage=cp1256
# You can also include other configuration files.
#include=/path/to/the/file/you/want/to/include
############
# Profiles #
############
# The options declared as part of profiles override global default settings,
# but only take effect when the profile is active.
# The following profile can be enabled on the command line with: --profile=eye-cancer
#[eye-cancer]
#sharpen=5

View File

@@ -0,0 +1,15 @@
[Unit]
Description=Bluetooth OrangePi
After=bluetooth.target
[Service]
Type=simple
ExecStartPre=/usr/sbin/rfkill unblock all
ExecStart=/usr/bin/brcm_patchram_plus_rk3399 -d --enable_hci --no2bytes --use_baudrate_for_download --tosleep 200000 --baudrate 1500000 --patchram /lib/firmware/brcm/BCM4345C5.hcd /dev/ttyS0
TimeoutSec=0
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target

0
external/packages/bsp/rk3399/scripts/io vendored Executable file
View File

View File

@@ -0,0 +1,74 @@
#!/bin/bash
preview_mode="width=640,height=480,framerate=30/1"
vsnk="autovideosink"
export DISPLAY=:0.0
#----------------------------------------------------------
# selfpath
declare -a PreviewDevs=()
# mainpath
declare -a PictureDevs=()
# camera type
declare -a CameraTypes=()
# isp1
if [ -d /sys/class/video4linux/v4l-subdev2/device/video4linux/video1 -o \
-d /sys/class/video4linux/v4l-subdev5/device/video4linux/video1 ]; then
PreviewDevs+=("/dev/video1")
PictureDevs+=("/dev/video0")
CameraTypes+=("mipi")
fi
# isp2
if [ -d /sys/class/video4linux/v4l-subdev2/device/video4linux/video6 -o \
-d /sys/class/video4linux/v4l-subdev5/device/video4linux/video6 ]; then
PreviewDevs+=("/dev/video6")
PictureDevs+=("/dev/video5")
CameraTypes+=("mipi")
fi
# usb camera
if [ -f /sys/class/video4linux/video10/name ]; then
if [ "$( grep -i "UVC" /sys/class/video4linux/video8/name )" ]; then
PreviewDevs+=("/dev/video10")
PictureDevs+=("/dev/video10")
CameraTypes+=("usb")
fi
fi
killall gst-launch-1.0 2>&1 > /dev/null
sleep 1
for icam in 0 1
do
[ -c "${PreviewDevs[$icam]}" ] || break
echo "Start MIPI CSI Camera Preview ${PreviewDevs[$icam]} ..."
rkargs="device=${PreviewDevs[$icam]}"
if [ ${CameraTypes[$icam]} = "mipi" ]; then
CMD="gst-launch-1.0 rkisp ${rkargs} io-mode=1 \
! video/x-raw,format=NV12,${preview_mode} \
! ${vsnk}"
else
CMD="gst-launch-1.0 v4l2src ${rkargs} io-mode=4 \
! videoconvert ! video/x-raw,format=NV12,${preview_mode} \
! ${vsnk}"
fi
echo "===================================================="
echo "=== GStreamer 1.1 command:"
echo "=== $(echo $CMD | sed -e 's/\r//g')"
echo "===================================================="
if [ $vsnk = "kmssink" -o "$(id -un)" = "pi" ]; then
eval "${CMD}"&
else
su orangepi -c "${CMD}"&
fi
sleep 2
done

View File

@@ -0,0 +1,240 @@
#!/bin/bash
export DISPLAY=:0.0
#su orangepi -c "gst-launch-1.0 -vvv rkisp device=${DEV} io-mode=1 analyzer=1 enable-3a=1 path-iqf=/etc/cam_iq.xml \
# ! video/x-raw,format=NV12,width=1280,height=720, framerate=30/1 ! videoconvert ! autovideosink"
icam=0
vsnk=
action="preview"
output=
verbose="yes"
#----------------------------------------------------------
usage()
{
echo "Usage: $0 [ARGS]"
echo
echo "Options:"
echo -e " -h, --help\n\tshow this help message and exit"
echo -e " -i, --index <0|1>\n\tcamera index, 0 or 1"
echo -e " -a, --action <preview|photo|video>\n\tpreview, take photo or record video"
echo -e " -o, --output <filename>\n\toutput file name"
echo -e " -v, --verbose\n\tshow full command"
exit 1
}
parse_args()
{
TEMP=`getopt -o "i:a:o:v:h" --long "index:,action:,output:,verbose:,help" -n "$SELF" -- "$@"`
if [ $? != 0 ] ; then exit 1; fi
eval set -- "$TEMP"
while true; do
case "$1" in
-i|--index ) icam=$2; shift 2;;
-a|--action) action=$2; shift 2;;
-o|--output) output=$2; shift 2;;
-v|--verbose) verbose=$2; shift 2;;
-h|--help ) usage; exit 1 ;;
-- ) shift; break ;;
* ) echo "invalid option $1"; usage; return 1 ;;
esac
done
if [ -z "$output" ]; then
if [ $action = "photo" ]; then
output="Image_MIPI.jpg"
elif [ $action = "video" ]; then
output="Video_MIPI.ts"
fi
fi
}
isp_default_vsnk="autovideosink"
usbcamera_default_vsnk="autovideosink"
#----------------------------------------------------------
SELF=$0
parse_args $@
# selfpath
declare -a PreviewDevs=()
# mainpath
declare -a PictureDevs=()
# camera type
declare -a CameraTypes=()
# sink
declare -a Sinks=()
# preivew format
declare -a PreviewModes=()
# photo format
declare -a PictureModes=()
# video recoard format
declare -a VideoModes=()
# isp1
if [ -d /sys/class/video4linux/v4l-subdev2/device/video4linux/video1 -o \
-d /sys/class/video4linux/v4l-subdev5/device/video4linux/video1 ]; then
PreviewDevs+=("/dev/video1")
PictureDevs+=("/dev/video0")
CameraTypes+=("mipi")
# use did not specify sink
if [ -z "${vsnk}" ]; then
Sinks+=(${isp_default_vsnk})
else
Sinks+=(${vsnk})
fi
PreviewModes+=("width=1280,height=720,framerate=30/1")
PictureModes+=("width=1920,height=1080,framerate=10/1")
VideoModes+=("width=1280,height=720,framerate=30/1")
fi
# isp2
if [ -d /sys/class/video4linux/v4l-subdev2/device/video4linux/video6 -o \
-d /sys/class/video4linux/v4l-subdev5/device/video4linux/video6 ]; then
PreviewDevs+=("/dev/video6")
PictureDevs+=("/dev/video5")
CameraTypes+=("mipi")
# use did not specify sink
if [ -z "${vsnk}" ]; then
Sinks+=(${isp_default_vsnk})
else
Sinks+=(${vsnk})
fi
PreviewModes+=("width=1280,height=720,framerate=30/1")
PictureModes+=("width=1920,height=1080,framerate=10/1")
VideoModes+=("width=1280,height=720,framerate=30/1")
fi
# usb camera
if [ -f /sys/class/video4linux/video10/name ]; then
if [ "$( grep -i "UVC" /sys/class/video4linux/video10/name )" ]; then
PreviewDevs+=("/dev/video10")
PictureDevs+=("/dev/video10")
CameraTypes+=("usb")
fi
# use did not specify sink
if [ -z "${vsnk}" ]; then
Sinks+=(${usbcamera_default_vsnk})
else
Sinks+=(${vsnk})
fi
PreviewModes+=("width=640,height=480,framerate=30/1")
PictureModes+=("width=640,height=480,framerate=30/1")
VideoModes+=("width=640,height=480,framerate=30/1")
fi
rkargs="device=${PreviewDevs[$icam]}"
rkargs_mainpath="device=${PictureDevs[$icam]}"
#----------------------------------------------------------
killall gst-launch-1.0 2>&1 > /dev/null
sleep 1
function start_preview() {
local CMD=
if [ ${CameraTypes[$icam]} = "mipi" ]; then
CMD="gst-launch-1.0 rkisp ${rkargs} io-mode=1 \
! video/x-raw,format=NV12,${PreviewModes[$icam]} \
! videoconvert ! ${Sinks[$icam]}"
else
CMD="gst-launch-1.0 v4l2src ${rkargs} io-mode=4 \
! videoconvert ! video/x-raw,format=NV12,${PreviewModes[$icam]} \
! ${Sinks[$icam]}"
fi
if [ "x${verbose}" == "xyes" ]; then
echo "===================================================="
echo "=== GStreamer 1.1 command:"
echo "=== $(echo $CMD | sed -e 's/\r//g')"
echo "===================================================="
fi
if [ ${Sinks[$icam]} = "kmssink" -o "$(id -un)" = "orangepi" ]; then
eval "${CMD}"&
else
su orangepi -c "${CMD}"&
fi
sleep 2
}
function take_photo() {
local CMD=
if [ ${CameraTypes[$icam]} = "mipi" ]; then
CMD="gst-launch-1.0 rkisp num-buffers=20 ${rkargs_mainpath} io-mode=1 \
! video/x-raw,format=NV12,${PictureModes[$icam]} \
! jpegenc ! multifilesink location=\"/tmp/isp-frame%d.jpg\""
else
# usb camera only support io-mode=4
CMD="gst-launch-1.0 v4l2src num-buffers=1 ${rkargs_mainpath} io-mode=4 \
! videoconvert ! video/x-raw,format=NV12,${PictureModes[$icam]} \
! jpegenc ! filesink location=\"/tmp/usb-frame.jpg\""
fi
if [ "x${verbose}" == "xyes" ]; then
echo "===================================================="
echo "=== GStreamer 1.1 command:"
echo "=== $(echo $CMD | sed -e 's/\r//g')"
echo "===================================================="
fi
echo "{{{{{{ start take photo"
if [ ${Sinks[$icam]} = "kmssink" -o "$(id -un)" = "orangepi" ]; then
eval "${CMD}"
else
su orangepi -c "${CMD}"
fi
echo "}}}}}} end take photo"
if [ ${CameraTypes[$icam]} = "mipi" ]; then
if [ -f /tmp/isp-frame19.jpg ]; then
cp /tmp/isp-frame19.jpg ${output}
fi
else
if [ -f /tmp/usb-frame.jpg ]; then
cp /tmp/usb-frame.jpg ${output}
fi
fi
}
function start_video_recording() {
local CMD=
if [ ${CameraTypes[$icam]} = "mipi" ]; then
CMD="gst-launch-1.0 rkisp num-buffers=512 ${rkargs_mainpath} io-mode=1 \
! video/x-raw,format=NV12,${VideoModes[$icam]} \
! mpph264enc ! queue ! h264parse ! mpegtsmux \
! filesink location=/tmp/camera-record.ts"
else
# usb camera only support io-mode=4
CMD="gst-launch-1.0 v4l2src num-buffers=512 ${rkargs_mainpath} io-mode=4 \
! videoconvert ! video/x-raw,format=NV12,${VideoModes[$icam]} \
! mpph264enc ! queue ! h264parse ! mpegtsmux \
! filesink location=/tmp/camera-record.ts"
fi
if [ "x${verbose}" == "xyes" ]; then
echo "===================================================="
echo "=== GStreamer 1.1 command:"
echo "=== $(echo $CMD | sed -e 's/\r//g')"
echo "===================================================="
fi
echo "{{{{{{ start video recording"
if [ ${Sinks[$icam]} = "kmssink" -o "$(id -un)" = "orangepi" ]; then
eval "${CMD}"
else
su orangepi -c "${CMD}"
fi
if [ -f /tmp/camera-record.ts ]; then
cp /tmp/camera-record.ts ${output}
fi
echo "}}}}}} end video recording"
}
if [ "x$action" == "xphoto" ]; then
take_photo
elif [ "x$action" == "xvideo" ]; then
start_video_recording
else
start_preview
fi

24
external/packages/bsp/rk3399/xorg.conf vendored Executable file
View File

@@ -0,0 +1,24 @@
Section "Device"
Identifier "Rockchip Graphics"
## Use armsoc driver
# Driver "armsoc"
## End armsoc configuration
## Use modesetting and glamor
Driver "modesetting"
Option "AccelMethod" "glamor" ### "glamor" to enable 3D acceleration, "none" to disable.
Option "DRI" "2"
Option "Dri2Vsync" "true"
Option "TripleBuffer" "True"
## End glamor configuration
EndSection
Section "Screen"
Identifier "Default Screen"
SubSectionSub "Display"
Depth 24
Modes "1920x1080" "1280x1024" "1024x768" "800x600"
EndSubSection
EndSection