Bool PSBDGAInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; PsbPtr pPsb = psbPTR(pScrn); PsbDevicePtr pDevice = pPsb->pDevice; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); int screen_buf = pDevice->fbSize; xf86_config->dga_address = (unsigned long)pDevice->fbMap; xf86_config->dga_stride = pScrn->displayWidth * (pScrn->bitsPerPixel >> 3); /* maxx = pScrn->virtualX; maxy = pScrn->virtualY; if( (pDevice->fbSize / (maxx * (pScrn->bitsPerPixel >> 3)) ) > maxy) maxy = pDevice->fbSize / (maxx * (pScrn->bitsPerPixel >> 3)); //xf86_config->dga_stride = maxx * (pScrn->bitsPerPixel >> 3); */ PSB_Calc_Maxxy( screen_buf/(pScrn->bitsPerPixel >> 3), &maxx, &maxy ); xf86_config->dga_width = maxx; xf86_config->dga_height = maxy; if (!xf86_dga_get_modes(pScreen)) return FALSE; return DGAInit(pScreen, &PSBDGAFuncs, pPsb->DGAModes, pPsb->numDGAModes); }
Bool SISDGAInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSiS = SISPTR(pScrn); int num = 0; pSiS->DGAModes = SISDGAMakeModes(pScrn, &num, FALSE); pSiS->numDGAModes = num; if(num) { if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA) || (pSiS->VGAEngine == SIS_530_VGA)) { return DGAInit(pScreen, &SISDGAFuncs3xx, pSiS->DGAModes, num); } else { return DGAInit(pScreen, &SISDGAFuncs, pSiS->DGAModes, num); } } else { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No DGA-suitable modes found, disabling DGA\n"); return TRUE; } }
Bool xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address) { ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86_config->dga_flags = 0; xf86_config->dga_address = dga_address; xf86_config->dga_width = scrn->virtualX; xf86_config->dga_height = scrn->virtualY; xf86_config->dga_stride = scrn->displayWidth * scrn->bitsPerPixel >> 3; if (!xf86_dga_get_modes (pScreen)) return FALSE; return DGAInit(pScreen, &xf86_dga_funcs, xf86_config->dga_modes, xf86_config->dga_nmode); }
Bool _xf86_di_dga_init_internal (ScreenPtr pScreen) { ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86_config->dga_flags = 0; xf86_config->dga_address = 0; xf86_config->dga_width = 0; xf86_config->dga_height = 0; xf86_config->dga_stride = 0; if (!xf86_dga_get_modes (pScreen)) return FALSE; return DGAInit(pScreen, &xf86_dga_funcs, xf86_config->dga_modes, xf86_config->dga_nmode); }
void FFB_InitDGA(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; FFBPtr pFfb; DGAModePtr mode; Bool result; pFfb = GET_FFB_FROM_SCRN(pScrn); mode = xnfcalloc(sizeof(DGAModeRec), 1); if (!mode) { xf86Msg(X_WARNING, "%s: DGA init failed, cannot alloc DGAMode.\n", pFfb->psdp->device); return; } mode->num = 0; mode->mode = pScrn->modes; /* Hmmm, what does concurrent access really mean? -DaveM */ mode->flags = (DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE | DGA_FILL_RECT); #ifdef USE_VIS mode->flags |= DGA_BLIT_RECT; #endif mode->imageWidth = 2048; mode->imageHeight = 2048; mode->pixmapWidth = 2048; mode->pixmapHeight = 2048; /* XXX I would imagine that this value states how many bytes * XXX you add to advance exactly one full horizontal line in * XXX the framebuffer addressing, but the way we set the pScrn * XXX mode values do not match that definition. * XXX * XXX Ask Jakub what is going on here. -DaveM */ #if 1 mode->bytesPerScanline = pScrn->modes->HDisplay * 4; #else mode->bytesPerScanline = (2048 * 4); #endif mode->byteOrder = pScrn->imageByteOrder; mode->depth = 32; mode->bitsPerPixel = 32; mode->red_mask = 0xff; mode->green_mask = 0xff00; mode->blue_mask = 0xff0000; mode->visualClass = TrueColor; mode->viewportWidth = pScrn->modes->HDisplay; mode->viewportHeight = pScrn->modes->VDisplay; /* Do these values even matter if we do not support * viewports? -DaveM */ mode->xViewportStep = 0; mode->yViewportStep = 0; mode->maxViewportX = 0; mode->maxViewportY = 0; mode->viewportFlags = 0; mode->offset = 0; result = DGAInit(pScreen, &FFB_DGAFuncs, mode, 1); if (result == FALSE) { xf86Msg(X_WARNING, "%s: DGA init failed, DGAInit returns FALSE.\n", pFfb->psdp->device); } else { xf86Msg(X_INFO, "%s: DGA support initialized.\n", pFfb->psdp->device); } }
Bool I810DGAInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I810Ptr pI810 = I810PTR(pScrn); DGAModePtr modes = NULL, newmodes = NULL, currentMode; DisplayModePtr pMode, firstMode; int Bpp = pScrn->bitsPerPixel >> 3; int num = 0; MARKER(); pMode = firstMode = pScrn->modes; while (pMode) { newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec)); if (!newmodes) { xfree(modes); return FALSE; } modes = newmodes; currentMode = modes + num; num++; currentMode->mode = pMode; currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; if (!pI810->noAccel) currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; if (pMode->Flags & V_DBLSCAN) currentMode->flags |= DGA_DOUBLESCAN; if (pMode->Flags & V_INTERLACE) currentMode->flags |= DGA_INTERLACED; currentMode->byteOrder = pScrn->imageByteOrder; currentMode->depth = pScrn->depth; currentMode->bitsPerPixel = pScrn->bitsPerPixel; currentMode->red_mask = pScrn->mask.red; currentMode->green_mask = pScrn->mask.green; currentMode->blue_mask = pScrn->mask.blue; currentMode->visualClass = (Bpp == 1) ? PseudoColor : TrueColor; currentMode->viewportWidth = pMode->HDisplay; currentMode->viewportHeight = pMode->VDisplay; currentMode->xViewportStep = (Bpp == 3) ? 2 : 1; currentMode->yViewportStep = 1; currentMode->viewportFlags = DGA_FLIP_RETRACE; currentMode->offset = 0; currentMode->address = pI810->FbBase; currentMode->bytesPerScanline = ((pScrn->displayWidth * Bpp) + 3) & ~3L; currentMode->imageWidth = pI810->FbMemBox.x2; currentMode->imageHeight = pI810->FbMemBox.y2; currentMode->pixmapWidth = currentMode->imageWidth; currentMode->pixmapHeight = currentMode->imageHeight; currentMode->maxViewportX = currentMode->imageWidth - currentMode->viewportWidth; /* this might need to get clamped to some maximum */ currentMode->maxViewportY = currentMode->imageHeight - currentMode->viewportHeight; pMode = pMode->next; if (pMode == firstMode) break; } pI810->numDGAModes = num; pI810->DGAModes = modes; return DGAInit(pScreen, &I810DGAFuncs, modes, num); }
/* * ATIDGAInit -- * * This function initialises the driver's support for the DGA extension. */ Bool ATIDGAInit ( ScreenPtr pScreen, ScrnInfoPtr pScreenInfo, ATIPtr pATI ) { #ifdef USE_XAA XAAInfoRecPtr pXAAInfo; #endif int flags; if (!pATI->nDGAMode) { /* Set up DGA callbacks */ pATI->ATIDGAFunctions.OpenFramebuffer = ATIDGAOpenFramebuffer; pATI->ATIDGAFunctions.SetMode = ATIDGASetMode; pATI->ATIDGAFunctions.SetViewport = ATIDGASetViewport; pATI->ATIDGAFunctions.GetViewport = ATIDGAGetViewport; flags = 0; #ifdef USE_XAA if ((pXAAInfo = pATI->pXAAInfo)) { pATI->ATIDGAFunctions.Sync = pXAAInfo->Sync; if (pXAAInfo->SetupForSolidFill && pXAAInfo->SubsequentSolidFillRect) { flags |= DGA_FILL_RECT; pATI->ATIDGAFunctions.FillRect = ATIDGAFillRect; } if (pXAAInfo->SetupForScreenToScreenCopy && pXAAInfo->SubsequentScreenToScreenCopy) { flags |= DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS; pATI->ATIDGAFunctions.BlitRect = ATIDGABlitRect; pATI->ATIDGAFunctions.BlitTransRect = ATIDGABlitTransRect; } } #endif if (!flags) flags = DGA_CONCURRENT_ACCESS; ATIDGAAddModes(pScreenInfo, pATI, flags, 8, 8, 0, 0, 0, PseudoColor); if ((pATI->Chip >= ATI_CHIP_264CT)) { ATIDGAAddModes(pScreenInfo, pATI, flags, 15, 16, 0x7C00U, 0x03E0U, 0x001FU, TrueColor); ATIDGAAddModes(pScreenInfo, pATI, flags, 16, 16, 0xF800U, 0x07E0U, 0x001FU, TrueColor); ATIDGAAddModes(pScreenInfo, pATI, flags, 24, 24, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, TrueColor); ATIDGAAddModes(pScreenInfo, pATI, flags, 24, 32, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, TrueColor); if (pATI->DAC != ATI_DAC_INTERNAL) /* Not first revision */ { ATIDGAAddModes(pScreenInfo, pATI, flags, 15, 16, 0x7C00U, 0x03E0U, 0x001FU, DirectColor); ATIDGAAddModes(pScreenInfo, pATI, flags, 16, 16, 0xF800U, 0x07E0U, 0x001FU, DirectColor); ATIDGAAddModes(pScreenInfo, pATI, flags, 24, 24, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, DirectColor); ATIDGAAddModes(pScreenInfo, pATI, flags, 24, 32, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, DirectColor); } } } return DGAInit(pScreen, &pATI->ATIDGAFunctions, pATI->pDGAMode, pATI->nDGAMode); }