Subversion Repositories Kolibri OS

Rev

Rev 2361 | Rev 3033 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2361 Rev 3031
Line 60... Line 60...
60
    void      (__stdcall *move_cursor)(cursor_t *cursor, int x, int y);
60
    void      (__stdcall *move_cursor)(cursor_t *cursor, int x, int y);
61
    void      (__stdcall *restore_cursor)(int x, int y);
61
    void      (__stdcall *restore_cursor)(int x, int y);
62
    void      (*disable_mouse)(void);
62
    void      (*disable_mouse)(void);
63
    u32  mask_seqno;
63
    u32  mask_seqno;
64
};
64
    u32  check_mouse;
-
 
65
    u32  check_m_pixel;
-
 
66
 
-
 
67
};
65
 
68
 
Line 66... Line 69...
66
 
69
 
Line 81... Line 84...
81
 
84
 
Line 82... Line 85...
82
void disable_mouse(void)
85
void disable_mouse(void)
83
{};
86
{};
Line -... Line 87...
-
 
87
 
-
 
88
static char *manufacturer_name(unsigned char *x)
-
 
89
{
-
 
90
    static char name[4];
-
 
91
 
-
 
92
    name[0] = ((x[0] & 0x7C) >> 2) + '@';
-
 
93
    name[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@';
-
 
94
    name[2] = (x[1] & 0x1F) + '@';
-
 
95
    name[3] = 0;
-
 
96
 
-
 
97
    return name;
-
 
98
}
-
 
99
 
-
 
100
bool set_mode(struct drm_device *dev, struct drm_connector *connector,
-
 
101
              videomode_t *reqmode, bool strict)
-
 
102
{
-
 
103
    drm_i915_private_t      *dev_priv   = dev->dev_private;
-
 
104
    struct drm_fb_helper    *fb_helper  = &dev_priv->fbdev->helper;
-
 
105
 
-
 
106
    struct drm_mode_config  *config     = &dev->mode_config;
-
 
107
    struct drm_display_mode *mode       = NULL, *tmpmode;
-
 
108
    struct drm_framebuffer  *fb         = NULL;
-
 
109
    struct drm_crtc         *crtc;
-
 
110
    struct drm_encoder      *encoder;
-
 
111
    struct drm_mode_set     set;
-
 
112
    char *con_name;
-
 
113
    char *enc_name;
-
 
114
    unsigned hdisplay, vdisplay;
-
 
115
    int ret;
-
 
116
 
-
 
117
    mutex_lock(&dev->mode_config.mutex);
-
 
118
 
-
 
119
    list_for_each_entry(tmpmode, &connector->modes, head)
-
 
120
    {
-
 
121
        if( (drm_mode_width(tmpmode)    == reqmode->width)  &&
-
 
122
            (drm_mode_height(tmpmode)   == reqmode->height) &&
-
 
123
            (drm_mode_vrefresh(tmpmode) == reqmode->freq) )
-
 
124
        {
-
 
125
            mode = tmpmode;
-
 
126
            goto do_set;
-
 
127
        }
-
 
128
    };
-
 
129
 
-
 
130
    if( (mode == NULL) && (strict == false) )
-
 
131
    {
-
 
132
        list_for_each_entry(tmpmode, &connector->modes, head)
-
 
133
        {
-
 
134
            if( (drm_mode_width(tmpmode)  == reqmode->width)  &&
-
 
135
                (drm_mode_height(tmpmode) == reqmode->height) )
-
 
136
            {
-
 
137
                mode = tmpmode;
-
 
138
                goto do_set;
-
 
139
            }
-
 
140
        };
-
 
141
    };
-
 
142
 
-
 
143
    printf("%s failed\n", __FUNCTION__);
-
 
144
 
-
 
145
    return -1;
-
 
146
 
-
 
147
do_set:
-
 
148
 
-
 
149
 
-
 
150
    encoder = connector->encoder;
-
 
151
    crtc = encoder->crtc;
-
 
152
 
-
 
153
    con_name = drm_get_connector_name(connector);
-
 
154
    enc_name = drm_get_encoder_name(encoder);
-
 
155
 
-
 
156
    DRM_DEBUG_KMS("set mode %d %d: crtc %d connector %s encoder %s\n",
-
 
157
              reqmode->width, reqmode->height, crtc->base.id,
-
 
158
              con_name, enc_name);
-
 
159
 
-
 
160
    drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
-
 
161
 
-
 
162
    hdisplay = mode->hdisplay;
-
 
163
    vdisplay = mode->vdisplay;
-
 
164
 
-
 
165
    if (crtc->invert_dimensions)
-
 
166
        swap(hdisplay, vdisplay);
-
 
167
 
-
 
168
    fb = fb_helper->fb;
-
 
169
 
-
 
170
    fb->width  = reqmode->width;
-
 
171
    fb->height = reqmode->height;
-
 
172
    fb->pitches[0]  = ALIGN(reqmode->width * 4, 64);
-
 
173
    fb->pitches[1]  = ALIGN(reqmode->width * 4, 64);
-
 
174
    fb->pitches[2]  = ALIGN(reqmode->width * 4, 64);
-
 
175
    fb->pitches[3]  = ALIGN(reqmode->width * 4, 64);
-
 
176
 
-
 
177
    fb->bits_per_pixel = 32;
-
 
178
    fb->depth = 24;
-
 
179
 
-
 
180
    crtc->fb = fb;
-
 
181
    crtc->enabled = true;
-
 
182
    os_display->crtc = crtc;
-
 
183
 
-
 
184
    set.crtc = crtc;
-
 
185
    set.x = 0;
-
 
186
    set.y = 0;
-
 
187
    set.mode = mode;
-
 
188
    set.connectors = &connector;
-
 
189
    set.num_connectors = 1;
-
 
190
    set.fb = fb;
-
 
191
    ret = crtc->funcs->set_config(&set);
-
 
192
    mutex_unlock(&dev->mode_config.mutex);
-
 
193
 
-
 
194
    if ( !ret )
-
 
195
    {
-
 
196
        os_display->width    = fb->width;
-
 
197
        os_display->height   = fb->height;
-
 
198
        os_display->pitch    = fb->pitches[0];
-
 
199
        os_display->vrefresh = drm_mode_vrefresh(mode);
-
 
200
 
-
 
201
        sysSetScreen(fb->width, fb->height, fb->pitches[0]);
-
 
202
 
-
 
203
        dbgprintf("new mode %d x %d pitch %d\n",
-
 
204
                       fb->width, fb->height, fb->pitches[0]);
-
 
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
    return ret;
-
 
212
}
84
 
213
 
85
static int count_connector_modes(struct drm_connector* connector)
214
static int count_connector_modes(struct drm_connector* connector)
86
{
215
{
87
    struct drm_display_mode  *mode;
216
    struct drm_display_mode  *mode;
Line 93... Line 222...
93
    };
222
    };
94
    return count;
223
    return count;
95
};
224
};
96
 
