Confusing or confused code

2010-03-11 Thread Michael Thayer
Hello,

I suspect that this code:

http://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/common/xf86Mode.c?id=326429badfc76885e4652ddc72860810c0e8d102#n1300

until line 1313 is supposed to be freeing the old list at
scrp-clockRanges, duplicating the user supplied list and storing it
there.  If that is right, then it looks to me though like it will not
work unless scrp-clockRanges is initially NULL and the user only
supplies a list with a single element.  Did I miss something important
there?

Regards,

Michael
-- 
Sun Microsystems GmbHMichael Thayer
Werkstrasse 24   VirtualBox engineer
71384 Weinstadt, Germany mailto:michael.tha...@sun.com

Sitz der Gesellschaft:
Sun Microsystems GmbH, Sonnenallee 1, 85551 Kirchheim-Heimstetten
Amtsgericht Muenchen: HRB 161028
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels
Vorsitzender des Aufsichtsrates: Martin Haering

___
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] Record: Avoid duplicates from replaying frozen events

2010-03-11 Thread Daniel Stone
Reintroduce a check which used to be there in the old
ProcessKeyboardEvent/ProcessPointerEvent codepath, which avoids us
recording events subject to a grab twice: once when it's first processed
in EnqueueEvent, and then again when it's thawed and being replayed.

This required a tiny amount of code motion to expose syncEvents.

Signed-off-by: Daniel Stone dan...@fooishbar.org
---
 Xi/exevents.c  |2 +-
 dix/events.c   |   28 +---
 include/inputstr.h |   30 ++
 3 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index a63b65b..e680f6f 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1051,7 +1051,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
 break;
 }
 
