- /* FIXME: don't use SMBus, obtain current video resolution directly from NV2A */
- if (I2CTransmitByteGetReturn(0x10, 0x04, &AvMode))
- {
- if (1 == AvMode) /* HDTV */
- {
- ScreenWidth = 720;
- }
- else
- {
- /* FIXME Other possible values of AvMode:
- * 0 - AV_SCART_RGB
- * 2 - AV_VGA_SOG
- * 4 - AV_SVIDEO
- * 6 - AV_COMPOSITE
- * 7 - AV_VGA
- * other AV_COMPOSITE
- */
- ScreenWidth = 640;
- }
- }
+ ScreenWidth = *((PULONG) NV2A_RAMDAC_FP_HVALID_END) + 1;
+ ScreenHeight = *((PULONG) NV2A_RAMDAC_FP_VVALID_END) + 1;
+ /* Get BPP directly from NV2A CRTC (magic constants are from Cromwell) */
+ BytesPerPixel = 8 * (((NvGetCrtc(0x19) & 0xE0) << 3) | (NvGetCrtc(0x13) & 0xFF)) / ScreenWidth;
+ if (BytesPerPixel == 4)
+ {
+ ASSERT((NvGetCrtc(0x28) & 0xF) == BytesPerPixel - 1);
+ }