[vlc-commits] [Git][videolan/vlc][master] 5 commits: qt: add kwindowsystem_module and win32windoweffects_module

2024-05-09 Thread Jean-Baptiste Kempf (@jbk)


Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
e6a1738d by Fatih Uzunoglu at 2024-05-09T16:05:51+00:00
qt: add kwindowsystem_module and win32windoweffects_module

- - - - -
10134a41 by Fatih Uzunoglu at 2024-05-09T16:05:51+00:00
qt: add setBlurBehind() to CompositorVideo

- - - - -
9fca2c36 by Fatih Uzunoglu at 2024-05-09T16:05:51+00:00
qt: use `CompositorVideo::setBlurBehind()` in compositor_dcomp

- - - - -
041b8f04 by Fatih Uzunoglu at 2024-05-09T16:05:51+00:00
qt: enable acrylic blur for KWin in compositor_wayland

- - - - -
7b98948b by Fatih Uzunoglu at 2024-05-09T16:05:51+00:00
qt: use KWindowSystem to enable blur in CompositorX11

- - - - -


16 changed files:

- configure.ac
- modules/gui/qt/Makefile.am
- modules/gui/qt/maininterface/compositor.cpp
- modules/gui/qt/maininterface/compositor.hpp
- modules/gui/qt/maininterface/compositor_dcomp.cpp
- modules/gui/qt/maininterface/compositor_dcomp.hpp
- modules/gui/qt/maininterface/compositor_wayland.cpp
- modules/gui/qt/maininterface/compositor_x11.cpp
- modules/gui/qt/maininterface/compositor_x11_renderwindow.cpp
- modules/gui/qt/maininterface/compositor_x11_renderwindow.hpp
- + modules/gui/qt/maininterface/kwindowsystem_module.cpp
- + modules/gui/qt/maininterface/win32windoweffects_module.cpp
- + modules/gui/qt/maininterface/win32windoweffects_module.hpp
- + modules/gui/qt/maininterface/windoweffects_module.hpp
- modules/gui/qt/meson.build
- modules/gui/qt/qt.cpp


Changes:

=
configure.ac
=
@@ -3944,6 +3944,16 @@ dnl
 
 EXTEND_HELP_STRING([Interface plugins:])
 
+dnl
+dnl  KF6WindowSystem
+dnl
+PKG_CHECK_MODULES([KF6WINDOWSYSTEM], [KF6WindowSystem >= 6.0.0], [
+  have_kf6windowsystem="yes"
+], [
+  have_kf6windowsystem="no"
+])
+AM_CONDITIONAL([HAVE_KF6WINDOWSYSTEM], [test "${have_kf6windowsystem}" = 
"yes"])
+
 dnl
 dnl QT
 dnl


=
modules/gui/qt/Makefile.am
=
@@ -188,6 +188,7 @@ libqt_plugin_la_SOURCES = \
maininterface/videosurface.hpp \
maininterface/video_window_handler.cpp \
maininterface/video_window_handler.hpp \
+   maininterface/windoweffects_module.hpp \
medialibrary/medialib.cpp \
medialibrary/medialib.hpp \
medialibrary/mlalbum.cpp \
@@ -528,7 +529,9 @@ libqt_plugin_la_SOURCES += \
maininterface/mainctx_win32.hpp \
maininterface/compositor_win7.cpp \
maininterface/compositor_win7.hpp \
-   style/windowsthemeprovider.cpp
+   style/windowsthemeprovider.cpp \
+   maininterface/win32windoweffects_module.cpp \
+   maininterface/win32windoweffects_module.hpp
 
 nodist_libqt_plugin_la_SOURCES += maininterface/mainctx_win32.moc.cpp \
maininterface/compositor_win7.moc.cpp
@@ -614,6 +617,22 @@ endif
 endif
 endif
 
+if !HAVE_WIN32
+if HAVE_KF6WINDOWSYSTEM
+
+libqt_plugin_la_CPPFLAGS += -DQT_HAS_KWINDOWSYSTEM_PLUGIN
+
+libqt_kwindowsystem_plugin_la_CXXFLAGS = $(AM_CXXFLAGS) 
$(KF6WINDOWSYSTEM_CFLAGS)
+libqt_kwindowsystem_plugin_la_LIBADD =  $(KF6WINDOWSYSTEM_LIBS)
+libqt_kwindowsystem_plugin_la_SOURCES = \
+   maininterface/kwindowsystem_module.cpp
+
+if ENABLE_QT
+gui_LTLIBRARIES += libqt_kwindowsystem_plugin.la
+endif
+endif
+endif
+
 # User interface compilation
 
 uic_verbose = $(uic_verbose_$(V))