225
 
Line -... Line 226...
-
 
226
static struct drm_connector* get_def_connector(struct drm_device *dev)
-
 
227
{
-
 
228
    struct drm_connector  *connector;
-
 
229
    struct drm_connector_helper_funcs *connector_funcs;
-
 
230
 
-
 
231
    struct drm_connector  *def_connector = NULL;
-
 
232
 
-
 
233
    list_for_each_entry(connector, &dev->mode_config.connector_list, head)
-
 
234
    {
-
 
235
        struct drm_encoder  *encoder;
-
 
236
        struct drm_crtc     *crtc;
-
 
237
 
-
 
238
        if( connector->status != connector_status_connected)
-
 
239
            continue;
-
 
240
 
-
 
241
        connector_funcs = connector->helper_private;
-
 
242
        encoder = connector_funcs->best_encoder(connector);
-
 
243
        if( encoder == NULL)
-
 
244
            continue;
-
 
245
 
-
 
246
        connector->encoder = encoder;
-
 
247
 
-
 
248
        crtc = encoder->crtc;
-
 
249
 
-
 
250
        dbgprintf("CONNECTOR %x ID:  %d status %d encoder %x\n crtc %x",
-
 
251
                   connector, connector->base.id,
-
 
252
                   connector->status, connector->encoder,
-
 
253
                   crtc);
-
 
254
 
-
 
255
//        if (crtc == NULL)
-
 
256
//            continue;
-
 
257
 
-
 
258
        def_connector = connector;
-
 
259
 
-
 
260
        break;
-
 
261
    };
-
 
262
 
-
 
263
    return def_connector;
-
 
264
};
-
 
265
 
-
 
266
 
97
int init_display_kms(struct drm_device *dev)
267
int init_display_kms(struct drm_device *dev)
98
{
268
{
99
    struct drm_connector    *connector;
269
    struct drm_connector    *connector;
100
    struct drm_connector_helper_funcs *connector_funcs;
270
    struct drm_connector_helper_funcs *connector_funcs;
101
    struct drm_encoder      *encoder;
271
    struct drm_encoder      *encoder;
Line 104... Line 274...
104
 
274
 
Line 105... Line 275...
105
    cursor_t  *cursor;
275
    cursor_t  *cursor;
106
    u32_t      ifl;
276
    u32_t      ifl;
Line 107... Line 277...
107
 
277
 
Line 108... Line 278...
108
    ENTER();
278
//    ENTER();
109
 
279
 
110
    list_for_each_entry(connector, &dev->mode_config.connector_list, head)
280
    list_for_each_entry(connector, &dev->mode_config.connector_list, head)
111
    {
281
    {
Line 120... Line 290...
120
                      connector, connector->base.id);
290
                      connector, connector->base.id);
121
            continue;
291
            continue;
122
        }
292
        }
123
        connector->encoder = encoder;
293
        connector->encoder = encoder;
124
 
294
        crtc = encoder->crtc;
-
 
295
 
Line 125... Line 296...
125
        dbgprintf("CONNECTOR %x ID:  %d status %d encoder %x\n crtc %x\n",
296
        dbgprintf("CONNECTOR %x ID:%d status:%d ENCODER %x CRTC %x ID:%d\n",
126
               connector, connector->base.id,
297
               connector, connector->base.id,
127
               connector->status, connector->encoder,
298
               connector->status, connector->encoder,
128
               encoder->crtc);
299
               crtc, crtc->base.id );
Line 129... Line -...
129
 
-
 
130
        crtc = encoder->crtc;
300
 
131
        break;
301
        break;
Line 132... Line 302...
132
    };
302
    };
133
 
303
 
Line 163... Line 333...
163
 
333
 
Line 164... Line 334...
164
    DRM_DEBUG_KMS("[Select CRTC:%d]\n", crtc->base.id);
334
    DRM_DEBUG_KMS("[Select CRTC:%d]\n", crtc->base.id);
165
 
-
 
166
    os_display = GetDisplay();
335
 
167
 
336
    os_display = GetDisplay();
168
    os_display->ddev = dev;
337
    os_display->ddev = dev;
Line 169... Line 338...
169
    os_display->connector = connector;
338
    os_display->connector = connector;
Line 199... Line 368...
199
#define XY_COLOR_BLT        ((2<<29)|(0x50<<22)|(0x4))
368
#define XY_COLOR_BLT        ((2<<29)|(0x50<<22)|(0x4))
200
#define BLT_WRITE_ALPHA     (1<<21)
369
#define BLT_WRITE_ALPHA     (1<<21)
201
#define BLT_WRITE_RGB       (1<<20)
370
#define BLT_WRITE_RGB       (1<<20)
Line -... Line 371...
-
 
