Exemple #1
0
static void I810EnablePageFlip(ScreenPtr pScreen)
{
    ScrnInfoPtr         pScrn      = xf86ScreenToScrn(pScreen);
    I810Ptr       pI810       = I810PTR(pScrn);
    I810SAREAPtr  pSAREAPriv = DRIGetSAREAPrivate(pScreen);
    int cpp=2;
    pSAREAPriv->pf_enabled = pI810->allowPageFlip;
    pSAREAPriv->pf_active = 0;
    
   if (pI810->allowPageFlip) {
      unsigned int br13 = pI810->auxPitch | (0xcc << 16);
      
      BEGIN_LP_RING(6);

      OUT_RING(BR00_BITBLT_CLIENT | BR00_OP_SRC_COPY_BLT | 0x4);
      OUT_RING(br13);
      OUT_RING((pScrn->virtualY << 16) | (pScrn->virtualX*cpp));
      OUT_RING(pI810->BackBuffer.Start);
      OUT_RING(br13 & 0xFFFF);
      OUT_RING(0);
      ADVANCE_LP_RING();

      pSAREAPriv->pf_active = 1;
   }
   
}
static int i915_emit_irq(drm_device_t * dev)
{
	
	drm_i915_private_t *dev_priv = dev->dev_private;
	RING_LOCALS;

	i915_kernel_lost_context(dev);

	DRM_DEBUG("%s\n", __FUNCTION__);

	dev_priv->sarea_priv->last_enqueue = ++dev_priv->counter;

	if (dev_priv->counter > 0x7FFFFFFFUL)
		 dev_priv->sarea_priv->last_enqueue = dev_priv->counter = 1;

	BEGIN_LP_RING(6);
	OUT_RING(CMD_STORE_DWORD_IDX);
	OUT_RING(20);
	OUT_RING(dev_priv->counter);

	OUT_RING(0);
	OUT_RING(0);
	OUT_RING(GFX_OP_USER_INTERRUPT);
	ADVANCE_LP_RING();

	return dev_priv->counter;


}
Exemple #3
0
/* This should be done *before* XAA syncs or fires its buffer.
 * Otherwise will have to fire it again???
 */
static void I810DRIRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
{
    I810Ptr pI810 = I810PTR(pScrn);
    int i;
    I810SAREAPtr  pSAREAPriv = DRIGetSAREAPrivate(pScrn->pScreen);
    unsigned int br13;
    int cpp=2;

    
    /* Don't want to do this when no 3d is active and pages are
     * right-way-round
     */
    if (!pSAREAPriv->pf_active && pSAREAPriv->pf_current_page == 0)
      return;

    br13 = (pI810->auxPitch) | (0xcc << 16);
    
    for (i = 0 ; i < num ; i++, pbox++) {
      unsigned int w = min(pbox->y2, pScrn->virtualY-1) - max(pbox->y1, 0) + 1;
      unsigned int h = min(pbox->x2, pScrn->virtualX-1) - max(pbox->x1, 0) + 1;
      unsigned int dst = max(pbox->x1, 0)*cpp + (max(pbox->y1, 0)*pI810->auxPitch);
      
      BEGIN_LP_RING(6);

      OUT_RING(BR00_BITBLT_CLIENT | BR00_OP_SRC_COPY_BLT | 0x4);
      OUT_RING(br13);
      OUT_RING( (h<<16) | (w*cpp) );
      OUT_RING(pI810->BackBuffer.Start + dst);
      OUT_RING(br13 & 0xffff);
      OUT_RING(dst);

      ADVANCE_LP_RING();
    }

}
Exemple #4
0
static void
I810SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
{
   I810Ptr pI810 = I810PTR(pScrn);

   pI810->BR[12] = (pI810->AccelInfoRec->ScanlineColorExpandBuffers[0] -
		    pI810->FbBase);

   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
      ErrorF("I810SubsequentColorExpandScanline %d (addr %x)\n",
	     bufno, pI810->BR[12]);

   {
      BEGIN_LP_RING(8);
      OUT_RING(pI810->BR[0]);
      OUT_RING(pI810->BR[13]);
      OUT_RING(pI810->BR[14]);
      OUT_RING(pI810->BR[9]);
      OUT_RING(pI810->BR[11]);
      OUT_RING(pI810->BR[12]);		/* srcaddr */
      OUT_RING(pI810->BR[18]);
      OUT_RING(pI810->BR[19]);
      ADVANCE_LP_RING();
   }

   /* Advance to next scanline.
    */
   pI810->BR[9] += pScrn->displayWidth * pI810->cpp;
   I810GetNextScanlineColorExpandBuffer(pScrn);
}
Exemple #5
0
/* Emit on gaining VT?
 */
