Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
955 serge 1
/*
2
 * Copyright 2004-2008  Luc Verhaegen 
3
 * Copyright 2007, 2008 Matthias Hopf 
4
 * Copyright 2007, 2008 Egbert Eich   
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a
7
 * copy of this software and associated documentation files (the "Software"),
8
 * to deal in the Software without restriction, including without limitation
9
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
 * and/or sell copies of the Software, and to permit persons to whom the
11
 * Software is furnished to do so, subject to the following conditions:
12
 *
13
 * The above copyright notice and this permission notice shall be included in
14
 * all copies or substantial portions of the Software.
15
 *
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
 * OTHER DEALINGS IN THE SOFTWARE.
23
 */
24
 
25
#ifndef _RHD_CRTC_H
26
# define _RHD_CRTC_H
27
 
28
struct rhdFMTDither {
29
    Bool LVDS24Bit;
30
    Bool LVDSSpatialDither;
31
    Bool LVDSTemporalDither;
32
    int LVDSGreyLevel;
33
};
34
 
35
enum rhdCrtcScaleType {
36
    RHD_CRTC_SCALE_TYPE_NONE,                     /* top left */
37
    RHD_CRTC_SCALE_TYPE_CENTER,                   /* center of the actual mode */
38
    RHD_CRTC_SCALE_TYPE_SCALE,                    /* scaled to fullscreen */
39
    RHD_CRTC_SCALE_TYPE_SCALE_KEEP_ASPECT_RATIO   /* scaled to fullscreen */
40
};
41
 
42
#define RHD_CRTC_SCALE_TYPE_DEFAULT RHD_CRTC_SCALE_TYPE_SCALE_KEEP_ASPECT_RATIO
43
 
44
 
45
struct rhdCrtc {
46
    int scrnIndex;
47
 
48
    char *Name;
49
#define RHD_CRTC_1 0
50
#define RHD_CRTC_2 1
51
    int Id; /* for others to hook onto */
52
 
53
    Bool Active;
54
 
55
    int Offset; /* Current offset */
56
    int bpp;
57
    int Pitch;
58
    int Width;
59
    int Height;
60
    int X, Y; /* Current frame */
61
    int MinX, MinY, MaxX, MaxY; /* Panning Area: Max != 0 if used */
62
    enum rhdCrtcScaleType ScaleType;
63
    struct rhdPLL *PLL; /* Currently attached PLL: move to private */
64
    struct rhdLUT *LUT; /* Currently attached LUT: move to private */
65
    struct rhdCursor *Cursor; /* Fixed to the MODE engine */
66
 
67
    DisplayModePtr CurrentMode;
68
    DisplayModePtr Modes; /* Validated ones: Cycle through these */
69
 
70
    DisplayModePtr ScaledToMode; /* usually a fixed mode from one of the monitors */
71
 
72
    struct rhdCrtcFMTPrivate *FMTPriv;  /* each CRTC subsystem may define this independently */
73
    void (*FMTModeSet)(struct rhdCrtc *Crtc, struct rhdFMTDither *FMTDither);
74
    void (*FMTSave)(struct rhdCrtc *Crtc);
75
    void (*FMTRestore)(struct rhdCrtc *Crtc);
76
    void (*FMTDestroy) (struct rhdCrtc *Crtc);
77
 
78
    struct rhdCrtcFBPrivate *FBPriv;  /* each CRTC subsystem may define this independently */
79
    ModeStatus (*FBValid) (struct rhdCrtc *Crtc, CARD16 Width, CARD16 Height,
80
			   int bpp, CARD32 Offset, CARD32 Size, CARD32 *pPitch);
81
    void (*FBSet) (struct rhdCrtc *Crtc, CARD16 Pitch, CARD16 Width,
82
		   CARD16 Height, int bpp, CARD32 Offset);
83
    void (*FBSave) (struct rhdCrtc *Crtc);
84
    void (*FBRestore) (struct rhdCrtc *Crtc);
85
    void (*FBDestroy) (struct rhdCrtc *Crtc);
86
 
87
    struct rhdCrtcModePrivate *ModePriv;  /* each CRTC subsystem may define this independently */
88
    ModeStatus (*ModeValid) (struct rhdCrtc *Crtc, DisplayModePtr Mode);
89
    void (*ModeSet) (struct rhdCrtc *Crtc, DisplayModePtr Mode);
90
    void (*ModeSave) (struct rhdCrtc *Crtc);
91
    void (*ModeRestore) (struct rhdCrtc *Crtc);
92
    void (*ModeDestroy) (struct rhdCrtc *Crtc);
93
 
94
    struct rhdCrtcScalePrivate *ScalePriv;  /* each CRTC subsystem may define this independently */
95
    ModeStatus (*ScaleValid) (struct rhdCrtc *Crtc, enum rhdCrtcScaleType Type, DisplayModePtr Mode, DisplayModePtr ScaledToMode);
96
    void (*ScaleSet) (struct rhdCrtc *Crtc, enum rhdCrtcScaleType Type, DisplayModePtr Mode, DisplayModePtr ScaledToMode);
97
    void (*ScaleSave) (struct rhdCrtc *Crtc);
98
    void (*ScaleRestore) (struct rhdCrtc *Crtc);
99
    void (*ScaleDestroy) (struct rhdCrtc *Crtc);
100
 
101
    void (*FrameSet) (struct rhdCrtc *Crtc, CARD16 X, CARD16 Y);
102
 
103
    /* callback for pll setting lives here */
104
    /* callback for lut setting lives here */
105
    struct rhdCrtcLUTPrivate *LUTPriv;  /* each CRTC subsystem may define this independently */
106
    void (*LUTSelect) (struct rhdCrtc *Crtc, struct rhdLUT *LUT);
107
    void (*LUTSave) (struct rhdCrtc *Crtc);
108
    void (*LUTRestore) (struct rhdCrtc *Crtc);
109
    void (*LUTDestroy) (struct rhdCrtc *Crtc);
110
 
111
    void (*Power) (struct rhdCrtc *Crtc, int Power);
112
    void (*Blank) (struct rhdCrtc *Crtc, Bool Blank);
113
};
114
 
115
Bool RHDCrtcsInit(RHDPtr rhdPtr);
116
void RHDAtomCrtcsInit(RHDPtr rhdPtr);
117
void RHDCrtcsDestroy(RHDPtr rhdPtr);
118
void RHDCrtcSave(struct rhdCrtc *Crtc);
119
void RHDCrtcRestore(struct rhdCrtc *Crtc);
120
 
121
/*
122
 * Calculate overscan values for scaler.
123
 */
124
struct rhdScalerOverscan
125
{
126
    int OverscanTop;
127
    int OverscanBottom;
128
    int OverscanLeft;
129
    int OverscanRight;
130
    enum rhdCrtcScaleType Type;
131
};
132
 
133
extern struct rhdScalerOverscan
134
rhdCalculateOverscan(DisplayModePtr Mode,
135
		     DisplayModePtr ScaledToMode,
136
		     enum rhdCrtcScaleType Type);
137
 
138
 
139
#endif /* _RHD_CRTC_H */