i810_accel.c

来自「是由intel提供的针对intel显卡915以上系列的linux驱动」· C语言 代码 · 共 628 行 · 第 1/2 页

C
628
字号
      OUT_RING(pI810->bufferOffset +	       (y * pScrn->displayWidth + x) * pI810->cpp);      OUT_RING(pI810->BR[16]);      OUT_RING(0);			/* pad to quadword */      ADVANCE_LP_RING();   }}voidI810SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop,			       unsigned int planemask, int transparency_color){   I810Ptr pI810 = I810PTR(pScrn);   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)      ErrorF("I810SetupForScreenToScreenCopy %d %d %x %x %d\n",	     xdir, ydir, rop, planemask, transparency_color);   pI810->BR[13] = (pScrn->displayWidth * pI810->cpp);   if (ydir == -1)      pI810->BR[13] = (-pI810->BR[13]) & 0xFFFF;   if (xdir == -1)      pI810->BR[13] |= BR13_RIGHT_TO_LEFT;   pI810->BR[13] |= XAAGetCopyROP(rop) << 16;   pI810->BR[18] = 0;}voidI810SubsequentScreenToScreenCopy(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.     */#define I810_MWIDTH 8    if ( !(pI810->BR[13] & BR13_RIGHT_TO_LEFT) && (y2 - y1) < 3 	 && (y2 - y1) >= 0 && (x2 - x1) <= (w + I810_MWIDTH)	 && (w > I810_MWIDTH))	w = I810_MWIDTH;    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;	if (w_back > I810_MWIDTH)	    w = I810_MWIDTH;	else	    w = w_back;    }  while (1);}static voidI810SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int pattx, int patty,			       int fg, int bg, int rop,			       unsigned int planemask){   I810Ptr pI810 = I810PTR(pScrn);   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)      ErrorF("I810SetupFor8x8PatternColorExpand\n");   /* FULL_MONO_PAT_BLT, p176 */   pI810->BR[0] = (BR00_BITBLT_CLIENT | BR00_OP_MONO_PAT_BLT | 0x9);   pI810->BR[18] = bg;   pI810->BR[19] = fg;   pI810->BR[13] = (pScrn->displayWidth * pI810->cpp);   pI810->BR[13] |= XAAGetPatternROP(rop) << 16;   if (bg == -1)      pI810->BR[13] |= BR13_MONO_PATN_TRANS;}static voidI810SubsequentMono8x8PatternFillRect(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();   }}static voidI810GetNextScanlineColorExpandBuffer(ScrnInfoPtr pScrn){   I810Ptr pI810 = I810PTR(pScrn);   XAAInfoRecPtr infoPtr = pI810->AccelInfoRec;   if (pI810->nextColorExpandBuf == pI810->NumScanlineColorExpandBuffers)      I810Sync(pScrn);   infoPtr->ScanlineColorExpandBuffers[0] =	 pI810->ScanlineColorExpandBuffers[pI810->nextColorExpandBuf];   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)      ErrorF("using color expand buffer %d\n", pI810->nextColorExpandBuf);   pI810->nextColorExpandBuf++;}static voidI810SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,					       int fg, int bg, int rop,					       unsigned int planemask){   I810Ptr pI810 = I810PTR(pScrn);   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)      ErrorF("I810SetupForScanlineScreenToScreenColorExpand %d %d %x %x\n",	     fg, bg, rop, planemask);   pI810->BR[13] = (pScrn->displayWidth * pI810->cpp);   pI810->BR[13] |= XAAGetCopyROP(rop) << 16;   pI810->BR[13] |= (1 << 27);   if (bg == -1)      pI810->BR[13] |= BR13_MONO_TRANSPCY;   pI810->BR[18] = bg;   pI810->BR[19] = fg;   I810GetNextScanlineColorExpandBuffer(pScrn);}static voidI810SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,						 int x, int y,						 int w, int h, int skipleft){   I810Ptr pI810 = I810PTR(pScrn);   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)      ErrorF("I810SubsequentScanlineCPUToScreenColorExpandFill "	     "%d,%d %dx%x %d\n", x, y, w, h, skipleft);   pI810->BR[0] = BR00_BITBLT_CLIENT | BR00_OP_MONO_SRC_COPY_BLT | 0x06;   pI810->BR[9] = (pI810->bufferOffset +		   (y * pScrn->displayWidth + x) * pI810->cpp);   pI810->BR[14] = ((1 << 16) | (w * pI810->cpp));   pI810->BR[11] = ((w + 31) / 32) - 1;}static voidI810SubsequentColorExpandScanline(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);}voidI810EmitFlush(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();}voidI810SelectBuffer(ScrnInfoPtr pScrn, int buffer){   I810Ptr pI810 = I810PTR(pScrn);   switch (buffer) {   case I810_SELECT_BACK:      pI810->bufferOffset = pI810->BackBuffer.Start;      break;   case I810_SELECT_DEPTH:      pI810->bufferOffset = pI810->DepthBuffer.Start;      break;   default:   case I810_SELECT_FRONT:      pI810->bufferOffset = pI810->FrontBuffer.Start;      break;   }   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)      ErrorF("I810SelectBuffer %d --> offset %x\n",	     buffer, pI810->bufferOffset);}voidI810RefreshRing(ScrnInfoPtr pScrn){   I810Ptr pI810 = I810PTR(pScrn);   pI810->LpRing->head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR;   pI810->LpRing->tail = INREG(LP_RING + RING_TAIL);   pI810->LpRing->space = pI810->LpRing->head - (pI810->LpRing->tail + 8);   if (pI810->LpRing->space < 0)      pI810->LpRing->space += pI810->LpRing->mem.Size;   pI810->AccelInfoRec->NeedToSync = TRUE;}/* Emit on gaining VT? */voidI810EmitInvarientState(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();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?