[Bug 36777] radeon 0000:01:00.0: IH ring buffer overflow (0xFFFFFFFF, 15, 65550)

2011-05-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=36777

Michel Dänzer  changed:

   What|Removed |Added

Product|xorg|DRI
  Component|Driver/Radeon   |DRM/Radeon
 AssignedTo|xorg-driver-...@lists.x.org |dri-devel@lists.freedesktop
   ||.org
  QAContact|xorg-t...@lists.x.org   |

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


[Bug 36745] wine 1.3.19 and 3Dmark2001SE Dragothic demo upset kernel 2.6.38.4

2011-05-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=36745

--- Comment #9 from Michel Dänzer  2011-05-03 01:37:50 PDT 
---
Can you print track->num_arrays when this happens? I suspect track->arrays[]
may be overflowing and clobbering track->cb[].

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


[Bug 36602] Hierarchical Z support for R600

2011-05-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=36602

Pierre-Eric Pelloux-Prayer  changed:

   What|Removed |Added

  Attachment #46081|0   |1
is obsolete||
  Attachment #46082|0   |1
is obsolete||

--- Comment #5 from Pierre-Eric Pelloux-Prayer  2011-05-03 
02:36:02 PDT ---
Created an attachment (id=46281)
 View: https://bugs.freedesktop.org/attachment.cgi?id=46281
 Review: https://bugs.freedesktop.org/review?bug=36602&attachment=46281

Updated patch

Here's an updated patch.
Main differences are :
- num tile pipes getter
- algo for determining HTILE_SETTINGS value
- htile buffer size is more precisely calculated

Questions :
- actually htile buffer is allocated to : DB_size_in_pixels * 4 / 4*4. This
could be reduced in some case (when using 8x8 tiles for instance). I was
thinking of moving the htile_settings calculation to r600_texture.c (when HiZ
bo is created), and storing the htile_settings value alongside the HiZ bo
pointer, for future usage (mainly when setting HTILE_SETTINGS register) ?
- I sometimes get this kernel error when enabling HiZ :
[  459.432139] WARNING: at drivers/gpu/drm/radeon/radeon_fence.c:248
radeon_fence_wait+0x2a0/0x33f [radeon]()
[  459.432146] Hardware name: MS-7551
[  459.432152] GPU lockup (waiting for 0x0001216B last fence id 0x00012167)
[]
[  459.432694]  [] ? drm_ioctl+0x273/0x347 [drm]
I'm not sure where does this come from, and how much this could be related to
HiZ ?

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


[Bug 34252] Unexpected behaviour when switching video cards with vga_switcheroo

2011-05-03 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=34252


Rafael J. Wysocki  changed:

   What|Removed |Added

 Blocks|32012   |27352




-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are watching the assignee of the bug.

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
--
___
Dri-devel mailing list
dri-de...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 36745] wine 1.3.19 and 3Dmark2001SE Dragothic demo upset kernel 2.6.38.4

2011-05-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=36745

Andrew Randrianasulu  changed:

   What|Removed |Added

  Attachment #46266|0   |1
is obsolete||

--- Comment #10 from Andrew Randrianasulu  2011-05-03 04:08:42 
PDT ---
Created an attachment (id=46284)
 --> (https://bugs.freedesktop.org/attachment.cgi?id=46284)
more debug in dmesg

I've added DRM_ERROR("[drm] num_arrays, %u\n", track->num_arrays); into
r100_cs_track_check(), but it prints just "3"

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


[PATCH] drm/radeon/kms: add support for thermal chips on combios asics

2011-05-03 Thread Alex Deucher
Signed-off-by: Alex Deucher 
---
 drivers/gpu/drm/radeon/radeon_combios.c |   54 +++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_combios.c 
b/drivers/gpu/drm/radeon/radeon_combios.c
index 8caf546..089ab92 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -2504,6 +2504,12 @@ bool radeon_get_legacy_connector_info_from_bios(struct 
drm_device *dev)
return true;
 }
 
+static const char *thermal_controller_names[] = {
+   "NONE",
+   "lm63",
+   "adm1032",
+};
+
 void radeon_combios_get_power_modes(struct radeon_device *rdev)
 {
struct drm_device *dev = rdev->ddev;
@@ -2524,6 +2530,54 @@ void radeon_combios_get_power_modes(struct radeon_device 
*rdev)
return;
}
 
+   /* check for a thermal chip */
+   offset = combios_get_table_offset(dev, COMBIOS_OVERDRIVE_INFO_TABLE);
+   if (offset) {
+   u8 thermal_controller = 0, gpio = 0, i2c_addr = 0, clk_bit = 0, 
data_bit = 0;
+   struct radeon_i2c_bus_rec i2c_bus;
+
+   rev = RBIOS8(offset);
+
+   if (rev == 0) {
+   thermal_controller = RBIOS8(offset + 3);
+   gpio = RBIOS8(offset + 4) & 0x3f;
+   i2c_addr = RBIOS8(offset + 5);
+   } else if (rev == 1) {
+   thermal_controller = RBIOS8(offset + 4);
+   gpio = RBIOS8(offset + 5) & 0x3f;
+   i2c_addr = RBIOS8(offset + 6);
+   } else if (rev == 2) {
+   thermal_controller = RBIOS8(offset + 4);
+   gpio = RBIOS8(offset + 5) & 0x3f;
+   i2c_addr = RBIOS8(offset + 6);
+   clk_bit = RBIOS8(offset + 0xa);
+   data_bit = RBIOS8(offset + 0xb);
+   }
+   if ((thermal_controller > 0) && (thermal_controller < 3)) {
+   DRM_INFO("Possible %s thermal controller at 0x%02x\n",
+thermal_controller_names[thermal_controller],
+i2c_addr >> 1);
+   if (gpio == DDC_LCD) {
+   /* MM i2c */
+   i2c_bus.valid = true;
+   i2c_bus.hw_capable = true;
+   i2c_bus.mm_i2c = true;
+   i2c_bus.i2c_id = 0xa0;
+   } else if (gpio == DDC_GPIO)
+   i2c_bus = combios_setup_i2c_bus(rdev, gpio, 1 
<< clk_bit, 1 << data_bit);
+   else
+   i2c_bus = combios_setup_i2c_bus(rdev, gpio, 0, 
0);
+   rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus);
+   if (rdev->pm.i2c_bus) {
+   struct i2c_board_info info = { };
+   const char *name = 
thermal_controller_names[thermal_controller];
+   info.addr = i2c_addr >> 1;
+   strlcpy(info.type, name, sizeof(info.type));
+   i2c_new_device(&rdev->pm.i2c_bus->adapter, 
&info);
+   }
+   }
+   }
+
if (rdev->flags & RADEON_IS_MOBILITY) {
offset = combios_get_table_offset(dev, 
COMBIOS_POWERPLAY_INFO_TABLE);
if (offset) {
-- 
1.7.1.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/2] drm/radeon/kms: set i2c adapter class to I2C_CLASS_DDC

2011-05-03 Thread Alex Deucher
The most common use of the radeon i2c buses is for ddc.

Signed-off-by: Alex Deucher 
Cc: Jean Delvare 
---
 drivers/gpu/drm/radeon/radeon_i2c.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c 
b/drivers/gpu/drm/radeon/radeon_i2c.c
index 983cbac..781196d 100644
--- a/drivers/gpu/drm/radeon/radeon_i2c.c
+++ b/drivers/gpu/drm/radeon/radeon_i2c.c
@@ -888,6 +888,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device 
*dev,
 
i2c->rec = *rec;
i2c->adapter.owner = THIS_MODULE;
+   i2c->adapter.class = I2C_CLASS_DDC;
i2c->dev = dev;
i2c_set_adapdata(&i2c->adapter, i2c);
if (rec->mm_i2c ||
@@ -947,6 +948,7 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct 
drm_device *dev,
 
i2c->rec = *rec;
i2c->adapter.owner = THIS_MODULE;
+   i2c->adapter.class = I2C_CLASS_DDC;
i2c->dev = dev;
snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
 "Radeon aux bus %s", name);
-- 
1.7.1.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/2] drm/radeon/kms: add I2C_CLASS_HWMON to radeon i2c adapater classes

2011-05-03 Thread Alex Deucher
I'm not sure this is necessary.  In most cases the driver
will add the hwmon device itself based on information from the
vbios tables.  However, there are some boards without a proper
vbios entry for the the hwmon chips and non-x86 (Mac/Sun) cards do
not have a standard vbios.  This allows the hwmon drivers to
detect devices on the radeon i2c buses.

Signed-off-by: Alex Deucher 
Cc: Jean Delvare 
---
 drivers/gpu/drm/radeon/radeon_i2c.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c 
b/drivers/gpu/drm/radeon/radeon_i2c.c
index 781196d..65d8744 100644
--- a/drivers/gpu/drm/radeon/radeon_i2c.c
+++ b/drivers/gpu/drm/radeon/radeon_i2c.c
@@ -888,7 +888,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device 
*dev,
 
i2c->rec = *rec;
i2c->adapter.owner = THIS_MODULE;
-   i2c->adapter.class = I2C_CLASS_DDC;
+   i2c->adapter.class = I2C_CLASS_DDC | I2C_CLASS_HWMON;
i2c->dev = dev;
i2c_set_adapdata(&i2c->adapter, i2c);
if (rec->mm_i2c ||
-- 
1.7.1.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[RFC] swap complete event handling fixes

2011-05-03 Thread Jesse Barnes
Ended up moving over to generic events since the GLX type code is part
of the GLX namespace and larger than 8 bits.

Apparently no one had ever tried ChangeDrawableAttributes with indirect
clients, because simply going a glXSelectEvent causes a crash in that
case.  So this patch set includes a fix for that issue and has been
tested with both direct and indirect clients, both with and without
client and server support.

New clients with old servers should get a 0 sbc rather than garbage.
New servers will send old clients a 0 sbc, but the clients will still
copy garbage into the event actually sent to clients.  New servers with
new clients should work both in the direct and indirect cases and get
whatever values the server sends for each field.

As always, testing and review appreciated.  Piglit's glx-swap-event case
now checks for swap count sanity (i.e. increasing, nonzero value) and
allows you to dump the current values in verbose mode.  I also added a
few more return value checks to the test.

Thanks,
Jesse

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 4/5] DRI2: support generic swap event handling

2011-05-03 Thread Jesse Barnes
The existing swap event structure is too large to fit in an XEvent, so new
servers will send a generic event if the client supports it.  This
allows a valid swap count value to be sent along with the event type,
timestamp, and media stamp.  Check for server support based on the
advertised DRI2 version and look for generic events in the event stream
with DRI2 in the extension field.

Signed-off-by: Jesse Barnes 
---
 configure.ac|2 +-
 src/glx/dri2.c  |  105 --
 src/glx/dri2.h  |3 +-
 src/glx/dri2_glx.c  |   31 +-
 src/glx/glxclient.h |2 +
 5 files changed, 108 insertions(+), 35 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3b05ca3..92d11af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ dnl Versions for external dependencies
 LIBDRM_REQUIRED=2.4.24
 LIBDRM_RADEON_REQUIRED=2.4.24
 LIBDRM_INTEL_REQUIRED=2.4.24
-DRI2PROTO_REQUIRED=2.1
+DRI2PROTO_REQUIRED=2.4
 GLPROTO_REQUIRED=1.4.11
 LIBDRM_XORG_REQUIRED=2.4.24
 LIBKMS_XORG_REQUIRED=1.0.0
diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index adfd3d1..9cab639 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -48,7 +48,7 @@
  */
 #if DRI2_MINOR < 1
 #undef DRI2_MINOR
-#define DRI2_MINOR 1
+#define DRI2_MINOR 4
 #define X_DRI2GetBuffersWithFormat 7
 #endif
 
