Rev 2344 | Rev 2352 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2344 | Rev 2351 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | #include |
15 | #include |
Line 16... | Line 16... | ||
16 | 16 | ||
Line -... | Line 17... | ||
- | 17 | #include "bitmap.h" |
|
- | 18 | ||
Line 17... | Line 19... | ||
17 | #include "bitmap.h" |
19 | extern struct drm_device *main_device; |
18 | 20 | ||
19 | 21 | ||
Line 65... | Line 67... | ||
65 | 67 | ||
Line 66... | Line 68... | ||
66 | u32_t cmd_buffer; |
68 | u32_t cmd_buffer; |
67 | u32_t cmd_offset; |
69 | u32_t cmd_offset; |
Line -... | Line 70... | ||
- | 70 | ||
- | 71 | void init_render(); |
|
- | 72 | int sna_init(); |
|
68 | 73 | ||
69 | int init_cursor(cursor_t *cursor); |
74 | int init_cursor(cursor_t *cursor); |
70 | static cursor_t* __stdcall select_cursor_kms(cursor_t *cursor); |
75 | static cursor_t* __stdcall select_cursor_kms(cursor_t *cursor); |
Line 71... | Line 76... | ||
71 | static void __stdcall move_cursor_kms(cursor_t *cursor, int x, int y); |
76 | static void __stdcall move_cursor_kms(cursor_t *cursor, int x, int y); |
Line 208... | Line 213... | ||
208 | cmd_offset = obj->gtt_offset; |
213 | cmd_offset = obj->gtt_offset; |
209 | }; |
214 | }; |
210 | #endif |
215 | #endif |
211 | 216 | ||
Line -... | Line 217... | ||
- | 217 | main_device = dev; |
|
- | 218 | ||
212 | int err; |
219 | int err; |
Line 213... | Line 220... | ||
213 | 220 | ||
214 | err = init_bitmaps(); |
221 | err = init_bitmaps(); |
215 | if( !err ) |
222 | if( !err ) |
216 | { |
223 | { |
217 | printf("Initialize bitmap manager\n"); |
224 | printf("Initialize bitmap manager\n"); |
Line -... | Line 225... | ||
- | 225 | }; |
|
- | 226 | ||
218 | }; |
227 | sna_init(); |
Line 219... | Line 228... | ||
219 | 228 | ||
220 | LEAVE(); |
229 | LEAVE(); |
Line 575... | Line 584... | ||
575 | move_cursor_kms(cursor, intel_crtc->cursor_x, intel_crtc->cursor_y); |
584 | move_cursor_kms(cursor, intel_crtc->cursor_x, intel_crtc->cursor_y); |
576 | return old; |
585 | return old; |
577 | }; |
586 | }; |
Line 578... | Line -... | ||
578 | - | ||
Line 579... | Line 587... | ||
579 | extern struct drm_device *main_device; |
587 | |
Line 580... | Line 588... | ||
580 | 588 | ||
Line 746... | Line 754... | ||
746 | }; |
754 | }; |
747 | #else |
755 | #else |
748 | u8* src_offset; |
756 | u8* src_offset; |
749 | u8* dst_offset; |
757 | u8* dst_offset; |
750 | 758 | u32 ifl; |
|
- | 759 | ||
Line 751... | Line 760... | ||
751 | src_offset = (u8*)(src_y*bitmap->pitch + src_x*4); |
760 | src_offset = (u8*)(src_y*bitmap->pitch + src_x*4); |
752 | src_offset += (u32)bitmap->uaddr; |
761 | src_offset += (u32)bitmap->uaddr; |
Line 753... | Line 762... | ||
753 | 762 | ||
754 | dst_offset = (u8*)(dst_y*os_display->width + dst_x); |
763 | dst_offset = (u8*)(dst_y*os_display->width + dst_x); |
Line 755... | Line 764... | ||
755 | dst_offset+= get_display_map(); |
764 | dst_offset+= get_display_map(); |
Line -... | Line 765... | ||
- | 765 | ||
756 | 766 | u32_t tmp_h = height; |
|
757 | u32_t tmp_h = height; |
767 | |
758 | 768 | ifl = safe_cli(); |
|
Line 759... | Line 769... | ||
759 | while( tmp_h--) |
769 | while( tmp_h--) |
Line 772... | Line 782... | ||
772 | tmp_src+=4; |
782 | tmp_src+=4; |
773 | tmp_dst++; |
783 | tmp_dst++; |
774 | }; |
784 | }; |
775 | }; |
785 | }; |
776 | } |
786 | safe_sti(ifl); |
- | 787 | } |
|
777 | #endif |
788 | #endif |
778 | 789 | ||
Line 779... | Line 790... | ||
779 | if((cmd_buffer & 0xFC0)==0xFC0) |
790 | if((cmd_buffer & 0xFC0)==0xFC0) |
780 | cmd_buffer&= 0xFFFFF000; |
791 | cmd_buffer&= 0xFFFFF000; |
Line 808... | Line 819... | ||
808 | 819 | ||
Line 809... | Line 820... | ||
809 | i915_gem_object_set_to_gtt_domain(bitmap->obj, false); |
820 | i915_gem_object_set_to_gtt_domain(bitmap->obj, false); |
Line 810... | Line 821... | ||
810 | 821 | ||
811 | if (HAS_BLT(main_device)) |
- | |
812 | ring = &dev_priv->ring[BCS]; |
822 | if (HAS_BLT(main_device)) |
813 | else |
823 | { |
Line -... | Line 824... | ||
- | 824 | int ret; |
|
814 | ring = &dev_priv->ring[RCS]; |
825 | |
Line 815... | Line -... | ||
815 | - | ||
816 | ring->dispatch_execbuffer(ring, cmd_offset, n*4); |
- | |
817 | 826 | ring = &dev_priv->ring[BCS]; |
|
818 | int ret; |
827 | ring->dispatch_execbuffer(ring, cmd_offset, n*4); |
819 | 828 | ||
Line 820... | Line 829... | ||
820 | ret = intel_ring_begin(ring, 4); |
829 | ret = intel_ring_begin(ring, 4); |
821 | if (ret) |
830 | if (ret) |
822 | return ret; |
831 | return ret; |
823 | 832 | ||
824 | intel_ring_emit(ring, MI_FLUSH_DW); |
833 | intel_ring_emit(ring, MI_FLUSH_DW); |
- | 834 | intel_ring_emit(ring, 0); |
|
- | 835 | intel_ring_emit(ring, 0); |
|
- | 836 | intel_ring_emit(ring, MI_NOOP); |
|
- | 837 | intel_ring_advance(ring); |
|
- | 838 | } |
|
- | 839 | else |
|
- | 840 | { |
|
- | 841 | ring = &dev_priv->ring[RCS]; |
|
- | 842 | ring->dispatch_execbuffer(ring, cmd_offset, n*4); |
|
- | 843 | ring->flush(ring, 0, I915_GEM_DOMAIN_RENDER); |
|
Line 825... | Line 844... | ||
825 | intel_ring_emit(ring, 0); |
844 | }; |
826 | intel_ring_emit(ring, 0); |
845 | |
827 | intel_ring_emit(ring, MI_NOOP); |
846 | bitmap->obj->base.read_domains = I915_GEM_DOMAIN_CPU; |
828 | intel_ring_advance(ring); |
847 | bitmap->obj->base.write_domain = I915_GEM_DOMAIN_CPU; |
- | 848 | ||
- | 849 | return 0; |
|
- | 850 | fail: |
|
- | 851 | return -1; |
|
- | 852 | }; |
|
- | 853 | ||
- | 854 | ||
- | 855 | /* For display hotplug interrupt */ |
|
- | 856 | static void |
|
- | 857 | ironlake_enable_display_irq(drm_i915_private_t *dev_priv, u32 mask) |
|
- | 858 | { |
|
- | 859 | if ((dev_priv->irq_mask & mask) != 0) { |
|
- | 860 | dev_priv->irq_mask &= ~mask; |
|
- | 861 | I915_WRITE(DEIMR, dev_priv->irq_mask); |
|
- | 862 | POSTING_READ(DEIMR); |
|
- | 863 | } |
|
- | 864 | } |
|
- | 865 | ||
- | 866 | static int ironlake_enable_vblank(struct drm_device *dev, int pipe) |
|
- | 867 | { |
|
- | 868 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
|
- | 869 | unsigned long irqflags; |
|
- | 870 | ||
- | 871 | // if (!i915_pipe_enabled(dev, pipe)) |
|
- | 872 | // return -EINVAL; |
|
- | 873 | ||
- | 874 | spin_lock_irqsave(&dev_priv->irq_lock, irqflags); |
|
- | 875 | ironlake_enable_display_irq(dev_priv, (pipe == 0) ? |
|
- | 876 | DE_PIPEA_VBLANK : DE_PIPEB_VBLANK); |
|
- | 877 | spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); |
|
- | 878 | ||
- | 879 | return 0; |
|
- | 880 | } |
|
- | 881 | ||
- | 882 | ||
- | 883 | ||
- | 884 | static int i915_interrupt_info(struct drm_device *dev) |
|
- | 885 | { |
|
- | 886 | drm_i915_private_t *dev_priv = dev->dev_private; |
|
- | 887 | int ret, i, pipe; |
|
- | 888 | ||
- | 889 | if (!HAS_PCH_SPLIT(dev)) { |
|
- | 890 | dbgprintf("Interrupt enable: %08x\n", |
|
- | 891 | I915_READ(IER)); |
|
- | 892 | dbgprintf("Interrupt identity: %08x\n", |
|
- | 893 | I915_READ(IIR)); |
|
- | 894 | dbgprintf("Interrupt mask: %08x\n", |
|
- | 895 | I915_READ(IMR)); |
|
- | 896 | for_each_pipe(pipe) |
|
- | 897 | dbgprintf("Pipe %c stat: %08x\n", |
|
- | 898 | pipe_name(pipe), |
|
- | 899 | I915_READ(PIPESTAT(pipe))); |
|
- | 900 | } else { |
|
- | 901 | dbgprintf("North Display Interrupt enable: %08x\n", |
|
- | 902 | I915_READ(DEIER)); |
|
- | 903 | dbgprintf("North Display Interrupt identity: %08x\n", |
|
- | 904 | I915_READ(DEIIR)); |
|
- | 905 | dbgprintf("North Display Interrupt mask: %08x\n", |
|
- | 906 | I915_READ(DEIMR)); |
|
- | 907 | dbgprintf("South Display Interrupt enable: %08x\n", |
|
- | 908 | I915_READ(SDEIER)); |
|
- | 909 | dbgprintf("South Display Interrupt identity: %08x\n", |
|
- | 910 | I915_READ(SDEIIR)); |
|
- | 911 | dbgprintf("South Display Interrupt mask: %08x\n", |
|
- | 912 | I915_READ(SDEIMR)); |
|
- | 913 | dbgprintf("Graphics Interrupt enable: %08x\n", |
|
- | 914 | I915_READ(GTIER)); |
|
- | 915 | dbgprintf("Graphics Interrupt identity: %08x\n", |
|
- | 916 | I915_READ(GTIIR)); |
|
- | 917 | dbgprintf("Graphics Interrupt mask: %08x\n", |
|
- | 918 | I915_READ(GTIMR)); |
|
- | 919 | } |
|
- | 920 | dbgprintf("Interrupts received: %d\n", |
|
- | 921 | atomic_read(&dev_priv->irq_received)); |
|
- | 922 | for (i = 0; i < I915_NUM_RINGS; i++) { |
|
- | 923 | if (IS_GEN6(dev) || IS_GEN7(dev)) { |
|
- | 924 | printf("Graphics Interrupt mask (%s): %08x\n", |
|
- | 925 | dev_priv->ring[i].name, |
|
- | 926 | I915_READ_IMR(&dev_priv->ring[i])); |
|
- | 927 | } |
|
- | 928 | // i915_ring_seqno_info(m, &dev_priv->ring[i]); |
|
- | 929 | } |
|
- | 930 | ||
- | 931 | return 0; |
|
- | 932 | } |
|
- | 933 | ||
- | 934 | void execute_buffer (struct drm_i915_gem_object *buffer, uint32_t offset, |
|
- | 935 | int size) |
|
- | 936 | { |
|
- | 937 | struct intel_ring_buffer *ring; |
|
- | 938 | drm_i915_private_t *dev_priv = main_device->dev_private; |
|
- | 939 | u32 invalidate; |
|
- | 940 | u32 seqno = 2; |
|
- | 941 | ||
- | 942 | offset += buffer->gtt_offset; |
|
- | 943 | // dbgprintf("execute %x size %d\n", offset, size); |
|
- | 944 | ||
- | 945 | // asm volatile( |
|
- | 946 | // "mfence \n" |
|
- | 947 | // "wbinvd \n" |
|
- | 948 | // "mfence \n" |
|
- | 949 | // :::"memory"); |
|
- | 950 | ||
- | 951 | ring = &dev_priv->ring[RCS]; |
|
- | 952 | ring->dispatch_execbuffer(ring, offset, size); |
|
- | 953 | ||
- | 954 | invalidate = I915_GEM_DOMAIN_COMMAND; |
|
- | 955 | if (INTEL_INFO(main_device)->gen >= 4) |
|
- | 956 | invalidate |= I915_GEM_DOMAIN_SAMPLER; |
|
- | 957 | if (ring->flush(ring, invalidate, 0)) |
|
- | 958 | i915_gem_next_request_seqno(ring); |
|
- | 959 | ||
- | 960 | ring->irq_get(ring); |
|
- | 961 | ||
- | 962 | ring->add_request(ring, &seqno); |
|
- | 963 | ||
- | 964 | // i915_interrupt_info(main_device); |
|
- | 965 | ||
- | 966 | // ironlake_enable_vblank(main_device, 0); |
|
- | 967 | }; |
|
- | 968 | ||
- | 969 | ||
- | 970 | int blit_textured(u32 hbitmap, int dst_x, int dst_y, |
|
- | 971 | int src_x, int src_y, u32 w, u32 h) |
|
- | 972 | { |
|
- | 973 | drm_i915_private_t *dev_priv = main_device->dev_private; |
|
- | 974 | ||
- | 975 | bitmap_t *src_bitmap, *dst_bitmap; |
|
- | 976 | bitmap_t screen; |
|
- | 977 | ||
- | 978 | rect_t winrc; |
|
- | 979 | ||
- | 980 | // dbgprintf(" handle: %d dx %d dy %d sx %d sy %d w %d h %d\n", |
|
- | 981 | // hbitmap, dst_x, dst_y, src_x, src_y, w, h); |
|
- | 982 | ||
- | 983 | if(unlikely(hbitmap==0)) |
|
- | 984 | return -1; |
|
- | 985 | ||
- | 986 | src_bitmap = (bitmap_t*)hman_get_data(&bm_man, hbitmap); |
|
- | 987 | // dbgprintf("bitmap %x\n", src_bitmap); |
|
- | 988 | ||
- | 989 | if(unlikely(src_bitmap==NULL)) |
|
- | 990 | return -1; |
|
- | 991 | ||
- | 992 | GetWindowRect(&winrc); |
|
- | 993 | ||
- | 994 | screen.pitch = os_display->pitch; |
|
- | 995 | screen.gaddr = 0; |
|
- | 996 | screen.width = os_display->width; |
|
- | 997 | screen.height = os_display->height; |
|
- | 998 | screen.obj = (void*)-1; |
|
- | 999 | ||
- | 1000 | dst_bitmap = &screen; |
|
- | 1001 | ||
- | 1002 | dst_x+= winrc.left; |
|
- | 1003 | dst_y+= winrc.top; |
|
- | 1004 | ||
- | 1005 | i915_gem_object_set_to_gtt_domain(src_bitmap->obj, false); |
|
- | 1006 | ||
- | 1007 | sna_blit_copy(dst_bitmap, dst_x, dst_y, w, h, src_bitmap, src_x, src_y); |
|
- | 1008 |