Rev 3482 | Rev 4126 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3482 | Rev 4104 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | #include |
15 | #include |
Line 16... | Line 16... | ||
16 | 16 | ||
Line 17... | Line -... | ||
17 | #include "bitmap.h" |
- | |
18 | - | ||
19 | extern struct drm_device *main_device; |
- | |
20 | 17 | #include "bitmap.h" |
|
21 | 18 | ||
22 | typedef struct |
19 | typedef struct |
Line 23... | Line 20... | ||
23 | { |
20 | { |
Line 145... | Line 142... | ||
145 | return -1; |
142 | return -1; |
Line 146... | Line 143... | ||
146 | 143 | ||
Line 147... | Line -... | ||
147 | do_set: |
- | |
148 | 144 | do_set: |
|
149 | 145 | ||
Line 150... | Line 146... | ||
150 | encoder = connector->encoder; |
146 | encoder = connector->encoder; |
151 | crtc = encoder->crtc; |
147 | crtc = encoder->crtc; |
Line 363... | Line 359... | ||
363 | select_cursor_kms(os_display->cursor); |
359 | select_cursor_kms(os_display->cursor); |
364 | }; |
360 | }; |
365 | safe_sti(ifl); |
361 | safe_sti(ifl); |
Line 366... | Line -... | ||
366 | - | ||
367 | main_device = dev; |
- | |
368 | 362 | ||
369 | #ifdef __HWA__ |
363 | #ifdef __HWA__ |
370 | err = init_bitmaps(); |
364 | err = init_bitmaps(); |
Line 371... | Line 365... | ||
371 | #endif |
365 | #endif |
Line 469... | Line 463... | ||
469 | obj = i915_gem_alloc_object(os_display->ddev, CURSOR_WIDTH*CURSOR_HEIGHT*4); |
463 | obj = i915_gem_alloc_object(os_display->ddev, CURSOR_WIDTH*CURSOR_HEIGHT*4); |
470 | if (unlikely(obj == NULL)) |
464 | if (unlikely(obj == NULL)) |
471 | return -ENOMEM; |
465 | return -ENOMEM; |
472 | 466 | ||
Line 473... | Line 467... | ||
473 | ret = i915_gem_object_pin(obj, CURSOR_WIDTH*CURSOR_HEIGHT*4, true, true); |
467 | ret = i915_gem_obj_ggtt_pin(obj, CURSOR_WIDTH*CURSOR_HEIGHT*4, true, true); |
474 | if (ret) { |
468 | if (ret) { |
475 | drm_gem_object_unreference(&obj->base); |
469 | drm_gem_object_unreference(&obj->base); |
476 | return ret; |
470 | return ret; |
477 | } |
471 | } |
Line -... | Line 472... | ||
- | 472 | ||
- | 473 | ret = i915_gem_object_set_to_gtt_domain(obj, true); |
|
- | 474 | if (ret) |
|
- | 475 | { |
|
- | 476 | i915_gem_object_unpin(obj); |
|
- | 477 | drm_gem_object_unreference(&obj->base); |
|
- | 478 | return ret; |
|
478 | 479 | } |
|
479 | /* You don't need to worry about fragmentation issues. |
480 | /* You don't need to worry about fragmentation issues. |
Line 480... | Line 481... | ||
480 | * GTT space is continuous. I guarantee it. */ |
481 | * GTT space is continuous. I guarantee it. */ |
481 | 482 | ||
Line 482... | Line 483... | ||
482 | mapped = bits = (u32*)MapIoMem(dev_priv->gtt.mappable_base + obj->gtt_offset, |
483 | mapped = bits = (u32*)MapIoMem(dev_priv->gtt.mappable_base + i915_gem_obj_ggtt_offset(obj), |
483 | CURSOR_WIDTH*CURSOR_HEIGHT*4, PG_SW); |
484 | CURSOR_WIDTH*CURSOR_HEIGHT*4, PG_SW); |
484 | 485 | ||
Line 610... | Line 611... | ||
610 | old = os_display->cursor; |
611 | old = os_display->cursor; |
611 | os_display->cursor = cursor; |
612 | os_display->cursor = cursor; |
Line 612... | Line 613... | ||
612 | 613 | ||
613 | if (!dev_priv->info->cursor_needs_physical) |
614 | if (!dev_priv->info->cursor_needs_physical) |
614 | intel_crtc->cursor_addr = cursor->cobj->gtt_offset; |
615 | intel_crtc->cursor_addr = i915_gem_obj_ggtt_offset(cursor->cobj); |
615 | else |
616 | else |
Line 616... | Line 617... | ||
616 | intel_crtc->cursor_addr = (addr_t)cursor->cobj; |
617 | intel_crtc->cursor_addr = (addr_t)cursor->cobj; |
617 | 618 | ||
Line 853... | Line 854... | ||
853 | ts->tv_sec = tmp/100; |
854 | ts->tv_sec = tmp/100; |
854 | ts->tv_nsec = (tmp - ts->tv_sec*100)*10000000; |
855 | ts->tv_nsec = (tmp - ts->tv_sec*100)*10000000; |
855 | } |
856 | } |
Line 856... | Line 857... | ||
856 | 857 | ||
857 | void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec) |
858 | void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec) |
858 | { |
859 | { |
- | 860 | while (nsec >= NSEC_PER_SEC) { |
|
- | 861 | /* |
|
- | 862 | * The following asm() prevents the compiler from |
|
- | 863 | * optimising this loop into a modulo operation. See |
|
- | 864 | * also __iter_div_u64_rem() in include/linux/time.h |
|
- | 865 | */ |
|
859 | while (nsec >= NSEC_PER_SEC) { |
866 | asm("" : "+rm"(nsec)); |
860 | nsec -= NSEC_PER_SEC; |
867 | nsec -= NSEC_PER_SEC; |
861 | ++sec; |
868 | ++sec; |
862 | } |
869 | } |
- | 870 | while (nsec < 0) { |
|
863 | while (nsec < 0) { |
871 | asm("" : "+rm"(nsec)); |
864 | nsec += NSEC_PER_SEC; |
872 | nsec += NSEC_PER_SEC; |
865 | --sec; |
873 | --sec; |
866 | } |
874 | } |
867 | ts->tv_sec = sec; |
875 | ts->tv_sec = sec; |
868 | ts->tv_nsec = nsec; |
876 | ts->tv_nsec = nsec; |
Line 869... | Line -... | ||
869 | } |
- | |
870 | 877 | } |
|
871 | 878 | ||
872 | void |
879 | void |
873 | prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state) |
880 | prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state) |