[Bug 51065] New: [Regression] : Acceleration initialization failed

2012-06-14 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=51065

 Bug #: 51065
   Summary: [Regression] : Acceleration initialization failed
Classification: Unclassified
   Product: Mesa
   Version: unspecified
  Platform: x86 (IA32)
OS/Version: All
Status: NEW
  Severity: critical
  Priority: medium
 Component: Drivers/Gallium/r600
AssignedTo: dri-devel@lists.freedesktop.org
ReportedBy: hysv...@gmail.com


Created attachment 63013
  --> https://bugs.freedesktop.org/attachment.cgi?id=63013
Xorg.log

Driver Stack Details:
=

1)Kernel-3.0.0-12-generice-pae 
2)drm-2.4.34
3)Mesa-8.1-devel 
4)Xorg-server-1.11.4
5)xf86-video-ati- master


System Environment:
===

Asic : EG CedarPro
O.S. : Ubuntu-11.10 (32 bit)
Processor: Intel(R) Xeon(R) @ 2.4 GHz
Memory   : 2 GB  

Observation:


Acceleration initialization fails with 6.14.99 but works fine with 6.14.4

-- 
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 51065] [Regression] : Acceleration initialization failed

2012-06-14 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=51065

samit vats  changed:

   What|Removed |Added

   Priority|medium  |high

-- 
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 51065] [Regression] : Acceleration initialization failed

2012-06-14 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=51065

Michel Dänzer  changed:

   What|Removed |Added

  Attachment #63013|application/octet-stream|text/plain
  mime type||

-- 
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 51065] [Regression] : Acceleration initialization failed

2012-06-14 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=51065

Michel Dänzer  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||NOTABUG

--- Comment #1 from Michel Dänzer  2012-06-14 01:15:24 PDT 
---
> 2)drm-2.4.34

Current xf86-video-ati Git requires at least libdrm 2.4.35 for KMS support.


P.S. please set the correct MIME type for attachments.

-- 
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 v2] drm/i915: ignore pipe select bit when checking for LVDS register initialization

2012-06-14 Thread Daniel Vetter
On Wed, Jun 13, 2012 at 03:26:00PM -0500, Seth Forshee wrote:
> On Wed, Jun 13, 2012 at 09:46:15PM +0200, Daniel Vetter wrote:
> > On Wed, Jun 13, 2012 at 01:46:58PM -0500, Seth Forshee wrote:
> > > The Lenovo Thinkpad T410 has the LVDS_PIPEB_SELECT bit set in the LVDS
> > > register when booted with the lid closed, even though the LVDS hasn't
> > > really been initialized. Ignore this bit so that the VBT value will be
> > > used instead.
> > > 
> > > Signed-off-by: Seth Forshee 
> > Queued for -next, thanks for the patch. Chris had some reservations about
> > the sanity of this patch, but given that it works around bios-insanity I'm
> > gonna just take this chance to stab myself with lvds-machines blowing up
> > left and right ;-)
> 
> Let's hope that doesn't happen ;)
> 
> I do find myself wondering though whether it might be better to prefer
> the value from the VBT whenever there's one available, and only rely on
> the actual register value as a fallback, since the bios can't be trusted
> to initialize the register. I'm pretty ignorant about all this graphics
> stuff though; I assume there's a reason it isn't done this way?

The usual reasoning is that if it's in the register, it's the value that
makes something show up on the screen and hence has a higher change of
being right. Yep, BIOS routinely store total garbage in vbt (or the newer
OpRegion) and somehow fix that up when copying things to the hw :(
Obviously there's also the other case where the hw values aren't set up,
in which case we try to try to fall back to vbt values.
-Daniel
-- 
Daniel Vetter
Mail: dan...@ffwll.ch
Mobile: +41 (0)79 365 57 48
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 14500] Kernel 2.6.31-14.48 froze during regular use (kref.c with warn_slowpath_common)

2012-06-14 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=14500


Alan  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||a...@lxorguk.ukuu.org.uk
  Component|Other   |Video(DRI - non Intel)
 Resolution||OBSOLETE
 AssignedTo|drivers_other@kernel-bugs.o |drivers_video-dri@kernel-bu
   |sdl.org |gs.osdl.org




--- Comment #3 from Alan   2012-06-14 10:06:31 ---
Reassigning to the DRI layer

I'll also close this as it doesn't provide any useful replication info and it
is versus an old kernel so it doesn't really have any obvious use to us any
more.

Tnanks for reporting it.

Alan

-- 
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 14500] Kernel 2.6.31-14.48 froze during regular use (kref.c with warn_slowpath_common)

2012-06-14 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=14500


Alan  changed:

   What|Removed |Added

 Status|RESOLVED|CLOSED




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


[PATCH 00/12] kill-with-fire, resurrected 2nd part

2012-06-14 Thread Daniel Vetter
Hi all,

Blind me has finally found the bug that killed via - dropping locks again in the
early exit path is highly advised ;-)

The big part of this series is cleaning up buffer handling in the
teardown/lastclose path: All special-cases only used by 1-2 drivers are moved
into the drivers respective preclose functions (newly created in most cases),
the remaining stuff is streamlined. The only things left in the common code
which is not used by all drivers is used by at least a few of them.

So after this patch series the drm_release/lastclose stuff is now fairly
readable and understandable. Originally I wanted to fix up a few of the resource
leaks that are possible at module unload time, but got stuck at understanding
the release/lastclose stuff ;-)

4 drivers needed special treatement, unfortunately I couldn't get a tested by
for sis. I've tried to ebay one of these old cards and found one that works with
the sisfb and sis ddx driver, but unfortunately the sis mesa driver only
supports one specific generations. But since drm/sis is more or less a 1:1 copy
of drm/via I'm fairly sure that this will work, too.

The last two patches just kill stuff that I've noticed while crawling around in
the close/release paths.

As usual, comments, flames, reviews (and especially from a sis users) tested-bys
highly welcome.

Yours, Daniel

Daniel Vetter (12):
  drm/via: clean up reclaim_buffers
  drm/sis: clean up reclaim_buffers
  drm: kill reclaim_buffers_idlelocked functions
  Revert "Revert "drm/i810: cleanup reclaim_buffers""
  drm: kill reclaim_buffers_locked
  drm/savage: clean up reclaim_buffers
  drm: kill reclaim_buffers callback
  drm: ditch strange DRIVER_DMA_QUEUE only error bail-out
  drm: kill dma queue support
  drm: unconditionally clean up dma buffers of closing clients
  drm: kill i915/i830 ids from drm_pciids.h
  drm: kill procfs support

 drivers/gpu/drm/Makefile  |2 +-
 drivers/gpu/drm/drm_bufs.c|   16 +--
 drivers/gpu/drm/drm_debugfs.c |1 -
 drivers/gpu/drm/drm_dma.c |5 -
 drivers/gpu/drm/drm_drv.c |   19 ---
 drivers/gpu/drm/drm_fops.c|   63 +-
 drivers/gpu/drm/drm_info.c|   36 --
 drivers/gpu/drm/drm_lock.c|4 -
 drivers/gpu/drm/drm_proc.c|  221 -
 drivers/gpu/drm/drm_stub.c|   25 ++--
 drivers/gpu/drm/gma500/psb_drv.c  |1 -
 drivers/gpu/drm/i810/i810_dma.c   |   17 ++-
 drivers/gpu/drm/i810/i810_drv.c   |3 +-
 drivers/gpu/drm/i810/i810_drv.h   |6 +-
 drivers/gpu/drm/i915/i915_drv.c   |1 -
 drivers/gpu/drm/mga/mga_drv.c |1 -
 drivers/gpu/drm/nouveau/nouveau_drv.c |1 -
 drivers/gpu/drm/r128/r128_drv.c   |1 -
 drivers/gpu/drm/radeon/radeon_drv.c   |2 -
 drivers/gpu/drm/savage/savage_bci.c   |9 +-
 drivers/gpu/drm/savage/savage_drv.c   |2 +-
 drivers/gpu/drm/sis/sis_drv.c |3 +-
 drivers/gpu/drm/sis/sis_mm.c  |   13 +-
 drivers/gpu/drm/tdfx/tdfx_drv.c   |1 -
 drivers/gpu/drm/via/via_drv.c |4 +-
 drivers/gpu/drm/via/via_mm.c  |   13 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c   |1 -
 include/drm/drmP.h|   23 +---
 include/drm/drm_pciids.h  |   42 ---
 29 files changed, 60 insertions(+), 476 deletions(-)
 delete mode 100644 drivers/gpu/drm/drm_proc.c

-- 
1.7.10

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


[PATCH 01/12] drm/via: clean up reclaim_buffers

2012-06-14 Thread Daniel Vetter
A few things
- kill reclaim_buffers, it's never ever called because via does not set
  DRIVER_HAVE_DMA
- inline the idlelock dance into the buffer reclaim logic and make it
  a simple preclose cleanup function
- directly call the the dma_quiescent function and kill the needless
  if check.

v2: Actually drop the idlelock when we take it. Reported by James
Simmons.

v3: Rebased onto latest drm-next.

v4: Fixup the refactor.

v5: More fixup the refactor - I've accidentally changed the check for
any master to checking whether the closing fd is the master.

v6: Don't forget to drop the idlelock in the early return path, too.

