コード例 #1
0
ファイル: radeon_lock.c プロジェクト: Ionic/nx-libs
static void r200RegainedLock(r200ContextPtr r200)
{
	__DRIdrawablePrivate *dPriv = r200->radeon.dri.drawable;
	int i;

	if (r200->radeon.lastStamp != dPriv->lastStamp) {
		radeonUpdatePageFlipping(&r200->radeon);
		R200_STATECHANGE(r200, ctx);
		r200->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] =
			r200->radeon.state.color.drawOffset
			+ r200->radeon.radeonScreen->fbLocation;
		r200->hw.ctx.cmd[CTX_RB3D_COLORPITCH] =
			r200->radeon.state.color.drawPitch;

		if (r200->radeon.glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
			radeonSetCliprects(&r200->radeon, GL_BACK_LEFT);
		else
			radeonSetCliprects(&r200->radeon, GL_FRONT_LEFT);
		r200UpdateViewportOffset(r200->radeon.glCtx);
		r200->radeon.lastStamp = dPriv->lastStamp;
	}

	for (i = 0; i < r200->nr_heaps; i++) {
		DRI_AGE_TEXTURES(r200->texture_heaps[i]);
	}
}
コード例 #2
0
ファイル: radeon_lock.c プロジェクト: Ionic/nx-libs
static void r300RegainedLock(radeonContextPtr radeon)
{
	__DRIdrawablePrivate *dPriv = radeon->dri.drawable;

	if (radeon->lastStamp != dPriv->lastStamp) {
		_mesa_resize_framebuffer(radeon->glCtx,
			(GLframebuffer*)dPriv->driverPrivate,
			dPriv->w, dPriv->h);

		radeonUpdatePageFlipping(radeon);

		if (radeon->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
			radeonSetCliprects(radeon, GL_BACK_LEFT);
		else
			radeonSetCliprects(radeon, GL_FRONT_LEFT);

		radeonUpdateScissor(radeon->glCtx);
		radeon->lastStamp = dPriv->lastStamp;
	}

#if R200_MERGED
	for (i = 0; i < r200->nr_heaps; i++) {
		DRI_AGE_TEXTURES(r200->texture_heaps[i]);
	}
#endif
}
コード例 #3
0
ファイル: radeon_context.c プロジェクト: toastpp/toastpp
/* Make context `c' the current context and bind it to the given
 * drawing and reading surfaces.
 */
GLboolean
radeonMakeCurrent( __DRIcontextPrivate *driContextPriv,
                   __DRIdrawablePrivate *driDrawPriv,
                   __DRIdrawablePrivate *driReadPriv )
{
   if ( driContextPriv ) {
      radeonContextPtr newCtx = 
	 (radeonContextPtr) driContextPriv->driverPrivate;

      if (RADEON_DEBUG & DEBUG_DRI)
	 fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *) newCtx->glCtx);

      newCtx->dri.readable = driReadPriv;

      if ( (newCtx->dri.drawable != driDrawPriv) ||
           newCtx->lastStamp != driDrawPriv->lastStamp ) {
	 if (driDrawPriv->swap_interval == (unsigned)-1) {
	    driDrawPriv->vblFlags = (newCtx->radeonScreen->irq != 0)
	       ? driGetDefaultVBlankFlags(&newCtx->optionCache)
	       : VBLANK_FLAG_NO_IRQ;

	    driDrawableInitVBlank( driDrawPriv );
	 }

	 newCtx->dri.drawable = driDrawPriv;

	 radeonSetCliprects(newCtx);
	 radeonUpdateViewportOffset( newCtx->glCtx );
      }

      _mesa_make_current( newCtx->glCtx,
			  (GLframebuffer *) driDrawPriv->driverPrivate,
			  (GLframebuffer *) driReadPriv->driverPrivate );

      _mesa_update_state( newCtx->glCtx );
   } else {
      if (RADEON_DEBUG & DEBUG_DRI)
	 fprintf(stderr, "%s ctx is null\n", __FUNCTION__);
      _mesa_make_current( NULL, NULL, NULL );
   }

   if (RADEON_DEBUG & DEBUG_DRI)
      fprintf(stderr, "End %s\n", __FUNCTION__);
   return GL_TRUE;
}
コード例 #4
0
ファイル: radeon_lock.c プロジェクト: connorimes/parsec-3.0
/* Update the hardware state.  This is called if another context has
 * grabbed the hardware lock, which includes the X server.  This
 * function also updates the driver's window state after the X server
 * moves, resizes or restacks a window -- the change will be reflected
 * in the drawable position and clip rects.  Since the X server grabs
 * the hardware lock when it changes the window state, this routine will
 * automatically be called after such a change.
 */
