Subversion Repositories Kolibri OS

Rev

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