Changes in uspace/srv/hid/display/main.c [4c6fd56:1762ceb] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/main.c
r4c6fd56 r1762ceb 1 1 /* 2 * Copyright (c) 20 23Jiri Svoboda2 * Copyright (c) 2019 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 36 36 #include <async.h> 37 37 #include <disp_srv.h> 38 #include <dispcfg_srv.h>39 38 #include <errno.h> 40 39 #include <gfx/context.h> … … 48 47 #include <stdio.h> 49 48 #include <task.h> 50 #include <wndmgt_srv.h>51 #include "cfgclient.h"52 #include "cfgops.h"53 49 #include "client.h" 54 50 #include "display.h" … … 59 55 #include "seat.h" 60 56 #include "window.h" 61 #include "wmclient.h"62 #include "wmops.h"63 57 64 58 static void display_client_conn(ipc_call_t *, void *); 65 59 static void display_client_ev_pending(void *); 66 static void display_wmclient_ev_pending(void *);67 static void display_cfgclient_ev_pending(void *);68 static void display_gc_conn(ipc_call_t *, void *);69 static void display_wndmgt_conn(ipc_call_t *, void *);70 static void display_dispcfg_conn(ipc_call_t *, void *);71 60 72 61 #ifdef CONFIG_DISP_DOUBLE_BUF … … 87 76 }; 88 77 89 static ds_wmclient_cb_t display_wmclient_cb = {90 .ev_pending = display_wmclient_ev_pending91 };92 93 static ds_cfgclient_cb_t display_cfgclient_cb = {94 .ev_pending = display_cfgclient_ev_pending95 };96 97 78 static void display_client_ev_pending(void *arg) 98 79 { … … 100 81 101 82 display_srv_ev_pending(srv); 102 }103 104 static void display_wmclient_ev_pending(void *arg)105 {106 wndmgt_srv_t *srv = (wndmgt_srv_t *) arg;107 108 wndmgt_srv_ev_pending(srv);109 }110 111 static void display_cfgclient_ev_pending(void *arg)112 {113 dispcfg_srv_t *srv = (dispcfg_srv_t *) arg;114 115 dispcfg_srv_ev_pending(srv);116 83 } 117 84 … … 123 90 ds_output_t *output = NULL; 124 91 gfx_context_t *gc = NULL; 125 port_id_t disp_port;126 port_id_t gc_port;127 port_id_t wm_port;128 port_id_t dc_port;129 loc_srv_t *srv = NULL;130 service_id_t sid = 0;131 92 errno_t rc; 132 93 … … 137 98 goto error; 138 99 139 rc = ds_seat_create(disp, "Alice",&seat);100 rc = ds_seat_create(disp, &seat); 140 101 if (rc != EOK) 141 102 goto error; … … 154 115 goto error; 155 116 156 rc = async_create_port(INTERFACE_DISPLAY, display_client_conn, disp, 157 &disp_port); 158 if (rc != EOK) 159 goto error; 160 161 rc = async_create_port(INTERFACE_GC, display_gc_conn, disp, &gc_port); 162 if (rc != EOK) 163 goto error; 164 165 rc = async_create_port(INTERFACE_WNDMGT, display_wndmgt_conn, disp, 166 &wm_port); 167 if (rc != EOK) 168 goto error; 169 170 rc = async_create_port(INTERFACE_DISPCFG, display_dispcfg_conn, disp, 171 &dc_port); 172 if (rc != EOK) 173 goto error; 174 175 rc = loc_server_register(NAME, &srv); 117 async_set_fallback_port_handler(display_client_conn, disp); 118 119 rc = loc_server_register(NAME); 176 120 if (rc != EOK) { 177 121 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server: %s.", str_error(rc)); … … 180 124 } 181 125 182 rc = loc_service_register(srv, SERVICE_NAME_DISPLAY, &sid); 126 service_id_t sid; 127 rc = loc_service_register(SERVICE_NAME_DISPLAY, &sid); 183 128 if (rc != EOK) { 184 129 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service: %s.", str_error(rc)); … … 190 135 return EOK; 191 136 error: 192 if (sid != 0)193 loc_service_unregister(srv, sid);194 if (srv != NULL)195 loc_server_unregister(srv);196 // XXX destroy disp_port197 // XXX destroy gc_port198 // XXX destroy wm_port199 // XXX destroy dc_port200 137 #if 0 201 138 if (disp->input != NULL) … … 217 154 { 218 155 display_srv_t srv; 156 sysarg_t wnd_id; 219 157 sysarg_t svc_id; 220 158 ds_client_t *client = NULL; 159 ds_window_t *wnd; 221 160 ds_display_t *disp = (ds_display_t *) arg; 161 gfx_context_t *gc; 222 162 errno_t rc; 223 163 … … 226 166 ipc_get_arg4(icall)); 227 167 168 (void) icall; 169 (void) arg; 170 228 171 svc_id = ipc_get_arg2(icall); 172 wnd_id = ipc_get_arg3(icall); 229 173 230 174 if (svc_id != 0) { 231 175 /* Create client object */ 232 ds_display_lock(disp);233 176 rc = ds_client_create(disp, &display_client_cb, &srv, &client); 234 ds_display_unlock(disp);235 177 if (rc != EOK) { 236 178 async_answer_0(icall, ENOMEM); … … 249 191 ds_client_destroy(client); 250 192 ds_display_unlock(disp); 251 } 252 } 253 254 /** Handle GC connection to display server */ 255 static void display_gc_conn(ipc_call_t *icall, void *arg) 256 { 257 sysarg_t wnd_id; 258 ds_window_t *wnd; 259 ds_display_t *disp = (ds_display_t *) arg; 260 gfx_context_t *gc; 261 262 log_msg(LOG_DEFAULT, LVL_DEBUG, "display_gc_conn arg1=%zu arg2=%zu arg3=%zu arg4=%zu.", 263 ipc_get_arg1(icall), ipc_get_arg2(icall), ipc_get_arg3(icall), 264 ipc_get_arg4(icall)); 265 266 wnd_id = ipc_get_arg3(icall); 267 268 /* Window GC connection */ 269 270 wnd = ds_display_find_window(disp, wnd_id); 271 if (wnd == NULL) { 272 async_answer_0(icall, ENOENT); 273 return; 274 } 275 276 /* 277 * XXX We need a way to make sure that the connection does 278 * not stay active after the window had been destroyed 279 */ 280 gc = ds_window_get_ctx(wnd); 281 gc_conn(icall, gc); 282 } 283 284 /** Handle window management connection to display server */ 285 static void display_wndmgt_conn(ipc_call_t *icall, void *arg) 286 { 287 ds_display_t *disp = (ds_display_t *) arg; 288 errno_t rc; 289 wndmgt_srv_t srv; 290 ds_wmclient_t *wmclient = NULL; 291 292 /* Create WM client object */ 293 ds_display_lock(disp); 294 rc = ds_wmclient_create(disp, &display_wmclient_cb, &srv, &wmclient); 295 ds_display_unlock(disp); 296 if (rc != EOK) { 297 async_answer_0(icall, ENOMEM); 298 return; 299 } 300 301 /* Set up protocol structure */ 302 wndmgt_srv_initialize(&srv); 303 srv.ops = &wndmgt_srv_ops; 304 srv.arg = wmclient; 305 306 /* Handle connection */ 307 wndmgt_conn(icall, &srv); 308 309 ds_display_lock(disp); 310 ds_wmclient_destroy(wmclient); 311 ds_display_unlock(disp); 312 } 313 314 /** Handle configuration connection to display server */ 315 static void display_dispcfg_conn(ipc_call_t *icall, void *arg) 316 { 317 ds_display_t *disp = (ds_display_t *) arg; 318 errno_t rc; 319 dispcfg_srv_t srv; 320 ds_cfgclient_t *cfgclient = NULL; 321 322 /* Create CFG client object */ 323 ds_display_lock(disp); 324 rc = ds_cfgclient_create(disp, &display_cfgclient_cb, &srv, &cfgclient); 325 ds_display_unlock(disp); 326 if (rc != EOK) { 327 async_answer_0(icall, ENOMEM); 328 return; 329 } 330 331 /* Set up protocol structure */ 332 dispcfg_srv_initialize(&srv); 333 srv.ops = &dispcfg_srv_ops; 334 srv.arg = cfgclient; 335 336 /* Handle connection */ 337 dispcfg_conn(icall, &srv); 338 339 ds_display_lock(disp); 340 ds_cfgclient_destroy(cfgclient); 341 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 } 342 209 } 343 210
Note:
See TracChangeset
for help on using the changeset viewer.