371
 
-
 
372
#if 0
202
 
373
 
203
#if 1
374
#if 1
Line 204... Line 375...
204
    {
375
    {
205
 
376
 
206
        drm_i915_private_t *dev_priv = dev->dev_private;
377
        drm_i915_private_t *dev_priv = dev->dev_private;
Line 207... Line 378...
207
        struct drm_i915_gem_object *obj;
378
        struct drm_i915_gem_object *obj;
208
        struct intel_ring_buffer *ring;
379
        struct intel_ring_buffer *ring;
Line 209... Line 380...
209
 
380
 
210
        obj = i915_gem_alloc_object(dev, 4096);
381
        obj = i915_gem_alloc_object(dev, 4096);
211
        i915_gem_object_pin(obj, 4096, true);
382
        i915_gem_object_pin(obj, 4096, true, true);
212
 
383
 
Line 213... Line 384...
213
        cmd_buffer = MapIoMem((addr_t)obj->pages[0], 4096, PG_SW|PG_NOCACHE);
384
        cmd_buffer = MapIoMem((addr_t)obj->pages.page[0], 4096, PG_SW|PG_NOCACHE);
Line 225... Line 396...
225
        printf("Initialize bitmap manager\n");
396
        printf("Initialize bitmap manager\n");
226
    };
397
    };
227
 
398
 
Line 228... Line 399...
228
    sna_init();
399
    sna_init();
-
 
400
#endif
Line 229... Line 401...
229
 
401
 
Line 230... Line 402...
230
    LEAVE();
402
//    LEAVE();
231
 
403
 
Line 232... Line -...
232
    return 0;
-
 
233
};
-
 
234
 
-
 
235
 
-
 
236
bool set_mode(struct drm_device *dev, struct drm_connector *connector,
-
 
237
              videomode_t *reqmode, bool strict)
-
 
