summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2001-10-15 16:33:22 +0000
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-05-04 18:13:24 -0700
commit30392c1e635663e5b3eb5771d8ce4c852cada4b8 (patch)
tree969059d432863edb9ae608f90a20047c94c5902d
parent062412a066cc62635c1d1eb99999ee774775ca6f (diff)
downloadxscope-30392c1e635663e5b3eb5771d8ce4c852cada4b8.tar.gz
Add SHM decoding
-rw-r--r--Imakefile4
-rw-r--r--decode11.c16
-rw-r--r--decode_render.c26
-rw-r--r--print11.c4
-rw-r--r--print_randr.c20
-rw-r--r--print_render.c16
-rw-r--r--renderscope.h1
-rw-r--r--shmscope.h6
8 files changed, 86 insertions, 7 deletions
diff --git a/Imakefile b/Imakefile
index e0ecf64..4c8acd2 100644
--- a/Imakefile
+++ b/Imakefile
@@ -36,13 +36,13 @@
server.c fd.c common.c scope.c audio.c \
decode_lbx.c print_lbx.c printnas.c decodenas.c \
decode_wcp.c print_wcp.c decode_render.c print_render.c \
- decode_randr.c print_randr.c \
+ decode_randr.c print_randr.c decode_shm.c print_shm.c \
$(PEX_SRC)
OBJS = scope.o common.o fd.o server.o decode11.o \
table11.o print11.o prtype.o audio.o \
decode_lbx.o print_lbx.o printnas.o decodenas.o \
decode_wcp.o print_wcp.o decode_render.o print_render.o \
- decode_randr.o print_randr.o \
+ decode_randr.o print_randr.o decode_shm.o print_shm.o \
$(PEX_OBJ)
ComplexProgramTarget(xscope)
diff --git a/decode11.c b/decode11.c
index 9f51214..d19a74a 100644
--- a/decode11.c
+++ b/decode11.c
@@ -325,6 +325,11 @@ extern unsigned char LookForRANDRFlag;
extern unsigned char RANDRRequest;
extern unsigned char RANDREvent;
+extern unsigned char LookForMITSHMFlag;
+extern unsigned char MITSHMRequest;
+extern unsigned char MITSHMError;
+extern unsigned char MITSHMEvent;
+
DecodeRequest(fd, buf, n)
FD fd;
unsigned char *buf;
@@ -372,6 +377,8 @@ DecodeRequest(fd, buf, n)
render_decode_req(fd,buf);
} else if (Request == RANDRRequest) {
randr_decode_req(fd,buf);
+ } else if (Request == MITSHMRequest) {
+ mitshm_decode_req(fd,buf);
} else
{
ExtendedRequest(buf);
@@ -720,6 +727,9 @@ DecodeRequest(fd, buf, n)
if (strncmp("RANDR",(char *)&buf[8],6) == 0)
LookForRANDRFlag=1;
+ if (strncmp("MIT-SHM",(char *)&buf[8],7) == 0)
+ LookForMITSHMFlag=1;
+
ReplyExpected(fd, Request);
break;
case 99:
@@ -843,6 +853,8 @@ DecodeReply(fd, buf, n)
render_decode_reply(fd, buf, RequestMinor);
else if (Request == RANDRRequest)
randr_decode_reply(fd, buf, RequestMinor);
+ else if (Request == MITSHMRequest)
+ mitshm_decode_reply(fd, buf, RequestMinor);
else if (Request < 0 || 127 < Request)
warn("Extended reply opcode");
else switch (Request)
@@ -1008,6 +1020,8 @@ DecodeError(fd, buf, n)
wcp_decode_error(fd, buf);
else if (Error >= RENDERError && Error < RENDERError + RENDERNError)
render_decode_error(fd,buf);
+ else if (Error == MITSHMError)
+ mitshm_decode_error(fd, buf);
else if (Error < 1 || Error > 17)
warn("Extended Error code");
else switch (Error)
@@ -1101,6 +1115,8 @@ DecodeEvent(fd, buf, n)
lbx_decode_event (fd, buf);
else if (Event == RANDREvent)
randr_decode_event (fd, buf);
+ else if (Event == MITSHMEvent)
+ mitshm_decode_event (fd, buf);
else if (Event < 2 || Event > 34)
warn("Extended Event code");
else switch (Event)
diff --git a/decode_render.c b/decode_render.c
index 8f6252a..c0c379a 100644
--- a/decode_render.c
+++ b/decode_render.c
@@ -130,6 +130,28 @@ PrintPICTFORMAT(buf)
return(4);
}
+PrintPICTFORMINFO(buf)
+ unsigned char *buf;
+{
+ /* print a PictFormInfo */
+ long n = ILong(buf);
+ short t = IByte(buf+4);
+ short d = IByte(buf+5);
+
+ fprintf (stdout, "PICTFORMINFO %08x %s %d ",
+ n, t == 0 ? "Indexed" : "Direct", d);
+ if (t == 0) {
+ long c = ILong(buf+20);
+ fprintf (stdout, "cmap %08x", c);
+ } else {
+ short r = IShort(buf+8);
+ short g = IShort(buf+12);
+ short b = IShort(buf+16);
+ short a = IShort(buf+20);
+ fprintf (stdout, "%d %d %d %d", a, r, g, b);
+ }
+}
+
PrintGLYPHSET(buf)
unsigned char *buf;
{
@@ -200,11 +222,15 @@ InitializeRENDER(buf)
p = DefineType(RENDERREPLY, ENUMERATED, "RENDERREPLY", PrintENUMERATED);
DefineEValue (p, 0L, "QueryVersion");
+ DefineEValue (p, 1L, "QueryPictFormats");
+ DefineEValue (p, 2L, "QueryPictIndexValues");
+ DefineEValue (p, 3L, "QueryDithers");
DefineType(PICTURE, BUILTIN, "PICTURE", PrintPICTURE);
DefineType(PICTFORMAT, BUILTIN, "PICTFORMAT", PrintPICTFORMAT);
DefineType(GLYPHSET, BUILTIN, "GLYPHSET", PrintGLYPHSET);
DefineType(RENDERCOLOR, BUILTIN, "RENDERCOLOR", PrintRENDERCOLOR);
+ DefineType(PICTFORMINFO, BUILTIN, "PICTFORMINFO", PrintPICTFORMINFO);
p = DefineType(PICTURE_BITMASK, SET, "PICTURE_BITMASK", PrintSET);
diff --git a/print11.c b/print11.c
index 938bf10..ed9c994 100644
--- a/print11.c
+++ b/print11.c
@@ -3303,6 +3303,7 @@ QueryExtensionReply(buf)
extern unsigned char LookForWCPFlag;
extern unsigned char LookForRENDERFlag;
extern unsigned char LookForRANDRFlag;
+ extern unsigned char LookForMITSHMFlag;
#ifdef PEX
extern unsigned char LookForPEXFlag;
extern unsigned char PEXCode;
@@ -3326,6 +3327,9 @@ QueryExtensionReply(buf)
if (LookForRANDRFlag) {
InitializeRANDR(buf);
}
+ if (LookForMITSHMFlag) {
+ InitializeMITSHM(buf);
+ }
PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* QueryExtension */ ;
if (Verbose < 1)
return;
diff --git a/print_randr.c b/print_randr.c
index cc1b0c1..da2da74 100644
--- a/print_randr.c
+++ b/print_randr.c
@@ -70,13 +70,29 @@ RandrGetScreenInfoReply (FD fd, unsigned char *buf)
short n;
long m;
long k;
+ unsigned short nsize;
+ unsigned short nvg;
+ unsigned short ngvg;
+ unsigned short i;
PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* RandrRequest reply */ ;
- PrintField(RBf, 1, 1, RANDRREPLY, RANDRREPLYHEADER) /* RandrQueryVersion reply */;
if (Verbose < 1)
return;
+ PrintField(buf, 1, 1, CARD8, "set-of-rotations");
printfield(buf, 2, 2, CARD16, "sequence number");
printfield(buf, 4, 4, DVALUE4(0), "reply length");
+ PrintField(buf, 8, 4, WINDOW, "root");
+ PrintField(buf,12, 4, TIMESTAMP, "timestamp");
+ PrintField(buf,16, 4, TIMESTAMP, "config-timestamp");
+ PrintField(buf,20, 2, CARD16, "num-visual-groups");
+ nvg = IShort (&buf[20]);
+ PrintField(buf,22, 2, CARD16, "num-groups-of-visual-groups");
+ ngvg = IShort (&buf[22]);
+ PrintField(buf,24, 2, CARD16, "num-sizes");
+ nsize = IShort (&buf[24]);
+ PrintField(buf,26, 2, CARD16, "size-id");
+ PrintField(buf,28, 2, CARD16, "visual-group-id");
+ PrintField(buf,30, 2, CARD16, "rotation");
}
RandrSetScreenConfig (FD fd, unsigned char *buf)
@@ -101,7 +117,7 @@ RandrSetScreenConfigReply (FD fd, unsigned char *buf)
{
short n;
long m;
- long k;
+ long k;
PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* RandrRequest reply */ ;
PrintField(buf, 1, 1, BOOL, "success") /* RandrQueryVersion reply */;
diff --git a/print_render.c b/print_render.c
index f7cdab4..78956d2 100644
--- a/print_render.c
+++ b/print_render.c
@@ -65,9 +65,13 @@ RenderQueryPictFormats (FD fd, unsigned char *buf)
}
RenderQueryPictFormatsReply (FD fd, unsigned char *buf)
{
- short n;
- long m;
- long k;
+ long n;
+ long f;
+ long s;
+ long d;
+ long v;
+ long m;
+ long k;
PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* RenderRequest reply */ ;
PrintField(RBf, 1, 1, RENDERREPLY, RENDERREPLYHEADER) /* RenderQueryVersion reply */;
@@ -75,6 +79,12 @@ RenderQueryPictFormatsReply (FD fd, unsigned char *buf)
return;
printfield(buf, 2, 2, CARD16, "sequence number");
printfield(buf, 4, 4, DVALUE4(0), "reply length");
+ n = ILong (&buf[8]);
+ f = ILong (&buf[12]);
+ s = ILong (&buf[16]);
+ d = ILong (&buf[20]);
+ v = ILong (&buf[24]);
+ PrintList (&buf[32], (long) f, PICTFORMINFO, "pict-formats");
}
RenderQueryPictIndexValues (FD fd, unsigned char *buf)
{
diff --git a/renderscope.h b/renderscope.h
index 8a7fb3b..0f28673 100644
--- a/renderscope.h
+++ b/renderscope.h
@@ -11,6 +11,7 @@
#define PICTOP 138
#define GLYPHSET 139
#define RENDERCOLOR 140
+#define PICTFORMINFO 141
#define RENDERREQUESTHEADER "RENDERREQUEST"
#define RENDERREPLYHEADER "RENDERREPLY"
diff --git a/shmscope.h b/shmscope.h
index d898326..f2795da 100644
--- a/shmscope.h
+++ b/shmscope.h
@@ -1,6 +1,12 @@
#ifndef _MITSHMSCOPE_H_
#define _MITSHMSCOPE_H_
+#define MITSHMREQUEST 144
+#define MITSHMREPLY 145
+#define MITSHMEVENT 146
+#define MITSHMERROR 147
+
+
#define MITSHMREQUESTHEADER "MITSHMREQUEST"
#define MITSHMREPLYHEADER "MITSHMREPLY"