Re: How to check in shell which output is primary?

2012-02-15 Thread Maciej Sitarz
Hi again,
wertarbyte developer shared on github a change to xrandr to dump the
entire configuration in an easily parsable format.

https://github.com/wertarbyte/xrandr/commit/a2abe6d3989334966dcee39fb13c23ebeaeb63b5

It has not been merged into main branch, maybe including it would be a
better idea then my few lines?

Best Regards
-- 
Maciej Sitarz
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: arch...@mail-archive.com


[ANNOUNCE] xfd 1.1.1

2012-02-15 Thread Alan Coopersmith
xfd is a simple Xaw app to display all the characters in a font using 
either the X11 core protocol or libXft2.

This minor maintenance release fixes some build configuration issues
and some (but not all) compiler warnings.

Alan Coopersmith (4):
  Strip trailing whitespace
  Add const attribute to domaindir fix gcc -Wwrite-strings warnings
  Remove freetype2 from PKG_CHECK_MODULES list
  xfd 1.1.1

Gaetan Nadon (6):
  config: replace deprecated AC_HELP_STRING with AS_HELP_STRING
  config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS
  man: remove trailing spaces and tabs
  man: replace hard coded man page section with substitution strings
  config: move man pages into their own directory
  Use the Automake recommended alternative to AX_DEFINE_DIR

git tag: xfd-1.1.1

http://xorg.freedesktop.org/archive/individual/app/xfd-1.1.1.tar.bz2
MD5:  b3893e03a5288927781acd5d3c65ba19
SHA1: b8662c6c6821f1f82995bcb98bb986b56716b787
SHA256: 3fbef0d5ed6dc088017df156e748d187b2d1aaedc3de7ea96e505ea6d1af7b73

http://xorg.freedesktop.org/archive/individual/app/xfd-1.1.1.tar.gz
MD5:  1e4eb9e16fbb6864948c20e1e0126d38
SHA1: 41763590b5f1b0285804886b921cebef2a1272dc
SHA256: e7c2a8f17992f7f6822ce175045e329995f4f64ad45ad8a87130ba7de686828c


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


pgpPJekqXPD7o.pgp
Description: PGP signature
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: arch...@mail-archive.com

Nominations for X.Org Foundation Board of Directors extended

2012-02-15 Thread Alan Coopersmith
The nomination deadline for candidates for election to the X.Org Foundation 
Board of Directors has been extended until 23.59 GMT on Monday, 20 February

2012.

The Board consists of directors elected from the membership.  Each
year, an election is held to bring the total number of directors to
eight.  The four members receiving the highest vote totals will serve
as directors for two year terms.

The directors who received two year terms starting last year were
Eric Anholt, Alan Coopersmith, Stuart Kreitman, and Bart Massey.  They
will continue to serve until their term ends in next year's elections.
Current directors who were elected two years ago, and whose term is expiring
are Alex Deucher, Matthieu Herrb, Matthias Hopf, and Keith Packard.

A director is expected to participate in the biweekly IRC meeting to
discuss current business and to attend the annual meeting of the X.Org
Foundation, which will be held at a location determined in advance by
the Board of Directors.

A member may nominate themselves or any other member they feel is
qualified.  Nominations should be sent to the Election Committee at
electi...@x.org.

Nominees shall be required to be current members of the X.Org
Foundation, and submit a  personal statement of up to 200 words that
will be provided to prospective voters.  The collected statements,
along with the statement of contribution to the X.Org Foundation in
the members account page on http://members.x.org, will be made
available to all voters to help them make their voting decisions.

Nominations and completed personal statements must be received no later
than 23.59 GMT on 20 February 2012.

The Election Committee
X.Org Foundation
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: arch...@mail-archive.com


Re: [PATCH] render: don't bother with animated cursors on floating slaves (#39989)

2012-02-15 Thread Jon TURNEY
On 26/01/2012 21:43, Colin Harrison wrote:
 On my Windows build this patch...
 
 diff --git a/render/animcur.c b/render/animcur.c
 index 4cf1fdf..0f174fd 100644
 --- a/render/animcur.c
 +++ b/render/animcur.c
 @@ -208,6 +208,9 @@ AnimCurDisplayCursor (DeviceIntPtr pDev,
  AnimCurScreenPtras = GetAnimCurScreen(pScreen);
  Bool ret;
  
 +if (IsFloating(pDev))
 + return FALSE;
 +
  Unwrap (as, pScreen, DisplayCursor);
  if (IsAnimCur(pCursor))
  {
 
 causes the 'default'  cursor to disappear...(I like to party_like_its 1989!)
 
 I always need a cursor as when the X root window isn't hidden on Windows you
 can't easily control anything as the 'black or stippled X window' blots out
 Microsoft's stuff :)

I did a bit of testing with -retro and the Xorg DDX, and I see the same thing,
the saltire cursor is missing initially.

However, reverting this commit didn't help. This seems to be a regression
since 1.10, present in 1.11.  Bisecting pointed to dc57f89 Switch to use
IsFloating()
___
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 Xaw3D] fix segfaults on tip popups. #46124

2012-02-15 Thread Devin J. Pohly
From: Devin J. Pohly djpohly+x...@gmail.com

When XAW_INTERNATIONALIZATION isn't defined, some uninitialized stack
data was being passed to XtGetValues.  This makes it not do that.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=46124
Signed-off-by: Devin J. Pohly djpohly+x...@gmail.com
---
 src/Tip.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/Tip.c b/src/Tip.c
index 5f54d14..5542fc5 100644
--- a/src/Tip.c
+++ b/src/Tip.c
@@ -606,8 +606,10 @@ TipTimeoutCallback(XtPointer closure, XtIntervalId *id)
 #ifdef XAW_INTERNATIONALIZATION
 info-tip-tip.international = False;
 XtSetArg(args[1], XtNinternational, info-tip-tip.international);
-#endif
 XtGetValues(winfo-widget, args, 2);
+#else
+XtGetValues(winfo-widget, args, 1);
+#endif
 
 TipLayout(info);
 TipPosition(info);
-- 
1.7.9

___
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 Xaw3D] fix segfaults on tip popups. #46124

2012-02-15 Thread Matt Turner
On Wed, Feb 15, 2012 at 2:05 PM, Devin J. Pohly djpohly+x...@gmail.com wrote:
 From: Devin J. Pohly djpohly+x...@gmail.com

 When XAW_INTERNATIONALIZATION isn't defined, some uninitialized stack
 data was being passed to XtGetValues.  This makes it not do that.

 Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=46124
 Signed-off-by: Devin J. Pohly djpohly+x...@gmail.com
 ---
  src/Tip.c |    4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)

 diff --git a/src/Tip.c b/src/Tip.c
 index 5f54d14..5542fc5 100644
 --- a/src/Tip.c
 +++ b/src/Tip.c
 @@ -606,8 +606,10 @@ TipTimeoutCallback(XtPointer closure, XtIntervalId *id)
  #ifdef XAW_INTERNATIONALIZATION
     info-tip-tip.international = False;
     XtSetArg(args[1], XtNinternational, info-tip-tip.international);
 -#endif
     XtGetValues(winfo-widget, args, 2);
 +#else
 +    XtGetValues(winfo-widget, args, 1);
 +#endif

     TipLayout(info);
     TipPosition(info);
 --
 1.7.9

Looks good to me. Thanks, I'll apply it. :)
___
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 savage] Refactor BIOS modes retrieval to only call VBEGetVBEInfo once

2012-02-15 Thread Tormod Volden
From: Tormod Volden debian.tor...@gmail.com

Signed-off-by: Tormod Volden debian.tor...@gmail.com
---

The change should be fine by itself, but the reason I changed this is
that with the latest stack (upgraded to 1.12RC etc) the second call to
VBEGetVBEInfo would return corrupted values. There, I fixed it!(TM) :)

So was the issue due to bugs in the savage driver, or is there something
more general VBE stuff broken? I also noticed that the vesa driver messes
up now, the computer hardlocks when I try to change VT. I haven't had time
to investigate that much further so I don't know if it is related.

Anyone else seeing strange stuff with VBE-enabled drivers?

