[PATCH] drm: cleanup device registration

2012-02-02 Thread Sascha Hauer
On Thu, Feb 02, 2012 at 02:27:18PM +, Alan Cox wrote:
> > I see. For example the i810 also has a framebuffer driver. Do you see
> > a way to fix this except writing a kms driver for all legacy devices?
> > Otherwise I would leave the pci part untouched and only keep the
> > platform/USB pieces which I'm admittedly more interested in.
> 
> Which is obsolete and unmaintained. More of a problem would be the
> various ati framebuffer drivers.
> 
> I would like to see Linux move to the situation where if there is a
> driver for a given device its either one or the other not one and some
> legacy code which is just extra work.
> 
> Doesn't need to be "all KMS" - but for any given card either/or seems
> perfectly reasonable.
> 
> The big thing that is needed is someone crazy enough to write a KMS
> driver to replace vesa/uvesafb and the like.

I am currently working on a layer which provides all the necessary
drm glue code for simple framebuffer devices. My test driver is a
Freescale i.MX framebuffer driver. This currently has < 500 loc which
is less than the corresponding driver under drivers/video. I am not
crazy enough to implement a vesa KMS driver, but my hope is that
these tasks can become quite easy with such a layer.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |


libdrm release on friday ?

2012-02-02 Thread Ville Syrjälä
On Thu, Feb 02, 2012 at 02:55:22PM -0500, Jerome Glisse wrote:
> On Thu, Feb 02, 2012 at 07:13:21PM +0200, Ville Syrj?l? wrote:
> > On Wed, Feb 01, 2012 at 07:10:10PM -0500, Jerome Glisse wrote:
> > > Hi,
> > > 
> > > I plan to do a libdrm release on friday because ddx/mesa work i have
> > > been doing depends on thing i added to libdrm/radeon. Is anybody else
> > > working on some libdrm related code that would need a release ?
> > 
> > AFAICS these never made it in:
> > Message-Id: <1324405614-18547-1-git-send-email-ville.syrjala at 
> > linux.intel.com>
> > Message-Id: <1324405614-18547-2-git-send-email-ville.syrjala at 
> > linux.intel.com>
> > Message-Id: <1324405614-18547-3-git-send-email-ville.syrjala at 
> > linux.intel.com>
> > 
> > Would be nice if you could scoop them up.
> > 
> > -- 
> > Ville Syrj?l?
> > Intel OTC
> 
> Ok found them, and reviewed & pushed

Thanks.

-- 
Ville Syrj?l?
Intel OTC


[PATCH] drm/radeon: do not continue after error from r600_ib_test

2012-02-02 Thread Matthijs Kooijman
This return statement got dropped while fixing the conflicts introduced
in 7a7e8734ac3.
---
 drivers/gpu/drm/radeon/evergreen.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Note that I've not actually tested this change, I just noticed when
reviewing the mentioned merge commit. If the removal of the return
statement was intentional, this patch makes no sense (but sending a
patch was the easiest way to point out this bug).

diff --git a/drivers/gpu/drm/radeon/evergreen.c 
b/drivers/gpu/drm/radeon/evergreen.c
index ccde2c9..5056a53 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -3190,6 +3190,7 @@ static int evergreen_startup(struct radeon_device *rdev)
if (r) {
DRM_ERROR("radeon: failed testing IB (%d).\n", r);
rdev->accel_working = false;
+   return r;
}

r = r600_audio_init(rdev);
-- 
1.7.7.3



[Bug 30151] HDMI audio via radeon DRM driver is not working.

2012-02-02 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=30151

--- Comment #1 from pitamila at free.fr 2012-02-02 12:47:26 PST ---
I can confirm this.

linux 3.2
graphic board hd4870

HDMI audio device seen  and unmuted
set in the grub kernel boot command radeon.audio=1

but when playing, no sound and no error
the audio file seems to be read faster than normal (compared to the
time it is played on my soundboard)

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


libdrm release on friday ?

2012-02-02 Thread Ville Syrjälä
On Wed, Feb 01, 2012 at 07:10:10PM -0500, Jerome Glisse wrote:
> Hi,
> 
> I plan to do a libdrm release on friday because ddx/mesa work i have
> been doing depends on thing i added to libdrm/radeon. Is anybody else
> working on some libdrm related code that would need a release ?

AFAICS these never made it in:
Message-Id: <1324405614-18547-1-git-send-email-ville.syrjala at linux.intel.com>
Message-Id: <1324405614-18547-2-git-send-email-ville.syrjala at linux.intel.com>
Message-Id: <1324405614-18547-3-git-send-email-ville.syrjala at linux.intel.com>

Would be nice if you could scoop them up.

-- 
Ville Syrj?l?
Intel OTC


[Bug 45558] cannot render on a drawable of size equal the max framebuffer size

2012-02-02 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=45558

Alban Browaeys  changed:

   What|Removed |Added

  Attachment #56550|application/octet-stream|text/plain
  mime type||
  Attachment #56550|0   |1
   is patch||

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


[Bug 45558] New: cannot render on a drawable of size equal the max framebuffer size

2012-02-02 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=45558

 Bug #: 45558
   Summary: cannot render on a drawable of size equal the max
framebuffer size
Classification: Unclassified
   Product: Mesa
   Version: git
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/DRI/i830
AssignedTo: dri-devel at lists.freedesktop.org
ReportedBy: prahal at yahoo.com


Created attachment 56550
  --> https://bugs.freedesktop.org/attachment.cgi?id=56550
do not drift one pixel above what we want - x2, y2 are exclusive max

The xorg drawable sizes are exclusive as I have learned on xorg-devel irc
channel by MrCooper.
This means that width = x2 - x1 , x2 behing exclusive and thus in the places
the code does DrawBuffer->Width + x1 to get the right coordinate when we get a
coordinate one pixel above what we want (ie we send x2 which is exclusive).

This patch fixes a few places were the gen2 865g are affected by this bug. That
is gnome-shell renders badly due to cogl using atlas a power of two of the
resolution (which is good but this leads to 2048 which is the framebuffer max
size on gen2).

I will also attach the testcase I used which is dumb but reproduce the same
issue as gnome-shell /cogl. Ie a drawable attached to the context as read and
draw buffer the size equal to framebuffer max size , ie 2048, on 865g gen2.

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


[PATCH:libdrm] Make drm/drm_fourcc.h portable to non-linux platforms

2012-02-02 Thread Alan Coopersmith
Signed-off-by: Alan Coopersmith 
---
 include/drm/drm_fourcc.h |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
index b1107cb..85facb0 100644
--- a/include/drm/drm_fourcc.h
+++ b/include/drm/drm_fourcc.h
@@ -24,10 +24,10 @@
 #ifndef DRM_FOURCC_H
 #define DRM_FOURCC_H

-#include 
+#include 

-#define fourcc_code(a,b,c,d) ((__u32)(a) | ((__u32)(b) << 8) | \
- ((__u32)(c) << 16) | ((__u32)(d) << 24))
+#define fourcc_code(a,b,c,d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
+ ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))

 #define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of 
little endian */

-- 
1.7.3.2



[Mesa-dev] anongit.freedesktop.org not available?

2012-02-02 Thread Dave Airlie
On Thu, Feb 2, 2012 at 5:38 PM, Paul Berry  wrote:
> On 1 February 2012 20:55, Alan Coopersmith 
> wrote:
>>
>> On 02/ 1/12 08:52 PM, Alexandre Demers wrote:
>>>
>>> Hi,
>>>
>>> I've been trying all day to sync sources from anongit.freedesktop.org
>>> (dri and mesa) and it always ends up by a time out. Is there a problem
>>> with the server or the address?
>>
>>
>> Yes. ?Others have reported on IRC that it works if you force the hostnames
>> to resolve to 131.252.210.176 instead of the DNS reported 131.252.210.161.
>
>
> Does anyone know an ETA on getting this fixed?? It would be nice to have
> anongit.freedesktop.org resolving correctly when we make the by the time we
> make the Mesa 8.0 release.

The admin is on holidays, nobody else has access from what I know, and
all are at FOSDEM.

Its also not a DNS issue, the other IP address is the old anongit
service, which thankfully wasn't removed yet.

Dave.


[Bug 43835] System crashes when radeon firmware blob (R520_cp.bin) is installed

2012-02-02 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=43835

--- Comment #52 from Michel D?nzer  2012-02-02 08:57:40 
PST ---
(In reply to comment #51)
> Mainline kernel 3.3-rc2 contains the mentioned patches?

No. You can try the drm-fixes branch of
git://people.freedesktop.org/~airlied/linux.git, but it should be easy to
manually apply the patch to any 3.x tree.

> Are there any other packages involved?

No.

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


[Bug 43835] System crashes when radeon firmware blob (R520_cp.bin) is installed

2012-02-02 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=43835

--- Comment #51 from Camale?n  2012-02-02 08:34:48 PST 
---
(In reply to comment #50)
> Argh, I mean bug 45329.

Thank you, we can do try... what would be the "easy peasy" way to go for it?
Mainline kernel 3.3-rc2 contains the mentioned patches? Are there any other
packages involved? By reading bug's #45329 comment 9 looks like
"xf86-video-ati" also needs to be patched :-?

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


[PATCH v2] drm/radeon/kms/blit: fix blit copy for very large buffers

2012-02-02 Thread Michel Dänzer
On Don, 2012-02-02 at 10:26 -0500, Ilija Hadzic wrote: 
> Evergreen and NI blit copy was broken if the buffer maps to a rectangle
> whose one dimension is 16384 (max dimension allowed by these chips).
> In the mainline kernel, the problem is exposed only when buffers are
> very large (1G), but it's still a problem. The problem could be exposed
> for smaller buffers if anyone modifies the algorithm for rectangle
> construction in r600_blit_create_rect() (the reason why someone would
> modify that algorithm is to tune the performance of buffer moves).
> 
> The root cause was in i2f() function which only operated on range between
> 0 and 16383. Fix this by extending the range of i2f() function to 0 to
> 32767.
> 
> While at it improve the function so that the range can be easily
> extended in the future (if it becomes necessary), cleanup lines
> over 80 characters, and replace in-line comments with one strategic
> comment that explains the crux of the function.
> 
> Credits to michel at daenzer.net for pointing out the root cause of
> the bug.
> 
> v2: Fix I2F_MAX_INPUT constant definition goof and warn only once
> if input argument is out of range. Edit the comment a little
> bit to avoid some linguistic confusion and make it look better
> in general.
> 
> Signed-off-by: Ilija Hadzic 

Reviewed-by: Michel D?nzer 


-- 
Earthling Michel D?nzer   |   http://www.amd.com
Libre software enthusiast |  Debian, X and DRI developer


[git pull] drm radeon + nouveau fixes

2012-02-02 Thread Dave Airlie

Hi Linus,

A set of fixes from nouveau and radeon, one reported regression about 
reading BIOS roms on certain dual-gpu laptops is fixed (use after free),
along with a s/r black screen fix, and a GPU hang fix.

Dave.


The following changes since commit 62aa2b537c6f5957afd98e29f96897419ed5ebab:

  Linux 3.3-rc2 (2012-01-31 13:31:54 -0800)

are available in the git repository at:
  git://people.freedesktop.org/~airlied/linux drm-fixes

Alex Deucher (1):
  drm/radeon/kms: fix TRAVIS panel setup

Ben Skeggs (4):
  drm/nouveau/disp: check that panel power gpio is enabled at init time
  drm/nouveau/mxm: pretend to succeed, even if we can't shadow the MXM-SIS
  drm/nouveau: fix typo on mxmdcb option
  drm/nouveau/gem: fix fence_sync race / oops

Dan Carpenter (1):
  drm/nv50/pm: signedness bug in nv50_pm_clocks_pre()

Dave Airlie (2):
  Merge branch 'drm-nouveau-fixes' of 
git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-fixes
  drm/radeon: fix use after free in ATRM bios reading code.

Ilija Hadzic (1):
  drm/radeon/kms/blit: fix blit copy for very large buffers

Jean Delvare (1):
  drm/radeon/kms: Fix device tree linkage of DP i2c buses too

Michel D?nzer (1):
  drm/radeon: Set DESKTOP_HEIGHT register to the framebuffer (not mode) 
height.

Seth Forshee (1):
  drm/radeon/kms: disable output polling when suspended

 drivers/gpu/drm/nouveau/nouveau_bios.h   |5 ++-
 drivers/gpu/drm/nouveau/nouveau_display.c|   10 +++
 drivers/gpu/drm/nouveau/nouveau_drv.c|2 +-
 drivers/gpu/drm/nouveau/nouveau_gem.c|   23 +++-
 drivers/gpu/drm/nouveau/nouveau_mxm.c|9 ++
 drivers/gpu/drm/nouveau/nv50_pm.c|4 +-
 drivers/gpu/drm/radeon/atombios_crtc.c   |4 +-
 drivers/gpu/drm/radeon/atombios_dp.c |   18 +++--
 drivers/gpu/drm/radeon/r600_blit_kms.c   |   35 ++---
 drivers/gpu/drm/radeon/radeon_atpx_handler.c |3 +-
 drivers/gpu/drm/radeon/radeon_device.c   |4 +++
 drivers/gpu/drm/radeon/radeon_i2c.c  |1 +
 12 files changed, 95 insertions(+), 23 deletions(-)


[PATCH] drm/radeon: do not continue after error from r600_ib_test

2012-02-02 Thread Alex Deucher
On Thu, Feb 2, 2012 at 3:23 PM, Matthijs Kooijman  wrote:
> This return statement got dropped while fixing the conflicts introduced
> in 7a7e8734ac3.
> ---
> ?drivers/gpu/drm/radeon/evergreen.c | ? ?1 +
> ?1 files changed, 1 insertions(+), 0 deletions(-)
>
> Note that I've not actually tested this change, I just noticed when
> reviewing the mentioned merge commit. If the removal of the return
> statement was intentional, this patch makes no sense (but sending a
> patch was the easiest way to point out this bug).

Patch is correct.

Reviewed-by: Alex Deucher 

>
> diff --git a/drivers/gpu/drm/radeon/evergreen.c 
> b/drivers/gpu/drm/radeon/evergreen.c
> index ccde2c9..5056a53 100644
> --- a/drivers/gpu/drm/radeon/evergreen.c
> +++ b/drivers/gpu/drm/radeon/evergreen.c
> @@ -3190,6 +3190,7 @@ static int evergreen_startup(struct radeon_device *rdev)
> ? ? ? ?if (r) {
> ? ? ? ? ? ? ? ?DRM_ERROR("radeon: failed testing IB (%d).\n", r);
> ? ? ? ? ? ? ? ?rdev->accel_working = false;
> + ? ? ? ? ? ? ? return r;
> ? ? ? ?}
>
> ? ? ? ?r = r600_audio_init(rdev);
> --
> 1.7.7.3
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 34155] [drm:radeon_crtc_page_flip] *ERROR* failed to reserve new rbo buffer before flip

2012-02-02 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=34155

--- Comment #7 from Michel D?nzer  2012-02-02 07:56:37 
PST ---
Created attachment 56529
  --> https://bugs.freedesktop.org/attachment.cgi?id=56529
Add return value to error message

Please apply this debugging patch and post the value(s) of r when the message
occurs again.

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


[Bug 34155] [drm:radeon_crtc_page_flip] *ERROR* failed to reserve new rbo buffer before flip

2012-02-02 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=34155

--- Comment #6 from Marco Albanese  2012-02-02 07:26:13 
PST ---
(In reply to comment #4)
> Are there also 'reserve failed' messages before the messages referenced in the
> original report?

No, there aren't. Is the only type of "reserve failed" I got.

> 
> Do you notice any problem other than the messages?

Mhm.. seems not. I've noticed anything related with radeon but, you can check
in the attachment of my dmesg.

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


[Bug 34155] [drm:radeon_crtc_page_flip] *ERROR* failed to reserve new rbo buffer before flip

2012-02-02 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=34155

--- Comment #5 from Marco Albanese  2012-02-02 07:26:00 
PST ---
Created attachment 56520
  --> https://bugs.freedesktop.org/attachment.cgi?id=56520
Dmesg with "failed to reserve"

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


[PATCH 4/4] intel, gma500, lvds: Fix use after free and mem leak in psb_intel_lvds_init()

2012-02-02 Thread Alan Cox
From: Jesper Juhl 

In psb_intel_lvds_init(), if we fail to allocate memory for
'psb_intel_connector' we free the memory we previously allocated for
'psb_intel_encoder', but we then proceed to use that free'd pointer
when we do 'psb_intel_encoder->dev_priv = lvds_priv;'.

We may also leak the memory we allocated for 'psb_intel_encoder' if we
'goto failed_connector;' and the variable goes out of scope.

While I was there anyway, I also removed the pointless 'if
(psb_intel_connector)' before freeing it at the 'failed_connector:'
label - kfree() deals gracefully with NULL pointers, so it is not
needed.

Signed-off-by: Jesper Juhl 
Signed-off-by: Alan Cox 
---

 drivers/gpu/drm/gma500/psb_intel_lvds.c |9 -
 1 files changed, 4 insertions(+), 5 deletions(-)


diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c 
b/drivers/gpu/drm/gma500/psb_intel_lvds.c
index 69a9651..c83f5b5 100644
--- a/drivers/gpu/drm/gma500/psb_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c
@@ -713,7 +713,6 @@ void psb_intel_lvds_init(struct drm_device *dev,

psb_intel_encoder =
kzalloc(sizeof(struct psb_intel_encoder), GFP_KERNEL);
-
if (!psb_intel_encoder) {
dev_err(dev->dev, "psb_intel_encoder allocation error\n");
return;
@@ -721,10 +720,9 @@ void psb_intel_lvds_init(struct drm_device *dev,

psb_intel_connector =
kzalloc(sizeof(struct psb_intel_connector), GFP_KERNEL);
-
if (!psb_intel_connector) {
-   kfree(psb_intel_encoder);
dev_err(dev->dev, "psb_intel_connector allocation error\n");
+   goto failed_encoder;
}

lvds_priv = kzalloc(sizeof(struct psb_intel_lvds_priv), GFP_KERNEL);
@@ -862,7 +860,8 @@ failed_blc_i2c:
drm_encoder_cleanup(encoder);
drm_connector_cleanup(connector);
 failed_connector:
-   if (psb_intel_connector)
-   kfree(psb_intel_connector);
+   kfree(psb_intel_connector);
+failed_encoder:
+   kfree(psb_intel_encoder);
 }




[PATCH 3/4] gma500: Kconfig documentation tweak

2012-02-02 Thread Alan Cox
From: Alan Cox 

Update this to better reflect the status

Signed-off-by: Alan Cox 
---

 drivers/gpu/drm/gma500/Kconfig |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)


diff --git a/drivers/gpu/drm/gma500/Kconfig b/drivers/gpu/drm/gma500/Kconfig
index 754e14b..f92a7f4 100644
--- a/drivers/gpu/drm/gma500/Kconfig
+++ b/drivers/gpu/drm/gma500/Kconfig
@@ -16,8 +16,7 @@ config DRM_GMA600
depends on DRM_GMA500
help
  Say yes to include support for GMA600 (Intel Moorestown/Oaktrail)
- platforms with LVDS ports. HDMI and MIPI are not currently
- supported.
+ platforms with LVDS ports. MIPI is not currently supported.

 config DRM_GMA3600
bool "Intel GMA3600/3650 support (Experimental)"



[PATCH 2/4] gma500: now move the Oaktrail save state into its own structure

2012-02-02 Thread Alan Cox
From: Alan Cox 

Signed-off-by: Alan Cox 
---

 drivers/gpu/drm/gma500/cdv_intel_display.c |   27 ++-
 drivers/gpu/drm/gma500/cdv_intel_lvds.c|6 -
 drivers/gpu/drm/gma500/oaktrail_device.c   |  204 +
 drivers/gpu/drm/gma500/oaktrail_hdmi.c |   72 +
 drivers/gpu/drm/gma500/oaktrail_lvds.c |2 
 drivers/gpu/drm/gma500/power.c |8 -
 drivers/gpu/drm/gma500/psb_device.c|   34 ++--
 drivers/gpu/drm/gma500/psb_drv.h   |  226 +++-
 drivers/gpu/drm/gma500/psb_intel_display.c |   27 ++-
 drivers/gpu/drm/gma500/psb_intel_lvds.c|   12 +
 10 files changed, 322 insertions(+), 296 deletions(-)


diff --git a/drivers/gpu/drm/gma500/cdv_intel_display.c 
b/drivers/gpu/drm/gma500/cdv_intel_display.c
index 18d1152..dc9e246 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_display.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_display.c
@@ -968,7 +968,7 @@ void cdv_intel_crtc_load_lut(struct drm_crtc *crtc)
gma_power_end(dev);
} else {
for (i = 0; i < 256; i++) {
-   dev_priv->save_palette_a[i] =
+   dev_priv->regs.save_palette_a[i] =
  ((psb_intel_crtc->lut_r[i] +
  psb_intel_crtc->lut_adj[i]) << 16) |
  ((psb_intel_crtc->lut_g[i] +
@@ -1338,18 +1338,19 @@ static int cdv_intel_crtc_clock_get(struct drm_device 
*dev,
gma_power_end(dev);
} else {
dpll = (pipe == 0) ?
-   dev_priv->saveDPLL_A : dev_priv->saveDPLL_B;
+   dev_priv->regs.saveDPLL_A : dev_priv->regs.saveDPLL_B;

if ((dpll & DISPLAY_RATE_SELECT_FPA1) == 0)
fp = (pipe == 0) ?
-   dev_priv->saveFPA0 :
-   dev_priv->saveFPB0;
+   dev_priv->regs.saveFPA0 :
+   dev_priv->regs.saveFPB0;
else
fp = (pipe == 0) ?
-   dev_priv->saveFPA1 :
-   dev_priv->saveFPB1;
+   dev_priv->regs.saveFPA1 :
+   dev_priv->regs.saveFPB1;

-   is_lvds = (pipe == 1) && (dev_priv->saveLVDS & LVDS_PORT_EN);
+   is_lvds = (pipe == 1) &&
+   (dev_priv->regs.saveLVDS & LVDS_PORT_EN);
}

clock.m1 = (fp & FP_M1_DIV_MASK) >> FP_M1_DIV_SHIFT;
@@ -1419,13 +1420,17 @@ struct drm_display_mode *cdv_intel_crtc_mode_get(struct 
drm_device *dev,
gma_power_end(dev);
} else {
htot = (pipe == 0) ?
-   dev_priv->saveHTOTAL_A : dev_priv->saveHTOTAL_B;
+   dev_priv->regs.saveHTOTAL_A :
+   dev_priv->regs.saveHTOTAL_B;
hsync = (pipe == 0) ?
-   dev_priv->saveHSYNC_A : dev_priv->saveHSYNC_B;
+   dev_priv->regs.saveHSYNC_A :
+   dev_priv->regs.saveHSYNC_B;
vtot = (pipe == 0) ?
-   dev_priv->saveVTOTAL_A : dev_priv->saveVTOTAL_B;
+   dev_priv->regs.saveVTOTAL_A :
+   dev_priv->regs.saveVTOTAL_B;
vsync = (pipe == 0) ?
-   dev_priv->saveVSYNC_A : dev_priv->saveVSYNC_B;
+   dev_priv->regs.saveVSYNC_A :
+   dev_priv->regs.saveVSYNC_B;
}

mode = kzalloc(sizeof(*mode), GFP_KERNEL);
diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c 
b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
index 50e744b..79b47d2 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
@@ -78,7 +78,7 @@ static u32 cdv_intel_lvds_get_max_backlight(struct drm_device 
*dev)

gma_power_end(dev);
} else
-   retval = ((dev_priv->saveBLC_PWM_CTL &
+   retval = ((dev_priv->regs.saveBLC_PWM_CTL &
  BACKLIGHT_MODULATION_FREQ_MASK) >>
  BACKLIGHT_MODULATION_FREQ_SHIFT) * 2;

@@ -184,9 +184,9 @@ static void cdv_intel_lvds_set_backlight(struct drm_device 
*dev, int level)
(level << BACKLIGHT_DUTY_CYCLE_SHIFT)));
gma_power_end(dev);
} else {
-   blc_pwm_ctl = dev_priv->saveBLC_PWM_CTL &
+   blc_pwm_ctl = dev_priv->regs.saveBLC_PWM_CTL &
~BACKLIGHT_DUTY_CYCLE_MASK;
-   dev_priv->saveBLC_PWM_CTL = (blc_pwm_ctl |
+   dev_priv->regs.saveBLC_PWM_CTL = (blc_pwm_ctl |
(level << BACKLIGHT_DUTY_CYCLE_SHIFT));
}
 }
diff --git a/drivers/gpu/drm/gma500/oaktrail_device.c 

[PATCH 1/4] gma500: clean up some of the struct fields we no longer use

2012-02-02 Thread Alan Cox
From: Alan Cox 

Some this is Medfield stuff that may reappear in some form later, other
bits are just dead stuff

Signed-off-by: Alan Cox 
---

 drivers/gpu/drm/gma500/oaktrail_crtc.c |3 -
 drivers/gpu/drm/gma500/psb_drv.h   |   94 +---
 2 files changed, 2 insertions(+), 95 deletions(-)


diff --git a/drivers/gpu/drm/gma500/oaktrail_crtc.c 
b/drivers/gpu/drm/gma500/oaktrail_crtc.c
index 9d12a3e..ff4f7ad 100644
--- a/drivers/gpu/drm/gma500/oaktrail_crtc.c
+++ b/drivers/gpu/drm/gma500/oaktrail_crtc.c
@@ -428,9 +428,6 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc,
else
dspcntr |= DISPPLANE_SEL_PIPE_B;

-   dev_priv->dspcntr = dspcntr |= DISPLAY_PLANE_ENABLE;
-   dev_priv->pipeconf = pipeconf |= PIPEACONF_ENABLE;
-
if (is_mipi)
goto oaktrail_crtc_mode_set_exit;

diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
index eb1568a..a84a9ec 100644
--- a/drivers/gpu/drm/gma500/psb_drv.h
+++ b/drivers/gpu/drm/gma500/psb_drv.h
@@ -397,33 +397,9 @@ struct drm_psb_private {
struct oaktrail_vbt vbt_data;
struct oaktrail_gct_data gct_data;

-   /* MIPI Panel type etc */
-   int panel_id;
-   bool dual_mipi; /* dual display - DPI & DBI */
-   bool dpi_panel_on;  /* The DPI panel power is on */
-   bool dpi_panel_on2; /* The DPI panel power is on */
-   bool dbi_panel_on;  /* The DBI panel power is on */
-   bool dbi_panel_on2; /* The DBI panel power is on */
-   u32 dsr_fb_update;  /* DSR FB update counter */
-
-   /* Moorestown HDMI state */
+   /* Oaktrail HDMI state */
struct oaktrail_hdmi_dev *hdmi_priv;
-
-   /* Moorestown pipe config register value cache */
-   uint32_t pipeconf;
-   uint32_t pipeconf1;
-   uint32_t pipeconf2;
-
-   /* Moorestown plane control register value cache */
-   uint32_t dspcntr;
-   uint32_t dspcntr1;
-   uint32_t dspcntr2;
-
-   /* Moorestown MM backlight cache */
-   uint8_t saveBKLTCNT;
-   uint8_t saveBKLTREQ;
-   uint8_t saveBKLTBRTL;
-
+   
/*
 * Register state
 */
@@ -535,78 +511,12 @@ struct drm_psb_private {
uint32_t msi_addr;
uint32_t msi_data;

-   /* Medfield specific register save state */
-   uint32_t saveHDMIPHYMISCCTL;
-   uint32_t saveHDMIB_CONTROL;
-   uint32_t saveDSPCCNTR;
-   uint32_t savePIPECCONF;
-   uint32_t savePIPECSRC;
-   uint32_t saveHTOTAL_C;
-   uint32_t saveHBLANK_C;
-   uint32_t saveHSYNC_C;
-   uint32_t saveVTOTAL_C;
-   uint32_t saveVBLANK_C;
-   uint32_t saveVSYNC_C;
-   uint32_t saveDSPCSTRIDE;
-   uint32_t saveDSPCSIZE;
-   uint32_t saveDSPCPOS;
-   uint32_t saveDSPCSURF;
-   uint32_t saveDSPCSTATUS;
-   uint32_t saveDSPCLINOFF;
-   uint32_t saveDSPCTILEOFF;
-   uint32_t saveDSPCCURSOR_CTRL;
-   uint32_t saveDSPCCURSOR_BASE;
-   uint32_t saveDSPCCURSOR_POS;
-   uint32_t save_palette_c[256];
-   uint32_t saveOV_OVADD_C;
-   uint32_t saveOV_OGAMC0_C;
-   uint32_t saveOV_OGAMC1_C;
-   uint32_t saveOV_OGAMC2_C;
-   uint32_t saveOV_OGAMC3_C;
-   uint32_t saveOV_OGAMC4_C;
-   uint32_t saveOV_OGAMC5_C;
-
-   /* DSI register save */
-   uint32_t saveDEVICE_READY_REG;
-   uint32_t saveINTR_EN_REG;
-   uint32_t saveDSI_FUNC_PRG_REG;
-   uint32_t saveHS_TX_TIMEOUT_REG;
-   uint32_t saveLP_RX_TIMEOUT_REG;
-   uint32_t saveTURN_AROUND_TIMEOUT_REG;
-   uint32_t saveDEVICE_RESET_REG;
-   uint32_t saveDPI_RESOLUTION_REG;
-   uint32_t saveHORIZ_SYNC_PAD_COUNT_REG;
-   uint32_t saveHORIZ_BACK_PORCH_COUNT_REG;
-   uint32_t saveHORIZ_FRONT_PORCH_COUNT_REG;
-   uint32_t saveHORIZ_ACTIVE_AREA_COUNT_REG;
-   uint32_t saveVERT_SYNC_PAD_COUNT_REG;
-   uint32_t saveVERT_BACK_PORCH_COUNT_REG;
-   uint32_t saveVERT_FRONT_PORCH_COUNT_REG;
-   uint32_t saveHIGH_LOW_SWITCH_COUNT_REG;
-   uint32_t saveINIT_COUNT_REG;
-   uint32_t saveMAX_RET_PAK_REG;
-   uint32_t saveVIDEO_FMT_REG;
-   uint32_t saveEOT_DISABLE_REG;
-   uint32_t saveLP_BYTECLK_REG;
-   uint32_t saveHS_LS_DBI_ENABLE_REG;
-   uint32_t saveTXCLKESC_REG;
-   uint32_t saveDPHY_PARAM_REG;
-   uint32_t saveMIPI_CONTROL_REG;
-   uint32_t saveMIPI;
-   uint32_t saveMIPI_C;
-
/* DPST register save */
uint32_t saveHISTOGRAM_INT_CONTROL_REG;
uint32_t saveHISTOGRAM_LOGIC_CONTROL_REG;
uint32_t savePWM_CONTROL_LOGIC;

/*
-* DSI info. 
-*/
-   void * dbi_dsr_info;
-   void * dbi_dpu_info;
-   void * dsi_configs[2];
-   /*
 * LID-Switch
 */
spinlock_t lid_lock;



[PATCH 2/2] gma500: plug in more of the gamma functionality

2012-02-02 Thread Alan Cox
From: Alan Cox 

Signed-off-by: Alan Cox 
---

 drivers/gpu/drm/gma500/framebuffer.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)


diff --git a/drivers/gpu/drm/gma500/framebuffer.c 
b/drivers/gpu/drm/gma500/framebuffer.c
index 791c0ef..97d5b80 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -560,11 +560,21 @@ static struct drm_framebuffer *psb_user_framebuffer_create
 static void psbfb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
u16 blue, int regno)
 {
+   struct psb_intel_crtc *intel_crtc = to_psb_intel_crtc(crtc);
+
+   intel_crtc->lut_r[regno] = red >> 8;
+   intel_crtc->lut_g[regno] = green >> 8;
+   intel_crtc->lut_b[regno] = blue >> 8;
 }

 static void psbfb_gamma_get(struct drm_crtc *crtc, u16 *red,
u16 *green, u16 *blue, int regno)
 {
+   struct psb_intel_crtc *intel_crtc = to_psb_intel_crtc(crtc);
+
+   *red = intel_crtc->lut_r[regno] << 8;
+   *green = intel_crtc->lut_g[regno] << 8;
+   *blue = intel_crtc->lut_b[regno] << 8;
 }

 static int psbfb_probe(struct drm_fb_helper *helper,



[PATCH 1/2] gma500: Fix leak of uncached page

2012-02-02 Thread Alan Cox
(Resending in two bits to avoid stgit breakage)

From: Alan Cox 

This was reported a long time ago (and I apologize to whoever it was that
reported it as I've lost the original report).

Signed-off-by: Alan Cox 
---

 drivers/gpu/drm/gma500/psb_drv.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)


diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index f14768f..653f439 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -239,6 +239,7 @@ static int psb_driver_unload(struct drm_device *dev)
}
psb_gtt_takedown(dev);
if (dev_priv->scratch_page) {
+   set_pages_wb(dev_priv->scratch_page, 1);
__free_page(dev_priv->scratch_page);
dev_priv->scratch_page = NULL;
}



[PATCH 2/7] gma500: plug in more of the gamma functionality

2012-02-02 Thread Alan Cox
From: Alan Cox 

Signed-off-by: Alan Cox 
---

 drivers/gpu/drm/gma500/framebuffer.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)


diff --git a/drivers/gpu/drm/gma500/framebuffer.c 
b/drivers/gpu/drm/gma500/framebuffer.c
index 791c0ef..97d5b80 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -560,11 +560,21 @@ static struct drm_framebuffer *psb_user_framebuffer_create
 static void psbfb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
u16 blue, int regno)
 {
+   struct psb_intel_crtc *intel_crtc = to_psb_intel_crtc(crtc);
+
+   intel_crtc->lut_r[regno] = red >> 8;
+   intel_crtc->lut_g[regno] = green >> 8;
+   intel_crtc->lut_b[regno] = blue >> 8;
 }

 static void psbfb_gamma_get(struct drm_crtc *crtc, u16 *red,
u16 *green, u16 *blue, int regno)
 {
+   struct psb_intel_crtc *intel_crtc = to_psb_intel_crtc(crtc);
+
+   *red = intel_crtc->lut_r[regno] << 8;
+   *green = intel_crtc->lut_g[regno] << 8;
+   *blue = intel_crtc->lut_b[regno] << 8;
 }

 static int psbfb_probe(struct drm_fb_helper *helper,



[PATCH 1/7] gma500: Fix leak of uncached page

2012-02-02 Thread Alan Cox
From: Alan Cox 

This was reported a long time ago (and I apologize to whoever it was that
reported it as I've lost the original report).

Signed-off-by: Alan Cox 
---

 drivers/gpu/drm/gma500/psb_drv.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)


diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index f14768f..653f439 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -239,6 +239,7 @@ static int psb_driver_unload(struct drm_device *dev)
}
psb_gtt_takedown(dev);
if (dev_priv->scratch_page) {
+   set_pages_wb(dev_priv->scratch_page, 1);
__free_page(dev_priv->scratch_page);
dev_priv->scratch_page = NULL;
}



[PATCH] drm cleanup patches

2012-02-02 Thread Sascha Hauer
Hi David,

On Wed, Feb 01, 2012 at 11:38:18AM +0100, Sascha Hauer wrote:
> The following patches contain some fixes and cleanups for the drm
> core.
> 
> - fix memory holes
> - make some initialization / deinitialization more symmetric
> - add convenience functions for creating properties
> - remove DRM_CONNECTOR_MAX_PROPERTY limitation
> 
> All patches tested on a GeForce 6200 LE with the nouveau driver and
> a DELL E6220 Laptop using the intel driver.
> 
> Please review and consider applying

Is the series otherwise series ok? If yes I would integrate the comments
received so far and repost.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |


[Bug 45503] [drm:radeon_get_bios] *ERROR* Unable to locate a BIOS ROM

2012-02-02 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=45503

--- Comment #12 from Dave Airlie  2012-02-02 
06:59:30 PST ---
arrgh good catch, I'll send a patch with that fix now,

thanks for tracking that down.

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


libdrm release on friday ?

2012-02-02 Thread Jerome Glisse
On Thu, Feb 02, 2012 at 07:13:21PM +0200, Ville Syrj?l? wrote:
> On Wed, Feb 01, 2012 at 07:10:10PM -0500, Jerome Glisse wrote:
> > Hi,
> > 
> > I plan to do a libdrm release on friday because ddx/mesa work i have
> > been doing depends on thing i added to libdrm/radeon. Is anybody else
> > working on some libdrm related code that would need a release ?
> 
> AFAICS these never made it in:
> Message-Id: <1324405614-18547-1-git-send-email-ville.syrjala at 
> linux.intel.com>
> Message-Id: <1324405614-18547-2-git-send-email-ville.syrjala at 
> linux.intel.com>
> Message-Id: <1324405614-18547-3-git-send-email-ville.syrjala at 
> linux.intel.com>
> 
> Would be nice if you could scoop them up.
> 
> -- 
> Ville Syrj?l?
> Intel OTC

Ok found them, and reviewed & pushed

Cheers,
Jerome


libdrm release on friday ?

2012-02-02 Thread Jerome Glisse
On Thu, Feb 02, 2012 at 07:13:21PM +0200, Ville Syrj?l? wrote:
> On Wed, Feb 01, 2012 at 07:10:10PM -0500, Jerome Glisse wrote:
> > Hi,
> > 
> > I plan to do a libdrm release on friday because ddx/mesa work i have
> > been doing depends on thing i added to libdrm/radeon. Is anybody else
> > working on some libdrm related code that would need a release ?
> 
> AFAICS these never made it in:
> Message-Id: <1324405614-18547-1-git-send-email-ville.syrjala at 
> linux.intel.com>
> Message-Id: <1324405614-18547-2-git-send-email-ville.syrjala at 
> linux.intel.com>
> Message-Id: <1324405614-18547-3-git-send-email-ville.syrjala at 
> linux.intel.com>
> 
> Would be nice if you could scoop them up.
> 
> -- 
> Ville Syrj?l?
> Intel OTC

I don't think i can use the link you supplied :)

Cheers,
Jerome


[Bug 43835] System crashes when radeon firmware blob (R520_cp.bin) is installed

2012-02-02 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=43835

--- Comment #50 from Michel D?nzer  2012-02-02 06:36:59 
PST ---
Argh, I mean bug 45329.

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


[Bug 43835] System crashes when radeon firmware blob (R520_cp.bin) is installed

2012-02-02 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=43835

--- Comment #49 from Michel D?nzer  2012-02-02 06:36:30 
PST ---
The kernel DESKTOP_HEIGHT fix from bug 43835 might help for the GPU lockups.

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


[PATCH] drm: cleanup device registration

2012-02-02 Thread Alan Cox
> I see. For example the i810 also has a framebuffer driver. Do you see
> a way to fix this except writing a kms driver for all legacy devices?
> Otherwise I would leave the pci part untouched and only keep the
> platform/USB pieces which I'm admittedly more interested in.

Which is obsolete and unmaintained. More of a problem would be the
various ati framebuffer drivers.

I would like to see Linux move to the situation where if there is a
driver for a given device its either one or the other not one and some
legacy code which is just extra work.

Doesn't need to be "all KMS" - but for any given card either/or seems
perfectly reasonable.

The big thing that is needed is someone crazy enough to write a KMS
driver to replace vesa/uvesafb and the like.

Alan


[Bug 43835] System crashes when radeon firmware blob (R520_cp.bin) is installed

2012-02-02 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=43835

--- Comment #48 from Camale?n  2012-02-02 06:23:13 PST 
---
Created attachment 56518
  --> https://bugs.freedesktop.org/attachment.cgi?id=56518
Output of "xrandr"

In reply to comment #47, I'm attaching the output of "xrandr".

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


[Bug 45503] [drm:radeon_get_bios] *ERROR* Unable to locate a BIOS ROM

2012-02-02 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=45503

--- Comment #11 from mlambda at gmail.com 2012-02-02 06:22:03 PST ---
Created attachment 56517
  --> https://bugs.freedesktop.org/attachment.cgi?id=56517
dmesg with my patch

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


[Bug 45503] [drm:radeon_get_bios] *ERROR* Unable to locate a BIOS ROM

2012-02-02 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=45503

--- Comment #10 from mlambda at gmail.com 2012-02-02 06:20:36 PST ---
I just found the solution:

diff -ur a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c2012-01-31
22:31:54.0 +0100
+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c2012-02-02
15:03:32.408629788 +0100
@@ -58,9 +58,12 @@
 }

 obj = (union acpi_object *)buffer.pointer;
+printk("obj->buffer.length: %i\n", obj->buffer.length);
+printk("len: %i\n", len);
 memcpy(bios+offset, obj->buffer.pointer, obj->buffer.length);
+len = obj->buffer.length;
 kfree(buffer.pointer);
-return obj->buffer.length;
+return len;
 }

 bool radeon_atrm_supported(struct pci_dev *pdev)

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


[PATCH] drm: cleanup device registration

2012-02-02 Thread Sascha Hauer
On Thu, Feb 02, 2012 at 07:05:00AM -0500, David Airlie wrote:
> - Original Message -
> > From: "Sascha Hauer" 
> > To: dri-devel at lists.freedesktop.org
> > Cc: "Inki Dae" , kernel at pengutronix.de
> > Sent: Thursday, 2 February, 2012 11:57:52 AM
> > Subject: [PATCH] drm: cleanup device registration
> > 
> > The non modesetting drm drivers currently use a handcrafted pci probe
> > function. This requires the drm core to keep a list of registered
> > devices
> > for each driver. This series adds a probe function for the non
> > modesetting
> > drivers and removes the legacy probe code. The USB and platform
> > drivers
> > use the devices_list aswell which is unnecessary. This is also
> > cleaned
> > up in this series.
> 
> No it can't work like this because we have conflicts between fb and drm 
> drivers, so the DRM is required to do its own
> probe if an fb driver for a device is already loaded.
> 
> it can't use the PCI probe out of the box.

I see. For example the i810 also has a framebuffer driver. Do you see
a way to fix this except writing a kms driver for all legacy devices?
Otherwise I would leave the pci part untouched and only keep the
platform/USB pieces which I'm admittedly more interested in.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |


[PATCH 12/12] drm usb: use drm_register_device

2012-02-02 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 drivers/gpu/drm/drm_usb.c |   43 ++-
 1 files changed, 2 insertions(+), 41 deletions(-)

diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c
index dd154d4..b741b54 100644
--- a/drivers/gpu/drm/drm_usb.c
+++ b/drivers/gpu/drm/drm_usb.c
@@ -24,52 +24,13 @@ int drm_get_usb_dev(struct usb_interface *interface,
usbdev = interface_to_usbdev(interface);
dev->dev = >dev;

-   mutex_lock(_global_mutex);
-
-   ret = drm_fill_in_dev(dev, NULL, driver);
-   if (ret) {
-   printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
-   goto err_g1;
-   }
-
usb_set_intfdata(interface, dev);
-   ret = drm_get_minor(dev, >control, DRM_MINOR_CONTROL);
-   if (ret)
-   goto err_g1;
-
-   ret = drm_get_minor(dev, >primary, DRM_MINOR_LEGACY);
-   if (ret)
-   goto err_g2;
-
-   if (dev->driver->load) {
-   ret = dev->driver->load(dev, 0);
-   if (ret)
-   goto err_g3;
-   }

-   /* setup the grouping for the legacy output */
-   ret = drm_mode_group_init_legacy_group(dev,
-  >primary->mode_group);
+   ret = drm_register_device(dev, driver, 0);
if (ret)
-   goto err_g3;
+   kfree(dev);

-   mutex_unlock(_global_mutex);
-
-   DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
-driver->name, driver->major, driver->minor, driver->patchlevel,
-driver->date, dev->primary->index);
-
-   return 0;
-
-err_g3:
-   drm_put_minor(>primary);
-err_g2:
-   drm_put_minor(>control);
-err_g1:
-   kfree(dev);
-   mutex_unlock(_global_mutex);
return ret;
-
 }
 EXPORT_SYMBOL(drm_get_usb_dev);

-- 
1.7.8.3



[PATCH 11/12] drm platform: use drm_register_device

2012-02-02 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 drivers/gpu/drm/drm_platform.c |   51 ++-
 1 files changed, 3 insertions(+), 48 deletions(-)

diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c
index 7153508..5d5e388 100644
--- a/drivers/gpu/drm/drm_platform.c
+++ b/drivers/gpu/drm/drm_platform.c
@@ -56,57 +56,12 @@ int drm_get_platform_dev(struct platform_device *platdev,
dev->dev = >dev;

driver->bus = _platform_bus;
+   dev_set_drvdata(>dev, dev);

-   mutex_lock(_global_mutex);
-
-   ret = drm_fill_in_dev(dev, NULL, driver);
-
-   if (ret) {
-   printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
-   goto err_g1;
-   }
-
-   if (drm_core_check_feature(dev, DRIVER_MODESET)) {
-   dev_set_drvdata(>dev, dev);
-   ret = drm_get_minor(dev, >control, DRM_MINOR_CONTROL);
-   if (ret)
-   goto err_g1;
-   }
-
-   ret = drm_get_minor(dev, >primary, DRM_MINOR_LEGACY);
+   ret = drm_register_device(dev, driver, 0);
if (ret)
-   goto err_g2;
-
-   if (dev->driver->load) {
-   ret = dev->driver->load(dev, 0);
-   if (ret)
-   goto err_g3;
-   }
-
-   /* setup the grouping for the legacy output */
-   if (drm_core_check_feature(dev, DRIVER_MODESET)) {
-   ret = drm_mode_group_init_legacy_group(dev,
-   >primary->mode_group);
-   if (ret)
-   goto err_g3;
-   }
-
-   mutex_unlock(_global_mutex);
-
-   DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
-driver->name, driver->major, driver->minor, driver->patchlevel,
-driver->date, dev->primary->index);
-
-   return 0;
+   kfree(dev);

-err_g3:
-   drm_put_minor(>primary);
-err_g2:
-   if (drm_core_check_feature(dev, DRIVER_MODESET))
-   drm_put_minor(>control);
-err_g1:
-   kfree(dev);
-   mutex_unlock(_global_mutex);
return ret;
 }
 EXPORT_SYMBOL(drm_get_platform_dev);
-- 
1.7.8.3



[PATCH 10/12] drm pci: use drm_register_device

2012-02-02 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 drivers/gpu/drm/drm_pci.c |   45 +++--
 1 files changed, 3 insertions(+), 42 deletions(-)

diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index c0d47ab..2407a1d 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -332,54 +332,15 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct 
pci_device_id *ent,
dev->hose = pdev->sysdata;
 #endif

-   mutex_lock(_global_mutex);
-
-   if ((ret = drm_fill_in_dev(dev, ent, driver))) {
-   printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
+   ret = drm_register_device(dev, driver, ent->driver_data);
+   if (ret)
goto err_g2;
-   }
-
-   if (drm_core_check_feature(dev, DRIVER_MODESET)) {
-   pci_set_drvdata(pdev, dev);
-   ret = drm_get_minor(dev, >control, DRM_MINOR_CONTROL);
-   if (ret)
-   goto err_g2;
-   }
-
-   if ((ret = drm_get_minor(dev, >primary, DRM_MINOR_LEGACY)))
-   goto err_g3;
-
-   if (dev->driver->load) {
-   ret = dev->driver->load(dev, ent->driver_data);
-   if (ret)
-   goto err_g4;
-   }
-
-   /* setup the grouping for the legacy output */
-   if (drm_core_check_feature(dev, DRIVER_MODESET)) {
-   ret = drm_mode_group_init_legacy_group(dev,
-   >primary->mode_group);
-   if (ret)
-   goto err_g4;
-   }
-
-   DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
-driver->name, driver->major, driver->minor, driver->patchlevel,
-driver->date, pci_name(pdev), dev->primary->index);

-   mutex_unlock(_global_mutex);
-   return 0;
-
-err_g4:
-   drm_put_minor(>primary);
-err_g3:
-   if (drm_core_check_feature(dev, DRIVER_MODESET))
-   drm_put_minor(>control);
+   return ret;
 err_g2:
pci_disable_device(pdev);
 err_g1:
kfree(dev);
-   mutex_unlock(_global_mutex);
return ret;
 }
 EXPORT_SYMBOL(drm_get_pci_dev);
-- 
1.7.8.3



[PATCH 09/12] drm: Add drm_register_device function

2012-02-02 Thread Sascha Hauer
pci, usb and platform support all duplicate the same code. Provide
a common function for this.

Signed-off-by: Sascha Hauer 
---
 drivers/gpu/drm/drm_stub.c |   56 
 include/drm/drmP.h |2 +
 2 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 6d7b083..c36b19c 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -320,6 +320,62 @@ int drm_fill_in_dev(struct drm_device *dev,
return retcode;
 }

+int drm_register_device(struct drm_device *dev, struct drm_driver *driver,
+   unsigned long flags)
+{
+   int ret;
+
+   mutex_lock(_global_mutex);
+
+   ret = drm_fill_in_dev(dev, NULL, driver);
+   if (ret) {
+   printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
+   goto err_g1;
+   }
+
+   if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+   ret = drm_get_minor(dev, >control, DRM_MINOR_CONTROL);
+   if (ret)
+   goto err_g1;
+   }
+
+   ret = drm_get_minor(dev, >primary, DRM_MINOR_LEGACY);
+   if (ret)
+   goto err_g2;
+
+   if (dev->driver->load) {
+   ret = dev->driver->load(dev, flags);
+   if (ret)
+   goto err_g3;
+   }
+
+   /* setup the grouping for the legacy output */
+   if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+   ret = drm_mode_group_init_legacy_group(dev,
+   >primary->mode_group);
+   if (ret)
+   goto err_g3;
+   }
+
+   mutex_unlock(_global_mutex);
+
+   DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
+driver->name, driver->major, driver->minor, driver->patchlevel,
+driver->date, dev->primary->index);
+
+   return 0;
+
+err_g3:
+   drm_put_minor(>primary);
+err_g2:
+   if (drm_core_check_feature(dev, DRIVER_MODESET))
+   drm_put_minor(>control);
+err_g1:
+   mutex_unlock(_global_mutex);
+
+   return ret;
+}
+EXPORT_SYMBOL(drm_register_device);

 /**
  * Get a secondary minor number.
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 3c14c05..467a9a5 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1651,6 +1651,8 @@ extern int drm_fill_in_dev(struct drm_device *dev,
   const struct pci_device_id *ent,
   struct drm_driver *driver);
 int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type);
+int drm_register_device(struct drm_device *dev, struct drm_driver *driver,
+   unsigned long flags);
 /*@}*/

 /* PCI section */
-- 
1.7.8.3



[PATCH 08/12] drm vmwgfx: remove unused field vmw_chipset from struct vmw_private

2012-02-02 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h |1 -
 2 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index f390f5f..8c7ac41 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -401,7 +401,6 @@ static int vmw_driver_load(struct drm_device *dev, unsigned 
long chipset)
memset(dev_priv, 0, sizeof(*dev_priv));

dev_priv->dev = dev;
-   dev_priv->vmw_chipset = chipset;
dev_priv->last_read_seqno = (uint32_t) -100;
mutex_init(_priv->hw_mutex);
mutex_init(_priv->cmdbuf_mutex);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h 
b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index dc27970..252dba2 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -194,7 +194,6 @@ struct vmw_private {
struct vmw_fifo_state fifo;

struct drm_device *dev;
-   unsigned long vmw_chipset;
unsigned int io_start;
uint32_t vram_start;
uint32_t vram_size;
-- 
1.7.8.3



[PATCH 07/12] drm: remove now unused device_list

2012-02-02 Thread Sascha Hauer
The driver core is better at tracking the devices
associated to a device, no need to do this ourselves.

Signed-off-by: Sascha Hauer 
---
 drivers/gpu/drm/drm_pci.c |1 -
 include/drm/drmP.h|3 ---
 2 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index b53427e..c0d47ab 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -399,7 +399,6 @@ int drm_pci_init(struct drm_driver *driver, struct 
pci_driver *pdriver)
 {
DRM_DEBUG("\n");

-   INIT_LIST_HEAD(>device_list);
driver->bus = _pci_bus;

return pci_register_driver(pdriver);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index d14c23a..3c14c05 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -915,9 +915,6 @@ struct drm_driver {
int num_ioctls;
const struct file_operations *fops;
struct drm_bus *bus;
-
-   /* List of devices hanging off this driver */
-   struct list_head device_list;
 };

 #define DRM_MINOR_UNASSIGNED 0
-- 
1.7.8.3



[PATCH 06/12] drm usb: drop drm_usb_init/exit

2012-02-02 Thread Sascha Hauer
Usb drivers can register themselves and call drm_get_usb_dev
in their probe function. We don't need a drm specific wrapper
function for this. As there are currently no users, none a
touched here.

Signed-off-by: Sascha Hauer 
---
 drivers/gpu/drm/drm_usb.c |   26 --
 include/drm/drm_usb.h |3 ---
 2 files changed, 4 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c
index b7eb64a..dd154d4 100644
--- a/drivers/gpu/drm/drm_usb.c
+++ b/drivers/gpu/drm/drm_usb.c
@@ -2,6 +2,8 @@
 #include 
 #include 

+static struct drm_bus drm_usb_bus;
+
 #ifdef CONFIG_USB
 int drm_get_usb_dev(struct usb_interface *interface,
const struct usb_device_id *id,
@@ -17,6 +19,8 @@ int drm_get_usb_dev(struct usb_interface *interface,
if (!dev)
return -ENOMEM;

+   driver->bus = _usb_bus;
+
usbdev = interface_to_usbdev(interface);
dev->dev = >dev;

@@ -49,8 +53,6 @@ int drm_get_usb_dev(struct usb_interface *interface,
if (ret)
goto err_g3;

-   list_add_tail(>driver_item, >device_list);
-
mutex_unlock(_global_mutex);

DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
@@ -92,24 +94,4 @@ static struct drm_bus drm_usb_bus = {
.get_name = drm_usb_get_name,
.set_busid = drm_usb_set_busid,
 };
-
-int drm_usb_init(struct drm_driver *driver, struct usb_driver *udriver)
-{
-   int res;
-   DRM_DEBUG("\n");
-
-   INIT_LIST_HEAD(>device_list);
-   driver->bus = _usb_bus;
-
-   res = usb_register(udriver);
-   return res;
-}
-EXPORT_SYMBOL(drm_usb_init);
-
-void drm_usb_exit(struct drm_driver *driver,
- struct usb_driver *udriver)
-{
-   usb_deregister(udriver);
-}
-EXPORT_SYMBOL(drm_usb_exit);
 #endif
diff --git a/include/drm/drm_usb.h b/include/drm/drm_usb.h
index 33506c11..198f90b 100644
--- a/include/drm/drm_usb.h
+++ b/include/drm/drm_usb.h
@@ -5,9 +5,6 @@

 #include 

-extern int drm_usb_init(struct drm_driver *driver, struct usb_driver *udriver);
-extern void drm_usb_exit(struct drm_driver *driver, struct usb_driver 
*udriver);
-
 int drm_get_usb_dev(struct usb_interface *interface,
const struct usb_device_id *id,
struct drm_driver *driver);
-- 
1.7.8.3



[PATCH 05/12] drm: use drm_get_platform_dev and drop drm_platform_init/exit

2012-02-02 Thread Sascha Hauer
drm_platform_init is modelled after the legacy pci probe
support. It initializes a device_list, but this list will
only ever have a single entry as it is specific to a single
platform device instance. Simplify this by calling
drm_get_platform_dev directly from the driver.

Signed-off-by: Sascha Hauer 
---
 drivers/gpu/drm/drm_platform.c  |   39 +++---
 drivers/gpu/drm/exynos/exynos_drm_drv.c |6 +++-
 include/drm/drmP.h  |3 --
 3 files changed, 8 insertions(+), 40 deletions(-)

diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c
index 453da2d..7153508 100644
--- a/drivers/gpu/drm/drm_platform.c
+++ b/drivers/gpu/drm/drm_platform.c
@@ -28,6 +28,8 @@
 #include 
 #include "drmP.h"

+static struct drm_bus drm_platform_bus;
+
 /**
  * Register.
  *
@@ -53,6 +55,8 @@ int drm_get_platform_dev(struct platform_device *platdev,

dev->dev = >dev;

+   driver->bus = _platform_bus;
+
mutex_lock(_global_mutex);

ret = drm_fill_in_dev(dev, NULL, driver);
@@ -87,8 +91,6 @@ int drm_get_platform_dev(struct platform_device *platdev,
goto err_g3;
}

-   list_add_tail(>driver_item, >device_list);
-
mutex_unlock(_global_mutex);

DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
@@ -165,36 +167,3 @@ static struct drm_bus drm_platform_bus = {
.get_name = drm_platform_get_name,
.set_busid = drm_platform_set_busid,
 };
-
-/**
- * Platform device initialization. Called direct from modules.
- *
- * \return zero on success or a negative number on failure.
- *
- * Initializes a drm_device structures,registering the
- * stubs
- *
- * Expands the \c DRIVER_PREINIT and \c DRIVER_POST_INIT macros before and
- * after the initialization for driver customization.
- */
-
-int drm_platform_init(struct drm_driver *driver, struct platform_device 
*platform_device)
-{
-   DRM_DEBUG("\n");
-
-   driver->bus = _platform_bus;
-   INIT_LIST_HEAD(>device_list);
-   return drm_get_platform_dev(platform_device, driver);
-}
-EXPORT_SYMBOL(drm_platform_init);
-
-void drm_platform_exit(struct drm_driver *driver, struct platform_device 
*platform_device)
-{
-   struct drm_device *dev, *tmp;
-   DRM_DEBUG("\n");
-
-   list_for_each_entry_safe(dev, tmp, >device_list, driver_item)
-   drm_put_dev(dev);
-   DRM_INFO("Module unloaded\n");
-}
-EXPORT_SYMBOL(drm_platform_exit);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 35889ca..17a100c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -219,14 +219,16 @@ static int exynos_drm_platform_probe(struct 
platform_device *pdev)

exynos_drm_driver.num_ioctls = DRM_ARRAY_SIZE(exynos_ioctls);

-   return drm_platform_init(_drm_driver, pdev);
+   return drm_get_platform_dev(pdev, _drm_driver);
 }

 static int exynos_drm_platform_remove(struct platform_device *pdev)
 {
+   struct drm_device *dev = platform_get_drvdata(pdev);
+
DRM_DEBUG_DRIVER("%s\n", __FILE__);

-   drm_platform_exit(_drm_driver, pdev);
+   drm_put_dev(dev);

return 0;
 }
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 3d1ce03..d14c23a 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1678,9 +1678,6 @@ extern int drm_get_pci_dev(struct pci_dev *pdev,


 /* platform section */
-extern int drm_platform_init(struct drm_driver *driver, struct platform_device 
*platform_device);
-extern void drm_platform_exit(struct drm_driver *driver, struct 
platform_device *platform_device);
-
 extern int drm_get_platform_dev(struct platform_device *pdev,
struct drm_driver *driver);

-- 
1.7.8.3



[PATCH 04/12] drm: provide a pci probe function for non modesetting devices

2012-02-02 Thread Sascha Hauer
This way we do not need the legacy handcrafted probe mechanism
anymore and can remove it.

Signed-off-by: Sascha Hauer 
---
 drivers/gpu/drm/drm_pci.c   |   41 +-
 drivers/gpu/drm/i810/i810_drv.c |   16 +
 drivers/gpu/drm/mga/mga_drv.c   |   16 +
 drivers/gpu/drm/r128/r128_drv.c |   16 +
 drivers/gpu/drm/savage/savage_drv.c |   16 +
 drivers/gpu/drm/sis/sis_drv.c   |   16 +
 drivers/gpu/drm/tdfx/tdfx_drv.c |   16 +
 7 files changed, 98 insertions(+), 39 deletions(-)

diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index f2e8019..b53427e 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -363,8 +363,6 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct 
pci_device_id *ent,
goto err_g4;
}

-   list_add_tail(>driver_item, >device_list);
-
DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
 driver->name, driver->major, driver->minor, driver->patchlevel,
 driver->date, pci_name(pdev), dev->primary->index);
@@ -399,41 +397,12 @@ EXPORT_SYMBOL(drm_get_pci_dev);
  */
 int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
 {
-   struct pci_dev *pdev = NULL;
-   const struct pci_device_id *pid;
-   int i;
-
DRM_DEBUG("\n");

INIT_LIST_HEAD(>device_list);
driver->bus = _pci_bus;

-   if (driver->driver_features & DRIVER_MODESET)
-   return pci_register_driver(pdriver);
-
-   /* If not using KMS, fall back to stealth mode manual scanning. */
-   for (i = 0; pdriver->id_table[i].vendor != 0; i++) {
-   pid = >id_table[i];
-
-   /* Loop around setting up a DRM device for each PCI device
-* matching our ID and device class.  If we had the internal
-* function that pci_get_subsys and pci_get_class used, we'd
-* be able to just pass pid in instead of doing a two-stage
-* thing.
-*/
-   pdev = NULL;
-   while ((pdev =
-   pci_get_subsys(pid->vendor, pid->device, pid->subvendor,
-  pid->subdevice, pdev)) != NULL) {
-   if ((pdev->class & pid->class_mask) != pid->class)
-   continue;
-
-   /* stealth mode requires a manual probe */
-   pci_dev_get(pdev);
-   drm_get_pci_dev(pdev, pid, driver);
-   }
-   }
-   return 0;
+   return pci_register_driver(pdriver);
 }

 #else
@@ -450,15 +419,9 @@ EXPORT_SYMBOL(drm_pci_init);
 /*@}*/
 void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver)
 {
-   struct drm_device *dev, *tmp;
DRM_DEBUG("\n");

-   if (driver->driver_features & DRIVER_MODESET) {
-   pci_unregister_driver(pdriver);
-   } else {
-   list_for_each_entry_safe(dev, tmp, >device_list, 
driver_item)
-   drm_put_dev(dev);
-   }
+   pci_unregister_driver(pdriver);
DRM_INFO("Module unloaded\n");
 }
 EXPORT_SYMBOL(drm_pci_exit);
diff --git a/drivers/gpu/drm/i810/i810_drv.c b/drivers/gpu/drm/i810/i810_drv.c
index ec12f7d..94f0660 100644
--- a/drivers/gpu/drm/i810/i810_drv.c
+++ b/drivers/gpu/drm/i810/i810_drv.c
@@ -75,7 +75,23 @@ static struct drm_driver driver = {
.patchlevel = DRIVER_PATCHLEVEL,
 };

+static int __devinit
+i810_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+{
+   return drm_get_pci_dev(pdev, ent, );
+}
+
+static void
+i810_pci_remove(struct pci_dev *pdev)
+{
+   struct drm_device *dev = pci_get_drvdata(pdev);
+
+   drm_put_dev(dev);
+}
+
 static struct pci_driver i810_pci_driver = {
+   .probe = i810_pci_probe,
+   .remove = i810_pci_remove,
.name = DRIVER_NAME,
.id_table = pciidlist,
 };
diff --git a/drivers/gpu/drm/mga/mga_drv.c b/drivers/gpu/drm/mga/mga_drv.c
index f9a925d..45d848a 100644
--- a/drivers/gpu/drm/mga/mga_drv.c
+++ b/drivers/gpu/drm/mga/mga_drv.c
@@ -87,7 +87,23 @@ static struct drm_driver driver = {
.patchlevel = DRIVER_PATCHLEVEL,
 };

+static int __devinit
+mga_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+{
+   return drm_get_pci_dev(pdev, ent, );
+}
+
+static void
+mga_pci_remove(struct pci_dev *pdev)
+{
+   struct drm_device *dev = pci_get_drvdata(pdev);
+
+   drm_put_dev(dev);
+}
+
 static struct pci_driver mga_pci_driver = {
+   .probe = mga_pci_probe,
+   .remove = mga_pci_remove,
.name = DRIVER_NAME,
.id_table = pciidlist,
 };
diff --git a/drivers/gpu/drm/r128/r128_drv.c b/drivers/gpu/drm/r128/r128_drv.c
index 6a5f439..257f8eb 100644
--- a/drivers/gpu/drm/r128/r128_drv.c
+++ b/drivers/gpu/drm/r128/r128_drv.c
@@ -88,7 

[PATCH 03/12] drm: remove unused field bus_type from struct drm_bus

2012-02-02 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 drivers/gpu/drm/drm_pci.c  |1 -
 drivers/gpu/drm/drm_platform.c |1 -
 drivers/gpu/drm/drm_usb.c  |1 -
 include/drm/drmP.h |5 -
 4 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index 1c06d3a..f2e8019 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -285,7 +285,6 @@ int drm_pci_agp_init(struct drm_device *dev)
 }

 static struct drm_bus drm_pci_bus = {
-   .bus_type = DRIVER_BUS_PCI,
.get_irq = drm_pci_get_irq,
.get_name = drm_pci_get_name,
.set_busid = drm_pci_set_busid,
diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c
index 1c1d581..453da2d 100644
--- a/drivers/gpu/drm/drm_platform.c
+++ b/drivers/gpu/drm/drm_platform.c
@@ -161,7 +161,6 @@ err:
 }

 static struct drm_bus drm_platform_bus = {
-   .bus_type = DRIVER_BUS_PLATFORM,
.get_irq = drm_platform_get_irq,
.get_name = drm_platform_get_name,
.set_busid = drm_platform_set_busid,
diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c
index 224dbdd..b7eb64a 100644
--- a/drivers/gpu/drm/drm_usb.c
+++ b/drivers/gpu/drm/drm_usb.c
@@ -88,7 +88,6 @@ static int drm_usb_set_busid(struct drm_device *dev,
 }

 static struct drm_bus drm_usb_bus = {
-   .bus_type = DRIVER_BUS_USB,
.get_irq = drm_usb_get_irq,
.get_name = drm_usb_get_name,
.set_busid = drm_usb_set_busid,
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index d770eef..3d1ce03 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -151,10 +151,6 @@ int drm_err(const char *func, const char *format, ...);
 #define DRIVER_GEM 0x1000
 #define DRIVER_MODESET 0x2000

-#define DRIVER_BUS_PCI 0x1
-#define DRIVER_BUS_PLATFORM 0x2
-#define DRIVER_BUS_USB 0x3
-
 /***/
 /** \name Begin the DRM... */
 /*@{*/
@@ -697,7 +693,6 @@ struct drm_master {
 #define DRM_SCANOUTPOS_ACCURATE (1 << 2)

 struct drm_bus {
-   int bus_type;
int (*get_irq)(struct drm_device *dev);
const char *(*get_name)(struct drm_device *dev);
int (*set_busid)(struct drm_device *dev, struct drm_master *master);
-- 
1.7.8.3



[PATCH 02/12] drm: remove platformdev and usbdev from struct drm_device

2012-02-02 Thread Sascha Hauer
struct drm_device has a struct usbdevice * and a
struct platform_device *. This is unused, so remove it.
If the platform_device or usbdevice is needed, we can
always get it using to_usb_device or to to_platform_device.

Signed-off-by: Sascha Hauer 
---
 drivers/gpu/drm/drm_platform.c|   18 +++---
 drivers/gpu/drm/drm_usb.c |1 -
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c |3 +--
 include/drm/drmP.h|3 ---
 4 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c
index f21243c..1c1d581 100644
--- a/drivers/gpu/drm/drm_platform.c
+++ b/drivers/gpu/drm/drm_platform.c
@@ -51,7 +51,6 @@ int drm_get_platform_dev(struct platform_device *platdev,
if (!dev)
return -ENOMEM;

-   dev->platformdev = platdev;
dev->dev = >dev;

mutex_lock(_global_mutex);
@@ -112,19 +111,24 @@ EXPORT_SYMBOL(drm_get_platform_dev);

 static int drm_platform_get_irq(struct drm_device *dev)
 {
-   return platform_get_irq(dev->platformdev, 0);
+   struct platform_device *pdev = to_platform_device(dev->dev);
+
+   return platform_get_irq(pdev, 0);
 }

 static const char *drm_platform_get_name(struct drm_device *dev)
 {
-   return dev->platformdev->name;
+   struct platform_device *pdev = to_platform_device(dev->dev);
+
+   return pdev->name;
 }

 static int drm_platform_set_busid(struct drm_device *dev, struct drm_master 
*master)
 {
+   struct platform_device *pdev = to_platform_device(dev->dev);
int len, ret;

-   master->unique_len = 13 + strlen(dev->platformdev->name);
+   master->unique_len = 13 + strlen(pdev->name);
master->unique_size = master->unique_len;
master->unique = kmalloc(master->unique_len + 1, GFP_KERNEL);

@@ -132,7 +136,7 @@ static int drm_platform_set_busid(struct drm_device *dev, 
struct drm_master *mas
return -ENOMEM;

len = snprintf(master->unique, master->unique_len,
-   "platform:%s:%02d", dev->platformdev->name, 
dev->platformdev->id);
+   "platform:%s:%02d", pdev->name, pdev->id);

if (len > master->unique_len) {
DRM_ERROR("Unique buffer overflowed\n");
@@ -141,7 +145,7 @@ static int drm_platform_set_busid(struct drm_device *dev, 
struct drm_master *mas
}

dev->devname =
-   kmalloc(strlen(dev->platformdev->name) +
+   kmalloc(strlen(pdev->name) +
master->unique_len + 2, GFP_KERNEL);

if (dev->devname == NULL) {
@@ -149,7 +153,7 @@ static int drm_platform_set_busid(struct drm_device *dev, 
struct drm_master *mas
goto err;
}

-   sprintf(dev->devname, "%s@%s", dev->platformdev->name,
+   sprintf(dev->devname, "%s@%s", pdev->name,
master->unique);
return 0;
 err:
diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c
index bd7fe72..224dbdd 100644
--- a/drivers/gpu/drm/drm_usb.c
+++ b/drivers/gpu/drm/drm_usb.c
@@ -18,7 +18,6 @@ int drm_get_usb_dev(struct usb_interface *interface,
return -ENOMEM;

usbdev = interface_to_usbdev(interface);
-   dev->usbdev = usbdev;
dev->dev = >dev;

mutex_lock(_global_mutex);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c 
b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index d7ae29d..3a9589b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -125,7 +125,6 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper 
*helper,
struct drm_device *dev = helper->dev;
struct fb_info *fbi;
struct drm_mode_fb_cmd2 mode_cmd = { 0 };
-   struct platform_device *pdev = dev->platformdev;
unsigned long size;
int ret;

@@ -143,7 +142,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper 
*helper,

mutex_lock(>struct_mutex);

-   fbi = framebuffer_alloc(0, >dev);
+   fbi = framebuffer_alloc(0, dev->dev);
if (!fbi) {
DRM_ERROR("failed to allocate fb info.\n");
ret = -ENOMEM;
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 38b95cb..d770eef 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1140,9 +1140,6 @@ struct drm_device {
struct pci_controller *hose;
 #endif

-   struct platform_device *platformdev; /**< Platform device struture */
-   struct usb_device *usbdev;
-
struct drm_sg_mem *sg;  /**< Scatter gather memory */
unsigned int num_crtcs;  /**< Number of CRTCs on this 
device */
void *dev_private;  /**< device private data */
-- 
1.7.8.3



[PATCH 01/12] drm: remove kdriver union from struct drm_driver

2012-02-02 Thread Sascha Hauer
struct drm_driver has a union containing the different drivers.
This field is unused in case of a usb or platform device. For
pci devices it is only used in drm_pci_get_name() which uses
the pci_driver to return the pci driver name. For all existing
drm drivers this driver name matches the struct drm_device->name,
so return this name instead and remove the now unnecessary code.

Signed-off-by: Sascha Hauer 
---
 drivers/gpu/drm/drm_pci.c  |   10 +++---
 drivers/gpu/drm/drm_platform.c |1 -
 drivers/gpu/drm/drm_usb.c  |1 -
 include/drm/drmP.h |5 -
 4 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index d4d10b7..1c06d3a 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -148,14 +148,12 @@ static int drm_pci_get_irq(struct drm_device *dev)

 static const char *drm_pci_get_name(struct drm_device *dev)
 {
-   struct pci_driver *pdriver = dev->driver->kdriver.pci;
-   return pdriver->name;
+   return dev->driver->name;
 }

 int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master)
 {
int len, ret;
-   struct pci_driver *pdriver = dev->driver->kdriver.pci;
master->unique_len = 40;
master->unique_size = master->unique_len;
master->unique = kmalloc(master->unique_size, GFP_KERNEL);
@@ -178,7 +176,7 @@ int drm_pci_set_busid(struct drm_device *dev, struct 
drm_master *master)
master->unique_len = len;

dev->devname =
-   kmalloc(strlen(pdriver->name) +
+   kmalloc(strlen(dev->driver->name) +
master->unique_len + 2, GFP_KERNEL);

if (dev->devname == NULL) {
@@ -186,8 +184,7 @@ int drm_pci_set_busid(struct drm_device *dev, struct 
drm_master *master)
goto err;
}

-   sprintf(dev->devname, "%s@%s", pdriver->name,
-   master->unique);
+   sprintf(dev->devname, "%s@%s", dev->driver->name, master->unique);

return 0;
 err:
@@ -410,7 +407,6 @@ int drm_pci_init(struct drm_driver *driver, struct 
pci_driver *pdriver)
DRM_DEBUG("\n");

INIT_LIST_HEAD(>device_list);
-   driver->kdriver.pci = pdriver;
driver->bus = _pci_bus;

if (driver->driver_features & DRIVER_MODESET)
diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c
index ae9db5e..f21243c 100644
--- a/drivers/gpu/drm/drm_platform.c
+++ b/drivers/gpu/drm/drm_platform.c
@@ -179,7 +179,6 @@ int drm_platform_init(struct drm_driver *driver, struct 
platform_device *platfor
 {
DRM_DEBUG("\n");

-   driver->kdriver.platform_device = platform_device;
driver->bus = _platform_bus;
INIT_LIST_HEAD(>device_list);
return drm_get_platform_dev(platform_device, driver);
diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c
index 445003f..bd7fe72 100644
--- a/drivers/gpu/drm/drm_usb.c
+++ b/drivers/gpu/drm/drm_usb.c
@@ -101,7 +101,6 @@ int drm_usb_init(struct drm_driver *driver, struct 
usb_driver *udriver)
DRM_DEBUG("\n");

INIT_LIST_HEAD(>device_list);
-   driver->kdriver.usb = udriver;
driver->bus = _usb_bus;

res = usb_register(udriver);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 92f0981..38b95cb 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -919,11 +919,6 @@ struct drm_driver {
struct drm_ioctl_desc *ioctls;
int num_ioctls;
const struct file_operations *fops;
-   union {
-   struct pci_driver *pci;
-   struct platform_device *platform_device;
-   struct usb_driver *usb;
-   } kdriver;
struct drm_bus *bus;

/* List of devices hanging off this driver */
-- 
1.7.8.3



[PATCH] drm: cleanup device registration

2012-02-02 Thread Sascha Hauer
The non modesetting drm drivers currently use a handcrafted pci probe
function. This requires the drm core to keep a list of registered devices
for each driver. This series adds a probe function for the non modesetting
drivers and removes the legacy probe code. The USB and platform drivers
use the devices_list aswell which is unnecessary. This is also cleaned
up in this series.

I am confident that the standard pci probe mechanism will work for the non
modesetting drivers, but unfortunately I have non of them handy for testing,
so it would be great if someone with access to one of those devices could
give this series a test.

Sascha

Sascha Hauer (12):
  drm: remove kdriver union from struct drm_driver
  drm: remove platformdev and usbdev from struct drm_device
  drm: remove unused field bus_type from struct drm_bus
  drm: provide a pci probe function for non modesetting devices
  drm: use drm_get_platform_dev and drop drm_platform_init/exit
  drm usb: drop drm_usb_init/exit
  drm: remove now unused device_list
  drm vmwgfx: remove unused field vmw_chipset from struct vmw_private
  drm: Add drm_register_device function
  drm pci: use drm_register_device
  drm platform: use drm_register_device
  drm usb: use drm_register_device

 drivers/gpu/drm/drm_pci.c |   98 ++
 drivers/gpu/drm/drm_platform.c|  108 +
 drivers/gpu/drm/drm_stub.c|   56 +++
 drivers/gpu/drm/drm_usb.c |   72 ++--
 drivers/gpu/drm/exynos/exynos_drm_drv.c   |6 +-
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c |3 +-
 drivers/gpu/drm/i810/i810_drv.c   |   16 
 drivers/gpu/drm/mga/mga_drv.c |   16 
 drivers/gpu/drm/r128/r128_drv.c   |   16 
 drivers/gpu/drm/savage/savage_drv.c   |   16 
 drivers/gpu/drm/sis/sis_drv.c |   16 
 drivers/gpu/drm/tdfx/tdfx_drv.c   |   16 
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c   |1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h   |1 -
 include/drm/drmP.h|   21 +-
 include/drm/drm_usb.h |3 -
 16 files changed, 190 insertions(+), 275 deletions(-)



[Bug 43835] System crashes when radeon firmware blob (R520_cp.bin) is installed

2012-02-02 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=43835

--- Comment #47 from Michel D?nzer  2012-02-02 04:04:31 
PST ---
How are the LVDS and DVI displays arranged in the session? Can you attach the
output of xrandr?

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


[Bug 42716] Boot failure with KMS enabled (radeon)

2012-02-02 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=42716





--- Comment #1 from Michel D?nzer   2012-02-02 11:59:30 
---
(In reply to comment #0)
> Any idea what's going on here?

Given your mixed testing results, I suspect the bisect result is bogus; you
probably need to at least test each kernel a couple of times before declaring
it as good.


> I don't have the option to attach a serial console, for what that's
> worth, so that aside, any suggestions for further debugging?

You could try netconsole.

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


[PATCH 19/20] drm exynos: use drm_fb_helper_set_par directly

2012-02-02 Thread Inki Dae


> -Original Message-
> From: Sascha Hauer [mailto:s.hauer at pengutronix.de]
> Sent: Wednesday, February 01, 2012 7:39 PM
> To: dri-devel at lists.freedesktop.org
> Cc: kernel at pengutronix.de; Sascha Hauer; Inki Dae
> Subject: [PATCH 19/20] drm exynos: use drm_fb_helper_set_par directly
> 
> info->fix.visual already is correctly set from drm_fb_helper_fill_fix.
> info->fix.line_length is also set from drm_fb_helper_fill_fix,
> so drm_fb_helper_set_par directly instead of a custom
> exynos_drm_fbdev_set_par.
> 
> Signed-off-by: Sascha Hauer 
> Cc: Inki Dae 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fbdev.c |   28
+
> ---
>  1 files changed, 1 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> index 706c906..e4bb88e 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> @@ -46,39 +46,13 @@ struct exynos_drm_fbdev {
>   struct exynos_drm_gem_obj   *exynos_gem_obj;
>  };
> 
> -static int exynos_drm_fbdev_set_par(struct fb_info *info)
> -{
> - struct fb_var_screeninfo *var = >var;
> -
> - switch (var->bits_per_pixel) {
> - case 32:
> - case 24:
> - case 18:
> - case 16:
> - case 12:
> - info->fix.visual = FB_VISUAL_TRUECOLOR;
> - break;
> - case 1:
> - info->fix.visual = FB_VISUAL_MONO01;
> - break;
> - default:
> - info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
> - break;
> - }
> -
> - info->fix.line_length = (var->xres_virtual * var->bits_per_pixel) /
> 8;
> -
> - return drm_fb_helper_set_par(info);
> -}
> -
> -
>  static struct fb_ops exynos_drm_fb_ops = {
>   .owner  = THIS_MODULE,
>   .fb_fillrect= cfb_fillrect,
>   .fb_copyarea= cfb_copyarea,
>   .fb_imageblit   = cfb_imageblit,
>   .fb_check_var   = drm_fb_helper_check_var,
> - .fb_set_par = exynos_drm_fbdev_set_par,
> + .fb_set_par = drm_fb_helper_set_par,
>   .fb_blank   = drm_fb_helper_blank,
>   .fb_pan_display = drm_fb_helper_pan_display,
>   .fb_setcmap = drm_fb_helper_setcmap,
> --
> 1.7.8.3

Tested-by: Inki Dae 
Thanks.



[PATCH] dma-buf: add dma_data_direction to unmap dma_buf_op

2012-02-02 Thread Laurent Pinchart
Hi Daniel,

On Tuesday 31 January 2012 11:36:02 Daniel Vetter wrote:
> On Tue, Jan 31, 2012 at 10:42:59AM +0100, Laurent Pinchart wrote:
> > Hi Sumit,
> > 
> > > On Friday 27 January 2012 10:43:28 Sumit Semwal wrote:
> > [snip]
> > 
> > >  static inline void dma_buf_unmap_attachment(struct dma_buf_attachment
> > > 
> > > *attach,
> > > -struct sg_table *sg)
> > > + struct sg_table *sg, enum dma_data_direction
> > > write)
> > 
> > On a second thought, would it make sense to store the direction in struct
> > dma_buf_attachment in dma_buf_map_attachment(), and pass the value
> > directly to the .unmap_dma_buf() instead of requiring the
> > dma_buf_unmap_attachment() caller to remember it ? Or is an attachment
> > allowed to map the buffer several times with different directions ?
> 
> Current dma api functions already require you to supply the direction
> argument on unmap

If I understand it correctly, that's mostly because the DMA API doesn't keep 
track of DMA mappings in a way that it can store the direction on map(), and 
use it on unmap(). In this case we have an attachment object that we can use 
to cache the information.

> and I think for cpu access I'm also leaning towards an interface where the
> importer has to supply the direction argument for both begin_access and
> end_access. So for consistency reasons I'm leaning towards adding it to
> unmap.

I'm OK with keeping the direction as an argument to unmap() if you think 
that's better.

-- 
Regards,

Laurent Pinchart


[PATCH v2] drm/radeon/kms/blit: fix blit copy for very large buffers

2012-02-02 Thread Alex Deucher
On Thu, Feb 2, 2012 at 10:26 AM, Ilija Hadzic
 wrote:
> Evergreen and NI blit copy was broken if the buffer maps to a rectangle
> whose one dimension is 16384 (max dimension allowed by these chips).
> In the mainline kernel, the problem is exposed only when buffers are
> very large (1G), but it's still a problem. The problem could be exposed
> for smaller buffers if anyone modifies the algorithm for rectangle
> construction in r600_blit_create_rect() (the reason why someone would
> modify that algorithm is to tune the performance of buffer moves).
>
> The root cause was in i2f() function which only operated on range between
> 0 and 16383. Fix this by extending the range of i2f() function to 0 to
> 32767.
>
> While at it improve the function so that the range can be easily
> extended in the future (if it becomes necessary), cleanup lines
> over 80 characters, and replace in-line comments with one strategic
> comment that explains the crux of the function.
>
> Credits to michel at daenzer.net for pointing out the root cause of
> the bug.
>
> v2: Fix I2F_MAX_INPUT constant definition goof and warn only once
> ? ?if input argument is out of range. Edit the comment a little
> ? ?bit to avoid some linguistic confusion and make it look better
> ? ?in general.
>
> Signed-off-by: Ilija Hadzic 

Should probably CC stable as well.

Reviewed-by: Alex Deucher 

> ---
> ?drivers/gpu/drm/radeon/r600_blit_kms.c | ? 35 ++-
> ?1 files changed, 25 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c 
> b/drivers/gpu/drm/radeon/r600_blit_kms.c
> index d996f43..accc032 100644
> --- a/drivers/gpu/drm/radeon/r600_blit_kms.c
> +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c
> @@ -468,27 +468,42 @@ set_default_state(struct radeon_device *rdev)
> ? ? ? ?radeon_ring_write(ring, sq_stack_resource_mgmt_2);
> ?}
>
> +#define I2F_MAX_BITS 15
> +#define I2F_MAX_INPUT ?((1 << I2F_MAX_BITS) - 1)
> +#define I2F_SHIFT (24 - I2F_MAX_BITS)
> +
> +/*
> + * Converts unsigned integer into 32-bit IEEE floating point representation.
> + * Conversion is not universal and only works for the range from 0
> + * to 2^I2F_MAX_BITS-1. Currently we only use it with inputs between
> + * 0 and 16384 (inclusive), so I2F_MAX_BITS=15 is enough. If necessary,
> + * I2F_MAX_BITS can be increased, but that will add to the loop iterations
> + * and slow us down. Conversion is done by shifting the input and counting
> + * down until the first 1 reaches bit position 23. The resulting counter
> + * and the shifted input are, respectively, the exponent and the fraction.
> + * The sign is always zero.
> + */
> ?static uint32_t i2f(uint32_t input)
> ?{
> ? ? ? ?u32 result, i, exponent, fraction;
>
> - ? ? ? if ((input & 0x3fff) == 0)
> - ? ? ? ? ? ? ? result = 0; /* 0 is a special case */
> + ? ? ? WARN_ON_ONCE(input > I2F_MAX_INPUT);
> +
> + ? ? ? if ((input & I2F_MAX_INPUT) == 0)
> + ? ? ? ? ? ? ? result = 0;
> ? ? ? ?else {
> - ? ? ? ? ? ? ? exponent = 140; /* exponent biased by 127; */
> - ? ? ? ? ? ? ? fraction = (input & 0x3fff) << 10; /* cheat and only
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? handle numbers below 
> 2^^15 */
> - ? ? ? ? ? ? ? for (i = 0; i < 14; i++) {
> + ? ? ? ? ? ? ? exponent = 126 + I2F_MAX_BITS;
> + ? ? ? ? ? ? ? fraction = (input & I2F_MAX_INPUT) << I2F_SHIFT;
> +
> + ? ? ? ? ? ? ? for (i = 0; i < I2F_MAX_BITS; i++) {
> ? ? ? ? ? ? ? ? ? ? ? ?if (fraction & 0x80)
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break;
> ? ? ? ? ? ? ? ? ? ? ? ?else {
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fraction = fraction << 1; /* keep
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?shifting left 
> until top bit = 1 */
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fraction = fraction << 1;
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?exponent = exponent - 1;
> ? ? ? ? ? ? ? ? ? ? ? ?}
> ? ? ? ? ? ? ? ?}
> - ? ? ? ? ? ? ? result = exponent << 23 | (fraction & 0x7f); /* mask
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? off top 
> bit; assumed 1 */
> + ? ? ? ? ? ? ? result = exponent << 23 | (fraction & 0x7f);
> ? ? ? ?}
> ? ? ? ?return result;
> ?}
> --
> 1.7.7
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2] drm/radeon/kms/blit: fix blit copy for very large buffers

2012-02-02 Thread Ilija Hadzic
Evergreen and NI blit copy was broken if the buffer maps to a rectangle
whose one dimension is 16384 (max dimension allowed by these chips).
In the mainline kernel, the problem is exposed only when buffers are
very large (1G), but it's still a problem. The problem could be exposed
for smaller buffers if anyone modifies the algorithm for rectangle
construction in r600_blit_create_rect() (the reason why someone would
modify that algorithm is to tune the performance of buffer moves).

The root cause was in i2f() function which only operated on range between
0 and 16383. Fix this by extending the range of i2f() function to 0 to
32767.

While at it improve the function so that the range can be easily
extended in the future (if it becomes necessary), cleanup lines
over 80 characters, and replace in-line comments with one strategic
comment that explains the crux of the function.

Credits to michel at daenzer.net for pointing out the root cause of
the bug.

v2: Fix I2F_MAX_INPUT constant definition goof and warn only once
if input argument is out of range. Edit the comment a little
bit to avoid some linguistic confusion and make it look better
in general.

Signed-off-by: Ilija Hadzic 
---
 drivers/gpu/drm/radeon/r600_blit_kms.c |   35 ++-
 1 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c 
b/drivers/gpu/drm/radeon/r600_blit_kms.c
index d996f43..accc032 100644
--- a/drivers/gpu/drm/radeon/r600_blit_kms.c
+++ b/drivers/gpu/drm/radeon/r600_blit_kms.c
@@ -468,27 +468,42 @@ set_default_state(struct radeon_device *rdev)
radeon_ring_write(ring, sq_stack_resource_mgmt_2);
 }

+#define I2F_MAX_BITS 15
+#define I2F_MAX_INPUT  ((1 << I2F_MAX_BITS) - 1)
+#define I2F_SHIFT (24 - I2F_MAX_BITS)
+
+/*
+ * Converts unsigned integer into 32-bit IEEE floating point representation.
+ * Conversion is not universal and only works for the range from 0
+ * to 2^I2F_MAX_BITS-1. Currently we only use it with inputs between
+ * 0 and 16384 (inclusive), so I2F_MAX_BITS=15 is enough. If necessary,
+ * I2F_MAX_BITS can be increased, but that will add to the loop iterations
+ * and slow us down. Conversion is done by shifting the input and counting
+ * down until the first 1 reaches bit position 23. The resulting counter
+ * and the shifted input are, respectively, the exponent and the fraction.
+ * The sign is always zero.
+ */
 static uint32_t i2f(uint32_t input)
 {
u32 result, i, exponent, fraction;

-   if ((input & 0x3fff) == 0)
-   result = 0; /* 0 is a special case */
+   WARN_ON_ONCE(input > I2F_MAX_INPUT);
+
+   if ((input & I2F_MAX_INPUT) == 0)
+   result = 0;
else {
-   exponent = 140; /* exponent biased by 127; */
-   fraction = (input & 0x3fff) << 10; /* cheat and only
- handle numbers below 
2^^15 */
-   for (i = 0; i < 14; i++) {
+   exponent = 126 + I2F_MAX_BITS;
+   fraction = (input & I2F_MAX_INPUT) << I2F_SHIFT;
+
+   for (i = 0; i < I2F_MAX_BITS; i++) {
if (fraction & 0x80)
break;
else {
-   fraction = fraction << 1; /* keep
-shifting left 
until top bit = 1 */
+   fraction = fraction << 1;
exponent = exponent - 1;
}
}
-   result = exponent << 23 | (fraction & 0x7f); /* mask
-   off top 
bit; assumed 1 */
+   result = exponent << 23 | (fraction & 0x7f);
}
return result;
 }
-- 
1.7.7



[PATCH] drm/radeon/kms/blit: fix blit copy for very large buffers

2012-02-02 Thread Paul Menzel
Dear Ilija,


Am Mittwoch, den 01.02.2012, 17:07 -0500 schrieb Ilija Hadzic:

[?]

> +#define I2F_MAX_BITS 15
> +#define I2F_MAX_INPUT  ((2 << I2F_MAX_BITS) - 1)
> +#define I2F_SHIFT (24 - I2F_MAX_BITS)
> +
> +/*
> + * converts unsigned integer into 32-bit IEEE floating point representation;
> + * conversion is not universal and only works for the range from 0
> + * to 2^^I2F_MAX_BITS-1; currently we only use it with inputs between
> + * 0 and 16384 (inclusive), so I2F_MAX_BITS=15 is enough; if necessary
> + * I2F_MAX_BITS can be increased, but that will add to loop iterations

should that be t*w*o?

> + * and slow us down; conversion is done by shifting the input and counting
> + * down until the first 1 reaches bit position 23; the resulting counter
> + * and the shifted input are the exponent and the fraction; the sign is
> + * always zero
> + */

I like sentences with capital starting letter and full stop at the end
better. But I do not know if there are any guidelines for that.

[?]


Thanks,

Paul
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20120202/439fa938/attachment.pgp>


[PATCH] drm/radeon/kms: fix TRAVIS panel setup

2012-02-02 Thread alexdeuc...@gmail.com
From: Alex Deucher 

Different versions of the DP to LVDS bridge chip
need different panel mode settings depending on
the chip version used.

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

Signed-off-by: Alex Deucher 
Cc: stable at vger.kernel.org
---
 drivers/gpu/drm/radeon/atombios_dp.c |   18 +++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_dp.c 
b/drivers/gpu/drm/radeon/atombios_dp.c
index a71557c..552b436 100644
--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -564,9 +564,21 @@ int radeon_dp_get_panel_mode(struct drm_encoder *encoder,
ENCODER_OBJECT_ID_NUTMEG)
panel_mode = DP_PANEL_MODE_INTERNAL_DP1_MODE;
else if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) ==
-ENCODER_OBJECT_ID_TRAVIS)
-   panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE;
-   else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
+ENCODER_OBJECT_ID_TRAVIS) {
+   u8 id[6];
+   int i;
+   for (i = 0; i < 6; i++)
+   id[i] = radeon_read_dpcd_reg(radeon_connector, 0x503 + 
i);
+   if (id[0] == 0x73 &&
+   id[1] == 0x69 &&
+   id[2] == 0x76 &&
+   id[3] == 0x61 &&
+   id[4] == 0x72 &&
+   id[5] == 0x54)
+   panel_mode = DP_PANEL_MODE_INTERNAL_DP1_MODE;
+   else
+   panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE;
+   } else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
u8 tmp = radeon_read_dpcd_reg(radeon_connector, 
DP_EDP_CONFIGURATION_CAP);
if (tmp & 1)
panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE;
-- 
1.7.7.5



[PATCH 2/2] drm/radeon/kms: add r1xx/r2xx CS support for tiled textures

2012-02-02 Thread alexdeuc...@gmail.com
From: Alex Deucher 

Not likely this will be implemented anytime soon, but for
completeness...

Signed-off-by: Alex Deucher 
---
 drivers/gpu/drm/radeon/r100.c |   12 +++-
 drivers/gpu/drm/radeon/r200.c |   12 +++-
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index e7587b7..869d479 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -1558,7 +1558,17 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
r100_cs_dump_packet(p, pkt);
return r;
}
-   ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset);
+   if (!(p->cs_flags & RADEON_CS_KEEP_TILING_FLAGS)) {
+   if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO)
+   tile_flags |= RADEON_TXO_MACRO_TILE;
+   if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO)
+   tile_flags |= RADEON_TXO_MICRO_TILE_X2;
+
+   tmp = idx_value & ~(0x7 << 2);
+   tmp |= tile_flags;
+   ib[idx] = tmp + ((u32)reloc->lobj.gpu_offset);
+   } else
+   ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset);
track->textures[i].robj = reloc->robj;
track->tex_dirty = true;
break;
diff --git a/drivers/gpu/drm/radeon/r200.c b/drivers/gpu/drm/radeon/r200.c
index 2f44397..a59cc47 100644
--- a/drivers/gpu/drm/radeon/r200.c
+++ b/drivers/gpu/drm/radeon/r200.c
@@ -215,7 +215,17 @@ int r200_packet0_check(struct radeon_cs_parser *p,
r100_cs_dump_packet(p, pkt);
return r;
}
-   ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset);
+   if (!(p->cs_flags & RADEON_CS_KEEP_TILING_FLAGS)) {
+   if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO)
+   tile_flags |= R200_TXO_MACRO_TILE;
+   if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO)
+   tile_flags |= R200_TXO_MICRO_TILE;
+
+   tmp = idx_value & ~(0x7 << 2);
+   tmp |= tile_flags;
+   ib[idx] = tmp + ((u32)reloc->lobj.gpu_offset);
+   } else
+   ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset);
track->textures[i].robj = reloc->robj;
track->tex_dirty = true;
break;
-- 
1.7.7.5



[PATCH 1/2] drm/radeon/kms: add r1xx/r2xx support for CS_KEEP_TILING_FLAGS

2012-02-02 Thread alexdeuc...@gmail.com
From: Alex Deucher 

Previous patch only updates r3xx+.  It's not likely
anyone will use this on r1xx/r2xx, but add it for consistency.

Signed-off-by: Alex Deucher 
---
 drivers/gpu/drm/radeon/r100.c |   46 +++-
 drivers/gpu/drm/radeon/r200.c |   17 +--
 2 files changed, 36 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 947ba22..e7587b7 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -87,23 +87,27 @@ int r100_reloc_pitch_offset(struct radeon_cs_parser *p,
r100_cs_dump_packet(p, pkt);
return r;
}
+
value = radeon_get_ib_value(p, idx);
tmp = value & 0x003f;
tmp += (((u32)reloc->lobj.gpu_offset) >> 10);

-   if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO)
-   tile_flags |= RADEON_DST_TILE_MACRO;
-   if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) {
-   if (reg == RADEON_SRC_PITCH_OFFSET) {
-   DRM_ERROR("Cannot src blit from microtiled surface\n");
-   r100_cs_dump_packet(p, pkt);
-   return -EINVAL;
+   if (!(p->cs_flags & RADEON_CS_KEEP_TILING_FLAGS)) {
+   if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO)
+   tile_flags |= RADEON_DST_TILE_MACRO;
+   if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) {
+   if (reg == RADEON_SRC_PITCH_OFFSET) {
+   DRM_ERROR("Cannot src blit from microtiled 
surface\n");
+   r100_cs_dump_packet(p, pkt);
+   return -EINVAL;
+   }
+   tile_flags |= RADEON_DST_TILE_MICRO;
}
-   tile_flags |= RADEON_DST_TILE_MICRO;
-   }

-   tmp |= tile_flags;
-   p->ib->ptr[idx] = (value & 0x3fc0) | tmp;
+   tmp |= tile_flags;
+   p->ib->ptr[idx] = (value & 0x3fc0) | tmp;
+   } else
+   p->ib->ptr[idx] = (value & 0xffc0) | tmp;
return 0;
 }

@@ -1625,15 +1629,17 @@ static int r100_packet0_check(struct radeon_cs_parser 
*p,
r100_cs_dump_packet(p, pkt);
return r;
}
-
-   if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO)
-   tile_flags |= RADEON_COLOR_TILE_ENABLE;
-   if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO)
-   tile_flags |= RADEON_COLOR_MICROTILE_ENABLE;
-
-   tmp = idx_value & ~(0x7 << 16);
-   tmp |= tile_flags;
-   ib[idx] = tmp;
+   if (!(p->cs_flags & RADEON_CS_KEEP_TILING_FLAGS)) {
+   if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO)
+   tile_flags |= RADEON_COLOR_TILE_ENABLE;
+   if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO)
+   tile_flags |= RADEON_COLOR_MICROTILE_ENABLE;
+
+   tmp = idx_value & ~(0x7 << 16);
+   tmp |= tile_flags;
+   ib[idx] = tmp;
+   } else
+   ib[idx] = idx_value;

track->cb[0].pitch = idx_value & RADEON_COLORPITCH_MASK;
track->cb_dirty = true;
diff --git a/drivers/gpu/drm/radeon/r200.c b/drivers/gpu/drm/radeon/r200.c
index eba4cbf..2f44397 100644
--- a/drivers/gpu/drm/radeon/r200.c
+++ b/drivers/gpu/drm/radeon/r200.c
@@ -277,14 +277,17 @@ int r200_packet0_check(struct radeon_cs_parser *p,
return r;
}

-   if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO)
-   tile_flags |= RADEON_COLOR_TILE_ENABLE;
-   if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO)
-   tile_flags |= RADEON_COLOR_MICROTILE_ENABLE;
+   if (!(p->cs_flags & RADEON_CS_KEEP_TILING_FLAGS)) {
+   if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO)
+   tile_flags |= RADEON_COLOR_TILE_ENABLE;
+   if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO)
+   tile_flags |= RADEON_COLOR_MICROTILE_ENABLE;

-   tmp = idx_value & ~(0x7 << 16);
-   tmp |= tile_flags;
-   ib[idx] = tmp;
+   tmp = idx_value & ~(0x7 << 16);
+   tmp |= tile_flags;
+   ib[idx] = tmp;
+   } else
+   ib[idx] = idx_value;

track->cb[0].pitch = idx_value & RADEON_COLORPITCH_MASK;
track->cb_dirty = true;
-- 
1.7.7.5



R600 definition error for interrupt handler swap

2012-02-02 Thread Michel Dänzer
On Don, 2012-02-02 at 09:42 +0100, C?dric Cano wrote: 
> 
> We try to use the Linux 3.0.0 on our PowerPC board and M96 GPU (RV730): 
> it doesn't work as is. We need to revert this definition like it was 
> before 2.6.39.4 
> (http://lists.freedesktop.org/archives/dri-devel/2011-July/012811.html).

I suspect you may be tripping over the double byte-swapping fixed by
commit df07d6999e4e502ff474eeafe11ea0055f4cd68d ('drm/radeon: Writeback
endian fixes'). By using the wrong definition of IH_MC_SWAP, you'd
accidentally disable the GPU byte swapping, making the CPU byte swapping
work correctly.


-- 
Earthling Michel D?nzer   |   http://www.amd.com
Libre software enthusiast |  Debian, X and DRI developer


[PATCH] drm/radeon/kms/blit: fix blit copy for very large buffers

2012-02-02 Thread Michel Dänzer
On Mit, 2012-02-01 at 17:07 -0500, Ilija Hadzic wrote: 
> 
> diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c 
> b/drivers/gpu/drm/radeon/r600_blit_kms.c
> index d996f43..32dcc95 100644
> --- a/drivers/gpu/drm/radeon/r600_blit_kms.c
> +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c
> @@ -468,27 +468,42 @@ set_default_state(struct radeon_device *rdev)
>   radeon_ring_write(ring, sq_stack_resource_mgmt_2);
>  }
>  
> +#define I2F_MAX_BITS 15
> +#define I2F_MAX_INPUT  ((2 << I2F_MAX_BITS) - 1)

Should be ((1 << I2F_MAX_BITS) - 1): 2^n == (1 << n)


> static uint32_t i2f(uint32_t input)
>  {
>   u32 result, i, exponent, fraction;
>  
> - if ((input & 0x3fff) == 0)
> - result = 0; /* 0 is a special case */
> + WARN_ON(input > I2F_MAX_INPUT);

Use WARN_ON_ONCE here to avoid spamming the kernel output. If this is
ever hit again, it won't happen just once.


Looks good to me otherwise.


-- 
Earthling Michel D?nzer   |   http://www.amd.com
Libre software enthusiast |  Debian, X and DRI developer


R600 definition error for interrupt handler swap

2012-02-02 Thread Cédric Cano
Hi Alex,

We don't have the documentation that contains this register definition.

We try to use the Linux 3.0.0 on our PowerPC board and M96 GPU (RV730): 
it doesn't work as is. We need to revert this definition like it was 
before 2.6.39.4 
(http://lists.freedesktop.org/archives/dri-devel/2011-July/012811.html).

Are you sure the documentation is correct?

Cedric

Le 01/02/2012 20:46, Alex Deucher a ?crit :
> On Wed, Feb 1, 2012 at 4:33 AM, C?dric Cano  
> wrote:
>> Hello,
>>
>> We're trying to use R600 DRM driver with big endian architecture. We find
>> the following error in R600 definition of interrupt handler swap.
>>
>> Perhaps there's the same error in the evergreen definitions header file.
> The definition in the register header is correct according to the
> register spec.  It's bits 2:1 on both r6xx and evergreen.
>
> 0 = no swap
> 1 = 16 bit swap (0xaabb becomes 0xbbaa)
> 2 = 32 bit swap (0xaabbccdd becomes 0xddccbbaa)
> 3 = 64 bit swap (0xaabbccddeeff0011 becomes 0x1100ffeeddccbbaa))
>
> Alex
>
>> Cedric
>>
>> Signed-off-by: C?dric Cano
>> Signed-off-by: Thomas Jourdan
>> ---
>> diff -Naur linux-3.2.2/drivers/gpu/drm/radeon/r600d.h
>> linux-3.2.2/drivers/gpu/drm/radeon/r600d.h
>> --- linux-3.2.2/drivers/gpu/drm/radeon/r600d.h2012-01-26
>> 01:39:32.0 +0100
>> +++ linux-3.2.2/drivers/gpu/drm/radeon/r600d.h2012-02-01
>> 10:25:04.0 +0100
>> @@ -552,7 +552,7 @@
>>   #define IH_RB_WPTR_ADDR_LO0x3e14
>>   #define IH_CNTL   0x3e18
>>   #   define ENABLE_INTR(1<<  0)
>> -#   define IH_MC_SWAP(x)  ((x)<<  1)
>> +#   define IH_MC_SWAP(x)  ((x)<<  2)
>>   #   define IH_MC_SWAP_NONE0
>>   #   define IH_MC_SWAP_16BIT   1
>>   #   define IH_MC_SWAP_32BIT   2
>> --
>>
>>
>> ___
>> dri-devel mailing list
>> dri-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2] drm/radeon/kms/blit: fix blit copy for very large buffers

2012-02-02 Thread Ilija Hadzic


On Thu, 2 Feb 2012, Alex Deucher wrote:

>
> Should probably CC stable as well.
>

I was thinking of that, but decided not to because it's in the gray area 
of this rule per Documentation/stable_kernel_rules.txt

  - It must fix a real bug that bothers people (not a, "This could be a
problem..." type thing).

-- Ilija


[Mesa-dev] anongit.freedesktop.org not available?

2012-02-02 Thread Paul Berry
On 1 February 2012 20:55, Alan Coopersmith wrote:

> On 02/ 1/12 08:52 PM, Alexandre Demers wrote:
>
>> Hi,
>>
>> I've been trying all day to sync sources from anongit.freedesktop.org
>> (dri and mesa) and it always ends up by a time out. Is there a problem
>> with the server or the address?
>>
>
> Yes.  Others have reported on IRC that it works if you force the hostnames
> to resolve to 131.252.210.176 instead of the DNS reported 131.252.210.161.
>

Does anyone know an ETA on getting this fixed?  It would be nice to have
anongit.freedesktop.org resolving correctly when we make the by the time we
make the Mesa 8.0 release.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20120202/11234192/attachment.htm>


[PATCH] drm/radeon/kms/blit: fix blit copy for very large buffers

2012-02-02 Thread Ilija Hadzic


On Thu, 2 Feb 2012, Michel [ISO-8859-1] D?nzer wrote:


>> +#define I2F_MAX_BITS 15
>> +#define I2F_MAX_INPUT  ((2 << I2F_MAX_BITS) - 1)
>
> Should be ((1 << I2F_MAX_BITS) - 1): 2^n == (1 << n)
>

Right. I'll fix it.

> Use WARN_ON_ONCE here to avoid spamming the kernel output. If this is
> ever hit again, it won't happen just once.
>
>

I agree. v2 coming shortly.

-- Ilija


[PATCH] drm: cleanup device registration

2012-02-02 Thread David Airlie


- Original Message -
> From: "Sascha Hauer" 
> To: "David Airlie" 
> Cc: "Inki Dae" , kernel at pengutronix.de, dri-devel 
> at lists.freedesktop.org
> Sent: Thursday, 2 February, 2012 12:34:02 PM
> Subject: Re: [PATCH] drm: cleanup device registration
> 
> On Thu, Feb 02, 2012 at 07:05:00AM -0500, David Airlie wrote:
> > - Original Message -
> > > From: "Sascha Hauer" 
> > > To: dri-devel at lists.freedesktop.org
> > > Cc: "Inki Dae" , kernel at pengutronix.de
> > > Sent: Thursday, 2 February, 2012 11:57:52 AM
> > > Subject: [PATCH] drm: cleanup device registration
> > > 
> > > The non modesetting drm drivers currently use a handcrafted pci
> > > probe
> > > function. This requires the drm core to keep a list of registered
> > > devices
> > > for each driver. This series adds a probe function for the non
> > > modesetting
> > > drivers and removes the legacy probe code. The USB and platform
> > > drivers
> > > use the devices_list aswell which is unnecessary. This is also
> > > cleaned
> > > up in this series.
> > 
> > No it can't work like this because we have conflicts between fb and
> > drm drivers, so the DRM is required to do its own
> > probe if an fb driver for a device is already loaded.
> > 
> > it can't use the PCI probe out of the box.
> 
> I see. For example the i810 also has a framebuffer driver. Do you see
> a way to fix this except writing a kms driver for all legacy devices?
> Otherwise I would leave the pci part untouched and only keep the
> platform/USB pieces which I'm admittedly more interested in.
> 

Its one of those things that would be a real pain to fix, since we can't remove
drm drivers since their interfaces are ABI. So its why its been left like it is.

It might be possible to split the PCI path up a bit so the non-kms drivers use 
it,
and we port kms ones to a newer interfaces, but I think nouveau is the only PCI 
KMS only
driver we have (maybe vmwgfx as well).

Dave.


[PATCH] drm: cleanup device registration

2012-02-02 Thread David Airlie
- Original Message -
> From: "Sascha Hauer" 
> To: dri-devel at lists.freedesktop.org
> Cc: "Inki Dae" , kernel at pengutronix.de
> Sent: Thursday, 2 February, 2012 11:57:52 AM
> Subject: [PATCH] drm: cleanup device registration
> 
> The non modesetting drm drivers currently use a handcrafted pci probe
> function. This requires the drm core to keep a list of registered
> devices
> for each driver. This series adds a probe function for the non
> modesetting
> drivers and removes the legacy probe code. The USB and platform
> drivers
> use the devices_list aswell which is unnecessary. This is also
> cleaned
> up in this series.

No it can't work like this because we have conflicts between fb and drm 
drivers, so the DRM is required to do its own
probe if an fb driver for a device is already loaded.

it can't use the PCI probe out of the box.

Dave.


[PATCH] drm/radeon/kms/blit: fix blit copy for very large buffers

2012-02-02 Thread Ilija Hadzic


On Thu, 2 Feb 2012, Paul Menzel wrote:

>> + * I2F_MAX_BITS can be increased, but that will add to loop iterations
>
> should that be t*w*o?
>

No, it's not "two" like the number but "to" like in "add to the group" or
"add to the pile".



[Bug 42716] New: Boot failure with KMS enabled (radeon)

2012-02-02 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=42716

   Summary: Boot failure with KMS enabled (radeon)
   Product: Drivers
   Version: 2.5
Kernel Version: 3.2.x
  Platform: All
OS/Version: Linux
  Tree: Mainline
Status: NEW
  Severity: normal
  Priority: P1
 Component: Video(DRI - non Intel)
AssignedTo: drivers_video-dri at kernel-bugs.osdl.org
ReportedBy: rw at rlworkman.net
Regression: No


Since 3.2.0, my machine [1] fails to boot - it crashes/panics in early boot
when the radeon module (or one of its deps) is loaded. Graphics chip is as
follows:

  VGA compatible controller: ATI Technologies Inc RS690 [Radeon X1200 Series]

This is all running on libdrm-2.4.29, mesa-7.11.2, xorg-server-1.11.4, and
xf86-video-ati-6.14.3 with udev-180 (though the problem existed on 178 and 179
as well).

3.2.0, 3.2.1, and now 3.2.2 all exhibit this problem, but 3.1.x (including
3.1.10, which I'm currently using) is fine.  If I disable KMS
(radeon.modeset=0), then the system boots fine.

I thought I'd be clever and bisect this, so I built about twelve or thirteen
kernels, and bisect blamed this commit: 
  [50b8d257486a45cba7b65ca978986ed216bbcc10] ptrace: partially fix the
do_wait(WEXITED) vs EXIT_DEAD->EXIT_ZOMBIE race

That doesn't seem reasonable, but sure, it's worth a try.  I reversed that
patch in mainline 3.2.2, and I get a good boot.  However, I notice that this is
in /var/log/syslog:
  Feb  1 21:00:40 isotope kernel: [2.039197] [drm:r100_ring_test] *ERROR*
radeon: ring test failed (scratch(0x15E4)=0xCAFEDEAD)
  Feb  1 21:00:40 isotope kernel: [2.039256] [drm:r100_cp_init] *ERROR*
radeon: cp isn't working (-22).
  Feb  1 21:00:40 isotope kernel: [2.162916] [drm:r100_cp_fini] *ERROR*
Wait for CP idle timeout, shutting down CP.

I then booted the vanilla 3.2.2, and it booted just fine.  Okay, that's odd, so
let's try the patched (reversed bisect patch from above) again.  This time,
appeared to OOPS after switching over to KMS, but the display is still visible.
 All of the potentially useful stuff scrolled off the screen, and now there's a
constant repetition of the following two lines (with alternating values of
CONNECTOR between 17 and 18) flooding the console every few seconds, so I can't
pageup back to the OOPS/trace/whatever:

  [drm:radeon_atombios_connected_scratch_regs], DFP3 disconnected
  [drm:output_poll_execute], [CONNECTOR:18:DVI-D-1] status updated from 2 to 2


So, let's reboot to that kernel a few times.
#1: all is fine
#2: crash/panic after kms load; no video at all
#3: crash/panic after kms load; no video at all

This isn't going well, so let's boot the patched kernel again:
#1: all is fine
#2: all is fine
#3: crash/panic after kms load; no video at all

Any idea what's going on here?  I don't have the option to attach a serial
console, for what that's worth, so that aside, any suggestions for further
debugging?

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


[PATCH 1/2] drm/radeon: fix invalid memory access in radeon_atrm_get_bios()

2012-02-02 Thread Igor Murzov
On Wed, 1 Feb 2012 18:42:52 +
Dave Airlie  wrote:

> On Tue, Jan 24, 2012 at 2:10 PM, Alex Deucher  
> wrote:
> > On Sun, Jan 22, 2012 at 9:43 AM, Igor Murzov
> >  wrote:
> >> From 77c912ea1eca50a93a34d5be69f9dc96a8bef0d8 Mon Sep 17 00:00:00 2001
> >> From: Igor Murzov 
> >> Date: Sun, 22 Jan 2012 19:02:27 +0400
> >> Subject: [PATCH 1/2] drm/radeon: fix invalid memory access in 
> >> radeon_atrm_get_bios()
> >>
> >> At a boot time I observed following bug:
> >>
> >> ?BUG: unable to handle kernel paging request at 8800a4244000
> >> ?IP: [] memcpy+0xb/0x120
> >> ?PGD 1816063 PUD 1fe7d067 PMD 1ff9f067 PTE 8000a4244160
> >> ?Oops:  [#1] SMP DEBUG_PAGEALLOC
> >> ?CPU 0
> >> ?Modules linked in: btusb bluetooth brcmsmac brcmutil crc8 cordic b43 
> >> radeon(+)
> >> ?mac80211 cfg80211 ttm ohci_hcd drm_kms_helper rfkill drm ssb agpgart 
> >> mmc_core
> >> ?sp5100_tco video battery ac thermal processor rtc_cmos thermal_sys 
> >> snd_hda_codec_hdmi
> >> ?joydev snd_hda_codec_conexant button bcma pcmcia snd_hda_intel 
> >> snd_hda_codec
> >> ?snd_hwdep snd_pcm shpchp pcmcia_core k8temp snd_timer atl1c snd psmouse 
> >> hwmon
> >> ?i2c_piix4 i2c_algo_bit soundcore evdev i2c_core ehci_hcd sg serio_raw 
> >> snd_page_alloc
> >> ?loop btrfs
> >>
> >> ?Pid: 1008, comm: modprobe Not tainted 3.3.0-rc1 #21 LENOVO 20046 ? ? ? ? 
> >> ? ? ? ? ? ? ? ? ? /AMD CRB
> >> ?RIP: 0010:[] ?[] memcpy+0xb/0x120
> >> ?RSP: 0018:8800aa72db00 ?EFLAGS: 00010246
> >> ?RAX: 8800a415 RBX: 1000 RCX: 0087
> >> ?RDX:  RSI: 8800a4244000 RDI: 8800a4150bc8
> >> ?RBP: 8800aa72db78 R08: 0010 R09: 8174bbec
> >> ?R10: 812ee010 R11: 0001 R12: 1000
> >> ?R13: 0001 R14: 8800a414 R15: 8800aaba1800
> >> ?FS: ?7ff9a3bd4720() GS:8800afa0() 
> >> knlGS:
> >> ?CS: ?0010 DS:  ES:  CR0: 8005003b
> >> ?CR2: 8800a4244000 CR3: a9c18000 CR4: 06f0
> >> ?DR0:  DR1:  DR2: 
> >> ?DR3:  DR6: 0ff0 DR7: 0400
> >> ?Process modprobe (pid: 1008, threadinfo 8800aa72c000, task 
> >> 8800aa0e4000)
> >> ?Stack:
> >> ?a04e7c7b 0001 0001 8800aa72db28
> >> ?0001 1000 8113cbef 0020
> >> ?8800a4243420 8802 8800aa72db08 8800a9d42000
> >> ?Call Trace:
> >> ?[] ? radeon_atrm_get_bios_chunk+0x8b/0xd0 [radeon]
> >> ?[] ? kmalloc_order_trace+0x3f/0xb0
> >> ?[] radeon_get_bios+0x68/0x2f0 [radeon]
> >> ?[] rv770_init+0x40/0x280 [radeon]
> >> ?[] radeon_device_init+0x560/0x600 [radeon]
> >> ?[] radeon_driver_load_kms+0xaf/0x170 [radeon]
> >> ?[] drm_get_pci_dev+0x18e/0x2c0 [drm]
> >> ?[] radeon_pci_probe+0xad/0xb5 [radeon]
> >> ?[] local_pci_probe+0x5f/0xd0
> >> ?[] pci_device_probe+0x88/0xb0
> >> ?[] ? driver_sysfs_add+0x7a/0xb0
> >> ?[] really_probe+0x68/0x180
> >> ?[] driver_probe_device+0x45/0x70
> >> ?[] __driver_attach+0xa3/0xb0
> >> ?[] ? driver_probe_device+0x70/0x70
> >> ?[] bus_for_each_dev+0x5e/0x90
> >> ?[] driver_attach+0x1e/0x20
> >> ?[] bus_add_driver+0xc8/0x280
> >> ?[] driver_register+0x76/0x140
> >> ?[] __pci_register_driver+0x66/0xe0
> >> ?[] drm_pci_init+0x111/0x120 [drm]
> >> ?[] ? vga_switcheroo_register_handler+0x3a/0x60
> >> ?[] ? 0xa0228fff
> >> ?[] radeon_init+0xec/0xee [radeon]
> >> ?[] do_one_initcall+0x42/0x180
> >> ?[] sys_init_module+0x92/0x1e0
> >> ?[] system_call_fastpath+0x16/0x1b
> >> ?Code: 58 2a 43 50 88 43 4e 48 83 c4 08 5b c9 c3 66 90 e8 cb fd ff ff eb
> >> ?e6 90 90 90 90 90 90 90 90 90 48 89 f8 89 d1 c1 e9 03 83 e2 07  48
> >> ?a5 89 d1 f3 a4 c3 20 48 83 ea 20 4c 8b 06 4c 8b 4e 08 4c
> >> ?RIP ?[] memcpy+0xb/0x120
> >> ?RSP 
> >> ?CR2: 8800a4244000
> >> ?---[ end trace fcffa1599cf56382 ]---
> >>
> >> Call to acpi_evaluate_object() not always returns 4096 bytes chunks,
> >> on my system it can return 2048 bytes chunk, so pass the length of
> >> retrieved chunk to memcpy(), not the length of the recieving buffer.
> >>
> >> Signed-off-by: Igor Murzov 
> 
> Hi Igor,
> 
> I'm not sure I understand, does your BIOS return 2K chunks always or
> just for the last chunks?

Only for the last chunk. acpi_evaluate_object() returns 16 x 4Kb chunks
and then 1 x 2Kb on my laptop.
If I revert both my patches (211fa4fc4e13492151e698d92b0dff56b29928ec and 
a3f83ab1a717c0e6c2f59a4cfdaa10707cc35c55), applying following patch:
-
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c 
b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
index 9d95792..1376b94 100644
--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
@@ -58,6 +58,7 @@ static int radeon_atrm_call(acpi_handle atrm_handle, uint8_t 
*bios,
}

obj = (union acpi_object 

Re: [PATCH 1/2] drm/radeon: fix invalid memory access in radeon_atrm_get_bios()

2012-02-02 Thread Igor Murzov
On Wed, 1 Feb 2012 18:42:52 +
Dave Airlie airl...@gmail.com wrote:

 On Tue, Jan 24, 2012 at 2:10 PM, Alex Deucher alexdeuc...@gmail.com wrote:
  On Sun, Jan 22, 2012 at 9:43 AM, Igor Murzov
  intergalactic.anonym...@gmail.com wrote:
  From 77c912ea1eca50a93a34d5be69f9dc96a8bef0d8 Mon Sep 17 00:00:00 2001
  From: Igor Murzov e-m...@date.by
  Date: Sun, 22 Jan 2012 19:02:27 +0400
  Subject: [PATCH 1/2] drm/radeon: fix invalid memory access in 
  radeon_atrm_get_bios()
 
  At a boot time I observed following bug:
 
   BUG: unable to handle kernel paging request at 8800a4244000
   IP: [81275b5b] memcpy+0xb/0x120
   PGD 1816063 PUD 1fe7d067 PMD 1ff9f067 PTE 8000a4244160
   Oops:  [#1] SMP DEBUG_PAGEALLOC
   CPU 0
   Modules linked in: btusb bluetooth brcmsmac brcmutil crc8 cordic b43 
  radeon(+)
   mac80211 cfg80211 ttm ohci_hcd drm_kms_helper rfkill drm ssb agpgart 
  mmc_core
   sp5100_tco video battery ac thermal processor rtc_cmos thermal_sys 
  snd_hda_codec_hdmi
   joydev snd_hda_codec_conexant button bcma pcmcia snd_hda_intel 
  snd_hda_codec
   snd_hwdep snd_pcm shpchp pcmcia_core k8temp snd_timer atl1c snd psmouse 
  hwmon
   i2c_piix4 i2c_algo_bit soundcore evdev i2c_core ehci_hcd sg serio_raw 
  snd_page_alloc
   loop btrfs
 
   Pid: 1008, comm: modprobe Not tainted 3.3.0-rc1 #21 LENOVO 20046          
                   /AMD CRB
   RIP: 0010:[81275b5b]  [81275b5b] memcpy+0xb/0x120
   RSP: 0018:8800aa72db00  EFLAGS: 00010246
   RAX: 8800a415 RBX: 1000 RCX: 0087
   RDX:  RSI: 8800a4244000 RDI: 8800a4150bc8
   RBP: 8800aa72db78 R08: 0010 R09: 8174bbec
   R10: 812ee010 R11: 0001 R12: 1000
   R13: 0001 R14: 8800a414 R15: 8800aaba1800
   FS:  7ff9a3bd4720() GS:8800afa0() 
  knlGS:
   CS:  0010 DS:  ES:  CR0: 8005003b
   CR2: 8800a4244000 CR3: a9c18000 CR4: 06f0
   DR0:  DR1:  DR2: 
   DR3:  DR6: 0ff0 DR7: 0400
   Process modprobe (pid: 1008, threadinfo 8800aa72c000, task 
  8800aa0e4000)
   Stack:
   a04e7c7b 0001 0001 8800aa72db28
   0001 1000 8113cbef 0020
   8800a4243420 8802 8800aa72db08 8800a9d42000
   Call Trace:
   [a04e7c7b] ? radeon_atrm_get_bios_chunk+0x8b/0xd0 [radeon]
   [8113cbef] ? kmalloc_order_trace+0x3f/0xb0
   [a04a9298] radeon_get_bios+0x68/0x2f0 [radeon]
   [a04c7a30] rv770_init+0x40/0x280 [radeon]
   [a047d740] radeon_device_init+0x560/0x600 [radeon]
   [a047ef4f] radeon_driver_load_kms+0xaf/0x170 [radeon]
   [a043cdde] drm_get_pci_dev+0x18e/0x2c0 [drm]
   [a04e7e95] radeon_pci_probe+0xad/0xb5 [radeon]
   [81296c5f] local_pci_probe+0x5f/0xd0
   [81297418] pci_device_probe+0x88/0xb0
   [813417aa] ? driver_sysfs_add+0x7a/0xb0
   [813418d8] really_probe+0x68/0x180
   [81341be5] driver_probe_device+0x45/0x70
   [81341cb3] __driver_attach+0xa3/0xb0
   [81341c10] ? driver_probe_device+0x70/0x70
   [813400ce] bus_for_each_dev+0x5e/0x90
   [8134172e] driver_attach+0x1e/0x20
   [81341298] bus_add_driver+0xc8/0x280
   [813422c6] driver_register+0x76/0x140
   [812976d6] __pci_register_driver+0x66/0xe0
   [a043d021] drm_pci_init+0x111/0x120 [drm]
   [8133c67a] ? vga_switcheroo_register_handler+0x3a/0x60
   [a0229000] ? 0xa0228fff
   [a02290ec] radeon_init+0xec/0xee [radeon]
   [810002f2] do_one_initcall+0x42/0x180
   [8109d8d2] sys_init_module+0x92/0x1e0
   [815407a9] system_call_fastpath+0x16/0x1b
   Code: 58 2a 43 50 88 43 4e 48 83 c4 08 5b c9 c3 66 90 e8 cb fd ff ff eb
   e6 90 90 90 90 90 90 90 90 90 48 89 f8 89 d1 c1 e9 03 83 e2 07 f3 48
   a5 89 d1 f3 a4 c3 20 48 83 ea 20 4c 8b 06 4c 8b 4e 08 4c
   RIP  [81275b5b] memcpy+0xb/0x120
   RSP 8800aa72db00
   CR2: 8800a4244000
   ---[ end trace fcffa1599cf56382 ]---
 
  Call to acpi_evaluate_object() not always returns 4096 bytes chunks,
  on my system it can return 2048 bytes chunk, so pass the length of
  retrieved chunk to memcpy(), not the length of the recieving buffer.
 
  Signed-off-by: Igor Murzov e-m...@date.by
 
 Hi Igor,
 
 I'm not sure I understand, does your BIOS return 2K chunks always or
 just for the last chunks?

Only for the last chunk. acpi_evaluate_object() returns 16 x 4Kb chunks
and then 1 x 2Kb on my laptop.
If I revert both my patches (211fa4fc4e13492151e698d92b0dff56b29928ec and 
a3f83ab1a717c0e6c2f59a4cfdaa10707cc35c55), applying following patch:
-
diff --git 

Re: [PATCH] Don't build Intel DRM if $CHOST is not i?86-* or x86_64-*

2012-02-02 Thread Jeremy Huddleston

On Feb 1, 2012, at 1:56 PM, Julien Cristau wrote:

 On Wed, Feb  1, 2012 at 13:01:58 -0800, Jeremy Huddleston wrote:
 
 yeah, that's probably cleaner (I guess it'll avoid the -*), but it should 
 have the same effect.
 
 I get host_os=linux-gnu here afaict, so not really the same effect, no.

Weird.  I had powerpc-linux-gnu when I checked it earlier ... maybe my mind is 
playing tricks on me...

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


Re: [PATCH] Don't build Intel DRM if $CHOST is not i?86-* or x86_64-*

2012-02-02 Thread Jeremy Huddleston
yeah, that's probably cleaner (I guess it'll avoid the -*), but it should have 
the same effect.

I'll make the change.

On Feb 1, 2012, at 12:43 PM, Julien Cristau wrote:

 On Mon, Jan 30, 2012 at 15:25:20 -0800, Jeremy Huddleston wrote:
 
 This fixes a failure in 'make check' found by the tinderbox when trying to
 build this code on Linux/ppc.  This code is only designed to run on
 Intel platforms, so don't even bother building it if we're not in that set.
 
 Found-by: Tinderbox
 Signed-off-by: Jeremy Huddleston jerem...@apple.com
 ---
 
 It now causes the intel bits to not build on my Linux/ppc tinderbox, but I'd
 appreciate someone verifying that it does the right thing on intel boxes as
 well.
 
 configure.ac |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)
 
 diff --git a/configure.ac b/configure.ac
 index 773167f..f5ebc1d 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -250,7 +250,10 @@ if test x$INTEL != xno -o x$RADEON != xno; then
 
 else
if test x$INTEL != xno; then
 -   INTEL=yes
 +   case $host_os in
 +   i?86-*|x86_64-*) INTEL=yes ;;
 +   *) INTEL=no ;;
 +   esac
fi
 
 don't you want to check host_cpu rather than host_os?
 
 Cheers,
 Julien
 

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


Flickering with page-flipping on Acer Iconia W500 (AMD C-50 APU)

2012-02-02 Thread Felix Kuehling
Following up on my message from Jan 19, now with a lot more hard data
and a less intrusive modification. Still a prototype though. CC-ing
DRI-devel and Mario Kleiner for a larger audience.

To recap, I was seeing consistent flickering with Mesa/KMS on Android on
my Iconia Tab W500 tablet with an AMD C-50 APU. I was also noticing
occasional flickering under Ubuntu on the same system when
maximizing/restoring windows and releasing windows after moving them.

I believe that flickering is related to page flipping and the associated
notifications to user space. A small modification to the page flipping
code in the Radeon driver made the problem disappear on both Ubuntu and
Android. As I understand it, the page flip notification logic works as
follows:

 1. Hardware issues vsync IRQ
 2. IRQ handler calls radeon_crtc_handle_flip
 3. radeon_crtc_handle_flip calls radeon_page_flip, which programs MMIO
to flip pages and returns status whether the flip has been completed
 4. if flip has not been completed, radeon_crtc_handle_flip uses current
scanout position to predict whether flip will complete in the
current frame or not
 5. if flip is predicted to complete, signal user space, otherwise defer
until next vsync IRQ

The condition in step 4 needed a slight modification on my hardware. If
the current scanout position is negative (inside vblank interval), the
page flip will not complete until the next vsync on my hardware.

I'm attaching two patches. radeon_flip_diag.diff adds some debug output
to the kernel log that helped me understand the timing of VSync IRQs
used for handling page-flips relative to the screen refresh in progress.
It also measures the time it takes to program the page flip in MMIO in
pixels scanned out (typically about 300 pixels, so relatively
insignificant compared to the vertical refresh).

On my system it turned out that the scanout position at the time
radeon_crtc_handle_flip was called was somewhere between 798-800 and
-2-0 (the LVDS screen having 800 visible rows). I used an awk script
(also attached) to compute some statistics. With the original condition
almost no page flips were detected as deferred to the next vsync IRQ.
With the modified condition about 50% page flips were completed
immediately according to radeon_page_flip and of the remaining ones
about 50% were correctly predicted to complete based on the scanout
position. In total about 25% were deferred until the next vsync. These
25% must have been causing flickering with the original condition.

radeon_flip_fix.diff shows the minor modification to the condition used
to decide whether a page-flip has been completed or will complete in the
current screen refresh.

My conclusion is that on this particular hardware the condition that 
predicts page flip completion must be modified in order to avoid
notifying user space of completed page flips prematurely.

Regards,
  Felix

-- 
 _Felix Kuehling
 \ _  |   MTS Software Development Eng.
 /|_| |   SW-Linux Base Gfx | AMD
|__/ \|   T 905.882.2600 x8928



parse_flip.awk
Description: parse_flip.awk
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 292f73f..b050e11 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -277,7 +277,7 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)
 	struct timeval now;
 	unsigned long flags;
 	u32 update_pending;
-	int vpos, hpos;
+	int vpos, hpos, valid;
 
 	spin_lock_irqsave(rdev-ddev-event_lock, flags);
 	work = radeon_crtc-unpin_work;
@@ -288,8 +288,17 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)
 	}
 	/* New pageflip, or just completion of a previous one? */
 	if (!radeon_crtc-deferred_flip_completion) {
+		int vpos0, hpos0, pixels;
+		valid = radeon_get_crtc_scanoutpos(rdev-ddev, crtc_id,
+		   vpos0, hpos0);
 		/* do the flip (mmio) */
 		update_pending = radeon_page_flip(rdev, crtc_id, work-new_crtc_base);
+		valid = radeon_get_crtc_scanoutpos(rdev-ddev, crtc_id,
+		   vpos, hpos);
+		if (vpos  vpos0)
+			vpos0 -= rdev-mode_info.crtcs[crtc_id]-base.hwmode.crtc_vtotal;
+		pixels = hpos - hpos0 + (vpos - vpos0) * rdev-mode_info.crtcs[crtc_id]-base.hwmode.crtc_htotal;
+		DRM_ERROR (radeon_page_flip took %d pixels\n, pixels);
 	} else {
 		/* This is just a completion of a flip queued in crtc
 		 * at last invocation. Make sure we go directly to
@@ -302,19 +311,24 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)
 	/* Has the pageflip already completed in crtc, or is it certain
 	 * to complete in this vblank?
 	 */
-	if (update_pending 
-	(DRM_SCANOUTPOS_VALID  radeon_get_crtc_scanoutpos(rdev-ddev, crtc_id,
-			   vpos, hpos)) 
-	(vpos =0) 
-	(vpos  (99 * rdev-mode_info.crtcs[crtc_id]-base.hwmode.crtc_vdisplay)/100)) {
-		/* crtc didn't flip in this target vblank interval,
-		 * but flip is pending in crtc. It will complete it
-		 

Re: R600 definition error for interrupt handler swap

2012-02-02 Thread Cédric Cano

Hi Alex,

We don't have the documentation that contains this register definition.

We try to use the Linux 3.0.0 on our PowerPC board and M96 GPU (RV730): 
it doesn't work as is. We need to revert this definition like it was 
before 2.6.39.4 
(http://lists.freedesktop.org/archives/dri-devel/2011-July/012811.html).


Are you sure the documentation is correct?

Cedric

Le 01/02/2012 20:46, Alex Deucher a écrit :

On Wed, Feb 1, 2012 at 4:33 AM, Cédric Canocc...@interfaceconcept.com  wrote:

Hello,

We're trying to use R600 DRM driver with big endian architecture. We find
the following error in R600 definition of interrupt handler swap.

Perhaps there's the same error in the evergreen definitions header file.

The definition in the register header is correct according to the
register spec.  It's bits 2:1 on both r6xx and evergreen.

0 = no swap
1 = 16 bit swap (0xaabb becomes 0xbbaa)
2 = 32 bit swap (0xaabbccdd becomes 0xddccbbaa)
3 = 64 bit swap (0xaabbccddeeff0011 becomes 0x1100ffeeddccbbaa))

Alex


Cedric

Signed-off-by: Cédric Canocc...@interfaceconcept.com
Signed-off-by: Thomas Jourdantjour...@interfaceconcept.com
---
diff -Naur linux-3.2.2/drivers/gpu/drm/radeon/r600d.h
linux-3.2.2/drivers/gpu/drm/radeon/r600d.h
--- linux-3.2.2/drivers/gpu/drm/radeon/r600d.h2012-01-26
01:39:32.0 +0100
+++ linux-3.2.2/drivers/gpu/drm/radeon/r600d.h2012-02-01
10:25:04.0 +0100
@@ -552,7 +552,7 @@
  #define IH_RB_WPTR_ADDR_LO0x3e14
  #define IH_CNTL   0x3e18
  #   define ENABLE_INTR(1  0)
-#   define IH_MC_SWAP(x)  ((x)  1)
+#   define IH_MC_SWAP(x)  ((x)  2)
  #   define IH_MC_SWAP_NONE0
  #   define IH_MC_SWAP_16BIT   1
  #   define IH_MC_SWAP_32BIT   2
--


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

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


Re: R600 definition error for interrupt handler swap

2012-02-02 Thread Michel Dänzer
On Don, 2012-02-02 at 09:42 +0100, Cédric Cano wrote: 
 
 We try to use the Linux 3.0.0 on our PowerPC board and M96 GPU (RV730): 
 it doesn't work as is. We need to revert this definition like it was 
 before 2.6.39.4 
 (http://lists.freedesktop.org/archives/dri-devel/2011-July/012811.html).

I suspect you may be tripping over the double byte-swapping fixed by
commit df07d6999e4e502ff474eeafe11ea0055f4cd68d ('drm/radeon: Writeback
endian fixes'). By using the wrong definition of IH_MC_SWAP, you'd
accidentally disable the GPU byte swapping, making the CPU byte swapping
work correctly.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast |  Debian, X and DRI developer
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/radeon/kms/blit: fix blit copy for very large buffers

2012-02-02 Thread Paul Menzel
Dear Ilija,


Am Mittwoch, den 01.02.2012, 17:07 -0500 schrieb Ilija Hadzic:

[…]

 +#define I2F_MAX_BITS 15
 +#define I2F_MAX_INPUT  ((2  I2F_MAX_BITS) - 1)
 +#define I2F_SHIFT (24 - I2F_MAX_BITS)
 +
 +/*
 + * converts unsigned integer into 32-bit IEEE floating point representation;
 + * conversion is not universal and only works for the range from 0
 + * to 2^^I2F_MAX_BITS-1; currently we only use it with inputs between
 + * 0 and 16384 (inclusive), so I2F_MAX_BITS=15 is enough; if necessary
 + * I2F_MAX_BITS can be increased, but that will add to loop iterations

should that be t*w*o?

 + * and slow us down; conversion is done by shifting the input and counting
 + * down until the first 1 reaches bit position 23; the resulting counter
 + * and the shifted input are the exponent and the fraction; the sign is
 + * always zero
 + */

I like sentences with capital starting letter and full stop at the end
better. But I do not know if there are any guidelines for that.

[…]


Thanks,

Paul


signature.asc
Description: This is a digitally signed message part
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm: cleanup device registration

2012-02-02 Thread Sascha Hauer
The non modesetting drm drivers currently use a handcrafted pci probe
function. This requires the drm core to keep a list of registered devices
for each driver. This series adds a probe function for the non modesetting
drivers and removes the legacy probe code. The USB and platform drivers
use the devices_list aswell which is unnecessary. This is also cleaned
up in this series.

I am confident that the standard pci probe mechanism will work for the non
modesetting drivers, but unfortunately I have non of them handy for testing,
so it would be great if someone with access to one of those devices could
give this series a test.

Sascha

Sascha Hauer (12):
  drm: remove kdriver union from struct drm_driver
  drm: remove platformdev and usbdev from struct drm_device
  drm: remove unused field bus_type from struct drm_bus
  drm: provide a pci probe function for non modesetting devices
  drm: use drm_get_platform_dev and drop drm_platform_init/exit
  drm usb: drop drm_usb_init/exit
  drm: remove now unused device_list
  drm vmwgfx: remove unused field vmw_chipset from struct vmw_private
  drm: Add drm_register_device function
  drm pci: use drm_register_device
  drm platform: use drm_register_device
  drm usb: use drm_register_device

 drivers/gpu/drm/drm_pci.c |   98 ++
 drivers/gpu/drm/drm_platform.c|  108 +
 drivers/gpu/drm/drm_stub.c|   56 +++
 drivers/gpu/drm/drm_usb.c |   72 ++--
 drivers/gpu/drm/exynos/exynos_drm_drv.c   |6 +-
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c |3 +-
 drivers/gpu/drm/i810/i810_drv.c   |   16 
 drivers/gpu/drm/mga/mga_drv.c |   16 
 drivers/gpu/drm/r128/r128_drv.c   |   16 
 drivers/gpu/drm/savage/savage_drv.c   |   16 
 drivers/gpu/drm/sis/sis_drv.c |   16 
 drivers/gpu/drm/tdfx/tdfx_drv.c   |   16 
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c   |1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h   |1 -
 include/drm/drmP.h|   21 +-
 include/drm/drm_usb.h |3 -
 16 files changed, 190 insertions(+), 275 deletions(-)

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


[PATCH 05/12] drm: use drm_get_platform_dev and drop drm_platform_init/exit

2012-02-02 Thread Sascha Hauer
drm_platform_init is modelled after the legacy pci probe
support. It initializes a device_list, but this list will
only ever have a single entry as it is specific to a single
platform device instance. Simplify this by calling
drm_get_platform_dev directly from the driver.

Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
---
 drivers/gpu/drm/drm_platform.c  |   39 +++---
 drivers/gpu/drm/exynos/exynos_drm_drv.c |6 +++-
 include/drm/drmP.h  |3 --
 3 files changed, 8 insertions(+), 40 deletions(-)

diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c
index 453da2d..7153508 100644
--- a/drivers/gpu/drm/drm_platform.c
+++ b/drivers/gpu/drm/drm_platform.c
@@ -28,6 +28,8 @@
 #include linux/export.h
 #include drmP.h
 
+static struct drm_bus drm_platform_bus;
+
 /**
  * Register.
  *
@@ -53,6 +55,8 @@ int drm_get_platform_dev(struct platform_device *platdev,
 
dev-dev = platdev-dev;
 
+   driver-bus = drm_platform_bus;
+
mutex_lock(drm_global_mutex);
 
ret = drm_fill_in_dev(dev, NULL, driver);
@@ -87,8 +91,6 @@ int drm_get_platform_dev(struct platform_device *platdev,
goto err_g3;
}
 
-   list_add_tail(dev-driver_item, driver-device_list);
-
mutex_unlock(drm_global_mutex);
 
DRM_INFO(Initialized %s %d.%d.%d %s on minor %d\n,
@@ -165,36 +167,3 @@ static struct drm_bus drm_platform_bus = {
.get_name = drm_platform_get_name,
.set_busid = drm_platform_set_busid,
 };
-
-/**
- * Platform device initialization. Called direct from modules.
- *
- * \return zero on success or a negative number on failure.
- *
- * Initializes a drm_device structures,registering the
- * stubs
- *
- * Expands the \c DRIVER_PREINIT and \c DRIVER_POST_INIT macros before and
- * after the initialization for driver customization.
- */
-
-int drm_platform_init(struct drm_driver *driver, struct platform_device 
*platform_device)
-{
-   DRM_DEBUG(\n);
-
-   driver-bus = drm_platform_bus;
-   INIT_LIST_HEAD(driver-device_list);
-   return drm_get_platform_dev(platform_device, driver);
-}
-EXPORT_SYMBOL(drm_platform_init);
-
-void drm_platform_exit(struct drm_driver *driver, struct platform_device 
*platform_device)
-{
-   struct drm_device *dev, *tmp;
-   DRM_DEBUG(\n);
-
-   list_for_each_entry_safe(dev, tmp, driver-device_list, driver_item)
-   drm_put_dev(dev);
-   DRM_INFO(Module unloaded\n);
-}
-EXPORT_SYMBOL(drm_platform_exit);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 35889ca..17a100c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -219,14 +219,16 @@ static int exynos_drm_platform_probe(struct 
platform_device *pdev)
 
exynos_drm_driver.num_ioctls = DRM_ARRAY_SIZE(exynos_ioctls);
 
-   return drm_platform_init(exynos_drm_driver, pdev);
+   return drm_get_platform_dev(pdev, exynos_drm_driver);
 }
 
 static int exynos_drm_platform_remove(struct platform_device *pdev)
 {
+   struct drm_device *dev = platform_get_drvdata(pdev);
+
DRM_DEBUG_DRIVER(%s\n, __FILE__);
 
-   drm_platform_exit(exynos_drm_driver, pdev);
+   drm_put_dev(dev);
 
return 0;
 }
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 3d1ce03..d14c23a 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1678,9 +1678,6 @@ extern int drm_get_pci_dev(struct pci_dev *pdev,
 
 
 /* platform section */
-extern int drm_platform_init(struct drm_driver *driver, struct platform_device 
*platform_device);
-extern void drm_platform_exit(struct drm_driver *driver, struct 
platform_device *platform_device);
-
 extern int drm_get_platform_dev(struct platform_device *pdev,
struct drm_driver *driver);
 
-- 
1.7.8.3

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


[PATCH 12/12] drm usb: use drm_register_device

2012-02-02 Thread Sascha Hauer
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
---
 drivers/gpu/drm/drm_usb.c |   43 ++-
 1 files changed, 2 insertions(+), 41 deletions(-)

diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c
index dd154d4..b741b54 100644
--- a/drivers/gpu/drm/drm_usb.c
+++ b/drivers/gpu/drm/drm_usb.c
@@ -24,52 +24,13 @@ int drm_get_usb_dev(struct usb_interface *interface,
usbdev = interface_to_usbdev(interface);
dev-dev = usbdev-dev;
 
-   mutex_lock(drm_global_mutex);
-
-   ret = drm_fill_in_dev(dev, NULL, driver);
-   if (ret) {
-   printk(KERN_ERR DRM: Fill_in_dev failed.\n);
-   goto err_g1;
-   }
-
usb_set_intfdata(interface, dev);
-   ret = drm_get_minor(dev, dev-control, DRM_MINOR_CONTROL);
-   if (ret)
-   goto err_g1;
-
-   ret = drm_get_minor(dev, dev-primary, DRM_MINOR_LEGACY);
-   if (ret)
-   goto err_g2;
-
-   if (dev-driver-load) {
-   ret = dev-driver-load(dev, 0);
-   if (ret)
-   goto err_g3;
-   }
 
-   /* setup the grouping for the legacy output */
-   ret = drm_mode_group_init_legacy_group(dev,
-  dev-primary-mode_group);
+   ret = drm_register_device(dev, driver, 0);
if (ret)
-   goto err_g3;
+   kfree(dev);
 
-   mutex_unlock(drm_global_mutex);
-
-   DRM_INFO(Initialized %s %d.%d.%d %s on minor %d\n,
-driver-name, driver-major, driver-minor, driver-patchlevel,
-driver-date, dev-primary-index);
-
-   return 0;
-
-err_g3:
-   drm_put_minor(dev-primary);
-err_g2:
-   drm_put_minor(dev-control);
-err_g1:
-   kfree(dev);
-   mutex_unlock(drm_global_mutex);
return ret;
-
 }
 EXPORT_SYMBOL(drm_get_usb_dev);
 
-- 
1.7.8.3

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


[PATCH 10/12] drm pci: use drm_register_device

2012-02-02 Thread Sascha Hauer
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
---
 drivers/gpu/drm/drm_pci.c |   45 +++--
 1 files changed, 3 insertions(+), 42 deletions(-)

diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index c0d47ab..2407a1d 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -332,54 +332,15 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct 
pci_device_id *ent,
dev-hose = pdev-sysdata;
 #endif
 
-   mutex_lock(drm_global_mutex);
-
-   if ((ret = drm_fill_in_dev(dev, ent, driver))) {
-   printk(KERN_ERR DRM: Fill_in_dev failed.\n);
+   ret = drm_register_device(dev, driver, ent-driver_data);
+   if (ret)
goto err_g2;
-   }
-
-   if (drm_core_check_feature(dev, DRIVER_MODESET)) {
-   pci_set_drvdata(pdev, dev);
-   ret = drm_get_minor(dev, dev-control, DRM_MINOR_CONTROL);
-   if (ret)
-   goto err_g2;
-   }
-
-   if ((ret = drm_get_minor(dev, dev-primary, DRM_MINOR_LEGACY)))
-   goto err_g3;
-
-   if (dev-driver-load) {
-   ret = dev-driver-load(dev, ent-driver_data);
-   if (ret)
-   goto err_g4;
-   }
-
-   /* setup the grouping for the legacy output */
-   if (drm_core_check_feature(dev, DRIVER_MODESET)) {
-   ret = drm_mode_group_init_legacy_group(dev,
-   dev-primary-mode_group);
-   if (ret)
-   goto err_g4;
-   }
-
-   DRM_INFO(Initialized %s %d.%d.%d %s for %s on minor %d\n,
-driver-name, driver-major, driver-minor, driver-patchlevel,
-driver-date, pci_name(pdev), dev-primary-index);
 
-   mutex_unlock(drm_global_mutex);
-   return 0;
-
-err_g4:
-   drm_put_minor(dev-primary);
-err_g3:
-   if (drm_core_check_feature(dev, DRIVER_MODESET))
-   drm_put_minor(dev-control);
+   return ret;
 err_g2:
pci_disable_device(pdev);
 err_g1:
kfree(dev);
-   mutex_unlock(drm_global_mutex);
return ret;
 }
 EXPORT_SYMBOL(drm_get_pci_dev);
-- 
1.7.8.3

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


[PATCH 09/12] drm: Add drm_register_device function

2012-02-02 Thread Sascha Hauer
pci, usb and platform support all duplicate the same code. Provide
a common function for this.

Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
---
 drivers/gpu/drm/drm_stub.c |   56 
 include/drm/drmP.h |2 +
 2 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 6d7b083..c36b19c 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -320,6 +320,62 @@ int drm_fill_in_dev(struct drm_device *dev,
return retcode;
 }
 
+int drm_register_device(struct drm_device *dev, struct drm_driver *driver,
+   unsigned long flags)
+{
+   int ret;
+
+   mutex_lock(drm_global_mutex);
+
+   ret = drm_fill_in_dev(dev, NULL, driver);
+   if (ret) {
+   printk(KERN_ERR DRM: Fill_in_dev failed.\n);
+   goto err_g1;
+   }
+
+   if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+   ret = drm_get_minor(dev, dev-control, DRM_MINOR_CONTROL);
+   if (ret)
+   goto err_g1;
+   }
+
+   ret = drm_get_minor(dev, dev-primary, DRM_MINOR_LEGACY);
+   if (ret)
+   goto err_g2;
+
+   if (dev-driver-load) {
+   ret = dev-driver-load(dev, flags);
+   if (ret)
+   goto err_g3;
+   }
+
+   /* setup the grouping for the legacy output */
+   if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+   ret = drm_mode_group_init_legacy_group(dev,
+   dev-primary-mode_group);
+   if (ret)
+   goto err_g3;
+   }
+
+   mutex_unlock(drm_global_mutex);
+
+   DRM_INFO(Initialized %s %d.%d.%d %s on minor %d\n,
+driver-name, driver-major, driver-minor, driver-patchlevel,
+driver-date, dev-primary-index);
+
+   return 0;
+
+err_g3:
+   drm_put_minor(dev-primary);
+err_g2:
+   if (drm_core_check_feature(dev, DRIVER_MODESET))
+   drm_put_minor(dev-control);
+err_g1:
+   mutex_unlock(drm_global_mutex);
+
+   return ret;
+}
+EXPORT_SYMBOL(drm_register_device);
 
 /**
  * Get a secondary minor number.
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 3c14c05..467a9a5 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1651,6 +1651,8 @@ extern int drm_fill_in_dev(struct drm_device *dev,
   const struct pci_device_id *ent,
   struct drm_driver *driver);
 int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type);
+int drm_register_device(struct drm_device *dev, struct drm_driver *driver,
+   unsigned long flags);
 /*@}*/
 
 /* PCI section */
-- 
1.7.8.3

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


[PATCH 11/12] drm platform: use drm_register_device

2012-02-02 Thread Sascha Hauer
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
---
 drivers/gpu/drm/drm_platform.c |   51 ++-
 1 files changed, 3 insertions(+), 48 deletions(-)

diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c
index 7153508..5d5e388 100644
--- a/drivers/gpu/drm/drm_platform.c
+++ b/drivers/gpu/drm/drm_platform.c
@@ -56,57 +56,12 @@ int drm_get_platform_dev(struct platform_device *platdev,
dev-dev = platdev-dev;
 
driver-bus = drm_platform_bus;
+   dev_set_drvdata(platdev-dev, dev);
 
-   mutex_lock(drm_global_mutex);
-
-   ret = drm_fill_in_dev(dev, NULL, driver);
-
-   if (ret) {
-   printk(KERN_ERR DRM: Fill_in_dev failed.\n);
-   goto err_g1;
-   }
-
-   if (drm_core_check_feature(dev, DRIVER_MODESET)) {
-   dev_set_drvdata(platdev-dev, dev);
-   ret = drm_get_minor(dev, dev-control, DRM_MINOR_CONTROL);
-   if (ret)
-   goto err_g1;
-   }
-
-   ret = drm_get_minor(dev, dev-primary, DRM_MINOR_LEGACY);
+   ret = drm_register_device(dev, driver, 0);
if (ret)
-   goto err_g2;
-
-   if (dev-driver-load) {
-   ret = dev-driver-load(dev, 0);
-   if (ret)
-   goto err_g3;
-   }
-
-   /* setup the grouping for the legacy output */
-   if (drm_core_check_feature(dev, DRIVER_MODESET)) {
-   ret = drm_mode_group_init_legacy_group(dev,
-   dev-primary-mode_group);
-   if (ret)
-   goto err_g3;
-   }
-
-   mutex_unlock(drm_global_mutex);
-
-   DRM_INFO(Initialized %s %d.%d.%d %s on minor %d\n,
-driver-name, driver-major, driver-minor, driver-patchlevel,
-driver-date, dev-primary-index);
-
-   return 0;
+   kfree(dev);
 
-err_g3:
-   drm_put_minor(dev-primary);
-err_g2:
-   if (drm_core_check_feature(dev, DRIVER_MODESET))
-   drm_put_minor(dev-control);
-err_g1:
-   kfree(dev);
-   mutex_unlock(drm_global_mutex);
return ret;
 }
 EXPORT_SYMBOL(drm_get_platform_dev);
-- 
1.7.8.3

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


[PATCH 06/12] drm usb: drop drm_usb_init/exit

2012-02-02 Thread Sascha Hauer
Usb drivers can register themselves and call drm_get_usb_dev
in their probe function. We don't need a drm specific wrapper
function for this. As there are currently no users, none a
touched here.

Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
---
 drivers/gpu/drm/drm_usb.c |   26 --
 include/drm/drm_usb.h |3 ---
 2 files changed, 4 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c
index b7eb64a..dd154d4 100644
--- a/drivers/gpu/drm/drm_usb.c
+++ b/drivers/gpu/drm/drm_usb.c
@@ -2,6 +2,8 @@
 #include linux/usb.h
 #include linux/export.h
 
+static struct drm_bus drm_usb_bus;
+
 #ifdef CONFIG_USB
 int drm_get_usb_dev(struct usb_interface *interface,
const struct usb_device_id *id,
@@ -17,6 +19,8 @@ int drm_get_usb_dev(struct usb_interface *interface,
if (!dev)
return -ENOMEM;
 
+   driver-bus = drm_usb_bus;
+
usbdev = interface_to_usbdev(interface);
dev-dev = usbdev-dev;
 
@@ -49,8 +53,6 @@ int drm_get_usb_dev(struct usb_interface *interface,
if (ret)
goto err_g3;
 
-   list_add_tail(dev-driver_item, driver-device_list);
-
mutex_unlock(drm_global_mutex);
 
DRM_INFO(Initialized %s %d.%d.%d %s on minor %d\n,
@@ -92,24 +94,4 @@ static struct drm_bus drm_usb_bus = {
.get_name = drm_usb_get_name,
.set_busid = drm_usb_set_busid,
 };
-
-int drm_usb_init(struct drm_driver *driver, struct usb_driver *udriver)
-{
-   int res;
-   DRM_DEBUG(\n);
-
-   INIT_LIST_HEAD(driver-device_list);
-   driver-bus = drm_usb_bus;
-
-   res = usb_register(udriver);
-   return res;
-}
-EXPORT_SYMBOL(drm_usb_init);
-
-void drm_usb_exit(struct drm_driver *driver,
- struct usb_driver *udriver)
-{
-   usb_deregister(udriver);
-}
-EXPORT_SYMBOL(drm_usb_exit);
 #endif
diff --git a/include/drm/drm_usb.h b/include/drm/drm_usb.h
index 33506c11..198f90b 100644
--- a/include/drm/drm_usb.h
+++ b/include/drm/drm_usb.h
@@ -5,9 +5,6 @@
 
 #include linux/usb.h
 
-extern int drm_usb_init(struct drm_driver *driver, struct usb_driver *udriver);
-extern void drm_usb_exit(struct drm_driver *driver, struct usb_driver 
*udriver);
-
 int drm_get_usb_dev(struct usb_interface *interface,
const struct usb_device_id *id,
struct drm_driver *driver);
-- 
1.7.8.3

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


[PATCH 02/12] drm: remove platformdev and usbdev from struct drm_device

2012-02-02 Thread Sascha Hauer
struct drm_device has a struct usbdevice * and a
struct platform_device *. This is unused, so remove it.
If the platform_device or usbdevice is needed, we can
always get it using to_usb_device or to to_platform_device.

Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
---
 drivers/gpu/drm/drm_platform.c|   18 +++---
 drivers/gpu/drm/drm_usb.c |1 -
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c |3 +--
 include/drm/drmP.h|3 ---
 4 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c
index f21243c..1c1d581 100644
--- a/drivers/gpu/drm/drm_platform.c
+++ b/drivers/gpu/drm/drm_platform.c
@@ -51,7 +51,6 @@ int drm_get_platform_dev(struct platform_device *platdev,
if (!dev)
return -ENOMEM;
 
-   dev-platformdev = platdev;
dev-dev = platdev-dev;
 
mutex_lock(drm_global_mutex);
@@ -112,19 +111,24 @@ EXPORT_SYMBOL(drm_get_platform_dev);
 
 static int drm_platform_get_irq(struct drm_device *dev)
 {
-   return platform_get_irq(dev-platformdev, 0);
+   struct platform_device *pdev = to_platform_device(dev-dev);
+
+   return platform_get_irq(pdev, 0);
 }
 
 static const char *drm_platform_get_name(struct drm_device *dev)
 {
-   return dev-platformdev-name;
+   struct platform_device *pdev = to_platform_device(dev-dev);
+
+   return pdev-name;
 }
 
 static int drm_platform_set_busid(struct drm_device *dev, struct drm_master 
*master)
 {
+   struct platform_device *pdev = to_platform_device(dev-dev);
int len, ret;
 
-   master-unique_len = 13 + strlen(dev-platformdev-name);
+   master-unique_len = 13 + strlen(pdev-name);
master-unique_size = master-unique_len;
master-unique = kmalloc(master-unique_len + 1, GFP_KERNEL);
 
@@ -132,7 +136,7 @@ static int drm_platform_set_busid(struct drm_device *dev, 
struct drm_master *mas
return -ENOMEM;
 
len = snprintf(master-unique, master-unique_len,
-   platform:%s:%02d, dev-platformdev-name, 
dev-platformdev-id);
+   platform:%s:%02d, pdev-name, pdev-id);
 
if (len  master-unique_len) {
DRM_ERROR(Unique buffer overflowed\n);
@@ -141,7 +145,7 @@ static int drm_platform_set_busid(struct drm_device *dev, 
struct drm_master *mas
}
 
dev-devname =
-   kmalloc(strlen(dev-platformdev-name) +
+   kmalloc(strlen(pdev-name) +
master-unique_len + 2, GFP_KERNEL);
 
if (dev-devname == NULL) {
@@ -149,7 +153,7 @@ static int drm_platform_set_busid(struct drm_device *dev, 
struct drm_master *mas
goto err;
}
 
-   sprintf(dev-devname, %s@%s, dev-platformdev-name,
+   sprintf(dev-devname, %s@%s, pdev-name,
master-unique);
return 0;
 err:
diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c
index bd7fe72..224dbdd 100644
--- a/drivers/gpu/drm/drm_usb.c
+++ b/drivers/gpu/drm/drm_usb.c
@@ -18,7 +18,6 @@ int drm_get_usb_dev(struct usb_interface *interface,
return -ENOMEM;
 
usbdev = interface_to_usbdev(interface);
-   dev-usbdev = usbdev;
dev-dev = usbdev-dev;
 
mutex_lock(drm_global_mutex);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c 
b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index d7ae29d..3a9589b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -125,7 +125,6 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper 
*helper,
struct drm_device *dev = helper-dev;
struct fb_info *fbi;
struct drm_mode_fb_cmd2 mode_cmd = { 0 };
-   struct platform_device *pdev = dev-platformdev;
unsigned long size;
int ret;
 
@@ -143,7 +142,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper 
*helper,
 
mutex_lock(dev-struct_mutex);
 
-   fbi = framebuffer_alloc(0, pdev-dev);
+   fbi = framebuffer_alloc(0, dev-dev);
if (!fbi) {
DRM_ERROR(failed to allocate fb info.\n);
ret = -ENOMEM;
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 38b95cb..d770eef 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1140,9 +1140,6 @@ struct drm_device {
struct pci_controller *hose;
 #endif
 
-   struct platform_device *platformdev; /** Platform device struture */
-   struct usb_device *usbdev;
-
struct drm_sg_mem *sg;  /** Scatter gather memory */
unsigned int num_crtcs;  /** Number of CRTCs on this 
device */
void *dev_private;  /** device private data */
-- 
1.7.8.3

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


[PATCH 08/12] drm vmwgfx: remove unused field vmw_chipset from struct vmw_private

2012-02-02 Thread Sascha Hauer
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h |1 -
 2 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index f390f5f..8c7ac41 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -401,7 +401,6 @@ static int vmw_driver_load(struct drm_device *dev, unsigned 
long chipset)
memset(dev_priv, 0, sizeof(*dev_priv));
 
dev_priv-dev = dev;
-   dev_priv-vmw_chipset = chipset;
dev_priv-last_read_seqno = (uint32_t) -100;
mutex_init(dev_priv-hw_mutex);
mutex_init(dev_priv-cmdbuf_mutex);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h 
b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index dc27970..252dba2 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -194,7 +194,6 @@ struct vmw_private {
struct vmw_fifo_state fifo;
 
struct drm_device *dev;
-   unsigned long vmw_chipset;
unsigned int io_start;
uint32_t vram_start;
uint32_t vram_size;
-- 
1.7.8.3

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


[PATCH 01/12] drm: remove kdriver union from struct drm_driver

2012-02-02 Thread Sascha Hauer
struct drm_driver has a union containing the different drivers.
This field is unused in case of a usb or platform device. For
pci devices it is only used in drm_pci_get_name() which uses
the pci_driver to return the pci driver name. For all existing
drm drivers this driver name matches the struct drm_device-name,
so return this name instead and remove the now unnecessary code.

Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
---
 drivers/gpu/drm/drm_pci.c  |   10 +++---
 drivers/gpu/drm/drm_platform.c |1 -
 drivers/gpu/drm/drm_usb.c  |1 -
 include/drm/drmP.h |5 -
 4 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index d4d10b7..1c06d3a 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -148,14 +148,12 @@ static int drm_pci_get_irq(struct drm_device *dev)
 
 static const char *drm_pci_get_name(struct drm_device *dev)
 {
-   struct pci_driver *pdriver = dev-driver-kdriver.pci;
-   return pdriver-name;
+   return dev-driver-name;
 }
 
 int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master)
 {
int len, ret;
-   struct pci_driver *pdriver = dev-driver-kdriver.pci;
master-unique_len = 40;
master-unique_size = master-unique_len;
master-unique = kmalloc(master-unique_size, GFP_KERNEL);
@@ -178,7 +176,7 @@ int drm_pci_set_busid(struct drm_device *dev, struct 
drm_master *master)
master-unique_len = len;
 
dev-devname =
-   kmalloc(strlen(pdriver-name) +
+   kmalloc(strlen(dev-driver-name) +
master-unique_len + 2, GFP_KERNEL);
 
if (dev-devname == NULL) {
@@ -186,8 +184,7 @@ int drm_pci_set_busid(struct drm_device *dev, struct 
drm_master *master)
goto err;
}
 
-   sprintf(dev-devname, %s@%s, pdriver-name,
-   master-unique);
+   sprintf(dev-devname, %s@%s, dev-driver-name, master-unique);
 
return 0;
 err:
@@ -410,7 +407,6 @@ int drm_pci_init(struct drm_driver *driver, struct 
pci_driver *pdriver)
DRM_DEBUG(\n);
 
INIT_LIST_HEAD(driver-device_list);
-   driver-kdriver.pci = pdriver;
driver-bus = drm_pci_bus;
 
if (driver-driver_features  DRIVER_MODESET)
diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c
index ae9db5e..f21243c 100644
--- a/drivers/gpu/drm/drm_platform.c
+++ b/drivers/gpu/drm/drm_platform.c
@@ -179,7 +179,6 @@ int drm_platform_init(struct drm_driver *driver, struct 
platform_device *platfor
 {
DRM_DEBUG(\n);
 
-   driver-kdriver.platform_device = platform_device;
driver-bus = drm_platform_bus;
INIT_LIST_HEAD(driver-device_list);
return drm_get_platform_dev(platform_device, driver);
diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c
index 445003f..bd7fe72 100644
--- a/drivers/gpu/drm/drm_usb.c
+++ b/drivers/gpu/drm/drm_usb.c
@@ -101,7 +101,6 @@ int drm_usb_init(struct drm_driver *driver, struct 
usb_driver *udriver)
DRM_DEBUG(\n);
 
INIT_LIST_HEAD(driver-device_list);
-   driver-kdriver.usb = udriver;
driver-bus = drm_usb_bus;
 
res = usb_register(udriver);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 92f0981..38b95cb 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -919,11 +919,6 @@ struct drm_driver {
struct drm_ioctl_desc *ioctls;
int num_ioctls;
const struct file_operations *fops;
-   union {
-   struct pci_driver *pci;
-   struct platform_device *platform_device;
-   struct usb_driver *usb;
-   } kdriver;
struct drm_bus *bus;
 
/* List of devices hanging off this driver */
-- 
1.7.8.3

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


[PATCH 03/12] drm: remove unused field bus_type from struct drm_bus

2012-02-02 Thread Sascha Hauer
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
---
 drivers/gpu/drm/drm_pci.c  |1 -
 drivers/gpu/drm/drm_platform.c |1 -
 drivers/gpu/drm/drm_usb.c  |1 -
 include/drm/drmP.h |5 -
 4 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index 1c06d3a..f2e8019 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -285,7 +285,6 @@ int drm_pci_agp_init(struct drm_device *dev)
 }
 
 static struct drm_bus drm_pci_bus = {
-   .bus_type = DRIVER_BUS_PCI,
.get_irq = drm_pci_get_irq,
.get_name = drm_pci_get_name,
.set_busid = drm_pci_set_busid,
diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c
index 1c1d581..453da2d 100644
--- a/drivers/gpu/drm/drm_platform.c
+++ b/drivers/gpu/drm/drm_platform.c
@@ -161,7 +161,6 @@ err:
 }
 
 static struct drm_bus drm_platform_bus = {
-   .bus_type = DRIVER_BUS_PLATFORM,
.get_irq = drm_platform_get_irq,
.get_name = drm_platform_get_name,
.set_busid = drm_platform_set_busid,
diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c
index 224dbdd..b7eb64a 100644
--- a/drivers/gpu/drm/drm_usb.c
+++ b/drivers/gpu/drm/drm_usb.c
@@ -88,7 +88,6 @@ static int drm_usb_set_busid(struct drm_device *dev,
 }
 
 static struct drm_bus drm_usb_bus = {
-   .bus_type = DRIVER_BUS_USB,
.get_irq = drm_usb_get_irq,
.get_name = drm_usb_get_name,
.set_busid = drm_usb_set_busid,
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index d770eef..3d1ce03 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -151,10 +151,6 @@ int drm_err(const char *func, const char *format, ...);
 #define DRIVER_GEM 0x1000
 #define DRIVER_MODESET 0x2000
 
-#define DRIVER_BUS_PCI 0x1
-#define DRIVER_BUS_PLATFORM 0x2
-#define DRIVER_BUS_USB 0x3
-
 /***/
 /** \name Begin the DRM... */
 /*@{*/
@@ -697,7 +693,6 @@ struct drm_master {
 #define DRM_SCANOUTPOS_ACCURATE (1  2)
 
 struct drm_bus {
-   int bus_type;
int (*get_irq)(struct drm_device *dev);
const char *(*get_name)(struct drm_device *dev);
int (*set_busid)(struct drm_device *dev, struct drm_master *master);
-- 
1.7.8.3

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


[PATCH 04/12] drm: provide a pci probe function for non modesetting devices

2012-02-02 Thread Sascha Hauer
This way we do not need the legacy handcrafted probe mechanism
anymore and can remove it.

Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
---
 drivers/gpu/drm/drm_pci.c   |   41 +-
 drivers/gpu/drm/i810/i810_drv.c |   16 +
 drivers/gpu/drm/mga/mga_drv.c   |   16 +
 drivers/gpu/drm/r128/r128_drv.c |   16 +
 drivers/gpu/drm/savage/savage_drv.c |   16 +
 drivers/gpu/drm/sis/sis_drv.c   |   16 +
 drivers/gpu/drm/tdfx/tdfx_drv.c |   16 +
 7 files changed, 98 insertions(+), 39 deletions(-)

diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index f2e8019..b53427e 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -363,8 +363,6 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct 
pci_device_id *ent,
goto err_g4;
}
 
-   list_add_tail(dev-driver_item, driver-device_list);
-
DRM_INFO(Initialized %s %d.%d.%d %s for %s on minor %d\n,
 driver-name, driver-major, driver-minor, driver-patchlevel,
 driver-date, pci_name(pdev), dev-primary-index);
@@ -399,41 +397,12 @@ EXPORT_SYMBOL(drm_get_pci_dev);
  */
 int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
 {
-   struct pci_dev *pdev = NULL;
-   const struct pci_device_id *pid;
-   int i;
-
DRM_DEBUG(\n);
 
INIT_LIST_HEAD(driver-device_list);
driver-bus = drm_pci_bus;
 
-   if (driver-driver_features  DRIVER_MODESET)
-   return pci_register_driver(pdriver);
-
-   /* If not using KMS, fall back to stealth mode manual scanning. */
-   for (i = 0; pdriver-id_table[i].vendor != 0; i++) {
-   pid = pdriver-id_table[i];
-
-   /* Loop around setting up a DRM device for each PCI device
-* matching our ID and device class.  If we had the internal
-* function that pci_get_subsys and pci_get_class used, we'd
-* be able to just pass pid in instead of doing a two-stage
-* thing.
-*/
-   pdev = NULL;
-   while ((pdev =
-   pci_get_subsys(pid-vendor, pid-device, pid-subvendor,
-  pid-subdevice, pdev)) != NULL) {
-   if ((pdev-class  pid-class_mask) != pid-class)
-   continue;
-
-   /* stealth mode requires a manual probe */
-   pci_dev_get(pdev);
-   drm_get_pci_dev(pdev, pid, driver);
-   }
-   }
-   return 0;
+   return pci_register_driver(pdriver);
 }
 
 #else
@@ -450,15 +419,9 @@ EXPORT_SYMBOL(drm_pci_init);
 /*@}*/
 void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver)
 {
-   struct drm_device *dev, *tmp;
DRM_DEBUG(\n);
 
-   if (driver-driver_features  DRIVER_MODESET) {
-   pci_unregister_driver(pdriver);
-   } else {
-   list_for_each_entry_safe(dev, tmp, driver-device_list, 
driver_item)
-   drm_put_dev(dev);
-   }
+   pci_unregister_driver(pdriver);
DRM_INFO(Module unloaded\n);
 }
 EXPORT_SYMBOL(drm_pci_exit);
diff --git a/drivers/gpu/drm/i810/i810_drv.c b/drivers/gpu/drm/i810/i810_drv.c
index ec12f7d..94f0660 100644
--- a/drivers/gpu/drm/i810/i810_drv.c
+++ b/drivers/gpu/drm/i810/i810_drv.c
@@ -75,7 +75,23 @@ static struct drm_driver driver = {
.patchlevel = DRIVER_PATCHLEVEL,
 };
 
+static int __devinit
+i810_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+{
+   return drm_get_pci_dev(pdev, ent, driver);
+}
+
+static void
+i810_pci_remove(struct pci_dev *pdev)
+{
+   struct drm_device *dev = pci_get_drvdata(pdev);
+
+   drm_put_dev(dev);
+}
+
 static struct pci_driver i810_pci_driver = {
+   .probe = i810_pci_probe,
+   .remove = i810_pci_remove,
.name = DRIVER_NAME,
.id_table = pciidlist,
 };
diff --git a/drivers/gpu/drm/mga/mga_drv.c b/drivers/gpu/drm/mga/mga_drv.c
index f9a925d..45d848a 100644
--- a/drivers/gpu/drm/mga/mga_drv.c
+++ b/drivers/gpu/drm/mga/mga_drv.c
@@ -87,7 +87,23 @@ static struct drm_driver driver = {
.patchlevel = DRIVER_PATCHLEVEL,
 };
 
+static int __devinit
+mga_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+{
+   return drm_get_pci_dev(pdev, ent, driver);
+}
+
+static void
+mga_pci_remove(struct pci_dev *pdev)
+{
+   struct drm_device *dev = pci_get_drvdata(pdev);
+
+   drm_put_dev(dev);
+}
+
 static struct pci_driver mga_pci_driver = {
+   .probe = mga_pci_probe,
+   .remove = mga_pci_remove,
.name = DRIVER_NAME,
.id_table = pciidlist,
 };
diff --git a/drivers/gpu/drm/r128/r128_drv.c b/drivers/gpu/drm/r128/r128_drv.c
index 6a5f439..257f8eb 100644
--- a/drivers/gpu/drm/r128/r128_drv.c
+++ 

[Bug 42716] Boot failure with KMS enabled (radeon)

2012-02-02 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=42716





--- Comment #1 from Michel Dänzer mic...@daenzer.net  2012-02-02 11:59:30 ---
(In reply to comment #0)
 Any idea what's going on here?

Given your mixed testing results, I suspect the bisect result is bogus; you
probably need to at least test each kernel a couple of times before declaring
it as good.


 I don't have the option to attach a serial console, for what that's
 worth, so that aside, any suggestions for further debugging?

You could try netconsole.

-- 
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 43835] System crashes when radeon firmware blob (R520_cp.bin) is installed

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

--- Comment #47 from Michel Dänzer mic...@daenzer.net 2012-02-02 04:04:31 PST 
---
How are the LVDS and DVI displays arranged in the session? Can you attach the
output of xrandr?

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


Re: [PATCH] drm: cleanup device registration

2012-02-02 Thread David Airlie
- Original Message -
 From: Sascha Hauer s.ha...@pengutronix.de
 To: dri-devel@lists.freedesktop.org
 Cc: Inki Dae inki@samsung.com, ker...@pengutronix.de
 Sent: Thursday, 2 February, 2012 11:57:52 AM
 Subject: [PATCH] drm: cleanup device registration
 
 The non modesetting drm drivers currently use a handcrafted pci probe
 function. This requires the drm core to keep a list of registered
 devices
 for each driver. This series adds a probe function for the non
 modesetting
 drivers and removes the legacy probe code. The USB and platform
 drivers
 use the devices_list aswell which is unnecessary. This is also
 cleaned
 up in this series.

No it can't work like this because we have conflicts between fb and drm 
drivers, so the DRM is required to do its own
probe if an fb driver for a device is already loaded.

it can't use the PCI probe out of the box.

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


Re: [PATCH] drm/radeon/kms/blit: fix blit copy for very large buffers

2012-02-02 Thread Ilija Hadzic



On Thu, 2 Feb 2012, Paul Menzel wrote:


+ * I2F_MAX_BITS can be increased, but that will add to loop iterations


should that be t*w*o?



No, it's not two like the number but to like in add to the group or
add to the pile.

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


Re: [PATCH] drm: cleanup device registration

2012-02-02 Thread Sascha Hauer
On Thu, Feb 02, 2012 at 07:05:00AM -0500, David Airlie wrote:
 - Original Message -
  From: Sascha Hauer s.ha...@pengutronix.de
  To: dri-devel@lists.freedesktop.org
  Cc: Inki Dae inki@samsung.com, ker...@pengutronix.de
  Sent: Thursday, 2 February, 2012 11:57:52 AM
  Subject: [PATCH] drm: cleanup device registration
  
  The non modesetting drm drivers currently use a handcrafted pci probe
  function. This requires the drm core to keep a list of registered
  devices
  for each driver. This series adds a probe function for the non
  modesetting
  drivers and removes the legacy probe code. The USB and platform
  drivers
  use the devices_list aswell which is unnecessary. This is also
  cleaned
  up in this series.
 
 No it can't work like this because we have conflicts between fb and drm 
 drivers, so the DRM is required to do its own
 probe if an fb driver for a device is already loaded.
 
 it can't use the PCI probe out of the box.

I see. For example the i810 also has a framebuffer driver. Do you see
a way to fix this except writing a kms driver for all legacy devices?
Otherwise I would leave the pci part untouched and only keep the
platform/USB pieces which I'm admittedly more interested in.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: cleanup device registration

2012-02-02 Thread David Airlie


- Original Message -
 From: Sascha Hauer s.ha...@pengutronix.de
 To: David Airlie airl...@redhat.com
 Cc: Inki Dae inki@samsung.com, ker...@pengutronix.de, 
 dri-devel@lists.freedesktop.org
 Sent: Thursday, 2 February, 2012 12:34:02 PM
 Subject: Re: [PATCH] drm: cleanup device registration
 
 On Thu, Feb 02, 2012 at 07:05:00AM -0500, David Airlie wrote:
  - Original Message -
   From: Sascha Hauer s.ha...@pengutronix.de
   To: dri-devel@lists.freedesktop.org
   Cc: Inki Dae inki@samsung.com, ker...@pengutronix.de
   Sent: Thursday, 2 February, 2012 11:57:52 AM
   Subject: [PATCH] drm: cleanup device registration
   
   The non modesetting drm drivers currently use a handcrafted pci
   probe
   function. This requires the drm core to keep a list of registered
   devices
   for each driver. This series adds a probe function for the non
   modesetting
   drivers and removes the legacy probe code. The USB and platform
   drivers
   use the devices_list aswell which is unnecessary. This is also
   cleaned
   up in this series.
  
  No it can't work like this because we have conflicts between fb and
  drm drivers, so the DRM is required to do its own
  probe if an fb driver for a device is already loaded.
  
  it can't use the PCI probe out of the box.
 
 I see. For example the i810 also has a framebuffer driver. Do you see
 a way to fix this except writing a kms driver for all legacy devices?
 Otherwise I would leave the pci part untouched and only keep the
 platform/USB pieces which I'm admittedly more interested in.
 

Its one of those things that would be a real pain to fix, since we can't remove
drm drivers since their interfaces are ABI. So its why its been left like it is.

It might be possible to split the PCI path up a bit so the non-kms drivers use 
it,
and we port kms ones to a newer interfaces, but I think nouveau is the only PCI 
KMS only
driver we have (maybe vmwgfx as well).

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


Re: [PATCH] drm/radeon/kms/blit: fix blit copy for very large buffers

2012-02-02 Thread Ilija Hadzic



On Thu, 2 Feb 2012, Michel [ISO-8859-1] D�nzer wrote:



+#define I2F_MAX_BITS 15
+#define I2F_MAX_INPUT  ((2  I2F_MAX_BITS) - 1)


Should be ((1  I2F_MAX_BITS) - 1): 2^n == (1  n)



Right. I'll fix it.


Use WARN_ON_ONCE here to avoid spamming the kernel output. If this is
ever hit again, it won't happen just once.




I agree. v2 coming shortly.

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


Re: [PATCH] drm cleanup patches

2012-02-02 Thread Sascha Hauer
Hi David,

On Wed, Feb 01, 2012 at 11:38:18AM +0100, Sascha Hauer wrote:
 The following patches contain some fixes and cleanups for the drm
 core.
 
 - fix memory holes
 - make some initialization / deinitialization more symmetric
 - add convenience functions for creating properties
 - remove DRM_CONNECTOR_MAX_PROPERTY limitation
 
 All patches tested on a GeForce 6200 LE with the nouveau driver and
 a DELL E6220 Laptop using the intel driver.
 
 Please review and consider applying

Is the series otherwise series ok? If yes I would integrate the comments
received so far and repost.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 45503] [drm:radeon_get_bios] *ERROR* Unable to locate a BIOS ROM

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

--- Comment #10 from mlam...@gmail.com 2012-02-02 06:20:36 PST ---
I just found the solution:

diff -ur a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c2012-01-31
22:31:54.0 +0100
+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c2012-02-02
15:03:32.408629788 +0100
@@ -58,9 +58,12 @@
 }

 obj = (union acpi_object *)buffer.pointer;
+printk(obj-buffer.length: %i\n, obj-buffer.length);
+printk(len: %i\n, len);
 memcpy(bios+offset, obj-buffer.pointer, obj-buffer.length);
+len = obj-buffer.length;
 kfree(buffer.pointer);
-return obj-buffer.length;
+return len;
 }

 bool radeon_atrm_supported(struct pci_dev *pdev)

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


[Bug 45503] [drm:radeon_get_bios] *ERROR* Unable to locate a BIOS ROM

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

--- Comment #11 from mlam...@gmail.com 2012-02-02 06:22:03 PST ---
Created attachment 56517
  -- https://bugs.freedesktop.org/attachment.cgi?id=56517
dmesg with my patch

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


[Bug 43835] System crashes when radeon firmware blob (R520_cp.bin) is installed

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

--- Comment #48 from Camaleón noela...@gmail.com 2012-02-02 06:23:13 PST ---
Created attachment 56518
  -- https://bugs.freedesktop.org/attachment.cgi?id=56518
Output of xrandr

In reply to comment #47, I'm attaching the output of xrandr.

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


  1   2   >