Subversion Repositories Kolibri OS

Rev

Rev 3266 | Rev 3290 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2340 Serge 1
 
2
3
 
2338 Serge 4
#include "drm.h"
5
#include "i915_drm.h"
6
#include "i915_drv.h"
7
#include "intel_drv.h"
8
9
 
10
#include 
11
#include 
12
#include 
13
#include 
14
15
 
16
17
 
3033 serge 18
#include "bitmap.h"
2340 Serge 19
2338 Serge 20
 
2351 Serge 21
2338 Serge 22
 
2351 Serge 23
 
2338 Serge 24
{
25
    kobj_t     header;
26
27
 
28
    uint32_t   hot_x;
29
    uint32_t   hot_y;
30
31
 
32
    struct drm_i915_gem_object  *cobj;
33
}cursor_t;
34
35
 
36
#define CURSOR_HEIGHT 64
37
38
 
39
 
40
{
41
    int  x;
42
    int  y;
43
    int  width;
44
    int  height;
45
    int  bpp;
46
    int  vrefresh;
47
    int  pitch;
48
    int  lfb;
49
50
 
51
    struct drm_device    *ddev;
52
    struct drm_connector *connector;
53
    struct drm_crtc      *crtc;
54
55
 
56
57
 
58
    int       (*init_cursor)(cursor_t*);
59
    cursor_t* (__stdcall *select_cursor)(cursor_t*);
60
    void      (*show_cursor)(int show);
61
    void      (__stdcall *move_cursor)(cursor_t *cursor, int x, int y);
62
    void      (__stdcall *restore_cursor)(int x, int y);
63
    void      (*disable_mouse)(void);
64
    u32  mask_seqno;
2361 Serge 65
    u32  check_mouse;
3031 serge 66
    u32  check_m_pixel;
67
68
 
2338 Serge 69
70
 
71
 
72
73
 
2340 Serge 74
u32_t cmd_offset;
75
76
 
2351 Serge 77
int  sna_init();
78
79
 
2338 Serge 80
static cursor_t*  __stdcall select_cursor_kms(cursor_t *cursor);
81
static void       __stdcall move_cursor_kms(cursor_t *cursor, int x, int y);
82
83
 
84
{};
85
86
 
87
{};
88
89
 
3031 serge 90
{
91
    static char name[4];
92
93
 
94
    name[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@';
95
    name[2] = (x[1] & 0x1F) + '@';
96
    name[3] = 0;
97
98
 
99
}
100
101
 
102
              videomode_t *reqmode, bool strict)
103
{
104
    drm_i915_private_t      *dev_priv   = dev->dev_private;
105
    struct drm_fb_helper    *fb_helper  = &dev_priv->fbdev->helper;
106
107
 
108
    struct drm_display_mode *mode       = NULL, *tmpmode;
109
    struct drm_framebuffer  *fb         = NULL;
110
    struct drm_crtc         *crtc;
111
    struct drm_encoder      *encoder;
112
    struct drm_mode_set     set;
113
    char *con_name;
114
    char *enc_name;
115
    unsigned hdisplay, vdisplay;
116
    int ret;
117
118
 
119
120
 
121
    {
122
        if( (drm_mode_width(tmpmode)    == reqmode->width)  &&
123
            (drm_mode_height(tmpmode)   == reqmode->height) &&
124
            (drm_mode_vrefresh(tmpmode) == reqmode->freq) )
125
        {
126
            mode = tmpmode;
127
            goto do_set;
128
        }
129
    };
130
131
 
132
    {
133
        list_for_each_entry(tmpmode, &connector->modes, head)
134
        {
135
            if( (drm_mode_width(tmpmode)  == reqmode->width)  &&
136
                (drm_mode_height(tmpmode) == reqmode->height) )
137
            {
138
                mode = tmpmode;
139
                goto do_set;
140
            }
141
        };
142
    };
143
144
 
3037 serge 145
3031 serge 146
 
147
148
 
149
150
 
151
 
152
    crtc = encoder->crtc;
153
154
 
155
    enc_name = drm_get_encoder_name(encoder);
156
157
 
158
              reqmode->width, reqmode->height, crtc->base.id,
159
              con_name, enc_name);
160
161
 
162
163
 
164
    vdisplay = mode->vdisplay;
165
166
 
167
        swap(hdisplay, vdisplay);
168
169
 
170
171
 
172
    fb->height = reqmode->height;
173
    fb->pitches[0]  = ALIGN(reqmode->width * 4, 64);
174
    fb->pitches[1]  = ALIGN(reqmode->width * 4, 64);
175
    fb->pitches[2]  = ALIGN(reqmode->width * 4, 64);
176
    fb->pitches[3]  = ALIGN(reqmode->width * 4, 64);
177
178
 
179
    fb->depth = 24;
180
181
 
182
    crtc->enabled = true;
183
    os_display->crtc = crtc;
184
185
 
186
    set.x = 0;
187
    set.y = 0;
188
    set.mode = mode;
189
    set.connectors = &connector;
190
    set.num_connectors = 1;
191
    set.fb = fb;
192
    ret = crtc->funcs->set_config(&set);
193
    mutex_unlock(&dev->mode_config.mutex);
194
195
 
196
    {
197
        os_display->width    = fb->width;
198
        os_display->height   = fb->height;
199
        os_display->pitch    = fb->pitches[0];
200
        os_display->vrefresh = drm_mode_vrefresh(mode);
201
202
 
203
204
 
3037 serge 205
                       fb->width, fb->height, fb->pitches[0]);
3031 serge 206
    }
207
    else
208
        DRM_ERROR("failed to set mode %d_%d on crtc %p\n",
209
                   fb->width, fb->height, crtc);
210
211
 
212
 
213
}
214
215
 
2338 Serge 216
{
217
    struct drm_display_mode  *mode;
218
    int count = 0;
219
220
 
221
    {
222
        count++;
223
    };
224
    return count;
225
};
226
227
 
3031 serge 228
{
229
    struct drm_connector  *connector;
230
    struct drm_connector_helper_funcs *connector_funcs;
231
232
 
233
234
 
235
    {
236
        struct drm_encoder  *encoder;
237
        struct drm_crtc     *crtc;
238
239
 
240
            continue;
241
242
 
243
        encoder = connector_funcs->best_encoder(connector);
244
        if( encoder == NULL)
245
            continue;
246
247
 
248
249
 
250
251
 
3037 serge 252
                   connector, connector->base.id,
3031 serge 253
                   connector->status, connector->encoder,
254
                   crtc);
255
256
 
257
//            continue;
258
259
 
260
261
 
262
    };
263
264
 
265
};