Cheers,
Tormod


 src/savage_driver.h |1 +
 src/savage_vbe.c|   25 ++---
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/savage_driver.h b/src/savage_driver.h
index 7b7e01d..338cfac 100644
--- a/src/savage_driver.h
+++ b/src/savage_driver.h
@@ -625,6 +625,7 @@ ModeStatus SavageMatchBiosMode(ScrnInfoPtr pScrn,int 
width,int height,int refres
 
 unsigned short SavageGetBIOSModes( 
 SavagePtr psav,
+VbeInfoBlock *vbe,
 int iDepth,
 SavageModeEntryPtr s3vModeTable );
 
diff --git a/src/savage_vbe.c b/src/savage_vbe.c
index d24da24..7dba538 100644
--- a/src/savage_vbe.c
+++ b/src/savage_vbe.c
@@ -242,17 +242,28 @@ SavageFreeBIOSModeTable( SavagePtr psav, 
SavageModeTablePtr* ppTable )
 SavageModeTablePtr
 SavageGetBIOSModeTable( SavagePtr psav, int iDepth )
 {
-int nModes = SavageGetBIOSModes( psav, iDepth, NULL );
+VbeInfoBlock *vbe;
+int nModes;
 SavageModeTablePtr pTable;
 
+if( !psav-pVbe )
+   return 0;
+
+if (!(vbe = VBEGetVBEInfo(psav-pVbe)))
+   return 0;
+
+nModes = SavageGetBIOSModes( psav, vbe, iDepth, NULL );
+
 pTable = (SavageModeTablePtr) 
calloc( 1, sizeof(SavageModeTableRec) + 
(nModes-1) * sizeof(SavageModeEntry) );
 if( pTable ) {
pTable-NumModes = nModes;
-   SavageGetBIOSModes( psav, iDepth, pTable-Modes );
+   SavageGetBIOSModes( psav, vbe, iDepth, pTable-Modes );
 }
 
+VBEFreeVBEInfo(vbe);
+
 return pTable;
 }
 
@@ -260,19 +271,16 @@ SavageGetBIOSModeTable( SavagePtr psav, int iDepth )
 unsigned short
 SavageGetBIOSModes( 
 SavagePtr psav,
+VbeInfoBlock *vbe,
 int iDepth,
 SavageModeEntryPtr s3vModeTable )
 {
 unsigned short iModeCount = 0;
 unsigned short int *mode_list;
 pointer vbeLinear = NULL;
-VbeInfoBlock *vbe;
 int vbeReal;
 struct vbe_mode_info_block * vmib;
 
-if( !psav-pVbe )
-   return 0;
-
 vbeLinear = xf86Int10AllocPages( psav-pVbe-pInt10, 1, vbeReal );
 if( !vbeLinear )
 {
@@ -281,9 +289,6 @@ SavageGetBIOSModes(
 }
 vmib = (struct vbe_mode_info_block *) vbeLinear;
 
-if (!(vbe = VBEGetVBEInfo(psav-pVbe)))
-   return 0;
-
 for (mode_list = vbe-VideoModePtr; *mode_list != 0x; mode_list++) {
 
/*
@@ -377,8 +382,6 @@ SavageGetBIOSModes(
}
 }
 
-VBEFreeVBEInfo(vbe);
-
 xf86Int10FreePages( psav-pVbe-pInt10, vbeLinear, 1 );
 
 return iModeCount;
-- 
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


[Patches][nouveau/ddx]: Improvements to bufferswap implementation and timestamping

2012-02-15 Thread Mario Kleiner
Hi,

here a set of patches against the nouveau-ddx. This is an extended and
revised set, based on Francisco Jerez feedback from autumn last year.

[1/9] Makes pageflipping work again on X-Server 1.12rc. It apparently stopped
working somewhere around Xorg 1.11+.

[2/9] Implements handling of pageflip completion events from the kernel.
Francisco Jerez argument against including it was that the x-server didn't
have a swaplimit api, so this couldn't be applied at the same time as the
pseudo triple-buffering hack which is in place in the current ddx.
Now we have the swaplimit api in 1.12, so this problem should be solved.

[3/9] Makes use of the swaplimit api. A new xorg.conf option SwapLimit
allows to select a swaplimit of 1 or 2 for double-buffering or
triple-buffering. It defaults to 2 for Xorg 1.12+ and 1 for older servers.
This way, on 1.12+ nouveau retains the kind of triple buffering behaviour it
currently has, but swap completion timestamping (OML_sync_control,
INTEL_swap_events, and client swap throttling) works conforming to
the specs. On older servers it removes triple-buffering but makes
nouveau conform to the specs. This is important for apps that need
precise and reliable swap scheduling and timestamping.

[4/9] A bug fix against corrupted desktop when switching from redirected
to non-redirected fullscreen windows under a desktop compositor.
Fixes FDO bug #35452.

[5/9] Some fixes to swap scheduling, revised according to Francisco's
review.

[6/9] Fixes swap throttling for non-fullscreen windows under a desktop
compositor. Split into a separate patch according to Francisco's
feedback.

[7/9] An attempt to provide more sane swap completion events for non-
fullscreen windows. This is a bit of cheating, as it delivers the
events for the earliest point in time one would expect the swap
to complete, assuming only a lightly loaded gpu. Real completion
could be later. I think this is an improvement because the current
implementation delivers swap complete events with timestamps and
counts that signal swap completion before the client even requested
the swap.

[8/9] This one adds Francisco's original triple-buffering hack back
for Xorg 1.11 and earlier servers if the xorg.conf option requests
a swaplimit  1. Users can choose between triple-buffering but
broken timestamping or double-buffering with sane timestamping.

[9/9] Fixes a corner case which could cause the ddx to segfault
with its current triple-buffering implementation.

I've tested these on single-display and dual-display setups,
with/without compositor, with/without redirection and checked
the robustness and precision of the timestamps with special
measurement equipment, on XOrg 1.12-rc2 and 1.10. They work
pretty well for me and finally make nouveau very useable for
the kind of scientific applications that require precise
swap scheduling and timestamping, so i'd love to see them
reviewed and hopefully included into the ddx soon.

A couple of things are a bit of hacks:

[3/9] I think the setup of a default swap limit would be
better done in the x-server itself instead of the ddx. The
setup code is a bit awkward, hijacking the ddx-CreateBuffer
function to apply the swaplimit. A DRI2GetSwapLimit() function
is also missing from the server, which could help in the
future to track swaplimit changes by other clients than the ddx
itself. Unfortunately it is too late for the 1.12 release to do
this.

[8/9] Don't know if this is still wanted/needed or not?

[9/9] It fixes the problem and doesn't affect performance, but is
somewhat of a hack. I don't know how to do better, maybe somebody
else has a better solution?

Thanks,
-mario

___
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/9] dri2: Fix can_exchange() to allow page-flipping on new servers.

2012-02-15 Thread Mario Kleiner
can_exchange() fails on at least Xorg 1.12+. This fixes
it in the same way it was fixed in the ati  intel ddx.

Signed-off-by: Mario Kleiner mario.klei...@tuebingen.mpg.de
---
 src/nouveau_dri2.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/nouveau_dri2.c b/src/nouveau_dri2.c
index 3aa5ec5..5b62425 100644
--- a/src/nouveau_dri2.c
+++ b/src/nouveau_dri2.c
@@ -160,7 +160,7 @@ can_exchange(DrawablePtr draw, PixmapPtr dst_pix, PixmapPtr 
src_pix)
return ((DRI2CanFlip(draw)  pNv-has_pageflip)) 
dst_pix-drawable.width == src_pix-drawable.width 
dst_pix-drawable.height == src_pix-drawable.height 
-   dst_pix-drawable.depth == src_pix-drawable.depth 
+   dst_pix-drawable.bitsPerPixel == 
src_pix-drawable.bitsPerPixel 
dst_pix-devKind == src_pix-devKind;
 }
 
-- 
1.7.5.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 2/9] dri2: Implement handling of pageflip completion events.

2012-02-15 Thread Mario Kleiner
Requests pageflip completion events from the kernel.
Implements pageflip completion handler to finalize
and timestamp swaps.

Completion handler includes a consistency check, and
disambiguation if multiple crtc's are involved in a
pageflip (e.g., clone mode, extendend desktop). Only
the timestamp of the crtc whose vblank event initially
triggered the swap is used, but handler waits for flip
completion on all involved crtc's before completing the
swap and releasing the old framebuffer.

This code is almost identical to the code used in the
ati/radeon ddx and intel ddx.

Signed-off-by: Mario Kleiner mario.klei...@tuebingen.mpg.de
---
 src/drmmode_display.c |  107 +++--
 src/nouveau_dri2.c|   89 ++--
 src/nv_proto.h|5 ++-
 3 files changed, 191 insertions(+), 10 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 75ef6dd..9e15c29 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -83,6 +83,21 @@ typedef struct {
 drmmode_prop_ptr props;
 } drmmode_output_private_rec, *drmmode_output_private_ptr;
 
+typedef struct {
+drmmode_ptr drmmode;
+unsigned old_fb_id;
+int flip_count;
+void *event_data;
+unsigned int fe_frame;
+unsigned int fe_tv_sec;
+unsigned int fe_tv_usec;
+} drmmode_flipdata_rec, *drmmode_flipdata_ptr;
+
+typedef struct {
+drmmode_flipdata_ptr flipdata;
+Bool dispatch_me;
+} drmmode_flipevtcarrier_rec, *drmmode_flipevtcarrier_ptr;
+
 static void drmmode_output_dpms(xf86OutputPtr output, int mode);
 
 static drmmode_ptr
@@ -1245,13 +1260,17 @@ drmmode_cursor_init(ScreenPtr pScreen)
 }
 
 Bool
-drmmode_page_flip(DrawablePtr draw, PixmapPtr back, void *priv)
+drmmode_page_flip(DrawablePtr draw, PixmapPtr back, void *priv,
+ unsigned int ref_crtc_hw_id)
 {
ScrnInfoPtr scrn = xf86Screens[draw-pScreen-myNum];
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
drmmode_crtc_private_ptr crtc = config-crtc[0]-driver_private;
drmmode_ptr mode = crtc-drmmode;
int ret, i, old_fb_id;
+   int emitted = 0;
+   drmmode_flipdata_ptr flipdata;
+   drmmode_flipevtcarrier_ptr flipcarrier;
 
old_fb_id = mode-fb_id;
ret = drmModeAddFB(mode-fd, scrn-virtualX, scrn-virtualY,
@@ -1264,24 +1283,64 @@ drmmode_page_flip(DrawablePtr draw, PixmapPtr back, 
void *priv)
return FALSE;
}
 
+   flipdata = calloc(1, sizeof(drmmode_flipdata_rec));
+   if (!flipdata) {
+   xf86DrvMsg(scrn-scrnIndex, X_WARNING,
+   flip queue: data alloc failed.\n);
+   goto error_undo;
+   }
+
+   flipdata-event_data = priv;
+   flipdata-drmmode = mode;
+
for (i = 0; i  config-num_crtc; i++) {
crtc = config-crtc[i]-driver_private;
 
if (!config-crtc[i]-enabled)
continue;
 
+   flipdata-flip_count++;
+
+   flipcarrier = calloc(1, sizeof(drmmode_flipevtcarrier_rec));
+   if (!flipcarrier) {
+   xf86DrvMsg(scrn-scrnIndex, X_WARNING,
+  flip queue: carrier alloc failed.\n);
+   if (emitted == 0)
+   free(flipdata);
+   goto error_undo;
+   }
+
+   /* Only the reference crtc will finally deliver its page flip
+* completion event. All other crtc's events will be discarded.
+*/
+   flipcarrier-dispatch_me = ((1  i) == ref_crtc_hw_id);
+   flipcarrier-flipdata = flipdata;
+
ret = drmModePageFlip(mode-fd, crtc-mode_crtc-crtc_id,
- mode-fb_id, 0, priv);
+ mode-fb_id, DRM_MODE_PAGE_FLIP_EVENT,
+ flipcarrier);
if (ret) {
xf86DrvMsg(scrn-scrnIndex, X_WARNING,
   flip queue failed: %s\n, strerror(errno));
-   return FALSE;
+
+   free(flipcarrier);
+   if (emitted == 0)
+   free(flipdata);
+   goto error_undo;
}
+
+   emitted++;
}
 
-   drmModeRmFB(mode-fd, old_fb_id);
+   /* Will release old fb after all crtc's completed flip. */
+   flipdata-old_fb_id = old_fb_id;
 
return TRUE;
+
+error_undo:
+   drmModeRmFB(mode-fd, mode-fb_id);
+   mode-fb_id = old_fb_id;
+   return FALSE;
 }
 
 #ifdef HAVE_LIBUDEV
@@ -1347,6 +1406,42 @@ drmmode_uevent_fini(ScrnInfoPtr scrn)
 }
 
 static void
+drmmode_flip_handler(int fd, unsigned int frame, unsigned int tv_sec,
+unsigned int tv_usec, void *event_data)
+{
+   drmmode_flipevtcarrier_ptr flipcarrier = 

[PATCH 3/9] dri2: Add support for DRI2SwapLimit() API.

2012-02-15 Thread Mario Kleiner
Uses the new DRI2SwapLimit() API of X-Server 1.12+
to allow to change the maximum number of pending
swaps on a drawable before the OpenGL client is
throttled by the server.

The new optional xorg.conf parameter SwapLimit
allows to select a new swap limit = 1. The default
swap limit is 2 for triple-buffering on XOrg 1.12+,
1 for double-buffering on older servers, as we can't
change the swap limit there.

Signed-off-by: Mario Kleiner mario.klei...@tuebingen.mpg.de
---
 man/nouveau.man|   11 +++
 src/nouveau_dri2.c |   29 +++--
 src/nv_const.h |2 ++
 src/nv_driver.c|   34 ++
 src/nv_type.h  |3 +++
 5 files changed, 77 insertions(+), 2 deletions(-)

diff --git a/man/nouveau.man b/man/nouveau.man
index dd9d938..59f6c1a 100644
--- a/man/nouveau.man
+++ b/man/nouveau.man
@@ -93,6 +93,17 @@ will assign xrandr outputs LVDS and VGA-0 to this instance 
of the driver.
 .TP
 .BI Option \*qPageFlip\*q \*q boolean \*q
 Enable DRI2 page flipping. Default: on.
+.TP
+.BI Option \*qSwapLimit\*q \*q integer \*q
+Set maximum allowed number of pending OpenGL double-buffer swaps for
+a drawable before a client is blocked.
+.br
+A value of 1 corresponds to double-buffering. A value of 2 corresponds
+to triple-buffering. Higher values may allow higher framerate, but also
+increase lag for interactive applications, e.g., games. Nouveau currently
+supports a maximum value of 2 on XOrg 1.12+ and a maximum of 1 on older 
servers.
+.br
+Default: 2 for XOrg 1.12+, 1 for older servers.
 .SH SEE ALSO
 __xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), 
