Ejemplo n.º 1
0
/**
 * This function takes both a read buffer and a draw buffer.  This is needed
 * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent
 * function.
 */
static int driBindContext(__DRIcontext *pcp,
			  __DRIdrawable *pdp,
			  __DRIdrawable *prp)
{
    /*
    ** Assume error checking is done properly in glXMakeCurrent before
    ** calling driUnbindContext.
    */

    if (!pcp)
	return GL_FALSE;

    /* Bind the drawable to the context */
    pcp->driDrawablePriv = pdp;
    pcp->driReadablePriv = prp;
    if (pdp) {
	pdp->driContextPriv = pcp;
	dri_get_drawable(pdp);
    }
    if (prp && pdp != prp) {
	dri_get_drawable(prp);
    }

    return pcp->driScreenPriv->driver->MakeCurrent(pcp, pdp, prp);
}
Ejemplo n.º 2
0
static __DRIdrawable *
driCreateNewDrawable(__DRIscreen *screen,
                     const __DRIconfig *config,
                     void *data)
{
    __DRIdrawable *pdraw;

    assert(data != NULL);

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

    pdraw->loaderPrivate = data;

    pdraw->driScreenPriv = screen;
    pdraw->driContextPriv = NULL;
    pdraw->refcount = 0;
    pdraw->lastStamp = 0;
    pdraw->w = 0;
    pdraw->h = 0;

    dri_get_drawable(pdraw);

    if (!screen->driver->CreateBuffer(screen, pdraw, &config->modes,
                                      GL_FALSE)) {
       free(pdraw);
       return NULL;
    }

    pdraw->dri2.stamp = pdraw->lastStamp + 1;

    return pdraw;
}
Ejemplo n.º 3
0
static __DRIdrawable *
driCreateNewDrawable(__DRIscreen *psp,
		     const __DRIconfig *config, void *data)
{
    __DRIdrawable *pdp;

    pdp = CALLOC_STRUCT(__DRIdrawableRec);
    if (!pdp)
	return NULL;

    pdp->loaderPrivate = data;

    pdp->driScreenPriv = psp;
    pdp->driContextPriv = NULL;

    dri_get_drawable(pdp);

    if (!driDriverAPI.CreateBuffer(psp, pdp, &config->modes, GL_FALSE)) {
	FREE(pdp);
	return NULL;
    }

    pdp->lastStamp = 1; /* const */

    return pdp;
}
Ejemplo n.º 4
0
/**
 * This function takes both a read buffer and a draw buffer.  This is needed
 * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent
 * function.
 */
static int driBindContext(__DRIcontext *pcp,
                          __DRIdrawable *pdp,
                          __DRIdrawable *prp)
{
    __DRIscreen *psp = NULL;

    /*
    ** Assume error checking is done properly in glXMakeCurrent before
    ** calling driUnbindContext.
    */

    if (!pcp)
        return GL_FALSE;

    /* Bind the drawable to the context */
    psp = pcp->driScreenPriv;
    pcp->driDrawablePriv = pdp;
    pcp->driReadablePriv = prp;
    if (pdp) {
        pdp->driContextPriv = pcp;
        dri_get_drawable(pdp);
    }
    if (prp && pdp != prp) {
        dri_get_drawable(prp);
    }

    /*
    ** Now that we have a context associated with this drawable, we can
    ** initialize the drawable information if has not been done before.
    */

    if (!psp->dri2.enabled) {
        if (pdp && !pdp->pStamp) {
            DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
            __driUtilUpdateDrawableInfo(pdp);
            DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
        }
        if (prp && pdp != prp && !prp->pStamp) {
            DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
            __driUtilUpdateDrawableInfo(prp);
            DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
        }
    }

    /* Call device-specific MakeCurrent */
    return (*psp->DriverAPI.MakeCurrent)(pcp, pdp, prp);
}
Ejemplo n.º 5
0
static int driBindContext(__DRIcontext *pcp,
			  __DRIdrawable *pdp,
			  __DRIdrawable *prp)
{
    /* Bind the drawable to the context */
    if (pcp) {
	pcp->driDrawablePriv = pdp;
	pcp->driReadablePriv = prp;
	if (pdp) {
	    pdp->driContextPriv = pcp;
	    dri_get_drawable(pdp);
	}
	if (prp && pdp != prp) {
	    dri_get_drawable(prp);
	}
    }

    return driDriverAPI.MakeCurrent(pcp, pdp, prp);
}