2 #include "e_mod_main.h"
4 /* local function prototypes */
5 static void _e_sprite_cb_buffer_destroy(struct wl_listener *listener, void *data __UNUSED__);
6 static void _e_sprite_cb_pending_buffer_destroy(struct wl_listener *listener, void *data __UNUSED__);
9 /* wayland interfaces */
10 /* external variables */
13 e_sprite_create(E_Drm_Compositor *dcomp, drmModePlane *plane)
17 DLOGFN(__FILE__, __LINE__, __FUNCTION__);
19 if (!plane) return NULL;
21 es = malloc(sizeof(E_Sprite) + ((sizeof(unsigned int)) * plane->count_formats));
24 memset(es, 0, sizeof(E_Sprite));
26 es->compositor = dcomp;
27 es->possible_crtcs = plane->possible_crtcs;
28 es->plane_id = plane->plane_id;
30 es->pending_surface = NULL;
32 es->pending_fb_id = 0;
33 es->destroy_listener.notify = _e_sprite_cb_buffer_destroy;
34 es->pending_destroy_listener.notify = _e_sprite_cb_pending_buffer_destroy;
35 es->format_count = plane->count_formats;
36 memcpy(es->formats, plane->formats,
37 plane->count_formats * sizeof(plane->formats[0]));
43 e_sprite_crtc_supported(E_Output *output, unsigned int supported)
46 E_Drm_Compositor *dcomp;
47 E_Drm_Output *doutput;
50 DLOGFN(__FILE__, __LINE__, __FUNCTION__);
52 comp = output->compositor;
53 dcomp = (E_Drm_Compositor *)comp;
54 doutput = (E_Drm_Output *)output;
56 for (crtc = 0; crtc < dcomp->num_crtcs; crtc++)
58 if (dcomp->crtcs[crtc] != doutput->crtc_id)
60 if (supported & (1 << crtc))
69 _e_sprite_cb_buffer_destroy(struct wl_listener *listener, void *data __UNUSED__)
73 DLOGFN(__FILE__, __LINE__, __FUNCTION__);
75 es = container_of(listener, E_Sprite, destroy_listener);
80 _e_sprite_cb_pending_buffer_destroy(struct wl_listener *listener, void *data __UNUSED__)
84 DLOGFN(__FILE__, __LINE__, __FUNCTION__);
86 es = container_of(listener, E_Sprite, pending_destroy_listener);
87 es->pending_surface = NULL;