@@ -88,43 +88,85 @@ static Bool
 DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
 {
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+   int type;
 
XextCheckExtension(dpy, info, dri2ExtensionName, False);
 
-   switch ((wire->u.u.type & 0x7f) - info->codes->first_event) {
+   if (wire->u.u.type == GenericEvent &&
+   dri2ServerSupportsSBC(dpy)) {
+  xGenericEvent *wire2 = (xGenericEvent *)wire;
+  if (!dri2Event(dpy, wire2->extension))
+ return False;
+  type = wire2->evtype;
+   } else {
+  type = (wire->u.u.type & 0x7f) - info->codes->first_event;
+   }
+
+   switch (type) {
 
 #ifdef X_DRI2SwapBuffers
case DRI2_BufferSwapComplete:
{
   GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event;
-  xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire;
-
-  /* Ignore swap events if we're not looking for them */
-  aevent->type = dri2GetSwapEventType(dpy, awire->drawable);
-  if(!aevent->type)
- return False;
-
-  aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
-  aevent->send_event = (awire->type & 0x80) != 0;
-  aevent->display = dpy;
-  aevent->drawable = awire->drawable;
-  switch (awire->event_type) {
-  case DRI2_EXCHANGE_COMPLETE:
-aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL;
-break;
-  case DRI2_BLIT_COMPLETE:
-aevent->event_type = GLX_COPY_COMPLETE_INTEL;
-break;
-  case DRI2_FLIP_COMPLETE:
-aevent->event_type = GLX_FLIP_COMPLETE_INTEL;
-break;
-  default:
-/* unknown swap completion type */
-return False;
+
+  if (dri2ServerSupportsSBC(dpy)) {
+xDRI2BufferSwapComplete2 *awire = (xDRI2BufferSwapComplete2 *)wire;
+
+/* Ignore swap events if we're not looking for them */
+aevent->type = dri2GetSwapEventType(dpy, awire->drawable);
+if(!aevent->type)
+   return False;
+
+aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
+aevent->send_event = (awire->type & 0x80) != 0;
+aevent->display = dpy;
+aevent->drawable = awire->drawable;
+switch (awire->swap_event_type) {
+case DRI2_EXCHANGE_COMPLETE:
+   aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL;
+   break;
+case DRI2_BLIT_COMPLETE:
+   aevent->event_type = GLX_COPY_COMPLETE_INTEL;
+   break;
+case DRI2_FLIP_COMPLETE:
+   aevent->event_type = GLX_FLIP_COMPLETE_INTEL;
+   break;
+default:
+   /* unknown swap completion type */
+   return False;
+}
+aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
+aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
+aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
+  } else {
+xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire;
+/* Ignore swap events if we're not looking for them */
+aevent->type = dri2GetSwapEventType(dpy, awire->drawable);
+if(!aevent->type)
+   return False;
+
+aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
+aevent->send_event = (awire->type & 0x80) != 0;
+aevent->display = dpy;
+aevent->drawable = awire->drawable;
+switch (awire->event_type) {
+case DRI2_EXCHANGE_COMPLETE:
+   aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL;
+   break;
+case DRI2_BLIT_COMPLETE:
+   aevent->event_type = GLX_COPY_COMPLETE_INTEL;
+   break;
+case DRI2_FLIP_CO

[PATCH] GLX: fix broken swap event size by using a generic event

2011-05-03 Thread Jesse Barnes
The existing event is too large for an XEvent meaning that the swap
count is never sent to clients.  Create a generic event instead for use
by new clients & servers.

Signed-off-by: Jesse Barnes 
---
 configure.ac |2 +-
 glxproto.h   |   18 ++
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index d88e6df..a3047e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([GLProto], [1.4.12], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AC_INIT([GLProto], [1.4.13], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
 
diff --git a/glxproto.h b/glxproto.h
index 0ff44e3..d026d4d 100644
--- a/glxproto.h
+++ b/glxproto.h
@@ -1384,6 +1384,24 @@ typedef struct {
 CARD32 sbc_lo B32;
 } xGLXBufferSwapComplete;
 
+/* The above is actually too large to fit in an XEvent, so use a generic
+ * event so we can send the sbc count as well. */
+typedef struct {
+BYTE type;
+CARD8 extension;
+CARD16 sequenceNumber B16;
+CARD32 length B32; /* should always be 8 for this event */
+CARD16 evtype B16;
+CARD16 swap_event_type B16;
+CARD32 drawable B32;
+CARD32 ust_hi B32;
+CARD32 ust_lo B32;
+CARD32 msc_hi B32;
+CARD32 msc_lo B32;
+CARD32 sbc_hi B32;
+CARD32 sbc_lo B32;
+} xGLXBufferSwapComplete2;
+
 //
 
 /*
-- 
1.7.4.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 5/5] GLX: support generic swap events

2011-05-03 Thread Jesse Barnes
The existing swap event structure is too big to fit in an XEvent, so
support servers that send generic events instead.  Do this by
advertising the GLX proto version we support when connecting and check
for generic events in the event stream.  Convert any received events
into regular swap complete events for client compatibility.

Signed-off-by: Jesse Barnes 
---
 configure.ac|2 +-
 src/glx/glxclient.h |2 +-
 src/glx/glxext.c|   55 --
 3 files changed, 50 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 92d11af..94fb6f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ LIBDRM_REQUIRED=2.4.24
 LIBDRM_RADEON_REQUIRED=2.4.24
 LIBDRM_INTEL_REQUIRED=2.4.24
 DRI2PROTO_REQUIRED=2.4
-GLPROTO_REQUIRED=1.4.11
+GLPROTO_REQUIRED=1.4.13
 LIBDRM_XORG_REQUIRED=2.4.24
 LIBKMS_XORG_REQUIRED=1.0.0
 
diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index 755a66d..cdef2a1 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -63,7 +63,7 @@
 #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
 
 #define GLX_MAJOR_VERSION 1   /* current version numbers */
-#define GLX_MINOR_VERSION 4
+#define GLX_MINOR_VERSION 5
 
 #define __GLX_MAX_TEXTURE_UNITS 32
 
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index 278c719..fb29711 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -104,14 +104,42 @@ XEXT_GENERATE_ERROR_STRING(__glXErrorString, 
__glXExtensionName,
  */
 
 static Bool
+__glXServerSupportsSBC(Display *dpy)
+{
+ struct glx_display *glx_dpy = __glXInitialize(dpy);
+
+ return (glx_dpy->majorVersion > 1 || (glx_dpy->majorVersion == 1 &&
+  glx_dpy->minorVersion > 4));
+}
+
+static Bool
+__glXGenericEvent(Display *dpy, xGenericEvent *wire)
+{
+ struct glx_display *glx_dpy = __glXInitialize(dpy);
+
+ return wire->extension == glx_dpy->codes->major_opcode;
+}
+
+static Bool
 __glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire)
 {
  struct glx_display *glx_dpy = __glXInitialize(dpy);
+ int type;
 
if (glx_dpy == NULL)
   return False;
 
-   switch ((wire->u.u.type & 0x7f) - glx_dpy->codes->first_event) {
+   /* New extension will send generic events for some events */
+   if (wire->u.u.type == GenericEvent && __glXServerSupportsSBC(dpy)) {
+  xGenericEvent *wire2 = (xGenericEvent *)wire;
+  if (!__glXGenericEvent(dpy, wire2))
+return False;
+  type = wire2->evtype;
+   } else {
+  type = (wire->u.u.type & 0x7f) - glx_dpy->codes->first_event;
+   }
+
+   switch (type) {
case GLX_PbufferClobber:
{
   GLXPbufferClobberEvent *aevent = (GLXPbufferClobberEvent *)event;
@@ -133,12 +161,23 @@ __glXWireToEvent(Display *dpy, XEvent *event, xEvent 
*wire)
case GLX_BufferSwapComplete:
{
   GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event;
-  xGLXBufferSwapComplete *awire = (xGLXBufferSwapComplete *)wire;
-  aevent->event_type = awire->event_type;
-  aevent->drawable = awire->drawable;
-  aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
-  aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
-  aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
+  if (__glXServerSupportsSBC(dpy)) {
+xGLXBufferSwapComplete2 *awire = (xGLXBufferSwapComplete2 *)wire;
+/* Make it look like a regular event to clients */
+aevent->type = glx_dpy->codes->first_event + awire->evtype;
+aevent->event_type = awire->swap_event_type;
+aevent->drawable = awire->drawable;
+aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
+aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
+aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
+  } else {
+xGLXBufferSwapComplete *awire = (xGLXBufferSwapComplete *)wire;
+aevent->event_type = awire->event_type;
+aevent->drawable = awire->drawable;
+aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
+aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
+aevent->sbc = 0;
+  }
   return True;
}
default:
@@ -843,6 +882,8 @@ __glXInitialize(Display * dpy)
   XESetEventToWire(dpy, dpyPriv->codes->first_event + i, __glXEventToWire);
}
 
+   XESetWireToEvent(dpy, GenericEvent, __glXWireToEvent);
+
XESetCloseDisplay(dpy, dpyPriv->codes->extension, __glXCloseDisplay);
XESetErrorString (dpy, dpyPriv->codes->extension,__glXErrorString);
 
-- 
1.7.4.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 6/8] GLX/DRI2: pass drawable correctly for indirect swap events

2011-05-03 Thread Jesse Barnes
Pass the right drawable pointer as data to the swap complete function.

Signed-off-by: Jesse Barnes 
---
 glx/glxdri2.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index d979717..93c5e5b 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -222,7 +222,7 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable 
*drawable)
 #endif
 
 if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused,
-   __glXdriSwapEvent, drawable->pDraw) != Success)
+   __glXdriSwapEvent, drawable) != Success)
return FALSE;
 
 return TRUE;
-- 
1.7.4.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 7/8] DRI2: support generic swap events

2011-05-03 Thread Jesse Barnes
Send the new generic swap event type if the client supports it.  This
means checking the client's DRI2 proto version at connect time and then
constructing a new generic event at swap complete time.  To track the
client version, we need to add a new DRI2 client private type and track
it for the lifetime of the client.

Signed-off-by: Jesse Barnes 
---
 configure.ac  |2 +-
 glx/glxdri2.c |   20 +++
 hw/xfree86/dri2/dri2.c|   57 -
 hw/xfree86/dri2/dri2.h|6 
 hw/xfree86/dri2/dri2ext.c |   47 +++-
 5 files changed, 118 insertions(+), 14 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6eb780c..8e00fe7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -771,7 +771,7 @@ RECORDPROTO="recordproto >= 1.13.99.1"
 SCRNSAVERPROTO="scrnsaverproto >= 1.1"
 RESOURCEPROTO="resourceproto"
 DRIPROTO="xf86driproto >= 2.1.0"
-DRI2PROTO="dri2proto >= 2.3"
+DRI2PROTO="dri2proto >= 2.4"
 XINERAMAPROTO="xineramaproto"
 BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
 DGAPROTO="xf86dgaproto >= 2.0.99.1"
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 93c5e5b..a17b4d5 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -228,6 +228,23 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, 
__GLXdrawable *drawable)
 return TRUE;
 }
 
+static void
+__glXDRIclientCallback(CallbackListPtr *list,
+  pointer  closure,
+  pointer  data)
+{
+NewClientInfoRec   *clientinfo = (NewClientInfoRec *) data;
+ClientPtr  pClient = clientinfo->client;
+
+switch (pClient->clientState) {
+case ClientStateGone:
+   DRI2ClientGone(pClient);
+   break;
+default:
+   break;
+}
+}
+
 static int
 __glXDRIdrawableSwapInterval(__GLXdrawable *drawable, int interval)
 {
@@ -769,6 +786,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 screen->leaveVT = pScrn->LeaveVT;
 pScrn->LeaveVT = glxDRILeaveVT;
 
+if (!AddCallback (&ClientStateCallback, __glXDRIclientCallback, 0))
+   return NULL;
+
 LogMessage(X_INFO,
   "AIGLX: Loaded and initialized %s\n", driverName);
 
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 5c42a51..9b5eab2 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -60,6 +60,9 @@ static DevPrivateKeyRec dri2WindowPrivateKeyRec;
 static DevPrivateKeyRec dri2PixmapPrivateKeyRec;
 #define dri2PixmapPrivateKey (&dri2PixmapPrivateKeyRec)
 
+static DevPrivateKeyRec dri2ClientPrivateKeyRec;
+#define dri2ClientPrivateKey (&dri2ClientPrivateKeyRec)
+
 static RESTYPE   dri2DrawableRes;
 
 typedef struct _DRI2Screen *DRI2ScreenPtr;
@@ -107,6 +110,11 @@ typedef struct _DRI2Screen {
 ConfigNotifyProcPtr ConfigNotify;
 } DRI2ScreenRec;
 
+typedef struct _DRI2Client {
+CARD32 major;
+CARD32 minor;
+} DRI2ClientRec, *DRI2ClientPtr;
+
 static DRI2ScreenPtr
 DRI2GetScreen(ScreenPtr pScreen)
 {
@@ -131,6 +139,12 @@ DRI2GetDrawable(DrawablePtr pDraw)
 }
 }
 
+static DRI2ClientPtr
+DRI2GetClient(ClientPtr client)
+{
+return dixLookupPrivate(&client->devPrivates, dri2ClientPrivateKey);
+}
+
 static unsigned long
 DRI2DrawableSerial(DrawablePtr pDraw)
 {
@@ -190,6 +204,44 @@ DRI2AllocateDrawable(DrawablePtr pDraw)
 return pPriv;
 }
 
+void
+DRI2InitClient(ClientPtr client, CARD32 major, CARD32 minor)
+{
+DRI2ClientPtr pPriv;
+
+pPriv = malloc(sizeof *pPriv);
+if (!pPriv)
+   return;
+
+pPriv->major = major;
+pPriv->minor = minor;
+
+dixSetPrivate(&client->devPrivates, dri2ClientPrivateKey, pPriv);
+}
+
+void
+DRI2ClientGone(ClientPtr client)
+{
+DRI2ClientPtr pPriv = DRI2GetClient(client);
+
+if (pPriv)
+   free(pPriv);
+}
+
+Bool
+DRI2ClientSupportsSBC(ClientPtr client)
+{
+DRI2ClientPtr pPriv = DRI2GetClient(client);
+
+if (!pPriv)
+   return FALSE;
+
+if (pPriv->major > 1 || (pPriv->major == 1 && pPriv->minor > 3))
+   return TRUE;
+
+return FALSE;
+}
+
 typedef struct DRI2DrawableRefRec {
 XID  id;
 XID  dri2_id;
@@ -1097,6 +1149,9 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
 if (!dixRegisterPrivateKey(&dri2PixmapPrivateKeyRec, PRIVATE_PIXMAP, 0))
return FALSE;
 
+if (!dixRegisterPrivateKey(&dri2ClientPrivateKeyRec, PRIVATE_CLIENT, 0))
+   return FALSE;
+
 ds = calloc(1, sizeof *ds);
 if (!ds)
return FALSE;
@@ -1114,7 +1169,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
ds->ScheduleSwap = info->ScheduleSwap;
ds->ScheduleWaitMSC = info->ScheduleWaitMSC;
ds->GetMSC = info->GetMSC;
-   cur_minor = 3;
+   cur_minor = 4;
 } else {
cur_minor = 1;
 }
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index fe0bf6c..97e8e86 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -192,6 +192,7 @@ typedef struct {
 }  DRI2

[PATCH 8/8] GLX: support generic swap events

2011-05-03 Thread Jesse Barnes
Send the new generic GLX swap event if supported by the client.  This
means checking the client GLX version at swap complete time and
constructing a new generic swap completion event at swap complete time.

Signed-off-by: Jesse Barnes 
---
 configure.ac|2 +-
 glx/glxdri2.c   |   99 +++---
 glx/glxext.c|2 +
 glx/glxserver.h |1 +
 include/protocol-versions.h |2 +-
 5 files changed, 78 insertions(+), 28 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8e00fe7..87194a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -775,7 +775,7 @@ DRI2PROTO="dri2proto >= 2.4"
 XINERAMAPROTO="xineramaproto"
 BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
 DGAPROTO="xf86dgaproto >= 2.0.99.1"
-GLPROTO="glproto >= 1.4.10"
+GLPROTO="glproto >= 1.4.13"
 DMXPROTO="dmxproto >= 2.2.99.1"
 VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
 WINDOWSWMPROTO="windowswmproto"
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index a17b4d5..dc96f55 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -161,41 +161,88 @@ __glXDRIdrawableWaitGL(__GLXdrawable *drawable)
   DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
 }
 
+static Bool
+__glXDRIclientSupportsSBC(ClientPtr client)
+{
+__GLXclientState *cl = glxGetClient(client);
+
+if (!cl)
+   return 0;
+
+if (cl->GLClientmajorVersion > 1 ||
+   (cl->GLClientmajorVersion == 1 && cl->GLClientminorVersion > 4))
+   return TRUE;
+
+return FALSE;
+}
+
 static void
 __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust,
  CARD64 msc, CARD64 sbc)
 {
 __GLXdrawable *drawable = data;
-xGLXBufferSwapComplete wire;
 
 if (!(drawable->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
return;
 
-wire.type = __glXEventBase + GLX_BufferSwapComplete;
-switch (type) {
-case DRI2_EXCHANGE_COMPLETE:
-   wire.event_type = GLX_EXCHANGE_COMPLETE_INTEL;
-   break;
-case DRI2_BLIT_COMPLETE:
-   wire.event_type = GLX_BLIT_COMPLETE_INTEL;
-   break;
-case DRI2_FLIP_COMPLETE:
-   wire.event_type = GLX_FLIP_COMPLETE_INTEL;
-   break;
-default:
-   /* unknown swap completion type */
-   wire.event_type = 0;
-   break;
+if (__glXDRIclientSupportsSBC(client)) {
+   xGLXBufferSwapComplete2 wire;
+
+   wire.type = GenericEvent;
+   wire.extension = __glXExtBase;
+   wire.evtype = GLX_BufferSwapComplete;
+   switch (type) {
+   case DRI2_EXCHANGE_COMPLETE:
+   wire.swap_event_type = GLX_EXCHANGE_COMPLETE_INTEL;
+   break;
+   case DRI2_BLIT_COMPLETE:
+   wire.swap_event_type = GLX_BLIT_COMPLETE_INTEL;
+   break;
+   case DRI2_FLIP_COMPLETE:
+   wire.swap_event_type = GLX_FLIP_COMPLETE_INTEL;
+   break;
+   default:
+   /* unknown swap completion type */
+   wire.swap_event_type = 0;
+   break;
+   }
+   wire.drawable = drawable->drawId;
+   wire.length = 8;
+   wire.ust_hi = ust >> 32;
+   wire.ust_lo = ust & 0x;
+   wire.msc_hi = msc >> 32;
+   wire.msc_lo = msc & 0x;
+   wire.sbc_hi = sbc >> 32;
+   wire.sbc_lo = sbc & 0x;;
+   WriteEventsToClient(client, 1, (xEvent *) &wire);
+} else {
+   xGLXBufferSwapComplete wire;
+
+   wire.type = __glXEventBase + GLX_BufferSwapComplete;
+   switch (type) {
+   case DRI2_EXCHANGE_COMPLETE:
+   wire.event_type = GLX_EXCHANGE_COMPLETE_INTEL;
+   break;
+   case DRI2_BLIT_COMPLETE:
+   wire.event_type = GLX_BLIT_COMPLETE_INTEL;
+   break;
+   case DRI2_FLIP_COMPLETE:
+   wire.event_type = GLX_FLIP_COMPLETE_INTEL;
+   break;
+   default:
+   /* unknown swap completion type */
+   wire.event_type = 0;
+   break;
+   }
+   wire.drawable = drawable->drawId;
+   wire.ust_hi = ust >> 32;
+   wire.ust_lo = ust & 0x;
+   wire.msc_hi = msc >> 32;
+   wire.msc_lo = msc & 0x;
+   wire.sbc_hi = 0;
+   wire.sbc_lo = 0;
+   WriteEventsToClient(client, 1, (xEvent *) &wire);
 }
-wire.drawable = drawable->drawId;
-wire.ust_hi = ust >> 32;
-wire.ust_lo = ust & 0x;
-wire.msc_hi = msc >> 32;
-wire.msc_lo = msc & 0x;
-wire.sbc_hi = sbc >> 32;
-wire.sbc_lo = sbc & 0x;
-
-WriteEventsToClient(client, 1, (xEvent *) &wire);
 }
 
 /*
@@ -779,7 +826,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
  *- GLX_ARB_multisample (1.4)
  */
 screen->base.GLXmajor = 1;
-screen->base.GLXminor = 4;
+screen->base.GLXminor = 5;
 
 screen->enterVT = pScrn->EnterVT;
 pScrn->EnterVT = glxDRIEnterVT; 
diff --git a/glx/glxext.c b/glx/glxext.c
index 9cfc096..01960a0 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -242,6 +242,7 @@ GLboolean __glXErrorOccured(void)
 
 stat

[PATCH] DRI2: fix swap complete event size by using a generic event

2011-05-03 Thread Jesse Barnes
The existing swap complete event is too large to fit in an XEvent, so
use a generic event instead.  New servers and clients can use this
structure to fully pass the swap count along with the media stamp
counter, swap complete type, and timestamp.

Signed-off-by: Jesse Barnes 
---
 configure.ac |2 +-
 dri2proto.h  |   22 --
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5b78d6b..9505f56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([DRI2Proto], [2.3], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AC_INIT([DRI2Proto], [2.4], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
 
diff --git a/dri2proto.h b/dri2proto.h
index 9708a4a..5a7d3e1 100644
--- a/dri2proto.h
+++ b/dri2proto.h
@@ -35,7 +35,7 @@
 
 #define DRI2_NAME  "DRI2"
 #define DRI2_MAJOR 1
-#define DRI2_MINOR 3
+#define DRI2_MINOR 4
 
 #define DRI2NumberErrors   0
 #define DRI2NumberEvents   2
@@ -298,7 +298,25 @@ typedef struct {
 CARD32 sbc_hi B32;
 CARD32 sbc_lo B32;
 } xDRI2BufferSwapComplete;
-#define sz_xDRI2BufferSwapComplete 32
+#define sz_xDRI2BufferSwapComplete 32 /* This should have been 36 */
+
+/* Use a generic event so we can transmit the sbc_lo value as well */
+typedef struct {
+BYTE type;
+CARD8 extension;
+CARD16 sequenceNumber B16;
+CARD32 length B32; /* should always be 8 for this event */
+CARD16 evtype B16;
+CARD16 swap_event_type B16;
+CARD32 drawable B32;
+CARD32 ust_hi B32;
+CARD32 ust_lo B32;
+CARD32 msc_hi B32;
+CARD32 msc_lo B32;
+CARD32 sbc_hi B32;
+CARD32 sbc_lo B32;
+} xDRI2BufferSwapComplete2;
+#define sz_xDRI2BufferSwapComplete2 38
 
 typedef struct {
 CARD8 type;
-- 
1.7.4.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 3/5] GLX: don't crash when indirect clients try to set an event mask

2011-05-03 Thread Jesse Barnes
After sending the GLXChangeDrawableAttributes request, we also set a
local set of attributes on the DRI drawable.  But in the indirect case
this array won't be present, so skip the setting in that case to avoid a
crash.

Signed-off-by: Jesse Barnes 
---
 src/glx/glx_pbuffer.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index 5f91bc6..ec54f1e 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -137,6 +137,9 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
 #ifdef GLX_DIRECT_RENDERING
pdraw = GetGLXDRIDrawable(dpy, drawable);
 
+   if (!pdraw)
+  return;
+
for (i = 0; i < num_attribs; i++) {
   switch(attribs[i * 2]) {
   case GLX_EVENT_MASK:
-- 
1.7.4.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 36812] New: GPU lockup in Team Fortress 2

2011-05-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=36812

   Summary: GPU lockup in Team Fortress 2
   Product: Mesa
   Version: git
  Platform: x86-64 (AMD64)
OS/Version: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/Gallium/r600
AssignedTo: dri-devel@lists.freedesktop.org
ReportedBy: enric...@gmx.de


After updating mesa to current git I always get a GPU lockup when the game is
about to start. After git bisect I got the following commit:

commit 18dcbd358f1d4fd5e4a40fa26c6d3bf99485884e
Author: Tom Stellard 
Date:   Sun Mar 27 01:17:43 2011 -0700

prog_optimize: Fix reallocating registers for shaders with loops

Registers that are used inside of loops need to be considered live
starting with the first instruction of the outermost loop.

https://bugs.freedesktop.org/show_bug.cgi?id=34370

NOTE: This is a candidate for the 7.9 and 7.10 branches.

Reviewed-by: Eric Anholt 


tested with kernels:
2.6.37.4
2.6.38.4
2.6.39-RC5

This is the call trace:

WARNING: at drivers/gpu/drm/radeon/radeon_fence.c:246 0x812dc0ba()

[] 
[] 
[] 
[] 
[] 
[] 
[] 
[] 
[] 
[] 
[] 
[] 
[] <_raw_spin_unlock_irq+11/40>
[] 
[] 
[] 
[] 
[] 
[] 
[] 

glxinfo (with mesa at git head):
OpenGL renderer string: Gallium 0.4 on AMD RV770
OpenGL version string: 2.1 Mesa 7.11-devel (git-a8bbce8)

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


[Bug 36812] GPU lockup in Team Fortress 2

2011-05-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=36812

enric...@gmx.de changed:

   What|Removed |Added

 CC||tstel...@gmail.com

--- Comment #1 from enric...@gmx.de 2011-05-03 11:46:04 PDT ---
Added commit author (hope this is ok?).

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


[PATCH] drm/radeon/kms: add some new pci ids

2011-05-03 Thread Alex Deucher
Signed-off-by: Alex Deucher 
Cc: sta...@kernel.org
---
 include/drm/drm_pciids.h |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 57e5a22..e08f344 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -155,6 +155,7 @@
{0x1002, 0x6719, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
{0x1002, 0x671c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
{0x1002, 0x671d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
+   {0x1002, 0x671f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6720, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_BARTS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6721, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_BARTS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6722, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_BARTS|RADEON_NEW_MEMMAP}, \
@@ -167,6 +168,7 @@
{0x1002, 0x6729, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_BARTS|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6738, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_BARTS|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6739, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_BARTS|RADEON_NEW_MEMMAP}, \
+   {0x1002, 0x673e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_BARTS|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6740, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6741, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6742, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -199,6 +201,7 @@
{0x1002, 0x688D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6898, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6899, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
+   {0x1002, 0x689b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
{0x1002, 0x689c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_HEMLOCK|RADEON_NEW_MEMMAP}, \
{0x1002, 0x689d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_HEMLOCK|RADEON_NEW_MEMMAP}, \
{0x1002, 0x689e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
@@ -209,7 +212,9 @@
{0x1002, 0x68b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_JUNIPER|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x68b8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
{0x1002, 0x68b9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
+   {0x1002, 0x68ba, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
{0x1002, 0x68be, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
+   {0x1002, 0x68bf, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
{0x1002, 0x68c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x68c1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x68c7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
-- 
1.7.1.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Make swap event handling match the spec

2011-05-03 Thread Jesse Barnes
Ian reminded me that we changed the spec to fit within an XEvent, but we
never updated the code to match.  This set of patches (much simpler than
the last) does just that.  Wrapping support can be added to Mesa if we
really want 64 bit values, but that means checking the drawable sbc and
adding whenver sbc hits 0.

Thanks,
Jesse

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 3/4] GLX/DRI2: pass drawable correctly for indirect swap events

2011-05-03 Thread Jesse Barnes
Pass the right drawable pointer as data to the swap complete function.

Signed-off-by: Jesse Barnes 
---
 glx/glxdri2.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index d979717..93c5e5b 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -222,7 +222,7 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable 
*drawable)
 #endif
 
 if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused,
-   __glXdriSwapEvent, drawable->pDraw) != Success)
+   __glXdriSwapEvent, drawable) != Success)
return FALSE;
 
 return TRUE;
-- 
1.7.4.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 4/4] GLX/DRI2: make GLX swap event handling match spec

2011-05-03 Thread Jesse Barnes
Only send a 32 bit swap count out to the client.

Signed-off-by: Jesse Barnes 
---
 configure.ac  |4 ++--
 glx/glxdri2.c |5 ++---
 hw/xfree86/dri2/dri2.c|2 +-
 hw/xfree86/dri2/dri2.h|2 +-
 hw/xfree86/dri2/dri2ext.c |5 ++---
 5 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6eb780c..87194a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -771,11 +771,11 @@ RECORDPROTO="recordproto >= 1.13.99.1"
 SCRNSAVERPROTO="scrnsaverproto >= 1.1"
 RESOURCEPROTO="resourceproto"
 DRIPROTO="xf86driproto >= 2.1.0"
-DRI2PROTO="dri2proto >= 2.3"
+DRI2PROTO="dri2proto >= 2.4"
 XINERAMAPROTO="xineramaproto"
 BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
 DGAPROTO="xf86dgaproto >= 2.0.99.1"
-GLPROTO="glproto >= 1.4.10"
+GLPROTO="glproto >= 1.4.13"
 DMXPROTO="dmxproto >= 2.2.99.1"
 VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
 WINDOWSWMPROTO="windowswmproto"
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 93c5e5b..450d8c9 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -163,7 +163,7 @@ __glXDRIdrawableWaitGL(__GLXdrawable *drawable)
 
 static void
 __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust,
- CARD64 msc, CARD64 sbc)
+ CARD64 msc, CARD32 sbc)
 {
 __GLXdrawable *drawable = data;
 xGLXBufferSwapComplete wire;
@@ -192,8 +192,7 @@ __glXdriSwapEvent(ClientPtr client, void *data, int type, 
CARD64 ust,
 wire.ust_lo = ust & 0x;
 wire.msc_hi = msc >> 32;
 wire.msc_lo = msc & 0x;
-wire.sbc_hi = sbc >> 32;
-wire.sbc_lo = sbc & 0x;
+wire.sbc = sbc;
 
 WriteEventsToClient(client, 1, (xEvent *) &wire);
 }
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 5c42a51..40829c2 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -76,7 +76,7 @@ typedef struct _DRI2Drawable {
 ClientPtr   blockedClient;
 BoolblockedOnMsc;
 int swap_interval;
-CARD64  swap_count;
+CARD32  swap_count;
 int64_t target_sbc; /* -1 means no SBC wait outstanding */
 CARD64  last_swap_target; /* most recently queued swap target 
*/
 CARD64  last_swap_msc; /* msc at completion of most recent 
swap */
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index fe0bf6c..2a41ead 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -51,7 +51,7 @@ extern CARD8 dri2_minor;
 
 typedef DRI2BufferRec DRI2Buffer2Rec, *DRI2Buffer2Ptr;
 typedef void (*DRI2SwapEventPtr)(ClientPtr client, void *data, int type,
-CARD64 ust, CARD64 msc, CARD64 sbc);
+CARD64 ust, CARD64 msc, CARD32 sbc);
 
 
 typedef DRI2BufferPtr  (*DRI2CreateBuffersProcPtr)(DrawablePtr pDraw,
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 4e48e65..2bb515f 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -357,7 +357,7 @@ vals_to_card64(CARD32 lo, CARD32 hi)
 
 static void
 DRI2SwapEvent(ClientPtr client, void *data, int type, CARD64 ust, CARD64 msc,
- CARD64 sbc)
+ CARD32 sbc)
 {
 xDRI2BufferSwapComplete event;
 DrawablePtr pDrawable = data;
@@ -369,8 +369,7 @@ DRI2SwapEvent(ClientPtr client, void *data, int type, 
CARD64 ust, CARD64 msc,
 event.ust_lo = ust & 0x;
 event.msc_hi = (CARD64)msc >> 32;
 event.msc_lo = msc & 0x;
-event.sbc_hi = (CARD64)sbc >> 32;
-event.sbc_lo = sbc & 0x;
+event.sbc = sbc;
 
 WriteEventsToClient(client, 1, (xEvent *)&event);
 }
-- 
1.7.4.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] glxproto: make GLX swap event struct match spec

2011-05-03 Thread Jesse Barnes
We only spec a 32 bit swap count, so drop the high sbc field.

Signed-off-by: Jesse Barnes 
---
 configure.ac |2 +-
 glxproto.h   |3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index d88e6df..a3047e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([GLProto], [1.4.12], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AC_INIT([GLProto], [1.4.13], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
 
diff --git a/glxproto.h b/glxproto.h
index 0ff44e3..a6018a1 100644
--- a/glxproto.h
+++ b/glxproto.h
@@ -1380,8 +1380,7 @@ typedef struct {
 CARD32 ust_lo B32;
 CARD32 msc_hi B32;
 CARD32 msc_lo B32;
-CARD32 sbc_hi B32;
-CARD32 sbc_lo B32;
+CARD32 sbc B32;
 } xGLXBufferSwapComplete;
 
 //
-- 
1.7.4.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] dri2proto: make DRI2 swap event match GLX spec

2011-05-03 Thread Jesse Barnes
We only spec a 32 bit sbc count, so drop the high bits.

Signed-off-by: Jesse Barnes 
---
 configure.ac |2 +-
 dri2proto.h  |3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5b78d6b..9505f56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([DRI2Proto], [2.3], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AC_INIT([DRI2Proto], [2.4], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
 
diff --git a/dri2proto.h b/dri2proto.h
index 9708a4a..12d834f 100644
--- a/dri2proto.h
+++ b/dri2proto.h
@@ -295,8 +295,7 @@ typedef struct {
 CARD32 ust_lo B32;
 CARD32 msc_hi B32;
 CARD32 msc_lo B32;
-CARD32 sbc_hi B32;
-CARD32 sbc_lo B32;
+CARD32 sbc B32;
 } xDRI2BufferSwapComplete;
 #define sz_xDRI2BufferSwapComplete 32
 
-- 
1.7.4.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 5/6] GLX: don't crash when indirect clients try to set an event mask

2011-05-03 Thread Jesse Barnes
After sending the GLXChangeDrawableAttributes request, we also set a
local set of attributes on the DRI drawable.  But in the indirect case
this array won't be present, so skip the setting in that case to avoid a
crash.

Signed-off-by: Jesse Barnes 
---
 src/glx/glx_pbuffer.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index 5f91bc6..ec54f1e 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -137,6 +137,9 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
 #ifdef GLX_DIRECT_RENDERING
pdraw = GetGLXDRIDrawable(dpy, drawable);
 
+   if (!pdraw)
+  return;
+
for (i = 0; i < num_attribs; i++) {
   switch(attribs[i * 2]) {
   case GLX_EVENT_MASK:
-- 
1.7.4.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 6/6] DRI2/GLX: make swap event handling match spec

2011-05-03 Thread Jesse Barnes
We only handle a 32 bit swap count, so use the new structure definitions.

Signed-off-by: Jesse Barnes 
---
 configure.ac |4 ++--
 src/glx/dri2.c   |2 +-
 src/glx/glxext.c |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3b05ca3..94fb6f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,8 +21,8 @@ dnl Versions for external dependencies
 LIBDRM_REQUIRED=2.4.24
 LIBDRM_RADEON_REQUIRED=2.4.24
 LIBDRM_INTEL_REQUIRED=2.4.24
-DRI2PROTO_REQUIRED=2.1
-GLPROTO_REQUIRED=1.4.11
+DRI2PROTO_REQUIRED=2.4
+GLPROTO_REQUIRED=1.4.13
 LIBDRM_XORG_REQUIRED=2.4.24
 LIBKMS_XORG_REQUIRED=1.0.0
 
diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index adfd3d1..2f18ca0 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -124,7 +124,7 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
   }
   aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
   aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
-  aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
+  aevent->sbc = awire->sbc;
   return True;
}
 #endif
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index 278c719..831d83f 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -138,7 +138,7 @@ __glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire)
   aevent->drawable = awire->drawable;
   aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
   aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
-  aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
+  aevent->sbc = awire->sbc;
   return True;
}
default:
-- 
1.7.4.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Make swap event handling match the spec

2011-05-03 Thread Jesse Barnes
On Tue,  3 May 2011 12:21:23 -0700
Jesse Barnes  wrote:

> Ian reminded me that we changed the spec to fit within an XEvent, but we
> never updated the code to match.  This set of patches (much simpler than
> the last) does just that.  Wrapping support can be added to Mesa if we
> really want 64 bit values, but that means checking the drawable sbc and
> adding whenver sbc hits 0.

Apparently I've confused git send-email...  3/4 and 4/4 are for the
server and 5/6 and 6/6 are for Mesa.

-- 
Jesse Barnes, Intel Open Source Technology Center
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/2] drm/radeon/kms: add I2C_CLASS_HWMON to radeon i2c adapater classes

2011-05-03 Thread Alex Deucher
BenH doesn't want this for macs and that was mainly the use for this
patch, so it (2/2) can be ignored.

Alex

On Tue, May 3, 2011 at 1:32 PM, Alex Deucher  wrote:
> I'm not sure this is necessary.  In most cases the driver
> will add the hwmon device itself based on information from the
> vbios tables.  However, there are some boards without a proper
> vbios entry for the the hwmon chips and non-x86 (Mac/Sun) cards do
> not have a standard vbios.  This allows the hwmon drivers to
> detect devices on the radeon i2c buses.
>
> Signed-off-by: Alex Deucher 
> Cc: Jean Delvare 
> ---
>  drivers/gpu/drm/radeon/radeon_i2c.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c 
> b/drivers/gpu/drm/radeon/radeon_i2c.c
> index 781196d..65d8744 100644
> --- a/drivers/gpu/drm/radeon/radeon_i2c.c
> +++ b/drivers/gpu/drm/radeon/radeon_i2c.c
> @@ -888,7 +888,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct 
> drm_device *dev,
>
>        i2c->rec = *rec;
>        i2c->adapter.owner = THIS_MODULE;
> -       i2c->adapter.class = I2C_CLASS_DDC;
> +       i2c->adapter.class = I2C_CLASS_DDC | I2C_CLASS_HWMON;
>        i2c->dev = dev;
>        i2c_set_adapdata(&i2c->adapter, i2c);
>        if (rec->mm_i2c ||
> --
> 1.7.1.1
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 25052] kernel modesetting still does not work

2011-05-03 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=25052





--- Comment #21 from Elmar Stellnberger   2011-05-03 
20:17:00 ---
Nothing better for kernel 2.6.39-0.0.71.da138d8.x86_64.

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are watching the assignee of the bug.

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
--
___
Dri-devel mailing list
dri-de...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 34102] radeon drm/kms: please use suspend/hibernate notifiers for allocating memory in suspend routines

2011-05-03 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=34102


Rafael J. Wysocki  changed:

   What|Removed |Added

 CC||r...@sisk.pl
 Kernel Version||2.6.38
 Blocks||7216
 Regression|Yes |No




--- Comment #1 from Rafael J. Wysocki   2011-05-03 20:45:22 ---
Strictly speaking, this is not a regression, because the radeon driver with
KMS has never worked correctly for you in this respect, right?

Now, while the ultimate fix would be to rework device drivers so that they
don't allocate memory from their ->suspend() callbacks, it's not quite
realistic to expect that that's going to happen any time soon.

For this reason, I'll try to provide a workaround for you.

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are watching the assignee of the bug.

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
--
___
Dri-devel mailing list
dri-de...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/2] drm/radeon/kms: set i2c adapter class to I2C_CLASS_DDC

2011-05-03 Thread Jean Delvare
On Tue,  3 May 2011 13:32:36 -0400, Alex Deucher wrote:
> The most common use of the radeon i2c buses is for ddc.
> 
> Signed-off-by: Alex Deucher 
> Cc: Jean Delvare 

Acked-by: Jean Delvare 

> ---
>  drivers/gpu/drm/radeon/radeon_i2c.c |2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c 
> b/drivers/gpu/drm/radeon/radeon_i2c.c
> index 983cbac..781196d 100644
> --- a/drivers/gpu/drm/radeon/radeon_i2c.c
> +++ b/drivers/gpu/drm/radeon/radeon_i2c.c
> @@ -888,6 +888,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct 
> drm_device *dev,
>  
>   i2c->rec = *rec;
>   i2c->adapter.owner = THIS_MODULE;
> + i2c->adapter.class = I2C_CLASS_DDC;
>   i2c->dev = dev;
>   i2c_set_adapdata(&i2c->adapter, i2c);
>   if (rec->mm_i2c ||
> @@ -947,6 +948,7 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct 
> drm_device *dev,
>  
>   i2c->rec = *rec;
>   i2c->adapter.owner = THIS_MODULE;
> + i2c->adapter.class = I2C_CLASS_DDC;
>   i2c->dev = dev;
>   snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
>"Radeon aux bus %s", name);


-- 
Jean Delvare
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] glxproto: make GLX swap event struct match spec

2011-05-03 Thread Keith Packard
On Tue,  3 May 2011 12:21:24 -0700, Jesse Barnes  
wrote:

> We only spec a 32 bit swap count, so drop the high sbc field.

You're missing the explicit 16-bit padding field after 'event_type'

The documented encoding
http://www.opengl.org/registry/specs/INTEL/swap_event.txt needs to be
fixed to match this, it has the padding at the end which leaves most of
the structure mis-aligned.

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


pgp4faBgjQsPD.pgp
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] glxproto: make GLX swap event struct match spec

2011-05-03 Thread Jesse Barnes
On Tue, 03 May 2011 13:54:38 -0700
Keith Packard  wrote:

> On Tue,  3 May 2011 12:21:24 -0700, Jesse Barnes  
> wrote:
> 
> > We only spec a 32 bit swap count, so drop the high sbc field.
> 
> You're missing the explicit 16-bit padding field after 'event_type'
> 
> The documented encoding
> http://www.opengl.org/registry/specs/INTEL/swap_event.txt needs to be
> fixed to match this, it has the padding at the end which leaves most of
> the structure mis-aligned.

Right, another case where we updated the spec incorrectly then failed
to make the code match the broken definition (the complete enums also
need to match the final values, which are correct in the first part of
the spec).  Yay for divergence.

-- 
Jesse Barnes, Intel Open Source Technology Center
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] glxproto: make GLX swap event struct match spec

2011-05-03 Thread Jesse Barnes
On Tue, 3 May 2011 14:02:31 -0700
Jesse Barnes  wrote:

> On Tue, 03 May 2011 13:54:38 -0700
> Keith Packard  wrote:
> 
> > On Tue,  3 May 2011 12:21:24 -0700, Jesse Barnes  
> > wrote:
> > 
> > > We only spec a 32 bit swap count, so drop the high sbc field.
> > 
> > You're missing the explicit 16-bit padding field after 'event_type'
> > 
> > The documented encoding
> > http://www.opengl.org/registry/specs/INTEL/swap_event.txt needs to be
> > fixed to match this, it has the padding at the end which leaves most of
> > the structure mis-aligned.
> 
> Right, another case where we updated the spec incorrectly then failed
> to make the code match the broken definition (the complete enums also
> need to match the final values, which are correct in the first part of
> the spec).  Yay for divergence.

Fixed version below.

-- 
Jesse Barnes, Intel Open Source Technology Center

>From f5403828c68af0f12c79c0504df0a4781ca84b2b Mon Sep 17 00:00:00 2001
From: Jesse Barnes 
Date: Tue, 3 May 2011 12:14:10 -0700
Subject: [PATCH] glxproto: make GLX swap event struct match spec

We only spec a 32 bit swap count, so drop the high sbc field.  Also make
the padding explicit (most compilers would have already done this since
it's not a packed structure, but making it explicit should prevent
surprises in the future).

Signed-off-by: Jesse Barnes 
---
 configure.ac |2 +-
 glxproto.h   |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index d88e6df..a3047e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([GLProto], [1.4.12], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AC_INIT([GLProto], [1.4.13], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
 
diff --git a/glxproto.h b/glxproto.h
index 0ff44e3..dfa0647 100644
--- a/glxproto.h
+++ b/glxproto.h
@@ -1375,13 +1375,13 @@ typedef struct {
 BYTE pad;
 CARD16 sequenceNumber B16;
 CARD16 event_type B16;
+CARD16 pad2;
 CARD32 drawable;
 CARD32 ust_hi B32;
 CARD32 ust_lo B32;
 CARD32 msc_hi B32;
 CARD32 msc_lo B32;
-CARD32 sbc_hi B32;
-CARD32 sbc_lo B32;
+CARD32 sbc B32;
 } xGLXBufferSwapComplete;
 
 //
-- 
1.7.4.1


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] dri2proto: make DRI2 swap event match GLX spec

2011-05-03 Thread Jesse Barnes
Updated with explicit padding.

-- 
Jesse Barnes, Intel Open Source Technology Center

>From 0ca3778de195a82087d0f07415a1cf8fc94f5b0a Mon Sep 17 00:00:00 2001
From: Jesse Barnes 
Date: Tue, 3 May 2011 12:14:58 -0700
Subject: [PATCH] dri2proto: make DRI2 swap event match GLX spec

We only spec a 32 bit sbc count, so drop the high bits.  Also make the
padding explicit.

Signed-off-by: Jesse Barnes 
---
 configure.ac |2 +-
 dri2proto.h  |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5b78d6b..9505f56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([DRI2Proto], [2.3], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AC_INIT([DRI2Proto], [2.4], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
 
diff --git a/dri2proto.h b/dri2proto.h
index 9708a4a..ff76355 100644
--- a/dri2proto.h
+++ b/dri2proto.h
@@ -290,13 +290,13 @@ typedef struct {
 CARD8 pad;
 CARD16 sequenceNumber B16;
 CARD16 event_type B16;
+CARD16 pad2;
 CARD32 drawable B32;
 CARD32 ust_hi B32;
 CARD32 ust_lo B32;
 CARD32 msc_hi B32;
 CARD32 msc_lo B32;
-CARD32 sbc_hi B32;
-CARD32 sbc_lo B32;
+CARD32 sbc B32;
 } xDRI2BufferSwapComplete;
 #define sz_xDRI2BufferSwapComplete 32
 
-- 
1.7.4.1


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] glxproto: make GLX swap event struct match spec

2011-05-03 Thread Keith Packard
On Tue, 3 May 2011 14:08:58 -0700, Jesse Barnes  
wrote:

> Fixed version below.

Reviewed-by: Keith Packard 

(assuming that the GLX protocol specification gets updated to match :-)

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


pgpc0zttIhtY3.pgp
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: multiple framebuffer drm maps

2011-05-03 Thread Tormod Volden
From: Tormod Volden 

Subject: [PATCH] drm: Add flag for multiple framebuffer support

Do not ignore the offset when looking for existing framebuffer maps
if the new _DRM_MATCH_FB_OFFSET flag is passed to drm_addmap_core.
---

> In commit 41c2e75e60200a860a74b7c84a6375c105e7437f "drm: Make
> drm_local_map use a resource_size_t offset" [1] the support for multiple
> _DRM_FRAMEBUFFER maps per device was taken away. This change made the
> savage drivers upset, since these cards have several apertures (the
> layout is different between card families) for which the kernel drm
> driver sets up maps. And these maps are now mixed up into one broken one.
> 
> The drivers (drm, ddx, mesa) for instance expects a framebuffer map and a
> tiled aperture map, and the broken maps show up as rendering corruption
> [2] and allocation failures. I have tried to come up with userland
> workarounds but it seems impossible since the kernel will only return
> the handle to a broken map and there is no way to remap it correctly.
> 
> Would it be possible to reintroduce this support? One solution could be
> a new flag _DRM_IGNORE_FB_OFFSET that can be used by those drivers that
> need it, or the other way around, a _DRM_CHECK_FB_OFFSET to be added
> by the savage drivers and others in the same situation. I can of course
> try to write a patch if people think this is a good idea.
 
This was what I had in mind. Probably controversial to add a new
flag for this, so more elegant ideas are welcome.

Cheers,
Tormod


 drivers/gpu/drm/drm_bufs.c |4 +++-
 include/drm/drm.h  |3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 3e257a5..9b7b257 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -60,8 +60,10 @@ static struct drm_map_list *drm_find_matching_map(struct 
drm_device *dev,
if (map->flags != _DRM_CONTAINS_LOCK)
break;
case _DRM_REGISTERS:
-   case _DRM_FRAME_BUFFER:
return entry;
+   case _DRM_FRAME_BUFFER:
+   if (!(map->flags & _DRM_MATCH_FB_OFFSET))
+   return entry;
default: /* Make gcc happy */
;
}
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 4be33b4..d4e2560 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -195,7 +195,8 @@ enum drm_map_flags {
_DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */
_DRM_CONTAINS_LOCK = 0x20,   /**< SHM page that contains lock */
_DRM_REMOVABLE = 0x40,   /**< Removable mapping */
-   _DRM_DRIVER = 0x80   /**< Managed by driver */
+   _DRM_DRIVER = 0x80,  /**< Managed by driver */
+   _DRM_MATCH_FB_OFFSET = 0x100 /**< Multiple framebuffer support */
 };
 
 struct drm_ctx_priv_map {
-- 
1.7.0.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] glxproto: make GLX swap event struct match spec

2011-05-03 Thread Jesse Barnes
On Tue, 03 May 2011 14:15:30 -0700
Keith Packard  wrote:

> On Tue, 3 May 2011 14:08:58 -0700, Jesse Barnes  
> wrote:
> 
> > Fixed version below.
> 
> Reviewed-by: Keith Packard 
> 
> (assuming that the GLX protocol specification gets updated to match :-)

Yeah, Ian is fixing up the padding there to match what our existing gcc
compiled implementations actually do (along with fixing the enums in
the second half to match the first :)

I'll push this out.

Thanks,
-- 
Jesse Barnes, Intel Open Source Technology Center
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 34102] radeon drm/kms: please use suspend/hibernate notifiers for allocating memory in suspend routines

2011-05-03 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=34102





--- Comment #2 from Martin Steigerwald   2011-05-03 
21:33:06 ---
It depends on the view point. Compared with the pre KMS radeon driver this has
been a regression for me.

Thanks for trying to provide a workaround. I appreciate it.

I work-around this problem for now by using KDE 4.6 activities which make it
easy to close a set of application before hibernating and restoring them back
to their old state after resuming. Anyway, my next notebook will have 8 GB of
RAM and be 64-Bit, so this should not be much of the problem there. Just to
hint at you that a fix is not urgent for me. But I will have that T42 where the
problem happens at hand to test any workaround you provide.

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are watching the assignee of the bug.

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
--
___
Dri-devel mailing list
dri-de...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 34102] radeon drm/kms: please use suspend/hibernate notifiers for allocating memory in suspend routines

2011-05-03 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=34102





--- Comment #3 from Rafael J. Wysocki   2011-05-03 21:44:15 ---
Created an attachment (id=56382)
 --> (https://bugzilla.kernel.org/attachment.cgi?id=56382)
PM / Hibernate: Add new sysfs attribute for controlling reserved memory

The attached patch adds a new knob, /sys/power/reserved_size, allowing you to
set the size of memory (in bytes) to be reserved for device drivers'
hibernation callbacks while counting the number of memory pages to allocate.

Please check if you can set it to such a number that hibernation will always
succeed on your machine.

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are watching the assignee of the bug.

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
--
___
Dri-devel mailing list
dri-de...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 34102] radeon drm/kms: please use suspend/hibernate notifiers for allocating memory in suspend routines

2011-05-03 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=34102


Rafael J. Wysocki  changed:

   What|Removed |Added

 Status|NEW |NEEDINFO




-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are watching the assignee of the bug.

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
--
___
Dri-devel mailing list
dri-de...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: multiple framebuffer drm maps

2011-05-03 Thread Tormod Volden
From: Tormod Volden 

Subject: [PATCH] drm/savage: Do not add framebuffer and aperture maps

Since multiple framebuffer maps are not supported any longer (commit
41c2e75e60200a860a74b7c84a6375c105e7437f) these maps would be broken,
and they are not used by the drm anyway.

Leave it to userspace to create one working map instead.

Signed-off-by: Tormod Volden 
---

And if we are absolutely sure that we do not want to support multiple
framebuffers maps, I would instead suggest this change to the savage
driver, which at least allows userspace to work around it.

Tormod

 drivers/gpu/drm/savage/savage_bci.c |   13 +
 drivers/gpu/drm/savage/savage_drv.h |2 --
 2 files changed, 1 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/savage/savage_bci.c 
b/drivers/gpu/drm/savage/savage_bci.c
index bf5f83e..91fe7b4 100644
--- a/drivers/gpu/drm/savage/savage_bci.c
+++ b/drivers/gpu/drm/savage/savage_bci.c
@@ -639,18 +639,7 @@ int savage_driver_firstopen(struct drm_device *dev)
if (ret)
return ret;
 
-   ret = drm_addmap(dev, fb_base, fb_size, _DRM_FRAME_BUFFER,
-_DRM_WRITE_COMBINING, &dev_priv->fb);
-   if (ret)
-   return ret;
-
-   ret = drm_addmap(dev, aperture_base, SAVAGE_APERTURE_SIZE,
-_DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING,
-&dev_priv->aperture);
-   if (ret)
-   return ret;
-
-   return ret;
+   return 0;
 }
 
 /*
diff --git a/drivers/gpu/drm/savage/savage_drv.h 
b/drivers/gpu/drm/savage/savage_drv.h
index df2aac6..2b49b3e 100644
--- a/drivers/gpu/drm/savage/savage_drv.h
+++ b/drivers/gpu/drm/savage/savage_drv.h
@@ -153,8 +153,6 @@ typedef struct drm_savage_private {
/* memory regions in physical memory */
drm_local_map_t *sarea;
drm_local_map_t *mmio;
-   drm_local_map_t *fb;
-   drm_local_map_t *aperture;
drm_local_map_t *status;
drm_local_map_t *agp_textures;
drm_local_map_t *cmd_dma;
-- 
1.7.0.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/radeon/kms: fix gart setup on fusion parts

2011-05-03 Thread Alex Deucher
Out of the entire GART/VM subsystem, the hw designers changed
the location of 3 regs.

Signed-off-by: Alex Deucher 
Signed-off-by: Jerome Glisse 
Cc: sta...@kernel.org
---
 drivers/gpu/drm/radeon/evergreen.c  |   17 +
 drivers/gpu/drm/radeon/evergreend.h |5 +
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen.c 
b/drivers/gpu/drm/radeon/evergreen.c
index 3453910..5484f24 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -863,9 +863,15 @@ int evergreen_pcie_gart_enable(struct radeon_device *rdev)
SYSTEM_ACCESS_MODE_NOT_IN_SYS |
SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU |
EFFECTIVE_L1_TLB_SIZE(5) | EFFECTIVE_L1_QUEUE_SIZE(5);
-   WREG32(MC_VM_MD_L1_TLB0_CNTL, tmp);
-   WREG32(MC_VM_MD_L1_TLB1_CNTL, tmp);
-   WREG32(MC_VM_MD_L1_TLB2_CNTL, tmp);
+   if (rdev->flags & RADEON_IS_IGP) {
+   WREG32(FUS_MC_VM_MD_L1_TLB0_CNTL, tmp);
+   WREG32(FUS_MC_VM_MD_L1_TLB1_CNTL, tmp);
+   WREG32(FUS_MC_VM_MD_L1_TLB2_CNTL, tmp);
+   } else {
+   WREG32(MC_VM_MD_L1_TLB0_CNTL, tmp);
+   WREG32(MC_VM_MD_L1_TLB1_CNTL, tmp);
+   WREG32(MC_VM_MD_L1_TLB2_CNTL, tmp);
+   }
WREG32(MC_VM_MB_L1_TLB0_CNTL, tmp);
WREG32(MC_VM_MB_L1_TLB1_CNTL, tmp);
WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp);
@@ -2924,11 +2930,6 @@ static int evergreen_startup(struct radeon_device *rdev)
rdev->asic->copy = NULL;
dev_warn(rdev->dev, "failed blitter (%d) falling back to 
memcpy\n", r);
}
-   /* XXX: ontario has problems blitting to gart at the moment */
-   if (rdev->family == CHIP_PALM) {
-   rdev->asic->copy = NULL;
-   radeon_ttm_set_active_vram_size(rdev, 
rdev->mc.visible_vram_size);
-   }
 
/* allocate wb buffer */
r = radeon_wb_init(rdev);
diff --git a/drivers/gpu/drm/radeon/evergreend.h 
b/drivers/gpu/drm/radeon/evergreend.h
index 9aaa3f0..9453384 100644
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -221,6 +221,11 @@
 #defineMC_VM_MD_L1_TLB0_CNTL   0x2654
 #defineMC_VM_MD_L1_TLB1_CNTL   0x2658
 #defineMC_VM_MD_L1_TLB2_CNTL   0x265C
+
+#defineFUS_MC_VM_MD_L1_TLB0_CNTL   0x265C
+#defineFUS_MC_VM_MD_L1_TLB1_CNTL   0x2660
+#defineFUS_MC_VM_MD_L1_TLB2_CNTL   0x2664
+
 #defineMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR  0x203C
 #defineMC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x2038
 #defineMC_VM_SYSTEM_APERTURE_LOW_ADDR  0x2034
-- 
1.7.4.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/radeon/kms: fix up r1xx-rs4xx i2c buses

2011-05-03 Thread Alex Deucher
Fix the vbios mapping and only add the actual
buses that the cards have.  The existing code was
mostly correct.  Just clean up a few cases on r2xx/r3xx
and document that buses the hw actually has.

Signed-off-by: Alex Deucher 
---
 drivers/gpu/drm/radeon/radeon_combios.c |   59 ++
 1 files changed, 43 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_combios.c 
b/drivers/gpu/drm/radeon/radeon_combios.c
index 089ab92..0e350b7 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -505,12 +505,18 @@ static struct radeon_i2c_bus_rec 
combios_setup_i2c_bus(struct radeon_device *rde
 * DDC_VGA   = RADEON_GPIO_VGA_DDC
 * DDC_LCD   = RADEON_GPIOPAD_MASK
 * DDC_GPIO  = RADEON_MDGPIO_MASK
-* r1xx/r2xx
+* r1xx
 * DDC_MONID = RADEON_GPIO_MONID
 * DDC_CRT2  = RADEON_GPIO_CRT2_DDC
-* r3xx
+* r200
 * DDC_MONID = RADEON_GPIO_MONID
 * DDC_CRT2  = RADEON_GPIO_DVI_DDC
+* r300/r350
+* DDC_MONID = RADEON_GPIO_DVI_DDC
+* DDC_CRT2  = RADEON_GPIO_DVI_DDC
+* rv2xx/rv3xx
+* DDC_MONID = RADEON_GPIO_MONID
+* DDC_CRT2  = RADEON_GPIO_MONID
 * rs3xx/rs4xx
 * DDC_MONID = RADEON_GPIOPAD_MASK
 * DDC_CRT2  = RADEON_GPIO_MONID
@@ -537,18 +543,21 @@ static struct radeon_i2c_bus_rec 
combios_setup_i2c_bus(struct radeon_device *rde
rdev->family == CHIP_RS400 ||
rdev->family == CHIP_RS480)
ddc_line = RADEON_GPIOPAD_MASK;
+   else if (rdev->family == CHIP_R300 ||
+rdev->family == CHIP_R350)
+   ddc_line = RADEON_GPIO_DVI_DDC;
else
ddc_line = RADEON_GPIO_MONID;
break;
case DDC_CRT2:
-   if (rdev->family == CHIP_RS300 ||
-   rdev->family == CHIP_RS400 ||
-   rdev->family == CHIP_RS480)
-   ddc_line = RADEON_GPIO_MONID;
-   else if (rdev->family >= CHIP_R300) {
+   if (rdev->family == CHIP_R200 ||
+   rdev->family == CHIP_R300 ||
+   rdev->family == CHIP_R350)
ddc_line = RADEON_GPIO_DVI_DDC;
-   ddc = DDC_DVI;
-   } else
+   else if (rdev->family == CHIP_RS300 ||
+rdev->family >= CHIP_RV350)
+   ddc_line = RADEON_GPIO_MONID;
+   else
ddc_line = RADEON_GPIO_CRT2_DDC;
break;
}
@@ -709,26 +718,42 @@ void radeon_combios_i2c_init(struct radeon_device *rdev)
struct drm_device *dev = rdev->ddev;
struct radeon_i2c_bus_rec i2c;
 
+   /* actual hw pads
+* r1xx/rs2xx/rs3xx
+* 0x60, 0x64, 0x68, 0x6c, gpiopads, mm
+* r200
+* 0x60, 0x64, 0x68, mm
+* r300/r350
+* 0x60, 0x64, mm
+* rv2xx/rv3xx/rs4xx
+* 0x60, 0x64, 0x68, gpiopads, mm
+*/
 
+   /* 0x60 */
i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0);
rdev->i2c_bus[0] = radeon_i2c_create(dev, &i2c, "DVI_DDC");
-
+   /* 0x64 */
i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0);
rdev->i2c_bus[1] = radeon_i2c_create(dev, &i2c, "VGA_DDC");
 
+   /* mm i2c */
i2c.valid = true;
i2c.hw_capable = true;
i2c.mm_i2c = true;
i2c.i2c_id = 0xa0;
rdev->i2c_bus[2] = radeon_i2c_create(dev, &i2c, "MM_I2C");
 
-   if (rdev->family == CHIP_RS300 ||
-   rdev->family == CHIP_RS400 ||
-   rdev->family == CHIP_RS480) {
+   if (rdev->family == CHIP_R300 ||
+   rdev->family == CHIP_R350) {
+   /* only 2 sw i2c pads */
+   } else if (rdev->family == CHIP_RS300 ||
+  rdev->family == CHIP_RS400 ||
+  rdev->family == CHIP_RS480) {
u16 offset;
u8 id, blocks, clk, data;
int i;
 
+   /* 0x68 */
i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0);
rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "MONID");
 
@@ -740,6 +765,7 @@ void radeon_combios_i2c_init(struct radeon_device *rdev)
if (id == 136) {
clk = RBIOS8(offset + 3 + (i * 5) + 3);
data = RBIOS8(offset + 3 + (i * 5) + 4);
+   /* gpiopad */
i2c = combios_setup_i2c_bus(rdev, 
DDC_MONID,
(1 << clk), 
(1 << data));
rdev->i2c_bus[4] = 
radeon_

[Bug 36817] New: RV670 - Kernel fails to enable acceleration when RAM greater than 32-bit limit

2011-05-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=36817

   Summary: RV670 - Kernel fails to enable acceleration when RAM
greater than 32-bit limit
   Product: DRI
   Version: unspecified
  Platform: x86 (IA32)
OS/Version: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: DRM/Radeon
AssignedTo: dri-devel@lists.freedesktop.org
ReportedBy: r...@achart.me.uk


I sure hope I'm in the right place...

Using a Radeon HD3870 that works fine under Windows (64-bit).  After a supposed
initial success using a pre-release version of KMS drivers (which may be a red
herring), I have been unable to get 3D acceleration on any Ubuntu release from
Lucid, unless I use a non-PAE kernel (I have 4GB RAM).

My Ubuntu bug ticket (including logs) is here:
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-ati/+bug/574884

Another bug that looks similar:
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-ati/+bug/657576

A similar looking bug with a similar workaround (which I'll shortly try on
mine) on SUSE: http://web.archiveorange.com/archive/v/wmeLDauZzOL6SFQx1uKY

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


[PATCH] drm/radeon/kms: fix gart setup on fusion parts (v2)

2011-05-03 Thread Dave Airlie
From: Alex Deucher 

Out of the entire GART/VM subsystem, the hw designers changed
the location of 3 regs.

v2: airlied: add parameter for userspace to work from.

Signed-off-by: Alex Deucher 
Signed-off-by: Jerome Glisse 
Cc: sta...@kernel.org
Signed-off-by: Dave Airlie 
---
 drivers/gpu/drm/radeon/evergreen.c  |   17 +
 drivers/gpu/drm/radeon/evergreend.h |5 +
 drivers/gpu/drm/radeon/radeon_kms.c |3 +++
 include/drm/radeon_drm.h|1 +
 4 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen.c 
b/drivers/gpu/drm/radeon/evergreen.c
index e9bc135..c20eac3 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -862,9 +862,15 @@ int evergreen_pcie_gart_enable(struct radeon_device *rdev)
SYSTEM_ACCESS_MODE_NOT_IN_SYS |
SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU |
EFFECTIVE_L1_TLB_SIZE(5) | EFFECTIVE_L1_QUEUE_SIZE(5);
-   WREG32(MC_VM_MD_L1_TLB0_CNTL, tmp);
-   WREG32(MC_VM_MD_L1_TLB1_CNTL, tmp);
-   WREG32(MC_VM_MD_L1_TLB2_CNTL, tmp);
+   if (rdev->flags & RADEON_IS_IGP) {
+   WREG32(FUS_MC_VM_MD_L1_TLB0_CNTL, tmp);
+   WREG32(FUS_MC_VM_MD_L1_TLB1_CNTL, tmp);
+   WREG32(FUS_MC_VM_MD_L1_TLB2_CNTL, tmp);
+   } else {
+   WREG32(MC_VM_MD_L1_TLB0_CNTL, tmp);
+   WREG32(MC_VM_MD_L1_TLB1_CNTL, tmp);
+   WREG32(MC_VM_MD_L1_TLB2_CNTL, tmp);
+   }
WREG32(MC_VM_MB_L1_TLB0_CNTL, tmp);
WREG32(MC_VM_MB_L1_TLB1_CNTL, tmp);
WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp);
@@ -2923,11 +2929,6 @@ static int evergreen_startup(struct radeon_device *rdev)
rdev->asic->copy = NULL;
dev_warn(rdev->dev, "failed blitter (%d) falling back to 
memcpy\n", r);
}
-   /* XXX: ontario has problems blitting to gart at the moment */
-   if (rdev->family == CHIP_PALM) {
-   rdev->asic->copy = NULL;
-   radeon_ttm_set_active_vram_size(rdev, 
rdev->mc.visible_vram_size);
-   }
 
/* allocate wb buffer */
r = radeon_wb_init(rdev);
diff --git a/drivers/gpu/drm/radeon/evergreend.h 
b/drivers/gpu/drm/radeon/evergreend.h
index 9aaa3f0..9453384 100644
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -221,6 +221,11 @@
 #defineMC_VM_MD_L1_TLB0_CNTL   0x2654
 #defineMC_VM_MD_L1_TLB1_CNTL   0x2658
 #defineMC_VM_MD_L1_TLB2_CNTL   0x265C
+
+#defineFUS_MC_VM_MD_L1_TLB0_CNTL   0x265C
+#defineFUS_MC_VM_MD_L1_TLB1_CNTL   0x2660
+#defineFUS_MC_VM_MD_L1_TLB2_CNTL   0x2664
+
 #defineMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR  0x203C
 #defineMC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x2038
 #defineMC_VM_SYSTEM_APERTURE_LOW_ADDR  0x2034
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
b/drivers/gpu/drm/radeon/radeon_kms.c
index 871df03..bd58af6 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -234,6 +234,9 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, 
struct drm_file *filp)
return -EINVAL;
}
break;
+   case RADEON_INFO_FUSION_GART_WORKING:
+   value = 1;
+   break;
default:
DRM_DEBUG_KMS("Invalid request %d\n", info->request);
return -EINVAL;
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 7aa5ddd..787f7b6 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -910,6 +910,7 @@ struct drm_radeon_cs {
 #define RADEON_INFO_CLOCK_CRYSTAL_FREQ 0x09 /* clock crystal frequency */
 #define RADEON_INFO_NUM_BACKENDS   0x0a /* DB/backends for r600+ - need 
for OQ */
 #define RADEON_INFO_NUM_TILE_PIPES 0x0b /* tile pipes for r600+ */
+#define RADEON_INFO_FUSION_GART_WORKING0x0c /* fusion writes to GTT 
were broken before this */
 
 struct drm_radeon_info {
uint32_trequest;
-- 
1.7.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/radeon/kms: fix gart setup on fusion parts (v2)

2011-05-03 Thread Alex Deucher
On Tue, May 3, 2011 at 8:17 PM, Dave Airlie  wrote:
> From: Alex Deucher 
>
> Out of the entire GART/VM subsystem, the hw designers changed
> the location of 3 regs.
>
> v2: airlied: add parameter for userspace to work from.
>
> Signed-off-by: Alex Deucher 
> Signed-off-by: Jerome Glisse 
> Cc: sta...@kernel.org
> Signed-off-by: Dave Airlie 

Looks good.

Signed-off-by: Alex Deucher 

> ---
>  drivers/gpu/drm/radeon/evergreen.c  |   17 +
>  drivers/gpu/drm/radeon/evergreend.h |    5 +
>  drivers/gpu/drm/radeon/radeon_kms.c |    3 +++
>  include/drm/radeon_drm.h            |    1 +
>  4 files changed, 18 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/evergreen.c 
> b/drivers/gpu/drm/radeon/evergreen.c
> index e9bc135..c20eac3 100644
> --- a/drivers/gpu/drm/radeon/evergreen.c
> +++ b/drivers/gpu/drm/radeon/evergreen.c
> @@ -862,9 +862,15 @@ int evergreen_pcie_gart_enable(struct radeon_device 
> *rdev)
>                SYSTEM_ACCESS_MODE_NOT_IN_SYS |
>                SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU |
>                EFFECTIVE_L1_TLB_SIZE(5) | EFFECTIVE_L1_QUEUE_SIZE(5);
> -       WREG32(MC_VM_MD_L1_TLB0_CNTL, tmp);
> -       WREG32(MC_VM_MD_L1_TLB1_CNTL, tmp);
> -       WREG32(MC_VM_MD_L1_TLB2_CNTL, tmp);
> +       if (rdev->flags & RADEON_IS_IGP) {
> +               WREG32(FUS_MC_VM_MD_L1_TLB0_CNTL, tmp);
> +               WREG32(FUS_MC_VM_MD_L1_TLB1_CNTL, tmp);
> +               WREG32(FUS_MC_VM_MD_L1_TLB2_CNTL, tmp);
> +       } else {
> +               WREG32(MC_VM_MD_L1_TLB0_CNTL, tmp);
> +               WREG32(MC_VM_MD_L1_TLB1_CNTL, tmp);
> +               WREG32(MC_VM_MD_L1_TLB2_CNTL, tmp);
> +       }
>        WREG32(MC_VM_MB_L1_TLB0_CNTL, tmp);
>        WREG32(MC_VM_MB_L1_TLB1_CNTL, tmp);
>        WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp);
> @@ -2923,11 +2929,6 @@ static int evergreen_startup(struct radeon_device 
> *rdev)
>                rdev->asic->copy = NULL;
>                dev_warn(rdev->dev, "failed blitter (%d) falling back to 
> memcpy\n", r);
>        }
> -       /* XXX: ontario has problems blitting to gart at the moment */
> -       if (rdev->family == CHIP_PALM) {
> -               rdev->asic->copy = NULL;
> -               radeon_ttm_set_active_vram_size(rdev, 
> rdev->mc.visible_vram_size);
> -       }
>
>        /* allocate wb buffer */
>        r = radeon_wb_init(rdev);
> diff --git a/drivers/gpu/drm/radeon/evergreend.h 
> b/drivers/gpu/drm/radeon/evergreend.h
> index 9aaa3f0..9453384 100644
> --- a/drivers/gpu/drm/radeon/evergreend.h
> +++ b/drivers/gpu/drm/radeon/evergreend.h
> @@ -221,6 +221,11 @@
>  #define        MC_VM_MD_L1_TLB0_CNTL                           0x2654
>  #define        MC_VM_MD_L1_TLB1_CNTL                           0x2658
>  #define        MC_VM_MD_L1_TLB2_CNTL                           0x265C
> +
> +#define        FUS_MC_VM_MD_L1_TLB0_CNTL                       0x265C
> +#define        FUS_MC_VM_MD_L1_TLB1_CNTL                       0x2660
> +#define        FUS_MC_VM_MD_L1_TLB2_CNTL                       0x2664
> +
>  #define        MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR              0x203C
>  #define        MC_VM_SYSTEM_APERTURE_HIGH_ADDR                 0x2038
>  #define        MC_VM_SYSTEM_APERTURE_LOW_ADDR                  0x2034
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
> b/drivers/gpu/drm/radeon/radeon_kms.c
> index 871df03..bd58af6 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> @@ -234,6 +234,9 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, 
> struct drm_file *filp)
>                        return -EINVAL;
>                }
>                break;
> +       case RADEON_INFO_FUSION_GART_WORKING:
> +               value = 1;
> +               break;
>        default:
>                DRM_DEBUG_KMS("Invalid request %d\n", info->request);
>                return -EINVAL;
> diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
> index 7aa5ddd..787f7b6 100644
> --- a/include/drm/radeon_drm.h
> +++ b/include/drm/radeon_drm.h
> @@ -910,6 +910,7 @@ struct drm_radeon_cs {
>  #define RADEON_INFO_CLOCK_CRYSTAL_FREQ 0x09 /* clock crystal frequency */
>  #define RADEON_INFO_NUM_BACKENDS       0x0a /* DB/backends for r600+ - need 
> for OQ */
>  #define RADEON_INFO_NUM_TILE_PIPES     0x0b /* tile pipes for r600+ */
> +#define RADEON_INFO_FUSION_GART_WORKING        0x0c /* fusion writes to GTT 
> were broken before this */
>
>  struct drm_radeon_info {
>        uint32_t                request;
> --
> 1.7.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[git pull] drm fixes

2011-05-03 Thread Dave Airlie

Hi Linus,

One core fix for stopping userspace apps hanging when the kernel turns off 
a display, mainly affects i915,

Some new radeon pci ids, a regression fix for people running switchable 
graphics laptops, and a fix to stabilise the fusion APU hw, which 3 of us 
have been searching for for over a week now, finally Jerome narrowed it 
down and Alex found the hw guys moved 3 registers just slightly to piss us 
off, maybe it saved a transistor and software is easy.

Dave.

The following changes since commit 609cfda586c7fe3e5d1a02c51edb587506294167:

  Merge branch 'stable/bug-fixes-for-rc5' of 
git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen (2011-05-03 09:25:42 
-0700)

are available in the git repository at:

  ssh://master.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git drm-fixes

Alex Deucher (2):
  drm/radeon/kms: add some new pci ids
  drm/radeon/kms: fix gart setup on fusion parts (v2)

Christopher James Halse Rogers (1):
  drm: Send pending vblank events before disabling vblank.

Dave Airlie (1):
  drm/radeon: fix regression on atom cards with hardcoded EDID record.

 drivers/gpu/drm/drm_irq.c|   23 +++
 drivers/gpu/drm/radeon/evergreen.c   |   17 +
 drivers/gpu/drm/radeon/evergreend.h  |5 +
 drivers/gpu/drm/radeon/radeon_atombios.c |5 +++--
 drivers/gpu/drm/radeon/radeon_kms.c  |3 +++
 include/drm/drm_pciids.h |5 +
 include/drm/radeon_drm.h |1 +
 7 files changed, 49 insertions(+), 10 deletions(-)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/2] vga_switcheroo: Remove unbalanced pci_enable_device

2011-05-03 Thread Dave Airlie
> This is unbalanced and probably more fitting for the client
> to take care of.  Remove it.

I've queued this in -next.

Dave.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/2] drm/nouveau: Check that the device is enabled before processing interrupt

2011-05-03 Thread Dave Airlie
On Mon, May 2, 2011 at 10:49 AM, Alex Williamson
 wrote:
> We're likely to be sharing an interrupt line with other devices,
> which means our handler might get called after we've turned off
> the device via vga switcheroo.  This can lead to all sorts of
> badness, like nv04_fifo_isr() spewing "PFIFO still angry after
> 100 spins, halt" to the console before the system enters a hard
> hang.
>
> We can avoid this by simply checking if the device is still
> enabled before processing an interrupt.  To avoid races, flush
> any inflight interrupts using synchronize_irq().  Note that
> since pci_intx() is called after pci_save_state(),
> pci_restore_state() will automatically re-enable INTx.

I still think we should just need the synchronize_irq followed by a
check in the irq handler for all fs,

or is there a race there I'm missing?

Dave.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/2] drm/nouveau: Check that the device is enabled before processing interrupt

2011-05-03 Thread Alex Williamson
On Wed, 2011-05-04 at 13:50 +1000, Dave Airlie wrote:
> On Mon, May 2, 2011 at 10:49 AM, Alex Williamson
>  wrote:
> > We're likely to be sharing an interrupt line with other devices,
> > which means our handler might get called after we've turned off
> > the device via vga switcheroo.  This can lead to all sorts of
> > badness, like nv04_fifo_isr() spewing "PFIFO still angry after
> > 100 spins, halt" to the console before the system enters a hard
> > hang.
> >
> > We can avoid this by simply checking if the device is still
> > enabled before processing an interrupt.  To avoid races, flush
> > any inflight interrupts using synchronize_irq().  Note that
> > since pci_intx() is called after pci_save_state(),
> > pci_restore_state() will automatically re-enable INTx.
> 
> I still think we should just need the synchronize_irq followed by a
> check in the irq handler for all fs,
> 
> or is there a race there I'm missing?

