Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/usermode Use the encoding values of the VNC spec an...



details:   https://anonhg.NetBSD.org/src/rev/b784d99c509a
branches:  trunk
changeset: 772336:b784d99c509a
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Fri Dec 30 12:07:33 2011 +0000

description:
Use the encoding values of the VNC spec and add a copyrect (not used yet)

diffstat:

 sys/arch/usermode/include/thunk.h  |   8 ++++--
 sys/arch/usermode/usermode/thunk.c |  46 ++++++++++++++++++++++++++++++++-----
 2 files changed, 44 insertions(+), 10 deletions(-)

diffs (114 lines):

diff -r 68d094b5ddc1 -r b784d99c509a sys/arch/usermode/include/thunk.h
--- a/sys/arch/usermode/include/thunk.h Fri Dec 30 11:32:57 2011 +0000
+++ b/sys/arch/usermode/include/thunk.h Fri Dec 30 12:07:33 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.49 2011/12/30 11:32:57 reinoud Exp $ */
+/* $NetBSD: thunk.h,v 1.50 2011/12/30 12:07:33 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -192,11 +192,12 @@
 
 
 typedef struct {
-       uint8_t                 type;
+       uint8_t                 enc;
        uint16_t                x, y, w, h;
+       uint16_t                srcx, srcy;
        uint32_t                colour;         /* for RRE clear */
 } thunk_rfb_update_t;
-#define THUNK_RFB_TYPE_UPDATE  0
+#define THUNK_RFB_TYPE_RAW     0
 #define THUNK_RFB_TYPE_COPYRECT        1
 #define THUNK_RFB_TYPE_RRE     2               /* rectangle fill */
 
@@ -223,5 +224,6 @@
 int    thunk_rfb_open(thunk_rfb_t *, uint16_t);
 int    thunk_rfb_poll(thunk_rfb_t *, thunk_rfb_event_t *);
 void   thunk_rfb_update(thunk_rfb_t *, int, int, int, int);
+void   thunk_rfb_copyrect(thunk_rfb_t *, int, int, int, int, int, int);
 
 #endif /* !_ARCH_USERMODE_INCLUDE_THUNK_H */
diff -r 68d094b5ddc1 -r b784d99c509a sys/arch/usermode/usermode/thunk.c
--- a/sys/arch/usermode/usermode/thunk.c        Fri Dec 30 11:32:57 2011 +0000
+++ b/sys/arch/usermode/usermode/thunk.c        Fri Dec 30 12:07:33 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.61 2011/12/30 11:32:57 reinoud Exp $ */
+/* $NetBSD: thunk.c,v 1.62 2011/12/30 12:07:33 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifdef __NetBSD__
-__RCSID("$NetBSD: thunk.c,v 1.61 2011/12/30 11:32:57 reinoud Exp $");
+__RCSID("$NetBSD: thunk.c,v 1.62 2011/12/30 12:07:33 reinoud Exp $");
 #endif
 
 #include <sys/types.h>
@@ -1031,11 +1031,15 @@
                *(uint16_t *)p = htons(update->y);      p += 2;
                *(uint16_t *)p = htons(update->w);      p += 2;
                *(uint16_t *)p = htons(update->h);      p += 2;
-               *(uint32_t *)p = htonl(0);              p += 4; /* Raw enc */
+               *(uint32_t *)p = htonl(update->enc);    p += 4; /* Raw enc */
 
 #ifdef RFB_DEBUG
-               fprintf(stdout, "rfb:   [%u] x=%d y=%d w=%d h=%d\n",
-                   n, update->x, update->y, update->w, update->h);
+               fprintf(stdout, "rfb: [%u] enc %d, [%d, %d] - [%d, %d)",
+                   n, update->enc, update->x, update->y, update->w, update->h);
+               if (update->enc == THUNK_RFB_TYPE_COPYRECT)
+                       fprintf(stdout, " from [%d, %d]",
+                           update->srcx, update->srcy);
+               fprintf(stdout, "\n");
 #endif
 
                len = safe_send(rfb->clientfd, rfb_update, 12);
@@ -1202,15 +1206,43 @@
        }
 
 #ifdef RFB_DEBUG
-       fprintf(stdout, "rfb: queue slot %d, x=%d y=%d w=%d h=%d\n",
+       fprintf(stdout, "rfb: update queue slot %d, x=%d y=%d w=%d h=%d\n",
            rfb->nupdates, x, y, w, h);
 #endif
 
        /* add the update request to the queue */
        update = &rfb->update[rfb->nupdates++];
-       update->type = THUNK_RFB_TYPE_UPDATE;
+       update->enc = THUNK_RFB_TYPE_RAW;
        update->x = x;
        update->y = y;
        update->w = w;
        update->h = h;
 }
+
+void
+thunk_rfb_copyrect(thunk_rfb_t *rfb, int x, int y, int w, int h,
+       int srcx, int srcy)
+{
+       thunk_rfb_update_t *update = NULL;
+
+       /* if the queue is full, just return */
+       if (rfb->nupdates >= __arraycount(rfb->update))
+               return;
+
+#ifdef RFB_DEBUG
+       fprintf(stdout, "rfb: copyrect queue slot %d, x=%d y=%d w=%d h=%d\n",
+           rfb->nupdates, x, y, w, h);
+#endif
+
+       /* add the update request to the queue */
+       update = &rfb->update[rfb->nupdates++];
+       update->enc = THUNK_RFB_TYPE_COPYRECT;
+       update->x = x;
+       update->y = y;
+       update->w = w;
+       update->h = h;
+       update->srcx = srcx;
+       update->srcy = srcy;
+
+       rfb->first_mergable = rfb->nupdates+1;
+}



Home | Main Index | Thread Index | Old Index