Re: [PATCH v3 1/4] drm: Add struct drm_rect and assorted utility functions

2013-04-05 Thread Ville Syrjälä
On Fri, Apr 05, 2013 at 01:51:24AM +0200, Laurent Pinchart wrote:
> Hi Ville,
> 
> On Thursday 04 April 2013 22:52:37 Ville Syrjälä wrote:
> > On Thu, Apr 04, 2013 at 06:38:15PM +0200, Laurent Pinchart wrote:
> > > On Wednesday 27 March 2013 17:46:22 ville.syrj...@linux.intel.com wrote:
> > > > From: Ville Syrjälä 
> > > > 
> > > > struct drm_rect represents a simple rectangle. The utility
> > > > functions are there to help driver writers.
> > > > 
> > > > v2: Moved the region stuff into its own file, made the smaller funcs
> > > > 
> > > > static inline, used 64bit maths in the scaled clipping function to
> > > > avoid overflows (instead it will saturate to INT_MIN or INT_MAX).
> > > > 
> > > > v3: Renamed drm_region to drm_rect, drm_region_clip to
> > > > 
> > > > drm_rect_intersect, and drm_region_subsample to drm_rect_downscale.
> > > > 
> > > > Signed-off-by: Ville Syrjälä 
> > > > ---
> > > > 
> > > >  drivers/gpu/drm/Makefile   |   3 +-
> > > >  drivers/gpu/drm/drm_rect.c |  96 +
> > > >  include/drm/drm_rect.h | 132 ++
> > > >  3 files changed, 230 insertions(+), 1 deletion(-)
> > > >  create mode 100644 drivers/gpu/drm/drm_rect.c
> > > >  create mode 100644 include/drm/drm_rect.h
> > > 
> > > [snip]
> > > 
> > > > diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
> > > > new file mode 100644
> > > > index 000..1ad4f5e
> > > > --- /dev/null
> > > > +++ b/drivers/gpu/drm/drm_rect.c
> > > > @@ -0,0 +1,96 @@
> > > 
> > > [snip]
> > > 
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +
> > > > +/**
> > > > + * drm_rect_intersect - intersect two rectangles
> > > > + * @r1: first rectangle
> > > > + * @r2: second rectangle
> > > > + *
> > > > + * Calculate the intersection of rectangles @r1 and @r2.
> > > > + * @r1 will be overwritten with the intersection.
> > > > + *
> > > > + * RETURNS:
> > > > + * @true if rectangle @r1 is still visible after the operation,
> > > > + * @false otherwise.
> > > 
> > > Isn't @ used for function parameters only ?
> > 
> > Not sure. It's been a while since I wrote these, and I guess I thought
> > that the @ was there just for higlighting purposes. Looks like the
> > documentation for the documentation system isn't that great :) so I
> > guess I'll need to try building the docs and see what happens.

I changed it to '%' since that's apparently meant for constants.

> > 
> > > > + */
> > > > +bool drm_rect_intersect(struct drm_rect *r1, const struct drm_rect *r2)
> > > > +{
> > > > +   r1->x1 = max(r1->x1, r2->x1);
> > > > +   r1->y1 = max(r1->y1, r2->y1);
> > > > +   r1->x2 = min(r1->x2, r2->x2);
> > > > +   r1->y2 = min(r1->y2, r2->y2);
> > > > +
> > > > +   return drm_rect_visible(r1);
> > > 
> > > Do callers always need that information, or should they instead call
> > > drm_rect_visible() explicitly when they need it ?
> > 
> > I suppose someone might call it w/o checking the visibility right away.
> > In my current use case I do use the return value, so it saves one line
> > of code :) But I don't mind changing it if you think that would be
> > better w/o the implicit drm_rect_visible() call.
> 
> I'm fine with whichever you think will be better. I just wanted to raise this 
> point to make sure it has been thought about.

I left this as is for now. We can split it later if there's need for it.


> > > > +/**
> > > > + * drm_rect_downscale - downscale a rect
> > > > + * @r: rect to be downscaled
> > > > + * @horz: horizontal downscale factor
> > > > + * @vert: vertical downscale factor
> > > > + *
> > > > + * Divide the coordinates of rect @r by @horz and @vert.
> > > > + */
> > > > +static inline void drm_rect_downscale(struct drm_rect *r, int horz, int
> > > > vert)
> > > 
> > > Shouldn't horz and vert be unsigned ?
> > 
> > Maybe. I'm actually not using this function currently (mainly because
> > our current hardware doesn't support planar formats) so I could just
> > remove the whole thing until it's needed.

I decided to leave the function as is. Using unsigned int for the
arguments would promote the numerator of the division to unsigned int
as well, and then the result would be wrong. So we'd either require
explicit casts to int, or we'd need to go with something like unsigned
short instead.

-- 
Ville Syrjälä
Intel OTC
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v4] drm: Add struct drm_rect and assorted utility functions

2013-04-05 Thread ville . syrjala
From: Ville Syrjälä 

struct drm_rect represents a simple rectangle. The utility
functions are there to help driver writers.

v2: Moved the region stuff into its own file, made the smaller funcs
static inline, used 64bit maths in the scaled clipping function to
avoid overflows (instead it will saturate to INT_MIN or INT_MAX).
v3: Renamed drm_region to drm_rect, drm_region_clip to
drm_rect_intersect, and drm_region_subsample to drm_rect_downscale.
v4: Renamed some function parameters, improve kernel-doc comments a bit,
and actually generate documentation for drm_rect.[ch].

Signed-off-by: Ville Syrjälä 
---
 Documentation/DocBook/drm.tmpl |   2 +
 drivers/gpu/drm/Makefile   |   3 +-
 drivers/gpu/drm/drm_rect.c |  96 ++
 include/drm/drm_rect.h | 132 +
 4 files changed, 232 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/drm_rect.c
 create mode 100644 include/drm/drm_rect.h

diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index f9df3b8..7c7af25 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -1653,6 +1653,8 @@ void intel_crt_init(struct drm_device *dev)
 
   KMS API Functions
 !Edrivers/gpu/drm/drm_crtc.c
+!Edrivers/gpu/drm/drm_rect.c
+!Finclude/drm/drm_rect.h
 
   
 
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 0d59b24..8f94018 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -12,7 +12,8 @@ drm-y   :=drm_auth.o drm_buffer.o drm_bufs.o 
drm_cache.o \
drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \
drm_crtc.o drm_modes.o drm_edid.o \
drm_info.o drm_debugfs.o drm_encoder_slave.o \
-   drm_trace_points.o drm_global.o drm_prime.o
+   drm_trace_points.o drm_global.o drm_prime.o \
+   drm_rect.o
 
 drm-$(CONFIG_COMPAT) += drm_ioc32.o
 drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
new file mode 100644
index 000..a9861bd
--- /dev/null
+++ b/drivers/gpu/drm/drm_rect.c
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2011-2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
+ * SOFTWARE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/**
+ * drm_rect_intersect - intersect two rectangles
+ * @r1: first rectangle
+ * @r2: second rectangle
+ *
+ * Calculate the intersection of rectangles @r1 and @r2.
+ * @r1 will be overwritten with the intersection.
+ *
+ * RETURNS:
+ * %true if rectangle @r1 is still visible after the operation,
+ * %false otherwise.
+ */
+bool drm_rect_intersect(struct drm_rect *r1, const struct drm_rect *r2)
+{
+   r1->x1 = max(r1->x1, r2->x1);
+   r1->y1 = max(r1->y1, r2->y1);
+   r1->x2 = min(r1->x2, r2->x2);
+   r1->y2 = min(r1->y2, r2->y2);
+
+   return drm_rect_visible(r1);
+}
+EXPORT_SYMBOL(drm_rect_intersect);
+
+/**
+ * drm_rect_clip_scaled - perform a scaled clip operation
+ * @src: source window rectangle
+ * @dst: destination window rectangle
+ * @clip: clip rectangle
+ * @hscale: horizontal scaling factor
+ * @vscale: vertical scaling factor
+ *
+ * Clip rectangle @dst by rectangle @clip. Clip rectangle @src by the
+ * same amounts multiplied by @hscale and @vscale.
+ *
+ * RETUTRNS:
+ * %true if rectangle @dst is still visible after being clipped,
+ * %false otherwise
+ */
+bool drm_rect_clip_scaled(struct drm_rect *src, struct drm_rect *dst,
+ const struct drm_rect *clip,
+ int hscale, int vscale)
+{
+   int diff;
+
+   diff = clip->x1 - dst->x1;
+   if (diff > 0) {
+   int64_t tmp = src->x1 + (int64_t) diff * hscale;
+   src->x1 = clamp_t(int64_t, tmp, INT_MIN, INT_MAX);
+   }
+   diff = clip->y

[Bug 61182] r600g causes KWin crashes with kernel 3.8

2013-04-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=61182

--- Comment #27 from Knut Andre Tidemann  ---
I've bisected the issue to this commit:

35840ab189595b817fa8b1a1df8cc92474a7c38d st/dri: implement MSAA for GLX/DRI2
framebuffers

The only thing that was recompiled was mesa, with the following options:

--with-dri-driverdir=/usr/lib/xorg/modules/dri
--with-gallium-drivers=r600,swrast
--with-dri-drivers=
--with-egl-platforms=drm,x11
--enable-gallium-egl --enable-shared-glapi
--enable-gallium-llvm
--enable-glx-tls
--enable-gles1
--enable-gles2
--enable-egl
--enable-dri
--enable-glx
--enable-xa
--enable-osmesa
--enable-gbm
--enable-texture-float

The issue was triggered by restarting kwin (kwin --replace) between each
compile and locking and unlocking the screen.

-- 
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 62997] Crashes on ARUBA unless R600_DEBUG=nodma

2013-04-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=62997

udo  changed:

   What|Removed |Added

Summary|GPU fault unless|Crashes on ARUBA unless
   |R600_DEBUG=nodma|R600_DEBUG=nodma

-- 
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 62997] Crashes on ARUBA unless R600_DEBUG=nodma

2013-04-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=62997

--- Comment #3 from udo  ---
With R600_DEBUG=nodma we get some mentions of GPU fault but not as often and no
crashing the whole PC.

-- 
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 62997] Crashes on ARUBA unless R600_DEBUG=nodma

2013-04-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=62997

--- Comment #4 from udo  ---
I shttps://bugs.freedesktop.org/show_bug.cgi?id=58667 a related issue?

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


Re: [PATCH v4 09/21] modetest: Allow specifying plane position

2013-04-05 Thread Ville Syrjälä
On Thu, Apr 04, 2013 at 06:24:24PM +0200, Laurent Pinchart wrote:
> Hi Ville,
> 
> On Wednesday 27 March 2013 19:15:31 Ville Syrjälä wrote:
> > On Wed, Mar 27, 2013 at 05:57:20PM +0200, Ville Syrjälä wrote:
> > > On Tue, Mar 19, 2013 at 03:55:50PM +0100, Laurent Pinchart wrote:
> > > > Extend the -P option to allow specifying the plane x and y offsets. The
> > > > position is optional, if not specified the plane will be positioned at
> > > > the center of the screen as before.
> > > > 
> > > > Signed-off-by: Laurent Pinchart 
> > > > ---
> > > > 
> > > >  tests/modetest/modetest.c | 72 ++--
> > > >  1 file changed, 57 insertions(+), 15 deletions(-)
> > > > 
> > > > diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
> > > > index 7153a40..f95efe6 100644
> > > > --- a/tests/modetest/modetest.c
> > > > +++ b/tests/modetest/modetest.c
> > > > @@ -645,6 +645,7 @@ struct connector_arg {
> > > > 
> > > >  struct plane_arg {
> > > >  
> > > > uint32_t con_id;  /* the id of connector to bind to */
> > > > 
> > > > +   uint32_t x, y;
> > > 
> > > I'd like the coordinates to allow negative values too.
> > 
> > Tested it and it actually works w/ negative values thanks to the way
> > strtoul() works :) The only real obstacle is the magic '-1' handling.
> > I guess you should just give up on magic values and add some flag to
> > indicate whether the user provided the coords or not.
> 
> Done :-) I'll post a new version.
> 
> > Also I must say that I don't like the syntax you used for specifying the
> > coords. '(' and ')' need to be escaped or the shell eats them. I've been
> > using the x11 -geometry syntax whenever I have to deal with the x/y/w/h
> > combination. It's a reasonably well known syntax and doesn't have these
> > shell issues. Maybe you could use it here as well.
> 
> Given that negative coordinates in the X geometry syntax don't match we what 
> need, should I keep the current syntax, abuse the X geometry syntax, or use 
> something else ?

Since no-one suggeste anything better, I vote for the abuse. I've
already gotten used to it :)

-- 
Ville Syrjälä
Intel OTC
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 62756] Rendering errors on rv790 with llvm and unigine heaven 3.0

2013-04-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=62756

--- Comment #9 from vincent  ---
Created attachment 77490
  --> https://bugs.freedesktop.org/attachment.cgi?id=77490&action=edit
Proposed patch

Does this patch solve the big regression ?

-- 
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 0/3] mgag200: bug fix, cleanup and managed devices

2013-04-05 Thread Christopher Harvey
Patch one is a simple bug fix for G200ER cards.

