Rev 5367 | Rev 6088 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5367 | Rev 6084 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | 15 | ||
Line 16... | Line 16... | ||
16 | 16 | ||
17 | display_t *os_display; |
17 | display_t *os_display; |
- | 18 | struct drm_i915_gem_object *main_fb_obj; |
|
Line 18... | Line 19... | ||
18 | struct drm_i915_gem_object *main_fb_obj; |
19 | struct drm_framebuffer *main_framebuffer; |
19 | 20 | ||
Line 20... | Line 21... | ||
20 | u32 cmd_buffer; |
21 | u32 cmd_buffer; |
Line 58... | Line 59... | ||
58 | unsigned hdisplay, vdisplay; |
59 | unsigned hdisplay, vdisplay; |
59 | int stride; |
60 | int stride; |
60 | int ret; |
61 | int ret; |
61 | 62 | ||
Line -... | Line 63... | ||
- | 63 | ENTER(); |
|
- | 64 | ||
62 | drm_modeset_lock_all(dev); |
65 | drm_modeset_lock_all(dev); |
Line 63... | Line 66... | ||
63 | 66 | ||
64 | list_for_each_entry(tmpmode, &connector->modes, head) |
67 | list_for_each_entry(tmpmode, &connector->modes, head) |
65 | { |
68 | { |
Line 101... | Line 104... | ||
101 | 104 | ||
Line 102... | Line 105... | ||
102 | hdisplay = mode->hdisplay; |
105 | hdisplay = mode->hdisplay; |
103 | vdisplay = mode->vdisplay; |
106 | vdisplay = mode->vdisplay; |
Line 104... | Line 107... | ||
104 | 107 | ||
105 | if (crtc->invert_dimensions) |
108 | // if (crtc->invert_dimensions) |
Line 106... | Line 109... | ||
106 | swap(hdisplay, vdisplay); |
109 | // swap(hdisplay, vdisplay); |
- | 110 | ||
- | 111 | fb = crtc->primary->fb; |
|
Line 107... | Line 112... | ||
107 | 112 | if(fb == NULL) |
|
108 | fb = crtc->primary->fb; |
113 | fb = main_framebuffer; |
Line 109... | Line 114... | ||
109 | 114 | ||
Line 136... | Line 141... | ||
136 | 141 | ||
Line 137... | Line 142... | ||
137 | crtc->enabled = true; |
142 | crtc->enabled = true; |
138 | os_display->crtc = crtc; |
143 | os_display->crtc = crtc; |
Line 139... | Line -... | ||
139 | - | ||
140 | // i915_gem_object_unpin_fence(main_fb_obj); |
144 | |
Line -... | Line 145... | ||
- | 145 | i915_gem_object_put_fence(main_fb_obj); |
|
- | 146 | ||
- | 147 | printf("fb:%p %dx%dx pitch %d format %x\n", |
|
141 | i915_gem_object_put_fence(main_fb_obj); |
148 | fb,fb->width,fb->height,fb->pitches[0],fb->pixel_format); |
142 | 149 | ||
143 | set.crtc = crtc; |
150 | set.crtc = crtc; |
144 | set.x = 0; |
151 | set.x = 0; |
145 | set.y = 0; |
152 | set.y = 0; |
146 | set.mode = mode; |
153 | set.mode = mode; |
147 | set.connectors = &connector; |
154 | set.connectors = &connector; |
Line 148... | Line 155... | ||
148 | set.num_connectors = 1; |
155 | set.num_connectors = 1; |
Line 149... | Line -... | ||
149 | set.fb = fb; |
- | |
150 | - | ||
151 | ret = drm_mode_set_config_internal(&set); |
156 | set.fb = fb; |
152 | 157 | ||
153 | drm_modeset_unlock_all(dev); |
158 | ret = drm_mode_set_config_internal(&set); |
154 | 159 | ||
155 | if ( !ret ) |
160 | if ( !ret ) |
Line 166... | Line 171... | ||
166 | else |
171 | else |
167 | DRM_ERROR("failed to set mode %d_%d on crtc %p\n", |
172 | DRM_ERROR("failed to set mode %d_%d on crtc %p\n", |
168 | fb->width, fb->height, crtc); |
173 | fb->width, fb->height, crtc); |
169 | 174 | ||
Line -... | Line 175... | ||
- | 175 | drm_modeset_unlock_all(dev); |
|
- | 176 | ||
- | 177 | LEAVE(); |
|
- | 178 | ||
170 | return ret; |
179 | return ret; |
171 | } |
180 | } |
Line 172... | Line 181... | ||
172 | 181 | ||
173 | static int count_connector_modes(struct drm_connector* connector) |
182 | static int count_connector_modes(struct drm_connector* connector) |
Line 221... | Line 230... | ||
221 | encoder = connector_funcs->best_encoder(connector); |
230 | encoder = connector_funcs->best_encoder(connector); |
222 | 231 | ||
Line 223... | Line 232... | ||
223 | if( encoder == NULL) |
232 | if( encoder == NULL) |
224 | { |
233 | { |
225 | DRM_DEBUG_KMS("CONNECTOR %x ID: %d no active encoders\n", |
234 | DRM_DEBUG_KMS("CONNECTOR %s ID: %d no active encoders\n", |
226 | connector, connector->base.id); |
235 | connector->name, connector->base.id); |
227 | continue; |
236 | continue; |
228 | }; |
237 | }; |
229 | } |
238 | } |
Line 230... | Line 239... | ||
230 | 239 | ||
Line 236... | Line 245... | ||
236 | { |
245 | { |
237 | *boot_connector = connector; |
246 | *boot_connector = connector; |
238 | *boot_crtc = crtc; |
247 | *boot_crtc = crtc; |
239 | 248 | ||
Line 240... | Line 249... | ||
240 | DRM_DEBUG_KMS("CONNECTOR %p ID:%d status:%d ENCODER %p ID: %d CRTC %p ID:%d\n", |
249 | DRM_DEBUG_KMS("CONNECTOR %s ID:%d status:%d ENCODER %p ID: %d CRTC %p ID:%d\n", |
241 | connector, connector->base.id, connector->status, |
250 | connector->name, connector->base.id, connector->status, |
242 | encoder, encoder->base.id, crtc, crtc->base.id ); |
251 | encoder, encoder->base.id, crtc, crtc->base.id ); |
- | 252 | char con_edid[128]; |
|
- | 253 | ||
- | 254 | memcpy(con_edid, connector->edid_blob_ptr->data, 128); |
|
- | 255 | printf("Manufacturer: %s Model %x Serial Number %u\n", |
|
- | 256 | manufacturer_name(con_edid + 0x08), |
|
- | 257 | (unsigned short)(con_edid[0x0A] + (con_edid[0x0B] << 8)), |
|
- | 258 | (unsigned int)(con_edid[0x0C] + (con_edid[0x0D] << 8) |
|
- | 259 | + (con_edid[0x0E] << 16) + (con_edid[0x0F] << 24))); |
|
- | 260 | ||
243 | return 0; |
261 | return 0; |
244 | } |
262 | } |
245 | else |
263 | else |
246 | DRM_DEBUG_KMS("No CRTC for encoder %d\n", encoder->base.id); |
264 | DRM_DEBUG_KMS("No CRTC for encoder %d\n", encoder->base.id); |
Line 283... | Line 301... | ||
283 | cursor_t *cursor; |
301 | cursor_t *cursor; |
284 | u32 ifl; |
302 | u32 ifl; |
285 | int ret; |
303 | int ret; |
Line -... | Line 304... | ||
- | 304 | ||
- | 305 | ENTER(); |
|
286 | 306 | ||
287 | mutex_lock(&dev->struct_mutex); |
307 | mutex_lock(&dev->struct_mutex); |
Line 288... | Line 308... | ||
288 | mutex_lock(&dev->mode_config.mutex); |
308 | mutex_lock(&dev->mode_config.mutex); |
289 | 309 | ||
Line 301... | Line 321... | ||
301 | if (!main_fb_obj->base.name) { |
321 | if (!main_fb_obj->base.name) { |
302 | ret = idr_alloc(&dev->object_name_idr, &main_fb_obj->base, 1, 0, GFP_NOWAIT); |
322 | ret = idr_alloc(&dev->object_name_idr, &main_fb_obj->base, 1, 0, GFP_NOWAIT); |
Line 303... | Line 323... | ||
303 | 323 | ||
304 | main_fb_obj->base.name = ret; |
- | |
305 | - | ||
306 | /* Allocate a reference for the name table. */ |
324 | main_fb_obj->base.name = ret; |
307 | drm_gem_object_reference(&main_fb_obj->base); |
- | |
308 | 325 | main_fb_obj->base.handle_count++; |
|
309 | DRM_DEBUG_KMS("%s allocate fb name %d\n", __FUNCTION__, main_fb_obj->base.name ); |
326 | DRM_DEBUG_KMS("%s allocate fb name %d\n", __FUNCTION__, main_fb_obj->base.name ); |
Line 310... | Line 327... | ||
310 | } |
327 | } |
311 | 328 | ||
312 | idr_preload_end(); |
- | |
Line 313... | Line 329... | ||
313 | mutex_unlock(&dev->object_name_lock); |
329 | idr_preload_end(); |
314 | drm_gem_object_unreference(&main_fb_obj->base); |
330 | mutex_unlock(&dev->object_name_lock); |
315 | 331 | ||
316 | os_display = GetDisplay(); |
332 | os_display = GetDisplay(); |
Line 461... | Line 477... | ||
461 | int ret; |
477 | int ret; |
462 | 478 | ||
Line 463... | Line 479... | ||
463 | if (dev_priv->info.cursor_needs_physical) |
479 | if (dev_priv->info.cursor_needs_physical) |
464 | { |
480 | { |
465 | bits = (uint32_t*)KernelAlloc(KMS_CURSOR_WIDTH*KMS_CURSOR_HEIGHT*4); |
481 | bits = (uint32_t*)KernelAlloc(KMS_CURSOR_WIDTH*KMS_CURSOR_HEIGHT*8); |
466 | if (unlikely(bits == NULL)) |
482 | if (unlikely(bits == NULL)) |
467 | return ENOMEM; |
483 | return ENOMEM; |
468 | cursor->cobj = (struct drm_i915_gem_object *)GetPgAddr(bits); |
484 | cursor->cobj = (struct drm_i915_gem_object *)GetPgAddr(bits); |
469 | } |
485 | } |
470 | else |
486 | else |
471 | { |
487 | { |
472 | obj = i915_gem_alloc_object(os_display->ddev, KMS_CURSOR_WIDTH*KMS_CURSOR_HEIGHT*4); |
488 | obj = i915_gem_alloc_object(os_display->ddev, KMS_CURSOR_WIDTH*KMS_CURSOR_HEIGHT*4); |
473 | if (unlikely(obj == NULL)) |
489 | if (unlikely(obj == NULL)) |
474 | return -ENOMEM; |
490 | return -ENOMEM; |
Line 475... | Line 491... | ||
475 | 491 | ||
476 | ret = i915_gem_obj_ggtt_pin(obj, 0,PIN_MAPPABLE | PIN_NONBLOCK); |
492 | ret = i915_gem_object_ggtt_pin(obj, &i915_ggtt_view_normal, 128*1024, PIN_GLOBAL); |
477 | if (ret) { |
493 | if (ret) { |
478 | drm_gem_object_unreference(&obj->base); |
494 | drm_gem_object_unreference(&obj->base); |
479 | return ret; |
495 | return ret; |
Line 529... | Line 545... | ||
529 | 545 | ||
530 | void __stdcall move_cursor_kms(cursor_t *cursor, int x, int y) |
546 | void __stdcall move_cursor_kms(cursor_t *cursor, int x, int y) |
531 | { |
547 | { |
- | 548 | struct drm_crtc *crtc = os_display->crtc; |
|
- | 549 | struct drm_plane_state *cursor_state = crtc->cursor->state; |
|
532 | struct drm_crtc *crtc = os_display->crtc; |
550 | |
533 | x-= cursor->hot_x; |
551 | x-= cursor->hot_x; |
Line 534... | Line 552... | ||
534 | y-= cursor->hot_y; |
552 | y-= cursor->hot_y; |
535 | 553 | ||
Line -... | Line 554... | ||
- | 554 | crtc->cursor_x = x; |
|
536 | crtc->cursor_x = x; |
555 | crtc->cursor_y = y; |
Line 537... | Line -... | ||
537 | crtc->cursor_y = y; |
- | |
538 | 556 | ||
Line 539... | Line 557... | ||
539 | intel_crtc_update_cursor(crtc, 1); |
557 | cursor_state->crtc_x = x; |
Line 540... | Line -... | ||
540 | - | ||
541 | // if (crtc->funcs->cursor_move) |
558 | cursor_state->crtc_y = y; |
542 | // crtc->funcs->cursor_move(crtc, x, y); |
559 | |
543 | 560 | intel_crtc_update_cursor(crtc, 1); |
|
544 | }; |
561 | |
545 | 562 | }; |
|
Line 554... | Line 571... | ||
554 | 571 | ||
Line 555... | Line 572... | ||
555 | old = os_display->cursor; |
572 | old = os_display->cursor; |
556 | os_display->cursor = cursor; |
573 | os_display->cursor = cursor; |
Line 557... | Line 574... | ||
557 | 574 | ||
Line 558... | Line 575... | ||
558 | intel_crtc->cursor_bo = cursor->cobj; |
575 | // intel_crtc->cursor_bo = cursor->cobj; |
559 | 576 | ||
560 | if (!dev_priv->info.cursor_needs_physical) |
577 | if (!dev_priv->info.cursor_needs_physical) |
561 | intel_crtc->cursor_addr = i915_gem_obj_ggtt_offset(cursor->cobj); |
578 | intel_crtc->cursor_addr = i915_gem_obj_ggtt_offset(cursor->cobj); |
Line -... | Line 579... | ||
- | 579 | else |
|
562 | else |
580 | intel_crtc->cursor_addr = (addr_t)cursor->cobj; |
563 | intel_crtc->cursor_addr = (addr_t)cursor->cobj; |
581 | |
Line 564... | Line 582... | ||
564 | 582 | intel_crtc->base.cursor->state->crtc_w = 64; |
|
565 | intel_crtc->cursor_width = 64; |
583 | intel_crtc->base.cursor->state->crtc_h = 64; |
566 | intel_crtc->cursor_height = 64; |
584 | intel_crtc->base.cursor->state->rotation = 0; |
Line 567... | Line 585... | ||
567 | 585 | ||
568 | move_cursor_kms(cursor, crtc->cursor_x, crtc->cursor_y); |
586 | move_cursor_kms(cursor, crtc->cursor_x, crtc->cursor_y); |
569 | return old; |
587 | return old; |
570 | }; |
588 | }; |
571 | - | ||
572 | int i915_fbinfo(struct drm_i915_fb_info *fb) |
589 | |
Line 573... | Line 590... | ||
573 | { |
590 | int i915_fbinfo(struct drm_i915_fb_info *fb) |
574 | struct drm_i915_private *dev_priv = os_display->ddev->dev_private; |
591 | { |
575 | struct intel_crtc *crtc = to_intel_crtc(os_display->crtc); |
592 | struct drm_i915_private *dev_priv = os_display->ddev->dev_private; |
Line 802... | Line 819... | ||
802 | u32 slot; |
819 | u32 slot; |
803 | int ret = 0; |
820 | int ret = 0; |
804 | slot = *((u8*)CURRENT_TASK); |
821 | slot = *((u8*)CURRENT_TASK); |
805 | 822 | ||
Line 806... | Line 823... | ||
806 | if( mask_seqno[slot] == os_display->mask_seqno) |
823 | if( mask->forced == 0 && mask_seqno[slot] == os_display->mask_seqno) |
807 | return 0; |
824 | return 0; |
Line -... | Line 825... | ||
- | 825 | ||
808 | 826 | if(mask->forced) |
|
Line 809... | Line 827... | ||
809 | memset(mask->bo_map,0,mask->width * mask->height); |
827 | memset((void*)mask->bo_map,0,mask->width * mask->height); |
810 | 828 | ||
811 | GetWindowRect(&win); |
829 | GetWindowRect(&win); |
Line 849... | Line 867... | ||
849 | drm_gem_object_unreference_unlocked(obj); |
867 | drm_gem_object_unreference_unlocked(obj); |
850 | return -EINVAL; |
868 | return -EINVAL; |
851 | } |
869 | } |
852 | 870 | ||
Line 853... | Line 871... | ||
853 | #if 1 |
871 | #if 0 |
854 | if(warn_count < 1000) |
872 | if(warn_count < 100) |
855 | { |
873 | { |
856 | printf("left %d top %d right %d bottom %d\n", |
874 | printf("left %d top %d right %d bottom %d\n", |
857 | ml, mt, mr, mb); |
875 | ml, mt, mr, mb); |
858 | warn_count++; |
876 | warn_count++; |
859 | }; |
877 | }; |
Line 999... | Line 1017... | ||
999 | 1017 | ||
Line 1000... | Line -... | ||
1000 | - | ||
1001 | - | ||
1002 | - | ||
1003 | - | ||
1004 | - | ||
1005 | - | ||
1006 | - | ||
1007 | 1018 | ||
Line 1008... | Line 1019... | ||
1008 | 1019 | ||
1009 | 1020 | ||
1010 | #define NSEC_PER_SEC 1000000000L |
1021 | #define NSEC_PER_SEC 1000000000L |
Line 1011... | Line 1022... | ||
1011 | 1022 | ||
1012 | void getrawmonotonic(struct timespec *ts) |
1023 | void getrawmonotonic(struct timespec *ts) |
1013 | { |
1024 | { |
Line 1014... | Line -... | ||
1014 | u32 tmp = GetTimerTicks(); |
- | |
1015 | - | ||
1016 | ts->tv_sec = tmp/100; |
- | |
1017 | ts->tv_nsec = (tmp - ts->tv_sec*100)*10000000; |
- | |
1018 | } |
- | |
1019 | - | ||
1020 | void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec) |
- | |
1021 | { |
- | |
1022 | while (nsec >= NSEC_PER_SEC) { |
- | |
1023 | /* |
- | |
1024 | * The following asm() prevents the compiler from |
- | |
1025 | * optimising this loop into a modulo operation. See |
- | |
1026 | * also __iter_div_u64_rem() in include/linux/time.h |
- | |
1027 | */ |
- | |
1028 | asm("" : "+rm"(nsec)); |
- | |
1029 | nsec -= NSEC_PER_SEC; |
- | |
1030 | ++sec; |
- | |
1031 | } |
- | |
1032 | while (nsec < 0) { |
- | |
1033 | asm("" : "+rm"(nsec)); |
- | |
1034 | nsec += NSEC_PER_SEC; |
- | |
1035 | --sec; |
- | |
1036 | } |
1025 | u32 tmp = GetTimerTicks(); |
1037 | ts->tv_sec = sec; |
1026 | |
1038 | ts->tv_nsec = nsec; |
1027 | ts->tv_sec = tmp/100; |
Line 1039... | Line 1028... | ||
1039 | } |
1028 | ts->tv_nsec = (tmp - ts->tv_sec*100)*10000000; |
1040 | 1029 | } |