diff options
Diffstat (limited to 'src/radeon_driver.c')
-rw-r--r-- | src/radeon_driver.c | 186 |
1 files changed, 0 insertions, 186 deletions
diff --git a/src/radeon_driver.c b/src/radeon_driver.c index 3e39b4b5..599d07d4 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -103,189 +103,3 @@ #include "atipciids.h" -extern _X_EXPORT int gRADEONEntityIndex; - -static int getRADEONEntityIndex(void) -{ - return gRADEONEntityIndex; -} - -RADEONEntPtr RADEONEntPriv(ScrnInfoPtr pScrn) -{ - DevUnion *pPriv; - RADEONInfoPtr info = RADEONPTR(pScrn); - pPriv = xf86GetEntityPrivate(info->pEnt->index, - getRADEONEntityIndex()); - return pPriv->ptr; -} - -/* Allocate our private RADEONInfoRec */ -Bool RADEONGetRec(ScrnInfoPtr pScrn) -{ - if (pScrn->driverPrivate) return TRUE; - - pScrn->driverPrivate = xnfcalloc(sizeof(RADEONInfoRec), 1); - return TRUE; -} - -/* Free our private RADEONInfoRec */ -void RADEONFreeRec(ScrnInfoPtr pScrn) -{ - RADEONInfoPtr info; - - if (!pScrn || !pScrn->driverPrivate) return; - - info = RADEONPTR(pScrn); - - if (info->accel_state) { - free(info->accel_state); - info->accel_state = NULL; - } - - free(pScrn->driverPrivate); - pScrn->driverPrivate = NULL; -} - -/* This is called by RADEONPreInit to set up the default visual */ -Bool RADEONPreInitVisual(ScrnInfoPtr pScrn) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - - if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support32bppFb)) - return FALSE; - - switch (pScrn->depth) { - case 8: - case 15: - case 16: - case 24: - break; - - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Given depth (%d) is not supported by %s driver\n", - pScrn->depth, RADEON_DRIVER_NAME); - return FALSE; - } - - xf86PrintDepthBpp(pScrn); - - info->pix24bpp = xf86GetBppFromDepth(pScrn, - pScrn->depth); - info->pixel_bytes = pScrn->bitsPerPixel / 8; - - if (info->pix24bpp == 24) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Radeon does NOT support 24bpp\n"); - return FALSE; - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Pixel depth = %d bits stored in %d byte%s (%d bpp pixmaps)\n", - pScrn->depth, - info->pixel_bytes, - info->pixel_bytes > 1 ? "s" : "", - info->pix24bpp); - - if (!xf86SetDefaultVisual(pScrn, -1)) return FALSE; - - if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Default visual (%s) is not supported at depth %d\n", - xf86GetVisualName(pScrn->defaultVisual), pScrn->depth); - return FALSE; - } - return TRUE; -} - -/* This is called by RADEONPreInit to handle all color weight issues */ -Bool RADEONPreInitWeight(ScrnInfoPtr pScrn) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - - /* Save flag for 6 bit DAC to use for - setting CRTC registers. Otherwise use - an 8 bit DAC, even if xf86SetWeight sets - pScrn->rgbBits to some value other than - 8. */ - info->dac6bits = FALSE; - - if (pScrn->depth > 8) { - rgb defaultWeight = { 0, 0, 0 }; - - if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) return FALSE; - } else { - pScrn->rgbBits = 8; - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %d bits per RGB (%d bit DAC)\n", - pScrn->rgbBits, info->dac6bits ? 6 : 8); - - return TRUE; -} - -Bool -RADEONZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name) -{ - int i = 0; - char s1[20]; - - do { - switch(*s) { - case ',': - s1[i] = '\0'; - i = 0; - if (strcmp(s1, output_name) == 0) - return TRUE; - break; - case ' ': - case '\t': - case '\n': - case '\r': - break; - default: - s1[i] = *s; - i++; - break; - } - } while(*s++); - - s1[i] = '\0'; - if (strcmp(s1, output_name) == 0) - return TRUE; - - return FALSE; -} - -#ifdef X_XF86MiscPassMessage -Bool RADEONHandleMessage(int scrnIndex, const char* msgtype, - const char* msgval, char** retmsg) -{ - ErrorF("RADEONHandleMessage(%d, \"%s\", \"%s\", retmsg)\n", scrnIndex, - msgtype, msgval); - *retmsg = ""; - return 0; -} -#endif - -#ifndef HAVE_XF86MODEBANDWIDTH -/** Calculates the memory bandwidth (in MiB/sec) of a mode. */ -_X_HIDDEN unsigned int -xf86ModeBandwidth(DisplayModePtr mode, int depth) -{ - float a_active, a_total, active_percent, pixels_per_second; - int bytes_per_pixel = (depth + 7) / 8; - - if (!mode->HTotal || !mode->VTotal || !mode->Clock) - return 0; - - a_active = mode->HDisplay * mode->VDisplay; - a_total = mode->HTotal * mode->VTotal; - active_percent = a_active / a_total; - pixels_per_second = active_percent * mode->Clock * 1000.0; - - return (unsigned int)(pixels_per_second * bytes_per_pixel / (1024 * 1024)); -} -#endif - |