summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2002-01-01 07:51:45 +0000
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-05-04 18:14:08 -0700
commitaf92a00b953746d64e1394d1988e77ffc3142df8 (patch)
treee0a5eca7764d21cd0e22c7d3f490fb50d9d019e7
parent093842a5e11bb5c0fd17b51a6c037634b5a3a223 (diff)
downloadxscope-af92a00b953746d64e1394d1988e77ffc3142df8.tar.gz
Add (some) support for BIG-REQUESTS
-rw-r--r--Imakefile4
-rw-r--r--bigreqscope.h3
-rw-r--r--decode11.c18
-rw-r--r--decode_render.c1
-rw-r--r--print11.c9
-rw-r--r--print_render.c55
-rw-r--r--server.c39
-rw-r--r--x11.h2
8 files changed, 108 insertions, 23 deletions
diff --git a/Imakefile b/Imakefile
index 4c8acd2..827cb69 100644
--- a/Imakefile
+++ b/Imakefile
@@ -37,13 +37,13 @@
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_shm.c print_shm.c \
- $(PEX_SRC)
+ decode_bigreq.c print_bigreq.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_shm.o print_shm.o \
- $(PEX_OBJ)
+ decode_bigreq.o print_bigreq.o $(PEX_OBJ)
ComplexProgramTarget(xscope)
SpecialObjectRule(common.o,$(_NOOP_),$(SIGNAL_DEFINES))
diff --git a/bigreqscope.h b/bigreqscope.h
index 80648f1..a7c3456 100644
--- a/bigreqscope.h
+++ b/bigreqscope.h
@@ -1,6 +1,9 @@
#ifndef _BIGREQSCOPE_H_
#define _BIGREQSCOPE_H_
+#define BIGREQREQUEST 148
+#define BIGREQREPLY 149
+
#define BIGREQREQUESTHEADER "BIGREQREQUEST"
#define BIGREQREPLYHEADER "BIGREQREPLY"
diff --git a/decode11.c b/decode11.c
index d19a74a..4a163c1 100644
--- a/decode11.c
+++ b/decode11.c
@@ -330,6 +330,9 @@ extern unsigned char MITSHMRequest;
extern unsigned char MITSHMError;
extern unsigned char MITSHMEvent;
+extern unsigned char LookForBIGREQFlag;
+extern unsigned char BIGREQRequest;
+
DecodeRequest(fd, buf, n)
FD fd;
unsigned char *buf;
@@ -354,6 +357,12 @@ DecodeRequest(fd, buf, n)
}
SetIndentLevel(PRINTCLIENT);
+ if (IShort(&buf[2]) == 0 && CS[fd].bigreqEnabled)
+ {
+ memmove (buf + 4, buf, 4);
+ CS[fd].requestLen--;
+ buf += 4;
+ }
if (Verbose < 0)
{
SimpleDump (DUMP_REQUEST, fd, Request, RequestMinor, n);
@@ -379,9 +388,11 @@ DecodeRequest(fd, buf, n)
randr_decode_req(fd,buf);
} else if (Request == MITSHMRequest) {
mitshm_decode_req(fd,buf);
+ } else if (Request == BIGREQRequest) {
+ bigreq_decode_req(fd,buf);
} else
{
- ExtendedRequest(buf);
+ ExtendedRequest(fd, buf);
ReplyExpected(fd, Request);
}
} else switch (Request)
@@ -730,6 +741,9 @@ DecodeRequest(fd, buf, n)
if (strncmp("MIT-SHM",(char *)&buf[8],7) == 0)
LookForMITSHMFlag=1;
+ if (strncmp ("BIG-REQUESTS",(char *)&buf[8],12) == 0)
+ LookForBIGREQFlag=1;
+
ReplyExpected(fd, Request);
break;
case 99:
@@ -855,6 +869,8 @@ DecodeReply(fd, buf, n)
randr_decode_reply(fd, buf, RequestMinor);
else if (Request == MITSHMRequest)
mitshm_decode_reply(fd, buf, RequestMinor);
+ else if (Request == BIGREQRequest)
+ bigreq_decode_reply(fd, buf, RequestMinor);
else if (Request < 0 || 127 < Request)
warn("Extended reply opcode");
else switch (Request)
diff --git a/decode_render.c b/decode_render.c
index c0c379a..63e4bbd 100644
--- a/decode_render.c
+++ b/decode_render.c
@@ -150,6 +150,7 @@ PrintPICTFORMINFO(buf)
short a = IShort(buf+20);
fprintf (stdout, "%d %d %d %d", a, r, g, b);
}
+ return(28);
}
PrintGLYPHSET(buf)
diff --git a/print11.c b/print11.c
index ed9c994..67a8607 100644
--- a/print11.c
+++ b/print11.c
@@ -874,7 +874,8 @@ MappingNotifyEvent(buf)
/* Request and Reply Printing procedures */
-ExtendedRequest(buf)
+ExtendedRequest(fd, buf)
+ int fd;
unsigned char *buf;
{
short n;
@@ -885,7 +886,7 @@ ExtendedRequest(buf)
PrintField(SBf, 0, 4, CARD32, "sequence number");
PrintField(buf, 1, 1, CARD8, "minor opcode");
printfield (buf, 2, 2, DVALUE2(n-1), "request length");
- n = IShort(&buf[2]) - 1;
+ n = CS[fd].requestLen - 1;
(void) PrintList (&buf[4], n, CARD32, "data");
}
@@ -3304,6 +3305,7 @@ QueryExtensionReply(buf)
extern unsigned char LookForRENDERFlag;
extern unsigned char LookForRANDRFlag;
extern unsigned char LookForMITSHMFlag;
+ extern unsigned char LookForBIGREQFlag;
#ifdef PEX
extern unsigned char LookForPEXFlag;
extern unsigned char PEXCode;
@@ -3330,6 +3332,9 @@ QueryExtensionReply(buf)
if (LookForMITSHMFlag) {
InitializeMITSHM(buf);
}
+ if (LookForBIGREQFlag) {
+ InitializeBIGREQ(buf);
+ }
PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* QueryExtension */ ;
if (Verbose < 1)
return;
diff --git a/print_render.c b/print_render.c
index 78956d2..4e3aacb 100644
--- a/print_render.c
+++ b/print_render.c
@@ -79,11 +79,11 @@ 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]);
+ n = ILong (&buf[4]);
+ f = ILong (&buf[8]);
+ s = ILong (&buf[12]);
+ d = ILong (&buf[16]);
+ v = ILong (&buf[20]);
PrintList (&buf[32], (long) f, PICTFORMINFO, "pict-formats");
}
RenderQueryPictIndexValues (FD fd, unsigned char *buf)
@@ -295,6 +295,8 @@ RenderCreateGlyphSet (FD fd, unsigned char *buf)
PrintField(SBf, 0, 4, CARD32, "sequence number");
printfield(buf, 2, 2, CONST2(2), "request length");
+ PrintField(buf, 4, 4, GLYPHSET, "glyphset");
+ PrintField(buf, 8, 4, PICTFORMAT, "format");
}
RenderReferenceGlyphSet (FD fd, unsigned char *buf)
{
@@ -318,8 +320,37 @@ RenderFreeGlyphSet (FD fd, unsigned char *buf)
printfield(buf, 2, 2, CONST2(2), "request length");
}
+extern char Leader[];
+
+void
+PrintGlyphs(unsigned char *buf, int n, char *name)
+{
+ unsigned char *gids;
+ unsigned char *glyphs;
+ int i;
+
+ fprintf(stdout, "%s%20s:\n", Leader, name);
+ gids = buf;
+ glyphs = gids + 4 * n;
+ for (i = 0; i < n; i++)
+ {
+ PrintField(gids, 0, 4, CARD32, "glyphid");
+ PrintField(glyphs, 0, 2, CARD16, "width");
+ PrintField(glyphs, 2, 2, CARD16, "height");
+ PrintField(glyphs, 4, 2, INT16, "x");
+ PrintField(glyphs, 6, 2, INT16, "y");
+ PrintField(glyphs, 8, 2, INT16, "xOff");
+ PrintField(glyphs, 10, 2, INT16, "yOff");
+ glyphs += 12;
+ }
+}
+
RenderAddGlyphs (FD fd, unsigned char *buf)
{
+ long n;
+ long i;
+ long g;
+ long nb;
PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ;
PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ;
if (Verbose < 1)
@@ -327,7 +358,10 @@ RenderAddGlyphs (FD fd, unsigned char *buf)
if (Verbose > 1)
PrintField(SBf, 0, 4, CARD32, "sequence number");
- printfield(buf, 2, 2, CONST2(2), "request length");
+ PrintField(buf, 2, 2, CONST2(2), "request length");
+ PrintField(buf, 4, 4, GLYPHSET, "glyphset");
+ PrintField(buf, 8, 4, CARD32, "nglyphs");
+ PrintGlyphs(&buf[12], ILong(&buf[8]), "glyphs");
}
RenderAddGlyphsFromPicture (FD fd, unsigned char *buf)
{
@@ -339,6 +373,7 @@ RenderAddGlyphsFromPicture (FD fd, unsigned char *buf)
PrintField(SBf, 0, 4, CARD32, "sequence number");
printfield(buf, 2, 2, CONST2(2), "request length");
+
}
RenderFreeGlyphs (FD fd, unsigned char *buf)
{
@@ -400,7 +435,7 @@ RenderCompositeGlyphs8 (FD fd, unsigned char *buf)
PrintField(SBf, 0, 4, CARD32, "sequence number");
printfield(buf, 2, 2, CONST2(2), "request length");
- n = (IShort(&buf[2]) - 7) * 4;
+ n = (CS[fd].requestLen - 7) * 4;
PrintField(buf, 4, 1, PICTOP, "op");
PrintField(buf, 8, 4, PICTURE, "source");
PrintField(buf, 12, 4, PICTURE, "dest");
@@ -423,7 +458,7 @@ RenderCompositeGlyphs16 (FD fd, unsigned char *buf)
PrintField(SBf, 0, 4, CARD32, "sequence number");
printfield(buf, 2, 2, CONST2(2), "request length");
- n = (IShort(&buf[2]) - 7) * 4;
+ n = (CS[fd].requestLen - 7) * 4;
PrintField(buf, 4, 1, PICTOP, "op");
PrintField(buf, 8, 4, PICTURE, "source");
@@ -446,7 +481,7 @@ RenderCompositeGlyphs32 (FD fd, unsigned char *buf)
PrintField(SBf, 0, 4, CARD32, "sequence number");
printfield(buf, 2, 2, CONST2(2), "request length");
- n = (IShort(&buf[2]) - 7) * 4;
+ n = (CS[fd].requestLen - 7) * 4;
PrintField(buf, 4, 1, PICTOP, "op");
PrintField(buf, 8, 4, PICTURE, "source");
PrintField(buf, 12, 4, PICTURE, "dest");
@@ -467,7 +502,7 @@ RenderFillRectangles (FD fd, unsigned char *buf)
PrintField(SBf, 0, 4, CARD32, "sequence number");
printfield(buf, 2, 2, CONST2(2), "request length");
- n = (IShort(&buf[2]) - 5) / 2;
+ n = (CS[fd].requestLen - 5) / 2;
PrintField(buf, 4, 1, PICTOP, "op");
PrintField(buf, 8, 4, PICTURE, "dest");
PrintField(buf, 12, 8, RENDERCOLOR, "color");
diff --git a/server.c b/server.c
index 383a66b..d1bc769 100644
--- a/server.c
+++ b/server.c
@@ -489,23 +489,46 @@ long FinishSetUpMessage (fd, buf, n)
return(n);
}
+long StartBigRequest (fd, buf, n)
+ FD fd;
+ unsigned char *buf;
+ long n;
+{
+ enterprocedure("StartBigRequest");
+
+ /* bytes 0-3 are ignored now; bytes 4-8 tell us the request length */
+ CS[fd].requestLen = ILong(&buf[4]);
+ CS[fd].ByteProcessing = FinishRequest;
+ CS[fd].NumberofBytesNeeded = 4 * CS[fd].requestLen;
+ debug(8,(stderr, "need %d more bytes to finish request\n",
+ CS[fd].NumberofBytesNeeded - n));
+ StartStuff (fd);
+ return(0);
+}
long StartRequest (fd, buf, n)
FD fd;
unsigned char *buf;
long n;
{
- unsigned short requestlength;
enterprocedure("StartRequest");
/* bytes 0,1 are ignored now; bytes 2,3 tell us the request length */
- requestlength = IShort(&buf[2]);
- if (requestlength == 0)
- requestlength=0xffff;
- CS[fd].ByteProcessing = FinishRequest;
- CS[fd].NumberofBytesNeeded = 4 * requestlength;
- debug(8,(stderr, "need %d more bytes to finish request\n",
- CS[fd].NumberofBytesNeeded - n));
+ CS[fd].requestLen = IShort(&buf[2]);
+ if (CS[fd].requestLen == 0 && CS[fd].bigreqEnabled)
+ {
+ CS[fd].ByteProcessing = StartBigRequest;
+ CS[fd].NumberofBytesNeeded = 8;
+ }
+ else
+ {
+ if (CS[fd].requestLen == 0)
+ CS[fd].requestLen = 1;
+ CS[fd].ByteProcessing = FinishRequest;
+ CS[fd].NumberofBytesNeeded = 4 * CS[fd].requestLen;
+ debug(8,(stderr, "need %d more bytes to finish request\n",
+ CS[fd].NumberofBytesNeeded - n));
+ }
StartStuff (fd);
return(0);
}
diff --git a/x11.h b/x11.h
index 3b2ab00..a677eb0 100644
--- a/x11.h
+++ b/x11.h
@@ -430,6 +430,8 @@ struct ConnState
{
unsigned char *SavedBytes;
int littleEndian;
+ int bigreqEnabled;
+ long requestLen;
long SizeofSavedBytes;
long NumberofSavedBytes;