-if (DeviceEventCallback) {
+if (DeviceEventCallback  !syncEvents.playingEvents) {
DeviceEventInfoRec eventinfo;
SpritePtr pSprite = device-spriteInfo-sprite;
 
diff --git a/dix/events.c b/dix/events.c
index 2e94726..7ad64ca 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -253,33 +253,7 @@ extern BOOL EventIsKeyRepeat(xEvent *event);
  */
 InputInfo inputInfo;
 
-/**
- * syncEvents is the global structure for queued events.
- *
- * Devices can be frozen through GrabModeSync pointer grabs. If this is the
- * case, events from these devices are added to pending instead of being
- * processed normally. When the device is unfrozen, events in pending are
- * replayed and processed as if they would come from the device directly.
- */
-static struct {
-QdEventPtr pending, /**  list of queued events */
-*pendtail; /** last event in list */
-/** The device to replay events for. Only set in AllowEvents(), in which
- * case it is set to the device specified in the request. */
-DeviceIntPtr   replayDev;  /* kludgy rock to put flag for */
-
-/**
- * The window the events are supposed to be replayed on.
- * This window may be set to the grab's window (but only when
- * Replay{Pointer|Keyboard} is given in the XAllowEvents()
- * request. */
-WindowPtr  replayWin;  /*   ComputeFreezes*/
-/**
- * Flag to indicate whether we're in the process of
- * replaying events. Only set in ComputeFreezes(). */
-Bool   playingEvents;
-TimeStamp  time;
-} syncEvents;
+EventSyncInfoRec syncEvents;
 
 /**
  * The root window the given device is currently on.
diff --git a/include/inputstr.h b/include/inputstr.h
index 29ad5a8..15184d0 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -557,4 +557,34 @@ typedef struct _QdEvent {
 InternalEvent  *event;
 } QdEventRec;
 
+/**
+ * syncEvents is the global structure for queued events.
+ *
+ * Devices can be frozen through GrabModeSync pointer grabs. If this is the
+ * case, events from these devices are added to pending instead of being
+ * processed normally. When the device is unfrozen, events in pending are
+ * replayed and processed as if they would come from the device directly.
+ */
+typedef struct _EventSyncInfo {
+QdEventPtr  pending, /**  list of queued events */
+*pendtail; /** last event in list */
+/** The device to replay events for. Only set in AllowEvents(), in which
+ * case it is set to the device specified in the request. */
+DeviceIntPtrreplayDev;  /* kludgy rock to put flag for */
+
+/**
+ * The window the events are supposed to be replayed on.
+ * This window may be set to the grab's window (but only when
+ * Replay{Pointer|Keyboard} is given in the XAllowEvents()
+ * request. */
+WindowPtr   replayWin;  /*   ComputeFreezes*/
+/**
+ * Flag to indicate whether we're in the process of
+ * replaying events. Only set in ComputeFreezes(). */
+BoolplayingEvents;
+TimeStamp   time;
+} EventSyncInfoRec, *EventSyncInfoPtr;
+
+extern EventSyncInfoRec syncEvents;
+
 #endif /* INPUTSTRUCT_H */
-- 
1.6.2.5

___
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] Record: Avoid duplicates from replaying frozen events

2010-03-11 Thread Peter Hutterer
On Thu, Mar 11, 2010 at 02:19:04PM +0200, Daniel Stone wrote:
 Reintroduce a check which used to be there in the old
 ProcessKeyboardEvent/ProcessPointerEvent codepath, which avoids us
 recording events subject to a grab twice: once when it's first processed
 in EnqueueEvent, and then again when it's thawed and being replayed.
 
 This required a tiny amount of code motion to expose syncEvents.
 
 Signed-off-by: Daniel Stone dan...@fooishbar.org
 ---
  Xi/exevents.c  |2 +-
  dix/events.c   |   28 +---
  include/inputstr.h |   30 ++
  3 files changed, 32 insertions(+), 28 deletions(-)
 
 diff --git a/Xi/exevents.c b/Xi/exevents.c
 index a63b65b..e680f6f 100644
 --- a/Xi/exevents.c
 +++ b/Xi/exevents.c
 @@ -1051,7 +1051,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr 
 device)
  break;
  }
  
 -if (DeviceEventCallback) {
 +if (DeviceEventCallback  !syncEvents.playingEvents) {
   DeviceEventInfoRec eventinfo;
   SpritePtr pSprite = device-spriteInfo-sprite;
  
 diff --git a/dix/events.c b/dix/events.c
 index 2e94726..7ad64ca 100644
 --- a/dix/events.c
 +++ b/dix/events.c
 @@ -253,33 +253,7 @@ extern BOOL EventIsKeyRepeat(xEvent *event);
   */
  InputInfo inputInfo;
  
 -/**
 - * syncEvents is the global structure for queued events.
 - *
 - * Devices can be frozen through GrabModeSync pointer grabs. If this is the
 - * case, events from these devices are added to pending instead of being
 - * processed normally. When the device is unfrozen, events in pending are
 - * replayed and processed as if they would come from the device directly.
 - */
 -static struct {
 -QdEventPtr   pending, /**  list of queued events */
 -*pendtail; /** last event in list */
 -/** The device to replay events for. Only set in AllowEvents(), in which
 - * case it is set to the device specified in the request. */
 -DeviceIntPtr replayDev;  /* kludgy rock to put flag for */
 -
 -/**
 - * The window the events are supposed to be replayed on.
 - * This window may be set to the grab's window (but only when
 - * Replay{Pointer|Keyboard} is given in the XAllowEvents()
 - * request. */
 -WindowPtrreplayWin;  /*   ComputeFreezes
 */
 -/**
 - * Flag to indicate whether we're in the process of
 - * replaying events. Only set in ComputeFreezes(). */
 -Bool playingEvents;
 -TimeStamptime;
 -} syncEvents;
 +EventSyncInfoRec syncEvents;
  
  /**
   * The root window the given device is currently on.
 diff --git a/include/inputstr.h b/include/inputstr.h
 index 29ad5a8..15184d0 100644
 --- a/include/inputstr.h
 +++ b/include/inputstr.h
 @@ -557,4 +557,34 @@ typedef struct _QdEvent {
  InternalEvent*event;
  } QdEventRec;
  
 +/**
 + * syncEvents is the global structure for queued events.
 + *
 + * Devices can be frozen through GrabModeSync pointer grabs. If this is the
 + * case, events from these devices are added to pending instead of being
 + * processed normally. When the device is unfrozen, events in pending are
 + * replayed and processed as if they would come from the device directly.
 + */
 +typedef struct _EventSyncInfo {
 +QdEventPtr  pending, /**  list of queued events */
 +*pendtail; /** last event in list */
 +/** The device to replay events for. Only set in AllowEvents(), in which
 + * case it is set to the device specified in the request. */
 +DeviceIntPtrreplayDev;  /* kludgy rock to put flag for */
 +
 +/**
 + * The window the events are supposed to be replayed on.
 + * This window may be set to the grab's window (but only when
 + * Replay{Pointer|Keyboard} is given in the XAllowEvents()
 + * request. */
 +WindowPtr   replayWin;  /*   ComputeFreezes*/
 +/**
 + * Flag to indicate whether we're in the process of
 + * replaying events. Only set in ComputeFreezes(). */
 +BoolplayingEvents;
 +TimeStamp   time;
 +} EventSyncInfoRec, *EventSyncInfoPtr;
 +
 +extern EventSyncInfoRec syncEvents;
 +
  #endif /* INPUTSTRUCT_H */
 -- 
 1.6.2.5

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

Cheers,
  Peter
___
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] doc: specify 1.6.1 as the minimum version for doxygen.

2010-03-11 Thread Gaetan Nadon
Older versions generate filenames that are different from
the ones listed in the Makefile.

Signed-off-by: Gaetan Nadon mems...@videotron.ca
---
 configure.ac |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0579551..78a871e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,10 +34,10 @@ AM_MAINTAINER_MODE
 
 # Require xorg-macros: XORG_DEFAULT_OPTIONS
 m4_ifndef([XORG_MACROS_VERSION],
-  [m4_fatal([must install xorg-macros 1.5 or later before running 
autoconf/autogen])])
-XORG_MACROS_VERSION(1.5)
+  [m4_fatal([must install xorg-macros 1.6 or later before running 
autoconf/autogen])])
+XORG_MACROS_VERSION(1.6)
 XORG_DEFAULT_OPTIONS
-XORG_WITH_DOXYGEN
+XORG_WITH_DOXYGEN(1.6.1)
 
 m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install fontutil 1.1 or 
later before running autoconf/autogen])])
 XORG_FONT_MACROS_VERSION(1.1)
-- 
1.6.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] configure: dix: support a variable number of screen structures

2010-03-11 Thread Mikhail Gusarov

Twas brillig at 15:22:14 10.03.2010 UTC-03 when vigna...@freedesktop.org did 
gyre and gimble:

 TV Signed-off-by: Tiago Vignatti tiago.vigna...@nokia.com

Reviewed-by: Mikhail Gusarov dotted...@dottedmag.net

 TV ---
 TV I'm not sure if I should declare it inside dix-config.h though. Is it okay 
to
 TV set there?

 TV Also, I'm afraid I might be breaking other DDXs. Jeremy, Jon Turney and
 TV others, can you please check this? Thanks.

Tested-by: Mikhail Gusarov dotted...@dottedmag.net (using kdrive/fbdev)

-- 
  http://fossarchy.blogspot.com/


pgp9iTczG7soC.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

[PULL] Cygwin build fixes, XF8Bigfont warnings

2010-03-11 Thread Yaakov (Cygwin/X)

These patches were all previously sent to this list, but some were ignored.

The following changes since commit f2eacb4646beb25d055de22868f93e6b24f229b6:
  Peter Hutterer (1):
