Changes in uspace/srv/hid/display/main.c [1762ceb:913add60] in mainline
- File:
-
- 1 edited
-
uspace/srv/hid/display/main.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/main.c
r1762ceb r913add60 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 47 47 #include <stdio.h> 48 48 #include <task.h> 49 #include <wndmgt_srv.h> 49 50 #include "client.h" 50 51 #include "display.h" … … 55 56 #include "seat.h" 56 57 #include "window.h" 58 #include "wmclient.h" 59 #include "wmops.h" 57 60 58 61 static void display_client_conn(ipc_call_t *, void *); 59 62 static void display_client_ev_pending(void *); 63 static void display_wmclient_ev_pending(void *); 64 static void display_gc_conn(ipc_call_t *, void *); 65 static void display_wndmgt_conn(ipc_call_t *, void *); 60 66 61 67 #ifdef CONFIG_DISP_DOUBLE_BUF … … 76 82 }; 77 83 84 static ds_wmclient_cb_t display_wmclient_cb = { 85 .ev_pending = display_wmclient_ev_pending 86 }; 87 78 88 static void display_client_ev_pending(void *arg) 79 89 { … … 81 91 82 92 display_srv_ev_pending(srv); 93 } 94 95 static void display_wmclient_ev_pending(void *arg) 96 { 97 wndmgt_srv_t *srv = (wndmgt_srv_t *) arg; 98 99 wndmgt_srv_ev_pending(srv); 83 100 } 84 101 … … 90 107 ds_output_t *output = NULL; 91 108 gfx_context_t *gc = NULL; 109 port_id_t disp_port; 110 port_id_t gc_port; 111 port_id_t wm_port; 92 112 errno_t rc; 93 113 … … 115 135 goto error; 116 136 117 async_set_fallback_port_handler(display_client_conn, disp); 137 rc = async_create_port(INTERFACE_DISPLAY, display_client_conn, disp, 138 &disp_port); 139 if (rc != EOK) 140 goto error; 141 142 rc = async_create_port(INTERFACE_GC, display_gc_conn, disp, &gc_port); 143 if (rc != EOK) 144 goto error; 145 146 rc = async_create_port(INTERFACE_WNDMGT, display_wndmgt_conn, disp, 147 &wm_port); 148 if (rc != EOK) 149 goto error; 118 150 119 151 rc = loc_server_register(NAME); … … 135 167 return EOK; 136 168 error: 169 // XXX destroy disp_port 170 // XXX destroy gc_port 171 // XXX destroy wm_port 137 172 #if 0 138 173 if (disp->input != NULL) … … 154 189 { 155 190 display_srv_t srv; 156 sysarg_t wnd_id;157 191 sysarg_t svc_id; 158 192 ds_client_t *client = NULL; 159 ds_window_t *wnd;160 193 ds_display_t *disp = (ds_display_t *) arg; 161 gfx_context_t *gc;162 194 errno_t rc; 163 195 … … 166 198 ipc_get_arg4(icall)); 167 199 168 (void) icall;169 (void) arg;170 171 200 svc_id = ipc_get_arg2(icall); 172 wnd_id = ipc_get_arg3(icall);173 201 174 202 if (svc_id != 0) { 175 203 /* Create client object */ 204 ds_display_lock(disp); 176 205 rc = ds_client_create(disp, &display_client_cb, &srv, &client); 206 ds_display_unlock(disp); 177 207 if (rc != EOK) { 178 208 async_answer_0(icall, ENOMEM); … … 191 221 ds_client_destroy(client); 192 222 ds_display_unlock(disp); 193 } else { 194 /* Window GC connection */ 195 196 wnd = ds_display_find_window(disp, wnd_id); 197 if (wnd == NULL) { 198 async_answer_0(icall, ENOENT); 199 return; 200 } 201 202 /* 203 * XXX We need a way to make sure that the connection does 204 * not stay active after the window had been destroyed 205 */ 206 gc = ds_window_get_ctx(wnd); 207 gc_conn(icall, gc); 208 } 223 } 224 } 225 226 /** Handle GC connection to display server */ 227 static void display_gc_conn(ipc_call_t *icall, void *arg) 228 { 229 sysarg_t wnd_id; 230 ds_window_t *wnd; 231 ds_display_t *disp = (ds_display_t *) arg; 232 gfx_context_t *gc; 233 234 log_msg(LOG_DEFAULT, LVL_DEBUG, "display_gc_conn arg1=%zu arg2=%zu arg3=%zu arg4=%zu.", 235 ipc_get_arg1(icall), ipc_get_arg2(icall), ipc_get_arg3(icall), 236 ipc_get_arg4(icall)); 237 238 wnd_id = ipc_get_arg3(icall); 239 240 /* Window GC connection */ 241 242 wnd = ds_display_find_window(disp, wnd_id); 243 if (wnd == NULL) { 244 async_answer_0(icall, ENOENT); 245 return; 246 } 247 248 /* 249 * XXX We need a way to make sure that the connection does 250 * not stay active after the window had been destroyed 251 */ 252 gc = ds_window_get_ctx(wnd); 253 gc_conn(icall, gc); 254 } 255 256 /** Handle window management connection to display server */ 257 static void display_wndmgt_conn(ipc_call_t *icall, void *arg) 258 { 259 ds_display_t *disp = (ds_display_t *) arg; 260 errno_t rc; 261 wndmgt_srv_t srv; 262 ds_wmclient_t *wmclient = NULL; 263 264 /* Create WM client object */ 265 ds_display_lock(disp); 266 rc = ds_wmclient_create(disp, &display_wmclient_cb, &srv, &wmclient); 267 ds_display_unlock(disp); 268 if (rc != EOK) { 269 async_answer_0(icall, ENOMEM); 270 return; 271 } 272 273 /* Set up protocol structure */ 274 wndmgt_srv_initialize(&srv); 275 srv.ops = &wndmgt_srv_ops; 276 srv.arg = wmclient; 277 278 /* Handle connection */ 279 wndmgt_conn(icall, &srv); 280 281 ds_display_lock(disp); 282 ds_wmclient_destroy(wmclient); 283 ds_display_unlock(disp); 209 284 } 210 285
Note:
See TracChangeset
for help on using the changeset viewer.
