1/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_disp.c,v 1.2 2003/01/14 09:34:34 alanh Exp $ */
2/*
3 * $Workfile: gfx_disp.c $
4 *
5 * This file contains routines to program the display controller.
6 *
7 * The "disp_gu1.c" and "disp_gu2.c" files implement the following routines:
8 *
9 *    gfx_get_display_mode_count
10 *    gfx_get_display_mode
11 *    gfx_is_display_mode_supported
12 *    gfx_get_display_details
13 *    gfx_set_display_mode
14 *    gfx_set_display_bpp
15 *	  gfx_set_display_timings
16 *    gfx_set_vtotal
17 *    gfx_get_display_pitch
18 *    gfx_set_display_pitch
19 *    gfx_set_display_offset
20 *    gfx_set_display_palette
21 *    gfx_set_display_palette_entry
22 *    gfx_set_cursor_enable
23 *    gfx_set_cursor_colors
24 *    gfx_set_cursor_position
25 *	  gfx_set_cursor_shape32
26 *	  gfx_set_cursor_shape64
27 *    gfx_set_icon_enable
28 *    gfx_set_icon_colors
29 *    gfx_set_icon_position
30 *    gfx_set_icon_shape64
31 *    gfx_set_compression_enable
32 *    gfx_set_compression_offset
33 *    gfx_set_compression_pitch
34 *    gfx_set_compression_size
35 *    gfx_set_display_priority_high
36 *    gfx_test_timing_active
37 *    gfx_test_vertical_active
38 *    gfx_wait_vertical_blank
39 *    gfx_reset_timing_lock
40 *
41 * And the following routines if GFX_READ_ROUTINES is set:
42 *
43 *	  gfx_get_hactive
44 *    gfx_get_hblank_start
45 *    gfx_get_hsync_start
46 *    gfx_get_hsync_end
47 *    gfx_get_hblank_end
48 *    gfx_get_htotal
49 *    gfx_get_vactive
50 *    gfx_get_vblank_start
51 *    gfx_get_vsync_start
52 *    gfx_get_vsync_end
53 *    gfx_get_vblank_end
54 *    gfx_get_vtotal
55 *    gfx_get_vline
56 *    gfx_get_display_bpp
57 *    gfx_get_display_offset
58 *    gfx_get_display_palette
59 *    gfx_get_cursor_enable
60 *    gfx_get_cursor_base
61 *    gfx_get_cursor_position
62 *    gfx_get_cursor_offset
63 *    gfx_get_cursor_color
64 *    gfx_get_icon_enable
65 *    gfx_get_icon_color
66 *    gfx_get_icon_offset
67 *    gfx_get_icon_position
68 *    gfx_get_compression_enable
69 *    gfx_get_compression_offset
70 *    gfx_get_compression_pitch
71 *    gfx_get_compression_size
72 *    gfx_get_display_priority_high
73 *    gfx_get_valid_bit
74 *
75 * NSC_LIC_ALTERNATIVE_PREAMBLE
76 *
77 * Revision 1.0
78 *
79 * National Semiconductor Alternative GPL-BSD License
80 *
81 * National Semiconductor Corporation licenses this software
82 * ("Software"):
83 *
84 *      Durango
85 *
86 * under one of the two following licenses, depending on how the
87 * Software is received by the Licensee.
88 *
89 * If this Software is received as part of the Linux Framebuffer or
90 * other GPL licensed software, then the GPL license designated
91 * NSC_LIC_GPL applies to this Software; in all other circumstances
92 * then the BSD-style license designated NSC_LIC_BSD shall apply.
93 *
94 * END_NSC_LIC_ALTERNATIVE_PREAMBLE */
95
96/* NSC_LIC_BSD
97 *
98 * National Semiconductor Corporation Open Source License for Durango
99 *
100 * (BSD License with Export Notice)
101 *
102 * Copyright (c) 1999-2001
103 * National Semiconductor Corporation.
104 * All rights reserved.
105 *
106 * Redistribution and use in source and binary forms, with or without
107 * modification, are permitted provided that the following conditions
108 * are met:
109 *
110 *   * Redistributions of source code must retain the above copyright
111 *     notice, this list of conditions and the following disclaimer.
112 *
113 *   * Redistributions in binary form must reproduce the above
114 *     copyright notice, this list of conditions and the following
115 *     disclaimer in the documentation and/or other materials provided
116 *     with the distribution.
117 *
118 *   * Neither the name of the National Semiconductor Corporation nor
119 *     the names of its contributors may be used to endorse or promote
120 *     products derived from this software without specific prior
121 *     written permission.
122 *
123 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
124 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
125 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
126 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
127 * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY
128 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
129 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
130 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
131 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
132 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
133 * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY
134 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
135 * OF SUCH DAMAGE.
136 *
137 * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
138 * YOUR JURISDICTION. It is licensee's responsibility to comply with
139 * any export regulations applicable in licensee's jurisdiction. Under
140 * CURRENT (2001) U.S. export regulations this software
141 * is eligible for export from the U.S. and can be downloaded by or
142 * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed
143 * destinations which include Cuba, Iraq, Libya, North Korea, Iran,
144 * Syria, Sudan, Afghanistan and any other country to which the U.S.
145 * has embargoed goods and services.
146 *
147 * END_NSC_LIC_BSD */
148
149/* NSC_LIC_GPL
150 *
151 * National Semiconductor Corporation Gnu General Public License for Durango
152 *
153 * (GPL License with Export Notice)
154 *
155 * Copyright (c) 1999-2001
156 * National Semiconductor Corporation.
157 * All rights reserved.
158 *
159 * Redistribution and use in source and binary forms, with or without
160 * modification, are permitted under the terms of the GNU General
161 * Public License as published by the Free Software Foundation; either
162 * version 2 of the License, or (at your option) any later version
163 *
164 * In addition to the terms of the GNU General Public License, neither
165 * the name of the National Semiconductor Corporation nor the names of
166 * its contributors may be used to endorse or promote products derived
167 * from this software without specific prior written permission.
168 *
169 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
170 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
171 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
172 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
173 * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY
174 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
175 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
176 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
177 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
178 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
179 * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY
180 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
181 * OF SUCH DAMAGE. See the GNU General Public License for more details.
182 *
183 * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
184 * YOUR JURISDICTION. It is licensee's responsibility to comply with
185 * any export regulations applicable in licensee's jurisdiction. Under
186 * CURRENT (2001) U.S. export regulations this software
187 * is eligible for export from the U.S. and can be downloaded by or
188 * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed
189 * destinations which include Cuba, Iraq, Libya, North Korea, Iran,
190 * Syria, Sudan, Afghanistan and any other country to which the U.S.
191 * has embargoed goods and services.
192 *
193 * You should have received a copy of the GNU General Public License
194 * along with this file; if not, write to the Free Software Foundation,
195 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
196 *
197 * END_NSC_LIC_GPL */
198
199unsigned short PanelWidth = 0;
200unsigned short PanelHeight = 0;
201unsigned short PanelEnable = 0;
202unsigned short ModeWidth;
203unsigned short ModeHeight;
204
205int DeltaX = 0;
206int DeltaY = 0;
207unsigned long prevstartAddr = 0;
208unsigned long panelTop = 0;
209unsigned long panelLeft = 0;
210
211int gbpp = 8;
212
213int gfx_compression_enabled = 0;
214int gfx_compression_active = 0;
215int gfx_line_double = 0;
216int gfx_pixel_double = 0;
217int gfx_timing_lock = 0;
218DISPLAYMODE gfx_display_mode;
219
220/* DISPLAY MODE TIMINGS */
221
222DISPLAYMODE DisplayParams[] = {
223
224/* 320 x 200 */
225
226   {GFX_MODE_70HZ |			/* refresh rate = 60  */
227    GFX_MODE_8BPP | GFX_MODE_16BPP |	/* 8 and 16 BPP valid */
228    GFX_MODE_NEG_HSYNC |		/* negative HSYNC     */
229    GFX_MODE_PIXEL_DOUBLE |		/* Double width       */
230    GFX_MODE_LINE_DOUBLE,		/* Double height      */
231    0x140, 0x288, 0x290, 0x2F0, 0x318, 0x320,	/* horizontal timings */
232    0x0C8, 0x197, 0x19C, 0x19E, 0x1BA, 0x1C1,	/* vertical timings   */
233    0x00192CCC,				/* freq = 25.175 MHz  */
234    },
235
236/* 320 x 240 */
237
238   {GFX_MODE_75HZ |			/* refresh rate = 75  */
239    GFX_MODE_8BPP | GFX_MODE_16BPP |	/* 8 and 16 BPP valid */
240    GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC |	/* negative syncs     */
241    GFX_MODE_PIXEL_DOUBLE |		/* Double width       */
242    GFX_MODE_LINE_DOUBLE,		/* Double height      */
243    0x0140, 0x0280, 0x0290, 0x02D0, 0x0348, 0x0348,	/* horizontal timings */
244    0x00F0, 0x01E0, 0x01E1, 0x01E4, 0x01F4, 0x01F4,	/* vertical timings   */
245    0x001F8000,				/* freq = 31.5 MHz    */
246    },
247
248/* 400 x 300 */
249
250   {GFX_MODE_75HZ |			/* refresh rate = 75  */
251    GFX_MODE_8BPP | GFX_MODE_16BPP |	/* 8 and 16 BPP valid */
252    GFX_MODE_PIXEL_DOUBLE |		/* Double width       */
253    GFX_MODE_LINE_DOUBLE,		/* Double height      */
254    0x0190, 0x0320, 0x0330, 0x0380, 0x0420, 0x0420,	/* horizontal timings */
255    0x012C, 0x0258, 0x0259, 0x025C, 0x0271, 0x0271,	/* vertical timings   */
256    0x00318000,				/* freq = 49.5 MHz    */
257    },
258
259/* 512 x 384 */
260
261   {GFX_MODE_75HZ |			/* refresh rate = 75  */
262    GFX_MODE_8BPP | GFX_MODE_16BPP |	/* 8 and 16 BPP valid */
263    GFX_MODE_PIXEL_DOUBLE |		/* Double width       */
264    GFX_MODE_LINE_DOUBLE,		/* Double height      */
265    0x0200, 0x0400, 0x0410, 0x0470, 0x0520, 0x0520,	/* horizontal timings */
266    0x0180, 0x0300, 0x0301, 0x0304, 0x0320, 0x0320,	/* vertical timings   */
267    0x004EC000,				/* freq = 78.75 MHz   */
268    },
269
270/* 640 x 400 */
271
272   {GFX_MODE_70HZ |			/* refresh rate = 60  */
273    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* all BPP valid      */
274    GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC,	/* negative HSYNC     */
275    0x280, 0x288, 0x290, 0x2F0, 0x318, 0x320,	/* horizontal timings */
276    0x190, 0x197, 0x19C, 0x19E, 0x1BA, 0x1C1,	/* vertical timings   */
277    0x00192CCC,				/* freq = 25.175 MHz  */
278    },
279
280/* 640x480 */
281
282   {GFX_MODE_60HZ |			/* refresh rate = 60  */
283    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* all BPP valid      */
284    GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC,	/* negative syncs     */
285    0x0280, 0x0288, 0x0290, 0x02E8, 0x0318, 0x0320,	/* horizontal timings */
286    0x01E0, 0x01E8, 0x01EA, 0x01EC, 0x0205, 0x020D,	/* vertical timings   */
287    0x00192CCC,				/* freq = 25.175 MHz  */
288    },
289
290   {GFX_MODE_72HZ |			/* refresh rate = 72  */
291    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* all BPP valid      */
292    GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC,	/* negative syncs     */
293    0x0280, 0x0288, 0x0298, 0x02c0, 0x0338, 0x0340,	/* horizontal timings */
294    0x01e0, 0x01e8, 0x01e9, 0x01ec, 0x0200, 0x0208,	/* vertical timings   */
295    0x001F8000,				/* freq = 31.5 MHz    */
296    },
297
298   {GFX_MODE_75HZ |			/* refresh rate = 75  */
299    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* all BPP valid      */
300    GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC,	/* negative syncs     */
301    0x0280, 0x0280, 0x0290, 0x02D0, 0x0348, 0x0348,	/* horizontal timings */
302    0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01F4, 0x01F4,	/* vertical timings   */
303    0x001F8000,				/* freq = 31.5 MHz    */
304    },
305
306   {GFX_MODE_85HZ |			/* refresh rate = 85  */
307    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* all BPP valid      */
308    GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC,	/* negative syncs     */
309    0x0280, 0x0280, 0x02B8, 0x02F0, 0x0340, 0x0340,	/* horizontal timings */
310    0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01FD, 0x01FD,	/* vertical timings   */
311    0x00240000,				/* freq = 36.0 MHz    */
312    },
313
314/* 800x600 */
315
316   {GFX_MODE_56HZ |			/* refresh rate = 56  */
317    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* all BPP valid      */
318    GFX_MODE_16BPP | GFX_MODE_24BPP,
319    0x0320, 0x0328, 0x0348, 0x03D0, 0x0418, 0x0420,	/* horizontal timings */
320    0x0258, 0x0258, 0x0259, 0x025D, 0x0274, 0x0274,	/* vertical timings   */
321    0x00240000,				/* freq = 36.00 MHz   */
322    },
323
324   {GFX_MODE_60HZ |			/* refresh rate = 60  */
325    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* all BPP valid      */
326    GFX_MODE_16BPP | GFX_MODE_24BPP,
327    0x0320, 0x0328, 0x0348, 0x03D0, 0x0418, 0x0420,	/* horizontal timings */
328    0x0258, 0x0258, 0x0259, 0x025D, 0x0274, 0x0274,	/* vertical timings   */
329    0x00280000,				/* freq = 40.00 MHz   */
330    },
331
332   {GFX_MODE_72HZ |			/* refresh rate = 72  */
333    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* all BPP valid      */
334    GFX_MODE_16BPP | GFX_MODE_24BPP,
335    0x0320, 0x0320, 0x0358, 0x03D0, 0x0410, 0x0410,	/* horizontal timings */
336    0x0258, 0x0258, 0x027D, 0x0283, 0x029A, 0x029A,	/* vertical timings   */
337    0x00320000,				/* freq = 49.5 MHz    */
338    },
339
340   {GFX_MODE_75HZ |			/* refresh rate = 75  */
341    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* all BPP valid      */
342    GFX_MODE_16BPP | GFX_MODE_24BPP,
343    0x0320, 0x0320, 0x0330, 0x0380, 0x0420, 0x0420,	/* horizontal timings */
344    0x0258, 0x0258, 0x0259, 0x025C, 0x0271, 0x0271,	/* vertical timings   */
345    0x00318000,				/* freq = 49.5 MHz    */
346    },
347
348   {GFX_MODE_85HZ |			/* refresh rate = 85  */
349    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* all BPP valid      */
350    GFX_MODE_16BPP | GFX_MODE_24BPP,
351    0x0320, 0x0320, 0x0340, 0x0380, 0x0418, 0x0418,	/* horizontal timings */
352    0x0258, 0x0258, 0x0259, 0x025C, 0x0277, 0x0277,	/* vertical timings   */
353    0x00384000,				/* freq = 56.25 MHz   */
354    },
355
356/* 1024x768 */
357
358   {GFX_MODE_60HZ |			/* refresh rate = 60  */
359    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* all BPP valid      */
360    GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC,	/* negative syncs     */
361    0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540,	/* horizontal timings */
362    0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326,	/* vertical timings   */
363    0x00410000,				/* freq = 65.00 MHz   */
364    },
365
366   {GFX_MODE_70HZ |			/* refresh rate = 70  */
367    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* all BPP valid      */
368    GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC,	/* negative syncs     */
369    0x0400, 0x0400, 0x0418, 0x04A0, 0x0530, 0x0530,	/* horizontal timings */
370    0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326,	/* vertical timings   */
371    0x004B0000,				/* freq = 78.75 MHz   */
372    },
373
374   {GFX_MODE_75HZ |			/* refresh rate = 75  */
375    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* all BPP valid      */
376    GFX_MODE_16BPP | GFX_MODE_24BPP,
377    0x0400, 0x0400, 0x0410, 0x0470, 0x0520, 0x0520,	/* horizontal timings */
378    0x0300, 0x0300, 0x0301, 0x0304, 0x0320, 0x0320,	/* vertical timings   */
379    0x004EC000,				/* freq = 78.75 MHz   */
380    },
381
382   {GFX_MODE_85HZ |			/* refresh rate = 85  */
383    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* all BPP valid      */
384    GFX_MODE_16BPP | GFX_MODE_24BPP,
385    0x0400, 0x0400, 0x0430, 0x0490, 0x0560, 0x0560,	/* horizontal timings */
386    0x0300, 0x0300, 0x0301, 0x0304, 0x0328, 0x0328,	/* vertical timings   */
387    0x005E8000,				/* freq = 94.50 MHz   */
388    },
389
390/* 1152x864 */
391
392   {GFX_MODE_75HZ |			/* refresh rate = 75  */
393    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* all BPP valid      */
394    GFX_MODE_16BPP | GFX_MODE_24BPP,
395    0x0480, 0x0480, 0x04C0, 0x0540, 0x0640, 0x0640,	/* horizontal timings */
396    0x0360, 0x0360, 0x0361, 0x0364, 0x0384, 0x0384,	/* vertical timings   */
397    0x006C0000,				/* freq = 108.00 MHz  */
398    },
399
400/* 1280x1024 */
401
402   {GFX_MODE_60HZ |			/* refresh rate = 60  */
403    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* Up to 16 bpp       */
404    GFX_MODE_16BPP | GFX_MODE_24BPP,
405    0x0500, 0x0500, 0x0530, 0x05A0, 0x0698, 0x0698,	/* horizontal timings */
406    0x0400, 0x0400, 0x0401, 0x0404, 0x042A, 0x042A,	/* vertical timings   */
407    0x006C0000,				/* freq = 108.0 MHz   */
408    },
409
410   {GFX_MODE_75HZ |			/* refresh rate = 75  */
411    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* Up to 16 bpp       */
412    GFX_MODE_16BPP | GFX_MODE_24BPP,
413    0x0500, 0x0500, 0x0510, 0x05A0, 0x0698, 0x0698,	/* horizontal timings */
414    0x0400, 0x0400, 0x0401, 0x0404, 0x042A, 0x042A,	/* vertical timings   */
415    0x00870000,				/* freq = 135.0 MHz   */
416    },
417
418   {GFX_MODE_85HZ |			/* refresh rate = 85  */
419    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* Up to 16 bpp       */
420    GFX_MODE_16BPP | GFX_MODE_24BPP,
421    0x0500, 0x0500, 0x0540, 0x05E0, 0x06C0, 0x06C0,	/* horizontal timings */
422    0x0400, 0x0400, 0x0401, 0x0404, 0x0430, 0x0430,	/* vertical timings   */
423    0x009D8000,				/* freq = 157.5 MHz   */
424    },
425
426/*********************************/
427/* BEGIN REDCLOUD-SPECIFIC MODES */
428/*-------------------------------*/
429
430/* 1600 x 1200 */
431
432   {GFX_MODE_60HZ |			/* refresh rate = 60  */
433    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* Up to 32 bpp       */
434    GFX_MODE_16BPP | GFX_MODE_24BPP,
435    0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870,	/* horizontal timings */
436    0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2,	/* vertical timings   */
437    0x00A20000,				/* freq = 162.0 MHz   */
438    },
439
440   {GFX_MODE_70HZ |			/* refresh rate = 70  */
441    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* Up to 32 bpp       */
442    GFX_MODE_16BPP | GFX_MODE_24BPP,
443    0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870,	/* horizontal timings */
444    0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2,	/* vertical timings   */
445    0x00BD0000,				/* freq = 189.0 MHz   */
446    },
447
448   {GFX_MODE_75HZ |			/* refresh rate = 75  */
449    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* Up to 32 bpp       */
450    GFX_MODE_16BPP | GFX_MODE_24BPP,
451    0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870,	/* horizontal timings */
452    0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2,	/* vertical timings   */
453    0x00CA8000,				/* freq = 202.5 MHz   */
454    },
455
456   {GFX_MODE_85HZ |			/* refresh rate = 85  */
457    GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP |	/* Up to 32 bpp       */
458    GFX_MODE_16BPP | GFX_MODE_24BPP,
459    0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870,	/* horizontal timings */
460    0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2,	/* vertical timings   */
461    0x00E58000,				/* freq = 229.5 MHz   */
462    },
463};
464
465/* UPDATE THIS VARIABLE WHENEVER NEW REDCLOUD-SPECIFIC MODES ARE ADDED */
466
467#define REDCLOUD_SPECIFIC_MODES 4
468
469#define NUM_RC_DISPLAY_MODES sizeof(DisplayParams) / sizeof(DISPLAYMODE)
470#define NUM_GX_DISPLAY_MODES (NUM_RC_DISPLAY_MODES - REDCLOUD_SPECIFIC_MODES)
471
472FIXEDTIMINGS FixedParams[] = {
473/* 640x480 Panel */
474   {640, 480, 640, 480,
475    0x0280, 0x280, 0x2a8, 0x328, 0x380, 0x380,
476    0x1e0, 0x1e0, 0x1e1, 0x1e5, 0x1fc, 0x1fc,
477    0x00192CCC,
478    },
479
480   {640, 480, 800, 600,
481    0x0280, 0x280, 0x2a8, 0x328, 0x380, 0x380,
482    0x1e0, 0x1e0, 0x1e1, 0x1e5, 0x1fc, 0x1fc,
483    0x00192CCC,
484    },
485
486   {640, 480, 1024, 768,
487    0x0280, 0x280, 0x2a8, 0x328, 0x380, 0x380,
488    0x1e0, 0x1e0, 0x1e1, 0x1e5, 0x1fc, 0x1fc,
489    0x00192CCC,
490    },
491
492   {640, 480, 1152, 864,
493    0x0280, 0x280, 0x2a8, 0x328, 0x380, 0x380,
494    0x1e0, 0x1e0, 0x1e1, 0x1e5, 0x1fc, 0x1fc,
495    0x00192CCC,
496    },
497
498   {640, 480, 1280, 1024,
499    0x0280, 0x280, 0x2a8, 0x328, 0x380, 0x380,
500    0x1e0, 0x1e0, 0x1e1, 0x1e5, 0x1fc, 0x1fc,
501    0x00192CCC,
502    },
503
504   {640, 480, 1600, 1200,
505    0x0280, 0x280, 0x2a8, 0x328, 0x380, 0x380,
506    0x1e0, 0x1e0, 0x1e1, 0x1e5, 0x1fc, 0x1fc,
507    0x00192CCC,
508    },
509
510/* 800x600 Panel */
511   {800, 600, 640, 480,
512    0x0280, 0x2d0, 0x2f8, 0x378, 0x3d0, 0x420,
513    0x1e0, 0x21c, 0x21d, 0x221, 0x238, 0x274,
514    0x00280000,
515    },
516
517   {800, 600, 800, 600,
518    0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420,
519    0x258, 0x258, 0x259, 0x25d, 0x274, 0x274,
520    0x00280000,
521    },
522
523   {800, 600, 1024, 768,
524    0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420,
525    0x258, 0x258, 0x259, 0x25d, 0x274, 0x274,
526    0x00280000,
527    },
528
529   {800, 600, 1152, 864,
530    0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420,
531    0x258, 0x258, 0x259, 0x25d, 0x274, 0x274,
532    0x00280000,
533    },
534
535   {800, 600, 1280, 1024,
536    0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420,
537    0x258, 0x258, 0x259, 0x25d, 0x274, 0x274,
538    0x00280000,
539    },
540
541   {800, 600, 1600, 1200,
542    0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420,
543    0x258, 0x258, 0x259, 0x25d, 0x274, 0x274,
544    0x00280000,
545    },
546
547/* 1024x768 panel */
548   {1024, 768, 640, 480,
549    0x0280, 0x340, 0x368, 0x3e8, 0x440, 0x500,
550    0x1e0, 0x270, 0x271, 0x275, 0x28c, 0x31c,
551    0x00410000,
552    },
553
554   {1024, 768, 800, 600,
555    0x0320, 0x390, 0x3b8, 0x438, 0x490, 0x500,
556    0x258, 0x2ac, 0x2ad, 0x2b1, 0x2c8, 0x31c,
557    0x00410000,
558    },
559
560   {1024, 768, 1024, 768,
561    0x0400, 0x400, 0x428, 0x4a8, 0x500, 0x500,
562    0x300, 0x300, 0x301, 0x305, 0x31c, 0x31c,
563    0x00410000,
564    },
565
566   {1024, 768, 1152, 864,
567    0x0400, 0x400, 0x428, 0x4a8, 0x500, 0x500,
568    0x300, 0x300, 0x301, 0x305, 0x31c, 0x31c,
569    0x00410000,
570    },
571
572   {1024, 768, 1280, 1024,
573    0x0400, 0x400, 0x428, 0x4a8, 0x500, 0x500,
574    0x300, 0x300, 0x301, 0x305, 0x31c, 0x31c,
575    0x00410000,
576    },
577
578   {1024, 768, 1600, 1200,
579    0x0400, 0x400, 0x428, 0x4a8, 0x500, 0x500,
580    0x300, 0x300, 0x301, 0x305, 0x31c, 0x31c,
581    0x00410000,
582    },
583
584};
585
586#define NUM_FIXED_TIMINGS_MODES sizeof(FixedParams)/sizeof(FIXEDTIMINGS)
587
588/* INCLUDE SUPPORT FOR FIRST GENERATION, IF SPECIFIED. */
589
590#if GFX_DISPLAY_GU1
591#include "disp_gu1.c"
592#endif
593
594/* INCLUDE SUPPORT FOR SECOND GENERATION, IF SPECIFIED. */
595
596#if GFX_DISPLAY_GU2
597#include "disp_gu2.c"
598#endif
599
600void gfx_set_display_video_format(unsigned long format);
601void gfx_set_display_video_enable(int enable);
602void gfx_set_display_video_yuv_offsets(unsigned long yoffset,
603				       unsigned long uoffset,
604				       unsigned long voffset);
605void gfx_set_display_video_yuv_pitch(unsigned long ypitch,
606				     unsigned long uvpitch);
607void gfx_set_display_video_downscale(unsigned short srch,
608				     unsigned short dsth);
609void gfx_set_display_video_vertical_downscale_enable(int enable);
610void gfx_get_display_video_yuv_offsets(unsigned long *yoffset,
611				       unsigned long *uoffset,
612				       unsigned long *voffset);
613void gfx_get_display_video_yuv_pitch(unsigned long *ypitch,
614				     unsigned long *uvpitch);
615unsigned long gfx_get_display_video_downscale_delta(void);
616int gfx_get_display_video_downscale_enable(void);
617unsigned long gfx_get_display_video_size(void);
618void gfx_set_display_video_size(unsigned short width, unsigned short height);
619void gfx_set_display_video_offset(unsigned long offset);
620unsigned long gfx_get_display_video_offset(void);
621
622/*---------------------------------------------------------------------------
623 * gfx_reset_timing_lock
624 *
625 * This routine resets the timing change lock. The lock can only be set by
626 * setting a flag when calling mode set.
627 *---------------------------------------------------------------------------
628 */
629void
630gfx_reset_timing_lock(void)
631{
632   gfx_timing_lock = 0;
633}
634
635/* WRAPPERS IF DYNAMIC SELECTION */
636/* Extra layer to call either first or second generation routines. */
637
638#if GFX_DISPLAY_DYNAMIC
639
640/*---------------------------------------------------------------------------
641 * gfx_set_display_bpp
642 *---------------------------------------------------------------------------
643 */
644int
645gfx_set_display_bpp(unsigned short bpp)
646{
647   int retval = 0;
648
649#	if GFX_DISPLAY_GU1
650   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
651      retval = gu1_set_display_bpp(bpp);
652#	endif
653#	if GFX_DISPLAY_GU2
654   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
655      retval = gu2_set_display_bpp(bpp);
656#	endif
657   return (retval);
658}
659
660/*---------------------------------------------------------------------------
661 * gfx_is_display_mode_supported
662 * check if given mode supported,
663 * return the supported mode on success, -1 on fail
664 *---------------------------------------------------------------------------
665 */
666int
667gfx_is_display_mode_supported(int xres, int yres, int bpp, int hz)
668{
669   int retval = -1;
670
671#	if GFX_DISPLAY_GU1
672   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
673      retval = gu1_is_display_mode_supported(xres, yres, bpp, hz);
674#	endif
675#	if GFX_DISPLAY_GU2
676   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
677      retval = gu2_is_display_mode_supported(xres, yres, bpp, hz);
678#	endif
679   return (retval);
680}
681
682/*---------------------------------------------------------------------------
683 * gfx_set_display_mode
684 *---------------------------------------------------------------------------
685 */
686int
687gfx_set_display_mode(int xres, int yres, int bpp, int hz)
688{
689   int retval = 0;
690
691#	if GFX_DISPLAY_GU1
692   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
693      retval = gu1_set_display_mode(xres, yres, bpp, hz);
694#	endif
695#	if GFX_DISPLAY_GU2
696   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
697      retval = gu2_set_display_mode(xres, yres, bpp, hz);
698#	endif
699   return (retval);
700}
701
702/*---------------------------------------------------------------------------
703 * gfx_set_display_timings
704 *---------------------------------------------------------------------------
705 */
706int
707gfx_set_display_timings(unsigned short bpp, unsigned short flags,
708			unsigned short hactive, unsigned short hblankstart,
709			unsigned short hsyncstart, unsigned short hsyncend,
710			unsigned short hblankend, unsigned short htotal,
711			unsigned short vactive, unsigned short vblankstart,
712			unsigned short vsyncstart, unsigned short vsyncend,
713			unsigned short vblankend, unsigned short vtotal,
714			unsigned long frequency)
715{
716   int retval = 0;
717
718#	if GFX_DISPLAY_GU1
719   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
720      retval = gu1_set_display_timings(bpp, flags,
721				       hactive, hblankstart, hsyncstart,
722				       hsyncend, hblankend, htotal, vactive,
723				       vblankstart, vsyncstart, vsyncend,
724				       vblankend, vtotal, frequency);
725#	endif
726#	if GFX_DISPLAY_GU2
727   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
728      retval = gu2_set_display_timings(bpp, flags,
729				       hactive, hblankstart, hsyncstart,
730				       hsyncend, hblankend, htotal, vactive,
731				       vblankstart, vsyncstart, vsyncend,
732				       vblankend, vtotal, frequency);
733#	endif
734   return (retval);
735}
736
737/*---------------------------------------------------------------------------
738 * gfx_set_display_pitch
739 *---------------------------------------------------------------------------
740 */
741void
742gfx_set_display_pitch(unsigned short pitch)
743{
744#	if GFX_DISPLAY_GU1
745   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
746      gu1_set_display_pitch(pitch);
747#	endif
748#	if GFX_DISPLAY_GU2
749   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
750      gu2_set_display_pitch(pitch);
751#	endif
752}
753
754/*---------------------------------------------------------------------------
755 * gfx_set_display_offset
756 *---------------------------------------------------------------------------
757 */
758void
759gfx_set_display_offset(unsigned long offset)
760{
761#	if GFX_DISPLAY_GU1
762   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
763      gu1_set_display_offset(offset);
764#	endif
765#	if GFX_DISPLAY_GU2
766   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
767      gu2_set_display_offset(offset);
768#	endif
769}
770
771/*---------------------------------------------------------------------------
772 * gfx_set_display_palette_entry
773 *---------------------------------------------------------------------------
774 */
775int
776gfx_set_display_palette_entry(unsigned long index, unsigned long palette)
777{
778   int status = 0;
779
780#	if GFX_DISPLAY_GU1
781   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
782      status = gu1_set_display_palette_entry(index, palette);
783#	endif
784#	if GFX_DISPLAY_GU2
785   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
786      status = gu2_set_display_palette_entry(index, palette);
787#	endif
788   return (status);
789}
790
791/*---------------------------------------------------------------------------
792 * gfx_set_display_palette
793 *---------------------------------------------------------------------------
794 */
795int
796gfx_set_display_palette(unsigned long *palette)
797{
798   int status = 0;
799
800#	if GFX_DISPLAY_GU1
801   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
802      status = gu1_set_display_palette(palette);
803#	endif
804#	if GFX_DISPLAY_GU2
805   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
806      status = gu2_set_display_palette(palette);
807#	endif
808   return (status);
809}
810
811/*---------------------------------------------------------------------------
812 * gfx_set_cursor_enable
813 *---------------------------------------------------------------------------
814 */
815void
816gfx_set_cursor_enable(int enable)
817{
818#	if GFX_DISPLAY_GU1
819   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
820      gu1_set_cursor_enable(enable);
821#	endif
822#	if GFX_DISPLAY_GU2
823   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
824      gu2_set_cursor_enable(enable);
825#	endif
826}
827
828/*---------------------------------------------------------------------------
829 * gfx_set_cursor_colors
830 *---------------------------------------------------------------------------
831 */
832void
833gfx_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor)
834{
835#	if GFX_DISPLAY_GU1
836   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
837      gu1_set_cursor_colors(bkcolor, fgcolor);
838#	endif
839#	if GFX_DISPLAY_GU2
840   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
841      gu2_set_cursor_colors(bkcolor, fgcolor);
842#	endif
843}
844
845/*---------------------------------------------------------------------------
846 * gfx_set_cursor_position
847 *---------------------------------------------------------------------------
848 */
849void
850gfx_set_cursor_position(unsigned long memoffset,
851			unsigned short xpos, unsigned short ypos,
852			unsigned short xhotspot, unsigned short yhotspot)
853{
854#	if GFX_DISPLAY_GU1
855   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
856      gu1_set_cursor_position(memoffset, xpos, ypos, xhotspot, yhotspot);
857#	endif
858#	if GFX_DISPLAY_GU2
859   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
860      gu2_set_cursor_position(memoffset, xpos, ypos, xhotspot, yhotspot);
861#	endif
862}
863
864/*---------------------------------------------------------------------------
865 * gfx_set_cursor_shape32
866 *---------------------------------------------------------------------------
867 */
868void
869gfx_set_cursor_shape32(unsigned long memoffset,
870		       unsigned long *andmask, unsigned long *xormask)
871{
872#	if GFX_DISPLAY_GU1
873   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
874      gu1_set_cursor_shape32(memoffset, andmask, xormask);
875#	endif
876#	if GFX_DISPLAY_GU2
877   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
878      gu2_set_cursor_shape32(memoffset, andmask, xormask);
879#	endif
880}
881
882/*---------------------------------------------------------------------------
883 * gfx_set_cursor_shape64
884 *---------------------------------------------------------------------------
885 */
886void
887gfx_set_cursor_shape64(unsigned long memoffset,
888		       unsigned long *andmask, unsigned long *xormask)
889{
890#	if GFX_DISPLAY_GU2
891   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
892      gu2_set_cursor_shape64(memoffset, andmask, xormask);
893#	endif
894}
895
896/*---------------------------------------------------------------------------
897 * gfx_set_icon_enable
898 *---------------------------------------------------------------------------
899 */
900void
901gfx_set_icon_enable(int enable)
902{
903#	if GFX_DISPLAY_GU2
904   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
905      gu2_set_icon_enable(enable);
906#	endif
907}
908
909/*---------------------------------------------------------------------------
910 * gfx_set_icon_colors
911 *---------------------------------------------------------------------------
912 */
913void
914gfx_set_icon_colors(unsigned long color0, unsigned long color1,
915		    unsigned long color2)
916{
917#	if GFX_DISPLAY_GU2
918   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
919      gu2_set_icon_colors(color0, color1, color2);
920#	endif
921}
922
923/*---------------------------------------------------------------------------
924 * gfx_set_icon_position
925 *---------------------------------------------------------------------------
926 */
927void
928gfx_set_icon_position(unsigned long memoffset, unsigned short xpos)
929{
930#	if GFX_DISPLAY_GU2
931   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
932      gu2_set_icon_position(memoffset, xpos);
933#	endif
934}
935
936/*---------------------------------------------------------------------------
937 * gfx_set_icon_shape64
938 *---------------------------------------------------------------------------
939 */
940void
941gfx_set_icon_shape64(unsigned long memoffset,
942		     unsigned long *andmask, unsigned long *xormask,
943		     unsigned int lines)
944{
945#	if GFX_DISPLAY_GU2
946   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
947      gu2_set_icon_shape64(memoffset, andmask, xormask, lines);
948#	endif
949}
950
951/*---------------------------------------------------------------------------
952 * gfx_set_compression_enable
953 *---------------------------------------------------------------------------
954 */
955int
956gfx_set_compression_enable(int enable)
957{
958   int status = 0;
959
960#	if GFX_DISPLAY_GU1
961   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
962      status = gu1_set_compression_enable(enable);
963#	endif
964#	if GFX_DISPLAY_GU2
965   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
966      status = gu2_set_compression_enable(enable);
967#	endif
968   return (status);
969}
970
971/*---------------------------------------------------------------------------
972 * gfx_set_compression_offset
973 *---------------------------------------------------------------------------
974 */
975int
976gfx_set_compression_offset(unsigned long offset)
977{
978   int status = 0;
979
980#	if GFX_DISPLAY_GU1
981   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
982      status = gu1_set_compression_offset(offset);
983#	endif
984#	if GFX_DISPLAY_GU2
985   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
986      status = gu2_set_compression_offset(offset);
987#	endif
988   return (status);
989}
990
991/*---------------------------------------------------------------------------
992 * gfx_set_compression_pitch
993 *---------------------------------------------------------------------------
994 */
995int
996gfx_set_compression_pitch(unsigned short pitch)
997{
998   int status = 0;
999
1000#	if GFX_DISPLAY_GU1
1001   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1002      status = gu1_set_compression_pitch(pitch);
1003#	endif
1004#	if GFX_DISPLAY_GU2
1005   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1006      status = gu2_set_compression_pitch(pitch);
1007#	endif
1008   return (status);
1009}
1010
1011/*---------------------------------------------------------------------------
1012 * gfx_set_compression_size
1013 *---------------------------------------------------------------------------
1014 */
1015int
1016gfx_set_compression_size(unsigned short size)
1017{
1018   int status = 0;
1019
1020#	if GFX_DISPLAY_GU1
1021   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1022      status = gu1_set_compression_size(size);
1023#	endif
1024#	if GFX_DISPLAY_GU2
1025   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1026      status = gu2_set_compression_size(size);
1027#	endif
1028   return (status);
1029}
1030
1031/*---------------------------------------------------------------------------
1032 * gfx_set_display_priority_high
1033 *---------------------------------------------------------------------------
1034 */
1035void
1036gfx_set_display_priority_high(int enable)
1037{
1038#	if GFX_DISPLAY_GU1
1039   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1040      gu1_set_display_priority_high(enable);
1041#	endif
1042}
1043
1044/*---------------------------------------------------------------------------
1045 * gfx_set_display_video_format (PRIVATE ROUTINE - NOT PART OF API)
1046 *
1047 * This routine is called by "gfx_set_video_format".  It abstracts the
1048 * version of the display controller from the video overlay routines.
1049 *---------------------------------------------------------------------------
1050 */
1051void
1052gfx_set_display_video_format(unsigned long format)
1053{
1054#	if GFX_DISPLAY_GU2
1055   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1056      gu2_set_display_video_format(format);
1057#	endif
1058}
1059
1060/*---------------------------------------------------------------------------
1061 * gfx_set_display_video_enable (PRIVATE ROUTINE - NOT PART OF API)
1062 *
1063 * This routine is called by "gfx_set_video_enable".  It abstracts the
1064 * version of the display controller from the video overlay routines.
1065 *---------------------------------------------------------------------------
1066 */
1067void
1068gfx_set_display_video_enable(int enable)
1069{
1070#	if GFX_DISPLAY_GU1
1071   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1072      gu1_set_display_video_enable(enable);
1073#	endif
1074#	if GFX_DISPLAY_GU2
1075   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1076      gu2_set_display_video_enable(enable);
1077#	endif
1078   return;
1079}
1080
1081/*---------------------------------------------------------------------------
1082 * gfx_set_display_video_size (PRIVATE ROUTINE - NOT PART OF API)
1083 *
1084 * This routine is called by "gfx_set_video_size".  It abstracts the
1085 * version of the display controller from the video overlay routines.
1086 *---------------------------------------------------------------------------
1087 */
1088void
1089gfx_set_display_video_size(unsigned short width, unsigned short height)
1090{
1091#	if GFX_DISPLAY_GU1
1092   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1093      gu1_set_display_video_size(width, height);
1094#	endif
1095#	if GFX_DISPLAY_GU2
1096   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1097      gu2_set_display_video_size(width, height);
1098#	endif
1099}
1100
1101/*---------------------------------------------------------------------------
1102 * gfx_set_display_video_offset (PRIVATE ROUTINE - NOT PART OF API)
1103 *
1104 * This routine is called by "gfx_set_video_offset".  It abstracts the
1105 * version of the display controller from the video overlay routines.
1106 *---------------------------------------------------------------------------
1107 */
1108void
1109gfx_set_display_video_offset(unsigned long offset)
1110{
1111#	if GFX_DISPLAY_GU1
1112   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1113      gu1_set_display_video_offset(offset);
1114#	endif
1115#	if GFX_DISPLAY_GU2
1116   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1117      gu2_set_display_video_offset(offset);
1118#	endif
1119}
1120
1121/*---------------------------------------------------------------------------
1122 * gfx_set_display_video_yuv_offsets (PRIVATE ROUTINE - NOT PART OF API)
1123 *
1124 * This routine is called by "gfx_set_video_yuv_offsets".  It abstracts the
1125 * version of the display controller from the video overlay routines.
1126 *---------------------------------------------------------------------------
1127 */
1128void
1129gfx_set_display_video_yuv_offsets(unsigned long yoffset,
1130				  unsigned long uoffset,
1131				  unsigned long voffset)
1132{
1133#	if GFX_DISPLAY_GU2
1134   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1135      gu2_set_display_video_yuv_offsets(yoffset, uoffset, voffset);
1136#	endif
1137}
1138
1139/*---------------------------------------------------------------------------
1140 * gfx_set_display_video_yuv_pitch (PRIVATE ROUTINE - NOT PART OF API)
1141 *
1142 * This routine is called by "gfx_set_video_yuv_pitch".  It abstracts the
1143 * version of the display controller from the video overlay routines.
1144 *---------------------------------------------------------------------------
1145 */
1146void
1147gfx_set_display_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch)
1148{
1149#	if GFX_DISPLAY_GU2
1150   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1151      gu2_set_display_video_yuv_pitch(ypitch, uvpitch);
1152#	endif
1153}
1154
1155/*---------------------------------------------------------------------------
1156 * gfx_set_display_video_downscale (PRIVATE ROUTINE - NOT PART OF API)
1157 *
1158 * This routine is called by "gfx_set_video_vertical_downscale".  It abstracts the
1159 * version of the display controller from the video overlay routines.
1160 *---------------------------------------------------------------------------
1161 */
1162void
1163gfx_set_display_video_downscale(unsigned short srch, unsigned short dsth)
1164{
1165#	if GFX_DISPLAY_GU2
1166   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1167      gu2_set_display_video_downscale(srch, dsth);
1168#	endif
1169}
1170
1171/*---------------------------------------------------------------------------
1172 * gfx_set_display_video_vertical_downscale_enable (PRIVATE ROUTINE - NOT PART OF API)
1173 *
1174 * This routine is called by "gfx_set_video_vertical_downscale_enable".  It abstracts the
1175 * version of the display controller from the video overlay routines.
1176 *---------------------------------------------------------------------------
1177 */
1178void
1179gfx_set_display_video_vertical_downscale_enable(int enable)
1180{
1181#	if GFX_DISPLAY_GU2
1182   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1183      gu2_set_display_video_vertical_downscale_enable(enable);
1184#	endif
1185}
1186
1187/*---------------------------------------------------------------------------
1188 * gfx_test_timing_active
1189 *---------------------------------------------------------------------------
1190 */
1191int
1192gfx_test_timing_active(void)
1193{
1194   int status = 0;
1195
1196#	if GFX_DISPLAY_GU1
1197   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1198      status = gu1_test_timing_active();
1199#	endif
1200#	if GFX_DISPLAY_GU2
1201   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1202      status = gu2_test_timing_active();
1203#	endif
1204   return (status);
1205}
1206
1207/*---------------------------------------------------------------------------
1208 * gfx_test_vertical_active
1209 *---------------------------------------------------------------------------
1210 */
1211int
1212gfx_test_vertical_active(void)
1213{
1214   int status = 0;
1215
1216#	if GFX_DISPLAY_GU1
1217   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1218      status = gu1_test_vertical_active();
1219#	endif
1220#	if GFX_DISPLAY_GU2
1221   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1222      status = gu2_test_vertical_active();
1223#	endif
1224   return (status);
1225}
1226
1227/*---------------------------------------------------------------------------
1228 * gfx_wait_vertical_blank
1229 *---------------------------------------------------------------------------
1230 */
1231int
1232gfx_wait_vertical_blank(void)
1233{
1234   int status = 0;
1235
1236#	if GFX_DISPLAY_GU1
1237   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1238      status = gu1_wait_vertical_blank();
1239#	endif
1240#	if GFX_DISPLAY_GU2
1241   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1242      status = gu2_wait_vertical_blank();
1243#	endif
1244   return (status);
1245}
1246
1247/*---------------------------------------------------------------------------
1248 * gfx_delay_milliseconds
1249 *---------------------------------------------------------------------------
1250 */
1251void
1252gfx_delay_milliseconds(unsigned long milliseconds)
1253{
1254#	if GFX_DISPLAY_GU1
1255   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1256      gu1_delay_milliseconds(milliseconds);
1257#	endif
1258#	if GFX_DISPLAY_GU2
1259   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1260      gu2_delay_milliseconds(milliseconds);
1261#	endif
1262}
1263
1264/*---------------------------------------------------------------------------
1265 * gfx_delay_microseconds
1266 *---------------------------------------------------------------------------
1267 */
1268void
1269gfx_delay_microseconds(unsigned long microseconds)
1270{
1271#	if GFX_DISPLAY_GU1
1272   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1273      gu1_delay_microseconds(microseconds);
1274#	endif
1275#	if GFX_DISPLAY_GU2
1276   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1277      gu2_delay_microseconds(microseconds);
1278#	endif
1279}
1280
1281/*---------------------------------------------------------------------------
1282 * gfx_enable_panning
1283 *
1284 * This routine  enables the panning when the Mode is bigger than the panel
1285 * size.
1286 *---------------------------------------------------------------------------
1287 */
1288void
1289gfx_enable_panning(int x, int y)
1290{
1291#	if GFX_DISPLAY_GU1
1292   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1293      gu1_enable_panning(x, y);
1294#	endif
1295#	if GFX_DISPLAY_GU2
1296   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1297      gu2_enable_panning(x, y);
1298#	endif
1299}
1300
1301/*---------------------------------------------------------------------------
1302 * gfx_set_fixed_timings
1303 *---------------------------------------------------------------------------
1304 */
1305int
1306gfx_set_fixed_timings(int panelResX, int panelResY, unsigned short width,
1307		      unsigned short height, unsigned short bpp)
1308{
1309   int status = 0;
1310
1311#	if GFX_DISPLAY_GU1
1312   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1313      status =
1314	    gu1_set_fixed_timings(panelResX, panelResY, width, height, bpp);
1315#	endif
1316#	if GFX_DISPLAY_GU2
1317   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1318      status =
1319	    gu2_set_fixed_timings(panelResX, panelResY, width, height, bpp);
1320#	endif
1321   return (status);
1322}
1323
1324/*---------------------------------------------------------------------------
1325 * gfx_set_panel_present
1326 *---------------------------------------------------------------------------
1327 */
1328int
1329gfx_set_panel_present(int panelResX, int panelResY, unsigned short width,
1330		      unsigned short height, unsigned short bpp)
1331{
1332   int status = 0;
1333
1334#	if GFX_DISPLAY_GU1
1335   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1336      status =
1337	    gu1_set_panel_present(panelResX, panelResY, width, height, bpp);
1338#	endif
1339#	if GFX_DISPLAY_GU2
1340   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1341      status =
1342	    gu2_set_panel_present(panelResX, panelResY, width, height, bpp);
1343#	endif
1344   return (status);
1345}
1346
1347/*---------------------------------------------------------------------------
1348 * gfx_set_vtotal
1349 *---------------------------------------------------------------------------
1350 */
1351int
1352gfx_set_vtotal(unsigned short vtotal)
1353{
1354   int retval = 0;
1355
1356#	if GFX_DISPLAY_GU1
1357   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1358      retval = gu1_set_vtotal(vtotal);
1359#	endif
1360#	if GFX_DISPLAY_GU2
1361   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1362      retval = gu2_set_vtotal(vtotal);
1363#	endif
1364   return (retval);
1365}
1366
1367/*-----------------------------------------------------------------------*
1368 * THE FOLLOWING READ ROUTINES ARE ALWAYS INCLUDED:                      *
1369 * gfx_get_hsync_end, gfx_get_htotal, gfx_get_vsync_end, gfx_get_vtotal  *
1370 * are used by the video overlay routines.                               *
1371 *                                                                       *
1372 * gfx_get_vline and gfx_vactive are used to prevent an issue for the    *
1373 * SC1200.                                                               *
1374 *                                                                       *
1375 * The others are part of the Durango API.                               *
1376 *-----------------------------------------------------------------------*/
1377
1378/*----------------------------------------------------------------------------
1379 * gfx_mode_frequency_supported
1380 *----------------------------------------------------------------------------
1381 */
1382int
1383gfx_mode_frequency_supported(int xres, int yres, int bpp,
1384			     unsigned long frequency)
1385{
1386   int freq = 0;
1387
1388#	if GFX_DISPLAY_GU1
1389   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1390      freq = gu1_mode_frequency_supported(xres, yres, bpp, frequency);
1391#	endif
1392#	if GFX_DISPLAY_GU2
1393   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1394      freq = gu2_mode_frequency_supported(xres, yres, bpp, frequency);
1395#	endif
1396   return (freq);
1397}
1398
1399/*----------------------------------------------------------------------------
1400 * gfx_refreshrate_from_frequency
1401 *----------------------------------------------------------------------------
1402 */
1403int
1404gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz,
1405				   unsigned long frequency)
1406{
1407#	if GFX_DISPLAY_GU1
1408   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1409      gu1_get_refreshrate_from_frequency(xres, yres, bpp, hz, frequency);
1410#	endif
1411#	if GFX_DISPLAY_GU2
1412   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1413      gu2_get_refreshrate_from_frequency(xres, yres, bpp, hz, frequency);
1414#	endif
1415
1416   return (1);
1417}
1418
1419/*----------------------------------------------------------------------------
1420 * gfx_refreshrate_from_mode
1421 *----------------------------------------------------------------------------
1422 */
1423int
1424gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz,
1425			      unsigned long frequency)
1426{
1427#	if GFX_DISPLAY_GU1
1428   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1429      gu1_get_refreshrate_from_mode(xres, yres, bpp, hz, frequency);
1430#	endif
1431#	if GFX_DISPLAY_GU2
1432   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1433      gu2_get_refreshrate_from_mode(xres, yres, bpp, hz, frequency);
1434#	endif
1435
1436   return (1);
1437}
1438
1439/*----------------------------------------------------------------------------
1440 * gfx_get_frequency_from_refreshrate
1441 *----------------------------------------------------------------------------
1442 */
1443int
1444gfx_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz,
1445				   int *frequency)
1446{
1447   int retval = -1;
1448
1449#	if GFX_DISPLAY_GU1
1450   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1451      retval =
1452	    gu1_get_frequency_from_refreshrate(xres, yres, bpp, hz,
1453					       frequency);
1454#	endif
1455#	if GFX_DISPLAY_GU2
1456   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1457      retval =
1458	    gu2_get_frequency_from_refreshrate(xres, yres, bpp, hz,
1459					       frequency);
1460#	endif
1461
1462   return retval;
1463}
1464
1465/*---------------------------------------------------------------------------
1466 * gfx_get_max_supported_pixel_clock
1467 *---------------------------------------------------------------------------
1468 */
1469unsigned long
1470gfx_get_max_supported_pixel_clock(void)
1471{
1472   unsigned long status = 0;
1473
1474#	if GFX_DISPLAY_GU1
1475   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1476      status = gu1_get_max_supported_pixel_clock();
1477#	endif
1478#	if GFX_DISPLAY_GU2
1479   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1480      status = gu2_get_max_supported_pixel_clock();
1481#	endif
1482   return (status);
1483}
1484
1485/*---------------------------------------------------------------------------
1486 * gfx_get_display_pitch
1487 *---------------------------------------------------------------------------
1488 */
1489unsigned short
1490gfx_get_display_pitch(void)
1491{
1492   unsigned short pitch = 0;
1493
1494#	if GFX_DISPLAY_GU1
1495   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1496      pitch = gu1_get_display_pitch();
1497#	endif
1498#	if GFX_DISPLAY_GU2
1499   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1500      pitch = gu2_get_display_pitch();
1501#	endif
1502   return (pitch);
1503}
1504
1505/*---------------------------------------------------------------------------
1506 * gfx_get_display_mode_count
1507 * return # of modes supported.
1508 *---------------------------------------------------------------------------
1509 */
1510int
1511gfx_get_display_mode_count(void)
1512{
1513   int retval = 0;
1514
1515#	if GFX_DISPLAY_GU1
1516   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1517      retval = gu1_get_display_mode_count();
1518#	endif
1519#	if GFX_DISPLAY_GU2
1520   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1521      retval = gu2_get_display_mode_count();
1522#	endif
1523   return (retval);
1524}
1525
1526/*---------------------------------------------------------------------------
1527 * gfx_get_frame_buffer_line_size
1528 *---------------------------------------------------------------------------
1529 */
1530unsigned long
1531gfx_get_frame_buffer_line_size(void)
1532{
1533   unsigned long retval = 0;
1534
1535#	if GFX_DISPLAY_GU1
1536   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1537      retval = gu1_get_frame_buffer_line_size();
1538#	endif
1539#	if GFX_DISPLAY_GU2
1540   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1541      retval = gu2_get_frame_buffer_line_size();
1542#	endif
1543   return (retval);
1544}
1545
1546/*---------------------------------------------------------------------------
1547 * gfx_get_display_mode
1548 * get the curent mode set,
1549 * return the supported mode on success, -1 on fail
1550 *---------------------------------------------------------------------------
1551 */
1552int
1553gfx_get_display_mode(int *xres, int *yres, int *bpp, int *hz)
1554{
1555   int retval = -1;
1556
1557#	if GFX_DISPLAY_GU1
1558   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1559      retval = gu1_get_display_mode(xres, yres, bpp, hz);
1560#	endif
1561#	if GFX_DISPLAY_GU2
1562   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1563      retval = gu2_get_display_mode(xres, yres, bpp, hz);
1564#	endif
1565   return (retval);
1566}
1567
1568/*---------------------------------------------------------------------------
1569 * gfx_get_display_details
1570 * given the mode get's the resoultion details, width, height, freq
1571 *---------------------------------------------------------------------------
1572 */
1573int
1574gfx_get_display_details(unsigned int mode, int *xres, int *yres, int *hz)
1575{
1576   int retval = -1;
1577
1578#	if GFX_DISPLAY_GU1
1579   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1580      retval = gu1_get_display_details(mode, xres, yres, hz);
1581#	endif
1582#	if GFX_DISPLAY_GU2
1583   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1584      retval = gu2_get_display_details(mode, xres, yres, hz);
1585#	endif
1586   return (retval);
1587}
1588
1589/*---------------------------------------------------------------------------
1590 * gfx_get_hactive
1591 *---------------------------------------------------------------------------
1592 */
1593unsigned short
1594gfx_get_hactive(void)
1595{
1596   unsigned short hactive = 0;
1597
1598#	if GFX_DISPLAY_GU1
1599   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1600      hactive = gu1_get_hactive();
1601#	endif
1602#	if GFX_DISPLAY_GU2
1603   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1604      hactive = gu2_get_hactive();
1605#	endif
1606   return (hactive);
1607}
1608
1609/*---------------------------------------------------------------------------
1610 * gfx_get_hsync_start
1611 *---------------------------------------------------------------------------
1612 */
1613unsigned short
1614gfx_get_hsync_start(void)
1615{
1616   unsigned short hsync_start = 0;
1617
1618#	if GFX_DISPLAY_GU1
1619   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1620      hsync_start = gu1_get_hsync_start();
1621#	endif
1622#	if GFX_DISPLAY_GU2
1623   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1624      hsync_start = gu2_get_hsync_start();
1625#	endif
1626   return (hsync_start);
1627}
1628
1629/*---------------------------------------------------------------------------
1630 * gfx_get_hsync_end
1631 *---------------------------------------------------------------------------
1632 */
1633unsigned short
1634gfx_get_hsync_end(void)
1635{
1636   unsigned short hsync_end = 0;
1637
1638#	if GFX_DISPLAY_GU1
1639   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1640      hsync_end = gu1_get_hsync_end();
1641#	endif
1642#	if GFX_DISPLAY_GU2
1643   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1644      hsync_end = gu2_get_hsync_end();
1645#	endif
1646   return (hsync_end);
1647}
1648
1649/*---------------------------------------------------------------------------
1650 * gfx_get_htotal
1651 *---------------------------------------------------------------------------
1652 */
1653unsigned short
1654gfx_get_htotal(void)
1655{
1656   unsigned short htotal = 0;
1657
1658#	if GFX_DISPLAY_GU1
1659   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1660      htotal = gu1_get_htotal();
1661#	endif
1662#	if GFX_DISPLAY_GU2
1663   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1664      htotal = gu2_get_htotal();
1665#	endif
1666   return (htotal);
1667}
1668
1669/*---------------------------------------------------------------------------
1670 * gfx_get_vactive
1671 *---------------------------------------------------------------------------
1672 */
1673unsigned short
1674gfx_get_vactive(void)
1675{
1676   unsigned short vactive = 0;
1677
1678#	if GFX_DISPLAY_GU1
1679   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1680      vactive = gu1_get_vactive();
1681#	endif
1682#	if GFX_DISPLAY_GU2
1683   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1684      vactive = gu2_get_vactive();
1685#	endif
1686   return (vactive);
1687}
1688
1689/*---------------------------------------------------------------------------
1690 * gfx_get_vsync_end
1691 *---------------------------------------------------------------------------
1692 */
1693unsigned short
1694gfx_get_vsync_end(void)
1695{
1696   unsigned short vsync_end = 0;
1697
1698#	if GFX_DISPLAY_GU1
1699   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1700      vsync_end = gu1_get_vsync_end();
1701#	endif
1702#	if GFX_DISPLAY_GU2
1703   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1704      vsync_end = gu2_get_vsync_end();
1705#	endif
1706   return (vsync_end);
1707}
1708
1709/*---------------------------------------------------------------------------
1710 * gfx_get_vtotal
1711 *---------------------------------------------------------------------------
1712 */
1713unsigned short
1714gfx_get_vtotal(void)
1715{
1716   unsigned short vtotal = 0;
1717
1718#	if GFX_DISPLAY_GU1
1719   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1720      vtotal = gu1_get_vtotal();
1721#	endif
1722#	if GFX_DISPLAY_GU2
1723   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1724      vtotal = gu2_get_vtotal();
1725#	endif
1726   return (vtotal);
1727}
1728
1729/*---------------------------------------------------------------------------
1730 *  gfx_get_display_bpp
1731 *---------------------------------------------------------------------------
1732 */
1733unsigned short
1734gfx_get_display_bpp(void)
1735{
1736   unsigned short bpp = 0;
1737
1738#	if GFX_DISPLAY_GU1
1739   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1740      bpp = gu1_get_display_bpp();
1741#	endif
1742#	if GFX_DISPLAY_GU2
1743   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1744      bpp = gu2_get_display_bpp();
1745#	endif
1746   return (bpp);
1747}
1748
1749/*---------------------------------------------------------------------------
1750 * gfx_get_vline
1751 *---------------------------------------------------------------------------
1752 */
1753unsigned short
1754gfx_get_vline(void)
1755{
1756   unsigned short vline = 0;
1757
1758#	if GFX_DISPLAY_GU1
1759   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1760      vline = gu1_get_vline();
1761#	endif
1762#	if GFX_DISPLAY_GU2
1763   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1764      vline = gu2_get_vline();
1765#	endif
1766   return (vline);
1767}
1768
1769/*---------------------------------------------------------------------------
1770 *  gfx_get_display_offset
1771 *---------------------------------------------------------------------------
1772 */
1773unsigned long
1774gfx_get_display_offset(void)
1775{
1776   unsigned long offset = 0;
1777
1778#	if GFX_DISPLAY_GU1
1779   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1780      offset = gu1_get_display_offset();
1781#	endif
1782#	if GFX_DISPLAY_GU2
1783   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1784      offset = gu2_get_display_offset();
1785#	endif
1786   return (offset);
1787}
1788
1789/*---------------------------------------------------------------------------
1790 *  gfx_get_cursor_offset
1791 *---------------------------------------------------------------------------
1792 */
1793unsigned long
1794gfx_get_cursor_offset(void)
1795{
1796   unsigned long base = 0;
1797
1798#	if GFX_DISPLAY_GU1
1799   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1800      base = gu1_get_cursor_offset();
1801#	endif
1802#	if GFX_DISPLAY_GU2
1803   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1804      base = gu2_get_cursor_offset();
1805#	endif
1806   return (base);
1807}
1808
1809/*************************************************************/
1810/*  READ ROUTINES  |  INCLUDED FOR DIAGNOSTIC PURPOSES ONLY  */
1811/*************************************************************/
1812
1813#if GFX_READ_ROUTINES
1814
1815/*---------------------------------------------------------------------------
1816 * gfx_get_hblank_start
1817 *---------------------------------------------------------------------------
1818 */
1819unsigned short
1820gfx_get_hblank_start(void)
1821{
1822   unsigned short hblank_start = 0;
1823
1824#	if GFX_DISPLAY_GU1
1825   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1826      hblank_start = gu1_get_hblank_start();
1827#	endif
1828#	if GFX_DISPLAY_GU2
1829   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1830      hblank_start = gu2_get_hblank_start();
1831#	endif
1832   return (hblank_start);
1833}
1834
1835/*---------------------------------------------------------------------------
1836 * gfx_get_hblank_end
1837 *---------------------------------------------------------------------------
1838 */
1839unsigned short
1840gfx_get_hblank_end(void)
1841{
1842   unsigned short hblank_end = 0;
1843
1844#	if GFX_DISPLAY_GU1
1845   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1846      hblank_end = gu1_get_hblank_end();
1847#	endif
1848#	if GFX_DISPLAY_GU2
1849   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1850      hblank_end = gu2_get_hblank_end();
1851#	endif
1852   return (hblank_end);
1853}
1854
1855/*---------------------------------------------------------------------------
1856 * gfx_get_vblank_start
1857 *---------------------------------------------------------------------------
1858 */
1859unsigned short
1860gfx_get_vblank_start(void)
1861{
1862   unsigned short vblank_start = 0;
1863
1864#	if GFX_DISPLAY_GU1
1865   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1866      vblank_start = gu1_get_vblank_start();
1867#	endif
1868#	if GFX_DISPLAY_GU2
1869   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1870      vblank_start = gu2_get_vblank_start();
1871#	endif
1872   return (vblank_start);
1873}
1874
1875/*---------------------------------------------------------------------------
1876 * gfx_get_vsync_start
1877 *---------------------------------------------------------------------------
1878 */
1879unsigned short
1880gfx_get_vsync_start(void)
1881{
1882   unsigned short vsync_start = 0;
1883
1884#	if GFX_DISPLAY_GU1
1885   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1886      vsync_start = gu1_get_vsync_start();
1887#	endif
1888#	if GFX_DISPLAY_GU2
1889   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1890      vsync_start = gu2_get_vsync_start();
1891#	endif
1892   return (vsync_start);
1893}
1894
1895/*---------------------------------------------------------------------------
1896 * gfx_get_vblank_end
1897 *---------------------------------------------------------------------------
1898 */
1899unsigned short
1900gfx_get_vblank_end(void)
1901{
1902   unsigned short vblank_end = 0;
1903
1904#	if GFX_DISPLAY_GU1
1905   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1906      vblank_end = gu1_get_vblank_end();
1907#	endif
1908#	if GFX_DISPLAY_GU2
1909   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1910      vblank_end = gu2_get_vblank_end();
1911#	endif
1912   return (vblank_end);
1913}
1914
1915/*---------------------------------------------------------------------------
1916 *  gfx_get_display_palette_entry
1917 *---------------------------------------------------------------------------
1918 */
1919int
1920gfx_get_display_palette_entry(unsigned long index, unsigned long *palette)
1921{
1922   int status = 0;
1923
1924#	if GFX_DISPLAY_GU1
1925   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1926      status = gu1_get_display_palette_entry(index, palette);
1927#	endif
1928#	if GFX_DISPLAY_GU2
1929   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1930      status = gu2_get_display_palette_entry(index, palette);
1931#	endif
1932
1933   return status;
1934}
1935
1936/*---------------------------------------------------------------------------
1937 *  gfx_get_display_palette
1938 *---------------------------------------------------------------------------
1939 */
1940void
1941gfx_get_display_palette(unsigned long *palette)
1942{
1943#	if GFX_DISPLAY_GU1
1944   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1945      gu1_get_display_palette(palette);
1946#	endif
1947#	if GFX_DISPLAY_GU2
1948   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1949      gu2_get_display_palette(palette);
1950#	endif
1951}
1952
1953/*---------------------------------------------------------------------------
1954 *  gfx_get_cursor_enable
1955 *---------------------------------------------------------------------------
1956 */
1957unsigned long
1958gfx_get_cursor_enable(void)
1959{
1960   unsigned long enable = 0;
1961
1962#	if GFX_DISPLAY_GU1
1963   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1964      enable = gu1_get_cursor_enable();
1965#	endif
1966#	if GFX_DISPLAY_GU2
1967   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1968      enable = gu2_get_cursor_enable();
1969#	endif
1970   return (enable);
1971}
1972
1973/*---------------------------------------------------------------------------
1974 *  gfx_get_cursor_position
1975 *---------------------------------------------------------------------------
1976 */
1977unsigned long
1978gfx_get_cursor_position(void)
1979{
1980   unsigned long position = 0;
1981
1982#	if GFX_DISPLAY_GU1
1983   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
1984      position = gu1_get_cursor_position();
1985#	endif
1986#	if GFX_DISPLAY_GU2
1987   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
1988      position = gu2_get_cursor_position();
1989#	endif
1990   return (position);
1991}
1992
1993/*---------------------------------------------------------------------------
1994 *  gfx_get_cursor_clip
1995 *---------------------------------------------------------------------------
1996 */
1997unsigned long
1998gfx_get_cursor_clip(void)
1999{
2000   unsigned long offset = 0;
2001
2002#	if GFX_DISPLAY_GU1
2003   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
2004      offset = gu1_get_cursor_clip();
2005#	endif
2006#	if GFX_DISPLAY_GU2
2007   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
2008      offset = gu2_get_cursor_clip();
2009#	endif
2010   return (offset);
2011}
2012
2013/*---------------------------------------------------------------------------
2014 *  gfx_get_cursor_color
2015 *---------------------------------------------------------------------------
2016 */
2017unsigned long
2018gfx_get_cursor_color(int index)
2019{
2020   unsigned long color = 0;
2021
2022#	if GFX_DISPLAY_GU1
2023   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
2024      color = gu1_get_cursor_color(index);
2025#	endif
2026#	if GFX_DISPLAY_GU2
2027   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
2028      color = gu2_get_cursor_color(index);
2029#	endif
2030   return (color);
2031}
2032
2033/*---------------------------------------------------------------------------
2034 *  gfx_get_icon_enable
2035 *---------------------------------------------------------------------------
2036 */
2037unsigned long
2038gfx_get_icon_enable(void)
2039{
2040   unsigned long enable = 0;
2041
2042#	if GFX_DISPLAY_GU2
2043   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
2044      enable = gu2_get_icon_enable();
2045#	endif
2046   return (enable);
2047}
2048
2049/*---------------------------------------------------------------------------
2050 *  gfx_get_icon_offset
2051 *---------------------------------------------------------------------------
2052 */
2053unsigned long
2054gfx_get_icon_offset(void)
2055{
2056   unsigned long base = 0;
2057
2058#	if GFX_DISPLAY_GU2
2059   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
2060      base = gu2_get_icon_offset();
2061#	endif
2062
2063   return (base);
2064}
2065
2066/*---------------------------------------------------------------------------
2067 *  gfx_get_icon_position
2068 *---------------------------------------------------------------------------
2069 */
2070unsigned long
2071gfx_get_icon_position(void)
2072{
2073   unsigned long position = 0;
2074
2075#	if GFX_DISPLAY_GU2
2076   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
2077      position = gu2_get_icon_position();
2078#	endif
2079
2080   return (position);
2081}
2082
2083/*---------------------------------------------------------------------------
2084 *  gfx_get_icon_color
2085 *---------------------------------------------------------------------------
2086 */
2087unsigned long
2088gfx_get_icon_color(int index)
2089{
2090   unsigned long color = 0;
2091
2092#	if GFX_DISPLAY_GU2
2093   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
2094      color = gu2_get_icon_color(index);
2095#	endif
2096
2097   return (color);
2098}
2099
2100/*---------------------------------------------------------------------------
2101 *  gfx_get_compression_enable
2102 *---------------------------------------------------------------------------
2103 */
2104int
2105gfx_get_compression_enable(void)
2106{
2107   int enable = 0;
2108
2109#	if GFX_DISPLAY_GU1
2110   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
2111      enable = gu1_get_compression_enable();
2112#	endif
2113#	if GFX_DISPLAY_GU2
2114   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
2115      enable = gu2_get_compression_enable();
2116#	endif
2117   return (enable);
2118}
2119
2120/*---------------------------------------------------------------------------
2121 *  gfx_get_compression_offset
2122 *---------------------------------------------------------------------------
2123 */
2124unsigned long
2125gfx_get_compression_offset(void)
2126{
2127   unsigned long offset = 0;
2128
2129#	if GFX_DISPLAY_GU1
2130   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
2131      offset = gu1_get_compression_offset();
2132#	endif
2133#	if GFX_DISPLAY_GU2
2134   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
2135      offset = gu2_get_compression_offset();
2136#	endif
2137   return (offset);
2138}
2139
2140/*---------------------------------------------------------------------------
2141 * gfx_get_compression_pitch
2142 *---------------------------------------------------------------------------
2143 */
2144unsigned short
2145gfx_get_compression_pitch(void)
2146{
2147   unsigned short pitch = 0;
2148
2149#	if GFX_DISPLAY_GU1
2150   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
2151      pitch = gu1_get_compression_pitch();
2152#	endif
2153#	if GFX_DISPLAY_GU2
2154   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
2155      pitch = gu2_get_compression_pitch();
2156#	endif
2157   return (pitch);
2158}
2159
2160/*---------------------------------------------------------------------------
2161 * gfx_get_compression_size
2162 *---------------------------------------------------------------------------
2163 */
2164unsigned short
2165gfx_get_compression_size(void)
2166{
2167   unsigned short size = 0;
2168
2169#	if GFX_DISPLAY_GU1
2170   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
2171      size = gu1_get_compression_size();
2172#	endif
2173#	if GFX_DISPLAY_GU2
2174   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
2175      size = gu2_get_compression_size();
2176#	endif
2177   return (size);
2178}
2179
2180/*---------------------------------------------------------------------------
2181 * gfx_get_display_priority_high
2182 *---------------------------------------------------------------------------
2183 */
2184int
2185gfx_get_display_priority_high(void)
2186{
2187   int high = GFX_STATUS_UNSUPPORTED;
2188
2189#	if GFX_DISPLAY_GU1
2190   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
2191      high = gu1_get_display_priority_high();
2192#	endif
2193   return (high);
2194}
2195
2196/*---------------------------------------------------------------------------
2197 * gfx_get_valid_bit
2198 *---------------------------------------------------------------------------
2199 */
2200int
2201gfx_get_valid_bit(int line)
2202{
2203   int valid = 0;
2204
2205#	if GFX_DISPLAY_GU1
2206   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
2207      valid = gu1_get_valid_bit(line);
2208#	endif
2209#	if GFX_DISPLAY_GU2
2210   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
2211      valid = gu2_get_valid_bit(line);
2212#	endif
2213   return (valid);
2214}
2215
2216/*---------------------------------------------------------------------------
2217 * gfx_get_display_video_offset
2218 *---------------------------------------------------------------------------
2219 */
2220unsigned long
2221gfx_get_display_video_offset(void)
2222{
2223   unsigned long offset = 0;
2224
2225#	if GFX_DISPLAY_GU1
2226   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
2227      offset = gu1_get_display_video_offset();
2228#	endif
2229#	if GFX_DISPLAY_GU2
2230   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
2231      offset = gu2_get_display_video_offset();
2232#	endif
2233   return (offset);
2234}
2235
2236/*---------------------------------------------------------------------------
2237 * gfx_get_display_video_yuv_offsets
2238 *---------------------------------------------------------------------------
2239 */
2240void
2241gfx_get_display_video_yuv_offsets(unsigned long *yoffset,
2242				  unsigned long *uoffset,
2243				  unsigned long *voffset)
2244{
2245#	if GFX_DISPLAY_GU2
2246   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
2247      gu2_get_display_video_yuv_offsets(yoffset, uoffset, voffset);
2248#	endif
2249}
2250
2251/*---------------------------------------------------------------------------
2252 * gfx_get_display_video_yuv_offsets
2253 *---------------------------------------------------------------------------
2254 */
2255void
2256gfx_get_display_video_yuv_pitch(unsigned long *ypitch, unsigned long *uvpitch)
2257{
2258#	if GFX_DISPLAY_GU2
2259   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
2260      gu2_get_display_video_yuv_pitch(ypitch, uvpitch);
2261#	endif
2262}
2263
2264/*---------------------------------------------------------------------------
2265 * gfx_get_display_video_downscale_delta
2266 *---------------------------------------------------------------------------
2267 */
2268unsigned long
2269gfx_get_display_video_downscale_delta(void)
2270{
2271   unsigned long ret_value = 0;
2272
2273#	if GFX_DISPLAY_GU2
2274   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
2275      ret_value = gu2_get_display_video_downscale_delta();
2276#	endif
2277
2278   return ret_value;
2279}
2280
2281/*---------------------------------------------------------------------------
2282 * gfx_get_display_video_downscale_delta
2283 *---------------------------------------------------------------------------
2284 */
2285int
2286gfx_get_display_video_downscale_enable(void)
2287{
2288   int ret_value = 0;
2289
2290#	if GFX_DISPLAY_GU2
2291   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
2292      ret_value = gu2_get_display_video_downscale_enable();
2293#	endif
2294
2295   return ret_value;
2296}
2297
2298/*---------------------------------------------------------------------------
2299 * gfx_get_display_video_size
2300 *---------------------------------------------------------------------------
2301 */
2302unsigned long
2303gfx_get_display_video_size(void)
2304{
2305   unsigned long size = 0;
2306
2307#	if GFX_DISPLAY_GU1
2308   if (gfx_display_type & GFX_DISPLAY_TYPE_GU1)
2309      size = gu1_get_display_video_size();
2310#	endif
2311#	if GFX_DISPLAY_GU2
2312   if (gfx_display_type & GFX_DISPLAY_TYPE_GU2)
2313      size = gu2_get_display_video_size();
2314#	endif
2315   return (size);
2316}
2317
2318#endif /* GFX_READ_ROUTINES */
2319
2320#endif /* GFX_DISPLAY_DYNAMIC */
2321
2322/* END OF FILE */
2323