Revert dix: Use DeliverGrabbedEvent for implicit passive grabs
(#25400)

are available in the git repository at:

  git://anongit.freedesktop.org/~yselkowitz/xserver.git master

Yaakov Selkowitz (8):
  Cygwin/X: Fix make dist after 
11252ed82e1f361b99e86521ac9314f868bd1a3a

  Cygwin/X: Fix windres rule for automake silent rules
  Use libtool -export-dynamic flag for portability
  Rename xdmx client to dmxinfo
  Xext: fix prototype warnings in xf86bigfont.c
  dix: fix XF86Bigfont declaration warnings in dixfonts.c
  os: fix XF86Bigfont declaration warnings in log.c
  mi: remove deprecated #include X11/extensions/xf86bigfstr.h in
miinitext.c

 Xext/xf86bigfont.c|8 ++--
 configure.ac  |   14 +++---
 dix/dixfonts.c|3 +--
 hw/dmx/examples/.gitignore|2 +-
 hw/dmx/examples/Makefile.am   |8 
 hw/dmx/examples/{xdmx.c = dmxinfo.c} |0
 hw/xwin/Makefile.am   |3 ++-
 mi/miinitext.c|2 +-
 os/log.c  |3 +--
 9 files changed, 19 insertions(+), 24 deletions(-)
 rename hw/dmx/examples/{xdmx.c = dmxinfo.c} (100%)
___
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: [RFC] Define/use pad() and pad_mask() instead of open coding it

2010-03-11 Thread Peter Hutterer
On Thu, Mar 11, 2010 at 07:33:30PM -0500, Matt Turner wrote:
 à la the Linux Kernel's ALIGN and __ALIGN_MASK macros.
 
 Not even compile tested, some files might need to include misc.h.
 
 CC: Peter Hutterer peter.hutte...@who-t.net
 Signed-off-by: Matt Turner matts...@gmail.com

ACK in principle, not tested either. :)

 diff --git a/include/misc.h b/include/misc.h
 index 62d813e..98d39bd 100644
 --- a/include/misc.h
 +++ b/include/misc.h
 @@ -200,6 +200,16 @@ bytes_to_int32(const int bytes) {
  return (((bytes) + 3)  2);
  }

+ /** 
+  * please comment on what I'm supposed to be doing 
+  */

  
 +static inline int
 +pad_mask(const int bytes, const int mask) {
 + return (((bytes) + mask)  ~mask);

you don't need the () around bytes, this isn't a macro.
which, looking at the context goes for bytes_to_int32 as well :)

 +}
 +
 +static inline int
 +pad(const int bytes, const int mask) {

shouldn't the second arg be called alignment or something, not mask?
otherwise, it's a bit confusing why both pad() and pad_mask() take a mask
argument.

 + return pad_mask(bytes, mask - 1);
 +}
 +

Cheers,
  Peter

___
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: [RFC] Define/use pad() and pad_mask() instead of open coding it

2010-03-11 Thread Matt Turner
On Thu, Mar 11, 2010 at 8:05 PM, Peter Hutterer
peter.hutte...@who-t.net wrote:
 On Thu, Mar 11, 2010 at 07:33:30PM -0500, Matt Turner wrote:
 à la the Linux Kernel's ALIGN and __ALIGN_MASK macros.

 Not even compile tested, some files might need to include misc.h.

 CC: Peter Hutterer peter.hutte...@who-t.net
 Signed-off-by: Matt Turner matts...@gmail.com

 ACK in principle, not tested either. :)

 diff --git a/include/misc.h b/include/misc.h
 index 62d813e..98d39bd 100644
 --- a/include/misc.h
 +++ b/include/misc.h
 @@ -200,6 +200,16 @@ bytes_to_int32(const int bytes) {
      return (((bytes) + 3)  2);
  }

 + /**
 +  * please comment on what I'm supposed to be doing
 +  */

Got any suggested text?


 +static inline int
 +pad_mask(const int bytes, const int mask) {
 +     return (((bytes) + mask)  ~mask);

 you don't need the () around bytes, this isn't a macro.
 which, looking at the context goes for bytes_to_int32 as well :)

 +}
 +
 +static inline int
 +pad(const int bytes, const int mask) {

 shouldn't the second arg be called alignment or something, not mask?
 otherwise, it's a bit confusing why both pad() and pad_mask() take a mask
 argument.

Good point.

 +     return pad_mask(bytes, mask - 1);
 +}
 +

 Cheers,
  Peter

I've found some more too--((x + bytes - 1) / bytes) * bytes. Ugh, how nasty.

Matt
___
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 libXi] doc: specify minimum version for xmlto and ascidoc

