Skip to content

Commit d955e36

Browse files
Development/compositor enhancements (#924)
* Compositor: Mesa add preflight checks * Add westeros environment configuration for compositor * Add README for Wayland Compositor Library * Update IOutput.h documentation for clarity and consistency * Compositor: Fix memory leak in DRM node * Compositor: Enhance DRM handling with mode selection and adjustments * Compositor: Update SelectBestMode and ScanConnector to include requestedRefreshRate parameter * Compositor: Add refreshRate parameter to buffer creation functions and update related components * Compositor: Improve error handling in configuration parsing and add trace logging * Compositor: Add refresh rate parameter to buffer creation in test files * Compositor: Fix compile issues * Compositor: EGL we need EGL_KHR_no_config_context or EGL_MESA_configless_context * Refactor PixelFormat class: streamline constructors, add IsValid method, and update DefaultModifier * Add CompositorUtils header with PixelFormat string conversion and intersection logic * Refactor Connector class: update format handling and improve framebuffer configuration logic * Compositor: add a property value and a blob getter. * Compositor: Add a function to extract pixel formats from drm properties. * Compositor: Let the hardware select what modifier it prefers. * Compositor Rename CreateBuffer to Buffer. * Compositor: Replace Wayland format and modifier types with PixelFormat and update related logic * Compositor: Add SHM format handling and logging in Wayland implementation * Compositor: Refactor egl pixel format handling to separate render and texture formats * Compositor: Update buffer creation to use default pixel format * Compositor: Improve GLESFrameBuffer handling and error logging for EGL image creation * Compositor: Update format and modifier handling to auto-select values and expose new accessors * Compositor: Update Presented method signatures to use uint64_t for sequence parameter * Compositor: Also report a failed presentation * Compositor: Implement output termination handling and exit requests in tests * Compositor: Factored GELS debugging * Compositor: Mark unused parameter in Terminated method across multiple files * Compositor: Wayland add damage buffer and presentation feedback handling * Compositor: fix FPS calculation in HandleVSync to prevent division by zero * Compositor: refactor WaylandOutput to decouple window size and render size * Compositor: add viewport support and configure viewport scaling in WaylandOutput * Compositor: add libdecor basics * Compositor: Remove serverside decoration * Add support for libdecor integration and enhance Wayland output handling - Updated CMakeLists.txt to conditionally include libdecor based on a new option. - Modified IBackend interface to support libdecor context retrieval. - Enhanced WaylandOutput class to manage libdecor frame configuration, commit, and destruction. - Introduced VSyncTimer class for managing frame synchronization. - Refactored buffer handling and presentation feedback mechanisms to accommodate libdecor. - Improved aspect ratio handling in window resizing logic. - Added surface tracking capabilities for better output management. * Enhance GLES2 debug scope management and improve error handling * Refactor EGL display management and enhance context handling * Reset EGL context in DmaBuffer destructor to ensure proper resource cleanup * Refactor RenderTest classes to inherit from BaseTest and improve structure - Updated RenderTest classes in testdmabuf.cpp, testquads.cpp, and testtexture.cpp to inherit from BaseTest, reducing code duplication and enhancing maintainability. - Removed unnecessary private members and methods related to rendering management, such as threading and exit handling, as these are now managed by BaseTest. - Simplified frame rendering logic by utilizing the NewFrame method from BaseTest, allowing for cleaner and more efficient frame updates. - Improved keyboard input handling in main functions to provide clearer command options for starting/stopping rendering and displaying FPS. - Adjusted constructor parameters for RenderTest to align with new BaseTest structure, ensuring proper initialization of rendering components. * Implement shared memory buffer in PixelBuffer and SHMMapper classes * Adjust frame rate handling in WaylandOutput and update RenderTest initialization * Compositor: GLES Render set egl context current on unbind * Compositor: Fix render tests * Compositor: Add DRM name wrappers * Adjust VSyncTimer refresh rate default to 60000 microseconds * Compositor: Fix dmabuf test * Compositor: mimic wayland feedback with theVSyncTimer * Compositor: Proper window resizing and damage tracking * Compositor: Add atomic terminated flag to WaylandOutput * Compositor: Add Atomic FIFO * Compositor: Implement Stop method to safely halt rendering and clean up resources * Compositor: Refactor Client and add PrivilegedRequestCallback for buffer handling * Compositor: Add rendering statistics tracking and reporting * Compositor: Add Stats tracing category * Compositor: Remove std::cout for buffer logging * Compositor: Remove redundant assertion for render descriptor * Compositor: Simplify DisplayDispatcher constructor and destructor by removing unnecessary reference counting * Compositor: Forgot to change copyright when I used findEGL.cmake as a base for this new file, * Update DRMTypes.cpp Remove console output. --------- Co-authored-by: Pierre Wielders <[email protected]>
1 parent 6431e0c commit d955e36

39 files changed

+3815
-1704
lines changed

Compositor/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,9 @@ option(PLUGIN_COMPOSITOR_TEST "Build a compositor test client" OFF)
5353
option(PLUGIN_COMPOSITOR_NXSERVER "Include a nexus server (Used in Wayland)" OFF)
5454

5555
set(PLUGIN_COMPOSITOR_IMPLEMENTATION_LIB "lib${PLATFORM_COMPOSITOR}.so" CACHE STRING "Specify a library with a compositor implementation." )
56-
set(PLUGIN_COMPOSITOR_RESOLUTION "720p" CACHE STRING "Specify the startup resolution")
56+
set(PLUGIN_COMPOSITOR_RESOLUTION "Unknown" CACHE STRING "Specify the startup resolution")
5757

5858
set(PLUGIN_COMPOSITOR_OUTPUT "HDMI-A-1" CACHE STRING "Specify the output (name1;h;w) that the compositor should use." )
59-
set(PLUGIN_COMPOSITOR_CANVAS_HEIGHT "1080" CACHE STRING "Specify the height of the canvas that the compositor uses for drawing." )
60-
set(PLUGIN_COMPOSITOR_CANVAS_WIDTH "1920" CACHE STRING "Specify the width of the canvas that the compositor uses for drawing." )
6159
set(PLUGIN_COMPOSITOR_RENDER_NODE "" CACHE STRING "Manually specify the render node to use (e.g. /dev/dri/renderDxxx or /dev/dri/cardx)." )
6260

6361
set(PLUGIN_COMPOSITOR_WESTON_TTY_LIST "1;2;3;4" CACHE STRING "TTY ids for weston drm backend")

Compositor/Compositor.conf.in

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,7 @@ if "@PLUGIN_COMPOSITOR_IMPLEMENTATION@" == "Wayland":
7373
output_configs_list.append(output_config_dict)
7474
configuration.add("outputs", output_configs_list)
7575

76-
if "@PLUGIN_COMPOSITOR_IMPLEMENTATION@" == "Mesa":
77-
configuration.add("height", "@PLUGIN_COMPOSITOR_CANVAS_HEIGHT@")
78-
configuration.add("width", "@PLUGIN_COMPOSITOR_CANVAS_WIDTH@")
79-
76+
if "@PLUGIN_COMPOSITOR_IMPLEMENTATION@" == "Mesa":
8077
if "@PLUGIN_COMPOSITOR_RENDER_NODE@":
8178
configuration.add("render", "@PLUGIN_COMPOSITOR_RENDER_NODE@")
8279

Compositor/Compositor.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,18 @@ namespace Plugin {
208208
} else {
209209
RegisterAll();
210210
_composition->Register(&_notification);
211-
_composition->Configure(_service);
212211

213-
_inputSwitch = _composition->QueryInterface<Exchange::IInputSwitch>();
214-
_inputSwitchCallsign = config.InputSwitch.Value();
215-
_newOnTop = config.NewOnTop.Value();
212+
uint32_t result = _composition->Configure(_service);
216213

217-
_brightness = _composition->QueryInterface<Exchange::IBrightness>();
214+
if (result != Core::ERROR_NONE) {
215+
message = "Instantiating the compositor failed. Could not configure: CompositorImplementation Error: " + std::string(Core::ErrorToString(result));
216+
} else {
217+
_inputSwitch = _composition->QueryInterface<Exchange::IInputSwitch>();
218+
_inputSwitchCallsign = config.InputSwitch.Value();
219+
_newOnTop = config.NewOnTop.Value();
220+
221+
_brightness = _composition->QueryInterface<Exchange::IBrightness>();
222+
}
218223
}
219224

220225
// On success return empty, to indicate there is no error text.
@@ -247,7 +252,7 @@ namespace Plugin {
247252
// It should have been the last reference we are releasing,
248253
// so it should endup in a DESTRUCTION_SUCCEEDED, if not we
249254
// are leaking...
250-
ASSERT( (result == Core::ERROR_CONNECTION_CLOSED) || (result == Core::ERROR_DESTRUCTION_SUCCEEDED));
255+
ASSERT((result == Core::ERROR_CONNECTION_CLOSED) || (result == Core::ERROR_DESTRUCTION_SUCCEEDED));
251256
// If this was running in a (container) process...
252257
if (connection != nullptr) {
253258
// Lets trigger the cleanup sequence for
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# If not stated otherwise in this file or this component's LICENSE file the
2+
# following copyright and licenses apply:
3+
#
4+
# Copyright 2025 Metrological
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
if(LIBDECOR_FIND_QUIETLY)
19+
set(_LIBDECOR_MODE QUIET)
20+
elseif(LIBDECOR_FIND_REQUIRED)
21+
set(_LIBDECOR_MODE REQUIRED)
22+
endif()
23+
24+
find_package(PkgConfig)
25+
pkg_check_modules(libdecor ${_LIBDECOR_MODE} IMPORTED_TARGET GLOBAL libdecor-0)
26+
27+
if (libdecor_FOUND)
28+
add_library(libdecor::libdecor ALIAS PkgConfig::libdecor)
29+
endif()

0 commit comments

Comments
 (0)