Compare commits

...

6 Commits

Author SHA1 Message Date
Chris Michael ca0f401ea7 New egl engine does not have a depth field.
Comment out setting engine_info->depth field.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2013-03-05 11:59:10 +00:00
Christopher Michael beb9f57b98 Fix include order to remove compiler warning
Signed-off-by: Christopher Michael <cp.michael@samsung.com>
2013-02-27 14:23:32 +00:00
Christopher Michael ac036b17fc Rename 'surface' field.
Signed-off-by: Christopher Michael <cp.michael@samsung.com>
2013-02-27 14:19:30 +00:00
Christopher Michael 84c96d566a Add initial engine header file.
Signed-off-by: Christopher Michael <cp.michael@samsung.com>
2013-02-27 13:47:33 +00:00
Christopher Michael b2e0c9efd9 Add new header file for Evas Wayland Egl engine.
Signed-off-by: Christopher Michael <cp.michael@samsung.com>
2013-02-27 13:36:26 +00:00
Christopher Michael 12a6ef11bb Remove old wayland_egl code.
Signed-off-by: Christopher Michael <cp.michael@samsung.com>
2013-02-27 12:33:50 +00:00
5 changed files with 54 additions and 4170 deletions

View File

@ -189,7 +189,7 @@ ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
einfo->info.display = ecore_wl_display_get();
einfo->info.destination_alpha = ee->alpha;
einfo->info.rotation = ee->rotation;
einfo->info.depth = 32;
// einfo->info.depth = 32;
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
{
ERR("Failed to set Evas Engine Info for '%s'", ee->driver);

View File

@ -1,49 +1,47 @@
#ifndef _EVAS_ENGINE_WAYLAND_EGL_H
#define _EVAS_ENGINE_WAYLAND_EGL_H
# define _EVAS_ENGINE_WAYLAND_EGL_H
/*
* Wayland supoprt is considered experimental as wayland itself is still
* unstable and liable to change core protocol. If you use this api, it is
* possible it will break in future, until this notice is removed.
*/
# include <wayland-client.h>
#include <wayland-client.h>
# define EVAS_ENGINE_WAYLAND_EGL_SWAP_MODE_EXISTS 1
typedef enum _Evas_Engine_Info_Wayland_Egl_Swap_Mode
{
EVAS_ENGINE_WAYLAND_EGL_SWAP_MODE_AUTO = 0,
EVAS_ENGINE_WAYLAND_EGL_SWAP_MODE_FULL = 1,
EVAS_ENGINE_WAYLAND_EGL_SWAP_MODE_COPY = 2,
EVAS_ENGINE_WAYLAND_EGL_SWAP_MODE_DOUBLE = 3,
EVAS_ENGINE_WAYLAND_EGL_SWAP_MODE_TRIPLE = 4
} Evas_Engine_Info_Wayland_Egl_Swap_Mode;
typedef struct _Evas_Engine_Info_Wayland_Egl Evas_Engine_Info_Wayland_Egl;
struct _Evas_Engine_Info_Wayland_Egl
{
/* PRIVATE - don't mess with this baby or evas will poke its tongue out */
/* at you and make nasty noises */
Evas_Engine_Info magic;
/* engine specific data & parameters it needs to set up */
struct {
struct wl_display *display;
struct wl_surface *surface;
int depth;
int screen;
int rotation;
int edges;
unsigned int destination_alpha : 1;
} info;
/* engine specific function calls to query stuff about the destination */
/* engine (what visual & colormap & depth to use, performance info etc. */
struct {
int (*best_depth_get) (Evas_Engine_Info_Wayland_Egl *einfo);
} func;
struct
{
struct wl_display *display;
struct wl_surface *surface;
int rotation;
int edges;
Eina_Bool destination_alpha : 1;
} info;
struct {
void (*pre_swap) (void *data, Evas *e);
void (*post_swap) (void *data, Evas *e);
struct
{
void (*pre_swap) (void *data, Evas *evas);
void (*post_swap) (void *data, Evas *evas);
void *data;
} callback;
void *data; // data for callback calls
} callback;
/* non-blocking or blocking mode */
Evas_Engine_Render_Mode render_mode;
unsigned char vsync : 1; // does nothing right now
unsigned char indirect : 1; // use indirect rendering
Eina_Bool vsync : 1;
Eina_Bool indirect : 1;
unsigned char swap_mode : 4;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,15 @@
#ifndef EVAS_ENGINE_H
#define EVAS_ENGINE_H
# define EVAS_ENGINE_H
#include "config.h"
#include "evas_common.h"
#include "evas_private.h"
#include "evas_gl_common.h"
#include "Evas.h"
#include "Evas_Engine_Wayland_Egl.h"
#define GL_GLEXT_PROTOTYPES
#include <EGL/egl.h>
#ifdef GL_GLES
# include <GLES2/gl2.h>
# include <GLES2/gl2ext.h>
#else
# include <GL/gl.h>
# include <GL/glext.h>
#endif
#include "evas_gl_common.h"
#include <wayland-egl.h>
extern int _evas_engine_wl_egl_log_dom;
@ -51,37 +43,30 @@ typedef struct _Evas_GL_Wl_Window Evas_GL_Wl_Window;
struct _Evas_GL_Wl_Window
{
struct wl_display *disp;
struct wl_egl_window *win;
struct wl_surface *surface;
int w, h;
int screen;
// XVisualInfo *visualinfo;
// Visual *visual;
// Colormap colormap;
int depth;
int alpha;
int rot;
struct wl_egl_window *win;
Evas_Coord w, h;
Eina_Bool alpha : 1;
int rotation;
Evas_Engine_GL_Context *gl_context;
struct {
int redraw : 1;
int drew : 1;
int x1, y1, x2, y2;
} draw;
EGLContext egl_context[1];
EGLSurface egl_surface[1];
EGLConfig egl_config;
EGLDisplay egl_disp;
int surf : 1;
Eina_Bool drawn : 1;
Eina_Bool surf : 1;
struct
{
EGLContext context[1];
EGLSurface surface[1];
EGLConfig config;
EGLDisplay disp;
} egl;
};
Evas_GL_Wl_Window *eng_window_new(struct wl_display *disp, struct wl_surface *surface, int screen,
Evas_GL_Wl_Window *eng_window_new(struct wl_display *disp,
struct wl_surface *surface, int screen,
int depth, int w, int h, int indirect,
int alpha, int rot);
void eng_window_free(Evas_GL_Wl_Window *gw);
void eng_window_use(Evas_GL_Wl_Window *gw);
void eng_window_unsurf(Evas_GL_Wl_Window *gw);
void eng_window_resurf(Evas_GL_Wl_Window *gw);
int eng_best_depth_get(Evas_Engine_Info_Wayland_Egl *einfo);
void eng_window_free(Evas_GL_Wl_Window *gw);
void eng_window_use(Evas_GL_Wl_Window *gw);
void eng_window_unsurf(Evas_GL_Wl_Window *gw);
void eng_window_resurf(Evas_GL_Wl_Window *gw);
#endif

View File

@ -1,295 +0,0 @@
#include "evas_engine.h"
static Evas_GL_Wl_Window *_evas_gl_wl_window = NULL;
static EGLContext share_context = EGL_NO_CONTEXT;
// fixme: something is up/wrong here - dont know what tho...
//#define NEWGL 1
static int win_count = 0;
Evas_GL_Wl_Window *
eng_window_new(struct wl_display *disp, struct wl_surface *surface, int screen,
int depth, int w, int h, int indirect, int alpha, int rot)
{
Evas_GL_Wl_Window *gw;
int context_attrs[3];
int config_attrs[40];
int major_version, minor_version;
int num_config, n = 0;
const GLubyte *vendor, *renderer, *version;
gw = calloc(1, sizeof(Evas_GL_Wl_Window));
if (!gw) return NULL;
win_count++;
gw->disp = disp;
gw->surface = surface;
gw->screen = screen;
gw->depth = depth;
gw->alpha = alpha;
gw->w = w;
gw->h = h;
gw->rot = rot;
// EGL / GLES
context_attrs[0] = EGL_CONTEXT_CLIENT_VERSION;
context_attrs[1] = 2;
context_attrs[2] = EGL_NONE;
config_attrs[n++] = EGL_SURFACE_TYPE;
config_attrs[n++] = EGL_WINDOW_BIT;
config_attrs[n++] = EGL_RENDERABLE_TYPE;
config_attrs[n++] = EGL_OPENGL_ES2_BIT;
# if 0
// FIXME: n900 - omap3 sgx libs break here
config_attrs[n++] = EGL_RED_SIZE;
config_attrs[n++] = 1;
config_attrs[n++] = EGL_GREEN_SIZE;
config_attrs[n++] = 1;
config_attrs[n++] = EGL_BLUE_SIZE;
config_attrs[n++] = 1;
// FIXME: end n900 breakage
# endif
if (gw->alpha)
{
config_attrs[n++] = EGL_ALPHA_SIZE;
config_attrs[n++] = 1;
}
else
{
config_attrs[n++] = EGL_ALPHA_SIZE;
config_attrs[n++] = 0;
}
config_attrs[n++] = EGL_DEPTH_SIZE;
config_attrs[n++] = 0;
config_attrs[n++] = EGL_STENCIL_SIZE;
config_attrs[n++] = 0;
config_attrs[n++] = EGL_NONE;
/* FIXME: Remove this line as soon as eglGetDisplay() autodetection
* gets fixed. Currently it is incorrectly detecting wl_display and
* returning _EGL_PLATFORM_X11 instead of _EGL_PLATFORM_WAYLAND.
*
* See ticket #1972 for more info.
*/
setenv("EGL_PLATFORM", "wayland", 1);
gw->egl_disp = eglGetDisplay((EGLNativeDisplayType)(gw->disp));
if (!gw->egl_disp)
{
ERR("eglGetDisplay() fail. code=%#x", eglGetError());
eng_window_free(gw);
return NULL;
}
if (!eglInitialize(gw->egl_disp, &major_version, &minor_version))
{
ERR("eglInitialize() fail. code=%#x", eglGetError());
eng_window_free(gw);
return NULL;
}
eglBindAPI(EGL_OPENGL_ES_API);
if (eglGetError() != EGL_SUCCESS)
{
ERR("eglBindAPI() fail. code=%#x", eglGetError());
eng_window_free(gw);
return NULL;
}
num_config = 0;
if (!eglChooseConfig(gw->egl_disp, config_attrs, &gw->egl_config,
1, &num_config) || (num_config != 1))
{
ERR("eglChooseConfig() fail. code=%#x", eglGetError());
eng_window_free(gw);
return NULL;
}
if ((gw->rot == 0) || (gw->rot == 180))
gw->win = wl_egl_window_create(gw->surface, gw->w, gw->h);
else if ((gw->rot == 90) || (gw->rot == 270))
gw->win = wl_egl_window_create(gw->surface, gw->h, gw->w);
gw->egl_surface[0] = eglCreateWindowSurface(gw->egl_disp, gw->egl_config,
(EGLNativeWindowType)gw->win,
NULL);
if (gw->egl_surface[0] == EGL_NO_SURFACE)
{
ERR("eglCreateWindowSurface() fail for %p. code=%#x",
gw->win, eglGetError());
eng_window_free(gw);
return NULL;
}
gw->egl_context[0] =
eglCreateContext(gw->egl_disp, gw->egl_config, share_context,
context_attrs);
if (gw->egl_context[0] == EGL_NO_CONTEXT)
{
ERR("eglCreateContext() fail. code=%#x", eglGetError());
eng_window_free(gw);
return NULL;
}
if (share_context == EGL_NO_CONTEXT)
share_context = gw->egl_context[0];
if (eglMakeCurrent(gw->egl_disp, gw->egl_surface[0], gw->egl_surface[0],
gw->egl_context[0]) == EGL_FALSE)
{
ERR("eglMakeCurrent() fail. code=%#x", eglGetError());
eng_window_free(gw);
return NULL;
}
vendor = glGetString(GL_VENDOR);
renderer = glGetString(GL_RENDERER);
version = glGetString(GL_VERSION);
if (!vendor) vendor = (unsigned char *)"-UNKNOWN-";
if (!renderer) renderer = (unsigned char *)"-UNKNOWN-";
if (!version) version = (unsigned char *)"-UNKNOWN-";
if (getenv("EVAS_GL_INFO"))
{
fprintf(stderr, "vendor: %s\n", vendor);
fprintf(stderr, "renderer: %s\n", renderer);
fprintf(stderr, "version: %s\n", version);
}
gw->gl_context = evas_gl_common_context_new();
if (!gw->gl_context)
{
eng_window_free(gw);
return NULL;
}
gw->gl_context->egldisp = gw->egl_disp;
eng_window_use(gw);
evas_gl_common_context_resize(gw->gl_context, w, h, rot);
gw->surf = 1;
return gw;
indirect = 0;
}
void
eng_window_free(Evas_GL_Wl_Window *gw)
{
int ref = 0;
win_count--;
eng_window_use(gw);
if (gw == _evas_gl_wl_window) _evas_gl_wl_window = NULL;
// if (gw->win) wl_egl_window_destroy(gw->win);
if (gw->gl_context)
{
ref = gw->gl_context->references - 1;
evas_gl_common_context_free(gw->gl_context);
}
if (gw->egl_surface[0] != EGL_NO_SURFACE)
eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (gw->egl_context[0] != EGL_NO_CONTEXT && gw->egl_context[0] != share_context)
eglDestroyContext(gw->egl_disp, gw->egl_context[0]);
if (ref == 0)
{
/* NB: This is causing an unknown hang when we run elm apps as
* wayland clients inside the weston compositor */
/* eglTerminate(gw->egl_disp); */
eglReleaseThread();
}
free(gw);
}
void
eng_window_use(Evas_GL_Wl_Window *gw)
{
Eina_Bool force_use = EINA_FALSE;
if (_evas_gl_wl_window)
{
if ((eglGetCurrentContext() !=
_evas_gl_wl_window->egl_context[0]) ||
(eglGetCurrentSurface(EGL_READ) !=
_evas_gl_wl_window->egl_surface[0]) ||
(eglGetCurrentSurface(EGL_DRAW) !=
_evas_gl_wl_window->egl_surface[0]))
force_use = EINA_TRUE;
}
if ((_evas_gl_wl_window != gw) || (force_use))
{
if (_evas_gl_wl_window)
{
evas_gl_common_context_use(_evas_gl_wl_window->gl_context);
evas_gl_common_context_flush(_evas_gl_wl_window->gl_context);
}
_evas_gl_wl_window = gw;
if (gw)
{
// EGL / GLES
if (gw->egl_surface[0] != EGL_NO_SURFACE)
{
if (eglMakeCurrent(gw->egl_disp, gw->egl_surface[0],
gw->egl_surface[0],
gw->egl_context[0]) == EGL_FALSE)
{
ERR("eglMakeCurrent() failed!");
}
}
}
}
if (gw) evas_gl_common_context_use(gw->gl_context);
}
void
eng_window_unsurf(Evas_GL_Wl_Window *gw)
{
if (!gw->surf) return;
if (!getenv("EVAS_GL_WIN_RESURF")) return;
if (getenv("EVAS_GL_INFO")) printf("unsurf %p\n", gw);
if (_evas_gl_wl_window)
evas_gl_common_context_flush(_evas_gl_wl_window->gl_context);
if (_evas_gl_wl_window == gw)
{
eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (gw->egl_surface[0] != EGL_NO_SURFACE)
eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
gw->egl_surface[0] = EGL_NO_SURFACE;
_evas_gl_wl_window = NULL;
}
gw->surf = 0;
}
void
eng_window_resurf(Evas_GL_Wl_Window *gw)
{
if (gw->surf) return;
if (getenv("EVAS_GL_INFO")) printf("resurf %p\n", gw);
gw->egl_surface[0] =
eglCreateWindowSurface(gw->egl_disp, gw->egl_config,
(EGLNativeWindowType)gw->win, NULL);
if (gw->egl_surface[0] == EGL_NO_SURFACE)
{
ERR("eglCreateWindowSurface() fail for %p. code=%#x",
gw->win, eglGetError());
return;
}
if (eglMakeCurrent(gw->egl_disp, gw->egl_surface[0], gw->egl_surface[0],
gw->egl_context[0]) == EGL_FALSE)
{
ERR("eglMakeCurrent() failed!");
}
gw->surf = 1;
}
int
eng_best_depth_get(Evas_Engine_Info_Wayland_Egl *einfo)
{
if (!einfo) return 0;
if (!einfo->info.display) return 0;
return (einfo->info.depth ? einfo->info.depth : 32);
}