BPicture: Fix archive constructor.
[haiku.git] / src / add-ons / accelerants / neomagic / GetModeInfo.c
blobbc0a9bb0484a5310556e2f242dc2958a32132e78
1 /*
2 Copyright 1999, Be Incorporated. All Rights Reserved.
3 This file may be used under the terms of the Be Sample Code License.
5 Other authors:
6 Rudolf Cornelissen 4/2003-1/2006
7 */
9 #define MODULE_BIT 0x02000000
11 #include "acc_std.h"
14 Return the current display mode. The only time you might return an
15 error is if a mode hasn't been set. Or if the system hands you a NULL pointer.
17 status_t GET_DISPLAY_MODE(display_mode *current_mode)
19 /* check for NULL pointer */
20 if (current_mode == NULL) return B_ERROR;
22 *current_mode = si->dm;
23 return B_OK;
26 /* Return the frame buffer configuration information. */
27 status_t GET_FRAME_BUFFER_CONFIG(frame_buffer_config *afb)
29 /* check for NULL pointer */
30 if (afb == NULL) return B_ERROR;
32 *afb = si->fbc;
33 return B_OK;
36 /* Return the maximum and minium pixelclock limits for the specified mode. */
37 status_t GET_PIXEL_CLOCK_LIMITS(display_mode *dm, uint32 *low, uint32 *high)
39 uint32 max_pclk = 0;
40 uint32 min_pclk = 0;
42 /* check for NULL pointers */
43 if ((dm == NULL) || (low == NULL) || (high == NULL)) return B_ERROR;
45 /* specify requested info assuming CRT-only mode
46 * (if panel is active, CRTC and pixelclock are not programmed!) */
48 /* find min. value */
49 switch (si->ps.card_type)
51 default:
52 *low = (si->ps.min_pixel_vco * 1000);
53 break;
55 /* find max. value */
56 switch (dm->space)
58 case B_CMAP8:
59 max_pclk = si->ps.max_dac1_clock_8;
60 break;
61 case B_RGB15_LITTLE:
62 case B_RGB16_LITTLE:
63 max_pclk = si->ps.max_dac1_clock_16;
64 break;
65 case B_RGB24_LITTLE:
66 max_pclk = si->ps.max_dac1_clock_24;
67 break;
68 default:
69 /* use fail-safe value */
70 max_pclk = si->ps.max_dac1_clock_24;
71 break;
73 /* return values in kHz */
74 *high = max_pclk * 1000;
77 /* clamp lower limit to 48Hz vertical refresh for now.
78 * Apparantly the BeOS screenprefs app does limit the upper refreshrate to 90Hz,
79 * while it does not limit the lower refreshrate. */
80 min_pclk = ((uint32)dm->timing.h_total * (uint32)dm->timing.v_total * 48) / 1000;
81 if (min_pclk > *low) *low = min_pclk;
83 return B_OK;
86 /* Return the semaphore id that will be used to signal a vertical sync occured. */
87 sem_id ACCELERANT_RETRACE_SEMAPHORE(void)
89 if (si->ps.int_assigned)
90 // return si->vblank;
91 //temp:
92 return B_ERROR;
93 else
94 return B_ERROR;