Changeset 8565a42 in mainline for uspace/lib/graph


Ignore:
Timestamp:
2018-03-02T20:34:50Z (8 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1a81f69, d5e5fd1
Parents:
3061bc1 (diff), 34e1206 (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:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
git-committer:
GitHub <noreply@…> (2018-03-02 20:34:50)
Message:

Remove all trailing whitespace, everywhere.

See individual commit messages for details.

Location:
uspace/lib/graph
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/graph/graph.c

    r3061bc1 r8565a42  
    9191        snprintf(node, LOC_NAME_MAXLEN, "%s%zu/%s%zu", NAMESPACE,
    9292            namespace_idx, VISUALIZER_NAME, visualizer_idx++);
    93        
     93
    9494        category_id_t cat;
    9595        errno_t rc = loc_category_get_id("visualizer", &cat, 0);
    9696        if (rc != EOK)
    9797                return rc;
    98        
     98
    9999        rc = loc_service_register(node, &vs->reg_svc_handle);
    100100        if (rc != EOK)
    101101                return rc;
    102        
     102
    103103        rc = loc_service_add_to_cat(vs->reg_svc_handle, cat);
    104104        if (rc != EOK) {
     
    106106                return rc;
    107107        }
    108        
     108
    109109        fibril_mutex_lock(&visualizer_list_mtx);
    110110        list_append(&vs->link, &visualizer_list);
    111111        fibril_mutex_unlock(&visualizer_list_mtx);
    112        
     112
    113113        return rc;
    114114}
     
    119119        snprintf(node, LOC_NAME_MAXLEN, "%s%zu/%s%zu", NAMESPACE,
    120120            namespace_idx, RENDERER_NAME, renderer_idx++);
    121        
     121
    122122        category_id_t cat;
    123123        errno_t rc = loc_category_get_id("renderer", &cat, 0);
    124124        if (rc != EOK)
    125125                return rc;
    126        
     126
    127127        rc = loc_service_register(node, &rnd->reg_svc_handle);
    128128        if (rc != EOK)
    129129                return rc;
    130        
     130
    131131        rc = loc_service_add_to_cat(rnd->reg_svc_handle, cat);
    132132        if (rc != EOK) {
     
    134134                return rc;
    135135        }
    136        
     136
    137137        fibril_mutex_lock(&renderer_list_mtx);
    138138        list_append(&rnd->link, &renderer_list);
    139139        fibril_mutex_unlock(&renderer_list_mtx);
    140        
     140
    141141        return rc;
    142142}
     
    145145{
    146146        visualizer_t *vs = NULL;
    147        
     147
    148148        fibril_mutex_lock(&visualizer_list_mtx);
    149        
     149
    150150        list_foreach(visualizer_list, link, visualizer_t, vcur) {
    151151                if (vcur->reg_svc_handle == handle) {
     
    154154                }
    155155        }
    156        
     156
    157157        fibril_mutex_unlock(&visualizer_list_mtx);
    158        
     158
    159159        return vs;
    160160}
     
    163163{
    164164        renderer_t *rnd = NULL;
    165        
     165
    166166        fibril_mutex_lock(&renderer_list_mtx);
    167        
     167
    168168        list_foreach(renderer_list, link, renderer_t, rcur) {
    169169                if (rcur->reg_svc_handle == handle) {
     
    172172                }
    173173        }
    174        
     174
    175175        fibril_mutex_unlock(&renderer_list_mtx);
    176        
     176
    177177        return rnd;
    178178}
     
    184184        list_remove(&vs->link);
    185185        fibril_mutex_unlock(&visualizer_list_mtx);
    186        
     186
    187187        return rc;
    188188}
     
    194194        list_remove(&rnd->link);
    195195        fibril_mutex_unlock(&renderer_list_mtx);
    196        
     196
    197197        return rc;
    198198}
     
    207207        assert(vs->cells.data == NULL);
    208208        assert(vs->dev_ctx == NULL);
    209        
     209
    210210        free(vs);
    211211}
     
    215215        // TODO
    216216        assert(atomic_get(&rnd->ref_cnt) == 0);
    217        
     217
    218218        free(rnd);
    219219}
     
    224224        errno_t ret = async_req_2_0(exch, VISUALIZER_MODE_CHANGE, handle, mode_idx);
    225225        async_exchange_end(exch);
    226        
     226
    227227        return ret;
    228228}
     
    233233        errno_t ret = async_req_1_0(exch, VISUALIZER_DISCONNECT, handle);
    234234        async_exchange_end(exch);
    235        
     235
    236236        async_hangup(sess);
    237        
     237
    238238        return ret;
    239239}
     
    255255                }
    256256        }
    257        
     257
    258258        /* Driver might also deallocate resources for the current mode. */
    259259        errno_t rc = vs->ops.yield(vs);
    260        
     260
    261261        /* Now that the driver was given a chance to deallocate resources,
    262262         * current mode can be unset. */
    263263        if (vs->mode_set)
    264264                vs->mode_set = false;
    265        
     265
    266266        async_answer_0(iid, rc);
    267267}
     
    271271        ipc_callid_t callid;
    272272        size_t len;
    273        
     273
    274274        if (!async_data_read_receive(&callid, &len)) {
    275275                async_answer_0(callid, EREFUSED);
     
    277277                return;
    278278        }
    279        
     279
    280280        fibril_mutex_lock(&vs->mode_mtx);
    281281        link_t *link = list_nth(&vs->modes, IPC_GET_ARG1(*icall));
    282        
     282
    283283        if (link != NULL) {
    284284                vslmode_list_element_t *mode_elem =
    285285                    list_get_instance(link, vslmode_list_element_t, link);
    286                
     286
    287287                errno_t rc = async_data_read_finalize(callid, &mode_elem->mode, len);
    288288                async_answer_0(iid, rc);
     
    291291                async_answer_0(iid, ENOENT);
    292292        }
    293        
     293
    294294        fibril_mutex_unlock(&vs->mode_mtx);
    295295}
     
    299299        ipc_callid_t callid;
    300300        size_t len;
    301        
     301
    302302        if (!async_data_read_receive(&callid, &len)) {
    303303                async_answer_0(callid, EREFUSED);
     
    305305                return;
    306306        }
    307        
     307
    308308        fibril_mutex_lock(&vs->mode_mtx);
    309309        vslmode_list_element_t *mode_elem = NULL;
    310        
     310
    311311        list_foreach(vs->modes, link, vslmode_list_element_t, cur) {
    312312                if (cur->mode.index == vs->def_mode_idx) {
     
    315315                }
    316316        }
    317        
     317
    318318        if (mode_elem != NULL) {
    319319                errno_t rc = async_data_read_finalize(callid, &mode_elem->mode, len);
     
    324324                async_answer_0(iid, ENOENT);
    325325        }
    326        
     326
    327327        fibril_mutex_unlock(&vs->mode_mtx);
    328328}
     
    332332        ipc_callid_t callid;
    333333        size_t len;
    334        
     334
    335335        if (!async_data_read_receive(&callid, &len)) {
    336336                async_answer_0(callid, EREFUSED);
     
    338338                return;
    339339        }
    340        
     340
    341341        if (vs->mode_set) {
    342342                errno_t rc = async_data_read_finalize(callid, &vs->cur_mode, len);
     
    352352        ipc_callid_t callid;
    353353        size_t len;
    354        
     354
    355355        if (!async_data_read_receive(&callid, &len)) {
    356356                async_answer_0(callid, EREFUSED);
     
    358358                return;
    359359        }
    360        
     360
    361361        sysarg_t mode_idx = IPC_GET_ARG1(*icall);
    362        
     362
    363363        fibril_mutex_lock(&vs->mode_mtx);
    364364        vslmode_list_element_t *mode_elem = NULL;
    365        
     365
    366366        list_foreach(vs->modes, link, vslmode_list_element_t, cur) {
    367367                if (cur->mode.index == mode_idx) {
     
    370370                }
    371371        }
    372        
     372
    373373        if (mode_elem != NULL) {
    374374                errno_t rc = async_data_read_finalize(callid, &mode_elem->mode, len);
     
    378378                async_answer_0(iid, ENOENT);
    379379        }
    380        
     380
    381381        fibril_mutex_unlock(&vs->mode_mtx);
    382382}
     
    387387        size_t size;
    388388        unsigned int flags;
    389        
     389
    390390        /* Retrieve the shared cell storage for the new mode. */
    391391        if (!async_share_out_receive(&callid, &size, &flags)) {
     
    394394                return;
    395395        }
    396        
     396
    397397        /* Retrieve mode index and version. */
    398398        sysarg_t mode_idx = IPC_GET_ARG1(*icall);
    399399        sysarg_t mode_version = IPC_GET_ARG2(*icall);
    400        
     400
    401401        /* Find mode in the list. */
    402402        fibril_mutex_lock(&vs->mode_mtx);
    403403        vslmode_list_element_t *mode_elem = NULL;
    404        
     404
    405405        list_foreach(vs->modes, link, vslmode_list_element_t, cur) {
    406406                if (cur->mode.index == mode_idx) {
     
    409409                }
    410410        }
    411        
     411
    412412        if (mode_elem == NULL) {
    413413                fibril_mutex_unlock(&vs->mode_mtx);
     
    416416                return;
    417417        }
    418        
     418
    419419        /* Extract mode description from the list node. */
    420420        vslmode_t new_mode = mode_elem->mode;
    421421        fibril_mutex_unlock(&vs->mode_mtx);
    422        
     422
    423423        /* Check whether the mode is still up-to-date. */
    424424        if (new_mode.version != mode_version) {
     
    427427                return;
    428428        }
    429        
     429
    430430        void *new_cell_storage;
    431431        errno_t rc = async_share_out_finalize(callid, &new_cell_storage);
     
    434434                return;
    435435        }
    436        
     436
    437437        /* Change device internal state. */
    438438        rc = vs->ops.change_mode(vs, new_mode);
    439        
     439
    440440        /* Device driver could not establish new mode. Rollback. */
    441441        if (rc != EOK) {
     
    444444                return;
    445445        }
    446        
     446
    447447        /*
    448448         * Because resources for the new mode were successfully
     
    456456                }
    457457        }
    458        
     458
    459459        /* Insert new mode into the visualizer. */
    460460        vs->cells.width = new_mode.screen_width;
     
    463463        vs->cur_mode = new_mode;
    464464        vs->mode_set = true;
    465        
     465
    466466        async_answer_0(iid, EOK);
    467467}
     
    471471        sysarg_t x_offset = (IPC_GET_ARG5(*icall) >> 16);
    472472        sysarg_t y_offset = (IPC_GET_ARG5(*icall) & 0x0000ffff);
    473        
     473
    474474        errno_t rc = vs->ops.handle_damage(vs,
    475475            IPC_GET_ARG1(*icall), IPC_GET_ARG2(*icall),
     
    496496        ipc_call_t call;
    497497        ipc_callid_t callid;
    498        
     498
    499499        /* Claim the visualizer. */
    500500        if (!cas(&vs->ref_cnt, 0, 1)) {
     
    502502                return;
    503503        }
    504        
     504
    505505        /* Accept the connection. */
    506506        async_answer_0(iid, EOK);
    507        
     507
    508508        /* Establish callback session. */
    509509        callid = async_get_call(&call);
     
    513513        else
    514514                async_answer_0(callid, ELIMIT);
    515        
     515
    516516        /* Enter command loop. */
    517517        while (true) {
    518518                callid = async_get_call(&call);
    519                
     519
    520520                if (!IPC_GET_IMETHOD(call)) {
    521521                        async_answer_0(callid, EINVAL);
    522522                        break;
    523523                }
    524                
     524
    525525                switch (IPC_GET_IMETHOD(call)) {
    526526                case VISUALIZER_CLAIM:
     
    559559                }
    560560        }
    561        
     561
    562562terminate:
    563563        async_hangup(vs->notif_sess);
     
    570570{
    571571        // TODO
    572        
     572
    573573        ipc_call_t call;
    574574        ipc_callid_t callid;
    575        
     575
    576576        /* Accept the connection. */
    577577        atomic_inc(&rnd->ref_cnt);
    578578        async_answer_0(iid, EOK);
    579        
     579
    580580        /* Enter command loop. */
    581581        while (true) {
    582582                callid = async_get_call(&call);
    583                
     583
    584584                if (!IPC_GET_IMETHOD(call)) {
    585585                        async_answer_0(callid, EINVAL);
    586586                        break;
    587587                }
    588                
     588
    589589                switch (IPC_GET_IMETHOD(call)) {
    590590                default:
     
    593593                }
    594594        }
    595        
     595
    596596terminate:
    597597        atomic_dec(&rnd->ref_cnt);
     
    603603        visualizer_t *vs = graph_get_visualizer(IPC_GET_ARG2(*icall));
    604604        renderer_t *rnd = graph_get_renderer(IPC_GET_ARG2(*icall));
    605        
     605
    606606        if (vs != NULL)
    607607                graph_visualizer_connection(vs, iid, icall, arg);
  • uspace/lib/graph/graph.h

    r3061bc1 r8565a42  
    5555         * specific for a claimed visualizer. */
    5656        errno_t (*claim)(struct visualizer *vs);
    57        
     57
    5858        /**
    5959         * Device driver shall deallocate any necessary internal structures
     
    6262         * accordingly (e.g. deallocate frame buffers). */
    6363        errno_t (*yield)(struct visualizer *vs);
    64        
     64
    6565        /**
    6666         * Device driver shall first try to claim all resources required for
     
    7373         * changed at this point. */
    7474        errno_t (*change_mode)(struct visualizer *vs, vslmode_t new_mode);
    75        
     75
    7676        /**
    7777         * Device driver shall render the cells from damaged region into its
     
    8585            sysarg_t x, sysarg_t y, sysarg_t width, sysarg_t height,
    8686            sysarg_t x_offset, sysarg_t y_offset);
    87        
     87
    8888        /**
    8989         * Upper layers of the graphic stack might report inactivity. In such
     
    9191         * corresponding to the visualizer. */
    9292        errno_t (*suspend)(struct visualizer *vs);
    93        
     93
    9494        /**
    9595         * When upper layers detect activity on suspended visualizer, device
     
    107107         * Field is fully managed by libgraph. */
    108108        link_t link;
    109        
     109
    110110        /**
    111111         * When reference count equals 1, visualizer is claimed by a client,
     
    114114         * Field is fully managed by libgraph. */
    115115        atomic_t ref_cnt;
    116        
     116
    117117        /**
    118118         * Visualizer ID assigned by some particular registration service
     
    123123         * responsibility to set and update this field. */
    124124        sysarg_t reg_svc_handle;
    125        
     125
    126126        /**
    127127         * Visualizer ID in the client context. When client gets notified by
     
    132132         * gets claimed and is valid until it is yielded. */
    133133        sysarg_t client_side_handle;
    134        
     134
    135135        /**
    136136         * Callback session to the client. Established by libgraph during initial
     
    143143         * through notification functions. */
    144144        async_sess_t *notif_sess;
    145        
     145
    146146        /**
    147147         * Mutex protecting the mode list and default mode index. This is required
     
    152152         * modes list or default mode index. */
    153153        fibril_mutex_t mode_mtx;
    154        
     154
    155155        /**
    156156         * List of all modes that can be set by this visualizer. List is populated
     
    164164         * mutex. */
    165165        list_t modes;
    166        
     166
    167167        /**
    168168         * Index of the default mode. Might come in handy to the clients that are
     
    175175         * mutex. */
    176176        sysarg_t def_mode_idx;
    177        
     177
    178178        /**
    179179         * Copy of the currently established mode. It is read by both libgraph and
     
    183183         * Field is fully managed by libgraph, can be read by device driver. */
    184184        vslmode_t cur_mode;
    185        
     185
    186186        /**
    187187         * Determines whether the visualizer is currently set to some mode or not,
     
    189189         * Field is fully managed by libgraph, can be read by device driver. */
    190190        bool mode_set;
    191        
     191
    192192        /**
    193193         * Device driver function pointers.
     
    195195         * functions through it. */
    196196        visualizer_ops_t ops;
    197        
     197
    198198        /**
    199199         * Backbuffer shared with the client. Sharing is established by libgraph.
     
    202202         * Field is fully managed by libgraph, can be read by device driver. */
    203203        pixelmap_t cells;
    204        
     204
    205205        /**
    206206         * Device driver context, completely opaque to the libgraph. Intended to
     
    252252        // TODO
    253253        link_t link;
    254        
     254
    255255        atomic_t ref_cnt;
    256        
     256
    257257        sysarg_t reg_svc_handle;
    258        
     258
    259259        renderer_ops_t ops;
    260260} renderer_t;
Note: See TracChangeset for help on using the changeset viewer.