Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 5271e4c in mainline


Ignore:
Timestamp:
2020-06-22T12:20:42Z (2 weeks ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
195b7b3
Parents:
66a408f7
git-author:
Jiri Svoboda <jiri@…> (2020-06-21 15:20:18)
git-committer:
Jiri Svoboda <jiri@…> (2020-06-22 12:20:42)
Message:

Duplicate rendering to additional output devices using a cloning GC

This gives the display server a pretty good illusion of rendering to just
one output device, while supporting multiple. This makes RFB work properly.

Location:
uspace
Files:
4 added
8 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gfx/src/bitmap.c

    r66a408f7 r5271e4c  
    7777
    7878        rc = gc->ops->bitmap_create(gc->arg, params, alloc, &bm_priv);
    79         if (rc != EOK)
     79        if (rc != EOK) {
     80                free(bitmap);
    8081                return rc;
     82        }
    8183
    8284        bitmap->gc = gc;
  • uspace/lib/memgfx/src/memgc.c

    r66a408f7 r5271e4c  
    7070 * Set drawing color on memory GC.
    7171 *
    72  * @param arg Canvas GC
     72 * @param arg Memory GC
    7373 * @param color Color
    7474 *
     
    8787/** Fill rectangle on memory GC.
    8888 *
    89  * @param arg Canvas GC
     89 * @param arg Memory GC
    9090 * @param rect Rectangle
    9191 *
     
    166166/** Delete memory GC.
    167167 *
    168  * @param mgc Canvas GC
     168 * @param mgc Memory GC
    169169 */
    170170errno_t mem_gc_delete(mem_gc_t *mgc)
     
    195195/** Get generic graphic context from memory GC.
    196196 *
    197  * @param mgc Canvas GC
     197 * @param mgc Memory GC
    198198 * @return Graphic context
    199199 */
     
    210210/** Create bitmap in memory GC.
    211211 *
    212  * @param arg Canvas GC
     212 * @param arg Memory GC
    213213 * @param params Bitmap params
    214214 * @param alloc Bitmap allocation info or @c NULL
  • uspace/srv/hid/display/ddev.c

    r66a408f7 r5271e4c  
    141141        }
    142142
    143         rc = ds_display_paint_bg(display, NULL);
     143        rc = ds_display_paint(display, NULL);
    144144        if (rc != EOK)
    145145                return rc;
  • uspace/srv/hid/display/display.c

    r66a408f7 r5271e4c  
    4242#include <stdlib.h>
    4343#include "client.h"
     44#include "clonegc.h"
    4445#include "cursimg.h"
    4546#include "cursor.h"
     
    505506                disp->rect = ddev->info.rect;
    506507
     508                /* Create cloning GC */
     509                rc = ds_clonegc_create(ddev->gc, &disp->fbgc);
     510                if (rc != EOK) {
     511                        // XXX Remove output
     512                        return ENOMEM;
     513                }
     514
    507515                /* Allocate backbuffer */
    508516                rc = ds_display_alloc_backbuf(disp);
     517                if (rc != EOK) {
     518                        // XXX Remove output
     519                        // XXX Delete clone GC
     520                        goto error;
     521                }
     522        } else {
     523                /* Add new output device to cloning GC */
     524                rc = ds_clonegc_add_output(disp->fbgc, ddev->gc);
    509525                if (rc != EOK)
    510526                        goto error;
     
    596612static gfx_context_t *ds_display_get_unbuf_gc(ds_display_t *display)
    597613{
    598         ds_ddev_t *ddev;
    599 
    600         /*
    601          * XXX To properly support multiple display devices, create
    602          * a cloning GC that copies rendering operation to each output.
    603          */
    604         ddev = ds_display_first_ddev(display);
    605         if (ddev == NULL)
    606                 return NULL;
    607 
    608         return ddev->gc;
     614        /* In case of unit tests */
     615        if (display->fbgc == NULL)
     616                return NULL;
     617
     618        return ds_clonegc_get_ctx(display->fbgc);
    609619}
    610620
  • uspace/srv/hid/display/meson.build

    r66a408f7 r5271e4c  
    3131src = files(
    3232        'client.c',
     33        'clonegc.c',
    3334        'cursor.c',
    3435        'cursimg.c',
     
    4546test_src = files(
    4647        'client.c',
     48        'clonegc.c',
    4749        'cursimg.c',
    4850        'cursor.c',
     
    5254        'window.c',
    5355        'test/client.c',
     56        'test/clonegc.c',
    5457        'test/cursor.c',
    5558        'test/display.c',
  • uspace/srv/hid/display/test/main.c

    r66a408f7 r5271e4c  
    3232
    3333PCUT_IMPORT(client);
     34PCUT_IMPORT(clonegc);
    3435PCUT_IMPORT(cursor);
    3536PCUT_IMPORT(display);
  • uspace/srv/hid/display/types/display/display.h

    r66a408f7 r5271e4c  
    4545#include <types/display/cursor.h>
    4646#include "cursor.h"
     47#include "clonegc.h"
    4748#include "window.h"
    4849
     
    100101        mem_gc_t *bbgc;
    101102
     103        /** Frontbuffer (clone) GC */
     104        ds_clonegc_t *fbgc;
     105
    102106        /** Backbuffer dirty rectangle */
    103107        gfx_rect_t dirty_rect;
  • uspace/srv/hid/rfb/main.c

    r66a408f7 r5271e4c  
    110110        rfb->damage_rect.y = new_rect.p0.y;
    111111        rfb->damage_rect.width = new_rect.p1.x - new_rect.p0.x;
    112         rfb->damage_rect.height = new_rect.p1.y - new_rect.p1.y;
     112        rfb->damage_rect.height = new_rect.p1.y - new_rect.p0.y;
    113113}
    114114
Note: See TracChangeset for help on using the changeset viewer.