2010-03-11 Thread Fernando Carrijo
Gaetan Nadon mems...@videotron.ca wrote:
 Specify 0.0.20 as the minimum version for xmlto.
 Older versions do not have fop backend.
 
 Specify 8.4.5 as the minimum version for ascidooc.
 Older versions stop with errors.
 
 Signed-off-by: Gaetan Nadon mems...@videotron.ca
 ---
  configure.ac |8 
  1 files changed, 4 insertions(+), 4 deletions(-)
 
 diff --git a/configure.ac b/configure.ac
 index 8aaa9d2..01416de 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -8,11 +8,11 @@ AM_MAINTAINER_MODE
  
  # Require xorg-macros: XORG_DEFAULT_OPTIONS
  m4_ifndef([XORG_MACROS_VERSION],
 -  [m4_fatal([must install xorg-macros 1.5 or later before running 
 autoconf/autogen])])
 -XORG_MACROS_VERSION(1.5)
 +  [m4_fatal([must install xorg-macros 1.6 or later before running 
 autoconf/autogen])])
 +XORG_MACROS_VERSION(1.6)
  XORG_DEFAULT_OPTIONS
 -XORG_WITH_XMLTO
 -XORG_WITH_ASCIIDOC
 +XORG_WITH_XMLTO(0.0.20)
 +XORG_WITH_ASCIIDOC(8.4.5)
  AM_CONFIG_HEADER(src/config.h)
  
  # Check for progs
 -- 
 1.6.0.4
 
 Also done for xmlto in libXcomposite, libXfont and libXtst

Tested-by: Fernando Carrijo fcarr...@yahoo.com.br

___
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


[PULL] last of the build fixes, RECORD fix

2010-03-11 Thread Peter Hutterer
Keith,

Please pull from my repo. Just two patches, one to stop duplicated events in
RECORD, the other one is the last of the build fixes I need for 1.7.6.

Cheers,
  Peter

The following changes since commit f2eacb4646beb25d055de22868f93e6b24f229b6:
  Peter Hutterer (1):
Revert dix: Use DeliverGrabbedEvent for implicit passive grabs 
(#25400)

are available in the git repository at:

  git://people.freedesktop.org/~whot/xserver.git for-keith

Daniel Stone (1):
  Record: Avoid duplicates from replaying frozen events

Eamon Walsh (1):
  Xext: Link to external libraries when necessary.

 Xext/Makefile.am   |4 
 Xi/exevents.c  |2 +-
 configure.ac   |2 +-
 dix/events.c   |   28 +---
 include/inputstr.h |   30 ++
 5 files changed, 37 insertions(+), 29 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


Re: [RFC] Define/use pad() and pad_mask() instead of open coding it

2010-03-11 Thread Matt Turner
On Thu, Mar 11, 2010 at 8:37 PM, Peter Hutterer
peter.hutte...@who-t.net wrote:
 On Thu, Mar 11, 2010 at 08:19:04PM -0500, Matt Turner wrote:
 On Thu, Mar 11, 2010 at 8:05 PM, Peter Hutterer
 peter.hutte...@who-t.net wrote:
  On Thu, Mar 11, 2010 at 07:33:30PM -0500, Matt Turner wrote:
  à la the Linux Kernel's ALIGN and __ALIGN_MASK macros.
 
  Not even compile tested, some files might need to include misc.h.
 
  CC: Peter Hutterer peter.hutte...@who-t.net
  Signed-off-by: Matt Turner matts...@gmail.com
 
  ACK in principle, not tested either. :)
 
  diff --git a/include/misc.h b/include/misc.h
  index 62d813e..98d39bd 100644
  --- a/include/misc.h
  +++ b/include/misc.h
  @@ -200,6 +200,16 @@ bytes_to_int32(const int bytes) {
       return (((bytes) + 3)  2);
   }
 
  + /**
  +  * please comment on what I'm supposed to be doing
  +  */

 Got any suggested text?

 nothing special, just something like this:

 pad(): return the number of bytes needed to align bytes with a multiple of
 alignment
 (assuming the second param was renamed of course). that should do, plus the
 param/return description for completeness' sake.

 pad_mask(): return the number of bytes needed to align bytes with the bit
 mask.

Alright, I have:
/**
 * Calculate the number of bytes needed to align bytes with the bit mask.
 * @param bytes The minimum number of bytes needed.
 * @param mask The bit mask to align to.
 * @return The number aligned to the bit mask.
 */
static inline int
pad_mask(const int bytes, const int mask) {
return ((bytes + mask)  ~mask);
}

