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