=
modules/gui/qt/maininterface/compositor.cpp
=
@@ -40,7 +40,11 @@
 #  include "compositor_x11.hpp"
 #endif
 
+#include "maininterface/windoweffects_module.hpp"
+
 #include 
+#include 
+
 
 using namespace vlc;
 
@@ -184,7 +188,12 @@ CompositorVideo::CompositorVideo(qt_intf_t *p_intf, 
QObject* parent)
 
 CompositorVideo::~CompositorVideo()
 {
-
+if (m_windowEffectsModule)
+{
+if (m_windowEffectsModule->p_module)
+module_unneed(m_windowEffectsModule, 
m_windowEffectsModule->p_module);
+vlc_object_delete(m_windowEffectsModule);
+}
 }
 
 void CompositorVideo::commonSetupVoutWindow(vlc_window_t* p_wnd, VoutDestroyCb 
destroyCb)
@@ -250,6 +259,7 @@ void CompositorVideo::commonWindowDisable()
 bool CompositorVideo::commonGUICreateImpl(QWindow* window, 
CompositorVideo::Flags flags)
 {
 assert(m_mainCtx);
+assert(window);
 
 m_videoSurfaceProvider = std::make_unique();
 m_mainCtx->setVideoSurfaceProvider(m_videoSurfaceProvider.get());
@@ -261,6 +271,10 @@ bool CompositorVideo::commonGUICreateImpl(QWindow* window, 
CompositorVideo::Flag
 connect(m_videoSurfaceProvider.get(), 
&VideoSurfaceProvider::surfaceSizeChanged,
 this, &CompositorVideo::onSurfaceSizeChanged);
 }
+if (flags & CompositorVideo::HAS_ACRYLIC)
+{
+setBlurBehind(window, true);
+}
 m_videoWindowHandler = std::make_unique(m_intf);
 m_videoWindowHandler->setWindow( window );
 
@@ -269,7 +283,7 @@ bool CompositorVideo::commonGUICreateImpl(QWin

[vlc-commits] [Git][videolan/vlc][master] service_discovery: Add winvolumes module

2024-05-09 Thread Jean-Baptiste Kempf (@jbk)


Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
f9d948ca by Prince Gupta at 2024-05-09T12:27:00+00:00
service_discovery: Add winvolumes module

implement SD_CAT_MYCOMPUTER based service discovery
module on Windows

allows to query volumes mounted on host computer
Ref #28597

- - - - -


3 changed files:

- modules/services_discovery/Makefile.am
- modules/services_discovery/meson.build
- + modules/services_discovery/winvolumes.c


Changes:

=
modules/services_discovery/Makefile.am
=
@@ -71,6 +71,11 @@ if HAVE_WIN32_DESKTOP
 sd_LTLIBRARIES += libwindrive_plugin.la
 endif
 
+libwinvolumes_plugin_la_SOURCES = services_discovery/winvolumes.c
+if HAVE_WIN32_DESKTOP
+sd_LTLIBRARIES += libwinvolumes_plugin.la
+endif
+
 libos2drive_plugin_la_SOURCES = services_discovery/os2drive.c
 if HAVE_OS2
 sd_LTLIBRARIES += libos2drive_plugin.la


=
modules/services_discovery/meson.build
=
@@ -89,6 +89,11 @@ if host_system == 'windows'
 'name' : 'windrive',
 'sources' : files('windrive.c')
 }
+
+vlc_modules += {
+'name' : 'winvolumes',
+'sources' : files('winvolumes.c')
+}
 endif
 
 # mDNS using libmicrodns


=
modules/services_discovery/winvolumes.c
=
@@ -0,0 +1,385 @@
+/*
+ * Copyright © 2010 Rémi Denis-Courmont
+ * Copyright © 2024 Prince Gupta 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+# include 
+#endif
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+
+// max drives allowed because of letter assignment (A-Z)
+#define MAX_DRIVES 26
+
+// name and window title used for observer window
+static const char WindowClassName[] = "VLCWinVolumesDeviceObserver";
+
+typedef struct volumes_observer_t
+{
+// observer thread
+vlc_thread_t thread;
+
+// signal to end the observer thread
+HANDLE quit_signal;
+
+input_item_t *items[MAX_DRIVES];
+} volumes_observer_t;
+
+
+/**
+ * @brief CreateInput
+ * @param letter - drive letter assosited with drive
+ * @return input item for the drive
+ */
+static input_item_t *CreateInput( const char letter )
+{
+char mrl[12] = "file:///A:/", name[MAX_PATH] = {0};
+char path[4] = "A:\\";
+
+path[0] = letter;
+mrl[8] = letter;
+
+// ignore the error, this information is not important
+GetVolumeInformationA(path, name, sizeof(name),
+  NULL, NULL, NULL, NULL, 0);
+
+if (GetDriveTypeA (path) == DRIVE_CDROM)
+return input_item_NewDisc( mrl, name, INPUT_DURATION_INDEFINITE );
+else
+return input_item_NewDirectory( mrl, name, ITEM_LOCAL );
+}
+
+
+/**
+ * @brief RegisterWindowClass registers window class for window creation
+ * @param class_name
+ * @param proc - window procedure associated with window class
+ * @return ATOM (unique identifier) for the class on success otherwise 0
+ */
+static ATOM RegisterWindowClass( const char *class_name, WNDPROC proc )
+{
+WNDCLASSEXA wcex =
+{
+.cbSize = sizeof(WNDCLASSEXA),
+.lpfnWndProc = proc,
+.hInstance = (HINSTANCE)GetModuleHandle(NULL),
+.hbrBackground = (HBRUSH)(COLOR_WINDOW),
+.lpszClassName = class_name
+};
+
+return RegisterClassExA(&wcex);
+}
+
+
+/**
+ * @brief StartWindow creates a hidden window, can be used to listen on OS 
events
+ * @param class_name name and title for window
+ * @param ctx will be passed as lpParam, can be used with CREATESTRUCT (see 
CreateWindowA docs)
+ * @return HANDLE to the created window on success otherwise NULL
+ */
+static HWND StartWindow(const char *class_name, void *ctx)
+{
+HWND window = CreateWindowA(class_name, class_name, WS_ICONIC,
+0, 0, CW_USEDEFAULT, 0, NULL, NULL,
+(HINSTANCE)GetModuleHandle(NULL), ctx);
+
+if (window == NULL)
+return NULL;
+
+ShowWindow(window, SW_HIDE);
+return window;
+}
+
+

[vlc-commits] [Git][videolan/vlc][master] contrib: aom: Backport patches to improve the SVE detection

2024-05-09 Thread Jean-Baptiste Kempf (@jbk)


Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
42cb003f by Martin Storsjö at 2024-05-09T08:44:13+00:00
contrib: aom: Backport patches to improve the SVE detection

This backports
https://aomedia.googlesource.com/aom/+/5ccdc66ab6eb8eb300eda854fab4ff250b2c2f92
and
https://aomedia.googlesource.com/aom/+/fb21617c1f3ef49795597e006b68adfba6e54be0.

This makes libaom test compiling a more nontrivial function,
which according to AAPCS requires backing up and restoring SVE
registers.

On current versions of Clang when targeting Windows, compiling such
a function errors out. This added test makes libaom not try to
compile the SVE codepaths for this target.

See https://github.com/llvm/llvm-project/issues/80009 for reference
on toolchain support for SVE functions on Windows on aarch64.

- - - - -


3 changed files:

- + 
contrib/src/aom/0001-cpu.cmake-Do-more-elaborate-test-of-whether-SVE-can-.patch
- + contrib/src/aom/0002-cpu.cmake-Address-issues-in-SVE-feature-tests.patch
- contrib/src/aom/rules.mak


Changes:

=
contrib/src/aom/0001-cpu.cmake-Do-more-elaborate-test-of-whether-SVE-can-.patch
=
@@ -0,0 +1,51 @@
+From 17cb0f6be6807c73027cce0d941868b3e5ede54f Mon Sep 17 00:00:00 2001
+From: Martin Storsjo 
+Date: Wed, 1 May 2024 00:45:41 +0300
+Subject: [PATCH 1/2] cpu.cmake: Do more elaborate test of whether SVE can be
+ compiled
+
+For Windows targets, Clang will successfully compile simpler
+SVE functions, but if the function requires backing up and restoring
+SVE registers (as part of the AAPCS calling convention), Clang
+will fail to generate unwind data for this function, resulting
+in an error.
+
+This issue is tracked upstream in Clang in
+https://github.com/llvm/llvm-project/issues/80009.
+
+Check whether the compiler can compile such a function, and
+disable SVE if it is unable to handle that case.
+
+Change-Id: I307d7398cedd1942c39ef034431a51696264ff47
+(cherry picked from commit 5ccdc66ab6eb8eb300eda854fab4ff250b2c2f92)
+---
+ build/cmake/cpu.cmake | 12 +++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/build/cmake/cpu.cmake b/build/cmake/cpu.cmake
+index 489dbcbf44..e16e9ec6a5 100644
+--- a/build/cmake/cpu.cmake
 b/build/cmake/cpu.cmake
+@@ -56,8 +56,18 @@ if("${AOM_TARGET_CPU}" STREQUAL "arm64")
+ #endif
+ #include 
+ #include " HAVE_SVE_HEADERS)
++# Check whether the compiler can compile SVE functions that require
++# backup/restore of SVE registers according to AAPCS. Clang for Windows 
used
++# to fail this, see https://github.com/llvm/llvm-project/issues/80009.
++aom_check_source_compiles("arm_sve_preserve" "
++#include 
++void other(void);
++svfloat32_t func(svfloat32_t a) {
++  other();
++  return a;
++}" CAN_COMPILE_SVE)
+ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQURED_FLAGS})
+-if(HAVE_SVE_HEADERS EQUAL 0)
++if(HAVE_SVE_HEADERS EQUAL 0 OR CAN_COMPILE_SVE EQUAL 0)
+   set(ENABLE_SVE 0)
+   set(ENABLE_SVE2 0)
+ endif()
+-- 
+2.34.1
+