Tested-by: Jakob Bornecrantz 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/via/via_drv.c |4 +---
 drivers/gpu/drm/via/via_mm.c  |   13 +++--
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/via/via_drv.c b/drivers/gpu/drm/via/via_drv.c
index 02661f3..e927b4c 100644
--- a/drivers/gpu/drm/via/via_drv.c
+++ b/drivers/gpu/drm/via/via_drv.c
@@ -75,6 +75,7 @@ static struct drm_driver driver = {
.load = via_driver_load,
.unload = via_driver_unload,
.open = via_driver_open,
+   .preclose = via_reclaim_buffers_locked,
.postclose = via_driver_postclose,
.context_dtor = via_final_context,
.get_vblank_counter = via_get_vblank_counter,
@@ -85,9 +86,6 @@ static struct drm_driver driver = {
.irq_uninstall = via_driver_irq_uninstall,
.irq_handler = via_driver_irq_handler,
.dma_quiescent = via_driver_dma_quiescent,
-   .reclaim_buffers = drm_core_reclaim_buffers,
-   .reclaim_buffers_locked = NULL,
-   .reclaim_buffers_idlelocked = via_reclaim_buffers_locked,
.lastclose = via_lastclose,
.ioctls = via_ioctls,
.fops = &via_driver_fops,
diff --git a/drivers/gpu/drm/via/via_mm.c b/drivers/gpu/drm/via/via_mm.c
index a3574d0..acfcb35 100644
--- a/drivers/gpu/drm/via/via_mm.c
+++ b/drivers/gpu/drm/via/via_mm.c
@@ -215,14 +215,20 @@ void via_reclaim_buffers_locked(struct drm_device *dev,
struct via_file_private *file_priv = file->driver_priv;
struct via_memblock *entry, *next;
 
+   if (!(file->minor->master && file->master->lock.hw_lock))
+   return;
+
+   drm_idlelock_take(&file->master->lock);
+
mutex_lock(&dev->struct_mutex);
if (list_empty(&file_priv->obj_list)) {
mutex_unlock(&dev->struct_mutex);
+   drm_idlelock_release(&file->master->lock);
+
return;
}
 
-   if (dev->driver->dma_quiescent)
-   dev->driver->dma_quiescent(dev);
+   via_driver_dma_quiescent(dev);
 
list_for_each_entry_safe(entry, next, &file_priv->obj_list,
 owner_list) {
@@ -231,5 +237,8 @@ void via_reclaim_buffers_locked(struct drm_device *dev,
kfree(entry);
}
mutex_unlock(&dev->struct_mutex);
+
+   drm_idlelock_release(&file->master->lock);
+
return;
 }
-- 
1.7.10

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


[PATCH 02/12] drm/sis: clean up reclaim_buffers

2012-06-14 Thread Daniel Vetter
Like for via.

v2: Actually drop the idlelock again if taken.

v3: Fixup.

v4: Fixup the "has master" vs. "is master" confusion the refactor
introduced.

v5: Drop the idlelock in the early return path.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/sis/sis_drv.c |3 +--
 drivers/gpu/drm/sis/sis_mm.c  |   13 +++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c
index c7263a4..614029d 100644
--- a/drivers/gpu/drm/sis/sis_drv.c
+++ b/drivers/gpu/drm/sis/sis_drv.c
@@ -105,10 +105,9 @@ static struct drm_driver driver = {
.load = sis_driver_load,
.unload = sis_driver_unload,
.open = sis_driver_open,
+   .preclose = sis_reclaim_buffers_locked,
.postclose = sis_driver_postclose,
.dma_quiescent = sis_idle,
-   .reclaim_buffers = NULL,
-   .reclaim_buffers_idlelocked = sis_reclaim_buffers_locked,
.lastclose = sis_lastclose,
.ioctls = sis_ioctls,
.fops = &sis_driver_fops,
diff --git a/drivers/gpu/drm/sis/sis_mm.c b/drivers/gpu/drm/sis/sis_mm.c
index dd4a316..5acc396 100644
--- a/drivers/gpu/drm/sis/sis_mm.c
+++ b/drivers/gpu/drm/sis/sis_mm.c
@@ -321,14 +321,20 @@ void sis_reclaim_buffers_locked(struct drm_device *dev,
struct sis_file_private *file_priv = file->driver_priv;
struct sis_memblock *entry, *next;
 
+   if (!(file->minor->master && file->master->lock.hw_lock))
+   return;
+
+   drm_idlelock_take(&file->master->lock);
+
mutex_lock(&dev->struct_mutex);
if (list_empty(&file_priv->obj_list)) {
mutex_unlock(&dev->struct_mutex);
+   drm_idlelock_release(&file->master->lock);
+
return;
}
 
-   if (dev->driver->dma_quiescent)
-   dev->driver->dma_quiescent(dev);
+   sis_idle(dev);
 
 
list_for_each_entry_safe(entry, next, &file_priv->obj_list,
@@ -343,6 +349,9 @@ void sis_reclaim_buffers_locked(struct drm_device *dev,
kfree(entry);
}
mutex_unlock(&dev->struct_mutex);
+
+   drm_idlelock_release(&file->master->lock);
+
return;
 }
 
-- 
1.7.10

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


[PATCH 03/12] drm: kill reclaim_buffers_idlelocked functions

2012-06-14 Thread Daniel Vetter
The only two users are now folded into the drivers preclose functions,
so this is unused.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_fops.c |8 
 include/drm/drmP.h |2 --
 2 files changed, 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 123de28..f6231f02 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -417,14 +417,6 @@ static void drm_master_release(struct drm_device *dev, 
struct file *filp)
file_priv->master->lock.hw_lock)
drm_reclaim_locked_buffers(dev, filp);
 
-   if (dev->driver->reclaim_buffers_idlelocked &&
-   file_priv->master->lock.hw_lock) {
-   drm_idlelock_take(&file_priv->master->lock);
-   dev->driver->reclaim_buffers_idlelocked(dev, file_priv);
-   drm_idlelock_release(&file_priv->master->lock);
-   }
-
-
if (drm_i_have_hw_lock(dev, file_priv)) {
DRM_DEBUG("File %p released, freeing lock for context %d\n",
  filp, 
_DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock));
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 31ad880..005af91 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -880,8 +880,6 @@ struct drm_driver {
 struct drm_file * file_priv);
void (*reclaim_buffers_locked) (struct drm_device *dev,
struct drm_file *file_priv);
-   void (*reclaim_buffers_idlelocked) (struct drm_device *dev,
-   struct drm_file *file_priv);
void (*set_version) (struct drm_device *dev,
 struct drm_set_version *sv);
 
-- 
1.7.10

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


[PATCH 04/12] Revert "Revert "drm/i810: cleanup reclaim_buffers""

2012-06-14 Thread Daniel Vetter
This reverts commit 6e877b576ddf7cde5db2e9a6dcb56fef0ea77e64,
reinstating the original commit:

commit 87499ffdcb1c70f66988cd8febc4ead0ba2f9118
Author: Daniel Vetter 
Date:   Tue Oct 25 23:51:24 2011 +0200

drm/i810: cleanup reclaim_buffers

My dear old i815 always hits the deadlocked on reclaim_buffers
warning. Switch over to the idlelock duct-tape on hope that
works better. I've fired up my i815 and now closing glxgears doesn't
take 5 seconds anymore. \o/

The original problem with that was that I've moved it ahead in the
series so that it could be included despite some patches not being
ready quite yet. The little problem is that this patch required some
of the previous rework to work correctly.

Now that everything is in the right order again, this actually works
on my i810 and does speed up closing gl apps as the original commit
claimed. Without hanging the machine, as the revert says.

Signed-Off-by: Daniel Vetter 
---
 drivers/gpu/drm/i810/i810_dma.c |   17 +++--
 drivers/gpu/drm/i810/i810_drv.c |1 -
 drivers/gpu/drm/i810/i810_drv.h |6 ++
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c
index fa94391..57d892e 100644
--- a/drivers/gpu/drm/i810/i810_dma.c
+++ b/drivers/gpu/drm/i810/i810_dma.c
@@ -881,7 +881,7 @@ static int i810_flush_queue(struct drm_device *dev)
 }
 
 /* Must be called with the lock held */
-static void i810_reclaim_buffers(struct drm_device *dev,
+void i810_driver_reclaim_buffers(struct drm_device *dev,
 struct drm_file *file_priv)
 {
struct drm_device_dma *dma = dev->dma;
@@ -1220,12 +1220,17 @@ void i810_driver_preclose(struct drm_device *dev, 
struct drm_file *file_priv)
if (dev_priv->page_flipping)
i810_do_cleanup_pageflip(dev);
}
-}
 
-void i810_driver_reclaim_buffers_locked(struct drm_device *dev,
-   struct drm_file *file_priv)
-{
-   i810_reclaim_buffers(dev, file_priv);
+   if (file_priv->master && file_priv->master->lock.hw_lock) {
+   drm_idlelock_take(&file_priv->master->lock);
+   i810_driver_reclaim_buffers(dev, file_priv);
+   drm_idlelock_release(&file_priv->master->lock);
+   } else {
+   /* master disappeared, clean up stuff anyway and hope nothing
+* goes wrong */
+   i810_driver_reclaim_buffers(dev, file_priv);
+   }
+
 }
 
 int i810_driver_dma_quiescent(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i810/i810_drv.c b/drivers/gpu/drm/i810/i810_drv.c
index ec12f7d..053f1ee 100644
--- a/drivers/gpu/drm/i810/i810_drv.c
+++ b/drivers/gpu/drm/i810/i810_drv.c
@@ -63,7 +63,6 @@ static struct drm_driver driver = {
.lastclose = i810_driver_lastclose,
.preclose = i810_driver_preclose,
.device_is_agp = i810_driver_device_is_agp,
-   .reclaim_buffers_locked = i810_driver_reclaim_buffers_locked,
.dma_quiescent = i810_driver_dma_quiescent,
.ioctls = i810_ioctls,
.fops = &i810_driver_fops,
diff --git a/drivers/gpu/drm/i810/i810_drv.h b/drivers/gpu/drm/i810/i810_drv.h
index c9339f4..6e0acad 100644
--- a/drivers/gpu/drm/i810/i810_drv.h
+++ b/drivers/gpu/drm/i810/i810_drv.h
@@ -116,14 +116,12 @@ typedef struct drm_i810_private {
 
/* i810_dma.c */
 extern int i810_driver_dma_quiescent(struct drm_device *dev);
-extern void i810_driver_reclaim_buffers_locked(struct drm_device *dev,
-  struct drm_file *file_priv);
+void i810_driver_reclaim_buffers(struct drm_device *dev,
+struct drm_file *file_priv);
 extern int i810_driver_load(struct drm_device *, unsigned long flags);
 extern void i810_driver_lastclose(struct drm_device *dev);
 extern void i810_driver_preclose(struct drm_device *dev,
 struct drm_file *file_priv);
-extern void i810_driver_reclaim_buffers_locked(struct drm_device *dev,
-  struct drm_file *file_priv);
 extern int i810_driver_device_is_agp(struct drm_device *dev);
 
 extern long i810_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
-- 
1.7.10

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


[PATCH 05/12] drm: kill reclaim_buffers_locked

2012-06-14 Thread Daniel Vetter
i810 was the last user of this code, with that gone, kill it.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_fops.c  |   46 +--
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |1 -
 include/drm/drmP.h  |2 --
 3 files changed, 1 insertion(+), 48 deletions(-)

diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index f6231f02..6cf9369 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -370,53 +370,10 @@ int drm_fasync(int fd, struct file *filp, int on)
 }
 EXPORT_SYMBOL(drm_fasync);
 
-/*
- * Reclaim locked buffers; note that this may be a bad idea if the current
- * context doesn't have the hw lock...
- */
-static void drm_reclaim_locked_buffers(struct drm_device *dev, struct file *f)
-{
-   struct drm_file *file_priv = f->private_data;
-
-   if (drm_i_have_hw_lock(dev, file_priv)) {
-   dev->driver->reclaim_buffers_locked(dev, file_priv);
-   } else {
-   unsigned long _end = jiffies + 3 * DRM_HZ;
-   int locked = 0;
-
-   drm_idlelock_take(&file_priv->master->lock);
-
-   /*
-* Wait for a while.
-*/
-   do {
-   spin_lock_bh(&file_priv->master->lock.spinlock);
-   locked = file_priv->master->lock.idle_has_lock;
-   spin_unlock_bh(&file_priv->master->lock.spinlock);
-   if (locked)
-   break;
-   schedule();
-   } while (!time_after_eq(jiffies, _end));
-
-   if (!locked) {
-   DRM_ERROR("reclaim_buffers_locked() deadlock. Please 
rework this\n"
- "\tdriver to use reclaim_buffers_idlelocked() 
instead.\n"
- "\tI will go on reclaiming the buffers 
anyway.\n");
-   }
-
-   dev->driver->reclaim_buffers_locked(dev, file_priv);
-   drm_idlelock_release(&file_priv->master->lock);
-   }
-}
-
 static void drm_master_release(struct drm_device *dev, struct file *filp)
 {
struct drm_file *file_priv = filp->private_data;
 
-   if (dev->driver->reclaim_buffers_locked &&
-   file_priv->master->lock.hw_lock)
-   drm_reclaim_locked_buffers(dev, filp);
-
if (drm_i_have_hw_lock(dev, file_priv)) {
DRM_DEBUG("File %p released, freeing lock for context %d\n",
  filp, 
_DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock));
@@ -424,8 +381,7 @@ static void drm_master_release(struct drm_device *dev, 
struct file *filp)
  
_DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock));
}
 
-   if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) &&
-   !dev->driver->reclaim_buffers_locked) {
+   if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) {
dev->driver->reclaim_buffers(dev, file_priv);
}
 }
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index ee24d21..5d5632f 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -1147,7 +1147,6 @@ static struct drm_driver driver = {
.get_vblank_counter = vmw_get_vblank_counter,
.enable_vblank = vmw_enable_vblank,
.disable_vblank = vmw_disable_vblank,
-   .reclaim_buffers_locked = NULL,
.ioctls = vmw_ioctls,
.num_ioctls = DRM_ARRAY_SIZE(vmw_ioctls),
.dma_quiescent = NULL,  /*vmw_dma_quiescent, */
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 005af91..8ee41e6 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -878,8 +878,6 @@ struct drm_driver {
void (*irq_uninstall) (struct drm_device *dev);
void (*reclaim_buffers) (struct drm_device *dev,
 struct drm_file * file_priv);
-   void (*reclaim_buffers_locked) (struct drm_device *dev,
-   struct drm_file *file_priv);
void (*set_version) (struct drm_device *dev,
 struct drm_set_version *sv);
 
-- 
1.7.10

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


[PATCH 06/12] drm/savage: clean up reclaim_buffers

2012-06-14 Thread Daniel Vetter
The reclaim_buffers function of the savage driver actually wants to run
with the hw_lock held - at least there are printks in the call-chain
to that effect. But the drm core only calls reclaim_buffers as used
by savage _after_ forcefully dropping the hwlock (in case it's still
hold by the closing fd).

So do the same idlelock dance as for the other dma drivers and hope
that papers over any issues.

v2: Don't let the idlelock linger around.

Signed-off-by: Daniel Vetter 
Tested-by: Tormod Volden 
---
 drivers/gpu/drm/savage/savage_bci.c |9 +++--
 drivers/gpu/drm/savage/savage_drv.c |2 +-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/savage/savage_bci.c 
b/drivers/gpu/drm/savage/savage_bci.c
index 6eb507a..1efbb90 100644
--- a/drivers/gpu/drm/savage/savage_bci.c
+++ b/drivers/gpu/drm/savage/savage_bci.c
@@ -1050,6 +1050,7 @@ void savage_reclaim_buffers(struct drm_device *dev, 
struct drm_file *file_priv)
 {
struct drm_device_dma *dma = dev->dma;
drm_savage_private_t *dev_priv = dev->dev_private;
+   int release_idlelock = 0;
int i;
 
if (!dma)
@@ -1059,7 +1060,10 @@ void savage_reclaim_buffers(struct drm_device *dev, 
struct drm_file *file_priv)
if (!dma->buflist)
return;
 
-   /*i830_flush_queue(dev); */
+   if (file_priv->master && file_priv->master->lock.hw_lock) {
+   drm_idlelock_take(&file_priv->master->lock);
+   release_idlelock = 1;
+   }
 
for (i = 0; i < dma->buf_count; i++) {
struct drm_buf *buf = dma->buflist[i];
@@ -1075,7 +1079,8 @@ void savage_reclaim_buffers(struct drm_device *dev, 
struct drm_file *file_priv)
}
}
 
-   drm_core_reclaim_buffers(dev, file_priv);
+   if (release_idlelock)
+   drm_idlelock_release(&file_priv->master->lock);
 }
 
 struct drm_ioctl_desc savage_ioctls[] = {
diff --git a/drivers/gpu/drm/savage/savage_drv.c 
b/drivers/gpu/drm/savage/savage_drv.c
index 89afe0b..d31d4cc 100644
--- a/drivers/gpu/drm/savage/savage_drv.c
+++ b/drivers/gpu/drm/savage/savage_drv.c
@@ -52,9 +52,9 @@ static struct drm_driver driver = {
.dev_priv_size = sizeof(drm_savage_buf_priv_t),
.load = savage_driver_load,
.firstopen = savage_driver_firstopen,
+   .preclose = savage_reclaim_buffers,
.lastclose = savage_driver_lastclose,
.unload = savage_driver_unload,
-   .reclaim_buffers = savage_reclaim_buffers,
.ioctls = savage_ioctls,
.dma_ioctl = savage_bci_buffers,
.fops = &savage_driver_fops,
-- 
1.7.10

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


[PATCH 07/12] drm: kill reclaim_buffers callback

2012-06-14 Thread Daniel Vetter
All leftover users either haven't set DRIVER_HAVE_DMA, in which
case this will never be called, or use the drm_core implementation.

Call that directly in the only callsite.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_fops.c|5 ++---
 drivers/gpu/drm/gma500/psb_drv.c  |1 -
 drivers/gpu/drm/i915/i915_drv.c   |1 -
 drivers/gpu/drm/mga/mga_drv.c |1 -
 drivers/gpu/drm/nouveau/nouveau_drv.c |1 -
 drivers/gpu/drm/r128/r128_drv.c   |1 -
 drivers/gpu/drm/radeon/radeon_drv.c   |2 --
 drivers/gpu/drm/tdfx/tdfx_drv.c   |1 -
 include/drm/drmP.h|2 --
 9 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 6cf9369..96b8c8f 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -381,9 +381,8 @@ static void drm_master_release(struct drm_device *dev, 
struct file *filp)
  
_DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock));
}
 
-   if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) {
-   dev->driver->reclaim_buffers(dev, file_priv);
-   }
+   if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
+   drm_core_reclaim_buffers(dev, file_priv);
 }
 
 static void drm_events_release(struct drm_file *file_priv)
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index caba6e0..cd1dd1b 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -632,7 +632,6 @@ static struct drm_driver driver = {
.open = psb_driver_open,
.preclose = psb_driver_preclose,
.postclose = psb_driver_close,
-   .reclaim_buffers = drm_core_reclaim_buffers,
 
.gem_init_object = psb_gem_init_object,
.gem_free_object = psb_gem_free_object,
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 9fe9ebe..a196eca 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1058,7 +1058,6 @@ static struct drm_driver driver = {
.resume = i915_resume,
 
.device_is_agp = i915_driver_device_is_agp,
-   .reclaim_buffers = drm_core_reclaim_buffers,
.master_create = i915_master_create,
.master_destroy = i915_master_destroy,
 #if defined(CONFIG_DEBUG_FS)
diff --git a/drivers/gpu/drm/mga/mga_drv.c b/drivers/gpu/drm/mga/mga_drv.c
index f9a925d..b1bb46d 100644
--- a/drivers/gpu/drm/mga/mga_drv.c
+++ b/drivers/gpu/drm/mga/mga_drv.c
@@ -75,7 +75,6 @@ static struct drm_driver driver = {
.irq_postinstall = mga_driver_irq_postinstall,
.irq_uninstall = mga_driver_irq_uninstall,
.irq_handler = mga_driver_irq_handler,
-   .reclaim_buffers = drm_core_reclaim_buffers,
.ioctls = mga_ioctls,
.dma_ioctl = mga_dma_buffers,
.fops = &mga_driver_fops,
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c 
b/drivers/gpu/drm/nouveau/nouveau_drv.c
index cad254c..b4d1b4a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.c
@@ -422,7 +422,6 @@ static struct drm_driver driver = {
.get_vblank_counter = drm_vblank_count,
.enable_vblank = nouveau_vblank_enable,
.disable_vblank = nouveau_vblank_disable,
-   .reclaim_buffers = drm_core_reclaim_buffers,
.ioctls = nouveau_ioctls,
.fops = &nouveau_driver_fops,
 
diff --git a/drivers/gpu/drm/r128/r128_drv.c b/drivers/gpu/drm/r128/r128_drv.c
index 88718fa..2666a53 100644
--- a/drivers/gpu/drm/r128/r128_drv.c
+++ b/drivers/gpu/drm/r128/r128_drv.c
@@ -71,7 +71,6 @@ static struct drm_driver driver = {
.irq_postinstall = r128_driver_irq_postinstall,
.irq_uninstall = r128_driver_irq_uninstall,
.irq_handler = r128_driver_irq_handler,
-   .reclaim_buffers = drm_core_reclaim_buffers,
.ioctls = r128_ioctls,
.dma_ioctl = r128_cce_buffers,
.fops = &r128_driver_fops,
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index f0bb2b5..040a8e7 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -260,7 +260,6 @@ static struct drm_driver driver_old = {
.irq_postinstall = radeon_driver_irq_postinstall,
.irq_uninstall = radeon_driver_irq_uninstall,
.irq_handler = radeon_driver_irq_handler,
-   .reclaim_buffers = drm_core_reclaim_buffers,
.ioctls = radeon_ioctls,
.dma_ioctl = radeon_cp_buffers,
.fops = &radeon_driver_old_fops,
@@ -363,7 +362,6 @@ static struct drm_driver kms_driver = {
.irq_postinstall = radeon_driver_irq_postinstall_kms,
.irq_uninstall = radeon_driver_irq_uninstall_kms,
.irq_handler = radeon_driver_irq_handler_kms,
-   .reclaim_buffers = drm_core_reclaim_buffers,
.ioctls = radeon_ioctls_kms,
.gem_init_object = radeon_gem_object_init,
.gem_

[PATCH 09/12] drm: kill dma queue support

2012-06-14 Thread Daniel Vetter
Absolutely unused. All the values are only ever initialized and
then used at most in some debug printout functions.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_bufs.c  |   16 ++--
 drivers/gpu/drm/drm_debugfs.c   |1 -
 drivers/gpu/drm/drm_dma.c   |5 -
 drivers/gpu/drm/drm_drv.c   |   11 ---
 drivers/gpu/drm/drm_fops.c  |4 
 drivers/gpu/drm/drm_info.c  |   36 
 drivers/gpu/drm/drm_proc.c  |1 -
 drivers/gpu/drm/i810/i810_drv.c |2 +-
 include/drm/drmP.h  |8 +---
 9 files changed, 4 insertions(+), 80 deletions(-)

diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 348b367..b356c71 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -641,8 +641,6 @@ int drm_addbufs_agp(struct drm_device * dev, struct 
drm_buf_desc * request)
 
if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
return -EINVAL;
-   if (dev->queue_count)
-   return -EBUSY;  /* Not while in use */
 
/* Make sure buffers are located in AGP memory that we own */
valid = 0;
@@ -704,7 +702,6 @@ int drm_addbufs_agp(struct drm_device * dev, struct 
drm_buf_desc * request)
buf->next = NULL;
buf->waiting = 0;
buf->pending = 0;
-   init_waitqueue_head(&buf->dma_wait);
buf->file_priv = NULL;
 
buf->dev_priv_size = dev->driver->dev_priv_size;
@@ -796,13 +793,11 @@ int drm_addbufs_pci(struct drm_device * dev, struct 
drm_buf_desc * request)
order = drm_order(request->size);
size = 1 << order;
 
-   DRM_DEBUG("count=%d, size=%d (%d), order=%d, queue_count=%d\n",
- request->count, request->size, size, order, dev->queue_count);
+   DRM_DEBUG("count=%d, size=%d (%d), order=%d\n",
+ request->count, request->size, size, order);
 
if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
return -EINVAL;
-   if (dev->queue_count)
-   return -EBUSY;  /* Not while in use */
 
alignment = (request->flags & _DRM_PAGE_ALIGN)
? PAGE_ALIGN(size) : size;
@@ -904,7 +899,6 @@ int drm_addbufs_pci(struct drm_device * dev, struct 
drm_buf_desc * request)
buf->next = NULL;
buf->waiting = 0;
buf->pending = 0;
-   init_waitqueue_head(&buf->dma_wait);
buf->file_priv = NULL;
 
buf->dev_priv_size = dev->driver->dev_priv_size;
@@ -1019,8 +1013,6 @@ static int drm_addbufs_sg(struct drm_device * dev, struct 
drm_buf_desc * request
 
if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
return -EINVAL;
-   if (dev->queue_count)
-   return -EBUSY;  /* Not while in use */
 
spin_lock(&dev->count_lock);
if (dev->buf_use) {
@@ -1071,7 +1063,6 @@ static int drm_addbufs_sg(struct drm_device * dev, struct 
drm_buf_desc * request
buf->next = NULL;
buf->waiting = 0;
buf->pending = 0;
-   init_waitqueue_head(&buf->dma_wait);
buf->file_priv = NULL;
 
buf->dev_priv_size = dev->driver->dev_priv_size;
@@ -1177,8 +1168,6 @@ static int drm_addbufs_fb(struct drm_device * dev, struct 
drm_buf_desc * request
 
if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
return -EINVAL;
-   if (dev->queue_count)
-   return -EBUSY;  /* Not while in use */
 
spin_lock(&dev->count_lock);
if (dev->buf_use) {
@@ -1228,7 +1217,6 @@ static int drm_addbufs_fb(struct drm_device * dev, struct 
drm_buf_desc * request
buf->next = NULL;
buf->waiting = 0;
buf->pending = 0;
-   init_waitqueue_head(&buf->dma_wait);
buf->file_priv = NULL;
 
buf->dev_priv_size = dev->driver->dev_priv_size;
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 1c7a1c0..70b13fc 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -46,7 +46,6 @@ static struct drm_info_list drm_debugfs_list[] = {
{"name", drm_name_info, 0},
{"vm", drm_vm_info, 0},
{"clients", drm_clients_info, 0},
-   {"queues", drm_queues_info, 0},
{"bufs", drm_bufs_info, 0},
{"gem_names", drm_gem_name_info, DRIVER_GEM},
 #if DRM_DEBUG_CODE
diff --git a/drivers/gpu/drm/drm_dma.c b/drivers/gpu/drm/drm_dma.c
index cfb4e33..08f5e53 100644
--- a/drivers/gpu/drm/drm_dma.c
+++ b/drivers/gpu/drm/drm_dma.c
@@ -120,11 +120,6 @@ void drm_free_buffer(struct drm_device *dev, struct 
drm_buf * buf)
buf->pending = 0;
buf->file_priv = NULL;
buf->used = 0;
-
-   if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE)
-   

[PATCH 10/12] drm: unconditionally clean up dma buffers of closing clients

2012-06-14 Thread Daniel Vetter
With the last patch to ditch DMA_QUEUE support, we should be able
to call the dma cleanup uncoditionally, even when the master has
disappeared.

Do so because it just makes more sense.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_fops.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index c6f5f89..d25a617 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -376,9 +376,6 @@ static void drm_master_release(struct drm_device *dev, 
struct file *filp)
drm_lock_free(&file_priv->master->lock,
  
_DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock));
}
-
-   if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
-   drm_core_reclaim_buffers(dev, file_priv);
 }
 
 static void drm_events_release(struct drm_file *file_priv)
@@ -448,6 +445,9 @@ int drm_release(struct inode *inode, struct file *filp)
if (file_priv->minor->master)
drm_master_release(dev, filp);
 
+   if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
+   drm_core_reclaim_buffers(dev, file_priv);
+
drm_events_release(file_priv);
 
if (dev->driver->driver_features & DRIVER_MODESET)
-- 
1.7.10

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


[PATCH 11/12] drm: kill i915/i830 ids from drm_pciids.h

2012-06-14 Thread Daniel Vetter
Signed-off-by: Daniel Vetter 
---
 include/drm/drm_pciids.h |   42 --
 1 file changed, 42 deletions(-)

diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 81368ab..20c46ec 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -690,14 +690,6 @@
{0x8086, 0x1132, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
{0, 0, 0}
 
-#define i830_PCI_IDS \
-   {0x8086, 0x3577, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-   {0x8086, 0x2562, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-   {0x8086, 0x3582, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-   {0x8086, 0x2572, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-   {0x8086, 0x358e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-   {0, 0, 0}
-
 #define gamma_PCI_IDS \
{0x3d3d, 0x0008, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
{0, 0, 0}
@@ -730,37 +722,3 @@
 
 #define ffb_PCI_IDS \
{0, 0, 0}
-
-#define i915_PCI_IDS \
-   {0x8086, 0x3577, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x2562, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x3582, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x2572, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x2582, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x258a, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x2592, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x2772, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x27a2, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x27ae, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x2972, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x2982, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x2992, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x29a2, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x29b2, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x29c2, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x29d2, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x2a02, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x2a12, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x2a42, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x2e02, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x2e12, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x2e22, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x2e32, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x2e42, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0xa001, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0xa011, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x35e8, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x0042, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x0046, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0x8086, 0x0102, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 
0x00, 0}, \
-   {0, 0, 0}
-- 
1.7.10

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


[PATCH 08/12] drm: ditch strange DRIVER_DMA_QUEUE only error bail-out

2012-06-14 Thread Daniel Vetter
Only one driver (i810) even sets that flag. Now the actual locking
code uncoditionally promotes lock->context to an unsigned int.

Closer inspection of the userspace reveals that the drm lock context
is defined as an unsigned int (at least on linux). I suspect we just
have a strange case of signedness confusion going on.

Tested on my i815, doesn't seem to break anything.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_lock.c |4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c
index 5211520..3203955 100644
--- a/drivers/gpu/drm/drm_lock.c
+++ b/drivers/gpu/drm/drm_lock.c
@@ -70,10 +70,6 @@ int drm_lock(struct drm_device *dev, void *data, struct 
drm_file *file_priv)
  lock->context, task_pid_nr(current),
  master->lock.hw_lock->lock, lock->flags);
 
-   if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE))
-   if (lock->context < 0)
-   return -EINVAL;
-
add_wait_queue(&master->lock.lock_queue, &entry);
spin_lock_bh(&master->lock.spinlock);
master->lock.user_waiters++;
-- 
1.7.10

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


[PATCH 12/12] drm: kill procfs support

2012-06-14 Thread Daniel Vetter
We have debugfs and sysfs for these things now!

Digging through the dungeons of old code and wading through countless
result pages on google indeed turned up one user of this:

libdrm before 2001 checks via the presence of /proc/dri/0 whether
the kernel drm is present and has a module successfully loaded.

Frankly I think that demanding from users that they upgrade to a more
modern libdrm is in order.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/Makefile   |2 +-
 drivers/gpu/drm/drm_drv.c  |8 --
 drivers/gpu/drm/drm_proc.c |  220 
 drivers/gpu/drm/drm_stub.c |   25 ++---
 include/drm/drmP.h |9 --
 5 files changed, 8 insertions(+), 256 deletions(-)
 delete mode 100644 drivers/gpu/drm/drm_proc.c

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index f65f65e..36b20b1 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -7,7 +7,7 @@ ccflags-y := -Iinclude/drm
 drm-y   := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \
drm_context.o drm_dma.o \
drm_drv.o drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \
-   drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \
+   drm_lock.o drm_memory.o drm_stub.o drm_vm.o \
drm_agpsupport.o drm_scatter.o ati_pcigart.o drm_pci.o \
drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \
drm_crtc.o drm_modes.o drm_edid.o \
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index bbabc05..0bb4b84 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -262,13 +262,6 @@ static int __init drm_core_init(void)
goto err_p2;
}
 
-   drm_proc_root = proc_mkdir("dri", NULL);
-   if (!drm_proc_root) {
-   DRM_ERROR("Cannot create /proc/dri\n");
-   ret = -1;
-   goto err_p3;
-   }
-
drm_debugfs_root = debugfs_create_dir("dri", NULL);
if (!drm_debugfs_root) {
DRM_ERROR("Cannot create /sys/kernel/debug/dri\n");
@@ -291,7 +284,6 @@ err_p1:
 
 static void __exit drm_core_exit(void)
 {
-   remove_proc_entry("dri", NULL);
debugfs_remove(drm_debugfs_root);
drm_sysfs_destroy();
 
diff --git a/drivers/gpu/drm/drm_proc.c b/drivers/gpu/drm/drm_proc.c
deleted file mode 100644
index 371c695..000
--- a/drivers/gpu/drm/drm_proc.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/**
- * \file drm_proc.c
- * /proc support for DRM
- *
- * \author Rickard E. (Rik) Faith 
- * \author Gareth Hughes 
- *
- * \par Acknowledgements:
- *Matthew J Sottek  sent in a patch to fix
- *the problem with the proc files not outputting all their information.
- */
-
-/*
- * Created: Mon Jan 11 09:48:47 1999 by fa...@valinux.com
- *
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include 
-#include 
-#include 
-#include "drmP.h"
-
-/***
- * Initialization, etc.
- **/
-
-/**
- * Proc file list.
- */
-static struct drm_info_list drm_proc_list[] = {
-   {"name", drm_name_info, 0},
-   {"vm", drm_vm_info, 0},
-   {"clients", drm_clients_info, 0},
-   {"bufs", drm_bufs_info, 0},
-   {"gem_names", drm_gem_name_info, DRIVER_GEM},
-#if DRM_DEBUG_CODE
-   {"vma", drm_vma_info, 0},
-#endif
-};
-#define DRM_PROC_ENTRIES ARRAY_SIZE(drm_proc_list)
-
-static int drm_proc_open(struct inode *inode, struct file *file)
-{
-   struct drm_info_node* node = PDE(inode)->data;
-
-   return single_open(file, node->info_ent->show, node);
-}
-
-static const struct file_operations drm_proc_fops = {
-   .owner = THIS_MODULE,
-   .open =

[Bug 51065] [Regression] : Acceleration initialization failed

2012-06-14 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=51065

--- Comment #2 from samit vats  2012-06-14 04:25:02 PDT ---
(In reply to comment #1)
> > 2)drm-2.4.34
> 
> Current xf86-video-ati Git requires at least libdrm 2.4.35 for KMS support.
> 
> 
> P.S. please set the correct MIME type for attachments.

Resolved, Not a Bug. drm-2.4.34 installed by mistake.

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


[PATCH] vga_switcheroo: Add include guard

2012-06-14 Thread Ozan Çağlayan
Guard vga_switcheroo.h against multiple inclusion.

Signed-off-by: Ozan Çağlayan 
---
 include/linux/vga_switcheroo.h |4 
 1 file changed, 4 insertions(+)

diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index b455c7c..9a1cf11 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -7,6 +7,9 @@
  * vga_switcheroo.h - Support for laptop with dual GPU using one set of outputs
  */
 
+#ifndef _LINUX_VGA_SWITCHEROO_H_
+#define _LINUX_VGA_SWITCHEROO_H_
+
 #include 
 
 enum vga_switcheroo_state {
@@ -64,3 +67,4 @@ static inline void vga_switcheroo_unregister_handler(void) {}
 static inline int vga_switcheroo_process_delayed_switch(void) { return 0; }
 
 #endif
+#endif /* _LINUX_VGA_SWITCHEROO_H_ */
-- 
1.7.10.2

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


[RFC] i.MX DRM devicetree binding

2012-06-14 Thread Sascha Hauer
Hi All,

The following is an attempt to come up with a devicetree binding for
DRM graphics on i.MX SoCs. I'm posting this seperate from the actual
code to not bury this in big patches.

The bindings should cover most of the problems we had while implementing
the possible IPU <-> (LVDS, HDMI, parallel) Display connections.

Contrary to some other devicetree bindings I have seen we decided not
to make the displays subnodes of the graphics unit because the (LVDS,
HDMI) encoders are outside the graphics units and also on i.MX6 there
are 2 IPUs and displays can be muxed between these IPUs.

Comments and suggestions welcome.

Sascha

8<--

DRM i.MX: Add devicetree binding documentation

Signed-off-by: Philipp Zabel 
Signed-off-by: Sascha Hauer 
---
 .../devicetree/bindings/drm/fsl-imx-drm.txt|  126 
 1 file changed, 126 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/drm/fsl-imx-drm.txt

diff --git a/Documentation/devicetree/bindings/drm/fsl-imx-drm.txt 
b/Documentation/devicetree/bindings/drm/fsl-imx-drm.txt
new file mode 100644
index 000..6766e03
--- /dev/null
+++ b/Documentation/devicetree/bindings/drm/fsl-imx-drm.txt
@@ -0,0 +1,126 @@
+Freescale i.MX IPUv3
+
+
+Required properties:
+- compatible: Should be "fsl,-ipu"
+- reg: should be register base and length as documented in the
+  datasheet
+- interrupts: Should contain sync interrupt and error interrupt,
+  in this order.
+- #crtc-cells: 1, See below
+
+example:
+
+ipu: ipu@1800 {
+   #crtc-cells = <1>;
+   compatible = "fsl,imx53-ipu";
+   reg = <0x1800 0x08000>;
+   interrupts = <11 10>;
+};
+
+Freescale i.MX LCDC controller
+==
+
+Required properties:
+- compatible: Should be "fsl,-lcdc"
+- reg: should be register base and length as documented in the
+  datasheet
+- interrupts: Should contain interrupt
+- #crtc-cells: 0, See below
+
+example:
+
+lcdc: lcdc@10021000 {
+   #crtc-cells = <0>;
+   compatible = "fsl,imx27-lcdc", "fsl,imx21-lcdc";
+   reg = <0x10021000 0x4000>;
+   interrupts = <61>;
+};
+
+Parallel display support
+
+
+Required properties:
+- compatible: Should be "fsl,imx-parallel-display"
+- crtc: the crtc this display is connected to, see below
+Optional properties:
+- interface_pix_fmt: How this display is connected to the
+  crtc. Currently supported types: "rgb24", "rgb565"
+- edid: verbatim EDID data block describing attached display.
+- ddc: phandle describing the i2c bus handling the display data
+  channel
+
+example:
+
+display@di0 {
+   compatible = "fsl,imx-parallel-display";
+   edid = [edid-data];
+   crtc = <&ipu 0>;
+   interface_pix_fmt = "rgb24";
+};
+
+LVDS display bridge (LDB)
+=
+
+Required properties:
+- compatible: Should be "fsl,-ldb"
+- channel0-crtcs, channel1-crtcs: the crtcs the ldb is connected to, see
+  below
+Optional properties:
+- channel0-edid, channel1-edid: verbatim EDID data blocks describing the
+  displays attached to channel0 and channel1.
+- channel0-ddc, channel1-ddc: phandles describing the i2c busses handling
+  the display data channels for channel0 and channel1.
+
+lvds@53fa8008 {
+   compatible = "fsl,imx6q-ldb";
+   channel0-edid = [edid-data];
+   channel1-ddc = <&i2c0>;
+   channel0-crtcs = <&ipu0 0>, <&ipu0 1>, <&ipu1 0>, <&ipu1 1>;
+   channel1-crtcs = <&ipu0 0>, <&ipu0 1>, <&ipu1 0>, <&ipu1 1>;
+};
+
+Specifying CRTCs connected to display output devices
+
+
+Display output device nodes should specify which CRTCs they can be
+connected to in their crtcs property, containing a 'crtc-list':
+
+   crtc-list ::=  [crtc-list]
+   single-crtc ::=  
+   crtc-phandle : phandle to device node providing the crtc
+   crtc-specifier : Array of #crtc-cells specifying specific crtc
+(controller specific, 1 on imx-ipuv3)
+
+In the following example, two image processing units ipu0 and ipu1
+provide two CRTCs each, indexed with a single cell. The hdmi connector
+can be connected to either CRTC of ipu1, and the lvds connector is
+fixed to the second CRTC of ipu0.
+
+   ipu0: ipu0 {
+   #crtc-cells = <1>;
+   };
+   ipu1: ipu1 {
+   #crtc-cells = <1>;
+   };
+   [...]
+   hdmi: hdmi {
+   ddc = <&i2c2>;
+   crtcs = <&ipu1 0 &ipu1 1>;
+   };
+   lvds: lvds {
+   edid = [edid-data];
+   crtcs = <&ipu0 1>;
+   };
+
+Note that the crtc-specifier length is controller dependent. A simple
+lcdc controller with a single CRTC should use #crtc-cells = <0>:
+
+   lcdc: lcdc {
+   #crtc-cells = <0>;
+   };
+   [...]
+   parallel-display {
+   crtcs = <&lcdc>
+   };
+
-- 
1.7.10

-- 
Pengutronix e.K.

[PATCH v4] scatterlist: add sg_alloc_table_from_pages function

2012-06-14 Thread Tomasz Stanislawski
This patch adds a new constructor for an sg table. The table is constructed
from an array of struct pages. All contiguous chunks of the pages are merged
into a single sg nodes. A user may provide an offset and a size of a buffer if
the buffer is not page-aligned.

The function is dedicated for DMABUF exporters which often perform conversion
from an page array to a scatterlist. Moreover the scatterlist should be
squashed in order to save memory and to speed-up the process of DMA mapping
using dma_map_sg.

The code is based on the patch 'v4l: vb2-dma-contig: add support for
scatterlist in userptr mode' and hints from Laurent Pinchart.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
Acked-by: Daniel Vetter 
Acked-by: Laurent Pinchart 
Signed-off-by: Marek Szyprowski 
CC: Andrew Morton 
---
v4:
- fix typos
- add Changelog

v3:
- use PFNs instead of page pointers to check contiguity

v2:
- rename sg_table_alloc_by_pages to sg_table_alloc_from_pages
- add some comments about error value

v1:
- initial version

---
 include/linux/scatterlist.h |4 +++
 lib/scatterlist.c   |   64 +++
 2 files changed, 68 insertions(+)

diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index ac9586d..7b600da 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -214,6 +214,10 @@ void sg_free_table(struct sg_table *);
 int __sg_alloc_table(struct sg_table *, unsigned int, unsigned int, gfp_t,
 sg_alloc_fn *);
 int sg_alloc_table(struct sg_table *, unsigned int, gfp_t);
+int sg_alloc_table_from_pages(struct sg_table *sgt,
+   struct page **pages, unsigned int n_pages,
+   unsigned long offset, unsigned long size,
+   gfp_t gfp_mask);

 size_t sg_copy_from_buffer(struct scatterlist *sgl, unsigned int nents,
   void *buf, size_t buflen);
diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 6096e89..e719adf 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -319,6 +319,70 @@ int sg_alloc_table(struct sg_table *table, unsigned int 
nents, gfp_t gfp_mask)
 EXPORT_SYMBOL(sg_alloc_table);

 /**
+ * sg_alloc_table_from_pages - Allocate and initialize an sg table from
+ *an array of pages
+ * @sgt:   The sg table header to use
+ * @pages: Pointer to an array of page pointers
+ * @n_pages:   Number of pages in the pages array
+ * @offset: Offset from start of the first page to the start of a buffer
+ * @size:   Number of valid bytes in the buffer (after offset)
+ * @gfp_mask:  GFP allocation mask
+ *
+ *  Description:
+ *Allocate and initialize an sg table from a list of pages. Contiguous
+ *ranges of the pages are squashed into a single scatterlist node. A user
+ *may provide an offset at a start and a size of valid data in a buffer
+ *specified by the page array. The returned sg table is released by
+ *sg_free_table.
+ *
+ * Returns:
+ *   0 on success, negative error on failure
+ */
+int sg_alloc_table_from_pages(struct sg_table *sgt,
+   struct page **pages, unsigned int n_pages,
+   unsigned long offset, unsigned long size,
+   gfp_t gfp_mask)
+{
+   unsigned int chunks;
+   unsigned int i;
+   unsigned int cur_page;
+   int ret;
+   struct scatterlist *s;
+
+   /* compute number of contiguous chunks */
+   chunks = 1;
+   for (i = 1; i < n_pages; ++i)
+   if (page_to_pfn(pages[i]) != page_to_pfn(pages[i - 1]) + 1)
+   ++chunks;
+
+   ret = sg_alloc_table(sgt, chunks, gfp_mask);
+   if (unlikely(ret))
+   return ret;
+
+   /* merging chunks and putting them into the scatterlist */
+   cur_page = 0;
+   for_each_sg(sgt->sgl, s, sgt->orig_nents, i) {
+   unsigned long chunk_size;
+   unsigned int j;
+
+   /* look for the end of the current chunk */
+   for (j = cur_page + 1; j < n_pages; ++j)
+   if (page_to_pfn(pages[j]) !=
+   page_to_pfn(pages[j - 1]) + 1)
+   break;
+
+   chunk_size = ((j - cur_page) << PAGE_SHIFT) - offset;
+   sg_set_page(s, pages[cur_page], min(size, chunk_size), offset);
+   size -= chunk_size;
+   offset = 0;
+   cur_page = j;
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL(sg_alloc_table_from_pages);
+
+/**
  * sg_miter_start - start mapping iteration over a sg list
  * @miter: sg mapping iter to be started
  * @sgl: sg list to iterate over
-- 
1.7.9.5
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv7 00/15] Integration of videobuf2 with dmabuf

2012-06-14 Thread Tomasz Stanislawski
Hello everyone,
This patchset adds support for DMABUF [2] importing to V4L2 stack.
The support for DMABUF exporting was moved to separate patchset
due to dependency on patches for DMA mapping redesign by
Marek Szyprowski [4]. This patchset depends on new scatterlist
constructor [5].

v7:
- support for V4L2_MEMORY_DMABUF in v4l2-compact-ioctl32.c
- cosmetic fixes to the documentation
- added importing for vmalloc because vmap support in dmabuf for 3.5
  was pull-requested
- support for dmabuf importing for VIVI
- resurrect allocation of dma-contig context
- remove reference of alloc_ctx in dma-contig buffer
- use sg_alloc_table_from_pages
- fix DMA scatterlist calls to use orig_nents instead of nents
- fix memleak in vb2_dc_sgt_foreach_page (use orig_nents instead of nents)

v6:
- fixed missing entry in v4l2_memory_names
- fixed a bug occuring after get_user_pages failure
- fixed a bug caused by using invalid vma for get_user_pages
- prepare/finish no longer call dma_sync for dmabuf buffers

v5:
- removed change of importer/exporter behaviour
- fixes vb2_dc_pages_to_sgt basing on Laurent's hints
- changed pin/unpin words to lock/unlock in Doc

v4:
- rebased on mainline 3.4-rc2
- included missing importing support for s5p-fimc and s5p-tv
- added patch for changing map/unmap for importers
- fixes to Documentation part
- coding style fixes
- pairing {map/unmap}_dmabuf in vb2-core
- fixing variable types and semantic of arguments in videobufb2-dma-contig.c

v3:
- rebased on mainline 3.4-rc1
- split 'code refactor' patch to multiple smaller patches
- squashed fixes to Sumit's patches
- patchset is no longer dependant on 'DMA mapping redesign'
- separated path for handling IO and non-IO mappings
- add documentation for DMABUF importing to V4L
- removed all DMABUF exporter related code
- removed usage of dma_get_pages extension

v2:
- extended VIDIOC_EXPBUF argument from integer memoffset to struct
  v4l2_exportbuffer
- added patch that breaks DMABUF spec on (un)map_atachment callcacks but allows
  to work with existing implementation of DMABUF prime in DRM
- all dma-contig code refactoring patches were squashed
- bugfixes

v1: List of changes since [1].
- support for DMA api extension dma_get_pages, the function is used to retrieve
  pages used to create DMA mapping.
- small fixes/code cleanup to videobuf2
- added prepare and finish callbacks to vb2 allocators, it is used keep
  consistency between dma-cpu acess to the memory (by Marek Szyprowski)
- support for exporting of DMABUF buffer in V4L2 and Videobuf2, originated from
  [3].
- support for dma-buf exporting in vb2-dma-contig allocator
- support for DMABUF for s5p-tv and s5p-fimc (capture interface) drivers,
  originated from [3]
- changed handling for userptr buffers (by Marek Szyprowski, Andrzej
  Pietrasiewicz)
- let mmap method to use dma_mmap_writecombine call (by Marek Szyprowski)

[1] 
http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/42966/focus=42968
[2] https://lkml.org/lkml/2011/12/26/29
[3] 
http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/36354/focus=36355
[4] http://thread.gmane.org/gmane.linux.kernel.cross-arch/12819
[5] http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/47983

Laurent Pinchart (2):
  v4l: vb2-dma-contig: Shorten vb2_dma_contig prefix to vb2_dc
  v4l: vb2-dma-contig: Reorder functions

Marek Szyprowski (2):
  v4l: vb2: add prepare/finish callbacks to allocators
  v4l: vb2-dma-contig: add prepare/finish to dma-contig allocator

Sumit Semwal (4):
  v4l: Add DMABUF as a memory type
  v4l: vb2: add support for shared buffer (dma_buf)
  v4l: vb: remove warnings about MEMORY_DMABUF
  v4l: vb2-dma-contig: add support for dma_buf importing

Tomasz Stanislawski (7):
  Documentation: media: description of DMABUF importing in V4L2
  v4l: vb2-dma-contig: remove reference of alloc_ctx from a buffer
  v4l: vb2-dma-contig: add support for scatterlist in userptr mode
  v4l: vb2-vmalloc: add support for dmabuf importing
  v4l: vivi: support for dmabuf importing
  v4l: s5p-tv: mixer: support for dmabuf importing
  v4l: s5p-fimc: support for dmabuf importing

 Documentation/DocBook/media/v4l/compat.xml |4 +
 Documentation/DocBook/media/v4l/io.xml |  179 
 .../DocBook/media/v4l/vidioc-create-bufs.xml   |3 +-
 Documentation/DocBook/media/v4l/vidioc-qbuf.xml|   15 +
 Documentation/DocBook/media/v4l/vidioc-reqbufs.xml |   47 +-
 drivers/media/video/Kconfig|1 +
 drivers/media/video/s5p-fimc/Kconfig   |1 +
 drivers/media/video/s5p-fimc/fimc-capture.c|2 +-
 drivers/media/video/s5p-tv/Kconfig |1 +
 drivers/media/video/s5p-tv/mixer_video.c   |2 +-
 drivers/media/video/v4l2-compat-ioctl32.c  |   16 +
 drivers/media/video/v4l2-ioctl.c   |1 +
 drivers/media/video/videobuf-core.c|4 +
 drivers/media/video/videobuf2-core

[PATCHv7 04/15] v4l: vb: remove warnings about MEMORY_DMABUF

2012-06-14 Thread Tomasz Stanislawski
From: Sumit Semwal 

Adding DMABUF memory type causes videobuf to complain about not using it
in some switch cases. This patch removes these warnings.

Signed-off-by: Sumit Semwal 
Acked-by: Laurent Pinchart 
---
 drivers/media/video/videobuf-core.c |4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/video/videobuf-core.c 
b/drivers/media/video/videobuf-core.c
index ffdf59c..3e3e55f 100644
--- a/drivers/media/video/videobuf-core.c
+++ b/drivers/media/video/videobuf-core.c
@@ -335,6 +335,9 @@ static void videobuf_status(struct videobuf_queue *q, 
struct v4l2_buffer *b,
case V4L2_MEMORY_OVERLAY:
b->m.offset  = vb->boff;
break;
+   case V4L2_MEMORY_DMABUF:
+   /* DMABUF is not handled in videobuf framework */
+   break;
}
 
b->flags= 0;
@@ -411,6 +414,7 @@ int __videobuf_mmap_setup(struct videobuf_queue *q,
break;
case V4L2_MEMORY_USERPTR:
case V4L2_MEMORY_OVERLAY:
+   case V4L2_MEMORY_DMABUF:
/* nothing */
break;
}
-- 
1.7.9.5

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


[PATCHv7 07/15] v4l: vb2-dma-contig: Reorder functions

2012-06-14 Thread Tomasz Stanislawski
From: Laurent Pinchart 

Group functions by buffer type.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/video/videobuf2-dma-contig.c |   92 
 1 file changed, 54 insertions(+), 38 deletions(-)

diff --git a/drivers/media/video/videobuf2-dma-contig.c 
b/drivers/media/video/videobuf2-dma-contig.c
index 20c95da..daac2b2 100644
--- a/drivers/media/video/videobuf2-dma-contig.c
+++ b/drivers/media/video/videobuf2-dma-contig.c
@@ -25,14 +25,56 @@ struct vb2_dc_conf {
 struct vb2_dc_buf {
struct device   *dev;
void*vaddr;
-   dma_addr_t  dma_addr;
unsigned long   size;
-   struct vm_area_struct   *vma;
-   atomic_trefcount;
+   dma_addr_t  dma_addr;
+
+   /* MMAP related */
struct vb2_vmarea_handler   handler;
+   atomic_trefcount;
+
+   /* USERPTR related */
+   struct vm_area_struct   *vma;
 };
 
-static void vb2_dc_put(void *buf_priv);
+/*/
+/* callbacks for all buffers */
+/*/
+
+static void *vb2_dc_cookie(void *buf_priv)
+{
+   struct vb2_dc_buf *buf = buf_priv;
+
+   return &buf->dma_addr;
+}
+
+static void *vb2_dc_vaddr(void *buf_priv)
+{
+   struct vb2_dc_buf *buf = buf_priv;
+
+   return buf->vaddr;
+}
+
+static unsigned int vb2_dc_num_users(void *buf_priv)
+{
+   struct vb2_dc_buf *buf = buf_priv;
+
+   return atomic_read(&buf->refcount);
+}
+
+/*/
+/*callbacks for MMAP buffers */
+/*/
+
+static void vb2_dc_put(void *buf_priv)
+{
+   struct vb2_dc_buf *buf = buf_priv;
+
+   if (!atomic_dec_and_test(&buf->refcount))
+   return;
+
+   dma_free_coherent(buf->dev, buf->size, buf->vaddr, buf->dma_addr);
+   kfree(buf);
+}
 
 static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size)
 {
@@ -63,40 +105,6 @@ static void *vb2_dc_alloc(void *alloc_ctx, unsigned long 
size)
return buf;
 }
 
-static void vb2_dc_put(void *buf_priv)
-{
-   struct vb2_dc_buf *buf = buf_priv;
-
-   if (atomic_dec_and_test(&buf->refcount)) {
-   dma_free_coherent(buf->dev, buf->size, buf->vaddr,
- buf->dma_addr);
-   kfree(buf);
-   }
-}
-
-static void *vb2_dc_cookie(void *buf_priv)
-{
-   struct vb2_dc_buf *buf = buf_priv;
-
-   return &buf->dma_addr;
-}
-
-static void *vb2_dc_vaddr(void *buf_priv)
-{
-   struct vb2_dc_buf *buf = buf_priv;
-   if (!buf)
-   return NULL;
-
-   return buf->vaddr;
-}
-
-static unsigned int vb2_dc_num_users(void *buf_priv)
-{
-   struct vb2_dc_buf *buf = buf_priv;
-
-   return atomic_read(&buf->refcount);
-}
-
 static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma)
 {
struct vb2_dc_buf *buf = buf_priv;
@@ -110,6 +118,10 @@ static int vb2_dc_mmap(void *buf_priv, struct 
vm_area_struct *vma)
  &vb2_common_vm_ops, &buf->handler);
 }
 
+/*/
+/*   callbacks for USERPTR buffers   */
+/*/
+
 static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned long vaddr,
unsigned long size, int write)
 {
@@ -148,6 +160,10 @@ static void vb2_dc_put_userptr(void *mem_priv)
kfree(buf);
 }
 
+/*/
+/*   DMA CONTIG exported functions   */
+/*/
+
 const struct vb2_mem_ops vb2_dma_contig_memops = {
.alloc  = vb2_dc_alloc,
.put= vb2_dc_put,
-- 
1.7.9.5

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


[PATCHv7 02/15] Documentation: media: description of DMABUF importing in V4L2

2012-06-14 Thread Tomasz Stanislawski
This patch adds description and usage examples for importing
DMABUF file descriptor in V4L2.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
CC: linux-...@vger.kernel.org
---
 Documentation/DocBook/media/v4l/compat.xml |4 +
 Documentation/DocBook/media/v4l/io.xml |  179 
 .../DocBook/media/v4l/vidioc-create-bufs.xml   |3 +-
 Documentation/DocBook/media/v4l/vidioc-qbuf.xml|   15 ++
 Documentation/DocBook/media/v4l/vidioc-reqbufs.xml |   47 ++---
 5 files changed, 225 insertions(+), 23 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/compat.xml 
b/Documentation/DocBook/media/v4l/compat.xml
index ea42ef8..07a311f 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -2587,6 +2587,10 @@ ioctls.
  
  V4L2_CID_AUTO_FOCUS_AREA control.
 
+
+ Importing DMABUF file descriptors as a new IO method described
+ in .
+
   
 
 
diff --git a/Documentation/DocBook/media/v4l/io.xml 
b/Documentation/DocBook/media/v4l/io.xml
index fd6aca2..f55b0ab 100644
--- a/Documentation/DocBook/media/v4l/io.xml
+++ b/Documentation/DocBook/media/v4l/io.xml
@@ -472,6 +472,162 @@ rest should be evident.
   
   
 
+  
+Streaming I/O (DMA buffer importing)
+
+
+  Experimental
+  This is an  experimental 
+  interface and may change in the future.
+
+
+The DMABUF framework provides a generic mean for sharing buffers between
+ multiple devices. Device drivers that support DMABUF can export a DMA buffer
+to userspace as a file descriptor (known as the exporter role), import a DMA
+buffer from userspace using a file descriptor previously exported for a
+different or the same device (known as the importer role), or both. This
+section describes the DMABUF importer role API in V4L2.
+
+Input and output devices support the streaming I/O method when the
+V4L2_CAP_STREAMING flag in the
+capabilities field of &v4l2-capability; returned by
+the &VIDIOC-QUERYCAP; ioctl is set. Whether importing DMA buffers through
+DMABUF file descriptors is supported is determined by calling the
+&VIDIOC-REQBUFS; ioctl with the memory type set to
+V4L2_MEMORY_DMABUF.
+
+This I/O method is dedicated for sharing DMA buffers between V4L and
+other APIs.  Buffers (planes) are allocated by a driver on behalf of the
+application, and exported to the application as file descriptors using an API
+specific to the allocator driver.  Only those file descriptor are exchanged,
+these files and meta-information are passed in &v4l2-buffer; (or in
+&v4l2-plane; in the multi-planar API case).  The driver must be switched into
+DMABUF I/O mode by calling the &VIDIOC-REQBUFS; with the desired buffer type.
+No buffers (planes) are allocated beforehand, consequently they are not indexed
+and cannot be queried like mapped buffers with the
+VIDIOC_QUERYBUF ioctl.
+
+
+  Initiating streaming I/O with DMABUF file descriptors
+
+  
+&v4l2-requestbuffers; reqbuf;
+
+memset (&reqbuf, 0, sizeof (reqbuf));
+reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+reqbuf.memory = V4L2_MEMORY_DMABUF;
+
+if (ioctl (fd, &VIDIOC-REQBUFS;, &reqbuf) == -1) {
+   if (errno == EINVAL)
+   printf ("Video capturing or DMABUF streaming is not 
supported\n");
+   else
+   perror ("VIDIOC_REQBUFS");
+
+   exit (EXIT_FAILURE);
+}
+  
+
+
+Buffer (plane) file is passed on the fly with the &VIDIOC-QBUF;
+ioctl. In case of multiplanar buffers, every plane can be associated with a
+different DMABUF descriptor.Although buffers are commonly cycled, applications
+can pass different DMABUF descriptor at each VIDIOC_QBUF
+call.
+
+
+  Queueing DMABUF using single plane API
+
+  
+int buffer_queue(int v4lfd, int index, int dmafd)
+{
+   &v4l2-buffer; buf;
+
+   memset(&buf, 0, sizeof buf);
+   buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+   buf.memory = V4L2_MEMORY_DMABUF;
+   buf.index = index;
+   buf.m.fd = dmafd;
+
+   if (ioctl (v4lfd, &VIDIOC-QBUF;, &buf) == -1) {
+   perror ("VIDIOC_QBUF");
+   return -1;
+   }
+
+   return 0;
+}
+  
+
+
+
+  Queueing DMABUF using multi plane API
+
+  
+int buffer_queue_mp(int v4lfd, int index, int dmafd[], int n_planes)
+{
+   &v4l2-buffer; buf;
+   &v4l2-plane; planes[VIDEO_MAX_PLANES];
+   int i;
+
+   memset(&buf, 0, sizeof buf);
+   buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+   buf.memory = V4L2_MEMORY_DMABUF;
+   buf.index = index;
+   buf.m.planes = planes;
+   buf.length = n_planes;
+
+   memset(&planes, 0, sizeof planes);
+
+   for (i = 0; i < n_planes; ++i)
+   buf.m.planes[i].m.fd = dmafd[i];
+
+   if (ioctl (v4lfd, &VIDIOC-QBUF;, &buf) == -1) {
+   perror ("VIDIOC_QBUF");
+   return -1;
+   }
+
+   return 0;
+}
+  

[PATCHv7 01/15] v4l: Add DMABUF as a memory type

2012-06-14 Thread Tomasz Stanislawski
From: Sumit Semwal 

Adds DMABUF memory type to v4l framework. Also adds the related file
descriptor in v4l2_plane and v4l2_buffer.

Signed-off-by: Tomasz Stanislawski 
   [original work in the PoC for buffer sharing]
Signed-off-by: Sumit Semwal 
Signed-off-by: Sumit Semwal 
Acked-by: Laurent Pinchart 
---
 drivers/media/video/v4l2-compat-ioctl32.c |   16 
 drivers/media/video/v4l2-ioctl.c  |1 +
 include/linux/videodev2.h |7 +++
 3 files changed, 24 insertions(+)

diff --git a/drivers/media/video/v4l2-compat-ioctl32.c 
b/drivers/media/video/v4l2-compat-ioctl32.c
index 5327ad3..d33ab18 100644
--- a/drivers/media/video/v4l2-compat-ioctl32.c
+++ b/drivers/media/video/v4l2-compat-ioctl32.c
@@ -348,6 +348,9 @@ static int get_v4l2_plane32(struct v4l2_plane *up, struct 
v4l2_plane32 *up32,
up_pln = compat_ptr(p);
if (put_user((unsigned long)up_pln, &up->m.userptr))
return -EFAULT;
+   } else if (memory == V4L2_MEMORY_DMABUF) {
+   if (copy_in_user(&up->m.fd, &up32->m.fd, sizeof(int)))
+   return -EFAULT;
} else {
if (copy_in_user(&up->m.mem_offset, &up32->m.mem_offset,
sizeof(__u32)))
@@ -371,6 +374,11 @@ static int put_v4l2_plane32(struct v4l2_plane *up, struct 
v4l2_plane32 *up32,
if (copy_in_user(&up32->m.mem_offset, &up->m.mem_offset,
sizeof(__u32)))
return -EFAULT;
+   /* For DMABUF, driver might've set up the fd, so copy it back. */
+   if (memory == V4L2_MEMORY_DMABUF)
+   if (copy_in_user(&up32->m.fd, &up->m.fd,
+   sizeof(int)))
+   return -EFAULT;
 
return 0;
 }
@@ -454,6 +462,10 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, 
struct v4l2_buffer32 __user
if (get_user(kp->m.offset, &up->m.offset))
return -EFAULT;
break;
+   case V4L2_MEMORY_DMABUF:
+   if (get_user(kp->m.fd, &up->m.fd))
+   return -EFAULT;
+   break;
}
}
 
@@ -518,6 +530,10 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, 
struct v4l2_buffer32 __user
if (put_user(kp->m.offset, &up->m.offset))
return -EFAULT;
break;
+   case V4L2_MEMORY_DMABUF:
+   if (put_user(kp->m.fd, &up->m.fd))
+   return -EFAULT;
+   break;
}
}
 
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 91be4e8..31fc2ad 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -175,6 +175,7 @@ static const char *v4l2_memory_names[] = {
[V4L2_MEMORY_MMAP]= "mmap",
[V4L2_MEMORY_USERPTR] = "userptr",
[V4L2_MEMORY_OVERLAY] = "overlay",
+   [V4L2_MEMORY_DMABUF] = "dmabuf",
 };
 
 #define prt_names(a, arr) a) >= 0) && ((a) < ARRAY_SIZE(arr))) ? \
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 370d111..51b20f4 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -185,6 +185,7 @@ enum v4l2_memory {
V4L2_MEMORY_MMAP = 1,
V4L2_MEMORY_USERPTR  = 2,
V4L2_MEMORY_OVERLAY  = 3,
+   V4L2_MEMORY_DMABUF   = 4,
 };
 
 /* see also http://vektor.theorem.ca/graphics/ycbcr/ */
@@ -591,6 +592,8 @@ struct v4l2_requestbuffers {
  * should be passed to mmap() called on the video node)
  * @userptr:   when memory is V4L2_MEMORY_USERPTR, a userspace pointer
  * pointing to this plane
+ * @fd:when memory is V4L2_MEMORY_DMABUF, a userspace 
file
+ * descriptor associated with this plane
  * @data_offset:   offset in the plane to the start of data; usually 0,
  * unless there is a header in front of the data
  *
@@ -605,6 +608,7 @@ struct v4l2_plane {
union {
__u32   mem_offset;
unsigned long   userptr;
+   int fd;
} m;
__u32   data_offset;
__u32   reserved[11];
@@ -629,6 +633,8 @@ struct v4l2_plane {
  * (or a "cookie" that should be passed to mmap() as offset)
  * @userptr:   for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR;
  * a userspace pointer pointing to this buffer
+ * @fd:for non-multiplanar buffers with memory == 
V4L2_MEMORY_DMABUF;
+ * a userspace file descriptor associated with this buffer
  * @planes:for multiplanar buffers; usersp

[PATCHv7 03/15] v4l: vb2: add support for shared buffer (dma_buf)

2012-06-14 Thread Tomasz Stanislawski
From: Sumit Semwal 

This patch adds support for DMABUF memory type in videobuf2. It calls relevant
APIs of dma_buf for v4l reqbuf / qbuf / dqbuf operations.

For this version, the support is for videobuf2 as a user of the shared buffer;
so the allocation of the buffer is done outside of V4L2. [A sample allocator of
dma-buf shared buffer is given at [1]]

[1]: Rob Clark's DRM:
   https://github.com/robclark/kernel-omap4/commits/drmplane-dmabuf

Signed-off-by: Tomasz Stanislawski 
   [original work in the PoC for buffer sharing]
Signed-off-by: Sumit Semwal 
Signed-off-by: Sumit Semwal 
Acked-by: Laurent Pinchart 
---
 drivers/media/video/videobuf2-core.c |  196 +-
 include/media/videobuf2-core.h   |   27 +
 2 files changed, 219 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/videobuf2-core.c 
b/drivers/media/video/videobuf2-core.c
index 9d4e9ed..f43cfa4 100644
--- a/drivers/media/video/videobuf2-core.c
+++ b/drivers/media/video/videobuf2-core.c
@@ -109,6 +109,36 @@ static void __vb2_buf_userptr_put(struct vb2_buffer *vb)
 }
 
 /**
+ * __vb2_plane_dmabuf_put() - release memory associated with
+ * a DMABUF shared plane
+ */
+static void __vb2_plane_dmabuf_put(struct vb2_queue *q, struct vb2_plane *p)
+{
+   if (!p->mem_priv)
+   return;
+
+   if (p->dbuf_mapped)
+   call_memop(q, unmap_dmabuf, p->mem_priv);
+
+   call_memop(q, detach_dmabuf, p->mem_priv);
+   dma_buf_put(p->dbuf);
+   memset(p, 0, sizeof *p);
+}
+
+/**
+ * __vb2_buf_dmabuf_put() - release memory associated with
+ * a DMABUF shared buffer
+ */
+static void __vb2_buf_dmabuf_put(struct vb2_buffer *vb)
+{
+   struct vb2_queue *q = vb->vb2_queue;
+   unsigned int plane;
+
+   for (plane = 0; plane < vb->num_planes; ++plane)
+   __vb2_plane_dmabuf_put(q, &vb->planes[plane]);
+}
+
+/**
  * __setup_offsets() - setup unique offsets ("cookies") for every plane in
  * every buffer on the queue
  */
@@ -230,6 +260,8 @@ static void __vb2_free_mem(struct vb2_queue *q, unsigned 
int buffers)
/* Free MMAP buffers or release USERPTR buffers */
if (q->memory == V4L2_MEMORY_MMAP)
__vb2_buf_mem_free(vb);
+   else if (q->memory == V4L2_MEMORY_DMABUF)
+   __vb2_buf_dmabuf_put(vb);
else
__vb2_buf_userptr_put(vb);
}
@@ -352,6 +384,12 @@ static int __fill_v4l2_buffer(struct vb2_buffer *vb, 
struct v4l2_buffer *b)
 */
memcpy(b->m.planes, vb->v4l2_planes,
b->length * sizeof(struct v4l2_plane));
+
+   if (q->memory == V4L2_MEMORY_DMABUF) {
+   unsigned int plane;
+   for (plane = 0; plane < vb->num_planes; ++plane)
+   b->m.planes[plane].m.fd = 0;
+   }
} else {
/*
 * We use length and offset in v4l2_planes array even for
@@ -363,6 +401,8 @@ static int __fill_v4l2_buffer(struct vb2_buffer *vb, struct 
v4l2_buffer *b)
b->m.offset = vb->v4l2_planes[0].m.mem_offset;
else if (q->memory == V4L2_MEMORY_USERPTR)
b->m.userptr = vb->v4l2_planes[0].m.userptr;
+   else if (q->memory == V4L2_MEMORY_DMABUF)
+   b->m.fd = 0;
}
 
/*
@@ -454,6 +494,20 @@ static int __verify_mmap_ops(struct vb2_queue *q)
 }
 
 /**
+ * __verify_dmabuf_ops() - verify that all memory operations required for
+ * DMABUF queue type have been provided
+ */
+static int __verify_dmabuf_ops(struct vb2_queue *q)
+{
+   if (!(q->io_modes & VB2_DMABUF) || !q->mem_ops->attach_dmabuf ||
+   !q->mem_ops->detach_dmabuf  || !q->mem_ops->map_dmabuf ||
+   !q->mem_ops->unmap_dmabuf)
+   return -EINVAL;
+
+   return 0;
+}
+
+/**
  * vb2_reqbufs() - Initiate streaming
  * @q: videobuf2 queue
  * @req:   struct passed from userspace to vidioc_reqbufs handler in driver
@@ -486,8 +540,9 @@ int vb2_reqbufs(struct vb2_queue *q, struct 
v4l2_requestbuffers *req)
return -EBUSY;
}
 
-   if (req->memory != V4L2_MEMORY_MMAP
-   && req->memory != V4L2_MEMORY_USERPTR) {
+   if (req->memory != V4L2_MEMORY_MMAP &&
+   req->memory != V4L2_MEMORY_DMABUF &&
+   req->memory != V4L2_MEMORY_USERPTR) {
dprintk(1, "reqbufs: unsupported memory type\n");
return -EINVAL;
}
@@ -516,6 +571,11 @@ int vb2_reqbufs(struct vb2_queue *q, struct 
v4l2_requestbuffers *req)
return -EINVAL;
}
 
+   if (req->memory == V4L2_MEMORY_DMABUF && __verify_dmabuf_ops(q)) {
+   dprintk(1, "reqbufs: DMABUF for current setup unsupported\n");
+   return -EINVAL;
+   }
+
if (req->count == 0 || q->num_buffers !

[PATCHv7 12/15] v4l: vb2-vmalloc: add support for dmabuf importing

2012-06-14 Thread Tomasz Stanislawski
This patch adds support for importing DMABUF files for
vmalloc allocator in Videobuf2.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
---
 drivers/media/video/videobuf2-vmalloc.c |   56 +++
 1 file changed, 56 insertions(+)

diff --git a/drivers/media/video/videobuf2-vmalloc.c 
b/drivers/media/video/videobuf2-vmalloc.c
index 6b5ca6c..305032f 100644
--- a/drivers/media/video/videobuf2-vmalloc.c
+++ b/drivers/media/video/videobuf2-vmalloc.c
@@ -29,6 +29,7 @@ struct vb2_vmalloc_buf {
unsigned intn_pages;
atomic_trefcount;
struct vb2_vmarea_handler   handler;
+   struct dma_buf  *dbuf;
 };
 
 static void vb2_vmalloc_put(void *buf_priv);
@@ -206,11 +207,66 @@ static int vb2_vmalloc_mmap(void *buf_priv, struct 
vm_area_struct *vma)
return 0;
 }
 
+/*/
+/*   callbacks for DMABUF buffers*/
+/*/
+
+static int vb2_vmalloc_map_dmabuf(void *mem_priv)
+{
+   struct vb2_vmalloc_buf *buf = mem_priv;
+
+   buf->vaddr = dma_buf_vmap(buf->dbuf);
+
+   return buf->vaddr ? 0 : -EFAULT;
+}
+
+static void vb2_vmalloc_unmap_dmabuf(void *mem_priv)
+{
+   struct vb2_vmalloc_buf *buf = mem_priv;
+
+   dma_buf_vunmap(buf->dbuf, buf->vaddr);
+   buf->vaddr = NULL;
+}
+
+static void vb2_vmalloc_detach_dmabuf(void *mem_priv)
+{
+   struct vb2_vmalloc_buf *buf = mem_priv;
+
+   if (buf->vaddr)
+   dma_buf_vunmap(buf->dbuf, buf->vaddr);
+
+   kfree(buf);
+}
+
+static void *vb2_vmalloc_attach_dmabuf(void *alloc_ctx, struct dma_buf *dbuf,
+   unsigned long size, int write)
+{
+   struct vb2_vmalloc_buf *buf;
+
+   if (dbuf->size < size)
+   return ERR_PTR(-EFAULT);
+
+   buf = kzalloc(sizeof *buf, GFP_KERNEL);
+   if (!buf)
+   return ERR_PTR(-ENOMEM);
+
+   buf->dbuf = dbuf;
+   buf->write = write;
+   buf->size = size;
+
+   return buf;
+}
+
+
 const struct vb2_mem_ops vb2_vmalloc_memops = {
.alloc  = vb2_vmalloc_alloc,
.put= vb2_vmalloc_put,
.get_userptr= vb2_vmalloc_get_userptr,
.put_userptr= vb2_vmalloc_put_userptr,
+   .map_dmabuf = vb2_vmalloc_map_dmabuf,
+   .unmap_dmabuf   = vb2_vmalloc_unmap_dmabuf,
+   .attach_dmabuf  = vb2_vmalloc_attach_dmabuf,
+   .detach_dmabuf  = vb2_vmalloc_detach_dmabuf,
.vaddr  = vb2_vmalloc_vaddr,
.mmap   = vb2_vmalloc_mmap,
.num_users  = vb2_vmalloc_num_users,
-- 
1.7.9.5

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


[PATCHv7 05/15] v4l: vb2-dma-contig: Shorten vb2_dma_contig prefix to vb2_dc

2012-06-14 Thread Tomasz Stanislawski
From: Laurent Pinchart 

Signed-off-by: Laurent Pinchart 
---
 drivers/media/video/videobuf2-dma-contig.c |   36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/media/video/videobuf2-dma-contig.c 
b/drivers/media/video/videobuf2-dma-contig.c
index 4b71326..a05784f 100644
--- a/drivers/media/video/videobuf2-dma-contig.c
+++ b/drivers/media/video/videobuf2-dma-contig.c
@@ -32,9 +32,9 @@ struct vb2_dc_buf {
struct vb2_vmarea_handler   handler;
 };
 
-static void vb2_dma_contig_put(void *buf_priv);
+static void vb2_dc_put(void *buf_priv);
 
-static void *vb2_dma_contig_alloc(void *alloc_ctx, unsigned long size)
+static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size)
 {
struct vb2_dc_conf *conf = alloc_ctx;
struct vb2_dc_buf *buf;
@@ -56,7 +56,7 @@ static void *vb2_dma_contig_alloc(void *alloc_ctx, unsigned 
long size)
buf->size = size;
 
buf->handler.refcount = &buf->refcount;
-   buf->handler.put = vb2_dma_contig_put;
+   buf->handler.put = vb2_dc_put;
buf->handler.arg = buf;
 
atomic_inc(&buf->refcount);
@@ -64,7 +64,7 @@ static void *vb2_dma_contig_alloc(void *alloc_ctx, unsigned 
long size)
return buf;
 }
 
-static void vb2_dma_contig_put(void *buf_priv)
+static void vb2_dc_put(void *buf_priv)
 {
struct vb2_dc_buf *buf = buf_priv;
 
@@ -75,14 +75,14 @@ static void vb2_dma_contig_put(void *buf_priv)
}
 }
 
-static void *vb2_dma_contig_cookie(void *buf_priv)
+static void *vb2_dc_cookie(void *buf_priv)
 {
struct vb2_dc_buf *buf = buf_priv;
 
return &buf->dma_addr;
 }
 
-static void *vb2_dma_contig_vaddr(void *buf_priv)
+static void *vb2_dc_vaddr(void *buf_priv)
 {
struct vb2_dc_buf *buf = buf_priv;
if (!buf)
@@ -91,14 +91,14 @@ static void *vb2_dma_contig_vaddr(void *buf_priv)
return buf->vaddr;
 }
 
-static unsigned int vb2_dma_contig_num_users(void *buf_priv)
+static unsigned int vb2_dc_num_users(void *buf_priv)
 {
struct vb2_dc_buf *buf = buf_priv;
 
return atomic_read(&buf->refcount);
 }
 
-static int vb2_dma_contig_mmap(void *buf_priv, struct vm_area_struct *vma)
+static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma)
 {
struct vb2_dc_buf *buf = buf_priv;
 
@@ -111,7 +111,7 @@ static int vb2_dma_contig_mmap(void *buf_priv, struct 
vm_area_struct *vma)
  &vb2_common_vm_ops, &buf->handler);
 }
 
-static void *vb2_dma_contig_get_userptr(void *alloc_ctx, unsigned long vaddr,
+static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned long vaddr,
unsigned long size, int write)
 {
struct vb2_dc_buf *buf;
@@ -138,7 +138,7 @@ static void *vb2_dma_contig_get_userptr(void *alloc_ctx, 
unsigned long vaddr,
return buf;
 }
 
-static void vb2_dma_contig_put_userptr(void *mem_priv)
+static void vb2_dc_put_userptr(void *mem_priv)
 {
struct vb2_dc_buf *buf = mem_priv;
 
@@ -150,14 +150,14 @@ static void vb2_dma_contig_put_userptr(void *mem_priv)
 }
 
 const struct vb2_mem_ops vb2_dma_contig_memops = {
-   .alloc  = vb2_dma_contig_alloc,
-   .put= vb2_dma_contig_put,
-   .cookie = vb2_dma_contig_cookie,
-   .vaddr  = vb2_dma_contig_vaddr,
-   .mmap   = vb2_dma_contig_mmap,
-   .get_userptr= vb2_dma_contig_get_userptr,
-   .put_userptr= vb2_dma_contig_put_userptr,
-   .num_users  = vb2_dma_contig_num_users,
+   .alloc  = vb2_dc_alloc,
+   .put= vb2_dc_put,
+   .cookie = vb2_dc_cookie,
+   .vaddr  = vb2_dc_vaddr,
+   .mmap   = vb2_dc_mmap,
+   .get_userptr= vb2_dc_get_userptr,
+   .put_userptr= vb2_dc_put_userptr,
+   .num_users  = vb2_dc_num_users,
 };
 EXPORT_SYMBOL_GPL(vb2_dma_contig_memops);
 
-- 
1.7.9.5

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


[PATCHv7 08/15] v4l: vb2-dma-contig: add support for scatterlist in userptr mode

2012-06-14 Thread Tomasz Stanislawski
This patch introduces usage of dma_map_sg to map memory behind
a userspace pointer to a device as dma-contiguous mapping.

This patch contains some of the code kindly provided by Marek Szyprowski
 and Kamil Debski  and Andrzej
Pietrasiewicz . Kind thanks for bug reports from Laurent
Pinchart  and Seung-Woo Kim
.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
Acked-by: Laurent Pinchart 
---
 drivers/media/video/videobuf2-dma-contig.c |  229 ++--
 1 file changed, 213 insertions(+), 16 deletions(-)

diff --git a/drivers/media/video/videobuf2-dma-contig.c 
b/drivers/media/video/videobuf2-dma-contig.c
index daac2b2..94f0874 100644
--- a/drivers/media/video/videobuf2-dma-contig.c
+++ b/drivers/media/video/videobuf2-dma-contig.c
@@ -11,6 +11,8 @@
  */
 
 #include 
+#include 
+#include 
 #include 
 #include 
 
@@ -27,6 +29,8 @@ struct vb2_dc_buf {
void*vaddr;
unsigned long   size;
dma_addr_t  dma_addr;
+   enum dma_data_direction dma_dir;
+   struct sg_table *dma_sgt;
 
/* MMAP related */
struct vb2_vmarea_handler   handler;
@@ -37,6 +41,44 @@ struct vb2_dc_buf {
 };
 
 /*/
+/*scatterlist table functions*/
+/*/
+
+
+static void vb2_dc_sgt_foreach_page(struct sg_table *sgt,
+   void (*cb)(struct page *pg))
+{
+   struct scatterlist *s;
+   unsigned int i;
+
+   for_each_sg(sgt->sgl, s, sgt->orig_nents, i) {
+   struct page *page = sg_page(s);
+   unsigned int n_pages = PAGE_ALIGN(s->offset + s->length)
+   >> PAGE_SHIFT;
+   unsigned int j;
+
+   for (j = 0; j < n_pages; ++j, ++page)
+   cb(page);
+   }
+}
+
+static unsigned long vb2_dc_get_contiguous_size(struct sg_table *sgt)
+{
+   struct scatterlist *s;
+   dma_addr_t expected = sg_dma_address(sgt->sgl);
+   unsigned int i;
+   unsigned long size = 0;
+
+   for_each_sg(sgt->sgl, s, sgt->nents, i) {
+   if (sg_dma_address(s) != expected)
+   break;
+   expected = sg_dma_address(s) + sg_dma_len(s);
+   size += sg_dma_len(s);
+   }
+   return size;
+}
+
+/*/
 /* callbacks for all buffers */
 /*/
 
@@ -122,42 +164,197 @@ static int vb2_dc_mmap(void *buf_priv, struct 
vm_area_struct *vma)
 /*   callbacks for USERPTR buffers   */
 /*/
 
+static inline int vma_is_io(struct vm_area_struct *vma)
+{
+   return !!(vma->vm_flags & (VM_IO | VM_PFNMAP));
+}
+
+static int vb2_dc_get_user_pages(unsigned long start, struct page **pages,
+   int n_pages, struct vm_area_struct *vma, int write)
+{
+   if (vma_is_io(vma)) {
+   unsigned int i;
+
+   for (i = 0; i < n_pages; ++i, start += PAGE_SIZE) {
+   unsigned long pfn;
+   int ret = follow_pfn(vma, start, &pfn);
+
+   if (ret) {
+   printk(KERN_ERR "no page for address %lu\n",
+   start);
+   return ret;
+   }
+   pages[i] = pfn_to_page(pfn);
+   }
+   } else {
+   int n;
+
+   n = get_user_pages(current, current->mm, start & PAGE_MASK,
+   n_pages, write, 1, pages, NULL);
+   /* negative error means that no page was pinned */
+   n = max(n, 0);
+   if (n != n_pages) {
+   printk(KERN_ERR "got only %d of %d user pages\n",
+   n, n_pages);
+   while (n)
+   put_page(pages[--n]);
+   return -EFAULT;
+   }
+   }
+
+   return 0;
+}
+
+static void vb2_dc_put_dirty_page(struct page *page)
+{
+   set_page_dirty_lock(page);
+   put_page(page);
+}
+
+static void vb2_dc_put_userptr(void *buf_priv)
+{
+   struct vb2_dc_buf *buf = buf_priv;
+   struct sg_table *sgt = buf->dma_sgt;
+
+   dma_unmap_sg(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir);
+   if (!vma_is_io(buf->vma))
+   vb2_dc_sgt_foreach_page(sgt, vb2_dc_put_dirty_page);
+
+   sg_free_table(sgt);
+   kfree(sgt);
+   vb2_put_vma(buf->vma);
+   kfree(buf);
+}
+
 static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned long vaddr,
-   unsigned long size, int write)
+   unsigned long size, int write)
 {
+   struct vb2_dc_conf *conf = alloc_ctx;
struct vb2_dc_buf *buf;
+   unsigned long start;
+   

[PATCHv7 10/15] v4l: vb2-dma-contig: add prepare/finish to dma-contig allocator

2012-06-14 Thread Tomasz Stanislawski
From: Marek Szyprowski 

Add prepare/finish callbacks to vb2-dma-contig allocator.

Signed-off-by: Marek Szyprowski 
---
 drivers/media/video/videobuf2-dma-contig.c |   24 
 1 file changed, 24 insertions(+)

diff --git a/drivers/media/video/videobuf2-dma-contig.c 
b/drivers/media/video/videobuf2-dma-contig.c
index 94f0874..f9286d7 100644
--- a/drivers/media/video/videobuf2-dma-contig.c
+++ b/drivers/media/video/videobuf2-dma-contig.c
@@ -103,6 +103,28 @@ static unsigned int vb2_dc_num_users(void *buf_priv)
return atomic_read(&buf->refcount);
 }
 
+static void vb2_dc_prepare(void *buf_priv)
+{
+   struct vb2_dc_buf *buf = buf_priv;
+   struct sg_table *sgt = buf->dma_sgt;
+
+   if (!sgt)
+   return;
+
+   dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir);
+}
+
+static void vb2_dc_finish(void *buf_priv)
+{
+   struct vb2_dc_buf *buf = buf_priv;
+   struct sg_table *sgt = buf->dma_sgt;
+
+   if (!sgt)
+   return;
+
+   dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir);
+}
+
 /*/
 /*callbacks for MMAP buffers */
 /*/
@@ -369,6 +391,8 @@ const struct vb2_mem_ops vb2_dma_contig_memops = {
.mmap   = vb2_dc_mmap,
.get_userptr= vb2_dc_get_userptr,
.put_userptr= vb2_dc_put_userptr,
+   .prepare= vb2_dc_prepare,
+   .finish = vb2_dc_finish,
.num_users  = vb2_dc_num_users,
 };
 EXPORT_SYMBOL_GPL(vb2_dma_contig_memops);
-- 
1.7.9.5

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


[PATCHv7 06/15] v4l: vb2-dma-contig: remove reference of alloc_ctx from a buffer

2012-06-14 Thread Tomasz Stanislawski
This patch removes a reference to alloc_ctx from an instance of a DMA
contiguous buffer. It helps to avoid a risk of a dangling pointer if the
context is released while the buffer is still valid. Moreover it removes one
dereference step while accessing a device structure.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
---
 drivers/media/video/videobuf2-dma-contig.c |   13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/media/video/videobuf2-dma-contig.c 
b/drivers/media/video/videobuf2-dma-contig.c
index a05784f..20c95da 100644
--- a/drivers/media/video/videobuf2-dma-contig.c
+++ b/drivers/media/video/videobuf2-dma-contig.c
@@ -23,7 +23,7 @@ struct vb2_dc_conf {
 };
 
 struct vb2_dc_buf {
-   struct vb2_dc_conf  *conf;
+   struct device   *dev;
void*vaddr;
dma_addr_t  dma_addr;
unsigned long   size;
@@ -37,22 +37,21 @@ static void vb2_dc_put(void *buf_priv);
 static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size)
 {
struct vb2_dc_conf *conf = alloc_ctx;
+   struct device *dev = conf->dev;
struct vb2_dc_buf *buf;
 
buf = kzalloc(sizeof *buf, GFP_KERNEL);
if (!buf)
return ERR_PTR(-ENOMEM);
 
-   buf->vaddr = dma_alloc_coherent(conf->dev, size, &buf->dma_addr,
-   GFP_KERNEL);
+   buf->vaddr = dma_alloc_coherent(dev, size, &buf->dma_addr, GFP_KERNEL);
if (!buf->vaddr) {
-   dev_err(conf->dev, "dma_alloc_coherent of size %ld failed\n",
-   size);
+   dev_err(dev, "dma_alloc_coherent of size %ld failed\n", size);
kfree(buf);
return ERR_PTR(-ENOMEM);
}
 
-   buf->conf = conf;
+   buf->dev = dev;
buf->size = size;
 
buf->handler.refcount = &buf->refcount;
@@ -69,7 +68,7 @@ static void vb2_dc_put(void *buf_priv)
struct vb2_dc_buf *buf = buf_priv;
 
if (atomic_dec_and_test(&buf->refcount)) {
-   dma_free_coherent(buf->conf->dev, buf->size, buf->vaddr,
+   dma_free_coherent(buf->dev, buf->size, buf->vaddr,
  buf->dma_addr);
kfree(buf);
}
-- 
1.7.9.5

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


[PATCHv7 09/15] v4l: vb2: add prepare/finish callbacks to allocators

2012-06-14 Thread Tomasz Stanislawski
From: Marek Szyprowski 

This patch adds support for prepare/finish callbacks in VB2 allocators. These
callback are used for buffer flushing.

Signed-off-by: Marek Szyprowski 
Acked-by: Laurent Pinchart 
---
 drivers/media/video/videobuf2-core.c |   11 +++
 include/media/videobuf2-core.h   |7 +++
 2 files changed, 18 insertions(+)

diff --git a/drivers/media/video/videobuf2-core.c 
b/drivers/media/video/videobuf2-core.c
index f43cfa4..d60ed25 100644
--- a/drivers/media/video/videobuf2-core.c
+++ b/drivers/media/video/videobuf2-core.c
@@ -845,6 +845,7 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum 
vb2_buffer_state state)
 {
struct vb2_queue *q = vb->vb2_queue;
unsigned long flags;
+   unsigned int plane;
 
if (vb->state != VB2_BUF_STATE_ACTIVE)
return;
@@ -855,6 +856,10 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum 
vb2_buffer_state state)
dprintk(4, "Done processing on buffer %d, state: %d\n",
vb->v4l2_buf.index, vb->state);
 
+   /* sync buffers */
+   for (plane = 0; plane < vb->num_planes; ++plane)
+   call_memop(q, finish, vb->planes[plane].mem_priv);
+
/* Add the buffer to the done buffers list */
spin_lock_irqsave(&q->done_lock, flags);
vb->state = state;
@@ -1137,9 +1142,15 @@ err:
 static void __enqueue_in_driver(struct vb2_buffer *vb)
 {
struct vb2_queue *q = vb->vb2_queue;
+   unsigned int plane;
 
vb->state = VB2_BUF_STATE_ACTIVE;
atomic_inc(&q->queued_count);
+
+   /* sync buffers */
+   for (plane = 0; plane < vb->num_planes; ++plane)
+   call_memop(q, prepare, vb->planes[plane].mem_priv);
+
q->ops->buf_queue(vb);
 }
 
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 859bbaf..d079f92 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -56,6 +56,10 @@ struct vb2_fileio_data;
  * dmabuf
  * @unmap_dmabuf: releases access control to the dmabuf - allocator is notified
  *   that this driver is done using the dmabuf for now
+ * @prepare:   called everytime the buffer is passed from userspace to the
+ * driver, usefull for cache synchronisation, optional
+ * @finish:called everytime the buffer is passed back from the driver
+ * to the userspace, also optional
  * @vaddr: return a kernel virtual address to a given memory buffer
  * associated with the passed private structure or NULL if no
  * such mapping exists
@@ -82,6 +86,9 @@ struct vb2_mem_ops {
unsigned long size, int write);
void(*put_userptr)(void *buf_priv);
 
+   void(*prepare)(void *buf_priv);
+   void(*finish)(void *buf_priv);
+
void*(*attach_dmabuf)(void *alloc_ctx, struct dma_buf *dbuf,
unsigned long size, int write);
void(*detach_dmabuf)(void *buf_priv);
-- 
1.7.9.5

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


[PATCHv7 15/15] v4l: s5p-fimc: support for dmabuf importing

2012-06-14 Thread Tomasz Stanislawski
This patch enhances s5p-fimc with support for DMABUF importing via
V4L2_MEMORY_DMABUF memory type.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
Acked-by: Sylwester Nawrocki 
---
 drivers/media/video/s5p-fimc/Kconfig|1 +
 drivers/media/video/s5p-fimc/fimc-capture.c |2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/video/s5p-fimc/Kconfig 
b/drivers/media/video/s5p-fimc/Kconfig
index a564f7e..3106026 100644
--- a/drivers/media/video/s5p-fimc/Kconfig
+++ b/drivers/media/video/s5p-fimc/Kconfig
@@ -14,6 +14,7 @@ config VIDEO_S5P_FIMC
depends on I2C
select VIDEOBUF2_DMA_CONTIG
select V4L2_MEM2MEM_DEV
+   select DMA_SHARED_BUFFER
help
  This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC camera host
  interface and video postprocessor (FIMC and FIMC-LITE) devices.
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index 3545745..cd27e33 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -1609,7 +1609,7 @@ static int fimc_register_capture_device(struct fimc_dev 
*fimc,
q = &fimc->vid_cap.vbq;
memset(q, 0, sizeof(*q));
q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
-   q->io_modes = VB2_MMAP | VB2_USERPTR;
+   q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF;
q->drv_priv = fimc->vid_cap.ctx;
q->ops = &fimc_capture_qops;
q->mem_ops = &vb2_dma_contig_memops;
-- 
1.7.9.5

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


[PATCHv7 13/15] v4l: vivi: support for dmabuf importing

2012-06-14 Thread Tomasz Stanislawski
This patch enhances VIVI driver with a support for importing a buffer
from DMABUF file descriptors.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
---
 drivers/media/video/Kconfig |1 +
 drivers/media/video/vivi.c  |2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 99937c9..9aa7306 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -630,6 +630,7 @@ config VIDEO_VIVI
depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
select FONT_8x16
select VIDEOBUF2_VMALLOC
+   select DMA_SHARED_BUFFER
default n
---help---
  Enables a virtual video driver. This device shows a color bar
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index 0960d7f..05709cd 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -1422,7 +1422,7 @@ static int __init vivi_create_instance(int inst)
q = &dev->vb_vidq;
memset(q, 0, sizeof(dev->vb_vidq));
q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-   q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ;
+   q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ;
q->drv_priv = dev;
q->buf_struct_size = sizeof(struct vivi_buffer);
q->ops = &vivi_video_qops;
-- 
1.7.9.5

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


[PATCHv7 11/15] v4l: vb2-dma-contig: add support for dma_buf importing

2012-06-14 Thread Tomasz Stanislawski
From: Sumit Semwal 

This patch makes changes for adding dma-contig as a dma_buf user. It provides
function implementations for the {attach, detach, map, unmap}_dmabuf()
mem_ops of DMABUF memory type.

Signed-off-by: Sumit Semwal 
Signed-off-by: Sumit Semwal 
[author of the original patch]
Signed-off-by: Tomasz Stanislawski 
[integration with refactored dma-contig allocator]
Acked-by: Laurent Pinchart 
---
 drivers/media/video/videobuf2-dma-contig.c |  120 +++-
 1 file changed, 118 insertions(+), 2 deletions(-)

diff --git a/drivers/media/video/videobuf2-dma-contig.c 
b/drivers/media/video/videobuf2-dma-contig.c
index f9286d7..040829b 100644
--- a/drivers/media/video/videobuf2-dma-contig.c
+++ b/drivers/media/video/videobuf2-dma-contig.c
@@ -10,6 +10,7 @@
  * the Free Software Foundation.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -38,6 +39,9 @@ struct vb2_dc_buf {
 
/* USERPTR related */
struct vm_area_struct   *vma;
+
+   /* DMABUF related */
+   struct dma_buf_attachment   *db_attach;
 };
 
 /*/
@@ -108,7 +112,8 @@ static void vb2_dc_prepare(void *buf_priv)
struct vb2_dc_buf *buf = buf_priv;
struct sg_table *sgt = buf->dma_sgt;
 
-   if (!sgt)
+   /* DMABUF exporter will flush the cache for us */
+   if (!sgt || buf->db_attach)
return;
 
dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir);
@@ -119,7 +124,8 @@ static void vb2_dc_finish(void *buf_priv)
struct vb2_dc_buf *buf = buf_priv;
struct sg_table *sgt = buf->dma_sgt;
 
-   if (!sgt)
+   /* DMABUF exporter will flush the cache for us */
+   if (!sgt || buf->db_attach)
return;
 
dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir);
@@ -380,6 +386,112 @@ fail_buf:
 }
 
 /*/
+/*   callbacks for DMABUF buffers*/
+/*/
+
+static int vb2_dc_map_dmabuf(void *mem_priv)
+{
+   struct vb2_dc_buf *buf = mem_priv;
+   struct sg_table *sgt;
+   unsigned long contig_size;
+
+   if (WARN_ON(!buf->db_attach)) {
+   printk(KERN_ERR "trying to pin a non attached buffer\n");
+   return -EINVAL;
+   }
+
+   if (WARN_ON(buf->dma_sgt)) {
+   printk(KERN_ERR "dmabuf buffer is already pinned\n");
+   return 0;
+   }
+
+   /* get the associated scatterlist for this buffer */
+   sgt = dma_buf_map_attachment(buf->db_attach, buf->dma_dir);
+   if (IS_ERR_OR_NULL(sgt)) {
+   printk(KERN_ERR "Error getting dmabuf scatterlist\n");
+   return -EINVAL;
+   }
+
+   /* checking if dmabuf is big enough to store contiguous chunk */
+   contig_size = vb2_dc_get_contiguous_size(sgt);
+   if (contig_size < buf->size) {
+   printk(KERN_ERR "contiguous chunk is too small %lu/%lu b\n",
+   contig_size, buf->size);
+   dma_buf_unmap_attachment(buf->db_attach, sgt, buf->dma_dir);
+   return -EFAULT;
+   }
+
+   buf->dma_addr = sg_dma_address(sgt->sgl);
+   buf->dma_sgt = sgt;
+
+   return 0;
+}
+
+static void vb2_dc_unmap_dmabuf(void *mem_priv)
+{
+   struct vb2_dc_buf *buf = mem_priv;
+   struct sg_table *sgt = buf->dma_sgt;
+
+   if (WARN_ON(!buf->db_attach)) {
+   printk(KERN_ERR "trying to unpin a not attached buffer\n");
+   return;
+   }
+
+   if (WARN_ON(!sgt)) {
+   printk(KERN_ERR "dmabuf buffer is already unpinned\n");
+   return;
+   }
+
+   dma_buf_unmap_attachment(buf->db_attach, sgt, buf->dma_dir);
+
+   buf->dma_addr = 0;
+   buf->dma_sgt = NULL;
+}
+
+static void vb2_dc_detach_dmabuf(void *mem_priv)
+{
+   struct vb2_dc_buf *buf = mem_priv;
+
+   /* if vb2 works correctly you should never detach mapped buffer */
+   if (WARN_ON(buf->dma_addr))
+   vb2_dc_unmap_dmabuf(buf);
+
+   /* detach this attachment */
+   dma_buf_detach(buf->db_attach->dmabuf, buf->db_attach);
+   kfree(buf);
+}
+
+static void *vb2_dc_attach_dmabuf(void *alloc_ctx, struct dma_buf *dbuf,
+   unsigned long size, int write)
+{
+   struct vb2_dc_conf *conf = alloc_ctx;
+   struct vb2_dc_buf *buf;
+   struct dma_buf_attachment *dba;
+
+   if (dbuf->size < size)
+   return ERR_PTR(-EFAULT);
+
+   buf = kzalloc(sizeof *buf, GFP_KERNEL);
+   if (!buf)
+   return ERR_PTR(-ENOMEM);
+
+   buf->dev = conf->dev;
+   /* create attachment for the dmabuf with the user device */
+   dba = dma_buf_attach(dbuf, buf->dev);
+   if (IS_ERR(dba)) {
+   printk(KERN_ERR "failed to attach dmabuf\n");
+   kfree(buf);
+   return dba;
+   }
+
+   buf->d

[PATCHv7 14/15] v4l: s5p-tv: mixer: support for dmabuf importing

2012-06-14 Thread Tomasz Stanislawski
This patch enhances s5p-tv with support for DMABUF importing via
V4L2_MEMORY_DMABUF memory type.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
---
 drivers/media/video/s5p-tv/Kconfig   |1 +
 drivers/media/video/s5p-tv/mixer_video.c |2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/video/s5p-tv/Kconfig 
b/drivers/media/video/s5p-tv/Kconfig
index f248b28..2e80126 100644
--- a/drivers/media/video/s5p-tv/Kconfig
+++ b/drivers/media/video/s5p-tv/Kconfig
@@ -10,6 +10,7 @@ config VIDEO_SAMSUNG_S5P_TV
bool "Samsung TV driver for S5P platform (experimental)"
depends on PLAT_S5P && PM_RUNTIME
depends on EXPERIMENTAL
+   select DMA_SHARED_BUFFER
default n
---help---
  Say Y here to enable selecting the TV output devices for
diff --git a/drivers/media/video/s5p-tv/mixer_video.c 
b/drivers/media/video/s5p-tv/mixer_video.c
index 33fde2a..cff974a 100644
--- a/drivers/media/video/s5p-tv/mixer_video.c
+++ b/drivers/media/video/s5p-tv/mixer_video.c
@@ -1078,7 +1078,7 @@ struct mxr_layer *mxr_base_layer_create(struct mxr_device 
*mdev,
 
layer->vb_queue = (struct vb2_queue) {
.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
-   .io_modes = VB2_MMAP | VB2_USERPTR,
+   .io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF,
.drv_priv = layer,
.buf_struct_size = sizeof(struct mxr_buffer),
.ops = &mxr_video_qops,
-- 
1.7.9.5

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


[PATCH 2/5] DRM i.MX: Add parallel display support

2012-06-14 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 drivers/gpu/drm/imx/Kconfig|4 +
 drivers/gpu/drm/imx/Makefile   |1 +
 drivers/gpu/drm/imx/imx-parallel-display.c |  255 
 3 files changed, 260 insertions(+)
 create mode 100644 drivers/gpu/drm/imx/imx-parallel-display.c

diff --git a/drivers/gpu/drm/imx/Kconfig b/drivers/gpu/drm/imx/Kconfig
index f77a605..fdd0f5d 100644
--- a/drivers/gpu/drm/imx/Kconfig
+++ b/drivers/gpu/drm/imx/Kconfig
@@ -14,3 +14,7 @@ config DRM_IMX_FB_HELPER
  The DRM framework can provide a legacy /dev/fb0 framebuffer
  for your device. This is necessary to get a framebuffer console
  and also for appplications using the legacy framebuffer API
+
+config DRM_IMX_PARALLEL_DISPLAY
+   tristate "Support for parallel displays"
+   depends on DRM_IMX
diff --git a/drivers/gpu/drm/imx/Makefile b/drivers/gpu/drm/imx/Makefile
index ff825f7..f5a793f 100644
--- a/drivers/gpu/drm/imx/Makefile
+++ b/drivers/gpu/drm/imx/Makefile
@@ -3,4 +3,5 @@ imxdrm-objs := imx-drm-core.o imx-fb.o
 
 obj-$(CONFIG_DRM_IMX) += imxdrm.o
 
+obj-$(CONFIG_DRM_IMX_PARALLEL_DISPLAY) += imx-parallel-display.o
 obj-$(CONFIG_DRM_IMX_FB_HELPER) += imx-fbdev.o
diff --git a/drivers/gpu/drm/imx/imx-parallel-display.c 
b/drivers/gpu/drm/imx/imx-parallel-display.c
new file mode 100644
index 000..9403cf1
--- /dev/null
+++ b/drivers/gpu/drm/imx/imx-parallel-display.c
@@ -0,0 +1,255 @@
+/*
+ * i.MX drm driver - parallel display implementation
+ *
+ * Copyright (C) 2012 Sascha Hauer, Pengutronix
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "imx-drm.h"
+
+#define con_to_imxpd(x) container_of(x, struct imx_parallel_display, connector)
+#define enc_to_imxpd(x) container_of(x, struct imx_parallel_display, encoder)
+
+struct imx_parallel_display {
+   struct drm_connector connector;
+   struct imx_drm_connector *imx_drm_connector;
+   struct drm_encoder encoder;
+   struct imx_drm_encoder *imx_drm_encoder;
+   struct device *dev;
+   void *edid;
+   int edid_len;
+   u32 interface_pix_fmt;
+};
+
+static enum drm_connector_status imx_pd_connector_detect(
+   struct drm_connector *connector, bool force)
+{
+   return connector_status_connected;
+}
+
+static void imx_pd_connector_destroy(struct drm_connector *connector)
+{
+   /* do not free here */
+}
+
+static int imx_pd_connector_get_modes(struct drm_connector *connector)
+{
+   struct imx_parallel_display *imxpd = con_to_imxpd(connector);
+   int ret;
+
+   if (!imxpd->edid)
+   return 0;
+
+   drm_mode_connector_update_edid_property(connector, imxpd->edid);
+   ret = drm_add_edid_modes(connector, imxpd->edid);
+   connector->display_info.raw_edid = NULL;
+
+   return ret;
+}
+
+static int imx_pd_connector_mode_valid(struct drm_connector *connector,
+ struct drm_display_mode *mode)
+{
+   return 0;
+}
+
+static struct drm_encoder *imx_pd_connector_best_encoder(
+   struct drm_connector *connector)
+{
+   struct imx_parallel_display *imxpd = con_to_imxpd(connector);
+
+   return &imxpd->encoder;
+}
+
+static void imx_pd_encoder_dpms(struct drm_encoder *encoder, int mode)
+{
+}
+
+static bool imx_pd_encoder_mode_fixup(struct drm_encoder *encoder,
+  struct drm_display_mode *mode,
+  struct drm_display_mode *adjusted_mode)
+{
+   return true;
+}
+
+static void imx_pd_encoder_prepare(struct drm_encoder *encoder)
+{
+   struct imx_parallel_display *imxpd = enc_to_imxpd(encoder);
+
+   imx_drm_crtc_panel_format(encoder->crtc, DRM_MODE_ENCODER_NONE,
+   imxpd->interface_pix_fmt);
+}
+
+static void imx_pd_encoder_commit(struct drm_encoder *encoder)
+{
+}
+
+static void imx_pd_encoder_mode_set(struct drm_encoder *encoder,
+struct drm_display_mode *mode,
+struct drm_display_mode *adjusted_mode)
+{
+}
+
+static void imx_pd_encoder_disable(struct drm_encoder *encoder)
+{
+}
+
+static void imx_pd_encoder_destroy(struct drm_encoder *encoder)
+{
+   /* do not free here */
+}
+
+static struct drm_connector_

[PATCH 3/5] DRM i.MX: Add LCDC support

2012-06-14 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 drivers/gpu/drm/imx/Kconfig |6 +
 drivers/gpu/drm/imx/Makefile|1 +
 drivers/gpu/drm/imx/imx-lcdc-crtc.c |  523 +++
 3 files changed, 530 insertions(+)
 create mode 100644 drivers/gpu/drm/imx/imx-lcdc-crtc.c

diff --git a/drivers/gpu/drm/imx/Kconfig b/drivers/gpu/drm/imx/Kconfig
index fdd0f5d..b554ecf 100644
--- a/drivers/gpu/drm/imx/Kconfig
+++ b/drivers/gpu/drm/imx/Kconfig
@@ -15,6 +15,12 @@ config DRM_IMX_FB_HELPER
  for your device. This is necessary to get a framebuffer console
  and also for appplications using the legacy framebuffer API
 
+config DRM_IMX_LCDC
+   tristate "DRM Support for Freescale i.MX1 and i.MX2"
+   depends on DRM_IMX
+   help
+ Choose this if you have a i.MX1, i.MX21, i.MX25 or i.MX27 processor.
+
 config DRM_IMX_PARALLEL_DISPLAY
tristate "Support for parallel displays"
depends on DRM_IMX
diff --git a/drivers/gpu/drm/imx/Makefile b/drivers/gpu/drm/imx/Makefile
index f5a793f..6c7dd2d 100644
--- a/drivers/gpu/drm/imx/Makefile
+++ b/drivers/gpu/drm/imx/Makefile
@@ -4,4 +4,5 @@ imxdrm-objs := imx-drm-core.o imx-fb.o
 obj-$(CONFIG_DRM_IMX) += imxdrm.o
 
 obj-$(CONFIG_DRM_IMX_PARALLEL_DISPLAY) += imx-parallel-display.o
+obj-$(CONFIG_DRM_IMX_LCDC) += imx-lcdc-crtc.o
 obj-$(CONFIG_DRM_IMX_FB_HELPER) += imx-fbdev.o
diff --git a/drivers/gpu/drm/imx/imx-lcdc-crtc.c 
b/drivers/gpu/drm/imx/imx-lcdc-crtc.c
new file mode 100644
index 000..5c72c47
--- /dev/null
+++ b/drivers/gpu/drm/imx/imx-lcdc-crtc.c
@@ -0,0 +1,523 @@
+/*
+ * i.MX LCDC crtc driver
+ *
+ * Copyright (C) 2012 Sascha Hauer, Pengutronix
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "imx-drm.h"
+
+#define LCDC_SSA   0x00
+#define LCDC_SIZE  0x04
+#define LCDC_VPW   0x08
+#define LCDC_CPOS  0x0C
+#define LCDC_LCWHB 0x10
+#define LCDC_LCHCC 0x14
+#define LCDC_PCR   0x18
+#define LCDC_HCR   0x1C
+#define LCDC_VCR   0x20
+#define LCDC_POS   0x24
+#define LCDC_LSCR1 0x28
+#define LCDC_PWMR  0x2C
+#define LCDC_DMACR 0x30
+#define LCDC_RMCR  0x34
+#define LCDC_LCDICR0x38
+#define LCDC_LIER  0x3c
+#define LCDC_LISR  0x40
+
+#define SIZE_XMAX(x)   x) >> 4) & 0x3f) << 20)
+
+#define YMAX_MASK  (cpu_is_mx1() ? 0x1ff : 0x3ff)
+#define SIZE_YMAX(y)   ((y) & YMAX_MASK)
+
+#define VPW_VPW(x) ((x) & 0x3ff)
+
+#define HCR_H_WIDTH(x) (((x) & 0x3f) << 26)
+#define HCR_H_WAIT_1(x)(((x) & 0xff) << 8)
+#define HCR_H_WAIT_2(x)((x) & 0xff)
+
+#define VCR_V_WIDTH(x) (((x) & 0x3f) << 26)
+#define VCR_V_WAIT_1(x)(((x) & 0xff) << 8)
+#define VCR_V_WAIT_2(x)((x) & 0xff)
+
+#define RMCR_LCDC_EN_MX1   (1 << 1)
+
+#define RMCR_SELF_REF  (1 << 0)
+
+#define LIER_EOF   (1 << 1)
+
+struct imx_crtc {
+   struct drm_crtc base;
+   struct imx_drm_crtc *imx_drm_crtc;
+   int di_no;
+   int enabled;
+   void __iomem*regs;
+   u32 pwmr;
+   u32 lscr1;
+   u32 dmacr;
+   u32 pcr;
+   struct clk  *clk;
+   struct device   *dev;
+   int vblank_enable;
+
+   struct drm_pending_vblank_event *page_flip_event;
+   struct drm_framebuffer  *newfb;
+};
+
+#define to_imx_crtc(x) container_of(x, struct imx_crtc, base)
+
+static void imx_crtc_load_lut(struct drm_crtc *crtc)
+{
+}
+
+#define PCR_BPIX_8 (3 << 25)
+#define PCR_BPIX_12(4 << 25)
+#define PCR_BPIX_16(5 << 25)
+#define PCR_BPIX_18(6 << 25)
+#define PCR_END_SEL(1 << 18)
+#define PCR_END_BYTE_SWAP  (1 << 17)
+
+static const char *fourcc_to_str(u32 fourcc)
+{
+   static char buf[5];
+
+   *(u32 *)buf = fourcc;
+   buf[4] = 0;
+
+   return buf;
+}
+
+static int imx_drm_crtc_set(struct drm_crtc *crtc,
+   struct drm_display_mode *mode)
+{
+   struct imx_crtc *imx_crtc = to_imx_crtc(crt

[PATCH 5/5] DRM: Add i.MX IPUv3 crtc support

2012-06-14 Thread Sascha Hauer
This adds a i.MX51/53 IPU (Image Processing Unit) KMS driver. The
driver has been tested on the i.MX51 babbage board and the i.MX53
LOCO board in different clone mode and dual head setups.

Signed-off-by: Sascha Hauer 
---
 drivers/gpu/drm/imx/Kconfig  |6 +
 drivers/gpu/drm/imx/Makefile |1 +
 drivers/gpu/drm/imx/imx-ipuv3-crtc.c |  579 ++
 3 files changed, 586 insertions(+)
 create mode 100644 drivers/gpu/drm/imx/imx-ipuv3-crtc.c

diff --git a/drivers/gpu/drm/imx/Kconfig b/drivers/gpu/drm/imx/Kconfig
index e735643..cd89c23 100644
--- a/drivers/gpu/drm/imx/Kconfig
+++ b/drivers/gpu/drm/imx/Kconfig
@@ -32,3 +32,9 @@ config DRM_IMX_IPUV3_CORE
  Choose this if you have a i.MX5/6 system and want
  to use the IPU. This option only enables IPU base
  support.
+
+config DRM_IMX_IPUV3
+   tristate "DRM Support for i.MX IPUv3"
+   depends on DRM_IMX
+   help
+ Choose this if you have a i.MX5 or i.MX6 processor.
diff --git a/drivers/gpu/drm/imx/Makefile b/drivers/gpu/drm/imx/Makefile
index 72a7e26..8006081 100644
--- a/drivers/gpu/drm/imx/Makefile
+++ b/drivers/gpu/drm/imx/Makefile
@@ -7,3 +7,4 @@ obj-$(CONFIG_DRM_IMX_PARALLEL_DISPLAY) += imx-parallel-display.o
 obj-$(CONFIG_DRM_IMX_LCDC) += imx-lcdc-crtc.o
 obj-$(CONFIG_DRM_IMX_FB_HELPER) += imx-fbdev.o
 obj-$(CONFIG_DRM_IMX_IPUV3_CORE) += ipu-v3/
+obj-$(CONFIG_DRM_IMX_IPUV3)+= imx-ipuv3-crtc.o
diff --git a/drivers/gpu/drm/imx/imx-ipuv3-crtc.c 
b/drivers/gpu/drm/imx/imx-ipuv3-crtc.c
new file mode 100644
index 000..5d7730d
--- /dev/null
+++ b/drivers/gpu/drm/imx/imx-ipuv3-crtc.c
@@ -0,0 +1,579 @@
+/*
+ * i.MX IPUv3 Graphics driver
+ *
+ * Copyright (C) 2011 Sascha Hauer, Pengutronix
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "imx-drm.h"
+
+#define DRIVER_DESC"i.MX IPUv3 Graphics"
+
+struct ipu_framebuffer {
+   struct drm_framebuffer  base;
+   void*virt;
+   dma_addr_t  phys;
+   size_t  len;
+};
+
+struct ipu_crtc {
+   struct drm_fb_helperfb_helper;
+   struct ipu_framebuffer  ifb;
+   int num_crtcs;
+   struct device   *dev;
+   struct drm_crtc base;
+   struct imx_drm_crtc *imx_crtc;
+   struct ipuv3_channel*ipu_ch;
+   struct ipu_dc   *dc;
+   struct ipu_dp   *dp;
+   struct dmfc_channel *dmfc;
+   struct ipu_di   *di;
+   int enabled;
+   struct ipu_priv *ipu_priv;
+   struct drm_pending_vblank_event *page_flip_event;
+   struct drm_framebuffer  *newfb;
+   int irq;
+   u32 interface_pix_fmt;
+   unsigned long   di_clkflags;
+};
+
+#define to_ipu_crtc(x) container_of(x, struct ipu_crtc, base)
+
+static int calc_vref(struct drm_display_mode *mode)
+{
+   unsigned long htotal, vtotal;
+
+   htotal = mode->htotal;
+   vtotal = mode->vtotal;
+
+   if (!htotal || !vtotal)
+   return 60;
+
+   return mode->clock * 1000 / vtotal / htotal;
+}
+
+static int calc_bandwidth(struct drm_display_mode *mode, unsigned int vref)
+{
+   return mode->hdisplay * mode->vdisplay * vref;
+}
+
+static void ipu_fb_enable(struct ipu_crtc *ipu_crtc)
+{
+   if (ipu_crtc->enabled)
+   return;
+
+   ipu_di_enable(ipu_crtc->di);
+   ipu_dmfc_enable_channel(ipu_crtc->dmfc);
+   ipu_idmac_enable_channel(ipu_crtc->ipu_ch);
+   ipu_dc_enable_channel(ipu_crtc->dc);
+   if (ipu_crtc->dp)
+   ipu_dp_enable_channel(ipu_crtc->dp);
+
+   ipu_crtc->enabled = 1;
+}
+
+static void ipu_fb_disable(struct ipu_crtc *ipu_crtc)
+{
+   if (!ipu_crtc->enabled)
+   return;
+
+   if (ipu_crtc->dp)
+   ipu_dp_disable_channel(ipu_crtc->dp);
+   ipu_dc_disable_channel(ipu_crtc->dc);
+   ipu_idmac_disable_channel(ipu_crtc->ipu_ch);
+   ipu_dmfc_disable_channel(ipu_crtc->dmfc);
+   ipu_di_disable(ipu_crtc->di);
+
+   ipu_crtc->enabled = 0;
+}
+
+static voi

[PATCH 1/5] DRM: Add i.MX drm core support

2012-06-14 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 drivers/gpu/drm/Kconfig|2 +
 drivers/gpu/drm/Makefile   |1 +
 drivers/gpu/drm/imx/Kconfig|   16 +
 drivers/gpu/drm/imx/Makefile   |6 +
 drivers/gpu/drm/imx/imx-drm-core.c |  891 
 drivers/gpu/drm/imx/imx-drm.h  |   58 +++
 drivers/gpu/drm/imx/imx-fb.c   |   47 ++
 drivers/gpu/drm/imx/imx-fbdev.c|   65 +++
 8 files changed, 1086 insertions(+)
 create mode 100644 drivers/gpu/drm/imx/Kconfig
 create mode 100644 drivers/gpu/drm/imx/Makefile
 create mode 100644 drivers/gpu/drm/imx/imx-drm-core.c
 create mode 100644 drivers/gpu/drm/imx/imx-drm.h
 create mode 100644 drivers/gpu/drm/imx/imx-fb.c
 create mode 100644 drivers/gpu/drm/imx/imx-fbdev.c

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 23120c0..dc5df12 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -192,3 +192,5 @@ source "drivers/gpu/drm/ast/Kconfig"
 source "drivers/gpu/drm/mgag200/Kconfig"
 
 source "drivers/gpu/drm/cirrus/Kconfig"
+
+source "drivers/gpu/drm/imx/Kconfig"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index f65f65e..0487ff6 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -45,4 +45,5 @@ obj-$(CONFIG_DRM_EXYNOS) +=exynos/
 obj-$(CONFIG_DRM_GMA500) += gma500/
 obj-$(CONFIG_DRM_UDL) += udl/
 obj-$(CONFIG_DRM_AST) += ast/
+obj-$(CONFIG_DRM_IMX) += imx/
 obj-y  += i2c/
diff --git a/drivers/gpu/drm/imx/Kconfig b/drivers/gpu/drm/imx/Kconfig
new file mode 100644
index 000..f77a605
--- /dev/null
+++ b/drivers/gpu/drm/imx/Kconfig
@@ -0,0 +1,16 @@
+config DRM_IMX
+   tristate "DRM Support for Freescale i.MX"
+   select DRM_KMS_HELPER
+   select DRM_GEM_CMA_HELPER
+   depends on DRM && ARCH_MXC
+   help
+ enable i.MX graphics support
+
+config DRM_IMX_FB_HELPER
+   tristate "provide legacy framebuffer /dev/fb0"
+   select DRM_KMS_CMA_HELPER
+   depends on DRM_IMX
+   help
+ The DRM framework can provide a legacy /dev/fb0 framebuffer
+ for your device. This is necessary to get a framebuffer console
+ and also for appplications using the legacy framebuffer API
diff --git a/drivers/gpu/drm/imx/Makefile b/drivers/gpu/drm/imx/Makefile
new file mode 100644
index 000..ff825f7
--- /dev/null
+++ b/drivers/gpu/drm/imx/Makefile
@@ -0,0 +1,6 @@
+
+imxdrm-objs := imx-drm-core.o imx-fb.o
+
+obj-$(CONFIG_DRM_IMX) += imxdrm.o
+
+obj-$(CONFIG_DRM_IMX_FB_HELPER) += imx-fbdev.o
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c 
b/drivers/gpu/drm/imx/imx-drm-core.c
new file mode 100644
index 000..d8f9dcd
--- /dev/null
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -0,0 +1,891 @@
+/*
+ * Freescale i.MX drm driver
+ *
+ * Copyright (C) 2011 Sascha Hauer, Pengutronix
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "imx-drm.h"
+
+#define MAX_CRTC   4
+
+struct crtc_cookie {
+   void *cookie;
+   int id;
+   struct list_head list;
+};
+
+struct imx_drm_device {
+   struct drm_device   *drm;
+   struct device   *dev;
+   struct list_headcrtc_list;
+   struct list_headencoder_list;
+   struct list_headconnector_list;
+   struct mutexmutex;
+   int references;
+   int pipes;
+   struct drm_fbdev_cma*fbhelper;
+};
+
+struct imx_drm_crtc {
+   struct drm_crtc *crtc;
+   struct list_headlist;
+   struct imx_drm_device   *imxdrm;
+   int pipe;
+   struct imx_drm_crtc_helper_funcsimx_drm_helper_funcs;
+   struct module   *owner;
+   struct crtc_cookie  cookie;
+};
+
+struct imx_drm_encoder {
+   struct drm_encoder  *encoder;
+   struct list_headlist;
+   struct module   *owner;
+   struct list_headpossible_crtcs;
+};
+
+struct imx_drm_connector {
+   struct drm_connector*connector;
+   struct list_head  

[PATCH, RFC] i.MX DRM support

2012-06-14 Thread Sascha Hauer
Hi All,

The following is the state-of-the-art i.MX IPU (Image Processing Unit)
DRM support.

This code is around for quite some time now and has been posted several
times with different APIs, first with plain old framebuffer support, now
DRM, first platform device binding, now devicetree. Unfortunately there's
quite much code needed to get something useful out of the IPU, so these
patches haven't received a lot of attention from people not involved in
i.MX. I think we have now come to a point where this code needs more public
exposure and where it's easier to talk in incremental changes instead of
blobs. Therefore I request this to go to staging for some cycles. This
would allow us to have something in mainline as a base for further discussion
while still being able to change bigger amounts of the driver without breaking
officially supported features. What do you think about this?

The IPU driver generally works on i.MX51, i.MX53 and i.MX6. The latter has
two IPUs, the driver is able to handle them both.

This series only contains the IPU driver. There are some additional glue
code patches necessary. Also necessary are two drm CMA/GEM helper patches
currently waiting for review on dri-devel. For testing the driver please
use this branch:

git://git.pengutronix.de/git/imx/linux-2.6.git work/gpu/imx-drm-ipu-complete

The branch contains board support for the i.MX51 babbage (both digital and
analog DVI outputs are supported) and i.MX6q armadillo2 (HDMI). Compile
with imx_v6_v7_defconfig.

For discussion of the devicetree binding please refer to the seperate mail
I sent.

As usual, all comments/suggestions welcome

Sascha


The following changes since commit cfaf025112d3856637ff34a767ef785ef5cf2ca9:

  Linux 3.5-rc2 (2012-06-08 18:40:09 -0700)

are available in the git repository at:

  git://git.pengutronix.de/git/imx/linux-2.6.git work/gpu/imx-drm-ipu

for you to fetch changes up to 6c25e018285a93053daa69786faa8b3fe43597be:

  DRM i.MX: Add devicetree binding documentation (2012-06-14 14:30:52 +0200)


Philipp Zabel (1):
  DRM i.MX: Add devicetree binding documentation

Sascha Hauer (5):
  DRM: Add i.MX drm core support
  DRM i.MX: Add parallel display support
  DRM i.MX: Add LCDC support
  DRM: add i.MX IPUv3 base driver
  DRM: Add i.MX IPUv3 crtc support

 .../devicetree/bindings/drm/fsl-imx-drm.txt|  126 +++
 drivers/gpu/drm/Kconfig|2 +
 drivers/gpu/drm/Makefile   |1 +
 drivers/gpu/drm/imx/Kconfig|   40 +
 drivers/gpu/drm/imx/Makefile   |   10 +
 drivers/gpu/drm/imx/imx-drm-core.c |  891 
 drivers/gpu/drm/imx/imx-drm.h  |   58 +
 drivers/gpu/drm/imx/imx-fb.c   |   47 +
 drivers/gpu/drm/imx/imx-fbdev.c|   65 ++
 drivers/gpu/drm/imx/imx-ipuv3-crtc.c   |  579 ++
 drivers/gpu/drm/imx/imx-lcdc-crtc.c|  523 +
 drivers/gpu/drm/imx/imx-parallel-display.c |  255 +
 drivers/gpu/drm/imx/ipu-v3/Makefile|3 +
 drivers/gpu/drm/imx/ipu-v3/ipu-common.c|  
 drivers/gpu/drm/imx/ipu-v3/ipu-dc.c|  384 +++
 drivers/gpu/drm/imx/ipu-v3/ipu-di.c|  695 
 drivers/gpu/drm/imx/ipu-v3/ipu-dmfc.c  |  410 
 drivers/gpu/drm/imx/ipu-v3/ipu-dp.c|  336 ++
 drivers/gpu/drm/imx/ipu-v3/ipu-prv.h   |  211 
 include/drm/imx-ipu-v3.h   |  320 ++
 20 files changed, 6067 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/drm/fsl-imx-drm.txt
 create mode 100644 drivers/gpu/drm/imx/Kconfig
 create mode 100644 drivers/gpu/drm/imx/Makefile
 create mode 100644 drivers/gpu/drm/imx/imx-drm-core.c
 create mode 100644 drivers/gpu/drm/imx/imx-drm.h
 create mode 100644 drivers/gpu/drm/imx/imx-fb.c
 create mode 100644 drivers/gpu/drm/imx/imx-fbdev.c
 create mode 100644 drivers/gpu/drm/imx/imx-ipuv3-crtc.c
 create mode 100644 drivers/gpu/drm/imx/imx-lcdc-crtc.c
 create mode 100644 drivers/gpu/drm/imx/imx-parallel-display.c
 create mode 100644 drivers/gpu/drm/imx/ipu-v3/Makefile
 create mode 100644 drivers/gpu/drm/imx/ipu-v3/ipu-common.c
 create mode 100644 drivers/gpu/drm/imx/ipu-v3/ipu-dc.c
 create mode 100644 drivers/gpu/drm/imx/ipu-v3/ipu-di.c
 create mode 100644 drivers/gpu/drm/imx/ipu-v3/ipu-dmfc.c
 create mode 100644 drivers/gpu/drm/imx/ipu-v3/ipu-dp.c
 create mode 100644 drivers/gpu/drm/imx/ipu-v3/ipu-prv.h
 create mode 100644 include/drm/imx-ipu-v3.h
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


drm-next radeon patches

2012-06-14 Thread Christian König
Hi Dave,

please apply the following nine patches to drm-next.

Just a few minor improvements to drm/radeon. They are on the list for quite a 
while now, and I finally found the time to test them to an extend that I can 
confirm they are working properly.

Regards,
Christian.

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


[PATCH 1/9] drm/radeon: remove radeon_fence_create

2012-06-14 Thread Christian König
It is completely unnecessary to create fences
before they are emitted, so remove it and a bunch
of checks if fences are emitted or not.

Signed-off-by: Christian König 
Reviewed-by: Jerome Glisse 
---
 drivers/gpu/drm/radeon/evergreen.c|2 +-
 drivers/gpu/drm/radeon/ni.c   |2 +-
 drivers/gpu/drm/radeon/r100.c |4 +-
 drivers/gpu/drm/radeon/r200.c |4 +-
 drivers/gpu/drm/radeon/r600.c |4 +-
 drivers/gpu/drm/radeon/r600_blit_kms.c|6 +--
 drivers/gpu/drm/radeon/radeon.h   |   11 +++--
 drivers/gpu/drm/radeon/radeon_asic.h  |8 ++--
 drivers/gpu/drm/radeon/radeon_benchmark.c |   10 +
 drivers/gpu/drm/radeon/radeon_fence.c |   42 ++
 drivers/gpu/drm/radeon/radeon_ring.c  |   19 +
 drivers/gpu/drm/radeon/radeon_sa.c|2 +-
 drivers/gpu/drm/radeon/radeon_test.c  |   66 -
 drivers/gpu/drm/radeon/radeon_ttm.c   |   30 +
 drivers/gpu/drm/radeon/si.c   |6 +--
 15 files changed, 86 insertions(+), 130 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen.c 
b/drivers/gpu/drm/radeon/evergreen.c
index 58991af..dd3cea4 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -1366,7 +1366,7 @@ void evergreen_mc_program(struct radeon_device *rdev)
  */
 void evergreen_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib 
*ib)
 {
-   struct radeon_ring *ring = &rdev->ring[ib->fence->ring];
+   struct radeon_ring *ring = &rdev->ring[ib->ring];
 
/* set to DX10/11 mode */
radeon_ring_write(ring, PACKET3(PACKET3_MODE_CONTROL, 0));
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index b01c2dd..9d9f5ac 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -1127,7 +1127,7 @@ void cayman_fence_ring_emit(struct radeon_device *rdev,
 
 void cayman_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib)
 {
-   struct radeon_ring *ring = &rdev->ring[ib->fence->ring];
+   struct radeon_ring *ring = &rdev->ring[ib->ring];
 
/* set to DX10/11 mode */
radeon_ring_write(ring, PACKET3(PACKET3_MODE_CONTROL, 0));
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index fb44e7e..415b7d8 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -883,7 +883,7 @@ int r100_copy_blit(struct radeon_device *rdev,
   uint64_t src_offset,
   uint64_t dst_offset,
   unsigned num_gpu_pages,
-  struct radeon_fence *fence)
+  struct radeon_fence **fence)
 {
struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX];
uint32_t cur_pages;
@@ -947,7 +947,7 @@ int r100_copy_blit(struct radeon_device *rdev,
  RADEON_WAIT_HOST_IDLECLEAN |
  RADEON_WAIT_DMA_GUI_IDLE);
if (fence) {
-   r = radeon_fence_emit(rdev, fence);
+   r = radeon_fence_emit(rdev, fence, RADEON_RING_TYPE_GFX_INDEX);
}
radeon_ring_unlock_commit(rdev, ring);
return r;
diff --git a/drivers/gpu/drm/radeon/r200.c b/drivers/gpu/drm/radeon/r200.c
index a26144d..f088925 100644
--- a/drivers/gpu/drm/radeon/r200.c
+++ b/drivers/gpu/drm/radeon/r200.c
@@ -85,7 +85,7 @@ int r200_copy_dma(struct radeon_device *rdev,
  uint64_t src_offset,
  uint64_t dst_offset,
  unsigned num_gpu_pages,
- struct radeon_fence *fence)
+ struct radeon_fence **fence)
 {
struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX];
uint32_t size;
@@ -120,7 +120,7 @@ int r200_copy_dma(struct radeon_device *rdev,
radeon_ring_write(ring, PACKET0(RADEON_WAIT_UNTIL, 0));
radeon_ring_write(ring, RADEON_WAIT_DMA_GUI_IDLE);
if (fence) {
-   r = radeon_fence_emit(rdev, fence);
+   r = radeon_fence_emit(rdev, fence, RADEON_RING_TYPE_GFX_INDEX);
}
radeon_ring_unlock_commit(rdev, ring);
return r;
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index f388a1d..e5279f9 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -2369,7 +2369,7 @@ int r600_copy_blit(struct radeon_device *rdev,
   uint64_t src_offset,
   uint64_t dst_offset,
   unsigned num_gpu_pages,
-  struct radeon_fence *fence)
+  struct radeon_fence **fence)
 {
struct radeon_sa_bo *vb = NULL;
int r;
@@ -2670,7 +2670,7 @@ void r600_fini(struct radeon_device *rdev)
  */
 void r600_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib)
 {
-   struct radeon_ring *ring = &rdev->ring[ib->fence->ring];
+   struct radeon_ring *ring = &rdev->ring[

[PATCH 2/9] drm/radeon: add infrastructure for advanced ring synchronization v2

2012-06-14 Thread Christian König
v2: BUG_ON not matching rings.

Signed-off-by: Christian König 
Reviewed-by: Jerome Glisse 
---
 drivers/gpu/drm/radeon/radeon.h   |   25 ++-
 drivers/gpu/drm/radeon/radeon_fence.c |   73 +
 2 files changed, 87 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 5e259b4..ef132eb 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -257,8 +257,8 @@ struct radeon_fence_driver {
uint32_tscratch_reg;
uint64_tgpu_addr;
volatile uint32_t   *cpu_addr;
-   /* seq is protected by ring emission lock */
-   uint64_tseq;
+   /* sync_seq is protected by ring emission lock */
+   uint64_tsync_seq[RADEON_NUM_RINGS];
atomic64_t  last_seq;
unsigned long   last_activity;
boolinitialized;
@@ -288,6 +288,27 @@ int radeon_fence_wait_any(struct radeon_device *rdev,
 struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence);
 void radeon_fence_unref(struct radeon_fence **fence);
 unsigned radeon_fence_count_emitted(struct radeon_device *rdev, int ring);
+bool radeon_fence_need_sync(struct radeon_fence *fence, int ring);
+void radeon_fence_note_sync(struct radeon_fence *fence, int ring);
+static inline struct radeon_fence *radeon_fence_later(struct radeon_fence *a,
+ struct radeon_fence *b)
+{
+   if (!a) {
+   return b;
+   }
+
+   if (!b) {
+   return a;
+   }
+
+   BUG_ON(a->ring != b->ring);
+
+   if (a->seq > b->seq) {
+   return a;
+   } else {
+   return b;
+   }
+}
 
 /*
  * Tiling registers
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c 
b/drivers/gpu/drm/radeon/radeon_fence.c
index 401d346..7b55625 100644
--- a/drivers/gpu/drm/radeon/radeon_fence.c
+++ b/drivers/gpu/drm/radeon/radeon_fence.c
@@ -72,7 +72,7 @@ int radeon_fence_emit(struct radeon_device *rdev,
}
kref_init(&((*fence)->kref));
(*fence)->rdev = rdev;
-   (*fence)->seq = ++rdev->fence_drv[ring].seq;
+   (*fence)->seq = ++rdev->fence_drv[ring].sync_seq[ring];
(*fence)->ring = ring;
radeon_fence_ring_emit(rdev, ring, *fence);
trace_radeon_fence_emit(rdev->ddev, (*fence)->seq);
@@ -449,7 +449,7 @@ int radeon_fence_wait_next_locked(struct radeon_device 
*rdev, int ring)
 * wait.
 */
seq = atomic64_read(&rdev->fence_drv[ring].last_seq) + 1ULL;
-   if (seq >= rdev->fence_drv[ring].seq) {
+   if (seq >= rdev->fence_drv[ring].sync_seq[ring]) {
/* nothing to wait for, last_seq is
   already the last emited fence */
return -ENOENT;
@@ -464,7 +464,7 @@ int radeon_fence_wait_empty_locked(struct radeon_device 
*rdev, int ring)
 * activity can be scheduled so there won't be concurrent access
 * to seq value.
 */
-   return radeon_fence_wait_seq(rdev, rdev->fence_drv[ring].seq,
+   return radeon_fence_wait_seq(rdev, rdev->fence_drv[ring].sync_seq[ring],
 ring, false, false);
 }
 
@@ -492,7 +492,8 @@ unsigned radeon_fence_count_emitted(struct radeon_device 
*rdev, int ring)
 * but it's ok to report slightly wrong fence count here.
 */
radeon_fence_process(rdev, ring);
-   emitted = rdev->fence_drv[ring].seq - 
atomic64_read(&rdev->fence_drv[ring].last_seq);
+   emitted = rdev->fence_drv[ring].sync_seq[ring]
+   - atomic64_read(&rdev->fence_drv[ring].last_seq);
/* to avoid 32bits warp around */
if (emitted > 0x1000) {
emitted = 0x1000;
@@ -500,6 +501,51 @@ unsigned radeon_fence_count_emitted(struct radeon_device 
*rdev, int ring)
return (unsigned)emitted;
 }
 
+bool radeon_fence_need_sync(struct radeon_fence *fence, int dst_ring)
+{
+   struct radeon_fence_driver *fdrv;
+
+   if (!fence) {
+   return false;
+   }
+
+   if (fence->ring == dst_ring) {
+   return false;
+   }
+
+   /* we are protected by the ring mutex */
+   fdrv = &fence->rdev->fence_drv[dst_ring];
+   if (fence->seq <= fdrv->sync_seq[fence->ring]) {
+   return false;
+   }
+
+   return true;
+}
+
+void radeon_fence_note_sync(struct radeon_fence *fence, int dst_ring)
+{
+   struct radeon_fence_driver *dst, *src;
+   unsigned i;
+
+   if (!fence) {
+   return;
+   }
+
+   if (fence->ring == dst_ring) {
+   return;
+   }
+
+   /* we are protected by the ring mutex */
+   src = &fence->rdev->fence_drv[fence->ring];
+   dst = &fence->rdev->fence_drv[dst_ring];
+   for (i = 0

[PATCH 3/9] drm/radeon: rework ring syncing code

2012-06-14 Thread Christian König
Move inter ring syncing with semaphores into the
existing ring allocations, with that we need to
lock the ring mutex only once.

Signed-off-by: Christian König 
Reviewed-by: Jerome Glisse 
---
 drivers/gpu/drm/radeon/evergreen_blit_kms.c |3 +-
 drivers/gpu/drm/radeon/r600.c   |5 +-
 drivers/gpu/drm/radeon/r600_blit_kms.c  |   24 +++--
 drivers/gpu/drm/radeon/radeon.h |6 +--
 drivers/gpu/drm/radeon/radeon_asic.h|5 +-
 drivers/gpu/drm/radeon/radeon_cs.c  |   38 +++---
 drivers/gpu/drm/radeon/radeon_ring.c|   30 +--
 drivers/gpu/drm/radeon/radeon_semaphore.c   |   71 ++-
 drivers/gpu/drm/radeon/radeon_test.c|6 +--
 drivers/gpu/drm/radeon/radeon_ttm.c |   20 
 10 files changed, 92 insertions(+), 116 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen_blit_kms.c 
b/drivers/gpu/drm/radeon/evergreen_blit_kms.c
index 1e96bd4..e512560 100644
--- a/drivers/gpu/drm/radeon/evergreen_blit_kms.c
+++ b/drivers/gpu/drm/radeon/evergreen_blit_kms.c
@@ -622,7 +622,8 @@ int evergreen_blit_init(struct radeon_device *rdev)
rdev->r600_blit.primitives.draw_auto = draw_auto;
rdev->r600_blit.primitives.set_default_state = set_default_state;
 
-   rdev->r600_blit.ring_size_common = 55; /* shaders + def state */
+   rdev->r600_blit.ring_size_common = 8; /* sync semaphore */
+   rdev->r600_blit.ring_size_common += 55; /* shaders + def state */
rdev->r600_blit.ring_size_common += 16; /* fence emit for VB IB */
rdev->r600_blit.ring_size_common += 5; /* done copy */
rdev->r600_blit.ring_size_common += 16; /* fence emit for done copy */
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index e5279f9..a8d8c44 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -2371,15 +2371,16 @@ int r600_copy_blit(struct radeon_device *rdev,
   unsigned num_gpu_pages,
   struct radeon_fence **fence)
 {
+   struct radeon_semaphore *sem = NULL;
struct radeon_sa_bo *vb = NULL;
int r;
 
-   r = r600_blit_prepare_copy(rdev, num_gpu_pages, &vb);
+   r = r600_blit_prepare_copy(rdev, num_gpu_pages, fence, &vb, &sem);
if (r) {
return r;
}
r600_kms_blit_copy(rdev, src_offset, dst_offset, num_gpu_pages, vb);
-   r600_blit_done_copy(rdev, fence, vb);
+   r600_blit_done_copy(rdev, fence, vb, sem);
return 0;
 }
 
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c 
b/drivers/gpu/drm/radeon/r600_blit_kms.c
index 02f4eeb..2b8d641 100644
--- a/drivers/gpu/drm/radeon/r600_blit_kms.c
+++ b/drivers/gpu/drm/radeon/r600_blit_kms.c
@@ -512,7 +512,8 @@ int r600_blit_init(struct radeon_device *rdev)
rdev->r600_blit.primitives.draw_auto = draw_auto;
rdev->r600_blit.primitives.set_default_state = set_default_state;
 
-   rdev->r600_blit.ring_size_common = 40; /* shaders + def state */
+   rdev->r600_blit.ring_size_common = 8; /* sync semaphore */
+   rdev->r600_blit.ring_size_common += 40; /* shaders + def state */
rdev->r600_blit.ring_size_common += 5; /* done copy */
rdev->r600_blit.ring_size_common += 16; /* fence emit for done copy */
 
@@ -666,7 +667,8 @@ static unsigned r600_blit_create_rect(unsigned 
num_gpu_pages,
 
 
 int r600_blit_prepare_copy(struct radeon_device *rdev, unsigned num_gpu_pages,
-  struct radeon_sa_bo **vb)
+  struct radeon_fence **fence, struct radeon_sa_bo 
**vb,
+  struct radeon_semaphore **sem)
 {
struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX];
int r;
@@ -689,22 +691,37 @@ int r600_blit_prepare_copy(struct radeon_device *rdev, 
unsigned num_gpu_pages,
return r;
}
 
+   r = radeon_semaphore_create(rdev, sem);
+   if (r) {
+   radeon_sa_bo_free(rdev, vb, NULL);
+   return r;
+   }
+
/* calculate number of loops correctly */
ring_size = num_loops * dwords_per_loop;
ring_size += rdev->r600_blit.ring_size_common;
r = radeon_ring_lock(rdev, ring, ring_size);
if (r) {
radeon_sa_bo_free(rdev, vb, NULL);
+   radeon_semaphore_free(rdev, sem, NULL);
return r;
}
 
+   if (radeon_fence_need_sync(*fence, RADEON_RING_TYPE_GFX_INDEX)) {
+   radeon_semaphore_sync_rings(rdev, *sem, (*fence)->ring,
+   RADEON_RING_TYPE_GFX_INDEX);
+   radeon_fence_note_sync(*fence, RADEON_RING_TYPE_GFX_INDEX);
+   } else {
+   radeon_semaphore_free(rdev, sem, NULL);
+   }
+
rdev->r600_blit.primitives.set_default_state(rdev);
rdev->r600_blit.primitives.set_shaders(rdev);
return 0;
 }
 
 void r600_blit_done_copy(stru

[PATCH 4/9] drm/radeon: replace vmram_mutex with mclk_lock v2

2012-06-14 Thread Christian König
It is a rw_semaphore now and only write locked
while changing the clock. Also the lock is renamed
to better reflect what it is protecting.

v2: Keep the ttm_vm_ops on IGPs

Signed-off-by: Christian König 
Reviewed-by: Jerome Glisse 
---
 drivers/gpu/drm/radeon/radeon.h|3 ++-
 drivers/gpu/drm/radeon/radeon_device.c |2 +-
 drivers/gpu/drm/radeon/radeon_object.c |8 
 drivers/gpu/drm/radeon/radeon_pm.c |4 ++--
 drivers/gpu/drm/radeon/radeon_ttm.c|4 ++--
 5 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 0257ed4..af57d1f 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1057,6 +1057,8 @@ struct radeon_power_state {
 
 struct radeon_pm {
struct mutexmutex;
+   /* write locked while reprogramming mclk */
+   struct rw_semaphore mclk_lock;
u32 active_crtcs;
int active_crtc_count;
int req_vblank;
@@ -1553,7 +1555,6 @@ struct radeon_device {
struct work_struct audio_work;
int num_crtc; /* number of crtcs */
struct mutex dc_hw_i2c_mutex; /* display controller hw i2c mutex */
-   struct mutex vram_mutex;
bool audio_enabled;
struct r600_audio audio_status; /* audio stuff */
struct notifier_block acpi_nb;
diff --git a/drivers/gpu/drm/radeon/radeon_device.c 
b/drivers/gpu/drm/radeon/radeon_device.c
index 066c98b..7667184 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -735,7 +735,7 @@ int radeon_device_init(struct radeon_device *rdev,
spin_lock_init(&rdev->ih.lock);
mutex_init(&rdev->gem.mutex);
mutex_init(&rdev->pm.mutex);
-   mutex_init(&rdev->vram_mutex);
+   init_rwsem(&rdev->pm.mclk_lock);
init_waitqueue_head(&rdev->irq.vblank_queue);
init_waitqueue_head(&rdev->irq.idle_queue);
r = radeon_gem_init(rdev);
diff --git a/drivers/gpu/drm/radeon/radeon_object.c 
b/drivers/gpu/drm/radeon/radeon_object.c
index 830f1a7..6ecb200 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -154,11 +154,11 @@ retry:
INIT_LIST_HEAD(&bo->va);
radeon_ttm_placement_from_domain(bo, domain);
/* Kernel allocation are uninterruptible */
-   mutex_lock(&rdev->vram_mutex);
+   down_read(&rdev->pm.mclk_lock);
r = ttm_bo_init(&rdev->mman.bdev, &bo->tbo, size, type,
&bo->placement, page_align, 0, !kernel, NULL,
acc_size, sg, &radeon_ttm_bo_destroy);
-   mutex_unlock(&rdev->vram_mutex);
+   up_read(&rdev->pm.mclk_lock);
if (unlikely(r != 0)) {
if (r != -ERESTARTSYS) {
if (domain == RADEON_GEM_DOMAIN_VRAM) {
@@ -219,9 +219,9 @@ void radeon_bo_unref(struct radeon_bo **bo)
return;
rdev = (*bo)->rdev;
tbo = &((*bo)->tbo);
-   mutex_lock(&rdev->vram_mutex);
+   down_read(&rdev->pm.mclk_lock);
ttm_bo_unref(&tbo);
-   mutex_unlock(&rdev->vram_mutex);
+   up_read(&rdev->pm.mclk_lock);
if (tbo == NULL)
*bo = NULL;
 }
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c 
b/drivers/gpu/drm/radeon/radeon_pm.c
index 0882554..d13b6ae 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -251,7 +251,7 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)
return;
 
mutex_lock(&rdev->ddev->struct_mutex);
-   mutex_lock(&rdev->vram_mutex);
+   down_write(&rdev->pm.mclk_lock);
mutex_lock(&rdev->ring_lock);
 
/* gui idle int has issues on older chips it seems */
@@ -303,7 +303,7 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)
rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE;
 
mutex_unlock(&rdev->ring_lock);
-   mutex_unlock(&rdev->vram_mutex);
+   up_write(&rdev->pm.mclk_lock);
mutex_unlock(&rdev->ddev->struct_mutex);
 }
 
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c 
b/drivers/gpu/drm/radeon/radeon_ttm.c
index c43035c..0881131 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -797,9 +797,9 @@ static int radeon_ttm_fault(struct vm_area_struct *vma, 
struct vm_fault *vmf)
return VM_FAULT_NOPAGE;
}
rdev = radeon_get_rdev(bo->bdev);
-   mutex_lock(&rdev->vram_mutex);
+   down_read(&rdev->pm.mclk_lock);
r = ttm_vm_ops->fault(vma, vmf);
-   mutex_unlock(&rdev->vram_mutex);
+   up_read(&rdev->pm.mclk_lock);
return r;
 }
 
-- 
1.7.9.5

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


[PATCH 5/9] drm/radeon: remove some unneeded structure members

2012-06-14 Thread Christian König
From: Christian Koenig 

Signed-off-by: Christian Koenig 
Reviewed-by: Jerome Glisse 
---
 drivers/gpu/drm/radeon/radeon.h |2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index af57d1f..e68db99 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -735,9 +735,7 @@ struct r600_ih {
struct radeon_bo*ring_obj;
volatile uint32_t   *ring;
unsignedrptr;
-   unsignedrptr_offs;
unsignedwptr;
-   unsignedwptr_old;
unsignedring_size;
uint64_tgpu_addr;
uint32_tptr_mask;
-- 
1.7.9.5

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


[PATCH 6/9] drm/radeon: fix & improve ih ring handling v3

2012-06-14 Thread Christian König
From: Christian Koenig 

The spinlock was actually there to protect the
rptr, but rptr was read outside of the locked area.

Also we don't really need a spinlock here, an
atomic should to quite fine since we only need to
prevent it from being reentrant.

v2: Keep the spinlock
v3: Back to an atomic again after finding & fixing the real bug.

Signed-off-by: Christian Koenig 
---
 drivers/gpu/drm/radeon/evergreen.c |   26 +-
 drivers/gpu/drm/radeon/r600.c  |   29 +
 drivers/gpu/drm/radeon/radeon.h|3 +--
 drivers/gpu/drm/radeon/radeon_device.c |3 +--
 drivers/gpu/drm/radeon/si.c|   27 +--
 5 files changed, 41 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen.c 
b/drivers/gpu/drm/radeon/evergreen.c
index dd3cea4..18abe3c 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -2943,7 +2943,6 @@ int evergreen_irq_process(struct radeon_device *rdev)
u32 rptr;
u32 src_id, src_data;
u32 ring_index;
-   unsigned long flags;
bool queue_hotplug = false;
bool queue_hdmi = false;
 
@@ -2951,22 +2950,21 @@ int evergreen_irq_process(struct radeon_device *rdev)
return IRQ_NONE;
 
wptr = evergreen_get_ih_wptr(rdev);
+
+restart_ih:
+   /* is somebody else already processing irqs? */
+   if (atomic_xchg(&rdev->ih.lock, 1))
+   return IRQ_NONE;
+
rptr = rdev->ih.rptr;
DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr);
 
-   spin_lock_irqsave(&rdev->ih.lock, flags);
-   if (rptr == wptr) {
-   spin_unlock_irqrestore(&rdev->ih.lock, flags);
-   return IRQ_NONE;
-   }
-restart_ih:
/* Order reading of wptr vs. reading of IH ring data */
rmb();
 
/* display interrupts */
evergreen_irq_ack(rdev);
 
-   rdev->ih.wptr = wptr;
while (rptr != wptr) {
/* wptr/rptr are in bytes! */
ring_index = rptr / 4;
@@ -3265,17 +3263,19 @@ restart_ih:
rptr += 16;
rptr &= rdev->ih.ptr_mask;
}
-   /* make sure wptr hasn't changed while processing */
-   wptr = evergreen_get_ih_wptr(rdev);
-   if (wptr != rdev->ih.wptr)
-   goto restart_ih;
if (queue_hotplug)
schedule_work(&rdev->hotplug_work);
if (queue_hdmi)
schedule_work(&rdev->audio_work);
rdev->ih.rptr = rptr;
WREG32(IH_RB_RPTR, rdev->ih.rptr);
-   spin_unlock_irqrestore(&rdev->ih.lock, flags);
+   atomic_set(&rdev->ih.lock, 0);
+
+   /* make sure wptr hasn't changed while processing */
+   wptr = evergreen_get_ih_wptr(rdev);
+   if (wptr != rptr)
+   goto restart_ih;
+
return IRQ_HANDLED;
 }
 
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index a8d8c44..ffbf0b7 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -2921,7 +2921,6 @@ void r600_disable_interrupts(struct radeon_device *rdev)
WREG32(IH_RB_RPTR, 0);
WREG32(IH_RB_WPTR, 0);
rdev->ih.enabled = false;
-   rdev->ih.wptr = 0;
rdev->ih.rptr = 0;
 }
 
@@ -3373,7 +3372,6 @@ int r600_irq_process(struct radeon_device *rdev)
u32 rptr;
u32 src_id, src_data;
u32 ring_index;
-   unsigned long flags;
bool queue_hotplug = false;
bool queue_hdmi = false;
 
@@ -3385,24 +3383,21 @@ int r600_irq_process(struct radeon_device *rdev)
RREG32(IH_RB_WPTR);
 
wptr = r600_get_ih_wptr(rdev);
-   rptr = rdev->ih.rptr;
-   DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr);
-
-   spin_lock_irqsave(&rdev->ih.lock, flags);
 
-   if (rptr == wptr) {
-   spin_unlock_irqrestore(&rdev->ih.lock, flags);
+restart_ih:
+   /* is somebody else already processing irqs? */
+   if (atomic_xchg(&rdev->ih.lock, 1))
return IRQ_NONE;
-   }
 
-restart_ih:
+   rptr = rdev->ih.rptr;
+   DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr);
+
/* Order reading of wptr vs. reading of IH ring data */
rmb();
 
/* display interrupts */
r600_irq_ack(rdev);
 
-   rdev->ih.wptr = wptr;
while (rptr != wptr) {
/* wptr/rptr are in bytes! */
ring_index = rptr / 4;
@@ -3556,17 +3551,19 @@ restart_ih:
rptr += 16;
rptr &= rdev->ih.ptr_mask;
}
-   /* make sure wptr hasn't changed while processing */
-   wptr = r600_get_ih_wptr(rdev);
-   if (wptr != rdev->ih.wptr)
-   goto restart_ih;
if (queue_hotplug)
schedule_work(&rdev->hotplug_work);
if (queue_hdmi)
schedule_work(&rdev->audio_work);
 

[PATCH 7/9] drm/radeon: apply Murphy's law to the kms irq code v3

2012-06-14 Thread Christian König
From: Christian Koenig 

1. It is really dangerous to have more than one
   spinlock protecting the same information.

2. radeon_irq_set sometimes wasn't called with lock
   protection, so it can happen that more than one
   CPU would tamper with the irq regs at the same
   time.

3. The pm.gui_idle variable was assuming that the 3D
   engine wasn't becoming idle between testing the
   register and setting the variable. So just remove
   it and test the register directly.

v2: Also handle the hpd irq code the same way.
v3: Rename hpd parameter for clarification.

Signed-off-by: Christian Koenig 
Reviewed-by: Alex Deucher 
---
 drivers/gpu/drm/radeon/evergreen.c  |   21 ++-
 drivers/gpu/drm/radeon/r100.c   |   29 ++
 drivers/gpu/drm/radeon/r600.c   |   38 
 drivers/gpu/drm/radeon/r600_hdmi.c  |6 +-
 drivers/gpu/drm/radeon/radeon.h |   35 +--
 drivers/gpu/drm/radeon/radeon_irq_kms.c |   96 +++
 drivers/gpu/drm/radeon/radeon_kms.c |   12 +++-
 drivers/gpu/drm/radeon/radeon_pm.c  |   12 +---
 drivers/gpu/drm/radeon/rs600.c  |   13 ++---
 drivers/gpu/drm/radeon/si.c |1 -
 10 files changed, 144 insertions(+), 119 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen.c 
b/drivers/gpu/drm/radeon/evergreen.c
index 18abe3c..8b64227 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -428,6 +428,7 @@ void evergreen_hpd_init(struct radeon_device *rdev)
 {
struct drm_device *dev = rdev->ddev;
struct drm_connector *connector;
+   unsigned enabled = 0;
u32 tmp = DC_HPDx_CONNECTION_TIMER(0x9c4) |
DC_HPDx_RX_INT_TIMER(0xfa) | DC_HPDx_EN;
 
@@ -436,73 +437,64 @@ void evergreen_hpd_init(struct radeon_device *rdev)
switch (radeon_connector->hpd.hpd) {
case RADEON_HPD_1:
WREG32(DC_HPD1_CONTROL, tmp);
-   rdev->irq.hpd[0] = true;
break;
case RADEON_HPD_2:
WREG32(DC_HPD2_CONTROL, tmp);
-   rdev->irq.hpd[1] = true;
break;
case RADEON_HPD_3:
WREG32(DC_HPD3_CONTROL, tmp);
-   rdev->irq.hpd[2] = true;
break;
case RADEON_HPD_4:
WREG32(DC_HPD4_CONTROL, tmp);
-   rdev->irq.hpd[3] = true;
break;
case RADEON_HPD_5:
WREG32(DC_HPD5_CONTROL, tmp);
-   rdev->irq.hpd[4] = true;
break;
case RADEON_HPD_6:
WREG32(DC_HPD6_CONTROL, tmp);
-   rdev->irq.hpd[5] = true;
break;
default:
break;
}
radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
+   enabled |= 1 << radeon_connector->hpd.hpd;
}
-   if (rdev->irq.installed)
-   evergreen_irq_set(rdev);
+   radeon_irq_kms_enable_hpd(rdev, enabled);
 }
 
 void evergreen_hpd_fini(struct radeon_device *rdev)
 {
struct drm_device *dev = rdev->ddev;
struct drm_connector *connector;
+   unsigned disabled = 0;
 
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
struct radeon_connector *radeon_connector = 
to_radeon_connector(connector);
switch (radeon_connector->hpd.hpd) {
case RADEON_HPD_1:
WREG32(DC_HPD1_CONTROL, 0);
-   rdev->irq.hpd[0] = false;
break;
case RADEON_HPD_2:
WREG32(DC_HPD2_CONTROL, 0);
-   rdev->irq.hpd[1] = false;
break;
case RADEON_HPD_3:
WREG32(DC_HPD3_CONTROL, 0);
-   rdev->irq.hpd[2] = false;
break;
case RADEON_HPD_4:
WREG32(DC_HPD4_CONTROL, 0);
-   rdev->irq.hpd[3] = false;
break;
case RADEON_HPD_5:
WREG32(DC_HPD5_CONTROL, 0);
-   rdev->irq.hpd[4] = false;
break;
case RADEON_HPD_6:
WREG32(DC_HPD6_CONTROL, 0);
-   rdev->irq.hpd[5] = false;
break;
default:
break;
}
+   disabled |= 1 << radeon_connector->hpd.hpd;
}
+   radeon_irq_kms_disable_hpd(rdev, disabled);
 }
 
 /* watermark setup */
@@ -3251,7 +3243,6 @@ restart_ih:
break;
case 233: /* GUI IDLE */
 

[PATCH 8/9] drm/radeon: replace pflip and sw_int counters with atomics

2012-06-14 Thread Christian König
From: Christian Koenig 

So we can skip the locking. Also renames sw_int to
ring_int, cause that better matches its purpose.

Signed-off-by: Christian Koenig 
---
 drivers/gpu/drm/radeon/evergreen.c  |   32 -
 drivers/gpu/drm/radeon/r100.c   |   10 +++---
 drivers/gpu/drm/radeon/r600.c   |   10 +++---
 drivers/gpu/drm/radeon/radeon.h |6 ++--
 drivers/gpu/drm/radeon/radeon_irq_kms.c |   59 +++
 drivers/gpu/drm/radeon/rs600.c  |   10 +++---
 drivers/gpu/drm/radeon/si.c |   30 
 7 files changed, 76 insertions(+), 81 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen.c 
b/drivers/gpu/drm/radeon/evergreen.c
index 8b64227..f2b6502 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -2607,20 +2607,20 @@ int evergreen_irq_set(struct radeon_device *rdev)
 
if (rdev->family >= CHIP_CAYMAN) {
/* enable CP interrupts on all rings */
-   if (rdev->irq.sw_int[RADEON_RING_TYPE_GFX_INDEX]) {
+   if 
(atomic_read(&rdev->irq.ring_int[RADEON_RING_TYPE_GFX_INDEX])) {
DRM_DEBUG("evergreen_irq_set: sw int gfx\n");
cp_int_cntl |= TIME_STAMP_INT_ENABLE;
}
-   if (rdev->irq.sw_int[CAYMAN_RING_TYPE_CP1_INDEX]) {
+   if 
(atomic_read(&rdev->irq.ring_int[CAYMAN_RING_TYPE_CP1_INDEX])) {
DRM_DEBUG("evergreen_irq_set: sw int cp1\n");
cp_int_cntl1 |= TIME_STAMP_INT_ENABLE;
}
-   if (rdev->irq.sw_int[CAYMAN_RING_TYPE_CP2_INDEX]) {
+   if 
(atomic_read(&rdev->irq.ring_int[CAYMAN_RING_TYPE_CP2_INDEX])) {
DRM_DEBUG("evergreen_irq_set: sw int cp2\n");
cp_int_cntl2 |= TIME_STAMP_INT_ENABLE;
}
} else {
-   if (rdev->irq.sw_int[RADEON_RING_TYPE_GFX_INDEX]) {
+   if 
(atomic_read(&rdev->irq.ring_int[RADEON_RING_TYPE_GFX_INDEX])) {
DRM_DEBUG("evergreen_irq_set: sw int gfx\n");
cp_int_cntl |= RB_INT_ENABLE;
cp_int_cntl |= TIME_STAMP_INT_ENABLE;
@@ -2628,32 +2628,32 @@ int evergreen_irq_set(struct radeon_device *rdev)
}
 
if (rdev->irq.crtc_vblank_int[0] ||
-   rdev->irq.pflip[0]) {
+   atomic_read(&rdev->irq.pflip[0])) {
DRM_DEBUG("evergreen_irq_set: vblank 0\n");
crtc1 |= VBLANK_INT_MASK;
}
if (rdev->irq.crtc_vblank_int[1] ||
-   rdev->irq.pflip[1]) {
+   atomic_read(&rdev->irq.pflip[1])) {
DRM_DEBUG("evergreen_irq_set: vblank 1\n");
crtc2 |= VBLANK_INT_MASK;
}
if (rdev->irq.crtc_vblank_int[2] ||
-   rdev->irq.pflip[2]) {
+   atomic_read(&rdev->irq.pflip[2])) {
DRM_DEBUG("evergreen_irq_set: vblank 2\n");
crtc3 |= VBLANK_INT_MASK;
}
if (rdev->irq.crtc_vblank_int[3] ||
-   rdev->irq.pflip[3]) {
+   atomic_read(&rdev->irq.pflip[3])) {
DRM_DEBUG("evergreen_irq_set: vblank 3\n");
crtc4 |= VBLANK_INT_MASK;
}
if (rdev->irq.crtc_vblank_int[4] ||
-   rdev->irq.pflip[4]) {
+   atomic_read(&rdev->irq.pflip[4])) {
DRM_DEBUG("evergreen_irq_set: vblank 4\n");
crtc5 |= VBLANK_INT_MASK;
}
if (rdev->irq.crtc_vblank_int[5] ||
-   rdev->irq.pflip[5]) {
+   atomic_read(&rdev->irq.pflip[5])) {
DRM_DEBUG("evergreen_irq_set: vblank 5\n");
crtc6 |= VBLANK_INT_MASK;
}
@@ -2973,7 +2973,7 @@ restart_ih:
rdev->pm.vblank_sync = true;

wake_up(&rdev->irq.vblank_queue);
}
-   if (rdev->irq.pflip[0])
+   if (atomic_read(&rdev->irq.pflip[0]))
radeon_crtc_handle_flip(rdev, 
0);
rdev->irq.stat_regs.evergreen.disp_int 
&= ~LB_D1_VBLANK_INTERRUPT;
DRM_DEBUG("IH: D1 vblank\n");
@@ -2999,7 +2999,7 @@ restart_ih:
rdev->pm.vblank_sync = true;

wake_up(&rdev->irq.vblank_queue);
}
-   if (rdev->irq.pflip[1])
+   if (atomic_read(&rdev->irq.pflip[1]))
radeon_crtc_handle_flip(rdev, 
1);

rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VBLAN

[PATCH 9/9] drm/radeon: replace cs_mutex with vm_mutex v2

2012-06-14 Thread Christian König
Try to remove or replace the cs_mutex with a
vm_mutex where it is still needed.

v2: fix locking order

Signed-off-by: Christian König 
---
 drivers/gpu/drm/radeon/radeon.h|   44 +---
 drivers/gpu/drm/radeon/radeon_cs.c |9 +++
 drivers/gpu/drm/radeon/radeon_device.c |2 +-
 drivers/gpu/drm/radeon/radeon_gart.c   |   39 
 drivers/gpu/drm/radeon/radeon_gem.c|2 --
 5 files changed, 27 insertions(+), 69 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index e14682e..46ecfae 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -159,48 +159,6 @@ static inline int radeon_atrm_get_bios_chunk(uint8_t 
*bios, int offset, int len)
 #endif
 bool radeon_get_bios(struct radeon_device *rdev);
 
-
-/*
- * Mutex which allows recursive locking from the same process.
- */
-struct radeon_mutex {
-   struct mutexmutex;
-   struct task_struct  *owner;
-   int level;
-};
-
-static inline void radeon_mutex_init(struct radeon_mutex *mutex)
-{
-   mutex_init(&mutex->mutex);
-   mutex->owner = NULL;
-   mutex->level = 0;
-}
-
-static inline void radeon_mutex_lock(struct radeon_mutex *mutex)
-{
-   if (mutex_trylock(&mutex->mutex)) {
-   /* The mutex was unlocked before, so it's ours now */
-   mutex->owner = current;
-   } else if (mutex->owner != current) {
-   /* Another process locked the mutex, take it */
-   mutex_lock(&mutex->mutex);
-   mutex->owner = current;
-   }
-   /* Otherwise the mutex was already locked by this process */
-
-   mutex->level++;
-}
-
-static inline void radeon_mutex_unlock(struct radeon_mutex *mutex)
-{
-   if (--mutex->level > 0)
-   return;
-
-   mutex->owner = NULL;
-   mutex_unlock(&mutex->mutex);
-}
-
-
 /*
  * Dummy page
  */
@@ -709,6 +667,7 @@ struct radeon_vm_funcs {
 };
 
 struct radeon_vm_manager {
+   struct mutexlock;
struct list_headlru_vm;
uint32_tuse_bitmap;
struct radeon_sa_managersa_manager;
@@ -1531,7 +1490,6 @@ struct radeon_device {
struct radeon_gem   gem;
struct radeon_pmpm;
uint32_tbios_scratch[RADEON_BIOS_NUM_SCRATCH];
-   struct radeon_mutex cs_mutex;
struct radeon_wbwb;
struct radeon_dummy_pagedummy_page;
boolshutdown;
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c 
b/drivers/gpu/drm/radeon/radeon_cs.c
index d295821..6822362 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -437,6 +437,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev,
return r;
}
 
+   mutex_lock(&rdev->vm_manager.lock);
mutex_lock(&vm->mutex);
r = radeon_vm_bind(rdev, vm);
if (r) {
@@ -474,7 +475,8 @@ out:
}
vm->fence = radeon_fence_ref(parser->ib.fence);
}
-   mutex_unlock(&fpriv->vm.mutex);
+   mutex_unlock(&vm->mutex);
+   mutex_unlock(&rdev->vm_manager.lock);
return r;
 }
 
@@ -494,9 +496,7 @@ int radeon_cs_ioctl(struct drm_device *dev, void *data, 
struct drm_file *filp)
struct radeon_cs_parser parser;
int r;
 
-   radeon_mutex_lock(&rdev->cs_mutex);
if (!rdev->accel_working) {
-   radeon_mutex_unlock(&rdev->cs_mutex);
return -EBUSY;
}
/* initialize parser */
@@ -510,7 +510,6 @@ int radeon_cs_ioctl(struct drm_device *dev, void *data, 
struct drm_file *filp)
DRM_ERROR("Failed to initialize parser !\n");
radeon_cs_parser_fini(&parser, r);
r = radeon_cs_handle_lockup(rdev, r);
-   radeon_mutex_unlock(&rdev->cs_mutex);
return r;
}
r = radeon_cs_parser_relocs(&parser);
@@ -519,7 +518,6 @@ int radeon_cs_ioctl(struct drm_device *dev, void *data, 
struct drm_file *filp)
DRM_ERROR("Failed to parse relocation %d!\n", r);
radeon_cs_parser_fini(&parser, r);
r = radeon_cs_handle_lockup(rdev, r);
-   radeon_mutex_unlock(&rdev->cs_mutex);
return r;
}
r = radeon_cs_ib_chunk(rdev, &parser);
@@ -533,7 +531,6 @@ int radeon_cs_ioctl(struct drm_device *dev, void *data, 
struct drm_file *filp)
 out:
radeon_cs_parser_fini(&parser, r);
r = radeon_cs_handle_lockup(rdev, r);
-   radeon_mutex_unlock(&rdev->cs_mutex);
return r;
 }
 
diff --git a/drivers/gpu/drm/radeon/radeon_device.c 
b/drivers/gpu/drm/radeon/radeon_device.c
index 3c563d1..f654ba8 100644
--- a/drivers/gpu/drm/radeon/radeon_device.

Re: [3.4 regression] [bisected] DisplayPort fails to come on

2012-06-14 Thread Daniel Vetter
On Thu, Jun 14, 2012 at 4:00 PM, Dave Airlie  wrote:
> On Thu, Jun 14, 2012 at 2:26 PM, Wouter M. Koolen
>  wrote:
> cc'ing Daniel.
>
>> Hi Igor and Len,
>>
>> When I cold boot 3.4 on my laptop the second monitor attached to the
>> displayport stays blank. It works fine with 3.3.8 and earlier.
>>
>> I get two error messages in dmesg:
>>
>> kernel: video: probe of LNXVIDEO:00 failed with error -5
>>
>> kernel: [drm:intel_dp_complete_link_train] *ERROR* failed to train DP,
>> aborting
>>
>> When I warm boot 3.4 after running kernel 3.3.8 first, only the first
>> message appears and the display works fine.

Ok, the second message is actually the one explaining the black
screen. Can you please boot with drm.debug=0xe added to your kernel
cmdline and attach the full dmesg, so we know a bit what your display
hw looks like?

Also, please redo the bisect if possible (with coldboots) and hunt for
the black screen/the "failed to train DP" message.

Thanks, Daniel
-- 
Daniel Vetter
daniel.vet...@ffwll.ch - +41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2 0/9] Support for dmabuf exporting for videobuf2

2012-06-14 Thread Tomasz Stanislawski
Hello everyone,
The patches adds support for DMABUF exporting to V4L2 stack.  The latest
support for DMABUF importing was posted in [1]. The exporter part is dependant
on DMA mapping redesign [2] which is expected to be merged into the mainline.
Therefore it is posted as a separate patchset. Moreover some patches depends on
vmap extension for DMABUF by Dave Airlie [3] and sg_alloc_table_from_pages
function [4]. The last patch 'v4l: vb2-dma-contig: use dma_get_sgtable' depends
on dma_get_sgtable extension to DMA api [5].

The tree with all the patches and extensions is available at:
repo: git://git.infradead.org/users/kmpark/linux-2.6-samsung
branch: media-for3.5-vb2-dmabuf-v7

Changelog:

v2:
- add documentation for DMABUF exporting
- squashed 'let mmap method to use dma_mmap_coherent call' with
  'remove vb2_mmap_pfn_range function'
- move setup of scatterlist for MMAP buffers from alloc to DMABUF export code
- use locking to serialize map/unmap of DMABUF attachments
- squash vmap/kmap, setup of sg lists, allocation in attachments into
  dma-contig exporter patch
- fix occasional failure of follow_pfn trick by using init_mm in artificial
  VMA
- add support for exporting in s5p-mfc driver
- drop all code that duplicates sg_alloc_table_from_pages
- introduce usage of dma_get_sgtable as generic solution
  to follow_pfn trick

v1:
- updated setup of VIDIOC_EXPBUF ioctl
- doc updates
- introduced workaround to avoid using dma_get_pages,
- removed caching of exported dmabuf to avoid existence of circular reference
  between dmabuf and vb2_dc_buf or resource leakage
- removed all 'change behaviour' patches
- inital support for exporting in s5p-mfs driver
- removal of vb2_mmap_pfn_range that is no longer used
- use sg_alloc_table_from_pages instead of creating sglist in vb2_dc code
- move attachment allocation to exporter's attach callback

v0: RFC
- initial version

[1] http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/49438
[2] http://thread.gmane.org/gmane.linux.kernel.cross-arch/14098
[3] http://permalink.gmane.org/gmane.comp.video.dri.devel/69302
[4] This patchset is rebased on 3.4-rc1 plus the following patchsets:
[5] http://www.spinics.net/lists/linux-arch/msg18282.html

Marek Szyprowski (1):
  v4l: vb2-dma-contig: let mmap method to use dma_mmap_coherent call

Tomasz Stanislawski (8):
  Documentation: media: description of DMABUF exporting in V4L2
  v4l: add buffer exporting via dmabuf
  v4l: vb2: add buffer exporting via dmabuf
  v4l: vb2-dma-contig: add support for DMABUF exporting
  v4l: s5p-fimc: support for dmabuf exporting
  v4l: s5p-tv: mixer: support for dmabuf exporting
  v4l: s5p-mfc: support for dmabuf exporting
  v4l: vb2-dma-contig: use dma_get_sgtable

 Documentation/DocBook/media/v4l/compat.xml|3 +
 Documentation/DocBook/media/v4l/io.xml|3 +
 Documentation/DocBook/media/v4l/v4l2.xml  |1 +
 Documentation/DocBook/media/v4l/vidioc-expbuf.xml |  223 
 drivers/media/video/s5p-fimc/fimc-capture.c   |9 +
 drivers/media/video/s5p-mfc/s5p_mfc_dec.c |   18 ++
 drivers/media/video/s5p-mfc/s5p_mfc_enc.c |   18 ++
 drivers/media/video/s5p-tv/mixer_video.c  |   10 +
 drivers/media/video/v4l2-compat-ioctl32.c |1 +
 drivers/media/video/v4l2-dev.c|1 +
 drivers/media/video/v4l2-ioctl.c  |6 +
 drivers/media/video/videobuf2-core.c  |   67 ++
 drivers/media/video/videobuf2-dma-contig.c|  224 -
 drivers/media/video/videobuf2-memops.c|   40 
 include/linux/videodev2.h |   26 +++
 include/media/v4l2-ioctl.h|2 +
 include/media/videobuf2-core.h|2 +
 include/media/videobuf2-memops.h  |5 -
 18 files changed, 612 insertions(+), 47 deletions(-)
 create mode 100644 Documentation/DocBook/media/v4l/vidioc-expbuf.xml

-- 
1.7.9.5

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


[PATCHv2 1/9] v4l: vb2-dma-contig: let mmap method to use dma_mmap_coherent call

2012-06-14 Thread Tomasz Stanislawski
From: Marek Szyprowski 

Let mmap method to use dma_mmap_coherent call.  This patch depends on DMA
mapping redesign patches because the usage of dma_mmap_coherent breaks
dma-contig allocator for architectures other than ARM and AVR.

Moreover, this patch removes vb2_mmap_pfn_range from videobuf2 helpers.
The function is no longer used in vb2 code.

Suggested-by: Laurent Pinchart 
Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
Acked-by: Laurent Pinchart 
---
 drivers/media/video/videobuf2-dma-contig.c |   28 +--
 drivers/media/video/videobuf2-memops.c |   40 
 include/media/videobuf2-memops.h   |5 
 3 files changed, 26 insertions(+), 47 deletions(-)

diff --git a/drivers/media/video/videobuf2-dma-contig.c 
b/drivers/media/video/videobuf2-dma-contig.c
index 040829b..00b776c 100644
--- a/drivers/media/video/videobuf2-dma-contig.c
+++ b/drivers/media/video/videobuf2-dma-contig.c
@@ -178,14 +178,38 @@ static void *vb2_dc_alloc(void *alloc_ctx, unsigned long 
size)
 static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma)
 {
struct vb2_dc_buf *buf = buf_priv;
+   int ret;
 
if (!buf) {
printk(KERN_ERR "No buffer to map\n");
return -EINVAL;
}
 
-   return vb2_mmap_pfn_range(vma, buf->dma_addr, buf->size,
- &vb2_common_vm_ops, &buf->handler);
+   /*
+* dma_mmap_* uses vm_pgoff as in-buffer offset, but we want to
+* map whole buffer
+*/
+   vma->vm_pgoff = 0;
+
+   ret = dma_mmap_coherent(buf->dev, vma, buf->vaddr,
+   buf->dma_addr, buf->size);
+
+   if (ret) {
+   printk(KERN_ERR "Remapping memory failed, error: %d\n", ret);
+   return ret;
+   }
+
+   vma->vm_flags   |= VM_DONTEXPAND | VM_RESERVED;
+   vma->vm_private_data= &buf->handler;
+   vma->vm_ops = &vb2_common_vm_ops;
+
+   vma->vm_ops->open(vma);
+
+   printk(KERN_DEBUG "%s: mapped dma addr 0x%08lx at 0x%08lx, size %ld\n",
+   __func__, (unsigned long)buf->dma_addr, vma->vm_start,
+   buf->size);
+
+   return 0;
 }
 
 /*/
diff --git a/drivers/media/video/videobuf2-memops.c 
b/drivers/media/video/videobuf2-memops.c
index 504cd4c..81c1ad8 100644
--- a/drivers/media/video/videobuf2-memops.c
+++ b/drivers/media/video/videobuf2-memops.c
@@ -137,46 +137,6 @@ int vb2_get_contig_userptr(unsigned long vaddr, unsigned 
long size,
 EXPORT_SYMBOL_GPL(vb2_get_contig_userptr);
 
 /**
- * vb2_mmap_pfn_range() - map physical pages to userspace
- * @vma:   virtual memory region for the mapping
- * @paddr: starting physical address of the memory to be mapped
- * @size:  size of the memory to be mapped
- * @vm_ops:vm operations to be assigned to the created area
- * @priv:  private data to be associated with the area
- *
- * Returns 0 on success.
- */
-int vb2_mmap_pfn_range(struct vm_area_struct *vma, unsigned long paddr,
-   unsigned long size,
-   const struct vm_operations_struct *vm_ops,
-   void *priv)
-{
-   int ret;
-
-   size = min_t(unsigned long, vma->vm_end - vma->vm_start, size);
-
-   vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-   ret = remap_pfn_range(vma, vma->vm_start, paddr >> PAGE_SHIFT,
-   size, vma->vm_page_prot);
-   if (ret) {
-   printk(KERN_ERR "Remapping memory failed, error: %d\n", ret);
-   return ret;
-   }
-
-   vma->vm_flags   |= VM_DONTEXPAND | VM_RESERVED;
-   vma->vm_private_data= priv;
-   vma->vm_ops = vm_ops;
-
-   vma->vm_ops->open(vma);
-
-   pr_debug("%s: mapped paddr 0x%08lx at 0x%08lx, size %ld\n",
-   __func__, paddr, vma->vm_start, size);
-
-   return 0;
-}
-EXPORT_SYMBOL_GPL(vb2_mmap_pfn_range);
-
-/**
  * vb2_common_vm_open() - increase refcount of the vma
  * @vma:   virtual memory region for the mapping
  *
diff --git a/include/media/videobuf2-memops.h b/include/media/videobuf2-memops.h
index 84e1f6c..f05444c 100644
--- a/include/media/videobuf2-memops.h
+++ b/include/media/videobuf2-memops.h
@@ -33,11 +33,6 @@ extern const struct vm_operations_struct vb2_common_vm_ops;
 int vb2_get_contig_userptr(unsigned long vaddr, unsigned long size,
   struct vm_area_struct **res_vma, dma_addr_t *res_pa);
 
-int vb2_mmap_pfn_range(struct vm_area_struct *vma, unsigned long paddr,
-   unsigned long size,
-   const struct vm_operations_struct *vm_ops,
-   void *priv);
-
 struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma);
 void vb2_put_vma(struct vm_area_struct *vma);
 
-- 
1.7.9.5

[PATCHv2 3/9] v4l: add buffer exporting via dmabuf

2012-06-14 Thread Tomasz Stanislawski
This patch adds extension to V4L2 api. It allow to export a mmap buffer as file
descriptor. New ioctl VIDIOC_EXPBUF is added. It takes a buffer offset used by
mmap and return a file descriptor on success.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
---
 drivers/media/video/v4l2-compat-ioctl32.c |1 +
 drivers/media/video/v4l2-dev.c|1 +
 drivers/media/video/v4l2-ioctl.c  |6 ++
 include/linux/videodev2.h |   26 ++
 include/media/v4l2-ioctl.h|2 ++
 5 files changed, 36 insertions(+)

diff --git a/drivers/media/video/v4l2-compat-ioctl32.c 
b/drivers/media/video/v4l2-compat-ioctl32.c
index d33ab18..141e745 100644
--- a/drivers/media/video/v4l2-compat-ioctl32.c
+++ b/drivers/media/video/v4l2-compat-ioctl32.c
@@ -970,6 +970,7 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int 
cmd, unsigned long arg)
case VIDIOC_S_FBUF32:
case VIDIOC_OVERLAY32:
case VIDIOC_QBUF32:
+   case VIDIOC_EXPBUF:
case VIDIOC_DQBUF32:
case VIDIOC_STREAMON32:
case VIDIOC_STREAMOFF32:
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
index 5ccbd46..6bf6307 100644
--- a/drivers/media/video/v4l2-dev.c
+++ b/drivers/media/video/v4l2-dev.c
@@ -597,6 +597,7 @@ static void determine_valid_ioctls(struct video_device 
*vdev)
SET_VALID_IOCTL(ops, VIDIOC_REQBUFS, vidioc_reqbufs);
SET_VALID_IOCTL(ops, VIDIOC_QUERYBUF, vidioc_querybuf);
SET_VALID_IOCTL(ops, VIDIOC_QBUF, vidioc_qbuf);
+   SET_VALID_IOCTL(ops, VIDIOC_EXPBUF, vidioc_expbuf);
SET_VALID_IOCTL(ops, VIDIOC_DQBUF, vidioc_dqbuf);
SET_VALID_IOCTL(ops, VIDIOC_OVERLAY, vidioc_overlay);
SET_VALID_IOCTL(ops, VIDIOC_G_FBUF, vidioc_g_fbuf);
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 31fc2ad..a73b14e 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -212,6 +212,7 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
IOCTL_INFO(VIDIOC_S_FBUF, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_OVERLAY, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_QBUF, 0),
+   IOCTL_INFO(VIDIOC_EXPBUF, 0),
IOCTL_INFO(VIDIOC_DQBUF, 0),
IOCTL_INFO(VIDIOC_STREAMON, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_STREAMOFF, INFO_FL_PRIO),
@@ -957,6 +958,11 @@ static long __video_do_ioctl(struct file *file,
dbgbuf(cmd, vfd, p);
break;
}
+   case VIDIOC_EXPBUF:
+   {
+   ret = ops->vidioc_expbuf(file, fh, arg);
+   break;
+   }
case VIDIOC_DQBUF:
{
struct v4l2_buffer *p = arg;
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 51b20f4..e8893a5 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -684,6 +684,31 @@ struct v4l2_buffer {
 #define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE  0x0800
 #define V4L2_BUF_FLAG_NO_CACHE_CLEAN   0x1000
 
+/**
+ * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor
+ *
+ * @fd:file descriptor associated with DMABUF (set by driver)
+ * @mem_offset:buffer memory offset as returned by VIDIOC_QUERYBUF in 
struct
+ * v4l2_buffer::m.offset (for single-plane formats) or
+ * v4l2_plane::m.offset (for multi-planar formats)
+ * @flags: flags for newly created file, currently only O_CLOEXEC is
+ * supported, refer to manual of open syscall for more details
+ *
+ * Contains data used for exporting a video buffer as DMABUF file descriptor.
+ * The buffer is identified by a 'cookie' returned by VIDIOC_QUERYBUF
+ * (identical to the cookie used to mmap() the buffer to userspace). All
+ * reserved fields must be set to zero. The field reserved0 is expected to
+ * become a structure 'type' allowing an alternative layout of the structure
+ * content. Therefore this field should not be used for any other extensions.
+ */
+struct v4l2_exportbuffer {
+   __u32   fd;
+   __u32   reserved0;
+   __u32   mem_offset;
+   __u32   flags;
+   __u32   reserved[12];
+};
+
 /*
  * O V E R L A Y   P R E V I E W
  */
@@ -2553,6 +2578,7 @@ struct v4l2_create_buffers {
 #define VIDIOC_S_FBUF   _IOW('V', 11, struct v4l2_framebuffer)
 #define VIDIOC_OVERLAY  _IOW('V', 14, int)
 #define VIDIOC_QBUF_IOWR('V', 15, struct v4l2_buffer)
+#define VIDIOC_EXPBUF  _IOWR('V', 16, struct v4l2_exportbuffer)
 #define VIDIOC_DQBUF   _IOWR('V', 17, struct v4l2_buffer)
 #define VIDIOC_STREAMON _IOW('V', 18, int)
 #define VIDIOC_STREAMOFF_IOW('V', 19, int)
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index d8b76f7..ccd1faa 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -119,6 +119,8 @

[PATCHv2 2/9] Documentation: media: description of DMABUF exporting in V4L2

2012-06-14 Thread Tomasz Stanislawski
This patch adds description and usage examples for exporting
DMABUF file descriptor in V4L2.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
CC: linux-...@vger.kernel.org
---
 Documentation/DocBook/media/v4l/compat.xml|3 +
 Documentation/DocBook/media/v4l/io.xml|3 +
 Documentation/DocBook/media/v4l/v4l2.xml  |1 +
 Documentation/DocBook/media/v4l/vidioc-expbuf.xml |  223 +
 4 files changed, 230 insertions(+)
 create mode 100644 Documentation/DocBook/media/v4l/vidioc-expbuf.xml

diff --git a/Documentation/DocBook/media/v4l/compat.xml 
b/Documentation/DocBook/media/v4l/compat.xml
index 07a311f..7773450 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -2591,6 +2591,9 @@ ioctls.
  Importing DMABUF file descriptors as a new IO method described
  in .
 
+
+ Exporting DMABUF files using &VIDIOC-EXPBUF; ioctl.
+
   
 
 
diff --git a/Documentation/DocBook/media/v4l/io.xml 
b/Documentation/DocBook/media/v4l/io.xml
index f55b0ab..7a0dfc9 100644
--- a/Documentation/DocBook/media/v4l/io.xml
+++ b/Documentation/DocBook/media/v4l/io.xml
@@ -488,6 +488,9 @@ buffer from userspace using a file descriptor previously 
exported for a
 different or the same device (known as the importer role), or both. This
 section describes the DMABUF importer role API in V4L2.
 
+Refer to  DMABUF exporting  for
+details about exporting a V4L2 buffers as DMABUF file descriptors.
+
 Input and output devices support the streaming I/O method when the
 V4L2_CAP_STREAMING flag in the
 capabilities field of &v4l2-capability; returned by
diff --git a/Documentation/DocBook/media/v4l/v4l2.xml 
b/Documentation/DocBook/media/v4l/v4l2.xml
index 015c561..8f650d2 100644
--- a/Documentation/DocBook/media/v4l/v4l2.xml
+++ b/Documentation/DocBook/media/v4l/v4l2.xml
@@ -561,6 +561,7 @@ and discussions on the V4L mailing list.
 &sub-log-status;
 &sub-overlay;
 &sub-qbuf;
+&sub-expbuf;
 &sub-querybuf;
 &sub-querycap;
 &sub-queryctrl;
diff --git a/Documentation/DocBook/media/v4l/vidioc-expbuf.xml 
b/Documentation/DocBook/media/v4l/vidioc-expbuf.xml
new file mode 100644
index 000..30ebf67
--- /dev/null
+++ b/Documentation/DocBook/media/v4l/vidioc-expbuf.xml
@@ -0,0 +1,223 @@
+
+
+  
+ioctl VIDIOC_EXPBUF
+&manvol;
+  
+
+  
+VIDIOC_EXPBUF
+Export a buffer as a DMABUF file descriptor.
+  
+
+  
+
+  
+   int ioctl
+   int fd
+   int request
+   struct v4l2_exportbuffer 
*argp
+  
+
+  
+
+  
+Arguments
+
+
+  
+   fd
+   
+ &fd;
+   
+  
+  
+   request
+   
+ VIDIOC_EXPBUF
+   
+  
+  
+   argp
+   
+ 
+   
+  
+
+  
+
+  
+Description
+
+
+  Experimental
+  This is an  experimental 
+  interface and may change in the future.
+
+
+This ioctl is an extension to the memory
+mapping I/O method therefore it is available only for
+V4L2_MEMORY_MMAP buffers.  It can be used to export a
+buffer as DMABUF file at any time after buffers have been allocated with the
+&VIDIOC-REQBUFS; ioctl.
+
+Prior to exporting an application calls VIDIOC_QUERYBUF to obtain memory offsets. When
+using the multi-planar API every plane has
+own offset.
+
+To export a buffer, the application fills &v4l2-exportbuffer;.  The
+ mem_offset  field is set to the offset obtained
+from  VIDIOC_QUERYBUF .  Additional flags may be posted in
+the  flags  field.  Refer to manual for open syscall
+for details. Currently only O_CLOEXEC is guaranteed to be supported.  All other
+fields must be set to zero.  In a case of multi-planar API, every plane is
+exported separately using multiple  VIDIOC_EXPBUF 
+calls.
+
+ After calling VIDIOC_EXPBUF the  fd
+ field will be set by a driver.  This is a DMABUF file
+descriptor. The application may pass it to other API. Refer to DMABUF importing for details about importing DMABUF
+files into V4L2 nodes. A developer is encouraged to close a DMABUF file when it
+is no longer used.  
+
+  
+  
+   
+  Examples
+
+  
+   Exporting a buffer.
+   
+int buffer_export(int v4lfd, &v4l2-buf-type; bt, int index, int *dmafd)
+{
+   &v4l2-buffer; buf;
+   &v4l2-exportbuffer; expbuf;
+
+   memset(&buf, 0, sizeof buf);
+   buf.type = bt;
+   buf.memory = V4L2_MEMORY_MMAP;
+   buf.index = index;
+
+   if (ioctl (v4lfd, &VIDIOC-QUERYBUF;, &buf) == -1) {
+   perror ("VIDIOC_QUERYBUF");
+   return -1;
+   }
+
+   memset(&expbuf, 0, sizeof expbuf);
+   expbuf.mem_offset = buf.m.offset;
+   if (ioctl (v4lfd, &VIDIOC-EXPBUF;, &expbuf) == -1) {
+   perror ("VIDIOC_EXPBUF");
+   return -1;
+   }
+
+   *dmafd = expbuf.fd;
+
+   return 0;
+}
+
+  
+
+  
+   Exporting a

[PATCHv2 6/9] v4l: s5p-fimc: support for dmabuf exporting

2012-06-14 Thread Tomasz Stanislawski
This patch enhances s5p-fimc with support for DMABUF exporting via
VIDIOC_EXPBUF ioctl.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
---
 drivers/media/video/s5p-fimc/fimc-capture.c |9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index cd27e33..52c9b36 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -1101,6 +1101,14 @@ static int fimc_cap_qbuf(struct file *file, void *priv,
return vb2_qbuf(&fimc->vid_cap.vbq, buf);
 }
 
+static int fimc_cap_expbuf(struct file *file, void *priv,
+ struct v4l2_exportbuffer *eb)
+{
+   struct fimc_dev *fimc = video_drvdata(file);
+
+   return vb2_expbuf(&fimc->vid_cap.vbq, eb);
+}
+
 static int fimc_cap_dqbuf(struct file *file, void *priv,
   struct v4l2_buffer *buf)
 {
@@ -1225,6 +1233,7 @@ static const struct v4l2_ioctl_ops fimc_capture_ioctl_ops 
= {
 
.vidioc_qbuf= fimc_cap_qbuf,
.vidioc_dqbuf   = fimc_cap_dqbuf,
+   .vidioc_expbuf  = fimc_cap_expbuf,
 
.vidioc_prepare_buf = fimc_cap_prepare_buf,
.vidioc_create_bufs = fimc_cap_create_bufs,
-- 
1.7.9.5

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


[PATCHv2 4/9] v4l: vb2: add buffer exporting via dmabuf

2012-06-14 Thread Tomasz Stanislawski
This patch adds extension to videobuf2-core. It allow to export a mmap buffer
as a file descriptor.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
Acked-by: Laurent Pinchart 
---
 drivers/media/video/videobuf2-core.c |   67 ++
 include/media/videobuf2-core.h   |2 +
 2 files changed, 69 insertions(+)

diff --git a/drivers/media/video/videobuf2-core.c 
b/drivers/media/video/videobuf2-core.c
index d60ed25..923165a 100644
--- a/drivers/media/video/videobuf2-core.c
+++ b/drivers/media/video/videobuf2-core.c
@@ -1730,6 +1730,73 @@ static int __find_plane_by_offset(struct vb2_queue *q, 
unsigned long off,
 }
 
 /**
+ * vb2_expbuf() - Export a buffer as a file descriptor
+ * @q: videobuf2 queue
+ * @eb:export buffer structure passed from userspace to 
vidioc_expbuf
+ * handler in driver
+ *
+ * The return values from this function are intended to be directly returned
+ * from vidioc_expbuf handler in driver.
+ */
+int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb)
+{
+   struct vb2_buffer *vb = NULL;
+   struct vb2_plane *vb_plane;
+   unsigned int buffer, plane;
+   int ret;
+   struct dma_buf *dbuf;
+
+   if (q->memory != V4L2_MEMORY_MMAP) {
+   dprintk(1, "Queue is not currently set up for mmap\n");
+   return -EINVAL;
+   }
+
+   if (!q->mem_ops->get_dmabuf) {
+   dprintk(1, "Queue does not support DMA buffer exporting\n");
+   return -EINVAL;
+   }
+
+   if (eb->flags & ~O_CLOEXEC) {
+   dprintk(1, "Queue does support only O_CLOEXEC flag\n");
+   return -EINVAL;
+   }
+
+   /*
+* Find the plane corresponding to the offset passed by userspace.
+*/
+   ret = __find_plane_by_offset(q, eb->mem_offset, &buffer, &plane);
+   if (ret) {
+   dprintk(1, "invalid offset %u\n", eb->mem_offset);
+   return ret;
+   }
+
+   vb = q->bufs[buffer];
+   vb_plane = &vb->planes[plane];
+
+   dbuf = call_memop(q, get_dmabuf, vb_plane->mem_priv);
+   if (IS_ERR_OR_NULL(dbuf)) {
+   dprintk(1, "Failed to export buffer %d, plane %d\n",
+   buffer, plane);
+   return -EINVAL;
+   }
+
+   ret = dma_buf_fd(dbuf, eb->flags);
+   if (ret < 0) {
+   dprintk(3, "buffer %d, plane %d failed to export (%d)\n",
+   buffer, plane, ret);
+   dma_buf_put(dbuf);
+   return ret;
+   }
+
+   dprintk(3, "buffer %d, plane %d exported as %d descriptor\n",
+   buffer, plane, ret);
+   eb->fd = ret;
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(vb2_expbuf);
+
+/**
  * vb2_mmap() - map video buffers into application address space
  * @q: videobuf2 queue
  * @vma:   vma passed to the mmap file operation handler in the driver
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index d079f92..fe01f95 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -81,6 +81,7 @@ struct vb2_fileio_data;
 struct vb2_mem_ops {
void*(*alloc)(void *alloc_ctx, unsigned long size);
void(*put)(void *buf_priv);
+   struct dma_buf *(*get_dmabuf)(void *buf_priv);
 
void*(*get_userptr)(void *alloc_ctx, unsigned long vaddr,
unsigned long size, int write);
@@ -350,6 +351,7 @@ int vb2_queue_init(struct vb2_queue *q);
 void vb2_queue_release(struct vb2_queue *q);
 
 int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b);
+int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb);
 int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking);
 
 int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type);
-- 
1.7.9.5

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


[PATCHv2 7/9] v4l: s5p-tv: mixer: support for dmabuf exporting

2012-06-14 Thread Tomasz Stanislawski
This patch enhances s5p-tv with support for DMABUF exporting via
VIDIOC_EXPBUF ioctl.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
---
 drivers/media/video/s5p-tv/mixer_video.c |   10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/media/video/s5p-tv/mixer_video.c 
b/drivers/media/video/s5p-tv/mixer_video.c
index cff974a..d8def5b 100644
--- a/drivers/media/video/s5p-tv/mixer_video.c
+++ b/drivers/media/video/s5p-tv/mixer_video.c
@@ -697,6 +697,15 @@ static int mxr_dqbuf(struct file *file, void *priv, struct 
v4l2_buffer *p)
return vb2_dqbuf(&layer->vb_queue, p, file->f_flags & O_NONBLOCK);
 }
 
+static int mxr_expbuf(struct file *file, void *priv,
+   struct v4l2_exportbuffer *eb)
+{
+   struct mxr_layer *layer = video_drvdata(file);
+
+   mxr_dbg(layer->mdev, "%s:%d\n", __func__, __LINE__);
+   return vb2_expbuf(&layer->vb_queue, eb);
+}
+
 static int mxr_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
 {
struct mxr_layer *layer = video_drvdata(file);
@@ -724,6 +733,7 @@ static const struct v4l2_ioctl_ops mxr_ioctl_ops = {
.vidioc_querybuf = mxr_querybuf,
.vidioc_qbuf = mxr_qbuf,
.vidioc_dqbuf = mxr_dqbuf,
+   .vidioc_expbuf = mxr_expbuf,
/* Streaming control */
.vidioc_streamon = mxr_streamon,
.vidioc_streamoff = mxr_streamoff,
-- 
1.7.9.5

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


[PATCHv2 5/9] v4l: vb2-dma-contig: add support for DMABUF exporting

2012-06-14 Thread Tomasz Stanislawski
This patch adds support for exporting a dma-contig buffer using
DMABUF interface.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
---
 drivers/media/video/videobuf2-dma-contig.c |  248 
 1 file changed, 248 insertions(+)

diff --git a/drivers/media/video/videobuf2-dma-contig.c 
b/drivers/media/video/videobuf2-dma-contig.c
index 00b776c..a845ff7 100644
--- a/drivers/media/video/videobuf2-dma-contig.c
+++ b/drivers/media/video/videobuf2-dma-contig.c
@@ -36,6 +36,7 @@ struct vb2_dc_buf {
/* MMAP related */
struct vb2_vmarea_handler   handler;
atomic_trefcount;
+   struct sg_table *sgt_base;
 
/* USERPTR related */
struct vm_area_struct   *vma;
@@ -142,6 +143,10 @@ static void vb2_dc_put(void *buf_priv)
if (!atomic_dec_and_test(&buf->refcount))
return;
 
+   if (buf->sgt_base) {
+   sg_free_table(buf->sgt_base);
+   kfree(buf->sgt_base);
+   }
dma_free_coherent(buf->dev, buf->size, buf->vaddr, buf->dma_addr);
kfree(buf);
 }
@@ -213,6 +218,248 @@ static int vb2_dc_mmap(void *buf_priv, struct 
vm_area_struct *vma)
 }
 
 /*/
+/* DMABUF ops for exporters  */
+/*/
+
+struct vb2_dc_attachment {
+   struct sg_table sgt;
+   enum dma_data_direction dir;
+};
+
+static int vb2_dc_dmabuf_ops_attach(struct dma_buf *dbuf, struct device *dev,
+   struct dma_buf_attachment *dbuf_attach)
+{
+   struct vb2_dc_attachment *attach;
+   unsigned int i;
+   struct scatterlist *rd, *wr;
+   struct sg_table *sgt;
+   struct vb2_dc_buf *buf = dbuf->priv;
+   int ret;
+
+   attach = kzalloc(sizeof *attach, GFP_KERNEL);
+   if (!attach)
+   return -ENOMEM;
+
+   sgt = &attach->sgt;
+   /* Copy the buf->base_sgt scatter list to the attachment, as we can't
+* map the same scatter list to multiple attachments at the same time.
+*/
+   ret = sg_alloc_table(sgt, buf->sgt_base->orig_nents, GFP_KERNEL);
+   if (ret) {
+   kfree(attach);
+   return -ENOMEM;
+   }
+
+   rd = buf->sgt_base->sgl;
+   wr = sgt->sgl;
+   for (i = 0; i < sgt->orig_nents; ++i) {
+   sg_set_page(wr, sg_page(rd), rd->length, rd->offset);
+   rd = sg_next(rd);
+   wr = sg_next(wr);
+   }
+
+   attach->dir = DMA_NONE;
+   dbuf_attach->priv = attach;
+
+   return 0;
+}
+
+static void vb2_dc_dmabuf_ops_detach(struct dma_buf *dbuf,
+   struct dma_buf_attachment *db_attach)
+{
+   struct vb2_dc_attachment *attach = db_attach->priv;
+   struct sg_table *sgt;
+
+   if (!attach)
+   return;
+
+   sgt = &attach->sgt;
+
+   /* release the scatterlist cache */
+   if (attach->dir != DMA_NONE)
+   dma_unmap_sg(db_attach->dev, sgt->sgl, sgt->orig_nents,
+   attach->dir);
+   sg_free_table(sgt);
+   kfree(attach);
+   db_attach->priv = NULL;
+}
+
+static struct sg_table *vb2_dc_dmabuf_ops_map(
+   struct dma_buf_attachment *db_attach, enum dma_data_direction dir)
+{
+   struct vb2_dc_attachment *attach = db_attach->priv;
+   /* stealing dmabuf mutex to serialize map/unmap operations */
+   struct mutex *lock = &db_attach->dmabuf->lock;
+   struct sg_table *sgt;
+   int ret;
+
+   mutex_lock(lock);
+
+   sgt = &attach->sgt;
+   /* return previously mapped sg table */
+   if (attach->dir == dir) {
+   mutex_unlock(lock);
+   return sgt;
+   }
+
+   /* release any previous cache */
+   if (attach->dir != DMA_NONE) {
+   dma_unmap_sg(db_attach->dev, sgt->sgl, sgt->orig_nents,
+   attach->dir);
+   attach->dir = DMA_NONE;
+   }
+
+   /* mapping to the client with new direction */
+   ret = dma_map_sg(db_attach->dev, sgt->sgl, sgt->orig_nents, dir);
+   if (ret <= 0) {
+   printk(KERN_ERR "failed to map scatterlist\n");
+   mutex_unlock(lock);
+   return ERR_PTR(-EIO);
+   }
+
+   attach->dir = dir;
+
+   mutex_unlock(lock);
+
+   return sgt;
+}
+
+static void vb2_dc_dmabuf_ops_unmap(struct dma_buf_attachment *db_attach,
+   struct sg_table *sgt, enum dma_data_direction dir)
+{
+   /* nothing to be done here */
+}
+
+static void vb2_dc_dmabuf_ops_release(struct dma_buf *dbuf)
+{
+   /* drop reference obtained in vb2_dc_get_dmabuf */
+   vb2_dc_put(dbuf->priv);
+}
+
+static void *vb2_dc_dmabuf_ops_kmap(struct dma_buf *dbuf, unsigned long pgnum)
+{
+   struct vb2_dc_buf *buf = dbuf->priv;
+
+   return buf->vaddr + pgnum * PAGE_SIZE;
+}
+
+static void *vb2_dc_dmabuf_ops_vmap(struct dma_buf *dbuf)
+{
+   struct

[PATCHv2 8/9] v4l: s5p-mfc: support for dmabuf exporting

2012-06-14 Thread Tomasz Stanislawski
This patch enhances s5p-mfc with support for DMABUF exporting via
VIDIOC_EXPBUF ioctl.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
CC: Kamil Debski 
---
 drivers/media/video/s5p-mfc/s5p_mfc_dec.c |   18 ++
 drivers/media/video/s5p-mfc/s5p_mfc_enc.c |   18 ++
 2 files changed, 36 insertions(+)

diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c 
b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c
index c25ec02..8344ce5 100644
--- a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c
@@ -564,6 +564,23 @@ static int vidioc_dqbuf(struct file *file, void *priv, 
struct v4l2_buffer *buf)
return -EINVAL;
 }
 
+/* Export DMA buffer */
+static int vidioc_expbuf(struct file *file, void *priv,
+   struct v4l2_exportbuffer *eb)
+{
+   struct s5p_mfc_ctx *ctx = fh_to_ctx(priv);
+   int ret;
+
+   if (eb->mem_offset < DST_QUEUE_OFF_BASE)
+   return vb2_expbuf(&ctx->vq_src, eb);
+
+   eb->mem_offset -= DST_QUEUE_OFF_BASE;
+   ret = vb2_expbuf(&ctx->vq_dst, eb);
+   eb->mem_offset += DST_QUEUE_OFF_BASE;
+
+   return ret;
+}
+
 /* Stream on */
 static int vidioc_streamon(struct file *file, void *priv,
   enum v4l2_buf_type type)
@@ -739,6 +756,7 @@ static const struct v4l2_ioctl_ops s5p_mfc_dec_ioctl_ops = {
.vidioc_querybuf = vidioc_querybuf,
.vidioc_qbuf = vidioc_qbuf,
.vidioc_dqbuf = vidioc_dqbuf,
+   .vidioc_expbuf = vidioc_expbuf,
.vidioc_streamon = vidioc_streamon,
.vidioc_streamoff = vidioc_streamoff,
.vidioc_g_crop = vidioc_g_crop,
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c 
b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c
index acedb20..db110c5 100644
--- a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c
@@ -1141,6 +1141,23 @@ static int vidioc_dqbuf(struct file *file, void *priv, 
struct v4l2_buffer *buf)
return -EINVAL;
 }
 
+/* Export DMA buffer */
+static int vidioc_expbuf(struct file *file, void *priv,
+   struct v4l2_exportbuffer *eb)
+{
+   struct s5p_mfc_ctx *ctx = fh_to_ctx(priv);
+   int ret;
+
+   if (eb->mem_offset < DST_QUEUE_OFF_BASE)
+   return vb2_expbuf(&ctx->vq_src, eb);
+
+   eb->mem_offset -= DST_QUEUE_OFF_BASE;
+   ret = vb2_expbuf(&ctx->vq_dst, eb);
+   eb->mem_offset += DST_QUEUE_OFF_BASE;
+
+   return ret;
+}
+
 /* Stream on */
 static int vidioc_streamon(struct file *file, void *priv,
   enum v4l2_buf_type type)
@@ -1486,6 +1503,7 @@ static const struct v4l2_ioctl_ops s5p_mfc_enc_ioctl_ops 
= {
.vidioc_querybuf = vidioc_querybuf,
.vidioc_qbuf = vidioc_qbuf,
.vidioc_dqbuf = vidioc_dqbuf,
+   .vidioc_expbuf = vidioc_expbuf,
.vidioc_streamon = vidioc_streamon,
.vidioc_streamoff = vidioc_streamoff,
.vidioc_s_parm = vidioc_s_parm,
-- 
1.7.9.5

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


[PATCHv2 9/9] v4l: vb2-dma-contig: use dma_get_sgtable

2012-06-14 Thread Tomasz Stanislawski
This patch removes a workaround for extraction of struct pages
from DMA buffer. The method of using follow_pfn for artificial
VMA is dropped in favour of dma_get_sgtable function.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
---
 drivers/media/video/videobuf2-dma-contig.c |   60 ++--
 1 file changed, 4 insertions(+), 56 deletions(-)

diff --git a/drivers/media/video/videobuf2-dma-contig.c 
b/drivers/media/video/videobuf2-dma-contig.c
index a845ff7..73297b7 100644
--- a/drivers/media/video/videobuf2-dma-contig.c
+++ b/drivers/media/video/videobuf2-dma-contig.c
@@ -361,73 +361,21 @@ static struct dma_buf_ops vb2_dc_dmabuf_ops = {
.release = vb2_dc_dmabuf_ops_release,
 };
 
-/**
- * vb2_dc_kaddr_to_pages() - extract list of struct pages from a kernel
- * pointer.  This function is a workaround to extract pages from a pointer
- * returned by dma_alloc_coherent. The pages are obtained by creating an
- * artificial vma and using follow_pfn to do a page walk to find a PFN
- */
-static int vb2_dc_kaddr_to_pages(unsigned long kaddr,
-   struct page **pages, unsigned int n_pages)
-{
-   unsigned int i;
-   unsigned long pfn;
-   /* create an artificial VMA */
-   struct vm_area_struct vma = {
-   .vm_flags = VM_IO | VM_PFNMAP,
-   .vm_mm = &init_mm,
-   };
-
-   for (i = 0; i < n_pages; ++i, kaddr += PAGE_SIZE) {
-   if (follow_pfn(&vma, kaddr, &pfn))
-   break;
-   pages[i] = pfn_to_page(pfn);
-   }
-
-   return i;
-}
-
 static struct sg_table *vb2_dc_get_base_sgt(struct vb2_dc_buf *buf)
 {
-   int n_pages;
-   struct page **pages = NULL;
int ret;
struct sg_table *sgt;
 
-   n_pages = PAGE_ALIGN(buf->size) >> PAGE_SHIFT;
-
-   pages = kmalloc(n_pages * sizeof pages[0], GFP_KERNEL);
-   if (!pages) {
-   dev_err(buf->dev, "failed to alloc page table\n");
-   return ERR_PTR(-ENOMEM);
-   }
-
-   ret = vb2_dc_kaddr_to_pages((unsigned long)buf->vaddr, pages, n_pages);
-   if (ret < 0) {
-   dev_err(buf->dev, "failed to get buffer pages from DMA API\n");
-   kfree(pages);
-   return ERR_PTR(ret);
-   }
-   if (ret != n_pages) {
-   dev_err(buf->dev, "got only %d of %d pages from DMA API\n",
-   ret, n_pages);
-   kfree(pages);
-   return ERR_PTR(-EFAULT);
-   }
-
sgt = kmalloc(sizeof *sgt, GFP_KERNEL);
if (!sgt) {
dev_err(buf->dev, "failed to alloc sg table\n");
-   kfree(pages);
return ERR_PTR(-ENOMEM);
}
 
-   ret = sg_alloc_table_from_pages(sgt, pages, n_pages, 0,
-   buf->size, GFP_KERNEL);
-   /* failure or not, pages are no longer needed */
-   kfree(pages);
-   if (ret) {
-   dev_err(buf->dev, "failed to covert pages to sg table\n");
+   ret = dma_get_sgtable(buf->dev, sgt, buf->vaddr, buf->dma_addr,
+   buf->size, NULL);
+   if (ret < 0) {
+   dev_err(buf->dev, "failed to get scatterlist from DMA API\n");
kfree(sgt);
return ERR_PTR(ret);
}
-- 
1.7.9.5

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


Re: [RFC] i.MX DRM devicetree binding

2012-06-14 Thread Sascha Hauer
On Thu, Jun 14, 2012 at 04:10:16PM +0200, David Jander wrote:
> On Thu, 14 Jun 2012 15:07:56 +0200
> Sascha Hauer  wrote:
> 
> > +
> > +Required properties:
> > +- compatible: Should be "fsl,imx-parallel-display"
> > +- crtc: the crtc this display is connected to, see below
> > +Optional properties:
> > +- interface_pix_fmt: How this display is connected to the
> > +  crtc. Currently supported types: "rgb24", "rgb565"
> > +- edid: verbatim EDID data block describing attached display.
> 
> I never really understood why one should put EDID data in a device-tree. It
> carries a lot of irrelevant information and is in a quite hostile format. The
> only reason it exists actually is historically grown "intelligency" built into
> VESA compatible CRT monitors for PC's what do _we_ have to do with that?
> There isn't even a decent tool to generate this data on linux.
> On top of that, the examples I have seen of EDID blobs in device-trees so far
> are just plain wrong and even contain device id's from "Samsung SyncMaster"
> and other such stuff that IMHO has no place here.
> 
> But we need an alternative way of communicating timing parameters. Can't we
> use something more ad-hoc, like the data one would give to DRM_MODE() in
> drm_crtc.h?

Generally +1 for this.

I Just don't want to open up another front for now, but I am willing to
support a generic (not i.MX specific) format to describe display timings
in devicetree.

The only discussion I know about was here:

https://lists.ozlabs.org/pipermail/linuxppc-dev/2010-February/080683.html

The outcome was that the suggested format was not entirely generic and
that it would be better to use some existing format rather than
inventing something new. I disagree here. The thing called modeline,
drm_display_mode or fb_videomode is well established and it is known
which parameters (most) displays need, so it should be possible to have
a generic display description in the devicetree.

However, we need EDID data parsing anyway in the kernel and being able
to overwrite the (maybe broken monitor supplied) EDID data in the
devicetree might become handy. So having this way of supplying EDID data
is good to have even if there is a generic display description.

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

2012-06-14 Thread Jerome Glisse
On Thu, Jun 14, 2012 at 12:04 AM, llittle了了  wrote:
> Yes, I transplant the radeon_driver from 64bit_kernel to a mini 32bit_os.
> The purpose is to open radeon_benchmark  or Xorg in the mini_32bit_os.
> So, I think ring_test success means GPU  work correctly and smmothly.
>
> But ,my ring_test in the mini_32bit_os does not success. When I read scratch
> register, it`s not the value wrote into the memory location.So, I think the
> address space does not map correct.
>
>>> |--系统内存--|--显存--|--GTT内存--|
>>> 0   256M 384M896M
>
> Such memory alloction in my mini32bit_os has been build up. There are
> differences between linux-kernel and my mini32bit_os :
> first,  mymini32bit_os does not have TTM;
> second, the mini32bit_os use 0x8000,-0x9000, virtual address
> which map to 0x00x1000, physical address . While linux-kernel use
> 0x9800,,fc24,0x9800,,ff00, CPU vritual address which map
> to 0x,,fc24,0x,,ff00, physical address.I have 2g
> memory.
>
> I also use gart_table to tell GPU my mini32bit_os address. set_gart_pages.
> But ring_test still does not work. If we can use gart_table to tell GPU the
> ring_buffer memory location, I alloc the ring_buffer from the low 16M
> memory, then fill the gart_table, GPU would konw that address and ring_test
> would sucess. But, when I use the low 16M memory for ring_buffer, ring_test
> faile d. I have reserved the low 16M memory  at the boot time.
>
> That is the exactly confused me. Why? I move ring_buffer any other palace,
> ring_test will not work?
>
>

Virtual address space does not matter for the GPU, what you need to
program is physical page address into GPU gart.

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


Re: [PATCH 00/25] i915 HW context support

2012-06-14 Thread Daniel Vetter
On Mon, Jun 04, 2012 at 02:42:40PM -0700, Ben Widawsky wrote:
> Setting myself up for a late night crying session once again. Most of the
> people reading this probably know the history and reasons for the patches. If
> not, you can search the intel-gfx mailing list to try to learn more. I won't
> recap the whole thing here, and instead let the patches speak for themselves.
> 
> Instead a brief review of what's here, and what's happened. Mostly,
> these badly need testing and review. I've carried these around for so
> long now, and seen so many different failures, I'm quite paranoid they
> still aren't perfect. Also, I've spent almost all of the time working on
> this in the kernel, so there is bound to be simple errors in the other
> stuff.
> 
> I've run these on various workloads and saw nothing worth mentioning.

Ok, my little attempt at in-situ bikeshedding failed, so I've just slurped
in your patches directly and only applied the minimal change to get rid of
object->context_id.

Please commit the i-g-t testcase so that qa can start testing this aspa.

Cheers, Daniel
-- 
Daniel Vetter
Mail: dan...@ffwll.ch
Mobile: +41 (0)79 365 57 48
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [RFC] i.MX DRM devicetree binding

2012-06-14 Thread David Jander
On Thu, 14 Jun 2012 15:07:56 +0200
Sascha Hauer  wrote:

> Hi All,
> 
> The following is an attempt to come up with a devicetree binding for
> DRM graphics on i.MX SoCs. I'm posting this seperate from the actual
> code to not bury this in big patches.
> 
> The bindings should cover most of the problems we had while implementing
> the possible IPU <-> (LVDS, HDMI, parallel) Display connections.
> 
> Contrary to some other devicetree bindings I have seen we decided not
> to make the displays subnodes of the graphics unit because the (LVDS,
> HDMI) encoders are outside the graphics units and also on i.MX6 there
> are 2 IPUs and displays can be muxed between these IPUs.

Sounds great!

> Comments and suggestions welcome.

Here you are:

> Sascha
> 
> 8<--
> 
> DRM i.MX: Add devicetree binding documentation
> 
> Signed-off-by: Philipp Zabel 
> Signed-off-by: Sascha Hauer 
> ---
>  .../devicetree/bindings/drm/fsl-imx-drm.txt|  126 
> 
>  1 file changed, 126 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/drm/fsl-imx-drm.txt
> 
> diff --git a/Documentation/devicetree/bindings/drm/fsl-imx-drm.txt 
> b/Documentation/devicetree/bindings/drm/fsl-imx-drm.txt
> new file mode 100644
> index 000..6766e03
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/drm/fsl-imx-drm.txt
> @@ -0,0 +1,126 @@
> +Freescale i.MX IPUv3
> +
> +
> +Required properties:
> +- compatible: Should be "fsl,-ipu"
> +- reg: should be register base and length as documented in the
> +  datasheet
> +- interrupts: Should contain sync interrupt and error interrupt,
> +  in this order.
> +- #crtc-cells: 1, See below
> +
> +example:
> +
> +ipu: ipu@1800 {
> + #crtc-cells = <1>;
> + compatible = "fsl,imx53-ipu";
> + reg = <0x1800 0x08000>;
> + interrupts = <11 10>;
> +};
> +
> +Freescale i.MX LCDC controller
> +==
> +
> +Required properties:
> +- compatible: Should be "fsl,-lcdc"
> +- reg: should be register base and length as documented in the
> +  datasheet
> +- interrupts: Should contain interrupt
> +- #crtc-cells: 0, See below
> +
> +example:
> +
> +lcdc: lcdc@10021000 {
> + #crtc-cells = <0>;
> + compatible = "fsl,imx27-lcdc", "fsl,imx21-lcdc";
> + reg = <0x10021000 0x4000>;
> + interrupts = <61>;
> +};
> +
> +Parallel display support
> +
> +
> +Required properties:
> +- compatible: Should be "fsl,imx-parallel-display"
> +- crtc: the crtc this display is connected to, see below
> +Optional properties:
> +- interface_pix_fmt: How this display is connected to the
> +  crtc. Currently supported types: "rgb24", "rgb565"
> +- edid: verbatim EDID data block describing attached display.

I never really understood why one should put EDID data in a device-tree. It
carries a lot of irrelevant information and is in a quite hostile format. The
only reason it exists actually is historically grown "intelligency" built into
VESA compatible CRT monitors for PC's what do _we_ have to do with that?
There isn't even a decent tool to generate this data on linux.
On top of that, the examples I have seen of EDID blobs in device-trees so far
are just plain wrong and even contain device id's from "Samsung SyncMaster"
and other such stuff that IMHO has no place here.

But we need an alternative way of communicating timing parameters. Can't we
use something more ad-hoc, like the data one would give to DRM_MODE() in
drm_crtc.h?

> +- ddc: phandle describing the i2c bus handling the display data
> +  channel
> +
> +example:
> +
> +display@di0 {
> + compatible = "fsl,imx-parallel-display";
> + edid = [edid-data];
> + crtc = <&ipu 0>;
> + interface_pix_fmt = "rgb24";
> +};
> +
> +LVDS display bridge (LDB)
> +=
> +
> +Required properties:
> +- compatible: Should be "fsl,-ldb"
> +- channel0-crtcs, channel1-crtcs: the crtcs the ldb is connected to, see
> +  below
> +Optional properties:
> +- channel0-edid, channel1-edid: verbatim EDID data blocks describing the
> +  displays attached to channel0 and channel1.
> +- channel0-ddc, channel1-ddc: phandles describing the i2c busses handling
> +  the display data channels for channel0 and channel1.

Same rant here... missing a humane way of specifying timing data.

> +
> +lvds@53fa8008 {
> + compatible = "fsl,imx6q-ldb";
> + channel0-edid = [edid-data];
> + channel1-ddc = <&i2c0>;
> + channel0-crtcs = <&ipu0 0>, <&ipu0 1>, <&ipu1 0>, <&ipu1 1>;
> + channel1-crtcs = <&ipu0 0>, <&ipu0 1>, <&ipu1 0>, <&ipu1 1>;
> +};
> +
> +Specifying CRTCs connected to display output devices
> +
> +
> +Display output device nodes should specify which CRTCs they can be
> +connected to in their crtcs property, containing a 'crtc-list':
> +
> + crtc-list ::=  [crtc-list]
> + single-crtc ::=  
> + crtc-phandle : phandle to device

Re: [RFC] i.MX DRM devicetree binding

2012-06-14 Thread David Jander
On Thu, 14 Jun 2012 16:45:33 +0200
Sascha Hauer  wrote:

> On Thu, Jun 14, 2012 at 04:10:16PM +0200, David Jander wrote:
> > On Thu, 14 Jun 2012 15:07:56 +0200
> > Sascha Hauer  wrote:
> > 
> > > +
> > > +Required properties:
> > > +- compatible: Should be "fsl,imx-parallel-display"
> > > +- crtc: the crtc this display is connected to, see below
> > > +Optional properties:
> > > +- interface_pix_fmt: How this display is connected to the
> > > +  crtc. Currently supported types: "rgb24", "rgb565"
> > > +- edid: verbatim EDID data block describing attached display.
> > 
> > I never really understood why one should put EDID data in a device-tree. It
> > carries a lot of irrelevant information and is in a quite hostile format. 
> > The
> > only reason it exists actually is historically grown "intelligency" built 
> > into
> > VESA compatible CRT monitors for PC's what do _we_ have to do with that?
> > There isn't even a decent tool to generate this data on linux.
> > On top of that, the examples I have seen of EDID blobs in device-trees so 
> > far
> > are just plain wrong and even contain device id's from "Samsung SyncMaster"
> > and other such stuff that IMHO has no place here.
> > 
> > But we need an alternative way of communicating timing parameters. Can't we
> > use something more ad-hoc, like the data one would give to DRM_MODE() in
> > drm_crtc.h?
> 
> Generally +1 for this.

Thanks ;-)

> I Just don't want to open up another front for now, but I am willing to
> support a generic (not i.MX specific) format to describe display timings
> in devicetree.

I understand.

> The only discussion I know about was here:
> 
> https://lists.ozlabs.org/pipermail/linuxppc-dev/2010-February/080683.html

Oh yeah. I remember vaguely having dealt with that one. I think we actually use
the code being discussed there on another boards, and also remember feeling
acute pain from tying to figure out how to cough up some useful EDID data blob
for our LCD panels. It felt wrong on all ends, and I think I ended up hacking
something around this in order to avoid having to deal with EDID.

> The outcome was that the suggested format was not entirely generic and
> that it would be better to use some existing format rather than
> inventing something new. I disagree here. The thing called modeline,
> drm_display_mode or fb_videomode is well established and it is known
> which parameters (most) displays need, so it should be possible to have
> a generic display description in the devicetree.

Right! It really can't be that complicated.

> However, we need EDID data parsing anyway in the kernel and being able

Why? This also feels almost entirely wrong, specially on an embedded system.
IMHO, encoders that actually receive EDID data via legacy DDC interfaces,
should convert this data immediately to generic timing data, and the kernel
should use that instead. But I agree that this is a different discussion and
should be held elsewhere.

> to overwrite the (maybe broken monitor supplied) EDID data in the
> devicetree might become handy. So having this way of supplying EDID data
> is good to have even if there is a generic display description.

I don't see why it would be good to have, but I agree that since it is
optional, it can perfectly well be ignored and we can use something else
instead. In fact, once there is "something else", I doubt anyone would want to
use EDID in a device-tree. EVK's like Babbage and LOCO have DDC interfaces,
and all other real embedded systems I can think of would rather benefit from
more straight-forward timing information, which can probably be copied almost
verbatim from the datasheet of the LCD panel.

Best regards,

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


[Bug 14274] radeon KMS unusable on RadeonHD 3650

2012-06-14 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=14274


Jérôme Glisse  changed:

   What|Removed |Added

 Status|NEEDINFO|CLOSED
 Resolution||CODE_FIX




-- 
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 14535] Memory corruption detected in low memory

2012-06-14 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=14535


Alan  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||OBSOLETE




--- Comment #34 from Alan   2012-06-14 16:43:57 ---
Closing as fixed as the original bug filed here was fixed

razamatan - if your bug is still present please open a new bug

-- 
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 14535] Memory corruption detected in low memory

2012-06-14 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=14535


Alan  changed:

   What|Removed |Added

 Status|RESOLVED|CLOSED
 Resolution|OBSOLETE|CODE_FIX




-- 
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 14574] using a displayport connector results in stack in dmesg and blank screen

2012-06-14 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=14574


Alan  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||a...@lxorguk.ukuu.org.uk
 Resolution||OBSOLETE




-- 
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 14574] using a displayport connector results in stack in dmesg and blank screen

2012-06-14 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=14574


Alan  changed:

   What|Removed |Added

 Status|RESOLVED|CLOSED




-- 
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 14575] using a hdmi connector frame buffer resolution maxes out at 1920x1200

2012-06-14 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=14575


Alan  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||a...@lxorguk.ukuu.org.uk
 Resolution||DOCUMENTED




-- 
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 14575] using a hdmi connector frame buffer resolution maxes out at 1920x1200

2012-06-14 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=14575


Alan  changed:

   What|Removed |Added

 Status|RESOLVED|CLOSED




-- 
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 14993] suspend-to-ram broken on my d630 since 2.6.31

2012-06-14 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=14993


Alan  changed:

   What|Removed |Added

 Status|NEEDINFO|CLOSED
 CC||a...@lxorguk.ukuu.org.uk
 Resolution||OBSOLETE




-- 
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 15851] Switcheroo: Intel card not working after passing OFF to discrete card

2012-06-14 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=15851


Alan  changed:

   What|Removed |Added

 Status|NEEDINFO|CLOSED
 CC||a...@lxorguk.ukuu.org.uk
 Resolution||OBSOLETE




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


Re: RFC: Change OML_sync_control UST to CLOCK_MONOTONIC

2012-06-14 Thread Joakim Plate

> >
> > From what I can tell, it should be using: ktime_to_ns(ktime_get()) / 1000. 
Only
> > issue is that changing it will break any app relying on it being REALTIME 
clock.
> >
> 
> App that rely on it being anything special are badly broken and i
> don't think there is any such app. The specification strongly stress
> that app should make no assumption about it.
> 

While that may be true... Since there is no other API for getting this UST 
clock, it's somewhat limited in use. Even if i know vsync happened at time X, 
if 
don't know what time it is "now" how can i make use of it?

Spec says: "The Unadjusted System Time (or UST)
is a 64-bit monotonically increasing counter that is available
throughout the system."

If across the system, the only API to get to this value is through GLX api, 
it's 
rather hard to make use of.

For example syncing audio to vsync. One need to sync audio output written to 
audio renderer now, with this clock.

Also regarding relying on current behavior... Even if this change is made now, 
there will be a lot of system with the old behaviour. So knowning if the change 
has been made in a system is crucial for supporting both / not enabling when 
feature is unreliable.

/Joakim

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


Re: [3.4 regression] [bisected] DisplayPort fails to come on

2012-06-14 Thread Daniel Vetter
On Thu, Jun 14, 2012 at 7:14 PM, Wouter M. Koolen
 wrote:
> On 06/14/2012 03:48 PM, Wouter M. Koolen wrote:
>>
>> In the mean while I will redo the bisect.
>
> Hi guys,
>
> I did a bisect on the actual problem (and not on the maybe-related second
> error message). It results in 092945e11c5b84f66dd08f0b87fb729715d377bc:
>
> Author: Adam Jackson   2011-07-26 20:39:45
> Committer: Daniel Vetter   2012-01-17 15:46:56
> Parent: 6919132e7a307b1f181d7655b3ef64cc7581a5ef (drm/i915/dp: Tweak auxch
> clock divider for PCH)
> Branches: linux-3.4.y, remotes/origin/linux-3.4.y, remotes/origin/master
> Follows: v3.2-rc6
> Precedes: v3.4-rc1
>
>    drm/i915/dp: Use auxch precharge value of 5 everywhere
>
>    The default in the Sandybridge docs is 5, as on Ironlake, and I have no
>    reason to believe 3 would work any better.
>
>    Signed-off-by: Adam Jackson 
>    Acked-by: Jesse Barnes 
>    Signed-off-by: Daniel Vetter 
>
> I guess there is your reason for 3 :)
>
> Any advice on how to proceed would be very helpful.

Well, can you revert this patch (or just replace the 5 with 3 in the
code) on top of latest 3.4.x and test whether this is indeed the cause
of your regression? Just to make sure that we have the right culprit.

Thanks, Daniel
-- 
Daniel Vetter
daniel.vet...@ffwll.ch - +41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 18872] [RADEON:KMS:R100:SUSPEND] suspend to ram problems

2012-06-14 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=18872


Alan  changed:

   What|Removed |Added

 CC||a...@lxorguk.ukuu.org.uk
 Kernel Version|2.6.36-rc4  |2.6.39




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


Re: RFC: Change OML_sync_control UST to CLOCK_MONOTONIC

2012-06-14 Thread Jerome Glisse
On Thu, Jun 14, 2012 at 1:19 PM, Joakim Plate  wrote:
>
>> >
>> > From what I can tell, it should be using: ktime_to_ns(ktime_get()) / 1000.
> Only
>> > issue is that changing it will break any app relying on it being REALTIME
> clock.
>> >
>>
>> App that rely on it being anything special are badly broken and i
>> don't think there is any such app. The specification strongly stress
>> that app should make no assumption about it.
>>
>
> While that may be true... Since there is no other API for getting this UST
> clock, it's somewhat limited in use. Even if i know vsync happened at time X, 
> if
> don't know what time it is "now" how can i make use of it?
>
> Spec says: "The Unadjusted System Time (or UST)
>    is a 64-bit monotonically increasing counter that is available
>    throughout the system."
>
> If across the system, the only API to get to this value is through GLX api, 
> it's
> rather hard to make use of.
>
> For example syncing audio to vsync. One need to sync audio output written to
> audio renderer now, with this clock.
>
> Also regarding relying on current behavior... Even if this change is made now,
> there will be a lot of system with the old behaviour. So knowning if the 
> change
> has been made in a system is crucial for supporting both / not enabling when
> feature is unreliable.
>
> /Joakim
>

This extension is not for predicting when is the next vblank and it's
wrong to try to use it for that. My understanding is that you should
use this extension for instance to show N video frame per second,
based on the number of frame you play per second you can synchronize
sounds output.

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


Re: RFC: Change OML_sync_control UST to CLOCK_MONOTONIC

2012-06-14 Thread Jerome Glisse
On Thu, Jun 14, 2012 at 2:17 PM, Jerome Glisse  wrote:
> On Thu, Jun 14, 2012 at 1:19 PM, Joakim Plate  wrote:
>>
>>> >
>>> > From what I can tell, it should be using: ktime_to_ns(ktime_get()) / 1000.
>> Only
>>> > issue is that changing it will break any app relying on it being REALTIME
>> clock.
>>> >
>>>
>>> App that rely on it being anything special are badly broken and i
>>> don't think there is any such app. The specification strongly stress
>>> that app should make no assumption about it.
>>>
>>
>> While that may be true... Since there is no other API for getting this UST
>> clock, it's somewhat limited in use. Even if i know vsync happened at time 
>> X, if
>> don't know what time it is "now" how can i make use of it?
>>
>> Spec says: "The Unadjusted System Time (or UST)
>>    is a 64-bit monotonically increasing counter that is available
>>    throughout the system."
>>
>> If across the system, the only API to get to this value is through GLX api, 
>> it's
>> rather hard to make use of.
>>
>> For example syncing audio to vsync. One need to sync audio output written to
>> audio renderer now, with this clock.
>>
>> Also regarding relying on current behavior... Even if this change is made 
>> now,
>> there will be a lot of system with the old behaviour. So knowning if the 
>> change
>> has been made in a system is crucial for supporting both / not enabling when
>> feature is unreliable.
>>
>> /Joakim
>>
>
> This extension is not for predicting when is the next vblank and it's
> wrong to try to use it for that. My understanding is that you should
> use this extension for instance to show N video frame per second,
> based on the number of frame you play per second you can synchronize
> sounds output.
>
> Cheers,
> Jerome

Note that if you really think that you need something like
GLX_OML_sync_control but with UST being some sensible value from the
system that you can query by other mean we could easily add a new mesa
extension GLX_MESA_sync_control that properly defines ust and keep
everything else the same. Then we can fix the kernel and expose this
extension only on fixed kernel. Of course this would probably only be
available on open source driver but with a bit of lobying nvidia & amd
might pick the extension in their closed source driver.

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


[Bug 39309] vdpau decodes noise on rv350

2012-06-14 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=39309

--- Comment #10 from Chris Rankin  2012-06-14 12:00:54 
PDT ---
I've just tested Mesa -git containing the following commit:

commit eb024c74885778ab1ffa6dc590116959bb526c2e
Author: Christian König 
Date:   Wed Jun 6 17:53:58 2012 +0200

st/vdpau: fix YCbCr down/up-loads for buffers larger than requested

When the video buffer turns out to be larger than
requested by the application we shouldn't upload
or download more data into / from it original requested.

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

Signed-off-by: Christian König 

My RV350 still decodes green noise, given the following command line:

$ LD_LIBRARY_PATH=/home/chris/local-mesa/lib/vdpau mplayer -vo vdpau -vc
ffmpeg12vdpau /video/xine/DVB-MPEG2-CAPTURE.ts

-- 
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 43367] radeon: NULL pointer dereference on switching to dynpm power method

2012-06-14 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=43367


Christoph Haag  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||CODE_FIX




--- Comment #2 from Christoph Haag   
2012-06-14 19:45:24 ---
The patch fixes it. Thank you. :)

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


[PATCH] drm/radeon: fix regression in dynpm due to multi-ring rework

2012-06-14 Thread alexdeucher
From: Alex Deucher 

Not all asics have all rings, so make sure the ring is ready
before attempting to check it in the dynpm work handler.

Fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=43367

Signed-off-by: Alex Deucher 
---
 drivers/gpu/drm/radeon/radeon_pm.c |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_pm.c 
b/drivers/gpu/drm/radeon/radeon_pm.c
index 79642cd..7ae6066 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -793,9 +793,13 @@ static void radeon_dynpm_idle_work_handler(struct 
work_struct *work)
int i;
 
for (i = 0; i < RADEON_NUM_RINGS; ++i) {
-   not_processed += radeon_fence_count_emitted(rdev, i);
-   if (not_processed >= 3)
-   break;
+   struct radeon_ring *ring = &rdev->ring[i];
+
+   if (ring->ready) {
+   not_processed += 
radeon_fence_count_emitted(rdev, i);
+   if (not_processed >= 3)
+   break;
+   }
}
 
if (not_processed >= 3) { /* should upclock */
-- 
1.7.7.5

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


Re: [PATCH] drm/radeon: fix regression in dynpm due to multi-ring rework

2012-06-14 Thread Jerome Glisse
On Thu, Jun 14, 2012 at 3:54 PM,   wrote:
> From: Alex Deucher 
>
> Not all asics have all rings, so make sure the ring is ready
> before attempting to check it in the dynpm work handler.
>
> Fixes:
> https://bugzilla.kernel.org/show_bug.cgi?id=43367
>
> Signed-off-by: Alex Deucher 
Reviewed-by: Jerome Glisse 

> ---
>  drivers/gpu/drm/radeon/radeon_pm.c |   10 +++---
>  1 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_pm.c 
> b/drivers/gpu/drm/radeon/radeon_pm.c
> index 79642cd..7ae6066 100644
> --- a/drivers/gpu/drm/radeon/radeon_pm.c
> +++ b/drivers/gpu/drm/radeon/radeon_pm.c
> @@ -793,9 +793,13 @@ static void radeon_dynpm_idle_work_handler(struct 
> work_struct *work)
>                int i;
>
>                for (i = 0; i < RADEON_NUM_RINGS; ++i) {
> -                       not_processed += radeon_fence_count_emitted(rdev, i);
> -                       if (not_processed >= 3)
> -                               break;
> +                       struct radeon_ring *ring = &rdev->ring[i];
> +
> +                       if (ring->ready) {
> +                               not_processed += 
> radeon_fence_count_emitted(rdev, i);
> +                               if (not_processed >= 3)
> +                                       break;
> +                       }
>                }
>
>                if (not_processed >= 3) { /* should upclock */
> --
> 1.7.7.5
>
> ___
> 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


[PATCH] drm/radeon: SI tiling fixes for display

2012-06-14 Thread alexdeucher
From: Alex Deucher 

Signed-off-by: Alex Deucher 
---
 drivers/gpu/drm/radeon/atombios_crtc.c |   10 -
 drivers/gpu/drm/radeon/si_reg.h|   72 
 2 files changed, 81 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c 
b/drivers/gpu/drm/radeon/atombios_crtc.c
index 01d77d1..3904d79 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -1149,7 +1149,9 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
}
 
if (tiling_flags & RADEON_TILING_MACRO) {
-   if (rdev->family >= CHIP_CAYMAN)
+   if (rdev->family >= CHIP_TAHITI)
+   tmp = rdev->config.si.tile_config;
+   else if (rdev->family >= CHIP_CAYMAN)
tmp = rdev->config.cayman.tile_config;
else
tmp = rdev->config.evergreen.tile_config;
@@ -1177,6 +1179,12 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
} else if (tiling_flags & RADEON_TILING_MICRO)
fb_format |= 
EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1);
 
+   if ((rdev->family == CHIP_TAHITI) ||
+   (rdev->family == CHIP_PITCAIRN))
+   fb_format |= SI_GRPH_PIPE_CONFIG(SI_ADDR_SURF_P8_32x32_8x16);
+   else if (rdev->family == CHIP_VERDE)
+   fb_format |= SI_GRPH_PIPE_CONFIG(SI_ADDR_SURF_P4_8x16);
+
switch (radeon_crtc->crtc_id) {
case 0:
WREG32(AVIVO_D1VGA_CONTROL, 0);
diff --git a/drivers/gpu/drm/radeon/si_reg.h b/drivers/gpu/drm/radeon/si_reg.h
index eda938a..501f9d4 100644
--- a/drivers/gpu/drm/radeon/si_reg.h
+++ b/drivers/gpu/drm/radeon/si_reg.h
@@ -30,4 +30,76 @@
 #define SI_DC_GPIO_HPD_EN0x65b8
 #define SI_DC_GPIO_HPD_Y 0x65bc
 
+#define SI_GRPH_CONTROL  0x6804
+#   define SI_GRPH_DEPTH(x)  (((x) & 0x3) << 0)
+#   define SI_GRPH_DEPTH_8BPP0
+#   define SI_GRPH_DEPTH_16BPP   1
+#   define SI_GRPH_DEPTH_32BPP   2
+#   define SI_GRPH_NUM_BANKS(x)  (((x) & 0x3) << 2)
+#   define SI_ADDR_SURF_2_BANK   0
+#   define SI_ADDR_SURF_4_BANK   1
+#   define SI_ADDR_SURF_8_BANK   2
+#   define SI_ADDR_SURF_16_BANK  3
+#   define SI_GRPH_Z(x)  (((x) & 0x3) << 4)
+#   define SI_GRPH_BANK_WIDTH(x) (((x) & 0x3) << 6)
+#   define SI_ADDR_SURF_BANK_WIDTH_1 0
+#   define SI_ADDR_SURF_BANK_WIDTH_2 1
+#   define SI_ADDR_SURF_BANK_WIDTH_4 2
+#   define SI_ADDR_SURF_BANK_WIDTH_8 3
+#   define SI_GRPH_FORMAT(x) (((x) & 0x7) << 8)
+/* 8 BPP */
+#   define SI_GRPH_FORMAT_INDEXED0
+/* 16 BPP */
+#   define SI_GRPH_FORMAT_ARGB1555   0
+#   define SI_GRPH_FORMAT_ARGB5651
+#   define SI_GRPH_FORMAT_ARGB   2
+#   define SI_GRPH_FORMAT_AI88   3
+#   define SI_GRPH_FORMAT_MONO16 4
+#   define SI_GRPH_FORMAT_BGRA5551   5
+/* 32 BPP */
+#   define SI_GRPH_FORMAT_ARGB   0
+#   define SI_GRPH_FORMAT_ARGB21010101
+#   define SI_GRPH_FORMAT_32BPP_DIG  2
+#   define SI_GRPH_FORMAT_8B_ARGB2101010 3
+#   define SI_GRPH_FORMAT_BGRA10101024
+#   define SI_GRPH_FORMAT_8B_BGRA1010102 5
+#   define SI_GRPH_FORMAT_RGB10  6
+#   define SI_GRPH_FORMAT_BGR10  7
+#   define SI_GRPH_BANK_HEIGHT(x)(((x) & 0x3) << 11)
+#   define SI_ADDR_SURF_BANK_HEIGHT_10
+#   define SI_ADDR_SURF_BANK_HEIGHT_21
+#   define SI_ADDR_SURF_BANK_HEIGHT_42
+#   define SI_ADDR_SURF_BANK_HEIGHT_83
+#   define SI_GRPH_TILE_SPLIT(x) (((x) & 0x7) << 13)
+#   define SI_ADDR_SURF_TILE_SPLIT_64B   0
+#   define SI_ADDR_SURF_TILE_SPLIT_128B  1
+#   define SI_ADDR_SURF_TILE_SPLIT_256B  2
+#   define SI_ADDR_SURF_TILE_SPLIT_512B  3
+#   define SI_ADDR_SURF_TILE_SPLIT_1KB   4
+#   define SI_ADDR_SURF_TILE_SPLIT_2KB   5
+#   define SI_ADDR_SURF_TILE_SPLIT_4KB   6
+#   define SI_GRPH_MACRO_TILE_ASPECT(x)  (((x) & 0x3) << 18)
+#   define SI_ADDR_SURF_MACRO_TILE_ASPECT_1  0
+#   define SI_ADDR_SURF_MACRO_TILE_ASPECT_2  1
+#   define SI_ADDR_SURF_MACRO_TILE_ASPECT_4  2
+#   define SI_ADDR_SURF_MACRO_TILE_ASPECT_8  3
+#   define SI_GRPH_ARRAY_MODE(x) (((x) & 0x7) << 20)
+#   define SI_GRPH_ARRAY_LINEAR_GENERAL  0
+#   define SI_GRPH_ARRAY_LINEAR_ALIGNED  1
+#   define SI_GRPH_ARRAY_1D_TILED_THIN1  2
+#   define SI_GRPH_ARRAY_2D_TILED_THIN1  4
+#   define SI_GRPH_PIPE_CONFIG(x)   

[PATCH] Revert "drm/i915/dp: Use auxch precharge value of 5 everywhere"

2012-06-14 Thread Daniel Vetter
This reverts commit 092945e11c5b84f66dd08f0b87fb729715d377bc.

This commit prevents a DP screen from properly training the link.
Oddly enough it works, once the machine has been warm-boot with an
older kernel.

According to DP docs this _should_ have been the right precharge time.
Also, the commit that originally introduce this was just general snb
DP enabling and didn't mention any specific reason for this special
value. Whatever, trust the reporter that this makes things worse.

Cc: Adam Jackson 
Cc: Jesse Barnes 
Reported-by: "Wouter M. Koolen" 
Buglink: https://lkml.org/lkml/2012/6/14/301
Signed-Off-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/intel_dp.c |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index c574ff0..a4b3887 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -371,7 +371,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
int recv_bytes;
uint32_t status;
uint32_t aux_clock_divider;
-   int try, precharge = 5;
+   int try, precharge;
 
intel_dp_check_edp(intel_dp);
/* The clock divider is based off the hrawclk,
@@ -391,6 +391,11 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
else
aux_clock_divider = intel_hrawclk(dev) / 2;
 
+   if (IS_GEN6(dev))
+   precharge = 3;
+   else
+   precharge = 5;
+
/* Try to wait for any previous AUX channel activity */
for (try = 0; try < 3; try++) {
status = I915_READ(ch_ctl);
-- 
1.7.10

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


[PATCH 1/2] drm/radeon: add some additional 6xx/7xx/EG register init

2012-06-14 Thread Marek Olšák
From: Alex Deucher 

- SMX_SAR_CTL0 needs to be programmed correctly to prevent
problems with memory exports in certain cases.
- VC_ENHANCE needs to be initialized on 6xx/7xx.

Signed-off-by: Alex Deucher 
Cc: sta...@vger.kernel.org
---
 drivers/gpu/drm/radeon/evergreen.c  |3 +++
 drivers/gpu/drm/radeon/evergreend.h |1 +
 drivers/gpu/drm/radeon/r600.c   |1 +
 drivers/gpu/drm/radeon/r600d.h  |1 +
 drivers/gpu/drm/radeon/rv770.c  |5 -
 drivers/gpu/drm/radeon/rv770d.h |3 +++
 6 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/evergreen.c 
b/drivers/gpu/drm/radeon/evergreen.c
index 01550d0..7fb3d2e 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -1932,6 +1932,9 @@ static void evergreen_gpu_init(struct radeon_device *rdev)
smx_dc_ctl0 |= NUMBER_OF_SETS(rdev->config.evergreen.sx_num_of_sets);
WREG32(SMX_DC_CTL0, smx_dc_ctl0);
 
+   if (rdev->family <= CHIP_SUMO2)
+   WREG32(SMX_SAR_CTL0, 0x0001);
+
WREG32(SX_EXPORT_BUFFER_SIZES, 
(COLOR_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_size / 4) - 1) |

POSITION_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_pos_size / 4) - 1) |

SMX_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_smx_size / 4) - 1)));
diff --git a/drivers/gpu/drm/radeon/evergreend.h 
b/drivers/gpu/drm/radeon/evergreend.h
index 2773039..b50b15c 100644
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -503,6 +503,7 @@
 #defineSCRATCH_UMSK0x8540
 #defineSCRATCH_ADDR0x8544
 
+#defineSMX_SAR_CTL00xA008
 #defineSMX_DC_CTL0 0xA020
 #defineUSE_HASH_FUNCTION   (1 << 0)
 #defineNUMBER_OF_SETS(x)   ((x) << 
1)
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index f30dc95..bff6272 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1839,6 +1839,7 @@ void r600_gpu_init(struct radeon_device *rdev)
WREG32(PA_CL_ENHANCE, (CLIP_VTX_REORDER_ENA |
   NUM_CLIP_SEQ(3)));
WREG32(PA_SC_ENHANCE, FORCE_EOV_MAX_CLK_CNT(4095));
+   WREG32(VC_ENHANCE, 0);
 }
 
 
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
index a0dbf1f..c6857e8 100644
--- a/drivers/gpu/drm/radeon/r600d.h
+++ b/drivers/gpu/drm/radeon/r600d.h
@@ -485,6 +485,7 @@
 #defineTC_L2_SIZE(x)   ((x)<<5)
 #defineL2_DISABLE_LATE_HIT (1<<9)
 
+#defineVC_ENHANCE  0x9714
 
 #defineVGT_CACHE_INVALIDATION  0x88C4
 #defineCACHE_INVALIDATION(x)   ((x)<<0)
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 4ad0281..b4f51c5 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -616,6 +616,9 @@ static void rv770_gpu_init(struct radeon_device *rdev)
   ACK_FLUSH_CTL(3) |
   SYNC_FLUSH_CTL));
 
+   if (rdev->family != CHIP_RV770)
+   WREG32(SMX_SAR_CTL0, 0x3f3f);
+
db_debug3 = RREG32(DB_DEBUG3);
db_debug3 &= ~DB_CLK_OFF_DELAY(0x1f);
switch (rdev->family) {
@@ -792,7 +795,7 @@ static void rv770_gpu_init(struct radeon_device *rdev)
 
WREG32(PA_CL_ENHANCE, (CLIP_VTX_REORDER_ENA |
  NUM_CLIP_SEQ(3)));
-
+   WREG32(VC_ENHANCE, 0);
 }
 
 void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
diff --git a/drivers/gpu/drm/radeon/rv770d.h b/drivers/gpu/drm/radeon/rv770d.h
index fdc0898..b0adfc5 100644
--- a/drivers/gpu/drm/radeon/rv770d.h
+++ b/drivers/gpu/drm/radeon/rv770d.h
@@ -211,6 +211,7 @@
 #defineSCRATCH_UMSK0x8540
 #defineSCRATCH_ADDR0x8544
 
+#defineSMX_SAR_CTL00xA008
 #defineSMX_DC_CTL0 0xA020
 #defineUSE_HASH_FUNCTION   (1 << 0)
 #defineCACHE_DEPTH(x)  ((x) << 
1)
@@ -310,6 +311,8 @@
 #defineTCP_CNTL0x9610
 #defineTCP_CHAN_STEER  0x9614
 
+#defineVC_ENHANCE  0x9714
+
 #defineVGT_CACHE_INVALIDATION  0x88C4
 #define  

[PATCH 2/2] drm/radeon: add support for STRMOUT_BASE_UPDATE on 7xx

2012-06-14 Thread Marek Olšák
From: Alex Deucher 

Required for streamout.  Bump drm minor.

Marek v2: fix pkt->count check

Signed-off-by: Alex Deucher 
Signed-off-by: Marek Olšák 
---
 drivers/gpu/drm/radeon/r600_cs.c|   42 +++
 drivers/gpu/drm/radeon/r600d.h  |1 +
 drivers/gpu/drm/radeon/radeon_drv.c |3 ++-
 3 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 0133f5f..ca87f7a 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -2079,6 +2079,48 @@ static int r600_packet3_check(struct radeon_cs_parser *p,
return -EINVAL;
}
break;
+   case PACKET3_STRMOUT_BASE_UPDATE:
+   if (p->family < CHIP_RV770) {
+   DRM_ERROR("STRMOUT_BASE_UPDATE only supported on 
7xx\n");
+   return -EINVAL;
+   }
+   if (pkt->count != 1) {
+   DRM_ERROR("bad STRMOUT_BASE_UPDATE packet count\n");
+   return -EINVAL;
+   }
+   if (idx_value > 3) {
+   DRM_ERROR("bad STRMOUT_BASE_UPDATE index\n");
+   return -EINVAL;
+   }
+   {
+   u64 offset;
+
+   r = r600_cs_packet_next_reloc(p, &reloc);
+   if (r) {
+   DRM_ERROR("bad STRMOUT_BASE_UPDATE reloc\n");
+   return -EINVAL;
+   }
+
+   if (reloc->robj != track->vgt_strmout_bo[idx_value]) {
+   DRM_ERROR("bad STRMOUT_BASE_UPDATE, bo does not 
match\n");
+   return -EINVAL;
+   }
+
+   offset = radeon_get_ib_value(p, idx+1) << 8;
+   if (offset != track->vgt_strmout_bo_offset[idx_value]) {
+   DRM_ERROR("bad STRMOUT_BASE_UPDATE, bo offset 
does not match: 0x%llx, 0x%x\n",
+ offset, 
track->vgt_strmout_bo_offset[idx_value]);
+   return -EINVAL;
+   }
+
+   if ((offset + 4) > radeon_bo_size(reloc->robj)) {
+   DRM_ERROR("bad STRMOUT_BASE_UPDATE bo too 
small: 0x%llx, 0x%lx\n",
+ offset + 4, 
radeon_bo_size(reloc->robj));
+   return -EINVAL;
+   }
+   ib[idx+1] += (u32)((reloc->lobj.gpu_offset >> 8) & 
0x);
+   }
+   break;
case PACKET3_SURFACE_BASE_UPDATE:
if (p->family >= CHIP_RV770 || p->family == CHIP_R600) {
DRM_ERROR("bad SURFACE_BASE_UPDATE\n");
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
index c6857e8..025fd5b 100644
--- a/drivers/gpu/drm/radeon/r600d.h
+++ b/drivers/gpu/drm/radeon/r600d.h
@@ -1164,6 +1164,7 @@
 #definePACKET3_SET_CTL_CONST   0x6F
 #definePACKET3_SET_CTL_CONST_OFFSET
0x0003cff0
 #definePACKET3_SET_CTL_CONST_END   
0x0003e200
+#definePACKET3_STRMOUT_BASE_UPDATE 0x72 /* r7xx */
 #definePACKET3_SURFACE_BASE_UPDATE 0x73
 
 
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index 03e5f5d..2c4d53f 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -58,9 +58,10 @@
  *   2.14.0 - add evergreen tiling informations
  *   2.15.0 - add max_pipes query
  *   2.16.0 - fix evergreen 2D tiled surface calculation
+ *   2.17.0 - add STRMOUT_BASE_UPDATE for r7xx
  */
 #define KMS_DRIVER_MAJOR   2
-#define KMS_DRIVER_MINOR   16
+#define KMS_DRIVER_MINOR   17
 #define KMS_DRIVER_PATCHLEVEL  0
 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
 int radeon_driver_unload_kms(struct drm_device *dev);
-- 
1.7.9.5

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


[Bug 39309] vdpau decodes noise on rv350

2012-06-14 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=39309

--- Comment #11 from Christian König  2012-06-14 
13:13:03 PDT ---
Sorry, I should have written "partially fixes..". It only fixes the crash, not
the playback problems.

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


[PATCH] Revert "drm/i915/dp: Use auxch precharge value of 5 everywhere"

2012-06-14 Thread Daniel Vetter
This reverts commit 092945e11c5b84f66dd08f0b87fb729715d377bc.

This commit prevents a DP screen from properly training the link.
Oddly enough it works, once the machine has been warm-booted with an
older kernel.

According to DP docs this _should_ have been the right precharge time.
Also, the commit that originally introduces this was just general snb
DP enabling and didn't mention any specific reason for this special
value. Whatever, trust the reporter that this makes things worse and
let's just revert it.

v2: Less spelling fail.

Cc: Adam Jackson 
Cc: Jesse Barnes 
Reported-by: "Wouter M. Koolen" 
Buglink: https://lkml.org/lkml/2012/6/14/301
Signed-Off-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/intel_dp.c |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index c574ff0..a4b3887 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -371,7 +371,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
int recv_bytes;
uint32_t status;
uint32_t aux_clock_divider;
-   int try, precharge = 5;
+   int try, precharge;
 
intel_dp_check_edp(intel_dp);
/* The clock divider is based off the hrawclk,
@@ -391,6 +391,11 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
else
aux_clock_divider = intel_hrawclk(dev) / 2;
 
+   if (IS_GEN6(dev))
+   precharge = 3;
+   else
+   precharge = 5;
+
/* Try to wait for any previous AUX channel activity */
for (try = 0; try < 3; try++) {
status = I915_READ(ch_ctl);
-- 
1.7.10

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


Re: [PATCH] drm/radeon: fix regression in dynpm due to multi-ring rework

2012-06-14 Thread Christian König

On 14.06.2012 21:54, alexdeuc...@gmail.com wrote:

From: Alex Deucher

Not all asics have all rings, so make sure the ring is ready
before attempting to check it in the dynpm work handler.

Fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=43367

Signed-off-by: Alex Deucher

Reviewed-by: Christian König


---
  drivers/gpu/drm/radeon/radeon_pm.c |   10 +++---
  1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_pm.c 
b/drivers/gpu/drm/radeon/radeon_pm.c
index 79642cd..7ae6066 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -793,9 +793,13 @@ static void radeon_dynpm_idle_work_handler(struct 
work_struct *work)
int i;

for (i = 0; i<  RADEON_NUM_RINGS; ++i) {
-   not_processed += radeon_fence_count_emitted(rdev, i);
-   if (not_processed>= 3)
-   break;
+   struct radeon_ring *ring =&rdev->ring[i];
+
+   if (ring->ready) {
+   not_processed += 
radeon_fence_count_emitted(rdev, i);
+   if (not_processed>= 3)
+   break;
+   }
}

if (not_processed>= 3) { /* should upclock */


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


[PATCH] drm: fix drm_read() returning 0

2012-06-14 Thread David Herrmann
Imagine two threads read()'ing on the drm file and both are asleep waiting
for events in drm_read(). If a single event occurs, both threads are woken
up and start fetching the event. One thread will get it and return, the
other thread will notice that there is no further event and return 0 to
user-space.

We can avoid this by waiting for events until we got at least one event or
an error occurred.

Signed-off-by: David Herrmann 
---
The patch might look a bit scary but it adds only a single do { } while(!total);
around the whole block.

 drivers/gpu/drm/drm_fops.c |   33 +
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 123de28..6e7d349 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -635,25 +635,26 @@ ssize_t drm_read(struct file *filp, char __user *buffer,
 {
struct drm_file *file_priv = filp->private_data;
struct drm_pending_event *e;
-   size_t total;
+   size_t total = 0;
ssize_t ret;
 
-   ret = wait_event_interruptible(file_priv->event_wait,
-  !list_empty(&file_priv->event_list));
-   if (ret < 0)
-   return ret;
-
-   total = 0;
-   while (drm_dequeue_event(file_priv, total, count, &e)) {
-   if (copy_to_user(buffer + total,
-e->event, e->event->length)) {
-   total = -EFAULT;
-   break;
-   }
+   do {
+   ret = wait_event_interruptible(file_priv->event_wait,
+  
!list_empty(&file_priv->event_list));
+   if (ret < 0)
+   return ret;
 
-   total += e->event->length;
-   e->destroy(e);
-   }
+   while (drm_dequeue_event(file_priv, total, count, &e)) {
+   if (copy_to_user(buffer + total,
+e->event, e->event->length)) {
+   total = -EFAULT;
+   break;
+   }
+
+   total += e->event->length;
+   e->destroy(e);
+   }
+   } while (!total);
 
return total;
 }
-- 
1.7.10.4

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


Re: [PATCH] drm/radeon: SI tiling fixes for display

2012-06-14 Thread Paul Menzel
Am Donnerstag, den 14.06.2012, 15:58 -0400 schrieb alexdeuc...@gmail.com:
> From: Alex Deucher 

No elaborate commit messages describing the problem and the solution
makes reviewing patches quite hard (at least for myself) and is up to
the subsystem maintainer of course. But if I understand it correctly,
the Linux kernel guidelines encourage elaborate commit messages.

> Signed-off-by: Alex Deucher 
> ---
>  drivers/gpu/drm/radeon/atombios_crtc.c |   10 -
>  drivers/gpu/drm/radeon/si_reg.h|   72 
> 
>  2 files changed, 81 insertions(+), 1 deletions(-)

[…]


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


Stripping of spaces in messages (was: [PATCH] drm/radeon: fix regression in dynpm due to multi-ring rework)

2012-06-14 Thread Paul Menzel
Dear Christian,


Am Donnerstag, den 14.06.2012, 22:17 +0200 schrieb Christian König:
> On 14.06.2012 21:54, alexdeuc...@gmail.com wrote:
> > From: Alex Deucher
  ^

> > Not all asics have all rings, so make sure the ring is ready
> > before attempting to check it in the dynpm work handler.
> >
> > Fixes:
> > https://bugzilla.kernel.org/show_bug.cgi?id=43367
> >
> > Signed-off-by: Alex Deucher
  ^
> Reviewed-by: Christian König
 ^

do you have any idea why your mailer strips the spaces in front of the
»<«?

[…]


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


Re: Stripping of spaces in messages

2012-06-14 Thread Christian König

On 14.06.2012 22:35, Paul Menzel wrote:

Dear Christian,


Am Donnerstag, den 14.06.2012, 22:17 +0200 schrieb Christian König:

On 14.06.2012 21:54, alexdeuc...@gmail.com wrote:

From: Alex Deucher

   ^


Not all asics have all rings, so make sure the ring is ready
before attempting to check it in the dynpm work handler.

Fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=43367

Signed-off-by: Alex Deucher

   ^

Reviewed-by: Christian König

  ^

do you have any idea why your mailer strips the spaces in front of the
»<«?
Noticed that effect for a couple of days now, but I have no idea what is 
causing this.


I'm using plain Thunderbird 12.0.1.

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


  1   2   3   >