1f29dbc25Smrg/* Copyright (c) 2005 Advanced Micro Devices, Inc.
2f29dbc25Smrg *
3f29dbc25Smrg * Permission is hereby granted, free of charge, to any person obtaining a copy
4f29dbc25Smrg * of this software and associated documentation files (the "Software"), to
5f29dbc25Smrg * deal in the Software without restriction, including without limitation the
6f29dbc25Smrg * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7f29dbc25Smrg * sell copies of the Software, and to permit persons to whom the Software is
8f29dbc25Smrg * furnished to do so, subject to the following conditions:
9f29dbc25Smrg *
10f29dbc25Smrg * The above copyright notice and this permission notice shall be included in
11f29dbc25Smrg * all copies or substantial portions of the Software.
12f29dbc25Smrg *
13f29dbc25Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14f29dbc25Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15f29dbc25Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16f29dbc25Smrg * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17f29dbc25Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18f29dbc25Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19f29dbc25Smrg * IN THE SOFTWARE.
20f29dbc25Smrg *
21f29dbc25Smrg * Neither the name of the Advanced Micro Devices, Inc. nor the names of its
22f29dbc25Smrg * contributors may be used to endorse or promote products derived from this
23f29dbc25Smrg * software without specific prior written permission.
24f29dbc25Smrg * */
25f29dbc25Smrg
26f29dbc25Smrg/*
27f29dbc25Smrg * This header file defines the Durango routines and variables used
28f29dbc25Smrg * to access the memory mapped regions.
29f29dbc25Smrg * */
30f29dbc25Smrg
31f29dbc25Smrg#ifndef _gfx_rtns_h
32f29dbc25Smrg#define _gfx_rtns_h
33f29dbc25Smrg
34f29dbc25Smrg/* INCLUDE DURANGO DEFINITIONS */
35f29dbc25Smrg/* These definitions are placed in another file to allow their inclusion
36f29dbc25Smrg * in a user application.  Such applications generally work through driver
37f29dbc25Smrg * shell routines that simply pass their parameters to Durango routines.
38f29dbc25Smrg * An external file provides an easy way to provide the definitions for these
39f29dbc25Smrg * parameters without the applications gaining any Durango visisbility.
40f29dbc25Smrg * */
41f29dbc25Smrg
42f29dbc25Smrg#include "gfx_type.h"
43f29dbc25Smrg
44f29dbc25Smrg/* COMPILER OPTION FOR C++ PROGRAMS */
45f29dbc25Smrg
46f29dbc25Smrg#ifdef __cplusplus
4704007ebaSmrgextern "C" {
48f29dbc25Smrg#endif
49f29dbc25Smrg
50f29dbc25Smrg/* DURANGO MEMORY POINTERS */
51f29dbc25Smrg
52f29dbc25Smrg    extern unsigned char *gfx_virt_regptr;
53f29dbc25Smrg    extern unsigned char *gfx_virt_fbptr;
54f29dbc25Smrg    extern unsigned char *gfx_virt_vidptr;
55f29dbc25Smrg    extern unsigned char *gfx_virt_vipptr;
56f29dbc25Smrg    extern unsigned char *gfx_virt_spptr;
57f29dbc25Smrg    extern unsigned char *gfx_virt_gpptr;
58f29dbc25Smrg
59f29dbc25Smrg    extern unsigned char *gfx_phys_regptr;
60f29dbc25Smrg    extern unsigned char *gfx_phys_fbptr;
61f29dbc25Smrg    extern unsigned char *gfx_phys_vidptr;
62f29dbc25Smrg    extern unsigned char *gfx_phys_vipptr;
63f29dbc25Smrg    extern unsigned char *gfx_phys_spptr;
64f29dbc25Smrg    extern unsigned char *gfx_phys_gpptr;
65f29dbc25Smrg
6679d5fcd7Smrg/* DURANGO VARIABLES FOR RUNTIME SELECTION AND POSSIBLE VALUES */
67f29dbc25Smrg
68f29dbc25Smrg    extern int gfx_display_type;
69f29dbc25Smrg#define GFX_DISPLAY_TYPE_GU1		0x0001
70f29dbc25Smrg#define GFX_DISPLAY_TYPE_GU2		0x0002
71f29dbc25Smrg
72f29dbc25Smrg    extern int gfx_init_type;
73f29dbc25Smrg#define GFX_INIT_TYPE_GU1           0x0001
74f29dbc25Smrg#define GFX_INIT_TYPE_GU2           0x0002
75f29dbc25Smrg
76f29dbc25Smrg    extern int gfx_msr_type;
77f29dbc25Smrg#define GFX_MSR_TYPE_REDCLOUD       0x0001
78f29dbc25Smrg
79f29dbc25Smrg    extern int gfx_2daccel_type;
80f29dbc25Smrg#define GFX_2DACCEL_TYPE_GU1		0x0001
81f29dbc25Smrg#define GFX_2DACCEL_TYPE_GU2		0x0002
82f29dbc25Smrg
83f29dbc25Smrg    extern int gfx_video_type;
84f29dbc25Smrg#define GFX_VIDEO_TYPE_CS5530		0x0001
85f29dbc25Smrg#define GFX_VIDEO_TYPE_SC1200		0x0002
86f29dbc25Smrg#define GFX_VIDEO_TYPE_REDCLOUD     0x0004
87f29dbc25Smrg
88f29dbc25Smrg    extern int gfx_vip_type;
89f29dbc25Smrg#define GFX_VIP_TYPE_SC1200			0x0001
90f29dbc25Smrg
91f29dbc25Smrg    extern int gfx_decoder_type;
92f29dbc25Smrg#define GFX_DECODER_TYPE_SAA7114	0x0001
93f29dbc25Smrg
94f29dbc25Smrg    extern int gfx_tv_type;
95f29dbc25Smrg#define GFX_TV_TYPE_SC1200			0x0001
96f29dbc25Smrg#define GFX_TV_TYPE_FS451			0x0002
97f29dbc25Smrg
98f29dbc25Smrg    extern int gfx_i2c_type;
99f29dbc25Smrg#define GFX_I2C_TYPE_ACCESS			0x0001
100f29dbc25Smrg#define GFX_I2C_TYPE_GPIO			0x0002
101f29dbc25Smrg
102f29dbc25Smrg/* GLOBAL CPU INFORMATION */
103f29dbc25Smrg
104f29dbc25Smrg    extern unsigned long gfx_cpu_version;
105f29dbc25Smrg    extern unsigned long gfx_cpu_frequency;
106f29dbc25Smrg    extern unsigned long gfx_vid_version;
107f29dbc25Smrg    extern ChipType gfx_chip_revision;
108f29dbc25Smrg
109f29dbc25Smrg/* ROUTINES IN GFX_INIT.C */
110f29dbc25Smrg
111f29dbc25Smrg    unsigned long gfx_pci_config_read(unsigned long address);
112f29dbc25Smrg    void gfx_pci_config_write(unsigned long address, unsigned long data);
113f29dbc25Smrg    unsigned long gfx_get_core_freq(void);
114f29dbc25Smrg    unsigned long gfx_detect_cpu(void);
115f29dbc25Smrg    unsigned long gfx_detect_video(void);
116f29dbc25Smrg    unsigned long gfx_get_cpu_register_base(void);
117f29dbc25Smrg    unsigned long gfx_get_graphics_register_base(void);
118f29dbc25Smrg    unsigned long gfx_get_frame_buffer_base(void);
119f29dbc25Smrg    unsigned long gfx_get_frame_buffer_size(void);
120f29dbc25Smrg    unsigned long gfx_get_vid_register_base(void);
121f29dbc25Smrg    unsigned long gfx_get_vip_register_base(void);
122f29dbc25Smrg
123f29dbc25Smrg/* ROUTINES IN GFX_MSR.C */
124f29dbc25Smrg
125f29dbc25Smrg    int gfx_msr_init(void);
126f29dbc25Smrg    DEV_STATUS gfx_id_msr_device(MSR * pDev, unsigned long address);
127f29dbc25Smrg    DEV_STATUS gfx_get_msr_dev_address(unsigned int device,
12804007ebaSmrg                                       unsigned long *address);
129f29dbc25Smrg    DEV_STATUS gfx_get_glink_id_at_address(unsigned int *device,
13004007ebaSmrg                                           unsigned long address);
131f29dbc25Smrg    DEV_STATUS gfx_msr_read(unsigned int device, unsigned int msrRegister,
13204007ebaSmrg                            Q_WORD * msrValue);
133f29dbc25Smrg    DEV_STATUS gfx_msr_write(unsigned int device, unsigned int msrRegister,
13404007ebaSmrg                             Q_WORD * msrValue);
135f29dbc25Smrg
136f29dbc25Smrg/* ROUTINES IN GFX_DISP.C */
137f29dbc25Smrg
138f29dbc25Smrg    int gfx_set_display_bpp(unsigned short bpp);
139f29dbc25Smrg    int gfx_is_display_mode_supported(int xres, int yres, int bpp, int hz);
140f29dbc25Smrg    int gfx_set_display_mode(int xres, int yres, int bpp, int hz);
141f29dbc25Smrg    int gfx_set_display_timings(unsigned short bpp, unsigned short flags,
14204007ebaSmrg                                unsigned short hactive,
14304007ebaSmrg                                unsigned short hblank_start,
14404007ebaSmrg                                unsigned short hsync_start,
14504007ebaSmrg                                unsigned short hsync_end,
14604007ebaSmrg                                unsigned short hblank_end,
14704007ebaSmrg                                unsigned short htotal, unsigned short vactive,
14804007ebaSmrg                                unsigned short vblank_start,
14904007ebaSmrg                                unsigned short vsync_start,
15004007ebaSmrg                                unsigned short vsync_end,
15104007ebaSmrg                                unsigned short vblank_end,
15204007ebaSmrg                                unsigned short vtotal, unsigned long frequency);
153f29dbc25Smrg    int gfx_set_vtotal(unsigned short vtotal);
154f29dbc25Smrg    void gfx_set_display_pitch(unsigned short pitch);
155f29dbc25Smrg    void gfx_set_display_offset(unsigned long offset);
156f29dbc25Smrg    int gfx_set_display_palette_entry(unsigned long index,
15704007ebaSmrg                                      unsigned long palette);
158f29dbc25Smrg    int gfx_set_display_palette(unsigned long *palette);
159f29dbc25Smrg    void gfx_video_shutdown(void);
160f29dbc25Smrg    void gfx_set_clock_frequency(unsigned long frequency);
161f29dbc25Smrg    int gfx_set_crt_enable(int enable);
162f29dbc25Smrg    void gfx_set_cursor_enable(int enable);
163f29dbc25Smrg    void gfx_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor);
164f29dbc25Smrg    void gfx_set_cursor_position(unsigned long memoffset,
16504007ebaSmrg                                 unsigned short xpos, unsigned short ypos,
16604007ebaSmrg                                 unsigned short xhotspot,
16704007ebaSmrg                                 unsigned short yhotspot);
16804007ebaSmrg    void gfx_set_cursor_shape32(unsigned long memoffset, unsigned long *andmask,
16904007ebaSmrg                                unsigned long *xormask);
17004007ebaSmrg    void gfx_set_cursor_shape64(unsigned long memoffset, unsigned long *andmask,
17104007ebaSmrg                                unsigned long *xormask);
172f29dbc25Smrg    void gfx_set_icon_enable(int enable);
173f29dbc25Smrg    void gfx_set_icon_colors(unsigned long color0, unsigned long color1,
17404007ebaSmrg                             unsigned long color2);
175f29dbc25Smrg    void gfx_set_icon_position(unsigned long memoffset, unsigned short xpos);
176f29dbc25Smrg    void gfx_set_icon_shape64(unsigned long memoffset, unsigned long *andmask,
17704007ebaSmrg                              unsigned long *xormask, unsigned int lines);
178f29dbc25Smrg
179f29dbc25Smrg    int gfx_set_compression_enable(int enable);
180f29dbc25Smrg    int gfx_set_compression_offset(unsigned long offset);
181f29dbc25Smrg    int gfx_set_compression_pitch(unsigned short pitch);
182f29dbc25Smrg    int gfx_set_compression_size(unsigned short size);
183f29dbc25Smrg    void gfx_set_display_priority_high(int enable);
184f29dbc25Smrg    int gfx_test_timing_active(void);
185f29dbc25Smrg    int gfx_test_vertical_active(void);
186f29dbc25Smrg    int gfx_wait_vertical_blank(void);
187f29dbc25Smrg    void gfx_delay_milliseconds(unsigned long milliseconds);
188f29dbc25Smrg    void gfx_delay_microseconds(unsigned long microseconds);
189f29dbc25Smrg    void gfx_enable_panning(int x, int y);
190f29dbc25Smrg    int gfx_is_panel_mode_supported(int panelResX, int panelResY,
19104007ebaSmrg                                    unsigned short width, unsigned short height,
19204007ebaSmrg                                    unsigned short bpp);
193f29dbc25Smrg    int gfx_set_fixed_timings(int panelResX, int panelResY,
19404007ebaSmrg                              unsigned short width, unsigned short height,
19504007ebaSmrg                              unsigned short bpp);
196f29dbc25Smrg    int gfx_set_panel_present(int panelResX, int panelResY,
19704007ebaSmrg                              unsigned short width, unsigned short height,
19804007ebaSmrg                              unsigned short bpp);
199f29dbc25Smrg    void gfx_reset_timing_lock(void);
200f29dbc25Smrg
201f29dbc25Smrg/* "READ" ROUTINES IN GFX_DISP.C */
202f29dbc25Smrg
203f29dbc25Smrg    int gfx_get_display_details(unsigned int mode, int *xres, int *yres,
20404007ebaSmrg                                int *hz);
205f29dbc25Smrg    unsigned short gfx_get_display_pitch(void);
206f29dbc25Smrg    int gfx_get_vsa2_softvga_enable(void);
207f29dbc25Smrg    int gfx_get_sync_polarities(void);
208f29dbc25Smrg    unsigned long gfx_get_clock_frequency(void);
209f29dbc25Smrg    unsigned long gfx_get_max_supported_pixel_clock(void);
210f29dbc25Smrg    int gfx_mode_frequency_supported(int xres, int yres, int bpp,
21104007ebaSmrg                                     unsigned long frequency);
212f29dbc25Smrg    int gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp,
21304007ebaSmrg                                           int *hz, unsigned long frequency);
214f29dbc25Smrg    int gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz,
21504007ebaSmrg                                      unsigned long frequency);
216f29dbc25Smrg    int gfx_get_frequency_from_refreshrate(int xres, int yres, int bpp,
21704007ebaSmrg                                           int hz, int *frequency);
218f29dbc25Smrg    int gfx_get_display_mode_count(void);
219f29dbc25Smrg    int gfx_get_display_mode(int *xres, int *yres, int *bpp, int *hz);
220f29dbc25Smrg    unsigned long gfx_get_frame_buffer_line_size(void);
221f29dbc25Smrg    unsigned short gfx_get_hactive(void);
222f29dbc25Smrg    unsigned short gfx_get_hblank_start(void);
223f29dbc25Smrg    unsigned short gfx_get_hsync_start(void);
224f29dbc25Smrg    unsigned short gfx_get_hsync_end(void);
225f29dbc25Smrg    unsigned short gfx_get_hblank_end(void);
226f29dbc25Smrg    unsigned short gfx_get_htotal(void);
227f29dbc25Smrg    unsigned short gfx_get_vactive(void);
228f29dbc25Smrg    unsigned short gfx_get_vline(void);
229f29dbc25Smrg    unsigned short gfx_get_vblank_start(void);
230f29dbc25Smrg    unsigned short gfx_get_vsync_start(void);
231f29dbc25Smrg    unsigned short gfx_get_vsync_end(void);
232f29dbc25Smrg    unsigned short gfx_get_vblank_end(void);
233f29dbc25Smrg    unsigned short gfx_get_vtotal(void);
234f29dbc25Smrg    unsigned short gfx_get_display_bpp(void);
235f29dbc25Smrg    unsigned long gfx_get_display_offset(void);
236f29dbc25Smrg    int gfx_get_display_palette_entry(unsigned long index,
23704007ebaSmrg                                      unsigned long *palette);
238f29dbc25Smrg    void gfx_get_display_palette(unsigned long *palette);
239f29dbc25Smrg    unsigned long gfx_get_cursor_enable(void);
240f29dbc25Smrg    unsigned long gfx_get_cursor_offset(void);
241f29dbc25Smrg    unsigned long gfx_get_cursor_position(void);
242f29dbc25Smrg    unsigned long gfx_get_cursor_clip(void);
243f29dbc25Smrg    unsigned long gfx_get_cursor_color(int color);
244f29dbc25Smrg    unsigned long gfx_get_icon_enable(void);
245f29dbc25Smrg    unsigned long gfx_get_icon_offset(void);
246f29dbc25Smrg    unsigned long gfx_get_icon_position(void);
247f29dbc25Smrg    unsigned long gfx_get_icon_color(int color);
248f29dbc25Smrg    int gfx_get_compression_enable(void);
249f29dbc25Smrg    unsigned long gfx_get_compression_offset(void);
250f29dbc25Smrg    unsigned short gfx_get_compression_pitch(void);
251f29dbc25Smrg    unsigned short gfx_get_compression_size(void);
252f29dbc25Smrg    int gfx_get_display_priority_high(void);
253f29dbc25Smrg    int gfx_get_valid_bit(int line);
254f29dbc25Smrg
255f29dbc25Smrg/* ROUTINES IN GFX_RNDR.C */
256f29dbc25Smrg
257f29dbc25Smrg    void gfx_set_bpp(unsigned short bpp);
258f29dbc25Smrg    void gfx_set_solid_pattern(unsigned long color);
259f29dbc25Smrg    void gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor,
26004007ebaSmrg                              unsigned long data0, unsigned long data1,
26104007ebaSmrg                              unsigned char transparency);
262f29dbc25Smrg    void gfx_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor,
26304007ebaSmrg                               unsigned long data0, unsigned long data1,
26404007ebaSmrg                               unsigned long data2, unsigned long data3,
26504007ebaSmrg                               unsigned char transparency);
266f29dbc25Smrg    void gfx_load_color_pattern_line(short y, unsigned long *pattern_8x8);
267f29dbc25Smrg    void gfx_set_solid_source(unsigned long color);
268f29dbc25Smrg    void gfx_set_mono_source(unsigned long bgcolor, unsigned long fgcolor,
26904007ebaSmrg                             unsigned short transparent);
270f29dbc25Smrg    void gfx_set_pattern_flags(unsigned short flags);
271f29dbc25Smrg    void gfx_set_raster_operation(unsigned char rop);
272f29dbc25Smrg    void gfx_pattern_fill(unsigned short x, unsigned short y,
27304007ebaSmrg                          unsigned short width, unsigned short height);
274f29dbc25Smrg    void gfx_color_pattern_fill(unsigned short x, unsigned short y,
27504007ebaSmrg                                unsigned short width, unsigned short height,
27604007ebaSmrg                                unsigned long *pattern);
277f29dbc25Smrg    void gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy,
27804007ebaSmrg                                  unsigned short dstx, unsigned short dsty,
27904007ebaSmrg                                  unsigned short width, unsigned short height);
280f29dbc25Smrg    void gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy,
28104007ebaSmrg                                   unsigned short dstx, unsigned short dsty,
28204007ebaSmrg                                   unsigned short width, unsigned short height,
28304007ebaSmrg                                   unsigned long color);
284f29dbc25Smrg    void gfx_color_bitmap_to_screen_blt(unsigned short srcx,
28504007ebaSmrg                                        unsigned short srcy,
28604007ebaSmrg                                        unsigned short dstx,
28704007ebaSmrg                                        unsigned short dsty,
28804007ebaSmrg                                        unsigned short width,
28904007ebaSmrg                                        unsigned short height,
29004007ebaSmrg                                        unsigned char *data, long pitch);
291f29dbc25Smrg    void gfx_color_bitmap_to_screen_xblt(unsigned short srcx,
29204007ebaSmrg                                         unsigned short srcy,
29304007ebaSmrg                                         unsigned short dstx,
29404007ebaSmrg                                         unsigned short dsty,
29504007ebaSmrg                                         unsigned short width,
29604007ebaSmrg                                         unsigned short height,
29704007ebaSmrg                                         unsigned char *data, long pitch,
29804007ebaSmrg                                         unsigned long color);
29904007ebaSmrg    void gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy,
30004007ebaSmrg                                       unsigned short dstx, unsigned short dsty,
30104007ebaSmrg                                       unsigned short width,
30204007ebaSmrg                                       unsigned short height,
30304007ebaSmrg                                       unsigned char *data, short pitch);
304f29dbc25Smrg    void gfx_text_blt(unsigned short dstx, unsigned short dsty,
30504007ebaSmrg                      unsigned short width, unsigned short height,
30604007ebaSmrg                      unsigned char *data);
307f29dbc25Smrg    void gfx_bresenham_line(unsigned short x, unsigned short y,
30804007ebaSmrg                            unsigned short length, unsigned short initerr,
30904007ebaSmrg                            unsigned short axialerr, unsigned short diagerr,
31004007ebaSmrg                            unsigned short flags);
311f29dbc25Smrg    void gfx_wait_until_idle(void);
312f29dbc25Smrg    int gfx_test_blt_pending(void);
313f29dbc25Smrg
314f29dbc25Smrg/* SECOND GENERATION RENDERING ROUTINES */
315f29dbc25Smrg
316f29dbc25Smrg    void gfx2_set_source_stride(unsigned short stride);
317f29dbc25Smrg    void gfx2_set_destination_stride(unsigned short stride);
318f29dbc25Smrg    void gfx2_set_pattern_origin(int x, int y);
31904007ebaSmrg    void gfx2_set_source_transparency(unsigned long color, unsigned long mask);
320f29dbc25Smrg    void gfx2_set_alpha_mode(int mode);
321f29dbc25Smrg    void gfx2_set_alpha_value(unsigned char value);
322f29dbc25Smrg    void gfx2_pattern_fill(unsigned long dstoffset, unsigned short width,
32304007ebaSmrg                           unsigned short height);
324f29dbc25Smrg    void gfx2_color_pattern_fill(unsigned long dstoffset,
32504007ebaSmrg                                 unsigned short width, unsigned short height,
32604007ebaSmrg                                 unsigned long *pattern);
327f29dbc25Smrg    void gfx2_screen_to_screen_blt(unsigned long srcoffset,
32804007ebaSmrg                                   unsigned long dstoffset,
32904007ebaSmrg                                   unsigned short width, unsigned short height,
33004007ebaSmrg                                   int flags);
331f29dbc25Smrg    void gfx2_mono_expand_blt(unsigned long srcbase, unsigned short srcx,
33204007ebaSmrg                              unsigned short srcy, unsigned long dstoffset,
33304007ebaSmrg                              unsigned short width, unsigned short height,
33404007ebaSmrg                              int byte_packed);
335f29dbc25Smrg    void gfx2_color_bitmap_to_screen_blt(unsigned short srcx,
33604007ebaSmrg                                         unsigned short srcy,
33704007ebaSmrg                                         unsigned long dstoffset,
33804007ebaSmrg                                         unsigned short width,
33904007ebaSmrg                                         unsigned short height,
34004007ebaSmrg                                         unsigned char *data, short pitch);
341f29dbc25Smrg    void gfx2_mono_bitmap_to_screen_blt(unsigned short srcx,
34204007ebaSmrg                                        unsigned short srcy,
34304007ebaSmrg                                        unsigned long dstoffset,
34404007ebaSmrg                                        unsigned short width,
34504007ebaSmrg                                        unsigned short height,
34604007ebaSmrg                                        unsigned char *data, short pitch);
347f29dbc25Smrg    void gfx2_text_blt(unsigned long dstoffset, unsigned short width,
34804007ebaSmrg                       unsigned short height, unsigned char *data);
349f29dbc25Smrg    void gfx2_bresenham_line(unsigned long dstoffset, unsigned short length,
35004007ebaSmrg                             unsigned short initerr, unsigned short axialerr,
35104007ebaSmrg                             unsigned short diagerr, unsigned short flags);
352f29dbc25Smrg    void gfx2_sync_to_vblank(void);
353f29dbc25Smrg
354f29dbc25Smrg/* ROUTINES IN GFX_VID.C */
355f29dbc25Smrg
356f29dbc25Smrg    int gfx_set_video_enable(int enable);
357f29dbc25Smrg    int gfx_set_video_format(unsigned long format);
358f29dbc25Smrg    int gfx_set_video_size(unsigned short width, unsigned short height);
359f29dbc25Smrg    int gfx_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch);
360f29dbc25Smrg    int gfx_set_video_offset(unsigned long offset);
361f29dbc25Smrg    int gfx_set_video_yuv_offsets(unsigned long yoffset,
36204007ebaSmrg                                  unsigned long uoffset, unsigned long voffset);
363f29dbc25Smrg    int gfx_set_video_window(short x, short y, unsigned short w,
36404007ebaSmrg                             unsigned short h);
365f29dbc25Smrg    int gfx_set_video_left_crop(unsigned short x);
366f29dbc25Smrg    int gfx_set_video_upscale(unsigned short srcw, unsigned short srch,
36704007ebaSmrg                              unsigned short dstw, unsigned short dsth);
368f29dbc25Smrg    int gfx_set_video_scale(unsigned short srcw, unsigned short srch,
36904007ebaSmrg                            unsigned short dstw, unsigned short dsth);
370f29dbc25Smrg    int gfx_set_video_vertical_downscale(unsigned short srch,
37104007ebaSmrg                                         unsigned short dsth);
372f29dbc25Smrg    void gfx_set_video_vertical_downscale_enable(int enable);
373f29dbc25Smrg    int gfx_set_video_downscale_config(unsigned short type, unsigned short m);
374f29dbc25Smrg    int gfx_set_video_color_key(unsigned long key, unsigned long mask,
37504007ebaSmrg                                int bluescreen);
376f29dbc25Smrg    int gfx_set_video_filter(int xfilter, int yfilter);
377f29dbc25Smrg    int gfx_set_video_palette(unsigned long *palette);
378f29dbc25Smrg    int gfx_set_graphics_palette(unsigned long *palette);
379f29dbc25Smrg    int gfx_set_video_palette_bypass(int enable);
380f29dbc25Smrg    int gfx_set_video_palette_entry(unsigned long index, unsigned long color);
381f29dbc25Smrg    int gfx_set_graphics_palette_entry(unsigned long index,
38204007ebaSmrg                                       unsigned long color);
383f29dbc25Smrg    int gfx_set_video_downscale_coefficients(unsigned short coef1,
38404007ebaSmrg                                             unsigned short coef2,
38504007ebaSmrg                                             unsigned short coef3,
38604007ebaSmrg                                             unsigned short coef4);
387f29dbc25Smrg    int gfx_set_video_downscale_enable(int enable);
388f29dbc25Smrg    int gfx_set_video_source(VideoSourceType source);
389f29dbc25Smrg    int gfx_set_vbi_source(VbiSourceType source);
390f29dbc25Smrg    int gfx_set_vbi_lines(unsigned long even, unsigned long odd);
391f29dbc25Smrg    int gfx_set_vbi_total(unsigned long even, unsigned long odd);
392f29dbc25Smrg    int gfx_set_video_interlaced(int enable);
393f29dbc25Smrg    int gfx_set_color_space_YUV(int enable);
394f29dbc25Smrg    int gfx_set_vertical_scaler_offset(char offset);
395f29dbc25Smrg    int gfx_set_top_line_in_odd(int enable);
396f29dbc25Smrg    int gfx_set_genlock_delay(unsigned long delay);
397f29dbc25Smrg    int gfx_set_genlock_enable(int flags);
398f29dbc25Smrg    int gfx_set_video_cursor(unsigned long key, unsigned long mask,
39904007ebaSmrg                             unsigned short select_color2, unsigned long color1,
40004007ebaSmrg                             unsigned long color2);
401f29dbc25Smrg    int gfx_set_video_cursor_enable(int enable);
402f29dbc25Smrg    int gfx_set_video_request(short x, short y);
403f29dbc25Smrg
404f29dbc25Smrg    int gfx_select_alpha_region(int region);
405f29dbc25Smrg    int gfx_set_alpha_enable(int enable);
406f29dbc25Smrg    int gfx_set_alpha_window(short x, short y,
40704007ebaSmrg                             unsigned short width, unsigned short height);
408f29dbc25Smrg    int gfx_set_alpha_value(unsigned char alpha, char delta);
409f29dbc25Smrg    int gfx_set_alpha_priority(int priority);
410f29dbc25Smrg    int gfx_set_alpha_color(unsigned long color);
411f29dbc25Smrg    int gfx_set_alpha_color_enable(int enable);
412f29dbc25Smrg    int gfx_set_no_ck_outside_alpha(int enable);
413f29dbc25Smrg    int gfx_disable_softvga(void);
414f29dbc25Smrg    int gfx_enable_softvga(void);
415f29dbc25Smrg    int gfx_set_macrovision_enable(int enable);
416f29dbc25Smrg    unsigned long gfx_get_max_video_width(void);
417f29dbc25Smrg
418f29dbc25Smrg/* READ ROUTINES IN GFX_VID.C */
419f29dbc25Smrg
420f29dbc25Smrg    int gfx_get_video_enable(void);
421f29dbc25Smrg    int gfx_get_video_format(void);
422f29dbc25Smrg    unsigned long gfx_get_video_src_size(void);
423f29dbc25Smrg    unsigned long gfx_get_video_line_size(void);
424f29dbc25Smrg    unsigned long gfx_get_video_xclip(void);
425f29dbc25Smrg    unsigned long gfx_get_video_offset(void);
426f29dbc25Smrg    void gfx_get_video_yuv_offsets(unsigned long *yoffset,
42704007ebaSmrg                                   unsigned long *uoffset,
42804007ebaSmrg                                   unsigned long *voffset);
42904007ebaSmrg    void gfx_get_video_yuv_pitch(unsigned long *ypitch, unsigned long *uvpitch);
430f29dbc25Smrg    unsigned long gfx_get_video_upscale(void);
431f29dbc25Smrg    unsigned long gfx_get_video_scale(void);
432f29dbc25Smrg    unsigned long gfx_get_video_downscale_delta(void);
433f29dbc25Smrg    int gfx_get_video_vertical_downscale_enable(void);
43404007ebaSmrg    int gfx_get_video_downscale_config(unsigned short *type, unsigned short *m);
435f29dbc25Smrg    void gfx_get_video_downscale_coefficients(unsigned short *coef1,
43604007ebaSmrg                                              unsigned short *coef2,
43704007ebaSmrg                                              unsigned short *coef3,
43804007ebaSmrg                                              unsigned short *coef4);
439f29dbc25Smrg    void gfx_get_video_downscale_enable(int *enable);
440f29dbc25Smrg    unsigned long gfx_get_video_dst_size(void);
441f29dbc25Smrg    unsigned long gfx_get_video_position(void);
442f29dbc25Smrg    unsigned long gfx_get_video_color_key(void);
443f29dbc25Smrg    unsigned long gfx_get_video_color_key_mask(void);
444f29dbc25Smrg    int gfx_get_video_palette_entry(unsigned long index,
44504007ebaSmrg                                    unsigned long *palette);
446f29dbc25Smrg    int gfx_get_video_color_key_src(void);
447f29dbc25Smrg    int gfx_get_video_filter(void);
448f29dbc25Smrg    int gfx_get_video_request(short *x, short *y);
449f29dbc25Smrg    int gfx_get_video_source(VideoSourceType * source);
450f29dbc25Smrg    int gfx_get_vbi_source(VbiSourceType * source);
451f29dbc25Smrg    unsigned long gfx_get_vbi_lines(int odd);
452f29dbc25Smrg    unsigned long gfx_get_vbi_total(int odd);
453f29dbc25Smrg    int gfx_get_video_interlaced(void);
454f29dbc25Smrg    int gfx_get_color_space_YUV(void);
455f29dbc25Smrg    int gfx_get_vertical_scaler_offset(char *offset);
456f29dbc25Smrg    unsigned long gfx_get_genlock_delay(void);
457f29dbc25Smrg    int gfx_get_genlock_enable(void);
458f29dbc25Smrg    int gfx_get_video_cursor(unsigned long *key, unsigned long *mask,
45904007ebaSmrg                             unsigned short *select_color2,
46004007ebaSmrg                             unsigned long *color1, unsigned short *color2);
461f29dbc25Smrg    unsigned long gfx_read_crc(void);
462f29dbc25Smrg    unsigned long gfx_read_crc32(void);
463f29dbc25Smrg    unsigned long gfx_read_window_crc(int source, unsigned short x,
46404007ebaSmrg                                      unsigned short y, unsigned short width,
46504007ebaSmrg                                      unsigned short height, int crc32);
466f29dbc25Smrg    int gfx_get_macrovision_enable(void);
467f29dbc25Smrg
468f29dbc25Smrg    void gfx_get_alpha_enable(int *enable);
469f29dbc25Smrg    void gfx_get_alpha_size(unsigned short *x, unsigned short *y,
47004007ebaSmrg                            unsigned short *width, unsigned short *height);
471f29dbc25Smrg    void gfx_get_alpha_value(unsigned char *alpha, char *delta);
472f29dbc25Smrg    void gfx_get_alpha_priority(int *priority);
473f29dbc25Smrg    void gfx_get_alpha_color(unsigned long *color);
474f29dbc25Smrg
475f29dbc25Smrg/* ROUTINES IN GFX_VIP.C */
476f29dbc25Smrg
477f29dbc25Smrg    int gfx_set_vip_enable(int enable);
478f29dbc25Smrg    int gfx_set_vip_capture_run_mode(int mode);
479f29dbc25Smrg    int gfx_set_vip_base(unsigned long even, unsigned long odd);
480f29dbc25Smrg    int gfx_set_vip_pitch(unsigned long pitch);
481f29dbc25Smrg    int gfx_set_vip_mode(int mode);
482f29dbc25Smrg    int gfx_set_vbi_enable(int enable);
483f29dbc25Smrg    int gfx_set_vbi_mode(int mode);
484f29dbc25Smrg    int gfx_set_vbi_base(unsigned long even, unsigned long odd);
485f29dbc25Smrg    int gfx_set_vbi_pitch(unsigned long pitch);
486f29dbc25Smrg    int gfx_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines);
487f29dbc25Smrg    int gfx_set_vbi_interrupt(int enable);
488f29dbc25Smrg    int gfx_set_vip_bus_request_threshold_high(int enable);
489f29dbc25Smrg    int gfx_set_vip_last_line(int last_line);
490f29dbc25Smrg    int gfx_test_vip_odd_field(void);
491f29dbc25Smrg    int gfx_test_vip_bases_updated(void);
492f29dbc25Smrg    int gfx_test_vip_fifo_overflow(void);
493f29dbc25Smrg    int gfx_get_vip_line(void);
494f29dbc25Smrg
495f29dbc25Smrg/* READ ROUTINES IN GFX_VIP.C */
496f29dbc25Smrg
497f29dbc25Smrg    int gfx_get_vip_enable(void);
498f29dbc25Smrg    unsigned long gfx_get_vip_base(int odd);
499f29dbc25Smrg    unsigned long gfx_get_vip_pitch(void);
500f29dbc25Smrg    int gfx_get_vip_mode(void);
501f29dbc25Smrg    int gfx_get_vbi_enable(void);
502f29dbc25Smrg    int gfx_get_vbi_mode(void);
503f29dbc25Smrg    unsigned long gfx_get_vbi_base(int odd);
504f29dbc25Smrg    unsigned long gfx_get_vbi_pitch(void);
505f29dbc25Smrg    unsigned long gfx_get_vbi_direct(int odd);
506f29dbc25Smrg    int gfx_get_vbi_interrupt(void);
507f29dbc25Smrg    int gfx_get_vip_bus_request_threshold_high(void);
508f29dbc25Smrg
509f29dbc25Smrg/* ROUTINES IN GFX_DCDR.C */
510f29dbc25Smrg
511f29dbc25Smrg    int gfx_set_decoder_defaults(void);
512f29dbc25Smrg    int gfx_set_decoder_analog_input(unsigned char input);
513f29dbc25Smrg    int gfx_set_decoder_brightness(unsigned char brightness);
514f29dbc25Smrg    int gfx_set_decoder_contrast(unsigned char contrast);
515f29dbc25Smrg    int gfx_set_decoder_hue(char hue);
516f29dbc25Smrg    int gfx_set_decoder_saturation(unsigned char saturation);
517f29dbc25Smrg    int gfx_set_decoder_input_offset(unsigned short x, unsigned short y);
51804007ebaSmrg    int gfx_set_decoder_input_size(unsigned short width, unsigned short height);
519f29dbc25Smrg    int gfx_set_decoder_output_size(unsigned short width,
52004007ebaSmrg                                    unsigned short height);
521f29dbc25Smrg    int gfx_set_decoder_scale(unsigned short srcw, unsigned short srch,
52204007ebaSmrg                              unsigned short dstw, unsigned short dsth);
523f29dbc25Smrg    int gfx_set_decoder_vbi_format(int start, int end, int format);
524f29dbc25Smrg    int gfx_set_decoder_vbi_enable(int enable);
525f29dbc25Smrg    int gfx_set_decoder_vbi_upscale(void);
526f29dbc25Smrg    int gfx_set_decoder_TV_standard(TVStandardType TVStandard);
527f29dbc25Smrg    int gfx_set_decoder_luminance_filter(unsigned char lufi);
528f29dbc25Smrg    int gfx_decoder_software_reset(void);
529f29dbc25Smrg    int gfx_decoder_detect_macrovision(void);
530f29dbc25Smrg    int gfx_decoder_detect_video(void);
531f29dbc25Smrg
532f29dbc25Smrg/* READ ROUTINES IN GFX_DCDR.C */
533f29dbc25Smrg
534f29dbc25Smrg    unsigned char gfx_get_decoder_brightness(void);
535f29dbc25Smrg    unsigned char gfx_get_decoder_contrast(void);
536f29dbc25Smrg    char gfx_get_decoder_hue(void);
537f29dbc25Smrg    unsigned char gfx_get_decoder_saturation(void);
538f29dbc25Smrg    unsigned long gfx_get_decoder_input_offset(void);
539f29dbc25Smrg    unsigned long gfx_get_decoder_input_size(void);
540f29dbc25Smrg    unsigned long gfx_get_decoder_output_size(void);
541f29dbc25Smrg    int gfx_get_decoder_vbi_format(int line);
542f29dbc25Smrg
543f29dbc25Smrg/* ROUTINES IN GFX_I2C.C */
544f29dbc25Smrg
545f29dbc25Smrg    int gfx_i2c_reset(unsigned char busnum, short adr, char freq);
546f29dbc25Smrg    int gfx_i2c_write(unsigned char busnum, unsigned char chipadr,
54704007ebaSmrg                      unsigned char subadr, unsigned char bytes,
54804007ebaSmrg                      unsigned char *data);
549f29dbc25Smrg    int gfx_i2c_read(unsigned char busnum, unsigned char chipadr,
55004007ebaSmrg                     unsigned char subadr, unsigned char bytes,
55104007ebaSmrg                     unsigned char *data);
552f29dbc25Smrg    int gfx_i2c_select_gpio(int clock, int data);
553f29dbc25Smrg    int gfx_i2c_init(void);
554f29dbc25Smrg    void gfx_i2c_cleanup(void);
555f29dbc25Smrg
556f29dbc25Smrg/* ROUTINES IN GFX_TV.C */
557f29dbc25Smrg
558f29dbc25Smrg    int gfx_set_tv_format(TVStandardType format, GfxOnTVType resolution);
559f29dbc25Smrg    int gfx_set_tv_output(int output);
560f29dbc25Smrg    int gfx_set_tv_enable(int enable);
561f29dbc25Smrg    int gfx_set_tv_flicker_filter(int ff);
562f29dbc25Smrg    int gfx_set_tv_sub_carrier_reset(int screset);
563f29dbc25Smrg    int gfx_set_tv_vphase(int vphase);
564f29dbc25Smrg    int gfx_set_tv_YC_delay(int delay);
565f29dbc25Smrg    int gfx_set_tvenc_reset_interval(int interval);
566f29dbc25Smrg    int gfx_set_tv_cc_enable(int enable);
567f29dbc25Smrg    int gfx_set_tv_cc_data(unsigned char data1, unsigned char data2);
568f29dbc25Smrg    int gfx_set_tv_display(int width, int height);
569f29dbc25Smrg    int gfx_test_tvout_odd_field(void);
570f29dbc25Smrg    int gfx_test_tvenc_odd_field(void);
571f29dbc25Smrg    int gfx_set_tv_field_status_invert(int enable);
572f29dbc25Smrg    int gfx_get_tv_vphase(void);
573f29dbc25Smrg    int gfx_get_tv_enable(unsigned int *p_on);
574f29dbc25Smrg    int gfx_get_tv_output(void);
575f29dbc25Smrg    int gfx_get_tv_mode_count(TVStandardType format);
576f29dbc25Smrg    int gfx_get_tv_display_mode(int *width, int *height, int *bpp, int *hz);
577f29dbc25Smrg    int gfx_get_tv_display_mode_frequency(unsigned short width,
57804007ebaSmrg                                          unsigned short height,
57904007ebaSmrg                                          TVStandardType format,
58004007ebaSmrg                                          int *frequency);
581f29dbc25Smrg    int gfx_is_tv_display_mode_supported(unsigned short width,
58204007ebaSmrg                                         unsigned short height,
58304007ebaSmrg                                         TVStandardType format);
584f29dbc25Smrg
585f29dbc25Smrg    int gfx_get_tv_standard(unsigned long *p_standard);
586f29dbc25Smrg    int gfx_get_available_tv_standards(unsigned long *p_standards);
587f29dbc25Smrg    int gfx_set_tv_standard(unsigned long standard);
588f29dbc25Smrg    int gfx_get_tv_vga_mode(unsigned long *p_vga_mode);
589f29dbc25Smrg    int gfx_get_available_tv_vga_modes(unsigned long *p_vga_modes);
590f29dbc25Smrg    int gfx_set_tv_vga_mode(unsigned long vga_mode);
591f29dbc25Smrg    int gfx_get_tvout_mode(unsigned long *p_tvout_mode);
592f29dbc25Smrg    int gfx_set_tvout_mode(unsigned long tvout_mode);
593f29dbc25Smrg    int gfx_get_sharpness(int *p_sharpness);
594f29dbc25Smrg    int gfx_set_sharpness(int sharpness);
595f29dbc25Smrg    int gfx_get_flicker_filter(int *p_flicker);
596f29dbc25Smrg    int gfx_set_flicker_filter(int flicker);
597f29dbc25Smrg    int gfx_get_overscan(int *p_x, int *p_y);
598f29dbc25Smrg    int gfx_set_overscan(int x, int y);
599f29dbc25Smrg    int gfx_get_position(int *p_x, int *p_y);
600f29dbc25Smrg    int gfx_set_position(int x, int y);
601f29dbc25Smrg    int gfx_get_color(int *p_color);
602f29dbc25Smrg    int gfx_set_color(int color);
603f29dbc25Smrg    int gfx_get_brightness(int *p_brightness);
604f29dbc25Smrg    int gfx_set_brightness(int brightness);
605f29dbc25Smrg    int gfx_get_contrast(int *p_contrast);
60679d5fcd7Smrg    int gfx_set_contrast(int contrast);
607f29dbc25Smrg    int gfx_get_yc_filter(unsigned int *p_yc_filter);
608f29dbc25Smrg    int gfx_set_yc_filter(unsigned int yc_filter);
609f29dbc25Smrg    int gfx_get_aps_trigger_bits(unsigned int *p_trigger_bits);
610f29dbc25Smrg    int gfx_set_aps_trigger_bits(unsigned int trigger_bits);
611f29dbc25Smrg
612f29dbc25Smrg/* ROUTINES IN GFX_VGA.C */
613f29dbc25Smrg
614f29dbc25Smrg    int gfx_get_softvga_active(void);
615f29dbc25Smrg    int gfx_vga_test_pci(void);
616f29dbc25Smrg    unsigned char gfx_vga_get_pci_command(void);
617f29dbc25Smrg    int gfx_vga_set_pci_command(unsigned char command);
618f29dbc25Smrg    int gfx_vga_seq_reset(int reset);
619f29dbc25Smrg    int gfx_vga_set_graphics_bits(void);
62004007ebaSmrg    int gfx_vga_mode(gfx_vga_struct * vga, int xres, int yres, int bpp, int hz);
621f29dbc25Smrg    int gfx_vga_pitch(gfx_vga_struct * vga, unsigned short pitch);
622f29dbc25Smrg    int gfx_vga_save(gfx_vga_struct * vga, int flags);
623f29dbc25Smrg    int gfx_vga_restore(gfx_vga_struct * vga, int flags);
624f29dbc25Smrg    int gfx_vga_mode_switch(int active);
625f29dbc25Smrg    void gfx_vga_clear_extended(void);
626f29dbc25Smrg
627f29dbc25Smrg/* CLOSE BRACKET FOR C++ COMPLILATION */
628f29dbc25Smrg
629f29dbc25Smrg#ifdef __cplusplus
630f29dbc25Smrg}
631f29dbc25Smrg#endif
63204007ebaSmrg#endif                          /* !_gfx_rtns_h */
633f29dbc25Smrg/* END OF FILE */
634