Evas: minor whitespace and debug changes

This commit is contained in:
Jean-Philippe Andre 2015-11-03 18:13:59 +09:00
parent aefcb11444
commit a2b64d9772
4 changed files with 77 additions and 78 deletions

View File

@ -486,7 +486,7 @@ _fbo_surface_cap_test(GLint color_ifmt, GLenum color_fmt,
DBG("glGetError() returns %x ", err);
return 0;
}
}
else
return 1;
}
@ -2113,10 +2113,10 @@ evgl_context_create(void *eng_data, EVGL_Context *share_ctx,
DBG("Creating context GLESv%d (eng = %p, shctx = %p)", version, eng_data, share_ctx);
if (!(rsc = _evgl_tls_resource_get()))
{
ERR("Error creating resources in tls.");
return NULL;
}
{
ERR("Error creating resources in tls.");
return NULL;
}
// Allocate context object
ctx = calloc(1, sizeof(EVGL_Context));
@ -2754,9 +2754,8 @@ evgl_native_surface_direct_opts_get(Evas_Native_Surface *ns,
if (evgl_engine->api_debug_mode)
{
DBG("Found native surface: texid:%u DR:%d CSR:%d",
ns->data.opengl.texture_id, (int) sfc->direct_fb_opt,
(int) sfc->client_side_rotation);
DBG("Found native surface: DR:%d CSR:%d",
(int) sfc->direct_fb_opt, (int) sfc->client_side_rotation);
}
if (direct_render) *direct_render = sfc->direct_fb_opt;

View File

@ -286,12 +286,12 @@ evgl_eng_native_window_create(void *data)
attr.win_gravity = NorthWestGravity;
attr.save_under = False;
attr.do_not_propagate_mask = NoEventMask;
attr.event_mask = 0;
attr.event_mask = 0;
win = XCreateWindow(eng_get_ob(re)->info->info.display,
eng_get_ob(re)->win,
-20, -20, 2, 2, 0,
CopyFromParent, InputOutput, CopyFromParent,
CopyFromParent, InputOutput, CopyFromParent,
CWBackingStore | CWOverrideRedirect |
CWBorderPixel | CWBackPixmap |
CWSaveUnder | CWDontPropagate |
@ -336,7 +336,7 @@ evgl_eng_native_window_destroy(void *data, void *native_window)
// Theoretically, we wouldn't need this functoin if the surfaceless context
// is supported. But, until then...
// is supported. But, until then...
static void *
evgl_eng_window_surface_create(void *data, void *native_window EINA_UNUSED)
{
@ -2032,43 +2032,43 @@ _native_bind_cb(void *data EINA_UNUSED, void *image)
static void
_native_unbind_cb(void *data EINA_UNUSED, void *image)
{
Evas_GL_Image *im = image;
Native *n = im->native.data;
Evas_GL_Image *im = image;
Native *n = im->native.data;
if (n->ns.type == EVAS_NATIVE_SURFACE_X11)
{
if (n->ns.type == EVAS_NATIVE_SURFACE_X11)
{
#ifdef GL_GLES
// nothing
// nothing
#else
# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT
Render_Engine *re = data;
if (glsym_glXReleaseTexImage)
{
glsym_glXReleaseTexImage(eng_get_ob(re)->disp, (XID)n->surface,
GLX_FRONT_LEFT_EXT);
}
else
ERR("Try glXReleaseTexImage on GLX with no support");
Render_Engine *re = data;
if (glsym_glXReleaseTexImage)
{
glsym_glXReleaseTexImage(eng_get_ob(re)->disp, (XID)n->surface,
GLX_FRONT_LEFT_EXT);
}
else
ERR("Try glXReleaseTexImage on GLX with no support");
# endif
#endif
}
else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL)
{
glBindTexture(GL_TEXTURE_2D, 0);
}
else if (n->ns.type == EVAS_NATIVE_SURFACE_TBM)
{
// nothing
}
else if (n->ns.type == EVAS_NATIVE_SURFACE_EVASGL)
{
}
else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL)
{
glBindTexture(GL_TEXTURE_2D, 0);
}
else if (n->ns.type == EVAS_NATIVE_SURFACE_TBM)
{
// nothing
}
else if (n->ns.type == EVAS_NATIVE_SURFACE_EVASGL)
{
#ifdef GL_GLES
// nothing
// nothing
#else
glBindTexture(GL_TEXTURE_2D, 0);
glBindTexture(GL_TEXTURE_2D, 0);
#endif
}
}
}
static void
@ -2448,7 +2448,7 @@ eng_image_native_set(void *data, void *image, void *native)
int dummy;
unsigned int w, h, depth = 32, border;
Window wdummy;
// fixme: round trip :(
XGetGeometry(eng_get_ob(re)->disp, pm, &wdummy, &dummy, &dummy,
&w, &h, &border, &depth);
@ -2462,7 +2462,7 @@ eng_image_native_set(void *data, void *image, void *native)
int tex_format = 0, tex_target = 0, yinvert = 0, mipmap = 0;
unsigned int target = 0;
GLXFBConfig *configs;
i = 0;
config_attrs[i++] = GLX_BUFFER_SIZE;
config_attrs[i++] = depth;
@ -2476,7 +2476,7 @@ eng_image_native_set(void *data, void *image, void *native)
config_attrs[i++] = GLX_BIND_TO_TEXTURE_RGB_EXT;
config_attrs[i++] = 1;
}
#ifndef GLX_VISUAL_ID
# define GLX_VISUAL_ID 0x800b
#endif
@ -2495,9 +2495,9 @@ eng_image_native_set(void *data, void *image, void *native)
config_attrs[i++] = 0;
config_attrs[i++] = GLX_STEREO;
config_attrs[i++] = 0;
config_attrs[i++] = 0;
configs = glXChooseFBConfig(eng_get_ob(re)->disp,
eng_get_ob(re)->screen,
config_attrs,
@ -2505,19 +2505,19 @@ eng_image_native_set(void *data, void *image, void *native)
if (configs)
{
int j = 0, val = 0, found = 0;
try_again:
for (j = 0; j < num; j++)
{
if (found == 0)
{
XVisualInfo *vi;
vi = glXGetVisualFromFBConfig(eng_get_ob(re)->disp, configs[j]);
if (!vi) continue;
if (vi->depth != (int)depth) continue;
XFree(vi);
glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j],
GLX_BUFFER_SIZE, &val);
if (val != (int) depth) continue;
@ -2562,7 +2562,7 @@ eng_image_native_set(void *data, void *image, void *native)
}
XFree(configs);
}
eina_hash_add(eng_get_ob(re)->gl_context->shared->native_pm_hash, &pmid, im);
if ((tex_target & GLX_TEXTURE_2D_BIT_EXT))
target = GLX_TEXTURE_2D_EXT;
@ -2579,7 +2579,7 @@ eng_image_native_set(void *data, void *image, void *native)
else if (!(tex_target & GLX_TEXTURE_RECTANGLE_BIT_EXT))
target = GLX_TEXTURE_2D_EXT;
}
i = 0;
pixmap_att[i++] = GLX_TEXTURE_FORMAT_EXT;
pixmap_att[i++] = tex_format;
@ -2591,7 +2591,7 @@ eng_image_native_set(void *data, void *image, void *native)
pixmap_att[i++] = target;
}
pixmap_att[i++] = 0;
memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
n->pixmap = pm;
n->visual = vis;
@ -2643,7 +2643,7 @@ eng_image_native_set(void *data, void *image, void *native)
im->native.func.bind = _native_bind_cb;
im->native.func.unbind = _native_unbind_cb;
im->native.func.free = _native_free_cb;
glsym_evas_gl_common_image_native_enable(im);
}
}

