mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 04:45:58 +01:00
linux-dmabuf-v1: introduce wlr_linux_dmabuf_v1_create()
Some compositors may want to use the linux-dmabuf-v1 implementation with a completely custom renderer. Add a function to create the global with a default feedback.
This commit is contained in:
parent
9c04fd2496
commit
f103dc74d8
2 changed files with 26 additions and 12 deletions
|
@ -73,6 +73,15 @@ struct wlr_linux_dmabuf_v1 {
|
|||
struct wl_listener display_destroy;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create the linux-dmabuf-unstable-v1 global.
|
||||
*
|
||||
* Compositors using struct wlr_renderer should use
|
||||
* wlr_linux_dmabuf_v1_create_with_renderer() instead.
|
||||
*/
|
||||
struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create(struct wl_display *display,
|
||||
uint32_t version, const struct wlr_linux_dmabuf_feedback_v1 *default_feedback);
|
||||
|
||||
/**
|
||||
* Create the linux-dmabuf-unstable-v1 global.
|
||||
*
|
||||
|
|
|
@ -968,8 +968,8 @@ error_compiled:
|
|||
return false;
|
||||
}
|
||||
|
||||
struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create_with_renderer(struct wl_display *display,
|
||||
uint32_t version, struct wlr_renderer *renderer) {
|
||||
struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create(struct wl_display *display,
|
||||
uint32_t version, const struct wlr_linux_dmabuf_feedback_v1 *default_feedback) {
|
||||
assert(version <= LINUX_DMABUF_VERSION);
|
||||
|
||||
struct wlr_linux_dmabuf_v1 *linux_dmabuf =
|
||||
|
@ -990,16 +990,7 @@ struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create_with_renderer(struct wl_d
|
|||
goto error_linux_dmabuf;
|
||||
}
|
||||
|
||||
struct wlr_linux_dmabuf_feedback_v1_tranche tranche = {0};
|
||||
if (!feedback_tranche_init_with_renderer(&tranche, renderer)) {
|
||||
goto error_global;
|
||||
}
|
||||
const struct wlr_linux_dmabuf_feedback_v1 feedback = {
|
||||
.main_device = tranche.target_device,
|
||||
.tranches = &tranche,
|
||||
.tranches_len = 1,
|
||||
};
|
||||
if (!set_default_feedback(linux_dmabuf, &feedback)) {
|
||||
if (!set_default_feedback(linux_dmabuf, default_feedback)) {
|
||||
goto error_global;
|
||||
}
|
||||
|
||||
|
@ -1017,6 +1008,20 @@ error_linux_dmabuf:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create_with_renderer(struct wl_display *display,
|
||||
uint32_t version, struct wlr_renderer *renderer) {
|
||||
struct wlr_linux_dmabuf_feedback_v1_tranche tranche = {0};
|
||||
if (!feedback_tranche_init_with_renderer(&tranche, renderer)) {
|
||||
return NULL;
|
||||
}
|
||||
const struct wlr_linux_dmabuf_feedback_v1 feedback = {
|
||||
.main_device = tranche.target_device,
|
||||
.tranches = &tranche,
|
||||
.tranches_len = 1,
|
||||
};
|
||||
return wlr_linux_dmabuf_v1_create(display, version, &feedback);
|
||||
}
|
||||
|
||||
bool wlr_linux_dmabuf_v1_set_surface_feedback(
|
||||
struct wlr_linux_dmabuf_v1 *linux_dmabuf,
|
||||
struct wlr_surface *wlr_surface,
|
||||
|
|
Loading…
Reference in a new issue