238
{
-
 
239
    struct drm_display_mode  *mode = NULL, *tmpmode;
-
 
240
    drm_i915_private_t *dev_priv = dev->dev_private;
-
 
241
    struct drm_fb_helper *fb_helper = &dev_priv->fbdev->helper;
-
 
242
 
-
 
243
    bool ret = false;
-
 
244
 
-
 
245
    ENTER();
-
 
246
 
-
 
247
    dbgprintf("width %d height %d vrefresh %d\n",
-
 
248
               reqmode->width, reqmode->height, reqmode->freq);
-
 
249
 
-
 
250
    list_for_each_entry(tmpmode, &connector->modes, head)
-
 
251
    {
-
 
252
        if( (drm_mode_width(tmpmode)    == reqmode->width)  &&
-
 
253
            (drm_mode_height(tmpmode)   == reqmode->height) &&
-
 
254
            (drm_mode_vrefresh(tmpmode) == reqmode->freq) )
-
 
255
        {
-
 
256
            mode = tmpmode;
-
 
257
            goto do_set;
-
 
258
        }
-
 
259
    };
-
 
260
 
-
 
261
    if( (mode == NULL) && (strict == false) )
-
 
262
    {
-
 
263
        list_for_each_entry(tmpmode, &connector->modes, head)
-
 
264
        {
-
 
265
            if( (drm_mode_width(tmpmode)  == reqmode->width)  &&
-
 
266
                (drm_mode_height(tmpmode) == reqmode->height) )
-
 
267
            {
-
 
268
                mode = tmpmode;
-
 
269
                goto do_set;
-
 
270
            }
-
 
271
        };
-
 
272
    };
-
 
273
 
-
 
274
do_set:
-
 
275
 
-
 
276
    if( mode != NULL )
-
 
277
    {
-
 
278
        struct drm_framebuffer   *fb;
-
 
279
        struct drm_encoder       *encoder;
-
 
280
        struct drm_crtc          *crtc;
-
 
281
 
-
 
282
        char *con_name;
-
 
283
        char *enc_name;
-
 
284
 
-
 
285
        encoder = connector->encoder;
-
 
286
        crtc = encoder->crtc;
-
 
287
 
-
 
288
        con_name = drm_get_connector_name(connector);
-
 
289
        enc_name = drm_get_encoder_name(encoder);
-
 
290
 
-
 
291
        dbgprintf("set mode %d %d connector %s encoder %s\n",
-
 
292
                   reqmode->width, reqmode->height, con_name, enc_name);
-
 
293
 
-
 
294
        fb = fb_helper->fb;
-
 
295
 
-
 
296
        fb->width  = reqmode->width;
-
 
297
        fb->height = reqmode->height;
-
 
298
        fb->pitches[0]  = ALIGN(reqmode->width * 4, 64);
-
 
299
        fb->pitches[1]  = ALIGN(reqmode->width * 4, 64);
-
 
300
        fb->pitches[2]  = ALIGN(reqmode->width * 4, 64);
-
 
301
        fb->pitches[3]  = ALIGN(reqmode->width * 4, 64);
-
 
302
 
-
 
303
        fb->bits_per_pixel = 32;
-
 
304
        fb->depth == 24;
-
 
305
 
-
 
306
        crtc->fb = fb;
-
 
307
        crtc->enabled = true;
-
 
308
        os_display->crtc = crtc;
-
 
309
 
-
 
310
        ret = drm_crtc_helper_set_mode(crtc, mode, 0, 0, fb);
-
 
311
 
-
 
312
//        select_cursor_kms(rdisplay->cursor);
-
 
313
//        radeon_show_cursor_kms(crtc);
-
 
314
 
-
 
315
        if (ret == true)
-
 
316
        {
-
 
317
            os_display->width    = fb->width;
-
 
318
            os_display->height   = fb->height;
-
 
319
            os_display->pitch    = fb->pitches[0];
-
 
320
            os_display->vrefresh = drm_mode_vrefresh(mode);
-
 
321
 
-
 
322
            sysSetScreen(fb->width, fb->height, fb->pitches[0]);
-
 
323
 
-
 
324
            dbgprintf("new mode %d x %d pitch %d\n",
-
 
325
                       fb->width, fb->height, fb->pitches[0]);
-
 
326
        }
-
 
327
        else
-
 
328
            DRM_ERROR("failed to set mode %d_%d on crtc %p\n",
-
 
329
                       fb->width, fb->height, crtc);
-
 
330
    }
-
 
331
 
-
 
332
    LEAVE();
-
 
333
    return ret;
-
 
334
};
404
    return 0;
335
 
405
};
336
 
406
 
Line 337... Line 407...
337
 
407
 
Line 338... Line 408...
338
int get_videomodes(videomode_t *mode, int *count)
408
int get_videomodes(videomode_t *mode, int *count)
Line 339... Line 409...
339
{
409
{
340
    int err = -1;
410
    int err = -1;
341
 
411
 
342
    ENTER();
412
//    ENTER();
Line 371... Line 441...
371
        };
441
        };
372
        *count = i;
442
        *count = i;
373
        err = 0;
443
        err = 0;
374
    };
444
    };
375
    LEAVE();
445
//    LEAVE();
376
    return err;
446
    return err;
377
};
447
};
378
 
448
 
