forked from enlightenment/enlightenment
E Comp (wayland): Update comp module (wayland) for removal of wl_shm.
SVN revision: 69673
This commit is contained in:
parent
c2792039e0
commit
eba1cf6e4a
|
@ -36,8 +36,6 @@ module_la_SOURCES += e_mod_comp_wl.h \
|
|||
e_mod_comp_wl.c \
|
||||
e_mod_comp_wl_comp.h \
|
||||
e_mod_comp_wl_comp.c \
|
||||
e_mod_comp_wl_shm.h \
|
||||
e_mod_comp_wl_shm.c \
|
||||
e_mod_comp_wl_output.h \
|
||||
e_mod_comp_wl_output.c \
|
||||
e_mod_comp_wl_input.h \
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
# include <xcb/xcb_image.h>
|
||||
# include "e_mod_comp_wl.h"
|
||||
# include "e_mod_comp_wl_comp.h"
|
||||
# include "e_mod_comp_wl_shm.h"
|
||||
# include "e_mod_comp_wl_output.h"
|
||||
# include "e_mod_comp_wl_input.h"
|
||||
# include "e_mod_comp_wl_shell.h"
|
||||
|
@ -36,11 +35,6 @@ e_mod_comp_wl_init(void)
|
|||
|
||||
if (wl_display_add_socket(_wl_disp, NULL))
|
||||
{
|
||||
/* e_mod_comp_wl_shell_shutdown(); */
|
||||
/* e_mod_comp_wl_input_shutdown(); */
|
||||
/* e_mod_comp_wl_output_shutdown(); */
|
||||
/* e_mod_comp_wl_shm_shutdown(); */
|
||||
/* e_mod_comp_wl_comp_shutdown(); */
|
||||
wl_display_terminate(_wl_disp);
|
||||
EINA_LOG_ERR("Failed to add socket to wayland display\n");
|
||||
return EINA_FALSE;
|
||||
|
@ -50,23 +44,13 @@ e_mod_comp_wl_init(void)
|
|||
if (!e_mod_comp_wl_comp_init())
|
||||
{
|
||||
wl_display_terminate(_wl_disp);
|
||||
EINA_LOG_ERR("Failed to create wayland shm\n");
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
/* init shm */
|
||||
if (!e_mod_comp_wl_shm_init())
|
||||
{
|
||||
e_mod_comp_wl_comp_shutdown();
|
||||
wl_display_terminate(_wl_disp);
|
||||
EINA_LOG_ERR("Failed to create wayland shm\n");
|
||||
EINA_LOG_ERR("Failed to create wayland compositor\n");
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
/* init output */
|
||||
if (!e_mod_comp_wl_output_init())
|
||||
{
|
||||
e_mod_comp_wl_shm_shutdown();
|
||||
e_mod_comp_wl_comp_shutdown();
|
||||
wl_display_terminate(_wl_disp);
|
||||
EINA_LOG_ERR("Failed to create wayland output\n");
|
||||
|
@ -77,7 +61,6 @@ e_mod_comp_wl_init(void)
|
|||
if (!e_mod_comp_wl_input_init())
|
||||
{
|
||||
e_mod_comp_wl_output_shutdown();
|
||||
e_mod_comp_wl_shm_shutdown();
|
||||
e_mod_comp_wl_comp_shutdown();
|
||||
wl_display_terminate(_wl_disp);
|
||||
EINA_LOG_ERR("Failed to create wayland input\n");
|
||||
|
@ -89,7 +72,6 @@ e_mod_comp_wl_init(void)
|
|||
{
|
||||
e_mod_comp_wl_input_shutdown();
|
||||
e_mod_comp_wl_output_shutdown();
|
||||
e_mod_comp_wl_shm_shutdown();
|
||||
e_mod_comp_wl_comp_shutdown();
|
||||
wl_display_terminate(_wl_disp);
|
||||
EINA_LOG_ERR("Failed to create wayland shell\n");
|
||||
|
@ -120,7 +102,6 @@ e_mod_comp_wl_shutdown(void)
|
|||
e_mod_comp_wl_shell_shutdown();
|
||||
e_mod_comp_wl_input_shutdown();
|
||||
e_mod_comp_wl_output_shutdown();
|
||||
e_mod_comp_wl_shm_shutdown();
|
||||
e_mod_comp_wl_comp_shutdown();
|
||||
|
||||
if (_wl_disp) wl_display_terminate(_wl_disp);
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#ifdef HAVE_WAYLAND_CLIENTS
|
||||
# include "e_mod_comp_wl.h"
|
||||
# include "e_mod_comp_wl_comp.h"
|
||||
# include "e_mod_comp_wl_shm.h"
|
||||
# include "e_mod_comp_wl_input.h"
|
||||
# include "e_mod_comp_wl_surface.h"
|
||||
# include "e_mod_comp_wl_region.h"
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
#ifdef HAVE_WAYLAND_CLIENTS
|
||||
# include "e_mod_comp_wl.h"
|
||||
# include "e_mod_comp_wl_shm.h"
|
||||
#endif
|
||||
|
||||
/* local function prototypes */
|
||||
static void _e_mod_comp_wl_shm_buffer_created(struct wl_buffer *buffer);
|
||||
static void _e_mod_comp_wl_shm_buffer_damaged(struct wl_buffer *buffer, int32_t x __UNUSED__, int32_t y __UNUSED__, int32_t width __UNUSED__, int32_t height __UNUSED__);
|
||||
static void _e_mod_comp_wl_shm_buffer_destroyed(struct wl_buffer *buffer);
|
||||
|
||||
/* wayland interfaces */
|
||||
static const struct wl_shm_callbacks _wl_shm_callbacks =
|
||||
{
|
||||
_e_mod_comp_wl_shm_buffer_created,
|
||||
_e_mod_comp_wl_shm_buffer_damaged,
|
||||
_e_mod_comp_wl_shm_buffer_destroyed
|
||||
};
|
||||
|
||||
/* private variables */
|
||||
static struct wl_shm *_wl_shm;
|
||||
|
||||
Eina_Bool
|
||||
e_mod_comp_wl_shm_init(void)
|
||||
{
|
||||
if (!(_wl_shm = wl_shm_init(_wl_disp, &_wl_shm_callbacks)))
|
||||
return EINA_FALSE;
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
e_mod_comp_wl_shm_shutdown(void)
|
||||
{
|
||||
if (_wl_shm) wl_shm_finish(_wl_shm);
|
||||
_wl_shm = NULL;
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static void
|
||||
_e_mod_comp_wl_shm_buffer_created(struct wl_buffer *buffer)
|
||||
{
|
||||
struct wl_list *attached;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!(attached = malloc(sizeof(*attached))))
|
||||
{
|
||||
EINA_LOG_ERR("Failed to allocate attached list\n");
|
||||
buffer->user_data = NULL;
|
||||
return;
|
||||
}
|
||||
wl_list_init(attached);
|
||||
buffer->user_data = attached;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_comp_wl_shm_buffer_damaged(struct wl_buffer *buffer, int32_t x __UNUSED__, int32_t y __UNUSED__, int32_t width __UNUSED__, int32_t height __UNUSED__)
|
||||
{
|
||||
struct wl_list *attached;
|
||||
GLsizei tex_width;
|
||||
Wayland_Surface *ws;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
attached = buffer->user_data;
|
||||
tex_width = wl_shm_buffer_get_stride(buffer) / 4;
|
||||
wl_list_for_each(ws, attached, buffer_link)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, ws->texture);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT,
|
||||
tex_width, buffer->height, 0, GL_BGRA_EXT,
|
||||
GL_UNSIGNED_BYTE, wl_shm_buffer_get_data(buffer));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_mod_comp_wl_shm_buffer_destroyed(struct wl_buffer *buffer)
|
||||
{
|
||||
struct wl_list *attached;
|
||||
Wayland_Surface *ws, *next;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
attached = buffer->user_data;
|
||||
wl_list_for_each_safe(ws, next, attached, buffer_link)
|
||||
{
|
||||
wl_list_remove(&ws->buffer_link);
|
||||
wl_list_init(&ws->buffer_link);
|
||||
}
|
||||
free(attached);
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
#ifdef E_TYPEDEFS
|
||||
#else
|
||||
# ifndef E_MOD_COMP_WL_SHM_H
|
||||
# define E_MOD_COMP_WL_SHM_H
|
||||
|
||||
Eina_Bool e_mod_comp_wl_shm_init(void);
|
||||
void e_mod_comp_wl_shm_shutdown(void);
|
||||
|
||||
# endif
|
||||
#endif
|
Loading…
Reference in New Issue