xcb_generic_error_t *err;
xcb_glx_make_current_cookie_t curck;
xcb_glx_make_current_reply_t *currep;
+ xcb_visualid_t vis;
plugin_id = id;
d->context = xcb_generate_id(sc->dpy->conn);
ck = xcb_glx_create_context_checked(sc->dpy->conn, d->context,
- sc->overlay_visual, sc->num,
- XCB_NONE, TRUE);
+ sc->overlay_visual,
+ sc->num, XCB_NONE, GL_TRUE);
if ((err = xcb_request_check(sc->dpy->conn, ck))) {
printf("context creation failed\n");
display_error(sc->dpy, err);
xcb_glx_swap_buffers(sc->dpy->conn, d->context_tag, sc->overlay);
glClearColor(0.4, 0.4, 0.4, 1.0);
+ //glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ glDisable(GL_BLEND);
/*
glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
glEnable(GL_BLEND);
{
int s;
- assert(numprops > 14);
+ assert(numprops > 15);
/*
for (s = vis * numprops; s < vis*numprops + numprops; ++s)
uint32_t *props;
unsigned int i, nprops;
-/*
- static int config[] = {
- GLX_DEPTH_SIZE, 1,
- GLX_DOUBLEBUFFER,
- GLX_RGBA,
- XCB_NONE
- };
-*/
-
props = xcb_glx_get_visual_configs_property_list(rep);
nprops = rep->num_properties;
return ok;
}
-static uint32_t
-glxrender_fbconfig_info(uint32_t *props, int con, int numprops, uint32_t name)
-{
- int i;
-
- for (i = 0; i < numprops; ++i) {
- if (props[i*2 + con*numprops*2] == name)
- return props[i*2 + con*numprops*2 + 1];
- }
- return 0;
-}
-
static gboolean
glxrender_find_fb_config(d_screen_t *sc, data_t *d)
{
- xcb_glx_get_visual_configs_cookie_t vck;
- xcb_glx_get_visual_configs_reply_t *vrep;
- xcb_glx_get_fb_configs_cookie_t fbck;
- xcb_glx_get_fb_configs_reply_t *fbrep;
+ static const uint32_t drawable_tfp_attrs[] = {
+ GLX_CONFIG_CAVEAT, GLX_NONE,
+ GLX_DOUBLEBUFFER, FALSE,
+ GLX_DEPTH_SIZE, 0,
+ GLX_RED_SIZE, 1,
+ GLX_GREEN_SIZE, 1,
+ GLX_BLUE_SIZE, 1,
+ GLX_ALPHA_SIZE, 1,
+ GLX_RENDER_TYPE, GLX_RGBA_BIT,
+ GLX_BIND_TO_TEXTURE_RGBA_EXT, TRUE, /* For TextureFromPixmap */
+ XCB_NONE
+ };
xcb_depth_iterator_t depth_it;
- unsigned int i, nvprops, nfbprops;
- uint32_t *vprops, *fbprops;
- uint32_t db, stencil, depthsize;
-
- {
- static const uint32_t drawable_tfp_attrs[] = {
- GLX_CONFIG_CAVEAT, GLX_NONE,
- GLX_DOUBLEBUFFER, FALSE,
- GLX_DEPTH_SIZE, 0,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- GLX_ALPHA_SIZE, 1,
- GLX_RENDER_TYPE, GLX_RGBA_BIT,
- GLX_BIND_TO_TEXTURE_RGBA_EXT, TRUE, /* For TextureFromPixmap */
- XCB_NONE
- };
-
- d_glx_fb_config_t *fbcons;
- int i, numfb;
-
- fbcons = glxcompat_choose_fb_config(sc->dpy->conn, sc->num,
- drawable_tfp_attrs, &numfb);
- printf("found %d\n", numfb);
- if (fbcons) {
- for (i = 0; i < numfb; ++i) {
- uint32_t v;
- glxcompat_get_fb_config_attrib(fbcons[i], GLX_FBCONFIG_ID, &v);
- printf("GLX_FBCONFIG_ID %x\n", v);
- }
- free(fbcons);
- }
- exit(0);
- }
+ d_glx_fb_config_t *fbcons;
+ int numfb;
- vck = xcb_glx_get_visual_configs_unchecked(sc->dpy->conn, sc->num);
- vrep = xcb_glx_get_visual_configs_reply(sc->dpy->conn, vck, NULL);
- if (!vrep) return FALSE;
-
- fbck = xcb_glx_get_fb_configs(sc->dpy->conn, sc->num);
- fbrep = xcb_glx_get_fb_configs_reply(sc->dpy->conn, fbck, NULL);
- if (!fbrep) return FALSE;
-
- vprops = xcb_glx_get_visual_configs_property_list(vrep);
- nvprops = vrep->num_properties;
- fbprops = xcb_glx_get_fb_configs_property_list(fbrep);
- nfbprops = fbrep->num_properties;
+ fbcons = glxcompat_choose_fb_config(sc->dpy->conn, sc->num,
+ drawable_tfp_attrs, &numfb);
+ if (!fbcons) return FALSE;
memset(d->fbconfig, 0, (MAX_DEPTH + 1) * sizeof(d->fbconfig[0]));
- db = 32767;
- stencil = 32767;
- depthsize = 32767;
depth_it = xcb_screen_allowed_depths_iterator(sc->super);
for (; depth_it.rem; xcb_depth_next(&depth_it)) {
- uint32_t vid;
- int j;
- unsigned int k;
+ int j, k;
xcb_visualtype_t *visuals;
int nvisuals;
- vid = 0;
if (depth_it.data->depth > MAX_DEPTH) continue;
printf("looking for depth %d\n", depth_it.data->depth);
visuals = xcb_depth_visuals(depth_it.data);
nvisuals = xcb_depth_visuals_length(depth_it.data);
- /* pick the nicest visual for the depth */
- for (j = 0; j < nvisuals; ++j) {
- uint32_t val;
- /* find the visual's properties */
- for (k = 0; k < vrep->num_visuals; ++k)
- if (glxrender_visual_info(vprops, k, nvprops, GLX_VISUAL_ID)
- == visuals[j].visual_id)
- {
+ /* look for an fbconfig for this depth */
+ for (j = 0; j < numfb; ++j) {
+ uint32_t vid, fbid;
+ gboolean use;
+
+ //glxcompat_get_fb_config_attrib(fbcons[j], GLX_FBCONFIG_ID, &v);
+ //printf("trying fbconfig 0x%x\n", v);
+
+ glxcompat_get_fb_config_attrib(fbcons[j], GLX_VISUAL_ID, &vid);
+ glxcompat_get_fb_config_attrib(fbcons[j], GLX_FBCONFIG_ID, &fbid);
+
+ use = FALSE;
+ for (k = 0; k < nvisuals; ++k)
+ //if (vid == visuals[k].visual_id) {
+ if ((vid == 0x80 && depth_it.data->depth == 32) ||
+ vid == 0x59) {
+ use = TRUE;
break;
}
- if (k == vrep->num_visuals) continue;
-
- val = glxrender_visual_info(vprops, k, nvprops, GLX_USE_GL);
- if (!val) continue;
-
- val = glxrender_visual_info(vprops, k, nvprops, GLX_DOUBLEBUFFER);
- if (!val > db) continue;
- db = val;
-
- val = glxrender_visual_info(vprops, k, nvprops, GLX_STENCIL_SIZE);
- if (!val > stencil) continue;
- stencil = val;
-
- val = glxrender_visual_info(vprops, k, nvprops, GLX_DEPTH_SIZE);
- if (!val > depthsize) continue;
- depthsize = val;
-
- /* try this visual */
- vid = visuals[j].visual_id;
-
- /* look for an fbconfig for this visual */
- for (k = 0; k < fbrep->num_FB_configs; ++k) {
- uint32_t val;
-
- //printf("root visual 0x%x\n", sc->super.root_visual);
- //printf("overlay visual 0x%x\n", sc->overlay_visual);
-
- val = glxrender_fbconfig_info(fbprops, k, nfbprops,
- GLX_VISUAL_ID);
- //printf("x visual 0x%x\n", val);
- if (val != vid) continue;
-
- val = glxrender_fbconfig_info(fbprops, k, nfbprops,
- GLX_BIND_TO_TEXTURE_TARGETS_EXT);
- printf("BIND TO TARGETS %x\n", val);
-
- val = glxrender_fbconfig_info(fbprops, k, nfbprops,
- GLX_DOUBLEBUFFER);
- printf("dbl buffer %s\n", val ? "yes" : "no");
- if (val) continue;
-
- val = glxrender_fbconfig_info(fbprops, k, nfbprops,
- GLX_DEPTH_SIZE);
- printf("depth size %d\n", val);
-
- val = glxrender_fbconfig_info(fbprops, k, nfbprops,
- GLX_RED_SIZE);
- printf("red size %d\n", val);
- if (!val) continue;
-
- val = glxrender_fbconfig_info(fbprops, k, nfbprops,
- GLX_GREEN_SIZE);
- printf("green size %d\n", val);
- if (!val) continue;
-
- val = glxrender_fbconfig_info(fbprops, k, nfbprops,
- GLX_BLUE_SIZE);
- printf("blue size %d\n", val);
- if (!val) continue;
-
- val = glxrender_fbconfig_info(fbprops, k, nfbprops,
- GLX_ALPHA_SIZE);
- printf("alpha size %d\n", val);
- //if (depth_it.data->depth == 32 && !val) continue;
-
- val = glxrender_fbconfig_info(fbprops, j, nfbprops,
- GLX_RENDER_TYPE);
- printf("rgba bit %s\n", val & GLX_RGBA_BIT ? "yes" : "no");
- if (!(val & GLX_RGBA_BIT)) continue;
-
- val = glxrender_fbconfig_info(fbprops, j, nfbprops,
- GLX_CONFIG_CAVEAT);
- printf("caveat 0x%x\n", val);
-
- val = glxrender_fbconfig_info(fbprops, j, nfbprops,
- GLX_BIND_TO_TEXTURE_RGBA_EXT);
- printf("bind ext %s\n", val ? "yes" : "no");
- if (!val) continue;
-
- d->fbconfig[depth_it.data->depth] =
- glxrender_fbconfig_info(fbprops, i, nfbprops,
- GLX_FBCONFIG_ID);
- break;
- }
- if (d->fbconfig[depth_it.data->depth])
+ if (use) {
+ d->fbconfig[depth_it.data->depth] = fbid;
+
printf("found visual 0x%x fbconfig 0x%x for depth %d\n",
- vid, d->fbconfig[depth_it.data->depth],
- depth_it.data->depth);
+ vid, fbid, depth_it.data->depth);
+ break;
+ }
}
}
- free(vrep);
- free(fbrep);
+ free(fbcons);
return TRUE;
}
px = window_get_pixmap(w);
depth = window_get_depth(w);
- if (px && d->fbconfig[depth]) {
+ //printf("%x %d %x\n", px, depth, d->fbconfig[depth]);
+ if (px && !d->fbconfig[depth])
+ printf("no GL visual for depth %d\n", depth);
+ else if (px) {
wd->glpixmap = xcb_generate_id(w->sc->dpy->conn);
- printf("creating pixmap fbcon 0x%x\n", d->fbconfig[depth]);
-
- xcb_void_cookie_t ck =
- xcb_glx_create_pixmap_checked(w->sc->dpy->conn, w->sc->num,
- d->fbconfig[depth],
- px, wd->glpixmap,
- sizeof(attrs)/sizeof(attrs[0]),
- attrs);
- {
- xcb_generic_error_t *err;
- err = xcb_request_check(w->sc->dpy->conn, ck);
- if (err) {
- printf("error creating pixmap\n");
- display_error(w->sc->dpy, err);
- free(err);
- }
- }
+ printf("bind config 0x%x screen %d pixmap 0x%x glpixmap 0x%x "
+ "nattr %d\n",
+ d->fbconfig[depth], w->sc->num, px, wd->glpixmap,
+ sizeof(attrs)/sizeof(attrs[0]));
+ xcb_glx_create_pixmap(w->sc->dpy->conn, w->sc->num,
+ d->fbconfig[depth],
+ px, wd->glpixmap,
+ sizeof(attrs)/sizeof(attrs[0]),
+ attrs);
glBindTexture(GL_TEXTURE_2D, wd->texname);
wd = window_find_plugin_data(w, plugin_id);
- paint_shadow(w, d, wd, x, y, width, height, bwidth);
- paint_window(w, d, wd, opaque, x, y, width, height, bwidth);
+ //paint_shadow(w, d, wd, x, y, width, height, bwidth);
+ //paint_window(w, d, wd, opaque, x, y, width, height, bwidth);
}
}