Line 379... Line 449...
379
int set_user_mode(videomode_t *mode)
449
int set_user_mode(videomode_t *mode)
380
{
450
{
381
    int err = -1;
451
    int err = -1;
Line 382... Line 452...
382
 
452
 
Line 383... Line 453...
383
    ENTER();
453
//    ENTER();
384
 
454
 
Line 385... Line 455...
385
    dbgprintf("width %d height %d vrefresh %d\n",
455
//    dbgprintf("width %d height %d vrefresh %d\n",
386
               mode->width, mode->height, mode->freq);
456
//               mode->width, mode->height, mode->freq);
387
 
457
 
388
    if( (mode->width  != 0)  &&
458
    if( (mode->width  != 0)  &&
Line 395... Line 465...
395
        if( set_mode(os_display->ddev, os_display->connector, mode, true) )
465
        if( set_mode(os_display->ddev, os_display->connector, mode, true) )
396
            err = 0;
466
            err = 0;
397
    };
467
    };
398
 
468
 
Line 399... Line 469...
399
    LEAVE();
469
//    LEAVE();
400
    return err;
470
    return err;
401
};
471
};
Line 402... Line 472...
402
 
472
 
403
void __attribute__((regparm(1))) destroy_cursor(cursor_t *cursor)
473
void __attribute__((regparm(1))) destroy_cursor(cursor_t *cursor)
Line 419... Line 489...
419
 
489
 
Line 420... Line 490...
420
    int       i,j;
490
    int       i,j;
421
    int       ret;
491
    int       ret;
Line 422... Line 492...
422
 
492
 
Line 423... Line 493...
423
    ENTER();
493
//    ENTER();
424
 
494
 
425
    if (dev_priv->info->cursor_needs_physical)
495
    if (dev_priv->info->cursor_needs_physical)
426
    {
496
    {
Line 434... Line 504...
434
        obj = i915_gem_alloc_object(os_display->ddev, CURSOR_WIDTH*CURSOR_HEIGHT*4);
504
        obj = i915_gem_alloc_object(os_display->ddev, CURSOR_WIDTH*CURSOR_HEIGHT*4);
435
        if (unlikely(obj == NULL))
505
        if (unlikely(obj == NULL))
436
            return -ENOMEM;
506
            return -ENOMEM;
437
 
507
 
Line 438... Line 508...
438
        ret = i915_gem_object_pin(obj, CURSOR_WIDTH*CURSOR_HEIGHT*4, true);
508
        ret = i915_gem_object_pin(obj, CURSOR_WIDTH*CURSOR_HEIGHT*4, true, true);
439
        if (ret) {
509
        if (ret) {
440
            drm_gem_object_unreference(&obj->base);
510
            drm_gem_object_unreference(&obj->base);
441
            return ret;
511
            return ret;
442
        }
512
        }
Line 443... Line 513...
443
 
513
 
444
/* You don't need to worry about fragmentation issues.
514
/* You don't need to worry about fragmentation issues.
Line 445... Line 515...
445
 * GTT space is continuous. I guarantee it.                           */
515
 * GTT space is continuous. I guarantee it.                           */
446
 
516
 
Line 447... Line 517...
447
        bits = (u32*)MapIoMem(get_bus_addr() + obj->gtt_offset,
517
        bits = (u32*)MapIoMem(dev_priv->mm.gtt->gma_bus_addr + obj->gtt_offset,
448
                    CURSOR_WIDTH*CURSOR_HEIGHT*4, PG_SW);
518
                    CURSOR_WIDTH*CURSOR_HEIGHT*4, PG_SW);
449
 
519
 
Line 474... Line 544...
474
 
544
 
Line 475... Line 545...
475
    cursor->data = bits;
545
    cursor->data = bits;
Line 476... Line 546...
476
 
546
 
477
    cursor->header.destroy = destroy_cursor;
547
    cursor->header.destroy = destroy_cursor;
Line 478... Line 548...
478
    LEAVE();
548
//    LEAVE();
479
 
549
 
Line 585... Line 655...
585
    move_cursor_kms(cursor, intel_crtc->cursor_x, intel_crtc->cursor_y);
655
    move_cursor_kms(cursor, intel_crtc->cursor_x, intel_crtc->cursor_y);
586
    return old;
656
    return old;
587
};
657
};
Line -... Line 658...
-
 
658
 
Line 588... Line 659...
588
 
