示例#1
0
static __GLXDRIdrawable *dri2CreateDrawable(__GLXscreenConfigs *psc,
					    XID xDrawable,
					    GLXDrawable drawable,
					    const __GLcontextModes *modes)
{
    __GLXDRIdrawablePrivate *pdraw;
    __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;

    pdraw = Xmalloc(sizeof(*pdraw));
    if (!pdraw)
	return NULL;

    pdraw->base.destroyDrawable = dri2DestroyDrawable;
    pdraw->base.xDrawable = xDrawable;
    pdraw->base.drawable = drawable;
    pdraw->base.psc = psc;
    pdraw->bufferCount = 0;

    DRI2CreateDrawable(psc->dpy, xDrawable);

    /* Create a new drawable */
    pdraw->base.driDrawable =
	(*psc->dri2->createNewDrawable)(psc->__driScreen,
					config->driConfig, pdraw);

    if (!pdraw->base.driDrawable) {
	DRI2DestroyDrawable(psc->dpy, drawable);
	Xfree(pdraw);
	return NULL;
    }

    return &pdraw->base;
}
示例#2
0
static void dri2DestroyDrawable(__GLXDRIdrawable *pdraw)
{
    const __DRIcoreExtension *core = pdraw->psc->core;

    (*core->destroyDrawable)(pdraw->driDrawable);
    DRI2DestroyDrawable(pdraw->psc->dpy, pdraw->drawable);
    Xfree(pdraw);
}
示例#3
0
/**
 * Create/Destroy the DRI drawable.
 */
void
x11_drawable_enable_dri2(struct x11_screen *xscr,
                         Drawable drawable, boolean on)
{
   if (on)
      DRI2CreateDrawable(xscr->dpy, drawable);
   else
      DRI2DestroyDrawable(xscr->dpy, drawable);
}
示例#4
0
static __GLXDRIdrawable *
dri2CreateDrawable(__GLXscreenConfigs * psc,
                   XID xDrawable,
                   GLXDrawable drawable, const __GLcontextModes * modes)
{
    __GLXDRIdrawablePrivate *pdraw;
    __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
    __GLXdisplayPrivate *dpyPriv;
    __GLXDRIdisplayPrivate *pdp;

    pdraw = Xmalloc(sizeof(*pdraw));
    if (!pdraw)
        return NULL;

    pdraw->base.destroyDrawable = dri2DestroyDrawable;
    pdraw->base.xDrawable = xDrawable;
    pdraw->base.drawable = drawable;
    pdraw->base.psc = psc;
    pdraw->bufferCount = 0;
    pdraw->swap_interval = 1;
    pdraw->have_back = 0;

    DRI2CreateDrawable(psc->dpy, xDrawable);

    dpyPriv = __glXInitialize(psc->dpy);
    pdp = (__GLXDRIdisplayPrivate *)dpyPriv->dri2Display;;
    /* Create a new drawable */
    pdraw->base.driDrawable =
        (*psc->dri2->createNewDrawable) (psc->__driScreen,
                                         config->driConfig, pdraw);

    if (!pdraw->base.driDrawable) {
        DRI2DestroyDrawable(psc->dpy, xDrawable);
        Xfree(pdraw);
        return NULL;
    }

#ifdef X_DRI2SwapInterval
    /*
     * Make sure server has the same swap interval we do for the new
     * drawable.
     */
    if (pdp->swapAvailable)
        DRI2SwapInterval(psc->dpy, xDrawable, pdraw->swap_interval);
#endif

    return &pdraw->base;
}
void ephyrDRI2DestroyDrawable(XID drawable)
{
    Display *dpy = hostx_get_display ();
    DRI2DestroyDrawable(dpy, drawable);
}