Re: RandR 1.4 restart

2011-03-09 Thread Pauli Nieminen
On Tue, Mar 8, 2011 at 4:13 PM, Soeren Sandmann sandm...@cs.au.dk wrote:
 James Jones jajo...@nvidia.com writes:

 Interesting.  I'm not really sold on the switch to InputOnly windows though.
 It sounds very elegant in theory, but I don't like the idea of apps needing 
 to
 use a separate codepath depending on whether a composite manager is running,
 and I'm not convinced it doesn't have other side effects.  I'll definitely
 have to give it some more thought though.

 It will require changes to the applications, yes. For GTK+ I think the
 main complication is the fact applications can create subwindows, and
 then ask for an XID for those subwindows. These applications will expect
 that XID to be an InputOutput window, which would be impossible if the
 toplevel was an InputOnly.

 This issue is not insurmountable though, since getting the XID for a
 GTK+ window is a rarely-used feature and increasingly considered
 somewhat deprecated.


 Soren

I think you are trying to create way too complex solution to simple
problem. Problem has been already solved in 80s by using double
buffering and swapping the buffers. Actually GL way of defining that
everything should look to application that swap buffers happened
immediately even tough it might take many milliseconds to complete the
swap. This kind of pipelining of all operations will make it a lot
easier to make everything flicker and tear free if driver is just
written correctly.

Then all modifications to windows, mode etc should be defined to take
effect on the next swap buffers. To make think easier in some cases
some operations might be defined to cause implicit swap buffers. For
example good definition for XCompositeUnredirectWindow(window
client_window, pixmap root/scanout, int mode) would be causes
pixmap to swap to window front buffer and any subsequent swap
buffers to window will swap window back buffer to pixmap

To support legacy  applications they would have to render to back
buffer or fake front. Buffer swap would be then implementation
detail that can happen based on timer or damaged area or what ever
heuristics makes legacy application look fairly good.

Pauli
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 2/3] dix: Shrink PropertyRec on LP64

2011-03-09 Thread Daniel Stone
On Tue, Mar 08, 2011 at 03:17:09PM -0500, Adam Jackson wrote:
 On Tue, 2011-03-08 at 19:37 +, Daniel Stone wrote:
  Being really pedantic again, can't these two be uint8_t or something?
  You've just grown format from 16 to 32 bytes. :P
 
 size pretty much needs to be uint32_t, MAX_BIG_REQUEST_SIZE is 4M so
 even if you're using format32 you're looking at (1  20).  Once you've
 got that, you're sticking format between two uint32_t, so making it
 uint8_t would just give you 24 bits of hole.
 
 If you really wanted to assume too much about bigreq sizing and/or throw
 BadAlloc on excessively large properties, you could probably smash
 format into the high bits of size, which would take you from 28 to 24
 bytes per on ILP32, but wouldn't win you anything on LP64 (either you'd
 be making a hole so the pointers are aligned, or you'd move it to the
 end of the struct and still have padding off the end due to ABI rules).
 
 Which seems... a little dirty, but if someone really wants that memory
 back, I guess that's a thing we could do.

Fair play -- have my R-b.  You've earned it. ;)

Cheers,
Daniel


signature.asc
Description: Digital signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xrandr] xrandr: dump configuration in parsable format

2011-03-09 Thread Stefan Tomanek
This patch adds the command line switch --dump to the xrandr program.
When specified, xrandr outputs the current display configuration in an
easily parsable format similar to the command line options accepted by
xrandr itself. That way, an existing configuration can easily be saved
and restored later.

Signed-off-by: Stefan Tomanek stefan.toma...@wertarbyte.de
---
 man/xrandr.man |3 +++
 xrandr.c   |   55 ---
 2 files changed, 43 insertions(+), 15 deletions(-)

diff --git a/man/xrandr.man b/man/xrandr.man
index ba36ae3..41f4332 100644
--- a/man/xrandr.man
+++ b/man/xrandr.man
@@ -26,6 +26,7 @@ xrandr \- primitive command line interface to RandR extension
 .B xrandr
 [\-help]  [\-display \fIdisplay\fP]
 [\-q] [\-v]
+[\-\-dump]
 [\-\-verbose]
 [\-\-dryrun]
 [\-\-screen \fIsnum\fP]
@@ -110,6 +111,8 @@ reported while executing the configuration changes.
 .IP \-q, \-\-query
 When this option is present, or when no configuration changes are requested,
 xrandr will display the current state of the system.
+.IP \-\-dump
+Dump the current display configuration in an easily parsable format.
 .IP \-\-dryrun
 Performs all the actions specified except that no changes are made.
 .IP \-\-nograb
diff --git a/xrandr.c b/xrandr.c
index 558fa45..df288e6 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -141,6 +141,7 @@ usage(void)
 fprintf(stderr,   --rmmode name\n);
 fprintf(stderr,   --addmode output name\n);
 fprintf(stderr,   --delmode output name\n);
+fprintf(stderr,   --dump\n);
 
 exit(1);
 /*NOTREACHED*/
@@ -2161,6 +2162,7 @@ main (int argc, char **argv)
 Bool   modeit = False;
 Bool   propit = False;
 Bool   query_1 = False;
+Bool   dump = False;
 intmajor, minor;
 Bool   current = False;
 
