diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/wayland-protocols/0001-linux-dmabuf-Add-support-for-YUV-Full-color-range.patch b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/wayland-protocols/0001-linux-dmabuf-Add-support-for-YUV-Full-color-range.patch new file mode 100644 index 000000000..e89a2bad2 --- /dev/null +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/wayland-protocols/0001-linux-dmabuf-Add-support-for-YUV-Full-color-range.patch @@ -0,0 +1,43 @@ +From cae18dad41f11683aa8c99d6e884b3d59a6e6739 Mon Sep 17 00:00:00 2001 +From: Mickael Reulier +Date: Wed, 22 Mar 2017 13:52:49 +0100 +Subject: [PATCH] linux-dmabuf: Add support for YUV Full color range + +Add new flag yuv_full_color_range to dmabuf protocol for +YUV components color range. +If set, components are in full color range. +If not set, components are in limited color range. + +Change-Id: Id4589f050d83d00298a834c444b01a13365ae6f2 +Signed-off-by: Mickael Reulier +--- + unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml b/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml +index 3b4861f..9f3df6e 100644 +--- a/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml ++++ b/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml +@@ -185,6 +185,8 @@ + + + ++ + + + +@@ -210,6 +212,10 @@ + 'bottom_first' is specified. It is undefined whether 'bottom_first' + is ignored if 'interlaced' is not set. + ++ Flag 'yuv_full_color_range' specifies YUV components color range. ++ If set, components are in full color range. ++ If not set, components are in limited color range. ++ + This protocol does not convey any information about field rate, + duration, or timing, other than the relative ordering between the + two fields in one buffer. A compositor may have to estimate the +-- +1.9.1 + diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/wayland-protocols_1.25.bbappend b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/wayland-protocols_1.25.bbappend new file mode 100644 index 000000000..1e02e8ed0 --- /dev/null +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/wayland-protocols_1.25.bbappend @@ -0,0 +1,4 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +SRC_URI += "file://0001-linux-dmabuf-Add-support-for-YUV-Full-color-range.patch" + diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init.bbappend b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init.bbappend new file mode 100644 index 000000000..62e42a610 --- /dev/null +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init.bbappend @@ -0,0 +1,99 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +DEPENDS += "${@oe.utils.conditional('DISTRO_FEATURES', 'pulseaudio', 'pulseaudio', '', d)}" + +SRC_URI += " \ + file://weston.ini \ + file://digi_background.png \ + file://weston-launch.service \ + file://weston-checkgpu.service \ + file://weston_profile.sh \ + file://README-CHECK-GPU \ + file://72-galcore.rules \ + file://73-pulseaudio-hdmi.rules \ + file://default_pulseaudio_profile \ + file://pulseaudio_hdmi_switch.sh \ + " +SRC_URI:append:stm32mpcommon = " file://check-gpu " + +FILES:${PN} += " ${datadir}/weston \ + ${sysconfdir}/etc/default \ + ${systemd_system_unitdir}/weston-launch.service \ + ${sbindir}/ \ + ${sysconfdir}/etc/default \ + ${sysconfdir}/etc/profile.d \ + ${sysconfdir}/xdg/weston/weston.ini \ + /home/root \ + " + +CONFFILES:${PN} += "${sysconfdir}/xdg/weston/weston.ini" + +do_install:append() { + install -d ${D}${sysconfdir}/xdg/weston/ + install -d ${D}${datadir}/weston/backgrounds + + install -m 0644 ${WORKDIR}/weston.ini ${D}${sysconfdir}/xdg/weston + + install -m 0644 ${WORKDIR}/digi_background.png ${D}${datadir}/weston/backgrounds/digi_background.png + + install -d ${D}${systemd_system_unitdir} ${D}${sbindir} + + install -d ${D}/lib/systemd/system/ + if [ -e ${D}/lib/systemd/system/weston.service ]; then + rm ${D}/lib/systemd/system/weston.service ${D}/lib/systemd/system/weston.socket + install -D -p -m0644 ${WORKDIR}/weston-launch.service ${D}${systemd_system_unitdir}/weston-launch.service + sed -i -e s:/etc:${sysconfdir}:g \ + -e s:/usr/bin:${bindir}:g \ + -e s:/var:${localstatedir}:g \ + ${D}${systemd_unitdir}/system/weston-launch.service + install -d ${D}${sysconfdir}/systemd/system/multi-user.target.wants/ + #ln -s /lib/systemd/system/weston-launch.service ${D}${sysconfdir}/systemd/system/multi-user.target.wants/display-manager.service + install -D -p -m0644 ${WORKDIR}/weston-checkgpu.service ${D}${systemd_system_unitdir}/ + fi + + install -d ${D}${sysconfdir}/profile.d + install -m 0755 ${WORKDIR}/weston_profile.sh ${D}${sysconfdir}/profile.d/ + + if ${@bb.utils.contains('DISTRO_FEATURES','xwayland','true','false',d)}; then + # uncomment modules line for support of xwayland + sed -i -e 's,#xwayland=true,xwayland=true,g' ${D}${sysconfdir}/xdg/weston/weston.ini + fi + sed -i 's,@DATADIR@,${datadir},g' ${D}${bindir}/weston-start + # /etc/default/weston + install -d ${D}${sysconfdir}/default + echo "WESTON_USER=weston" > ${D}${sysconfdir}/default/weston + + # check GPU + install -d ${D}/home/root/ + install -m 644 ${WORKDIR}/README-CHECK-GPU ${D}/home/root/ + if ! test -f ${D}${base_sbindir}/check-gpu; then + install -d ${D}${base_sbindir} + echo '#!/bin/sh' > ${WORKDIR}/check-gpu.empty + echo '/bin/true' >> ${WORKDIR}/check-gpu.empty + install -m 755 ${WORKDIR}/check-gpu.empty ${D}${base_sbindir}/check-gpu + fi + + # udev rules for galcore + install -D -p -m0644 ${WORKDIR}/72-galcore.rules ${D}${sysconfdir}/udev/rules.d/72-galcore.rules + + # AUDIO: swith between analog stero and HDMI + install -d ${D}${sysconfdir}/default + install -m 0644 ${WORKDIR}/default_pulseaudio_profile ${D}${sysconfdir}/default/pulseaudio_profile + install -d ${D}${sysconfdir}/udev/rules.d + install -p -m 0644 ${WORKDIR}/73-pulseaudio-hdmi.rules ${D}${sysconfdir}/udev/rules.d/73-pulseaudio-hdmi.rules + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/pulseaudio_hdmi_switch.sh ${D}${bindir}/ +} + +do_install:append:stm32mpcommon() { + if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then + install -d ${D}${base_sbindir} + install -m 755 ${WORKDIR}/check-gpu ${D}${base_sbindir} + fi +} + +SYSTEMD_SERVICE:${PN}:remove = "weston.service weston.socket" +SYSTEMD_SERVICE:${PN} += "weston-launch.service weston-checkgpu.service" +#inherit useradd +USERADD_PARAM:${PN} = "--home /home/weston --shell /bin/sh --user-group -G video,input,tty,audio,weston-launch,dialout weston" +GROUPADD_PARAM:${PN} = "-r weston-launch; -r wayland" diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/72-galcore.rules b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/72-galcore.rules new file mode 100644 index 000000000..9422958b9 --- /dev/null +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/72-galcore.rules @@ -0,0 +1,2 @@ +SUBSYSTEMS=="graphics_class", KERNEL=="galcore", GROUP="video", MODE="0666" + diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/73-pulseaudio-hdmi.rules b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/73-pulseaudio-hdmi.rules new file mode 100644 index 000000000..c1b256d7b --- /dev/null +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/73-pulseaudio-hdmi.rules @@ -0,0 +1 @@ +SUBSYSTEMS=="drm", ACTION=="change", RUN+="/usr/bin/pulseaudio_hdmi_switch.sh diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/README-CHECK-GPU b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/README-CHECK-GPU new file mode 100644 index 000000000..3306a4fea --- /dev/null +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/README-CHECK-GPU @@ -0,0 +1,9 @@ +Check GPU +========= + +GPU can be deactivated by fuse or not present in some SOC + +So in case the GPU is not present, you must configure weston on pix-man by creating this file : +/etc/default/weston with this content : + +OPTARGS=--use-pixman diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/check-gpu b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/check-gpu new file mode 100755 index 000000000..08fe5b840 --- /dev/null +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/check-gpu @@ -0,0 +1,115 @@ +#!/bin/sh - +#=============================================================================== +# +# FILE: system-generator-check-gpu +# +# DESCRIPTION: The goal are to detect if the gpu are present/loaded or not +# ORGANIZATION: STMicroelectronics +# COPYRIGHT: Copyright (C) 2018, STMicroelectronics - All Rights Reserved +#=============================================================================== + +check_dt_status() { + gcnano_dir=$(ls /proc/device-tree/soc/ | grep gpu) + if [ -z "$gcnano_dir" ] || [ ! -d /proc/device-tree/soc/$gcnano_dir ]; + then + echo "Gcnano in /proc/device-tree/soc/ is not available" > /dev/kmsg + force_no_dtb_gpu="1" + else + if [ ! -f /proc/device-tree/soc/$gcnano_dir/status ]; then + gcnano_status="okay" + else + if $(grep -q "okay" /proc/device-tree/soc/$gcnano_dir/status); then + gcnano_status="okay" + fi + fi + fi +} + +check_load_module() { + local _timeout=0 + if [ -n "$(cat /proc/modules | grep etnaviv)" ]; then + galcore_module=$(cat /proc/modules | grep ^etnaviv) + return + fi + while [ -z "$(cat /proc/modules | grep galcore)" ]; do + sleep 1 + _timeout=$(($_timeout+1)) + if [ "$_timeout" -eq "10" ]; then + echo "Time out check load galcore module expired" > /dev/kmsg + break + fi + done + galcore_module=$(cat /proc/modules | grep galcore) +} + +check_devices() { + local _timeout=0 + if [ -n "$(cat /proc/modules | grep etnaviv)" ]; then + galcore_device=$(cat /proc/modules | grep ^etnaviv) + return + fi + while [ -z "$(ls -l /dev/ | grep galcore)" ]; do + sleep 1 + _timeout=$(($_timeout+1)) + if [ "$_timeout" -eq "10" ]; then + echo "Time out check galcore device expired" > /dev/kmsg + break + fi + done + galcore_device=$(ls -l /dev/ | grep galcore) +} + +check_default_weston_config() { + if [ "$force_no_dtb_gpu" = "1" ]; + then + if [ -e /etc/default/weston ] && $(grep -q "Autogenerated" /etc/default/weston); + then + default_weston_status="Autogenerated" + fi + fi +} +# +# Main +# +gcnano_status="disabled" +galcore_module="" +galcore_device="" +default_weston_status="" +force_no_dtb_gpu=0 + +check_dt_status +check_default_weston_config +if [ "$default_weston_status" = "Autogenerated" ]; +then + echo "Weston already configured" + exit 0 +fi + +check_load_module +check_devices + +if [ "$gcnano_status" = "okay" ] && [ -n "$galcore_module" ] && [ -n "$galcore_device" ]; +then + #echo "Gcnano is present and activated" > /dev/kmsg + if [ -f /etc/default/weston ] && $(grep -q "Autogenerated" /etc/default/weston) ; + then + sed -i "s/OPTARGS=--use-pixman/#OPTARGS=--use-pixman/g" /etc/default/weston + sed -i "/#Autogenerated/d" /etc/default/weston + fi +else + if [ -f /etc/default/weston ] && $(grep -q "Autogenerated" /etc/default/weston) ; + then + echo "Weston already configured on pixman" > /dev/kmsg + else + echo "Configure weston on pixman" > /dev/kmsg + echo "#Autogenerated" > /etc/default/weston + echo "OPTARGS=--use-pixman" >> /etc/default/weston + echo "WESTON_USER=weston" >> /etc/default/weston + fi +fi + +dri_device=$(ls -l /dev/ | grep dri) +if [ -z "$dri_device" ]; +then + exit 1 +fi diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/default_pulseaudio_profile b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/default_pulseaudio_profile new file mode 100644 index 000000000..f0f06fab6 --- /dev/null +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/default_pulseaudio_profile @@ -0,0 +1,3 @@ +DEFAULT_PULSE_AUDIO_LOCAL_PROFILE=output:analog-stereo +DEFAULT_PULSE_AUDIO_HDMI_PROFILE=output:hdmi-stereo + diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/digi_background.png b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/digi_background.png new file mode 100644 index 000000000..2963c6a1f Binary files /dev/null and b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/digi_background.png differ diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/pulseaudio_hdmi_switch.sh b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/pulseaudio_hdmi_switch.sh new file mode 100644 index 000000000..d867153f7 --- /dev/null +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/pulseaudio_hdmi_switch.sh @@ -0,0 +1,39 @@ +#!/bin/sh - +source /etc/default/pulseaudio_profile +PROFILE_LOCAL=$DEFAULT_PULSE_AUDIO_LOCAL_PROFILE +PROFILE_HDMI=$DEFAULT_PULSE_AUDIO_HDMI_PROFILE +HDMI_STATUS=$(cat /sys/class/drm/card0/*HDMI*/status) + +if [ "$HDMI_STATUS" = "connected" ]; then + PROFILE=$PROFILE_HDMI +else + PROFILE=$PROFILE_LOCAL +fi +cat > /tmp/pulse_temp_switch.sh < /tmp/splash_fifo + #kill -9 $PSPLASH_PID + echo "done." + fi + + ;; + *) + ;; +esac + + +#log file managment on weston CMD line +CMD_LINE_WESTON="" +if [ -z $LOG_FILE ]; +then + CMD_LINE_WESTON=" " +else + if [ -f $LOG_FILE ]; then + rm $LOG_FILE + fi + CMD_LINE_WESTON="--log=$LOG_FILE" +fi +if [ -z "$ST_WESTON_IDLE_TIME" ]; +then + ST_WESTON_IDLE_TIME=648000 +fi +#compositor managment on CMD line +if [ -z $USE_PIXMAN ]; +then + echo ""; +else + CMD_LINE_WESTON="$CMD_LINE_WESTON --use-pixman" +fi + +#Addons paramaters +if [ -n $ST_WESTON_ADDONS ]; +then + CMD_LINE_WESTON="$CMD_LINE_WESTON $ST_WESTON_ADDONS" +fi + +# See how we were called. +case "$1" in + start) + if [ ! -z $LOG_FILE ]; + then + echo "[SERVICE] start.........." >> $LOG_FILE + fi + echo "Starting Weston" + if [ -n "$DEBUG_OPENGL_VIA_OPENVT" ]; + then + echo "[DEBUG] use script /tmp/launch_basic_weston.sh" + echo "[DEBUG] output saved on file $DEBUG_OPENGL_VIA_OPENVT" + #generate a wrapper script to launch weston +cat > /tmp/launch_basic_weston.sh << EOF +/usr/bin/weston $CMD_LINE_WESTON 2>&1 > $DEBUG_OPENGL_VIA_OPENVT +EOF + chmod +x /tmp/launch_basic_weston.sh + openvt -s -w -- /tmp/launch_basic_weston.sh + else + echo "/usr/bin/weston $CMD_LINE_WESTON" + openvt -s -w -- /usr/bin/weston $CMD_LINE_WESTON +# weston --tty=1 $CMD_LINE_WESTON + fi + ;; + + stop) + echo "Stopping Weston" + if [ ! -z $LOG_FILE ]; + then + echo "[SERVICE] stop.........." >> $LOG_FILE + fi + pid_weston=`pidof weston` + kill -9 $pid_weston + ;; + + status) + if pidof weston >/dev/null + then + echo "Weston: running" + echo "CMDLINE of weston:" + echo " /usr/bin/weston $CMD_LINE_WESTON" + else + echo "Weston: not running" + exit 3 + fi + exit 0 + ;; + + restart) + $0 stop + sleep 1 + $0 start + ;; + + *) + echo "Usage: weston.sh {start|stop|status|restart}" + exit 1 + ;; +esac + +exit 0 + diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/weston_profile.sh b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/weston_profile.sh new file mode 100644 index 000000000..2d12244ee --- /dev/null +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/weston_profile.sh @@ -0,0 +1,16 @@ +if [ "$USER" == "weston" ]; then + export XDG_RUNTIME_DIR=/run/user/`id -u weston` + + export ELM_ENGINE=wayland_shm + export ECORE_EVAS_ENGINE=wayland_shm + export ECORE_EVAS_ENGINE=wayland_shm + export GDK_BACKEND=wayland + export PULSE_RUNTIME_PATH=/run/user/`id -u weston` + if [ -e $XDG_RUNTIME_DIR/wayland-0 ]; then + export WAYLAND_DISPLAY=wayland-0 + else + if [ -e $XDG_RUNTIME_DIR/wayland-1 ]; then + export WAYLAND_DISPLAY=wayland-1 + fi + fi +fi diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston/0001-Allow-to-get-hdmi-output-with-several-outputs.patch b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston/0001-Allow-to-get-hdmi-output-with-several-outputs.patch new file mode 100644 index 000000000..49893aa3e --- /dev/null +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston/0001-Allow-to-get-hdmi-output-with-several-outputs.patch @@ -0,0 +1,40 @@ +From c2489e20f7803159444150ff03bd78fbf9b1bae4 Mon Sep 17 00:00:00 2001 +From: Christophe Priouzeau +Date: Thu, 19 Mar 2020 12:15:19 +0100 +Subject: [PATCH 1/4] Allow to get hdmi output with several outputs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If an ouput fail to be attach or enable then this output must be only +destroyed and an error doesn't be re which detach & destroy +all other output. + +Signed-off-by: Yannick Fertré +--- + compositor/main.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/compositor/main.c b/compositor/main.c +index 322f2ff..055eed3 100644 +--- a/compositor/main.c ++++ b/compositor/main.c +@@ -2246,8 +2246,14 @@ drm_process_layoutput(struct wet_compositor *wet, struct wet_layoutput *lo) + return -1; + + if (drm_try_attach_enable(output->output, lo) < 0) { ++ /* ++ * if a wet_ouput fail to be attach or enable ++ * then this output must be destroyed ++ * but don't return an error which dettatch & destroy ++ * all other output. ++ */ + wet_output_destroy(output); +- return -1; ++ //return -1; + } + } + +-- +2.25.1 + diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston/0001-Remove-useless-code-from-new-Fragment-Shader.patch b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston/0001-Remove-useless-code-from-new-Fragment-Shader.patch new file mode 100644 index 000000000..6bdbf3f40 --- /dev/null +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston/0001-Remove-useless-code-from-new-Fragment-Shader.patch @@ -0,0 +1,178 @@ +From 7f9365919153c9ba17bfeb48049df2ee5a77b047 Mon Sep 17 00:00:00 2001 +From: Pierre-Yves MORDRET +Date: Mon, 23 May 2022 14:27:13 +0200 +Subject: [PATCH] Remove useless code from new Fragment Shader + +Generic Weston 10.0 consumes more GPU than before (8.0). +The compilation doesn't get rid from unreachable code. +Since not used and not optimized during compilation +state, we simply remove the code. + +Change-Id: I37880d5fcb8487c77e084b289db8d2fb945c21ab +Signed-off-by: Pierre-Yves MORDRET +--- + libweston/renderer-gl/fragment.glsl | 93 ++--------------------------- + libweston/renderer-gl/gl-shaders.c | 5 -- + 2 files changed, 5 insertions(+), 93 deletions(-) + +diff --git a/libweston/renderer-gl/fragment.glsl b/libweston/renderer-gl/fragment.glsl +index 63a20cd6..f735ab3a 100644 +--- a/libweston/renderer-gl/fragment.glsl ++++ b/libweston/renderer-gl/fragment.glsl +@@ -42,30 +42,17 @@ + #define SHADER_VARIANT_SOLID 7 + #define SHADER_VARIANT_EXTERNAL 8 + +-/* enum gl_shader_color_curve */ +-#define SHADER_COLOR_CURVE_IDENTITY 0 +-#define SHADER_COLOR_CURVE_LUT_3x1D 1 +- + #if DEF_VARIANT == SHADER_VARIANT_EXTERNAL + #extension GL_OES_EGL_image_external : require + #endif + +-#ifdef GL_FRAGMENT_PRECISION_HIGH +-#define HIGHPRECISION highp +-#else +-#define HIGHPRECISION mediump +-#endif +- +-precision HIGHPRECISION float; ++precision mediump float; + + /* + * These undeclared identifiers will be #defined by a runtime generated code + * snippet. + */ + compile_const int c_variant = DEF_VARIANT; +-compile_const bool c_input_is_premult = DEF_INPUT_IS_PREMULT; +-compile_const bool c_green_tint = DEF_GREEN_TINT; +-compile_const int c_color_pre_curve = DEF_COLOR_PRE_CURVE; + + vec4 + yuva2rgba(vec4 yuva) +@@ -91,6 +78,7 @@ yuva2rgba(vec4 yuva) + color_out.g = Y - 0.39176229 * su - 0.81296764 * sv; + color_out.b = Y + 2.01723214 * su; + ++ color_out.rgb *= yuva.w; + color_out.a = yuva.w; + + return color_out; +@@ -107,8 +95,6 @@ uniform sampler2D tex1; + uniform sampler2D tex2; + uniform float alpha; + uniform vec4 unicolor; +-uniform HIGHPRECISION sampler2D color_pre_curve_lut_2d; +-uniform HIGHPRECISION vec2 color_pre_curve_lut_scale_offset; + + vec4 + sample_input_texture() +@@ -154,85 +140,16 @@ sample_input_texture() + return yuva2rgba(yuva); + } + +-/* +- * Texture coordinates go from 0.0 to 1.0 corresponding to texture edges. +- * When we do LUT look-ups with linear filtering, the correct range to sample +- * from is not from edge to edge, but center of first texel to center of last +- * texel. This follows because with LUTs, you have the exact end points given, +- * you never extrapolate but only interpolate. +- * The scale and offset are precomputed to achieve this mapping. +- */ +-float +-lut_texcoord(float x, vec2 scale_offset) +-{ +- return x * scale_offset.s + scale_offset.t; +-} +- +-/* +- * Sample a 1D LUT which is a single row of a 2D texture. The 2D texture has +- * four rows so that the centers of texels have precise y-coordinates. +- */ +-float +-sample_color_pre_curve_lut_2d(float x, compile_const int row) +-{ +- float tx = lut_texcoord(x, color_pre_curve_lut_scale_offset); +- +- return texture2D(color_pre_curve_lut_2d, +- vec2(tx, (float(row) + 0.5) / 4.0)).x; +-} +- +-vec3 +-color_pre_curve(vec3 color) +-{ +- vec3 ret; +- +- if (c_color_pre_curve == SHADER_COLOR_CURVE_IDENTITY) { +- return color; +- } else if (c_color_pre_curve == SHADER_COLOR_CURVE_LUT_3x1D) { +- ret.r = sample_color_pre_curve_lut_2d(color.r, 0); +- ret.g = sample_color_pre_curve_lut_2d(color.g, 1); +- ret.b = sample_color_pre_curve_lut_2d(color.b, 2); +- return ret; +- } else { +- /* Never reached, bad c_color_pre_curve. */ +- return vec3(1.0, 0.3, 1.0); +- } +-} +- +-vec4 +-color_pipeline(vec4 color) +-{ +- /* View alpha (opacity) */ +- color.a *= alpha; +- +- color.rgb = color_pre_curve(color.rgb); +- +- return color; +-} +- + void + main() + { + vec4 color; + +- /* Electrical (non-linear) RGBA values, may be premult or not */ ++ /* Electrical (non-linear) RGBA values, pre-multiplied */ + color = sample_input_texture(); + +- /* Ensure straight alpha */ +- if (c_input_is_premult) { +- if (color.a == 0.0) +- color.rgb = vec3(0, 0, 0); +- else +- color.rgb *= 1.0 / color.a; +- } +- +- color = color_pipeline(color); +- +- /* pre-multiply for blending */ +- color.rgb *= color.a; +- +- if (c_green_tint) +- color = vec4(0.0, 0.3, 0.0, 0.2) + color * 0.8; ++ /* View alpha (opacity) */ ++ color *= alpha; + + gl_FragColor = color; + } +diff --git a/libweston/renderer-gl/gl-shaders.c b/libweston/renderer-gl/gl-shaders.c +index 97f288c0..c8e3d297 100644 +--- a/libweston/renderer-gl/gl-shaders.c ++++ b/libweston/renderer-gl/gl-shaders.c +@@ -263,11 +263,6 @@ gl_shader_create(struct gl_renderer *gr, + shader->alpha_uniform = glGetUniformLocation(shader->program, "alpha"); + shader->color_uniform = glGetUniformLocation(shader->program, + "unicolor"); +- shader->color_pre_curve_lut_2d_uniform = +- glGetUniformLocation(shader->program, "color_pre_curve_lut_2d"); +- shader->color_pre_curve_lut_scale_offset_uniform = +- glGetUniformLocation(shader->program, "color_pre_curve_lut_scale_offset"); +- + free(conf); + + wl_list_insert(&gr->shader_list, &shader->link); +-- +2.17.1 + diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston/0002-Force-to-close-all-output.patch b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston/0002-Force-to-close-all-output.patch new file mode 100644 index 000000000..9b06b6058 --- /dev/null +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston/0002-Force-to-close-all-output.patch @@ -0,0 +1,36 @@ +From 5d96505846d911c942a42f74c2a6f816f5c940b5 Mon Sep 17 00:00:00 2001 +From: Christophe Priouzeau +Date: Thu, 19 Mar 2020 12:20:32 +0100 +Subject: [PATCH 2/4] Force to close all output +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In case of plug/unplug HMDI, it's necessary to close all output enabled. +Without this patch, weston is stuck on DSI output. + +Signed-off-by: Yannick Fertré +--- + compositor/main.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/compositor/main.c b/compositor/main.c +index 055eed3..ac366a0 100644 +--- a/compositor/main.c ++++ b/compositor/main.c +@@ -2322,7 +2322,11 @@ drm_heads_changed(struct wl_listener *listener, void *arg) + + if ((connected || forced) && !enabled) { + drm_head_prepare_enable(wet, head); +- } else if (!(connected || forced) && enabled) { ++ } else if (enabled) { ++ /* ++ * closed all output (connected or not connected) ++ * this is neccessary to switch between HDMI <> DSI ++ */ + drm_head_disable(head); + } else if (enabled && changed) { + weston_log("Detected a monitor change on head '%s', " +-- +2.25.1 + diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston/0003-Disable-gles3.patch b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston/0003-Disable-gles3.patch new file mode 100644 index 000000000..7951235ee --- /dev/null +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston/0003-Disable-gles3.patch @@ -0,0 +1,49 @@ +From 00384d5c39473f95868b1173aee81b763794de54 Mon Sep 17 00:00:00 2001 +From: Christophe Priouzeau +Date: Tue, 26 Apr 2022 09:59:10 +0200 +Subject: [PATCH 3/4] Disable gles3 + +Signed-off-by: Christophe Priouzeau +--- + libweston/renderer-gl/gl-renderer.c | 6 ++++++ + .../renderer-gl/gl-shader-config-color-transformation.c | 5 +++++ + 2 files changed, 11 insertions(+) + +diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c +index a5f5eae..2f7941f 100644 +--- a/libweston/renderer-gl/gl-renderer.c ++++ b/libweston/renderer-gl/gl-renderer.c +@@ -29,7 +29,13 @@ + + #include + #include ++#if 0 + #include ++#else ++#define GL_RGBA16F 0x881A ++#define GL_RGB10_A2 0x8059 ++#define GL_HALF_FLOAT 0x140B ++#endif + + #include + #include +diff --git a/libweston/renderer-gl/gl-shader-config-color-transformation.c b/libweston/renderer-gl/gl-shader-config-color-transformation.c +index 21a4565..d5f2491 100644 +--- a/libweston/renderer-gl/gl-shader-config-color-transformation.c ++++ b/libweston/renderer-gl/gl-shader-config-color-transformation.c +@@ -25,7 +25,12 @@ + + #include "config.h" + ++#if 0 + #include ++#else ++#include ++#define GL_R32F 0x822E ++#endif + #include + + #include +-- +2.25.1 + diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston/0004-Revert-gl-renderer-Add-EGL_IMAGE_PRESERVED_KHR-to-ou.patch b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston/0004-Revert-gl-renderer-Add-EGL_IMAGE_PRESERVED_KHR-to-ou.patch new file mode 100644 index 000000000..cb9fe5513 --- /dev/null +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston/0004-Revert-gl-renderer-Add-EGL_IMAGE_PRESERVED_KHR-to-ou.patch @@ -0,0 +1,56 @@ +From 45a8c37e9dbff9207d58846df048406bf54ce30b Mon Sep 17 00:00:00 2001 +From: Christophe Priouzeau +Date: Fri, 6 May 2022 11:41:10 +0200 +Subject: [PATCH 4/4] Revert gl-renderer: Add EGL_IMAGE_PRESERVED_KHR to our + attributes + +Signed-off-by: Christophe Priouzeau +--- + libweston/renderer-gl/gl-renderer.c | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c +index 2f7941f..2ab707c 100644 +--- a/libweston/renderer-gl/gl-renderer.c ++++ b/libweston/renderer-gl/gl-renderer.c +@@ -2152,7 +2152,7 @@ gl_renderer_attach_egl(struct weston_surface *es, struct weston_buffer *buffer, + struct weston_compositor *ec = es->compositor; + struct gl_renderer *gr = get_renderer(ec); + struct gl_surface_state *gs = get_surface_state(es); +- EGLint attribs[5]; ++ EGLint attribs[3]; + GLenum target; + int i, num_planes; + +@@ -2205,9 +2205,7 @@ gl_renderer_attach_egl(struct weston_surface *es, struct weston_buffer *buffer, + for (i = 0; i < num_planes; i++) { + attribs[0] = EGL_WAYLAND_PLANE_WL; + attribs[1] = i; +- attribs[2] = EGL_IMAGE_PRESERVED_KHR; +- attribs[3] = EGL_TRUE; +- attribs[4] = EGL_NONE; ++ attribs[2] = EGL_NONE; + + gs->images[i] = egl_image_create(gr, + EGL_WAYLAND_BUFFER_WL, +@@ -2242,7 +2240,7 @@ import_simple_dmabuf(struct gl_renderer *gr, + struct dmabuf_attributes *attributes) + { + struct egl_image *image; +- EGLint attribs[52]; ++ EGLint attribs[50]; + int atti = 0; + bool has_modifier; + +@@ -2260,8 +2258,6 @@ import_simple_dmabuf(struct gl_renderer *gr, + attribs[atti++] = attributes->height; + attribs[atti++] = EGL_LINUX_DRM_FOURCC_EXT; + attribs[atti++] = attributes->format; +- attribs[atti++] = EGL_IMAGE_PRESERVED_KHR; +- attribs[atti++] = EGL_TRUE; + + if (attributes->modifier[0] != DRM_FORMAT_MOD_INVALID) { + if (!gr->has_dmabuf_import_modifiers) +-- +2.25.1 + diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston_10.0.0.bbappend b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston_10.0.0.bbappend new file mode 100644 index 000000000..d48d6c9dd --- /dev/null +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston_10.0.0.bbappend @@ -0,0 +1,23 @@ +FILESEXTRAPATHS:prepend:stm32mpcommon := "${THISDIR}/${PN}:" + +SRC_URI:append:stm32mpcommon = " \ + file://0001-Allow-to-get-hdmi-output-with-several-outputs.patch \ + file://0002-Force-to-close-all-output.patch \ + file://0003-Disable-gles3.patch \ + file://0004-Revert-gl-renderer-Add-EGL_IMAGE_PRESERVED_KHR-to-ou.patch \ + file://0001-Remove-useless-code-from-new-Fragment-Shader.patch \ + " +SIMPLECLIENTS="egl,touch,dmabuf-v4l,dmabuf-egl" + +PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'kms wayland egl clients', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xwayland', '', d)} \ + ${@bb.utils.filter('DISTRO_FEATURES', 'systemd x11', d)} \ + ${@bb.utils.contains_any('DISTRO_FEATURES', 'wayland x11', '', 'headless', d)} \ + ${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'sysvinit', 'launcher-libseat', '', d)} \ + image-jpeg \ + screenshare \ + shell-desktop \ + shell-fullscreen \ + launch" + +EXTRA_OEMESON += "-Ddeprecated-wl-shell=true"