Changeset 984a9ba in mainline for uspace/srv/hid/compositor/compositor.c
- Timestamp:
- 2018-07-05T09:34:09Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 63d46341
- Parents:
- 76f566d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/compositor/compositor.c
r76f566d r984a9ba 602 602 } 603 603 604 static void comp_window_get_event(window_t *win, cap_call_handle_t icall_handle,ipc_call_t *icall)604 static void comp_window_get_event(window_t *win, ipc_call_t *icall) 605 605 { 606 606 window_event_t *event = (window_event_t *) prodcons_consume(&win->queue); 607 607 608 cap_call_handle_t chandle;608 ipc_call_t call; 609 609 size_t len; 610 610 611 if (!async_data_read_receive(&c handle, &len)) {612 async_answer_0(icall _handle, EINVAL);611 if (!async_data_read_receive(&call, &len)) { 612 async_answer_0(icall, EINVAL); 613 613 free(event); 614 614 return; 615 615 } 616 616 617 errno_t rc = async_data_read_finalize( chandle, event, len);617 errno_t rc = async_data_read_finalize(&call, event, len); 618 618 if (rc != EOK) { 619 async_answer_0(icall _handle, ENOMEM);619 async_answer_0(icall, ENOMEM); 620 620 free(event); 621 621 return; 622 622 } 623 623 624 async_answer_0(icall _handle, EOK);624 async_answer_0(icall, EOK); 625 625 free(event); 626 626 } 627 627 628 static void comp_window_damage(window_t *win, cap_call_handle_t icall_handle,ipc_call_t *icall)628 static void comp_window_damage(window_t *win, ipc_call_t *icall) 629 629 { 630 630 double x = IPC_GET_ARG1(*icall); … … 644 644 } 645 645 646 async_answer_0(icall _handle, EOK);647 } 648 649 static void comp_window_grab(window_t *win, cap_call_handle_t icall_handle,ipc_call_t *icall)646 async_answer_0(icall, EOK); 647 } 648 649 static void comp_window_grab(window_t *win, ipc_call_t *icall) 650 650 { 651 651 sysarg_t pos_id = IPC_GET_ARG1(*icall); … … 674 674 } 675 675 676 async_answer_0(icall _handle, EOK);676 async_answer_0(icall, EOK); 677 677 } 678 678 … … 706 706 } 707 707 708 static void comp_window_resize(window_t *win, cap_call_handle_t icall_handle,ipc_call_t *icall)709 { 710 cap_call_handle_t chandle;708 static void comp_window_resize(window_t *win, ipc_call_t *icall) 709 { 710 ipc_call_t call; 711 711 size_t size; 712 712 unsigned int flags; 713 713 714 714 /* Start sharing resized window with client. */ 715 if (!async_share_out_receive(&c handle, &size, &flags)) {716 async_answer_0(icall _handle, EINVAL);715 if (!async_share_out_receive(&call, &size, &flags)) { 716 async_answer_0(icall, EINVAL); 717 717 return; 718 718 } 719 719 720 720 void *new_cell_storage; 721 errno_t rc = async_share_out_finalize( chandle, &new_cell_storage);721 errno_t rc = async_share_out_finalize(&call, &new_cell_storage); 722 722 if ((rc != EOK) || (new_cell_storage == AS_MAP_FAILED)) { 723 async_answer_0(icall _handle, ENOMEM);723 async_answer_0(icall, ENOMEM); 724 724 return; 725 725 } … … 730 730 if (!new_surface) { 731 731 as_area_destroy(new_cell_storage); 732 async_answer_0(icall _handle, ENOMEM);732 async_answer_0(icall, ENOMEM); 733 733 return; 734 734 } … … 817 817 comp_damage(x, y, width, height); 818 818 819 async_answer_0(icall _handle, EOK);819 async_answer_0(icall, EOK); 820 820 } 821 821 … … 849 849 } 850 850 851 static void comp_window_close(window_t *win, cap_call_handle_t icall_handle,ipc_call_t *icall)851 static void comp_window_close(window_t *win, ipc_call_t *icall) 852 852 { 853 853 /* Stop managing the window. */ … … 891 891 892 892 comp_damage(x, y, width, height); 893 async_answer_0(icall _handle, EOK);894 } 895 896 static void comp_window_close_request(window_t *win, cap_call_handle_t icall_handle,ipc_call_t *icall)893 async_answer_0(icall, EOK); 894 } 895 896 static void comp_window_close_request(window_t *win, ipc_call_t *icall) 897 897 { 898 898 window_event_t *event = (window_event_t *) malloc(sizeof(window_event_t)); 899 899 if (event == NULL) { 900 async_answer_0(icall _handle, ENOMEM);900 async_answer_0(icall, ENOMEM); 901 901 return; 902 902 } … … 906 906 907 907 prodcons_produce(&win->queue, &event->link); 908 async_answer_0(icall _handle, EOK);909 } 910 911 static void client_connection( cap_call_handle_t icall_handle,ipc_call_t *icall, void *arg)908 async_answer_0(icall, EOK); 909 } 910 911 static void client_connection(ipc_call_t *icall, void *arg) 912 912 { 913 913 ipc_call_t call; 914 cap_call_handle_t chandle;915 914 service_id_t service_id = (service_id_t) IPC_GET_ARG2(*icall); 916 915 917 916 /* Allocate resources for new window and register it to the location service. */ 918 917 if (service_id == winreg_id) { 919 async_answer_0(icall _handle, EOK);920 921 chandle =async_get_call(&call);918 async_answer_0(icall, EOK); 919 920 async_get_call(&call); 922 921 if (IPC_GET_IMETHOD(call) == WINDOW_REGISTER) { 923 922 fibril_mutex_lock(&window_list_mtx); … … 925 924 window_t *win = window_create(); 926 925 if (!win) { 927 async_answer_2( chandle, ENOMEM, 0, 0);926 async_answer_2(&call, ENOMEM, 0, 0); 928 927 fibril_mutex_unlock(&window_list_mtx); 929 928 return; … … 944 943 if (loc_service_register(name_in, &win->in_dsid) != EOK) { 945 944 window_destroy(win); 946 async_answer_2( chandle, EINVAL, 0, 0);945 async_answer_2(&call, EINVAL, 0, 0); 947 946 fibril_mutex_unlock(&window_list_mtx); 948 947 return; … … 952 951 loc_service_unregister(win->in_dsid); 953 952 window_destroy(win); 954 async_answer_2( chandle, EINVAL, 0, 0);953 async_answer_2(&call, EINVAL, 0, 0); 955 954 fibril_mutex_unlock(&window_list_mtx); 956 955 return; … … 966 965 } 967 966 968 async_answer_2( chandle, EOK, win->in_dsid, win->out_dsid);967 async_answer_2(&call, EOK, win->in_dsid, win->out_dsid); 969 968 fibril_mutex_unlock(&window_list_mtx); 970 969 … … 975 974 return; 976 975 } else { 977 async_answer_0( chandle, EINVAL);976 async_answer_0(&call, EINVAL); 978 977 return; 979 978 } … … 993 992 if (win) { 994 993 atomic_inc(&win->ref_cnt); 995 async_answer_0(icall _handle, EOK);994 async_answer_0(icall, EOK); 996 995 } else { 997 async_answer_0(icall _handle, EINVAL);996 async_answer_0(icall, EINVAL); 998 997 return; 999 998 } … … 1002 1001 if (win->in_dsid == service_id) { 1003 1002 while (true) { 1004 chandle =async_get_call(&call);1003 async_get_call(&call); 1005 1004 1006 1005 if (!IPC_GET_IMETHOD(call)) { 1007 async_answer_0( chandle, EOK);1006 async_answer_0(&call, EOK); 1008 1007 atomic_dec(&win->ref_cnt); 1009 1008 window_destroy(win); … … 1013 1012 switch (IPC_GET_IMETHOD(call)) { 1014 1013 case WINDOW_GET_EVENT: 1015 comp_window_get_event(win, chandle,&call);1014 comp_window_get_event(win, &call); 1016 1015 break; 1017 1016 default: 1018 async_answer_0( chandle, EINVAL);1017 async_answer_0(&call, EINVAL); 1019 1018 } 1020 1019 } 1021 1020 } else if (win->out_dsid == service_id) { 1022 1021 while (true) { 1023 chandle =async_get_call(&call);1022 async_get_call(&call); 1024 1023 1025 1024 if (!IPC_GET_IMETHOD(call)) { 1026 comp_window_close(win, chandle,&call);1025 comp_window_close(win, &call); 1027 1026 atomic_dec(&win->ref_cnt); 1028 1027 window_destroy(win); … … 1032 1031 switch (IPC_GET_IMETHOD(call)) { 1033 1032 case WINDOW_DAMAGE: 1034 comp_window_damage(win, chandle,&call);1033 comp_window_damage(win, &call); 1035 1034 break; 1036 1035 case WINDOW_GRAB: 1037 comp_window_grab(win, chandle,&call);1036 comp_window_grab(win, &call); 1038 1037 break; 1039 1038 case WINDOW_RESIZE: 1040 comp_window_resize(win, chandle,&call);1039 comp_window_resize(win, &call); 1041 1040 break; 1042 1041 case WINDOW_CLOSE: … … 1045 1044 * the case when the client is killed abruptly. 1046 1045 */ 1047 async_answer_0( chandle, EOK);1046 async_answer_0(&call, EOK); 1048 1047 break; 1049 1048 case WINDOW_CLOSE_REQUEST: 1050 comp_window_close_request(win, chandle,&call);1049 comp_window_close_request(win, &call); 1051 1050 break; 1052 1051 default: 1053 async_answer_0( chandle, EINVAL);1054 } 1055 } 1056 } 1057 } 1058 1059 static void comp_mode_change(viewport_t *vp, cap_call_handle_t icall_handle,ipc_call_t *icall)1052 async_answer_0(&call, EINVAL); 1053 } 1054 } 1055 } 1056 } 1057 1058 static void comp_mode_change(viewport_t *vp, ipc_call_t *icall) 1060 1059 { 1061 1060 sysarg_t mode_idx = IPC_GET_ARG2(*icall); … … 1067 1066 if (rc != EOK) { 1068 1067 fibril_mutex_unlock(&viewport_list_mtx); 1069 async_answer_0(icall _handle, EINVAL);1068 async_answer_0(icall, EINVAL); 1070 1069 return; 1071 1070 } … … 1076 1075 if (!new_surface) { 1077 1076 fibril_mutex_unlock(&viewport_list_mtx); 1078 async_answer_0(icall _handle, ENOMEM);1077 async_answer_0(icall, ENOMEM); 1079 1078 return; 1080 1079 } … … 1086 1085 surface_destroy(new_surface); 1087 1086 fibril_mutex_unlock(&viewport_list_mtx); 1088 async_answer_0(icall _handle, rc);1087 async_answer_0(icall, rc); 1089 1088 return; 1090 1089 } … … 1096 1095 1097 1096 fibril_mutex_unlock(&viewport_list_mtx); 1098 async_answer_0(icall _handle, EOK);1097 async_answer_0(icall, EOK); 1099 1098 1100 1099 comp_restrict_pointers(); … … 1130 1129 fibril_mutex_unlock(&window_list_mtx); 1131 1130 1132 async_answer_0(icall _handle, EOK);1131 async_answer_0(icall, EOK); 1133 1132 1134 1133 /* All fibrils of the compositor will terminate soon. */ … … 1136 1135 #endif 1137 1136 1138 static void comp_visualizer_disconnect(viewport_t *vp, cap_call_handle_t icall_handle,ipc_call_t *icall)1137 static void comp_visualizer_disconnect(viewport_t *vp, ipc_call_t *icall) 1139 1138 { 1140 1139 /* Release viewport resources. */ … … 1146 1145 fibril_mutex_unlock(&viewport_list_mtx); 1147 1146 1148 async_answer_0(icall _handle, EOK);1147 async_answer_0(icall, EOK); 1149 1148 1150 1149 comp_restrict_pointers(); … … 1152 1151 } 1153 1152 1154 static void vsl_notifications( cap_call_handle_t icall_handle,ipc_call_t *icall, void *arg)1153 static void vsl_notifications(ipc_call_t *icall, void *arg) 1155 1154 { 1156 1155 viewport_t *vp = NULL; … … 1170 1169 while (true) { 1171 1170 ipc_call_t call; 1172 cap_call_handle_t chandle =async_get_call(&call);1171 async_get_call(&call); 1173 1172 1174 1173 if (!IPC_GET_IMETHOD(call)) { … … 1179 1178 switch (IPC_GET_IMETHOD(call)) { 1180 1179 case VISUALIZER_MODE_CHANGE: 1181 comp_mode_change(vp, chandle,&call);1180 comp_mode_change(vp, &call); 1182 1181 break; 1183 1182 case VISUALIZER_DISCONNECT: 1184 comp_visualizer_disconnect(vp, chandle,&call);1183 comp_visualizer_disconnect(vp, &call); 1185 1184 return; 1186 1185 default: 1187 async_answer_0( chandle, EINVAL);1186 async_answer_0(&call, EINVAL); 1188 1187 } 1189 1188 }
Note:
See TracChangeset
for help on using the changeset viewer.