The synchronize_irq by itself doesn't guarantee anything.  The irq
handler could be immediately started on another CPU once that returns
and be well past the first device read before we make it far enough
through pci_set_power_state that the device becomes unresponsive.  Can
we guarantee that first device read in the interrupt handler will always
be 0 or -1 in the suspend path?  Even as the last milliamperes of charge
drain out of the device?

By adding the device enabled check in the interrupt handler, disabling
the device, then calling synchronize_irq, we guarantee that the entire
interrupt handler path is not being executed and won't be executed again
until we re-enable the device.  It does seem a bit odd, but how many
other devices in the system are entirely powered off, with a driver
attached and interrupt handler registered while the system is still
humming along?  Thanks,

Alex

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/2] drm/nouveau: Check that the device is enabled before processing interrupt

2011-05-03 Thread Dave Airlie
On Tue, 2011-05-03 at 22:18 -0600, Alex Williamson wrote:
> On Wed, 2011-05-04 at 13:50 +1000, Dave Airlie wrote:
> > On Mon, May 2, 2011 at 10:49 AM, Alex Williamson
> >  wrote:
> > > We're likely to be sharing an interrupt line with other devices,
> > > which means our handler might get called after we've turned off
> > > the device via vga switcheroo.  This can lead to all sorts of
> > > badness, like nv04_fifo_isr() spewing "PFIFO still angry after
> > > 100 spins, halt" to the console before the system enters a hard
> > > hang.
> > >
> > > We can avoid this by simply checking if the device is still
> > > enabled before processing an interrupt.  To avoid races, flush
> > > any inflight interrupts using synchronize_irq().  Note that
> > > since pci_intx() is called after pci_save_state(),
> > > pci_restore_state() will automatically re-enable INTx.
> > 
> > I still think we should just need the synchronize_irq followed by a
> > check in the irq handler for all fs,
> > 
> > or is there a race there I'm missing?
> 
> The synchronize_irq by itself doesn't guarantee anything.  The irq
> handler could be immediately started on another CPU once that returns
> and be well past the first device read before we make it far enough
> through pci_set_power_state that the device becomes unresponsive.  Can
> we guarantee that first device read in the interrupt handler will always
> be 0 or -1 in the suspend path?  Even as the last milliamperes of charge
> drain out of the device?

