add indirect engine option - and do glsym for glxcreatepixmap and friends.

SVN revision: 46167
This commit is contained in:
Carsten Haitzler 2010-02-14 15:12:39 +00:00
parent 302e9054c4
commit cee4d504cf
4 changed files with 70 additions and 38 deletions

View File

@ -34,7 +34,8 @@ struct _Evas_Engine_Info_GL_X11
void *data; // data for callback calls void *data; // data for callback calls
} callback; } callback;
unsigned char vsync : 1; unsigned char vsync : 1; // does nothing right now
unsigned char indirect : 1; // use indirect rendering
}; };
#endif #endif

View File

@ -32,6 +32,9 @@ void (*glsym_glXBindTexImage) (Display *a, GLXDrawable b, int c, int *d)
void (*glsym_glXReleaseTexImage) (Display *a, GLXDrawable b, int c) = NULL; void (*glsym_glXReleaseTexImage) (Display *a, GLXDrawable b, int c) = NULL;
int (*glsym_glXGetVideoSync) (unsigned int *a) = NULL; int (*glsym_glXGetVideoSync) (unsigned int *a) = NULL;
int (*glsym_glXWaitVideoSync) (int a, int b, unsigned int *c) = NULL; int (*glsym_glXWaitVideoSync) (int a, int b, unsigned int *c) = NULL;
XID (*glsym_glXCreatePixmap) (Display *a, void *b, Pixmap c, const int *d) = NULL;
void (*glsym_glXDestroyPixmap) (Display *a, XID b) = NULL;
void (*glsym_glXQueryDrawable) (Display *a, XID b, int c, unsigned int *d) = NULL;
#endif #endif
static void static void
@ -93,6 +96,18 @@ _sym_init(void)
FINDSYM(glsym_glXGetVideoSync, "glXGetVideoSyncSGI"); FINDSYM(glsym_glXGetVideoSync, "glXGetVideoSyncSGI");
FINDSYM(glsym_glXWaitVideoSync, "glXWaitVideoSyncSGI"); FINDSYM(glsym_glXWaitVideoSync, "glXWaitVideoSyncSGI");
FINDSYM(glsym_glXCreatePixmap, "glXCreatePixmap");
FINDSYM(glsym_glXCreatePixmap, "glXCreatePixmapEXT");
FINDSYM(glsym_glXCreatePixmap, "glXCreatePixmapARB");
FINDSYM(glsym_glXDestroyPixmap, "glXDestroyPixmap");
FINDSYM(glsym_glXDestroyPixmap, "glXDestroyPixmapEXT");
FINDSYM(glsym_glXDestroyPixmap, "glXDestroyPixmapARB");
FINDSYM(glsym_glXQueryDrawable, "glXQueryDrawable");
FINDSYM(glsym_glXQueryDrawable, "glXQueryDrawableEXT");
FINDSYM(glsym_glXQueryDrawable, "glXQueryDrawableARB");
#endif #endif
} }
@ -166,7 +181,8 @@ eng_setup(Evas *e, void *in)
info->info.colormap, info->info.colormap,
info->info.depth, info->info.depth,
e->output.w, e->output.w,
e->output.h); e->output.h,
info->indirect);
if (!re->win) if (!re->win)
{ {
free(re); free(re);
@ -252,7 +268,8 @@ eng_setup(Evas *e, void *in)
info->info.colormap, info->info.colormap,
info->info.depth, info->info.depth,
e->output.w, e->output.w,
e->output.h); e->output.h,
info->indirect);
} }
else if ((re->win->w != e->output.w) || else if ((re->win->w != e->output.w) ||
(re->win->h != e->output.h)) (re->win->h != e->output.h))
@ -436,11 +453,15 @@ eng_output_flush(void *data)
{ {
re->info->callback.pre_swap(re->info->callback.data, re->evas); re->info->callback.pre_swap(re->info->callback.data, re->evas);
} }
if ((re->win->draw.x1 == 0) && if ((1)
(re->win->draw.y1 == 0) && // (re->win->draw.x1 == 0) &&
(re->win->draw.x2 == (re->win->w - 1)) && // (re->win->draw.y1 == 0) &&
(re->win->draw.y2 == (re->win->h - 1))) // (re->win->draw.x2 == (re->win->w - 1)) &&
glXSwapBuffers(re->win->disp, re->win->win); // (re->win->draw.y2 == (re->win->h - 1))
)
{
glXSwapBuffers(re->win->disp, re->win->win);
}
else else
{ {
// FIXME: this doesnt work.. why oh why? // FIXME: this doesnt work.. why oh why?
@ -1071,10 +1092,8 @@ struct _Native
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
void *egl_surface; void *egl_surface;
#else #else
# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT void *fbc;
GLXFBConfig fbc; XID glx_pixmap;
GLXPixmap glx_pixmap;
# endif
#endif #endif
}; };
@ -1152,7 +1171,8 @@ _native_free_cb(void *data, void *image)
GLX_FRONT_LEFT_EXT); GLX_FRONT_LEFT_EXT);
} }
// printf("free glx pixmap %p\n", n->glx_pixmap); // printf("free glx pixmap %p\n", n->glx_pixmap);
glXDestroyPixmap(re->win->disp, n->glx_pixmap); if (glsym_glXDestroyPixmap)
glsym_glXDestroyPixmap(re->win->disp, n->glx_pixmap);
n->glx_pixmap = 0; n->glx_pixmap = 0;
} }
# endif # endif
@ -1335,32 +1355,37 @@ eng_image_native_set(void *data, void *image, void *native)
im->native.func.bind = _native_bind_cb; im->native.func.bind = _native_bind_cb;
im->native.func.unbind = _native_unbind_cb; im->native.func.unbind = _native_unbind_cb;
im->native.func.free = _native_free_cb; im->native.func.free = _native_free_cb;
n->glx_pixmap = glXCreatePixmap(re->win->disp, n->fbc, if (glsym_glXCreatePixmap)
n->pixmap, pixmap_att); n->glx_pixmap = glsym_glXCreatePixmap(re->win->disp, n->fbc,
n->pixmap, pixmap_att);
if (n->glx_pixmap)
{
// printf("new native texture for %x | %4i x %4i @ %2i = %p\n", // printf("new native texture for %x | %4i x %4i @ %2i = %p\n",
// pm, w, h, depth, n->glx_pixmap); // pm, w, h, depth, n->glx_pixmap);
if (!target) if (!target)
{ {
printf("no target :(\n"); printf("no target :(\n");
glXQueryDrawable(re->win->disp, n->pixmap, GLX_TEXTURE_TARGET_EXT, &target); if (glsym_glXQueryDrawable)
} glsym_glXQueryDrawable(re->win->disp, n->pixmap, GLX_TEXTURE_TARGET_EXT, &target);
if (target == GLX_TEXTURE_2D_EXT) }
{ if (target == GLX_TEXTURE_2D_EXT)
im->native.target = GL_TEXTURE_2D; {
im->native.mipmap = re->win->depth_cfg[depth].mipmap; im->native.target = GL_TEXTURE_2D;
} im->native.mipmap = re->win->depth_cfg[depth].mipmap;
}
#ifdef GL_TEXTURE_RECTANGLE_ARB #ifdef GL_TEXTURE_RECTANGLE_ARB
else if (target == GLX_TEXTURE_RECTANGLE_EXT) else if (target == GLX_TEXTURE_RECTANGLE_EXT)
{ {
im->native.target = GL_TEXTURE_RECTANGLE_ARB; im->native.target = GL_TEXTURE_RECTANGLE_ARB;
im->native.mipmap = 0; im->native.mipmap = 0;
} }
#endif #endif
else else
{ {
im->native.target = GL_TEXTURE_2D; im->native.target = GL_TEXTURE_2D;
im->native.mipmap = 0; im->native.mipmap = 0;
printf("still unknown target\n"); printf("still unknown target\n");
}
} }
evas_gl_common_image_native_enable(im); evas_gl_common_image_native_enable(im);