Patch two doesn't change any code

Patch three makes the mgag200 driver use managed devices where
possible. I'm not too sure how to test this one properly, other than
to just boot a bunch of boards and stare at the code changes for a
long while. Any testing hints are appreciated.

Christopher Harvey (3):
  drm/mgag200: Index 24 in extended CRTC registers is 24 in hex, not decimal.
  drm: Misc comment cleanup
  drm/mgag200: Convert to managed device resources where possible

 drivers/gpu/drm/mgag200/mgag200_drv.h  |  6 +++---
 drivers/gpu/drm/mgag200/mgag200_fb.c   |  9 +++--
 drivers/gpu/drm/mgag200/mgag200_main.c | 29 +
 drivers/gpu/drm/mgag200/mgag200_mode.c | 13 +++--
 include/drm/drm_crtc.h |  2 +-
 include/uapi/drm/drm_mode.h|  6 +++---
 6 files changed, 18 insertions(+), 47 deletions(-)

-- 
1.7.12.4

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


[PATCH 1/3] drm/mgag200: Index 24 in extended CRTC registers is 24 in hex, not decimal.

2013-04-05 Thread Christopher Harvey
This change properly enables the "requester" in G200ER cards that is
responsible for getting pixels out of memory and clocking them out to
the screen.

Signed-off-by: Christopher Harvey 
---
 drivers/gpu/drm/mgag200/mgag200_mode.c | 13 +++--
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c 
b/drivers/gpu/drm/mgag200/mgag200_mode.c
index 7337013..f988965 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -751,8 +751,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
int i;
unsigned char misc = 0;
unsigned char ext_vga[6];
-   unsigned char ext_vga_index24;
-   unsigned char dac_index90 = 0;
u8 bppshift;
 
static unsigned char dacvalue[] = {
@@ -803,7 +801,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
option2 = 0xb000;
break;
case G200_ER:
-   dac_index90 = 0;
break;
}
 
@@ -852,10 +849,8 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
WREG_DAC(i, dacvalue[i]);
}
 
-   if (mdev->type == G200_ER) {
-   WREG_DAC(0x90, dac_index90);
-   }
-
+   if (mdev->type == G200_ER)
+   WREG_DAC(0x90, 0);
 
if (option)
pci_write_config_dword(dev->pdev, PCI_MGA_OPTION, option);
@@ -952,8 +947,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
if (mdev->type == G200_WB)
ext_vga[1] |= 0x88;
 
-   ext_vga_index24 = 0x05;
-
/* Set pixel clocks */
misc = 0x2d;
WREG8(MGA_MISC_OUT, misc);
@@ -965,7 +958,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
}
 
if (mdev->type == G200_ER)
-   WREG_ECRT(24, ext_vga_index24);
+   WREG_ECRT(0x24, 0x5);
 
if (mdev->type == G200_EV) {
WREG_ECRT(6, 0);
-- 
1.7.12.4

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


[PATCH 2/3] drm: Misc comment cleanup

2013-04-05 Thread Christopher Harvey

Signed-off-by: Christopher Harvey 
---
 drivers/gpu/drm/mgag200/mgag200_drv.h | 6 +++---
 include/drm/drm_crtc.h| 2 +-
 include/uapi/drm/drm_mode.h   | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h 
b/drivers/gpu/drm/mgag200/mgag200_drv.h
index 4d932c4..dcfc973 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.h
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.h
@@ -215,7 +215,7 @@ mgag200_bo(struct ttm_buffer_object *bo)
 {
return container_of(bo, struct mgag200_bo, bo);
 }
-   /* mga_crtc.c */
+   /* mgag200_crtc.c */
 void mga_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
 u16 blue, int regno);
 void mga_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
@@ -225,7 +225,7 @@ void mga_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, 
u16 *green,
 int mgag200_modeset_init(struct mga_device *mdev);
 void mgag200_modeset_fini(struct mga_device *mdev);
 
-   /* mga_fbdev.c */
+   /* mgag200_fb.c */
 int mgag200_fbdev_init(struct mga_device *mdev);
 void mgag200_fbdev_fini(struct mga_device *mdev);
 
@@ -254,7 +254,7 @@ mgag200_dumb_mmap_offset(struct drm_file *file,
 struct drm_device *dev,
 uint32_t handle,
 uint64_t *offset);
-   /* mga_i2c.c */
+   /* mgag200_i2c.c */
 struct mga_i2c_chan *mgag200_i2c_create(struct drm_device *dev);
 void mgag200_i2c_destroy(struct mga_i2c_chan *i2c);
 
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index e3e0d65..8c7846b 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -310,7 +310,7 @@ struct drm_plane;
  * drm_crtc_funcs - control CRTCs for a given device
  * @save: save CRTC state
  * @restore: restore CRTC state
- * @reset: reset CRTC after state has been invalidate (e.g. resume)
+ * @reset: reset CRTC after state has been invalidated (e.g. resume)
  * @cursor_set: setup the cursor
  * @cursor_move: move the cursor
  * @gamma_set: specify color ramp for CRTC
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 3d6301b..090e533 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -367,13 +367,13 @@ struct drm_mode_mode_cmd {
  * depending on the value in flags different members are used.
  *
  * CURSOR_BO uses
- *crtc
+ *crtc_id
  *width
  *height
- *handle - if 0 turns the cursor of
+ *handle - if 0 turns the cursor off
  *
  * CURSOR_MOVE uses
- *crtc
+ *crtc_id
  *x
  *y
  */
-- 
1.7.12.4

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


[PATCH 3/3] drm/mgag200: Convert to managed device resources where possible

2013-04-05 Thread Christopher Harvey
Signed-off-by: Christopher Harvey 
---
 drivers/gpu/drm/mgag200/mgag200_fb.c   |  9 +++--
 drivers/gpu/drm/mgag200/mgag200_main.c | 29 +
 2 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c 
b/drivers/gpu/drm/mgag200/mgag200_fb.c
index a5a1f34..421beab 100644
--- a/drivers/gpu/drm/mgag200/mgag200_fb.c
+++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
@@ -246,7 +246,7 @@ int mgag200_fbdev_init(struct mga_device *mdev)
struct mga_fbdev *mfbdev;
int ret;
 
-   mfbdev = kzalloc(sizeof(struct mga_fbdev), GFP_KERNEL);
+   mfbdev = devm_kzalloc(mdev->dev->dev, sizeof(struct mga_fbdev), 
GFP_KERNEL);
if (!mfbdev)
return -ENOMEM;
 
@@ -255,10 +255,9 @@ int mgag200_fbdev_init(struct mga_device *mdev)
 
ret = drm_fb_helper_init(mdev->dev, &mfbdev->helper,
 mdev->num_crtc, MGAG200FB_CONN_LIMIT);
-   if (ret) {
-   kfree(mfbdev);
+   if (ret)
return ret;
-   }
+
drm_fb_helper_single_add_all_connectors(&mfbdev->helper);
 
/* disable all the possible outputs/crtcs before entering KMS mode */
@@ -275,6 +274,4 @@ void mgag200_fbdev_fini(struct mga_device *mdev)
return;
 
mga_fbdev_destroy(mdev->dev, mdev->mfbdev);
-   kfree(mdev->mfbdev);
-   mdev->mfbdev = NULL;
 }
diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c 
b/drivers/gpu/drm/mgag200/mgag200_main.c
index baf54d9..19db16d 100644
--- a/drivers/gpu/drm/mgag200/mgag200_main.c
+++ b/drivers/gpu/drm/mgag200/mgag200_main.c
@@ -80,15 +80,6 @@ static const struct drm_mode_config_funcs mga_mode_funcs = {
.fb_create = mgag200_user_framebuffer_create,
 };
 
