Rev 4570 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4570 | Rev 5078 | ||
---|---|---|---|
Line 29... | Line 29... | ||
29 | struct drm_device *main_device; |
29 | struct drm_device *main_device; |
30 | struct drm_file *drm_file_handlers[256]; |
30 | struct drm_file *drm_file_handlers[256]; |
Line 31... | Line 31... | ||
31 | 31 | ||
32 | int vmw_init(void); |
32 | int vmw_init(void); |
- | 33 | int kms_init(struct drm_device *dev); |
|
33 | int kms_init(struct drm_device *dev); |
34 | void vmw_driver_thread(); |
34 | void kms_update(); |
- | |
35 | 35 | void kms_update(); |
|
Line 36... | Line 36... | ||
36 | void cpu_detect(); |
36 | void cpu_detect(); |
37 | 37 | ||
Line 38... | Line -... | ||
38 | void parse_cmdline(char *cmdline, char *log); |
- | |
39 | int _stdcall display_handler(ioctl_t *io); |
- | |
40 | - | ||
41 | int srv_blit_bitmap(u32 hbitmap, int dst_x, int dst_y, |
- | |
42 | int src_x, int src_y, u32 w, u32 h); |
- | |
43 | - | ||
44 | int blit_textured(u32 hbitmap, int dst_x, int dst_y, |
- | |
45 | int src_x, int src_y, u32 w, u32 h); |
- | |
Line 46... | Line 38... | ||
46 | 38 | void parse_cmdline(char *cmdline, char *log); |
|
47 | int blit_tex(u32 hbitmap, int dst_x, int dst_y, |
39 | int _stdcall display_handler(ioctl_t *io); |
Line 48... | Line 40... | ||
48 | int src_x, int src_y, u32 w, u32 h); |
40 | |
Line 62... | Line 54... | ||
62 | int x86_clflush_size; |
54 | int x86_clflush_size; |
63 | unsigned int tsc_khz; |
55 | unsigned int tsc_khz; |
Line 64... | Line 56... | ||
64 | 56 | ||
Line 65... | Line -... | ||
65 | int kms_modeset = 1; |
- | |
66 | - | ||
67 | - | ||
68 | void vmw_driver_thread() |
- | |
69 | { |
- | |
70 | dbgprintf("%s\n",__FUNCTION__); |
- | |
71 | - | ||
72 | // run_workqueue(dev_priv->wq); |
- | |
73 | - | ||
74 | while(driver_wq_state) |
- | |
75 | { |
- | |
76 | kms_update(); |
- | |
77 | delay(1); |
- | |
78 | }; |
- | |
79 | __asm__ __volatile__ ( |
- | |
80 | "int $0x40" |
- | |
81 | ::"a"(-1)); |
- | |
82 | } |
57 | int kms_modeset = 1; |
83 | 58 | ||
Line 84... | Line 59... | ||
84 | u32_t __attribute__((externally_visible)) drvEntry(int action, char *cmdline) |
59 | u32_t __attribute__((externally_visible)) drvEntry(int action, char *cmdline) |
Line 201... | Line 176... | ||
201 | *outp = DISPLAY_VERSION; |
176 | *outp = DISPLAY_VERSION; |
202 | retval = 0; |
177 | retval = 0; |
203 | break; |
178 | break; |
Line 204... | Line 179... | ||
204 | 179 | ||
205 | case SRV_ENUM_MODES: |
180 | case SRV_ENUM_MODES: |
206 | dbgprintf("SRV_ENUM_MODES inp %x inp_size %x out_size %x\n", |
181 | // dbgprintf("SRV_ENUM_MODES inp %x inp_size %x out_size %x\n", |
207 | inp, io->inp_size, io->out_size ); |
182 | // inp, io->inp_size, io->out_size ); |
208 | check_output(4); |
183 | // check_output(4); |
209 | // check_input(*outp * sizeof(videomode_t)); |
184 | // check_input(*outp * sizeof(videomode_t)); |
210 | if( kms_modeset) |
185 | if( kms_modeset) |
211 | retval = get_videomodes((videomode_t*)inp, outp); |
186 | retval = get_videomodes((videomode_t*)inp, outp); |
Line 212... | Line 187... | ||
212 | break; |
187 | break; |
213 | 188 | ||
214 | case SRV_SET_MODE: |
189 | case SRV_SET_MODE: |
215 | dbgprintf("SRV_SET_MODE inp %x inp_size %x\n", |
190 | // dbgprintf("SRV_SET_MODE inp %x inp_size %x\n", |
216 | inp, io->inp_size); |
191 | // inp, io->inp_size); |
217 | check_input(sizeof(videomode_t)); |
192 | // check_input(sizeof(videomode_t)); |
218 | if( kms_modeset ) |
193 | if( kms_modeset ) |
Line 219... | Line 194... | ||
219 | retval = set_user_mode((videomode_t*)inp); |
194 | retval = set_user_mode((videomode_t*)inp); |
Line 828... | Line 803... | ||
828 | uint32_t *data; |
803 | uint32_t *data; |
829 | uint32_t hot_x; |
804 | uint32_t hot_x; |
830 | uint32_t hot_y; |
805 | uint32_t hot_y; |
Line 831... | Line 806... | ||
831 | 806 | ||
- | 807 | struct list_head list; |
|
832 | struct list_head list; |
808 | void *priv; |
Line 833... | Line 809... | ||
833 | }cursor_t; |
809 | }cursor_t; |
834 | 810 | ||
Line 863... | Line 839... | ||
863 | u32 mask_seqno; |
839 | u32 mask_seqno; |
864 | u32 check_mouse; |
840 | u32 check_mouse; |
865 | u32 check_m_pixel; |
841 | u32 check_m_pixel; |
866 | }; |
842 | }; |
Line 867... | Line -... | ||
867 | - | ||
868 | 843 | ||
Line 869... | Line 844... | ||
869 | static display_t *os_display; |
844 | display_t *os_display; |
870 | 845 | ||
871 | static int count_connector_modes(struct drm_connector* connector) |
846 | static int count_connector_modes(struct drm_connector* connector) |
872 | { |
847 | { |
Line 887... | Line 862... | ||
887 | { |
862 | { |
888 | struct drm_crtc *crtc = os_display->crtc; |
863 | struct drm_crtc *crtc = os_display->crtc; |
889 | struct vmw_private *dev_priv = vmw_priv(crtc->dev); |
864 | struct vmw_private *dev_priv = vmw_priv(crtc->dev); |
890 | struct vmw_display_unit *du = vmw_crtc_to_du(crtc); |
865 | struct vmw_display_unit *du = vmw_crtc_to_du(crtc); |
Line -... | Line 866... | ||
- | 866 | ||
- | 867 | du->cursor_x = x; |
|
891 | 868 | du->cursor_y = y; |
|
892 | vmw_cursor_update_position(dev_priv, true, x,y); |
869 | vmw_cursor_update_position(dev_priv, true, x,y); |
Line 893... | Line 870... | ||
893 | }; |
870 | }; |
894 | 871 | ||
895 | static cursor_t* __stdcall select_cursor_kms(cursor_t *cursor) |
872 | static cursor_t* __stdcall select_cursor_kms(cursor_t *cursor) |
- | 873 | { |
|
896 | { |
874 | struct vmw_private *dev_priv = vmw_priv(os_display->ddev); |
Line 897... | Line 875... | ||
897 | struct vmw_private *dev_priv = vmw_priv(os_display->ddev); |
875 | struct vmw_display_unit *du = vmw_crtc_to_du(os_display->crtc); |
898 | cursor_t *old; |
876 | cursor_t *old; |
Line 899... | Line 877... | ||
899 | 877 | ||
900 | old = os_display->cursor; |
878 | old = os_display->cursor; |
901 | os_display->cursor = cursor; |
- | |
902 | 879 | os_display->cursor = cursor; |
|
903 | vmw_cursor_update_image(dev_priv, cursor->data, |
- | |
904 | 64, 64, cursor->hot_x, cursor->hot_y); |
880 | |
905 | - | ||
906 | // vmw_cursor_update_position(dev_priv, true, |
881 | vmw_cursor_update_image(dev_priv, cursor->data, |
907 | // du->cursor_x + du->hotspot_x, |
882 | 64, 64, cursor->hot_x, cursor->hot_y); |
Line -... | Line 883... | ||
- | 883 | vmw_cursor_update_position(dev_priv, true, |
|
- | 884 | du->cursor_x, du->cursor_y); |
|
- | 885 | return old; |
|
- | 886 | }; |
|
- | 887 | ||
- | 888 | void vmw_driver_thread() |
|
- | 889 | { |
|
- | 890 | DRM_DEBUG_KMS("%s\n",__FUNCTION__); |
|
- | 891 | ||
- | 892 | select_cursor_kms(os_display->cursor); |
|
- | 893 | ||
- | 894 | while(driver_wq_state) |
|
- | 895 | { |
|
- | 896 | kms_update(); |
|
- | 897 | delay(2); |
|
Line 908... | Line 898... | ||
908 | // du->cursor_y + du->hotspot_y); |
898 | }; |
909 | 899 | __asm__ __volatile__ ( |
|
910 | return old; |
900 | "int $0x40" |
911 | }; |
- | |
912 | 901 | ::"a"(-1)); |
|
913 | 902 | } |
|
914 | int kms_init(struct drm_device *dev) |
903 | |
915 | { |
- | |
916 | struct drm_connector *connector; |
904 | int kms_init(struct drm_device *dev) |
917 | struct drm_connector_helper_funcs *connector_funcs; |
905 | { |
918 | struct drm_encoder *encoder; |
906 | struct drm_connector *connector; |
919 | struct drm_crtc *crtc = NULL; |
907 | struct drm_encoder *encoder; |
Line 920... | Line -... | ||
920 | struct drm_framebuffer *fb; |
- | |
921 | - | ||
922 | cursor_t *cursor; |
908 | struct drm_crtc *crtc = NULL; |
923 | int mode_count; |
909 | struct vmw_display_unit *du; |
924 | u32_t ifl; |
910 | cursor_t *cursor; |
925 | int err; |
911 | int mode_count; |
Line 942... | Line 928... | ||
942 | 928 | ||
943 | list_for_each_entry(mode, &connector->modes, head) |
929 | list_for_each_entry(mode, &connector->modes, head) |
944 | mode_count++; |
930 | mode_count++; |
Line 945... | Line -... | ||
945 | }; |
- | |
946 | - | ||
947 | printf("%s %d\n",__FUNCTION__, mode_count); |
931 | }; |
948 | 932 | ||
949 | DRM_DEBUG_KMS("CONNECTOR %x ID:%d status:%d ENCODER %x CRTC %x ID:%d\n", |
933 | DRM_DEBUG_KMS("CONNECTOR %x ID:%d status:%d ENCODER %x CRTC %x ID:%d\n", |
950 | connector, connector->base.id, |
934 | connector, connector->base.id, |
Line 951... | Line -... | ||
951 | connector->status, connector->encoder, |
- | |
952 | crtc, crtc->base.id ); |
- | |
953 | 935 | connector->status, connector->encoder, |
|
Line 954... | Line -... | ||
954 | DRM_DEBUG_KMS("[Select CRTC:%d]\n", crtc->base.id); |
- | |
955 | - | ||
956 | os_display = GetDisplay(); |
936 | crtc, crtc->base.id ); |
957 | 937 | ||
958 | ifl = safe_cli(); |
938 | os_display = GetDisplay(); |
959 | { |
939 | |
Line -... | Line 940... | ||
- | 940 | os_display->ddev = dev; |
|
- | 941 | os_display->connector = connector; |
|
960 | os_display->ddev = dev; |
942 | os_display->crtc = crtc; |
961 | os_display->connector = connector; |
943 | os_display->supported_modes = mode_count; |
962 | os_display->crtc = crtc; |
944 | |
963 | os_display->supported_modes = mode_count; |
945 | ifl = safe_cli(); |
964 | 946 | { |
|
965 | os_display->restore_cursor(0,0); |
947 | os_display->restore_cursor(0,0); |
966 | os_display->select_cursor = select_cursor_kms; |
- | |
967 | os_display->show_cursor = NULL; |
948 | os_display->select_cursor = select_cursor_kms; |
968 | os_display->move_cursor = move_cursor_kms; |
949 | os_display->show_cursor = NULL; |
Line 969... | Line 950... | ||
969 | os_display->restore_cursor = restore_cursor; |
950 | os_display->move_cursor = move_cursor_kms; |
970 | os_display->disable_mouse = disable_mouse; |
951 | os_display->restore_cursor = restore_cursor; |
971 | select_cursor_kms(os_display->cursor); |
952 | os_display->disable_mouse = disable_mouse; |
972 | }; |
- | |
973 | safe_sti(ifl); |
953 | }; |
Line 974... | Line 954... | ||
974 | 954 | safe_sti(ifl); |
|
975 | #ifdef __HWA__ |
955 | |
Line 976... | Line 956... | ||
976 | err = init_bitmaps(); |
956 | du = vmw_crtc_to_du(os_display->crtc); |
977 | #endif |
957 | du->cursor_x = os_display->width/2; |
978 | 958 | du->cursor_y = os_display->height/2; |
|
979 | LEAVE(); |
959 | select_cursor_kms(os_display->cursor); |
- | 960 | ||
980 | 961 | return 0; |
|
Line 981... | Line 962... | ||
981 | return 0; |
962 | }; |
982 | }; |
963 | |
983 | 964 | ||
Line 1002... | Line 983... | ||
1002 | } |
983 | } |
Line 1003... | Line 984... | ||
1003 | 984 | ||
1004 | cmd->header = cpu_to_le32(SVGA_CMD_UPDATE); |
985 | cmd->header = cpu_to_le32(SVGA_CMD_UPDATE); |
1005 | cmd->body.x = 0; |
986 | cmd->body.x = 0; |
1006 | cmd->body.y = 0; |
987 | cmd->body.y = 0; |
1007 | cmd->body.width = os_display->width; //cpu_to_le32(clips->x2 - clips->x1); |
988 | cmd->body.width = os_display->width; |
Line 1008... | Line 989... | ||
1008 | cmd->body.height = os_display->height; //cpu_to_le32(clips->y2 - clips->y1); |
989 | cmd->body.height = os_display->height; |
1009 | 990 | ||
Line 1010... | Line 991... | ||
1010 | vmw_fifo_commit(dev_priv, fifo_size); |
991 | vmw_fifo_commit(dev_priv, fifo_size); |
1011 | } |
992 | } |
- | 993 | ||
1012 | 994 | int get_videomodes(videomode_t *mode, int *count) |
|
Line 1013... | Line -... | ||
1013 | int get_videomodes(videomode_t *mode, int *count) |
- | |
1014 | { |
- | |
1015 | int err = -1; |
995 | { |
1016 | 996 | struct drm_display_mode *drmmode; |
|
1017 | dbgprintf("mode %x count %d\n", mode, *count); |
997 | int err = -1; |
1018 | 998 | ||
1019 | if( *count == 0 ) |
999 | if( *count == 0 ) |
1020 | { |
1000 | { |
1021 | *count = os_display->supported_modes; |
1001 | *count = os_display->supported_modes; |
1022 | err = 0; |
- | |
1023 | } |
1002 | err = 0; |
Line 1024... | Line 1003... | ||
1024 | else if( mode != NULL ) |
1003 | } |
1025 | { |
1004 | else if( mode != NULL ) |
Line 1034... | Line 1013... | ||
1034 | if( i < *count) |
1013 | if( i < *count) |
1035 | { |
1014 | { |
1036 | mode->width = drm_mode_width(drmmode); |
1015 | mode->width = drm_mode_width(drmmode); |
1037 | mode->height = drm_mode_height(drmmode); |
1016 | mode->height = drm_mode_height(drmmode); |
1038 | mode->bpp = 32; |
1017 | mode->bpp = 32; |
1039 | mode->freq = drm_mode_vrefresh(drmmode); |
1018 | mode->freq = drmmode->vrefresh; |
1040 | i++; |
1019 | i++; |
1041 | mode++; |
1020 | mode++; |
1042 | } |
1021 | } |
1043 | else break; |
1022 | else break; |
1044 | }; |
1023 | }; |
- | 1024 | ||
1045 | *count = i; |
1025 | *count = i; |
1046 | err = 0; |
1026 | err = 0; |
1047 | }; |
1027 | }; |
- | 1028 | ||
1048 | return err; |
1029 | return err; |
1049 | }; |
1030 | }; |
Line 1050... | Line 1031... | ||
1050 | 1031 |