View File

@ -107,7 +107,7 @@ struct _Evas_GL_X11_Window
Evas_GL_X11_Window *eng_window_new(Display *disp, Window win, int screen, Evas_GL_X11_Window *eng_window_new(Display *disp, Window win, int screen,
Visual *vis, Colormap cmap, Visual *vis, Colormap cmap,
int depth, int w, int h); int depth, int w, int h, int indirect);
void eng_window_free(Evas_GL_X11_Window *gw); void eng_window_free(Evas_GL_X11_Window *gw);
void eng_window_use(Evas_GL_X11_Window *gw); void eng_window_use(Evas_GL_X11_Window *gw);
Visual *eng_best_visual_get(Display *disp, int screen); Visual *eng_best_visual_get(Display *disp, int screen);

View File

@ -20,7 +20,8 @@ eng_window_new(Display *disp,
Colormap cmap, Colormap cmap,
int depth, int depth,
int w, int w,
int h) int h,
int indirect)
{ {
Evas_GL_X11_Window *gw; Evas_GL_X11_Window *gw;
int context_attrs[3]; int context_attrs[3];
@ -138,7 +139,12 @@ eng_window_new(Display *disp,
// GLX // GLX
#else #else
if (!context) if (!context)
context = glXCreateContext(disp, gw->visualinfo, NULL, GL_TRUE); {
if (indirect)
context = glXCreateContext(disp, gw->visualinfo, NULL, GL_FALSE);
else
context = glXCreateContext(disp, gw->visualinfo, NULL, GL_TRUE);
}
gw->context = context; gw->context = context;
if (gw->context) if (gw->context)