Changeset 7470d97 in mainline for uspace/drv/fb


Ignore:
Timestamp:
2021-04-30T15:05:06Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
051349b
Parents:
252d03c
Message:

Add GC operation to set clipping rectangle

The number of changed files is due to the proliferation of GC
implementations, mostly these are just dummies in unit tests.
Definitely need to tame those in the future.

Location:
uspace/drv/fb
Files:
3 edited

Legend:

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

    r252d03c r7470d97  
    11/*
    2  * Copyright (c) 2020 Jiri Svoboda
     2 * Copyright (c) 2021 Jiri Svoboda
    33 * Copyright (c) 2013 Jan Vesely
    44 * All rights reserved.
     
    6767static errno_t amdm37x_ddev_get_info(void *, ddev_info_t *);
    6868
     69static errno_t amdm37x_gc_set_clip_rect(void *, gfx_rect_t *);
    6970static errno_t amdm37x_gc_set_color(void *, gfx_color_t *);
    7071static errno_t amdm37x_gc_fill_rect(void *, gfx_rect_t *);
     
    8182
    8283gfx_context_ops_t amdm37x_gc_ops = {
     84        .set_clip_rect = amdm37x_gc_set_clip_rect,
    8385        .set_color = amdm37x_gc_set_color,
    8486        .fill_rect = amdm37x_gc_fill_rect,
     
    291293        dispc->rect.p1.x = x;
    292294        dispc->rect.p1.y = y;
     295        dispc->clip_rect = dispc->rect;
    293296        dispc->size = size;
    294297
     
    321324}
    322325
     326/** Set clipping rectangle on AMDM37x display controller.
     327 *
     328 * @param arg AMDM37x display controller
     329 * @param rect Rectangle
     330 *
     331 * @return EOK on success or an error code
     332 */
     333static errno_t amdm37x_gc_set_clip_rect(void *arg, gfx_rect_t *rect)
     334{
     335        amdm37x_dispc_t *dispc = (amdm37x_dispc_t *) arg;
     336
     337        if (rect != NULL)
     338                gfx_rect_clip(rect, &dispc->rect, &dispc->clip_rect);
     339        else
     340                dispc->clip_rect = dispc->rect;
     341
     342        return EOK;
     343}
     344
    323345/** Set color on AMDM37x display controller.
    324346 *
     
    354376
    355377        /* Make sure we have a sorted, clipped rectangle */
    356         gfx_rect_clip(rect, &dispc->rect, &crect);
     378        gfx_rect_clip(rect, &dispc->clip_rect, &crect);
    357379
    358380        for (y = crect.p0.y; y < crect.p1.y; y++) {
     
    479501        pbm.data = dcbm->alloc.pixels;
    480502
    481         /* Transform AMDM37x bounding rectangle back to bitmap coordinate system */
    482         gfx_rect_rtranslate(&offs, &dispc->rect, &skfbrect);
     503        /* Transform AMDM37x clipping rectangle back to bitmap coordinate system */
     504        gfx_rect_rtranslate(&offs, &dispc->clip_rect, &skfbrect);
    483505
    484506        /*
  • uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.h

    r252d03c r7470d97  
    11/*
    2  * Copyright (c) 2020 Jiri Svoboda
     2 * Copyright (c) 2021 Jiri Svoboda
    33 * Copyright (c) 2013 Jan Vesely
    44 * All rights reserved.
     
    6363        pixel_t color;
    6464        gfx_rect_t rect;
     65        gfx_rect_t clip_rect;
    6566        size_t size;
    6667        void *fb_data;
  • uspace/drv/fb/kfb/port.c

    r252d03c r7470d97  
    11/*
    2  * Copyright (c) 2019 Jiri Svoboda
     2 * Copyright (c) 2021 Jiri Svoboda
    33 * Copyright (c) 2006 Jakub Vana
    44 * Copyright (c) 2006 Ondrej Palkovsky
     
    6969        sysarg_t paddr;
    7070        gfx_rect_t rect;
     71        gfx_rect_t clip_rect;
    7172        size_t offset;
    7273        size_t scanline;
     
    9798static errno_t kfb_ddev_get_info(void *, ddev_info_t *);
    9899
     100static errno_t kfb_gc_set_clip_rect(void *, gfx_rect_t *);
    99101static errno_t kfb_gc_set_color(void *, gfx_color_t *);
    100102static errno_t kfb_gc_fill_rect(void *, gfx_rect_t *);
     
    111113
    112114static gfx_context_ops_t kfb_gc_ops = {
     115        .set_clip_rect = kfb_gc_set_clip_rect,
    113116        .set_color = kfb_gc_set_color,
    114117        .fill_rect = kfb_gc_fill_rect,
     
    134137        ddev_info_init(info);
    135138        info->rect = kfb->rect;
     139        return EOK;
     140}
     141
     142/** Set clipping rectangle on KFB.
     143 *
     144 * @param arg KFB
     145 * @param rect Rectangle or @c NULL
     146 *
     147 * @return EOK on success or an error code
     148 */
     149static errno_t kfb_gc_set_clip_rect(void *arg, gfx_rect_t *rect)
     150{
     151        kfb_t *kfb = (kfb_t *) arg;
     152
     153        if (rect != NULL)
     154                gfx_rect_clip(rect, &kfb->rect, &kfb->clip_rect);
     155        else
     156                kfb->clip_rect = kfb->rect;
     157
    136158        return EOK;
    137159}
     
    361383}
    362384
    363 #include <stdio.h>
    364385static void kfb_client_conn(ipc_call_t *icall, void *arg)
    365386{
     
    372393        kfb = (kfb_t *) ddf_fun_data_get((ddf_fun_t *) arg);
    373394
    374         printf("kfb_client_conn arg2=%lu arg3=%lu arg4=%lu\n",
    375             (unsigned long) ipc_get_arg2(icall),
    376             (unsigned long) ipc_get_arg3(icall),
    377             (unsigned long) ipc_get_arg4(icall));
    378 
    379395        gc_id = ipc_get_arg3(icall);
    380396
     
    500516        kfb->rect.p1.x = width;
    501517        kfb->rect.p1.y = height;
     518
     519        kfb->clip_rect = kfb->rect;
    502520
    503521        kfb->paddr = paddr;
Note: See TracChangeset for help on using the changeset viewer.