void radeonGetLock(radeonContextPtr rmesa, GLuint flags)
{
    __DRIdrawablePrivate *const drawable = rmesa->dri.drawable;
    __DRIdrawablePrivate *const readable = rmesa->dri.readable;
    __DRIscreenPrivate *sPriv = rmesa->dri.screen;
    drm_radeon_sarea_t *sarea = rmesa->sarea;
    r300ContextPtr r300 = (r300ContextPtr) rmesa;

    assert(drawable != NULL);

    drmGetLock(rmesa->dri.fd, rmesa->dri.hwContext, flags);

    /* The window might have moved, so we might need to get new clip
     * rects.
     *
     * NOTE: This releases and regrabs the hw lock to allow the X server
     * to respond to the DRI protocol request for new drawable info.
     * Since the hardware state depends on having the latest drawable
     * clip rects, all state checking must be done _after_ this call.
     */
    DRI_VALIDATE_DRAWABLE_INFO(sPriv, drawable);
    if (drawable != readable) {
        DRI_VALIDATE_DRAWABLE_INFO(sPriv, readable);
    }

    if (rmesa->lastStamp != drawable->lastStamp) {
        radeonUpdatePageFlipping(rmesa);
        radeonSetCliprects(rmesa);
        r300UpdateViewportOffset(rmesa->glCtx);
        driUpdateFramebufferSize(rmesa->glCtx, drawable);
    }

    if (sarea->ctx_owner != rmesa->dri.hwContext) {
        int i;

        sarea->ctx_owner = rmesa->dri.hwContext;
        for (i = 0; i < r300->nr_heaps; i++) {
            DRI_AGE_TEXTURES(r300->texture_heaps[i]);
        }
    }

    rmesa->lost_context = GL_TRUE;
}
コード例 #5
0
ファイル: radeon_lock.c プロジェクト: dikerex/theqvd
/* Update the hardware state.  This is called if another context has
 * grabbed the hardware lock, which includes the X server.  This
 * function also updates the driver's window state after the X server
 * moves, resizes or restacks a window -- the change will be reflected
 * in the drawable position and clip rects.  Since the X server grabs
 * the hardware lock when it changes the window state, this routine will
 * automatically be called after such a change.
 */
void radeonGetLock( radeonContextPtr rmesa, GLuint flags )
{
   __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
   __DRIscreenPrivate *sPriv = rmesa->dri.screen;
   RADEONSAREAPrivPtr sarea = rmesa->sarea;
   int i;

   drmGetLock( rmesa->dri.fd, rmesa->dri.hwContext, flags );

   /* The window might have moved, so we might need to get new clip
    * rects.
    *
    * NOTE: This releases and regrabs the hw lock to allow the X server
    * to respond to the DRI protocol request for new drawable info.
    * Since the hardware state depends on having the latest drawable
    * clip rects, all state checking must be done _after_ this call.
    */
   DRI_VALIDATE_DRAWABLE_INFO( rmesa->dri.display, sPriv, dPriv );

   if ( rmesa->lastStamp != dPriv->lastStamp ) {
      radeonUpdatePageFlipping( rmesa );
      radeonSetCliprects( rmesa, rmesa->glCtx->Color.DriverDrawBuffer );
      radeonUpdateViewportOffset( rmesa->glCtx );
      rmesa->lastStamp = dPriv->lastStamp;
   }

   if ( sarea->ctxOwner != rmesa->dri.hwContext ) {
      sarea->ctxOwner = rmesa->dri.hwContext;

      for ( i = 0 ; i < rmesa->texture.numHeaps ; i++ ) {
	 if ( rmesa->texture.heap[i] && sarea->texAge[i] != rmesa->texture.age[i] ) {
	    radeonAgeTextures( rmesa, i );
	 }
      }
   }
}