Rev 3031 | Rev 3037 | 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 | |||
145 | |||
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 | |||
205 | fb->width, fb->height, fb->pitches[0]); |
||
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 | |||
252 | connector, connector->base.id, |
||
253 | connector->status, connector->encoder, |
||
254 | crtc); |
||
255 | |||
256 | |||
257 | // continue; |
||
258 | |||
259 | |||
260 | |||
261 | |||
262 | }; |
||
263 | |||
264 | |||
265 | }; |
||
266 | |||
267 | |||
268 | |||
2338 | Serge | 269 | { |
270 | struct drm_connector *connector; |
||
271 | struct drm_connector_helper_funcs *connector_funcs; |
||
272 | struct drm_encoder *encoder; |
||
273 | struct drm_crtc *crtc = NULL; |
||
274 | struct drm_framebuffer *fb; |
||
275 | |||
276 | |||
277 | u32_t ifl; |
||
278 | int err; |
||
3033 | serge | 279 | |
2338 | Serge | 280 | |
3031 | serge | 281 | |
2338 | Serge | 282 | |
283 | { |
||
284 | if( connector->status != connector_status_connected) |
||
285 | continue; |
||
286 | |||
287 | |||
288 | encoder = connector_funcs->best_encoder(connector); |
||
289 | if( encoder == NULL) |
||
290 | { |
||
291 | dbgprintf("CONNECTOR %x ID: %d no active encoders\n", |
||
292 | connector, connector->base.id); |
||
293 | continue; |
||
294 | } |
||
295 | connector->encoder = encoder; |
||
296 | crtc = encoder->crtc; |
||
3031 | serge | 297 | |
2338 | Serge | 298 | |
3031 | serge | 299 | connector, connector->base.id, |
2338 | Serge | 300 | connector->status, connector->encoder, |
301 | crtc, crtc->base.id ); |
||
3031 | serge | 302 | |
2338 | Serge | 303 | |
304 | }; |
||
305 | |||
306 | |||
307 | { |
||
308 | dbgprintf("No active connectors!\n"); |
||
309 | return -1; |
||
310 | }; |
||
311 | |||
312 | |||
313 | { |
||
314 | struct drm_crtc *tmp_crtc; |
||
315 | int crtc_mask = 1; |
||
316 | |||
317 | |||
318 | { |
||
319 | if (encoder->possible_crtcs & crtc_mask) |
||
320 | { |
||
321 | crtc = tmp_crtc; |
||
322 | encoder->crtc = crtc; |
||
323 | break; |
||
324 | }; |
||
325 | crtc_mask <<= 1; |
||
326 | }; |
||
327 | }; |
||
328 | |||
329 | |||
330 | { |
||
331 | dbgprintf("No CRTC for encoder %d\n", encoder->base.id); |
||
332 | return -1; |
||
333 | }; |
||
334 | |||
335 | |||
336 | |||
337 | |||
338 | |||
339 | os_display->ddev = dev; |
||
340 | os_display->connector = connector; |
||
341 | os_display->crtc = crtc; |
||
342 | |||
343 | |||
344 | |||
345 | |||
346 | |||
347 | { |
||
348 | struct intel_crtc *intel_crtc = to_intel_crtc(os_display->crtc); |
||
349 | |||
350 | |||
351 | { |
||
352 | init_cursor(cursor); |
||
353 | }; |
||
354 | |||
355 | |||
356 | os_display->init_cursor = init_cursor; |
||
357 | os_display->select_cursor = select_cursor_kms; |
||
358 | os_display->show_cursor = NULL; |
||
359 | os_display->move_cursor = move_cursor_kms; |
||
360 | os_display->restore_cursor = restore_cursor; |
||
361 | os_display->disable_mouse = disable_mouse; |
||
362 | |||
363 | |||
364 | intel_crtc->cursor_y = os_display->height/2; |
||
365 | |||
366 | |||
367 | }; |
||
368 | safe_sti(ifl); |
||
369 | |||
370 | |||
2351 | Serge | 371 | |
372 | |||
2342 | Serge | 373 | if( !err ) |
374 | { |
||
375 | printf("Initialize bitmap manager\n"); |
||
376 | }; |
||
2340 | Serge | 377 | |
378 | |||
2351 | Serge | 379 | |
3031 | serge | 380 | |
2338 | Serge | 381 | |
382 | }; |
||
383 | |||
384 | |||
385 | |||
386 | { |
||
387 | int err = -1; |
||
388 | |||
389 | |||
3031 | serge | 390 | |
2338 | Serge | 391 | |
3031 | serge | 392 | |
2338 | Serge | 393 | |
394 | { |
||
395 | *count = os_display->supported_modes; |
||
396 | err = 0; |
||
397 | } |
||
398 | else if( mode != NULL ) |
||
399 | { |
||
400 | struct drm_display_mode *drmmode; |
||
401 | int i = 0; |
||
402 | |||
403 | |||
404 | *count = os_display->supported_modes; |
||
405 | |||
406 | |||
407 | { |
||
408 | if( i < *count) |
||
409 | { |
||
410 | mode->width = drm_mode_width(drmmode); |
||
411 | mode->height = drm_mode_height(drmmode); |
||
412 | mode->bpp = 32; |
||
413 | mode->freq = drm_mode_vrefresh(drmmode); |
||
414 | i++; |
||
415 | mode++; |
||
416 | } |
||
417 | else break; |
||
418 | }; |
||
419 | *count = i; |
||
420 | err = 0; |
||
421 | }; |
||
422 | // LEAVE(); |
||
3031 | serge | 423 | return err; |
2338 | Serge | 424 | }; |
425 | |||
426 | |||
427 | { |
||
428 | int err = -1; |
||
429 | |||
430 | |||
3031 | serge | 431 | |
2338 | Serge | 432 | |
3031 | serge | 433 | // mode->width, mode->height, mode->freq); |
434 | |||
2338 | Serge | 435 | |
436 | (mode->height != 0) && |
||
437 | (mode->freq != 0 ) && |
||
438 | ( (mode->width != os_display->width) || |
||
439 | (mode->height != os_display->height) || |
||
440 | (mode->freq != os_display->vrefresh) ) ) |
||
441 | { |
||
442 | if( set_mode(os_display->ddev, os_display->connector, mode, true) ) |
||
443 | err = 0; |
||
444 | }; |
||
445 | |||
446 | |||
3031 | serge | 447 | return err; |
2338 | Serge | 448 | }; |
449 | |||
450 | |||
451 | { |
||
452 | /* FIXME synchronization */ |
||
2342 | Serge | 453 | |
454 | |||
2338 | Serge | 455 | // radeon_bo_unpin(cursor->robj); |
456 | // KernelFree(cursor->data); |
||
457 | __DestroyObject(cursor); |
||
458 | }; |
||
459 | |||
460 | |||
461 | { |
||
462 | struct drm_i915_private *dev_priv = os_display->ddev->dev_private; |
||
463 | struct drm_i915_gem_object *obj; |
||
464 | uint32_t *bits; |
||
465 | uint32_t *src; |
||
466 | |||
467 | |||
468 | int ret; |
||
469 | |||
470 | |||
3031 | serge | 471 | |
2338 | Serge | 472 | |
473 | { |
||
474 | bits = (uint32_t*)KernelAlloc(CURSOR_WIDTH*CURSOR_HEIGHT*4); |
||
475 | if (unlikely(bits == NULL)) |
||
476 | return ENOMEM; |
||
477 | cursor->cobj = (struct drm_i915_gem_object *)GetPgAddr(bits); |
||
478 | } |
||
479 | else |
||
480 | { |
||
481 | obj = i915_gem_alloc_object(os_display->ddev, CURSOR_WIDTH*CURSOR_HEIGHT*4); |
||
482 | if (unlikely(obj == NULL)) |
||
483 | return -ENOMEM; |
||
484 | |||
485 | |||
3031 | serge | 486 | if (ret) { |
2338 | Serge | 487 | drm_gem_object_unreference(&obj->base); |
2344 | Serge | 488 | return ret; |
2338 | Serge | 489 | } |
490 | |||
491 | |||
492 | * GTT space is continuous. I guarantee it. */ |
||
493 | |||
494 | |||
3031 | serge | 495 | CURSOR_WIDTH*CURSOR_HEIGHT*4, PG_SW); |
2338 | Serge | 496 | |
497 | |||
498 | { |
||
499 | i915_gem_object_unpin(obj); |
||
2344 | Serge | 500 | drm_gem_object_unreference(&obj->base); |
501 | return -ENOMEM; |
||
2338 | Serge | 502 | }; |
503 | cursor->cobj = obj; |
||
504 | }; |
||
505 | |||
506 | |||
507 | |||
508 | |||
509 | { |
||
510 | for(j = 0; j < 32; j++) |
||
511 | *bits++ = *src++; |
||
512 | for(j = 32; j < CURSOR_WIDTH; j++) |
||
513 | *bits++ = 0; |
||
514 | } |
||
515 | for(i = 0; i < CURSOR_WIDTH*(CURSOR_HEIGHT-32); i++) |
||
516 | *bits++ = 0; |
||
517 | |||
518 | |||
519 | |||
520 | |||
2340 | Serge | 521 | |
2338 | Serge | 522 | |
523 | |||
524 | |||
525 | // LEAVE(); |
||
3031 | serge | 526 | |
2338 | Serge | 527 | |
528 | } |
||
529 | |||
530 | |||
531 | |||
532 | { |
||
533 | struct drm_device *dev = crtc->dev; |
||
534 | struct drm_i915_private *dev_priv = dev->dev_private; |
||
535 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
||
536 | int pipe = intel_crtc->pipe; |
||
537 | bool visible = base != 0; |
||
538 | |||
539 | |||
540 | uint32_t cntl = I915_READ(CURCNTR(pipe)); |
||
541 | if (base) { |
||
542 | cntl &= ~(CURSOR_MODE | MCURSOR_PIPE_SELECT); |
||
543 | cntl |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE; |
||
544 | cntl |= pipe << 28; /* Connect to correct pipe */ |
||
545 | } else { |
||
546 | cntl &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE); |
||
547 | cntl |= CURSOR_MODE_DISABLE; |
||
548 | } |
||
549 | I915_WRITE(CURCNTR(pipe), cntl); |
||
550 | |||
551 | |||
552 | } |
||
553 | /* and commit changes on next vblank */ |
||
554 | I915_WRITE(CURBASE(pipe), base); |
||
555 | } |
||
556 | |||
557 | |||
558 | { |
||
559 | struct drm_i915_private *dev_priv = os_display->ddev->dev_private; |
||
560 | struct intel_crtc *intel_crtc = to_intel_crtc(os_display->crtc); |
||
561 | u32 base, pos; |
||
562 | bool visible; |
||
563 | |||
564 | |||
565 | |||
566 | |||
567 | intel_crtc->cursor_y = y; |
||
568 | |||
569 | |||
570 | y = y - cursor->hot_y; |
||
571 | |||
572 | |||
573 | |||
574 | |||
575 | |||
576 | if (x >= os_display->width) |
||
577 | base = 0; |
||
578 | |||
579 | |||
580 | base = 0; |
||
581 | |||
582 | |||
583 | { |
||
584 | if (x + intel_crtc->cursor_width < 0) |
||
585 | base = 0; |
||
586 | |||
587 | |||
588 | x = -x; |
||
589 | } |
||
590 | pos |= x << CURSOR_X_SHIFT; |
||
591 | |||
592 | |||
593 | { |
||
594 | if (y + intel_crtc->cursor_height < 0) |
||
595 | base = 0; |
||
596 | |||
597 | |||
598 | y = -y; |
||
599 | } |
||
600 | pos |= y << CURSOR_Y_SHIFT; |
||
601 | |||
602 | |||
603 | if (!visible && !intel_crtc->cursor_visible) |
||
604 | return; |
||
605 | |||
606 | |||
607 | // if (IS_845G(dev) || IS_I865G(dev)) |
||
608 | // i845_update_cursor(crtc, base); |
||
609 | // else |
||
610 | i9xx_update_cursor(os_display->crtc, base); |
||
611 | |||
612 | |||
613 | |||
614 | |||
615 | |||
616 | { |
||
617 | struct drm_i915_private *dev_priv = os_display->ddev->dev_private; |
||
618 | struct intel_crtc *intel_crtc = to_intel_crtc(os_display->crtc); |
||
619 | cursor_t *old; |
||
620 | |||
621 | |||
622 | os_display->cursor = cursor; |
||
623 | |||
624 | |||
625 | intel_crtc->cursor_addr = cursor->cobj->gtt_offset; |
||
626 | else |
||
627 | intel_crtc->cursor_addr = (addr_t)cursor->cobj; |
||
2352 | Serge | 628 | |
2338 | Serge | 629 | |
630 | intel_crtc->cursor_height = 32; |
||
631 | |||
632 | |||
633 | return old; |
||
634 | }; |
||
635 | |||
636 | |||
2340 | Serge | 637 | |
638 | |||
2342 | Serge | 639 | |
3033 | serge | 640 | |
641 | |||
642 | |||
643 | |||
2342 | Serge | 644 | { |
2338 | Serge | 645 | int left; |
2342 | Serge | 646 | int top; |
647 | int right; |
||
648 | int bottom; |
||
649 | }rect_t; |
||
650 | |||
2338 | Serge | 651 | |
2342 | Serge | 652 | |
653 | |||
654 | |||
655 | |||
656 | |||
657 | |||
658 | |||
659 | { |
||
660 | u32_t addr; |
||
661 | |||
662 | |||
663 | addr+= sizeof(display_t); /* shoot me */ |
||
664 | return *(u32_t*)addr; |
||
665 | } |
||
666 | |||
667 | |||
3033 | serge | 668 | #define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6) |
669 | #define XY_SRC_COPY_CHROMA_CMD ((2<<29)|(0x73<<22)|8) |
||
2342 | Serge | 670 | #define ROP_COPY_SRC 0xCC |
671 | #define FORMAT8888 3 |
||
672 | |||
673 | |||
3033 | serge | 674 | #define BLT_WRITE_RGB (1<<20) |
675 | |||
676 | |||
677 | |||
678 | |||
2342 | Serge | 679 | |
680 | |||
681 | |||
3033 | serge | 682 | i915_gem_execbuffer_retire_commands(struct drm_device *dev, |
683 | struct intel_ring_buffer *ring) |
||
684 | { |
||
685 | struct drm_i915_gem_request *request; |
||
686 | u32 invalidate; |
||
687 | u32 req; |
||
688 | /* |
||
689 | * Ensure that the commands in the batch buffer are |
||
690 | * finished before the interrupt fires. |
||
691 | * |
||
692 | * The sampler always gets flushed on i965 (sigh). |
||
693 | */ |
||
694 | invalidate = I915_GEM_DOMAIN_COMMAND; |
||
695 | if (INTEL_INFO(dev)->gen >= 4) |
||
696 | invalidate |= I915_GEM_DOMAIN_SAMPLER; |
||
697 | if (ring->flush(ring, invalidate, 0)) { |
||
698 | i915_gem_next_request_seqno(ring); |
||
699 | return; |
||
700 | } |
||
701 | |||
702 | |||
703 | if (request == NULL || i915_add_request(ring, NULL, &req)) { |
||
704 | i915_gem_next_request_seqno(ring); |
||
705 | } |
||
706 | } |
||
707 | |||
708 | |||
709 | |||
710 | |||
711 | |||
712 | |||
2342 | Serge | 713 | int src_x, int src_y, u32 w, u32 h) |
714 | { |
||
715 | drm_i915_private_t *dev_priv = main_device->dev_private; |
||
2340 | Serge | 716 | struct intel_ring_buffer *ring; |
717 | struct context *context; |
||
3033 | serge | 718 | |
2338 | Serge | 719 | |
2342 | Serge | 720 | rect_t winrc; |
721 | clip_t dst_clip; |
||
722 | clip_t src_clip; |
||
723 | u32_t width; |
||
724 | u32_t height; |
||
725 | |||
2338 | Serge | 726 | |
2342 | Serge | 727 | u32_t offset; |
728 | u8 slot; |
||
729 | int n=0; |
||
2340 | Serge | 730 | |
2338 | Serge | 731 | |
2342 | Serge | 732 | return -1; |
733 | |||
2338 | Serge | 734 | |
3033 | serge | 735 | |
2338 | Serge | 736 | |
2342 | Serge | 737 | return -1; |
738 | |||
2338 | Serge | 739 | |
3033 | serge | 740 | if(unlikely(context == NULL)) |
741 | return -1; |
||
742 | |||
2338 | Serge | 743 | |
2342 | Serge | 744 | |
2338 | Serge | 745 | |
2342 | Serge | 746 | dst_clip.ymin = 0; |
747 | dst_clip.xmax = winrc.right-winrc.left-1; |
||
748 | dst_clip.ymax = winrc.bottom -winrc.top -1; |
||
749 | |||
2338 | Serge | 750 | |
2342 | Serge | 751 | src_clip.ymin = 0; |
752 | src_clip.xmax = bitmap->width - 1; |
||
753 | src_clip.ymax = bitmap->height - 1; |
||
754 | |||
2338 | Serge | 755 | |
2342 | Serge | 756 | height = h; |
757 | |||
2338 | Serge | 758 | |
2342 | Serge | 759 | &src_clip, &src_x, &src_y, |
760 | &width, &height) ) |
||
761 | return 0; |
||
762 | |||
2340 | Serge | 763 | |
2342 | Serge | 764 | dst_y+= winrc.top; |
765 | |||
2340 | Serge | 766 | |
2342 | Serge | 767 | |
2340 | Serge | 768 | |
2342 | Serge | 769 | |
2340 | Serge | 770 | |
2342 | Serge | 771 | #if 0 |
772 | static v4si write_mask = {0xFF000000, 0xFF000000, |
||
773 | 0xFF000000, 0xFF000000}; |
||
774 | |||
2340 | Serge | 775 | |
2342 | Serge | 776 | u8* dst_offset; |
777 | |||
2340 | Serge | 778 | |
2342 | Serge | 779 | src_offset += (u32)bitmap->uaddr; |
780 | |||
2340 | Serge | 781 | |
2342 | Serge | 782 | dst_offset+= get_display_map(); |
783 | |||
2340 | Serge | 784 | |
2342 | Serge | 785 | |
2340 | Serge | 786 | |
2342 | Serge | 787 | "movdqa %[write_mask], %%xmm7 \n" |
788 | "movd %[slot_mask], %%xmm6 \n" |
||
789 | "punpckldq %%xmm6, %%xmm6 \n" |
||
790 | "punpcklqdq %%xmm6, %%xmm6 \n" |
||
791 | :: [write_mask] "m" (write_mask), |
||
792 | [slot_mask] "g" (slot_mask) |
||
793 | :"xmm7", "xmm6"); |
||
794 | |||
2340 | Serge | 795 | |
2342 | Serge | 796 | { |
797 | u32_t tmp_w = width; |
||
798 | |||
2340 | Serge | 799 | |
2342 | Serge | 800 | u8* tmp_dst = dst_offset; |
801 | |||
2340 | Serge | 802 | |
2342 | Serge | 803 | dst_offset+= os_display->width; |
804 | |||
2340 | Serge | 805 | |
2342 | Serge | 806 | { |
807 | __asm__ __volatile__ ( |
||
808 | "movq (%0), %%xmm0 \n" |
||
809 | "punpcklbw %%xmm0, %%xmm0 \n" |
||
810 | "movdqa %%xmm0, %%xmm1 \n" |
||
811 | "punpcklwd %%xmm0, %%xmm0 \n" |
||
812 | "punpckhwd %%xmm1, %%xmm1 \n" |
||
813 | "pcmpeqb %%xmm6, %%xmm0 \n" |
||
814 | "pcmpeqb %%xmm6, %%xmm1 \n" |
||
815 | "maskmovdqu %%xmm7, %%xmm0 \n" |
||
816 | "addl $16, %%edi \n" |
||
817 | "maskmovdqu %%xmm7, %%xmm1 \n" |
||
818 | :: "r" (tmp_dst), "D" (tmp_src) |
||
819 | :"xmm0", "xmm1"); |
||
820 | __asm__ __volatile__ ("":::"edi"); |
||
821 | tmp_w -= 8; |
||
822 | tmp_src += 32; |
||
823 | tmp_dst += 8; |
||
824 | }; |
||
825 | |||
2340 | Serge | 826 | |
2342 | Serge | 827 | { |
828 | __asm__ __volatile__ ( |
||
829 | "movd (%0), %%xmm0 \n" |
||
830 | "punpcklbw %%xmm0, %%xmm0 \n" |
||
831 | "punpcklwd %%xmm0, %%xmm0 \n" |
||
832 | "pcmpeqb %%xmm6, %%xmm0 \n" |
||
833 | "maskmovdqu %%xmm7, %%xmm0 \n" |
||
834 | :: "r" (tmp_dst), "D" (tmp_src) |
||
835 | :"xmm0"); |
||
836 | tmp_w -= 4; |
||
837 | tmp_src += 16; |
||
838 | tmp_dst += 4; |
||
839 | }; |
||
840 | |||
2340 | Serge | 841 | |
2342 | Serge | 842 | { |
843 | *(tmp_src+3) = (*tmp_dst==slot)?0xFF:0x00; |
||
844 | tmp_src+=4; |
||
845 | tmp_dst++; |
||
846 | }; |
||
847 | }; |
||
848 | #else |
||
849 | u8* src_offset; |
||
850 | u8* dst_offset; |
||
851 | u32 ifl; |
||
2351 | Serge | 852 | |
2340 | Serge | 853 | |
2342 | Serge | 854 | src_offset += (u32)bitmap->uaddr; |
855 | |||
2340 | Serge | 856 | |
2342 | Serge | 857 | dst_offset+= get_display_map(); |
858 | |||
859 | |||
860 | |||
861 | |||
2351 | Serge | 862 | while( tmp_h--) |
2342 | Serge | 863 | { |
864 | u32_t tmp_w = width; |
||
865 | |||
866 | |||
867 | u8* tmp_dst = dst_offset; |
||
868 | |||
869 | |||
870 | dst_offset+= os_display->width; |
||
871 | |||
872 | |||
873 | { |
||
874 | *(tmp_src+3) = (*tmp_dst==slot)?0xFF:0x00; |
||
875 | tmp_src+=4; |
||
876 | tmp_dst++; |
||
877 | }; |
||
878 | }; |
||
879 | safe_sti(ifl); |
||
2351 | Serge | 880 | } |
2342 | Serge | 881 | #endif |
882 | |||
883 | |||
3033 | serge | 884 | context->cmd_buffer&= 0xFFFFF000; |
885 | |||
2342 | Serge | 886 | |
3033 | serge | 887 | |
2342 | Serge | 888 | |
3033 | serge | 889 | |
2342 | Serge | 890 | |
891 | cmd |= 3 << 17; |
||
892 | |||
893 | |||
2340 | Serge | 894 | br13|= ROP_COPY_SRC << 16; |
2342 | Serge | 895 | br13|= FORMAT8888 << 24; |
896 | |||
2340 | Serge | 897 | |
898 | b[n++] = br13; |
||
899 | b[n++] = (dst_y << 16) | dst_x; // left, top |
||
2342 | Serge | 900 | b[n++] = ((dst_y+height-1)<< 16)|(dst_x+width-1); // bottom, right |
901 | b[n++] = 0; // destination |
||
902 | b[n++] = (src_y << 16) | src_x; // source left & top |
||
903 | b[n++] = bitmap->pitch; // source pitch |
||
904 | b[n++] = bitmap->gaddr; // source |
||
905 | |||
2340 | Serge | 906 | |
2342 | Serge | 907 | b[n++] = 0x00FFFFFF; // Transparency Color High |
908 | |||
2340 | Serge | 909 | |
910 | if( n & 1) |
||
911 | b[n++] = MI_NOOP; |
||
912 | |||
913 | |||
3033 | serge | 914 | |
2340 | Serge | 915 | |
3033 | serge | 916 | |
917 | |||
2342 | Serge | 918 | { |
2351 | Serge | 919 | int ret; |
920 | |||
921 | |||
2342 | Serge | 922 | // printf("dispatch... "); |
3033 | serge | 923 | ring->dispatch_execbuffer(ring, offset, n*4); |
924 | // printf("done\n"); |
||
925 | |||
2351 | Serge | 926 | |
3033 | serge | 927 | // printf("retire\n"); |
928 | } |
||
2351 | Serge | 929 | else |
2342 | Serge | 930 | { |
2351 | Serge | 931 | ring = &dev_priv->ring[RCS]; |
2342 | Serge | 932 | ring->dispatch_execbuffer(ring, offset, n*4); |
3033 | serge | 933 | ring->flush(ring, 0, I915_GEM_DOMAIN_RENDER); |
2351 | Serge | 934 | }; |
935 | |||
2342 | Serge | 936 | |
2351 | Serge | 937 | bitmap->obj->base.write_domain = I915_GEM_DOMAIN_CPU; |
938 | |||
2340 | Serge | 939 | |
2351 | Serge | 940 | fail: |
941 | return -1; |
||
942 | }; |
||
943 | |||
2340 | Serge | 944 | |
2344 | Serge | 945 | |
3033 | serge | 946 | |
947 | |||
948 | /* For display hotplug interrupt */ |
||
2351 | Serge | 949 | static void |
950 | ironlake_enable_display_irq(drm_i915_private_t *dev_priv, u32 mask) |
||
951 | { |
||
952 | if ((dev_priv->irq_mask & mask) != 0) { |
||
953 | dev_priv->irq_mask &= ~mask; |
||
954 | I915_WRITE(DEIMR, dev_priv->irq_mask); |
||
955 | POSTING_READ(DEIMR); |
||
956 | } |
||
957 | } |
||
958 | |||
2340 | Serge | 959 | |
2351 | Serge | 960 | { |
961 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
||
962 | unsigned long irqflags; |
||
963 | |||
964 | |||
965 | // return -EINVAL; |
||
966 | |||
967 | |||
968 | ironlake_enable_display_irq(dev_priv, (pipe == 0) ? |
||
969 | DE_PIPEA_VBLANK : DE_PIPEB_VBLANK); |
||
970 | spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); |
||
971 | |||
972 | |||
2340 | Serge | 973 | } |
2351 | Serge | 974 | |
975 | |||
976 | |||
977 | |||
978 | { |
||
979 | drm_i915_private_t *dev_priv = dev->dev_private; |
||
980 | int ret, i, pipe; |
||
981 | |||
982 | |||
983 | dbgprintf("Interrupt enable: %08x\n", |
||
984 | I915_READ(IER)); |
||
985 | dbgprintf("Interrupt identity: %08x\n", |
||
986 | I915_READ(IIR)); |
||
987 | dbgprintf("Interrupt mask: %08x\n", |
||
988 | I915_READ(IMR)); |
||
989 | for_each_pipe(pipe) |
||
990 | dbgprintf("Pipe %c stat: %08x\n", |
||
991 | pipe_name(pipe), |
||
992 | I915_READ(PIPESTAT(pipe))); |
||
993 | } else { |
||
994 | dbgprintf("North Display Interrupt enable: %08x\n", |
||
995 | I915_READ(DEIER)); |
||
996 | dbgprintf("North Display Interrupt identity: %08x\n", |
||
997 | I915_READ(DEIIR)); |
||
998 | dbgprintf("North Display Interrupt mask: %08x\n", |
||
999 | I915_READ(DEIMR)); |
||
1000 | dbgprintf("South Display Interrupt enable: %08x\n", |
||
1001 | I915_READ(SDEIER)); |
||
1002 | dbgprintf("South Display Interrupt identity: %08x\n", |
||
1003 | I915_READ(SDEIIR)); |
||
1004 | dbgprintf("South Display Interrupt mask: %08x\n", |
||
1005 | I915_READ(SDEIMR)); |
||
1006 | dbgprintf("Graphics Interrupt enable: %08x\n", |
||
1007 | I915_READ(GTIER)); |
||
1008 | dbgprintf("Graphics Interrupt identity: %08x\n", |
||
1009 | I915_READ(GTIIR)); |
||
1010 | dbgprintf("Graphics Interrupt mask: %08x\n", |
||
1011 | I915_READ(GTIMR)); |
||
1012 | } |
||
1013 | dbgprintf("Interrupts received: %d\n", |
||
1014 | atomic_read(&dev_priv->irq_received)); |
||
1015 | for (i = 0; i < I915_NUM_RINGS; i++) { |
||
1016 | if (IS_GEN6(dev) || IS_GEN7(dev)) { |
||
1017 | printf("Graphics Interrupt mask (%s): %08x\n", |
||
1018 | dev_priv->ring[i].name, |
||
1019 | I915_READ_IMR(&dev_priv->ring[i])); |
||
1020 | } |
||
1021 | // i915_ring_seqno_info(m, &dev_priv->ring[i]); |
||
1022 | } |
||
1023 | |||
1024 | |||
1025 | } |
||
1026 | |||
1027 | |||
1028 | int size) |
||
1029 | { |
||
1030 | struct intel_ring_buffer *ring; |
||
1031 | drm_i915_private_t *dev_priv = main_device->dev_private; |
||
1032 | u32 invalidate; |
||
1033 | u32 seqno = 2; |
||
1034 | |||
1035 | |||
1036 | // dbgprintf("execute %x size %d\n", offset, size); |
||
1037 | |||
1038 | |||
1039 | // "mfence \n" |
||
1040 | // "wbinvd \n" |
||
1041 | // "mfence \n" |
||
1042 | // :::"memory"); |
||
1043 | |||
1044 | |||
1045 | ring->dispatch_execbuffer(ring, offset, size); |
||
1046 | |||
1047 | |||
1048 | if (INTEL_INFO(main_device)->gen >= 4) |
||
1049 | invalidate |= I915_GEM_DOMAIN_SAMPLER; |
||
1050 | if (ring->flush(ring, invalidate, 0)) |
||
1051 | i915_gem_next_request_seqno(ring); |
||
1052 | |||
1053 | |||
1054 | |||
1055 | |||
1056 | |||
1057 | |||
1058 | |||
1059 | |||
2340 | Serge | 1060 | |
2351 | Serge | 1061 | |
1062 | |||
1063 | int src_x, int src_y, u32 w, u32 h) |
||
1064 | { |
||
1065 | drm_i915_private_t *dev_priv = main_device->dev_private; |
||
1066 | |||
1067 | |||
1068 | bitmap_t screen; |
||
1069 | |||
1070 | |||
1071 | |||
1072 | |||
1073 | // hbitmap, dst_x, dst_y, src_x, src_y, w, h); |
||
1074 | |||
1075 | |||
1076 | return -1; |
||
1077 | |||
1078 | |||
1079 | // dbgprintf("bitmap %x\n", src_bitmap); |
||
1080 | |||
1081 | |||
1082 | return -1; |
||
1083 | |||
1084 | |||
1085 | |||
1086 | |||
1087 | screen.gaddr = 0; |
||
1088 | screen.width = os_display->width; |
||
1089 | screen.height = os_display->height; |
||
1090 | screen.obj = (void*)-1; |
||
1091 | |||
1092 | |||
1093 | |||
1094 | |||
1095 | dst_y+= winrc.top; |
||
1096 | |||
1097 | |||
1098 | |||
1099 | |||
1100 | |||
1101 | |||
2361 | Serge | 1102 | int w, int h, bitmap_t *src_bitmap, int src_x, int src_y, |
1103 | bitmap_t *mask_bitmap); |
||
1104 | |||
2360 | Serge | 1105 | |
2361 | Serge | 1106 | |
1107 | int src_x, int src_y, u32 w, u32 h) |
||
1108 | { |
||
1109 | drm_i915_private_t *dev_priv = main_device->dev_private; |
||
1110 | struct context *ctx; |
||
1111 | |||
1112 | |||
1113 | bitmap_t screen; |
||
1114 | int ret; |
||
1115 | |||
1116 | |||
1117 | rect_t winrc; |
||
1118 | |||
1119 | |||
1120 | // hbitmap, dst_x, dst_y, src_x, src_y, w, h); |
||
1121 | |||
1122 | |||
1123 | return -1; |
||
1124 | |||
1125 | |||
1126 | // dbgprintf("bitmap %x\n", src_bitmap); |
||
1127 | |||
1128 | |||
1129 | return -1; |
||
1130 | |||
1131 | |||
1132 | if(unlikely(ctx==NULL)) |
||
1133 | { |
||
1134 | ret = create_context(); |
||
1135 | if(ret!=0) |
||
1136 | return -1; |
||
1137 | |||
1138 | |||
1139 | }; |
||
1140 | |||
1141 | |||
1142 | |||
1143 | |||
1144 | dst_x+= winrc.left; |
||
1145 | dst_y+= winrc.top; |
||
1146 | |||
1147 | |||
1148 | |||
1149 | { |
||
1150 | u8* src_offset; |
||
1151 | u8* dst_offset; |
||
1152 | u32 slot; |
||
3031 | serge | 1153 | u32 ifl; |
2361 | Serge | 1154 | |
1155 | |||
1156 | if(ret !=0 ) |
||
1157 | { |
||
1158 | dbgprintf("%s fail\n", __FUNCTION__); |
||
1159 | return ret; |
||
1160 | }; |
||
1161 | |||
1162 | |||
3031 | serge | 1163 | |
2361 | Serge | 1164 | |
1165 | mask_bitmap->height = winrc.bottom; |
||
1166 | mask_bitmap->pitch = ALIGN(w,64); |
||
1167 | |||
1168 | |||
3031 | serge | 1169 | // slot = 0x01; |
1170 | |||
1171 | |||
2361 | Serge | 1172 | |
1173 | |||
1174 | |||
1175 | "movd %[slot], %%xmm6 \n" |
||
1176 | "punpckldq %%xmm6, %%xmm6 \n" |
||
1177 | "punpcklqdq %%xmm6, %%xmm6 \n" |
||
1178 | :: [slot] "m" (slot) |
||
3031 | serge | 1179 | :"xmm6"); |
2361 | Serge | 1180 | |
1181 | |||
1182 | |||
1183 | |||
1184 | dst_offset+= get_display_map(); |
||
1185 | |||
1186 | |||
1187 | |||
1188 | |||
1189 | while( tmp_h--) |
||
1190 | { |
||
1191 | int tmp_w = mask_bitmap->width; |
||
1192 | |||
1193 | |||
1194 | u8* tmp_dst = dst_offset; |
||
1195 | |||
1196 | |||
1197 | dst_offset+= os_display->width; |
||
1198 | |||
1199 | |||
1200 | // { |
||
1201 | // *(tmp_src) = (*tmp_dst==slot)?0x1:0x00; |
||
1202 | // tmp_src++; |
||
1203 | // tmp_dst++; |
||
1204 | // }; |
||
1205 | while(tmp_w >= 64) |
||
1206 | { |
||
1207 | __asm__ __volatile__ ( |
||
1208 | "movdqu (%0), %%xmm0 \n" |
||
1209 | "movdqu 16(%0), %%xmm1 \n" |
||
1210 | "movdqu 32(%0), %%xmm2 \n" |
||
1211 | "movdqu 48(%0), %%xmm3 \n" |
||
1212 | "pcmpeqb %%xmm6, %%xmm0 \n" |
||
1213 | "pcmpeqb %%xmm6, %%xmm1 \n" |
||
1214 | "pcmpeqb %%xmm6, %%xmm2 \n" |
||
1215 | "pcmpeqb %%xmm6, %%xmm3 \n" |
||
1216 | "movdqa %%xmm0, (%%edi) \n" |
||
1217 | "movdqa %%xmm1, 16(%%edi) \n" |
||
1218 | "movdqa %%xmm2, 32(%%edi) \n" |
||
1219 | "movdqa %%xmm3, 48(%%edi) \n" |
||
1220 | |||
1221 | |||
1222 | :"xmm0","xmm1","xmm2","xmm3"); |
||
1223 | tmp_w -= 64; |
||
1224 | tmp_src += 64; |
||
1225 | tmp_dst += 64; |
||
1226 | } |
||
1227 | |||
1228 | |||
1229 | { |
||
1230 | __asm__ __volatile__ ( |
||
1231 | "movdqu (%0), %%xmm0 \n" |
||
1232 | "movdqu 16(%0), %%xmm1 \n" |
||
1233 | "pcmpeqb %%xmm6, %%xmm0 \n" |
||
1234 | "pcmpeqb %%xmm6, %%xmm1 \n" |
||
1235 | "movdqa %%xmm0, (%%edi) \n" |
||
1236 | "movdqa %%xmm1, 16(%%edi) \n" |
||
1237 | |||
1238 | |||
1239 | :"xmm0","xmm1"); |
||
1240 | tmp_w -= 32; |
||
1241 | tmp_src += 32; |
||
1242 | tmp_dst += 32; |
||
1243 | } |
||
1244 | |||
1245 | |||
1246 | { |
||
1247 | __asm__ __volatile__ ( |
||
1248 | "movdqu (%0), %%xmm0 \n" |
||
1249 | "pcmpeqb %%xmm6, %%xmm0 \n" |
||
1250 | "movdqa %%xmm0, (%%edi) \n" |
||
1251 | :: "r" (tmp_dst), "D" (tmp_src) |
||
1252 | :"xmm0"); |
||
1253 | tmp_w -= 16; |
||
1254 | tmp_src += 16; |
||
1255 | tmp_dst += 16; |
||
1256 | } |
||
1257 | }; |
||
1258 | safe_sti(ifl); |
||
1259 | ctx->seqno = os_display->mask_seqno; |
||
1260 | } |
||
1261 | |||
1262 | |||
1263 | screen.gaddr = 0; |
||
1264 | screen.width = os_display->width; |
||
1265 | screen.height = os_display->height; |
||
1266 | screen.obj = (void*)-1; |
||
1267 | |||
1268 | |||
1269 | |||
1270 | |||
1271 | |||
1272 | mask_bitmap); |
||
1273 | |||
1274 | |||
1275 | }; |
||
1276 | |||
1277 | |||
1278 | |||
3031 | serge | 1279 | |
2361 | Serge | 1280 | |
1281 | |||
1282 | |||
1283 | |||
1284 | |||
1285 | |||
1286 | |||
1287 | |||
2360 | Serge | 1288 | { |
1289 | unsigned long irqflags; |
||
1290 | |||
1291 | |||
1292 | // cwq, &cwq->worklist, cwq->worklist.next); |
||
1293 | |||
1294 | |||
1295 | |||
1296 | |||
1297 | { |
||
1298 | struct work_struct *work = list_entry(cwq->worklist.next, |
||
1299 | struct work_struct, entry); |
||
1300 | work_func_t f = work->func; |
||
1301 | list_del_init(cwq->worklist.next); |
||
1302 | // dbgprintf("head %x, next %x\n", |
||
1303 | // &cwq->worklist, cwq->worklist.next); |
||
1304 | |||
1305 | |||
1306 | f(work); |
||
1307 | spin_lock_irqsave(&cwq->lock, irqflags); |
||
1308 | } |
||
1309 | |||
1310 | |||
1311 | } |
||
1312 | |||
1313 | |||
1314 | |||
1315 | int __queue_work(struct workqueue_struct *wq, |
||
1316 | struct work_struct *work) |
||
1317 | { |
||
1318 | unsigned long flags; |
||
1319 | // ENTER(); |
||
1320 | |||
1321 | |||
1322 | // wq, work ); |
||
1323 | |||
1324 | |||
1325 | return 0; |
||
1326 | |||
1327 | |||
1328 | |||
1329 | |||
1330 | TimerHs(0,0, run_workqueue, wq); |
||
1331 | |||
1332 | |||
1333 | |||
1334 | |||
1335 | // dbgprintf("wq: %x head %x, next %x\n", |
||
1336 | // wq, &wq->worklist, wq->worklist.next); |
||
1337 | |||
1338 | |||
1339 | return 1; |
||
1340 | }; |
||
1341 | |||
1342 | |||
1343 | { |
||
1344 | // ENTER(); |
||
1345 | struct delayed_work *dwork = (struct delayed_work *)__data; |
||
1346 | struct workqueue_struct *wq = dwork->work.data; |
||
1347 | |||
1348 | |||
1349 | // wq, &dwork->work ); |
||
1350 | |||
1351 | |||
1352 | // LEAVE(); |
||
1353 | } |
||
1354 | |||
1355 | |||
1356 | |||
1357 | struct delayed_work *dwork, unsigned long delay) |
||
1358 | { |
||
1359 | struct work_struct *work = &dwork->work; |
||
1360 | |||
1361 | |||
1362 | TimerHs(0,0, delayed_work_timer_fn, dwork); |
||
1363 | return 1; |
||
1364 | } |
||
1365 | |||
1366 | |||
1367 | struct delayed_work *dwork, unsigned long delay) |
||
1368 | { |
||
1369 | u32 flags; |
||
1370 | // ENTER(); |
||
1371 | |||
1372 | |||
1373 | // wq, &dwork->work ); |
||
1374 | |||
1375 | |||
1376 | return __queue_work(wq, &dwork->work); |
||
1377 | |||
1378 | |||
1379 | } |
||
1380 | |||
1381 | |||
1382 | |||
1383 | unsigned int flags, |
||
1384 | int max_active) |
||
1385 | { |
||
1386 | struct workqueue_struct *wq; |
||
1387 | |||
1388 | |||
1389 | if (!wq) |
||
1390 | goto err; |
||
1391 | |||
1392 | |||
1393 | |||
1394 | |||
1395 | err: |
||
1396 | return NULL; |
||
1397 | } |
||
1398 | |||
1399 | |||
3031 | serge | 1400 | |
2360 | Serge | 1401 | |
3031 | serge | 1402 | { |
1403 | u32 tmp = GetTimerTicks(); |
||
1404 | |||
2360 | Serge | 1405 | |
3031 | serge | 1406 | ts->tv_nsec = (tmp - ts->tv_sec*100)*10000000; |
1407 | } |
||
1408 | |||
2360 | Serge | 1409 | |
3031 | serge | 1410 | { |
1411 | while (nsec >= NSEC_PER_SEC) { |
||
1412 | nsec -= NSEC_PER_SEC; |
||
1413 | ++sec; |
||
1414 | } |
||
1415 | while (nsec < 0) { |
||
1416 | nsec += NSEC_PER_SEC; |
||
1417 | --sec; |
||
1418 | } |
||
1419 | ts->tv_sec = sec; |
||
1420 | ts->tv_nsec = nsec; |
||
1421 | }>24); |
||
1422 | |||
2360 | Serge | 1423 | |
3031 | serge | 1424 | |
1425 |