mirror of
https://gitlab.freedesktop.org/mesa/vulkan-wsi-layer.git
synced 2025-12-24 10:00:10 +01:00
Merge 'Add support for wp_presentation in the WSI layer' into 'main'
See merge request mesa/vulkan-wsi-layer!113
This commit is contained in:
commit
e6fa021f8d
4 changed files with 39 additions and 2 deletions
|
|
@ -148,14 +148,23 @@ if(BUILD_WSI_WAYLAND)
|
||||||
COMMAND ${WAYLAND_SCANNER_EXEC} public-code
|
COMMAND ${WAYLAND_SCANNER_EXEC} public-code
|
||||||
${WAYLAND_PROTOCOLS_DIR}/unstable/linux-explicit-synchronization/linux-explicit-synchronization-unstable-v1.xml
|
${WAYLAND_PROTOCOLS_DIR}/unstable/linux-explicit-synchronization/linux-explicit-synchronization-unstable-v1.xml
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/linux-explicit-synchronization-unstable-v1-protocol.c
|
${CMAKE_CURRENT_BINARY_DIR}/linux-explicit-synchronization-unstable-v1-protocol.c
|
||||||
|
COMMAND ${WAYLAND_SCANNER_EXEC} client-header
|
||||||
|
${WAYLAND_PROTOCOLS_DIR}/stable/presentation-time/presentation-time.xml
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/presentation-time-client-protocol.h
|
||||||
|
COMMAND ${WAYLAND_SCANNER_EXEC} public-code
|
||||||
|
${WAYLAND_PROTOCOLS_DIR}/stable/presentation-time/presentation-time.xml
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/presentation-time-client-protocol.c
|
||||||
BYPRODUCTS linux-dmabuf-unstable-v1-protocol.c linux-dmabuf-unstable-v1-client-protocol.h
|
BYPRODUCTS linux-dmabuf-unstable-v1-protocol.c linux-dmabuf-unstable-v1-client-protocol.h
|
||||||
linux-explicit-synchronization-unstable-v1-protocol.c linux-explicit-synchronization-unstable-v1-protocol.h)
|
linux-explicit-synchronization-unstable-v1-protocol.c linux-explicit-synchronization-unstable-v1-protocol.h
|
||||||
|
presentation-time-client-protocol.c presentation-time-client-protocol.h)
|
||||||
|
|
||||||
target_sources(wayland_wsi PRIVATE
|
target_sources(wayland_wsi PRIVATE
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/linux-dmabuf-unstable-v1-protocol.c
|
${CMAKE_CURRENT_BINARY_DIR}/linux-dmabuf-unstable-v1-protocol.c
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/linux-dmabuf-unstable-v1-client-protocol.h
|
${CMAKE_CURRENT_BINARY_DIR}/linux-dmabuf-unstable-v1-client-protocol.h
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/linux-explicit-synchronization-unstable-v1-protocol.c
|
${CMAKE_CURRENT_BINARY_DIR}/linux-explicit-synchronization-unstable-v1-protocol.c
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/linux-explicit-synchronization-unstable-v1-protocol.h)
|
${CMAKE_CURRENT_BINARY_DIR}/linux-explicit-synchronization-unstable-v1-protocol.h
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/presentation-time-client-protocol.c
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/presentation-time-client-protocol.h)
|
||||||
add_dependencies(wayland_wsi wayland_generated_files)
|
add_dependencies(wayland_wsi wayland_generated_files)
|
||||||
|
|
||||||
target_include_directories(wayland_wsi PRIVATE
|
target_include_directories(wayland_wsi PRIVATE
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,19 @@ surface_registry_handler(void *data, struct wl_registry *wl_registry, uint32_t n
|
||||||
|
|
||||||
wsi_surface->explicit_sync_interface.reset(explicit_sync_interface_obj);
|
wsi_surface->explicit_sync_interface.reset(explicit_sync_interface_obj);
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(interface, wp_presentation_interface.name))
|
||||||
|
{
|
||||||
|
wp_presentation *wp_presentation_obj =
|
||||||
|
reinterpret_cast<wp_presentation *>(wl_registry_bind(wl_registry, name, &wp_presentation_interface, 1));
|
||||||
|
|
||||||
|
if (wp_presentation_obj == nullptr)
|
||||||
|
{
|
||||||
|
WSI_LOG_ERROR("Failed to get wp_presentation interface.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wsi_surface->presentation_time_interface.reset(wp_presentation_obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool surface::init()
|
bool surface::init()
|
||||||
|
|
@ -222,6 +235,12 @@ bool surface::init()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (presentation_time_interface.get() == nullptr)
|
||||||
|
{
|
||||||
|
WSI_LOG_ERROR("Failed to obtain wp_presentation interface.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
auto surface_sync_obj =
|
auto surface_sync_obj =
|
||||||
zwp_linux_explicit_synchronization_v1_get_synchronization(explicit_sync_interface.get(), wayland_surface);
|
zwp_linux_explicit_synchronization_v1_get_synchronization(explicit_sync_interface.get(), wayland_surface);
|
||||||
if (surface_sync_obj == nullptr)
|
if (surface_sync_obj == nullptr)
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,9 @@ private:
|
||||||
/** Container for the surface specific zwp_linux_surface_synchronization_v1 interface. */
|
/** Container for the surface specific zwp_linux_surface_synchronization_v1 interface. */
|
||||||
wayland_owner<zwp_linux_surface_synchronization_v1> surface_sync_interface;
|
wayland_owner<zwp_linux_surface_synchronization_v1> surface_sync_interface;
|
||||||
|
|
||||||
|
/** Container for the wp_presentation interface binding */
|
||||||
|
wayland_owner<wp_presentation> presentation_time_interface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Container for a callback object for the latest frame done event.
|
* Container for a callback object for the latest frame done event.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
#include <linux-dmabuf-unstable-v1-client-protocol.h>
|
#include <linux-dmabuf-unstable-v1-client-protocol.h>
|
||||||
#include <linux-explicit-synchronization-unstable-v1-protocol.h>
|
#include <linux-explicit-synchronization-unstable-v1-protocol.h>
|
||||||
|
#include <presentation-time-client-protocol.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
|
@ -55,6 +56,11 @@ static inline void wayland_object_destroy(zwp_linux_surface_synchronization_v1 *
|
||||||
zwp_linux_surface_synchronization_v1_destroy(obj);
|
zwp_linux_surface_synchronization_v1_destroy(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void wayland_object_destroy(wp_presentation *obj)
|
||||||
|
{
|
||||||
|
wp_presentation_destroy(obj);
|
||||||
|
}
|
||||||
|
|
||||||
static inline void wayland_object_destroy(wl_callback *obj)
|
static inline void wayland_object_destroy(wl_callback *obj)
|
||||||
{
|
{
|
||||||
wl_callback_destroy(obj);
|
wl_callback_destroy(obj);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue