2 * Copyright (c) 2002, Thomas Kurschel
3 * Distributed under the terms of the MIT License.
6 /*! Public mode-specific info functions */
9 #include "radeon_accelerant.h"
10 #include "GlobalData.h"
13 #include <GraphicsDefs.h>
19 GET_DISPLAY_MODE(display_mode
*mode
)
21 virtual_card
*vc
= ai
->vc
;
23 // TBD: there is a race condition if someone else is just setting it
24 // we won't lock up but return non-sense
28 // we hide multi-monitor-mode because :-
29 // - we want to look like an ordinary single-screen driver
30 // - the multi-mode is already adapted to current screen configuration,
31 // and the mode should be configuration-independant
32 Radeon_HideMultiMode(vc
, mode
);
38 GET_FRAME_BUFFER_CONFIG(frame_buffer_config
*afb
)
40 virtual_card
*vc
= ai
->vc
;
42 // TBD: race condition again
44 // easy again, as the last mode set stored the info in a convienient form
51 GET_PIXEL_CLOCK_LIMITS(display_mode
*dm
, uint32
*low
, uint32
*high
)
53 // we ignore stuff like DVI/LCD restrictions -
54 // they are handled automatically on set_display_mode
55 uint32 total_pix
= (uint32
)dm
->timing
.h_total
* (uint32
)dm
->timing
.v_total
;
56 uint32 clock_limit
= ai
->si
->pll
.max_pll_freq
* 10;
58 /* lower limit of about 48Hz vertical refresh */
59 *low
= (total_pix
* 48L) / 1000L;
60 if (*low
> clock_limit
)
71 radeon_get_preferred_display_mode(display_mode
* mode
)
73 fp_info
*fpInfo
= &ai
->si
->flatpanels
[0];
74 disp_entity
* routes
= &ai
->si
->routing
;
77 if (routes
->port_info
[0].edid_valid
|| routes
->port_info
[1].edid_valid
) {
78 // prefer EDID data in this case
82 if ((ai
->vc
->connected_displays
& (dd_dvi
| dd_dvi_ext
| dd_lvds
)) == 0)
83 return B_NOT_SUPPORTED
;
85 // Mode has already been added by addFPMode(), just return it
87 for (i
= 0; i
< ai
->si
->mode_count
; ++i
) {
88 if (ai
->mode_list
[i
].timing
.h_display
== fpInfo
->panel_xres
89 && ai
->mode_list
[i
].timing
.v_display
== fpInfo
->panel_yres
90 && ai
->mode_list
[i
].virtual_width
== fpInfo
->panel_xres
91 && ai
->mode_list
[i
].virtual_height
== fpInfo
->panel_yres
92 && ai
->mode_list
[i
].space
== B_RGB32_LITTLE
) {
93 memcpy(mode
, &ai
->mode_list
[i
], sizeof(display_mode
));
103 radeon_get_edid_info(void* info
, size_t size
, uint32
* _version
)
105 disp_entity
* routes
= &ai
->si
->routing
;
108 if (size
< sizeof(struct edid1_info
))
109 return B_BUFFER_OVERFLOW
;
111 if (routes
->port_info
[0].edid_valid
)
113 else if (routes
->port_info
[1].edid_valid
)
118 memcpy(info
, &routes
->port_info
[index
].edid
, sizeof(struct edid1_info
));
119 *_version
= EDID_VERSION_1
;
126 Return the semaphore id that will be used to signal a vertical retrace
130 ACCELERANT_RETRACE_SEMAPHORE(void)
132 virtual_card
*vc
= ai
->vc
;
136 The kernel driver created this for us. We don't know if the system is
137 using real interrupts, or if we're faking it, and we don't care.
138 If we choose not to support this at all, we'd just return B_ERROR here,
139 and the user wouldn't get any kind of vertical retrace support.
141 // with multi-monitor mode, we have two vertical blanks!
142 // until we find a better solution, we always return virtual port 0,
143 // which may be either physical port 0 or 1
146 if( vc
->used_crtc
[0] )
151 //SHOW_INFO( 3, "semaphore: %x", ai->si->ports[physical_port].vblank );
153 return ai
->si
->crtc
[crtcIndex
].vblank
;