i830_accel.c

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

C
793
字号
   pI830->BR[16] = color;   switch (pScrn->bitsPerPixel) {   case 8:      break;   case 16:      pI830->BR[13] |= (1 << 24);      break;   case 32:      pI830->BR[13] |= ((1 << 25) | (1 << 24));      break;   }}voidI830SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h){   I830Ptr pI830 = I830PTR(pScrn);   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)      ErrorF("I830SubsequentFillRectSolid %d,%d %dx%d\n", x, y, w, h);   {      BEGIN_LP_RING(6);      if (pScrn->bitsPerPixel == 32) {	 OUT_RING(COLOR_BLT_CMD | COLOR_BLT_WRITE_ALPHA |		  COLOR_BLT_WRITE_RGB);      } else {	 OUT_RING(COLOR_BLT_CMD);      }      OUT_RING(pI830->BR[13]);      OUT_RING((h << 16) | (w * pI830->cpp));      OUT_RING(pI830->bufferOffset + (y * pScrn->displayWidth + x) *	       pI830->cpp);      OUT_RING(pI830->BR[16]);      OUT_RING(0);      ADVANCE_LP_RING();   }}voidI830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop,			       unsigned int planemask, int transparency_color){   I830Ptr pI830 = I830PTR(pScrn);   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)      ErrorF("I830SetupForScreenToScreenCopy %d %d %x %x %d\n",	     xdir, ydir, rop, planemask, transparency_color);   pI830->BR[13] = (pScrn->displayWidth * pI830->cpp);   pI830->BR[13] |= XAAGetCopyROP(rop) << 16;   switch (pScrn->bitsPerPixel) {   case 8:      break;   case 16:      pI830->BR[13] |= (1 << 24);      break;   case 32:      pI830->BR[13] |= ((1 << 25) | (1 << 24));      break;   }}voidI830SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int src_x1, int src_y1,				 int dst_x1, int dst_y1, int w, int h){   I830Ptr pI830 = I830PTR(pScrn);   int dst_x2, dst_y2;   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)      ErrorF("I830SubsequentScreenToScreenCopy %d,%d - %d,%d %dx%d\n",	     src_x1, src_y1, dst_x1, dst_y1, w, h);   dst_x2 = dst_x1 + w;   dst_y2 = dst_y1 + h;   {      BEGIN_LP_RING(8);      if (pScrn->bitsPerPixel == 32) {	 OUT_RING(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |		  XY_SRC_COPY_BLT_WRITE_RGB);      } else {	 OUT_RING(XY_SRC_COPY_BLT_CMD);      }      OUT_RING(pI830->BR[13]);      OUT_RING((dst_y1 << 16) | (dst_x1 & 0xffff));      OUT_RING((dst_y2 << 16) | (dst_x2 & 0xffff));      OUT_RING(pI830->bufferOffset);      OUT_RING((src_y1 << 16) | (src_x1 & 0xffff));      OUT_RING(pI830->BR[13] & 0xFFFF);      OUT_RING(pI830->bufferOffset);      ADVANCE_LP_RING();   }}static voidI830SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int pattx, int patty,			       int fg, int bg, int rop,			       unsigned int planemask){   I830Ptr pI830 = I830PTR(pScrn);   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)      ErrorF("I830SetupForMono8x8PatternFill\n");   pI830->BR[16] = pattx;   pI830->BR[17] = patty;   pI830->BR[18] = bg;   pI830->BR[19] = fg;   pI830->BR[13] = (pScrn->displayWidth * pI830->cpp);	/* In bytes */   pI830->BR[13] |= XAAGetPatternROP(rop) << 16;   if (bg == -1)      pI830->BR[13] |= (1 << 28);   switch (pScrn->bitsPerPixel) {   case 8:      break;   case 16:      pI830->BR[13] |= (1 << 24);      break;   case 32:      pI830->BR[13] |= ((1 << 25) | (1 << 24));      break;   }}static voidI830SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int pattx, int patty,				     int x, int y, int w, int h){   I830Ptr pI830 = I830PTR(pScrn);   int x1, x2, y1, y2;   x1 = x;   x2 = x + w;   y1 = y;   y2 = y + h;   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)      ErrorF("I830SubsequentMono8x8PatternFillRect\n");   {      BEGIN_LP_RING(10);      if (pScrn->bitsPerPixel == 32) {	 OUT_RING(XY_MONO_PAT_BLT_CMD | XY_MONO_PAT_BLT_WRITE_ALPHA |		  XY_MONO_PAT_BLT_WRITE_RGB |		  ((patty << 8) & XY_MONO_PAT_VERT_SEED) |		  ((pattx << 12) & XY_MONO_PAT_HORT_SEED));      } else {	 OUT_RING(XY_MONO_PAT_BLT_CMD |		  ((patty << 8) & XY_MONO_PAT_VERT_SEED) |		  ((pattx << 12) & XY_MONO_PAT_HORT_SEED));      }      OUT_RING(pI830->BR[13]);      OUT_RING((y1 << 16) | x1);      OUT_RING((y2 << 16) | x2);      OUT_RING(pI830->bufferOffset);      OUT_RING(pI830->BR[18]);		/* bg */      OUT_RING(pI830->BR[19]);		/* fg */      OUT_RING(pI830->BR[16]);		/* pattern data */      OUT_RING(pI830->BR[17]);      OUT_RING(0);      ADVANCE_LP_RING();   }}static voidI830GetNextScanlineColorExpandBuffer(ScrnInfoPtr pScrn){   I830Ptr pI830 = I830PTR(pScrn);   XAAInfoRecPtr infoPtr = pI830->AccelInfoRec;   if (pI830->nextColorExpandBuf == pI830->NumScanlineColorExpandBuffers)      I830Sync(pScrn);   infoPtr->ScanlineColorExpandBuffers[0] =	 pI830->ScanlineColorExpandBuffers[pI830->nextColorExpandBuf];   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)      ErrorF("using color expand buffer %d\n", pI830->nextColorExpandBuf);   pI830->nextColorExpandBuf++;}static voidI830SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,					       int fg, int bg, int rop,					       unsigned int planemask){   I830Ptr pI830 = I830PTR(pScrn);   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)      ErrorF("I830SetupForScanlineScreenToScreenColorExpand %d %d %x %x\n",	     fg, bg, rop, planemask);   /* Fill out register values */   pI830->BR[13] = (pScrn->displayWidth * pI830->cpp);   pI830->BR[13] |= XAAGetCopyROP(rop) << 16;   if (bg == -1)      pI830->BR[13] |= (1 << 29);   switch (pScrn->bitsPerPixel) {   case 8:      break;   case 16:      pI830->BR[13] |= (1 << 24);      break;   case 32:      pI830->BR[13] |= ((1 << 25) | (1 << 24));      break;   }   pI830->BR[18] = bg;   pI830->BR[19] = fg;   I830GetNextScanlineColorExpandBuffer(pScrn);}static voidI830SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,						 int x, int y,						 int w, int h, int skipleft){   I830Ptr pI830 = I830PTR(pScrn);   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)      ErrorF("I830SubsequentScanlineCPUToScreenColorExpandFill "	     "%d,%d %dx%x %d\n", x, y, w, h, skipleft);   /* Fill out register values */   pI830->BR[9] = (pI830->bufferOffset +		   (y * pScrn->displayWidth + x) * pI830->cpp);   pI830->BR[11] = ((1 << 16) | w);}static voidI830SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno){   I830Ptr pI830 = I830PTR(pScrn);   if (pI830->init == 0) {      pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] -		       pI830->FbBase);   } else {      I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);      /* We have to use the primary screen's FbBase, as that's where       * we allocated Scratch2, so we get the correct pointer */      pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] -		       pI8301->FbBase);   }   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)      ErrorF("I830SubsequentColorExpandScanline %d (addr %x)\n",	     bufno, pI830->BR[12]);   {      BEGIN_LP_RING(8);      if (pScrn->bitsPerPixel == 32) {	 OUT_RING(XY_MONO_SRC_BLT_CMD | XY_MONO_SRC_BLT_WRITE_ALPHA |		  XY_MONO_SRC_BLT_WRITE_RGB);      } else {	 OUT_RING(XY_MONO_SRC_BLT_CMD);      }      OUT_RING(pI830->BR[13]);      OUT_RING(0);			/* x1 = 0, y1 = 0 */      OUT_RING(pI830->BR[11]);		/* x2 = w, y2 = 1 */      OUT_RING(pI830->BR[9]);		/* dst addr */      OUT_RING(pI830->BR[12]);		/* src addr */      OUT_RING(pI830->BR[18]);		/* bg */      OUT_RING(pI830->BR[19]);		/* fg */      ADVANCE_LP_RING();   }   /* Advance to next scanline.    */   pI830->BR[9] += pScrn->displayWidth * pI830->cpp;   I830GetNextScanlineColorExpandBuffer(pScrn);}#if DO_SCANLINE_IMAGE_WRITEstatic voidI830SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop,			       unsigned int planemask, int trans_color,			       int bpp, int depth){   I830Ptr pI830 = I830PTR(pScrn);   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)      ErrorF("I830SetupForScanlineImageWrite %x %x\n", rop, planemask);   /* Fill out register values */   pI830->BR[13] = (pScrn->displayWidth * pI830->cpp);   pI830->BR[13] |= XAAGetCopyROP(rop) << 16;   switch (pScrn->bitsPerPixel) {   case 8:      break;   case 16:      pI830->BR[13] |= (1 << 24);      break;   case 32:      pI830->BR[13] |= ((1 << 25) | (1 << 24));      break;   }   I830GetNextScanlineColorExpandBuffer(pScrn);}static voidI830SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int x, int y,				     int w, int h, int skipleft){   I830Ptr pI830 = I830PTR(pScrn);   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)      ErrorF("I830SubsequentScanlineImageWriteRect "	     "%d,%d %dx%x %d\n", x, y, w, h, skipleft);   /* Fill out register values */   pI830->BR[9] = (pI830->bufferOffset +		   (y * pScrn->displayWidth + x) * pI830->cpp);   pI830->BR[11] = ((1 << 16) | w);}static voidI830SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno){   I830Ptr pI830 = I830PTR(pScrn);   if (pI830->init == 0) {      pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] -		       pI830->FbBase);   } else {      I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);      /* We have to use the primary screen's FbBase, as that's where       * we allocated Scratch2, so we get the correct pointer */      pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] -		       pI8301->FbBase);   }   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)      ErrorF("I830SubsequentImageWriteScanline %d (addr %x)\n",	     bufno, pI830->BR[12]);   {      BEGIN_LP_RING(8);      if (pScrn->bitsPerPixel == 32) {	 OUT_RING(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |		  XY_SRC_COPY_BLT_WRITE_RGB);      } else {	 OUT_RING(XY_SRC_COPY_BLT_CMD);      }      OUT_RING(pI830->BR[13]);      OUT_RING(0);			/* x1 = 0, y1 = 0 */      OUT_RING(pI830->BR[11]);		/* x2 = w, y2 = 1 */      OUT_RING(pI830->BR[9]);		/* dst addr */      OUT_RING(0);			/* source origin (0,0) */      OUT_RING(pI830->BR[11] & 0xffff);	/* source pitch */      OUT_RING(pI830->BR[12]);		/* src addr */      ADVANCE_LP_RING();   }   /* Advance to next scanline.    */   pI830->BR[9] += pScrn->displayWidth * pI830->cpp;   I830GetNextScanlineColorExpandBuffer(pScrn);}#endif/* Support for multiscreen */static voidI830RestoreAccelState(ScrnInfoPtr pScrn){#if 0   /* might be needed, but everything is on a ring, so I don't think so */   I830Sync(pScrn);#endif}

⌨️ 快捷键说明

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