⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 s3.c

📁 基于组件方式开发操作系统的OSKIT源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
	       s3InfoRec.clock[j] /= 2;	       clocksChanged = TRUE;	       break;	    case 4:	       s3InfoRec.clock[j] /= 4;	       clocksChanged = TRUE;	       break;	    }	    break;	 case ATT20C498_DAC:	 case ATT22C498_DAC:	 case STG1700_DAC:	 case STG1703_DAC:	/* XXXX should this be here? */	    switch (s3Bpp) {	    case 1:	       if (!numClocksChanged) {		  newNumClocks = 32;		  numClocksChanged = TRUE;		  clocksChanged = TRUE;		  for(i = s3InfoRec.clocks; i < newNumClocks; i++)		     s3InfoRec.clock[i] = 0;  /* XXXX is clock[] initialized? */		  if (s3InfoRec.clocks > 16) 		     s3InfoRec.clocks = 16;	       }	       if (s3InfoRec.clock[j] * 2 > pixMuxMinClock &&		   s3InfoRec.clock[j] * 2 <= s3InfoRec.dacSpeeds[0])		  s3InfoRec.clock[j + 16] = s3InfoRec.clock[j] * 2;	       else		  s3InfoRec.clock[j + 16] = 0;	       if (s3InfoRec.clock[j] > nonMuxMaxClock)		  s3InfoRec.clock[j] = 0;	       break;	    case 2:	       /* No change for 16bpp */	       break;	    case 4:	       s3InfoRec.clock[j] /= 2;	       clocksChanged = TRUE;	       break;	    }	    break;	 case ATT20C490_DAC:	 case SS2410_DAC:	/* GUESSING!! (based on 490)  */	 case SC1148x_M2_DAC:	    if (s3Bpp > 1) {	       s3InfoRec.clock[j] /= s3Bpp;	       clocksChanged = TRUE;	    }	    break;	 case SC15025_DAC:	    if (s3Bpp > 1) {	       s3InfoRec.clock[j] /= s3Bpp;	       clocksChanged = TRUE;	    }	    break;	 case TI3025_DAC:	 case TI3026_DAC:	 case TI3030_DAC:	 case IBMRGB524_DAC:	 case IBMRGB525_DAC:	 case IBMRGB528_DAC:	 case S3_SDAC_DAC:	 case S3_GENDAC_DAC:	 case S3_TRIO32_DAC:	 case S3_TRIO64_DAC:	 case S3_TRIO64V2_DAC:	    /*	     * We should never get here since these have a programmable	     * clock built in.	     */	    break;	 default:	    /* Do nothing */	    break;	 }      }      if (numClocksChanged)	 s3InfoRec.clocks = newNumClocks;      if (xf86Verbose && clocksChanged) {	 ErrorF("%s %s: Effective pixel clocks available for depth %d:\n",		XCONFIG_PROBED, s3InfoRec.name, s3InfoRec.depth);	 for (j = 0; j < s3InfoRec.clocks; j++) {	    if ((j % 8) == 0) {	       if (j != 0)		  ErrorF("\n");               ErrorF("%s %s: pixel clocks:", XCONFIG_PROBED, s3InfoRec.name);	    }	    ErrorF(" %6.2f", (double)s3InfoRec.clock[j] / 1000.0);         }         ErrorF("\n");      }   }   /* At this point, the s3InfoRec.clock[] values are pixel clocks */	/***********************************************\	|	Set maxDisplayHeight and Width 		|	\***********************************************/   if (S3_911_SERIES(s3ChipId)) {      maxDisplayWidth = 1024;      maxDisplayHeight = 1024 - 1; /* Cursor takes exactly 1 line for 911 */   } else if ((OFLG_ISSET(OPTION_BT485_CURS, &s3InfoRec.options) &&	       DAC_IS_BT485_SERIES) ||	      (OFLG_ISSET(OPTION_TI3020_CURS, &s3InfoRec.options) &&	       DAC_IS_TI3020_SERIES) ||	      (OFLG_ISSET(OPTION_TI3026_CURS, &s3InfoRec.options) &&	       (DAC_IS_TI3026 || DAC_IS_TI3030)) ||	      (OFLG_ISSET(OPTION_IBMRGB_CURS, &s3InfoRec.options) &&	       DAC_IS_IBMRGB) ||	      OFLG_ISSET(OPTION_SW_CURSOR, &s3InfoRec.options)) {      maxDisplayWidth = 2048;      maxDisplayHeight = 4096;   } else {      maxDisplayWidth = 2048;      maxDisplayHeight = 4096 - 3; /* Cursor can take up to 3 lines */   }   if (s3InfoRec.virtualX > maxDisplayWidth) {      ErrorF("%s: Virtual width (%d) is too large.  Maximum is %d\n",	     s3InfoRec.name, s3InfoRec.virtualX, maxDisplayWidth);      xf86DisableIOPorts(s3InfoRec.scrnIndex);      return (FALSE);   }   if (s3InfoRec.virtualY > maxDisplayHeight) {      ErrorF("%s: Virtual height (%d) is too large.  Maximum is %d\n",	     s3InfoRec.name, s3InfoRec.virtualY, maxDisplayHeight);      xf86DisableIOPorts(s3InfoRec.scrnIndex);      return (FALSE);   } 	/*******************************\	|	Validate Modes		|	\*******************************/   if (pixMuxPossible && (s3InfoRec.videoRam > nonMuxMaxMemory))      pixMuxNeeded = TRUE;    lookupFlags = LOOKUP_DEFAULT;   TempVirtualX = s3InfoRec.virtualX;   TempVirtualY = s3InfoRec.virtualY;redo_mode_lookup:   OldPixMuxStatus = pixMuxNeeded;   pMode = s3InfoRec.modes;   if (pMode == NULL) {      ErrorF("No modes supplied in XF86Config\n");      xf86DisableIOPorts(s3InfoRec.scrnIndex);      return (FALSE);   }   pEnd = NULL;   do {      DisplayModePtr pModeSv;      pModeSv = pMode->next;          if (!xf86LookupMode(pMode, &s3InfoRec, lookupFlags)) {	 xf86DeleteMode(&s3InfoRec, pMode);      }       else {   	not_safe = FALSE;	if(s3ValidMode(pMode,TRUE,MODE_USED) != MODE_OK)	   xf86DeleteMode(&s3InfoRec, pMode);	else {	 /*	  * Successfully looked up this mode.  If pEnd isn't	  * initialized, set it to this mode.	  */	    if (pEnd == (DisplayModePtr) NULL)	       pEnd = pMode;	}   	not_safe = TRUE;      }       pMode = pModeSv;   } while (pMode != pEnd);   if(OldPixMuxStatus != pixMuxNeeded)   {   /* If the decision that pixel multiplexing is needed for all	modes has been made sometime within the above do loop (most 	likely due to !allowPixMuxSwitching), there is the possibility	that some modes returned MODE_OK before the constraint	of manditory pixel multiplexing was added. In this case	we should recheck all modes under the new constraint (MArk)*/	      ErrorF("%s %s: One or more modes require pixel multiplexing and\n",		 XCONFIG_PROBED, s3InfoRec.name);     ErrorF("\tthe hardware is incapable of switching between mux/non-mux\n");     ErrorF("\tmodes. All modes will be re-evaluated under the new "	   "constraint.\n");	     goto redo_mode_lookup;	   }   if ((TempVirtualX != s3InfoRec.virtualX) || 			(TempVirtualY != s3InfoRec.virtualY)) {      OFLG_CLR(XCONFIG_VIRTUAL,&s3InfoRec.xconfigFlag); 	/* These will never get overwritten if they were specified 		in the XF86Config file */      s3InfoRec.virtualX = TempVirtualX;      s3InfoRec.virtualY = TempVirtualY;   }   if (s3InfoRec.virtualX > maxDisplayWidth) {      ErrorF("%s: Virtual width (%d) is too large.  Maximum is %d\n",	     s3InfoRec.name, s3InfoRec.virtualX, maxDisplayWidth);      xf86DisableIOPorts(s3InfoRec.scrnIndex);      return (FALSE);   }   if (s3InfoRec.virtualY > maxDisplayHeight) {      ErrorF("%s: Virtual height (%d) is too large.  Maximum is %d\n",	     s3InfoRec.name, s3InfoRec.virtualY, maxDisplayHeight);      xf86DisableIOPorts(s3InfoRec.scrnIndex);      return (FALSE);   }    /*    *  If we had to delete a mode due to the inability to switch    *  between mux and non-mux modes, we favor the mux modes and    *  print a little message telling why we had to delete it. (MArk)    */   if (pixMuxPossible && pixMuxNeeded) {      if(!pixMuxWidthOK || !pixMuxInterlaceOK || !pixMuxClockOK)      {	 ErrorF("%s %s: Modes that require pixel multiplexing and modes\n"	  "\tthat can't use it are both present in the XF86Config file but\n"	  "\tthe hardware is incapable of switching between the two.\n",			XCONFIG_PROBED, s3InfoRec.name);	 ErrorF("\tModes that can't pixel multiplex are being sacrificed for\n"	  "the following reason(s):\n");      	        if (!pixMuxWidthOK) 	    ErrorF("\t\tWidth is too narrow for multiplexing (min = %d).\n",		pixMuxMinWidth);        if (!pixMuxInterlaceOK) 	    ErrorF("\t\tMultiplexing isn't possible for interlaced modes.\n");        if (!pixMuxClockOK) 	    ErrorF("\t\tClock is too low for multiplexing (min = %d).\n",		pixMuxMinClock);      }   }   /* s3ValidMode decided if s3UsingPixMux */   if (xf86Verbose && s3UsingPixMux)	ErrorF("%s %s: Operating RAMDAC in pixel multiplex mode\n",		   XCONFIG_PROBED, s3InfoRec.name);   /* pixmux on Bt485 requires use of Bt485's cursor */   if (((s3Bt485PixMux && s3UsingPixMux) ||	OFLG_ISSET(OPTION_STB_PEGASUS, &s3InfoRec.options) ||	OFLG_ISSET(OPTION_MIRO_MAGIC_S4, &s3InfoRec.options)) &&       !OFLG_ISSET(OPTION_BT485_CURS, &s3InfoRec.options)) {      OFLG_SET(OPTION_BT485_CURS, &s3InfoRec.options);      ErrorF("%s %s: Using hardware cursor from Bt485/20C505 RAMDAC\n",	     XCONFIG_PROBED, s3InfoRec.name);   }   if (DAC_IS_BT485_SERIES || DAC_IS_TI3020_SERIES || DAC_IS_TI3026         || DAC_IS_TI3030 || DAC_IS_IBMRGB) {      if (!OFLG_ISSET(OPTION_DAC_6_BIT, &s3InfoRec.options) || s3Bpp > 1)	 s3DAC8Bit = TRUE;      if (OFLG_ISSET(OPTION_SYNC_ON_GREEN, &s3InfoRec.options)) {	 s3DACSyncOnGreen = TRUE;	 if (xf86Verbose)	    ErrorF("%s %s: Putting RAMDAC into sync-on-green mode\n",		   XCONFIG_GIVEN, s3InfoRec.name);      }   }   if (DAC_IS_SC15025 || DAC_IS_ATT498 || DAC_IS_STG1700 || DAC_IS_ATT20C409) {      if (!OFLG_ISSET(OPTION_DAC_6_BIT, &s3InfoRec.options) || s3Bpp > 1)         s3DAC8Bit = TRUE;   }   if (DAC_IS_ATT490) {      if (OFLG_ISSET(OPTION_DAC_8_BIT, &s3InfoRec.options) || s3Bpp > 1)         s3DAC8Bit = TRUE;   }   if (OFLG_ISSET(OPTION_DAC_8_BIT, &s3InfoRec.options) && !s3DAC8Bit) {      ErrorF("%s %s: Option \"dac_8_bit\" not recognised for RAMDAC \"%s\"\n",	     XCONFIG_PROBED, s3InfoRec.name, s3InfoRec.ramdac);   }   if (xf86Verbose) {      if (s3InfoRec.bitsPerPixel == 8)	 ErrorF("%s %s: Using %d bits per RGB value\n",		OFLG_ISSET(OPTION_DAC_8_BIT, &s3InfoRec.options) ||		OFLG_ISSET(OPTION_DAC_6_BIT, &s3InfoRec.options) ?		XCONFIG_GIVEN : XCONFIG_PROBED, s3InfoRec.name,		s3DAC8Bit ?  8 : 6);      else if (s3InfoRec.bitsPerPixel == 16)	 ErrorF("%s %s: Using 16 bpp.  Color weight: %1d%1d%1d\n",		XCONFIG_GIVEN, s3InfoRec.name, xf86weight.red,		xf86weight.green, xf86weight.blue);      else if (xf86bpp == 24)	 ErrorF("%s %s: Using packed 24 bpp.  Color weight: %1d%1d%1d\n",		XCONFIG_GIVEN, s3InfoRec.name, xf86weight.red,		xf86weight.green, xf86weight.blue);      else if (s3InfoRec.bitsPerPixel == 32)	 ErrorF("%s %s: Using sparse 32 bpp.  Color weight: %1d%1d%1d\n",		XCONFIG_GIVEN, s3InfoRec.name, xf86weight.red,		xf86weight.green, xf86weight.blue);   }	/*******************************************************\   	|	Select the appropriate logical line width 	|	\*******************************************************/   if (s3UsingPixMux && pixMuxLimitedWidths) {      if (s3InfoRec.virtualX <= 1024) {	 s3DisplayWidth = 1024;      } else if (s3InfoRec.virtualX <= 2048) {	 s3DisplayWidth = 2048;      } else { /* should never get here */	 ErrorF("Internal error in DisplayWidth check, virtual width = %d\n",	        s3InfoRec.virtualX);	 xf86DisableIOPorts(s3InfoRec.scrnIndex);	 return (FALSE);      }   } else if (S3_911_SERIES(s3ChipId)) {      s3DisplayWidth = 1024;   } else {      if (s3InfoRec.virtualX <= 640) {	 s3DisplayWidth = 640;      } else if (s3InfoRec.virtualX <= 800) {	 s3DisplayWidth = 800;      } else if (s3InfoRec.virtualX <= 1024) {	 s3DisplayWidth = 1024;      } else if ((s3InfoRec.virtualX <= 1152) &&		 (   S3_801_REV_C(s3ChipId)                   || S3_805_I_SERIES(s3ChipId)		  || S3_928_REV_E(s3ChipId)		  || S3_x64_SERIES(s3ChipId))) {	 s3DisplayWidth = 1152;      } else if (s3InfoRec.virtualX <= 1280) {	 s3DisplayWidth = 1280;      } else if ((s3InfoRec.virtualX <= 1600) && 		 ((S3_928_REV_E(s3ChipId) &&		   !(OFLG_ISSET(OPTION_NUMBER_NINE, &s3InfoRec.options) &&		     (s3Bpp == 1)))		  || S3_x64_SERIES(s3ChipId))) {	 s3DisplayWidth = 1600;      } else if (s3InfoRec.virtualX <= 2048) {	 s3DisplayWidth = 2048;      } else { /* should never get here */	 ErrorF("Internal error in DisplayWidth check, virtual width = %d\n",	        s3InfoRec.virtualX);	 xf86DisableIOPorts(s3InfoRec.scrnIndex);	 return (FALSE);      }   }   s3BppDisplayWidth = s3Bpp * s3DisplayWidth;   /*    * Work out where to locate S3's HW cursor storage.  It must be on a    * 1k boundary.  When using a RAMDAC cursor, set s3CursorStartY    * and s3CursorLines appropriately for the memory usage calculation below    */   if (OFLG_ISSET(OPTION_BT485_CURS, &s3InfoRec.options) ||       OFLG_ISSET(OPTION_TI3020_CURS, &s3InfoRec.options) ||       OFLG_ISSET(OPTION_TI3026_CURS, &s3InfoRec.options) ||       OFLG_ISSET(OPTION_IBMRGB_CURS, &s3InfoRec.options) ||       OFLG_ISSET(OPTION_SW_CURSOR, &s3InfoRec.options)) {      s3CursorStartY = s3InfoRec.virtualY;      s3CursorLines = 0;   } else {      int st_addr = (s3InfoRec.virtualY * s3BppDisplayWidth + 1023) & ~1023;      s3CursorStartX = st_addr % s3BppDisplayWidth;      s3CursorStartY = st_addr / s3BppDisplayWidth;      s3CursorLines = ((s3CursorStartX + 1023) / s3BppDisplayWidth) + 1;   }   /*    * Reduce the videoRam value if necessary to prevent Y coords exceeding    * the 12-bit (4096) limit when small display widths are used on cards    * with a lot of memory    */   if (s3InfoRec.videoRam * 1024 / s3BppDisplayWidth > 4096) {      s3InfoRec.videoRam = s3BppDisplayWidth * 4096 / 1024;      ErrorF("%s %s: videoram usage reduced to %dk to avoid co-ord overflow\n",	     XCONFIG_PROBED, s3InfoRec.name, s3InfoRec.videoRam);   }     /*    * This one is difficult to deal with by deleting modes.  Do you delete    * modes to reduce the vertical size or to reduce the displayWidth?  Either    * way it will require the recalculation of everything above.  This one    * is in the too-hard basket.    */   if ((s3BppDisplayWidth * (s3CursorStartY + s3CursorLines)) >       s3InfoRec.videoRam * 1024) { /* XXXX improve this message */      ErrorF("%s %s: Display size %dx%d is too large: ",              OFLG_ISSET(XCONFIG_VIRTUAL,&s3InfoRec.xconfigFlag) ?                 XCONFIG_GIVEN : XCONFIG_PROBED,             s3InfoRec.name,	     s3DisplayWidth, s3InfoRec.virtualY);    

⌨️ 快捷键说明

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