void
I810EmitInvarientState(ScrnInfoPtr pScrn)
{
   I810Ptr pI810 = I810PTR(pScrn);

   BEGIN_LP_RING(10);

   OUT_RING(INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE);
   OUT_RING(GFX_CMD_CONTEXT_SEL | CS_UPDATE_USE | CS_USE_CTX0);
   OUT_RING(INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE);
   OUT_RING(0);

   OUT_RING(GFX_OP_COLOR_CHROMA_KEY);
   OUT_RING(CC1_UPDATE_KILL_WRITE |
	    CC1_DISABLE_KILL_WRITE |
	    CC1_UPDATE_COLOR_IDX |
	    CC1_UPDATE_CHROMA_LOW | CC1_UPDATE_CHROMA_HI | 0);
   OUT_RING(0);
   OUT_RING(0);

/*     OUT_RING( CMD_OP_Z_BUFFER_INFO ); */
/*     OUT_RING( pI810->DepthBuffer.Start | pI810->auxPitchBits); */

   ADVANCE_LP_RING();
}
Exemple #6
0
static void
I810SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int pattx, int patty,
				     int x, int y, int w, int h)
{
   I810Ptr pI810 = I810PTR(pScrn);
   int addr =
	 pI810->bufferOffset + (y * pScrn->displayWidth + x) * pI810->cpp;

   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
      ErrorF("I810Subsequent8x8PatternColorExpand\n");

   {
      BEGIN_LP_RING(12);
      OUT_RING(pI810->BR[0] | ((y << 5) & BR00_PAT_VERT_ALIGN));
      OUT_RING(pI810->BR[13]);
      OUT_RING((h << 16) | (w * pI810->cpp));
      OUT_RING(addr);
      OUT_RING(pI810->BR[13] & 0xFFFF);	/* src pitch */
      OUT_RING(addr);			/* src addr */
      OUT_RING(0);			/* transparency color */
      OUT_RING(pI810->BR[18]);		/* bg */
      OUT_RING(pI810->BR[19]);		/* fg */
      OUT_RING(pattx);			/* pattern data */
      OUT_RING(patty);
      OUT_RING(0);
      ADVANCE_LP_RING();
   }
}
Exemple #7
0
void
I810Sync(ScrnInfoPtr pScrn)
{
   I810Ptr pI810 = I810PTR(pScrn);

   if (I810_DEBUG & (DEBUG_VERBOSE_ACCEL | DEBUG_VERBOSE_SYNC))
      ErrorF("I810Sync\n");

#ifdef XF86DRI
   /* VT switching tries to do this.  
    */
   if (!pI810->LockHeld && pI810->directRenderingEnabled) {
      return;
   }
#endif

   /* Send a flush instruction and then wait till the ring is empty.
    * This is stronger than waiting for the blitter to finish as it also
    * flushes the internal graphics caches.
    */
   {
      BEGIN_LP_RING(2);
      OUT_RING(INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE);
      OUT_RING(0);			/* pad to quadword */
      ADVANCE_LP_RING();
   }

   I810WaitLpRing(pScrn, pI810->LpRing.mem.Size - 8, 0);

   pI810->LpRing.space = pI810->LpRing.mem.Size - 8;
   pI810->nextColorExpandBuf = 0;
}
Exemple #8
0
void
I810SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1,
				 int x2, int y2, int w, int h)
{
    I810Ptr pI810 = I810PTR(pScrn);
    int src, dst;
    int w_back = w;

    if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
	ErrorF( "I810SubsequentScreenToScreenCopy %d,%d - %d,%d %dx%d\n",
		x1,y1,x2,y2,w,h);
    /* 
     * This works around a bug in the i810 drawing engine.
     * This was developed empirically so it may not catch all
     * cases.
     */
    if ( !(pI810->BR[13] & BR13_RIGHT_TO_LEFT) && (y2 - y1) < 3 
	 && (y2 - y1) >= 0 && (x2 - x1) <= (w + 4) && (w > 4))
	w = 4;
    do {

	if (pI810->BR[13] & BR13_PITCH_SIGN_BIT) {
	    src = (y1 + h - 1) * pScrn->displayWidth * pI810->cpp;
	    dst = (y2 + h - 1) * pScrn->displayWidth * pI810->cpp;
	} else {
	    src = y1 * pScrn->displayWidth * pI810->cpp;
	    dst = y2 * pScrn->displayWidth * pI810->cpp;
	}

	if (pI810->BR[13] & BR13_RIGHT_TO_LEFT) {
	    src += (x1 + w - 1) * pI810->cpp + pI810->cpp - 1;
	    dst += (x2 + w - 1) * pI810->cpp + pI810->cpp - 1;
	} else {
	    src += x1 * pI810->cpp;
	    dst += x2 * pI810->cpp;
	}


	/* SRC_COPY_BLT, p169 */
	{
	    BEGIN_LP_RING(6);
	    OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_SRC_COPY_BLT | 0x4 );
	    OUT_RING( pI810->BR[13]);

	    OUT_RING( (h << 16) | (w * pI810->cpp));
	    OUT_RING( pI810->bufferOffset + dst);

	    OUT_RING( pI810->BR[13] & 0xFFFF);
	    OUT_RING( pI810->bufferOffset + src);
	    ADVANCE_LP_RING();
	}
	w_back -= w;
	if (w_back <= 0)
	    break;
	x2 += w;
	x1 += w;
	w = w_back;
    }  while (1);
}
Exemple #9
0
void
I810EmitFlush(ScrnInfoPtr pScrn)
{
   I810Ptr pI810 = I810PTR(pScrn);

   BEGIN_LP_RING(2);
   OUT_RING(INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE);
   OUT_RING(0);
   ADVANCE_LP_RING();
}
Exemple #10
0
static int i830_emit_irq(struct drm_device * dev)
{
	drm_i830_private_t *dev_priv = dev->dev_private;
	RING_LOCALS;

	DRM_DEBUG("%s\n", __FUNCTION__);

	atomic_inc(&dev_priv->irq_emitted);

	BEGIN_LP_RING(2);
	OUT_RING(0);
	OUT_RING(GFX_OP_USER_INTERRUPT);
	ADVANCE_LP_RING();

	return atomic_read(&dev_priv->irq_emitted);
}
Exemple #11
0
static int i915_emit_irq(drm_device_t * dev)
{
	drm_i915_private_t *dev_priv = dev->dev_private;
	u32 ret;
	RING_LOCALS;

	i915_kernel_lost_context(dev);

	DRM_DEBUG("%s\n", __FUNCTION__);

	ret = dev_priv->counter;

	BEGIN_LP_RING(2);
	OUT_RING(0);
	OUT_RING(GFX_OP_USER_INTERRUPT);
	ADVANCE_LP_RING();

	return ret;
}
Exemple #12
0
void
I810SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
{
   I810Ptr pI810 = I810PTR(pScrn);

   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
      ErrorF("I810SubsequentFillRectSolid %d,%d %dx%d\n", x, y, w, h);

   {
      BEGIN_LP_RING(6);

      OUT_RING(BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3);
      OUT_RING(pI810->BR[13]);
      OUT_RING((h << 16) | (w * pI810->cpp));
      OUT_RING(pI810->bufferOffset +
	       (y * pScrn->displayWidth + x) * pI810->cpp);

      OUT_RING(pI810->BR[16]);
      OUT_RING(0);			/* pad to quadword */

      ADVANCE_LP_RING();
   }
}