Changeset 87a7cdb in mainline
- Timestamp:
- 2019-12-05T19:35:12Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 71cbe5c
- Parents:
- 973efd36
- Location:
- uspace
- Files:
-
- 4 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ddev/test/ddev.c
r973efd36 r87a7cdb 210 210 } 211 211 212 /* WindowGC connection */212 /* GC connection */ 213 213 gc_conn(icall, gc); 214 214 } -
uspace/srv/hid/display/display.c
r973efd36 r87a7cdb 58 58 59 59 list_initialize(&disp->clients); 60 disp->gc = gc;61 60 disp->next_wnd_id = 1; 61 list_initialize(&disp->ddevs); 62 62 list_initialize(&disp->seats); 63 63 list_initialize(&disp->windows); … … 347 347 } 348 348 349 /** Add display device to display. 350 * 351 * @param disp Display 352 * @param ddev Display device 353 */ 354 void ds_display_add_ddev(ds_display_t *disp, ds_ddev_t *ddev) 355 { 356 assert(ddev->display == NULL); 357 assert(!link_used(&ddev->lddevs)); 358 359 ddev->display = disp; 360 list_append(&ddev->lddevs, &disp->ddevs); 361 } 362 363 /** Remove display device from display. 364 * 365 * @param ddev Display device 366 */ 367 void ds_display_remove_ddev(ds_ddev_t *ddev) 368 { 369 list_remove(&ddev->lddevs); 370 ddev->display = NULL; 371 } 372 373 /** Get first display device in display. 374 * 375 * @param disp Display 376 * @return First display device or @c NULL if there is none 377 */ 378 ds_ddev_t *ds_display_first_ddev(ds_display_t *disp) 379 { 380 link_t *link = list_first(&disp->ddevs); 381 382 if (link == NULL) 383 return NULL; 384 385 return list_get_instance(link, ds_ddev_t, lddevs); 386 } 387 388 /** Get next display device in display. 389 * 390 * @param ddev Current display device 391 * @return Next display device or @c NULL if there is none 392 */ 393 ds_ddev_t *ds_display_next_ddev(ds_ddev_t *ddev) 394 { 395 link_t *link = list_next(&ddev->lddevs, &ddev->display->ddevs); 396 397 if (link == NULL) 398 return NULL; 399 400 return list_get_instance(link, ds_ddev_t, lddevs); 401 } 402 403 // XXX 404 gfx_context_t *ds_display_get_gc(ds_display_t *display) 405 { 406 ds_ddev_t *ddev; 407 408 ddev = ds_display_first_ddev(display); 409 if (ddev == NULL) 410 abort(); 411 412 return ddev->gc; 413 } 414 349 415 /** @} 350 416 */ -
uspace/srv/hid/display/display.h
r973efd36 r87a7cdb 42 42 #include <io/pos_event.h> 43 43 #include "types/display/client.h" 44 #include "types/display/ddev.h" 44 45 #include "types/display/display.h" 45 46 #include "types/display/seat.h" … … 63 64 extern ds_seat_t *ds_display_first_seat(ds_display_t *); 64 65 extern ds_seat_t *ds_display_next_seat(ds_seat_t *); 66 extern void ds_display_add_ddev(ds_display_t *, ds_ddev_t *); 67 extern void ds_display_remove_ddev(ds_ddev_t *); 68 extern ds_ddev_t *ds_display_first_ddev(ds_display_t *); 69 extern ds_ddev_t *ds_display_next_ddev(ds_ddev_t *); 70 extern gfx_context_t *ds_display_get_gc(ds_display_t *); 65 71 66 72 #endif -
uspace/srv/hid/display/main.c
r973efd36 r87a7cdb 84 84 85 85 /** Initialize display server */ 86 static errno_t display_srv_init( void)86 static errno_t display_srv_init(ds_output_t **routput) 87 87 { 88 88 ds_display_t *disp = NULL; 89 89 ds_seat_t *seat = NULL; 90 ds_output_t *output = NULL; 90 91 gfx_context_t *gc = NULL; 91 92 errno_t rc; … … 101 102 goto error; 102 103 103 rc = output_init(display_kbd_event, (void *) disp,104 display_pos_event, (void *) disp, &gc);105 if (rc != EOK)106 goto error;107 108 disp->gc = gc;109 104 #if 0 110 105 rc = ds_input_open(disp); … … 112 107 goto error; 113 108 #endif 109 rc = ds_output_create(display_kbd_event, (void *) disp, 110 display_pos_event, (void *) disp, &output); 111 if (rc != EOK) 112 goto error; 113 114 output->def_display = disp; 115 rc = ds_output_start_discovery(output); 116 if (rc != EOK) 117 goto error; 118 114 119 async_set_fallback_port_handler(display_client_conn, disp); 115 120 … … 128 133 } 129 134 135 *routput = output; 130 136 return EOK; 131 137 error: … … 134 140 ds_input_close(disp); 135 141 #endif 142 if (output != NULL) 143 ds_output_destroy(output); 136 144 if (gc != NULL) 137 145 gfx_context_delete(gc); … … 199 207 { 200 208 errno_t rc; 209 ds_output_t *output; 201 210 202 211 printf("%s: Display server\n", NAME); … … 207 216 } 208 217 209 rc = display_srv_init( );218 rc = display_srv_init(&output); 210 219 if (rc != EOK) 211 220 return 1; -
uspace/srv/hid/display/meson.build
r973efd36 r87a7cdb 27 27 # 28 28 29 deps = [ 'ipcgfx', 'display', ' guigfx' ]29 deps = [ 'ipcgfx', 'display', 'ddev' ] 30 30 31 31 src = files( 32 32 'client.c', 33 'ddev.c', 33 34 'display.c', 34 35 'dsops.c', -
uspace/srv/hid/display/output.c
r973efd36 r87a7cdb 34 34 */ 35 35 36 #include <assert.h> 36 37 #include <errno.h> 37 #include <gfx/context.h> 38 #include <guigfx/canvas.h> 38 #include <fibril_synch.h> 39 39 #include <io/kbd_event.h> 40 40 #include <io/pos_event.h> 41 #include <loc.h> 41 42 #include <stdio.h> 42 43 #include <stdlib.h> 43 #include <window.h>44 #include "ddev.h" 44 45 #include "output.h" 45 46 47 #if 0 46 48 static void (*kbd_ev_handler)(void *, kbd_event_t *); 47 49 static void *kbd_ev_arg; … … 59 61 pos_ev_handler(pos_ev_arg, (pos_event_t *) data); 60 62 } 63 #endif 61 64 62 errno_t output_init(void (*kbd_event_handler)(void *, kbd_event_t *), 63 void *karg, void (*pos_event_handler)(void *, pos_event_t *), 64 void *parg, gfx_context_t **rgc) 65 /** Check for new display devices. 66 * 67 * @param output Display server output 68 */ 69 static errno_t ds_output_check_new_devs(ds_output_t *output) 65 70 { 66 canvas_gc_t *cgc = NULL; 67 window_t *window = NULL; 68 pixel_t *pixbuf = NULL; 69 surface_t *surface = NULL; 70 canvas_t *canvas = NULL; 71 gfx_coord_t vw, vh; 71 category_id_t ddev_cid; 72 service_id_t *svcs; 73 size_t count, i; 74 bool already_known; 75 ds_ddev_t *nddev; 72 76 errno_t rc; 73 77 74 printf("Init canvas..\n"); 75 kbd_ev_handler = kbd_event_handler; 76 kbd_ev_arg = karg; 78 assert(fibril_mutex_is_locked(&output->lock)); 77 79 78 pos_ev_handler = pos_event_handler; 79 pos_ev_arg = parg; 80 81 window = window_open("comp:0/winreg", NULL, 82 WINDOW_MAIN | WINDOW_DECORATED, "Display Server"); 83 if (window == NULL) { 84 printf("Error creating window.\n"); 85 return -1; 86 } 87 88 vw = 800; 89 vh = 600; 90 91 pixbuf = calloc(vw * vh, sizeof(pixel_t)); 92 if (pixbuf == NULL) { 93 printf("Error allocating memory for pixel buffer.\n"); 94 return ENOMEM; 95 } 96 97 surface = surface_create(vw, vh, pixbuf, 0); 98 if (surface == NULL) { 99 printf("Error creating surface.\n"); 80 rc = loc_category_get_id("display-device", &ddev_cid, 81 IPC_FLAG_BLOCKING); 82 if (rc != EOK) { 83 printf("Error looking up category 'display-device'.\n"); 100 84 return EIO; 101 85 } 102 86 103 canvas = create_canvas(window_root(window), NULL, vw, vh, 104 surface); 105 if (canvas == NULL) { 106 printf("Error creating canvas.\n"); 87 /* 88 * Check for new dispay devices 89 */ 90 rc = loc_category_get_svcs(ddev_cid, &svcs, &count); 91 if (rc != EOK) { 92 printf("Error getting list of display devices.\n"); 107 93 return EIO; 108 94 } 109 95 110 sig_connect(&canvas->keyboard_event, NULL, on_keyboard_event);111 sig_connect(&canvas->position_event, NULL, on_position_event);96 for (i = 0; i < count; i++) { 97 already_known = false; 112 98 113 window_resize(window, 0, 0, vw + 10, vh + 30, WINDOW_PLACEMENT_ANY); 114 window_exec(window); 99 /* Determine whether we already know this device. */ 100 list_foreach(output->ddevs, loutdevs, ds_ddev_t, ddev) { 101 if (ddev->svc_id == svcs[i]) { 102 already_known = true; 103 break; 104 } 105 } 115 106 116 printf("Create canvas GC\n"); 117 rc = canvas_gc_create(canvas, surface, &cgc); 118 if (rc != EOK) 107 if (!already_known) { 108 rc = ds_ddev_open(output->def_display, svcs[i], &nddev); 109 if (rc != EOK) { 110 printf("Error adding display device.\n"); 111 continue; 112 } 113 114 list_append(&nddev->loutdevs, &output->ddevs); 115 116 printf("Added display device '%lu'\n", 117 (unsigned long) svcs[i]); 118 } 119 } 120 121 free(svcs); 122 123 return EOK; 124 } 125 126 /** Display device category change callback. 127 * 128 * @param arg Display server output (cast to void *) 129 */ 130 static void ds_ddev_change_cb(void *arg) 131 { 132 ds_output_t *output = (ds_output_t *) arg; 133 134 printf("ds_ddev_change_cb\n"); 135 fibril_mutex_lock(&output->lock); 136 (void) ds_output_check_new_devs(output); 137 fibril_mutex_unlock(&output->lock); 138 } 139 140 /** Create display server output. 141 * 142 * @param kbd_event_handler 143 * @param karg 144 * @param pos_event_handler 145 * @param parg 146 * @param routput Place to store pointer to display server output object. 147 * @return EOK on success or an error code 148 */ 149 errno_t ds_output_create(void (*kbd_event_handler)(void *, kbd_event_t *), 150 void *karg, void (*pos_event_handler)(void *, pos_event_t *), 151 void *parg, ds_output_t **routput) 152 { 153 ds_output_t *output; 154 155 output = calloc(1, sizeof(ds_output_t)); 156 if (output == NULL) 157 return ENOMEM; 158 159 fibril_mutex_initialize(&output->lock); 160 list_initialize(&output->ddevs); 161 162 *routput = output; 163 return EOK; 164 } 165 166 /** Start display device discovery. 167 * 168 * @param output Display server output 169 * @return EOK on success or an error code 170 */ 171 errno_t ds_output_start_discovery(ds_output_t *output) 172 { 173 errno_t rc; 174 175 rc = loc_register_cat_change_cb(ds_ddev_change_cb, output); 176 if (rc != EOK) { 177 printf("Failed registering callback for device discovery.\n"); 119 178 return rc; 179 } 120 180 121 *rgc = canvas_gc_get_ctx(cgc); 122 return EOK; 181 fibril_mutex_lock(&output->lock); 182 rc = ds_output_check_new_devs(output); 183 fibril_mutex_unlock(&output->lock); 184 185 return rc; 186 } 187 188 /** Destroy display server output. 189 * 190 * @param output Display server output 191 */ 192 void ds_output_destroy(ds_output_t *output) 193 { 194 free(output); 123 195 } 124 196 -
uspace/srv/hid/display/output.h
r973efd36 r87a7cdb 40 40 #include <io/kbd_event.h> 41 41 #include <io/pos_event.h> 42 #include "types/display/output.h" 42 43 43 extern errno_t output_init(void (*)(void *, kbd_event_t *), void *, 44 void (*)(void *, pos_event_t *), void *, 45 gfx_context_t **); 44 extern errno_t ds_output_create(void (*)(void *, kbd_event_t *), 45 void *, void (*)(void *, pos_event_t *), void *, ds_output_t **); 46 extern errno_t ds_output_start_discovery(ds_output_t *); 47 extern void ds_output_destroy(ds_output_t *); 46 48 47 49 #endif -
uspace/srv/hid/display/types/display/display.h
r973efd36 r87a7cdb 38 38 39 39 #include <adt/list.h> 40 #include <gfx/context.h>41 40 #include <io/input.h> 42 41 #include "window.h" … … 46 45 /** Clients (of ds_client_t) */ 47 46 list_t clients; 48 /** Output GC */49 gfx_context_t *gc;50 47 51 48 /** Next ID to assign to a window. … … 65 62 /** Windows (of ds_window_t) in stacking order */ 66 63 list_t windows; 64 65 /** Display devices (of ds_ddev_t) */ 66 list_t ddevs; 67 67 } ds_display_t; 68 68 -
uspace/srv/hid/display/window.c
r973efd36 r87a7cdb 77 77 ds_window_t *wnd = (ds_window_t *) arg; 78 78 79 log_msg(LOG_DEFAULT, LVL_NOTE, "gc_set_color gc=%p", wnd->display->gc); 80 return gfx_set_color(wnd->display->gc, color); 79 log_msg(LOG_DEFAULT, LVL_NOTE, "gc_set_color gc=%p", 80 ds_display_get_gc(wnd->display)); 81 return gfx_set_color(ds_display_get_gc(wnd->display), color); 81 82 } 82 83 … … 95 96 log_msg(LOG_DEFAULT, LVL_NOTE, "gc_fill_rect"); 96 97 gfx_rect_translate(&wnd->dpos, rect, &drect); 97 return gfx_fill_rect( wnd->display->gc, &drect);98 return gfx_fill_rect(ds_display_get_gc(wnd->display), &drect); 98 99 } 99 100 … … 117 118 return ENOMEM; 118 119 119 rc = gfx_bitmap_create( wnd->display->gc, params, alloc,120 rc = gfx_bitmap_create(ds_display_get_gc(wnd->display), params, alloc, 120 121 &cbm->bitmap); 121 122 if (rc != EOK) -
uspace/srv/hid/rfb/main.c
r973efd36 r87a7cdb 27 27 */ 28 28 29 #include < stdlib.h>29 #include <ddev_srv.h> 30 30 #include <errno.h> 31 #include <fibril_synch.h> 32 #include <gfx/color.h> 33 #include <gfx/context.h> 34 #include <gfx/coord.h> 35 #include <inttypes.h> 36 #include <io/log.h> 37 #include <io/pixelmap.h> 38 #include <ipcgfx/server.h> 31 39 #include <loc.h> 32 40 #include <stdio.h> 33 #include <fibril_synch.h> 34 #include <abi/ipc/methods.h> 35 #include <inttypes.h> 36 #include <io/log.h> 37 #include <str.h> 41 #include <stdlib.h> 38 42 #include <task.h> 39 43 40 #include <abi/fb/visuals.h>41 #include <adt/list.h>42 #include <io/mode.h>43 #include <io/pixelmap.h>44 #include <io/chargrid.h>45 #include <graph.h>46 47 44 #include "rfb.h" 48 45 49 46 #define NAME "rfb" 50 47 51 static vslmode_list_element_t pixel_mode; 52 static visualizer_t *vis; 53 static rfb_t rfb; 54 55 static errno_t rfb_claim(visualizer_t *vs) 56 { 57 return EOK; 58 } 59 60 static errno_t rfb_yield(visualizer_t *vs) 61 { 62 return EOK; 63 } 64 65 static errno_t rfb_suspend(visualizer_t *vs) 66 { 67 return EOK; 68 } 69 70 static errno_t rfb_wakeup(visualizer_t *vs) 71 { 72 return EOK; 73 } 74 48 static errno_t rfb_gc_set_color(void *, gfx_color_t *); 49 static errno_t rfb_gc_fill_rect(void *, gfx_rect_t *); 50 static errno_t rfb_gc_bitmap_create(void *, gfx_bitmap_params_t *, 51 gfx_bitmap_alloc_t *, void **); 52 static errno_t rfb_gc_bitmap_destroy(void *); 53 static errno_t rfb_gc_bitmap_render(void *, gfx_rect_t *, gfx_coord2_t *); 54 static errno_t rfb_gc_bitmap_get_alloc(void *, gfx_bitmap_alloc_t *); 55 56 static ddev_ops_t rfb_ddev_ops = { 57 }; 58 59 typedef struct { 60 rfb_t rfb; 61 pixel_t color; 62 } rfb_gc_t; 63 64 typedef struct { 65 rfb_gc_t *rfb; 66 gfx_bitmap_alloc_t alloc; 67 gfx_rect_t rect; 68 bool myalloc; 69 } rfb_bitmap_t; 70 71 gfx_context_ops_t rfb_gc_ops = { 72 .set_color = rfb_gc_set_color, 73 .fill_rect = rfb_gc_fill_rect, 74 .bitmap_create = rfb_gc_bitmap_create, 75 .bitmap_destroy = rfb_gc_bitmap_destroy, 76 .bitmap_render = rfb_gc_bitmap_render, 77 .bitmap_get_alloc = rfb_gc_bitmap_get_alloc 78 }; 79 80 static void rfb_gc_invalidate_rect(rfb_gc_t *rfbgc, gfx_rect_t *rect) 81 { 82 rfb_t *rfb = &rfbgc->rfb; 83 gfx_rect_t old_rect; 84 gfx_rect_t new_rect; 85 86 if (gfx_rect_is_empty(rect)) 87 return; 88 89 if (!rfb->damage_valid) { 90 old_rect.p0.x = old_rect.p0.y = 0; 91 old_rect.p1.x = old_rect.p1.y = 0; 92 } else { 93 old_rect.p0.x = rfb->damage_rect.x; 94 old_rect.p0.y = rfb->damage_rect.y; 95 old_rect.p1.x = rfb->damage_rect.x + rfb->damage_rect.width; 96 old_rect.p1.y = rfb->damage_rect.y + rfb->damage_rect.height; 97 } 98 99 gfx_rect_envelope(&old_rect, rect, &new_rect); 100 101 rfb->damage_rect.x = new_rect.p0.x; 102 rfb->damage_rect.y = new_rect.p0.y; 103 rfb->damage_rect.width = new_rect.p1.x - new_rect.p0.x; 104 rfb->damage_rect.height = new_rect.p1.y - new_rect.p1.y; 105 } 106 107 /** Set color on RFB. 108 * 109 * Set drawing color on RFB GC. 110 * 111 * @param arg RFB 112 * @param color Color 113 * 114 * @return EOK on success or an error code 115 */ 116 static errno_t rfb_gc_set_color(void *arg, gfx_color_t *color) 117 { 118 rfb_gc_t *rfb = (rfb_gc_t *) arg; 119 uint16_t r, g, b; 120 121 gfx_color_get_rgb_i16(color, &r, &g, &b); 122 rfb->color = PIXEL(0, r >> 8, g >> 8, b >> 8); 123 return EOK; 124 } 125 126 /** Fill rectangle on RFB. 127 * 128 * @param arg RFB 129 * @param rect Rectangle 130 * 131 * @return EOK on success or an error code 132 */ 133 static errno_t rfb_gc_fill_rect(void *arg, gfx_rect_t *rect) 134 { 135 rfb_gc_t *rfb = (rfb_gc_t *) arg; 136 gfx_coord_t x, y; 137 138 // XXX We should handle p0.x > p1.x and p0.y > p1.y 139 140 for (y = rect->p0.y; y < rect->p1.y; y++) { 141 for (x = rect->p0.x; x < rect->p1.x; x++) { 142 pixelmap_put_pixel(&rfb->rfb.framebuffer, x, y, 143 rfb->color); 144 } 145 } 146 147 rfb_gc_invalidate_rect(rfb, rect); 148 149 return EOK; 150 } 151 152 /** Create bitmap in RFB GC. 153 * 154 * @param arg RFB 155 * @param params Bitmap params 156 * @param alloc Bitmap allocation info or @c NULL 157 * @param rbm Place to store pointer to new bitmap 158 * @return EOK on success or an error code 159 */ 160 errno_t rfb_gc_bitmap_create(void *arg, gfx_bitmap_params_t *params, 161 gfx_bitmap_alloc_t *alloc, void **rbm) 162 { 163 rfb_gc_t *rfb = (rfb_gc_t *) arg; 164 rfb_bitmap_t *rfbbm = NULL; 165 gfx_coord2_t dim; 166 errno_t rc; 167 168 rfbbm = calloc(1, sizeof(rfb_bitmap_t)); 169 if (rfbbm == NULL) 170 return ENOMEM; 171 172 gfx_coord2_subtract(¶ms->rect.p1, ¶ms->rect.p0, &dim); 173 rfbbm->rect = params->rect; 174 175 if (alloc == NULL) { 176 rfbbm->alloc.pitch = dim.x * sizeof(uint32_t); 177 rfbbm->alloc.off0 = 0; 178 rfbbm->alloc.pixels = malloc(rfbbm->alloc.pitch * dim.y); 179 rfbbm->myalloc = true; 180 181 if (rfbbm->alloc.pixels == NULL) { 182 rc = ENOMEM; 183 goto error; 184 } 185 } else { 186 rfbbm->alloc = *alloc; 187 } 188 189 rfbbm->rfb = rfb; 190 *rbm = (void *)rfbbm; 191 return EOK; 192 error: 193 if (rbm != NULL) 194 free(rfbbm); 195 return rc; 196 } 197 198 /** Destroy bitmap in RFB GC. 199 * 200 * @param bm Bitmap 201 * @return EOK on success or an error code 202 */ 203 static errno_t rfb_gc_bitmap_destroy(void *bm) 204 { 205 rfb_bitmap_t *rfbbm = (rfb_bitmap_t *)bm; 206 if (rfbbm->myalloc) 207 free(rfbbm->alloc.pixels); 208 free(rfbbm); 209 return EOK; 210 } 211 212 /** Render bitmap in RFB GC. 213 * 214 * @param bm Bitmap 215 * @param srect0 Source rectangle or @c NULL 216 * @param offs0 Offset or @c NULL 217 * @return EOK on success or an error code 218 */ 219 static errno_t rfb_gc_bitmap_render(void *bm, gfx_rect_t *srect0, 220 gfx_coord2_t *offs0) 221 { 222 rfb_bitmap_t *rfbbm = (rfb_bitmap_t *)bm; 223 gfx_rect_t srect; 224 gfx_rect_t drect; 225 gfx_coord2_t offs; 226 gfx_coord2_t dim; 227 228 if (srect0 != NULL) 229 srect = *srect0; 230 else 231 srect = rfbbm->rect; 232 233 if (offs0 != NULL) { 234 offs = *offs0; 235 } else { 236 offs.x = 0; 237 offs.y = 0; 238 } 239 240 /* Destination rectangle */ 241 gfx_rect_translate(&offs, &srect, &drect); 242 243 gfx_coord2_subtract(&drect.p1, &drect.p0, &dim); 244 245 return EOK; 246 } 247 248 /** Get allocation info for bitmap in RFB GC. 249 * 250 * @param bm Bitmap 251 * @param alloc Place to store allocation info 252 * @return EOK on success or an error code 253 */ 254 static errno_t rfb_gc_bitmap_get_alloc(void *bm, gfx_bitmap_alloc_t *alloc) 255 { 256 rfb_bitmap_t *rfbbm = (rfb_bitmap_t *)bm; 257 *alloc = rfbbm->alloc; 258 return EOK; 259 } 260 261 #if 0 75 262 static errno_t rfb_handle_damage_pixels(visualizer_t *vs, 76 263 sysarg_t x0, sysarg_t y0, sysarg_t width, sysarg_t height, … … 125 312 return EOK; 126 313 } 127 128 static errno_t rfb_change_mode(visualizer_t *vs, vslmode_t new_mode) 129 { 130 return EOK; 131 } 132 133 static visualizer_ops_t rfb_ops = { 134 .claim = rfb_claim, 135 .yield = rfb_yield, 136 .change_mode = rfb_change_mode, 137 .handle_damage = rfb_handle_damage_pixels, 138 .suspend = rfb_suspend, 139 .wakeup = rfb_wakeup 140 }; 314 #endif 141 315 142 316 static void syntax_print(void) … … 145 319 } 146 320 147 static void client_connection(ipc_call_t *call, void *data) 148 { 149 graph_visualizer_connection(vis, call, data); 321 static void client_connection(ipc_call_t *icall, void *arg) 322 { 323 ddev_srv_t srv; 324 sysarg_t svc_id; 325 gfx_context_t *gc; 326 errno_t rc; 327 328 svc_id = ipc_get_arg2(icall); 329 330 if (svc_id != 0) { 331 /* Set up protocol structure */ 332 ddev_srv_initialize(&srv); 333 srv.ops = &rfb_ddev_ops; 334 srv.arg = arg; 335 336 /* Handle connection */ 337 ddev_conn(icall, &srv); 338 } else { 339 rc = gfx_context_new(&rfb_gc_ops, arg, &gc); 340 if (rc != EOK) { 341 async_answer_0(icall, ENOMEM); 342 return; 343 } 344 345 /* GC connection */ 346 gc_conn(icall, gc); 347 } 150 348 } 151 349 152 350 int main(int argc, char **argv) 153 351 { 352 rfb_t rfb; 353 154 354 log_init(NAME); 155 355 … … 188 388 rfb_init(&rfb, width, height, rfb_name); 189 389 190 vis = malloc(sizeof(visualizer_t)); 191 if (vis == NULL) { 192 fprintf(stderr, "Failed allocating visualizer struct\n"); 193 return 3; 194 } 195 196 graph_init_visualizer(vis); 197 198 pixel_mode.mode.index = 0; 199 pixel_mode.mode.version = 0; 200 pixel_mode.mode.refresh_rate = 0; 201 pixel_mode.mode.screen_aspect.width = rfb.width; 202 pixel_mode.mode.screen_aspect.height = rfb.height; 203 pixel_mode.mode.screen_width = rfb.width; 204 pixel_mode.mode.screen_height = rfb.height; 205 pixel_mode.mode.cell_aspect.width = 1; 206 pixel_mode.mode.cell_aspect.height = 1; 207 pixel_mode.mode.cell_visual.pixel_visual = VISUAL_RGB_8_8_8; 208 209 link_initialize(&pixel_mode.link); 210 list_append(&pixel_mode.link, &vis->modes); 211 212 vis->def_mode_idx = 0; 213 214 vis->ops = rfb_ops; 215 vis->dev_ctx = NULL; 216 217 async_set_fallback_port_handler(client_connection, NULL); 390 async_set_fallback_port_handler(client_connection, &rfb); 218 391 219 392 errno_t rc = loc_server_register(NAME); … … 240 413 free(service_name); 241 414 242 category_id_t visualizer_category;243 rc = loc_category_get_id(" visualizer", &visualizer_category, IPC_FLAG_BLOCKING);415 category_id_t ddev_cid; 416 rc = loc_category_get_id("display-device", &ddev_cid, IPC_FLAG_BLOCKING); 244 417 if (rc != EOK) { 245 418 fprintf(stderr, NAME ": Unable to get visualizer category id.\n"); … … 247 420 } 248 421 249 rc = loc_service_add_to_cat(service_id, visualizer_category);422 rc = loc_service_add_to_cat(service_id, ddev_cid); 250 423 if (rc != EOK) { 251 424 fprintf(stderr, NAME ": Unable to add service to visualizer category.\n"); -
uspace/srv/hid/rfb/meson.build
r973efd36 r87a7cdb 27 27 # 28 28 29 deps = [ ' graph' ]29 deps = [ 'ipcgfx', 'ddev' ] 30 30 src = files('main.c', 'rfb.c') -
uspace/srv/locsrv/locsrv.c
r973efd36 r87a7cdb 1384 1384 categ_dir_add_cat(&cdir, cat); 1385 1385 1386 cat = category_new("display-device"); 1387 categ_dir_add_cat(&cdir, cat); 1388 1386 1389 cat = category_new("audio-pcm"); 1387 1390 categ_dir_add_cat(&cdir, cat);
Note:
See TracChangeset
for help on using the changeset viewer.