It should always be a valid irq or 0x. It got nothing to do with
milliamperes of charge, and all to do with the PCI BAR decodes being
turned off.

> By adding the device enabled check in the interrupt handler, disabling
> the device, then calling synchronize_irq, we guarantee that the entire
> interrupt handler path is not being executed and won't be executed again
> until we re-enable the device.  It does seem a bit odd, but how many
> other devices in the system are entirely powered off, with a driver
> attached and interrupt handler registered while the system is still
> humming along?  Thanks,

The theory is lots. OLPC does this sort of things for its breakfast I'd
have thought.

which is why I still think we are missing something, when we D3 the
device it should be the same as suspend/resume cycle pretty much,

I'll have to think about it a bit more and maybe see what PM guys can
tell us.

mjg59 any clues?

Dave.

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/2] drm/nouveau: Check that the device is enabled before processing interrupt

2011-05-03 Thread Alex Williamson
On Wed, 2011-05-04 at 14:22 +1000, Dave Airlie wrote:
> On Tue, 2011-05-03 at 22:18 -0600, Alex Williamson wrote:
> > On Wed, 2011-05-04 at 13:50 +1000, Dave Airlie wrote:
> > > On Mon, May 2, 2011 at 10:49 AM, Alex Williamson
> > >  wrote:
> > > > We're likely to be sharing an interrupt line with other devices,
> > > > which means our handler might get called after we've turned off
> > > > the device via vga switcheroo.  This can lead to all sorts of
> > > > badness, like nv04_fifo_isr() spewing "PFIFO still angry after
> > > > 100 spins, halt" to the console before the system enters a hard
> > > > hang.
> > > >
> > > > We can avoid this by simply checking if the device is still
> > > > enabled before processing an interrupt.  To avoid races, flush
> > > > any inflight interrupts using synchronize_irq().  Note that
> > > > since pci_intx() is called after pci_save_state(),
> > > > pci_restore_state() will automatically re-enable INTx.
> > > 
> > > I still think we should just need the synchronize_irq followed by a
> > > check in the irq handler for all fs,
> > > 
> > > or is there a race there I'm missing?
> > 
> > The synchronize_irq by itself doesn't guarantee anything.  The irq
> > handler could be immediately started on another CPU once that returns
> > and be well past the first device read before we make it far enough
> > through pci_set_power_state that the device becomes unresponsive.  Can
> > we guarantee that first device read in the interrupt handler will always
> > be 0 or -1 in the suspend path?  Even as the last milliamperes of charge
> > drain out of the device?
> 
> It should always be a valid irq or 0x. It got nothing to do with
> milliamperes of charge, and all to do with the PCI BAR decodes being
> turned off.

Unfortunately this depends on the platform behavior for a master abort.
But maybe this bring up another issue; we really want to make sure we're
turning off decode after we've flushed any inflight interrupts.  We
can't guarantee that w/o some kind of synchronization and the device
being enabled is probably too late... are you sure you don't want to
uninstall the interrupt handler? ;)

> > By adding the device enabled check in the interrupt handler, disabling
> > the device, then calling synchronize_irq, we guarantee that the entire
> > interrupt handler path is not being executed and won't be executed again
> > until we re-enable the device.  It does seem a bit odd, but how many
> > other devices in the system are entirely powered off, with a driver
> > attached and interrupt handler registered while the system is still
> > humming along?  Thanks,
> 
> The theory is lots. OLPC does this sort of things for its breakfast I'd
> have thought.
> 
> which is why I still think we are missing something, when we D3 the
> device it should be the same as suspend/resume cycle pretty much,

Except the whole system goes down for a suspend/resume and we don't
typically have to worry about stray interrupt during the down time.  If
our vga switcheroo handler is doing the right thing, we're not only
going to D3, we're entirely removing power from the device.  Some
platforms (probably not ones we care about for switcheroo, but
nonetheless) won't put up with a master abort on the bus that would be
caused by reading from an effectively non-existent device.  Thanks,

Alex

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/2] drm/nouveau: Check that the device is enabled before processing interrupt

2011-05-03 Thread Dave Airlie
On Tue, 2011-05-03 at 22:47 -0600, Alex Williamson wrote:
> On Wed, 2011-05-04 at 14:22 +1000, Dave Airlie wrote:
> > On Tue, 2011-05-03 at 22:18 -0600, Alex Williamson wrote:
> > > On Wed, 2011-05-04 at 13:50 +1000, Dave Airlie wrote:
> > > > On Mon, May 2, 2011 at 10:49 AM, Alex Williamson
> > > >  wrote:
> > > > > We're likely to be sharing an interrupt line with other devices,
> > > > > which means our handler might get called after we've turned off
> > > > > the device via vga switcheroo.  This can lead to all sorts of
> > > > > badness, like nv04_fifo_isr() spewing "PFIFO still angry after
> > > > > 100 spins, halt" to the console before the system enters a hard
> > > > > hang.
> > > > >
> > > > > We can avoid this by simply checking if the device is still
> > > > > enabled before processing an interrupt.  To avoid races, flush
> > > > > any inflight interrupts using synchronize_irq().  Note that
> > > > > since pci_intx() is called after pci_save_state(),
> > > > > pci_restore_state() will automatically re-enable INTx.
> > > > 
> > > > I still think we should just need the synchronize_irq followed by a
> > > > check in the irq handler for all fs,
> > > > 
> > > > or is there a race there I'm missing?
> > > 
> > > The synchronize_irq by itself doesn't guarantee anything.  The irq
> > > handler could be immediately started on another CPU once that returns
> > > and be well past the first device read before we make it far enough
> > > through pci_set_power_state that the device becomes unresponsive.  Can
> > > we guarantee that first device read in the interrupt handler will always
> > > be 0 or -1 in the suspend path?  Even as the last milliamperes of charge
> > > drain out of the device?
> > 
> > It should always be a valid irq or 0x. It got nothing to do with
> > milliamperes of charge, and all to do with the PCI BAR decodes being
> > turned off.
> 
> Unfortunately this depends on the platform behavior for a master abort.
> But maybe this bring up another issue; we really want to make sure we're
> turning off decode after we've flushed any inflight interrupts.  We
> can't guarantee that w/o some kind of synchronization and the device
> being enabled is probably too late... are you sure you don't want to
> uninstall the interrupt handler? ;)

The x86 behaviour is all we care about btw, don't even think about worry
about someone creating a powerpc with hybrid graphics.

As I said OLPC does this lots. I'm hoping there is some example of how
this should work, maybe it should work like this, but in that case I'd
like a previous example of it.


> > The theory is lots. OLPC does this sort of things for its breakfast I'd
> > have thought.
> > 
> > which is why I still think we are missing something, when we D3 the
> > device it should be the same as suspend/resume cycle pretty much,
> 
> Except the whole system goes down for a suspend/resume and we don't
> typically have to worry about stray interrupt during the down time.  If
> our vga switcheroo handler is doing the right thing, we're not only
> going to D3, we're entirely removing power from the device.  Some
> platforms (probably not ones we care about for switcheroo, but
> nonetheless) won't put up with a master abort on the bus that would be
> caused by reading from an effectively non-existent device.  Thanks,

Again OLPC and lots of other embedded systems D3 devices without D3ing
the whole system, and AFAIK without deinstalling the irq handlers.

I'll try and find some time to look into it deeper later this week.

Dave.

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 36777] radeon 0000:01:00.0: IH ring buffer overflow (0xFFFFFFFF, 15, 65550)

2011-05-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=36777

Michel D?nzer  changed:

   What|Removed |Added

Product|xorg|DRI
  Component|Driver/Radeon   |DRM/Radeon
 AssignedTo|xorg-driver-ati at lists.x.org |dri-devel at 
lists.freedesktop
   ||.org
  QAContact|xorg-team at lists.x.org   |

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


[Bug 36745] wine 1.3.19 and 3Dmark2001SE Dragothic demo upset kernel 2.6.38.4

2011-05-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=36745

--- Comment #9 from Michel D?nzer  2011-05-03 01:37:50 
PDT ---
Can you print track->num_arrays when this happens? I suspect track->arrays[]
may be overflowing and clobbering track->cb[].

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


[Bug 36602] Hierarchical Z support for R600

2011-05-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=36602

Pierre-Eric Pelloux-Prayer  changed:

   What|Removed |Added

  Attachment #46081|0   |1
is obsolete||
  Attachment #46082|0   |1
is obsolete||

--- Comment #5 from Pierre-Eric Pelloux-Prayer  
2011-05-03 02:36:02 PDT ---
Created an attachment (id=46281)
 View: https://bugs.freedesktop.org/attachment.cgi?id=46281
 Review: https://bugs.freedesktop.org/review?bug=36602&attachment=46281

Updated patch

Here's an updated patch.
Main differences are :
- num tile pipes getter
- algo for determining HTILE_SETTINGS value
- htile buffer size is more precisely calculated

Questions :
- actually htile buffer is allocated to : DB_size_in_pixels * 4 / 4*4. This
could be reduced in some case (when using 8x8 tiles for instance). I was
thinking of moving the htile_settings calculation to r600_texture.c (when HiZ
bo is created), and storing the htile_settings value alongside the HiZ bo
pointer, for future usage (mainly when setting HTILE_SETTINGS register) ?
- I sometimes get this kernel error when enabling HiZ :
[  459.432139] WARNING: at drivers/gpu/drm/radeon/radeon_fence.c:248
radeon_fence_wait+0x2a0/0x33f [radeon]()
[  459.432146] Hardware name: MS-7551
[  459.432152] GPU lockup (waiting for 0x0001216B last fence id 0x00012167)
[]
[  459.432694]  [] ? drm_ioctl+0x273/0x347 [drm]
I'm not sure where does this come from, and how much this could be related to
HiZ ?

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


[Bug 34252] Unexpected behaviour when switching video cards with vga_switcheroo

2011-05-03 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=34252


Rafael J. Wysocki  changed:

   What|Removed |Added

 Blocks|32012   |27352




-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are watching the assignee of the bug.

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
--
___
Dri-devel mailing list
Dri-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[Bug 36745] wine 1.3.19 and 3Dmark2001SE Dragothic demo upset kernel 2.6.38.4

2011-05-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=36745

Andrew Randrianasulu  changed:

   What|Removed |Added

  Attachment #46266|0   |1
is obsolete||

--- Comment #10 from Andrew Randrianasulu  2011-05-03 
04:08:42 PDT ---
Created an attachment (id=46284)
 --> (https://bugs.freedesktop.org/attachment.cgi?id=46284)
more debug in dmesg

I've added DRM_ERROR("[drm] num_arrays, %u\n", track->num_arrays); into
r100_cs_track_check(), but it prints just "3"

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


[PATCH] drm/radeon/kms: add support for thermal chips on combios asics

2011-05-03 Thread Alex Deucher
Signed-off-by: Alex Deucher 
---
 drivers/gpu/drm/radeon/radeon_combios.c |   54 +++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_combios.c 
b/drivers/gpu/drm/radeon/radeon_combios.c
index 8caf546..089ab92 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -2504,6 +2504,12 @@ bool radeon_get_legacy_connector_info_from_bios(struct 
drm_device *dev)
return true;
 }

+static const char *thermal_controller_names[] = {
+   "NONE",
+   "lm63",
+   "adm1032",
+};
+
 void radeon_combios_get_power_modes(struct radeon_device *rdev)
 {
struct drm_device *dev = rdev->ddev;
@@ -2524,6 +2530,54 @@ void radeon_combios_get_power_modes(struct radeon_device 
*rdev)
return;
}

