5 #include "util/u_inlines.h"
6 #include "state_tracker/drm_driver.h"
8 #ifdef HAVE_WAYLAND_BACKEND
10 #include <wayland-server.h>
11 #include <wayland-drm-server-protocol.h>
13 #include "native_wayland_drm_bufmgr_helper.h"
16 egl_g3d_wl_drm_helper_reference_buffer(void *user_data
, uint32_t name
,
17 int32_t width
, int32_t height
,
19 struct wl_visual
*visual
)
21 struct native_display
*ndpy
= user_data
;
22 struct pipe_resource templ
;
23 struct winsys_handle wsh
;
24 enum pipe_format format
= PIPE_FORMAT_B8G8R8A8_UNORM
;
26 memset(&templ
, 0, sizeof(templ
));
27 templ
.target
= PIPE_TEXTURE_2D
;
28 templ
.format
= format
;
29 templ
.bind
= PIPE_BIND_RENDER_TARGET
| PIPE_BIND_SAMPLER_VIEW
;
31 templ
.height0
= height
;
35 memset(&wsh
, 0, sizeof(wsh
));
39 return ndpy
->screen
->resource_from_handle(ndpy
->screen
, &templ
, &wsh
);
43 egl_g3d_wl_drm_helper_unreference_buffer(void *user_data
, void *buffer
)
45 struct pipe_resource
*resource
= buffer
;
47 pipe_resource_reference(&resource
, NULL
);
50 struct pipe_resource
*
51 egl_g3d_wl_drm_common_wl_buffer_get_resource(struct native_display
*ndpy
,
52 struct wl_buffer
*buffer
)
54 return wayland_drm_buffer_get_buffer(buffer
);