diff --git a/include/screencast_common.h b/include/screencast_common.h index 2b16b09..b871c59 100644 --- a/include/screencast_common.h +++ b/include/screencast_common.h @@ -103,6 +103,7 @@ struct xdpw_screencast_context { struct zwlr_screencopy_manager_v1 *screencopy_manager; struct zxdg_output_manager_v1 *xdg_output_manager; struct wl_shm *shm; + struct zwp_linux_dmabuf_v1 *linux_dmabuf; // gbm struct gbm_device *gbm; diff --git a/include/wlr_screencast.h b/include/wlr_screencast.h index 15e535f..1af267f 100644 --- a/include/wlr_screencast.h +++ b/include/wlr_screencast.h @@ -12,6 +12,8 @@ #define XDG_OUTPUT_MANAGER_VERSION 3 +#define LINUX_DMABUF_VERSION 3 + struct xdpw_state; int xdpw_wlr_screencopy_init(struct xdpw_state *state); diff --git a/src/screencast/wlr_screencast.c b/src/screencast/wlr_screencast.c index cc10f6e..129068b 100644 --- a/src/screencast/wlr_screencast.c +++ b/src/screencast/wlr_screencast.c @@ -1,5 +1,6 @@ #include "wlr_screencast.h" +#include "linux-dmabuf-unstable-v1-client-protocol.h" #include "wlr-screencopy-unstable-v1-client-protocol.h" #include "xdg-output-unstable-v1-client-protocol.h" #include @@ -582,6 +583,10 @@ static void wlr_registry_handle_add(void *data, struct wl_registry *reg, ctx->xdg_output_manager = wl_registry_bind(reg, id, &zxdg_output_manager_v1_interface, XDG_OUTPUT_MANAGER_VERSION); } + if (strcmp(interface, zwp_linux_dmabuf_v1_interface.name) == 0) { + logprint(DEBUG, "wlroots: |-- registered to interface %s (Version %u)", interface, LINUX_DMABUF_VERSION); + ctx->linux_dmabuf = wl_registry_bind(reg, id, &zwp_linux_dmabuf_v1_interface, LINUX_DMABUF_VERSION); + } } static void wlr_registry_handle_remove(void *data, struct wl_registry *reg, @@ -677,6 +682,9 @@ void xdpw_wlr_screencopy_finish(struct xdpw_screencast_context *ctx) { gbm_device_destroy(ctx->gbm); close(fd); } + if (ctx->linux_dmabuf) { + zwp_linux_dmabuf_v1_destroy(ctx->linux_dmabuf); + } if (ctx->registry) { wl_registry_destroy(ctx->registry); }