+   /* check for a thermal chip */
+   offset = combios_get_table_offset(dev, COMBIOS_OVERDRIVE_INFO_TABLE);
+   if (offset) {
+   u8 thermal_controller = 0, gpio = 0, i2c_addr = 0, clk_bit = 0, 
data_bit = 0;
+   struct radeon_i2c_bus_rec i2c_bus;
+
+   rev = RBIOS8(offset);
+
+   if (rev == 0) {
+   thermal_controller = RBIOS8(offset + 3);
+   gpio = RBIOS8(offset + 4) & 0x3f;
+   i2c_addr = RBIOS8(offset + 5);
+   } else if (rev == 1) {
+   thermal_controller = RBIOS8(offset + 4);
+   gpio = RBIOS8(offset + 5) & 0x3f;
+   i2c_addr = RBIOS8(offset + 6);
+   } else if (rev == 2) {
+   thermal_controller = RBIOS8(offset + 4);
+   gpio = RBIOS8(offset + 5) & 0x3f;
+   i2c_addr = RBIOS8(offset + 6);
+   clk_bit = RBIOS8(offset + 0xa);
+   data_bit = RBIOS8(offset + 0xb);
+   }
+   if ((thermal_controller > 0) && (thermal_controller < 3)) {
+   DRM_INFO("Possible %s thermal controller at 0x%02x\n",
+thermal_controller_names[thermal_controller],
+i2c_addr >> 1);
+   if (gpio == DDC_LCD) {
+   /* MM i2c */
+   i2c_bus.valid = true;
+   i2c_bus.hw_capable = true;
+   i2c_bus.mm_i2c = true;
+   i2c_bus.i2c_id = 0xa0;
+   } else if (gpio == DDC_GPIO)
+   i2c_bus = combios_setup_i2c_bus(rdev, gpio, 1 
<< clk_bit, 1 << data_bit);
+   else
+   i2c_bus = combios_setup_i2c_bus(rdev, gpio, 0, 
0);
+   rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus);
+   if (rdev->pm.i2c_bus) {
+   struct i2c_board_info info = { };
+   const char *name = 
thermal_controller_names[thermal_controller];
+   info.addr = i2c_addr >> 1;
+   strlcpy(info.type, name, sizeof(info.type));
+   i2c_new_device(&rdev->pm.i2c_bus->adapter, 
&info);
+   }
+   }
+   }
+
if (rdev->flags & RADEON_IS_MOBILITY) {
offset = combios_get_table_offset(dev, 
COMBIOS_POWERPLAY_INFO_TABLE);
if (offset) {
-- 
1.7.1.1



[PATCH 1/2] drm/radeon/kms: set i2c adapter class to I2C_CLASS_DDC

2011-05-03 Thread Alex Deucher
The most common use of the radeon i2c buses is for ddc.

Signed-off-by: Alex Deucher 
Cc: Jean Delvare 
---
 drivers/gpu/drm/radeon/radeon_i2c.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c 
b/drivers/gpu/drm/radeon/radeon_i2c.c
index 983cbac..781196d 100644
--- a/drivers/gpu/drm/radeon/radeon_i2c.c
+++ b/drivers/gpu/drm/radeon/radeon_i2c.c
@@ -888,6 +888,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device 
*dev,

i2c->rec = *rec;
i2c->adapter.owner = THIS_MODULE;
+   i2c->adapter.class = I2C_CLASS_DDC;
i2c->dev = dev;
i2c_set_adapdata(&i2c->adapter, i2c);
if (rec->mm_i2c ||
@@ -947,6 +948,7 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct 
drm_device *dev,

i2c->rec = *rec;
i2c->adapter.owner = THIS_MODULE;
+   i2c->adapter.class = I2C_CLASS_DDC;
i2c->dev = dev;
snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
 "Radeon aux bus %s", name);
-- 
1.7.1.1



[PATCH 2/2] drm/radeon/kms: add I2C_CLASS_HWMON to radeon i2c adapater classes

2011-05-03 Thread Alex Deucher
I'm not sure this is necessary.  In most cases the driver
will add the hwmon device itself based on information from the
vbios tables.  However, there are some boards without a proper
vbios entry for the the hwmon chips and non-x86 (Mac/Sun) cards do
not have a standard vbios.  This allows the hwmon drivers to
detect devices on the radeon i2c buses.

Signed-off-by: Alex Deucher 
Cc: Jean Delvare 
---
 drivers/gpu/drm/radeon/radeon_i2c.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c 
b/drivers/gpu/drm/radeon/radeon_i2c.c
index 781196d..65d8744 100644
--- a/drivers/gpu/drm/radeon/radeon_i2c.c
+++ b/drivers/gpu/drm/radeon/radeon_i2c.c
@@ -888,7 +888,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device 
*dev,

i2c->rec = *rec;
i2c->adapter.owner = THIS_MODULE;
-   i2c->adapter.class = I2C_CLASS_DDC;
+   i2c->adapter.class = I2C_CLASS_DDC | I2C_CLASS_HWMON;
i2c->dev = dev;
i2c_set_adapdata(&i2c->adapter, i2c);
if (rec->mm_i2c ||
-- 
1.7.1.1



[RFC] swap complete event handling fixes

2011-05-03 Thread Jesse Barnes
Ended up moving over to generic events since the GLX type code is part
of the GLX namespace and larger than 8 bits.

Apparently no one had ever tried ChangeDrawableAttributes with indirect
clients, because simply going a glXSelectEvent causes a crash in that
case.  So this patch set includes a fix for that issue and has been
tested with both direct and indirect clients, both with and without
client and server support.

New clients with old servers should get a 0 sbc rather than garbage.
New servers will send old clients a 0 sbc, but the clients will still
copy garbage into the event actually sent to clients.  New servers with
new clients should work both in the direct and indirect cases and get
whatever values the server sends for each field.

As always, testing and review appreciated.  Piglit's glx-swap-event case
now checks for swap count sanity (i.e. increasing, nonzero value) and
allows you to dump the current values in verbose mode.  I also added a
few more return value checks to the test.

Thanks,
Jesse



[PATCH 4/5] DRI2: support generic swap event handling

2011-05-03 Thread Jesse Barnes
The existing swap event structure is too large to fit in an XEvent, so new
servers will send a generic event if the client supports it.  This
allows a valid swap count value to be sent along with the event type,
timestamp, and media stamp.  Check for server support based on the
advertised DRI2 version and look for generic events in the event stream
with DRI2 in the extension field.

Signed-off-by: Jesse Barnes 
---
 configure.ac|2 +-
 src/glx/dri2.c  |  105 --
 src/glx/dri2.h  |3 +-
 src/glx/dri2_glx.c  |   31 +-
 src/glx/glxclient.h |2 +
 5 files changed, 108 insertions(+), 35 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3b05ca3..92d11af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ dnl Versions for external dependencies
 LIBDRM_REQUIRED=2.4.24
 LIBDRM_RADEON_REQUIRED=2.4.24
 LIBDRM_INTEL_REQUIRED=2.4.24
-DRI2PROTO_REQUIRED=2.1
+DRI2PROTO_REQUIRED=2.4
 GLPROTO_REQUIRED=1.4.11
 LIBDRM_XORG_REQUIRED=2.4.24
 LIBKMS_XORG_REQUIRED=1.0.0
diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index adfd3d1..9cab639 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -48,7 +48,7 @@
  */
 #if DRI2_MINOR < 1
 #undef DRI2_MINOR
-#define DRI2_MINOR 1
+#define DRI2_MINOR 4
 #define X_DRI2GetBuffersWithFormat 7
 #endif

@@ -88,43 +88,85 @@ static Bool
 DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
 {
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+   int type;

XextCheckExtension(dpy, info, dri2ExtensionName, False);

-   switch ((wire->u.u.type & 0x7f) - info->codes->first_event) {
+   if (wire->u.u.type == GenericEvent &&
+   dri2ServerSupportsSBC(dpy)) {
+  xGenericEvent *wire2 = (xGenericEvent *)wire;
+  if (!dri2Event(dpy, wire2->extension))
+ return False;
+  type = wire2->evtype;
+   } else {
+  type = (wire->u.u.type & 0x7f) - info->codes->first_event;
+   }
+
+   switch (type) {

 #ifdef X_DRI2SwapBuffers
case DRI2_BufferSwapComplete:
{
   GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event;
-  xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire;
-
-  /* Ignore swap events if we're not looking for them */
-  aevent->type = dri2GetSwapEventType(dpy, awire->drawable);
-  if(!aevent->type)
- return False;
-
-  aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
-  aevent->send_event = (awire->type & 0x80) != 0;
-  aevent->display = dpy;
-  aevent->drawable = awire->drawable;
-  switch (awire->event_type) {
-  case DRI2_EXCHANGE_COMPLETE:
-aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL;
-break;
-  case DRI2_BLIT_COMPLETE:
-aevent->event_type = GLX_COPY_COMPLETE_INTEL;
-break;
-  case DRI2_FLIP_COMPLETE:
-aevent->event_type = GLX_FLIP_COMPLETE_INTEL;
-break;
-  default:
-/* unknown swap completion type */
-return False;
+
+  if (dri2ServerSupportsSBC(dpy)) {
+xDRI2BufferSwapComplete2 *awire = (xDRI2BufferSwapComplete2 *)wire;
+
+/* Ignore swap events if we're not looking for them */
+aevent->type = dri2GetSwapEventType(dpy, awire->drawable);
+if(!aevent->type)
+   return False;
+
+aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
+aevent->send_event = (awire->type & 0x80) != 0;
+aevent->display = dpy;
+aevent->drawable = awire->drawable;
+switch (awire->swap_event_type) {
+case DRI2_EXCHANGE_COMPLETE:
+   aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL;
+   break;
+case DRI2_BLIT_COMPLETE:
+   aevent->event_type = GLX_COPY_COMPLETE_INTEL;
+   break;
+case DRI2_FLIP_COMPLETE:
+   aevent->event_type = GLX_FLIP_COMPLETE_INTEL;
+   break;
+default:
+   /* unknown swap completion type */
+   return False;
+}
+aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
+aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
+aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
+  } else {
+xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire;
+/* Ignore swap events if we're not looking for them */
+aevent->type = dri2GetSwapEventType(dpy, awire->drawable);
+if(!aevent->type)
+   return False;
+
+aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
+aevent->send_event = (awire->type & 0x80) != 0;
+aevent->display = dpy;
+aevent->drawable = awire->drawable;
+switch (awire->event_type) {
+case DRI2_EXCHANGE_COMPLETE:
+   aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL;
+   break;
+case DRI2_BLIT_COMPLETE:
+   aevent->event_type = GLX_COPY_COMPLETE_INTEL;
+   break;
+case DRI2_FLIP_COMPLE

[PATCH] GLX: fix broken swap event size by using a generic event

2011-05-03 Thread Jesse Barnes
The existing event is too large for an XEvent meaning that the swap
count is never sent to clients.  Create a generic event instead for use
by new clients & servers.

Signed-off-by: Jesse Barnes 
---
 configure.ac |2 +-
 glxproto.h   |   18 ++
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index d88e6df..a3047e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([GLProto], [1.4.12], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AC_INIT([GLProto], [1.4.13], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE

diff --git a/glxproto.h b/glxproto.h
index 0ff44e3..d026d4d 100644
--- a/glxproto.h
+++ b/glxproto.h
@@ -1384,6 +1384,24 @@ typedef struct {
 CARD32 sbc_lo B32;
 } xGLXBufferSwapComplete;

+/* The above is actually too large to fit in an XEvent, so use a generic
+ * event so we can send the sbc count as well. */
+typedef struct {
+BYTE type;
+CARD8 extension;
+CARD16 sequenceNumber B16;
+CARD32 length B32; /* should always be 8 for this event */
+CARD16 evtype B16;
+CARD16 swap_event_type B16;
+CARD32 drawable B32;
+CARD32 ust_hi B32;
+CARD32 ust_lo B32;
+CARD32 msc_hi B32;
+CARD32 msc_lo B32;
+CARD32 sbc_hi B32;
+CARD32 sbc_lo B32;
+} xGLXBufferSwapComplete2;
+
 //

 /*
-- 
1.7.4.1



[PATCH 5/5] GLX: support generic swap events

2011-05-03 Thread Jesse Barnes
The existing swap event structure is too big to fit in an XEvent, so
support servers that send generic events instead.  Do this by
advertising the GLX proto version we support when connecting and check
for generic events in the event stream.  Convert any received events
into regular swap complete events for client compatibility.

Signed-off-by: Jesse Barnes 
---
 configure.ac|2 +-
 src/glx/glxclient.h |2 +-
 src/glx/glxext.c|   55 --
 3 files changed, 50 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 92d11af..94fb6f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ LIBDRM_REQUIRED=2.4.24
 LIBDRM_RADEON_REQUIRED=2.4.24
 LIBDRM_INTEL_REQUIRED=2.4.24
 DRI2PROTO_REQUIRED=2.4
-GLPROTO_REQUIRED=1.4.11
+GLPROTO_REQUIRED=1.4.13
 LIBDRM_XORG_REQUIRED=2.4.24
 LIBKMS_XORG_REQUIRED=1.0.0

diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index 755a66d..cdef2a1 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -63,7 +63,7 @@
 #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))

 #define GLX_MAJOR_VERSION 1   /* current version numbers */
-#define GLX_MINOR_VERSION 4
+#define GLX_MINOR_VERSION 5

 #define __GLX_MAX_TEXTURE_UNITS 32

diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index 278c719..fb29711 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -104,14 +104,42 @@ XEXT_GENERATE_ERROR_STRING(__glXErrorString, 
__glXExtensionName,
  */

 static Bool
+__glXServerSupportsSBC(Display *dpy)
+{
+ struct glx_display *glx_dpy = __glXInitialize(dpy);
+
+ return (glx_dpy->majorVersion > 1 || (glx_dpy->majorVersion == 1 &&
+  glx_dpy->minorVersion > 4));
+}
+
+static Bool
+__glXGenericEvent(Display *dpy, xGenericEvent *wire)
+{
+ struct glx_display *glx_dpy = __glXInitialize(dpy);
+
+ return wire->extension == glx_dpy->codes->major_opcode;
+}
+
+static Bool
 __glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire)
 {
  struct glx_display *glx_dpy = __glXInitialize(dpy);
+ int type;

if (glx_dpy == NULL)
   return False;

-   switch ((wire->u.u.type & 0x7f) - glx_dpy->codes->first_event) {
+   /* New extension will send generic events for some events */
+   if (wire->u.u.type == GenericEvent && __glXServerSupportsSBC(dpy)) {
+  xGenericEvent *wire2 = (xGenericEvent *)wire;
+  if (!__glXGenericEvent(dpy, wire2))
+return False;
+  type = wire2->evtype;
+   } else {
+  type = (wire->u.u.type & 0x7f) - glx_dpy->codes->first_event;
+   }
+
+   switch (type) {
case GLX_PbufferClobber:
{
   GLXPbufferClobberEvent *aevent = (GLXPbufferClobberEvent *)event;
@@ -133,12 +161,23 @@ __glXWireToEvent(Display *dpy, XEvent *event, xEvent 
*wire)
case GLX_BufferSwapComplete:
{
   GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event;
-  xGLXBufferSwapComplete *awire = (xGLXBufferSwapComplete *)wire;
-  aevent->event_type = awire->event_type;
-  aevent->drawable = awire->drawable;
-  aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
-  aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
-  aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
+  if (__glXServerSupportsSBC(dpy)) {
+xGLXBufferSwapComplete2 *awire = (xGLXBufferSwapComplete2 *)wire;
+/* Make it look like a regular event to clients */
+aevent->type = glx_dpy->codes->first_event + awire->evtype;
+aevent->event_type = awire->swap_event_type;
+aevent->drawable = awire->drawable;
+aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
+aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
+aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
+  } else {
+xGLXBufferSwapComplete *awire = (xGLXBufferSwapComplete *)wire;
+aevent->event_type = awire->event_type;
+aevent->drawable = awire->drawable;
+aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
+aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
+aevent->sbc = 0;
+  }
   return True;
}
default:
@@ -843,6 +882,8 @@ __glXInitialize(Display * dpy)
   XESetEventToWire(dpy, dpyPriv->codes->first_event + i, __glXEventToWire);
}

+   XESetWireToEvent(dpy, GenericEvent, __glXWireToEvent);
+
XESetCloseDisplay(dpy, dpyPriv->codes->extension, __glXCloseDisplay);
XESetErrorString (dpy, dpyPriv->codes->extension,__glXErrorString);

-- 
1.7.4.1



[PATCH 6/8] GLX/DRI2: pass drawable correctly for indirect swap events

2011-05-03 Thread Jesse Barnes
Pass the right drawable pointer as data to the swap complete function.

Signed-off-by: Jesse Barnes 
---
 glx/glxdri2.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index d979717..93c5e5b 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -222,7 +222,7 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable 
*drawable)
 #endif

 if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused,
-   __glXdriSwapEvent, drawable->pDraw) != Success)
+   __glXdriSwapEvent, drawable) != Success)
return FALSE;

 return TRUE;
-- 
1.7.4.1



[PATCH 7/8] DRI2: support generic swap events

2011-05-03 Thread Jesse Barnes
Send the new generic swap event type if the client supports it.  This
means checking the client's DRI2 proto version at connect time and then
constructing a new generic event at swap complete time.  To track the
client version, we need to add a new DRI2 client private type and track
it for the lifetime of the client.

Signed-off-by: Jesse Barnes 
---
 configure.ac  |2 +-
 glx/glxdri2.c |   20 +++
 hw/xfree86/dri2/dri2.c|   57 -
 hw/xfree86/dri2/dri2.h|6 
 hw/xfree86/dri2/dri2ext.c |   47 +++-
 5 files changed, 118 insertions(+), 14 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6eb780c..8e00fe7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -771,7 +771,7 @@ RECORDPROTO="recordproto >= 1.13.99.1"
 SCRNSAVERPROTO="scrnsaverproto >= 1.1"
 RESOURCEPROTO="resourceproto"
 DRIPROTO="xf86driproto >= 2.1.0"
-DRI2PROTO="dri2proto >= 2.3"
+DRI2PROTO="dri2proto >= 2.4"
 XINERAMAPROTO="xineramaproto"
 BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
 DGAPROTO="xf86dgaproto >= 2.0.99.1"
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 93c5e5b..a17b4d5 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -228,6 +228,23 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, 
__GLXdrawable *drawable)
 return TRUE;
 }

+static void
+__glXDRIclientCallback(CallbackListPtr *list,
+  pointer  closure,
+  pointer  data)
+{
+NewClientInfoRec   *clientinfo = (NewClientInfoRec *) data;
+ClientPtr  pClient = clientinfo->client;
+
+switch (pClient->clientState) {
+case ClientStateGone:
+   DRI2ClientGone(pClient);
+   break;
+default:
+   break;
+}
+}
+
 static int
 __glXDRIdrawableSwapInterval(__GLXdrawable *drawable, int interval)
 {
@@ -769,6 +786,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 screen->leaveVT = pScrn->LeaveVT;
 pScrn->LeaveVT = glxDRILeaveVT;

+if (!AddCallback (&ClientStateCallback, __glXDRIclientCallback, 0))
+   return NULL;
+
 LogMessage(X_INFO,
   "AIGLX: Loaded and initialized %s\n", driverName);

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 5c42a51..9b5eab2 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -60,6 +60,9 @@ static DevPrivateKeyRec dri2WindowPrivateKeyRec;
 static DevPrivateKeyRec dri2PixmapPrivateKeyRec;
 #define dri2PixmapPrivateKey (&dri2PixmapPrivateKeyRec)

+static DevPrivateKeyRec dri2ClientPrivateKeyRec;
+#define dri2ClientPrivateKey (&dri2ClientPrivateKeyRec)
+
 static RESTYPE   dri2DrawableRes;

 typedef struct _DRI2Screen *DRI2ScreenPtr;
@@ -107,6 +110,11 @@ typedef struct _DRI2Screen {
 ConfigNotifyProcPtr ConfigNotify;
 } DRI2ScreenRec;

+typedef struct _DRI2Client {
+CARD32 major;
+CARD32 minor;
+} DRI2ClientRec, *DRI2ClientPtr;
+
 static DRI2ScreenPtr
 DRI2GetScreen(ScreenPtr pScreen)
 {
@@ -131,6 +139,12 @@ DRI2GetDrawable(DrawablePtr pDraw)
 }
 }

+static DRI2ClientPtr
+DRI2GetClient(ClientPtr client)
+{
+return dixLookupPrivate(&client->devPrivates, dri2ClientPrivateKey);
+}
+
 static unsigned long
 DRI2DrawableSerial(DrawablePtr pDraw)
 {
@@ -190,6 +204,44 @@ DRI2AllocateDrawable(DrawablePtr pDraw)
 return pPriv;
 }

+void
+DRI2InitClient(ClientPtr client, CARD32 major, CARD32 minor)
+{
+DRI2ClientPtr pPriv;
+
+pPriv = malloc(sizeof *pPriv);
+if (!pPriv)
+   return;
+
+pPriv->major = major;
+pPriv->minor = minor;
+
+dixSetPrivate(&client->devPrivates, dri2ClientPrivateKey, pPriv);
+}
+
+void
+DRI2ClientGone(ClientPtr client)
+{
+DRI2ClientPtr pPriv = DRI2GetClient(client);
+
+if (pPriv)
+   free(pPriv);
+}
+
+Bool
+DRI2ClientSupportsSBC(ClientPtr client)
+{
+DRI2ClientPtr pPriv = DRI2GetClient(client);
+
+if (!pPriv)
+   return FALSE;
+
+if (pPriv->major > 1 || (pPriv->major == 1 && pPriv->minor > 3))
+   return TRUE;
+
+return FALSE;
+}
+
 typedef struct DRI2DrawableRefRec {
 XID  id;
 XID  dri2_id;
@@ -1097,6 +1149,9 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
 if (!dixRegisterPrivateKey(&dri2PixmapPrivateKeyRec, PRIVATE_PIXMAP, 0))
return FALSE;

+if (!dixRegisterPrivateKey(&dri2ClientPrivateKeyRec, PRIVATE_CLIENT, 0))
+   return FALSE;
+
 ds = calloc(1, sizeof *ds);
 if (!ds)
return FALSE;
@@ -1114,7 +1169,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
ds->ScheduleSwap = info->ScheduleSwap;
ds->ScheduleWaitMSC = info->ScheduleWaitMSC;
ds->GetMSC = info->GetMSC;
-   cur_minor = 3;
+   cur_minor = 4;
 } else {
cur_minor = 1;
 }
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index fe0bf6c..97e8e86 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -192,6 +192,7 @@ typedef struct {
 }  DRI2InfoRec, 

[PATCH 8/8] GLX: support generic swap events

2011-05-03 Thread Jesse Barnes
Send the new generic GLX swap event if supported by the client.  This
means checking the client GLX version at swap complete time and
constructing a new generic swap completion event at swap complete time.

Signed-off-by: Jesse Barnes 
---
 configure.ac|2 +-
 glx/glxdri2.c   |   99 +++---
 glx/glxext.c|2 +
 glx/glxserver.h |1 +
 include/protocol-versions.h |2 +-
 5 files changed, 78 insertions(+), 28 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8e00fe7..87194a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -775,7 +775,7 @@ DRI2PROTO="dri2proto >= 2.4"
 XINERAMAPROTO="xineramaproto"
 BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
 DGAPROTO="xf86dgaproto >= 2.0.99.1"
-GLPROTO="glproto >= 1.4.10"
+GLPROTO="glproto >= 1.4.13"
 DMXPROTO="dmxproto >= 2.2.99.1"
 VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
 WINDOWSWMPROTO="windowswmproto"
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index a17b4d5..dc96f55 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -161,41 +161,88 @@ __glXDRIdrawableWaitGL(__GLXdrawable *drawable)
   DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
 }

+static Bool
+__glXDRIclientSupportsSBC(ClientPtr client)
+{
+__GLXclientState *cl = glxGetClient(client);
+
+if (!cl)
+   return 0;
+
+if (cl->GLClientmajorVersion > 1 ||
+   (cl->GLClientmajorVersion == 1 && cl->GLClientminorVersion > 4))
+   return TRUE;
+
+return FALSE;
+}
+
 static void
 __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust,
  CARD64 msc, CARD64 sbc)
 {
 __GLXdrawable *drawable = data;
-xGLXBufferSwapComplete wire;

 if (!(drawable->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
return;

-wire.type = __glXEventBase + GLX_BufferSwapComplete;
-switch (type) {
-case DRI2_EXCHANGE_COMPLETE:
-   wire.event_type = GLX_EXCHANGE_COMPLETE_INTEL;
-   break;
-case DRI2_BLIT_COMPLETE:
-   wire.event_type = GLX_BLIT_COMPLETE_INTEL;
-   break;
-case DRI2_FLIP_COMPLETE:
-   wire.event_type = GLX_FLIP_COMPLETE_INTEL;
-   break;
-default:
-   /* unknown swap completion type */
-   wire.event_type = 0;
-   break;
+if (__glXDRIclientSupportsSBC(client)) {
+   xGLXBufferSwapComplete2 wire;
+
+   wire.type = GenericEvent;
+   wire.extension = __glXExtBase;
+   wire.evtype = GLX_BufferSwapComplete;
+   switch (type) {
+   case DRI2_EXCHANGE_COMPLETE:
+   wire.swap_event_type = GLX_EXCHANGE_COMPLETE_INTEL;
+   break;
+   case DRI2_BLIT_COMPLETE:
+   wire.swap_event_type = GLX_BLIT_COMPLETE_INTEL;
+   break;
+   case DRI2_FLIP_COMPLETE:
+   wire.swap_event_type = GLX_FLIP_COMPLETE_INTEL;
+   break;
+   default:
+   /* unknown swap completion type */
+   wire.swap_event_type = 0;
+   break;
+   }
+   wire.drawable = drawable->drawId;
+   wire.length = 8;
+   wire.ust_hi = ust >> 32;
+   wire.ust_lo = ust & 0x;
+   wire.msc_hi = msc >> 32;
+   wire.msc_lo = msc & 0x;
+   wire.sbc_hi = sbc >> 32;
+   wire.sbc_lo = sbc & 0x;;
+   WriteEventsToClient(client, 1, (xEvent *) &wire);
+} else {
+   xGLXBufferSwapComplete wire;
+
+   wire.type = __glXEventBase + GLX_BufferSwapComplete;
+   switch (type) {
+   case DRI2_EXCHANGE_COMPLETE:
+   wire.event_type = GLX_EXCHANGE_COMPLETE_INTEL;
+   break;
+   case DRI2_BLIT_COMPLETE:
+   wire.event_type = GLX_BLIT_COMPLETE_INTEL;
+   break;
+   case DRI2_FLIP_COMPLETE:
+   wire.event_type = GLX_FLIP_COMPLETE_INTEL;
+   break;
+   default:
+   /* unknown swap completion type */
+   wire.event_type = 0;
+   break;
+   }
+   wire.drawable = drawable->drawId;
+   wire.ust_hi = ust >> 32;
+   wire.ust_lo = ust & 0x;
+   wire.msc_hi = msc >> 32;
+   wire.msc_lo = msc & 0x;
+   wire.sbc_hi = 0;
+   wire.sbc_lo = 0;
+   WriteEventsToClient(client, 1, (xEvent *) &wire);
 }
-wire.drawable = drawable->drawId;
-wire.ust_hi = ust >> 32;
-wire.ust_lo = ust & 0x;
-wire.msc_hi = msc >> 32;
-wire.msc_lo = msc & 0x;
-wire.sbc_hi = sbc >> 32;
-wire.sbc_lo = sbc & 0x;
-
-WriteEventsToClient(client, 1, (xEvent *) &wire);
 }

 /*
@@ -779,7 +826,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
  *- GLX_ARB_multisample (1.4)
  */
 screen->base.GLXmajor = 1;
-screen->base.GLXminor = 4;
+screen->base.GLXminor = 5;

 screen->enterVT = pScrn->EnterVT;
 pScrn->EnterVT = glxDRIEnterVT; 
diff --git a/glx/glxext.c b/glx/glxext.c
index 9cfc096..01960a0 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -242,6 +242,7 @@ GLboolean __glXErrorOccured(void)

 static int __g

[PATCH] DRI2: fix swap complete event size by using a generic event

2011-05-03 Thread Jesse Barnes
The existing swap complete event is too large to fit in an XEvent, so
use a generic event instead.  New servers and clients can use this
structure to fully pass the swap count along with the media stamp
counter, swap complete type, and timestamp.

Signed-off-by: Jesse Barnes 
---
 configure.ac |2 +-
 dri2proto.h  |   22 --
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5b78d6b..9505f56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([DRI2Proto], [2.3], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AC_INIT([DRI2Proto], [2.4], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE

diff --git a/dri2proto.h b/dri2proto.h
index 9708a4a..5a7d3e1 100644
--- a/dri2proto.h
+++ b/dri2proto.h
@@ -35,7 +35,7 @@

 #define DRI2_NAME  "DRI2"
 #define DRI2_MAJOR 1
-#define DRI2_MINOR 3
+#define DRI2_MINOR 4

 #define DRI2NumberErrors   0
 #define DRI2NumberEvents   2
@@ -298,7 +298,25 @@ typedef struct {
 CARD32 sbc_hi B32;
 CARD32 sbc_lo B32;
 } xDRI2BufferSwapComplete;
-#define sz_xDRI2BufferSwapComplete 32
+#define sz_xDRI2BufferSwapComplete 32 /* This should have been 36 */
+
+/* Use a generic event so we can transmit the sbc_lo value as well */
+typedef struct {
+BYTE type;
+CARD8 extension;
+CARD16 sequenceNumber B16;
+CARD32 length B32; /* should always be 8 for this event */
+CARD16 evtype B16;
+CARD16 swap_event_type B16;
+CARD32 drawable B32;
+CARD32 ust_hi B32;
+CARD32 ust_lo B32;
+CARD32 msc_hi B32;
+CARD32 msc_lo B32;
+CARD32 sbc_hi B32;
+CARD32 sbc_lo B32;
+} xDRI2BufferSwapComplete2;
+#define sz_xDRI2BufferSwapComplete2 38

 typedef struct {
 CARD8 type;
-- 
1.7.4.1



[PATCH 3/5] GLX: don't crash when indirect clients try to set an event mask

2011-05-03 Thread Jesse Barnes
After sending the GLXChangeDrawableAttributes request, we also set a
local set of attributes on the DRI drawable.  But in the indirect case
this array won't be present, so skip the setting in that case to avoid a
crash.

Signed-off-by: Jesse Barnes 
---
 src/glx/glx_pbuffer.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index 5f91bc6..ec54f1e 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -137,6 +137,9 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
 #ifdef GLX_DIRECT_RENDERING
pdraw = GetGLXDRIDrawable(dpy, drawable);

+   if (!pdraw)
+  return;
+
for (i = 0; i < num_attribs; i++) {
   switch(attribs[i * 2]) {
   case GLX_EVENT_MASK:
-- 
1.7.4.1



[Bug 36812] New: GPU lockup in Team Fortress 2

2011-05-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=36812

   Summary: GPU lockup in Team Fortress 2
   Product: Mesa
   Version: git
  Platform: x86-64 (AMD64)
OS/Version: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/Gallium/r600
AssignedTo: dri-devel at lists.freedesktop.org
ReportedBy: Enrico_m at gmx.de


After updating mesa to current git I always get a GPU lockup when the game is
about to start. After git bisect I got the following commit:

commit 18dcbd358f1d4fd5e4a40fa26c6d3bf99485884e
Author: Tom Stellard 
Date:   Sun Mar 27 01:17:43 2011 -0700

prog_optimize: Fix reallocating registers for shaders with loops

Registers that are used inside of loops need to be considered live
starting with the first instruction of the outermost loop.

https://bugs.freedesktop.org/show_bug.cgi?id=34370

NOTE: This is a candidate for the 7.9 and 7.10 branches.

Reviewed-by: Eric Anholt 


tested with kernels:
2.6.37.4
2.6.38.4
2.6.39-RC5

This is the call trace:

WARNING: at drivers/gpu/drm/radeon/radeon_fence.c:246 0x812dc0ba()

[] 
[] 
[] 
[] 
[] 
[] 
[] 
[] 
[] 
[] 
[] 
[] 
[] <_raw_spin_unlock_irq+11/40>
[] 
[] 
[] 
[] 
[] 
[] 
[] 

glxinfo (with mesa at git head):
OpenGL renderer string: Gallium 0.4 on AMD RV770
OpenGL version string: 2.1 Mesa 7.11-devel (git-a8bbce8)

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


[Bug 36812] GPU lockup in Team Fortress 2

2011-05-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=36812

Enrico_m at gmx.de changed:

   What|Removed |Added

 CC||tstellar at gmail.com

--- Comment #1 from Enrico_m at gmx.de 2011-05-03 11:46:04 PDT ---
Added commit author (hope this is ok?).

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


[PATCH] drm/radeon/kms: add some new pci ids

2011-05-03 Thread Alex Deucher
Signed-off-by: Alex Deucher 
Cc: stable at kernel.org
---
 include/drm/drm_pciids.h |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 57e5a22..e08f344 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -155,6 +155,7 @@
{0x1002, 0x6719, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
{0x1002, 0x671c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
{0x1002, 0x671d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
+   {0x1002, 0x671f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6720, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_BARTS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6721, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_BARTS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6722, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_BARTS|RADEON_NEW_MEMMAP}, \
@@ -167,6 +168,7 @@
{0x1002, 0x6729, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_BARTS|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6738, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_BARTS|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6739, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_BARTS|RADEON_NEW_MEMMAP}, \
+   {0x1002, 0x673e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_BARTS|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6740, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6741, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6742, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -199,6 +201,7 @@
{0x1002, 0x688D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6898, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
{0x1002, 0x6899, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
+   {0x1002, 0x689b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
{0x1002, 0x689c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_HEMLOCK|RADEON_NEW_MEMMAP}, \
{0x1002, 0x689d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_HEMLOCK|RADEON_NEW_MEMMAP}, \
{0x1002, 0x689e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
@@ -209,7 +212,9 @@
{0x1002, 0x68b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_JUNIPER|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x68b8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
{0x1002, 0x68b9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
+   {0x1002, 0x68ba, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
{0x1002, 0x68be, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
+   {0x1002, 0x68bf, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
{0x1002, 0x68c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x68c1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x68c7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
-- 
1.7.1.1



Make swap event handling match the spec

2011-05-03 Thread Jesse Barnes
Ian reminded me that we changed the spec to fit within an XEvent, but we
never updated the code to match.  This set of patches (much simpler than
the last) does just that.  Wrapping support can be added to Mesa if we
really want 64 bit values, but that means checking the drawable sbc and
adding whenver sbc hits 0.

Thanks,
Jesse



[PATCH 3/4] GLX/DRI2: pass drawable correctly for indirect swap events

2011-05-03 Thread Jesse Barnes
Pass the right drawable pointer as data to the swap complete function.

Signed-off-by: Jesse Barnes 
---
 glx/glxdri2.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index d979717..93c5e5b 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -222,7 +222,7 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable 
*drawable)
 #endif

 if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused,
-   __glXdriSwapEvent, drawable->pDraw) != Success)
+   __glXdriSwapEvent, drawable) != Success)
return FALSE;

 return TRUE;
-- 
1.7.4.1



[PATCH 4/4] GLX/DRI2: make GLX swap event handling match spec

2011-05-03 Thread Jesse Barnes
Only send a 32 bit swap count out to the client.

Signed-off-by: Jesse Barnes 
---
 configure.ac  |4 ++--
 glx/glxdri2.c |5 ++---
 hw/xfree86/dri2/dri2.c|2 +-
 hw/xfree86/dri2/dri2.h|2 +-
 hw/xfree86/dri2/dri2ext.c |5 ++---
 5 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6eb780c..87194a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -771,11 +771,11 @@ RECORDPROTO="recordproto >= 1.13.99.1"
 SCRNSAVERPROTO="scrnsaverproto >= 1.1"
 RESOURCEPROTO="resourceproto"
 DRIPROTO="xf86driproto >= 2.1.0"
-DRI2PROTO="dri2proto >= 2.3"
+DRI2PROTO="dri2proto >= 2.4"
 XINERAMAPROTO="xineramaproto"
 BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
 DGAPROTO="xf86dgaproto >= 2.0.99.1"
-GLPROTO="glproto >= 1.4.10"
+GLPROTO="glproto >= 1.4.13"
 DMXPROTO="dmxproto >= 2.2.99.1"
 VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
 WINDOWSWMPROTO="windowswmproto"
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 93c5e5b..450d8c9 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -163,7 +163,7 @@ __glXDRIdrawableWaitGL(__GLXdrawable *drawable)

 static void
 __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust,
- CARD64 msc, CARD64 sbc)
+ CARD64 msc, CARD32 sbc)
 {
 __GLXdrawable *drawable = data;
 xGLXBufferSwapComplete wire;
@@ -192,8 +192,7 @@ __glXdriSwapEvent(ClientPtr client, void *data, int type, 
CARD64 ust,
 wire.ust_lo = ust & 0x;
 wire.msc_hi = msc >> 32;
 wire.msc_lo = msc & 0x;
-wire.sbc_hi = sbc >> 32;
-wire.sbc_lo = sbc & 0x;
+wire.sbc = sbc;

 WriteEventsToClient(client, 1, (xEvent *) &wire);
 }
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 5c42a51..40829c2 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -76,7 +76,7 @@ typedef struct _DRI2Drawable {
 ClientPtr   blockedClient;
 BoolblockedOnMsc;
 int swap_interval;
-CARD64  swap_count;
+CARD32  swap_count;
 int64_t target_sbc; /* -1 means no SBC wait outstanding */
 CARD64  last_swap_target; /* most recently queued swap target 
*/
 CARD64  last_swap_msc; /* msc at completion of most recent 
swap */
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index fe0bf6c..2a41ead 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -51,7 +51,7 @@ extern CARD8 dri2_minor;

 typedef DRI2BufferRec DRI2Buffer2Rec, *DRI2Buffer2Ptr;
 typedef void (*DRI2SwapEventPtr)(ClientPtr client, void *data, int type,
-CARD64 ust, CARD64 msc, CARD64 sbc);
+CARD64 ust, CARD64 msc, CARD32 sbc);


 typedef DRI2BufferPtr  (*DRI2CreateBuffersProcPtr)(DrawablePtr pDraw,
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 4e48e65..2bb515f 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -357,7 +357,7 @@ vals_to_card64(CARD32 lo, CARD32 hi)

 static void
 DRI2SwapEvent(ClientPtr client, void *data, int type, CARD64 ust, CARD64 msc,
- CARD64 sbc)
+ CARD32 sbc)
 {
 xDRI2BufferSwapComplete event;
 DrawablePtr pDrawable = data;
@@ -369,8 +369,7 @@ DRI2SwapEvent(ClientPtr client, void *data, int type, 
CARD64 ust, CARD64 msc,
 event.ust_lo = ust & 0x;
 event.msc_hi = (CARD64)msc >> 32;
 event.msc_lo = msc & 0x;
-event.sbc_hi = (CARD64)sbc >> 32;
-event.sbc_lo = sbc & 0x;
+event.sbc = sbc;

 WriteEventsToClient(client, 1, (xEvent *)&event);
 }
-- 
1.7.4.1



[PATCH] glxproto: make GLX swap event struct match spec

2011-05-03 Thread Jesse Barnes
We only spec a 32 bit swap count, so drop the high sbc field.

Signed-off-by: Jesse Barnes 
---
 configure.ac |2 +-
 glxproto.h   |3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index d88e6df..a3047e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([GLProto], [1.4.12], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AC_INIT([GLProto], [1.4.13], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE

diff --git a/glxproto.h b/glxproto.h
index 0ff44e3..a6018a1 100644
--- a/glxproto.h
+++ b/glxproto.h
@@ -1380,8 +1380,7 @@ typedef struct {
 CARD32 ust_lo B32;
 CARD32 msc_hi B32;
 CARD32 msc_lo B32;
-CARD32 sbc_hi B32;
-CARD32 sbc_lo B32;
+CARD32 sbc B32;
 } xGLXBufferSwapComplete;

 //
-- 
1.7.4.1



[PATCH] dri2proto: make DRI2 swap event match GLX spec

2011-05-03 Thread Jesse Barnes
We only spec a 32 bit sbc count, so drop the high bits.

Signed-off-by: Jesse Barnes 
---
 configure.ac |2 +-
 dri2proto.h  |3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5b78d6b..9505f56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([DRI2Proto], [2.3], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AC_INIT([DRI2Proto], [2.4], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE

diff --git a/dri2proto.h b/dri2proto.h
index 9708a4a..12d834f 100644
--- a/dri2proto.h
+++ b/dri2proto.h
@@ -295,8 +295,7 @@ typedef struct {
 CARD32 ust_lo B32;
 CARD32 msc_hi B32;
 CARD32 msc_lo B32;
-CARD32 sbc_hi B32;
-CARD32 sbc_lo B32;
+CARD32 sbc B32;
 } xDRI2BufferSwapComplete;
 #define sz_xDRI2BufferSwapComplete 32

-- 
1.7.4.1



[PATCH 5/6] GLX: don't crash when indirect clients try to set an event mask

2011-05-03 Thread Jesse Barnes
After sending the GLXChangeDrawableAttributes request, we also set a
local set of attributes on the DRI drawable.  But in the indirect case
this array won't be present, so skip the setting in that case to avoid a
crash.

Signed-off-by: Jesse Barnes 
---
 src/glx/glx_pbuffer.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index 5f91bc6..ec54f1e 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -137,6 +137,9 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
 #ifdef GLX_DIRECT_RENDERING
pdraw = GetGLXDRIDrawable(dpy, drawable);

+   if (!pdraw)
+  return;
+
for (i = 0; i < num_attribs; i++) {
   switch(attribs[i * 2]) {
   case GLX_EVENT_MASK:
-- 
1.7.4.1



[PATCH 6/6] DRI2/GLX: make swap event handling match spec

2011-05-03 Thread Jesse Barnes
We only handle a 32 bit swap count, so use the new structure definitions.

Signed-off-by: Jesse Barnes 
---
 configure.ac |4 ++--
 src/glx/dri2.c   |2 +-
 src/glx/glxext.c |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3b05ca3..94fb6f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,8 +21,8 @@ dnl Versions for external dependencies
 LIBDRM_REQUIRED=2.4.24
 LIBDRM_RADEON_REQUIRED=2.4.24
 LIBDRM_INTEL_REQUIRED=2.4.24
-DRI2PROTO_REQUIRED=2.1
-GLPROTO_REQUIRED=1.4.11
+DRI2PROTO_REQUIRED=2.4
+GLPROTO_REQUIRED=1.4.13
 LIBDRM_XORG_REQUIRED=2.4.24
 LIBKMS_XORG_REQUIRED=1.0.0

diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index adfd3d1..2f18ca0 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -124,7 +124,7 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
   }
   aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
   aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
-  aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
+  aevent->sbc = awire->sbc;
   return True;
}
 #endif
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index 278c719..831d83f 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -138,7 +138,7 @@ __glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire)
   aevent->drawable = awire->drawable;
   aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
   aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
-  aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
+  aevent->sbc = awire->sbc;
   return True;
}
default:
-- 
1.7.4.1



Make swap event handling match the spec

2011-05-03 Thread Jesse Barnes
On Tue,  3 May 2011 12:21:23 -0700
Jesse Barnes  wrote:

> Ian reminded me that we changed the spec to fit within an XEvent, but we
> never updated the code to match.  This set of patches (much simpler than
> the last) does just that.  Wrapping support can be added to Mesa if we
> really want 64 bit values, but that means checking the drawable sbc and
> adding whenver sbc hits 0.

Apparently I've confused git send-email...  3/4 and 4/4 are for the
server and 5/6 and 6/6 are for Mesa.

-- 
Jesse Barnes, Intel Open Source Technology Center


[PATCH 2/2] drm/radeon/kms: add I2C_CLASS_HWMON to radeon i2c adapater classes

2011-05-03 Thread Alex Deucher
BenH doesn't want this for macs and that was mainly the use for this
patch, so it (2/2) can be ignored.

Alex

On Tue, May 3, 2011 at 1:32 PM, Alex Deucher  wrote:
> I'm not sure this is necessary. ?In most cases the driver
> will add the hwmon device itself based on information from the
> vbios tables. ?However, there are some boards without a proper
> vbios entry for the the hwmon chips and non-x86 (Mac/Sun) cards do
> not have a standard vbios. ?This allows the hwmon drivers to
> detect devices on the radeon i2c buses.
>
> Signed-off-by: Alex Deucher 
> Cc: Jean Delvare 
> ---
> ?drivers/gpu/drm/radeon/radeon_i2c.c | ? ?2 +-
> ?1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c 
> b/drivers/gpu/drm/radeon/radeon_i2c.c
> index 781196d..65d8744 100644
> --- a/drivers/gpu/drm/radeon/radeon_i2c.c
> +++ b/drivers/gpu/drm/radeon/radeon_i2c.c
> @@ -888,7 +888,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct 
> drm_device *dev,
>
> ? ? ? ?i2c->rec = *rec;
> ? ? ? ?i2c->adapter.owner = THIS_MODULE;
> - ? ? ? i2c->adapter.class = I2C_CLASS_DDC;
> + ? ? ? i2c->adapter.class = I2C_CLASS_DDC | I2C_CLASS_HWMON;
> ? ? ? ?i2c->dev = dev;
> ? ? ? ?i2c_set_adapdata(&i2c->adapter, i2c);
> ? ? ? ?if (rec->mm_i2c ||
> --
> 1.7.1.1
>
>


[Bug 25052] kernel modesetting still does not work

2011-05-03 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=25052





--- Comment #21 from Elmar Stellnberger   2011-05-03 
20:17:00 ---
Nothing better for kernel 2.6.39-0.0.71.da138d8.x86_64.

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are watching the assignee of the bug.

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
--
___
Dri-devel mailing list
Dri-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[Bug 34102] radeon drm/kms: please use suspend/hibernate notifiers for allocating memory in suspend routines

2011-05-03 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=34102


Rafael J. Wysocki  changed:

   What|Removed |Added

 CC||rjw at sisk.pl
 Kernel Version||2.6.38
 Blocks||7216
 Regression|Yes |No




--- Comment #1 from Rafael J. Wysocki   2011-05-03 20:45:22 ---
Strictly speaking, this is not a regression, because the radeon driver with
KMS has never worked correctly for you in this respect, right?

Now, while the ultimate fix would be to rework device drivers so that they
don't allocate memory from their ->suspend() callbacks, it's not quite
realistic to expect that that's going to happen any time soon.

For this reason, I'll try to provide a workaround for you.

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are watching the assignee of the bug.

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
--
___
Dri-devel mailing list
Dri-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH 1/2] drm/radeon/kms: set i2c adapter class to I2C_CLASS_DDC

2011-05-03 Thread Jean Delvare
On Tue,  3 May 2011 13:32:36 -0400, Alex Deucher wrote:
> The most common use of the radeon i2c buses is for ddc.
> 
> Signed-off-by: Alex Deucher 
> Cc: Jean Delvare 

Acked-by: Jean Delvare 

> ---
>  drivers/gpu/drm/radeon/radeon_i2c.c |2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c 
> b/drivers/gpu/drm/radeon/radeon_i2c.c
> index 983cbac..781196d 100644
> --- a/drivers/gpu/drm/radeon/radeon_i2c.c
> +++ b/drivers/gpu/drm/radeon/radeon_i2c.c
> @@ -888,6 +888,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct 
> drm_device *dev,
>  
>   i2c->rec = *rec;
>   i2c->adapter.owner = THIS_MODULE;
> + i2c->adapter.class = I2C_CLASS_DDC;
>   i2c->dev = dev;
>   i2c_set_adapdata(&i2c->adapter, i2c);
>   if (rec->mm_i2c ||
> @@ -947,6 +948,7 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct 
> drm_device *dev,
>  
>   i2c->rec = *rec;
>   i2c->adapter.owner = THIS_MODULE;
> + i2c->adapter.class = I2C_CLASS_DDC;
>   i2c->dev = dev;
>   snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
>"Radeon aux bus %s", name);


-- 
Jean Delvare


[PATCH] glxproto: make GLX swap event struct match spec

2011-05-03 Thread Keith Packard
On Tue,  3 May 2011 12:21:24 -0700, Jesse Barnes  
wrote:

> We only spec a 32 bit swap count, so drop the high sbc field.

You're missing the explicit 16-bit padding field after 'event_type'

The documented encoding
http://www.opengl.org/registry/specs/INTEL/swap_event.txt needs to be
fixed to match this, it has the padding at the end which leaves most of
the structure mis-aligned.

-- 
keith.packard at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20110503/75a2089c/attachment.pgp>


[PATCH] glxproto: make GLX swap event struct match spec

2011-05-03 Thread Jesse Barnes
On Tue, 03 May 2011 13:54:38 -0700
Keith Packard  wrote:

> On Tue,  3 May 2011 12:21:24 -0700, Jesse Barnes  virtuousgeek.org> wrote:
> 
> > We only spec a 32 bit swap count, so drop the high sbc field.
> 
> You're missing the explicit 16-bit padding field after 'event_type'
> 
> The documented encoding
> http://www.opengl.org/registry/specs/INTEL/swap_event.txt needs to be
> fixed to match this, it has the padding at the end which leaves most of
> the structure mis-aligned.

Right, another case where we updated the spec incorrectly then failed
to make the code match the broken definition (the complete enums also
need to match the final values, which are correct in the first part of
the spec).  Yay for divergence.

-- 
Jesse Barnes, Intel Open Source Technology Center


[PATCH] glxproto: make GLX swap event struct match spec

2011-05-03 Thread Jesse Barnes
On Tue, 3 May 2011 14:02:31 -0700
Jesse Barnes  wrote:

> On Tue, 03 May 2011 13:54:38 -0700
> Keith Packard  wrote:
> 
> > On Tue,  3 May 2011 12:21:24 -0700, Jesse Barnes  > virtuousgeek.org> wrote:
> > 
> > > We only spec a 32 bit swap count, so drop the high sbc field.
> > 
> > You're missing the explicit 16-bit padding field after 'event_type'
> > 
> > The documented encoding
> > http://www.opengl.org/registry/specs/INTEL/swap_event.txt needs to be
> > fixed to match this, it has the padding at the end which leaves most of
> > the structure mis-aligned.
> 
> Right, another case where we updated the spec incorrectly then failed
> to make the code match the broken definition (the complete enums also
> need to match the final values, which are correct in the first part of
> the spec).  Yay for divergence.

Fixed version below.

-- 
Jesse Barnes, Intel Open Source Technology Center


[PATCH] glxproto: make GLX swap event struct match spec

2011-05-03 Thread Jesse Barnes
We only spec a 32 bit swap count, so drop the high sbc field.  Also make
the padding explicit (most compilers would have already done this since
it's not a packed structure, but making it explicit should prevent
surprises in the future).

Signed-off-by: Jesse Barnes 
---
 configure.ac |2 +-
 glxproto.h   |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index d88e6df..a3047e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([GLProto], [1.4.12], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AC_INIT([GLProto], [1.4.13], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE

diff --git a/glxproto.h b/glxproto.h
index 0ff44e3..dfa0647 100644
--- a/glxproto.h
+++ b/glxproto.h
@@ -1375,13 +1375,13 @@ typedef struct {
 BYTE pad;
 CARD16 sequenceNumber B16;
 CARD16 event_type B16;
+CARD16 pad2;
 CARD32 drawable;
 CARD32 ust_hi B32;
 CARD32 ust_lo B32;
 CARD32 msc_hi B32;
 CARD32 msc_lo B32;
-CARD32 sbc_hi B32;
-CARD32 sbc_lo B32;
+CARD32 sbc B32;
 } xGLXBufferSwapComplete;

 //
-- 
1.7.4.1




[PATCH] dri2proto: make DRI2 swap event match GLX spec

2011-05-03 Thread Jesse Barnes
Updated with explicit padding.

-- 
Jesse Barnes, Intel Open Source Technology Center


[PATCH] dri2proto: make DRI2 swap event match GLX spec

2011-05-03 Thread Jesse Barnes
We only spec a 32 bit sbc count, so drop the high bits.  Also make the
padding explicit.

Signed-off-by: Jesse Barnes 
---
 configure.ac |2 +-
 dri2proto.h  |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5b78d6b..9505f56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([DRI2Proto], [2.3], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AC_INIT([DRI2Proto], [2.4], 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE

diff --git a/dri2proto.h b/dri2proto.h
index 9708a4a..ff76355 100644
--- a/dri2proto.h
+++ b/dri2proto.h
@@ -290,13 +290,13 @@ typedef struct {
 CARD8 pad;
 CARD16 sequenceNumber B16;
 CARD16 event_type B16;
+CARD16 pad2;
 CARD32 drawable B32;
 CARD32 ust_hi B32;
 CARD32 ust_lo B32;
 CARD32 msc_hi B32;
 CARD32 msc_lo B32;
-CARD32 sbc_hi B32;
-CARD32 sbc_lo B32;
+CARD32 sbc B32;
 } xDRI2BufferSwapComplete;
 #define sz_xDRI2BufferSwapComplete 32

-- 
1.7.4.1




[PATCH] glxproto: make GLX swap event struct match spec

2011-05-03 Thread Keith Packard
On Tue, 3 May 2011 14:08:58 -0700, Jesse Barnes  
wrote:

> Fixed version below.

Reviewed-by: Keith Packard 

(assuming that the GLX protocol specification gets updated to match :-)

-- 
keith.packard at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20110503/2559815a/attachment.pgp>


multiple framebuffer drm maps

2011-05-03 Thread Tormod Volden
From: Tormod Volden 

Subject: [PATCH] drm: Add flag for multiple framebuffer support

Do not ignore the offset when looking for existing framebuffer maps
if the new _DRM_MATCH_FB_OFFSET flag is passed to drm_addmap_core.
---

> In commit 41c2e75e60200a860a74b7c84a6375c105e7437f "drm: Make
> drm_local_map use a resource_size_t offset" [1] the support for multiple
> _DRM_FRAMEBUFFER maps per device was taken away. This change made the
> savage drivers upset, since these cards have several apertures (the
> layout is different between card families) for which the kernel drm
> driver sets up maps. And these maps are now mixed up into one broken one.
> 
> The drivers (drm, ddx, mesa) for instance expects a framebuffer map and a
> tiled aperture map, and the broken maps show up as rendering corruption
> [2] and allocation failures. I have tried to come up with userland
> workarounds but it seems impossible since the kernel will only return
> the handle to a broken map and there is no way to remap it correctly.
> 
> Would it be possible to reintroduce this support? One solution could be
> a new flag _DRM_IGNORE_FB_OFFSET that can be used by those drivers that
> need it, or the other way around, a _DRM_CHECK_FB_OFFSET to be added
> by the savage drivers and others in the same situation. I can of course
> try to write a patch if people think this is a good idea.

This was what I had in mind. Probably controversial to add a new
flag for this, so more elegant ideas are welcome.

Cheers,
Tormod


 drivers/gpu/drm/drm_bufs.c |4 +++-
 include/drm/drm.h  |3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 3e257a5..9b7b257 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -60,8 +60,10 @@ static struct drm_map_list *drm_find_matching_map(struct 
drm_device *dev,
if (map->flags != _DRM_CONTAINS_LOCK)
break;
case _DRM_REGISTERS:
-   case _DRM_FRAME_BUFFER:
return entry;
+   case _DRM_FRAME_BUFFER:
+   if (!(map->flags & _DRM_MATCH_FB_OFFSET))
+   return entry;
default: /* Make gcc happy */
;
}
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 4be33b4..d4e2560 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -195,7 +195,8 @@ enum drm_map_flags {
_DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */
_DRM_CONTAINS_LOCK = 0x20,   /**< SHM page that contains lock */
_DRM_REMOVABLE = 0x40,   /**< Removable mapping */
-   _DRM_DRIVER = 0x80   /**< Managed by driver */
+   _DRM_DRIVER = 0x80,  /**< Managed by driver */
+   _DRM_MATCH_FB_OFFSET = 0x100 /**< Multiple framebuffer support */
 };

 struct drm_ctx_priv_map {
-- 
1.7.0.4



[PATCH] glxproto: make GLX swap event struct match spec

2011-05-03 Thread Jesse Barnes
On Tue, 03 May 2011 14:15:30 -0700
Keith Packard  wrote:

> On Tue, 3 May 2011 14:08:58 -0700, Jesse Barnes  
> wrote:
> 
> > Fixed version below.
> 
> Reviewed-by: Keith Packard 
> 
> (assuming that the GLX protocol specification gets updated to match :-)

Yeah, Ian is fixing up the padding there to match what our existing gcc
compiled implementations actually do (along with fixing the enums in
the second half to match the first :)

I'll push this out.

Thanks,
-- 
Jesse Barnes, Intel Open Source Technology Center


[Bug 34102] radeon drm/kms: please use suspend/hibernate notifiers for allocating memory in suspend routines

2011-05-03 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=34102





--- Comment #2 from Martin Steigerwald   2011-05-03 
21:33:06 ---
It depends on the view point. Compared with the pre KMS radeon driver this has
been a regression for me.

Thanks for trying to provide a workaround. I appreciate it.

I work-around this problem for now by using KDE 4.6 activities which make it
easy to close a set of application before hibernating and restoring them back
to their old state after resuming. Anyway, my next notebook will have 8 GB of
RAM and be 64-Bit, so this should not be much of the problem there. Just to
hint at you that a fix is not urgent for me. But I will have that T42 where the
problem happens at hand to test any workaround you provide.

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are watching the assignee of the bug.

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
--
___
Dri-devel mailing list
Dri-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[Bug 34102] radeon drm/kms: please use suspend/hibernate notifiers for allocating memory in suspend routines

2011-05-03 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=34102





--- Comment #3 from Rafael J. Wysocki   2011-05-03 21:44:15 ---
Created an attachment (id=56382)
 --> (https://bugzilla.kernel.org/attachment.cgi?id=56382)
PM / Hibernate: Add new sysfs attribute for controlling reserved memory

The attached patch adds a new knob, /sys/power/reserved_size, allowing you to
set the size of memory (in bytes) to be reserved for device drivers'
hibernation callbacks while counting the number of memory pages to allocate.

Please check if you can set it to such a number that hibernation will always
succeed on your machine.

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are watching the assignee of the bug.

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
--
___
Dri-devel mailing list
Dri-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[Bug 34102] radeon drm/kms: please use suspend/hibernate notifiers for allocating memory in suspend routines

2011-05-03 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=34102


Rafael J. Wysocki  changed:

   What|Removed |Added

 Status|NEW |NEEDINFO




-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are watching the assignee of the bug.

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
--
___
Dri-devel mailing list
Dri-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


multiple framebuffer drm maps

2011-05-03 Thread Tormod Volden
From: Tormod Volden 

Subject: [PATCH] drm/savage: Do not add framebuffer and aperture maps

Since multiple framebuffer maps are not supported any longer (commit
41c2e75e60200a860a74b7c84a6375c105e7437f) these maps would be broken,
and they are not used by the drm anyway.

Leave it to userspace to create one working map instead.

Signed-off-by: Tormod Volden 
---

And if we are absolutely sure that we do not want to support multiple
framebuffers maps, I would instead suggest this change to the savage
driver, which at least allows userspace to work around it.

Tormod

 drivers/gpu/drm/savage/savage_bci.c |   13 +
 drivers/gpu/drm/savage/savage_drv.h |2 --
 2 files changed, 1 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/savage/savage_bci.c 
b/drivers/gpu/drm/savage/savage_bci.c
index bf5f83e..91fe7b4 100644
--- a/drivers/gpu/drm/savage/savage_bci.c
+++ b/drivers/gpu/drm/savage/savage_bci.c
@@ -639,18 +639,7 @@ int savage_driver_firstopen(struct drm_device *dev)
if (ret)
return ret;

-   ret = drm_addmap(dev, fb_base, fb_size, _DRM_FRAME_BUFFER,
-_DRM_WRITE_COMBINING, &dev_priv->fb);
-   if (ret)
-   return ret;
-
-   ret = drm_addmap(dev, aperture_base, SAVAGE_APERTURE_SIZE,
-_DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING,
-&dev_priv->aperture);
-   if (ret)
-   return ret;
-
-   return ret;
+   return 0;
 }

 /*
diff --git a/drivers/gpu/drm/savage/savage_drv.h 
b/drivers/gpu/drm/savage/savage_drv.h
index df2aac6..2b49b3e 100644
--- a/drivers/gpu/drm/savage/savage_drv.h
+++ b/drivers/gpu/drm/savage/savage_drv.h
@@ -153,8 +153,6 @@ typedef struct drm_savage_private {
/* memory regions in physical memory */
drm_local_map_t *sarea;
drm_local_map_t *mmio;
-   drm_local_map_t *fb;
-   drm_local_map_t *aperture;
drm_local_map_t *status;
drm_local_map_t *agp_textures;
drm_local_map_t *cmd_dma;
-- 
1.7.0.4



  1   2   >