Changeset 2a515dcd in mainline for uspace/drv/fb/amdm37x_dispc/main.c
- Timestamp:
- 2020-02-25T10:47:32Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0e6e77f
- Parents:
- 265989d
- git-author:
- Jiri Svoboda <jiri@…> (2020-02-24 20:47:13)
- git-committer:
- Jiri Svoboda <jiri@…> (2020-02-25 10:47:32)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/fb/amdm37x_dispc/main.c
r265989d r2a515dcd 1 1 /* 2 * Copyright (c) 2020 Jiri Svoboda 2 3 * Copyright (c) 2013 Jan Vesely 3 4 * Copyright (c) 2011 Petr Koupy … … 35 36 */ 36 37 38 #include <ddev_srv.h> 37 39 #include <ddf/driver.h> 38 40 #include <ddf/log.h> 39 41 #include <errno.h> 42 #include <ipcgfx/server.h> 40 43 #include <str_error.h> 41 44 #include <stdio.h> 42 #include <graph.h>43 45 44 46 #include "amdm37x_dispc.h" … … 46 48 #define NAME "amdm37x_dispc" 47 49 48 static void graph_vsl_connection(ipc_call_t *icall, void *arg)50 static void amdm37x_client_conn(ipc_call_t *icall, void *arg) 49 51 { 50 visualizer_t *vsl; 52 amdm37x_dispc_t *dispc; 53 ddev_srv_t srv; 54 sysarg_t gc_id; 55 gfx_context_t *gc; 56 errno_t rc; 51 57 52 vsl = (visualizer_t *) ddf_fun_data_get((ddf_fun_t *)arg); 53 graph_visualizer_connection(vsl, icall, NULL); 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); 54 85 } 55 86 … … 57 88 { 58 89 assert(dev); 59 /* Visualizer part */ 60 ddf_fun_t *fun = ddf_fun_create(dev, fun_exposed, " viz");90 91 ddf_fun_t *fun = ddf_fun_create(dev, fun_exposed, "a"); 61 92 if (!fun) { 62 93 ddf_log_error("Failed to create visualizer function."); … … 64 95 } 65 96 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 } 97 ddf_fun_set_conn_handler(fun, &amdm37x_client_conn); 72 98 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);77 99 /* Hw part */ 78 100 amdm37x_dispc_t *dispc = … … 84 106 } 85 107 86 errno_t rc = amdm37x_dispc_init(dispc, vis);108 errno_t rc = amdm37x_dispc_init(dispc, fun); 87 109 if (rc != EOK) { 88 110 ddf_log_error("Failed to init dispc: %s.", str_error(rc)); … … 100 122 } 101 123 102 rc = ddf_fun_add_to_category(fun, " visualizer");124 rc = ddf_fun_add_to_category(fun, "display-device"); 103 125 if (rc != EOK) { 104 126 ddf_log_error("Failed to add function: %s to visualizer "
Note:
See TracChangeset
for help on using the changeset viewer.