-/* Unmap the framebuffer from the core and release the memory */
-static void mga_vram_fini(struct mga_device *mdev)
-{
-   pci_iounmap(mdev->dev->pdev, mdev->rmmio);
-   mdev->rmmio = NULL;
-   if (mdev->mc.vram_base)
-   release_mem_region(mdev->mc.vram_base, mdev->mc.vram_window);
-}
-
 static int mga_probe_vram(struct mga_device *mdev, void __iomem *mem)
 {
int offset;
@@ -144,7 +135,7 @@ static int mga_vram_init(struct mga_device *mdev)
remove_conflicting_framebuffers(aper, "mgafb", true);
kfree(aper);
 
-   if (!request_mem_region(mdev->mc.vram_base, mdev->mc.vram_window,
+   if (!devm_request_mem_region(mdev->dev->dev, mdev->mc.vram_base, 
mdev->mc.vram_window,
"mgadrmfb_vram")) {
DRM_ERROR("can't reserve VRAM\n");
return -ENXIO;
@@ -177,13 +168,13 @@ static int mgag200_device_init(struct drm_device *dev,
mdev->rmmio_base = pci_resource_start(mdev->dev->pdev, 1);
mdev->rmmio_size = pci_resource_len(mdev->dev->pdev, 1);
 
-   if (!request_mem_region(mdev->rmmio_base, mdev->rmmio_size,
+   if (!devm_request_mem_region(mdev->dev->dev, mdev->rmmio_base, 
mdev->rmmio_size,
"mgadrmfb_mmio")) {
DRM_ERROR("can't reserve mmio registers\n");
return -ENOMEM;
}
 
-   mdev->rmmio = pci_iomap(dev->pdev, 1, 0);
+   mdev->rmmio = pcim_iomap(dev->pdev, 1, 0);
if (mdev->rmmio == NULL)
return -ENOMEM;
 
@@ -192,10 +183,8 @@ static int mgag200_device_init(struct drm_device *dev,
mdev->reg_1e24 = RREG32(0x1e24);
 
ret = mga_vram_init(mdev);
-   if (ret) {
-   release_mem_region(mdev->rmmio_base, mdev->rmmio_size);
+   if (ret)
return ret;
-   }
 
mdev->bpp_shifts[0] = 0;
mdev->bpp_shifts[1] = 1;
@@ -204,12 +193,6 @@ static int mgag200_device_init(struct drm_device *dev,
return 0;
 }
 
-void mgag200_device_fini(struct mga_device *mdev)
-{
-   release_mem_region(mdev->rmmio_base, mdev->rmmio_size);
-   mga_vram_fini(mdev);
-}
-
 /*
  * Functions here will be called by the core once it's bound the driver to
  * a PCI device
@@ -221,7 +204,7 @@ int mgag200_driver_load(struct drm_device *dev, unsigned 
long flags)
struct mga_device *mdev;
int r;
 
-   mdev = kzalloc(sizeof(struct mga_device), GFP_KERNEL);
+   mdev = devm_kzalloc(dev->dev, sizeof(struct mga_device), GFP_KERNEL);
if (mdev == NULL)
return -ENOMEM;
dev->dev_private = (void *)mdev;
@@ -265,8 +248,6 @@ int mgag200_driver_unload(struct drm_device *dev)
mgag200_fbdev_fini(mdev);
drm_mode_config_cleanup(dev);
mgag200_mm_fini(mdev);
-   mgag200_device_fini(mdev);
-   kfree(mdev);
dev->dev_private = NULL;
return 0;
 }
-- 
1.7.12.4

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


[Bug 62756] Rendering errors on rv790 with llvm and unigine heaven 3.0

2013-04-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=62756

--- Comment #10 from Andy Furniss  ---
(In reply to comment #9)
> Created attachment 77490 [details] [review]
> Proposed patch
> 
> Does this patch solve the big regression ?

No, it's the same with that.

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


Re: BUG: kworker hangs the GPU on drm and i915 since 3.8.x under X11

2013-04-05 Thread Daniel Vetter
On Thu, Apr 4, 2013 at 11:53 PM, George Amanakis  wrote:
> Compiled und run the kernel as you instructed.
> Although the GPU did hang momentarily the dmesg showed no abnormalities.


Can you please explain in more detail what you mean by "did hang
momentarily"? If it's a real gpu hang it should be stuck until the
kernel resets the gpu, which will result in some dmesg noise. I'm a
bit at loss here what's going wrong ...
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 56437] LLVM ERROR: Cannot select: target intrinsic %llvm.AMDIL.mad when running Heaven

2013-04-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=56437

maxi...@free.fr changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #15 from maxi...@free.fr ---
Not seen in a while with vanilla mesa, closing.

-- 
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 58491] regression : r600g: work around ddx over alignment

2013-04-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=58491

--- Comment #10 from maxi...@free.fr ---
Should this stay open for reference?

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


Re: [PATCH 1/3] drm/mgag200: Index 24 in extended CRTC registers is 24 in hex, not decimal.

2013-04-05 Thread Mathieu Larouche


On 05/04/2013 10:51 AM, Christopher Harvey wrote:

This change properly enables the "requester" in G200ER cards that is
responsible for getting pixels out of memory and clocking them out to
the screen.

Signed-off-by: Christopher Harvey 


Signed-off-by: Mathieu Larouche 


---
  drivers/gpu/drm/mgag200/mgag200_mode.c | 13 +++--
  1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c 
b/drivers/gpu/drm/mgag200/mgag200_mode.c
index 7337013..f988965 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -751,8 +751,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
int i;
unsigned char misc = 0;
unsigned char ext_vga[6];
-   unsigned char ext_vga_index24;
-   unsigned char dac_index90 = 0;
u8 bppshift;
  
  	static unsigned char dacvalue[] = {

@@ -803,7 +801,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
option2 = 0xb000;
break;
case G200_ER:
-   dac_index90 = 0;
break;
}
  
@@ -852,10 +849,8 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,

WREG_DAC(i, dacvalue[i]);
}
  
-	if (mdev->type == G200_ER) {

-   WREG_DAC(0x90, dac_index90);
-   }
-
+   if (mdev->type == G200_ER)
+   WREG_DAC(0x90, 0);
  
  	if (option)

pci_write_config_dword(dev->pdev, PCI_MGA_OPTION, option);
@@ -952,8 +947,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
if (mdev->type == G200_WB)
ext_vga[1] |= 0x88;
  
-	ext_vga_index24 = 0x05;

-
/* Set pixel clocks */
misc = 0x2d;
WREG8(MGA_MISC_OUT, misc);
@@ -965,7 +958,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
}
  
  	if (mdev->type == G200_ER)

-   WREG_ECRT(24, ext_vga_index24);
+   WREG_ECRT(0x24, 0x5);
  
  	if (mdev->type == G200_EV) {

WREG_ECRT(6, 0);


--
Mathieu Larouche Ing./Eng.
Software Designer
Matrox Graphics Inc.
Phone : 514 822-6000 x7905
Email : mathieu.larou...@matrox.com

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


[PATCH] drm/radeon: add si tile mode array query v2

2013-04-05 Thread j . glisse
From: Jerome Glisse 

Allow userspace to query for the tile mode array so userspace can properly
compute surface pitch and alignment requirement depending on tiling.

v2: Make strict aliasing safer by casting to char when copying

Signed-off-by: Jerome Glisse 
---
 drivers/gpu/drm/radeon/radeon.h |   1 +
 drivers/gpu/drm/radeon/radeon_drv.c |   3 +-
 drivers/gpu/drm/radeon/radeon_kms.c | 158 +++-
 drivers/gpu/drm/radeon/si.c |   2 +
 include/uapi/drm/radeon_drm.h   |  20 +
 5 files changed, 109 insertions(+), 75 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 8263af3..961659e 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1443,6 +1443,7 @@ struct si_asic {
unsigned multi_gpu_tile_size;
 
unsigned tile_config;
+   uint32_t tile_mode_array[32];
 };
 
 union radeon_asic_config {
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index 66a7f0f..1e48ab6 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -71,9 +71,10 @@
  *   2.28.0 - r600-eg: Add MEM_WRITE packet support
  *   2.29.0 - R500 FP16 color clear registers
  *   2.30.0 - fix for FMASK texturing
+ *   2.31.0 - Add SI tiling mode array query
  */
 #define KMS_DRIVER_MAJOR   2
-#define KMS_DRIVER_MINOR   30
+#define KMS_DRIVER_MINOR   31
 #define KMS_DRIVER_PATCHLEVEL  0
 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
 int radeon_driver_unload_kms(struct drm_device *dev);
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
b/drivers/gpu/drm/radeon/radeon_kms.c
index c75cb2c..63e28e0 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -176,80 +176,65 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, 
struct drm_file *filp)
struct radeon_device *rdev = dev->dev_private;
struct drm_radeon_info *info = data;
struct radeon_mode_info *minfo = &rdev->mode_info;
-   uint32_t value, *value_ptr;
-   uint64_t value64, *value_ptr64;
+   uint32_t *value, value_tmp, *value_ptr, value_size;
+   uint64_t value64;
struct drm_crtc *crtc;
int i, found;
 
-   /* TIMESTAMP is a 64-bit value, needs special handling. */
-   if (info->request == RADEON_INFO_TIMESTAMP) {
-   if (rdev->family >= CHIP_R600) {
-   value_ptr64 = (uint64_t*)((unsigned long)info->value);
-   value64 = radeon_get_gpu_clock_counter(rdev);
-
-   if (DRM_COPY_TO_USER(value_ptr64, &value64, 
sizeof(value64))) {
-   DRM_ERROR("copy_to_user %s:%u\n", __func__, 
__LINE__);
-   return -EFAULT;
-   }
-   return 0;
-   } else {
-   DRM_DEBUG_KMS("timestamp is r6xx+ only!\n");
-   return -EINVAL;
-   }
-   }
-
value_ptr = (uint32_t *)((unsigned long)info->value);
-   if (DRM_COPY_FROM_USER(&value, value_ptr, sizeof(value))) {
-   DRM_ERROR("copy_from_user %s:%u\n", __func__, __LINE__);
-   return -EFAULT;
-   }
+   value = &value_tmp;
+   value_size = sizeof(uint32_t);
 
switch (info->request) {
case RADEON_INFO_DEVICE_ID:
-   value = dev->pci_device;
+   *value = dev->pci_device;
break;
case RADEON_INFO_NUM_GB_PIPES:
-   value = rdev->num_gb_pipes;
+   *value = rdev->num_gb_pipes;
break;
case RADEON_INFO_NUM_Z_PIPES:
-   value = rdev->num_z_pipes;
+   *value = rdev->num_z_pipes;
break;
case RADEON_INFO_ACCEL_WORKING:
/* xf86-video-ati 6.13.0 relies on this being false for 
evergreen */
if ((rdev->family >= CHIP_CEDAR) && (rdev->family <= 
CHIP_HEMLOCK))
-   value = false;
+   *value = false;
else
-   value = rdev->accel_working;
+   *value = rdev->accel_working;
break;
case RADEON_INFO_CRTC_FROM_ID:
+   if (DRM_COPY_FROM_USER(value, value_ptr, sizeof(uint32_t))) {
+   DRM_ERROR("copy_from_user %s:%u\n", __func__, __LINE__);
+   return -EFAULT;
+   }
for (i = 0, found = 0; i < rdev->num_crtc; i++) {
crtc = (struct drm_crtc *)minfo->crtcs[i];
-   if (crtc && crtc->base.id == value) {
+   if (crtc && crtc->base.id == *value) {
struct radeon_crtc *radeon_crtc = 
to_radeon_crtc(crtc);
-   value = radeon_crtc->crtc_id;
+

[PATCH] radeon: add si tiling support v3

2013-04-05 Thread j . glisse
From: Jerome Glisse 

v2: Only writte tile index if flags for it is set
v3: Remove useless allow2d scanout flags

Signed-off-by: Jerome Glisse 
---
 include/drm/radeon_drm.h |  61 +
 radeon/radeon_surface.c  | 658 +++
 radeon/radeon_surface.h  |  31 +++
 3 files changed, 705 insertions(+), 45 deletions(-)

diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 00d66b3..ff3ce3a 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -509,6 +509,7 @@ typedef struct {
 #define DRM_RADEON_GEM_SET_TILING  0x28
 #define DRM_RADEON_GEM_GET_TILING  0x29
 #define DRM_RADEON_GEM_BUSY0x2a
+#define DRM_RADEON_GEM_VA  0x2b
 
 #define DRM_IOCTL_RADEON_CP_INITDRM_IOW( DRM_COMMAND_BASE + 
DRM_RADEON_CP_INIT, drm_radeon_init_t)
 #define DRM_IOCTL_RADEON_CP_START   DRM_IO(  DRM_COMMAND_BASE + 
DRM_RADEON_CP_START)
@@ -550,6 +551,7 @@ typedef struct {
 #define DRM_IOCTL_RADEON_SET_TILINGDRM_IOWR(DRM_COMMAND_BASE + 
DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling)
 #define DRM_IOCTL_RADEON_GET_TILINGDRM_IOWR(DRM_COMMAND_BASE + 
DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling)
 #define DRM_IOCTL_RADEON_GEM_BUSY  DRM_IOWR(DRM_COMMAND_BASE + 
DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy)
+#define DRM_IOCTL_RADEON_GEM_VADRM_IOWR(DRM_COMMAND_BASE + 
DRM_RADEON_GEM_VA, struct drm_radeon_gem_va)
 
 typedef struct drm_radeon_init {
enum {
@@ -882,6 +884,27 @@ struct drm_radeon_gem_pwrite {
uint64_t data_ptr;
 };
 
+#define RADEON_VA_MAP  1
+#define RADEON_VA_UNMAP2
+
+#define RADEON_VA_RESULT_OK0
+#define RADEON_VA_RESULT_ERROR 1
+#define RADEON_VA_RESULT_VA_EXIST  2
+
+#define RADEON_VM_PAGE_VALID   (1 << 0)
+#define RADEON_VM_PAGE_READABLE(1 << 1)
+#define RADEON_VM_PAGE_WRITEABLE   (1 << 2)
+#define RADEON_VM_PAGE_SYSTEM  (1 << 3)
+#define RADEON_VM_PAGE_SNOOPED (1 << 4)
+
+struct drm_radeon_gem_va {
+   uint32_thandle;
+   uint32_toperation;
+   uint32_tvm_id;
+   uint32_tflags;
+   uint64_toffset;
+};
+
 #define RADEON_CHUNK_ID_RELOCS 0x01
 #define RADEON_CHUNK_ID_IB 0x02
 
@@ -916,6 +939,26 @@ struct drm_radeon_cs {
 #define RADEON_INFO_ACCEL_WORKING2 0x05
 #define RADEON_INFO_TILING_CONFIG  0x06
 #define RADEON_INFO_WANT_HYPERZ0x07
+#define RADEON_INFO_WANT_CMASK 0x08 /* get access to CMASK on r300 */
+#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 */
+#define RADEON_INFO_BACKEND_MAP0x0d /* pipe to backend map, 
needed by mesa */
+/* virtual address start, va < start are reserved by the kernel */
+#define RADEON_INFO_VA_START   0x0e
+/* maximum size of ib using the virtual memory cs */
+#define RADEON_INFO_IB_VM_MAX_SIZE 0x0f
+/* max pipes - needed for compute shaders */
+#define RADEON_INFO_MAX_PIPES  0x10
+/* timestamp for GL_ARB_timer_query (OpenGL), returns the current GPU clock */
+#define RADEON_INFO_TIMESTAMP  0x11
+/* max shader engines (SE) - needed for geometry shaders, etc. */
+#define RADEON_INFO_MAX_SE 0x12
+/* max SH per SE */
+#define RADEON_INFO_MAX_SH_PER_SE  0x13
+/* SI tile mode array */
+#define RADEON_INFO_SI_TILE_MODE_ARRAY 0x14
 
 struct drm_radeon_info {
uint32_trequest;
@@ -923,4 +966,22 @@ struct drm_radeon_info {
uint64_tvalue;
 };
 
+/* Those correspond to the tile index to use, this is to explicitly state
+ * the API that is implicitly defined by the tile mode array.
+ */
+#define SI_TILE_MODE_COLOR_LINEAR_ALIGNED  8
+#define SI_TILE_MODE_COLOR_1D  13
+#define SI_TILE_MODE_COLOR_1D_SCANOUT  9
+#define SI_TILE_MODE_COLOR_2D_8BPP 14
+#define SI_TILE_MODE_COLOR_2D_16BPP15
+#define SI_TILE_MODE_COLOR_2D_32BPP16
+#define SI_TILE_MODE_COLOR_2D_64BPP17
+#define SI_TILE_MODE_COLOR_2D_SCANOUT_16BPP11
+#define SI_TILE_MODE_COLOR_2D_SCANOUT_32BPP12
+#define SI_TILE_MODE_DEPTH_STENCIL_1D  4
+#define SI_TILE_MODE_DEPTH_STENCIL_2D  0
+#define SI_TILE_MODE_DEPTH_STENCIL_2D_2AA  3
+#define SI_TILE_MODE_DEPTH_STENCIL_2D_4AA  3
+#define SI_TILE_MODE_DEPTH_STENCIL_2D_8AA  2
+
 #endif
diff --git a/radeon/radeon_surface.c b/radeon/radeon_surface.c
index 5935c23..e567fba 100644
--- a/radeon/radeon_surface.c
+++ b/radeon/radeon_surface.c
@@ -83,12 +83,14 @@ typedef int (*hw_best_surface_t)(struct 
r

[Bug 62959] r600g (HD 6950 Cayman) fails piglit tests and hangs system

2013-04-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=62959

--- Comment #13 from Marek Olšák  ---
This kernel patch fixes everything:

diff --git a/drivers/gpu/drm/radeon/radeon_cs.c
b/drivers/gpu/drm/radeon/radeon_cs.c
index 70d3824..748a933 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -459,6 +459,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device
*rdev,
if (r) {
goto out;
}
+   radeon_fence_wait(vm->fence, false);
radeon_cs_sync_rings(parser);
radeon_ib_sync_to(&parser->ib, vm->fence);
radeon_ib_sync_to(&parser->ib, radeon_vm_grab_id(

It's merely a workaround and it kills performance, but it's now pretty clear
there is a synchronization issue in the kernel affecting all NI chips with
virtual memory, and it should now be easier to find the bug. I'm not really
familiar with the kernel code. I had to do some code reading before I found the
right place to put the wait call in.

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


Re: [PATCH v4] drm: Add struct drm_rect and assorted utility functions

2013-04-05 Thread Laurent Pinchart
Hi Ville,

Thanks for the patch.

On Friday 05 April 2013 16:19:36 ville.syrj...@linux.intel.com wrote:
> From: Ville Syrjälä 
> 
> struct drm_rect represents a simple rectangle. The utility
> functions are there to help driver writers.
> 
> v2: Moved the region stuff into its own file, made the smaller funcs
> static inline, used 64bit maths in the scaled clipping function to
> avoid overflows (instead it will saturate to INT_MIN or INT_MAX).
> v3: Renamed drm_region to drm_rect, drm_region_clip to
> drm_rect_intersect, and drm_region_subsample to drm_rect_downscale.
> v4: Renamed some function parameters, improve kernel-doc comments a bit,
> and actually generate documentation for drm_rect.[ch].
> 
> Signed-off-by: Ville Syrjälä 
> ---
>  Documentation/DocBook/drm.tmpl |   2 +
>  drivers/gpu/drm/Makefile   |   3 +-
>  drivers/gpu/drm/drm_rect.c |  96 ++
>  include/drm/drm_rect.h | 132 ++
>  4 files changed, 232 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/gpu/drm/drm_rect.c
>  create mode 100644 include/drm/drm_rect.h

[snip]

> diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
> new file mode 100644
> index 000..a9861bd
> --- /dev/null
> +++ b/drivers/gpu/drm/drm_rect.c

[snip]

> +/**
> + * drm_rect_clip_scaled - perform a scaled clip operation
> + * @src: source window rectangle
> + * @dst: destination window rectangle
> + * @clip: clip rectangle
> + * @hscale: horizontal scaling factor
> + * @vscale: vertical scaling factor
> + *
> + * Clip rectangle @dst by rectangle @clip. Clip rectangle @src by the
> + * same amounts multiplied by @hscale and @vscale.
> + *
> + * RETUTRNS:

s/RETUTRNS/RETURNS/

> + * %true if rectangle @dst is still visible after being clipped,
> + * %false otherwise
> + */

Otherwise,

Reviewed-by: Laurent Pinchart 

-- 
Regards,

Laurent Pinchart

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


[Bug 63192] New: [nouveau] drmModeSetCursor->nouveau_bo_rd32->ioread32 provides high cpu load when using weston drm-compositor

2013-04-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=63192

  Priority: medium
Bug ID: 63192
  Assignee: dri-devel@lists.freedesktop.org
   Summary: [nouveau] drmModeSetCursor->nouveau_bo_rd32->ioread32
provides high cpu load when using weston
drm-compositor
  Severity: normal
Classification: Unclassified
OS: Linux (All)
  Reporter: vova7...@mail.ru
  Hardware: x86-64 (AMD64)
Status: NEW
   Version: DRI CVS
 Component: DRM/other
   Product: DRI

Weston runned in drm-mode provide very high cpu load on mouse moving. I don`t
think that the bug of weston, seems problem in nouveau drm. At launch weston
have a log:

...
[24465.734894] nouveau W[   PFIFO][:02:00.0] INTR 0x0001: 0x0004
[24465.748153] nouveau W[   PFIFO][:02:00.0] INTR 0x0001: 0x0004
[24521.950788] nouveau W[   PFIFO][:02:00.0] INTR 0x0001: 0x0004
[24521.955032] nouveau W[   PFIFO][:02:00.0] INTR 0x0001: 0x0004
...


ioread32_native(ioread32 on litle-endian) using 100% of cpu core. If in weston
comment out drmModeSetCursor - cpu load is normal, but no see cursor ofcourse.
They copying cursor(64x64) from bo-object. Seems TTM iomem access provide very
high cpu load... On radeon it works smoothly and no have very high cpu load.


Kernel 3.9-rc5 (x86_64)
Wayland/Weston: git
Mesa: git
libdrm: git

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


Graphics and Display Microconference @LPC2013

2013-04-05 Thread Laurent Pinchart
Hello everybody,

I've submitted a graphics and display microconference for the Linux Plumbers 
Conference 2013, and just realized that I haven't announced the proposal on 
the dri-devel and linux-fbdev mailing lists.

The proposal is available at 
http://wiki.linuxplumbersconf.org/2013:graphics_and_display. Please send me 
feedback on the proposed topics, and add your name to the attendees list if 
you plan to participate.

-- 
Regards,

Laurent Pinchart

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


[Bug 61182] r600g causes KWin crashes with kernel 3.8

2013-04-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=61182

--- Comment #28 from Stan  ---
Here happens similar thing. KWin with desktop effects enabled crashes on login
to KDE and after resume from suspend with 100% reproductibility.

My config Fedora 18. 
 - kernel-PAE-3.8.5-201.fc18.i686
 - libdrm-2.4.42-1.fc18.i686
 - xorg-x11-server-Xorg-1.13.3-2.fc18.i686
 - mesa-dri-drivers-9.1-3.fc18.i686
 - kde 4.10.2-1

Backtrace:
Application: KWin (kwin), signal: Bus error
Using host libthread_db library "/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0xb769c780 (LWP 18403))]

Thread 2 (Thread 0xb1644b40 (LWP 18417)):
#0  0xb7784424 in __kernel_vsyscall ()
#1  0x4145e18c in pthread_cond_wait@@GLIBC_2.3.2 () at
../nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S:171
#2  0xb2d5c20c in pipe_semaphore_wait (sema=0xb4190b50) at
../../../../../src/gallium/auxiliary/os/os_thread.h:433
#3  radeon_drm_cs_emit_ioctl (param=0xb4170008) at radeon_drm_cs.c:416
#4  0x4145aaff in start_thread (arg=0xb1644b40) at pthread_create.c:308
#5  0x4138a0be in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:132

Thread 1 (Thread 0xb769c780 (LWP 18403)):
[KCrash Handler]
#7  __memset_sse2 () at ../sysdeps/i386/i686/multiarch/memset-sse2.S:331
#8  0xb2d2f186 in r600_texture_create_object (screen=screen@entry=0x9342718,
base=base@entry=0xbfc4b1e4,
pitch_in_bytes_override=pitch_in_bytes_override@entry=0, buf=buf@entry=0x0,
alloc_bo=alloc_bo@entry=1 '\001', surface=surface@entry=0xbfc4a4d8) at
r600_texture.c:460
#9  0xb2d2f49c in r600_texture_create (screen=screen@entry=0x9342718,
templ=templ@entry=0xbfc4b1e4) at r600_texture.c:550
#10 0xb2d28564 in r600_resource_create (screen=0x9342718, templ=0xbfc4b1e4) at
r600_resource.c:37
#11 0xb2d5650f in dri2_drawable_process_buffers (att_count=1, atts=0xbfc4b2a4,
buffer_count=1, buffers=0x94cccbc, drawable=) at dri2.c:254
#12 dri2_allocate_textures (drawable=0x94dad88, statts=0xbfc4b2a4,
statts_count=1) at dri2.c:404
#13 0xb2d5788c in dri_st_framebuffer_validate (stfbi=0x94dad88,
statts=0xbfc4b2a4, count=1, out=0x0) at dri_drawable.c:81
#14 0xb2d57ab7 in dri_drawable_validate_att (statt=ST_ATTACHMENT_FRONT_LEFT,
drawable=0x94dad88) at dri_drawable.c:206
#15 dri_set_tex_buffer2 (pDRICtx=0x9310270, target=3553, format=8409,
dPriv=0x948c7a0) at dri_drawable.c:220
#16 0xb771b770 in dri2_bind_tex_image (dpy=0x91897e8, drawable=29360181,
buffer=8414, attrib_list=0x0) at dri2_glx.c:1004
#17 0xb76efa93 in __glXBindTexImageEXT (dpy=0x91897e8,
drawable=drawable@entry=29360181, buffer=buffer@entry=8414,
attrib_list=attrib_list@entry=0x0) at glxcmds.c:2370
#18 0x447d5a8c in loadTexture (depth=24, size=..., pix=@0xbfc4b40c: 29360179,
this=0x9494f08) at /usr/src/debug/kde-workspace-4.10.2/kwin/glxbackend.cpp:716
#19 KWin::GlxTexture::loadTexture (this=0x9494f08, pix=@0xbfc4b40c: 29360179,
size=..., depth=24) at
/usr/src/debug/kde-workspace-4.10.2/kwin/glxbackend.cpp:658
#20 0x447ca65a in KWin::SceneOpenGL::Texture::load (this=0x92df3a8,
pix=@0xbfc4b40c: 29360179, size=..., depth=24, region=...) at
/usr/src/debug/kde-workspace-4.10.2/kwin/scene_opengl.cpp:764
#21 0x447ccaf7 in KWin::SceneOpenGL::Window::bindTexture (this=0x94ccbd0) at
/usr/src/debug/kde-workspace-4.10.2/kwin/scene_opengl.cpp:822
#22 0x447d385c in KWin::SceneOpenGL::Window::performPaint (this=0x94ccbd0,
mask=1, region=..., data=...) at
/usr/src/debug/kde-workspace-4.10.2/kwin/scene_opengl.cpp:931
#23 0x447cbc9d in KWin::SceneOpenGL2::performPaintWindow
(this=this@entry=0x93b0348, w=w@entry=0x94dbdc8, mask=mask@entry=1, region=...,
data=...) at /usr/src/debug/kde-workspace-4.10.2/kwin/scene_opengl.cpp:566
#24 0x447cbe57 in KWin::SceneOpenGL2::finalDrawWindow (this=0x93b0348,
w=w@entry=0x94dbdc8, mask=mask@entry=1, region=..., data=...) at
/usr/src/debug/kde-workspace-4.10.2/kwin/scene_opengl.cpp:551
#25 0x447e3018 in KWin::EffectsHandlerImpl::drawWindow (this=0x94d9ff0,
w=w@entry=0x94dbdc8, mask=mask@entry=1, region=..., data=...) at
/usr/src/debug/kde-workspace-4.10.2/kwin/effects.cpp:318
#26 0x447bd1e3 in KWin::Scene::finalPaintWindow (this=0x93b0348, w=0x94dbdc8,
mask=1, region=..., data=...) at
/usr/src/debug/kde-workspace-4.10.2/kwin/scene.cpp:449
#27 0x447e3443 in KWin::EffectsHandlerImpl::paintWindow (this=0x94d9ff0,
w=0x94dbdc8, mask=mask@entry=1, region=..., data=...) at
/usr/src/debug/kde-workspace-4.10.2/kwin/effects.cpp:281
#28 0x447c0398 in KWin::Scene::paintWindow (this=this@entry=0x93b0348,
w=0x94ccbd0, mask=1, region=..., quads=...) at
/usr/src/debug/kde-workspace-4.10.2/kwin/scene.cpp:356
#29 0x447bf571 in KWin::Scene::paintSimpleScreen (this=this@entry=0x93b0348,
orig_mask=orig_mask@entry=0, region=...) at
/usr/src/debug/kde-workspace-4.10.2/kwin/scene.cpp:342
#30 0x447bd114 in KWin::Scene::finalPaintScreen (this=0x93b0348, mask=0,
region=..., data=...) at /usr/src/debug/kde-workspace-4.10.2/kwin/scene.cpp:186
#31 0x447e3163 in KWin::EffectsHandlerImpl::paintScreen (this=0x94d9ff0,
mask=0, region=..., data=...) at
/usr

[Bug 49981] On HD6850, Power Profile doesn't change if 2 screen is attached.

2013-04-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=49981

--- Comment #32 from Benjamin Lee  ---
On my TURKS chip (HD 6750M) the radeon_pm_print_states() output shows that I
should be using POWER_STATE_TYPE_POWERSAVE instead of POWER_STATE_TYPE_BATTERY.

I don't know if this is true for all TURKS chips or what other chips are
affected, but the following patch against 3.9-rc5 fixes power profiles on my
MacBookPro8,2.

diff -ruN linux-3.9-rc5.orig/drivers/gpu/drm/radeon/evergreen.c
linux-3.9-rc5/drivers/gpu/drm/radeon/evergreen.c
--- linux-3.9-rc5.orig/drivers/gpu/drm/radeon/evergreen.c   2013-03-31
15:12:43.0 -0700
+++ linux-3.9-rc5/drivers/gpu/drm/radeon/evergreen.c2013-04-05
17:45:04.179779729 -0700
@@ -343,7 +343,9 @@
 * MH and SH.  Difference is that we always use the high clock index
for
 * mclk.
 */
-   if (rdev->flags & RADEON_IS_MOBILITY)
+   if ((rdev->flags & RADEON_IS_MOBILITY) && (rdev->family == CHIP_TURKS))
+   idx = radeon_pm_get_type_index(rdev,
POWER_STATE_TYPE_POWERSAVE, 0);
+   else if (rdev->flags & RADEON_IS_MOBILITY)
idx = radeon_pm_get_type_index(rdev, POWER_STATE_TYPE_BATTERY,
0);
else
idx = radeon_pm_get_type_index(rdev,
POWER_STATE_TYPE_PERFORMANCE, 0);

-- 
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 61182] r600g causes KWin crashes with kernel 3.8

2013-04-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=61182

--- Comment #29 from Marek Olšák  ---
r600g crashes because it's mapping a MSAA resource in order to clear the CMASK
to zeros. The problem is MSAA resources occupy a lot of memory and the system
is failing to map the whole resource.

The solution is easy: we should clear the CMASK and HTILE buffers using DMA or
streamout and not with the CPU.

-- 
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 55941] Hybrid graphics i915/radeon. Switch to radeon results to black screen

2013-04-05 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=55941


laurent.deb...@gmail.com changed:

   What|Removed |Added

 CC||laurent.deb...@gmail.com




--- Comment #4 from laurent.deb...@gmail.com  2013-04-06 01:55:28 ---
I have  been very puzzled when reading your last message Alex, since I got (on
debian) the exact same problem with a Mux system intel Ironlake/radeon Hd5650.
The same issue occurs with kernel 3.7.6 (compiled by me) while the switch works
correctly one the "distrib" kernel 3.2.0-4-ppae. Another issue 
appears with kernel 3.8.5 (with the NEW default modesetting bla for radeon..)
but in that case  X seems to crash (well i don't really now what's happening
only got the little  "-" on the top left of my screen)
I would be glad to give any addiotionnal infos relevant or to file a bug
myself.


(In reply to comment #3)
> You have a muxless powerxpress system so there are no displays physically
> connected to the radeon card.  The only way to utilize the radeon card is for
> offscreen rendering (radeon renders application frame and the frame is copied
> to the intel card for display).  You need the new gpu hotplug features in
> xserver 1.13.x or 1.14 to utilize the card in that manner.

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


[Bug 55941] Hybrid graphics i915/radeon. Switch to radeon results to black screen

2013-04-05 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=55941





--- Comment #5 from laurent.deb...@gmail.com  2013-04-06 02:03:48 ---
By the way this it should be the duplicated of Bug 55311.

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


[PATCH v3 1/4] drm: Add struct drm_rect and assorted utility functions

2013-04-05 Thread Laurent Pinchart
Hi Ville,

On Thursday 04 April 2013 22:52:37 Ville Syrj?l? wrote:
> On Thu, Apr 04, 2013 at 06:38:15PM +0200, Laurent Pinchart wrote:
> > On Wednesday 27 March 2013 17:46:22 ville.syrjala at linux.intel.com wrote:
> > > From: Ville Syrj?l? 
> > > 
> > > struct drm_rect represents a simple rectangle. The utility
> > > functions are there to help driver writers.
> > > 
> > > v2: Moved the region stuff into its own file, made the smaller funcs
> > > 
> > > static inline, used 64bit maths in the scaled clipping function to
> > > avoid overflows (instead it will saturate to INT_MIN or INT_MAX).
> > > 
> > > v3: Renamed drm_region to drm_rect, drm_region_clip to
> > > 
> > > drm_rect_intersect, and drm_region_subsample to drm_rect_downscale.
> > > 
> > > Signed-off-by: Ville Syrj?l? 
> > > ---
> > > 
> > >  drivers/gpu/drm/Makefile   |   3 +-
> > >  drivers/gpu/drm/drm_rect.c |  96 +
> > >  include/drm/drm_rect.h | 132 ++
> > >  3 files changed, 230 insertions(+), 1 deletion(-)
> > >  create mode 100644 drivers/gpu/drm/drm_rect.c
> > >  create mode 100644 include/drm/drm_rect.h
> > 
> > [snip]
> > 
> > > diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
> > > new file mode 100644
> > > index 000..1ad4f5e
> > > --- /dev/null
> > > +++ b/drivers/gpu/drm/drm_rect.c
> > > @@ -0,0 +1,96 @@
> > 
> > [snip]
> > 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +
> > > +/**
> > > + * drm_rect_intersect - intersect two rectangles
> > > + * @r1: first rectangle
> > > + * @r2: second rectangle
> > > + *
> > > + * Calculate the intersection of rectangles @r1 and @r2.
> > > + * @r1 will be overwritten with the intersection.
> > > + *
> > > + * RETURNS:
> > > + * @true if rectangle @r1 is still visible after the operation,
> > > + * @false otherwise.
> > 
> > Isn't @ used for function parameters only ?
> 
> Not sure. It's been a while since I wrote these, and I guess I thought
> that the @ was there just for higlighting purposes. Looks like the
> documentation for the documentation system isn't that great :) so I
> guess I'll need to try building the docs and see what happens.
> 
> > > + */
> > > +bool drm_rect_intersect(struct drm_rect *r1, const struct drm_rect *r2)
> > > +{
> > > + r1->x1 = max(r1->x1, r2->x1);
> > > + r1->y1 = max(r1->y1, r2->y1);
> > > + r1->x2 = min(r1->x2, r2->x2);
> > > + r1->y2 = min(r1->y2, r2->y2);
> > > +
> > > + return drm_rect_visible(r1);
> > 
> > Do callers always need that information, or should they instead call
> > drm_rect_visible() explicitly when they need it ?
> 
> I suppose someone might call it w/o checking the visibility right away.
> In my current use case I do use the return value, so it saves one line
> of code :) But I don't mind changing it if you think that would be
> better w/o the implicit drm_rect_visible() call.

I'm fine with whichever you think will be better. I just wanted to raise this 
point to make sure it has been thought about.

> > > +}
> > > +EXPORT_SYMBOL(drm_rect_intersect);
> > > +
> > > +/**
> > > + * drm_rect_clip_scaled - perform a scaled clip operation
> > > + * @src: source window rectangle
> > > + * @dst: destination window rectangle
> > > + * @clip: clip rectangle
> > > + * @hscale: horizontal scaling factor
> > > + * @vscale: vertical scaling factor
> > > + *
> > > + * Clip rectangle @dst by rectangle @clip. Clip rectangle @src by the
> > > + * same amounts multiplied by @hscale and @vscale.
> > > + *
> > > + * RETUTRNS:
> > > + * @true if rectangle @dst is still visible after being clipped,
> > > + * @false otherwise
> > > + */
> > > +bool drm_rect_clip_scaled(struct drm_rect *src, struct drm_rect *dst,
> > > +   const struct drm_rect *clip,
> > > +   int hscale, int vscale)
> > > +{
> > > + int diff;
> > > +
> > > + diff = clip->x1 - dst->x1;
> > > + if (diff > 0) {
> > > + int64_t tmp = src->x1 + (int64_t) diff * hscale;
> > > + src->x1 = clamp_t(int64_t, tmp, INT_MIN, INT_MAX);
> > > + }
> > > + diff = clip->y1 - dst->y1;
> > > + if (diff > 0) {
> > > + int64_t tmp = src->y1 + (int64_t) diff * vscale;
> > > + src->y1 = clamp_t(int64_t, tmp, INT_MIN, INT_MAX);
> > > + }
> > > + diff = dst->x2 - clip->x2;
> > > + if (diff > 0) {
> > > + int64_t tmp = src->x2 - (int64_t) diff * hscale;
> > > + src->x2 = clamp_t(int64_t, tmp, INT_MIN, INT_MAX);
> > > + }
> > > + diff = dst->y2 - clip->y2;
> > > + if (diff > 0) {
> > > + int64_t tmp = src->y2 - (int64_t) diff * vscale;
> > > + src->y2 = clamp_t(int64_t, tmp, INT_MIN, INT_MAX);
> > > + }
> > > +
> > > + return drm_rect_intersect(dst, clip);
> > > +}
> > > +EXPORT_SYMBOL(drm_rect_clip_scaled);
> > > diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
> > > new file mode 100644
> > > index 000..40b09a4
> > > --- /dev/null
> > > +++ b/include/drm/drm_rect.h
> > > @@ -0,0

[Bug 43655] Latest radeon dri driver on HD6950 with GRUB set "GRUB_GFXPAYLOAD_LINUX=keep" put the display in a flickering state

2013-04-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=43655

--- Comment #31 from Alexandre Demers  ---
(In reply to comment #30)
> does attachment 77441 [details] [review] help?

Still the same. 1 boot on 4 was OK, the three others were showing the same kind
of corruptions as before.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20130405/19c48e2b/attachment.html>


[PATCH v3 1/4] drm: Add struct drm_rect and assorted utility functions

2013-04-05 Thread Ville Syrjälä
On Fri, Apr 05, 2013 at 01:51:24AM +0200, Laurent Pinchart wrote:
> Hi Ville,
> 
> On Thursday 04 April 2013 22:52:37 Ville Syrj?l? wrote:
> > On Thu, Apr 04, 2013 at 06:38:15PM +0200, Laurent Pinchart wrote:
> > > On Wednesday 27 March 2013 17:46:22 ville.syrjala at linux.intel.com 
> > > wrote:
> > > > From: Ville Syrj?l? 
> > > > 
> > > > struct drm_rect represents a simple rectangle. The utility
> > > > functions are there to help driver writers.
> > > > 
> > > > v2: Moved the region stuff into its own file, made the smaller funcs
> > > > 
> > > > static inline, used 64bit maths in the scaled clipping function to
> > > > avoid overflows (instead it will saturate to INT_MIN or INT_MAX).
> > > > 
> > > > v3: Renamed drm_region to drm_rect, drm_region_clip to
> > > > 
> > > > drm_rect_intersect, and drm_region_subsample to drm_rect_downscale.
> > > > 
> > > > Signed-off-by: Ville Syrj?l? 
> > > > ---
> > > > 
> > > >  drivers/gpu/drm/Makefile   |   3 +-
> > > >  drivers/gpu/drm/drm_rect.c |  96 +
> > > >  include/drm/drm_rect.h | 132 ++
> > > >  3 files changed, 230 insertions(+), 1 deletion(-)
> > > >  create mode 100644 drivers/gpu/drm/drm_rect.c
> > > >  create mode 100644 include/drm/drm_rect.h
> > > 
> > > [snip]
> > > 
> > > > diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
> > > > new file mode 100644
> > > > index 000..1ad4f5e
> > > > --- /dev/null
> > > > +++ b/drivers/gpu/drm/drm_rect.c
> > > > @@ -0,0 +1,96 @@
> > > 
> > > [snip]
> > > 
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +
> > > > +/**
> > > > + * drm_rect_intersect - intersect two rectangles
> > > > + * @r1: first rectangle
> > > > + * @r2: second rectangle
> > > > + *
> > > > + * Calculate the intersection of rectangles @r1 and @r2.
> > > > + * @r1 will be overwritten with the intersection.
> > > > + *
> > > > + * RETURNS:
> > > > + * @true if rectangle @r1 is still visible after the operation,
> > > > + * @false otherwise.
> > > 
> > > Isn't @ used for function parameters only ?
> > 
> > Not sure. It's been a while since I wrote these, and I guess I thought
> > that the @ was there just for higlighting purposes. Looks like the
> > documentation for the documentation system isn't that great :) so I
> > guess I'll need to try building the docs and see what happens.

I changed it to '%' since that's apparently meant for constants.

> > 
> > > > + */
> > > > +bool drm_rect_intersect(struct drm_rect *r1, const struct drm_rect *r2)
> > > > +{
> > > > +   r1->x1 = max(r1->x1, r2->x1);
> > > > +   r1->y1 = max(r1->y1, r2->y1);
> > > > +   r1->x2 = min(r1->x2, r2->x2);
> > > > +   r1->y2 = min(r1->y2, r2->y2);
> > > > +
> > > > +   return drm_rect_visible(r1);
> > > 
> > > Do callers always need that information, or should they instead call
> > > drm_rect_visible() explicitly when they need it ?
> > 
> > I suppose someone might call it w/o checking the visibility right away.
> > In my current use case I do use the return value, so it saves one line
> > of code :) But I don't mind changing it if you think that would be
> > better w/o the implicit drm_rect_visible() call.
> 
> I'm fine with whichever you think will be better. I just wanted to raise this 
> point to make sure it has been thought about.

I left this as is for now. We can split it later if there's need for it.


> > > > +/**
> > > > + * drm_rect_downscale - downscale a rect
> > > > + * @r: rect to be downscaled
> > > > + * @horz: horizontal downscale factor
> > > > + * @vert: vertical downscale factor
> > > > + *
> > > > + * Divide the coordinates of rect @r by @horz and @vert.
> > > > + */
> > > > +static inline void drm_rect_downscale(struct drm_rect *r, int horz, int
> > > > vert)
> > > 
> > > Shouldn't horz and vert be unsigned ?
> > 
> > Maybe. I'm actually not using this function currently (mainly because
> > our current hardware doesn't support planar formats) so I could just
> > remove the whole thing until it's needed.

I decided to leave the function as is. Using unsigned int for the
arguments would promote the numerator of the division to unsigned int
as well, and then the result would be wrong. So we'd either require
explicit casts to int, or we'd need to go with something like unsigned
short instead.

-- 
Ville Syrj?l?
Intel OTC


[PATCH v4] drm: Add struct drm_rect and assorted utility functions

2013-04-05 Thread ville.syrj...@linux.intel.com
From: Ville Syrj?l? 

struct drm_rect represents a simple rectangle. The utility
functions are there to help driver writers.

v2: Moved the region stuff into its own file, made the smaller funcs
static inline, used 64bit maths in the scaled clipping function to
avoid overflows (instead it will saturate to INT_MIN or INT_MAX).
v3: Renamed drm_region to drm_rect, drm_region_clip to
drm_rect_intersect, and drm_region_subsample to drm_rect_downscale.
v4: Renamed some function parameters, improve kernel-doc comments a bit,
and actually generate documentation for drm_rect.[ch].

Signed-off-by: Ville Syrj?l? 
---
 Documentation/DocBook/drm.tmpl |   2 +
 drivers/gpu/drm/Makefile   |   3 +-
 drivers/gpu/drm/drm_rect.c |  96 ++
 include/drm/drm_rect.h | 132 +
 4 files changed, 232 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/drm_rect.c
 create mode 100644 include/drm/drm_rect.h

diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index f9df3b8..7c7af25 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -1653,6 +1653,8 @@ void intel_crt_init(struct drm_device *dev)
 
   KMS API Functions
 !Edrivers/gpu/drm/drm_crtc.c
+!Edrivers/gpu/drm/drm_rect.c
+!Finclude/drm/drm_rect.h
 
   

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 0d59b24..8f94018 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -12,7 +12,8 @@ drm-y   :=drm_auth.o drm_buffer.o drm_bufs.o 
drm_cache.o \
drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \
drm_crtc.o drm_modes.o drm_edid.o \
drm_info.o drm_debugfs.o drm_encoder_slave.o \
-   drm_trace_points.o drm_global.o drm_prime.o
+   drm_trace_points.o drm_global.o drm_prime.o \
+   drm_rect.o

 drm-$(CONFIG_COMPAT) += drm_ioc32.o
 drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
new file mode 100644
index 000..a9861bd
--- /dev/null
+++ b/drivers/gpu/drm/drm_rect.c
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2011-2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
+ * SOFTWARE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/**
+ * drm_rect_intersect - intersect two rectangles
+ * @r1: first rectangle
+ * @r2: second rectangle
+ *
+ * Calculate the intersection of rectangles @r1 and @r2.
+ * @r1 will be overwritten with the intersection.
+ *
+ * RETURNS:
+ * %true if rectangle @r1 is still visible after the operation,
+ * %false otherwise.
+ */
+bool drm_rect_intersect(struct drm_rect *r1, const struct drm_rect *r2)
+{
+   r1->x1 = max(r1->x1, r2->x1);
+   r1->y1 = max(r1->y1, r2->y1);
+   r1->x2 = min(r1->x2, r2->x2);
+   r1->y2 = min(r1->y2, r2->y2);
+
+   return drm_rect_visible(r1);
+}
+EXPORT_SYMBOL(drm_rect_intersect);
+
+/**
+ * drm_rect_clip_scaled - perform a scaled clip operation
+ * @src: source window rectangle
+ * @dst: destination window rectangle
+ * @clip: clip rectangle
+ * @hscale: horizontal scaling factor
+ * @vscale: vertical scaling factor
+ *
+ * Clip rectangle @dst by rectangle @clip. Clip rectangle @src by the
+ * same amounts multiplied by @hscale and @vscale.
+ *
+ * RETUTRNS:
+ * %true if rectangle @dst is still visible after being clipped,
+ * %false otherwise
+ */
+bool drm_rect_clip_scaled(struct drm_rect *src, struct drm_rect *dst,
+ const struct drm_rect *clip,
+ int hscale, int vscale)
+{
+   int diff;
+
+   diff = clip->x1 - dst->x1;
+   if (diff > 0) {
+   int64_t tmp = src->x1 + (int64_t) diff * hscale;
+   src->x1 = clamp_t(int64_t, tmp, INT_MIN, INT_MAX);
+   }
+   diff = clip->y1 

[Bug 61182] r600g causes KWin crashes with kernel 3.8

2013-04-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=61182

--- Comment #27 from Knut Andre Tidemann  ---
I've bisected the issue to this commit:

35840ab189595b817fa8b1a1df8cc92474a7c38d st/dri: implement MSAA for GLX/DRI2
framebuffers

The only thing that was recompiled was mesa, with the following options:

--with-dri-driverdir=/usr/lib/xorg/modules/dri
--with-gallium-drivers=r600,swrast
--with-dri-drivers=
--with-egl-platforms=drm,x11
--enable-gallium-egl --enable-shared-glapi
--enable-gallium-llvm
--enable-glx-tls
--enable-gles1
--enable-gles2
--enable-egl
--enable-dri
--enable-glx
--enable-xa
--enable-osmesa
--enable-gbm
--enable-texture-float

The issue was triggered by restarting kwin (kwin --replace) between each
compile and locking and unlocking the screen.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20130405/b3ac7425/attachment.html>


[Bug 62997] Crashes on ARUBA unless R600_DEBUG=nodma

2013-04-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=62997

udo  changed:

   What|Removed |Added

Summary|GPU fault unless|Crashes on ARUBA unless
   |R600_DEBUG=nodma|R600_DEBUG=nodma

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20130405/548d9ad2/attachment.html>


[Bug 62997] Crashes on ARUBA unless R600_DEBUG=nodma

2013-04-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=62997

--- Comment #3 from udo  ---
With R600_DEBUG=nodma we get some mentions of GPU fault but not as often and no
crashing the whole PC.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20130405/e5ea01a5/attachment-0001.html>


[Bug 62997] Crashes on ARUBA unless R600_DEBUG=nodma

2013-04-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=62997

--- Comment #4 from udo  ---
I shttps://bugs.freedesktop.org/show_bug.cgi?id=58667 a related issue?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20130405/5a36f3f1/attachment.html>


[PATCH v4 09/21] modetest: Allow specifying plane position

2013-04-05 Thread Ville Syrjälä
On Thu, Apr 04, 2013 at 06:24:24PM +0200, Laurent Pinchart wrote:
> Hi Ville,
> 
> On Wednesday 27 March 2013 19:15:31 Ville Syrj?l? wrote:
> > On Wed, Mar 27, 2013 at 05:57:20PM +0200, Ville Syrj?l? wrote:
> > > On Tue, Mar 19, 2013 at 03:55:50PM +0100, Laurent Pinchart wrote:
> > > > Extend the -P option to allow specifying the plane x and y offsets. The
> > > > position is optional, if not specified the plane will be positioned at
> > > > the center of the screen as before.
> > > > 
> > > > Signed-off-by: Laurent Pinchart 
> > > > ---
> > > > 
> > > >  tests/modetest/modetest.c | 72 ++--
> > > >  1 file changed, 57 insertions(+), 15 deletions(-)
> > > > 
> > > > diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
> > > > index 7153a40..f95efe6 100644
> > > > --- a/tests/modetest/modetest.c
> > > > +++ b/tests/modetest/modetest.c
> > > > @@ -645,6 +645,7 @@ struct connector_arg {
> > > > 
> > > >  struct plane_arg {
> > > >  
> > > > uint32_t con_id;  /* the id of connector to bind to */
> > > > 
> > > > +   uint32_t x, y;
> > > 
> > > I'd like the coordinates to allow negative values too.
> > 
> > Tested it and it actually works w/ negative values thanks to the way
> > strtoul() works :) The only real obstacle is the magic '-1' handling.
> > I guess you should just give up on magic values and add some flag to
> > indicate whether the user provided the coords or not.
> 
> Done :-) I'll post a new version.
> 
> > Also I must say that I don't like the syntax you used for specifying the
> > coords. '(' and ')' need to be escaped or the shell eats them. I've been
> > using the x11 -geometry syntax whenever I have to deal with the x/y/w/h
> > combination. It's a reasonably well known syntax and doesn't have these
> > shell issues. Maybe you could use it here as well.
> 
> Given that negative coordinates in the X geometry syntax don't match we what 
> need, should I keep the current syntax, abuse the X geometry syntax, or use 
> something else ?

Since no-one suggeste anything better, I vote for the abuse. I've
already gotten used to it :)

-- 
Ville Syrj?l?
Intel OTC


[Bug 62756] Rendering errors on rv790 with llvm and unigine heaven 3.0

2013-04-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=62756

--- Comment #9 from vincent  ---
Created attachment 77490
  --> https://bugs.freedesktop.org/attachment.cgi?id=77490&action=edit
Proposed patch

Does this patch solve the big regression ?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20130405/9bd7941f/attachment.html>


[PATCH 0/3] mgag200: bug fix, cleanup and managed devices

2013-04-05 Thread Christopher Harvey
Patch one is a simple bug fix for G200ER cards.

Patch two doesn't change any code

Patch three makes the mgag200 driver use managed devices where
possible. I'm not too sure how to test this one properly, other than
to just boot a bunch of boards and stare at the code changes for a
long while. Any testing hints are appreciated.

Christopher Harvey (3):
  drm/mgag200: Index 24 in extended CRTC registers is 24 in hex, not decimal.
  drm: Misc comment cleanup
  drm/mgag200: Convert to managed device resources where possible

 drivers/gpu/drm/mgag200/mgag200_drv.h  |  6 +++---
 drivers/gpu/drm/mgag200/mgag200_fb.c   |  9 +++--
 drivers/gpu/drm/mgag200/mgag200_main.c | 29 +
 drivers/gpu/drm/mgag200/mgag200_mode.c | 13 +++--
 include/drm/drm_crtc.h |  2 +-
 include/uapi/drm/drm_mode.h|  6 +++---
 6 files changed, 18 insertions(+), 47 deletions(-)

-- 
1.7.12.4



[PATCH 1/3] drm/mgag200: Index 24 in extended CRTC registers is 24 in hex, not decimal.

2013-04-05 Thread Christopher Harvey
This change properly enables the "requester" in G200ER cards that is
responsible for getting pixels out of memory and clocking them out to
the screen.

Signed-off-by: Christopher Harvey 
---
 drivers/gpu/drm/mgag200/mgag200_mode.c | 13 +++--
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c 
b/drivers/gpu/drm/mgag200/mgag200_mode.c
index 7337013..f988965 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -751,8 +751,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
int i;
unsigned char misc = 0;
unsigned char ext_vga[6];
-   unsigned char ext_vga_index24;
-   unsigned char dac_index90 = 0;
u8 bppshift;

static unsigned char dacvalue[] = {
@@ -803,7 +801,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
option2 = 0xb000;
break;
case G200_ER:
-   dac_index90 = 0;
break;
}

@@ -852,10 +849,8 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
WREG_DAC(i, dacvalue[i]);
}

-   if (mdev->type == G200_ER) {
-   WREG_DAC(0x90, dac_index90);
-   }
-
+   if (mdev->type == G200_ER)
+   WREG_DAC(0x90, 0);

if (option)
pci_write_config_dword(dev->pdev, PCI_MGA_OPTION, option);
@@ -952,8 +947,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
if (mdev->type == G200_WB)
ext_vga[1] |= 0x88;

-   ext_vga_index24 = 0x05;
-
/* Set pixel clocks */
misc = 0x2d;
WREG8(MGA_MISC_OUT, misc);
@@ -965,7 +958,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
}

if (mdev->type == G200_ER)
-   WREG_ECRT(24, ext_vga_index24);
+   WREG_ECRT(0x24, 0x5);

if (mdev->type == G200_EV) {
WREG_ECRT(6, 0);
-- 
1.7.12.4



[PATCH 2/3] drm: Misc comment cleanup

2013-04-05 Thread Christopher Harvey

Signed-off-by: Christopher Harvey 
---
 drivers/gpu/drm/mgag200/mgag200_drv.h | 6 +++---
 include/drm/drm_crtc.h| 2 +-
 include/uapi/drm/drm_mode.h   | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h 
b/drivers/gpu/drm/mgag200/mgag200_drv.h
index 4d932c4..dcfc973 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.h
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.h
@@ -215,7 +215,7 @@ mgag200_bo(struct ttm_buffer_object *bo)
 {
return container_of(bo, struct mgag200_bo, bo);
 }
-   /* mga_crtc.c */
+   /* mgag200_crtc.c */
 void mga_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
 u16 blue, int regno);
 void mga_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
@@ -225,7 +225,7 @@ void mga_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, 
u16 *green,
 int mgag200_modeset_init(struct mga_device *mdev);
 void mgag200_modeset_fini(struct mga_device *mdev);

-   /* mga_fbdev.c */
+   /* mgag200_fb.c */
 int mgag200_fbdev_init(struct mga_device *mdev);
 void mgag200_fbdev_fini(struct mga_device *mdev);

@@ -254,7 +254,7 @@ mgag200_dumb_mmap_offset(struct drm_file *file,
 struct drm_device *dev,
 uint32_t handle,
 uint64_t *offset);
-   /* mga_i2c.c */
+   /* mgag200_i2c.c */
 struct mga_i2c_chan *mgag200_i2c_create(struct drm_device *dev);
 void mgag200_i2c_destroy(struct mga_i2c_chan *i2c);

diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index e3e0d65..8c7846b 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -310,7 +310,7 @@ struct drm_plane;
  * drm_crtc_funcs - control CRTCs for a given device
  * @save: save CRTC state
  * @restore: restore CRTC state
- * @reset: reset CRTC after state has been invalidate (e.g. resume)
+ * @reset: reset CRTC after state has been invalidated (e.g. resume)
  * @cursor_set: setup the cursor
  * @cursor_move: move the cursor
  * @gamma_set: specify color ramp for CRTC
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 3d6301b..090e533 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -367,13 +367,13 @@ struct drm_mode_mode_cmd {
  * depending on the value in flags different members are used.
  *
  * CURSOR_BO uses
- *crtc
+ *crtc_id
  *width
  *height
- *handle - if 0 turns the cursor of
+ *handle - if 0 turns the cursor off
  *
  * CURSOR_MOVE uses
- *crtc
+ *crtc_id
  *x
  *y
  */
-- 
1.7.12.4



[PATCH 3/3] drm/mgag200: Convert to managed device resources where possible

2013-04-05 Thread Christopher Harvey
Signed-off-by: Christopher Harvey 
---
 drivers/gpu/drm/mgag200/mgag200_fb.c   |  9 +++--
 drivers/gpu/drm/mgag200/mgag200_main.c | 29 +
 2 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c 
b/drivers/gpu/drm/mgag200/mgag200_fb.c
index a5a1f34..421beab 100644
--- a/drivers/gpu/drm/mgag200/mgag200_fb.c
+++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
@@ -246,7 +246,7 @@ int mgag200_fbdev_init(struct mga_device *mdev)
struct mga_fbdev *mfbdev;
int ret;

-   mfbdev = kzalloc(sizeof(struct mga_fbdev), GFP_KERNEL);
+   mfbdev = devm_kzalloc(mdev->dev->dev, sizeof(struct mga_fbdev), 
GFP_KERNEL);
if (!mfbdev)
return -ENOMEM;

@@ -255,10 +255,9 @@ int mgag200_fbdev_init(struct mga_device *mdev)

ret = drm_fb_helper_init(mdev->dev, &mfbdev->helper,
 mdev->num_crtc, MGAG200FB_CONN_LIMIT);
-   if (ret) {
-   kfree(mfbdev);
+   if (ret)
return ret;
-   }
+
drm_fb_helper_single_add_all_connectors(&mfbdev->helper);

/* disable all the possible outputs/crtcs before entering KMS mode */
@@ -275,6 +274,4 @@ void mgag200_fbdev_fini(struct mga_device *mdev)
return;

mga_fbdev_destroy(mdev->dev, mdev->mfbdev);
-   kfree(mdev->mfbdev);
-   mdev->mfbdev = NULL;
 }
diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c 
b/drivers/gpu/drm/mgag200/mgag200_main.c
index baf54d9..19db16d 100644
--- a/drivers/gpu/drm/mgag200/mgag200_main.c
+++ b/drivers/gpu/drm/mgag200/mgag200_main.c
@@ -80,15 +80,6 @@ static const struct drm_mode_config_funcs mga_mode_funcs = {
.fb_create = mgag200_user_framebuffer_create,
 };

-/* Unmap the framebuffer from the core and release the memory */
-static void mga_vram_fini(struct mga_device *mdev)
-{
-   pci_iounmap(mdev->dev->pdev, mdev->rmmio);
-   mdev->rmmio = NULL;
-   if (mdev->mc.vram_base)
-   release_mem_region(mdev->mc.vram_base, mdev->mc.vram_window);
-}
-
 static int mga_probe_vram(struct mga_device *mdev, void __iomem *mem)
 {
int offset;
@@ -144,7 +135,7 @@ static int mga_vram_init(struct mga_device *mdev)
remove_conflicting_framebuffers(aper, "mgafb", true);
kfree(aper);

-   if (!request_mem_region(mdev->mc.vram_base, mdev->mc.vram_window,
+   if (!devm_request_mem_region(mdev->dev->dev, mdev->mc.vram_base, 
mdev->mc.vram_window,
"mgadrmfb_vram")) {
DRM_ERROR("can't reserve VRAM\n");
return -ENXIO;
@@ -177,13 +168,13 @@ static int mgag200_device_init(struct drm_device *dev,
mdev->rmmio_base = pci_resource_start(mdev->dev->pdev, 1);
mdev->rmmio_size = pci_resource_len(mdev->dev->pdev, 1);

-   if (!request_mem_region(mdev->rmmio_base, mdev->rmmio_size,
+   if (!devm_request_mem_region(mdev->dev->dev, mdev->rmmio_base, 
mdev->rmmio_size,
"mgadrmfb_mmio")) {
DRM_ERROR("can't reserve mmio registers\n");
return -ENOMEM;
}

-   mdev->rmmio = pci_iomap(dev->pdev, 1, 0);
+   mdev->rmmio = pcim_iomap(dev->pdev, 1, 0);
if (mdev->rmmio == NULL)
return -ENOMEM;

@@ -192,10 +183,8 @@ static int mgag200_device_init(struct drm_device *dev,
mdev->reg_1e24 = RREG32(0x1e24);

ret = mga_vram_init(mdev);
-   if (ret) {
-   release_mem_region(mdev->rmmio_base, mdev->rmmio_size);
+   if (ret)
return ret;
-   }

mdev->bpp_shifts[0] = 0;
mdev->bpp_shifts[1] = 1;
@@ -204,12 +193,6 @@ static int mgag200_device_init(struct drm_device *dev,
return 0;
 }

-void mgag200_device_fini(struct mga_device *mdev)
-{
-   release_mem_region(mdev->rmmio_base, mdev->rmmio_size);
-   mga_vram_fini(mdev);
-}
-
 /*
  * Functions here will be called by the core once it's bound the driver to
  * a PCI device
@@ -221,7 +204,7 @@ int mgag200_driver_load(struct drm_device *dev, unsigned 
long flags)
struct mga_device *mdev;
int r;

-   mdev = kzalloc(sizeof(struct mga_device), GFP_KERNEL);
+   mdev = devm_kzalloc(dev->dev, sizeof(struct mga_device), GFP_KERNEL);
if (mdev == NULL)
return -ENOMEM;
dev->dev_private = (void *)mdev;
@@ -265,8 +248,6 @@ int mgag200_driver_unload(struct drm_device *dev)
mgag200_fbdev_fini(mdev);
drm_mode_config_cleanup(dev);
mgag200_mm_fini(mdev);
-   mgag200_device_fini(mdev);
-   kfree(mdev);
dev->dev_private = NULL;
return 0;
 }
-- 
1.7.12.4



[Bug 62756] Rendering errors on rv790 with llvm and unigine heaven 3.0

2013-04-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=62756

--- Comment #10 from Andy Furniss  ---
(In reply to comment #9)
> Created attachment 77490 [details] [review]
> Proposed patch
> 
> Does this patch solve the big regression ?

No, it's the same with that.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20130405/9af1eb70/attachment.html>


BUG: kworker hangs the GPU on drm and i915 since 3.8.x under X11

2013-04-05 Thread Daniel Vetter
On Thu, Apr 4, 2013 at 11:53 PM, George Amanakis  
wrote:
> Compiled und run the kernel as you instructed.
> Although the GPU did hang momentarily the dmesg showed no abnormalities.


Can you please explain in more detail what you mean by "did hang
momentarily"? If it's a real gpu hang it should be stuck until the
kernel resets the gpu, which will result in some dmesg noise. I'm a
bit at loss here what's going wrong ...
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[Bug 56437] LLVM ERROR: Cannot select: target intrinsic %llvm.AMDIL.mad when running Heaven

2013-04-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=56437

maxijac at free.fr changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #15 from maxijac at free.fr ---
Not seen in a while with vanilla mesa, closing.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20130405/3459a2b8/attachment.html>


[Bug 58491] regression : r600g: work around ddx over alignment

2013-04-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=58491

--- Comment #10 from maxijac at free.fr ---
Should this stay open for reference?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20130405/2393e987/attachment.html>


[PATCH 1/3] drm/mgag200: Index 24 in extended CRTC registers is 24 in hex, not decimal.

2013-04-05 Thread Mathieu Larouche

On 05/04/2013 10:51 AM, Christopher Harvey wrote:
> This change properly enables the "requester" in G200ER cards that is
> responsible for getting pixels out of memory and clocking them out to
> the screen.
>
> Signed-off-by: Christopher Harvey 

Signed-off-by: Mathieu Larouche 

> ---
>   drivers/gpu/drm/mgag200/mgag200_mode.c | 13 +++--
>   1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c 
> b/drivers/gpu/drm/mgag200/mgag200_mode.c
> index 7337013..f988965 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_mode.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
> @@ -751,8 +751,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
>   int i;
>   unsigned char misc = 0;
>   unsigned char ext_vga[6];
> - unsigned char ext_vga_index24;
> - unsigned char dac_index90 = 0;
>   u8 bppshift;
>   
>   static unsigned char dacvalue[] = {
> @@ -803,7 +801,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
>   option2 = 0xb000;
>   break;
>   case G200_ER:
> - dac_index90 = 0;
>   break;
>   }
>   
> @@ -852,10 +849,8 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
>   WREG_DAC(i, dacvalue[i]);
>   }
>   
> - if (mdev->type == G200_ER) {
> - WREG_DAC(0x90, dac_index90);
> - }
> -
> + if (mdev->type == G200_ER)
> + WREG_DAC(0x90, 0);
>   
>   if (option)
>   pci_write_config_dword(dev->pdev, PCI_MGA_OPTION, option);
> @@ -952,8 +947,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
>   if (mdev->type == G200_WB)
>   ext_vga[1] |= 0x88;
>   
> - ext_vga_index24 = 0x05;
> -
>   /* Set pixel clocks */
>   misc = 0x2d;
>   WREG8(MGA_MISC_OUT, misc);
> @@ -965,7 +958,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
>   }
>   
>   if (mdev->type == G200_ER)
> - WREG_ECRT(24, ext_vga_index24);
> + WREG_ECRT(0x24, 0x5);
>   
>   if (mdev->type == G200_EV) {
>   WREG_ECRT(6, 0);

-- 
Mathieu Larouche Ing./Eng.
Software Designer
Matrox Graphics Inc.
Phone : 514 822-6000 x7905
Email : mathieu.larouche at matrox.com



[PATCH] drm/radeon: add si tile mode array query v2

2013-04-05 Thread j.gli...@gmail.com
From: Jerome Glisse 

Allow userspace to query for the tile mode array so userspace can properly
compute surface pitch and alignment requirement depending on tiling.

v2: Make strict aliasing safer by casting to char when copying

Signed-off-by: Jerome Glisse 
---
 drivers/gpu/drm/radeon/radeon.h |   1 +
 drivers/gpu/drm/radeon/radeon_drv.c |   3 +-
 drivers/gpu/drm/radeon/radeon_kms.c | 158 +++-
 drivers/gpu/drm/radeon/si.c |   2 +
 include/uapi/drm/radeon_drm.h   |  20 +
 5 files changed, 109 insertions(+), 75 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 8263af3..961659e 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1443,6 +1443,7 @@ struct si_asic {
unsigned multi_gpu_tile_size;

unsigned tile_config;
+   uint32_t tile_mode_array[32];
 };

 union radeon_asic_config {
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index 66a7f0f..1e48ab6 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -71,9 +71,10 @@
  *   2.28.0 - r600-eg: Add MEM_WRITE packet support
  *   2.29.0 - R500 FP16 color clear registers
  *   2.30.0 - fix for FMASK texturing
+ *   2.31.0 - Add SI tiling mode array query
  */
 #define KMS_DRIVER_MAJOR   2
-#define KMS_DRIVER_MINOR   30
+#define KMS_DRIVER_MINOR   31
 #define KMS_DRIVER_PATCHLEVEL  0
 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
 int radeon_driver_unload_kms(struct drm_device *dev);
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
b/drivers/gpu/drm/radeon/radeon_kms.c
index c75cb2c..63e28e0 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -176,80 +176,65 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, 
struct drm_file *filp)
struct radeon_device *rdev = dev->dev_private;
struct drm_radeon_info *info = data;
struct radeon_mode_info *minfo = &rdev->mode_info;
-   uint32_t value, *value_ptr;
-   uint64_t value64, *value_ptr64;
+   uint32_t *value, value_tmp, *value_ptr, value_size;
+   uint64_t value64;
struct drm_crtc *crtc;
int i, found;

-   /* TIMESTAMP is a 64-bit value, needs special handling. */
-   if (info->request == RADEON_INFO_TIMESTAMP) {
-   if (rdev->family >= CHIP_R600) {
-   value_ptr64 = (uint64_t*)((unsigned long)info->value);
-   value64 = radeon_get_gpu_clock_counter(rdev);
-
-   if (DRM_COPY_TO_USER(value_ptr64, &value64, 
sizeof(value64))) {
-   DRM_ERROR("copy_to_user %s:%u\n", __func__, 
__LINE__);
-   return -EFAULT;
-   }
-   return 0;
-   } else {
-   DRM_DEBUG_KMS("timestamp is r6xx+ only!\n");
-   return -EINVAL;
-   }
-   }
-
value_ptr = (uint32_t *)((unsigned long)info->value);
-   if (DRM_COPY_FROM_USER(&value, value_ptr, sizeof(value))) {
-   DRM_ERROR("copy_from_user %s:%u\n", __func__, __LINE__);
-   return -EFAULT;
-   }
+   value = &value_tmp;
+   value_size = sizeof(uint32_t);

switch (info->request) {
case RADEON_INFO_DEVICE_ID:
-   value = dev->pci_device;
+   *value = dev->pci_device;
break;
case RADEON_INFO_NUM_GB_PIPES:
-   value = rdev->num_gb_pipes;
+   *value = rdev->num_gb_pipes;
break;
case RADEON_INFO_NUM_Z_PIPES:
-   value = rdev->num_z_pipes;
+   *value = rdev->num_z_pipes;
break;
case RADEON_INFO_ACCEL_WORKING:
/* xf86-video-ati 6.13.0 relies on this being false for 
evergreen */
if ((rdev->family >= CHIP_CEDAR) && (rdev->family <= 
CHIP_HEMLOCK))
-   value = false;
+   *value = false;
else
-   value = rdev->accel_working;
+   *value = rdev->accel_working;
break;
case RADEON_INFO_CRTC_FROM_ID:
+   if (DRM_COPY_FROM_USER(value, value_ptr, sizeof(uint32_t))) {
+   DRM_ERROR("copy_from_user %s:%u\n", __func__, __LINE__);
+   return -EFAULT;
+   }
for (i = 0, found = 0; i < rdev->num_crtc; i++) {
crtc = (struct drm_crtc *)minfo->crtcs[i];
-   if (crtc && crtc->base.id == value) {
+   if (crtc && crtc->base.id == *value) {
struct radeon_crtc *radeon_crtc = 
to_radeon_crtc(crtc);
-   value = radeon_crtc->crtc_id;
+

[PATCH] radeon: add si tiling support v3

2013-04-05 Thread j.gli...@gmail.com
From: Jerome Glisse 

v2: Only writte tile index if flags for it is set
v3: Remove useless allow2d scanout flags

Signed-off-by: Jerome Glisse 
---
 include/drm/radeon_drm.h |  61 +
 radeon/radeon_surface.c  | 658 +++
 radeon/radeon_surface.h  |  31 +++
 3 files changed, 705 insertions(+), 45 deletions(-)

diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 00d66b3..ff3ce3a 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -509,6 +509,7 @@ typedef struct {
 #define DRM_RADEON_GEM_SET_TILING  0x28
 #define DRM_RADEON_GEM_GET_TILING  0x29
 #define DRM_RADEON_GEM_BUSY0x2a
+#define DRM_RADEON_GEM_VA  0x2b

 #define DRM_IOCTL_RADEON_CP_INITDRM_IOW( DRM_COMMAND_BASE + 
DRM_RADEON_CP_INIT, drm_radeon_init_t)
 #define DRM_IOCTL_RADEON_CP_START   DRM_IO(  DRM_COMMAND_BASE + 
DRM_RADEON_CP_START)
@@ -550,6 +551,7 @@ typedef struct {
 #define DRM_IOCTL_RADEON_SET_TILINGDRM_IOWR(DRM_COMMAND_BASE + 
DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling)
 #define DRM_IOCTL_RADEON_GET_TILINGDRM_IOWR(DRM_COMMAND_BASE + 
DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling)
 #define DRM_IOCTL_RADEON_GEM_BUSY  DRM_IOWR(DRM_COMMAND_BASE + 
DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy)
+#define DRM_IOCTL_RADEON_GEM_VADRM_IOWR(DRM_COMMAND_BASE + 
DRM_RADEON_GEM_VA, struct drm_radeon_gem_va)

 typedef struct drm_radeon_init {
enum {
@@ -882,6 +884,27 @@ struct drm_radeon_gem_pwrite {
uint64_t data_ptr;
 };

+#define RADEON_VA_MAP  1
+#define RADEON_VA_UNMAP2
+
+#define RADEON_VA_RESULT_OK0
+#define RADEON_VA_RESULT_ERROR 1
+#define RADEON_VA_RESULT_VA_EXIST  2
+
+#define RADEON_VM_PAGE_VALID   (1 << 0)
+#define RADEON_VM_PAGE_READABLE(1 << 1)
+#define RADEON_VM_PAGE_WRITEABLE   (1 << 2)
+#define RADEON_VM_PAGE_SYSTEM  (1 << 3)
+#define RADEON_VM_PAGE_SNOOPED (1 << 4)
+
+struct drm_radeon_gem_va {
+   uint32_thandle;
+   uint32_toperation;
+   uint32_tvm_id;
+   uint32_tflags;
+   uint64_toffset;
+};
+
 #define RADEON_CHUNK_ID_RELOCS 0x01
 #define RADEON_CHUNK_ID_IB 0x02

@@ -916,6 +939,26 @@ struct drm_radeon_cs {
 #define RADEON_INFO_ACCEL_WORKING2 0x05
 #define RADEON_INFO_TILING_CONFIG  0x06
 #define RADEON_INFO_WANT_HYPERZ0x07
+#define RADEON_INFO_WANT_CMASK 0x08 /* get access to CMASK on r300 */
+#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 */
+#define RADEON_INFO_BACKEND_MAP0x0d /* pipe to backend map, 
needed by mesa */
+/* virtual address start, va < start are reserved by the kernel */
+#define RADEON_INFO_VA_START   0x0e
+/* maximum size of ib using the virtual memory cs */
+#define RADEON_INFO_IB_VM_MAX_SIZE 0x0f
+/* max pipes - needed for compute shaders */
+#define RADEON_INFO_MAX_PIPES  0x10
+/* timestamp for GL_ARB_timer_query (OpenGL), returns the current GPU clock */
+#define RADEON_INFO_TIMESTAMP  0x11
+/* max shader engines (SE) - needed for geometry shaders, etc. */
+#define RADEON_INFO_MAX_SE 0x12
+/* max SH per SE */
+#define RADEON_INFO_MAX_SH_PER_SE  0x13
+/* SI tile mode array */
+#define RADEON_INFO_SI_TILE_MODE_ARRAY 0x14

 struct drm_radeon_info {
uint32_trequest;
@@ -923,4 +966,22 @@ struct drm_radeon_info {
uint64_tvalue;
 };

+/* Those correspond to the tile index to use, this is to explicitly state
+ * the API that is implicitly defined by the tile mode array.
+ */
+#define SI_TILE_MODE_COLOR_LINEAR_ALIGNED  8
+#define SI_TILE_MODE_COLOR_1D  13
+#define SI_TILE_MODE_COLOR_1D_SCANOUT  9
+#define SI_TILE_MODE_COLOR_2D_8BPP 14
+#define SI_TILE_MODE_COLOR_2D_16BPP15
+#define SI_TILE_MODE_COLOR_2D_32BPP16
+#define SI_TILE_MODE_COLOR_2D_64BPP17
+#define SI_TILE_MODE_COLOR_2D_SCANOUT_16BPP11
+#define SI_TILE_MODE_COLOR_2D_SCANOUT_32BPP12
+#define SI_TILE_MODE_DEPTH_STENCIL_1D  4
+#define SI_TILE_MODE_DEPTH_STENCIL_2D  0
+#define SI_TILE_MODE_DEPTH_STENCIL_2D_2AA  3
+#define SI_TILE_MODE_DEPTH_STENCIL_2D_4AA  3
+#define SI_TILE_MODE_DEPTH_STENCIL_2D_8AA  2
+
 #endif
diff --git a/radeon/radeon_surface.c b/radeon/radeon_surface.c
index 5935c23..e567fba 100644
--- a/radeon/radeon_surface.c
+++ b/radeon/radeon_surface.c
@@ -83,12 +83,14 @@ typedef int (*hw_best_surface_t)(struct 
radeon_

[Bug 62959] r600g (HD 6950 Cayman) fails piglit tests and hangs system

2013-04-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=62959

--- Comment #13 from Marek Ol??k  ---
This kernel patch fixes everything:

diff --git a/drivers/gpu/drm/radeon/radeon_cs.c
b/drivers/gpu/drm/radeon/radeon_cs.c
index 70d3824..748a933 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -459,6 +459,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device
*rdev,
if (r) {
goto out;
}
+   radeon_fence_wait(vm->fence, false);
radeon_cs_sync_rings(parser);
radeon_ib_sync_to(&parser->ib, vm->fence);
radeon_ib_sync_to(&parser->ib, radeon_vm_grab_id(

It's merely a workaround and it kills performance, but it's now pretty clear
there is a synchronization issue in the kernel affecting all NI chips with
virtual memory, and it should now be easier to find the bug. I'm not really
familiar with the kernel code. I had to do some code reading before I found the
right place to put the wait call in.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20130405/be7e7e8e/attachment.html>


Radeon lockup on 3.8.5-201.fc18.x86_64

2013-04-05 Thread Andy Lutomirski
Every day or so, I'll click something and my screens go blank for a
second or two.  dmesg complains about a lockup, and afterwards
everything is painfully slow.  (Even switching focus to other emacs
windows takes a second or two.)  Once this happens, if I restart X, I
get a blank screen, although the mouse still works and I can switch
VTs and use the console.

My userspace driver is
xorg-x11-drv-ati-7.0.0-0.9.20121015gitbd9e2c064.fc18.src.rpm.  I have
Option "ColorTiling2D" "true", but I'm not sure this matters.

lspci says:
08:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee
ATI Caicos [Radeon HD 6450]


[ 7508.750753] radeon :08:00.0: GPU lockup CP stall for more than
5102593msec
[ 7508.750757] radeon :08:00.0: GPU lockup (waiting for
0x0155 last fence id 0x0154)
[ 7508.751832] radeon :08:00.0: Saved 71 dwords of commands on ring 0.
[ 7508.751837] radeon :08:00.0: GPU softreset: 0x0007
[ 7508.762035] radeon :08:00.0:   GRBM_STATUS   = 0xA0003828
[ 7508.762037] radeon :08:00.0:   GRBM_STATUS_SE0   = 0x0007
[ 7508.762040] radeon :08:00.0:   GRBM_STATUS_SE1   = 0x0007
[ 7508.762042] radeon :08:00.0:   SRBM_STATUS   = 0x200400C0
[ 7508.762045] radeon :08:00.0:   R_008674_CP_STALLED_STAT1 = 0x
[ 7508.762047] radeon :08:00.0:   R_008678_CP_STALLED_STAT2 = 0x
[ 7508.762050] radeon :08:00.0:   R_00867C_CP_BUSY_STAT = 0x0004
[ 7508.762053] radeon :08:00.0:   R_008680_CP_STAT  = 0x80008647
[ 7508.762054] radeon :08:00.0:   GRBM_SOFT_RESET=0x7F6B
[ 7508.762109] radeon :08:00.0:   GRBM_STATUS   = 0x3828
[ 7508.762112] radeon :08:00.0:   GRBM_STATUS_SE0   = 0x0007
[ 7508.762114] radeon :08:00.0:   GRBM_STATUS_SE1   = 0x0007
[ 7508.762117] radeon :08:00.0:   SRBM_STATUS   = 0x200400C0
[ 7508.762120] radeon :08:00.0:   R_008674_CP_STALLED_STAT1 = 0x
[ 7508.762122] radeon :08:00.0:   R_008678_CP_STALLED_STAT2 = 0x
[ 7508.762125] radeon :08:00.0:   R_00867C_CP_BUSY_STAT = 0x
[ 7508.762127] radeon :08:00.0:   R_008680_CP_STAT  = 0x
[ 7508.762131] radeon :08:00.0:   R_00D034_DMA_STATUS_REG   = 0x4448C156
[ 7508.762187] radeon :08:00.0:   R_00D034_DMA_STATUS_REG   = 0x44C83D57
[ 7508.779603] radeon :08:00.0: GPU reset succeeded, trying to resume
[ 7508.798041] [drm] probing gen 2 caps for device 8086:1d1a = 2/0
[ 7508.798047] [drm] enabling PCIE gen 2 link speeds, disable with
radeon.pcie_gen2=0
[ 7508.805050] [drm] PCIE GART of 512M enabled (table at 0x0004).
[ 7508.805186] radeon :08:00.0: WB enabled
[ 7508.805189] radeon :08:00.0: fence driver on ring 0 use gpu
addr 0x4c00 and cpu addr 0x880442ddcc00
[ 7508.805190] radeon :08:00.0: fence driver on ring 3 use gpu
addr 0x4c0c and cpu addr 0x880442ddcc0c
[ 7508.821692] [drm] ring test on 0 succeeded in 2 usecs
[ 7508.821765] [drm] ring test on 3 succeeded in 1 usecs
[ 7508.821845] [drm] ib test on ring 0 succeeded in 0 usecs
[ 7508.821923] [drm] ib test on ring 3 succeeded in 1 usecs

--Andy


BUG: kworker hangs the GPU on drm and i915 since 3.8.x under X11

2013-04-05 Thread George Amanakis
I mean that I can type, move the mouse pointer, open new windows but there is a 
lag until these changes are displayed. Stuttering like.

I ended up not reverting the aforementioned commit but modifying it. This also 
solves the issue. Here is the patch:


diff -rupN a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
--- a/drivers/gpu/drm/drm_crtc_helper.c??? 2013-02-19 00:58:34.0 +0100
+++ b/drivers/gpu/drm/drm_crtc_helper.c??? 2013-04-05 23:10:36.454936677 +0200
@@ -1067,7 +1067,7 @@ void drm_helper_hpd_irq_event(struct drm
 enum drm_connector_status old_status;
 bool changed = false;
?
-??? if (!dev->mode_config.poll_enabled)
+??? if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll)
 ??? return;
?
 mutex_lock(&dev->mode_config.mutex);
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20130405/413397de/attachment-0001.html>