/**
 * Calculate the number of bytes needed to align bytes to a multiple of
 * alignment.
 * @param bytes The minimum number of bytes needed.
 * @param alignment The number to align to.
 * @return The next multiple of alignment greater or equal to bytes.
 */
static inline int
pad(const int bytes, const int alignment) {
return pad_mask(bytes, alignment - 1);
}

How's this?

 it might be worth checking the mask for completeness as well. Or at least
 document what happens when you call a pad_mask(2, 3)?

I'm not sure I follow here. Do you mean that the mask should always be
a power of two minus one?

 also, looks like by adding these you can replace the body of bits_to_bytes
 and friends with pad().

I guess, but
- return (((bytes) + 3)  2);
+ return pad(bytes, 4)  2;
doesn't look like an improvement to me (looks like an extra and-not)
Maybe I missed it.

Thanks,
Matt


 Cheers,
  Peter

 
  +static inline int
  +pad_mask(const int bytes, const int mask) {
  +     return (((bytes) + mask)  ~mask);
 
  you don't need the () around bytes, this isn't a macro.
  which, looking at the context goes for bytes_to_int32 as well :)
 
  +}
  +
  +static inline int
  +pad(const int bytes, const int mask) {
 
  shouldn't the second arg be called alignment or something, not mask?
  otherwise, it's a bit confusing why both pad() and pad_mask() take a mask
  argument.

 Good point.

  +     return pad_mask(bytes, mask - 1);
  +}
  +
 
  Cheers,
   Peter

 I've found some more too--((x + bytes - 1) / bytes) * bytes. Ugh, how nasty..

 Matt
___
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


[RFC] Define/use pad() instead of open coding it

2010-03-11 Thread Matt Turner
à la the Linux Kernel's ALIGN macro.

Not even compile tested, some files might need to include misc.h.

CC: Peter Hutterer peter.hutte...@who-t.net
Signed-off-by: Matt Turner matts...@gmail.com
---
 hw/dmx/dmxpict.c  |2 +-
 hw/kdrive/ephyr/XF86dri.c |6 +++---
 hw/xfree86/common/xf86Mode.c  |2 +-
 hw/xfree86/common/xf86fbman.c |   10 +-
 hw/xfree86/dixmods/extmod/xf86vmode.c |6 +++---
 hw/xfree86/int10/generic.c|   13 ++---
 hw/xfree86/os-support/bus/Sbus.c  |   12 ++--
 hw/xquartz/xpr/xprCursor.c|2 +-
 include/misc.h|   16 ++--
 mi/mibank.c   |6 ++
 miext/rootless/rootlessWindow.c   |2 +-
 os/utils.c|6 +++---
 render/render.c   |2 +-
 13 files changed, 47 insertions(+), 38 deletions(-)

diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c
index 072e3a6..a2b9484 100644
--- a/hw/dmx/dmxpict.c
+++ b/hw/dmx/dmxpict.c
@@ -674,7 +674,7 @@ static int dmxProcRenderSetPictureFilter(ClientPtr client)
 
 if (pPictPriv-pict) {
filter  = (char *)(stuff + 1);
-   params  = (XFixed *)(filter + ((stuff-nbytes + 3)  ~3));
+   params  = (XFixed *)(filter + pad(stuff-nbytes, 4));
nparams = ((XFixed *)stuff + client-req_len) - params;
 
XRenderSetPictureFilter(dmxScreen-beDisplay,
diff --git a/hw/kdrive/ephyr/XF86dri.c b/hw/kdrive/ephyr/XF86dri.c
index 08123d3..ed8271b 100644
--- a/hw/kdrive/ephyr/XF86dri.c
+++ b/hw/kdrive/ephyr/XF86dri.c
@@ -222,7 +222,7 @@ XF86DRIOpenConnection (Display *dpy, int screen,
 
 if (rep.length) {
 if (!(*busIdString = (char *)Xcalloc(rep.busIdStringLength + 1, 1))) {
-_XEatData(dpy, ((rep.busIdStringLength+3)  ~3));
+_XEatData(dpy, pad(rep.busIdStringLength, 4));
 UnlockDisplay(dpy);
 SyncHandle();
 TRACE(OpenConnection... return False);
@@ -317,7 +317,7 @@ Bool XF86DRIGetClientDriverName(Display *dpy, int screen,
 
 if (rep.length) {
 if (!(*clientDriverName = (char *)Xcalloc(rep.clientDriverNameLength + 
1, 1))) {
-_XEatData(dpy, ((rep.clientDriverNameLength+3)  ~3));
+_XEatData(dpy, pad(rep.clientDriverNameLength, 4));
 UnlockDisplay(dpy);
 SyncHandle();
 TRACE(GetClientDriverName... return False);
@@ -588,7 +588,7 @@ XF86DRIGetDeviceInfo (Display *dpy, int screen, 
drm_handle_t *hFrameBuffer,
 
 if (rep.length) {
 if (!(*pDevPrivate = (void *)Xcalloc(rep.devPrivateSize, 1))) {
-_XEatData(dpy, ((rep.devPrivateSize+3)  ~3));
+_XEatData(dpy, pad(rep.devPrivateSize, 4));
 UnlockDisplay(dpy);
 SyncHandle();
 TRACE(GetDeviceInfo... return False);
diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index 949d4fc..c3e518a 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -740,7 +740,7 @@ xf86CheckModeSize(ScrnInfoPtr scrp, int w, int x, int y)
 if ((w  0) || (x  0) || (y = 0))
return FALSE;
 
-lineWidth = (((w * bpp) + pad - 1) / pad) * pad;
+lineWidth = pad(w * bpp, pad);
 lastWidth = x * bpp;
 
 /*
diff --git a/hw/xfree86/common/xf86fbman.c b/hw/xfree86/common/xf86fbman.c
index 5b88717..049c419 100644
--- a/hw/xfree86/common/xf86fbman.c
+++ b/hw/xfree86/common/xf86fbman.c
@@ -370,7 +370,7 @@ AllocateArea(
for(i = 0; i  num; i++, boxp++) {
x = boxp-x1;
if (granularity  1)
-   x = ((x + granularity - 1) / granularity) * granularity;
+   x = pad(x, granularity);
 
if(((boxp-y2 - boxp-y1)  h) || ((boxp-x2 - x)  w))
   continue;
@@ -398,7 +398,7 @@ AllocateArea(
   boxp = (link-area.box);
   x = boxp-x1;
   if (granularity  1)
-   x = ((x + granularity - 1) / granularity) * granularity;
+   x = pad(x, granularity);
 
   if(((boxp-y2 - boxp-y1)  h) || ((boxp-x2 - x)  w)) {
link = link-next;
@@ -683,7 +683,7 @@ localQueryLargestOffscreenArea(
 while(nbox--) {
x = pbox-x1;
if (granularity  1)
-  x = ((x + granularity - 1) / granularity) * granularity;
+  x = pad(x, granularity);
 
w = pbox-x2 - x;
h = pbox-y2 - pbox-y1;
@@ -842,7 +842,7 @@ AllocateLinear(
   if (!linear-area  linear-free) {
 offset = linear-linear.offset;
 if (granularity  1)
-   offset = ((offset + granularity - 1) / granularity) * granularity;
+   offset = pad(offset, granularity);
 end = offset+size;
 if (end = (linear-linear.offset + linear-linear.size))
break;
@@ -964,7 +964,7 @@ localAllocateOffscreenLinear(
linear-size = h * w;
linear-offset = (pitch * area-box.y1) + area-box.x1;
if (gran  1)
-  

[PATCH] Don't bother checking for O_ASYNC, glibc's had it since '98.

2010-03-11 Thread Matt Turner
No, seriously. 1998.

Signed-off-by: Matt Turner matts...@gmail.com
---
 hw/xfree86/os-support/shared/sigio.c |   12 
 1 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/hw/xfree86/os-support/shared/sigio.c 
b/hw/xfree86/os-support/shared/sigio.c
index aed5654..88f1d49 100644
--- a/hw/xfree86/os-support/shared/sigio.c
+++ b/hw/xfree86/os-support/shared/sigio.c
@@ -67,14 +67,6 @@
 # include stropts.h
 #endif
 
-/*
- * Linux libc5 defines FASYNC, but not O_ASYNC.  Don't know if it is
- * functional or not.
- */
-#if defined(FASYNC)  !defined(O_ASYNC)
-#  define O_ASYNC FASYNC
-#endif
-
 #ifdef MAXDEVICES
 /* MAXDEVICES represents the maximimum number of input devices usable
  * at the same time plus one entry for DRM support.
@@ -155,7 +147,6 @@ xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), 
void *closure)
if (xf86IsPipe (fd))
return 0;
blocked = xf86BlockSIGIO();
-#ifdef O_ASYNC
if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) {
xf86Msg(X_WARNING, fcntl(%d, O_ASYNC): %s\n,
fd, strerror(errno));
@@ -167,7 +158,6 @@ xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), 
void *closure)
installed = TRUE;
}
}
-#endif
 #ifdef I_SETSIG /* System V Streams - used on Solaris for input devices */
if (!installed  isastream(fd)) {
if (ioctl(fd, I_SETSIG, S_INPUT | S_ERROR | S_HANGUP) == -1) {
@@ -247,9 +237,7 @@ xf86RemoveSIGIOHandler(int fd)
 }
 if (ret)
 {
-#ifdef O_ASYNC
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL)  ~O_ASYNC);
-#endif
 #ifdef I_SETSIG
if (isastream(fd)) {
if (ioctl(fd, I_SETSIG, 0) == -1) {
-- 
1.6.4.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] Don't bother checking for O_ASYNC, glibc's had it since '98.

2010-03-11 Thread Alan Coopersmith
But other kernels/libc's still don't have it in 2010.   Yes, seriously, 2010.
(Hence the #ifdef I_SETSIG code in there for Solaris  other SysV flavors.)

Delete the Linux libc5 comment, and the first hunk to define O_ASYNC to FSYNC
if you want, but please don't delete the later #ifdefs.

-alan-

Matt Turner wrote:
 No, seriously. 1998.
 
 Signed-off-by: Matt Turner matts...@gmail.com
 ---
  hw/xfree86/os-support/shared/sigio.c |   12 
  1 files changed, 0 insertions(+), 12 deletions(-)
 
 diff --git a/hw/xfree86/os-support/shared/sigio.c 
 b/hw/xfree86/os-support/shared/sigio.c
 index aed5654..88f1d49 100644
 --- a/hw/xfree86/os-support/shared/sigio.c
 +++ b/hw/xfree86/os-support/shared/sigio.c
 @@ -67,14 +67,6 @@
  # include stropts.h
  #endif
  
 -/*
 - * Linux libc5 defines FASYNC, but not O_ASYNC.  Don't know if it is
 - * functional or not.
 - */
 -#if defined(FASYNC)  !defined(O_ASYNC)
 -#  define O_ASYNC FASYNC
 -#endif
 -
  #ifdef MAXDEVICES
  /* MAXDEVICES represents the maximimum number of input devices usable
   * at the same time plus one entry for DRM support.
 @@ -155,7 +147,6 @@ xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), 
 void *closure)
   if (xf86IsPipe (fd))
   return 0;
   blocked = xf86BlockSIGIO();
 -#ifdef O_ASYNC
   if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) {
   xf86Msg(X_WARNING, fcntl(%d, O_ASYNC): %s\n,
   fd, strerror(errno));
 @@ -167,7 +158,6 @@ xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), 
 void *closure)
   installed = TRUE;
   }
   }
 -#endif
  #ifdef I_SETSIG /* System V Streams - used on Solaris for input devices */
   if (!installed  isastream(fd)) {
   if (ioctl(fd, I_SETSIG, S_INPUT | S_ERROR | S_HANGUP) == -1) {
 @@ -247,9 +237,7 @@ xf86RemoveSIGIOHandler(int fd)
  }
  if (ret)
  {
 -#ifdef O_ASYNC
   fcntl(fd, F_SETFL, fcntl(fd, F_GETFL)  ~O_ASYNC);
 -#endif
  #ifdef I_SETSIG
   if (isastream(fd)) {
   if (ioctl(fd, I_SETSIG, 0) == -1) {

-- 
-Alan Coopersmith-   alan.coopersm...@sun.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