Changes in uspace/drv/fb/amdm37x_dispc/main.c [de19d4a:4f87a85a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/fb/amdm37x_dispc/main.c
rde19d4a r4f87a85a 1 1 /* 2 * Copyright (c) 2020 Jiri Svoboda3 2 * Copyright (c) 2013 Jan Vesely 4 3 * Copyright (c) 2011 Petr Koupy … … 36 35 */ 37 36 38 #include <ddev_srv.h>39 37 #include <ddf/driver.h> 40 38 #include <ddf/log.h> 41 39 #include <errno.h> 42 #include <ipcgfx/server.h>43 40 #include <str_error.h> 44 41 #include <stdio.h> 42 #include <graph.h> 45 43 46 44 #include "amdm37x_dispc.h" … … 48 46 #define NAME "amdm37x_dispc" 49 47 50 static void amdm37x_client_conn(ipc_call_t *icall, void *arg)48 static void graph_vsl_connection(ipc_call_t *icall, void *arg) 51 49 { 52 amdm37x_dispc_t *dispc; 53 ddev_srv_t srv; 54 sysarg_t gc_id; 55 gfx_context_t *gc; 56 errno_t rc; 50 visualizer_t *vsl; 57 51 58 dispc = (amdm37x_dispc_t *) ddf_dev_data_get( 59 ddf_fun_get_dev((ddf_fun_t *) arg)); 60 61 gc_id = ipc_get_arg3(icall); 62 63 if (gc_id == 0) { 64 /* Set up protocol structure */ 65 ddev_srv_initialize(&srv); 66 srv.ops = &amdm37x_ddev_ops; 67 srv.arg = dispc; 68 69 /* Handle connection */ 70 ddev_conn(icall, &srv); 71 } else { 72 assert(gc_id == 42); 73 74 rc = gfx_context_new(&amdm37x_gc_ops, dispc, &gc); 75 if (rc != EOK) 76 goto error; 77 78 /* GC connection */ 79 gc_conn(icall, gc); 80 } 81 82 return; 83 error: 84 async_answer_0(icall, rc); 52 vsl = (visualizer_t *) ddf_fun_data_get((ddf_fun_t *)arg); 53 graph_visualizer_connection(vsl, icall, NULL); 85 54 } 86 55 … … 88 57 { 89 58 assert(dev); 90 91 ddf_fun_t *fun = ddf_fun_create(dev, fun_exposed, " a");59 /* Visualizer part */ 60 ddf_fun_t *fun = ddf_fun_create(dev, fun_exposed, "viz"); 92 61 if (!fun) { 93 ddf_log_error("Failed to create display devicefunction.");62 ddf_log_error("Failed to create visualizer function."); 94 63 return ENOMEM; 95 64 } 96 65 97 ddf_fun_set_conn_handler(fun, &amdm37x_client_conn); 66 visualizer_t *vis = ddf_fun_data_alloc(fun, sizeof(visualizer_t)); 67 if (!vis) { 68 ddf_log_error("Failed to allocate visualizer structure."); 69 ddf_fun_destroy(fun); 70 return ENOMEM; 71 } 98 72 73 graph_init_visualizer(vis); 74 vis->reg_svc_handle = ddf_fun_get_handle(fun); 75 76 ddf_fun_set_conn_handler(fun, graph_vsl_connection); 99 77 /* Hw part */ 100 78 amdm37x_dispc_t *dispc = … … 106 84 } 107 85 108 errno_t rc = amdm37x_dispc_init(dispc, fun);86 errno_t rc = amdm37x_dispc_init(dispc, vis); 109 87 if (rc != EOK) { 110 88 ddf_log_error("Failed to init dispc: %s.", str_error(rc)); … … 122 100 } 123 101 124 rc = ddf_fun_add_to_category(fun, " display-device");102 rc = ddf_fun_add_to_category(fun, "visualizer"); 125 103 if (rc != EOK) { 126 ddf_log_error("Failed to add function: %s to display device"104 ddf_log_error("Failed to add function: %s to visualizer " 127 105 "category.", str_error(rc)); 128 106 amdm37x_dispc_fini(dispc);
Note:
See TracChangeset
for help on using the changeset viewer.