|
|
@ -1,11 +1,9 @@
|
|
|
|
#ifndef _POSIX_C_SOURCE
|
|
|
|
|
|
|
|
#define _POSIX_C_SOURCE 200809L
|
|
|
|
#define _POSIX_C_SOURCE 200809L
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <wayland-server.h>
|
|
|
|
#include <wayland-server.h>
|
|
|
|
#include <wlr/render/egl.h>
|
|
|
|
#include <wlr/render/wlr_renderer.h>
|
|
|
|
#include <wlr/types/wlr_linux_dmabuf.h>
|
|
|
|
#include <wlr/types/wlr_linux_dmabuf.h>
|
|
|
|
#include <wlr/util/log.h>
|
|
|
|
#include <wlr/util/log.h>
|
|
|
|
#include "linux-dmabuf-unstable-v1-protocol.h"
|
|
|
|
#include "linux-dmabuf-unstable-v1-protocol.h"
|
|
|
@ -25,7 +23,8 @@ bool wlr_dmabuf_resource_is_buffer(struct wl_resource *buffer_resource) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_dmabuf_buffer *buffer = wl_resource_get_user_data(buffer_resource);
|
|
|
|
struct wlr_dmabuf_buffer *buffer =
|
|
|
|
|
|
|
|
wl_resource_get_user_data(buffer_resource);
|
|
|
|
if (buffer && buffer->buffer_resource && !buffer->params_resource &&
|
|
|
|
if (buffer && buffer->buffer_resource && !buffer->params_resource &&
|
|
|
|
buffer->buffer_resource == buffer_resource) {
|
|
|
|
buffer->buffer_resource == buffer_resource) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
@ -39,7 +38,8 @@ struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_buffer_resource(
|
|
|
|
assert(wl_resource_instance_of(buffer_resource, &wl_buffer_interface,
|
|
|
|
assert(wl_resource_instance_of(buffer_resource, &wl_buffer_interface,
|
|
|
|
&wl_buffer_impl));
|
|
|
|
&wl_buffer_impl));
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_dmabuf_buffer *buffer = wl_resource_get_user_data(buffer_resource);
|
|
|
|
struct wlr_dmabuf_buffer *buffer =
|
|
|
|
|
|
|
|
wl_resource_get_user_data(buffer_resource);
|
|
|
|
assert(buffer);
|
|
|
|
assert(buffer);
|
|
|
|
assert(buffer->buffer_resource);
|
|
|
|
assert(buffer->buffer_resource);
|
|
|
|
assert(!buffer->params_resource);
|
|
|
|
assert(!buffer->params_resource);
|
|
|
@ -57,7 +57,8 @@ static void linux_dmabuf_buffer_destroy(struct wlr_dmabuf_buffer *buffer) {
|
|
|
|
free(buffer);
|
|
|
|
free(buffer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void params_destroy(struct wl_client *client, struct wl_resource *resource) {
|
|
|
|
static void params_destroy(struct wl_client *client,
|
|
|
|
|
|
|
|
struct wl_resource *resource) {
|
|
|
|
wl_resource_destroy(resource);
|
|
|
|
wl_resource_destroy(resource);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -65,8 +66,8 @@ static void params_add(struct wl_client *client,
|
|
|
|
struct wl_resource *params_resource, int32_t name_fd,
|
|
|
|
struct wl_resource *params_resource, int32_t name_fd,
|
|
|
|
uint32_t plane_idx, uint32_t offset, uint32_t stride,
|
|
|
|
uint32_t plane_idx, uint32_t offset, uint32_t stride,
|
|
|
|
uint32_t modifier_hi, uint32_t modifier_lo) {
|
|
|
|
uint32_t modifier_hi, uint32_t modifier_lo) {
|
|
|
|
struct wlr_dmabuf_buffer *buffer = wlr_dmabuf_buffer_from_params_resource(
|
|
|
|
struct wlr_dmabuf_buffer *buffer =
|
|
|
|
params_resource);
|
|
|
|
wlr_dmabuf_buffer_from_params_resource(params_resource);
|
|
|
|
|
|
|
|
|
|
|
|
if (!buffer) {
|
|
|
|
if (!buffer) {
|
|
|
|
wl_resource_post_error(params_resource,
|
|
|
|
wl_resource_post_error(params_resource,
|
|
|
@ -97,15 +98,15 @@ static void params_add(struct wl_client *client,
|
|
|
|
buffer->attributes.fd[plane_idx] = name_fd;
|
|
|
|
buffer->attributes.fd[plane_idx] = name_fd;
|
|
|
|
buffer->attributes.offset[plane_idx] = offset;
|
|
|
|
buffer->attributes.offset[plane_idx] = offset;
|
|
|
|
buffer->attributes.stride[plane_idx] = stride;
|
|
|
|
buffer->attributes.stride[plane_idx] = stride;
|
|
|
|
buffer->attributes.modifier[plane_idx] = ((uint64_t)modifier_hi << 32) |
|
|
|
|
buffer->attributes.modifier[plane_idx] =
|
|
|
|
modifier_lo;
|
|
|
|
((uint64_t)modifier_hi << 32) | modifier_lo;
|
|
|
|
buffer->attributes.n_planes++;
|
|
|
|
buffer->attributes.n_planes++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void handle_buffer_destroy(struct wl_resource *buffer_resource)
|
|
|
|
static void handle_buffer_destroy(struct wl_resource *buffer_resource)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
struct wlr_dmabuf_buffer *buffer = wlr_dmabuf_buffer_from_buffer_resource(
|
|
|
|
struct wlr_dmabuf_buffer *buffer =
|
|
|
|
buffer_resource);
|
|
|
|
wlr_dmabuf_buffer_from_buffer_resource(buffer_resource);
|
|
|
|
|
|
|
|
|
|
|
|
linux_dmabuf_buffer_destroy(buffer);
|
|
|
|
linux_dmabuf_buffer_destroy(buffer);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -119,8 +120,8 @@ static void params_create_common(struct wl_client *client,
|
|
|
|
"params was already used to create a wl_buffer");
|
|
|
|
"params was already used to create a wl_buffer");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
struct wlr_dmabuf_buffer *buffer = wlr_dmabuf_buffer_from_params_resource(
|
|
|
|
struct wlr_dmabuf_buffer *buffer =
|
|
|
|
params_resource);
|
|
|
|
wlr_dmabuf_buffer_from_params_resource(params_resource);
|
|
|
|
|
|
|
|
|
|
|
|
/* Switch the linux_dmabuf_buffer object from params resource to
|
|
|
|
/* Switch the linux_dmabuf_buffer object from params resource to
|
|
|
|
* eventually wl_buffer resource. */
|
|
|
|
* eventually wl_buffer resource. */
|
|
|
@ -216,7 +217,7 @@ static void params_create_common(struct wl_client *client,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Check if dmabuf is usable */
|
|
|
|
/* Check if dmabuf is usable */
|
|
|
|
if (!wlr_egl_check_import_dmabuf(buffer->egl, buffer)) {
|
|
|
|
if (!wlr_renderer_check_import_dmabuf(buffer->renderer, buffer)) {
|
|
|
|
goto err_failed;
|
|
|
|
goto err_failed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -254,26 +255,28 @@ err_failed:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
err_out:
|
|
|
|
err_out:
|
|
|
|
linux_dmabuf_buffer_destroy(buffer);
|
|
|
|
linux_dmabuf_buffer_destroy(buffer);
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void params_create(struct wl_client *client,
|
|
|
|
static void params_create(struct wl_client *client,
|
|
|
|
struct wl_resource *params_resource,
|
|
|
|
struct wl_resource *params_resource,
|
|
|
|
int32_t width, int32_t height,uint32_t format, uint32_t flags) {
|
|
|
|
int32_t width, int32_t height, uint32_t format, uint32_t flags) {
|
|
|
|
params_create_common(client, params_resource, 0, width, height, format, flags);
|
|
|
|
params_create_common(client, params_resource, 0, width, height, format,
|
|
|
|
|
|
|
|
flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void params_create_immed(struct wl_client *client,
|
|
|
|
static void params_create_immed(struct wl_client *client,
|
|
|
|
struct wl_resource *params_resource, uint32_t buffer_id,
|
|
|
|
struct wl_resource *params_resource, uint32_t buffer_id,
|
|
|
|
int32_t width, int32_t height,uint32_t format, uint32_t flags) {
|
|
|
|
int32_t width, int32_t height, uint32_t format, uint32_t flags) {
|
|
|
|
params_create_common(client, params_resource, buffer_id, width, height, format, flags);
|
|
|
|
params_create_common(client, params_resource, buffer_id, width, height,
|
|
|
|
|
|
|
|
format, flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const struct zwp_linux_buffer_params_v1_interface linux_buffer_params_impl = {
|
|
|
|
static const struct zwp_linux_buffer_params_v1_interface
|
|
|
|
params_destroy,
|
|
|
|
linux_buffer_params_impl = {
|
|
|
|
params_add,
|
|
|
|
.destroy = params_destroy,
|
|
|
|
params_create,
|
|
|
|
.add = params_add,
|
|
|
|
params_create_immed,
|
|
|
|
.create = params_create,
|
|
|
|
|
|
|
|
.create_immed = params_create_immed,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_params_resource(
|
|
|
|
struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_params_resource(
|
|
|
@ -282,7 +285,8 @@ struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_params_resource(
|
|
|
|
&zwp_linux_buffer_params_v1_interface,
|
|
|
|
&zwp_linux_buffer_params_v1_interface,
|
|
|
|
&linux_buffer_params_impl));
|
|
|
|
&linux_buffer_params_impl));
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_dmabuf_buffer *buffer = wl_resource_get_user_data(params_resource);
|
|
|
|
struct wlr_dmabuf_buffer *buffer =
|
|
|
|
|
|
|
|
wl_resource_get_user_data(params_resource);
|
|
|
|
assert(buffer);
|
|
|
|
assert(buffer);
|
|
|
|
assert(buffer->params_resource);
|
|
|
|
assert(buffer->params_resource);
|
|
|
|
assert(!buffer->buffer_resource);
|
|
|
|
assert(!buffer->buffer_resource);
|
|
|
@ -305,8 +309,8 @@ static void handle_params_destroy(struct wl_resource *params_resource) {
|
|
|
|
static void linux_dmabuf_create_params(struct wl_client *client,
|
|
|
|
static void linux_dmabuf_create_params(struct wl_client *client,
|
|
|
|
struct wl_resource *linux_dmabuf_resource,
|
|
|
|
struct wl_resource *linux_dmabuf_resource,
|
|
|
|
uint32_t params_id) {
|
|
|
|
uint32_t params_id) {
|
|
|
|
struct wlr_linux_dmabuf *linux_dmabuf = wlr_linux_dmabuf_from_resource(
|
|
|
|
struct wlr_linux_dmabuf *linux_dmabuf =
|
|
|
|
linux_dmabuf_resource);
|
|
|
|
wlr_linux_dmabuf_from_resource(linux_dmabuf_resource);
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t version = wl_resource_get_version(linux_dmabuf_resource);
|
|
|
|
uint32_t version = wl_resource_get_version(linux_dmabuf_resource);
|
|
|
|
struct wlr_dmabuf_buffer *buffer = calloc(1, sizeof *buffer);
|
|
|
|
struct wlr_dmabuf_buffer *buffer = calloc(1, sizeof *buffer);
|
|
|
@ -318,7 +322,7 @@ static void linux_dmabuf_create_params(struct wl_client *client,
|
|
|
|
buffer->attributes.fd[i] = -1;
|
|
|
|
buffer->attributes.fd[i] = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
buffer->egl = linux_dmabuf->egl;
|
|
|
|
buffer->renderer = linux_dmabuf->renderer;
|
|
|
|
buffer->params_resource = wl_resource_create(client,
|
|
|
|
buffer->params_resource = wl_resource_create(client,
|
|
|
|
&zwp_linux_buffer_params_v1_interface,
|
|
|
|
&zwp_linux_buffer_params_v1_interface,
|
|
|
|
version, params_id);
|
|
|
|
version, params_id);
|
|
|
@ -327,7 +331,7 @@ static void linux_dmabuf_create_params(struct wl_client *client,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wl_resource_set_implementation(buffer->params_resource,
|
|
|
|
wl_resource_set_implementation(buffer->params_resource,
|
|
|
|
&linux_buffer_params_impl,buffer, handle_params_destroy);
|
|
|
|
&linux_buffer_params_impl, buffer, handle_params_destroy);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
err_free:
|
|
|
|
err_free:
|
|
|
@ -336,13 +340,14 @@ err:
|
|
|
|
wl_resource_post_no_memory(linux_dmabuf_resource);
|
|
|
|
wl_resource_post_no_memory(linux_dmabuf_resource);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void linux_dmabuf_destroy(struct wl_client *client, struct wl_resource *resource) {
|
|
|
|
static void linux_dmabuf_destroy(struct wl_client *client,
|
|
|
|
|
|
|
|
struct wl_resource *resource) {
|
|
|
|
wl_resource_destroy(resource);
|
|
|
|
wl_resource_destroy(resource);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const struct zwp_linux_dmabuf_v1_interface linux_dmabuf_impl = {
|
|
|
|
static const struct zwp_linux_dmabuf_v1_interface linux_dmabuf_impl = {
|
|
|
|
linux_dmabuf_destroy,
|
|
|
|
.destroy = linux_dmabuf_destroy,
|
|
|
|
linux_dmabuf_create_params
|
|
|
|
.create_params = linux_dmabuf_create_params,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_linux_dmabuf *wlr_linux_dmabuf_from_resource(
|
|
|
|
struct wlr_linux_dmabuf *wlr_linux_dmabuf_from_resource(
|
|
|
@ -357,25 +362,22 @@ struct wlr_linux_dmabuf *wlr_linux_dmabuf_from_resource(
|
|
|
|
|
|
|
|
|
|
|
|
static void linux_dmabuf_send_modifiers(struct wlr_linux_dmabuf *linux_dmabuf,
|
|
|
|
static void linux_dmabuf_send_modifiers(struct wlr_linux_dmabuf *linux_dmabuf,
|
|
|
|
struct wl_resource *resource) {
|
|
|
|
struct wl_resource *resource) {
|
|
|
|
struct wlr_egl *egl = linux_dmabuf->egl;
|
|
|
|
struct wlr_renderer *renderer = linux_dmabuf->renderer;
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Use EGL_EXT_image_dma_buf_import_modifiers to query and advertise
|
|
|
|
* Use EGL_EXT_image_dma_buf_import_modifiers to query and advertise
|
|
|
|
* format/modifier codes.
|
|
|
|
* format/modifier codes.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
uint64_t modifier_invalid = DRM_FORMAT_MOD_INVALID;
|
|
|
|
uint64_t modifier_invalid = DRM_FORMAT_MOD_INVALID;
|
|
|
|
int *formats = NULL;
|
|
|
|
int *formats = NULL;
|
|
|
|
int num_formats = wlr_egl_get_dmabuf_formats(egl, &formats);
|
|
|
|
int num_formats = wlr_renderer_get_dmabuf_formats(renderer, &formats);
|
|
|
|
|
|
|
|
|
|
|
|
if (num_formats < 0) {
|
|
|
|
if (num_formats < 0) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < num_formats; i++) {
|
|
|
|
for (int i = 0; i < num_formats; i++) {
|
|
|
|
int num_modifiers;
|
|
|
|
|
|
|
|
uint64_t *modifiers = NULL;
|
|
|
|
uint64_t *modifiers = NULL;
|
|
|
|
|
|
|
|
int num_modifiers = wlr_renderer_get_dmabuf_modifiers(renderer,
|
|
|
|
num_modifiers = wlr_egl_get_dmabuf_modifiers(egl, formats[i],
|
|
|
|
formats[i], &modifiers);
|
|
|
|
&modifiers);
|
|
|
|
|
|
|
|
if (num_modifiers < 0) {
|
|
|
|
if (num_modifiers < 0) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -389,8 +391,7 @@ static void linux_dmabuf_send_modifiers(struct wlr_linux_dmabuf *linux_dmabuf,
|
|
|
|
uint32_t modifier_lo = modifiers[j] & 0xFFFFFFFF;
|
|
|
|
uint32_t modifier_lo = modifiers[j] & 0xFFFFFFFF;
|
|
|
|
uint32_t modifier_hi = modifiers[j] >> 32;
|
|
|
|
uint32_t modifier_hi = modifiers[j] >> 32;
|
|
|
|
zwp_linux_dmabuf_v1_send_modifier(resource, formats[i],
|
|
|
|
zwp_linux_dmabuf_v1_send_modifier(resource, formats[i],
|
|
|
|
modifier_hi,
|
|
|
|
modifier_hi, modifier_lo);
|
|
|
|
modifier_lo);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (modifiers != &modifier_invalid) {
|
|
|
|
if (modifiers != &modifier_invalid) {
|
|
|
|
free(modifiers);
|
|
|
|
free(modifiers);
|
|
|
@ -399,13 +400,12 @@ static void linux_dmabuf_send_modifiers(struct wlr_linux_dmabuf *linux_dmabuf,
|
|
|
|
free(formats);
|
|
|
|
free(formats);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void linux_dmabuf_bind(struct wl_client *client,
|
|
|
|
static void linux_dmabuf_bind(struct wl_client *client, void *data,
|
|
|
|
void *data, uint32_t version, uint32_t id) {
|
|
|
|
uint32_t version, uint32_t id) {
|
|
|
|
struct wlr_linux_dmabuf *linux_dmabuf = data;
|
|
|
|
struct wlr_linux_dmabuf *linux_dmabuf = data;
|
|
|
|
struct wl_resource *resource = wl_resource_create(client,
|
|
|
|
|
|
|
|
&zwp_linux_dmabuf_v1_interface,
|
|
|
|
|
|
|
|
version, id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct wl_resource *resource = wl_resource_create(client,
|
|
|
|
|
|
|
|
&zwp_linux_dmabuf_v1_interface, version, id);
|
|
|
|
if (resource == NULL) {
|
|
|
|
if (resource == NULL) {
|
|
|
|
wl_client_post_no_memory(client);
|
|
|
|
wl_client_post_no_memory(client);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -414,7 +414,7 @@ static void linux_dmabuf_bind(struct wl_client *client,
|
|
|
|
wl_resource_set_implementation(resource, &linux_dmabuf_impl,
|
|
|
|
wl_resource_set_implementation(resource, &linux_dmabuf_impl,
|
|
|
|
linux_dmabuf, NULL);
|
|
|
|
linux_dmabuf, NULL);
|
|
|
|
if (version < ZWP_LINUX_DMABUF_V1_MODIFIER_SINCE_VERSION) {
|
|
|
|
if (version < ZWP_LINUX_DMABUF_V1_MODIFIER_SINCE_VERSION) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
linux_dmabuf_send_modifiers(linux_dmabuf, resource);
|
|
|
|
linux_dmabuf_send_modifiers(linux_dmabuf, resource);
|
|
|
@ -431,32 +431,32 @@ void wlr_linux_dmabuf_destroy(struct wlr_linux_dmabuf *linux_dmabuf) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
|
|
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
|
|
|
struct wlr_linux_dmabuf *linux_dmabuf = wl_container_of(listener, linux_dmabuf, display_destroy);
|
|
|
|
struct wlr_linux_dmabuf *linux_dmabuf =
|
|
|
|
|
|
|
|
wl_container_of(listener, linux_dmabuf, display_destroy);
|
|
|
|
wlr_linux_dmabuf_destroy(linux_dmabuf);
|
|
|
|
wlr_linux_dmabuf_destroy(linux_dmabuf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_linux_dmabuf *wlr_linux_dmabuf_create(struct wl_display *display,
|
|
|
|
struct wlr_linux_dmabuf *wlr_linux_dmabuf_create(struct wl_display *display,
|
|
|
|
struct wlr_egl *egl) {
|
|
|
|
struct wlr_renderer *renderer) {
|
|
|
|
struct wlr_linux_dmabuf *linux_dmabuf =
|
|
|
|
struct wlr_linux_dmabuf *linux_dmabuf =
|
|
|
|
calloc(1, sizeof(struct wlr_linux_dmabuf));
|
|
|
|
calloc(1, sizeof(struct wlr_linux_dmabuf));
|
|
|
|
if (linux_dmabuf == NULL) {
|
|
|
|
if (linux_dmabuf == NULL) {
|
|
|
|
wlr_log(L_ERROR, "could not create simple dmabuf manager");
|
|
|
|
wlr_log(L_ERROR, "could not create simple dmabuf manager");
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
linux_dmabuf->renderer = renderer;
|
|
|
|
linux_dmabuf->display_destroy.notify = handle_display_destroy;
|
|
|
|
|
|
|
|
wl_display_add_destroy_listener(display, &linux_dmabuf->display_destroy);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
linux_dmabuf->wl_global =
|
|
|
|
linux_dmabuf->wl_global =
|
|
|
|
wl_global_create(display, &zwp_linux_dmabuf_v1_interface,
|
|
|
|
wl_global_create(display, &zwp_linux_dmabuf_v1_interface,
|
|
|
|
3, linux_dmabuf, linux_dmabuf_bind);
|
|
|
|
3, linux_dmabuf, linux_dmabuf_bind);
|
|
|
|
|
|
|
|
|
|
|
|
linux_dmabuf->egl = egl;
|
|
|
|
|
|
|
|
if (!linux_dmabuf->wl_global) {
|
|
|
|
if (!linux_dmabuf->wl_global) {
|
|
|
|
wlr_log(L_ERROR, "could not create linux dmabuf v1 wl global");
|
|
|
|
wlr_log(L_ERROR, "could not create linux dmabuf v1 wl global");
|
|
|
|
free(linux_dmabuf);
|
|
|
|
free(linux_dmabuf);
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
linux_dmabuf->display_destroy.notify = handle_display_destroy;
|
|
|
|
|
|
|
|
wl_display_add_destroy_listener(display, &linux_dmabuf->display_destroy);
|
|
|
|
|
|
|
|
|
|
|
|
return linux_dmabuf;
|
|
|
|
return linux_dmabuf;
|
|
|
|
}
|
|
|
|
}
|
|
|
|