xref: /haiku/src/add-ons/accelerants/et6x00/GetModeInfo.c (revision 8731383444bd7e453833f844e32f7b5136079df2)
1*87313834SIngo Weinhold /*****************************************************************************\
2*87313834SIngo Weinhold  * Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5.
3*87313834SIngo Weinhold  * Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov.
4*87313834SIngo Weinhold \*****************************************************************************/
5*87313834SIngo Weinhold 
6*87313834SIngo Weinhold #include "GlobalData.h"
7*87313834SIngo Weinhold #include "generic.h"
8*87313834SIngo Weinhold 
9*87313834SIngo Weinhold 
10*87313834SIngo Weinhold /*****************************************************************************/
11*87313834SIngo Weinhold /*
12*87313834SIngo Weinhold  * Return the current display mode.  The only time you
13*87313834SIngo Weinhold  * might return an error is if a mode hasn't been set.
14*87313834SIngo Weinhold  */
GET_DISPLAY_MODE(display_mode * current_mode)15*87313834SIngo Weinhold status_t GET_DISPLAY_MODE(display_mode *current_mode) {
16*87313834SIngo Weinhold     /* easy for us, we return the last mode we set */
17*87313834SIngo Weinhold     *current_mode = si->dm;
18*87313834SIngo Weinhold     return B_OK;
19*87313834SIngo Weinhold }
20*87313834SIngo Weinhold /*****************************************************************************/
21*87313834SIngo Weinhold /*
22*87313834SIngo Weinhold  * Return the frame buffer configuration information.
23*87313834SIngo Weinhold  */
GET_FRAME_BUFFER_CONFIG(frame_buffer_config * afb)24*87313834SIngo Weinhold status_t GET_FRAME_BUFFER_CONFIG(frame_buffer_config *afb) {
25*87313834SIngo Weinhold     /* easy again, as the last mode set stored the info in a convienient form */
26*87313834SIngo Weinhold     *afb = si->fbc;
27*87313834SIngo Weinhold     return B_OK;
28*87313834SIngo Weinhold }
29*87313834SIngo Weinhold /*****************************************************************************/
30*87313834SIngo Weinhold /*
31*87313834SIngo Weinhold  * Return the maximum and minium pixel clock limits for the specified mode.
32*87313834SIngo Weinhold  * Note that we're not making any guarantees about the ability of the
33*87313834SIngo Weinhold  * attached display to handle pixel clocks within the limits we return.
34*87313834SIngo Weinhold  * A future monitor capablilities database will post-process this
35*87313834SIngo Weinhold  * information.
36*87313834SIngo Weinhold  */
GET_PIXEL_CLOCK_LIMITS(display_mode * dm,uint32 * low,uint32 * high)37*87313834SIngo Weinhold status_t GET_PIXEL_CLOCK_LIMITS(display_mode *dm, uint32 *low, uint32 *high) {
38*87313834SIngo Weinhold uint32 clockLimit;
39*87313834SIngo Weinhold uint32 totalPix = (uint32)dm->timing.h_total * (uint32)dm->timing.v_total;
40*87313834SIngo Weinhold 
41*87313834SIngo Weinhold     /* max pixel clock is pixel depth dependant */
42*87313834SIngo Weinhold     switch (dm->space & ~0x3000) {
43*87313834SIngo Weinhold  	case B_RGB24: clockLimit = si->pixelClockMax24; break;
44*87313834SIngo Weinhold 	case B_RGB15:
45*87313834SIngo Weinhold 	case B_RGB16: clockLimit = si->pixelClockMax16; break;
46*87313834SIngo Weinhold 	default:
47*87313834SIngo Weinhold 	    clockLimit = 0;
48*87313834SIngo Weinhold     }
49*87313834SIngo Weinhold 
50*87313834SIngo Weinhold     /* lower limit of about 48Hz vertical refresh */
51*87313834SIngo Weinhold     *low = (totalPix * 48L) / 1000L;
52*87313834SIngo Weinhold     if (*low > clockLimit) return B_ERROR;
53*87313834SIngo Weinhold     *high = clockLimit;
54*87313834SIngo Weinhold 
55*87313834SIngo Weinhold     return B_OK;
56*87313834SIngo Weinhold }
57*87313834SIngo Weinhold /*****************************************************************************/
58