start a const list of common mode timings (mostly vesa); verify refresh rate is sane by calculating it using pixel clock and horizontal/vertical totals

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41354 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexander von Gluck IV 2011-05-06 20:50:05 +00:00
parent ccb1117c85
commit 91235829b2
2 changed files with 41 additions and 8 deletions

View File

@ -349,15 +349,15 @@ mode_sanity_check(display_mode *mode)
// horizontal timing
// validate h_sync_start is less then h_sync_end
if (mode->timing.h_sync_start > mode->timing.h_sync_end) {
TRACE("%s: ERROR: "
"(%dx%d) received h_sync_start greater then h_sync_end!\n",
TRACE("%s: ERROR: (%dx%d) "
"received h_sync_start greater then h_sync_end!\n",
__func__, mode->timing.h_display, mode->timing.v_display);
return B_ERROR;
}
// validate h_total is greater then h_display
if (mode->timing.h_total < mode->timing.h_display) {
TRACE("%s: ERROR: "
"(%dx%d) received h_total greater then h_display!\n",
TRACE("%s: ERROR: (%dx%d) "
"received h_total greater then h_display!\n",
__func__, mode->timing.h_display, mode->timing.v_display);
return B_ERROR;
}
@ -365,19 +365,30 @@ mode_sanity_check(display_mode *mode)
// vertical timing
// validate v_start is less then v_end
if (mode->timing.v_sync_start > mode->timing.v_sync_end) {
TRACE("%s: ERROR: "
"(%dx%d) received v_sync_start greater then v_sync_end!\n",
TRACE("%s: ERROR: (%dx%d) "
"received v_sync_start greater then v_sync_end!\n",
__func__, mode->timing.h_display, mode->timing.v_display);
return B_ERROR;
}
// validate v_total is greater then v_display
if (mode->timing.v_total < mode->timing.v_display) {
TRACE("%s: ERROR: "
"(%dx%d) received v_total greater then v_display!\n",
TRACE("%s: ERROR: (%dx%d) "
"received v_total greater then v_display!\n",
__func__, mode->timing.h_display, mode->timing.v_display);
return B_ERROR;
}
// calculate refresh rate for given timings to whole int (in Hz)
int refresh = mode->timing.pixel_clock * 1000
/ (mode->timing.h_total * mode->timing.v_total);
if (refresh < 30 || refresh > 250) {
TRACE("%s: ERROR: (%dx%d) "
"refresh rate of %dHz is unlikely for any kind of monitor!\n",
__func__, mode->timing.h_display, mode->timing.v_display, refresh);
return B_ERROR;
}
return B_OK;
}

View File

@ -14,6 +14,9 @@
#include <edid.h>
#define T_POSITIVE_SYNC (B_POSITIVE_HSYNC | B_POSITIVE_VSYNC)
status_t create_mode_list(void);
status_t mode_sanity_check(display_mode *mode);
@ -80,4 +83,23 @@ enum {
};
// A collection of the more common timings
const display_timing kStdModeTimings[] = {
{25180, 640, 656, 752, 800, 480, 490, 492, 525, 0},
// 640x480@60
{40000, 800, 840, 968, 1056, 600, 601, 605, 628, T_POSITIVE_SYNC},
// 800x600@60
{50000, 800, 856, 976, 1040, 600, 637, 643, 666, T_POSITIVE_SYNC},
// 800x600@72
{65000, 1024, 1048, 1184, 1344, 768, 771, 777, 806, 0},
// 1024x768@60
{75000, 1024, 1048, 1184, 1328, 768, 771, 777, 806, 0},
// 1024x768@70
{108000, 1280, 1328, 1440, 1688, 1024, 1025, 1028, 1066, T_POSITIVE_SYNC},
// 1280x1024@60
{135000, 1280, 1296, 1440, 1688, 1024, 1025, 1028, 1066, T_POSITIVE_SYNC}
// 1280x1024@75
};
#endif /*RADEON_HD_MODE_H*/