Xserver(__appmansuffix__), X(__miscmansuffix__)
 .SH AUTHORS
diff --git a/src/nouveau_dri2.c b/src/nouveau_dri2.c
index acef08a..2908e56 100644
--- a/src/nouveau_dri2.c
+++ b/src/nouveau_dri2.c
@@ -42,6 +42,11 @@ nouveau_dri2_create_buffer(DrawablePtr pDraw, unsigned int 
attachment,
} else {
WindowPtr pwin = (WindowPtr)pDraw;
ppix = pScreen-GetWindowPixmap(pwin);
+
+#if DRI2INFOREC_VERSION = 6
+   /* Set initial swap limit on drawable. */
+   DRI2SwapLimit(pDraw, pNv-swap_limit);
+#endif
}
 
ppix-refcnt++;
@@ -208,6 +213,20 @@ nouveau_wait_vblank(DrawablePtr draw, int type, CARD64 msc,
return 0;
 }
 
+#if DRI2INFOREC_VERSION = 6
+static Bool
+nouveau_dri2_swap_limit_validate(DrawablePtr draw, int swap_limit)
+{
+   ScrnInfoPtr scrn = xf86Screens[draw-pScreen-myNum];
+   NVPtr pNv = NVPTR(scrn);
+
+   if ((swap_limit  1 ) || (swap_limit  pNv-max_swap_limit))
+   return FALSE;
+
+   return TRUE;
+}
+#endif
+
 static void
 nouveau_dri2_finish_swap(DrawablePtr draw, unsigned int frame,
 unsigned int tv_sec, unsigned int tv_usec,
@@ -293,8 +312,10 @@ nouveau_dri2_finish_swap(DrawablePtr draw, unsigned int 
frame,
 * not, to prevent it from blocking the client on the next
 * GetBuffers request (and let the client do triple-buffering).
 *
-* XXX - The DRI2SwapLimit() API will allow us to move this to
-*   the flip handler with no FPS hit.
+* XXX - The DRI2SwapLimit() API allowed us to move this to
+*   the flip handler with no FPS hit for page flipped swaps.
+*   It is still needed for copy swaps as we lack a method
+*   to detect true swap completion for DRI2_BLIT_COMPLETE.
 */
DRI2SwapComplete(s-client, draw, frame, tv_sec, tv_usec,
 type, s-func, s-data);
@@ -534,6 +555,10 @@ nouveau_dri2_init(ScreenPtr pScreen)
dri2.ScheduleWaitMSC = nouveau_dri2_schedule_wait;
dri2.GetMSC = nouveau_dri2_get_msc;
 
+#if DRI2INFOREC_VERSION = 6
+   dri2.SwapLimitValidate = nouveau_dri2_swap_limit_validate;
+#endif
+
return DRI2ScreenInit(pScreen, dri2);
 }
 
diff --git a/src/nv_const.h b/src/nv_const.h
index a27a951..5c232d4 100644
--- a/src/nv_const.h
+++ b/src/nv_const.h
@@ -15,6 +15,7 @@ typedef enum {
 OPTION_GLX_VBLANK,
 OPTION_ZAPHOD_HEADS,
 OPTION_PAGE_FLIP,
+OPTION_SWAP_LIMIT,
 } NVOpts;
 
 
@@ -28,6 +29,7 @@ static const OptionInfoRec NVOptions[] = {
 { OPTION_GLX_VBLANK,   GLXVBlank,OPTV_BOOLEAN,   {0}, FALSE },
 { OPTION_ZAPHOD_HEADS, ZaphodHeads,  OPTV_STRING,{0}, FALSE },
 { OPTION_PAGE_FLIP,PageFlip, OPTV_BOOLEAN,   {0}, 
FALSE },
+{ OPTION_SWAP_LIMIT,   SwapLimit,OPTV_INTEGER,   {0}, FALSE },
 { -1,   NULL,   OPTV_NONE,  {0}, FALSE }
 };
 
diff --git a/src/nv_driver.c b/src/nv_driver.c
index 87ef2c4..5def531 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -31,6 +31,9 @@
 #include xf86drm.h
 #include xf86drmMode.h
 #include nouveau_drm.h
+#ifdef DRI2
+#include dri2.h
+#endif
 
 /*
  * Forward definitions for the functions that 

[PATCH 4/9] dri2: Update front buffer pixmap and name before exchanging buffers

2012-02-15 Thread Mario Kleiner
Buffer exchange assumes that the front buffer pixmap and name
information is accurate. That may not be the case eg. if the window
has been (un)redirected since the buffer was created.

This is a translation to nouveau of a fix that was originally developed
by Ville Syrjala syrj...@sci.fi for the ati/radeon ddx to fix the
same bug there.

See thread at:

http://lists.x.org/archives/xorg-devel/2011-May/021908.html

Fixes FDO bug #35452.

Signed-off-by: Mario Kleiner mario.klei...@tuebingen.mpg.de
---
 src/nouveau_dri2.c |   45 ++---
 1 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/src/nouveau_dri2.c b/src/nouveau_dri2.c
index 2908e56..8608678 100644
--- a/src/nouveau_dri2.c
+++ b/src/nouveau_dri2.c
@@ -149,6 +149,35 @@ struct nouveau_dri2_vblank_state {
 };
 
 static Bool
+update_front(DrawablePtr draw, DRI2BufferPtr front)
+{
+   int r;
+   PixmapPtr pixmap;
+   struct nouveau_dri2_buffer *nvbuf = nouveau_dri2_buffer(front);
+
+   if (draw-type == DRAWABLE_PIXMAP)
+   pixmap = (PixmapPtr)draw;
+   else
+   pixmap = (*draw-pScreen-GetWindowPixmap)((WindowPtr)draw);
+
+   pixmap-refcnt++;
+
+   exaMoveInPixmap(pixmap);
+   r = nouveau_bo_handle_get(nouveau_pixmap_bo(pixmap), front-name);
+   if (r) {
+   (*draw-pScreen-DestroyPixmap)(pixmap);
+   return FALSE;
+   }
+
+   (*draw-pScreen-DestroyPixmap)(nvbuf-ppix);
+   front-pitch = pixmap-devKind;
+   front-cpp = pixmap-drawable.bitsPerPixel / 8;
+   nvbuf-ppix = pixmap;
+
+   return TRUE;
+}
+
+static Bool
 can_exchange(DrawablePtr draw, PixmapPtr dst_pix, PixmapPtr src_pix)
 {
ScrnInfoPtr scrn = xf86Screens[draw-pScreen-myNum];
@@ -234,13 +263,14 @@ nouveau_dri2_finish_swap(DrawablePtr draw, unsigned int 
frame,
 {
ScrnInfoPtr scrn = xf86Screens[draw-pScreen-myNum];
NVPtr pNv = NVPTR(scrn);
-   PixmapPtr dst_pix = nouveau_dri2_buffer(s-dst)-ppix;
+   PixmapPtr dst_pix;
PixmapPtr src_pix = nouveau_dri2_buffer(s-src)-ppix;
-   struct nouveau_bo *dst_bo = nouveau_pixmap_bo(dst_pix);
+   struct nouveau_bo *dst_bo;
struct nouveau_bo *src_bo = nouveau_pixmap_bo(src_pix);
struct nouveau_channel *chan = pNv-chan;
RegionRec reg;
int type, ret;
+   Bool front_updated;
 
REGION_INIT(0, reg, ((BoxRec){ 0, 0, draw-width, draw-height }), 0);
REGION_TRANSLATE(0, reg, draw-x, draw-y);
@@ -257,6 +287,15 @@ nouveau_dri2_finish_swap(DrawablePtr draw, unsigned int 
frame,
if (ref_crtc_hw_id  1)
ref_crtc_hw_id = 1;
 
+   /* Update frontbuffer pixmap and name: Could have changed due to
+* window (un)redirection as part of compositing.
+*/
+   front_updated = update_front(draw, s-dst);
+
+   /* Assign frontbuffer pixmap, after update in update_front() */
+   dst_pix = nouveau_dri2_buffer(s-dst)-ppix;
+   dst_bo = nouveau_pixmap_bo(dst_pix);
+
/* Throttle on the previous frame before swapping */
nouveau_bo_map(dst_bo, NOUVEAU_BO_RD);
nouveau_bo_unmap(dst_bo);
@@ -275,7 +314,7 @@ nouveau_dri2_finish_swap(DrawablePtr draw, unsigned int 
frame,
FIRE_RING(chan);
}
 
-   if (can_exchange(draw, dst_pix, src_pix)) {
+   if (front_updated  can_exchange(draw, dst_pix, src_pix)) {
type = DRI2_EXCHANGE_COMPLETE;
DamageRegionAppend(draw, reg);
 
-- 
1.7.5.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 5/9] dri2: Fixes to swap scheduling.

2012-02-15 Thread Mario Kleiner
Fix some small off-by-one errors and a mismatch
between 32 bit kernel interfaces for vblank count
and 64 bit dri2 interfaces for target_msc et al.

Return corrected target_msc to swap scheduling in
x-server.

A revised version of the patch discussed here:
http://lists.freedesktop.org/archives/nouveau/2011-September/009143.html

Signed-off-by: Mario Kleiner mario.klei...@tuebingen.mpg.de
---
 src/nouveau_dri2.c |   23 +--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/nouveau_dri2.c b/src/nouveau_dri2.c
index 8608678..719b3bb 100644
--- a/src/nouveau_dri2.c
+++ b/src/nouveau_dri2.c
@@ -387,11 +387,22 @@ nouveau_dri2_schedule_swap(ClientPtr client, DrawablePtr 
draw,
if (ret)
goto fail;
 
+   /* Truncate to match kernel interfaces; means occasional 
overflow
+* misses, but that's generally not a big deal.
+*/
+   *target_msc = 0x;
+   divisor = 0x;
+   remainder = 0x;
+
/* Calculate a swap target if we don't have one */
if (current_msc = *target_msc  divisor)
*target_msc = current_msc + divisor
- (current_msc - remainder) % divisor;
 
+   /* Avoid underflow of unsigned value below */
+   if (*target_msc == 0)
+   *target_msc = 1;
+
/* Request a vblank event one frame before the target */
ret = nouveau_wait_vblank(draw, DRM_VBLANK_ABSOLUTE |
  DRM_VBLANK_EVENT,
@@ -399,7 +410,8 @@ nouveau_dri2_schedule_swap(ClientPtr client, DrawablePtr 
draw,
  expect_msc, NULL, s);
if (ret)
goto fail;
-   s-frame = (unsigned int) expect_msc  0x;
+   s-frame = 1 + ((unsigned int) expect_msc  0x);
+   *target_msc = 1 + expect_msc;
} else {
/* We can't/don't want to sync to vblank, just swap. */
nouveau_dri2_finish_swap(draw, 0, 0, 0, s);
@@ -420,6 +432,13 @@ nouveau_dri2_schedule_wait(ClientPtr client, DrawablePtr 
draw,
CARD64 current_msc;
int ret;
 
+   /* Truncate to match kernel interfaces; means occasional overflow
+* misses, but that's generally not a big deal.
+*/
+   target_msc = 0x;
+   divisor = 0x;
+   remainder = 0x;
+
if (!can_sync_to_vblank(draw)) {
DRI2WaitMSCComplete(client, draw, target_msc, 0, 0);
return TRUE;
@@ -439,7 +458,7 @@ nouveau_dri2_schedule_wait(ClientPtr client, DrawablePtr 
draw,
goto fail;
 
/* Calculate a wait target if we don't have one */
-   if (current_msc  target_msc  divisor)
+   if (current_msc = target_msc  divisor)
target_msc = current_msc + divisor
- (current_msc - remainder) % divisor;
 
-- 
1.7.5.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 6/9] dri2: Allow vblank controlled swaps for redirected windows. Part I

2012-02-15 Thread Mario Kleiner
Make sure that swaps for redirected windows under a
compositor are still scheduled via vblank events, to
avoid effects like 2900 fps swaps under a compositor.

See discussion with Francisco Jerez at:

http://lists.freedesktop.org/archives/nouveau/2011-September/009278.html
http://lists.freedesktop.org/archives/nouveau/2011-September/009292.html

This is part I of the agreed upon band-aid, in a separate patch.

It allows to use vblank related functions on redirected
windows and thereby fixes functions from sgi_sync_control
and oml_sync_control extension, e.g., glXWaitForMscOML(),
glXGetSyncValuesOML(), glXWaitVideoSyncSGI, ...

Signed-off-by: Mario Kleiner mario.klei...@tuebingen.mpg.de
---
 src/nouveau_dri2.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/src/nouveau_dri2.c b/src/nouveau_dri2.c
index 719b3bb..6a0800c 100644
--- a/src/nouveau_dri2.c
+++ b/src/nouveau_dri2.c
@@ -204,10 +204,8 @@ can_sync_to_vblank(DrawablePtr draw)
 {
ScrnInfoPtr scrn = xf86Screens[draw-pScreen-myNum];
NVPtr pNv = NVPTR(scrn);
-   PixmapPtr pix = NVGetDrawablePixmap(draw);
 
return pNv-glx_vblank 
-   nouveau_exa_pixmap_is_onscreen(pix) 
nv_window_belongs_to_crtc(scrn, draw-x, draw-y,
  draw-width, draw-height);
 }
-- 
1.7.5.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 7/9] dri2: Allow vblank controlled swaps for redirected windows. Part II

2012-02-15 Thread Mario Kleiner
This part implements proper throttling for clients. For
vblank synchronized blits, it defers DRI2SwapComplete()
until 1 vblank after the framebuffer blit is submitted to
the gpu.

Rationale:

For unredirected windows, this is the earliest time the
blit swap can complete, as blits are submitted one vblank
before the target vblank and synchronized with vblank in the
gpu. This makes swap completion timestamps at least reasonable.

For redirected windows, the compositor will probably pick
up the blit swapped frontbuffer pixmap of the window quickly,
but defer its own recomposition to the next vblank, at least
if sync to vblank for the compositor is on.

Signed-off-by: Mario Kleiner mario.klei...@tuebingen.mpg.de
---
 src/nouveau_dri2.c |   32 +---
 1 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/src/nouveau_dri2.c b/src/nouveau_dri2.c
index 6a0800c..fdc5148 100644
--- a/src/nouveau_dri2.c
+++ b/src/nouveau_dri2.c
@@ -135,6 +135,7 @@ nouveau_dri2_copy_region(DrawablePtr pDraw, RegionPtr 
pRegion,
 struct nouveau_dri2_vblank_state {
enum {
SWAP,
+   BLIT,
WAIT
} action;
 
@@ -342,6 +343,22 @@ nouveau_dri2_finish_swap(DrawablePtr draw, unsigned int 
frame,
 
REGION_TRANSLATE(0, reg, -draw-x, -draw-y);
nouveau_dri2_copy_region(draw, reg, s-dst, s-src);
+
+   if (can_sync_to_vblank(draw)) {
+   /* Request a vblank event one vblank from now, the most
+* likely (optimistic?) time a direct framebuffer blit
+* will complete or a desktop compositor will update its
+* screen. This defers DRI2SwapComplete() to the 
earliest
+* likely time of real swap completion.
+*/
+   s-action = BLIT;
+   ret = nouveau_wait_vblank(draw, DRM_VBLANK_EVENT |
+ DRM_VBLANK_RELATIVE, 1,
+ NULL, NULL, s);
+   /* Done, if success. Otherwise use fallback below. */
+   if (!ret)
+   return;
+   }
}
 
/*
@@ -351,8 +368,9 @@ nouveau_dri2_finish_swap(DrawablePtr draw, unsigned int 
frame,
 *
 * XXX - The DRI2SwapLimit() API allowed us to move this to
 *   the flip handler with no FPS hit for page flipped swaps.
-*   It is still needed for copy swaps as we lack a method
-*   to detect true swap completion for DRI2_BLIT_COMPLETE.
+*   It is still needed as a fallback for some copy swaps as
+*   we lack a method to detect true swap completion for
+*   DRI2_BLIT_COMPLETE.
 */
DRI2SwapComplete(s-client, draw, frame, tv_sec, tv_usec,
 type, s-func, s-data);
@@ -505,8 +523,10 @@ nouveau_dri2_vblank_handler(int fd, unsigned int frame,
 
ret = dixLookupDrawable(draw, s-draw, serverClient,
M_ANY, DixWriteAccess);
-   if (ret)
+   if (ret) {
+   free(s);
return;
+   }
 
switch (s-action) {
case SWAP:
@@ -517,6 +537,12 @@ nouveau_dri2_vblank_handler(int fd, unsigned int frame,
DRI2WaitMSCComplete(s-client, draw, frame, tv_sec, tv_usec);
free(s);
break;
+
+   case BLIT:
+   DRI2SwapComplete(s-client, draw, frame, tv_sec, tv_usec,
+DRI2_BLIT_COMPLETE, s-func, s-data);
+   free(s);
+   break;
}
 }
 
-- 
1.7.5.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 8/9] dri2: Reimplement hack for triple-buffering on old X-Servers.

2012-02-15 Thread Mario Kleiner
X-Servers before 1.12.0 don't have the DRI2SwapLimit()
API. On these, default to a swaplimit of 1 - double-buffering.

This patch implements support for swap limit of 2,
triple-buffering, on old x-servers via Francisco Jerez
previous hack:

Return DRI2SwapComplete() before the swap has completed,
so clients don't get blocked on the pending swap. This
allows for a triple-buffering look-alike behaviour, but
breaks the swap scheduling and timestamping defined
in the OML_sync_control spec, so applications which
rely on conformant behaviour will break with a swap
limit of 2 on pre 1.12.0 x-servers.

Signed-off-by: Mario Kleiner mario.klei...@tuebingen.mpg.de
---
 man/nouveau.man|6 +-
 src/nouveau_dri2.c |   32 +---
 src/nv_driver.c|   11 ++-
 3 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/man/nouveau.man b/man/nouveau.man
index 59f6c1a..7c72907 100644
--- a/man/nouveau.man
+++ b/man/nouveau.man
@@ -101,7 +101,11 @@ a drawable before a client is blocked.
 A value of 1 corresponds to double-buffering. A value of 2 corresponds
 to triple-buffering. Higher values may allow higher framerate, but also
 increase lag for interactive applications, e.g., games. Nouveau currently
-supports a maximum value of 2 on XOrg 1.12+ and a maximum of 1 on older 
servers.
+reliably supports a maximum value of 2 on XOrg 1.12+. A maximum setting of 2
+on older x-servers is allowed, but it will break conformance with the
+OpenML OML_sync_control specification and will cause failure of software
+that relies on correct presentation timing behaviour as defined in that
+specification.
 .br
 Default: 2 for XOrg 1.12+, 1 for older servers.
 .SH SEE ALSO
diff --git a/src/nouveau_dri2.c b/src/nouveau_dri2.c
index fdc5148..f0c7fec 100644
--- a/src/nouveau_dri2.c
+++ b/src/nouveau_dri2.c
@@ -255,6 +255,18 @@ nouveau_dri2_swap_limit_validate(DrawablePtr draw, int 
swap_limit)
 }
 #endif
 
+/* Shall we intentionally violate the OML_sync_control spec to
+ * get some sort of triple-buffering behaviour on a pre 1.12.0
+ * x-server?
+ */
+static Bool violate_oml(DrawablePtr draw)
+{
+   ScrnInfoPtr scrn = xf86Screens[draw-pScreen-myNum];
+   NVPtr pNv = NVPTR(scrn);
+
+   return (DRI2INFOREC_VERSION  6)  (pNv-swap_limit  1);
+}
+
 static void
 nouveau_dri2_finish_swap(DrawablePtr draw, unsigned int frame,
 unsigned int tv_sec, unsigned int tv_usec,
@@ -319,7 +331,9 @@ nouveau_dri2_finish_swap(DrawablePtr draw, unsigned int 
frame,
 
if (DRI2CanFlip(draw)) {
type = DRI2_FLIP_COMPLETE;
-   ret = drmmode_page_flip(draw, src_pix, s, 
ref_crtc_hw_id);
+   ret = drmmode_page_flip(draw, src_pix,
+   violate_oml(draw) ? NULL : s,
+   ref_crtc_hw_id);
if (!ret)
goto out;
}
@@ -330,7 +344,7 @@ nouveau_dri2_finish_swap(DrawablePtr draw, unsigned int 
frame,
DamageRegionProcessPending(draw);
 
/* If it is a page flip, finish it in the flip event handler. */
-   if (type == DRI2_FLIP_COMPLETE)
+   if ((type == DRI2_FLIP_COMPLETE)  !violate_oml(draw))
return;
} else {
type = DRI2_BLIT_COMPLETE;
@@ -344,7 +358,7 @@ nouveau_dri2_finish_swap(DrawablePtr draw, unsigned int 
frame,
REGION_TRANSLATE(0, reg, -draw-x, -draw-y);
nouveau_dri2_copy_region(draw, reg, s-dst, s-src);
 
-   if (can_sync_to_vblank(draw)) {
+   if (can_sync_to_vblank(draw)  !violate_oml(draw)) {
/* Request a vblank event one vblank from now, the most
 * likely (optimistic?) time a direct framebuffer blit
 * will complete or a desktop compositor will update its
@@ -361,6 +375,14 @@ nouveau_dri2_finish_swap(DrawablePtr draw, unsigned int 
frame,
}
}
 
+   /* Special triple-buffering hack for old pre 1.12.0 x-servers used? */
+   if (violate_oml(draw)) {
+   /* Signal to client that swap completion timestamps and counts
+* are invalid - they violate the specification.
+*/
+   frame = tv_sec = tv_usec = 0;
+   }
+
/*
 * Tell the X server buffers are already swapped even if they're
 * not, to prevent it from blocking the client on the next
@@ -371,6 +393,10 @@ nouveau_dri2_finish_swap(DrawablePtr draw, unsigned int 
frame,
 *   It is still needed as a fallback for some copy swaps as
 *   we lack a method to detect true swap completion for
 *   DRI2_BLIT_COMPLETE.
+*
+*   It is also used if triple-buffering is requested on
+*   old x-servers which don't 

[PATCH 9/9] dri2: Fix corner case crash for swaplimit 1

2012-02-15 Thread Mario Kleiner
If a swaplimit  1 is set on a server which
supports the swaplimit api (XOrg 1.12.0+),
the following can happen:

1. Client calls glXSwapBuffersMscOML() with a
   swap target  1 vblank in the future, or a
   client calls glXSwapbuffers() while the swap
   interval is set to  1 (unusual but possible).

2. nouveau_dri2_finish_swap() is therefore called
   only at the target vblank, instead of immediately.

3. Because of the deferred execution of
   nouveu_dri2_finish_swap(), the OpenGL client
   can call x-servers DRI2GetBuffersWithFormat()
   before nouveau_dri2_finish_swap() executes and
   it deletes pixmaps that would be needed by
   nouveau_dri2_finish_swap() -- Segfault -- Crash.

Prevent this: When a swap is scheduled into the
future, we temporarily reduce the swaplimit to 1
until nouveau_dri2_finish_swap() is done, then
restore it to its original value. This throttles
the client inside the server in DRI2ThrottleClient()
before it can call the evil DRI2GetbuffersWithFormat().

The client will still be released one video refresh
interval before swap completion, so there is still
some potential win.

This doesn't affect the common case of swapping at
the next vblank, where this throttling is not needed
or done.

Signed-off-by: Mario Kleiner mario.klei...@tuebingen.mpg.de
---
 src/nouveau_dri2.c |   26 ++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/src/nouveau_dri2.c b/src/nouveau_dri2.c
index f0c7fec..7878a5a 100644
--- a/src/nouveau_dri2.c
+++ b/src/nouveau_dri2.c
@@ -445,6 +445,26 @@ nouveau_dri2_schedule_swap(ClientPtr client, DrawablePtr 
draw,
if (*target_msc == 0)
*target_msc = 1;
 
+#if DRI2INFOREC_VERSION = 6
+   /* Is this a swap in the future, ie. the vblank event will
+* not be immediately dispatched, but only at a future vblank?
+* If so, we need to temporarily lower the swaplimit to 1, so
+* that DRI2GetBuffersWithFormat() requests from the client get
+* deferred in the x-server until the vblank event has been
+* dispatched to us and nouveau_dri2_finish_swap() is done. If
+* we wouldn't do this, DRI2GetBuffersWithFormat() would operate
+* on wrong (pre-swap) buffers, and cause a segfault later on in
+* nouveau_dri2_finish_swap(). Our vblank event handler restores
+* the old swaplimit immediately after 
nouveau_dri2_finish_swap()
+* is done, so we still get 1 video refresh cycle worth of
+* triple-buffering. For a swap at next vblank, dispatch of the
+* vblank event happens immediately, so there isn't any need
+* for this lowered swaplimit.
+*/
+   if (current_msc  *target_msc - 1)
+   DRI2SwapLimit(draw, 1);
+#endif
+
/* Request a vblank event one frame before the target */
ret = nouveau_wait_vblank(draw, DRM_VBLANK_ABSOLUTE |
  DRM_VBLANK_EVENT,
@@ -557,6 +577,12 @@ nouveau_dri2_vblank_handler(int fd, unsigned int frame,
switch (s-action) {
case SWAP:
nouveau_dri2_finish_swap(draw, frame, tv_sec, tv_usec, s);
+#if DRI2INFOREC_VERSION = 6
+   /* Restore real swap limit on drawable, now that it is safe. */
+   ScrnInfoPtr scrn = xf86Screens[draw-pScreen-myNum];
+   DRI2SwapLimit(draw, NVPTR(scrn)-swap_limit);
+#endif
+
break;
 
case WAIT:
-- 
1.7.5.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 xrandr-utils 2/4] Refactor reflection support into library.

2012-02-15 Thread Bryce Harrington
This follows the same API style as rotation.

Signed-off-by: Bryce Harrington br...@canonical.com
---
 examples/xrandr.c|   36 ++
 include/X11/extensions/XrandrUtils.h |9 +++
 man/XrandrUtils.man  |   18 +
 src/XrandrUtils.c|   56 +++
 test/.gitignore  |1 +
 test/Makefile.am |3 +-
 test/reflections.c   |  130 ++
 7 files changed, 221 insertions(+), 32 deletions(-)
 create mode 100644 test/reflections.c

diff --git a/examples/xrandr.c b/examples/xrandr.c
index c6ad767..e7c2295 100644
--- a/examples/xrandr.c
+++ b/examples/xrandr.c
@@ -51,13 +51,6 @@ static Bool  properties = False;
 static Boolgrab_server = True;
 static Boolno_primary = False;
 
-static char *reflections[5] = {
-normal, 
-x, 
-y, 
-xy,
-\n};
-
 /* subpixel order */
 static char *order[6] = {
 unknown,
@@ -173,23 +166,6 @@ static inline double dmin (double x, double y)
 return x  y ? x : y;
 }
 
-static char *
-reflection_name (Rotation rotation)
-{
-rotation = (RR_Reflect_X|RR_Reflect_Y);
-switch (rotation) {
-case 0:
-   return none;
-case RR_Reflect_X:
-   return X axis;
-case RR_Reflect_Y:
-   return Y axis;
-case RR_Reflect_X|RR_Reflect_Y:
-   return X and Y axis;
-}
-return invalid reflection;
-}
-
 typedef enum _changes {
 changes_none = 0,
 changes_crtc = (1  0),
@@ -1113,7 +1089,7 @@ set_output_info (output_t *output, RROutput xid, 
XRROutputInfo *output_info)
fatal (output %s cannot use rotation \%s\ reflection \%s\\n,
   output-output.string,
   XRURotationName (output-rotation),
-  reflection_name (output-rotation));
+  XRUReflectionName (output-rotation));
 
 /* set gamma */
 if (!(output-changes  changes_gamma))
@@ -2301,10 +2277,8 @@ main (int argc, char **argv)
if (!strcmp (--reflect, argv[i]) || !strcmp (--reflection, 
argv[i])) {
if (++i=argc) usage ();
if (!output) usage ();
-   for (dirind = 0; dirind  4; dirind++) {
-if (strcmp (reflections[dirind], argv[i]) == 0) break;
-}
-   if (dirind == 4)
+   dirind = XRUGetReflectionIndex(argv[i]);
+   if ((dirind  0) || (dirind  3))
usage ();
output-rotation = ~(RR_Reflect_X|RR_Reflect_Y);
output-rotation |= dirind * RR_Reflect_X;
@@ -2918,7 +2892,7 @@ main (int argc, char **argv)
printf ( %s,
XRURotationName (output-rotation));
if (output-rotation  (RR_Reflect_X|RR_Reflect_Y))
-   printf ( %s, reflection_name (output-rotation));
+   printf ( %s, XRUReflectionName (output-rotation));
}
}
if (rotations != RR_Rotate_0 || verbose)
@@ -3292,7 +3266,7 @@ main (int argc, char **argv)
   XRURotationName (current_rotation));
 
printf(Current reflection - %s\n,
-  reflection_name (current_rotation));
+  XRUReflectionName (current_rotation));
 
printf (Rotations possible - );
for (i = 0; i  4; i ++) {
diff --git a/include/X11/extensions/XrandrUtils.h 
b/include/X11/extensions/XrandrUtils.h
index c48de2e..7b33769 100644
--- a/include/X11/extensions/XrandrUtils.h
+++ b/include/X11/extensions/XrandrUtils.h
@@ -55,4 +55,13 @@ XRUGetRotationIndex(char * rotation_name);
 Rotation
 XRUGetRotation(int dirind);
 
+const char *
+XRUReflectionName(Rotation rotation);
+
+int
+XRUGetReflectionIndex(char * reflection_name);
+
+Rotation
+XRUGetReflection(int dirind);
+
 #endif /* _XRANDR_UTILS_H_ */
diff --git a/man/XrandrUtils.man b/man/XrandrUtils.man
index 0fd1a46..7acf0e9 100644
--- a/man/XrandrUtils.man
+++ b/man/XrandrUtils.man
@@ -52,6 +52,24 @@ int XRUGetRotationIndex(char * rotation_name);
  */
 Rotation XRUGetRotation(int dirind);
 
+/**
+ * Return string name for the given rotation,
+ * or invalid reflection on error.
+ */
+const char * XRUReflectionName(Rotation rotation);
+
+/**
+ * Look up reflection name and return an index number,
+ * or -1 if name could not be found.
+ */
+int XRUGetReflectionIndex(char * reflection_name);
+
+/**
+ * Return the reflection matching the given index as
+ * a Rotation, or 0 if not valid.
+ */
+Rotation XRUGetReflection(int dirind);
+
 .sp
 .fi
 
diff --git a/src/XrandrUtils.c b/src/XrandrUtils.c
index a00ad1c..0654977 100644
--- a/src/XrandrUtils.c
+++ b/src/XrandrUtils.c
@@ -40,6 +40,15 @@ static /* const */ char * ru_direction[5] = {
 inverted,
 right,
 \n};
+
+static /* const */ char * ru_reflection[5] = {
+normal,
+x,
+y,
+xy,
+\n};
+
+/* Rotations */
 const char *
 XRURotationName(Rotation rotation)
 {
@@ -72,3 +81,50 @@ XRUGetRotation(int dirind)

[PATCH xrandr-utils 3/4] Add an A/B test comparing our xrandr's output with the installed xrandr

2012-02-15 Thread Bryce Harrington
Signed-off-by: Bryce Harrington br...@canonical.com
---
 examples/before_and_after.sh |   23 +++
 examples/xrandr.c|5 -
 2 files changed, 27 insertions(+), 1 deletions(-)
 create mode 100755 examples/before_and_after.sh

diff --git a/examples/before_and_after.sh b/examples/before_and_after.sh
new file mode 100755
index 000..1ec3e73
--- /dev/null
+++ b/examples/before_and_after.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+
+export DISPLAY=:0
+
+compare_str() {
+echo -n ${1}: 
+if [ ${2} = ${3} ]; then
+echo PASS
+else
+echo FAIL
+fi
+}
+
+
+compare_str version $(xrandr --version) $(./xrandr --version)
+
+compare_str help $(xrandr --help 21) $(./xrandr --help 21)
+
+compare_str basic status $(xrandr) $(./xrandr)
+
+compare_str verbose status $(xrandr --verbose) $(./xrandr --verbose)
+
+
diff --git a/examples/xrandr.c b/examples/xrandr.c
index e7c2295..7b4 100644
--- a/examples/xrandr.c
+++ b/examples/xrandr.c
@@ -41,6 +41,9 @@
 #include config.h
 #include XrandrUtils.h
 
+/* #define XRANDR_VERSION VERSION */
+#define XRANDR_VERSION 1.3.5
+
 static char*program_name;
 static Display *dpy;
 static Window  root;
@@ -2602,7 +2605,7 @@ main (int argc, char **argv)
query_1 = True;
 }
 if (version)
-   printf(xrandr program versionVERSION \n);
+   printf(xrandr program versionXRANDR_VERSION \n);
 
 dpy = XOpenDisplay (display_name);
 
-- 
1.7.9

___
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-utils 1/4] Refactor rotations into library

2012-02-15 Thread Bryce Harrington
This is perhaps the simplest way to refactor out the code, but I'm not
happy with it.  It adds three api calls when it seems like 2 ought to be
sufficient.  Also, one routine returns 0 on error, the other -1, and
that's no good.

Signed-off-by: Bryce Harrington br...@canonical.com
---
 Makefile.am  |2 +-
 examples/Makefile.am |9 ++-
 examples/xrandr.c|   61 ++--
 include/X11/extensions/XrandrUtils.h |   11 +++
 man/XrandrUtils.man  |   19 +
 src/XrandrUtils.c|   74 +++
 test/.gitignore  |1 +
 test/Makefile.am |8 ++-
 test/rotations.c |  132 ++
 9 files changed, 274 insertions(+), 43 deletions(-)
 create mode 100644 test/rotations.c

diff --git a/Makefile.am b/Makefile.am
index f6bb4f9..0bb4033 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 = examples man src test
+SUBDIRS = src test examples man
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = xrandr-utils.pc
diff --git a/examples/Makefile.am b/examples/Makefile.am
index c993ccc..438e0b7 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -4,10 +4,17 @@ AM_CFLAGS = \
$(RANDR_UTILS_CFLAGS) \
$(MALLOC_ZERO_CFLAGS) \
$(CWARNFLAGS)
-xrandr_LDADD = @RANDR_UTILS_LIBS@
+
+RANDR_UTILS_LIB = $(top_builddir)/src/libXrandrUtils.la
+
+xrandr_LDADD = \
+   $(RANDR_UTILS_LIB) \
+   @RANDR_UTILS_LIBS@
 
 INCLUDES = -I$(top_srcdir)/include/X11/extensions
 
 xrandr_SOURCES =   \
 xrandr.c
 
+$(RANDR_UTILS_LIB):
+   @cd $(top_builddir)/src/  $(MAKE) libXrandrUtils.la
diff --git a/examples/xrandr.c b/examples/xrandr.c
index a69eea3..c6ad767 100644
--- a/examples/xrandr.c
+++ b/examples/xrandr.c
@@ -51,13 +51,6 @@ static Bool  properties = False;
 static Boolgrab_server = True;
 static Boolno_primary = False;
 
-static char *direction[5] = {
-normal, 
-left, 
-inverted, 
-right,
-\n};
-
 static char *reflections[5] = {
 normal, 
 x, 
@@ -181,19 +174,6 @@ static inline double dmin (double x, double y)
 }
 
 static char *
-rotation_name (Rotation rotation)
-{
-inti;
-
-if ((rotation  0xf) == 0)
-   return normal;
-for (i = 0; i  4; i++)
-   if (rotation  (1  i))
-   return direction[i];
-return invalid rotation;
-}
-
-static char *
 reflection_name (Rotation rotation)
 {
 rotation = (RR_Reflect_X|RR_Reflect_Y);
@@ -1132,7 +1112,7 @@ set_output_info (output_t *output, RROutput xid, 
XRROutputInfo *output_info)
 if (!output_can_use_rotation (output, output-rotation))
fatal (output %s cannot use rotation \%s\ reflection \%s\\n,
   output-output.string,
-  rotation_name (output-rotation),
+  XRURotationName (output-rotation),
   reflection_name (output-rotation));
 
 /* set gamma */
@@ -2246,10 +2226,9 @@ main (int argc, char **argv)
if (++i=argc) usage ();
dirind = strtol(argv[i], endptr, 10);
if (argv[i] == endptr) {
-   for (dirind = 0; dirind  4; dirind++) {
-   if (strcmp (direction[dirind], argv[i]) == 0) break;
-   }
-   if ((dirind  0) || (dirind  3))  usage();
+   dirind = XRUGetRotationIndex(argv[i]);
+   if ((dirind  0) || (dirind  3))
+   usage();
}
rot = dirind;
setit = True;
@@ -2310,11 +2289,9 @@ main (int argc, char **argv)
}
if (!strcmp (--rotation, argv[i]) || !strcmp (--rotate, argv[i])) {
if (++i=argc) usage ();
-   if (!output) usage();
-   for (dirind = 0; dirind  4; dirind++) {
-   if (strcmp (direction[dirind], argv[i]) == 0) break;
-   }
-   if (dirind == 4)
+   if (!output) usage ();
+   dirind = XRUGetRotationIndex(argv[i]);
+   if ((dirind  0) || (dirind  3))
usage ();
output-rotation = ~0xf;
output-rotation |= 1  dirind;
@@ -2323,10 +2300,10 @@ main (int argc, char **argv)
}
if (!strcmp (--reflect, argv[i]) || !strcmp (--reflection, 
argv[i])) {
if (++i=argc) usage ();
-   if (!output) usage();
+   if (!output) usage ();
for (dirind = 0; dirind  4; dirind++) {
-   if (strcmp (reflections[dirind], argv[i]) == 0) break;
-   }
+if (strcmp (reflections[dirind], argv[i]) == 0) break;
+}
if (dirind == 4)
usage ();
output-rotation = ~(RR_Reflect_X|RR_Reflect_Y);
@@ -2938,8 +2915,8 @@ main (int argc, char **argv)
printf ( (0x%x), 

[PATCH xrandr-utils 0/4] rotations, reflections, names

2012-02-15 Thread Bryce Harrington
Refactors three more chunks of xrandr into libXrandrUtils, and
associated tests.

Since there were no further comments to the last set of patches, they've
been posted to git.freedesktop.org.

Bryce Harrington (4):
  Refactor rotations into library
  Refactor reflection support into library.
  Add an A/B test comparing our xrandr's output with the installed
xrandr
  Refactor name_t into XRUName

 Makefile.am  |2 +-
 examples/Makefile.am |9 +-
 examples/before_and_after.sh |   23 +++
 examples/xrandr.c|  300 +++---
 include/X11/extensions/XrandrUtils.h |   58 +++
 man/XrandrUtils.man  |   52 ++
 src/Makefile.am  |3 +-
 src/XrandrUtils.c|  130 +++
 src/names.c  |   80 +
 test/.gitignore  |2 +
 test/Makefile.am |9 +-
 test/reflections.c   |  130 +++
 test/rotations.c |  132 +++
 13 files changed, 725 insertions(+), 205 deletions(-)
 create mode 100755 examples/before_and_after.sh
 create mode 100644 src/names.c
 create mode 100644 test/reflections.c
 create mode 100644 test/rotations.c

-- 
1.7.9

___
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-utils 4/4] Refactor name_t into XRUName

2012-02-15 Thread Bryce Harrington
Signed-off-by: Bryce Harrington br...@canonical.com
---
 examples/xrandr.c|  202 --
 include/X11/extensions/XrandrUtils.h |   38 +++
 man/XrandrUtils.man  |   15 +++
 src/Makefile.am  |3 +-
 src/names.c  |   80 +
 5 files changed, 206 insertions(+), 132 deletions(-)
 create mode 100644 src/names.c

diff --git a/examples/xrandr.c b/examples/xrandr.c
index 7b4..7eb50bf 100644
--- a/examples/xrandr.c
+++ b/examples/xrandr.c
@@ -186,21 +186,6 @@ typedef enum _changes {
 changes_primary = (1  12),
 } changes_t;
 
-typedef enum _name_kind {
-name_none = 0,
-name_string = (1  0),
-name_xid = (1  1),
-name_index = (1  2),
-name_preferred = (1  3),
-} name_kind_t;
-
-typedef struct {
-name_kind_tkind;
-char   *string;
-XIDxid;
-intindex;
-} name_t;
-
 typedef struct _crtc crtc_t;
 typedef struct _output output_t;
 typedef struct _transform transform_t;
@@ -215,7 +200,7 @@ struct _transform {
 };
 
 struct _crtc {
-name_t crtc;
+XRUNamecrtc;
 Bool   changing;
 XRRCrtcInfo*crtc_info;
 
@@ -242,18 +227,18 @@ struct _output {
 
 output_prop_t   *props;
 
-name_t output;
+XRUNameoutput;
 XRROutputInfo   *output_info;
 
-name_t crtc;
+XRUNamecrtc;
 crtc_t *crtc_info;
 crtc_t *current_crtc_info;
 
-name_t mode;
+XRUNamemode;
 double refresh;
 XRRModeInfo*mode_info;
 
-name_t addmode;
+XRUNameaddmode;
 
 XRURelationrelation;
 char   *relative_to;
@@ -289,8 +274,8 @@ struct _umode {
 
 umode_action_t  action;
 XRRModeInfomode;
-name_t output;
-name_t name;
+XRUNameoutput;
+XRUNamename;
 };
 
 static char *connection[3] = {
@@ -326,6 +311,23 @@ static int minWidth, maxWidth, minHeight, maxHeight;
 static Boolhas_1_2 = False;
 static Boolhas_1_3 = False;
 
+static void
+set_name (XRUName *name, char *string, XRUNameKind valid)
+{
+unsigned int xid; /* don't make it XID (which is unsigned long):
+ scanf() takes unsigned int */
+int index;
+
+if ((valid  name_xid)  sscanf (string, 0x%x, xid) == 1)
+XRUSetNameXid (name, xid);
+else if ((valid  name_index)  sscanf (string, %d, index) == 1)
+XRUSetNameIndex (name, index);
+else if (valid  name_string)
+XRUSetNameString (name, string);
+else
+   usage ();
+}
+
 static int
 mode_height (XRRModeInfo *mode_info, Rotation rotation)
 {
@@ -459,68 +461,6 @@ mode_hsync (XRRModeInfo *mode_info)
 }
 
 static void
-init_name (name_t *name)
-{
-name-kind = name_none;
-}
-
-static void
-set_name_string (name_t *name, char *string)
-{
-name-kind |= name_string;
-name-string = string;
-}
-
-static void
-set_name_xid (name_t *name, XID xid)
-{
-name-kind |= name_xid;
-name-xid = xid;
-}
-
-static void
-set_name_index (name_t *name, int index)
-{
-name-kind |= name_index;
-name-index = index;
-}
-
-static void
-set_name_preferred (name_t *name)
-{
-name-kind |= name_preferred;
-}
-
-static void
-set_name_all (name_t *name, name_t *old)
-{
-if (old-kind  name_xid)
-   name-xid = old-xid;
-if (old-kind  name_string)
-   name-string = old-string;
-if (old-kind  name_index)
-   name-index = old-index;
-name-kind |= old-kind;
-}
-
-static void
-set_name (name_t *name, char *string, name_kind_t valid)
-{
-unsigned int xid; /* don't make it XID (which is unsigned long):
-scanf() takes unsigned int */
-int index;
-
-if ((valid  name_xid)  sscanf (string, 0x%x, xid) == 1)
-   set_name_xid (name, xid);
-else if ((valid  name_index)  sscanf (string, %d, index) == 1)
-   set_name_index (name, index);
-else if (valid  name_string)
-   set_name_string (name, string);
-else
-   usage ();
-}
-
-static void
 init_transform (transform_t *transform)
 {
 int x;
@@ -583,14 +523,14 @@ add_output (void)
 }
 
 static output_t *
-find_output (name_t *name)
+find_output (XRUName *name)
 {
 output_t *output;
 
 for (output = outputs; output; output = output-next)
 {
-   name_kind_t common = name-kind  output-output.kind;
-   
+   XRUNameKind common = name-kind  output-output.kind;
+
if ((common  name_xid)  name-xid == output-output.xid)
break;
if ((common  name_string)  !strcmp (name-string, 
output-output.string))
@@ -604,33 +544,33 @@ find_output (name_t *name)
 static output_t *
 find_output_by_xid (RROutput output)
 {
-name_t  output_name;
+XRUName  output_name;
 
-init_name 

Re: [PATCH xf86-input-synaptics v2] Prefer multitouch over single-touch axis ranges

2012-02-15 Thread Peter Hutterer
On Sat, Feb 11, 2012 at 06:57:20PM +0100, Chase Douglas wrote:
 We still use single-touch data in most cases, but sometimes the
 multitouch axes have higher resolution. Since we use the same XI
 valuators to report ST and MT data, we must pick one axis and scale the
 other to match. This change picks the MT axis ranges.
 
 Signed-off-by: Chase Douglas chase.doug...@canonical.com

   e6032c3..f9a9065  master - master

Thanks

Cheers,
  Peter

 ---
 Changes since v1:
 * Move proto_data members around so they compile when !HAVE_MTDEV
 * Initialize scale factors in EventProtoDataAlloc so eventcomm-test passes
 
  src/eventcomm.c |   45 +
  1 files changed, 41 insertions(+), 4 deletions(-)
 
 diff --git a/src/eventcomm.c b/src/eventcomm.c
 index 6ffe265..e97faa8 100644
 --- a/src/eventcomm.c
 +++ b/src/eventcomm.c
 @@ -65,6 +65,10 @@ struct eventcomm_proto_data
   * exists for readability of the code.
   */
  BOOL need_grab;
 +int st_to_mt_offset_x;
 +double st_to_mt_scale_x;
 +int st_to_mt_offset_y;
 +double st_to_mt_scale_y;
  #ifdef HAVE_MTDEV
  struct mtdev *mtdev;
  int axis_map[MT_ABS_SIZE];
 @@ -76,7 +80,16 @@ struct eventcomm_proto_data
  struct eventcomm_proto_data *
  EventProtoDataAlloc(void)
  {
 -return calloc(1, sizeof(struct eventcomm_proto_data));
 +struct eventcomm_proto_data *proto_data;
 +
 +proto_data = calloc(1, sizeof(struct eventcomm_proto_data));
 +if (!proto_data)
 +return NULL;
 +
 +proto_data-st_to_mt_scale_x = 1;
 +proto_data-st_to_mt_scale_y = 1;
 +
 +return proto_data;
  }
  
  #ifdef HAVE_MTDEV
 @@ -363,6 +376,7 @@ static void
  event_query_axis_ranges(InputInfoPtr pInfo)
  {
  SynapticsPrivate *priv = (SynapticsPrivate *)pInfo-private;
 +struct eventcomm_proto_data *proto_data = priv-proto_data;
  unsigned long absbits[NBITS(ABS_MAX)] = {0};
  unsigned long keybits[NBITS(KEY_MAX)] = {0};
  char buf[256] = {0};
 @@ -396,6 +410,26 @@ event_query_axis_ranges(InputInfoPtr pInfo)
 priv-minw, priv-maxw,
 NULL, NULL);
  
 +if (priv-has_touch)
 +{
 +int st_minx = priv-minx;
 +int st_maxx = priv-maxx;
 +int st_miny = priv-miny;
 +int st_maxy = priv-maxy;
 +
 +event_get_abs(pInfo, pInfo-fd, ABS_MT_POSITION_X, priv-minx,
 +  priv-maxx, priv-synpara.hyst_x, priv-resx);
 +event_get_abs(pInfo, pInfo-fd, ABS_MT_POSITION_Y, priv-miny,
 +  priv-maxy, priv-synpara.hyst_y, priv-resy);
 +
 +proto_data-st_to_mt_offset_x = priv-minx - st_minx;
 +proto_data-st_to_mt_scale_x =
 +(priv-maxx - priv-minx) / (st_maxx - st_minx);
 +proto_data-st_to_mt_offset_y = priv-miny - st_miny;
 +proto_data-st_to_mt_scale_y =
 +(priv-maxy - priv-miny) / (st_maxy - st_miny);
 +}
 +
  SYSCALL(rc = ioctl(pInfo-fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), 
 keybits));
  if (rc = 0)
  {
 @@ -569,6 +603,7 @@ EventReadHwState(InputInfoPtr pInfo,
  struct SynapticsHwState *hw = comm-hwState;
  SynapticsPrivate *priv = (SynapticsPrivate *)pInfo-private;
  SynapticsParameters *para = priv-synpara;
 +struct eventcomm_proto_data *proto_data = priv-proto_data;
  
  SynapticsResetTouchHwState(hw);
  
 @@ -644,10 +679,12 @@ EventReadHwState(InputInfoPtr pInfo,
   if (ev.code  ABS_MT_SLOT) {
   switch (ev.code) {
   case ABS_X:
 - hw-x = ev.value;
 + hw-x = ev.value * proto_data-st_to_mt_scale_x +
 + proto_data-st_to_mt_offset_x;
   break;
   case ABS_Y:
 - hw-y = ev.value;
 + hw-y = ev.value * proto_data-st_to_mt_scale_y +
 + proto_data-st_to_mt_offset_y;
   break;
   case ABS_PRESSURE:
   hw-z = ev.value;
 @@ -816,10 +853,10 @@ EventReadDevDimensions(InputInfoPtr pInfo)
  
  if (event_query_is_touchpad(pInfo-fd, (proto_data) ? 
 proto_data-need_grab : TRUE))
  {
 -event_query_axis_ranges(pInfo);
  #ifdef HAVE_MTDEV
  event_query_touch(pInfo);
  #endif
 +event_query_axis_ranges(pInfo);
  }
  event_query_model(pInfo-fd, priv-model, priv-id_vendor, 
 priv-id_product);
  
 -- 
 1.7.8.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


Nominations for X.Org Foundation Board of Directors extended

2012-02-15 Thread Alan Coopersmith
The nomination deadline for candidates for election to the X.Org Foundation 
Board of Directors has been extended until 23.59 GMT on Monday, 20 February

2012.

The Board consists of directors elected from the membership.  Each
year, an election is held to bring the total number of directors to
eight.  The four members receiving the highest vote totals will serve
as directors for two year terms.

The directors who received two year terms starting last year were
Eric Anholt, Alan Coopersmith, Stuart Kreitman, and Bart Massey.  They
will continue to serve until their term ends in next year's elections.
Current directors who were elected two years ago, and whose term is expiring
are Alex Deucher, Matthieu Herrb, Matthias Hopf, and Keith Packard.

A director is expected to participate in the biweekly IRC meeting to
discuss current business and to attend the annual meeting of the X.Org
Foundation, which will be held at a location determined in advance by
the Board of Directors.

A member may nominate themselves or any other member they feel is
qualified.  Nominations should be sent to the Election Committee at
electi...@x.org.

Nominees shall be required to be current members of the X.Org
Foundation, and submit a  personal statement of up to 200 words that
will be provided to prospective voters.  The collected statements,
along with the statement of contribution to the X.Org Foundation in
the members account page on http://members.x.org, will be made
available to all voters to help them make their voting decisions.

Nominations and completed personal statements must be received no later
than 23.59 GMT on 20 February 2012.

The Election Committee
X.Org Foundation
___
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] Revert render: don't bother with animated cursors on floating slaves (#39989)

2012-02-15 Thread Peter Hutterer
This reverts commit bbb6b8c834e0e1491ca14403b5d0840dd14380d3.

With this patch applied, Xorg -retro does not display the default cursor.

Cause: IsFloating(dev) returns 1 for a master device if that master device
is not yet paired with the keyboard. This happens for the VCP at startup,
causing the above issue.

Correct fix is to replace with !IsMaster()  IsFloating().

Reported-by: Colin Harrison colin.harri...@virgin.net
Reported-by: Jon TURNEY jon.tur...@dronecode.org.uk
Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
I'm sending this as a revert + a new patch to make future cherry-picking
easier.

 render/animcur.c |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/render/animcur.c b/render/animcur.c
index 8d4a9c2..31cbab9 100644
--- a/render/animcur.c
+++ b/render/animcur.c
@@ -208,9 +208,6 @@ AnimCurDisplayCursor (DeviceIntPtr pDev,
 AnimCurScreenPtras = GetAnimCurScreen(pScreen);
 Bool   ret;
 
-if (IsFloating(pDev))
-   return FALSE;
-
 Unwrap (as, pScreen, DisplayCursor);
 if (IsAnimCur(pCursor))
 {
-- 
1.7.7.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


[PATCH] render: don't bother with animated cursors on floating slaves (#39989)

2012-02-15 Thread Peter Hutterer
X.Org Bug 39989 http://bugs.freedesktop.org/show_bug.cgi?id=39989

This is the corrected version after the initial fix in
bbb6b8c834e0e1491ca14403b5d0840dd14380d3.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 render/animcur.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/render/animcur.c b/render/animcur.c
index 31cbab9..11f30ad 100644
--- a/render/animcur.c
+++ b/render/animcur.c
@@ -208,6 +208,9 @@ AnimCurDisplayCursor (DeviceIntPtr pDev,
 AnimCurScreenPtras = GetAnimCurScreen(pScreen);
 Bool   ret;
 
+if (!IsMaster(pDev)  IsFloating(pDev))
+   return FALSE;
+
 Unwrap (as, pScreen, DisplayCursor);
 if (IsAnimCur(pCursor))
 {
-- 
1.7.7.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


[PATCH] Xext: return BadAccess if PickPointer fails (#45796)

2012-02-15 Thread Peter Hutterer
PickPointer or PickKeyboard return NULL, all MDs are currently disabled and
we cannot emulate a core event. This wasn't anticipated by the protocol, so
we don't really have an error code we may use here - BadAccess is simply the
least bad of the possible ones.

And returning BadAccess beats crashing the server.

X.Org Bug 45796 http://bugs.freedesktop.org/show_bug.cgi?id=45796

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 Xext/xtest.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/Xext/xtest.c b/Xext/xtest.c
index bd8e1d3..2f6a733 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -120,6 +120,10 @@ ProcXTestCompareCursor(ClientPtr client)
 rc = dixLookupWindow(pWin, stuff-window, client, DixGetAttrAccess);
 if (rc != Success)
 return rc;
+
+if (!ptr)
+return BadAccess;
+
 if (stuff-cursor == None)
 pCursor = NullCursor;
 else if (stuff-cursor == XTestCurrentCursor)
@@ -320,9 +324,15 @@ ProcXTestFakeInput(ClientPtr client)
 return BadValue;
 }
 
+/* Technically the protocol doesn't allow for BadAccess here but
+ * this can only happen when all MDs are disabled.  */
+if (!dev)
+return BadAccess;
+
 dev = GetXTestDevice(dev);
 }
 
+
 /* If the event has a time set, wait for it to pass */
 if (ev-u.keyButtonPointer.time)
 {
-- 
1.7.7.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] render: don't bother with animated cursors on floating slaves (#39989)

2012-02-15 Thread Colin Harrison
Hi,

On Wed, Feb 15, 2012 Peter Hutterer wrote:
 This is the corrected version after the initial fix in
bbb6b8c834e0e1491ca14403b5d0840dd14380d3.

Works for me.

Thanks,
Colin Harrison

___
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


[ANNOUNCE] xfd 1.1.1

2012-02-15 Thread Alan Coopersmith
xfd is a simple Xaw app to display all the characters in a font using 
either the X11 core protocol or libXft2.

This minor maintenance release fixes some build configuration issues
and some (but not all) compiler warnings.

Alan Coopersmith (4):
  Strip trailing whitespace
  Add const attribute to domaindir fix gcc -Wwrite-strings warnings
  Remove freetype2 from PKG_CHECK_MODULES list
  xfd 1.1.1

Gaetan Nadon (6):
  config: replace deprecated AC_HELP_STRING with AS_HELP_STRING
  config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS
  man: remove trailing spaces and tabs
  man: replace hard coded man page section with substitution strings
  config: move man pages into their own directory
  Use the Automake recommended alternative to AX_DEFINE_DIR

git tag: xfd-1.1.1

http://xorg.freedesktop.org/archive/individual/app/xfd-1.1.1.tar.bz2
MD5:  b3893e03a5288927781acd5d3c65ba19
SHA1: b8662c6c6821f1f82995bcb98bb986b56716b787
SHA256: 3fbef0d5ed6dc088017df156e748d187b2d1aaedc3de7ea96e505ea6d1af7b73

http://xorg.freedesktop.org/archive/individual/app/xfd-1.1.1.tar.gz
MD5:  1e4eb9e16fbb6864948c20e1e0126d38
SHA1: 41763590b5f1b0285804886b921cebef2a1272dc
SHA256: e7c2a8f17992f7f6822ce175045e329995f4f64ad45ad8a87130ba7de686828c


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


pgpCnbzWg404q.pgp
Description: PGP signature
___
xorg-announce mailing list
xorg-announce@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-announce


[ANNOUNCE] libXaw3d 1.6.1

2012-02-15 Thread Matt Turner
Devin J. Pohly (1):
  Fix segfaults on tip popups

Gaetan Nadon (1):
  Make --enable-internationalization default

Jeremy Huddleston (3):
  Include stdlib.h for abs()
  Cleanup shadow declarations
  Build fix for int-pointer cast errors

Matt Turner (6):
  Include XAW3D_CPPFLAGS in xaw3d.pc Cflags
  Include headers instead of using extern definitions
  Include WidgetNode.h from AllWidgets.h
  Add multiSink and multiSrc to AllWidgets.c
  Include MultiSrc.h in AllWidgets.c
  libXaw3d 1.6.1

git tag: libXaw3d-1.6.1

http://xorg.freedesktop.org/archive/individual/lib/libXaw3d-1.6.1.tar.bz2
MD5:  3db4cfe29ee911a519ef254625809f9c  libXaw3d-1.6.1.tar.bz2
SHA1: e8da0b904459af6e769b0fb2c9bc34a560126e86  libXaw3d-1.6.1.tar.bz2
SHA256: 9cd43caabb9e17d7d06c6e156cace9f7b7849c60662f61561dbf44c1eea10971  
libXaw3d-1.6.1.tar.bz2

http://xorg.freedesktop.org/archive/individual/lib/libXaw3d-1.6.1.tar.gz
MD5:  b7b530238a89feefbdb20066e29a436e  libXaw3d-1.6.1.tar.gz
SHA1: 742f1a74bb2644c29513b66845b129864173bee7  libXaw3d-1.6.1.tar.gz
SHA256: 8989a5993804d832f26497438f235079f1863803583fcd028c8f7e80959ab9e8  
libXaw3d-1.6.1.tar.gz



pgpCpiTGHtoQ3.pgp
Description: PGP signature
___
xorg-announce mailing list
xorg-announce@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-announce


Re: Stuttering / Frame drops with RS880/785G and AMD Bulldozer CPU

2012-02-15 Thread Shahar Or
2012/2/14 Michel Dänzer mic...@daenzer.net

 On Mon, 2012-02-13 at 13:05 +0200, Shahar Or wrote:
 
  A Live image of Ubuntu Desktop 12.04 amd64 was also tested. It had the
  same stuttering / framedrop.

 Have you tried a live image of a different distro?

I've tried openSUSE-12.1-GNOME-LiveCD-x86_64.iso. Same thing. Maybe a
bit worse. Using the 'performance' governor results in no stuttering,
just like in Ubuntu 11.10 (more on that below).

  2012/2/9 Michel Dänzer mic...@daenzer.net
   On Don, 2012-02-09 at 02:03 +0200, Shahar Or wrote:
  So I ran sysprof, which is an easy GUI and to my content I only needed
  to press a Start button :). That's when the magic happened. From the
  moment it starts the stuttering goes away. Sweet rendering smoothness
  of divine electrical display benefaction ensues! And from the moment I
  press Profile to stop it, it stops and stuttering returns OMG. And
  this is perfectly persistent. What does this mean?

 Not sure...

 Which cpufreq governor is being used? Assuming it's one that dynamically
 changes CPU core frequencies, such as ondemand or conservative, does the
 problem go away if you switch to one that doesn't, e.g. performance or
 powersave?

This is fun.
performance: smoothness goodness
ondemand: the stuttering as demonstrated in the video
conservative: stuttering reduced to seemingly about 10% compared to ondemand
powersave: stuttering increase seemingly to about five times more than
with ondemand

When using ondemand, raising minimum frequencies results in less
stuttering. Raising the minimum frequency of all four cores to the
second step, 1.7GHz, helps a lot and and raising it to 2.5GHz results
no stuttering. This is under the limited strain of dragging windows
around in 1280x1024 in compiz, Ubuntu 11.10.
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[Bug 44099] Big Image in Firefox crashes X server in

2012-02-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=44099

--- Comment #1 from Stefan kde...@vogtner.de 2012-02-15 06:17:56 PST ---
The direct URL to the 10-MB-JPEG is

http://upload.wikimedia.org/wikipedia/commons/d/db/Aerial_photo_of_WTC_groundzero.jpg

It crashes the X server not only when viewed in Firefox but also when using 
kuickshow. Full Backtrace:

Program received signal SIGBUS, Bus error.
0x75849e5b in memcpy () from /lib64/libc.so.6
#0  0x75849e5b in memcpy () from /lib64/libc.so.6
No symbol table info available.
#1  0x73e95f8e in R600UploadToScreenCS (pDst=0x15d7080, x=0, y=0, 
w=8098, h=8, src=0x1b74f88 LD\025, src_pitch=32392) at r600_exa.c:1851
pScrn = 0x80ba50
info = 0x810110
accel_state = 0x8116e0
driver_priv = 0x16891c0
scratch = 0x0
copy_dst = 0x1641c30
dst = 0x7fffe0df7000 Address 0x7fffe0df7000 out of bounds
dst_domain = 4
bpp = optimized out
scratch_pitch = optimized out
copy_pitch = 32768
ret = optimized out
flush = 0
r = optimized out
i = 1
src_obj = {pitch = 22900864, width = 0, height = 4092015433, 
  offset = 32767, bpp = 0, domain = 0, bo = 0x737abeba, 
  tiling_flags = 22900864}
dst_obj = {pitch = 0, width = 0, height = 8567792, offset = 0, 
  bpp = 32392, domain = 0, bo = 0x0, tiling_flags = 0}
#2  0x737ad549 in exaDoPutImage (src_stride=optimized out, 
bits=optimized out, format=optimized out, h=optimized out, 
w=optimized out, y=optimized out, x=optimized out, 
depth=optimized out, pGC=optimized out, pDrawable=optimized out)
at exa_accel.c:219
No locals.
#3  exaPutImage (pDrawable=0x15d7080, pGC=0x1685c90, depth=24, x=0, y=0, 
w=8098, h=8, leftPad=0, format=2, bits=0x1b74f88 LD\025)
at exa_accel.c:240
No locals.
#4  0x004fcc02 in damagePutImage (pDrawable=0x15d7080, pGC=0x1685c90, 
depth=24, x=0, y=0, w=8098, h=8, leftPad=0, format=2, 
pImage=0x1b74f88 LD\025) at damage.c:830
oldFuncs = 0x7d3460
#5  0x00433a0a in ProcPutImage (client=0x1653b30) at dispatch.c:1986
pGC = 0x1685c90
pDraw = 0x15d7080
length = optimized out
#6  0x00437099 in Dispatch () at dispatch.c:432
result = 0
client = 0x1653b30
nready = 0
start_tick = 160
#7  0x00425d35 in main (argc=8, argv=0x7fffe238, 
envp=optimized out) at main.c:287
i = 1
alwaysCheckForInput = {0, 1}

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[Bug 28106] radeon KMS causes hardware conflict/interference with Intel wifi and audio, crashes wireless

2012-02-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=28106

--- Comment #62 from Neven nkla...@gmail.com 2012-02-15 21:43:31 PST ---
Looks like this will never get solved ;( 

If anyone has ideas on how to debug this issue, I have a t60 that I can use.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[Bug 28106] radeon KMS causes hardware conflict/interference with Intel wifi and audio, crashes wireless

2012-02-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=28106

--- Comment #63 from Neven nkla...@gmail.com 2012-02-15 23:31:58 PST ---
(In reply to comment #62)
 Looks like this will never get solved ;( 
 
 If anyone has ideas on how to debug this issue, I have a t60 that I can use.

I tried enabling msi on alsa and its alot better. Still fulscreen is not good, 
but much sounds like 11.04 

Add: options snd-hda-intel enable_msi=1 to the bottom of your 
/etc/modprobe.d/alsa-base file.

I think radeon is somehow not playing nice with msi. If we could disable it it 
might fix the problem...I tried doing it with echo 0  msi_bus in the radeon
bridge but it wasnt working

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


Radeon KMS msi issues.

2012-02-15 Thread Neven Klacar
https://bugs.freedesktop.org/show_bug.cgi?id=28106

I was investigating the above bug, and for some reason radeon x1400 cards
that use msi based interrupts, are conflicting in some way with the msi
interrupts used by the sound card and wifi chip. Doing anything display
intensive will drop the wifi connection and make really choppy sound.


How can I disable msi on the radeon driver? Can it be turned off/on via a
conf file? I tried echo 0 to msi_bus in /sys/bus/pci/devices/**/ but it
didnt work.

If I have to recompile the source where do I disable it?

~Neven
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati