Changeset e79a025 in mainline for uspace/drv/fb/amdm37x_dispc/main.c


Ignore:
Timestamp:
2020-07-03T23:41:46Z (4 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fd11144
Parents:
edb57bc6 (diff), ddb844e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
jxsvoboda <5887334+jxsvoboda@…> (2020-07-03 23:41:46)
git-committer:
GitHub <noreply@…> (2020-07-03 23:41:46)
Message:

Merge pull request #200 from jxsvoboda/gfx

Display server

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/fb/amdm37x_dispc/main.c

    redb57bc6 re79a025  
    11/*
     2 * Copyright (c) 2020 Jiri Svoboda
    23 * Copyright (c) 2013 Jan Vesely
    34 * Copyright (c) 2011 Petr Koupy
     
    3536 */
    3637
     38#include <ddev_srv.h>
    3739#include <ddf/driver.h>
    3840#include <ddf/log.h>
    3941#include <errno.h>
     42#include <ipcgfx/server.h>
    4043#include <str_error.h>
    4144#include <stdio.h>
    42 #include <graph.h>
    4345
    4446#include "amdm37x_dispc.h"
     
    4648#define NAME  "amdm37x_dispc"
    4749
    48 static void graph_vsl_connection(ipc_call_t *icall, void *arg)
     50static void amdm37x_client_conn(ipc_call_t *icall, void *arg)
    4951{
    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;
    5157
    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;
     83error:
     84        async_answer_0(icall, rc);
    5485}
    5586
     
    5788{
    5889        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");
    6192        if (!fun) {
    62                 ddf_log_error("Failed to create visualizer function.");
     93                ddf_log_error("Failed to create display device function.");
    6394                return ENOMEM;
    6495        }
    6596
    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);
    7298
    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);
    7799        /* Hw part */
    78100        amdm37x_dispc_t *dispc =
     
    84106        }
    85107
    86         errno_t rc = amdm37x_dispc_init(dispc, vis);
     108        errno_t rc = amdm37x_dispc_init(dispc, fun);
    87109        if (rc != EOK) {
    88110                ddf_log_error("Failed to init dispc: %s.", str_error(rc));
     
    100122        }
    101123
    102         rc = ddf_fun_add_to_category(fun, "visualizer");
     124        rc = ddf_fun_add_to_category(fun, "display-device");
    103125        if (rc != EOK) {
    104                 ddf_log_error("Failed to add function: %s to visualizer "
     126                ddf_log_error("Failed to add function: %s to display device "
    105127                    "category.", str_error(rc));
    106128                amdm37x_dispc_fini(dispc);
Note: See TracChangeset for help on using the changeset viewer.