=
contrib/src/aom/0002-cpu.cmake-Address-issues-in-SVE-feature-tests.patch
=
@@ -0,0 +1,58 @@
+From b349f7613350aa8a15c06470dc63c5d6a4a1222f Mon Sep 17 00:00:00 2001
+From: George Steed 
+Date: Sat, 4 May 2024 13:20:42 +0100
+Subject: [PATCH 2/2] cpu.cmake: Address issues in SVE feature tests
+
+A test to check that SVE registers were correctly handled as function
+parameters was added in 5ccdc66ab6eb8eb300eda854fab4ff250b2c2f92,
+however this appears to have a couple of issues:
+
+* Semicolons need to be escaped, else the compiler fails to compile due
+  to invalid syntax. We can fix this by prefixing each semicolon with a
+  backslash.
+
+* The "other" function does not have a definition so the test program
+  will always fail to link even if it compiles to an object file. We can
+  work around this by instructing CMake to only try compiling up to a
+  static library rather than a full executable.
+
+Change-Id: Ic37280d4b42b9031e68bed8a4b24c0eb51491827
+(cherry picked from commit fb21617c1f3ef49795597e006b68adfba6e54be0)
+---
+ build/cmake/cpu.cmake | 9 ++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/build/cmake/cpu.cmake b/build/cmake/cpu.cmake
+index e16e9ec6a5..8d0acf3d2b 100644
+--- a/build/cmake/cpu.cmake
 b/build/cmake/cpu.cmake
+@@ -49,7 +49,9 @@ if("${AOM_TARGET_CPU}" STREQUAL "arm64")
+   # SVE and SVE2 require that the Neon-SVE bridge header is also available.
+   if(ENABLE_SVE OR ENABLE_SVE2)
+ set(OLD_CMAKE_REQURED_FLAGS ${CMAKE_REQUIRED_FLAGS})
++set(OLD_CMAKE_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE})
+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${AOM_SVE_FLAG}")
++set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+ aom_check_source_compiles("arm_neon_sve_bridge_available" "
+ #ifndef __ARM_NEON_SVE_BRIDGE
+ #error 1
+@@ -61,12 +63,13 @@ if