659
#if 0
Line 589... Line 660...
589
 
660
 
Line 1058... Line 1129...
1058
    if(ctx->seqno != os_display->mask_seqno)
1129
    if(ctx->seqno != os_display->mask_seqno)
1059
    {
1130
    {
1060
        u8* src_offset;
1131
        u8* src_offset;
1061
        u8* dst_offset;
1132
        u8* dst_offset;
1062
        u32 slot = *((u8*)CURRENT_TASK);
1133
        u32 slot;
1063
        u32 ifl;
1134
        u32 ifl;
Line 1064... Line 1135...
1064
 
1135
 
1065
        ret = gem_object_lock(mask_bitmap->obj);
1136
        ret = gem_object_lock(mask_bitmap->obj);
1066
        if(ret !=0 )
1137
        if(ret !=0 )
1067
        {
1138
        {
1068
            dbgprintf("%s fail\n", __FUNCTION__);
1139
            dbgprintf("%s fail\n", __FUNCTION__);
1069
            return ret;
1140
            return ret;
Line 1070... Line 1141...
1070
        };
1141
        };
Line 1071... Line 1142...
1071
 
1142
 
1072
        printf("width %d height %d\n", winrc.right, winrc.bottom);
1143
//        printf("width %d height %d\n", winrc.right, winrc.bottom);
1073
 
1144
 
Line -... Line 1145...
-
 
1145
        mask_bitmap->width  = winrc.right;
-
 
1146
        mask_bitmap->height = winrc.bottom;
-
 
1147
        mask_bitmap->pitch =  ALIGN(w,64);
1074
        mask_bitmap->width  = winrc.right;
1148
 
Line 1075... Line 1149...
1075
        mask_bitmap->height = winrc.bottom;
1149
        slot = *((u8*)CURRENT_TASK);
1076
        mask_bitmap->pitch =  ALIGN(w,64);
1150
//        slot = 0x01;
1077
 
1151
 
1078
        slot|= (slot<<8)|(slot<<16)|(slot<<24);
1152
        slot|= (slot<<8)|(slot<<16)|(slot<<24);
1079
 
1153
 
1080
 
1154
 
Line 1081... Line 1155...
1081
        __asm__ __volatile__ (
1155
        __asm__ __volatile__ (
Line 1082... Line 1156...
1082
        "movd       %[slot],   %%xmm6    \n"
1156
        "movd       %[slot],   %%xmm6    \n"
Line 1250... Line 1324...
1250
 
1324
 
Line 1251... Line 1325...
1251
    return context_map[slot];
1325
    return context_map[slot];
1252
}
1326
}
Line 1253... Line 1327...
1253
 
1327
 
Line 1371... Line 1445...
1371
err:
1445
err:
1372
    return NULL;
1446
    return NULL;
1373
}
1447
}
1374
 
1448
 
Line -... Line 1449...
-
 
1449
#define NSEC_PER_SEC    1000000000L
Line -... Line 1450...
-
 
1450
 
-
 
1451
void getrawmonotonic(struct timespec *ts)
-
 
1452
{
-
 
1453
    u32 tmp = GetTimerTicks();
-
 
1454
 
-
 
1455
    ts->tv_sec  = tmp/100;
-
 
1456
    ts->tv_nsec = (tmp - ts->tv_sec*100)*10000000;
-
 
1457
}
-
 
1458
 
-
 
1459
void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec)
-
 
1460
{
-
 
1461
        while (nsec >= NSEC_PER_SEC) {
-
 
1462
                nsec -= NSEC_PER_SEC;
-
 
1463
                ++sec;
-
 
1464
        }
-
 
1465
        while (nsec < 0) {
-
 
1466
                nsec += NSEC_PER_SEC;
-
 
1467
                --sec;
-
 
1468
        }
-
 
1469
        ts->tv_sec = sec;
-
 
1470
        ts->tv_nsec = nsec;