@@ -2252,6 +2254,10 @@ main (int argc, char **argv)
query = True;
continue;
}
+   if (!strcmp (--dump, argv[i])) {
+   dump = True;
+   continue;
+   }
if (!strcmp (-o, argv[i]) || !strcmp (--orientation, argv[i])) {
char *endptr;
if (++i=argc) usage ();
@@ -2919,11 +2925,13 @@ main (int argc, char **argv)
get_screen (current);
get_crtcs ();
get_outputs ();
-
-printf (Screen %d: minimum %d x %d, current %d x %d, maximum %d x 
%d\n,
+   if (!dump)
+   {
+   printf (Screen %d: minimum %d x %d, current %d x %d, maximum %d x 
%d\n,
screen, minWidth, minHeight,
DisplayWidth (dpy, screen), DisplayHeight(dpy, screen),
maxWidth, maxHeight);
+   }
 
for (output = outputs; output; output = output-next)
{
@@ -2936,28 +2944,38 @@ main (int argc, char **argv)
Bool*mode_shown;
Rotationrotations = output_rotations (output);
 
-   printf (%s %s, output_info-name, 
connection[output_info-connection]);
+   printf ( dump ? output %s\n : %s %s, output_info-name, 
connection[output_info-connection]);
+   if (dump  output_is_primary(output))
+   {
+   printf( primary\n );
+   }
+
if (mode)
{
if (crtc_info) {
-   printf ( %dx%d+%d+%d,
+   printf ( dump ? mode %dx%d\npos %dx%d\n :  %dx%d+%d+%d,
crtc_info-width, crtc_info-height,
crtc_info-x, crtc_info-y);
} else {
-   printf ( %dx%d+%d+%d,
-   mode-width, mode-height, output-x, output-y);
+   printf ( dump ? mode %dx%d\npos %dx%d\n :  %dx%d+%d+%d,
+   mode-width, mode-height, output-x, output-y);
}
-   if (verbose)
+   if (verbose  !dump)
printf ( (0x%x), (int)mode-id);
-   if (output-rotation != RR_Rotate_0 || verbose)
+   if (output-rotation != RR_Rotate_0 || verbose || dump)
{
-   printf ( %s, 
+   printf ( dump ? rotate %s\n :  %s,
rotation_name (output-rotation));
if (output-rotation  (RR_Reflect_X|RR_Reflect_Y))
-   printf ( %s, reflection_name (output-rotation));
+   printf ( dump ? reflect %s\n :  %s, reflection_name 
(output-rotation));
+   }
+   } else {
+   if (dump)
+   {
+   printf( off\n );
}
}
-   if (rotations != RR_Rotate_0 || verbose)
+   if (!dump  (rotations != RR_Rotate_0 || verbose))
{
Boolfirst = True;
printf ( ();
@@ -2981,7 +2999,7 @@ main (int argc, char **argv)
printf ());
}
 
-   if (mode)
+   if (!dump  mode)
{
  

[PATCH] [xorg/xserver] mi/misprite: release private record

2011-03-09 Thread Erkki Seppälä
The record allocated by miSpriteDeviceCursorInitialize was not being
released. This patch adds a call to free and resetting the private
record to miSpriteDeviceCursorCleanup.

Reviewed-by: Rami Ylimäki rami.ylim...@vincit.fi
Signed-off-by: Erkki Seppälä erkki.sepp...@vincit.fi
---
 mi/misprite.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/mi/misprite.c b/mi/misprite.c
index 770951e..0306f62 100644
--- a/mi/misprite.c
+++ b/mi/misprite.c
@@ -892,6 +892,9 @@ miSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr 
pScreen)
 {
 if (DevHasCursor(pDev))
 miDCDeviceCleanup(pDev, pScreen);
+
+free(dixLookupPrivate(pDev-devPrivates, miSpriteDevPrivatesKey));
+dixSetPrivate(pDev-devPrivates, miSpriteDevPrivatesKey, NULL);
 }
 
 /*
-- 
1.7.0.4

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver] xkb: Initialize pad bytes sent in replies of geometry requests.

2011-03-09 Thread Rami Ylimäki
Valgrind complains about uninitialized data being written to clients.

Reviewed-by: Erkki Seppälä erkki.sepp...@vincit.fi
Signed-off-by: Rami Ylimäki rami.ylim...@vincit.fi
---
 xkb/xkb.c |   12 +---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/xkb/xkb.c b/xkb/xkb.c
index 8d61e01..39dbab4 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -4305,7 +4305,7 @@ ProcXkbSetNames(ClientPtr client)
 static char *
 XkbWriteCountedString(char *wire,char *str,Bool swap)
 {
-CARD16 len,*pLen;
+CARD16 len,*pLen, paddedLen;
 
 if (!str)
 return wire;
@@ -4317,8 +4317,9 @@ XkbWriteCountedString(char *wire,char *str,Bool swap)
register int n;
swaps(pLen,n);
 }
-memcpy(wire[2],str,len);
-wire+= ((2+len+3)/4)*4;
+paddedLen= pad_to_int32(sizeof(len)+len)-sizeof(len);
+strncpy(wire[sizeof(len)],str,paddedLen);
+wire+= sizeof(len)+paddedLen;
 return wire;
 }
 
@@ -4429,6 +4430,7 @@ xkbShapeWireDesc *shapeWire;
if (shape-approx!=NULL)
 shapeWire-approxNdx= XkbOutlineIndex(shape,shape-approx);
else shapeWire-approxNdx= XkbNoShape;
+   shapeWire-pad= 0;
if (swap) {
register int n;
swapl(shapeWire-name,n);
@@ -4441,6 +4443,7 @@ xkbShapeWireDesc *shapeWire;
olWire= (xkbOutlineWireDesc *)wire;
olWire-nPoints= ol-num_points;
olWire-cornerRadius= ol-corner_radius;
+   olWire-pad= 0;
wire= (char *)olWire[1];
ptWire= (xkbPointWireDesc *)wire;
for (p=0,pt=ol-points;pol-num_points;p++,pt++) {
@@ -4554,6 +4557,8 @@ xkbOverlayWireDesc *  olWire;
olWire= (xkbOverlayWireDesc *)wire;
olWire-name= ol-name;
olWire-nRows= ol-num_rows;
+   olWire-pad1= 0;
+   olWire-pad2= 0;
if (swap) {
register int n;
swapl(olWire-name,n);
@@ -4566,6 +4571,7 @@ xkbOverlayWireDesc *  olWire;
rowWire= (xkbOverlayRowWireDesc *)wire;
rowWire-rowUnder= row-row_under;
rowWire-nKeys= row-num_keys;
+   rowWire-pad1= 0;
wire= (char *)rowWire[1];
for (k=0,key=row-keys;krow-num_keys;k++,key++) {
xkbOverlayKeyWireDesc * keyWire;
-- 
1.6.3.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] xkb: Initialize pad bytes sent in replies of geometry requests.

2011-03-09 Thread Daniel Stone
On Wed, Mar 09, 2011 at 03:45:40PM +0200, Rami Ylimäki wrote:
 Valgrind complains about uninitialized data being written to clients.
 
 Reviewed-by: Erkki Seppälä erkki.sepp...@vincit.fi
 Signed-off-by: Rami Ylimäki rami.ylim...@vincit.fi

Reviewed-by: Daniel Stone dan...@fooishbar.org


signature.asc
Description: Digital signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH] [xorg/xserver] mi/misprite: release private record

2011-03-09 Thread Daniel Stone
Hi,

On Wed, Mar 09, 2011 at 03:42:14PM +0200, Erkki Seppälä wrote:
 The record allocated by miSpriteDeviceCursorInitialize was not being
 released. This patch adds a call to free and resetting the private
 record to miSpriteDeviceCursorCleanup.
 
 Reviewed-by: Rami Ylimäki rami.ylim...@vincit.fi
 Signed-off-by: Erkki Seppälä erkki.sepp...@vincit.fi
 ---
  mi/misprite.c |3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)
 
 diff --git a/mi/misprite.c b/mi/misprite.c
 index 770951e..0306f62 100644
 --- a/mi/misprite.c
 +++ b/mi/misprite.c
 @@ -892,6 +892,9 @@ miSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr 
 pScreen)
  {
  if (DevHasCursor(pDev))
  miDCDeviceCleanup(pDev, pScreen);
 +
 +free(dixLookupPrivate(pDev-devPrivates, miSpriteDevPrivatesKey));
 +dixSetPrivate(pDev-devPrivates, miSpriteDevPrivatesKey, NULL);
  }

You could get this automatically by having miSpriteDevPrivatesKey
allocate sizeof(miCursorInfoRec), rather than doing the allocation and
free separately.

Cheers,
Daniel


signature.asc
Description: Digital signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 1/1] randr: avoid rrGetScreenResources replying with uninitialized bytes.

2011-03-09 Thread Oliver McFadden
==== Syscall param writev(vector[...]) points to uninitialised byte(s)
====at 0x4AB7054: writev (writev.c:51)
====by 0x5E237: _XSERVTransWritev (Xtrans.c:912)
====by 0x6154B: FlushClient (io.c:937)
====by 0x61FFF: FlushAllOutput (io.c:681)
====by 0x26BF3: Dispatch (dispatch.c:453)
====by 0x205E7: main (main.c:291)
====  Address 0x5525c70 is 632 bytes inside a block of size 4,096 alloc'd
====at 0x48334A4: calloc (vg_replace_malloc.c:467)
====by 0x61E23: WriteToClient (io.c:1078)
====by 0x21517: ProcEstablishConnection (dispatch.c:3685)
====by 0x26CEB: Dispatch (dispatch.c:432)
====by 0x205E7: main (main.c:291)
====  Uninitialised value was created by a stack allocation
====at 0xCA4E0: rrGetScreenResources (rrscreen.c:313)

Signed-off-by: Oliver McFadden oliver.mcfad...@nokia.com
---
 randr/rrscreen.c |9 +
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 1bc1a9e..d27a384 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -331,23 +331,18 @@ rrGetScreenResources(ClientPtr client, Bool query)
 
 pScreen = pWin-drawable.pScreen;
 pScrPriv = rrGetScrPriv(pScreen);
-rep.pad = 0;
 
 if (query  pScrPriv)
if (!RRGetInfo (pScreen, query))
return BadAlloc;
 
+memset (rep, 0, sizeof (xRRGetScreenResourcesReply));
 if (!pScrPriv)
 {
rep.type = X_Reply;
rep.sequenceNumber = client-sequence;
-   rep.length = 0;
rep.timestamp = currentTime.milliseconds;
rep.configTimestamp = currentTime.milliseconds;
-   rep.nCrtcs = 0;
-   rep.nOutputs = 0;
-   rep.nModes = 0;
-   rep.nbytesNames = 0;
extra = NULL;
extraLen = 0;
 }
@@ -362,13 +357,11 @@ rrGetScreenResources(ClientPtr client, Bool query)

rep.type = X_Reply;
rep.sequenceNumber = client-sequence;
-   rep.length = 0;
rep.timestamp = pScrPriv-lastSetTime.milliseconds;
rep.configTimestamp = pScrPriv-lastConfigTime.milliseconds;
rep.nCrtcs = pScrPriv-numCrtcs;
rep.nOutputs = pScrPriv-numOutputs;
rep.nModes = num_modes;
-   rep.nbytesNames = 0;
 
for (i = 0; i  num_modes; i++)
rep.nbytesNames += modes[i]-mode.nameLength;
-- 
1.7.1.245.g7c42e

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 1/1] randr: avoid rrGetScreenResources replying with uninitialized bytes.

2011-03-09 Thread Daniel Stone
On Wed, Mar 09, 2011 at 04:02:11PM +0200, Oliver McFadden wrote:
 ==== Syscall param writev(vector[...]) points to uninitialised byte(s)
 ====at 0x4AB7054: writev (writev.c:51)
 ====by 0x5E237: _XSERVTransWritev (Xtrans.c:912)
 ====by 0x6154B: FlushClient (io.c:937)
 ====by 0x61FFF: FlushAllOutput (io.c:681)
 ====by 0x26BF3: Dispatch (dispatch.c:453)
 ====by 0x205E7: main (main.c:291)
 ====  Address 0x5525c70 is 632 bytes inside a block of size 4,096 alloc'd
 ====at 0x48334A4: calloc (vg_replace_malloc.c:467)
 ====by 0x61E23: WriteToClient (io.c:1078)
 ====by 0x21517: ProcEstablishConnection (dispatch.c:3685)
 ====by 0x26CEB: Dispatch (dispatch.c:432)
 ====by 0x205E7: main (main.c:291)
 ====  Uninitialised value was created by a stack allocation
 ====at 0xCA4E0: rrGetScreenResources (rrscreen.c:313)
 
 Signed-off-by: Oliver McFadden oliver.mcfad...@nokia.com

Reviewed-by: Daniel Stone dan...@fooishbar.org


signature.asc
Description: Digital signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH] [xorg/xserver] mi/misprite: release private record

2011-03-09 Thread Erkki Seppala

On 09.03.2011 15:57, Daniel Stone wrote:

You could get this automatically by having miSpriteDevPrivatesKey
allocate sizeof(miCursorInfoRec), rather than doing the allocation and
free separately.


Thanks for the feedback!

I considered this with Rami, but it appeared that it uses the NULLness 
of the pointer for making a decision. In file misprite.c:


#define MISPRITE(dev) \
((!IsMaster(dev)  !dev-u.master) ? \
   (miCursorInfoPtr)dixLookupPrivate(dev-devPrivates, 
miSpriteDevPrivatesKey) : \
   (miCursorInfoPtr)dixLookupPrivate((GetMaster(dev, 
MASTER_POINTER))-devPrivates, miSpriteDevPrivatesKey))


..

static void
miSpriteBlockHandler (int i, pointer blockData, pointer pTimeout,
  pointer pReadmask)
{ ..
for(pDev = inputInfo.devices; pDev; pDev = pDev-next)
{
if (DevHasCursor(pDev))
{
pCursorInfo = MISPRITE(pDev);
if (pCursorInfo  !pCursorInfo-isUp
 pCursorInfo-pScreen == pScreen
 pCursorInfo-shouldBeUp)
{
SPRITE_DEBUG ((BlockHandler save));
miSpriteSaveUnderCursor (pDev, pScreen);
}
}
}

So at least this code is prepared to handle the case that the privates 
are not allocated. Is this something that can never actually happen, and 
therefore one could just use the automated mechanism?


(I guess I should've mentioned this in the commit message already ;-).)
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH] [xorg/xserver] mi/misprite: release private record

2011-03-09 Thread Daniel Stone
Hi,

On Wed, Mar 09, 2011 at 04:19:06PM +0200, Erkki Seppala wrote:
 On 09.03.2011 15:57, Daniel Stone wrote:
 You could get this automatically by having miSpriteDevPrivatesKey
 allocate sizeof(miCursorInfoRec), rather than doing the allocation and
 free separately.
 
 Thanks for the feedback!
 
 I considered this with Rami, but it appeared that it uses the
 NULLness of the pointer for making a decision. In file misprite.c:

 [...]
 
 pCursorInfo = MISPRITE(pDev);
 if (pCursorInfo  !pCursorInfo-isUp
  pCursorInfo-pScreen == pScreen
  pCursorInfo-shouldBeUp)
 {
 [...]
 }
 
 So at least this code is prepared to handle the case that the
 privates are not allocated. Is this something that can never
 actually happen, and therefore one could just use the automated
 mechanism?
 
 (I guess I should've mentioned this in the commit message already ;-).)

Heh.  Well, if you allocate space with the private key it comes
pre-calloced, so pCursorInfo-shouldBeUp will never be true, and
pCursorInfo-pScreen will never match.

Cheers,
Daniel


signature.asc
Description: Digital signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v2] [xorg/xserver] mi/misprite: use memory management provided by dixRegisterPrivateKey

2011-03-09 Thread Erkki Seppälä
The record allocated by miSpriteDeviceCursorInitialize was not being
released.

This patch makes misprite use dixRegisterPrivateKey with the record
size argument, which handles the memory management
issues. miSpriteDeviceCursorInitialize is restructured to initialize
pCursorInfo only if miDCDeviceInitialize succeeds. The record itself
is zeroed on cleanup to ensure that the assumptions in the code still
hold.

Reviewed-by: Rami Ylimäki rami.ylim...@vincit.fi
Signed-off-by: Erkki Seppälä erkki.sepp...@vincit.fi
---
 mi/misprite.c |   41 +++--
 1 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/mi/misprite.c b/mi/misprite.c
index 770951e..c9d0180 100644
--- a/mi/misprite.c
+++ b/mi/misprite.c
@@ -308,7 +308,7 @@ miSpriteInitialize (ScreenPtr   pScreen,
 if (!dixRegisterPrivateKey(miSpriteScreenKeyRec, PRIVATE_SCREEN, 0))
return FALSE;
 
-if (!dixRegisterPrivateKey(miSpriteDevPrivatesKeyRec, PRIVATE_DEVICE, 0))
+if (!dixRegisterPrivateKey(miSpriteDevPrivatesKeyRec, PRIVATE_DEVICE, 
sizeof(miCursorInfoRec)))
return FALSE;
 
 pScreenPriv = malloc(sizeof (miSpriteScreenRec));
@@ -860,38 +860,35 @@ miSpriteMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, 
int x, int y)
 static Bool
 miSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
 {
-miCursorInfoPtr pCursorInfo;
-int ret = FALSE;
-
-pCursorInfo = malloc(sizeof(miCursorInfoRec));
-if (!pCursorInfo)
-return FALSE;
-
-pCursorInfo-pCursor = NULL;
-pCursorInfo-x = 0;
-pCursorInfo-y = 0;
-pCursorInfo-isUp = FALSE;
-pCursorInfo-shouldBeUp = FALSE;
-pCursorInfo-pCacheWin = NullWindow;
-pCursorInfo-isInCacheWin = FALSE;
-pCursorInfo-checkPixels = TRUE;
-pCursorInfo-pScreen = FALSE;
+int ret = miDCDeviceInitialize(pDev, pScreen);
 
-ret = miDCDeviceInitialize(pDev, pScreen);
-if (!ret)
+if (ret)
 {
-free(pCursorInfo);
-pCursorInfo = NULL;
+miCursorInfoPtr pCursorInfo;
+pCursorInfo = dixLookupPrivate(pDev-devPrivates, 
miSpriteDevPrivatesKey);
+pCursorInfo-pCursor = NULL;
+pCursorInfo-x = 0;
+pCursorInfo-y = 0;
+pCursorInfo-isUp = FALSE;
+pCursorInfo-shouldBeUp = FALSE;
+pCursorInfo-pCacheWin = NullWindow;
+pCursorInfo-isInCacheWin = FALSE;
+pCursorInfo-checkPixels = TRUE;
+pCursorInfo-pScreen = FALSE;
 }
-dixSetPrivate(pDev-devPrivates, miSpriteDevPrivatesKey, pCursorInfo);
+
 return ret;
 }
 
 static void
 miSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
 {
+miCursorInfoPtr pCursorInfo = dixLookupPrivate(pDev-devPrivates, 
miSpriteDevPrivatesKey);
+
 if (DevHasCursor(pDev))
 miDCDeviceCleanup(pDev, pScreen);
+
+memset(pCursorInfo, 0, sizeof(miCursorInfoRec));
 }
 
 /*
-- 
1.7.0.4

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH v2] [xorg/xserver] mi/misprite: use memory management provided by dixRegisterPrivateKey

2011-03-09 Thread Erkki Seppala
Oops, I intended to send this to you instead of just Keith and the list 
- too fast with command line history - I hope you notice it at least 
this way.

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH v2] [xorg/xserver] mi/misprite: use memory management provided by dixRegisterPrivateKey

2011-03-09 Thread Daniel Stone
Hi,

On Wed, Mar 09, 2011 at 05:29:14PM +0200, Erkki Seppälä wrote:
 The record allocated by miSpriteDeviceCursorInitialize was not being
 released.
 
 This patch makes misprite use dixRegisterPrivateKey with the record
 size argument, which handles the memory management
 issues. miSpriteDeviceCursorInitialize is restructured to initialize
 pCursorInfo only if miDCDeviceInitialize succeeds. The record itself
 is zeroed on cleanup to ensure that the assumptions in the code still
 hold.
 
 Reviewed-by: Rami Ylimäki rami.ylim...@vincit.fi
 Signed-off-by: Erkki Seppälä erkki.sepp...@vincit.fi

Looks fine to me.  miSpriteDeviceCursorInitialize gets called as
spriteFuncs-DeviceCursorInitialize from miPointerDeviceInitialize,
which gets called as pScreen-DeviceCursorInitialize from
ActivateDevice.

Similarly, miSpriteDeviceCursorCleanup only gets called after a
DEVICE_CLOSE from CloseDevice(), and we shouldn't get any more events
after that; AccelCleanupProc doesn't post any events either, just, er,
cleans up.

So this looks fine to me.  Thanks! There are many other potential fixes
just like this one lurking in misprite.c and mipointer.c if that
horrible mess hasn't scared you off yet.

Reviewed-by: Daniel Stone dan...@fooishbar.org

Cheers,
Daniel


signature.asc
Description: Digital signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH] Remove geometry arguments from miSourceValidate()

2011-03-09 Thread Søren Sandmann
From: Søren Sandmann Pedersen s...@redhat.com

The only user of the geometry coordinates is the software sprite code,
which uses them to remove the pointer whenever the window beneath is
being used as a source. However, using Window pictures as a source is
extremely rare (let alone *partial* windows), so there is no harm done
in just validating all of the drawable.

Additionally, the miSourceValidate() function was buggy in at least
three respects:

(a) It added drawable-{x,y} before calling down, which is wrong since
the misprite code already adds them in its check. (Alternatively,
the misprite code is wrong, but there are actual users who would
notice if that code was broken).

(b) It didn't account for the width of the interpolation filter, so if
the Picture had a bilinear or convolution filter, the edges
surrounding the source area would not be validated.

(c) It didn't validate alpha maps.

Finally, computing the bounding box of the transform on every
composite request was a real performance issue in pixman, so
presumably it could be one here as well.

This patch changes miSourceValidate() to simply validate all of the
underlying drawable.

Signed-off-by: Soren Sandmann s...@redhat.com
---
 fb/fbpict.c |4 +-
 render/mipict.c |   62 +-
 render/mipict.h |7 +
 3 files changed, 19 insertions(+), 54 deletions(-)

diff --git a/fb/fbpict.c b/fb/fbpict.c
index 312f3df..133f422 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -54,9 +54,9 @@ fbComposite (CARD8  op,
 int msk_xoff, msk_yoff;
 int dst_xoff, dst_yoff;
 
-miCompositeSourceValidate (pSrc, xSrc - xDst, ySrc - yDst, width, height);
+miCompositeSourceValidate (pSrc);
 if (pMask)
-   miCompositeSourceValidate (pMask, xMask - xDst, yMask - yDst, width, 
height);
+   miCompositeSourceValidate (pMask);
 
 src = image_from_pict (pSrc, FALSE, src_xoff, src_yoff);
 mask = image_from_pict (pMask, FALSE, msk_xoff, msk_yoff);
diff --git a/render/mipict.c b/render/mipict.c
index 3b73888..a057840 100644
--- a/render/mipict.c
+++ b/render/mipict.c
@@ -333,12 +333,8 @@ miClipPictureSrc (RegionPtrpRegion,
 return TRUE;
 }
 
-void
-miCompositeSourceValidate (PicturePtr  pPicture,
-  INT16x,
-  INT16y,
-  CARD16   width,
-  CARD16   height)
+static void
+SourceValidateOnePicture (PicturePtr pPicture)
 {
 DrawablePtrpDrawable = pPicture-pDrawable;
 ScreenPtr  pScreen;
@@ -347,50 +343,22 @@ miCompositeSourceValidate (PicturePtr pPicture,
 return;
 
 pScreen = pDrawable-pScreen;
-
+
 if (pScreen-SourceValidate)
 {
-   if (pPicture-transform)
-   {
-   xPoint  points[4];
-   int i;
-   int xmin, ymin, xmax, ymax;
-
-#define VectorSet(i,_x,_y) { points[i].x = _x; points[i].y = _y; }
-   VectorSet (0, x, y);
-   VectorSet (1, x + width, y);
-   VectorSet (2, x, y + height);
-   VectorSet (3, x + width, y + height);
-   xmin = ymin = 32767;
-   xmax = ymax = -32737;
-   for (i = 0; i  4; i++)
-   {
-   PictVector  t;
-   t.vector[0] = IntToxFixed (points[i].x);
-   t.vector[1] = IntToxFixed (points[i].y);
-   t.vector[2] = xFixed1;
-   if (pixman_transform_point (pPicture-transform, t))
-   {
-   int tx = xFixedToInt (t.vector[0]);
-   int ty = xFixedToInt (t.vector[1]);
-   if (tx  xmin) xmin = tx;
-   if (tx  xmax) xmax = tx;
-   if (ty  ymin) ymin = ty;
-   if (ty  ymax) ymax = ty;
-   }
-   }
-   x = xmin;
-   y = ymin;
-   width = xmax - xmin;
-   height = ymax - ymin;
-   }
-x += pPicture-pDrawable-x;
-y += pPicture-pDrawable-y;
-   (*pScreen-SourceValidate) (pDrawable, x, y, width, height,
-   pPicture-subWindowMode);
+   pScreen-SourceValidate (
+   pDrawable, 0, 0, pDrawable-width, pDrawable-height, 
pPicture-subWindowMode);
 }
 }
 
+void
+miCompositeSourceValidate (PicturePtr pPicture)
+{
+SourceValidateOnePicture (pPicture);
+if (pPicture-alphaMap)
+   SourceValidateOnePicture (pPicture-alphaMap);
+}
+
 /*
  * returns FALSE if the final region is empty.  Indistinguishable from
  * an allocation failure, but rendering ignores those anyways.
@@ -480,9 +448,9 @@ miComputeCompositeRegion (RegionPtr pRegion,
 }
 
 
-miCompositeSourceValidate (pSrc, xSrc, ySrc, width, height);
+miCompositeSourceValidate (pSrc);
 if (pMask)
-   miCompositeSourceValidate (pMask, xMask, yMask, width, height);
+   

Re: [PATCH 2/5] panoramiX: convert 0-panoramiXNumScreens loops to macro

2011-03-09 Thread Alan Coopersmith
On 03/ 8/11 09:29 PM, Dave Airlie wrote:
 From: Dave Airlie airl...@redhat.com
 
 This just uses the FOR_NSCREENS macro instead.

Looks like a couple of the 1-n loop conversions to FOR_NSCREENS_FORWARD_SKIP
snuck in from patch 3 as well:

 @@ -740,7 +740,7 @@ PanoramiXMaybeAddDepth(DepthPtr pDepth)
  int j, k;
  Bool found = FALSE;
  
 -for (j = 1; j  PanoramiXNumScreens; j++) {
 +FOR_NSCREENS_FORWARD_SKIP(j) {
   pScreen = screenInfo.screens[j];
   for (k = 0; k  pScreen-numDepths; k++) {
   if (pScreen-allowedDepths[k].depth == pDepth-depth) {


 @@ -773,7 +773,7 @@ PanoramiXMaybeAddVisual(VisualPtr pVisual)
  int j, k;
  Bool found = FALSE;
  
 -for (j = 1; j  PanoramiXNumScreens; j++) {
 +FOR_NSCREENS_FORWARD_SKIP(j) {
   pScreen = screenInfo.screens[j];
   found = FALSE;
  

 diff --git a/Xext/shm.c b/Xext/shm.c
 index 6294720..b08af82 100644
 --- a/Xext/shm.c
 +++ b/Xext/shm.c
 @@ -848,7 +848,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
   return BadAlloc;
  
  drawables[0] = pDraw;
 -for(i = 1; i  PanoramiXNumScreens; i++) {
 +FOR_NSCREENS_FORWARD_SKIP(i) {
   rc = dixLookupDrawable(drawables+i, draw-info[i].id, client, 0, 
  DixReadAccess);
   if (rc != Success)

-- 
-Alan Coopersmith-alan.coopersm...@oracle.com
 Oracle Solaris Platform Engineering: X Window System

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 4/5] panoramiX: use RESTYPE instead of unsigned long

2011-03-09 Thread Alan Coopersmith
On 03/ 8/11 09:29 PM, Dave Airlie wrote:
 From: Dave Airlie airl...@redhat.com
 
 unsigned long seems like the wrong type to use here,
 switch to using RESTYPE.
 
 Signed-off-by: Dave Airlie airl...@redhat.com

Looks like a duplicate of ajax's patch a few days earlier:
http://patchwork.freedesktop.org/patch/4422/

Guess it must be right if you both independently came to the same fix. 8-)

-- 
-Alan Coopersmith-alan.coopersm...@oracle.com
 Oracle Solaris Platform Engineering: X Window System

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 4/5] panoramiX: use RESTYPE instead of unsigned long

2011-03-09 Thread Dave Airlie
On Thu, Mar 10, 2011 at 4:59 AM, Alan Coopersmith
alan.coopersm...@oracle.com wrote:
 On 03/ 8/11 09:29 PM, Dave Airlie wrote:
 From: Dave Airlie airl...@redhat.com

 unsigned long seems like the wrong type to use here,
 switch to using RESTYPE.

 Signed-off-by: Dave Airlie airl...@redhat.com

 Looks like a duplicate of ajax's patch a few days earlier:
        http://patchwork.freedesktop.org/patch/4422/

 Guess it must be right if you both independently came to the same fix. 8-)

I actually wondered if he'd done this and checked the list and still missed it.

Dave.
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH] panoramiX: macro checking if drawable is root (v2)

2011-03-09 Thread Peter Hutterer
On Wed, Mar 09, 2011 at 04:04:49PM +1000, Dave Airlie wrote:
 From: Dave Airlie airl...@redhat.com
 
 this code appears in quite a few places, consolidate it into
 a macro in a header.
 
 v2: align braces with macro just above it, and with
 lines removed
 
 Signed-off-by: Dave Airlie airl...@redhat.com

Reviewed-by: Peter Hutterer peter.hutte...@who-t.net

Cheers,
  Peter

 ---
  Xext/panoramiX.h  |1 +
  Xext/panoramiXprocs.c |   26 +-
  2 files changed, 14 insertions(+), 13 deletions(-)
 
 diff --git a/Xext/panoramiX.h b/Xext/panoramiX.h
 index fcfac0e..71651e5 100644
 --- a/Xext/panoramiX.h
 +++ b/Xext/panoramiX.h
 @@ -76,4 +76,5 @@ typedef struct {
  
  #define IS_SHARED_PIXMAP(r) (((r)-type == XRT_PIXMAP)  (r)-u.pix.shared)
  
 +#define IS_ROOT_DRAWABLE(d) (((d)-type == XRT_WINDOW)  (d)-u.win.root)
  #endif /* _PANORAMIX_H_ */
 diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
 index b6ca807..9ea4611 100644
 --- a/Xext/panoramiXprocs.c
 +++ b/Xext/panoramiXprocs.c
 @@ -1328,7 +1328,7 @@ int PanoramiXPolyLine(ClientPtr client)
  if (result != Success)
   return result;
  
 -isRoot = (draw-type == XRT_WINDOW)  draw-u.win.root;
 +isRoot = IS_ROOT_DRAWABLE(draw);
  npoint = bytes_to_int32((client-req_len  2) - sizeof(xPolyLineReq));
  if (npoint  0){
  origPts = malloc(npoint * sizeof(xPoint));
 @@ -1388,7 +1388,7 @@ int PanoramiXPolySegment(ClientPtr client)
  if (result != Success)
   return result;
  
 -isRoot = (draw-type == XRT_WINDOW)  draw-u.win.root;
 +isRoot = IS_ROOT_DRAWABLE(draw);
  
  nsegs = (client-req_len  2) - sizeof(xPolySegmentReq);
  if(nsegs  4) return BadLength;
 @@ -1451,7 +1451,7 @@ int PanoramiXPolyRectangle(ClientPtr client)
  if (result != Success)
   return result;
  
 -isRoot = (draw-type == XRT_WINDOW)  draw-u.win.root;
 +isRoot = IS_ROOT_DRAWABLE(draw);
  
  nrects = (client-req_len  2) - sizeof(xPolyRectangleReq);
  if(nrects  4) return BadLength;
 @@ -1513,7 +1513,7 @@ int PanoramiXPolyArc(ClientPtr client)
  if (result != Success)
   return result;
  
 -isRoot = (draw-type == XRT_WINDOW)  draw-u.win.root;
 +isRoot = IS_ROOT_DRAWABLE(draw);
  
  narcs = (client-req_len  2) - sizeof(xPolyArcReq);
  if(narcs % sizeof(xArc)) return BadLength;
 @@ -1573,7 +1573,7 @@ int PanoramiXFillPoly(ClientPtr client)
  if (result != Success)
   return result;
  
 -isRoot = (draw-type == XRT_WINDOW)  draw-u.win.root;
 +isRoot = IS_ROOT_DRAWABLE(draw);
  
  count = bytes_to_int32((client-req_len  2) - sizeof(xFillPolyReq));
  if (count  0){
 @@ -1634,7 +1634,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
  if (result != Success)
   return result;
  
 -isRoot = (draw-type == XRT_WINDOW)  draw-u.win.root;
 +isRoot = IS_ROOT_DRAWABLE(draw);
  
  things = (client-req_len  2) - sizeof(xPolyFillRectangleReq);
  if(things  4) return BadLength;
 @@ -1695,7 +1695,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
  if (result != Success)
   return result;
  
 -isRoot = (draw-type == XRT_WINDOW)  draw-u.win.root;
 +isRoot = IS_ROOT_DRAWABLE(draw);
  
  narcs = (client-req_len  2) - sizeof(xPolyFillArcReq);
  if (narcs % sizeof(xArc)) return BadLength;
 @@ -1755,7 +1755,7 @@ int PanoramiXPutImage(ClientPtr client)
  if (result != Success)
   return result;
  
 -isRoot = (draw-type == XRT_WINDOW)  draw-u.win.root;
 +isRoot = IS_ROOT_DRAWABLE(draw);
  
  orig_x = stuff-dstX;
  orig_y = stuff-dstY;
 @@ -1818,7 +1818,7 @@ int PanoramiXGetImage(ClientPtr client)
  format = stuff-format;
  planemask = stuff-planeMask;
  
 -isRoot = (draw-type == XRT_WINDOW)  draw-u.win.root;
 +isRoot = IS_ROOT_DRAWABLE(draw);
  
  if(isRoot) {
if( /* check for being onscreen */
 @@ -1956,7 +1956,7 @@ PanoramiXPolyText8(ClientPtr client)
  if (result != Success)
   return result;
  
 -isRoot = (draw-type == XRT_WINDOW)  draw-u.win.root;
 +isRoot = IS_ROOT_DRAWABLE(draw);
  
  orig_x = stuff-x;
  orig_y = stuff-y;
 @@ -1997,7 +1997,7 @@ PanoramiXPolyText16(ClientPtr client)
  if (result != Success)
   return result;
  
 -isRoot = (draw-type == XRT_WINDOW)  draw-u.win.root;
 +isRoot = IS_ROOT_DRAWABLE(draw);
  
  orig_x = stuff-x;
  orig_y = stuff-y;
 @@ -2038,7 +2038,7 @@ int PanoramiXImageText8(ClientPtr client)
  if (result != Success)
   return result;
  
 -isRoot = (draw-type == XRT_WINDOW)  draw-u.win.root;
 +isRoot = IS_ROOT_DRAWABLE(draw);
  
  orig_x = stuff-x;
  orig_y = stuff-y;
 @@ -2079,7 +2079,7 @@ int PanoramiXImageText16(ClientPtr client)
  if (result != Success)
   return result;
  
 -isRoot = (draw-type == XRT_WINDOW)  draw-u.win.root;
 +isRoot = IS_ROOT_DRAWABLE(draw);
  
  orig_x = stuff-x;
  orig_y = stuff-y;
 -- 
 1.7.3.4

Re: [PULL] xserver-next, 2011-03-08

2011-03-09 Thread Keith Packard
On Tue, 08 Mar 2011 13:52:45 -0500, Adam Jackson a...@nwnk.net wrote:

 Adam Jackson (14):
   vbe: Fix malloc size bug
   dix: Remove usage_hint from pixmaps, store it in -drawable.class
   dix: Remove deprecated.c
   dix: Remove PIXEL typedef
   xv: Use RESTYPE where appropriate
   xinerama: Use RESTYPE consistently
   xvmc: Use RESTYPE consistently
   xi: Use RESTYPE consistently
   glx: Remove unused _glapi_get_proc_offset and friends
   glx: unifdef SOLARIS_THREADS
   glx: unifdef USE_XTHREADS
   glx: unifdef BEOS_THREADS
   glx: Simplify _glapi_check_multithread
   glx: Remove unused _glapi_get_proc_name
 
 Erkki Seppälä (1):
   xfree86/common: Remove a configScreen leak when conf_screen is
   NULL

Merged.
   628d16a..a19771e  master - master

-- 
keith.pack...@intel.com


pgp8EjYTCbtmG.pgp
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 5/8] xinerama: Use RESTYPE consistently

2011-03-09 Thread Dave Airlie
On Tue, Mar 8, 2011 at 2:28 AM, Adam Jackson a...@redhat.com wrote:
 No functional change

 Signed-off-by: Adam Jackson a...@redhat.com

Reviewed-by: Dave Airlie airl...@redhat.com

since I just posted nearly the exact same patch.

Dave.
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PULL] xserver-next, 2011-03-08

2011-03-09 Thread Adam Jackson

On 3/9/11 5:20 PM, Keith Packard wrote:

On Tue, 08 Mar 2011 13:52:45 -0500, Adam Jacksona...@nwnk.net  wrote:


Adam Jackson (14):
   vbe: Fix malloc size bug
   dix: Remove usage_hint from pixmaps, store it in -drawable.class
   dix: Remove deprecated.c
   dix: Remove PIXEL typedef
   xv: Use RESTYPE where appropriate
   xinerama: Use RESTYPE consistently
   xvmc: Use RESTYPE consistently
   xi: Use RESTYPE consistently
   glx: Remove unused _glapi_get_proc_offset and friends
   glx: unifdef SOLARIS_THREADS
   glx: unifdef USE_XTHREADS
   glx: unifdef BEOS_THREADS
   glx: Simplify _glapi_check_multithread
   glx: Remove unused _glapi_get_proc_name

Erkki Seppälä (1):
   xfree86/common: Remove a configScreen leak when conf_screen is
   NULL


Merged.
628d16a..a19771e  master -  master


Jeremy, please cherry-pick d8caa782009abf4dc17b945e325e83fda299a534 (the 
VBE fix above) to 1.9 branch.


- ajax

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 1/3] panoramiX: consolidate common id assignment code.

2011-03-09 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

This adds a new FOR_NSCREENS_FORWARD_SKIP, which skips the first
element and is a common idiom throughout panoramiX code.

It then adds a new inline function to hide id assignment to a
panoramiX resource and cleans up lots of common repeated code.

Signed-off-by: Dave Airlie airl...@redhat.com
---
 Xext/panoramiX.h  |3 ++-
 Xext/panoramiXprocs.c |   20 +---
 Xext/panoramiXsrv.h   |   11 +++
 Xext/shm.c|4 +---
 composite/compext.c   |5 +
 render/render.c   |   25 +
 6 files changed, 25 insertions(+), 43 deletions(-)

diff --git a/Xext/panoramiX.h b/Xext/panoramiX.h
index e4938f5..71651e5 100644
--- a/Xext/panoramiX.h
+++ b/Xext/panoramiX.h
@@ -44,7 +44,7 @@ Equipment Corporation.
 #include X11/extensions/panoramiXproto.h
 #undef _PANORAMIX_SERVER
 #include gcstruct.h
-
+#include dixstruct.h
 
 typedef struct _PanoramiXInfo {
 XID id ;
@@ -70,6 +70,7 @@ typedef struct {
 } PanoramiXRes;
 
 #define FOR_NSCREENS_FORWARD(j) for(j = 0; j  PanoramiXNumScreens; j++)
+#define FOR_NSCREENS_FORWARD_SKIP(j) for(j = 1; j  PanoramiXNumScreens; j++)
 #define FOR_NSCREENS_BACKWARD(j) for(j = PanoramiXNumScreens - 1; j = 0; j--)
 #define FOR_NSCREENS(j) FOR_NSCREENS_FORWARD(j)
 
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index 4ad5489..3e68d0a 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -120,9 +120,7 @@ int PanoramiXCreateWindow(ClientPtr client)
 newWin-u.win.visibility = VisibilityNotViewable;
 newWin-u.win.class = stuff-class;
 newWin-u.win.root = FALSE;
-newWin-info[0].id = stuff-wid;
-for(j = 1; j  PanoramiXNumScreens; j++)
-newWin-info[j].id = FakeClientID(client-index);
+panoramix_setup_ids(newWin, client, stuff-wid);
 
 if (stuff-class == InputOnly)
stuff-visual = CopyFromParent;
@@ -663,9 +661,7 @@ int PanoramiXCreatePixmap(ClientPtr client)
 
 newPix-type = XRT_PIXMAP;
 newPix-u.pix.shared = FALSE;
-newPix-info[0].id = stuff-pid;
-for(j = 1; j  PanoramiXNumScreens; j++)
-   newPix-info[j].id = FakeClientID(client-index);
+panoramix_setup_ids(newPix, client, stuff-pid);

 FOR_NSCREENS_BACKWARD(j) {
stuff-pid = newPix-info[j].id;
@@ -767,9 +763,7 @@ int PanoramiXCreateGC(ClientPtr client)
 return BadAlloc;
 
 newGC-type = XRT_GC;
-newGC-info[0].id = stuff-gc;
-for(j = 1; j  PanoramiXNumScreens; j++)
-newGC-info[j].id = FakeClientID(client-index);
+panoramix_setup_ids(newGC, client, stuff-gc);
 
 FOR_NSCREENS_BACKWARD(j) {
 stuff-gc = newGC-info[j].id;
@@ -2121,9 +2115,7 @@ int PanoramiXCreateColormap(ClientPtr client)
 return BadAlloc;
 
 newCmap-type = XRT_COLORMAP;
-newCmap-info[0].id = stuff-mid;
-for(j = 1; j  PanoramiXNumScreens; j++)
-newCmap-info[j].id = FakeClientID(client-index);
+panoramix_setup_ids(newCmap, client, stuff-mid);
 
 orig_visual = stuff-visual;
 FOR_NSCREENS_BACKWARD(j){
@@ -2192,9 +2184,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
 return BadAlloc;
 
 newCmap-type = XRT_COLORMAP;
-newCmap-info[0].id = stuff-mid;
-for(j = 1; j  PanoramiXNumScreens; j++)
-newCmap-info[j].id = FakeClientID(client-index);
+panoramix_setup_ids(newCmap, client, stuff-mid);
 
 FOR_NSCREENS_BACKWARD(j){
 stuff-srcCmap = cmap-info[j].id;
diff --git a/Xext/panoramiXsrv.h b/Xext/panoramiXsrv.h
index b0a5a6e..5dd02e8 100644
--- a/Xext/panoramiXsrv.h
+++ b/Xext/panoramiXsrv.h
@@ -51,4 +51,15 @@ extern _X_EXPORT void XineramaGetImageData(
 Bool isRoot
 );
 
+static inline void panoramix_setup_ids(PanoramiXRes *resource, 
+   ClientPtr client, XID base_id)
+{
+int j;
+
+resource-info[0].id = base_id;
+FOR_NSCREENS_FORWARD_SKIP(j) {
+resource-info[j].id = FakeClientID(client-index);
+}
+}
+
 #endif /* _PANORAMIXSRV_H_ */
diff --git a/Xext/shm.c b/Xext/shm.c
index 23afe6b..6294720 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -972,9 +972,7 @@ CreatePmap:
 
 newPix-type = XRT_PIXMAP;
 newPix-u.pix.shared = TRUE;
-newPix-info[0].id = stuff-pid;
-for(j = 1; j  PanoramiXNumScreens; j++)
-   newPix-info[j].id = FakeClientID(client-index);
+panoramix_setup_ids(newPix, client, stuff-pid);
 
 result = Success;
 
diff --git a/composite/compext.c b/composite/compext.c
index fbd36b5..e0d8e75 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -703,10 +703,7 @@ PanoramiXCompositeNameWindowPixmap (ClientPtr client)
 
 newPix-type = XRT_PIXMAP;
 newPix-u.pix.shared = FALSE;
-newPix-info[0].id = stuff-pixmap;
-
-for (i = 1; i  PanoramiXNumScreens; i++)
-   newPix-info[i].id = FakeClientID (client-index);
+panoramix_setup_ids(newPix, client, stuff-pixmap);
 
 FOR_NSCREENS(i) {
rc = dixLookupResourceByType ((void **) pWin, 

[PATCH 2/3] panoramiX: convert 0-panoramiXNumScreens loops to macro (v2)

2011-03-09 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

This just uses the FOR_NSCREENS macro instead.

also convert one num - 1 - 0 loop.

v2: remove some of the 1-x loops.

Signed-off-by: Dave Airlie airl...@redhat.com
---
 Xext/panoramiX.c  |   10 +-
 Xext/panoramiXprocs.c |2 +-
 Xext/saver.c  |2 +-
 Xext/xvdisp.c |2 +-
 dix/events.c  |4 ++--
 dix/window.c  |4 ++--
 hw/dmx/dmxcb.c|7 ---
 hw/dmx/dmxextension.c |4 ++--
 8 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index e6334bd..d10af70 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -393,7 +393,7 @@ static void XineramaInitData(ScreenPtr pScreen)
 int i, w, h;
 
 RegionNull(PanoramiXScreenRegion);
-for (i = 0; i  PanoramiXNumScreens; i++) {
+FOR_NSCREENS(i) {
BoxRec TheBox;
RegionRec ScreenRegion;
 
@@ -478,7 +478,7 @@ void PanoramiXExtensionInit(int argc, char *argv[])
 *  run in non-PanoramiXeen mode.
 */
 
-   for (i = 0; i  PanoramiXNumScreens; i++) {
+   FOR_NSCREENS(i) {
   pScreen = screenInfo.screens[i];
   pScreenPriv = malloc(sizeof(PanoramiXScreenRec));
   dixSetPrivate(pScreen-devPrivates, PanoramiXScreenKey,
@@ -836,7 +836,7 @@ PanoramiXConsolidate(void)
 saver = malloc(sizeof(PanoramiXRes));
 saver-type = XRT_WINDOW;
 
-for (i =  0; i  PanoramiXNumScreens; i++) {
+FOR_NSCREENS(i) {
ScreenPtr pScreen = screenInfo.screens[i];
root-info[i].id = pScreen-root-drawable.id;
root-u.win.class = InputOutput;
@@ -1074,7 +1074,7 @@ ProcXineramaQueryScreens(ClientPtr client)
xXineramaScreenInfo scratch;
int i;
 
-   for(i = 0; i  PanoramiXNumScreens; i++) {
+   FOR_NSCREENS(i) {
scratch.x_org  = screenInfo.screens[i]-x;
scratch.y_org  = screenInfo.screens[i]-y;
scratch.width  = screenInfo.screens[i]-width;
@@ -1179,7 +1179,7 @@ XineramaGetImageData(
 
 depth = (format == XYPixmap) ? 1 : pDraw-depth;
 
-for(i = 0; i  PanoramiXNumScreens; i++) {
+FOR_NSCREENS(i) {
BoxRec TheBox;
ScreenPtr pScreen;
pDraw = pDrawables[i];
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index 3e68d0a..4eb9a13 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -2186,7 +2186,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
 newCmap-type = XRT_COLORMAP;
 panoramix_setup_ids(newCmap, client, stuff-mid);
 
-FOR_NSCREENS_BACKWARD(j){
+FOR_NSCREENS_BACKWARD(j) {
 stuff-srcCmap = cmap-info[j].id;
stuff-mid = newCmap-info[j].id;
 result = (* SavedProcVector[X_CopyColormapAndFree])(client);
diff --git a/Xext/saver.c b/Xext/saver.c
index 1888603..492a54f 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -1288,7 +1288,7 @@ ProcScreenSaverUnsetAttributes (ClientPtr client)
if (rc != Success)
return (rc == BadValue) ? BadDrawable : rc;
 
-   for(i = PanoramiXNumScreens - 1; i  0; i--) {
+   FOR_NSCREENS_BACKWARD(i) {
 stuff-drawable = draw-info[i].id;
 ScreenSaverUnsetAttributes(client);
}
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index deddebd..beb26a9 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -1927,7 +1927,7 @@ void XineramifyXv(void)
 if(!port)
break;
 
-for(k = 0; k  PanoramiXNumScreens; k++) {
+FOR_NSCREENS(k) {
if(MatchingAdaptors[k]  (MatchingAdaptors[k]-nPorts  j)) 
port-info[k].id = MatchingAdaptors[k]-base_id + j;
else
diff --git a/dix/events.c b/dix/events.c
index df62e83..5151f74 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -558,7 +558,7 @@ XineramaSetWindowPntrs(DeviceIntPtr pDev, WindowPtr pWin)
 
 if(pWin == screenInfo.screens[0]-root) {
int i;
-   for (i = 0; i  PanoramiXNumScreens; i++)
+   FOR_NSCREENS(i)
pSprite-windows[i] = screenInfo.screens[i]-root;
 } else {
PanoramiXRes *win;
@@ -569,7 +569,7 @@ XineramaSetWindowPntrs(DeviceIntPtr pDev, WindowPtr pWin)
if (rc != Success)
return FALSE;
 
-   for(i = 0; i  PanoramiXNumScreens; i++) {
+   FOR_NSCREENS(i) {
rc = dixLookupWindow(pSprite-windows + i, win-info[i].id,
 serverClient, DixReadAccess);
if (rc != Success)  /* window is being unmapped */
diff --git a/dix/window.c b/dix/window.c
index 9be7064..3668370 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -3067,7 +3067,7 @@ SendVisibilityNotify(WindowPtr pWin)
 
switch(visibility) {
case VisibilityUnobscured:
-   for(i = 0; i  PanoramiXNumScreens; i++) {
+   FOR_NSCREENS(i) {
if(i == Scrnum) continue;
 
rc = dixLookupWindow(pWin2, win-info[i].id, serverClient,
@@ -3089,7 +3089,7 @@ SendVisibilityNotify(WindowPtr pWin)
 

[PATCH 3/3] panoramiX: convert 1-panoramiXNumScreens loops to use macro (v2)

2011-03-09 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

This converts all the remaining 1-num loops to the macro,
this removes nearly all the panoramiXNumScreens usage in
loops, and is a step to replacing it.

v2: move some from the other patch.

Signed-off-by: Dave Airlie airl...@redhat.com
---
 Xext/panoramiX.c  |6 +++---
 Xext/panoramiXprocs.c |2 +-
 Xext/shm.c|2 +-
 Xext/xvdisp.c |2 +-
 dix/events.c  |6 +++---
 hw/dmx/dmxgcops.c |2 +-
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index d10af70..74241d8 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -413,7 +413,7 @@ static void XineramaInitData(ScreenPtr pScreen)
 PanoramiXPixWidth = screenInfo.screens[0]-x + 
screenInfo.screens[0]-width;
 PanoramiXPixHeight = screenInfo.screens[0]-y + 
screenInfo.screens[0]-height;
 
-for (i = 1; i  PanoramiXNumScreens; i++) {
+FOR_NSCREENS_FORWARD_SKIP(i) {
pScreen = screenInfo.screens[i];
w = pScreen-x + pScreen-width;
h = pScreen-y + pScreen-height;
@@ -740,7 +740,7 @@ PanoramiXMaybeAddDepth(DepthPtr pDepth)
 int j, k;
 Bool found = FALSE;
 
-for (j = 1; j  PanoramiXNumScreens; j++) {
+FOR_NSCREENS_FORWARD_SKIP(j) {
pScreen = screenInfo.screens[j];
for (k = 0; k  pScreen-numDepths; k++) {
if (pScreen-allowedDepths[k].depth == pDepth-depth) {
@@ -773,7 +773,7 @@ PanoramiXMaybeAddVisual(VisualPtr pVisual)
 int j, k;
 Bool found = FALSE;
 
-for (j = 1; j  PanoramiXNumScreens; j++) {
+FOR_NSCREENS_FORWARD_SKIP(j) {
pScreen = screenInfo.screens[j];
found = FALSE;
 
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index 4eb9a13..9ea4611 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -1840,7 +1840,7 @@ int PanoramiXGetImage(ClientPtr client)
 }
 
 drawables[0] = pDraw;
-for(i = 1; i  PanoramiXNumScreens; i++) {
+FOR_NSCREENS_FORWARD_SKIP(i) {
rc = dixLookupDrawable(drawables+i, draw-info[i].id, client, 0,
   DixGetAttrAccess);
if (rc != Success)
diff --git a/Xext/shm.c b/Xext/shm.c
index 6294720..b08af82 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -848,7 +848,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
return BadAlloc;
 
 drawables[0] = pDraw;
-for(i = 1; i  PanoramiXNumScreens; i++) {
+FOR_NSCREENS_FORWARD_SKIP(i) {
rc = dixLookupDrawable(drawables+i, draw-info[i].id, client, 0, 
   DixReadAccess);
if (rc != Success)
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index beb26a9..b968431 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -1918,7 +1918,7 @@ void XineramifyXv(void)
 
   MatchingAdaptors[0] = refAdapt;
   isOverlay = hasOverlay(refAdapt);
-  for(j = 1; j  PanoramiXNumScreens; j++)
+  FOR_NSCREENS_FORWARD_SKIP(j)
 MatchingAdaptors[j] = matchAdaptor(screenInfo.screens[j], refAdapt, 
isOverlay);
 
   /* now create a resource for each port */
diff --git a/dix/events.c b/dix/events.c
index 5151f74..8835c5e 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2554,7 +2554,7 @@ PointInBorderSize(WindowPtr pWin, int x, int y)
SpritePtr pSprite = inputInfo.pointer-spriteInfo-sprite;
int i;
 
-   for(i = 1; i  PanoramiXNumScreens; i++) {
+   FOR_NSCREENS_FORWARD_SKIP(i) {
   if(RegionContainsPoint(pSprite-windows[i]-borderSize,
  x + screenInfo.screens[0]-x - 
screenInfo.screens[i]-x,
  y + screenInfo.screens[0]-y - 
screenInfo.screens[i]-y,
@@ -3153,7 +3153,7 @@ XineramaPointInWindowIsVisible(
 xoff = x + screenInfo.screens[0]-x;
 yoff = y + screenInfo.screens[0]-y;
 
-for(i = 1; i  PanoramiXNumScreens; i++) {
+FOR_NSCREENS_FORWARD_SKIP(i) {
pWin = inputInfo.pointer-spriteInfo-sprite-windows[i];
x = xoff - screenInfo.screens[i]-x;
y = yoff - screenInfo.screens[i]-y;
@@ -3360,7 +3360,7 @@ BorderSizeNotEmpty(DeviceIntPtr pDev, WindowPtr pWin)
  if(!noPanoramiXExtension  XineramaSetWindowPntrs(pDev, pWin)) {
int i;
 
-   for(i = 1; i  PanoramiXNumScreens; i++) {
+   FOR_NSCREENS_FORWARD_SKIP(i) {

if(RegionNotEmpty(pDev-spriteInfo-sprite-windows[i]-borderSize))
return TRUE;
}
diff --git a/hw/dmx/dmxgcops.c b/hw/dmx/dmxgcops.c
index bc8cd9e..500e2cd 100644
--- a/hw/dmx/dmxgcops.c
+++ b/hw/dmx/dmxgcops.c
@@ -529,7 +529,7 @@ static DMXScreenInfo *dmxFindAlternatePixmap(DrawablePtr 
pDrawable, XID *draw)
   NullClient, DixUnknownAccess))
 return NULL;
 
-for (i = 1; i  PanoramiXNumScreens; i++) {
+FOR_NSCREENS_FORWARD_SKIP(i) {
 dmxScreen = dmxScreens[i];
 if (dmxScreen-beDisplay) {
 PixmapPtr pSrc;
-- 
1.7.3.4

___

Re: [PATCH xserver] xkb: Initialize pad bytes sent in replies of geometry requests.

2011-03-09 Thread Peter Hutterer
On Wed, Mar 09, 2011 at 03:45:40PM +0200, Rami Ylimäki wrote:
 Valgrind complains about uninitialized data being written to clients.
 
 Reviewed-by: Erkki Seppälä erkki.sepp...@vincit.fi
 Signed-off-by: Rami Ylimäki rami.ylim...@vincit.fi

merged, thanks.

Cheers,
  Peter

 ---
  xkb/xkb.c |   12 +---
  1 files changed, 9 insertions(+), 3 deletions(-)
 
 diff --git a/xkb/xkb.c b/xkb/xkb.c
 index 8d61e01..39dbab4 100644
 --- a/xkb/xkb.c
 +++ b/xkb/xkb.c
 @@ -4305,7 +4305,7 @@ ProcXkbSetNames(ClientPtr client)
  static char *
  XkbWriteCountedString(char *wire,char *str,Bool swap)
  {
 -CARD16 len,*pLen;
 +CARD16 len,*pLen, paddedLen;
  
  if (!str)
  return wire;
 @@ -4317,8 +4317,9 @@ XkbWriteCountedString(char *wire,char *str,Bool swap)
   register int n;
   swaps(pLen,n);
  }
 -memcpy(wire[2],str,len);
 -wire+= ((2+len+3)/4)*4;
 +paddedLen= pad_to_int32(sizeof(len)+len)-sizeof(len);
 +strncpy(wire[sizeof(len)],str,paddedLen);
 +wire+= sizeof(len)+paddedLen;
  return wire;
  }
  
 @@ -4429,6 +4430,7 @@ xkbShapeWireDesc *  shapeWire;
   if (shape-approx!=NULL)
shapeWire-approxNdx= XkbOutlineIndex(shape,shape-approx);
   else shapeWire-approxNdx= XkbNoShape;
 + shapeWire-pad= 0;
   if (swap) {
   register int n;
   swapl(shapeWire-name,n);
 @@ -4441,6 +4443,7 @@ xkbShapeWireDesc *  shapeWire;
   olWire= (xkbOutlineWireDesc *)wire;
   olWire-nPoints= ol-num_points;
   olWire-cornerRadius= ol-corner_radius;
 + olWire-pad= 0;
   wire= (char *)olWire[1];
   ptWire= (xkbPointWireDesc *)wire;
   for (p=0,pt=ol-points;pol-num_points;p++,pt++) {
 @@ -4554,6 +4557,8 @@ xkbOverlayWireDesc *olWire;
 olWire= (xkbOverlayWireDesc *)wire;
 olWire-name= ol-name;
 olWire-nRows= ol-num_rows;
 +   olWire-pad1= 0;
 +   olWire-pad2= 0;
 if (swap) {
   register int n;
   swapl(olWire-name,n);
 @@ -4566,6 +4571,7 @@ xkbOverlayWireDesc *olWire;
   rowWire= (xkbOverlayRowWireDesc *)wire;
   rowWire-rowUnder= row-row_under;
   rowWire-nKeys= row-num_keys;
 + rowWire-pad1= 0;
   wire= (char *)rowWire[1];
   for (k=0,key=row-keys;krow-num_keys;k++,key++) {
   xkbOverlayKeyWireDesc * keyWire;
 -- 
 1.6.3.3
 
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: panoramiX: repost 3 patches post-review

2011-03-09 Thread Alan Coopersmith
On 03/ 9/11 03:23 PM, Dave Airlie wrote:
 This is a repost of the 3 unreviewed patches post comments by Alan.
 
 I've dropped the patch I overlapped with ajax.

For the series:
Reviewed-by: Alan Coopersmith alan.coopersm...@oracle.com

-- 
-Alan Coopersmith-alan.coopersm...@oracle.com
 Oracle Solaris Platform Engineering: X Window System

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 2/3] panoramiX: convert 0-panoramiXNumScreens loops to macro (v2)

2011-03-09 Thread Daniel Stone
Hi,

On Thu, Mar 10, 2011 at 09:23:34AM +1000, Dave Airlie wrote:
 diff --git a/Xext/saver.c b/Xext/saver.c
 index 1888603..492a54f 100644
 --- a/Xext/saver.c
 +++ b/Xext/saver.c
 @@ -1288,7 +1288,7 @@ ProcScreenSaverUnsetAttributes (ClientPtr client)
 if (rc != Success)
 return (rc == BadValue) ? BadDrawable : rc;
  
 -   for(i = PanoramiXNumScreens - 1; i  0; i--) {
 +   FOR_NSCREENS_BACKWARD(i) {
  stuff-drawable = draw-info[i].id;
  ScreenSaverUnsetAttributes(client);
 }

You're changing semantics here by changing info[0..n], rather than
info[1..n].  Looks like you might just be able to turn this into a
FOR_NSCREENS_FORWARD_SKIP though?

Other than that, for the series:
Reviewed-by: Daniel Stone dan...@fooishbar.org

Cheers,
Daniel


signature.asc
Description: Digital signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [libXt:PATCH] XtAsprintf: Fix memory corruption.

2011-03-09 Thread Alan Coopersmith
On 03/ 8/11 01:14 PM, Alan Coopersmith wrote:
 On 03/ 8/11 07:09 AM, Cyril Brulebois wrote:
 Don't write the null terminator to a random place, this can trigger some
 segfault in XtOpenDisplay() and other annoyances.
 -new_string[len] = '\0';
 +(*new_string)[len] = '\0';
 
 Oops!  Sorry.   Yes.
 
 Reviewed-by: Alan Coopersmith alan.coopersm...@oracle.com
 
 As penance I wrote a quick test that catches this failure and confirms the 
 fix.
 (See separate mail for that.)   A very incomplete test case, but we have to
 start somewhere, and it seems to be working for the xserver so far.
 
 Once the fix  test are in, we'll get a libXt-1.1.1 release out with those and
 the two other minor changes in git master - I'll hold back on pushing the
 possibly more risky XtAppMainLoop patch until after that.

I've gone ahead and pushed your fix for now, since it's right, while the test
case needs more work as discussed in various other messages.

-- 
-Alan Coopersmith-alan.coopersm...@oracle.com
 Oracle Solaris Platform Engineering: X Window System

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PULL] xserver-next, 2011-03-08

2011-03-09 Thread Jeremy Huddleston
/facepalm fix applied to both 1.9 and 1.10:

   424..8ffaef2  server-1.9-branch - server-1.9-branch
   3550396..0ab680f  server-1.10-branch - server-1.10-branch


On Mar 9, 2011, at 15:23, Adam Jackson wrote:

 On 3/9/11 5:20 PM, Keith Packard wrote:
 On Tue, 08 Mar 2011 13:52:45 -0500, Adam Jacksona...@nwnk.net  wrote:
 
 Adam Jackson (14):
   vbe: Fix malloc size bug
   dix: Remove usage_hint from pixmaps, store it in -drawable.class
   dix: Remove deprecated.c
   dix: Remove PIXEL typedef
   xv: Use RESTYPE where appropriate
   xinerama: Use RESTYPE consistently
   xvmc: Use RESTYPE consistently
   xi: Use RESTYPE consistently
   glx: Remove unused _glapi_get_proc_offset and friends
   glx: unifdef SOLARIS_THREADS
   glx: unifdef USE_XTHREADS
   glx: unifdef BEOS_THREADS
   glx: Simplify _glapi_check_multithread
   glx: Remove unused _glapi_get_proc_name
 
 Erkki Seppälä (1):
   xfree86/common: Remove a configScreen leak when conf_screen is
   NULL
 
 Merged.
628d16a..a19771e  master -  master
 
 Jeremy, please cherry-pick d8caa782009abf4dc17b945e325e83fda299a534 (the VBE 
 fix above) to 1.9 branch.
 
 - ajax
 

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PULL] xserver-next, 2011-03-08

2011-03-09 Thread Adam Jackson

On 3/9/11 6:58 PM, Jeremy Huddleston wrote:

/facepalm fix applied to both 1.9 and 1.10:

424..8ffaef2  server-1.9-branch -  server-1.9-branch
3550396..0ab680f  server-1.10-branch -  server-1.10-branch


No worries, my fault for not getting it into master promptly.  Thanks!

- ajax
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 2/3] panoramiX: convert 0-panoramiXNumScreens loops to macro (v2)

2011-03-09 Thread Dave Airlie
On Thu, Mar 10, 2011 at 9:48 AM, Daniel Stone dan...@fooishbar.org wrote:
 Hi,

 On Thu, Mar 10, 2011 at 09:23:34AM +1000, Dave Airlie wrote:
 diff --git a/Xext/saver.c b/Xext/saver.c
 index 1888603..492a54f 100644
 --- a/Xext/saver.c
 +++ b/Xext/saver.c
 @@ -1288,7 +1288,7 @@ ProcScreenSaverUnsetAttributes (ClientPtr client)
         if (rc != Success)
             return (rc == BadValue) ? BadDrawable : rc;

 -       for(i = PanoramiXNumScreens - 1; i  0; i--) {
 +       FOR_NSCREENS_BACKWARD(i) {
              stuff-drawable = draw-info[i].id;
              ScreenSaverUnsetAttributes(client);
         }

 You're changing semantics here by changing info[0..n], rather than
 info[1..n].  Looks like you might just be able to turn this into a
 FOR_NSCREENS_FORWARD_SKIP though?

thats n-1..0 to n-1..0 isn't it?

Dave.
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 2/3] panoramiX: convert 0-panoramiXNumScreens loops to macro (v2)

2011-03-09 Thread Alan Coopersmith
On 03/ 9/11 04:14 PM, Dave Airlie wrote:
 On Thu, Mar 10, 2011 at 9:48 AM, Daniel Stone dan...@fooishbar.org wrote:
 Hi,

 On Thu, Mar 10, 2011 at 09:23:34AM +1000, Dave Airlie wrote:
 diff --git a/Xext/saver.c b/Xext/saver.c
 index 1888603..492a54f 100644
 --- a/Xext/saver.c
 +++ b/Xext/saver.c
 @@ -1288,7 +1288,7 @@ ProcScreenSaverUnsetAttributes (ClientPtr client)
 if (rc != Success)
 return (rc == BadValue) ? BadDrawable : rc;

 -   for(i = PanoramiXNumScreens - 1; i  0; i--) {
 +   FOR_NSCREENS_BACKWARD(i) {
  stuff-drawable = draw-info[i].id;
  ScreenSaverUnsetAttributes(client);
 }

 You're changing semantics here by changing info[0..n], rather than
 info[1..n].  Looks like you might just be able to turn this into a
 FOR_NSCREENS_FORWARD_SKIP though?
 
 thats n-1..0 to n-1..0 isn't it?

I missed it in my review, but I think Daniel is right, since it's i  0,
not i = 0.

-- 
-Alan Coopersmith-alan.coopersm...@oracle.com
 Oracle Solaris Platform Engineering: X Window System

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 2/3] panoramiX: convert 0-panoramiXNumScreens loops to macro (v2)

2011-03-09 Thread Dave Airlie
On Thu, Mar 10, 2011 at 10:17 AM, Alan Coopersmith
alan.coopersm...@oracle.com wrote:
 On 03/ 9/11 04:14 PM, Dave Airlie wrote:
 On Thu, Mar 10, 2011 at 9:48 AM, Daniel Stone dan...@fooishbar.org wrote:
 Hi,

 On Thu, Mar 10, 2011 at 09:23:34AM +1000, Dave Airlie wrote:
 diff --git a/Xext/saver.c b/Xext/saver.c
 index 1888603..492a54f 100644
 --- a/Xext/saver.c
 +++ b/Xext/saver.c
 @@ -1288,7 +1288,7 @@ ProcScreenSaverUnsetAttributes (ClientPtr client)
         if (rc != Success)
             return (rc == BadValue) ? BadDrawable : rc;

 -       for(i = PanoramiXNumScreens - 1; i  0; i--) {
 +       FOR_NSCREENS_BACKWARD(i) {
              stuff-drawable = draw-info[i].id;
              ScreenSaverUnsetAttributes(client);
         }

 You're changing semantics here by changing info[0..n], rather than
 info[1..n].  Looks like you might just be able to turn this into a
 FOR_NSCREENS_FORWARD_SKIP though?

 thats n-1..0 to n-1..0 isn't it?

 I missed it in my review, but I think Daniel is right, since it's i  0,
 not i = 0.

Oh yeah good point, will fix that up.

Dave.
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


The following changes since commit 628d16a92a7fa556fbb70bf4a4adf57ec05c190b:

2011-03-09 Thread Dave Airlie
  loader: Don't distribute sdksyms.c and make it depend on the config 
(2011-03-03 21:54:25 -0800)

are available in the git repository at:
  git://people.freedesktop.org/~airlied/xserver xinerama-cleanup

Dave Airlie (4):
  panoramiX: macro checking if drawable is root (v2)
  panoramiX: consolidate common id assignment code.
  panoramiX: convert 0-panoramiXNumScreens loops to macro (v3)
  panoramiX: convert 1-panoramiXNumScreens loops to use macro (v2)

 Xext/panoramiX.c  |   16 +++---
 Xext/panoramiX.h  |4 ++-
 Xext/panoramiXprocs.c |   50 +++-
 Xext/panoramiXsrv.h   |   11 ++
 Xext/shm.c|6 +---
 Xext/xvdisp.c |4 +-
 composite/compext.c   |5 +---
 dix/events.c  |   10 
 dix/window.c  |4 +-
 hw/dmx/dmxcb.c|7 +++--
 hw/dmx/dmxextension.c |4 +-
 hw/dmx/dmxgcops.c |2 +-
 render/render.c   |   25 ---
 13 files changed, 66 insertions(+), 82 deletions(-)
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH v2:libXt] Add test framework similar to xserver and use it to test XtAsprintf

2011-03-09 Thread Alan Coopersmith
Only two simple test cases to start with:
 - compares the results of snprintf of a short string to a static buffer
with the new buffer returned by XtAsprintf.
 - compare the results of using XtAsprintf to replicate a portion of a
very long string with the original string.

Uses malloc debugging flags for various platforms to try to catch errors
with uninitialized memory (such as the recently fixed failure to terminate
the string).

Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com
---

v2: Thanks to suggestions from many on #xorg-devel IRC, set malloc debugging
environment variables for common platforms (only tested on Solaris though)

As suggested by KiBi, add a test case long enough to force XtAsprintf to
re-run snprintf after allocating a larger buffer than the builtin default.

The configure.ac changes should eventually be replaced by new XORG_*
macros once we define them.

 Makefile.am  |2 +-
 configure.ac |   33 
 test/Alloc.c |  112 ++
 test/Makefile.am |   12 ++
 4 files changed, 158 insertions(+), 1 deletions(-)
 create mode 100644 test/Alloc.c
 create mode 100644 test/Makefile.am

diff --git a/Makefile.am b/Makefile.am
index e9e0316..8ef09ca 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,7 @@
 #  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 #  PERFORMANCE OF THIS SOFTWARE.
 
-SUBDIRS = util src include man specs
+SUBDIRS = util src include man specs test
 
 ACLOCAL_AMFLAGS = -I m4
 
diff --git a/configure.ac b/configure.ac
index 8945729..104dcf3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,6 +95,38 @@ if test x$XKB = xyes ; then
AC_DEFINE(XKB, 1, [Define to 1 to use XKB for keysym resolution.])
 fi
 
+AC_ARG_ENABLE(unit-tests,AS_HELP_STRING([--enable-unit-tests],
+  [Enable unit-tests (default: auto)]),
+[UNITTESTS=$enableval], [UNITTESTS=auto])
+if test x$UNITTESTS != xno ; then
+   PKG_CHECK_MODULES([GLIB], [glib-2.0 = 2.16],
+ [HAVE_GLIB=yes], [HAVE_GLIB=no])
+fi
+if test x$UNITTESTS = xyes; then
+   if test x$HAVE_GLIB = xno; then
+   AC_MSG_ERROR([glib required to build unit tests])
+   fi
+elif test x$UNITTESTS = xauto; then
+   UNITTESTS=$HAVE_GLIB
+fi
+
+AM_CONDITIONAL(UNITTESTS, [test x$UNITTESTS = xyes])
+
+# Memory checking support
+case $host_os in
+ solaris*)
+AC_CHECK_LIB([umem], [umem_alloc],
+[MALLOC_DEBUG_ENV='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
+;;
+ *bsd*|darwin*)
+MALLOC_DEBUG_ENV='MallocPreScribble=1 MallocScribble=1'
+;;
+ *) # Assume glibc
+MALLOC_DEBUG_ENV='MALLOC_PERTURB_=255'
+;;
+esac
+AC_SUBST([MALLOC_DEBUG_ENV])
+
 # Replaces XFileSearchPathDefault from Imake configs
 
XFILESEARCHPATHDEFAULT='$(sysconfdir)/X11/%L/%T/%N%C%S:$(sysconfdir)/X11/%l/%T/%N%C%S:$(sysconfdir)/X11/%T/%N%C%S:$(sysconfdir)/X11/%L/%T/%N%S:$(sysconfdir)/X11/%l/%T/%N%S:$(sysconfdir)/X11/%T/%N%S:$(datadir)/X11/%L/%T/%N%C%S:$(datadir)/X11/%l/%T/%N%C%S:$(datadir)/X11/%T/%N%C%S:$(datadir)/X11/%L/%T/%N%S:$(datadir)/X11/%l/%T/%N%S:$(datadir)/X11/%T/%N%S:$(libdir)/X11/%L/%T/%N%C%S:$(libdir)/X11/%l/%T/%N%C%S:$(libdir)/X11/%T/%N%C%S:$(libdir)/X11/%L/%T/%N%S:$(libdir)/X11/%l/%T/%N%S:$(libdir)/X11/%T/%N%S'
 
@@ -144,5 +176,6 @@ AC_CONFIG_FILES([Makefile
include/Makefile
man/Makefile
specs/Makefile
+   test/Makefile
xt.pc])
 AC_OUTPUT
diff --git a/test/Alloc.c b/test/Alloc.c
new file mode 100644
index 000..8a70b5f
--- /dev/null
+++ b/test/Alloc.c
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include 

Summer of code 2011

2011-03-09 Thread Stéphane Marchesin
Hi,

This is this time of year again, as the weather gets better (or worse
depending on your side of the planet) Summer of code is coming up. So
we will need to update and fill this page with our best and brightest
summer of code ideas:
http://wiki.x.org/wiki/SummerOfCodeIdeas

We have a couple ideas on that page already, but it'd be nice to get
more (we don't always need a mentor right away, if all you have is a
good idea, please add it to the page!).

Best,
Stephane
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel