[PATCH 0/4] drm/i915: Make video sprites survive a modeset

2012-05-24 Thread Ville Syrjälä
On Thu, May 24, 2012 at 08:49:53PM +0200, Daniel Vetter wrote:
> On Thu, May 24, 2012 at 11:35:35AM -0700, Jesse Barnes wrote:
> > On Thu, 24 May 2012 21:29:46 +0300
> > ville.syrjala at linux.intel.com wrote:
> > 
> > > Currently the video sprites appear to get disabled on modeset more by
> > > accient than by design.
> > > 
> > > With the current API that behaviour makes very little sense to me.
> > > You first enable some plane, and then it can get disabled due to some
> > > unrelated operation.
> > > 
> > > So these patches change the behaviour so that planes survive a modeset.
> > > There's a new hook to make sure they get disabled when swithing
> > > back to fbdev to show a panic oops.
> > 
> > Yeah that's not really a design requirement; the assumption was that
> > the display manager would do the right thing in any case (both mode
> > sets and plane sets are privileged ops).  When doing a mode set, the
> > plane parameters will probably need to be changed anyway...
> > 
> > But keeping it on with some kind of sensible behavior makes the simple
> > cases easier.
> 
> tbh I don't see the use-case. If you issue a modeset from userspace, you
> better start out with something sensible (like a black screeen) and fade
> in nicely whatever you want to show. And if you change the layout, you
> have to reorg everything anyway.

Mainly I just dislike incoherent behaviour.

One use case might be flipping to another framebuffer using the
setcrtc ioctl, in case the page flip ioctl isn't provided, or can't
be used. With the current code the result depends on various
implementation specific details like whether the driver implements
a set_base type of optimization in a certain way. From the user
space POV it's just a setcrtc ioctl, but there's no sensible way
to know whether the operation will destroy some unrelated state
or not.

-- 
Ville Syrj?l?
Intel OTC


[Bug 50230] offset mapping in nexuiz results in bad texturing with the llvm compiler

2012-05-24 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=50230

--- Comment #10 from almos  2012-05-24 13:25:32 PDT ---
(In reply to comment #9)
> Created attachment 62057 [details] [review]
> [PATCH] radeon/llvm: fix sampler index in llvm_emit_tex
> 
> Does this patch help?
Yes, the patch fixes it. I also tried the revert patch, and that fixes the
lightmap flickering.

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


[Bug 50232] screen redraw is wrong in sauerbraten with the llvm compiler

2012-05-24 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=50232

--- Comment #2 from almos  2012-05-24 13:25:38 PDT ---
(In reply to comment #1)
> Please test with the first patch from bug 50230.
The revert patch fixes the ghost image problem. The warning is still printed,
but the visuals seem to be good now.

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


[RFC] [PATCH 00/14] HPD/connector-polling rework

2012-05-24 Thread Daniel Vetter
Hi all,

I've got fed up with our sorry state of connector detection and rampant edid re
and rere-reading.

This patch series lays the groundwork in the drm helpers so that drivers can
avoid all this madness (at least on working hw) and properly cache the edid.

With the additional changes for drm/i915, the edid is now read _once_ per plug
event (or at boot-up/resume time). A further step would be to integrate the
hotplug handling into the driver itself and only call ->detect on the connectors
for which the irq handler received a hotplug event.

By adding POLL_FORCE drivers can get back the old behaviour of calling ->detect
every time probe_single_connector is called from userspace. I've splattered that
over all drivers where I've thought it might be required.

Note though that setting this doesn't avoid all regressions - the regular output
poll work will still ignore any connectors with POLL_HPD set. If a driver/hw
with broken hpd got away due to this, this will break stuff. But that should be
easy to fix by admitting the defeat and setting POLL_CONNECT|DISCONNECT
directly.

If other people want to convert over their drivers, the following steps are
required:
- Ensure that the connector status is unknown every time the driver could have
  missed a hpd event (e.g. after resume). drm_mode_config_reset will do that for
  you.
- Drop the POLL_FORCE flag for connectors where hdp is fully reliable.
- Implement edid caching - that's a nice way to figure out whether hpd is
  actually reliable, because if it isn't, this step will ensure that you get bug
  reports because the the edid won't ever get updated ;-)
- Optionally teach the driver some smarts about which specific connectors
  actually got a hotplug event. Mostly useful on cheap hw (like intel's) that
  can't distinguish between hdmi and dp without trying some aux channel
  transfers.

As you can guess from the patch series, I've discovered the hard way that i915
sdvo support is totally broken. Tested on most of the intel machines I have and
also quickly on my radeon hd5000.

Comments, flames, ideas and test reports highly welcome.

Cheers, Daniel

Daniel Vetter (14):
  drm: extract drm_kms_helper_hotplug_event
  drm: handle HDP and polled connectors separately
  drm: introduce DRM_CONNECTOR_POLL_FORCE
  drm/i915: set POLL_FORCE for sdvo outputs
  drm: properly init/reset connector status
  drm: kill unnecessary calls to connector->detect
  drm: don't start the poll engine in probe_single_connector
  drm: don't unnecessarily enable the polling work
  drm: don't poll forced connectors
  drm/i915: cache crt edid
  drm/i915: cache dp edid
  drm/i915: cache hdmi edid
  drm/i915/sdvo: implement correct return value for ->get_modes
  drm/i915: s/mdelay/msleep/ in the sdvo detect function

 drivers/gpu/drm/drm_crtc.c|6 ++-
 drivers/gpu/drm/drm_crtc_helper.c |   76 ++---
 drivers/gpu/drm/exynos/exynos_drm_connector.c |2 +
 drivers/gpu/drm/gma500/cdv_intel_crt.c|2 +
 drivers/gpu/drm/gma500/cdv_intel_hdmi.c   |2 +
 drivers/gpu/drm/gma500/mdfld_dsi_output.c |1 +
 drivers/gpu/drm/gma500/oaktrail_hdmi.c|2 +
 drivers/gpu/drm/gma500/psb_intel_sdvo.c   |2 +
 drivers/gpu/drm/i915/intel_crt.c  |   28 +++--
 drivers/gpu/drm/i915/intel_dp.c   |   47 +++
 drivers/gpu/drm/i915/intel_drv.h  |2 +
 drivers/gpu/drm/i915/intel_hdmi.c |   48 ++--
 drivers/gpu/drm/i915/intel_modes.c|   18 +-
 drivers/gpu/drm/i915/intel_sdvo.c |   45 +--
 drivers/gpu/drm/i915/intel_tv.c   |3 +-
 drivers/gpu/drm/nouveau/nouveau_connector.c   |1 +
 drivers/gpu/drm/radeon/radeon_connectors.c|5 ++
 drivers/gpu/drm/udl/udl_connector.c   |2 +
 drivers/staging/omapdrm/omap_connector.c  |2 +
 include/drm/drm_crtc.h|5 ++
 include/drm/drm_crtc_helper.h |1 +
 21 files changed, 208 insertions(+), 92 deletions(-)

-- 
1.7.7.6



[PATCH 01/14] drm: extract drm_kms_helper_hotplug_event

2012-05-24 Thread Daniel Vetter
Useful if drivers want to be slightly more clever about hotplug
handling.

Signed-Off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_crtc_helper.c |   17 +++--
 include/drm/drm_crtc_helper.h |1 +
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index 974196a..909a85c 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -918,6 +918,15 @@ int drm_helper_resume_force_mode(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_helper_resume_force_mode);

+void drm_kms_helper_hotplug_event(struct drm_device *dev)
+{
+   /* send a uevent + call fbdev */
+   drm_sysfs_hotplug_event(dev);
+   if (dev->mode_config.funcs->output_poll_changed)
+   dev->mode_config.funcs->output_poll_changed(dev);
+}
+EXPORT_SYMBOL(drm_kms_helper_hotplug_event);
+
 #define DRM_OUTPUT_POLL_PERIOD (10*HZ)
 static void output_poll_execute(struct work_struct *work)
 {
@@ -960,12 +969,8 @@ static void output_poll_execute(struct work_struct *work)

mutex_unlock(>mode_config.mutex);

-   if (changed) {
-   /* send a uevent + call fbdev */
-   drm_sysfs_hotplug_event(dev);
-   if (dev->mode_config.funcs->output_poll_changed)
-   dev->mode_config.funcs->output_poll_changed(dev);
-   }
+   if (changed)
+   drm_kms_helper_hotplug_event(dev);

if (repoll)
queue_delayed_work(system_nrt_wq, delayed_work, 
DRM_OUTPUT_POLL_PERIOD);
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index 3add00e..9a9288d 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -141,6 +141,7 @@ extern int drm_helper_resume_force_mode(struct drm_device 
*dev);
 extern void drm_kms_helper_poll_init(struct drm_device *dev);
 extern void drm_kms_helper_poll_fini(struct drm_device *dev);
 extern void drm_helper_hpd_irq_event(struct drm_device *dev);
+extern void drm_kms_helper_hotplug_event(struct drm_device *dev);

 extern void drm_kms_helper_poll_disable(struct drm_device *dev);
 extern void drm_kms_helper_poll_enable(struct drm_device *dev);
-- 
1.7.7.6



[PATCH 03/14] drm: introduce DRM_CONNECTOR_POLL_FORCE

2012-05-24 Thread Daniel Vetter
Useful for ->detect functions that have different behaviour if force
is set. This way probe_single_connector can avoid to do the expensive
edid dance on connectors where this is not needed.

I've checked through all drivers and set this flag everywhere where
the connector->detect function has different behaviour if force is
set. For nouveau and radeon I've got lost in the code traces, so I've
set this flag unconditionally.

Note that we also need to update the poll_execute function to now
also ignore connectors which have only this new flag set.

v2: Change POLL_HDP checks so that they ignore POLL_FORCE for both the
poll and the hpd handling code.

v3: Sprinkle POLL_FORCE more liberally over drivers. It should be now
everywhere where a non-intel driver can return anything else than
connector_status_connected in its detect callback.

Signed-Off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_crtc_helper.c |6 --
 drivers/gpu/drm/exynos/exynos_drm_connector.c |2 ++
 drivers/gpu/drm/gma500/cdv_intel_crt.c|2 ++
 drivers/gpu/drm/gma500/cdv_intel_hdmi.c   |2 ++
 drivers/gpu/drm/gma500/mdfld_dsi_output.c |1 +
 drivers/gpu/drm/gma500/oaktrail_hdmi.c|2 ++
 drivers/gpu/drm/gma500/psb_intel_sdvo.c   |2 ++
 drivers/gpu/drm/i915/intel_crt.c  |3 ++-
 drivers/gpu/drm/i915/intel_tv.c   |3 ++-
 drivers/gpu/drm/nouveau/nouveau_connector.c   |1 +
 drivers/gpu/drm/radeon/radeon_connectors.c|5 +
 drivers/gpu/drm/udl/udl_connector.c   |2 ++
 drivers/staging/omapdrm/omap_connector.c  |2 ++
 include/drm/drm_crtc.h|4 
 14 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index b1d643d..8ea1c1e 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -944,7 +944,9 @@ static void output_poll_execute(struct work_struct *work)

/* Ignore HDP capable connectors and connectors where we don't
 * want any hotplug detection at all for polling. */
-   if (!connector->polled || connector->polled == 
DRM_CONNECTOR_POLL_HPD)
+   if (!connector->polled ||
+   connector->polled == DRM_CONNECTOR_POLL_FORCE ||
+   (connector->polled & DRM_CONNECTOR_POLL_HPD))
continue;

else if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT | 
DRM_CONNECTOR_POLL_DISCONNECT))
@@ -1029,7 +1031,7 @@ void drm_helper_hpd_irq_event(struct drm_device *dev)
list_for_each_entry(connector, >mode_config.connector_list, head) {

/* Only handle HPD capable connectors. */
-   if (connector->polled != DRM_CONNECTOR_POLL_HPD)
+   if (!(connector->polled & DRM_CONNECTOR_POLL_HPD))
continue;

old_status = connector->status;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c 
b/drivers/gpu/drm/exynos/exynos_drm_connector.c
index bf791fa..e5a8a27 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_connector.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c
@@ -327,6 +327,8 @@ struct drm_connector *exynos_drm_connector_create(struct 
drm_device *dev,
drm_connector_init(dev, connector, _connector_funcs, type);
drm_connector_helper_add(connector, _connector_helper_funcs);

+   connector->polled |= DRM_CONNECTOR_POLL_FORCE;
+
err = drm_sysfs_connector_add(connector);
if (err)
goto err_connector;
diff --git a/drivers/gpu/drm/gma500/cdv_intel_crt.c 
b/drivers/gpu/drm/gma500/cdv_intel_crt.c
index 1874220..e6b2e49 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_crt.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_crt.c
@@ -313,6 +313,8 @@ void cdv_intel_crt_init(struct drm_device *dev,
drm_connector_helper_add(connector,
_intel_crt_connector_helper_funcs);

+   connector->polled |= DRM_CONNECTOR_POLL_FORCE;
+
drm_sysfs_connector_add(connector);

return;
diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c 
b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
index 88b59d4..766aec8 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
@@ -373,6 +373,8 @@ void cdv_hdmi_init(struct drm_device *dev,
hdmi_priv->hdmi_i2c_adapter =
&(psb_intel_encoder->i2c_bus->adapter);
hdmi_priv->dev = dev;
+   connector->polled |= DRM_CONNECTOR_POLL_FORCE;
+
drm_sysfs_connector_add(connector);
return;

diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.c 
b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
index 5675d93..0e97a91 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_output.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
@@ -604,6 +604,7 @@ void mdfld_dsi_output_init(struct drm_device *dev,

[PATCH 05/14] drm: properly init/reset connector status

2012-05-24 Thread Daniel Vetter
We need this because otherwise the improved connector code has no idea
when it needs to run the ->detect callback after boot/resume on all
connectors.

Because drm/i915 is the only driver that properly calls
mode_config_reset at resume time, this will horribly blow up
everywhere else.

Signed-Off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_crtc.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index a177d0a..82eaff0 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -495,6 +495,7 @@ int drm_connector_init(struct drm_device *dev,
INIT_LIST_HEAD(>probed_modes);
INIT_LIST_HEAD(>modes);
connector->edid_blob_ptr = NULL;
+   connector->status = connector_status_unknown;

list_add_tail(>head, >mode_config.connector_list);
dev->mode_config.num_connector++;
@@ -3521,9 +3522,12 @@ void drm_mode_config_reset(struct drm_device *dev)
if (encoder->funcs->reset)
encoder->funcs->reset(encoder);

-   list_for_each_entry(connector, >mode_config.connector_list, head)
+   list_for_each_entry(connector, >mode_config.connector_list, head) {
+   connector->status = connector_status_unknown;
+
if (connector->funcs->reset)
connector->funcs->reset(connector);
+   }
 }
 EXPORT_SYMBOL(drm_mode_config_reset);

-- 
1.7.7.6



[PATCH 06/14] drm: kill unnecessary calls to connector->detect

2012-05-24 Thread Daniel Vetter
Only call that function if something has actually changed (i.e. in the
output polling or hdp handling functions) or when userspace asks for
the information and DRM_CONNECTOR_POLL_FORCE is set.

Let's see how many bugs this uncovers.

v2: Run ->detect if the current connector status is 'unknown' -
otherwise we won't ever detect the boot-up/resume state correctly.

Signed-Off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_crtc_helper.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index 8ea1c1e..db93e4d 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -107,7 +107,8 @@ int drm_helper_probe_single_connector_modes(struct 
drm_connector *connector,
connector->status = connector_status_disconnected;
if (connector->funcs->force)
connector->funcs->force(connector);
-   } else {
+   } else if (connector->polled & DRM_CONNECTOR_POLL_FORCE ||
+  connector->status == connector_status_unknown) {
connector->status = connector->funcs->detect(connector, true);
drm_kms_helper_poll_enable(dev);
}
-- 
1.7.7.6



[PATCH 07/14] drm: don't start the poll engine in probe_single_connector

2012-05-24 Thread Daniel Vetter
Actually there's a reason this stuff is there, and it's called

commit e58f637bb96d5a0ae0919b9998b891d1ba7e47c9
Author: Chris Wilson 
Date:   Fri Aug 20 09:13:36 2010 +0100

drm/kms: Add a module parameter to disable polling

The idea has been that users can enable/disable polling at runtime. So
the quick hack has been to just re-enable the output polling if xrandr
asks for the latest state of the connectors.

The problem with that hack is that when we force connectors to another
state than what would be detected, we nicely ping-pong:
- Userspace calls probe, gets the forced state, but polling starts
  again.
- Polling notices that the state is actually different, wakes up
  userspace.
- Repeat.

As that commit already explains, the right fix would be to make the
locking more fine-grained, so that hotplug detection on one output
does not interfere with cursor updates on another crtc.

But that is way too much work. So let's just safe this gross hack by
caching the last-seen state of drm_kms_helper_poll for that driver,
and only fire up the poll engine again if it changed from off to on.

v2: Fixup the edge detection of drm_kms_helper_poll.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49907
Tested-by: Tvrtko Ursulin 
Signed-Off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_crtc_helper.c |7 ++-
 include/drm/drm_crtc.h|1 +
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index db93e4d..f17953e 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -110,9 +110,14 @@ int drm_helper_probe_single_connector_modes(struct 
drm_connector *connector,
} else if (connector->polled & DRM_CONNECTOR_POLL_FORCE ||
   connector->status == connector_status_unknown) {
connector->status = connector->funcs->detect(connector, true);
-   drm_kms_helper_poll_enable(dev);
}

+   /* Re-enable polling in case the global poll config changed. */
+   if (drm_kms_helper_poll != dev->mode_config.poll_running)
+   drm_kms_helper_poll_enable(dev);
+
+   dev->mode_config.poll_running = drm_kms_helper_poll;
+
if (connector->status == connector_status_disconnected) {
DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n",
connector->base.id, drm_get_connector_name(connector));
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 4417da2..fb21121 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -783,6 +783,7 @@ struct drm_mode_config {

/* output poll support */
bool poll_enabled;
+   bool poll_running;
struct delayed_work output_poll_work;

/* pointers to standard properties */
-- 
1.7.7.6



[PATCH 08/14] drm: don't unnecessarily enable the polling work

2012-05-24 Thread Daniel Vetter
... by properly checking connector->polled. This doesn't matter too
much because the polling work itself gets this slightly more right and
doesn't set repoll if there's nothing to do. But we can do better.

Signed-Off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_crtc_helper.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index f17953e..87a45de 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -955,9 +955,6 @@ static void output_poll_execute(struct work_struct *work)
(connector->polled & DRM_CONNECTOR_POLL_HPD))
continue;

-   else if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT | 
DRM_CONNECTOR_POLL_DISCONNECT))
-   repoll = true;
-
old_status = connector->status;
/* if we are connected and don't want to poll for disconnect
   skip it */
@@ -1000,7 +997,8 @@ void drm_kms_helper_poll_enable(struct drm_device *dev)
return;

list_for_each_entry(connector, >mode_config.connector_list, head) {
-   if (connector->polled)
+   if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT |
+DRM_CONNECTOR_POLL_DISCONNECT))
poll = true;
}

-- 
1.7.7.6



[PATCH 09/14] drm: don't poll forced connectors

2012-05-24 Thread Daniel Vetter
Otherwise if the detect callback reports a different state than what
the user forced (rather likely), we continously annoy userspace about
a hotplug uevent.

Signed-Off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_crtc_helper.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index 87a45de..9214612 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -948,6 +948,10 @@ static void output_poll_execute(struct work_struct *work)
mutex_lock(>mode_config.mutex);
list_for_each_entry(connector, >mode_config.connector_list, head) {

+   /* Ignore forced connectors. */
+   if (connector->force)
+   continue;
+
/* Ignore HDP capable connectors and connectors where we don't
 * want any hotplug detection at all for polling. */
if (!connector->polled ||
-- 
1.7.7.6



[PATCH 10/14] drm/i915: cache crt edid

2012-05-24 Thread Daniel Vetter
Let's put all this new output detection infrastructure and rework
to some good use and cache the crt edid. Given that the drm helpers
now only call ->detect when actually required, we only need to reset
the edid there and can keep it otherwise.

Slashes xrandr time on systems that are hotplug capable if there's
something connected to the VGA connector.

v2: Remember to clean up the cached edid on destroy.

Signed-Off-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/intel_crt.c   |   25 -
 drivers/gpu/drm/i915/intel_drv.h   |1 +
 drivers/gpu/drm/i915/intel_modes.c |   18 ++
 3 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index a60d131..46a0716 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -47,6 +47,7 @@
 struct intel_crt {
struct intel_encoder base;
bool force_hotplug_required;
+   struct edid *cached_edid;
 };

 static struct intel_crt *intel_attached_crt(struct drm_connector *connector)
@@ -310,7 +311,7 @@ static bool intel_crt_detect_ddc(struct drm_connector 
*connector)
if (edid != NULL) {
is_digital = edid->input & DRM_EDID_INPUT_DIGITAL;
connector->display_info.raw_edid = NULL;
-   kfree(edid);
+   crt->cached_edid = edid;
}

if (!is_digital) {
@@ -452,6 +453,10 @@ intel_crt_detect(struct drm_connector *connector, bool 
force)
enum drm_connector_status status;
struct intel_load_detect_pipe tmp;

+   /* Clean the edid cache. */
+   kfree(crt->cached_edid);
+   crt->cached_edid = NULL;
+
if (I915_HAS_HOTPLUG(dev)) {
if (intel_crt_detect_hotplug(connector)) {
DRM_DEBUG_KMS("CRT detected via hotplug\n");
@@ -485,8 +490,11 @@ intel_crt_detect(struct drm_connector *connector, bool 
force)

 static void intel_crt_destroy(struct drm_connector *connector)
 {
+   struct intel_crt *crt = intel_attached_crt(connector);
+
drm_sysfs_connector_remove(connector);
drm_connector_cleanup(connector);
+   kfree(crt->cached_edid);
kfree(connector);
 }

@@ -494,17 +502,24 @@ static int intel_crt_get_modes(struct drm_connector 
*connector)
 {
struct drm_device *dev = connector->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
-   int ret;
+   struct intel_crt *crt = intel_attached_crt(connector);
+   int ret = 0;
struct i2c_adapter *i2c;

-   i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin);
-   ret = intel_ddc_get_modes(connector, i2c);
+   if (!crt->cached_edid) {
+   i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin);
+   crt->cached_edid = drm_get_edid(connector, i2c);
+   }
+
+   ret = intel_edid_get_modes(connector, crt->cached_edid);
if (ret || !IS_G4X(dev))
return ret;

/* Try to probe digital port for output in DVI-I -> VGA mode. */
i2c = intel_gmbus_get_adapter(dev_priv, GMBUS_PORT_DPB);
-   return intel_ddc_get_modes(connector, i2c);
+   kfree(crt->cached_edid);
+   crt->cached_edid = drm_get_edid(connector, i2c);
+   return intel_edid_get_modes(connector, crt->cached_edid);
 }

 static int intel_crt_set_property(struct drm_connector *connector,
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 3e09188..3b6f716 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -335,6 +335,7 @@ struct intel_fbc_work {
 };

 int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter);
+int intel_edid_get_modes(struct drm_connector *connector, struct edid *edid);
 extern bool intel_ddc_probe(struct intel_encoder *intel_encoder, int ddc_bus);

 extern void intel_attach_force_audio_property(struct drm_connector *connector);
diff --git a/drivers/gpu/drm/i915/intel_modes.c 
b/drivers/gpu/drm/i915/intel_modes.c
index d67ec3a..6c723d9 100644
--- a/drivers/gpu/drm/i915/intel_modes.c
+++ b/drivers/gpu/drm/i915/intel_modes.c
@@ -60,6 +60,19 @@ bool intel_ddc_probe(struct intel_encoder *intel_encoder, 
int ddc_bus)
msgs, 2) == 2;
 }

+int intel_edid_get_modes(struct drm_connector *connector,
+struct edid *edid)
+{
+   int ret;
+
+   drm_mode_connector_update_edid_property(connector, edid);
+   ret = drm_add_edid_modes(connector, edid);
+   drm_edid_to_eld(connector, edid);
+   connector->display_info.raw_edid = NULL;
+
+   return ret;
+}
+
 /**
  * intel_ddc_get_modes - get modelist from monitor
  * @connector: DRM connector device to use
@@ -75,10 +88,7 @@ int intel_ddc_get_modes(struct drm_connector *connector,

edid = drm_get_edid(connector, adapter);
if (edid) {
-   

[PATCH 11/14] drm/i915: cache dp edid

2012-05-24 Thread Daniel Vetter
Again, let's be slightly more clever here.

Signed-Off-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/intel_dp.c |   47 ++
 1 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 3bbd754..1c84a97 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -67,6 +67,7 @@ struct intel_dp {
struct drm_display_mode *panel_fixed_mode;  /* for eDP */
struct delayed_work panel_vdd_work;
bool want_panel_vdd;
+   struct edid *cached_edid;
 };

 /**
@@ -2089,30 +2090,19 @@ g4x_dp_detect(struct intel_dp *intel_dp)
 }

 static struct edid *
-intel_dp_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
+intel_dp_get_edid(struct drm_connector *connector)
 {
struct intel_dp *intel_dp = intel_attached_dp(connector);
-   struct edid *edid;
-
-   ironlake_edp_panel_vdd_on(intel_dp);
-   edid = drm_get_edid(connector, adapter);
-   ironlake_edp_panel_vdd_off(intel_dp, false);
-   return edid;
-}

-static int
-intel_dp_get_edid_modes(struct drm_connector *connector, struct i2c_adapter 
*adapter)
-{
-   struct intel_dp *intel_dp = intel_attached_dp(connector);
-   int ret;
+   if (!intel_dp->cached_edid) {
+   ironlake_edp_panel_vdd_on(intel_dp);
+   intel_dp->cached_edid = drm_get_edid(connector, 
_dp->adapter);
+   ironlake_edp_panel_vdd_off(intel_dp, false);
+   }

-   ironlake_edp_panel_vdd_on(intel_dp);
-   ret = intel_ddc_get_modes(connector, adapter);
-   ironlake_edp_panel_vdd_off(intel_dp, false);
-   return ret;
+   return intel_dp->cached_edid;
 }

-
 /**
  * Uses CRT_HOTPLUG_EN and CRT_HOTPLUG_STAT to detect DP connection.
  *
@@ -2127,6 +2117,10 @@ intel_dp_detect(struct drm_connector *connector, bool 
force)
enum drm_connector_status status;
struct edid *edid = NULL;

+   /* Clean the edid cache. */
+   kfree(intel_dp->cached_edid);
+   intel_dp->cached_edid = NULL;
+
intel_dp->has_audio = false;

if (HAS_PCH_SPLIT(dev))
@@ -2145,11 +2139,10 @@ intel_dp_detect(struct drm_connector *connector, bool 
force)
if (intel_dp->force_audio != HDMI_AUDIO_AUTO) {
intel_dp->has_audio = (intel_dp->force_audio == HDMI_AUDIO_ON);
} else {
-   edid = intel_dp_get_edid(connector, _dp->adapter);
+   edid = intel_dp_get_edid(connector);
if (edid) {
intel_dp->has_audio = drm_detect_monitor_audio(edid);
connector->display_info.raw_edid = NULL;
-   kfree(edid);
}
}

@@ -2161,12 +2154,16 @@ static int intel_dp_get_modes(struct drm_connector 
*connector)
struct intel_dp *intel_dp = intel_attached_dp(connector);
struct drm_device *dev = intel_dp->base.base.dev;
struct drm_i915_private *dev_priv = dev->dev_private;
-   int ret;
+   struct edid *edid;
+   int ret = 0;

/* We should parse the EDID data and find out if it has an audio sink
 */

-   ret = intel_dp_get_edid_modes(connector, _dp->adapter);
+   edid = intel_dp_get_edid(connector);
+   if (edid)
+   ret = intel_edid_get_modes(connector, edid);
+
if (ret) {
if (is_edp(intel_dp) && !intel_dp->panel_fixed_mode) {
struct drm_display_mode *newmode;
@@ -2206,16 +2203,14 @@ static int intel_dp_get_modes(struct drm_connector 
*connector)
 static bool
 intel_dp_detect_audio(struct drm_connector *connector)
 {
-   struct intel_dp *intel_dp = intel_attached_dp(connector);
struct edid *edid;
bool has_audio = false;

-   edid = intel_dp_get_edid(connector, _dp->adapter);
+   edid = intel_dp_get_edid(connector);
if (edid) {
has_audio = drm_detect_monitor_audio(edid);

connector->display_info.raw_edid = NULL;
-   kfree(edid);
}

return has_audio;
@@ -2279,6 +2274,7 @@ done:
 static void
 intel_dp_destroy(struct drm_connector *connector)
 {
+   struct intel_dp *intel_dp = intel_attached_dp(connector);
struct drm_device *dev = connector->dev;

if (intel_dpd_is_edp(dev))
@@ -2286,6 +2282,7 @@ intel_dp_destroy(struct drm_connector *connector)

drm_sysfs_connector_remove(connector);
drm_connector_cleanup(connector);
+   kfree(intel_dp->cached_edid);
kfree(connector);
 }

-- 
1.7.7.6



[PATCH 12/14] drm/i915: cache hdmi edid

2012-05-24 Thread Daniel Vetter
Like the previous patches.

While at it also kill a stale comment - we've moved hdmi audio
detection from ->get_modes to ->detect and the audio property handling
functions.

Signed-Off-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/intel_drv.h  |1 +
 drivers/gpu/drm/i915/intel_hdmi.c |   48 +++--
 2 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 3b6f716..8693551 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -301,6 +301,7 @@ struct intel_hdmi {
enum hdmi_force_audio force_audio;
void (*write_infoframe)(struct drm_encoder *encoder,
struct dip_infoframe *frame);
+   struct edid *cached_edid;
 };

 static inline struct drm_crtc *
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c 
b/drivers/gpu/drm/i915/intel_hdmi.c
index 2ead3bf..373d252 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -452,19 +452,37 @@ static bool intel_hdmi_mode_fixup(struct drm_encoder 
*encoder,
return true;
 }

+struct edid *
+intel_hdmi_get_edid(struct drm_connector *connector)
+{
+   struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+   struct drm_i915_private *dev_priv = connector->dev->dev_private;
+
+   if (!intel_hdmi->cached_edid) {
+   struct i2c_adapter *adapter;
+
+   adapter = intel_gmbus_get_adapter(dev_priv,
+ intel_hdmi->ddc_bus);
+   intel_hdmi->cached_edid = drm_get_edid(connector, adapter);
+   }
+
+   return intel_hdmi->cached_edid;
+}
+
 static enum drm_connector_status
 intel_hdmi_detect(struct drm_connector *connector, bool force)
 {
struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
-   struct drm_i915_private *dev_priv = connector->dev->dev_private;
struct edid *edid;
enum drm_connector_status status = connector_status_disconnected;

+   /* Clean the edid cache. */
+   kfree(intel_hdmi->cached_edid);
+   intel_hdmi->cached_edid = NULL;
+
intel_hdmi->has_hdmi_sink = false;
intel_hdmi->has_audio = false;
-   edid = drm_get_edid(connector,
-   intel_gmbus_get_adapter(dev_priv,
-   intel_hdmi->ddc_bus));
+   edid = intel_hdmi_get_edid(connector);

if (edid) {
if (edid->input & DRM_EDID_INPUT_DIGITAL) {
@@ -477,6 +495,7 @@ intel_hdmi_detect(struct drm_connector *connector, bool 
force)
connector->display_info.raw_edid = NULL;
kfree(edid);
}
+   intel_hdmi->cached_edid = edid;

if (status == connector_status_connected) {
if (intel_hdmi->force_audio != HDMI_AUDIO_AUTO)
@@ -489,29 +508,19 @@ intel_hdmi_detect(struct drm_connector *connector, bool 
force)

 static int intel_hdmi_get_modes(struct drm_connector *connector)
 {
-   struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
-   struct drm_i915_private *dev_priv = connector->dev->dev_private;
-
-   /* We should parse the EDID data and find out if it's an HDMI sink so
-* we can send audio to it.
-*/
+   struct edid *edid;

-   return intel_ddc_get_modes(connector,
-  intel_gmbus_get_adapter(dev_priv,
-  
intel_hdmi->ddc_bus));
+   edid = intel_hdmi_get_edid(connector);
+   return intel_edid_get_modes(connector, edid);
 }

 static bool
 intel_hdmi_detect_audio(struct drm_connector *connector)
 {
-   struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
-   struct drm_i915_private *dev_priv = connector->dev->dev_private;
struct edid *edid;
bool has_audio = false;

-   edid = drm_get_edid(connector,
-   intel_gmbus_get_adapter(dev_priv,
-   intel_hdmi->ddc_bus));
+   edid = intel_hdmi_get_edid(connector);
if (edid) {
if (edid->input & DRM_EDID_INPUT_DIGITAL)
has_audio = drm_detect_monitor_audio(edid);
@@ -580,8 +589,11 @@ done:

 static void intel_hdmi_destroy(struct drm_connector *connector)
 {
+   struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+
drm_sysfs_connector_remove(connector);
drm_connector_cleanup(connector);
+   kfree(intel_hdmi->cached_edid);
kfree(connector);
 }

-- 
1.7.7.6



[PATCH 13/14] drm/i915/sdvo: implement correct return value for ->get_modes

2012-05-24 Thread Daniel Vetter
We should return the number of added modes. Luckily no one really
cares, but it kinda sticked out compared to the other ->get_modes
functions I've looked at recently.

Signed-Off-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/intel_sdvo.c |   41 ++--
 1 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_sdvo.c 
b/drivers/gpu/drm/i915/intel_sdvo.c
index fdc0574..6056603 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1428,8 +1428,9 @@ intel_sdvo_detect(struct drm_connector *connector, bool 
force)
return ret;
 }

-static void intel_sdvo_get_ddc_modes(struct drm_connector *connector)
+static int intel_sdvo_get_ddc_modes(struct drm_connector *connector)
 {
+   int ret = 0;
struct edid *edid;

/* set the bus switch and get the modes */
@@ -1448,12 +1449,14 @@ static void intel_sdvo_get_ddc_modes(struct 
drm_connector *connector)
if 
(intel_sdvo_connector_matches_edid(to_intel_sdvo_connector(connector),
  edid)) {
drm_mode_connector_update_edid_property(connector, 
edid);
-   drm_add_edid_modes(connector, edid);
+   ret = drm_add_edid_modes(connector, edid);
}

connector->display_info.raw_edid = NULL;
kfree(edid);
}
+
+   return ret;
 }

 /*
@@ -1521,12 +1524,12 @@ static const struct drm_display_mode sdvo_tv_modes[] = {
   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
 };

-static void intel_sdvo_get_tv_modes(struct drm_connector *connector)
+static int intel_sdvo_get_tv_modes(struct drm_connector *connector)
 {
struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector);
struct intel_sdvo_sdtv_resolution_request tv_res;
uint32_t reply = 0, format_map = 0;
-   int i;
+   int i, ret = 0;

/* Read the list of supported input resolutions for the selected TV
 * format.
@@ -1536,39 +1539,44 @@ static void intel_sdvo_get_tv_modes(struct 
drm_connector *connector)
   min(sizeof(format_map), sizeof(struct 
intel_sdvo_sdtv_resolution_request)));

if (!intel_sdvo_set_target_output(intel_sdvo, 
intel_sdvo->attached_output))
-   return;
+   return 0;

BUILD_BUG_ON(sizeof(tv_res) != 3);
if (!intel_sdvo_write_cmd(intel_sdvo,
  SDVO_CMD_GET_SDTV_RESOLUTION_SUPPORT,
  _res, sizeof(tv_res)))
-   return;
+   return 0;
if (!intel_sdvo_read_response(intel_sdvo, , 3))
-   return;
+   return 0;

for (i = 0; i < ARRAY_SIZE(sdvo_tv_modes); i++)
if (reply & (1 << i)) {
struct drm_display_mode *nmode;
nmode = drm_mode_duplicate(connector->dev,
   _tv_modes[i]);
-   if (nmode)
+   if (nmode) {
drm_mode_probed_add(connector, nmode);
+   ret++;
+   }
}
+
+   return ret;
 }

-static void intel_sdvo_get_lvds_modes(struct drm_connector *connector)
+static int intel_sdvo_get_lvds_modes(struct drm_connector *connector)
 {
struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector);
struct drm_i915_private *dev_priv = connector->dev->dev_private;
struct drm_display_mode *newmode;
+   int ret;

/*
 * Attempt to get the mode list from DDC.
 * Assume that the preferred modes are
 * arranged in priority order.
 */
-   intel_ddc_get_modes(connector, intel_sdvo->i2c);
-   if (list_empty(>probed_modes) == false)
+   ret = intel_ddc_get_modes(connector, intel_sdvo->i2c);
+   if (ret)
goto end;

/* Fetch modes from VBT */
@@ -1580,6 +1588,8 @@ static void intel_sdvo_get_lvds_modes(struct 
drm_connector *connector)
newmode->type = (DRM_MODE_TYPE_PREFERRED |
 DRM_MODE_TYPE_DRIVER);
drm_mode_probed_add(connector, newmode);
+
+   ret++;
}
}

@@ -1594,6 +1604,7 @@ end:
}
}

+   return ret;
 }

 static int intel_sdvo_get_modes(struct drm_connector *connector)
@@ -1601,13 +1612,11 @@ static int intel_sdvo_get_modes(struct drm_connector 
*connector)
struct intel_sdvo_connector *intel_sdvo_connector = 
to_intel_sdvo_connector(connector);

if (IS_TV(intel_sdvo_connector))
-   intel_sdvo_get_tv_modes(connector);
+   return intel_sdvo_get_tv_modes(connector);
else if (IS_LVDS(intel_sdvo_connector))
-   

[PATCH 14/14] drm/i915: s/mdelay/msleep/ in the sdvo detect function

2012-05-24 Thread Daniel Vetter
A 30 ms delay is simply way too big to waste cpu cycles on.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/intel_sdvo.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_sdvo.c 
b/drivers/gpu/drm/i915/intel_sdvo.c
index 6056603..efa0d17 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1370,7 +1370,7 @@ intel_sdvo_detect(struct drm_connector *connector, bool 
force)

/* add 30ms delay when the output type might be TV */
if (intel_sdvo->caps.output_flags & SDVO_TV_MASK)
-   mdelay(30);
+   msleep(30);

if (!intel_sdvo_read_response(intel_sdvo, , 2))
return connector_status_unknown;
-- 
1.7.7.6



[Bug 50325] New: Glyphy bad render on r600g (software render is fine)

2012-05-24 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=50325

 Bug #: 50325
   Summary: Glyphy bad render on r600g (software render is fine)
Classification: Unclassified
   Product: Mesa
   Version: 8.0
  Platform: x86-64 (AMD64)
OS/Version: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/Gallium/r600
AssignedTo: dri-devel at lists.freedesktop.org
ReportedBy: edwin+mesa at etorok.net


Created attachment 62078
  --> https://bugs.freedesktop.org/attachment.cgi?id=62078
apitrace (cf. https://github.com/apitrace/apitrace/tree/1.0)

I just tried Glyphy on r600g and the output is very bad.
Don't know if its Glyphy bug or Mesa bug, but if I force software rendering in
Mesa then I do see the output.

Attached screenshots of bad (r600g) and good (software render).

The bad render was obtained by:
demo/glyphy-demo

The good one:
LIBGL_ALWAYS_SOFTWARE=1 demo/glyphy-demo

I tested on:
OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD RV730
OpenGL version string: 2.1 Mesa 8.0.2
OpenGL shading language version string: 1.20

I'll try to test on mesa git later to see if its still an issue there.

Also attached is a an apitrace, and the bad render can be reproduced with:
build/glretrace lt-glyphy-demo.trace

The good render (initialization a bit slow, but works):
LIBGL_ALWAYS_SOFTWARE=1 build/glretrace lt-glyphy-demo.trace

The source code for Glyphy can be found here:
https://code.google.com/p/glyphy/source/checkout

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


[Bug 50325] Glyphy bad render on r600g (software render is fine)

2012-05-24 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=50325

--- Comment #1 from T?r?k Edwin  2012-05-24 14:57:08 
PDT ---
Created attachment 62079
  --> https://bugs.freedesktop.org/attachment.cgi?id=62079
r600g-bad.png

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


[Bug 50325] Glyphy bad render on r600g (software render is fine)

2012-05-24 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=50325

--- Comment #2 from T?r?k Edwin  2012-05-24 14:57:24 
PDT ---
Created attachment 62080
  --> https://bugs.freedesktop.org/attachment.cgi?id=62080
sw-good.png

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


drm/i915 3.5 merge window: gen6_sanitize_pm errors

2012-05-24 Thread Linus Torvalds
These guys seem to be recently introduced:

  [drm:gen6_sanitize_pm] *ERROR* Power management discrepancy:
GEN6_RP_INTERRUPT_LIMITS expected 1700, was 1206
  [drm:gen6_sanitize_pm] *ERROR* Power management discrepancy:
GEN6_RP_INTERRUPT_LIMITS expected 1707, was 1700

This is on my SNB Macbook Air.

Everything seems to *work*, which makes me think:

 - that error isn't really so big a deal that you have to *SHOUT* about it.

 - I wonder how valid the discrepancy checking code is to begin with.

Hmm?

  Linus


[PATCH] drm/radeon: fix typo in trinity tiling setup

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

Using the wrong union.

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

diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index b01c2dd..ce4e7cc 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -865,7 +865,7 @@ static void cayman_gpu_init(struct radeon_device *rdev)

/* num banks is 8 on all fusion asics. 0 = 4, 1 = 8, 2 = 16 */
if (rdev->flags & RADEON_IS_IGP)
-   rdev->config.evergreen.tile_config |= 1 << 4;
+   rdev->config.cayman.tile_config |= 1 << 4;
else
rdev->config.cayman.tile_config |=
((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT) << 
4;
-- 
1.7.7.5



[PATCH] omap2+: add drm device

2012-05-24 Thread Clark, Rob
On Thu, May 24, 2012 at 12:01 AM, Tomi Valkeinen  
wrote:
> Hi,
>
> On Wed, 2012-05-23 at 15:08 -0500, Andy Gross wrote:
>> Register OMAP DRM/KMS platform device. ?DMM is split into a
>> separate device using hwmod.
>>
>> Signed-off-by: Andy Gross 
>
> 
>
>> +static int __init omap_init_drm(void)
>> +{
>> + ? ? struct omap_hwmod *oh = NULL;
>> + ? ? struct platform_device *pdev;
>> +
>> + ? ? /* lookup and populate the DMM information, if present - OMAP4+ */
>> + ? ? oh = omap_hwmod_lookup("dmm");
>> +
>> + ? ? if (oh) {
>> + ? ? ? ? ? ? pdev = omap_device_build(oh->name, -1, oh, NULL, 0, NULL, 0,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? false);
>> + ? ? ? ? ? ? WARN(IS_ERR(pdev), "Could not build omap_device for %s\n",
>> + ? ? ? ? ? ? ? ? ? ? oh->name);
>> + ? ? }
>> +
>> + ? ? return platform_device_register(_drm_device);
>> +
>> +}
>
> I still don't like fixing the tiler to drm. I would like to have basic
> tiler support in omapfb also, but with this approach I'll need to
> duplicate the code. And even if we disregard omapfb, wouldn't it be
> architecturally better to have the tiler as a separate independent
> library/driver?

Not easily, at least not if we want to manage to use tiler/dmm in a
more dynamic way, or to enable some additional features which are
still on the roadmap (like reprogramming dmm synchronized w/ scanout,
or some things which are coming if future hw generations).  We need
one place to keep track of which buffers are potentially evictable to
make room for mapping a new buffer.  And if you look at the tricks
that go on with mmap'ing tiled buffers to userspace, you *really*
don't want to duplicate that in N different drivers.

Fortunately with dmabuf there is not really a need for N different
drivers to need to use tiler/dmm directly.  The dmabuf mechanism
provides what they need to import GEM buffers from omapdrm.  That may
not really help omapfb because fbdev doesn't have a concept of
importing buffers.  But OTOH this is unnecessary, because drm provides
an fbdev interface for legacy apps.  The best thing I'd recommend is,
if you miss some features of omapfb in the drm fbdev implementation,
is to send some patches to add this missing features.

>> +struct omap_drm_platform_data {
>> + ? ? struct omap_kms_platform_data *kms_pdata;
>> +};
>
> This one is missing struct omap_dmm_platform_data *dmm_pdata, so you
> didn't just move the struct. Is that on purpose?

the dmm pdata is no longer needed because we get what we need from
hwmod via platform_get_resource()

BR,
-R

> ?Tomi
>


Oops with Radeon/Uninorth on Maple

2012-05-24 Thread Dmitry Eremin-Solenikov
Hello, colleagues,

I'm trying to enable an AGP slot (again) on my Maple board (dual 
PPC970FX board, with CPC925 (U3H) north bridge).

  For now I'm stuck with a problem: I use radeon card, drm-radeon driver 
with KMS.

If I force drm-radeon to think about a card as about PCI card (by 
commenting corresponding lines in drm_radeon_kms.c), everything works, I 
get framebuffer, working X11, etc. If I enable agpgart-uninorth driver
and RADEON_IS_AGP flag in drm driver, I get an Oops early during the 
bootstrap. Relevant part of the log (I can send full dmesg of normal 
bootstrap or this oops on request, if that would help).

[2.820647] Linux agpgart interface v0.103
[2.824909] agpgart-uninorth :f0:0b.0: Apple U3H chipset
[2.830668] agpgart-uninorth :f0:0b.0: Found device u3, rev 35
[2.843611] agpgart-uninorth :f0:0b.0: configuring for size idx: 64
[2.850638] agpgart-uninorth :f0:0b.0: AGP aperture is 256M @ 0x0
[2.857646] [drm] Initialized drm 1.1.0 20060810
[2.862567] [drm] radeon defaulting to kernel modesetting.
[2.868091] [drm] radeon kernel modesetting enabled.
[2.873222] radeon :f0:10.0: enabling device ( -> 0003)
[2.880311] radeon :f0:10.0: enabling bus mastering
[2.885591] [drm] initializing kernel modesetting (RV350 
0x1002:0x4152 0x18BC:0x0416).
[2.893629] [drm] register mmio base: 0xD002
[2.898260] [drm] register mmio size: 65536
[2.947112] [drm] GPU not posted. posting now...
[3.051033] agpgart-uninorth :f0:0b.0: putting AGP V3 device into 
8x mode
[3.058197] radeon :f0:10.0: putting AGP V3 device into 8x mode
[3.064666] radeon :f0:10.0: GTT: 256M 0x - 0x0FFF
[3.070864] [drm] Generation 2 PCI interface, using max accessible memory
[3.077672] radeon :f0:10.0: VRAM: 128M 0xC000 - 
0xC7FF (128M used)
[3.086487] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
[3.093126] [drm] Driver supports precise vblank timestamp query.
[3.099291] [drm] radeon: irq initialized.
[3.103404] [drm] Detected VRAM RAM=128M, BAR=128M
[3.108214] [drm] RAM width 128bits DDR
[3.112263] [TTM] Zone  kernel: Available graphics memory: 496682 kiB
[3.118732] [TTM] Initializing pool allocator
[3.123346] [drm] radeon: 128M of VRAM memory ready
[3.128256] [drm] radeon: 256M of GTT memory ready.
[3.133295] [drm] radeon: ib pool ready.
[3.137708] [drm] radeon: 1 quad pipes, 1 Z pipes initialized.
[3.144018] radeon :f0:10.0: WB disabled
[3.148326] [drm] fence driver on ring 0 use gpu addr 0x and 
cpu addr 0xd0066000
[3.157474] [drm] Loading R300 Microcode
[3.162480] [drm] radeon: ring at 0x1000
[3.167569] [drm] ring test succeeded in 0 usecs
cpu 0x0: Vector: 200 (Machine Check) at [c0d63aa0]
 pc: c00cc07c: .trace_hardirqs_on_caller+0x6c/0x190
 lr: c00152f4: .cpu_idle+0x1a4/0x220
 sp: c0d63d20
msr: 90009032
   current = 0xc0c4db30
   paca= 0xc000   softe: 0irq_happened: 0x01
 pid   = 0, comm = swapper/0
enter ? for help
[c0d63db0] c00152f4 .cpu_idle+0x1a4/0x220
[c0d63e50] c0008fb8 .rest_init+0xe8/0x110
[c0d63ee0] c0ba2998 .start_kernel+0x3e4/0x408
[c0d63f90] c0007558 .start_here_common+0x20/0x48
0:mon> x
[  843.783295] Oops: Machine check, sig: 7 [#1]
[  843.787589] SMP NR_CPUS=4 Maple
[  843.790768] Modules linked in:
[  843.793855] NIP: c00cc07c LR: c00152f4 CTR: 
c0023eac
[  843.800920] REGS: c0d63aa0 TRAP: 0200   Not tainted  (3.4.0+)
[  843.807376] MSR: 90009032   CR: 
2422  XER: 0006
[  843.815412] SOFTE: 0
[  843.817607] TASK = c0c4db30[0] 'swapper/0' THREAD: 
c0d6 CPU: 0
[  843.825035] GPR00:  c0d63d20 c0d63280 
c00152f4
[  843.833169] GPR04:  c0099d10 0001 
0002
[  843.841302] GPR08: 0100 c0e828e8 0140 

[  843.849436] GPR12: 4482 c000  

[  843.857570] GPR16: 00ff8750 00cdc890 010001e0 

[  843.865702] GPR20:   1dcd6500 

[  843.873835] GPR24:  00ec7b00 90009032 
c0d7b178
[  843.881979] GPR28: c0d7b278 0008 c0c970f8 
c00152f4
[  843.890314] NIP [c00cc07c] .trace_hardirqs_on_caller+0x6c/0x190
[  843.896942] LR [c00152f4] .cpu_idle+0x1a4/0x220
[  843.902181] Call Trace:
[  843.904640] [c0d63d20] [c0d63db0] 
init_thread_union+0x3db0/0x4000 (unreliable)
[  843.913317] [c0d63db0] [c00152f4] .cpu_idle+0x1a4/0x220
[  

[patch] drm/udl: unlock before returning in udl_gem_mmap()

2012-05-24 Thread Dan Carpenter
On Thu, Mar 22, 2012 at 09:30:56AM +0300, Dan Carpenter wrote:
> If we hit an error here, then we should unlock and unreference obj
> before returning.
> 

This is still present in linux-next.

regards,
dan carpenter

> Signed-off-by: Dan Carpenter 
> 
> diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c
> index 852642d..6de6130 100644
> --- a/drivers/gpu/drm/udl/udl_gem.c
> +++ b/drivers/gpu/drm/udl/udl_gem.c
> @@ -210,7 +210,7 @@ int udl_gem_mmap(struct drm_file *file, struct drm_device 
> *dev,
>  
>   ret = udl_gem_get_pages(gobj, GFP_KERNEL);
>   if (ret)
> - return ret;
> + goto out;
>   if (!gobj->base.map_list.map) {
>   ret = drm_gem_create_mmap_offset(obj);
>   if (ret)


[PATCH 08/10] drm/radeon: replace pflip and sw_int counters with atomics

2012-05-24 Thread Koenig, Christian
> -Original Message-
> From: Sylvain BERTRAND [mailto:sylware at legeek.net]
> Sent: Thursday, May 24, 2012 1:59 PM
> To: Christian K?nig
> Cc: j.glisse at gmail.com; Koenig, Christian; dri-devel at 
> lists.freedesktop.org
> Subject: Re: [PATCH 08/10] drm/radeon: replace pflip and sw_int counters
> with atomics
> 
> > +   atomic_tring_int[RADEON_NUM_RINGS];
> > bool
>   crtc_vblank_int[RADEON_MAX_CRTCS];
> > -   boolpflip[RADEON_MAX_CRTCS];
> > -   int
>   pflip_refcount[RADEON_MAX_CRTCS];
> > +   atomic_tpflip[RADEON_MAX_CRTCS];
> 
> Hi,
> 
> Does the linux API mandates atomic_t to be a 32bits word?

AFAIK it is, at least for the platforms we care about. But since this depends 
on the vertical refresh frequency even a 8bit counter should do fine.

On the other hand it was an accident that those patches hit the maillinglist in 
the first place, cause only the first four where supposed to be send out (my 
fault, sorry). This one isn't tested beside compiling, and I don't think it 
will work out of the box.

Cheers,
Christian.



<    1   2   3