View File

@ -490,7 +490,7 @@ try_gles2:
// vendor: VMware, Inc.
// renderer: Gallium 0.4 on softpipe
// version: 2.1 Mesa 7.9-devel
//
//
if (strstr((const char *)vendor, "Mesa Project"))
{
if (strstr((const char *)renderer, "Software Rasterizer"))
@ -1578,7 +1578,7 @@ eng_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode)
}
}
else
eglSwapBuffers(ob->egl_disp, ob->egl_surface[0]);
eglSwapBuffers(ob->egl_disp, ob->egl_surface[0]);
//xx if (!safe_native) eglWaitGL();
if (ob->info->callback.post_swap)

View File

@ -50,14 +50,14 @@ _buf_new(X_Swapper *swp, Buffer *buf)
{
buf->w = swp->w;
buf->h = swp->h;
// try shm first
buf->xim = XShmCreateImage(swp->disp, swp->vis, swp->depth, ZPixmap,
NULL, &(buf->shm_info), buf->w, buf->h);
if (buf->xim)
{
buf->bpl = buf->xim->bytes_per_line;
buf->shm_info.shmid = shmget(IPC_PRIVATE, buf->bpl * buf->h,
IPC_CREAT | 0777);
if (buf->shm_info.shmid >= 0)
@ -68,7 +68,7 @@ _buf_new(X_Swapper *swp, Buffer *buf)
if (buf->shm_info.shmaddr != ((void *)-1))
{
XErrorHandler ph;
XSync(swp->disp, False);
_x_err = EINA_FALSE;
ph = XSetErrorHandler((XErrorHandler)_x_err_hand);
@ -104,7 +104,7 @@ _buf_new(X_Swapper *swp, Buffer *buf)
if (!buf->xim) // shm failed - try normal ximage
{
buf->xim = XCreateImage(swp->disp, swp->vis, swp->depth, ZPixmap,
buf->xim = XCreateImage(swp->disp, swp->vis, swp->depth, ZPixmap,
0, NULL, buf->w, buf->h, 32, 0);
if (!buf->xim) return EINA_FALSE;
buf->bpl = buf->xim->bytes_per_line;
@ -143,7 +143,7 @@ _buf_put(X_Swapper *swp, Buffer *buf, Eina_Rectangle *rects, int nrects)
{
Region tmpr;
int i;
if (!buf->xim) return;
tmpr = XCreateRegion();
if ((rects)/* && 0*/) // set to 0 to test buffer stuff
@ -151,7 +151,7 @@ _buf_put(X_Swapper *swp, Buffer *buf, Eina_Rectangle *rects, int nrects)
for (i = 0; i < nrects; i++)
{
XRectangle xr;
xr.x = rects[i].x; xr.y = rects[i].y;
xr.width = rects[i].w; xr.height = rects[i].h;
XUnionRectWithRegion(&xr, tmpr, tmpr);
@ -160,7 +160,7 @@ _buf_put(X_Swapper *swp, Buffer *buf, Eina_Rectangle *rects, int nrects)
else
{
XRectangle xr;
xr.x = 0; xr.y = 0;
xr.width = buf->w; xr.height = buf->h;
XUnionRectWithRegion(&xr, tmpr, tmpr);
@ -189,9 +189,9 @@ evas_xlib_swapper_new(Display *disp, Drawable draw, Visual *vis,
X_Swapper *swp;
XGCValues gcv;
int i;
int nbuf = 3; // pretend we are triple buffered
swp = calloc(1, sizeof(X_Swapper));
if (!swp) return NULL;
swp->disp = disp;
@ -246,7 +246,7 @@ void
evas_xlib_swapper_swap(X_Swapper *swp, Eina_Rectangle *rects, int nrects)
{
int n;
n = swp->buf_cur;
_buf_put(swp, &(swp->buf[n]), rects, nrects);
swp->buf[n].valid = 1;
@ -257,7 +257,7 @@ Render_Engine_Swap_Mode
evas_xlib_swapper_buffer_state_get(X_Swapper *swp)
{
int i, n, count = 0;
/*
/*
for (i = 0; i < swp->buf_num; i++)
{
if ((rand() % 50) == 0)
@ -434,13 +434,13 @@ _drm_init(Display *disp, int scr)
{
char *drv_name = NULL, *dev_name = NULL;
drm_magic_t magic = 0;
if (swap_debug == -1)
{
if (getenv("EVAS_SWAPPER_DEBUG")) swap_debug = 1;
else swap_debug = 0;
}
if (xfixes_lib) return EINA_TRUE;
if ((tried) && (!xfixes_lib)) return EINA_FALSE;
tried = EINA_TRUE;
@ -471,7 +471,7 @@ _drm_init(Display *disp, int scr)
if (swap_debug) ERR("Can't load libXfixes.so.3");
goto err;
}
#define SYM(l, x) \
do { sym_ ## x = dlsym(l, #x); \
if (!sym_ ## x) { \
@ -479,7 +479,7 @@ _drm_init(Display *disp, int scr)
goto err; \
} \
} while (0)
SYM(drm_lib, drmGetMagic);
if (!slp_mode)
@ -523,14 +523,14 @@ _drm_init(Display *disp, int scr)
SYM(xfixes_lib, XFixesQueryVersion);
SYM(xfixes_lib, XFixesCreateRegion);
SYM(xfixes_lib, XFixesDestroyRegion);
if (!sym_XFixesQueryExtension(disp, &xfixes_ev_base, &xfixes_err_base))
{
if (swap_debug) ERR("XFixes extension not in xserver");
goto err;
}
sym_XFixesQueryVersion(disp, &xfixes_major, &xfixes_minor);
if (!sym_DRI2QueryExtension(disp, &dri2_ev_base, &dri2_err_base))
{
if (swap_debug) ERR("DRI2 extension not in xserver");
@ -563,7 +563,7 @@ _drm_init(Display *disp, int scr)
if (swap_debug) ERR("DRM get magic failed");
goto err;
}
if (!sym_DRI2Authenticate(disp, RootWindow(disp, scr),
if (!sym_DRI2Authenticate(disp, RootWindow(disp, scr),
(unsigned int)magic))
{
if (swap_debug) ERR("DRI2 authenticate failed with magic 0x%x on screen %i", (unsigned int)magic, scr);
@ -621,7 +621,7 @@ _drm_shutdown(void)
// though, as once shut down, we have to re-init and this could be
// expensive especially if u have a single canvas that is changing config
// and being shut down and re-initted a few times.
/*
/*
if (bufmgr)
{
sym_tbm_bufmgr_deinit(bufmgr);
@ -663,7 +663,7 @@ evas_xlib_swapper_new(Display *disp, Drawable draw, Visual *vis,
if (!_drm_init(disp, 0)) return NULL;
}
inits++;
swp = calloc(1, sizeof(X_Swapper));
if (!swp) return NULL;
swp->disp = disp;
@ -692,7 +692,7 @@ void
evas_xlib_swapper_free(X_Swapper *swp)
{
Buffer *b;
if (swap_debug) printf("Swapper free\n");
if (swp->mapped) evas_xlib_swapper_buffer_unmap(swp);
EINA_LIST_FREE(swp->buf_cache, b)
@ -715,7 +715,7 @@ evas_xlib_swapper_buffer_map(X_Swapper *swp, int *bpl, int *w, int *h)
Eina_List *l;
Buffer *b;
DRI2BufferFlags *flags;
if (swp->mapped)
{
if (bpl)
@ -727,7 +727,7 @@ evas_xlib_swapper_buffer_map(X_Swapper *swp, int *bpl, int *w, int *h)
if (h) *h = swp->h;
return swp->buf_data;
}
swp->buf = sym_DRI2GetBuffers(swp->disp, swp->draw,
swp->buf = sym_DRI2GetBuffers(swp->disp, swp->draw,
&(swp->buf_w), &(swp->buf_h),
&attach, 1, &num);
if (!swp->buf) return NULL;
@ -840,7 +840,7 @@ evas_xlib_swapper_swap(X_Swapper *swp, Eina_Rectangle *rects, int nrects)
XID region;
int i;
unsigned long long sbc_count = 0;
if (swap_debug) printf("Swap buffers\n");
for (i = 0; i < nrects; i++)
{
@ -856,7 +856,7 @@ Render_Engine_Swap_Mode
evas_xlib_swapper_buffer_state_get(X_Swapper *swp)
{
DRI2BufferFlags *flags;
if (!swp->mapped) evas_xlib_swapper_buffer_map(swp, NULL, NULL, NULL);
if (!swp->mapped) return MODE_FULL;
flags = (DRI2BufferFlags *)(&(swp->buf->flags));