This patch series versus linux-next 2011/06/08 fixes various bugs including a
nasty pinning bug found by Andre Bartke.
With these patches applied the driver passes the various GEM tests and you can
use the KMS tools and test sets to set modes and display stuff from GEM
buffers including those mapped from main memory via the GTT.
You can't yet take a GEM handle of the system frame buffer. That requires
a trivial patch to drm_gem and a similar trivial patch to this driver.
The two main remaining tasks now are to provide a 2D command interface for the
X server including support for blitting between GEM objects (so we need relocs)
and to clean the code up.
Vblank support is also possible but doesn't seem terribly useful.
---
Alan Cox (12):
gma500: Kill spare kref
gma500: nuke the PSB debug stuff
gma500: nuke the last bits of TTM code
gma500: 2D acceleration tidying
gma500: polish for completion of this phase
gma500: trim some of the debug
gma500: Do sane FB cleanup
gma500: revamp frame buffer creation and handling
gma500: Set the correct bits according to the pipe
gma500: Ensure the frame buffer has a linear virtual mapping
gma500: Make GTT pages uncached
gma500: fix warnings
Andre Bartke (1):
gma500: Fix uninitialized variable and style issues
Michael Chang (1):
staging/gma500: get control from firmware framebuffer if conflicts
Patrik Jakobsson (1):
gma500: Skip bogus LVDS VBT mode and check for LVDS before adding backlight
drivers/staging/gma500/mrst_crtc.c | 27 +-
drivers/staging/gma500/mrst_lvds.c | 14 -
drivers/staging/gma500/psb_2d.c | 39 +--
drivers/staging/gma500/psb_bl.c | 12 -
drivers/staging/gma500/psb_drm.h | 90 --------
drivers/staging/gma500/psb_drv.c | 58 ++---
drivers/staging/gma500/psb_drv.h | 181 ++++------------
drivers/staging/gma500/psb_fb.c | 309 +++++++++++++++------------
drivers/staging/gma500/psb_fb.h | 6 -
drivers/staging/gma500/psb_gem.c | 39 +--
drivers/staging/gma500/psb_gtt.c | 187 ++++++----------
drivers/staging/gma500/psb_gtt.h | 11 +
drivers/staging/gma500/psb_intel_bios.c | 26 +-
drivers/staging/gma500/psb_intel_display.c | 130 +++--------
drivers/staging/gma500/psb_intel_drv.h | 19 --
drivers/staging/gma500/psb_intel_lvds.c | 53 +----
drivers/staging/gma500/psb_intel_opregion.c | 7 -
drivers/staging/gma500/psb_intel_sdvo.c | 34 +--
drivers/staging/gma500/psb_irq.c | 33 +--
drivers/staging/gma500/psb_irq.h | 8 -
drivers/staging/gma500/psb_powermgmt.c | 4
drivers/staging/gma500/psb_powermgmt.h | 2
drivers/staging/gma500/psb_reg.h | 2
23 files changed, 461 insertions(+), 830 deletions(-)
--
Signature
From: Alan Cox <[email protected]>
Signed-off-by: Alan Cox <[email protected]>
---
drivers/staging/gma500/psb_gtt.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/gma500/psb_gtt.c b/drivers/staging/gma500/psb_gtt.c
index 74c5a65..1d0e242 100644
--- a/drivers/staging/gma500/psb_gtt.c
+++ b/drivers/staging/gma500/psb_gtt.c
@@ -78,7 +78,6 @@ u32 *psb_gtt_entry(struct drm_device *dev, struct gtt_range *r)
*/
static int psb_gtt_insert(struct drm_device *dev, struct gtt_range *r)
{
- struct drm_psb_private *dev_priv = dev->dev_private;
u32 *gtt_slot, pte;
int numpages = (r->resource.end + 1 - r->resource.start) >> PAGE_SHIFT;
struct page **pages;
@@ -490,7 +489,7 @@ int psb_gtt_init(struct drm_device *dev, int resume)
goto out_err;
}
- DRM_DEBUG("%s: vram kernel virtual address %p\n", dev_priv->vram_addr);
+ DRM_DEBUG("gma500: vram kernel virtual address %p\n", dev_priv->vram_addr);
tt_pages = (pg->gatt_pages < PSB_TT_PRIV0_PLIMIT) ?
(pg->gatt_pages) : PSB_TT_PRIV0_PLIMIT;
From: Patrik Jakobsson <[email protected]>
On the Fit-PC2 the VBT reports an invalid fixed panel mode for LVDS, this gets
in the way for SDVO. This patch makes VBT parsing skip the invalid mode. When
there is no LVDS output the backlight support crashes so the patch also checks
for this before enabling it.
Signed-off-by: Patrik Jakobsson <[email protected]>
Signed-off-by: Alan Cox <[email protected]>
---
drivers/staging/gma500/psb_drv.c | 15 ++++++++++++++-
drivers/staging/gma500/psb_intel_bios.c | 13 +++++++++----
2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/gma500/psb_drv.c b/drivers/staging/gma500/psb_drv.c
index 1c45c11..aa87b1b 100644
--- a/drivers/staging/gma500/psb_drv.c
+++ b/drivers/staging/gma500/psb_drv.c
@@ -542,6 +542,8 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)
unsigned long irqflags;
int ret = -ENOMEM;
uint32_t tt_pages;
+ struct drm_connector *connector;
+ struct psb_intel_output *psb_intel_output;
dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL);
if (dev_priv == NULL)
@@ -663,7 +665,18 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)
drm_kms_helper_poll_init(dev);
}
- ret = psb_backlight_init(dev);
+ /* Only add backlight support if we have LVDS output */
+ list_for_each_entry(connector, &dev->mode_config.connector_list,
+ head) {
+ psb_intel_output = to_psb_intel_output(connector);
+
+ switch (psb_intel_output->type) {
+ case INTEL_OUTPUT_LVDS:
+ ret = psb_backlight_init(dev);
+ break;
+ }
+ }
+
if (ret)
return ret;
#if 0
diff --git a/drivers/staging/gma500/psb_intel_bios.c b/drivers/staging/gma500/psb_intel_bios.c
index 48ac8ba..417965d 100644
--- a/drivers/staging/gma500/psb_intel_bios.c
+++ b/drivers/staging/gma500/psb_intel_bios.c
@@ -154,10 +154,15 @@ static void parse_lfp_panel_data(struct drm_psb_private *dev_priv,
fill_detail_timing_data(panel_fixed_mode, dvo_timing);
- dev_priv->lfp_lvds_vbt_mode = panel_fixed_mode;
-
- DRM_DEBUG("Found panel mode in BIOS VBT tables:\n");
- drm_mode_debug_printmodeline(panel_fixed_mode);
+ if (panel_fixed_mode->htotal > 0 && panel_fixed_mode->vtotal > 0) {
+ dev_priv->lfp_lvds_vbt_mode = panel_fixed_mode;
+ DRM_DEBUG("Found panel mode in BIOS VBT tables:\n");
+ drm_mode_debug_printmodeline(panel_fixed_mode);
+ } else {
+ DRM_DEBUG("Ignoring bogus LVDS VBT mode.\n");
+ dev_priv->lvds_vbt = 0;
+ kfree(panel_fixed_mode);
+ }
return;
}
From: Alan Cox <[email protected]>
Clean up the GTT code a bit, make the pages uncached and go via the proper
interfaces. This avoids any aliasing problems.
On the CPU side we need to access the pages via their true addresses not via
the GTT. This is fine for GEM created fb objects for X. For the kernel fb
when not in stolen RAM we are going to need to use vm_map_ram() and hope we
have enough virtual address space to steal.
Signed-off-by: Alan Cox <[email protected]>
---
drivers/staging/gma500/psb_fb.c | 9 ++++++++-
drivers/staging/gma500/psb_gem.c | 26 +++++++-------------------
drivers/staging/gma500/psb_gtt.c | 27 ++++++++++++++-------------
3 files changed, 29 insertions(+), 33 deletions(-)
diff --git a/drivers/staging/gma500/psb_fb.c b/drivers/staging/gma500/psb_fb.c
index 99c03a2..f578ca8 100644
--- a/drivers/staging/gma500/psb_fb.c
+++ b/drivers/staging/gma500/psb_fb.c
@@ -346,6 +346,11 @@ err:
* and back it with a GEM object.
*
* In this case the GEM object has no handle.
+ *
+ * FIXME: console speed up - allocate twice the space if room and use
+ * hardware scrolling for acceleration.
+ * FIXME: we need to vm_map_ram a linear mapping if the object has to
+ * be GEM host mapped, otherwise the cfb layer's brain will fall out.
*/
static struct gtt_range *psbfb_alloc(struct drm_device *dev, int aligned_size)
{
@@ -436,7 +441,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
/* Accessed via stolen memory directly, This only works for stolem
memory however. Need to address this once we start using gtt
- pages we allocate */
+ pages we allocate. FIXME: vm_map_ram for that case */
info->screen_base = (char *)dev_priv->vram_addr + backing->offset;
info->screen_size = size;
memset(info->screen_base, 0, size);
@@ -666,6 +671,8 @@ static void psb_user_framebuffer_destroy(struct drm_framebuffer *fb)
struct psb_framebuffer *psbfb = to_psb_fb(fb);
struct gtt_range *r = psbfb->gtt;
+ pr_err("user framebuffer destroy %p, fbdev %p\n",
+ psbfb, psbfb->fbdev);
if (psbfb->fbdev)
psbfb_remove(dev, fb);
diff --git a/drivers/staging/gma500/psb_gem.c b/drivers/staging/gma500/psb_gem.c
index 76ff7ba..98d8ab3 100644
--- a/drivers/staging/gma500/psb_gem.c
+++ b/drivers/staging/gma500/psb_gem.c
@@ -40,7 +40,6 @@ int psb_gem_init_object(struct drm_gem_object *obj)
void psb_gem_free_object(struct drm_gem_object *obj)
{
struct gtt_range *gtt = container_of(obj, struct gtt_range, gem);
- psb_gtt_free_range(obj->dev, gtt);
if (obj->map_list.map) {
/* Do things GEM should do for us */
struct drm_gem_mm *mm = obj->dev->mm_private;
@@ -51,6 +50,8 @@ void psb_gem_free_object(struct drm_gem_object *obj)
list->map = NULL;
}
drm_gem_object_release(obj);
+ /* This must occur last as it frees up the memory of the GEM object */
+ psb_gtt_free_range(obj->dev, gtt);
}
int psb_gem_get_aperture(struct drm_device *dev, void *data,
@@ -245,19 +246,13 @@ int psb_gem_dumb_destroy(struct drm_file *file, struct drm_device *dev,
* but we need to do the actual page work.
*
* This code eventually needs to handle faulting objects in and out
- * of the GART and repacking it when we run out of space. We can put
+ * of the GTT and repacking it when we run out of space. We can put
* that off for now and for our simple uses
*
* The VMA was set up by GEM. In doing so it also ensured that the
* vma->vm_private_data points to the GEM object that is backing this
* mapping.
*
- * To avoid aliasing and cache funnies we want to map the object
- * through the GART. For the moment this is slightly hackish. It would
- * be nicer if GEM provided mmap opened/closed hooks for us giving
- * the object so that we could track things nicely. That needs changes
- * to the core GEM code so must be tackled post staging
- *
* FIXME
*/
int psb_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
@@ -289,20 +284,13 @@ int psb_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
r->mmapping = 1;
}
- /* FIXME: Locking. We may also need to repack the GART sometimes */
-
- /* Page relative to the VMA start */
+ /* Page relative to the VMA start - we must calculate this ourselves
+ because vmf->pgoff is the fake GEM offset */
page_offset = ((unsigned long) vmf->virtual_address - vma->vm_start)
>> PAGE_SHIFT;
- /* Bus address of the page is gart + object offset + page offset */
- /* Assumes gtt allocations are page aligned */
- pfn = (r->resource.start >> PAGE_SHIFT) + page_offset;
-
- pr_debug("Object GTT base at %p\n", (void *)(r->resource.start));
- pr_debug("Inserting %p pfn %lx, pa %lx\n", vmf->virtual_address,
- pfn, pfn << PAGE_SHIFT);
-
+ /* CPU view of the page, don't go via the GART for CPU writes */
+ pfn = page_to_phys(r->pages[page_offset]) >> PAGE_SHIFT;
ret = vm_insert_pfn(vma, (unsigned long)vmf->virtual_address, pfn);
fail:
diff --git a/drivers/staging/gma500/psb_gtt.c b/drivers/staging/gma500/psb_gtt.c
index 1d0e242..d76037f 100644
--- a/drivers/staging/gma500/psb_gtt.c
+++ b/drivers/staging/gma500/psb_gtt.c
@@ -28,11 +28,11 @@
*/
/**
- * psb_gtt_mask_pte - generate GART pte entry
+ * psb_gtt_mask_pte - generate GTT pte entry
* @pfn: page number to encode
- * @type: type of memory in the GART
+ * @type: type of memory in the GTT
*
- * Set the GART entry for the appropriate memory type.
+ * Set the GTT entry for the appropriate memory type.
*/
static inline uint32_t psb_gtt_mask_pte(uint32_t pfn, int type)
{
@@ -49,11 +49,11 @@ static inline uint32_t psb_gtt_mask_pte(uint32_t pfn, int type)
}
/**
- * psb_gtt_entry - find the GART entries for a gtt_range
+ * psb_gtt_entry - find the GTT entries for a gtt_range
* @dev: our DRM device
* @r: our GTT range
*
- * Given a gtt_range object return the GART offset of the page table
+ * Given a gtt_range object return the GTT offset of the page table
* entries for this gtt_range
*/
u32 *psb_gtt_entry(struct drm_device *dev, struct gtt_range *r)
@@ -67,12 +67,12 @@ u32 *psb_gtt_entry(struct drm_device *dev, struct gtt_range *r)
}
/**
- * psb_gtt_insert - put an object into the GART
+ * psb_gtt_insert - put an object into the GTT
* @dev: our DRM device
* @r: our GTT range
*
* Take our preallocated GTT range and insert the GEM object into
- * the GART.
+ * the GTT.
*
* FIXME: gtt lock ?
*/
@@ -93,10 +93,10 @@ static int psb_gtt_insert(struct drm_device *dev, struct gtt_range *r)
gtt_slot = psb_gtt_entry(dev, r);
pages = r->pages;
- /* Make sure we have no alias present */
- wbinvd();
+ /* Make sure changes are visible to the GPU */
+ set_pages_array_uc(pages, numpages);
- /* Write our page entries into the GART itself */
+ /* Write our page entries into the GTT itself */
for (i = 0; i < numpages; i++) {
pte = psb_gtt_mask_pte(page_to_pfn(*pages++), 0/*type*/);
iowrite32(pte, gtt_slot++);
@@ -108,11 +108,11 @@ static int psb_gtt_insert(struct drm_device *dev, struct gtt_range *r)
}
/**
- * psb_gtt_remove - remove an object from the GART
+ * psb_gtt_remove - remove an object from the GTT
* @dev: our DRM device
* @r: our GTT range
*
- * Remove a preallocated GTT range from the GART. Overwrite all the
+ * Remove a preallocated GTT range from the GTT. Overwrite all the
* page table entries with the dummy page
*/
@@ -131,6 +131,7 @@ static void psb_gtt_remove(struct drm_device *dev, struct gtt_range *r)
for (i = 0; i < numpages; i++)
iowrite32(pte, gtt_slot++);
ioread32(gtt_slot - 1);
+ set_pages_array_wb(r->pages, numpages);
}
/**
@@ -182,7 +183,7 @@ err:
* @gt: the gtt range
*
* Undo the effect of psb_gtt_attach_pages. At this point the pages
- * must have been removed from the GART as they could now be paged out
+ * must have been removed from the GTT as they could now be paged out
* and move bus address.
*
* FIXME: Do we need to cache flush when we update the GTT
From: Alan Cox <[email protected]>
We need this for the framebuffer in order to ensure that the kernel
framebuffer layer can handle it when using KMS. Except for the base
framebuffer this isn't a concern.
Add an npage field to the gtt as too many copies of the page calculation
are getting spread around the code.
Signed-off-by: Alan Cox <[email protected]>
---
drivers/staging/gma500/psb_fb.c | 47 ++++++++++++++++++++++++--------------
drivers/staging/gma500/psb_fb.h | 1 +
drivers/staging/gma500/psb_gtt.c | 18 ++++++---------
drivers/staging/gma500/psb_gtt.h | 5 ++--
4 files changed, 42 insertions(+), 29 deletions(-)
diff --git a/drivers/staging/gma500/psb_fb.c b/drivers/staging/gma500/psb_fb.c
index f578ca8..4e6294c 100644
--- a/drivers/staging/gma500/psb_fb.c
+++ b/drivers/staging/gma500/psb_fb.c
@@ -254,17 +254,13 @@ static int psbfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
vma->vm_pgoff, fb_screen_base,
dev_priv->vram_addr);
- /* FIXME: ultimately this needs to become 'if entirely stolen memory' */
- if (1 || fb_screen_base == dev_priv->vram_addr) {
- vma->vm_ops = &psbfb_vm_ops;
- vma->vm_private_data = (void *)psbfb;
- vma->vm_flags |= VM_RESERVED | VM_IO |
- VM_MIXEDMAP | VM_DONTEXPAND;
- } else {
- /* GTT memory backed by kernel/user pages, needs a different
- approach ? - GEM ? */
- }
-
+ /* If this is a GEM object then info->screen_base is the virtual
+ kernel remapping of the object. FIXME: Review if this is
+ suitable for our mmap work */
+ vma->vm_ops = &psbfb_vm_ops;
+ vma->vm_private_data = (void *)psbfb;
+ vma->vm_flags |= VM_RESERVED | VM_IO |
+ VM_MIXEDMAP | VM_DONTEXPAND;
return 0;
}
@@ -349,8 +345,6 @@ err:
*
* FIXME: console speed up - allocate twice the space if room and use
* hardware scrolling for acceleration.
- * FIXME: we need to vm_map_ram a linear mapping if the object has to
- * be GEM host mapped, otherwise the cfb layer's brain will fall out.
*/
static struct gtt_range *psbfb_alloc(struct drm_device *dev, int aligned_size)
{
@@ -439,10 +433,22 @@ static int psbfb_create(struct psb_fbdev *fbdev,
info->fix.smem_start = dev->mode_config.fb_base;
info->fix.smem_len = size;
- /* Accessed via stolen memory directly, This only works for stolem
- memory however. Need to address this once we start using gtt
- pages we allocate. FIXME: vm_map_ram for that case */
- info->screen_base = (char *)dev_priv->vram_addr + backing->offset;
+ if (backing->stolen) {
+ /* Accessed stolen memory directly */
+ info->screen_base = (char *)dev_priv->vram_addr +
+ backing->offset;
+ } else {
+ /* Pin the pages into the GTT and create a mapping to them */
+ psb_gtt_pin(backing);
+ info->screen_base = vm_map_ram(backing->pages, backing->npage,
+ -1, PAGE_KERNEL);
+ if (info->screen_base == NULL) {
+ psb_gtt_unpin(backing);
+ ret = -ENOMEM;
+ goto out_err0;
+ }
+ psbfb->vm_map = 1;
+ }
info->screen_size = size;
memset(info->screen_base, 0, size);
@@ -560,6 +566,13 @@ int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev)
if (fbdev->psb_fb_helper.fbdev) {
info = fbdev->psb_fb_helper.fbdev;
+
+ /* If this is our base framebuffer then kill any virtual map
+ for the framebuffer layer and unpin it */
+ if (psbfb->vm_map) {
+ vm_unmap_ram(info->screen_base, psbfb->gtt->npage);
+ psb_gtt_unpin(psbfb->gtt);
+ }
/* FIXME: this is a bit more inside knowledge than I'd like
but I don't see how to make a fake GEM object of the
stolen space nicely */
diff --git a/drivers/staging/gma500/psb_fb.h b/drivers/staging/gma500/psb_fb.h
index c8ec0d6..2153c74 100644
--- a/drivers/staging/gma500/psb_fb.h
+++ b/drivers/staging/gma500/psb_fb.h
@@ -33,6 +33,7 @@ struct psb_framebuffer {
struct address_space *addr_space;
struct fb_info *fbdev;
struct gtt_range *gtt;
+ bool vm_map; /* True if we must undo a vm_map_ram */
};
struct psb_fbdev {
diff --git a/drivers/staging/gma500/psb_gtt.c b/drivers/staging/gma500/psb_gtt.c
index d76037f..6a24246 100644
--- a/drivers/staging/gma500/psb_gtt.c
+++ b/drivers/staging/gma500/psb_gtt.c
@@ -79,7 +79,6 @@ u32 *psb_gtt_entry(struct drm_device *dev, struct gtt_range *r)
static int psb_gtt_insert(struct drm_device *dev, struct gtt_range *r)
{
u32 *gtt_slot, pte;
- int numpages = (r->resource.end + 1 - r->resource.start) >> PAGE_SHIFT;
struct page **pages;
int i;
@@ -94,10 +93,10 @@ static int psb_gtt_insert(struct drm_device *dev, struct gtt_range *r)
pages = r->pages;
/* Make sure changes are visible to the GPU */
- set_pages_array_uc(pages, numpages);
+ set_pages_array_uc(pages, r->npage);
/* Write our page entries into the GTT itself */
- for (i = 0; i < numpages; i++) {
+ for (i = 0; i < r->npage; i++) {
pte = psb_gtt_mask_pte(page_to_pfn(*pages++), 0/*type*/);
iowrite32(pte, gtt_slot++);
}
@@ -120,7 +119,6 @@ static void psb_gtt_remove(struct drm_device *dev, struct gtt_range *r)
{
struct drm_psb_private *dev_priv = dev->dev_private;
u32 *gtt_slot, pte;
- int numpages = (r->resource.end + 1 - r->resource.start) >> PAGE_SHIFT;
int i;
WARN_ON(r->stolen);
@@ -128,10 +126,10 @@ static void psb_gtt_remove(struct drm_device *dev, struct gtt_range *r)
gtt_slot = psb_gtt_entry(dev, r);
pte = psb_gtt_mask_pte(page_to_pfn(dev_priv->scratch_page), 0);;
- for (i = 0; i < numpages; i++)
+ for (i = 0; i < r->npage; i++)
iowrite32(pte, gtt_slot++);
ioread32(gtt_slot - 1);
- set_pages_array_wb(r->pages, numpages);
+ set_pages_array_wb(r->pages, r->npage);
}
/**
@@ -149,7 +147,7 @@ static int psb_gtt_attach_pages(struct gtt_range *gt)
struct address_space *mapping;
int i;
struct page *p;
- int pages = (gt->resource.end + 1 - gt->resource.start) >> PAGE_SHIFT;
+ int pages = gt->gem.size / PAGE_SIZE;
WARN_ON(gt->pages);
@@ -160,6 +158,8 @@ static int psb_gtt_attach_pages(struct gtt_range *gt)
gt->pages = kmalloc(pages * sizeof(struct page *), GFP_KERNEL);
if (gt->pages == NULL)
return -ENOMEM;
+ gt->npage = pages;
+
for (i = 0; i < pages; i++) {
/* FIXME: review flags later */
p = read_cache_page_gfp(mapping, i,
@@ -191,9 +191,7 @@ err:
static void psb_gtt_detach_pages(struct gtt_range *gt)
{
int i;
- int pages = (gt->resource.end + 1 - gt->resource.start) >> PAGE_SHIFT;
-
- for (i = 0; i < pages; i++) {
+ for (i = 0; i < gt->npage; i++) {
/* FIXME: do we need to force dirty */
set_page_dirty(gt->pages[i]);
/* Undo the reference we took when populating the table */
diff --git a/drivers/staging/gma500/psb_gtt.h b/drivers/staging/gma500/psb_gtt.h
index 535ae00..37287eb 100644
--- a/drivers/staging/gma500/psb_gtt.h
+++ b/drivers/staging/gma500/psb_gtt.h
@@ -46,9 +46,10 @@ struct gtt_range {
struct kref kref;
struct drm_gem_object gem; /* GEM high level stuff */
int in_gart; /* Currently in the GART (ref ct) */
- bool stolen; /* Backed from stolen RAM */
- bool mmapping; /* Is mmappable */
+ bool stolen; /* Backed from stolen RAM */
+ bool mmapping; /* Is mmappable */
struct page **pages; /* Backing pages if present */
+ int npage; /* Number of backing pages */
};
extern struct gtt_range *psb_gtt_alloc_range(struct drm_device *dev, int len,
From: Alan Cox <[email protected]>
Squash a hardcoded assumption we shouldn't really make
Signed-off-by: Alan Cox <[email protected]>
---
drivers/staging/gma500/psb_intel_display.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/gma500/psb_intel_display.c b/drivers/staging/gma500/psb_intel_display.c
index 4f47d09..a99271d 100644
--- a/drivers/staging/gma500/psb_intel_display.c
+++ b/drivers/staging/gma500/psb_intel_display.c
@@ -723,17 +723,18 @@ static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,
if (is_lvds) {
u32 lvds = REG_READ(LVDS);
- lvds |=
- LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP |
- LVDS_PIPEB_SELECT;
+ lvds &= ~LVDS_PIPEB_SELECT;
+ if (pipe == 1)
+ lvds |= LVDS_PIPEB_SELECT;
+
+ lvds |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP;
/* Set the B0-B3 data pairs corresponding to
* whether we're going to
* set the DPLLs for dual-channel mode or not.
*/
+ lvds &= ~(LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP);
if (clock.p2 == 7)
lvds |= LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP;
- else
- lvds &= ~(LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP);
/* It would be nice to set 24 vs 18-bit mode (LVDS_A3_POWER_UP)
* appropriately here, but we need to look more
From: Michael Chang <[email protected]>
Many Linux distributions would enable vesafb in order to display
early stage boot splash. In this case, we will get garbled X
Window screen if running X fbdev on psbfb.
This is because fb0 is occupied by vesafb while psbfb is on fb1.
They tried to drive the same pieces of hardware at the same
time. With unmodified X start-up, it would try to use default
fb0 framebuffer device and unfortunately it is now broken
becaues fb1 supersedes it.
We should let psbfb takeover framebuffer control from vesafb
to get around this problem.
See also commit : 4410f3910947dcea8672280b3adecd53cec4e85e
Signed-off-by: Michael Chang <[email protected]>
Signed-off-by: Alan Cox <[email protected]>
---
drivers/staging/gma500/psb_fb.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/staging/gma500/psb_fb.c b/drivers/staging/gma500/psb_fb.c
index 4e6294c..4b05cdc 100644
--- a/drivers/staging/gma500/psb_fb.c
+++ b/drivers/staging/gma500/psb_fb.c
@@ -452,6 +452,16 @@ static int psbfb_create(struct psb_fbdev *fbdev,
info->screen_size = size;
memset(info->screen_base, 0, size);
+ if (dev_priv->pg->stolen_size) {
+ info->apertures = alloc_apertures(1);
+ if (!info->apertures) {
+ ret = -ENOMEM;
+ goto out_err0;
+ }
+ info->apertures->ranges[0].base = dev->mode_config.fb_base;
+ info->apertures->ranges[0].size = dev_priv->pg->stolen_size;
+ }
+
drm_fb_helper_fill_fix(info, fb->pitch, fb->depth);
drm_fb_helper_fill_var(info, &fbdev->psb_fb_helper,
sizes->fb_width, sizes->fb_height);
From: Andre Bartke <[email protected]>
The return variable of psb_gtt_pin() may be used
uninitialized. Also fixed some coding style issues.
Signed-off-by: Andre Bartke <[email protected]>
[Reapplied by hand due to other changes]
Signed-off-by: Alan Cox <[email protected]>
---
drivers/staging/gma500/psb_gtt.c | 36 ++++++++++++++++++------------------
1 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/staging/gma500/psb_gtt.c b/drivers/staging/gma500/psb_gtt.c
index 6a24246..5a296e1 100644
--- a/drivers/staging/gma500/psb_gtt.c
+++ b/drivers/staging/gma500/psb_gtt.c
@@ -58,7 +58,7 @@ static inline uint32_t psb_gtt_mask_pte(uint32_t pfn, int type)
*/
u32 *psb_gtt_entry(struct drm_device *dev, struct gtt_range *r)
{
- struct drm_psb_private *dev_priv = dev->dev_private;
+ struct drm_psb_private *dev_priv = dev->dev_private;
unsigned long offset;
offset = r->resource.start - dev_priv->gtt_mem->start;
@@ -124,7 +124,7 @@ static void psb_gtt_remove(struct drm_device *dev, struct gtt_range *r)
WARN_ON(r->stolen);
gtt_slot = psb_gtt_entry(dev, r);
- pte = psb_gtt_mask_pte(page_to_pfn(dev_priv->scratch_page), 0);;
+ pte = psb_gtt_mask_pte(page_to_pfn(dev_priv->scratch_page), 0);
for (i = 0; i < r->npage; i++)
iowrite32(pte, gtt_slot++);
@@ -213,7 +213,7 @@ static void psb_gtt_detach_pages(struct gtt_range *gt)
*/
int psb_gtt_pin(struct gtt_range *gt)
{
- int ret;
+ int ret = 0;
struct drm_device *dev = gt->gem.dev;
struct drm_psb_private *dev_priv = dev->dev_private;
@@ -289,33 +289,33 @@ struct gtt_range *psb_gtt_alloc_range(struct drm_device *dev, int len,
struct resource *r = dev_priv->gtt_mem;
int ret;
unsigned long start, end;
-
+
if (backed) {
- /* The start of the GTT is the stolen pages */
- start = r->start;
- end = r->start + dev_priv->pg->stolen_size - 1;
+ /* The start of the GTT is the stolen pages */
+ start = r->start;
+ end = r->start + dev_priv->pg->stolen_size - 1;
} else {
- /* The rest we will use for GEM backed objects */
- start = r->start + dev_priv->pg->stolen_size;
- end = r->end;
+ /* The rest we will use for GEM backed objects */
+ start = r->start + dev_priv->pg->stolen_size;
+ end = r->end;
}
gt = kzalloc(sizeof(struct gtt_range), GFP_KERNEL);
if (gt == NULL)
return NULL;
- gt->resource.name = name;
- gt->stolen = backed;
- gt->in_gart = backed;
- /* Ensure this is set for non GEM objects */
- gt->gem.dev = dev;
+ gt->resource.name = name;
+ gt->stolen = backed;
+ gt->in_gart = backed;
+ /* Ensure this is set for non GEM objects */
+ gt->gem.dev = dev;
kref_init(>->kref);
ret = allocate_resource(dev_priv->gtt_mem, >->resource,
len, start, end, PAGE_SIZE, NULL, NULL);
if (ret == 0) {
- gt->offset = gt->resource.start - r->start;
+ gt->offset = gt->resource.start - r->start;
return gt;
- }
+ }
kfree(gt);
return NULL;
}
@@ -419,7 +419,7 @@ int psb_gtt_init(struct drm_device *dev, int resume)
dev_priv->pg = pg = psb_gtt_alloc(dev);
if (pg == NULL)
- return -ENOMEM;
+ return -ENOMEM;
pci_read_config_word(dev->pdev, PSB_GMCH_CTRL, &dev_priv->gmch_ctrl);
pci_write_config_word(dev->pdev, PSB_GMCH_CTRL,
From: Alan Cox <[email protected]>
Restructure this to work the same way as the i915 frame buffer does. That
cleans up various chunks of code.
We can now set a mode in modetest but mode restore is a bit iffy
Signed-off-by: Alan Cox <[email protected]>
---
drivers/staging/gma500/psb_2d.c | 13 +--
drivers/staging/gma500/psb_fb.c | 195 +++++++++++++++++++++-----------------
drivers/staging/gma500/psb_fb.h | 2
drivers/staging/gma500/psb_gem.c | 18 +++-
drivers/staging/gma500/psb_gtt.c | 2
5 files changed, 133 insertions(+), 97 deletions(-)
diff --git a/drivers/staging/gma500/psb_2d.c b/drivers/staging/gma500/psb_2d.c
index 0bd834c..060eeaf 100644
--- a/drivers/staging/gma500/psb_2d.c
+++ b/drivers/staging/gma500/psb_2d.c
@@ -148,7 +148,7 @@ static void psbfb_fillrect_accel(struct fb_info *info,
const struct fb_fillrect *r)
{
struct psb_fbdev *fbdev = info->par;
- struct psb_framebuffer *psbfb = fbdev->pfb;
+ struct psb_framebuffer *psbfb = &fbdev->pfb;
struct drm_device *dev = psbfb->base.dev;
struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb;
struct drm_psb_private *dev_priv = dev->dev_private;
@@ -291,7 +291,7 @@ static void psbfb_copyarea_accel(struct fb_info *info,
const struct fb_copyarea *a)
{
struct psb_fbdev *fbdev = info->par;
- struct psb_framebuffer *psbfb = fbdev->pfb;
+ struct psb_framebuffer *psbfb = &fbdev->pfb;
struct drm_device *dev = psbfb->base.dev;
struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb;
struct drm_psb_private *dev_priv = dev->dev_private;
@@ -360,19 +360,12 @@ void psbfb_imageblit(struct fb_info *info, const struct fb_image *image)
int psbfb_sync(struct fb_info *info)
{
struct psb_fbdev *fbdev = info->par;
- struct psb_framebuffer *psbfb = fbdev->pfb;
+ struct psb_framebuffer *psbfb = &fbdev->pfb;
struct drm_device *dev = psbfb->base.dev;
struct drm_psb_private *dev_priv = dev->dev_private;
unsigned long _end = jiffies + DRM_HZ;
int busy = 0;
-#if 0
- /* Just a way to quickly test if cmd issue explodes */
- u32 test[2] = {
- PSB_2D_FENCE_BH,
- };
- psbfb_2d_submit(dev_priv, test, 1);
-#endif
/*
* First idle the 2D engine.
*/
diff --git a/drivers/staging/gma500/psb_fb.c b/drivers/staging/gma500/psb_fb.c
index 4b05cdc..5977add 100644
--- a/drivers/staging/gma500/psb_fb.c
+++ b/drivers/staging/gma500/psb_fb.c
@@ -235,7 +235,7 @@ static struct vm_operations_struct psbfb_vm_ops = {
static int psbfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
struct psb_fbdev *fbdev = info->par;
- struct psb_framebuffer *psbfb = fbdev->pfb;
+ struct psb_framebuffer *psbfb = &fbdev->pfb;
char *fb_screen_base = NULL;
struct drm_device *dev = psbfb->base.dev;
struct drm_psb_private *dev_priv = dev->dev_private;
@@ -267,7 +267,7 @@ static int psbfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
static int psbfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
{
struct psb_fbdev *fbdev = info->par;
- struct psb_framebuffer *psbfb = fbdev->pfb;
+ struct psb_framebuffer *psbfb = &fbdev->pfb;
struct drm_device *dev = psbfb->base.dev;
struct drm_psb_private *dev_priv = dev->dev_private;
u32 __user *p = (u32 __user *)arg;
@@ -304,8 +304,58 @@ static struct fb_ops psbfb_ops = {
.fb_ioctl = psbfb_ioctl,
};
+/**
+ * psb_framebuffer_init - initialize a framebuffer
+ * @dev: our DRM device
+ * @fb: framebuffer to set up
+ * @mode_cmd: mode description
+ * @gt: backing object
+ *
+ * Configure and fill in the boilerplate for our frame buffer. Return
+ * 0 on success or an error code if we fail.
+ */
+static int psb_framebuffer_init(struct drm_device *dev,
+ struct psb_framebuffer *fb,
+ struct drm_mode_fb_cmd *mode_cmd,
+ struct gtt_range *gt)
+{
+ int ret;
+
+ if (mode_cmd->pitch & 63)
+ return -EINVAL;
+ switch (mode_cmd->bpp) {
+ case 8:
+ case 16:
+ case 24:
+ case 32:
+ break;
+ default:
+ return -EINVAL;
+ }
+ ret = drm_framebuffer_init(dev, &fb->base, &psb_fb_funcs);
+ if (ret) {
+ dev_err(dev->dev, "framebuffer init failed: %d\n", ret);
+ return ret;
+ }
+ drm_helper_mode_fill_fb_struct(&fb->base, mode_cmd);
+ fb->gtt = gt;
+ return 0;
+}
+
+/**
+ * psb_framebuffer_create - create a framebuffer backed by gt
+ * @dev: our DRM device
+ * @mode_cmd: the description of the requested mode
+ * @gt: the backing object
+ *
+ * Create a framebuffer object backed by the gt, and fill in the
+ * boilerplate required
+ *
+ * TODO: review object references
+ */
static struct drm_framebuffer *psb_framebuffer_create
- (struct drm_device *dev, struct drm_mode_fb_cmd *r,
+ (struct drm_device *dev,
+ struct drm_mode_fb_cmd *mode_cmd,
struct gtt_range *gt)
{
struct psb_framebuffer *fb;
@@ -313,22 +363,14 @@ static struct drm_framebuffer *psb_framebuffer_create
fb = kzalloc(sizeof(*fb), GFP_KERNEL);
if (!fb)
- return NULL;
-
- ret = drm_framebuffer_init(dev, &fb->base, &psb_fb_funcs);
-
- if (ret)
- goto err;
-
- drm_helper_mode_fill_fb_struct(&fb->base, r);
-
- fb->gtt = gt;
-
- return &fb->base;
+ return ERR_PTR(-ENOMEM);
-err:
- kfree(fb);
- return NULL;
+ ret = psb_framebuffer_init(dev, fb, mode_cmd, gt);
+ if (ret) {
+ kfree(fb);
+ return ERR_PTR(ret);
+ }
+ return &fb->base;
}
/**
@@ -380,56 +422,63 @@ static int psbfb_create(struct psb_fbdev *fbdev,
struct drm_psb_private *dev_priv = dev->dev_private;
struct fb_info *info;
struct drm_framebuffer *fb;
- struct psb_framebuffer *psbfb;
+ struct psb_framebuffer *psbfb = &fbdev->pfb;
struct drm_mode_fb_cmd mode_cmd;
struct device *device = &dev->pdev->dev;
- int size, aligned_size;
+ int size;
int ret;
struct gtt_range *backing;
mode_cmd.width = sizes->surface_width;
mode_cmd.height = sizes->surface_height;
+ mode_cmd.bpp = sizes->surface_bpp;
+
+ /* No 24bit packed */
+ if (mode_cmd.bpp == 24)
+ mode_cmd.bpp = 32;
- mode_cmd.bpp = 32;
/* HW requires pitch to be 64 byte aligned */
- mode_cmd.pitch = ALIGN(mode_cmd.width * ((mode_cmd.bpp + 1) / 8), 64);
- mode_cmd.depth = 24;
+ mode_cmd.pitch = ALIGN(mode_cmd.width * ((mode_cmd.bpp + 7) / 8), 64);
+ mode_cmd.depth = sizes->surface_depth;
size = mode_cmd.pitch * mode_cmd.height;
- aligned_size = ALIGN(size, PAGE_SIZE);
+ size = ALIGN(size, PAGE_SIZE);
/* Allocate the framebuffer in the GTT with stolen page backing */
- backing = psbfb_alloc(dev, aligned_size);
+ backing = psbfb_alloc(dev, size);
if (backing == NULL)
return -ENOMEM;
mutex_lock(&dev->struct_mutex);
- fb = psb_framebuffer_create(dev, &mode_cmd, backing);
- if (!fb) {
- DRM_ERROR("failed to allocate fb.\n");
- ret = -ENOMEM;
- goto out_err1;
- }
- psbfb = to_psb_fb(fb);
- info = framebuffer_alloc(sizeof(struct psb_fbdev), device);
+ info = framebuffer_alloc(0, device);
if (!info) {
ret = -ENOMEM;
- goto out_err0;
+ goto out_err1;
}
-
info->par = fbdev;
+ ret = psb_framebuffer_init(dev, psbfb, &mode_cmd, backing);
+ if (ret)
+ goto out_unref;
+
+ fb = &psbfb->base;
psbfb->fbdev = info;
fbdev->psb_fb_helper.fb = fb;
fbdev->psb_fb_helper.fbdev = info;
- fbdev->pfb = psbfb;
strcpy(info->fix.id, "psbfb");
info->flags = FBINFO_DEFAULT;
info->fbops = &psbfb_ops;
+
+ ret = fb_alloc_cmap(&info->cmap, 256, 0);
+ if (ret) {
+ ret = -ENOMEM;
+ goto out_unref;
+ }
+
info->fix.smem_start = dev->mode_config.fb_base;
info->fix.smem_len = size;
@@ -445,18 +494,18 @@ static int psbfb_create(struct psb_fbdev *fbdev,
if (info->screen_base == NULL) {
psb_gtt_unpin(backing);
ret = -ENOMEM;
- goto out_err0;
+ goto out_unref;
}
psbfb->vm_map = 1;
}
info->screen_size = size;
- memset(info->screen_base, 0, size);
+/* memset(info->screen_base, 0, size); */
if (dev_priv->pg->stolen_size) {
info->apertures = alloc_apertures(1);
if (!info->apertures) {
ret = -ENOMEM;
- goto out_err0;
+ goto out_unref;
}
info->apertures->ranges[0].base = dev->mode_config.fb_base;
info->apertures->ranges[0].size = dev_priv->pg->stolen_size;
@@ -484,8 +533,14 @@ static int psbfb_create(struct psb_fbdev *fbdev,
mutex_unlock(&dev->struct_mutex);
return 0;
-out_err0:
- fb->funcs->destroy(fb);
+out_unref:
+ if (backing->stolen)
+ psb_gtt_free_range(dev, backing);
+ else {
+ if (psbfb->vm_map)
+ vm_unmap_ram(info->screen_base, backing->npage);
+ drm_gem_object_unreference(&backing->gem);
+ }
out_err1:
mutex_unlock(&dev->struct_mutex);
psb_gtt_free_range(dev, backing);
@@ -506,7 +561,6 @@ static struct drm_framebuffer *psb_user_framebuffer_create
{
struct gtt_range *r;
struct drm_gem_object *obj;
- struct psb_framebuffer *psbfb;
/* Find the GEM object and thus the gtt range object that is
to back this space */
@@ -514,23 +568,9 @@ static struct drm_framebuffer *psb_user_framebuffer_create
if (obj == NULL)
return ERR_PTR(-ENOENT);
- /* Allocate a framebuffer */
- psbfb = kzalloc(sizeof(*psbfb), GFP_KERNEL);
- if (psbfb == NULL) {
- drm_gem_object_unreference_unlocked(obj);
- return ERR_PTR(-ENOMEM);
- }
-
/* Let the core code do all the work */
r = container_of(obj, struct gtt_range, gem);
- if (psb_framebuffer_create(dev, cmd, r) == NULL) {
- drm_gem_object_unreference_unlocked(obj);
- kfree(psbfb);
- return ERR_PTR(-EINVAL);
- }
- /* Return the drm_framebuffer contained within the psb fbdev which
- has been initialized by the framebuffer creation */
- return &psbfb->base;
+ return psb_framebuffer_create(dev, cmd, r);
}
static void psbfb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
@@ -572,7 +612,7 @@ struct drm_fb_helper_funcs psb_fb_helper_funcs = {
int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev)
{
struct fb_info *info;
- struct psb_framebuffer *psbfb = fbdev->pfb;
+ struct psb_framebuffer *psbfb = &fbdev->pfb;
if (fbdev->psb_fb_helper.fbdev) {
info = fbdev->psb_fb_helper.fbdev;
@@ -583,6 +623,15 @@ int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev)
vm_unmap_ram(info->screen_base, psbfb->gtt->npage);
psb_gtt_unpin(psbfb->gtt);
}
+ unregister_framebuffer(info);
+ if (info->cmap.len)
+ fb_dealloc_cmap(&info->cmap);
+ framebuffer_release(info);
+ }
+ drm_fb_helper_fini(&fbdev->psb_fb_helper);
+ drm_framebuffer_cleanup(&psbfb->base);
+
+ if (psbfb->gtt) {
/* FIXME: this is a bit more inside knowledge than I'd like
but I don't see how to make a fake GEM object of the
stolen space nicely */
@@ -590,13 +639,7 @@ int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev)
psb_gtt_free_range(dev, psbfb->gtt);
else
drm_gem_object_unreference(&psbfb->gtt->gem);
- unregister_framebuffer(info);
- iounmap(info->screen_base);
- framebuffer_release(info);
- }
-
- drm_fb_helper_fini(&fbdev->psb_fb_helper);
- drm_framebuffer_cleanup(&psbfb->base);
+ }
return 0;
}
@@ -644,22 +687,6 @@ static void psbfb_output_poll_changed(struct drm_device *dev)
drm_fb_helper_hotplug_event(&fbdev->psb_fb_helper);
}
-int psbfb_remove(struct drm_device *dev, struct drm_framebuffer *fb)
-{
- struct fb_info *info;
- struct psb_framebuffer *psbfb = to_psb_fb(fb);
-
- if (drm_psb_no_fb)
- return 0;
-
- info = psbfb->fbdev;
-
- if (info)
- framebuffer_release(info);
- return 0;
-}
-/*EXPORT_SYMBOL(psbfb_remove); */
-
/**
* psb_user_framebuffer_create_handle - add hamdle to a framebuffer
* @fb: framebuffer
@@ -690,15 +717,13 @@ static int psb_user_framebuffer_create_handle(struct drm_framebuffer *fb,
*/
static void psb_user_framebuffer_destroy(struct drm_framebuffer *fb)
{
- struct drm_device *dev = fb->dev;
struct psb_framebuffer *psbfb = to_psb_fb(fb);
struct gtt_range *r = psbfb->gtt;
+ /* Should never get stolen memory for a user fb */
+ WARN_ON(r->stolen);
pr_err("user framebuffer destroy %p, fbdev %p\n",
psbfb, psbfb->fbdev);
- if (psbfb->fbdev)
- psbfb_remove(dev, fb);
-
/* Let DRM do its clean up */
drm_framebuffer_cleanup(fb);
/* We are no longer using the resource in GEM */
diff --git a/drivers/staging/gma500/psb_fb.h b/drivers/staging/gma500/psb_fb.h
index 2153c74..fd7e51a 100644
--- a/drivers/staging/gma500/psb_fb.h
+++ b/drivers/staging/gma500/psb_fb.h
@@ -38,7 +38,7 @@ struct psb_framebuffer {
struct psb_fbdev {
struct drm_fb_helper psb_fb_helper;
- struct psb_framebuffer *pfb;
+ struct psb_framebuffer pfb;
};
diff --git a/drivers/staging/gma500/psb_gem.c b/drivers/staging/gma500/psb_gem.c
index 98d8ab3..b24b964 100644
--- a/drivers/staging/gma500/psb_gem.c
+++ b/drivers/staging/gma500/psb_gem.c
@@ -51,6 +51,7 @@ void psb_gem_free_object(struct drm_gem_object *obj)
}
drm_gem_object_release(obj);
/* This must occur last as it frees up the memory of the GEM object */
+ pr_err("GEM destroyed %p, %p\n", gtt, obj);
psb_gtt_free_range(obj->dev, gtt);
}
@@ -176,21 +177,28 @@ static int psb_gem_create(struct drm_file *file,
size = roundup(size, PAGE_SIZE);
+ dev_err(dev->dev, "GEM creating %lld\n", size);
+
/* Allocate our object - for now a direct gtt range which is not
stolen memory backed */
r = psb_gtt_alloc_range(dev, size, "gem", 0);
- if (r == NULL)
+ if (r == NULL) {
+ dev_err(dev->dev, "no memory for %lld byte GEM object\n", size);
return -ENOSPC;
+ }
/* Initialize the extra goodies GEM needs to do all the hard work */
if (drm_gem_object_init(dev, &r->gem, size) != 0) {
psb_gtt_free_range(dev, r);
/* GEM doesn't give an error code and we don't have an
EGEMSUCKS so make something up for now - FIXME */
+ dev_err(dev->dev, "GEM init failed for %lld\n", size);
return -ENOMEM;
}
/* Give the object a handle so we can carry it more easily */
ret = drm_gem_handle_create(file, &r->gem, &handle);
if (ret) {
+ dev_err(dev->dev, "GEM handle failed for %p, %lld\n",
+ &r->gem, size);
drm_gem_object_release(&r->gem);
psb_gtt_free_range(dev, r);
return ret;
@@ -198,6 +206,8 @@ static int psb_gem_create(struct drm_file *file,
/* We have the initial and handle reference but need only one now */
drm_gem_object_unreference(&r->gem);
*handlep = handle;
+ dev_err(dev->dev, "GEM handle %x for %p OK\n",
+ handle, &r->gem);
return 0;
}
@@ -273,9 +283,12 @@ int psb_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
something from beneath our feet */
mutex_lock(&dev->struct_mutex);
+ dev_err(dev->dev, "Fault on GTT %p\n", r);
+
/* For now the mmap pins the object and it stays pinned. As things
stand that will do us no harm */
if (r->mmapping == 0) {
+ dev_err(dev->dev, "Need to pin %p\n", r);
ret = psb_gtt_pin(r);
if (ret < 0) {
DRM_ERROR("gma500: pin failed: %d\n", ret);
@@ -289,10 +302,13 @@ int psb_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
page_offset = ((unsigned long) vmf->virtual_address - vma->vm_start)
>> PAGE_SHIFT;
+ dev_err(dev->dev, "Page offset %p %d\n", r, (int)page_offset);
/* CPU view of the page, don't go via the GART for CPU writes */
pfn = page_to_phys(r->pages[page_offset]) >> PAGE_SHIFT;
ret = vm_insert_pfn(vma, (unsigned long)vmf->virtual_address, pfn);
+ dev_err(dev->dev, "PFN %ld for VA %p = %d\n", pfn, vmf->virtual_address, ret);
+
fail:
mutex_unlock(&dev->struct_mutex);
switch (ret) {
diff --git a/drivers/staging/gma500/psb_gtt.c b/drivers/staging/gma500/psb_gtt.c
index 5a296e1..c6a7492 100644
--- a/drivers/staging/gma500/psb_gtt.c
+++ b/drivers/staging/gma500/psb_gtt.c
@@ -314,6 +314,7 @@ struct gtt_range *psb_gtt_alloc_range(struct drm_device *dev, int len,
len, start, end, PAGE_SIZE, NULL, NULL);
if (ret == 0) {
gt->offset = gt->resource.start - r->start;
+ dev_err(dev->dev, "GTT new %p, %d\n", gt, gt->stolen);
return gt;
}
kfree(gt);
@@ -340,6 +341,7 @@ static void psb_gtt_destroy(struct kref *kref)
}
WARN_ON(gt->in_gart && !gt->stolen);
release_resource(>->resource);
+ pr_err("GTT destroyed %p, %d\n", gt, gt->stolen);
kfree(gt);
}
From: Alan Cox <[email protected]>
If we get a user frame buffer destroyed which is being displayed then clean
up the mess nicely. We can now run a slightly modified modetest including setting
modes, and handling crashes.
Modetest still blows up but this is because libdrm 2.4.25 is busted.
Signed-off-by: Alan Cox <[email protected]>
---
drivers/staging/gma500/psb_fb.c | 24 +++++++++++++++++++++++-
drivers/staging/gma500/psb_intel_display.c | 22 +++++++++++++---------
2 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/gma500/psb_fb.c b/drivers/staging/gma500/psb_fb.c
index 5977add..d005025 100644
--- a/drivers/staging/gma500/psb_fb.c
+++ b/drivers/staging/gma500/psb_fb.c
@@ -719,16 +719,38 @@ static void psb_user_framebuffer_destroy(struct drm_framebuffer *fb)
{
struct psb_framebuffer *psbfb = to_psb_fb(fb);
struct gtt_range *r = psbfb->gtt;
+ struct drm_device *dev = fb->dev;
+ struct drm_psb_private *dev_priv = dev->dev_private;
+ struct psb_fbdev *fbdev = dev_priv->fbdev;
+ struct drm_crtc *crtc;
+ int reset = 0;
/* Should never get stolen memory for a user fb */
WARN_ON(r->stolen);
pr_err("user framebuffer destroy %p, fbdev %p\n",
psbfb, psbfb->fbdev);
+ /* Check if we are erroneously live */
+ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
+ if (crtc->fb == fb)
+ reset = 1;
+
+ if (reset)
+ pr_err("DRM: gma500, forcing reset\n");
+
+ if (reset)
+ /*
+ * Now force a sane response before we permit the DRM crc layer to
+ * do stupid things like blank the display. Instead we reset this
+ * framebuffer as if the user had forced a reset. We must do this
+ * before the cleanup so that the DRM layer doesn't get a chance
+ * to stick its oar in where it isn't wanted.
+ */
+ drm_fb_helper_restore_fbdev_mode(&fbdev->psb_fb_helper);
+
/* Let DRM do its clean up */
drm_framebuffer_cleanup(fb);
/* We are no longer using the resource in GEM */
drm_gem_object_unreference_unlocked(&r->gem);
-
kfree(fb);
}
diff --git a/drivers/staging/gma500/psb_intel_display.c b/drivers/staging/gma500/psb_intel_display.c
index a99271d..c7c55b1 100644
--- a/drivers/staging/gma500/psb_intel_display.c
+++ b/drivers/staging/gma500/psb_intel_display.c
@@ -352,15 +352,15 @@ int psb_intel_pipe_set_base(struct drm_crtc *crtc,
PSB_DEBUG_ENTRY("\n");
+ if (!gma_power_begin(dev, true))
+ return 0;
+
/* no fb bound */
if (!crtc->fb) {
DRM_DEBUG("No FB bound\n");
- return 0;
+ goto psb_intel_pipe_cleaner;
}
- if (!gma_power_begin(dev, true))
- return 0;
-
/* We are displaying this buffer, make sure it is actually loaded
into the GTT */
ret = psb_gtt_pin(psbfb->gtt);
@@ -409,6 +409,7 @@ int psb_intel_pipe_set_base(struct drm_crtc *crtc,
REG_READ(dspbase);
}
+psb_intel_pipe_cleaner:
/* If there was a previous display we can now unpin it */
if (old_fb)
psb_gtt_unpin(to_psb_fb(old_fb)->gtt);
@@ -588,6 +589,7 @@ static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,
{
struct drm_device *dev = crtc->dev;
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc);
+ struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
int pipe = psb_intel_crtc->pipe;
int fp_reg = (pipe == 0) ? FPA0 : FPB0;
int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B;
@@ -610,6 +612,12 @@ static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,
struct drm_mode_config *mode_config = &dev->mode_config;
struct drm_connector *connector;
+ /* No scan out no play */
+ if (crtc->fb == NULL) {
+ crtc_funcs->mode_set_base(crtc, x, y, old_fb);
+ return 0;
+ }
+
list_for_each_entry(connector, &mode_config->connector_list, head) {
struct psb_intel_output *psb_intel_output =
to_psb_intel_output(connector);
@@ -786,11 +794,7 @@ static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,
REG_WRITE(dspcntr_reg, dspcntr);
/* Flush the plane changes */
- {
- struct drm_crtc_helper_funcs *crtc_funcs =
- crtc->helper_private;
- crtc_funcs->mode_set_base(crtc, x, y, old_fb);
- }
+ crtc_funcs->mode_set_base(crtc, x, y, old_fb);
psb_intel_wait_for_vblank(dev);
From: Alan Cox <[email protected]>
Signed-off-by: Alan Cox <[email protected]>
---
drivers/staging/gma500/psb_fb.c | 6 +-----
drivers/staging/gma500/psb_gem.c | 11 -----------
drivers/staging/gma500/psb_gtt.c | 2 --
3 files changed, 1 insertions(+), 18 deletions(-)
diff --git a/drivers/staging/gma500/psb_fb.c b/drivers/staging/gma500/psb_fb.c
index d005025..156f8ad 100644
--- a/drivers/staging/gma500/psb_fb.c
+++ b/drivers/staging/gma500/psb_fb.c
@@ -727,17 +727,13 @@ static void psb_user_framebuffer_destroy(struct drm_framebuffer *fb)
/* Should never get stolen memory for a user fb */
WARN_ON(r->stolen);
- pr_err("user framebuffer destroy %p, fbdev %p\n",
- psbfb, psbfb->fbdev);
+
/* Check if we are erroneously live */
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
if (crtc->fb == fb)
reset = 1;
if (reset)
- pr_err("DRM: gma500, forcing reset\n");
-
- if (reset)
/*
* Now force a sane response before we permit the DRM crc layer to
* do stupid things like blank the display. Instead we reset this
diff --git a/drivers/staging/gma500/psb_gem.c b/drivers/staging/gma500/psb_gem.c
index b24b964..125ea6b 100644
--- a/drivers/staging/gma500/psb_gem.c
+++ b/drivers/staging/gma500/psb_gem.c
@@ -51,7 +51,6 @@ void psb_gem_free_object(struct drm_gem_object *obj)
}
drm_gem_object_release(obj);
/* This must occur last as it frees up the memory of the GEM object */
- pr_err("GEM destroyed %p, %p\n", gtt, obj);
psb_gtt_free_range(obj->dev, gtt);
}
@@ -177,8 +176,6 @@ static int psb_gem_create(struct drm_file *file,
size = roundup(size, PAGE_SIZE);
- dev_err(dev->dev, "GEM creating %lld\n", size);
-
/* Allocate our object - for now a direct gtt range which is not
stolen memory backed */
r = psb_gtt_alloc_range(dev, size, "gem", 0);
@@ -206,8 +203,6 @@ static int psb_gem_create(struct drm_file *file,
/* We have the initial and handle reference but need only one now */
drm_gem_object_unreference(&r->gem);
*handlep = handle;
- dev_err(dev->dev, "GEM handle %x for %p OK\n",
- handle, &r->gem);
return 0;
}
@@ -283,12 +278,9 @@ int psb_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
something from beneath our feet */
mutex_lock(&dev->struct_mutex);
- dev_err(dev->dev, "Fault on GTT %p\n", r);
-
/* For now the mmap pins the object and it stays pinned. As things
stand that will do us no harm */
if (r->mmapping == 0) {
- dev_err(dev->dev, "Need to pin %p\n", r);
ret = psb_gtt_pin(r);
if (ret < 0) {
DRM_ERROR("gma500: pin failed: %d\n", ret);
@@ -302,13 +294,10 @@ int psb_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
page_offset = ((unsigned long) vmf->virtual_address - vma->vm_start)
>> PAGE_SHIFT;
- dev_err(dev->dev, "Page offset %p %d\n", r, (int)page_offset);
/* CPU view of the page, don't go via the GART for CPU writes */
pfn = page_to_phys(r->pages[page_offset]) >> PAGE_SHIFT;
ret = vm_insert_pfn(vma, (unsigned long)vmf->virtual_address, pfn);
- dev_err(dev->dev, "PFN %ld for VA %p = %d\n", pfn, vmf->virtual_address, ret);
-
fail:
mutex_unlock(&dev->struct_mutex);
switch (ret) {
diff --git a/drivers/staging/gma500/psb_gtt.c b/drivers/staging/gma500/psb_gtt.c
index c6a7492..5a296e1 100644
--- a/drivers/staging/gma500/psb_gtt.c
+++ b/drivers/staging/gma500/psb_gtt.c
@@ -314,7 +314,6 @@ struct gtt_range *psb_gtt_alloc_range(struct drm_device *dev, int len,
len, start, end, PAGE_SIZE, NULL, NULL);
if (ret == 0) {
gt->offset = gt->resource.start - r->start;
- dev_err(dev->dev, "GTT new %p, %d\n", gt, gt->stolen);
return gt;
}
kfree(gt);
@@ -341,7 +340,6 @@ static void psb_gtt_destroy(struct kref *kref)
}
WARN_ON(gt->in_gart && !gt->stolen);
release_resource(>->resource);
- pr_err("GTT destroyed %p, %d\n", gt, gt->stolen);
kfree(gt);
}
From: Alan Cox <[email protected]>
Give the driver its own proper DRM name, clean up copyright headers and so
forth
Signed-off-by: Alan Cox <[email protected]>
---
drivers/staging/gma500/mrst_crtc.c | 4 +
drivers/staging/gma500/mrst_lvds.c | 2 -
drivers/staging/gma500/psb_2d.c | 7 --
drivers/staging/gma500/psb_bl.c | 4 +
drivers/staging/gma500/psb_drm.h | 90 +-------------------------------
drivers/staging/gma500/psb_drv.c | 4 +
drivers/staging/gma500/psb_drv.h | 85 +++++++++++++++---------------
drivers/staging/gma500/psb_fb.c | 3 -
drivers/staging/gma500/psb_fb.h | 3 -
drivers/staging/gma500/psb_gtt.h | 7 +-
drivers/staging/gma500/psb_intel_drv.h | 19 +------
drivers/staging/gma500/psb_irq.h | 8 +--
drivers/staging/gma500/psb_powermgmt.c | 4 +
drivers/staging/gma500/psb_powermgmt.h | 2 -
drivers/staging/gma500/psb_reg.h | 2 -
15 files changed, 67 insertions(+), 177 deletions(-)
diff --git a/drivers/staging/gma500/mrst_crtc.c b/drivers/staging/gma500/mrst_crtc.c
index e4a0c03..fd97c80 100644
--- a/drivers/staging/gma500/mrst_crtc.c
+++ b/drivers/staging/gma500/mrst_crtc.c
@@ -86,7 +86,7 @@ static const struct mrst_limit_t *mrst_limit(struct drm_crtc *crtc)
{
const struct mrst_limit_t *limit = NULL;
struct drm_device *dev = crtc->dev;
- DRM_DRIVER_PRIVATE_T *dev_priv = dev->dev_private;
+ struct drm_psb_private *dev_priv = dev->dev_private;
if (psb_intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)
|| psb_intel_pipe_has_type(crtc, INTEL_OUTPUT_MIPI)) {
@@ -296,7 +296,7 @@ static int mrst_crtc_mode_set(struct drm_crtc *crtc,
{
struct drm_device *dev = crtc->dev;
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc);
- DRM_DRIVER_PRIVATE_T *dev_priv = dev->dev_private;
+ struct drm_psb_private *dev_priv = dev->dev_private;
int pipe = psb_intel_crtc->pipe;
int fp_reg = (pipe == 0) ? MRST_FPA0 : FPB0;
int dpll_reg = (pipe == 0) ? MRST_DPLL_A : DPLL_B;
diff --git a/drivers/staging/gma500/mrst_lvds.c b/drivers/staging/gma500/mrst_lvds.c
index 4a08b74..22ea00e 100644
--- a/drivers/staging/gma500/mrst_lvds.c
+++ b/drivers/staging/gma500/mrst_lvds.c
@@ -46,7 +46,7 @@ static void mrst_lvds_set_power(struct drm_device *dev,
struct psb_intel_output *output, bool on)
{
u32 pp_status;
- DRM_DRIVER_PRIVATE_T *dev_priv = dev->dev_private;
+ struct drm_psb_private *dev_priv = dev->dev_private;
PSB_DEBUG_ENTRY("\n");
if (!gma_power_begin(dev, true))
diff --git a/drivers/staging/gma500/psb_2d.c b/drivers/staging/gma500/psb_2d.c
index 060eeaf..c3d7085 100644
--- a/drivers/staging/gma500/psb_2d.c
+++ b/drivers/staging/gma500/psb_2d.c
@@ -1,5 +1,5 @@
/**************************************************************************
- * Copyright (c) 2007, Intel Corporation.
+ * Copyright (c) 2007-2011, Intel Corporation.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
@@ -396,8 +396,3 @@ int psbfb_sync(struct fb_info *info)
out:
return (busy) ? -EBUSY : 0;
}
-
-/*
- info->fix.accel = FB_ACCEL_I830;
- info->flags = FBINFO_DEFAULT;
-*/
diff --git a/drivers/staging/gma500/psb_bl.c b/drivers/staging/gma500/psb_bl.c
index 5dffc71..2f9674d 100644
--- a/drivers/staging/gma500/psb_bl.c
+++ b/drivers/staging/gma500/psb_bl.c
@@ -1,7 +1,7 @@
/*
- * psb backlight interface
+ * GMA500 Backlight Interface
*
- * Copyright (c) 2009, Intel Corporation.
+ * Copyright (c) 2009-2011, Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
diff --git a/drivers/staging/gma500/psb_drm.h b/drivers/staging/gma500/psb_drm.h
index 49ffdd5..b005293 100644
--- a/drivers/staging/gma500/psb_drm.h
+++ b/drivers/staging/gma500/psb_drm.h
@@ -1,5 +1,5 @@
/**************************************************************************
- * Copyright (c) 2007, Intel Corporation.
+ * Copyright (c) 2007-2011, Intel Corporation.
* All Rights Reserved.
* Copyright (c) 2008, Tungsten Graphics Inc. Cedar Park, TX., USA.
* All Rights Reserved.
@@ -22,84 +22,8 @@
#ifndef _PSB_DRM_H_
#define _PSB_DRM_H_
-#if defined(__linux__) && !defined(__KERNEL__)
-#include<stdint.h>
-#include <linux/types.h>
-#include "drm_mode.h"
-#endif
-
-#define DRM_PSB_SAREA_MAJOR 0
-#define DRM_PSB_SAREA_MINOR 2
-#define PSB_FIXED_SHIFT 16
-
#define PSB_NUM_PIPE 3
-/*
- * Public memory types.
- */
-
-typedef s32 psb_fixed;
-typedef u32 psb_ufixed;
-
-static inline s32 psb_int_to_fixed(int a)
-{
- return a * (1 << PSB_FIXED_SHIFT);
-}
-
-static inline u32 psb_unsigned_to_ufixed(unsigned int a)
-{
- return a << PSB_FIXED_SHIFT;
-}
-
-/*Status of the command sent to the gfx device.*/
-typedef enum {
- DRM_CMD_SUCCESS,
- DRM_CMD_FAILED,
- DRM_CMD_HANG
-} drm_cmd_status_t;
-
-struct drm_psb_scanout {
- u32 buffer_id; /* DRM buffer object ID */
- u32 rotation; /* Rotation as in RR_rotation definitions */
- u32 stride; /* Buffer stride in bytes */
- u32 depth; /* Buffer depth in bits (NOT) bpp */
- u32 width; /* Buffer width in pixels */
- u32 height; /* Buffer height in lines */
- s32 transform[3][3]; /* Buffer composite transform */
- /* (scaling, rot, reflect) */
-};
-
-#define DRM_PSB_SAREA_OWNERS 16
-#define DRM_PSB_SAREA_OWNER_2D 0
-#define DRM_PSB_SAREA_OWNER_3D 1
-
-#define DRM_PSB_SAREA_SCANOUTS 3
-
-struct drm_psb_sarea {
- /* Track changes of this data structure */
-
- u32 major;
- u32 minor;
-
- /* Last context to touch part of hw */
- u32 ctx_owners[DRM_PSB_SAREA_OWNERS];
-
- /* Definition of front- and rotated buffers */
- u32 num_scanouts;
- struct drm_psb_scanout scanouts[DRM_PSB_SAREA_SCANOUTS];
-
- int planeA_x;
- int planeA_y;
- int planeA_w;
- int planeA_h;
- int planeB_x;
- int planeB_y;
- int planeB_w;
- int planeB_h;
- /* Number of active scanouts */
- u32 num_active_scanouts;
-};
-
#define PSB_GPU_ACCESS_READ (1ULL << 32)
#define PSB_GPU_ACCESS_WRITE (1ULL << 33)
#define PSB_GPU_ACCESS_MASK (PSB_GPU_ACCESS_READ | PSB_GPU_ACCESS_WRITE)
@@ -223,20 +147,14 @@ struct drm_psb_register_rw_arg {
#define DRM_PSB_KMS_OFF 0x00
#define DRM_PSB_KMS_ON 0x01
-#define DRM_PSB_VT_LEAVE 0x02
-#define DRM_PSB_VT_ENTER 0x03
-#define DRM_PSB_EXTENSION 0x06
#define DRM_PSB_SIZES 0x07
#define DRM_PSB_FUSE_REG 0x08
-#define DRM_PSB_VBT 0x09
#define DRM_PSB_DC_STATE 0x0A
#define DRM_PSB_ADB 0x0B
#define DRM_PSB_MODE_OPERATION 0x0C
#define DRM_PSB_STOLEN_MEMORY 0x0D
#define DRM_PSB_REGISTER_RW 0x0E
-#define DRM_PSB_GTT_MAP 0x0F
-#define DRM_PSB_GTT_UNMAP 0x10
-#define DRM_PSB_GETPAGEADDRS 0x11
+
/**
* NOTE: Add new commands here, but increment
* the values below and increment their
@@ -249,10 +167,6 @@ struct drm_psb_register_rw_arg {
#define DRM_PVR_RESERVED4 0x15
#define DRM_PVR_RESERVED5 0x16
-#define DRM_PSB_HIST_ENABLE 0x17
-#define DRM_PSB_HIST_STATUS 0x18
-#define DRM_PSB_UPDATE_GUARD 0x19
-#define DRM_PSB_INIT_COMM 0x1A
#define DRM_PSB_DPST 0x1B
#define DRM_PSB_GAMMA 0x1C
#define DRM_PSB_DPST_BL 0x1D
diff --git a/drivers/staging/gma500/psb_drv.c b/drivers/staging/gma500/psb_drv.c
index aa87b1b..9bd0a5d 100644
--- a/drivers/staging/gma500/psb_drv.c
+++ b/drivers/staging/gma500/psb_drv.c
@@ -1,5 +1,5 @@
/**************************************************************************
- * Copyright (c) 2007, Intel Corporation.
+ * Copyright (c) 2007-2011, Intel Corporation.
* All Rights Reserved.
* Copyright (c) 2008, Tungsten Graphics, Inc. Cedar Park, TX., USA.
* All Rights Reserved.
@@ -1462,6 +1462,6 @@ static void __exit psb_exit(void)
late_initcall(psb_init);
module_exit(psb_exit);
-MODULE_AUTHOR(DRIVER_AUTHOR);
+MODULE_AUTHOR("Alan Cox <[email protected]> and others");
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
diff --git a/drivers/staging/gma500/psb_drv.h b/drivers/staging/gma500/psb_drv.h
index e19a454..c0468ee 100644
--- a/drivers/staging/gma500/psb_drv.h
+++ b/drivers/staging/gma500/psb_drv.h
@@ -1,5 +1,5 @@
/**************************************************************************
- * Copyright (c) 2007-2008, Intel Corporation.
+ * Copyright (c) 2007-2011, Intel Corporation.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
@@ -32,40 +32,32 @@
#include "psb_powermgmt.h"
#include "mrst.h"
-/*Append new drm mode definition here, align with libdrm definition*/
+/* Append new drm mode definition here, align with libdrm definition */
#define DRM_MODE_SCALE_NO_SCALE 2
enum {
- CHIP_PSB_8108 = 0,
- CHIP_PSB_8109 = 1,
- CHIP_MRST_4100 = 2,
+ CHIP_PSB_8108 = 0, /* Poulsbo */
+ CHIP_PSB_8109 = 1, /* Poulsbo */
+ CHIP_MRST_4100 = 2, /* Moorestown/Oaktrail */
};
#define IS_MRST(dev) (((dev)->pci_device & 0xfffc) == 0x4100)
/*
- *Hardware bugfixes
+ * Driver definitions
*/
-#define DRIVER_NAME "pvrsrvkm"
-#define DRIVER_DESC "drm driver for the Intel GMA500"
-#define DRIVER_AUTHOR "Intel Corporation"
+#define DRIVER_NAME "gma500"
+#define DRIVER_DESC "DRM driver for the Intel GMA500"
-#define PSB_DRM_DRIVER_DATE "2009-03-10"
-#define PSB_DRM_DRIVER_MAJOR 8
-#define PSB_DRM_DRIVER_MINOR 1
+#define PSB_DRM_DRIVER_DATE "2011-06-06"
+#define PSB_DRM_DRIVER_MAJOR 1
+#define PSB_DRM_DRIVER_MINOR 0
#define PSB_DRM_DRIVER_PATCHLEVEL 0
/*
- *TTM driver private offsets.
+ * Hardware offsets
*/
-
-#define DRM_PSB_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
-
-#define PSB_OBJECT_HASH_ORDER 13
-#define PSB_FILE_OBJECT_HASH_ORDER 12
-#define PSB_BO_HASH_ORDER 12
-
#define PSB_VDC_OFFSET 0x00000000
#define PSB_VDC_SIZE 0x000080000
#define MRST_MMIO_SIZE 0x0000C0000
@@ -73,42 +65,52 @@ enum {
#define PSB_SGX_SIZE 0x8000
#define PSB_SGX_OFFSET 0x00040000
#define MRST_SGX_OFFSET 0x00080000
+/*
+ * PCI resource identifiers
+ */
#define PSB_MMIO_RESOURCE 0
#define PSB_GATT_RESOURCE 2
#define PSB_GTT_RESOURCE 3
+/*
+ * PCI configuration
+ */
#define PSB_GMCH_CTRL 0x52
#define PSB_BSM 0x5C
#define _PSB_GMCH_ENABLED 0x4
#define PSB_PGETBL_CTL 0x2020
#define _PSB_PGETBL_ENABLED 0x00000001
#define PSB_SGX_2D_SLAVE_PORT 0x4000
+
+/* To get rid of */
#define PSB_TT_PRIV0_LIMIT (256*1024*1024)
#define PSB_TT_PRIV0_PLIMIT (PSB_TT_PRIV0_LIMIT >> PAGE_SHIFT)
-#define PSB_NUM_VALIDATE_BUFFERS 2048
/*
- *Flags for external memory type field.
+ * SGX side MMU definitions (these can probably go)
*/
+/*
+ * Flags for external memory type field.
+ */
#define PSB_MMU_CACHED_MEMORY 0x0001 /* Bind to MMU only */
#define PSB_MMU_RO_MEMORY 0x0002 /* MMU RO memory */
#define PSB_MMU_WO_MEMORY 0x0004 /* MMU WO memory */
-
/*
- *PTE's and PDE's
+ * PTE's and PDE's
*/
-
#define PSB_PDE_MASK 0x003FFFFF
#define PSB_PDE_SHIFT 22
#define PSB_PTE_SHIFT 12
-
+/*
+ * Cache control
+ */
#define PSB_PTE_VALID 0x0001 /* PTE / PDE valid */
#define PSB_PTE_WO 0x0002 /* Write only */
#define PSB_PTE_RO 0x0004 /* Read only */
#define PSB_PTE_CACHED 0x0008 /* CPU cache coherent */
/*
- *VDC registers and bits
+ * VDC registers and bits
*/
#define PSB_MSVDX_CLOCKGATING 0x2064
#define PSB_TOPAZ_CLOCKGATING 0x2068
@@ -278,7 +280,7 @@ struct drm_psb_private {
int display_count;
/*
- *Modesetting
+ * Modesetting
*/
struct psb_intel_mode_device mode_dev;
@@ -287,12 +289,8 @@ struct drm_psb_private {
uint32_t num_pipe;
/*
- *Memory managers
+ * OSPM info (Power management base) (can go ?)
*/
-
- /*
- *OSPM info
- */
uint32_t ospm_base;
/*
@@ -304,11 +302,11 @@ struct drm_psb_private {
u32 fuse_reg_value;
u32 video_device_fuse;
- /* pci revision id for B0:D2:F0 */
+ /* PCI revision ID for B0:D2:F0 */
uint8_t platform_rev_id;
/*
- *LVDS info
+ * LVDS info
*/
int backlight_duty_cycle; /* restore backlight to this value */
bool panel_wants_dither;
@@ -316,10 +314,10 @@ struct drm_psb_private {
struct drm_display_mode *lfp_lvds_vbt_mode;
struct drm_display_mode *sdvo_lvds_vbt_mode;
- struct bdb_lvds_backlight *lvds_bl; /*LVDS backlight info from VBT*/
+ struct bdb_lvds_backlight *lvds_bl; /* LVDS backlight info from VBT */
struct psb_intel_i2c_chan *lvds_i2c_bus;
- /* Feature bits from the VBIOS*/
+ /* Feature bits from the VBIOS */
unsigned int int_tv_support:1;
unsigned int lvds_dither:1;
unsigned int lvds_vbt:1;
@@ -332,7 +330,7 @@ struct drm_psb_private {
unsigned int core_freq;
uint32_t iLVDS_enable;
- /*runtime PM state*/
+ /* Runtime PM state */
int rpm_enabled;
/* Moorestown specific */
@@ -350,7 +348,7 @@ struct drm_psb_private {
uint32_t dspcntr2;
/*
- *Register state
+ * Register state
*/
uint32_t saveDSPACNTR;
uint32_t saveDSPBCNTR;
@@ -468,7 +466,7 @@ struct drm_psb_private {
u32 lid_last_state;
/*
- *Watchdog
+ * Watchdog
*/
uint32_t apm_reg;
@@ -497,7 +495,7 @@ static inline struct drm_psb_private *psb_priv(struct drm_device *dev)
}
/*
- *MMU stuff.
+ * MMU stuff.
*/
extern struct psb_mmu_driver *psb_mmu_driver_init(uint8_t __iomem * registers,
@@ -525,7 +523,7 @@ extern int psb_mmu_virtual_to_pfn(struct psb_mmu_pd *pd, uint32_t virtual,
unsigned long *pfn);
/*
- *Enable / disable MMU for different requestors.
+ * Enable / disable MMU for different requestors.
*/
@@ -598,7 +596,7 @@ extern int psbfb_2d_submit(struct drm_psb_private *dev_priv, uint32_t *cmdbuf,
unsigned size);
/*
- *psb_reset.c
+ * psb_reset.c
*/
extern void psb_lid_timer_init(struct drm_psb_private *dev_priv);
@@ -710,7 +708,6 @@ extern int drm_idle_check_interval;
/*
*Utilities
*/
-#define DRM_DRIVER_PRIVATE_T struct drm_psb_private
static inline u32 MRST_MSG_READ32(uint port, uint offset)
{
diff --git a/drivers/staging/gma500/psb_fb.c b/drivers/staging/gma500/psb_fb.c
index 156f8ad..0a77abf 100644
--- a/drivers/staging/gma500/psb_fb.c
+++ b/drivers/staging/gma500/psb_fb.c
@@ -1,5 +1,5 @@
/**************************************************************************
- * Copyright (c) 2007, Intel Corporation.
+ * Copyright (c) 2007-2011, Intel Corporation.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
@@ -56,7 +56,6 @@ void *psbfb_vdc_reg(struct drm_device *dev)
dev_priv = (struct drm_psb_private *) dev->dev_private;
return dev_priv->vdc_reg;
}
-/*EXPORT_SYMBOL(psbfb_vdc_reg); */
static int psbfb_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp,
diff --git a/drivers/staging/gma500/psb_fb.h b/drivers/staging/gma500/psb_fb.h
index fd7e51a..ed6e856 100644
--- a/drivers/staging/gma500/psb_fb.h
+++ b/drivers/staging/gma500/psb_fb.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Intel Corporation
+ * Copyright (c) 2008-2011, Intel Corporation
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -41,7 +41,6 @@ struct psb_fbdev {
struct psb_framebuffer pfb;
};
-
#define to_psb_fb(x) container_of(x, struct psb_framebuffer, base)
extern int psb_intel_connector_clones(struct drm_device *dev, int type_mask);
diff --git a/drivers/staging/gma500/psb_gtt.h b/drivers/staging/gma500/psb_gtt.h
index 37287eb..7e1f21e 100644
--- a/drivers/staging/gma500/psb_gtt.h
+++ b/drivers/staging/gma500/psb_gtt.h
@@ -22,6 +22,7 @@
#include <drm/drmP.h>
+/* This wants cleaning up with respect to the psb_dev and un-needed stuff */
struct psb_gtt {
struct drm_device *dev;
uint32_t gatt_start;
@@ -41,9 +42,9 @@ extern void psb_gtt_takedown(struct drm_device *dev);
/* Each gtt_range describes an allocation in the GTT area */
struct gtt_range {
- struct resource resource;
- u32 offset;
- struct kref kref;
+ struct resource resource; /* Resource for our allocation */
+ u32 offset; /* GTT offset of our object */
+ struct kref kref; /* Can probably go FIXME - GEM kref will do */
struct drm_gem_object gem; /* GEM high level stuff */
int in_gart; /* Currently in the GART (ref ct) */
bool stolen; /* Backed from stolen RAM */
diff --git a/drivers/staging/gma500/psb_intel_drv.h b/drivers/staging/gma500/psb_intel_drv.h
index 6006ddd..75a95f7 100644
--- a/drivers/staging/gma500/psb_intel_drv.h
+++ b/drivers/staging/gma500/psb_intel_drv.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Intel Corporation.
+ * Copyright (c) 2009-2011, Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -26,11 +26,6 @@
#include <linux/gpio.h>
/*
- * MOORESTOWN defines
- */
-#define DELAY_TIME1 2000 /* 1000 = 1ms */
-
-/*
* Display related stuff
*/
@@ -61,16 +56,10 @@
#define INTEL_DVO_CHIP_TMDS 2
#define INTEL_DVO_CHIP_TVOUT 4
-enum mipi_panel_type {
- NSC_800X480 = 1,
- LGE_480X1024 = 2,
- TPO_864X480 = 3
-};
-
-/**
+/*
* Hold information useally put on the device driver privates here,
* since it needs to be shared across multiple of devices drivers privates.
-*/
+ */
struct psb_intel_mode_device {
/*
@@ -79,7 +68,7 @@ struct psb_intel_mode_device {
size_t(*bo_offset) (struct drm_device *dev, void *bo);
/*
- * Cursor
+ * Cursor (Can go ?)
*/
int cursor_needs_physical;
diff --git a/drivers/staging/gma500/psb_irq.h b/drivers/staging/gma500/psb_irq.h
index 3e56f33..216fda3 100644
--- a/drivers/staging/gma500/psb_irq.h
+++ b/drivers/staging/gma500/psb_irq.h
@@ -1,5 +1,5 @@
/**************************************************************************
- * Copyright (c) 2009, Intel Corporation.
+ * Copyright (c) 2009-2011, Intel Corporation.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
@@ -34,10 +34,6 @@ int psb_irq_postinstall(struct drm_device *dev);
void psb_irq_uninstall(struct drm_device *dev);
irqreturn_t psb_irq_handler(DRM_IRQ_ARGS);
-void psb_irq_preinstall_islands(struct drm_device *dev, int hw_islands);
-int psb_irq_postinstall_islands(struct drm_device *dev, int hw_islands);
-void psb_irq_uninstall_islands(struct drm_device *dev, int hw_islands);
-
int psb_irq_enable_dpst(struct drm_device *dev);
int psb_irq_disable_dpst(struct drm_device *dev);
void psb_irq_turn_on_dpst(struct drm_device *dev);
@@ -46,4 +42,4 @@ int psb_enable_vblank(struct drm_device *dev, int pipe);
void psb_disable_vblank(struct drm_device *dev, int pipe);
u32 psb_get_vblank_counter(struct drm_device *dev, int pipe);
-#endif //_SYSIRQ_H_
+#endif /* _SYSIRQ_H_ */
diff --git a/drivers/staging/gma500/psb_powermgmt.c b/drivers/staging/gma500/psb_powermgmt.c
index 1495415..50f2234 100644
--- a/drivers/staging/gma500/psb_powermgmt.c
+++ b/drivers/staging/gma500/psb_powermgmt.c
@@ -1,7 +1,7 @@
/**************************************************************************
- * Copyright (c) 2009, Intel Corporation.
+ * Copyright (c) 2009-2011, Intel Corporation.
* 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
diff --git a/drivers/staging/gma500/psb_powermgmt.h b/drivers/staging/gma500/psb_powermgmt.h
index e005229..333b28d 100644
--- a/drivers/staging/gma500/psb_powermgmt.h
+++ b/drivers/staging/gma500/psb_powermgmt.h
@@ -1,5 +1,5 @@
/**************************************************************************
- * Copyright (c) 2009, Intel Corporation.
+ * Copyright (c) 2009-2011, Intel Corporation.
* All Rights Reserved.
* Permission is hereby granted, free of charge, to any person obtaining a
diff --git a/drivers/staging/gma500/psb_reg.h b/drivers/staging/gma500/psb_reg.h
index 9ad4989..529fda8 100644
--- a/drivers/staging/gma500/psb_reg.h
+++ b/drivers/staging/gma500/psb_reg.h
@@ -573,7 +573,7 @@
#define MDFLD_PWRGT_DISPLAY_C_CNTR 0x00030000
#define MDFLD_PWRGT_DISP_MIPI_CNTR 0x000c0000
#define MDFLD_PWRGT_DISPLAY_CNTR (MDFLD_PWRGT_DISPLAY_A_CNTR | MDFLD_PWRGT_DISPLAY_B_CNTR | MDFLD_PWRGT_DISPLAY_C_CNTR | MDFLD_PWRGT_DISP_MIPI_CNTR)// 0x000fc00c
-// Display SSS register bits are different in A0 vs. B0
+/* Display SSS register bits are different in A0 vs. B0 */
#define PSB_PWRGT_GFX_MASK 0x3
#define MDFLD_PWRGT_DISPLAY_A_STS 0x000000c0
#define MDFLD_PWRGT_DISPLAY_B_STS 0x00000300
From: Alan Cox <[email protected]>
We have a FIXME to do the power management for which the framework now
exists, and we also need to deal with an erratum. Some operations exactly 8
pixels wide or high fail. The work around is to do two smaller ones (see
the Intel released X driver bits) but for console quite frankly if it's
8bits wide and/or high its not worth it so fall back.
Signed-off-by: Alan Cox <[email protected]>
---
drivers/staging/gma500/psb_2d.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/gma500/psb_2d.c b/drivers/staging/gma500/psb_2d.c
index c3d7085..494bad5 100644
--- a/drivers/staging/gma500/psb_2d.c
+++ b/drivers/staging/gma500/psb_2d.c
@@ -183,10 +183,14 @@ static void psbfb_fillrect_accel(struct fb_info *info,
cfb_fillrect(info, r);
return;
}
-
+ if (!gma_power_begin(dev, false)) {
+ cfb_fillrect(info, r);
+ return;
+ }
psb_accel_2d_fillrect(dev_priv,
offset, stride, format,
r->dx, r->dy, r->width, r->height, r->color);
+ gma_power_end(dev);
}
void psbfb_fillrect(struct fb_info *info,
@@ -198,9 +202,7 @@ void psbfb_fillrect(struct fb_info *info,
if (1 || (info->flags & FBINFO_HWACCEL_DISABLED))
return cfb_fillrect(info, rect);
- /*psb_check_power_state(dev, PSB_DEVICE_SGX); */
psbfb_fillrect_accel(info, rect);
- /* Drop power again here on MRST FIXMEAC */
}
static u32 psb_accel_2d_copy_direction(int xdir, int ydir)
@@ -331,10 +333,15 @@ static void psbfb_copyarea_accel(struct fb_info *info,
return;
}
+ if (!gma_power_begin(dev, false)) {
+ cfb_copyarea(info, a);
+ return;
+ }
psb_accel_2d_copy(dev_priv,
offset, stride, src_format,
offset, stride, dst_format,
a->sx, a->sy, a->dx, a->dy, a->width, a->height);
+ gma_power_end(dev);
}
void psbfb_copyarea(struct fb_info *info,
@@ -343,12 +350,12 @@ void psbfb_copyarea(struct fb_info *info,
if (unlikely(info->state != FBINFO_STATE_RUNNING))
return;
- if (info->flags & FBINFO_HWACCEL_DISABLED)
+ /* Avoid the 8 pixel erratum */
+ if (region->width == 8 || region->height == 8 ||
+ (info->flags & FBINFO_HWACCEL_DISABLED))
return cfb_copyarea(info, region);
- /* psb_check_power_state(dev, PSB_DEVICE_SGX); */
psbfb_copyarea_accel(info, region);
- /* Need to power back off here for MRST FIXMEAC */
}
void psbfb_imageblit(struct fb_info *info, const struct fb_image *image)
From: Alan Cox <[email protected]>
We don't seem to need this for our task.
Signed-off-by: Alan Cox <[email protected]>
---
drivers/staging/gma500/psb_drv.c | 6 ----
drivers/staging/gma500/psb_gtt.c | 62 ++++++++++++--------------------------
2 files changed, 19 insertions(+), 49 deletions(-)
diff --git a/drivers/staging/gma500/psb_drv.c b/drivers/staging/gma500/psb_drv.c
index 9bd0a5d..ab1da30 100644
--- a/drivers/staging/gma500/psb_drv.c
+++ b/drivers/staging/gma500/psb_drv.c
@@ -409,8 +409,6 @@ static int psb_do_init(struct drm_device *dev)
struct psb_gtt *pg = dev_priv->pg;
uint32_t stolen_gtt;
- uint32_t tt_start;
- uint32_t tt_pages;
int ret = -ENOMEM;
@@ -449,10 +447,6 @@ static int psb_do_init(struct drm_device *dev)
spin_lock_init(&dev_priv->irqmask_lock);
- tt_pages = (pg->gatt_pages < PSB_TT_PRIV0_PLIMIT) ?
- pg->gatt_pages : PSB_TT_PRIV0_PLIMIT;
- tt_start = dev_priv->gatt_free_offset - pg->mmu_gatt_start;
- tt_pages -= tt_start >> PAGE_SHIFT;
/* FIXME: can we kill ta_mem_size ? */
dev_priv->sizes.ta_mem_size = 0;
diff --git a/drivers/staging/gma500/psb_gtt.c b/drivers/staging/gma500/psb_gtt.c
index 5a296e1..8fcb833 100644
--- a/drivers/staging/gma500/psb_gtt.c
+++ b/drivers/staging/gma500/psb_gtt.c
@@ -138,8 +138,6 @@ static void psb_gtt_remove(struct drm_device *dev, struct gtt_range *r)
*
* Pin and build an in kernel list of the pages that back our GEM object.
* While we hold this the pages cannot be swapped out
- *
- * FIXME: Do we need to cache flush when we update the GTT
*/
static int psb_gtt_attach_pages(struct gtt_range *gt)
{
@@ -185,8 +183,6 @@ err:
* Undo the effect of psb_gtt_attach_pages. At this point the pages
* must have been removed from the GTT as they could now be paged out
* and move bus address.
- *
- * FIXME: Do we need to cache flush when we update the GTT
*/
static void psb_gtt_detach_pages(struct gtt_range *gt)
{
@@ -194,7 +190,6 @@ static void psb_gtt_detach_pages(struct gtt_range *gt)
for (i = 0; i < gt->npage; i++) {
/* FIXME: do we need to force dirty */
set_page_dirty(gt->pages[i]);
- /* Undo the reference we took when populating the table */
page_cache_release(gt->pages[i]);
}
kfree(gt->pages);
@@ -384,7 +379,6 @@ void psb_gtt_takedown(struct drm_device *dev)
{
struct drm_psb_private *dev_priv = dev->dev_private;
- /* FIXME: iounmap dev_priv->vram_addr etc */
if (dev_priv->gtt_map) {
iounmap(dev_priv->gtt_map);
dev_priv->gtt_map = NULL;
@@ -395,6 +389,8 @@ void psb_gtt_takedown(struct drm_device *dev)
PSB_WVDC32(dev_priv->pge_ctl, PSB_PGETBL_CTL);
(void) PSB_RVDC32(PSB_PGETBL_CTL);
}
+ if (dev_priv->vram_addr)
+ iounmap(dev_priv->gtt_map);
kfree(dev_priv->pg);
dev_priv->pg = NULL;
}
@@ -407,8 +403,6 @@ int psb_gtt_init(struct drm_device *dev, int resume)
unsigned i, num_pages;
unsigned pfn_base;
uint32_t vram_pages;
- uint32_t tt_pages;
- uint32_t *ttm_gtt_map;
uint32_t dvmt_mode = 0;
struct psb_gtt *pg;
@@ -421,6 +415,7 @@ int psb_gtt_init(struct drm_device *dev, int resume)
if (pg == NULL)
return -ENOMEM;
+ /* Enable the GTT */
pci_read_config_word(dev->pdev, PSB_GMCH_CTRL, &dev_priv->gmch_ctrl);
pci_write_config_word(dev->pdev, PSB_GMCH_CTRL,
dev_priv->gmch_ctrl | _PSB_GMCH_ENABLED);
@@ -431,30 +426,26 @@ int psb_gtt_init(struct drm_device *dev, int resume)
/* The root resource we allocate address space from */
dev_priv->gtt_mem = &dev->pdev->resource[PSB_GATT_RESOURCE];
-
dev_priv->gtt_initialized = 1;
pg->gtt_phys_start = dev_priv->pge_ctl & PAGE_MASK;
pg->gatt_start = pci_resource_start(dev->pdev, PSB_GATT_RESOURCE);
- /* fix me: video mmu has hw bug to access 0x0D0000000,
- * then make gatt start at 0x0e000,0000 */
+ /*
+ * FIXME: video mmu has hw bug to access 0x0D0000000,
+ * then make gatt start at 0x0e000,0000
+ */
pg->mmu_gatt_start = 0xE0000000;
+
pg->gtt_start = pci_resource_start(dev->pdev, PSB_GTT_RESOURCE);
- gtt_pages =
- pci_resource_len(dev->pdev, PSB_GTT_RESOURCE) >> PAGE_SHIFT;
- pg->gatt_pages = pci_resource_len(dev->pdev, PSB_GATT_RESOURCE)
- >> PAGE_SHIFT;
+ gtt_pages = pci_resource_len(dev->pdev, PSB_GTT_RESOURCE) >> PAGE_SHIFT;
+ pg->gatt_pages = pci_resource_len(dev->pdev, PSB_GATT_RESOURCE) >> PAGE_SHIFT;
pci_read_config_dword(dev->pdev, PSB_BSM, &dev_priv->stolen_base);
vram_stolen_size = pg->gtt_phys_start - dev_priv->stolen_base - PAGE_SIZE;
stolen_size = vram_stolen_size;
- printk(KERN_INFO"GMMADR(region 0) start: 0x%08x (%dM).\n",
- pg->gatt_start, pg->gatt_pages/256);
- printk(KERN_INFO"GTTADR(region 3) start: 0x%08x (can map %dM RAM), and actual RAM base 0x%08x.\n",
- pg->gtt_start, gtt_pages * 4, pg->gtt_phys_start);
printk(KERN_INFO "Stolen memory information\n");
printk(KERN_INFO " base in RAM: 0x%x\n", dev_priv->stolen_base);
printk(KERN_INFO " size: %luK, calculated by (GTT RAM base) - (Stolen base), seems wrong\n",
@@ -473,8 +464,11 @@ int psb_gtt_init(struct drm_device *dev, int resume)
pg->gtt_pages = gtt_pages;
pg->stolen_size = stolen_size;
dev_priv->vram_stolen_size = vram_stolen_size;
- dev_priv->gtt_map =
- ioremap_nocache(pg->gtt_phys_start, gtt_pages << PAGE_SHIFT);
+
+ /*
+ * Map the GTT and the stolen memory area
+ */
+ dev_priv->gtt_map = ioremap_nocache(pg->gtt_phys_start, gtt_pages << PAGE_SHIFT);
if (!dev_priv->gtt_map) {
DRM_ERROR("Failure to map gtt.\n");
ret = -ENOMEM;
@@ -488,15 +482,8 @@ int psb_gtt_init(struct drm_device *dev, int resume)
goto out_err;
}
- DRM_DEBUG("gma500: vram kernel virtual address %p\n", dev_priv->vram_addr);
-
- tt_pages = (pg->gatt_pages < PSB_TT_PRIV0_PLIMIT) ?
- (pg->gatt_pages) : PSB_TT_PRIV0_PLIMIT;
-
- ttm_gtt_map = dev_priv->gtt_map + tt_pages / 2;
-
/*
- * insert vram stolen pages.
+ * Insert vram stolen pages into the GTT
*/
pfn_base = dev_priv->stolen_base >> PAGE_SHIFT;
@@ -509,26 +496,15 @@ int psb_gtt_init(struct drm_device *dev, int resume)
}
/*
- * Init rest of gtt managed by IMG.
- */
- pfn_base = page_to_pfn(dev_priv->scratch_page);
- pte = psb_gtt_mask_pte(pfn_base, 0);
- for (; i < tt_pages / 2 - 1; ++i)
- iowrite32(pte, dev_priv->gtt_map + i);
-
- /*
- * Init rest of gtt managed by TTM.
+ * Init rest of GTT to the scratch page to avoid accidents or scribbles
*/
pfn_base = page_to_pfn(dev_priv->scratch_page);
pte = psb_gtt_mask_pte(pfn_base, 0);
- PSB_DEBUG_INIT("Initializing the rest of a total "
- "of %d gtt pages.\n", pg->gatt_pages);
+ for (; i < gtt_pages; ++i)
+ iowrite32(pte, dev_priv->gtt_map + i);
- for (; i < pg->gatt_pages - tt_pages / 2; ++i)
- iowrite32(pte, ttm_gtt_map + i);
(void) ioread32(dev_priv->gtt_map + i - 1);
-
return 0;
out_err:
From: Alan Cox <[email protected]>
Lose all the PSB debug gunge. We can replace it with dev_dbg() like normal
drivers if and when we need debug on stuff.
Signed-off-by: Alan Cox <[email protected]>
---
drivers/staging/gma500/mrst_crtc.c | 23 ++----
drivers/staging/gma500/mrst_lvds.c | 12 +--
drivers/staging/gma500/psb_bl.c | 8 --
drivers/staging/gma500/psb_drv.c | 33 +++------
drivers/staging/gma500/psb_drv.h | 96 +++-----------------------
drivers/staging/gma500/psb_fb.c | 34 +--------
drivers/staging/gma500/psb_gem.c | 6 +-
drivers/staging/gma500/psb_gtt.c | 6 +-
drivers/staging/gma500/psb_intel_bios.c | 17 +----
drivers/staging/gma500/psb_intel_display.c | 99 +++------------------------
drivers/staging/gma500/psb_intel_lvds.c | 53 ++------------
drivers/staging/gma500/psb_intel_opregion.c | 7 --
drivers/staging/gma500/psb_intel_sdvo.c | 34 ++++-----
drivers/staging/gma500/psb_irq.c | 33 ++-------
14 files changed, 87 insertions(+), 374 deletions(-)
diff --git a/drivers/staging/gma500/mrst_crtc.c b/drivers/staging/gma500/mrst_crtc.c
index fd97c80..fb9f2a2 100644
--- a/drivers/staging/gma500/mrst_crtc.c
+++ b/drivers/staging/gma500/mrst_crtc.c
@@ -103,7 +103,7 @@ static const struct mrst_limit_t *mrst_limit(struct drm_crtc *crtc)
}
} else {
limit = NULL;
- PSB_DEBUG_ENTRY("mrst_limit Wrong display type.\n");
+ dev_err(dev->dev, "mrst_limit Wrong display type.\n");
}
return limit;
@@ -117,7 +117,7 @@ static void mrst_clock(int refclk, struct mrst_clock_t *clock)
void mrstPrintPll(char *prefix, struct mrst_clock_t *clock)
{
- PSB_DEBUG_ENTRY("%s: dotclock = %d, m = %d, p1 = %d.\n",
+ pr_debug("%s: dotclock = %d, m = %d, p1 = %d.\n",
prefix, clock->dot, clock->m, clock->p1);
}
@@ -149,8 +149,7 @@ mrstFindBestPLL(struct drm_crtc *crtc, int target, int refclk,
}
}
}
- DRM_DEBUG("mrstFindBestPLL err = %d.\n", err);
-
+ dev_dbg(crtc->dev->dev, "mrstFindBestPLL err = %d.\n", err);
return err != target;
}
@@ -172,8 +171,6 @@ static void mrst_crtc_dpms(struct drm_crtc *crtc, int mode)
u32 temp;
bool enabled;
- PSB_DEBUG_ENTRY("mode = %d, pipe = %d\n", mode, pipe);
-
if (!gma_power_begin(dev, true))
return;
@@ -320,8 +317,6 @@ static int mrst_crtc_mode_set(struct drm_crtc *crtc,
uint64_t scalingType = DRM_MODE_SCALE_FULLSCREEN;
struct drm_encoder *encoder;
- PSB_DEBUG_ENTRY("pipe = 0x%x\n", pipe);
-
if (!gma_power_begin(dev, true))
return 0;
@@ -446,10 +441,9 @@ static int mrst_crtc_mode_set(struct drm_crtc *crtc,
ok = mrstFindBestPLL(crtc, adjusted_mode->clock, refclk, &clock);
if (!ok) {
- PSB_DEBUG_ENTRY(
- "mrstFindBestPLL fail in mrst_crtc_mode_set.\n");
+ dev_dbg(dev->dev, "mrstFindBestPLL fail in mrst_crtc_mode_set.\n");
} else {
- PSB_DEBUG_ENTRY("mrst_crtc_mode_set pixel clock = %d,"
+ dev_dbg(dev->dev, "mrst_crtc_mode_set pixel clock = %d,"
"m = %x, p1 = %x.\n", clock.dot, clock.m,
clock.p1);
}
@@ -540,11 +534,9 @@ int mrst_pipe_set_base(struct drm_crtc *crtc,
u32 dspcntr;
int ret = 0;
- PSB_DEBUG_ENTRY("\n");
-
/* no fb bound */
if (!crtc->fb) {
- DRM_DEBUG("No FB bound\n");
+ dev_dbg(dev->dev, "No FB bound\n");
return 0;
}
@@ -574,13 +566,12 @@ int mrst_pipe_set_base(struct drm_crtc *crtc,
dspcntr |= DISPPLANE_32BPP_NO_ALPHA;
break;
default:
- DRM_ERROR("Unknown color depth\n");
+ dev_err(dev->dev, "Unknown color depth\n");
ret = -EINVAL;
goto pipe_set_base_exit;
}
REG_WRITE(dspcntr_reg, dspcntr);
- DRM_DEBUG("Writing base %08lX %08lX %d %d\n", start, offset, x, y);
if (0 /* FIXMEAC - check what PSB needs */) {
REG_WRITE(dspbase, offset);
REG_READ(dspbase);
diff --git a/drivers/staging/gma500/mrst_lvds.c b/drivers/staging/gma500/mrst_lvds.c
index 22ea00e..aac80cc 100644
--- a/drivers/staging/gma500/mrst_lvds.c
+++ b/drivers/staging/gma500/mrst_lvds.c
@@ -47,7 +47,6 @@ static void mrst_lvds_set_power(struct drm_device *dev,
{
u32 pp_status;
struct drm_psb_private *dev_priv = dev->dev_private;
- PSB_DEBUG_ENTRY("\n");
if (!gma_power_begin(dev, true))
return;
@@ -77,8 +76,6 @@ static void mrst_lvds_dpms(struct drm_encoder *encoder, int mode)
struct drm_device *dev = encoder->dev;
struct psb_intel_output *output = enc_to_psb_intel_output(encoder);
- PSB_DEBUG_ENTRY("\n");
-
if (mode == DRM_MODE_DPMS_ON)
mrst_lvds_set_power(dev, output, true);
else
@@ -97,8 +94,6 @@ static void mrst_lvds_mode_set(struct drm_encoder *encoder,
u32 lvds_port;
uint64_t v = DRM_MODE_SCALE_FULLSCREEN;
- PSB_DEBUG_ENTRY("\n");
-
if (!gma_power_begin(dev, true))
return;
@@ -252,8 +247,6 @@ void mrst_lvds_init(struct drm_device *dev,
struct i2c_adapter *i2c_adap;
struct drm_display_mode *scan; /* *modes, *bios_mode; */
- PSB_DEBUG_ENTRY("\n");
-
psb_intel_output = kzalloc(sizeof(struct psb_intel_output), GFP_KERNEL);
if (!psb_intel_output)
return;
@@ -348,8 +341,7 @@ void mrst_lvds_init(struct drm_device *dev,
/* If we still don't have a mode after all that, give up. */
if (!mode_dev->panel_fixed_mode) {
- DRM_DEBUG
- ("Found no modes on the lvds, ignoring the LVDS\n");
+ dev_err(dev->dev, "Found no modes on the lvds, ignoring the LVDS\n");
goto failed_find;
}
@@ -358,7 +350,7 @@ out:
return;
failed_find:
- DRM_DEBUG("No LVDS modes found, disabling.\n");
+ dev_dbg(dev->dev, "No LVDS modes found, disabling.\n");
if (psb_intel_output->ddc_bus)
psb_intel_i2c_destroy(psb_intel_output->ddc_bus);
diff --git a/drivers/staging/gma500/psb_bl.c b/drivers/staging/gma500/psb_bl.c
index 2f9674d..4a00047 100644
--- a/drivers/staging/gma500/psb_bl.c
+++ b/drivers/staging/gma500/psb_bl.c
@@ -56,8 +56,6 @@ int psb_set_brightness(struct backlight_device *bd)
struct drm_device *dev = bl_get_data(psb_backlight_device);
int level = bd->props.brightness;
- DRM_DEBUG_DRIVER("backlight level set to %d\n", level);
-
/* Percentage 1-100% being valid */
if (level < 1)
level = 1;
@@ -75,8 +73,6 @@ int mrst_set_brightness(struct backlight_device *bd)
u32 blc_pwm_ctl;
u32 max_pwm_blc;
- DRM_DEBUG_DRIVER("backlight level set to %d\n", level);
-
/* Percentage 1-100% being valid */
if (level < 1)
level = 1;
@@ -111,8 +107,6 @@ int mrst_set_brightness(struct backlight_device *bd)
int psb_get_brightness(struct backlight_device *bd)
{
- DRM_DEBUG_DRIVER("brightness = 0x%x\n", psb_brightness);
-
/* return locally cached var instead of HW read (due to DPST etc.) */
/* FIXME: ideally return actual value in case firmware fiddled with
it */
@@ -144,7 +138,7 @@ static int device_backlight_init(struct drm_device *dev)
} else {
/* get bl_max_freq and pol from dev_priv*/
if (!dev_priv->lvds_bl) {
- DRM_ERROR("Has no valid LVDS backlight info\n");
+ dev_err(dev->dev, "Has no valid LVDS backlight info\n");
return 1;
}
bl_max_freq = dev_priv->lvds_bl->freq;
diff --git a/drivers/staging/gma500/psb_drv.c b/drivers/staging/gma500/psb_drv.c
index ab1da30..6ea06dd 100644
--- a/drivers/staging/gma500/psb_drv.c
+++ b/drivers/staging/gma500/psb_drv.c
@@ -35,17 +35,14 @@
#include <linux/pm_runtime.h>
#include <acpi/video.h>
-int drm_psb_debug;
static int drm_psb_trap_pagefaults;
int drm_psb_no_fb;
static int psb_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
-MODULE_PARM_DESC(debug, "Enable debug output");
MODULE_PARM_DESC(no_fb, "Disable FBdev");
MODULE_PARM_DESC(trap_pagefaults, "Error and reset on MMU pagefaults");
-module_param_named(debug, drm_psb_debug, int, 0600);
module_param_named(no_fb, drm_psb_no_fb, int, 0600);
module_param_named(trap_pagefaults, drm_psb_trap_pagefaults, int, 0600);
@@ -215,7 +212,8 @@ void mrst_get_fuse_settings(struct drm_device *dev)
dev_priv->core_freq = 166;
break;
default:
- DRM_ERROR("Invalid SKU values, SKU value = 0x%08x\n", fuse_value_tmp);
+ dev_warn(dev->dev, "Invalid SKU values, SKU value = 0x%08x\n",
+ fuse_value_tmp);
dev_priv->core_freq = 0;
}
DRM_INFO("LNC core clk is %dMHz.\n", dev_priv->core_freq);
@@ -231,7 +229,8 @@ void mid_get_pci_revID (struct drm_psb_private *dev_priv)
pci_read_config_dword(pci_gfx_root, 0x08, &platform_rev_id);
dev_priv->platform_rev_id = (uint8_t) platform_rev_id;
pci_dev_put(pci_gfx_root);
- PSB_DEBUG_ENTRY("platform_rev_id is %x\n", dev_priv->platform_rev_id);
+ dev_info(dev_priv->dev->dev, "platform_rev_id is %x\n",
+ dev_priv->platform_rev_id);
}
void mrst_get_vbt_data(struct drm_psb_private *dev_priv)
@@ -413,7 +412,7 @@ static int psb_do_init(struct drm_device *dev)
int ret = -ENOMEM;
if (pg->mmu_gatt_start & 0x0FFFFFFF) {
- DRM_ERROR("Gatt must be 256M aligned. This is a bug.\n");
+ dev_err(dev->dev, "Gatt must be 256M aligned. This is a bug.\n");
ret = -EINVAL;
goto out_err;
}
@@ -447,9 +446,6 @@ static int psb_do_init(struct drm_device *dev)
spin_lock_init(&dev_priv->irqmask_lock);
- /* FIXME: can we kill ta_mem_size ? */
- dev_priv->sizes.ta_mem_size = 0;
-
PSB_WSGX32(0x00000000, PSB_CR_BIF_BANK0);
PSB_WSGX32(0x00000000, PSB_CR_BIF_BANK1);
PSB_RSGX32(PSB_CR_BIF_BANK1);
@@ -553,7 +549,6 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)
dev->dev_private = (void *) dev_priv;
dev_priv->chipset = chipset;
- PSB_DEBUG_INIT("Mapping MMIO\n");
resource_start = pci_resource_start(dev->pdev, PSB_MMIO_RESOURCE);
dev_priv->vdc_reg =
@@ -679,7 +674,6 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)
pm_runtime_set_active(&dev->pdev->dev);
#endif
/*Intel drm driver load is done, continue doing pvr load*/
- DRM_DEBUG("Pvr driver load\n");
return 0;
out_err:
psb_driver_unload(dev);
@@ -721,7 +715,7 @@ static int psb_dc_state_ioctl(struct drm_device *dev, void * data,
obj = drm_mode_object_find(dev, obj_id,
DRM_MODE_OBJECT_CRTC);
if (!obj) {
- DRM_DEBUG("Invalid CRTC object.\n");
+ dev_dbg(dev->dev, "Invalid CRTC object.\n");
return -EINVAL;
}
@@ -741,7 +735,7 @@ static int psb_dc_state_ioctl(struct drm_device *dev, void * data,
obj = drm_mode_object_find(dev, obj_id,
DRM_MODE_OBJECT_CONNECTOR);
if (!obj) {
- DRM_DEBUG("Invalid connector id.\n");
+ dev_dbg(dev->dev, "Invalid connector id.\n");
return -EINVAL;
}
@@ -753,8 +747,6 @@ static int psb_dc_state_ioctl(struct drm_device *dev, void * data,
return 0;
}
-
- DRM_DEBUG("Bad flags 0x%x\n", flags);
return -EINVAL;
}
@@ -832,7 +824,7 @@ static int psb_gamma_ioctl(struct drm_device *dev, void *data,
obj_id = lut_arg->output_id;
obj = drm_mode_object_find(dev, obj_id, DRM_MODE_OBJECT_CONNECTOR);
if (!obj) {
- DRM_DEBUG("Invalid Connector object.\n");
+ dev_dbg(dev->dev, "Invalid Connector object.\n");
return -EINVAL;
}
@@ -873,7 +865,7 @@ static int psb_mode_operation_ioctl(struct drm_device *dev, void *data,
case PSB_MODE_OPERATION_SET_DC_BASE:
obj = drm_mode_object_find(dev, obj_id, DRM_MODE_OBJECT_FB);
if (!obj) {
- DRM_ERROR("Invalid FB id %d\n", obj_id);
+ dev_dbg(dev->dev, "Invalid FB id %d\n", obj_id);
return -EINVAL;
}
@@ -945,7 +937,7 @@ mode_op_out:
return ret;
default:
- DRM_DEBUG("Unsupported psb mode operation");
+ dev_dbg(dev->dev, "Unsupported psb mode operation\n");
return -EOPNOTSUPP;
}
@@ -1336,9 +1328,6 @@ static long psb_unlocked_ioctl(struct file *filp, unsigned int cmd,
struct drm_device *dev = file_priv->minor->dev;
struct drm_psb_private *dev_priv = dev->dev_private;
static unsigned int runtime_allowed;
- unsigned int nr = DRM_IOCTL_NR(cmd);
-
- DRM_DEBUG("cmd = %x, nr = %x\n", cmd, nr);
if (runtime_allowed == 1 && dev_priv->is_lvds_on) {
runtime_allowed++;
@@ -1439,7 +1428,7 @@ static int psb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
/* MLD Added this from Inaky's patch */
if (pci_enable_msi(pdev))
- DRM_ERROR("Enable MSI failed!\n");
+ dev_warn(&pdev->dev, "Enable MSI failed!\n");
return drm_get_pci_dev(pdev, ent, &driver);
}
diff --git a/drivers/staging/gma500/psb_drv.h b/drivers/staging/gma500/psb_drv.h
index c0468ee..45752aa 100644
--- a/drivers/staging/gma500/psb_drv.h
+++ b/drivers/staging/gma500/psb_drv.h
@@ -659,54 +659,12 @@ extern int psb_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
#define PSB_D_MSVDX (1 << 9)
#define PSB_D_TOPAZ (1 << 10)
-#ifndef DRM_DEBUG_CODE
-/* To enable debug printout, set drm_psb_debug in psb_drv.c
- * to any combination of above print flags.
- */
-/* #define DRM_DEBUG_CODE 2 */
-#endif
-
-extern int drm_psb_debug;
extern int drm_psb_no_fb;
extern int drm_idle_check_interval;
-#define PSB_DEBUG_GENERAL(_fmt, _arg...) \
- PSB_DEBUG(PSB_D_GENERAL, _fmt, ##_arg)
-#define PSB_DEBUG_INIT(_fmt, _arg...) \
- PSB_DEBUG(PSB_D_INIT, _fmt, ##_arg)
-#define PSB_DEBUG_IRQ(_fmt, _arg...) \
- PSB_DEBUG(PSB_D_IRQ, _fmt, ##_arg)
-#define PSB_DEBUG_ENTRY(_fmt, _arg...) \
- PSB_DEBUG(PSB_D_ENTRY, _fmt, ##_arg)
-#define PSB_DEBUG_HV(_fmt, _arg...) \
- PSB_DEBUG(PSB_D_HV, _fmt, ##_arg)
-#define PSB_DEBUG_DBI_BF(_fmt, _arg...) \
- PSB_DEBUG(PSB_D_DBI_BF, _fmt, ##_arg)
-#define PSB_DEBUG_PM(_fmt, _arg...) \
- PSB_DEBUG(PSB_D_PM, _fmt, ##_arg)
-#define PSB_DEBUG_RENDER(_fmt, _arg...) \
- PSB_DEBUG(PSB_D_RENDER, _fmt, ##_arg)
-#define PSB_DEBUG_REG(_fmt, _arg...) \
- PSB_DEBUG(PSB_D_REG, _fmt, ##_arg)
-#define PSB_DEBUG_MSVDX(_fmt, _arg...) \
- PSB_DEBUG(PSB_D_MSVDX, _fmt, ##_arg)
-#define PSB_DEBUG_TOPAZ(_fmt, _arg...) \
- PSB_DEBUG(PSB_D_TOPAZ, _fmt, ##_arg)
-
-#if DRM_DEBUG_CODE
-#define PSB_DEBUG(_flag, _fmt, _arg...) \
- do { \
- if (unlikely((_flag) & drm_psb_debug)) \
- printk(KERN_DEBUG \
- "[psb:0x%02x:%s] " _fmt , _flag, \
- __func__ , ##_arg); \
- } while (0)
-#else
-#define PSB_DEBUG(_fmt, _arg...) do { } while (0)
-#endif
/*
- *Utilities
+ * Utilities
*/
static inline u32 MRST_MSG_READ32(uint port, uint offset)
@@ -749,19 +707,15 @@ static inline void MDFLD_MSG_WRITE32(uint port, uint offset, u32 value)
static inline uint32_t REGISTER_READ(struct drm_device *dev, uint32_t reg)
{
struct drm_psb_private *dev_priv = dev->dev_private;
- int reg_val = ioread32(dev_priv->vdc_reg + (reg));
- PSB_DEBUG_REG("reg = 0x%x. reg_val = 0x%x. \n", reg, reg_val);
- return reg_val;
+ return ioread32(dev_priv->vdc_reg + reg);
}
#define REG_READ(reg) REGISTER_READ(dev, (reg))
+
static inline void REGISTER_WRITE(struct drm_device *dev, uint32_t reg,
uint32_t val)
{
struct drm_psb_private *dev_priv = dev->dev_private;
- if ((reg < 0x70084 || reg >0x70088) && (reg < 0xa000 || reg >0xa3ff))
- PSB_DEBUG_REG("reg = 0x%x, val = 0x%x. \n", reg, val);
-
iowrite32((val), dev_priv->vdc_reg + (reg));
}
@@ -771,9 +725,6 @@ static inline void REGISTER_WRITE16(struct drm_device *dev,
uint32_t reg, uint32_t val)
{
struct drm_psb_private *dev_priv = dev->dev_private;
-
- PSB_DEBUG_REG("reg = 0x%x, val = 0x%x. \n", reg, val);
-
iowrite16((val), dev_priv->vdc_reg + (reg));
}
@@ -783,20 +734,13 @@ static inline void REGISTER_WRITE8(struct drm_device *dev,
uint32_t reg, uint32_t val)
{
struct drm_psb_private *dev_priv = dev->dev_private;
-
- PSB_DEBUG_REG("reg = 0x%x, val = 0x%x. \n", reg, val);
-
iowrite8((val), dev_priv->vdc_reg + (reg));
}
-#define REG_WRITE8(reg, val) REGISTER_WRITE8(dev, (reg), (val))
+#define REG_WRITE8(reg, val) REGISTER_WRITE8(dev, (reg), (val))
-#define PSB_ALIGN_TO(_val, _align) \
- (((_val) + ((_align) - 1)) & ~((_align) - 1))
-#define PSB_WVDC32(_val, _offs) \
- iowrite32(_val, dev_priv->vdc_reg + (_offs))
-#define PSB_RVDC32(_offs) \
- ioread32(dev_priv->vdc_reg + (_offs))
+#define PSB_WVDC32(_val, _offs) iowrite32(_val, dev_priv->vdc_reg + (_offs))
+#define PSB_RVDC32(_offs) ioread32(dev_priv->vdc_reg + (_offs))
/* #define TRAP_SGX_PM_FAULT 1 */
#ifdef TRAP_SGX_PM_FAULT
@@ -810,33 +754,13 @@ static inline void REGISTER_WRITE8(struct drm_device *dev,
ioread32(dev_priv->sgx_reg + (_offs)); \
})
#else
-#define PSB_RSGX32(_offs) \
- ioread32(dev_priv->sgx_reg + (_offs))
+#define PSB_RSGX32(_offs) ioread32(dev_priv->sgx_reg + (_offs))
#endif
-#define PSB_WSGX32(_val, _offs) \
- iowrite32(_val, dev_priv->sgx_reg + (_offs))
+#define PSB_WSGX32(_val, _offs) iowrite32(_val, dev_priv->sgx_reg + (_offs))
#define MSVDX_REG_DUMP 0
-#if MSVDX_REG_DUMP
-
-#define PSB_WMSVDX32(_val, _offs) \
- printk("MSVDX: write %08x to reg 0x%08x\n", (unsigned int)(_val), (unsigned int)(_offs));\
- iowrite32(_val, dev_priv->msvdx_reg + (_offs))
-#define PSB_RMSVDX32(_offs) \
- ioread32(dev_priv->msvdx_reg + (_offs))
-
-#else
-
-#define PSB_WMSVDX32(_val, _offs) \
- iowrite32(_val, dev_priv->msvdx_reg + (_offs))
-#define PSB_RMSVDX32(_offs) \
- ioread32(dev_priv->msvdx_reg + (_offs))
-
-#endif
-#define PSB_ALPL(_val, _base) \
- (((_val) >> (_base ## _ALIGNSHIFT)) << (_base ## _SHIFT))
-#define PSB_ALPLM(_val, _base) \
- ((((_val) >> (_base ## _ALIGNSHIFT)) << (_base ## _SHIFT)) & (_base ## _MASK))
+#define PSB_WMSVDX32(_val, _offs) iowrite32(_val, dev_priv->msvdx_reg + (_offs))
+#define PSB_RMSVDX32(_offs) ioread32(dev_priv->msvdx_reg + (_offs))
#endif
diff --git a/drivers/staging/gma500/psb_fb.c b/drivers/staging/gma500/psb_fb.c
index 0a77abf..988f4db 100644
--- a/drivers/staging/gma500/psb_fb.c
+++ b/drivers/staging/gma500/psb_fb.c
@@ -100,7 +100,6 @@ static int psbfb_kms_off(struct drm_device *dev, int suspend)
{
struct drm_framebuffer *fb = 0;
struct psb_framebuffer *psbfb = to_psb_fb(fb);
- DRM_DEBUG("psbfb_kms_off_ioctl\n");
mutex_lock(&dev->mode_config.mutex);
list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
@@ -134,8 +133,6 @@ static int psbfb_kms_on(struct drm_device *dev, int resume)
struct drm_framebuffer *fb = 0;
struct psb_framebuffer *psbfb = to_psb_fb(fb);
- DRM_DEBUG("psbfb_kms_on_ioctl\n");
-
mutex_lock(&dev->mode_config.mutex);
list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
struct fb_info *info = psbfb->fbdev;
@@ -217,12 +214,10 @@ static int psbfb_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
static void psbfb_vm_open(struct vm_area_struct *vma)
{
- DRM_DEBUG("vm_open\n");
}
static void psbfb_vm_close(struct vm_area_struct *vma)
{
- DRM_DEBUG("vm_close\n");
}
static struct vm_operations_struct psbfb_vm_ops = {
@@ -237,7 +232,6 @@ static int psbfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
struct psb_framebuffer *psbfb = &fbdev->pfb;
char *fb_screen_base = NULL;
struct drm_device *dev = psbfb->base.dev;
- struct drm_psb_private *dev_priv = dev->dev_private;
if (vma->vm_pgoff != 0)
return -EINVAL;
@@ -249,10 +243,6 @@ static int psbfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
fb_screen_base = (char *)info->screen_base;
- DRM_DEBUG("vm_pgoff 0x%lx, screen base %p vram_addr %p\n",
- vma->vm_pgoff, fb_screen_base,
- dev_priv->vram_addr);
-
/* If this is a GEM object then info->screen_base is the virtual
kernel remapping of the object. FIXME: Review if this is
suitable for our mmap work */
@@ -523,14 +513,10 @@ static int psbfb_create(struct psb_fbdev *fbdev,
info->pixmap.flags = FB_PIXMAP_SYSTEM;
info->pixmap.scan_align = 1;
- DRM_DEBUG("fb depth is %d\n", fb->depth);
- DRM_DEBUG(" pitch is %d\n", fb->pitch);
-
- printk(KERN_INFO"allocated %dx%d fb\n",
- psbfb->base.width, psbfb->base.height);
+ dev_info(dev->dev, "allocated %dx%d fb\n",
+ psbfb->base.width, psbfb->base.height);
mutex_unlock(&dev->struct_mutex);
-
return 0;
out_unref:
if (backing->stolen)
@@ -575,13 +561,11 @@ static struct drm_framebuffer *psb_user_framebuffer_create
static void psbfb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
u16 blue, int regno)
{
- DRM_DEBUG("%s\n", __func__);
}
static void psbfb_gamma_get(struct drm_crtc *crtc, u16 *red,
u16 *green, u16 *blue, int regno)
{
- DRM_DEBUG("%s\n", __func__);
}
static int psbfb_probe(struct drm_fb_helper *helper,
@@ -591,8 +575,6 @@ static int psbfb_probe(struct drm_fb_helper *helper,
int new_fb = 0;
int ret;
- DRM_DEBUG("%s\n", __func__);
-
if (!helper->fb) {
ret = psbfb_create(psb_fbdev, sizes);
if (ret)
@@ -650,7 +632,7 @@ int psb_fbdev_init(struct drm_device *dev)
fbdev = kzalloc(sizeof(struct psb_fbdev), GFP_KERNEL);
if (!fbdev) {
- DRM_ERROR("no memory\n");
+ dev_err(dev->dev, "no memory\n");
return -ENOMEM;
}
@@ -781,8 +763,6 @@ static void psb_setup_outputs(struct drm_device *dev)
(struct drm_psb_private *) dev->dev_private;
struct drm_connector *connector;
- PSB_DEBUG_ENTRY("\n");
-
drm_mode_create_scaling_mode_property(dev);
psb_create_backlight_property(dev);
@@ -791,7 +771,7 @@ static void psb_setup_outputs(struct drm_device *dev)
if (dev_priv->iLVDS_enable)
mrst_lvds_init(dev, &dev_priv->mode_dev);
else
- DRM_ERROR("DSI is not supported\n");
+ dev_err(dev->dev, "DSI is not supported\n");
} else {
psb_intel_lvds_init(dev, &dev_priv->mode_dev);
psb_intel_sdvo_init(dev, SDVOB);
@@ -811,7 +791,6 @@ static void psb_setup_outputs(struct drm_device *dev)
clone_mask = (1 << INTEL_OUTPUT_SDVO);
break;
case INTEL_OUTPUT_LVDS:
- PSB_DEBUG_ENTRY("LVDS.\n");
if (IS_MRST(dev))
crtc_mask = (1 << 0);
else
@@ -819,17 +798,14 @@ static void psb_setup_outputs(struct drm_device *dev)
clone_mask = (1 << INTEL_OUTPUT_LVDS);
break;
case INTEL_OUTPUT_MIPI:
- PSB_DEBUG_ENTRY("MIPI.\n");
crtc_mask = (1 << 0);
clone_mask = (1 << INTEL_OUTPUT_MIPI);
break;
case INTEL_OUTPUT_MIPI2:
- PSB_DEBUG_ENTRY("MIPI2.\n");
crtc_mask = (1 << 2);
clone_mask = (1 << INTEL_OUTPUT_MIPI2);
break;
case INTEL_OUTPUT_HDMI:
- PSB_DEBUG_ENTRY("HDMI.\n");
crtc_mask = (1 << 1);
clone_mask = (1 << INTEL_OUTPUT_HDMI);
break;
@@ -849,8 +825,6 @@ void psb_modeset_init(struct drm_device *dev)
struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
int i;
- PSB_DEBUG_ENTRY("\n");
-
drm_mode_config_init(dev);
dev->mode_config.min_width = 0;
diff --git a/drivers/staging/gma500/psb_gem.c b/drivers/staging/gma500/psb_gem.c
index 125ea6b..7f6f479 100644
--- a/drivers/staging/gma500/psb_gem.c
+++ b/drivers/staging/gma500/psb_gem.c
@@ -87,7 +87,7 @@ static int psb_gem_create_mmap_offset(struct drm_gem_object *obj)
list->file_offset_node = drm_mm_search_free(&mm->offset_manager,
obj->size / PAGE_SIZE, 0, 0);
if (!list->file_offset_node) {
- DRM_ERROR("failed to allocate offset for bo %d\n", obj->name);
+ dev_err(dev->dev, "failed to allocate offset for bo %d\n", obj->name);
ret = -ENOSPC;
goto free_it;
}
@@ -100,7 +100,7 @@ static int psb_gem_create_mmap_offset(struct drm_gem_object *obj)
list->hash.key = list->file_offset_node->start;
ret = drm_ht_insert_item(&mm->offset_hash, &list->hash);
if (ret) {
- DRM_ERROR("failed to add to map hash\n");
+ dev_err(dev->dev, "failed to add to map hash\n");
goto free_mm;
}
return 0;
@@ -283,7 +283,7 @@ int psb_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
if (r->mmapping == 0) {
ret = psb_gtt_pin(r);
if (ret < 0) {
- DRM_ERROR("gma500: pin failed: %d\n", ret);
+ dev_err(dev->dev, "gma500: pin failed: %d\n", ret);
goto fail;
}
r->mmapping = 1;
diff --git a/drivers/staging/gma500/psb_gtt.c b/drivers/staging/gma500/psb_gtt.c
index 8fcb833..54a9308 100644
--- a/drivers/staging/gma500/psb_gtt.c
+++ b/drivers/staging/gma500/psb_gtt.c
@@ -456,7 +456,7 @@ int psb_gtt_init(struct drm_device *dev, int resume)
if (resume && (gtt_pages != pg->gtt_pages) &&
(stolen_size != pg->stolen_size)) {
- DRM_ERROR("GTT resume error.\n");
+ dev_err(dev->dev, "GTT resume error.\n");
ret = -EINVAL;
goto out_err;
}
@@ -470,14 +470,14 @@ int psb_gtt_init(struct drm_device *dev, int resume)
*/
dev_priv->gtt_map = ioremap_nocache(pg->gtt_phys_start, gtt_pages << PAGE_SHIFT);
if (!dev_priv->gtt_map) {
- DRM_ERROR("Failure to map gtt.\n");
+ dev_err(dev->dev, "Failure to map gtt.\n");
ret = -ENOMEM;
goto out_err;
}
dev_priv->vram_addr = ioremap_wc(dev_priv->stolen_base, stolen_size);
if (!dev_priv->vram_addr) {
- DRM_ERROR("Failure to map stolen base.\n");
+ dev_err(dev->dev, "Failure to map stolen base.\n");
ret = -ENOMEM;
goto out_err;
}
diff --git a/drivers/staging/gma500/psb_intel_bios.c b/drivers/staging/gma500/psb_intel_bios.c
index 417965d..5b3e88c 100644
--- a/drivers/staging/gma500/psb_intel_bios.c
+++ b/drivers/staging/gma500/psb_intel_bios.c
@@ -96,25 +96,20 @@ static void parse_backlight_data(struct drm_psb_private *dev_priv,
dev_priv->lvds_bl = NULL;
- if (lvds_opts) {
- DRM_DEBUG("lvds_options found at %p\n", lvds_opts);
+ if (lvds_opts)
p_type = lvds_opts->panel_type;
- } else {
- DRM_DEBUG("no lvds_options\n");
+ else
return;
- }
bl_start = find_section(bdb, BDB_LVDS_BACKLIGHT);
vbt_lvds_bl = (struct bdb_lvds_backlight *)(bl_start + 1) + p_type;
lvds_bl = kzalloc(sizeof(*vbt_lvds_bl), GFP_KERNEL);
if (!lvds_bl) {
- DRM_DEBUG("No memory\n");
+ dev_err(dev_priv->dev->dev, "out of memory for backlight data\n");
return;
}
-
memcpy(lvds_bl, vbt_lvds_bl, sizeof(*vbt_lvds_bl));
-
dev_priv->lvds_bl = lvds_bl;
}
@@ -156,14 +151,12 @@ static void parse_lfp_panel_data(struct drm_psb_private *dev_priv,
if (panel_fixed_mode->htotal > 0 && panel_fixed_mode->vtotal > 0) {
dev_priv->lfp_lvds_vbt_mode = panel_fixed_mode;
- DRM_DEBUG("Found panel mode in BIOS VBT tables:\n");
drm_mode_debug_printmodeline(panel_fixed_mode);
} else {
- DRM_DEBUG("Ignoring bogus LVDS VBT mode.\n");
+ dev_dbg(dev_priv->dev->dev, "ignoring invalid LVDS VBT\n");
dev_priv->lvds_vbt = 0;
kfree(panel_fixed_mode);
}
-
return;
}
@@ -257,7 +250,7 @@ bool psb_intel_init_bios(struct drm_device *dev)
}
if (!vbt) {
- DRM_ERROR("VBT signature missing\n");
+ dev_err(dev->dev, "VBT signature missing\n");
pci_unmap_rom(pdev, bios);
return -1;
}
diff --git a/drivers/staging/gma500/psb_intel_display.c b/drivers/staging/gma500/psb_intel_display.c
index c7c55b1..be7e1f9 100644
--- a/drivers/staging/gma500/psb_intel_display.c
+++ b/drivers/staging/gma500/psb_intel_display.c
@@ -350,14 +350,12 @@ int psb_intel_pipe_set_base(struct drm_crtc *crtc,
u32 dspcntr;
int ret = 0;
- PSB_DEBUG_ENTRY("\n");
-
if (!gma_power_begin(dev, true))
return 0;
/* no fb bound */
if (!crtc->fb) {
- DRM_DEBUG("No FB bound\n");
+ dev_dbg(dev->dev, "No FB bound\n");
goto psb_intel_pipe_cleaner;
}
@@ -390,7 +388,7 @@ int psb_intel_pipe_set_base(struct drm_crtc *crtc,
dspcntr |= DISPPLANE_32BPP_NO_ALPHA;
break;
default:
- DRM_ERROR("Unknown color depth\n");
+ dev_err(dev->dev, "Unknown color depth\n");
ret = -EINVAL;
psb_gtt_unpin(psbfb->gtt);
goto psb_intel_pipe_set_base_exit;
@@ -398,7 +396,6 @@ int psb_intel_pipe_set_base(struct drm_crtc *crtc,
REG_WRITE(dspcntr_reg, dspcntr);
- DRM_DEBUG("Writing base %08lX %08lX %d %d\n", start, offset, x, y);
if (0 /* FIXMEAC - check what PSB needs */) {
REG_WRITE(dspbase, offset);
REG_READ(dspbase);
@@ -650,7 +647,7 @@ static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,
ok = psb_intel_find_best_PLL(crtc, adjusted_mode->clock, refclk,
&clock);
if (!ok) {
- DRM_ERROR("Couldn't find PLL settings for mode!\n");
+ dev_err(dev->dev, "Couldn't find PLL settings for mode!\n");
return 0;
}
@@ -714,7 +711,6 @@ static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,
if (psb_intel_panel_fitter_pipe(dev) == pipe)
REG_WRITE(PFIT_CONTROL, 0);
- DRM_DEBUG("Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B');
drm_mode_debug_printmodeline(mode);
if (dpll & DPLL_VCO_ENABLE) {
@@ -825,7 +821,7 @@ void psb_intel_crtc_load_lut(struct drm_crtc *crtc)
palreg = PALETTE_C;
break;
default:
- DRM_ERROR("Illegal Pipe Number.\n");
+ dev_err(dev->dev, "Illegal Pipe Number.\n");
return;
}
@@ -868,10 +864,8 @@ static void psb_intel_crtc_save(struct drm_crtc *crtc)
uint32_t paletteReg;
int i;
- DRM_DEBUG("\n");
-
if (!crtc_state) {
- DRM_DEBUG("No CRTC state found\n");
+ dev_err(dev->dev, "No CRTC state found\n");
return;
}
@@ -895,25 +889,6 @@ static void psb_intel_crtc_save(struct drm_crtc *crtc)
crtc_state->saveDSPBASE = REG_READ(pipeA ? DSPABASE : DSPBBASE);
- DRM_DEBUG("(%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x)\n",
- crtc_state->saveDSPCNTR,
- crtc_state->savePIPECONF,
- crtc_state->savePIPESRC,
- crtc_state->saveFP0,
- crtc_state->saveFP1,
- crtc_state->saveDPLL,
- crtc_state->saveHTOTAL,
- crtc_state->saveHBLANK,
- crtc_state->saveHSYNC,
- crtc_state->saveVTOTAL,
- crtc_state->saveVBLANK,
- crtc_state->saveVSYNC,
- crtc_state->saveDSPSTRIDE,
- crtc_state->saveDSPSIZE,
- crtc_state->saveDSPPOS,
- crtc_state->saveDSPBASE
- );
-
paletteReg = pipeA ? PALETTE_A : PALETTE_B;
for (i = 0; i < 256; ++i)
crtc_state->savePalette[i] = REG_READ(paletteReg + (i << 2));
@@ -934,60 +909,15 @@ static void psb_intel_crtc_restore(struct drm_crtc *crtc)
uint32_t paletteReg;
int i;
- DRM_DEBUG("\n");
-
if (!crtc_state) {
- DRM_DEBUG("No crtc state\n");
+ dev_err(dev->dev, "No crtc state\n");
return;
}
- DRM_DEBUG(
- "current:(%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x)\n",
- REG_READ(pipeA ? DSPACNTR : DSPBCNTR),
- REG_READ(pipeA ? PIPEACONF : PIPEBCONF),
- REG_READ(pipeA ? PIPEASRC : PIPEBSRC),
- REG_READ(pipeA ? FPA0 : FPB0),
- REG_READ(pipeA ? FPA1 : FPB1),
- REG_READ(pipeA ? DPLL_A : DPLL_B),
- REG_READ(pipeA ? HTOTAL_A : HTOTAL_B),
- REG_READ(pipeA ? HBLANK_A : HBLANK_B),
- REG_READ(pipeA ? HSYNC_A : HSYNC_B),
- REG_READ(pipeA ? VTOTAL_A : VTOTAL_B),
- REG_READ(pipeA ? VBLANK_A : VBLANK_B),
- REG_READ(pipeA ? VSYNC_A : VSYNC_B),
- REG_READ(pipeA ? DSPASTRIDE : DSPBSTRIDE),
- REG_READ(pipeA ? DSPASIZE : DSPBSIZE),
- REG_READ(pipeA ? DSPAPOS : DSPBPOS),
- REG_READ(pipeA ? DSPABASE : DSPBBASE)
- );
-
- DRM_DEBUG(
- "saved: (%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x)\n",
- crtc_state->saveDSPCNTR,
- crtc_state->savePIPECONF,
- crtc_state->savePIPESRC,
- crtc_state->saveFP0,
- crtc_state->saveFP1,
- crtc_state->saveDPLL,
- crtc_state->saveHTOTAL,
- crtc_state->saveHBLANK,
- crtc_state->saveHSYNC,
- crtc_state->saveVTOTAL,
- crtc_state->saveVBLANK,
- crtc_state->saveVSYNC,
- crtc_state->saveDSPSTRIDE,
- crtc_state->saveDSPSIZE,
- crtc_state->saveDSPPOS,
- crtc_state->saveDSPBASE
- );
-
-
if (crtc_state->saveDPLL & DPLL_VCO_ENABLE) {
REG_WRITE(pipeA ? DPLL_A : DPLL_B,
crtc_state->saveDPLL & ~DPLL_VCO_ENABLE);
REG_READ(pipeA ? DPLL_A : DPLL_B);
- DRM_DEBUG("write dpll: %x\n",
- REG_READ(pipeA ? DPLL_A : DPLL_B));
udelay(150);
}
@@ -1044,11 +974,8 @@ static int psb_intel_crtc_cursor_set(struct drm_crtc *crtc,
struct drm_gem_object *obj;
int ret;
- DRM_DEBUG("\n");
-
/* if we want to turn of the cursor ignore width and height */
if (!handle) {
- DRM_DEBUG("cursor off\n");
/* turn off the cursor */
temp = CURSOR_MODE_DISABLE;
@@ -1072,7 +999,7 @@ static int psb_intel_crtc_cursor_set(struct drm_crtc *crtc,
/* Currently we only support 64x64 cursors */
if (width != 64 || height != 64) {
- DRM_ERROR("we currently only support 64x64 cursors\n");
+ dev_dbg(dev->dev, "we currently only support 64x64 cursors\n");
return -EINVAL;
}
@@ -1081,7 +1008,7 @@ static int psb_intel_crtc_cursor_set(struct drm_crtc *crtc,
return -ENOENT;
if (obj->size < width * height * 4) {
- DRM_ERROR("buffer is to small\n");
+ dev_dbg(dev->dev, "buffer is to small\n");
return -ENOMEM;
}
@@ -1090,7 +1017,7 @@ static int psb_intel_crtc_cursor_set(struct drm_crtc *crtc,
/* Pin the memory into the GTT */
ret = psb_gtt_pin(gt);
if (ret) {
- DRM_ERROR("Can not pin down handle 0x%x\n", handle);
+ dev_err(dev->dev, "Can not pin down handle 0x%x\n", handle);
return ret;
}
@@ -1359,8 +1286,6 @@ void psb_intel_crtc_init(struct drm_device *dev, int pipe,
int i;
uint16_t *r_base, *g_base, *b_base;
- PSB_DEBUG_ENTRY("\n");
-
/* We allocate a extra array of drm_connector pointers
* for fbdev after the crtc */
psb_intel_crtc =
@@ -1373,7 +1298,7 @@ void psb_intel_crtc_init(struct drm_device *dev, int pipe,
psb_intel_crtc->crtc_state =
kzalloc(sizeof(struct psb_intel_crtc_state), GFP_KERNEL);
if (!psb_intel_crtc->crtc_state) {
- DRM_INFO("Crtc state error: No memory\n");
+ dev_err(dev->dev, "Crtc state error: No memory\n");
kfree(psb_intel_crtc);
return;
}
@@ -1430,7 +1355,7 @@ int psb_intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
struct psb_intel_crtc *crtc;
if (!dev_priv) {
- DRM_ERROR("called with no initialization\n");
+ dev_err(dev->dev, "called with no initialization\n");
return -EINVAL;
}
@@ -1438,7 +1363,7 @@ int psb_intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
DRM_MODE_OBJECT_CRTC);
if (!drmmode_obj) {
- DRM_ERROR("no such CRTC id\n");
+ dev_err(dev->dev, "no such CRTC id\n");
return -EINVAL;
}
diff --git a/drivers/staging/gma500/psb_intel_lvds.c b/drivers/staging/gma500/psb_intel_lvds.c
index b0a225b..1cbc9bc 100644
--- a/drivers/staging/gma500/psb_intel_lvds.c
+++ b/drivers/staging/gma500/psb_intel_lvds.c
@@ -126,13 +126,13 @@ static int psb_lvds_i2c_set_brightness(struct drm_device *dev,
out_buf[1] = (u8)blc_i2c_brightness;
if (i2c_transfer(&lvds_i2c_bus->adapter, msgs, 1) == 1) {
- DRM_DEBUG("I2C set brightness.(command, value) (%d, %d)\n",
+ dev_dbg(dev->dev, "I2C set brightness.(command, value) (%d, %d)\n",
dev_priv->lvds_bl->brightnesscmd,
blc_i2c_brightness);
return 0;
}
- DRM_ERROR("I2C transfer error\n");
+ dev_err(dev->dev, "I2C transfer error\n");
return -1;
}
@@ -172,10 +172,10 @@ void psb_intel_lvds_set_brightness(struct drm_device *dev, int level)
struct drm_psb_private *dev_priv =
(struct drm_psb_private *)dev->dev_private;
- DRM_DEBUG("backlight level is %d\n", level);
+ dev_dbg(dev->dev, "backlight level is %d\n", level);
if (!dev_priv->lvds_bl) {
- DRM_ERROR("NO LVDS Backlight Info\n");
+ dev_err(dev->dev, "NO LVDS Backlight Info\n");
return;
}
@@ -289,7 +289,7 @@ static void psb_intel_lvds_save(struct drm_connector *connector)
dev_priv->backlight_duty_cycle =
psb_intel_lvds_get_max_backlight(dev);
- DRM_DEBUG("(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n",
+ dev_dbg(dev->dev, "(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n",
lvds_priv->savePP_ON,
lvds_priv->savePP_OFF,
lvds_priv->saveLVDS,
@@ -310,7 +310,7 @@ static void psb_intel_lvds_restore(struct drm_connector *connector)
struct psb_intel_lvds_priv *lvds_priv =
(struct psb_intel_lvds_priv *)psb_intel_output->dev_priv;
- DRM_DEBUG("(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n",
+ dev_dbg(dev->dev, "(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n",
lvds_priv->savePP_ON,
lvds_priv->savePP_OFF,
lvds_priv->saveLVDS,
@@ -351,8 +351,6 @@ int psb_intel_lvds_mode_valid(struct drm_connector *connector,
struct drm_display_mode *fixed_mode =
psb_intel_output->mode_dev->panel_fixed_mode;
- PSB_DEBUG_ENTRY("\n");
-
if (psb_intel_output->type == INTEL_OUTPUT_MIPI2)
fixed_mode = psb_intel_output->mode_dev->panel_fixed_mode2;
@@ -387,9 +385,6 @@ bool psb_intel_lvds_mode_fixup(struct drm_encoder *encoder,
struct psb_intel_output *psb_intel_output =
enc_to_psb_intel_output(encoder);
- PSB_DEBUG_ENTRY("type = 0x%x, pipe = %d.\n",
- psb_intel_output->type, psb_intel_crtc->pipe);
-
if (psb_intel_output->type == INTEL_OUTPUT_MIPI2)
panel_fixed_mode = mode_dev->panel_fixed_mode2;
@@ -448,8 +443,6 @@ void psb_intel_lvds_prepare(struct drm_encoder *encoder)
struct psb_intel_output *output = enc_to_psb_intel_output(encoder);
struct psb_intel_mode_device *mode_dev = output->mode_dev;
- PSB_DEBUG_ENTRY("\n");
-
if (!gma_power_begin(dev, true))
return;
@@ -468,8 +461,6 @@ void psb_intel_lvds_commit(struct drm_encoder *encoder)
struct psb_intel_output *output = enc_to_psb_intel_output(encoder);
struct psb_intel_mode_device *mode_dev = output->mode_dev;
- PSB_DEBUG_ENTRY("\n");
-
if (mode_dev->backlight_duty_cycle == 0)
mode_dev->backlight_duty_cycle =
psb_intel_lvds_get_max_backlight(dev);
@@ -585,15 +576,11 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
{
struct drm_encoder *pEncoder = connector->encoder;
- PSB_DEBUG_ENTRY("\n");
-
if (!strcmp(property->name, "scaling mode") && pEncoder) {
struct psb_intel_crtc *pPsbCrtc =
to_psb_intel_crtc(pEncoder->crtc);
uint64_t curValue;
- PSB_DEBUG_ENTRY("scaling mode\n");
-
if (!pPsbCrtc)
goto set_prop_error;
@@ -631,8 +618,6 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
goto set_prop_error;
}
} else if (!strcmp(property->name, "backlight") && pEncoder) {
- PSB_DEBUG_ENTRY("backlight\n");
-
if (drm_connector_property_set_value(connector,
property,
value))
@@ -647,7 +632,6 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
} else if (!strcmp(property->name, "DPMS") && pEncoder) {
struct drm_encoder_helper_funcs *pEncHFuncs
= pEncoder->helper_private;
- PSB_DEBUG_ENTRY("DPMS\n");
pEncHFuncs->dpms(pEncoder, value);
}
@@ -722,7 +706,7 @@ void psb_intel_lvds_init(struct drm_device *dev,
lvds_priv = kzalloc(sizeof(struct psb_intel_lvds_priv), GFP_KERNEL);
if (!lvds_priv) {
kfree(psb_intel_output);
- DRM_DEBUG("LVDS private allocation error\n");
+ dev_err(dev->dev, "LVDS private allocation error\n");
return;
}
@@ -838,8 +822,7 @@ void psb_intel_lvds_init(struct drm_device *dev,
/* If we still don't have a mode after all that, give up. */
if (!mode_dev->panel_fixed_mode) {
- DRM_DEBUG
- ("Found no modes on the lvds, ignoring the LVDS\n");
+ dev_err(dev->dev, "Found no modes on the lvds, ignoring the LVDS\n");
goto failed_find;
}
@@ -849,26 +832,6 @@ void psb_intel_lvds_init(struct drm_device *dev,
*/
out:
drm_sysfs_connector_add(connector);
-
- PSB_DEBUG_ENTRY("hdisplay = %d\n",
- mode_dev->panel_fixed_mode->hdisplay);
- PSB_DEBUG_ENTRY(" vdisplay = %d\n",
- mode_dev->panel_fixed_mode->vdisplay);
- PSB_DEBUG_ENTRY(" hsync_start = %d\n",
- mode_dev->panel_fixed_mode->hsync_start);
- PSB_DEBUG_ENTRY(" hsync_end = %d\n",
- mode_dev->panel_fixed_mode->hsync_end);
- PSB_DEBUG_ENTRY(" htotal = %d\n",
- mode_dev->panel_fixed_mode->htotal);
- PSB_DEBUG_ENTRY(" vsync_start = %d\n",
- mode_dev->panel_fixed_mode->vsync_start);
- PSB_DEBUG_ENTRY(" vsync_end = %d\n",
- mode_dev->panel_fixed_mode->vsync_end);
- PSB_DEBUG_ENTRY(" vtotal = %d\n",
- mode_dev->panel_fixed_mode->vtotal);
- PSB_DEBUG_ENTRY(" clock = %d\n",
- mode_dev->panel_fixed_mode->clock);
-
return;
failed_find:
diff --git a/drivers/staging/gma500/psb_intel_opregion.c b/drivers/staging/gma500/psb_intel_opregion.c
index 65e3e9b..51cf1d6 100644
--- a/drivers/staging/gma500/psb_intel_opregion.c
+++ b/drivers/staging/gma500/psb_intel_opregion.c
@@ -58,11 +58,8 @@ int psb_intel_opregion_init(struct drm_device *dev)
dev_priv->lid_state = NULL;
pci_read_config_dword(dev->pdev, 0xfc, &opregion_phy);
- if (opregion_phy == 0) {
- DRM_DEBUG("Opregion not supported, won't support lid-switch\n");
+ if (opregion_phy == 0)
return -ENOTSUPP;
- }
- DRM_DEBUG("OpRegion detected at 0x%8x\n", opregion_phy);
base = ioremap(opregion_phy, 8*1024);
if (!base)
@@ -70,8 +67,6 @@ int psb_intel_opregion_init(struct drm_device *dev)
lid_state = base + 0x01ac;
- DRM_DEBUG("Lid switch state 0x%08x\n", *lid_state);
-
dev_priv->lid_state = lid_state;
dev_priv->lid_last_state = *lid_state;
return 0;
diff --git a/drivers/staging/gma500/psb_intel_sdvo.c b/drivers/staging/gma500/psb_intel_sdvo.c
index df1c006..e313ce2 100644
--- a/drivers/staging/gma500/psb_intel_sdvo.c
+++ b/drivers/staging/gma500/psb_intel_sdvo.c
@@ -107,14 +107,10 @@ static bool psb_intel_sdvo_read_byte(
ret = i2c_transfer(&sdvo_priv->i2c_bus->adapter, msgs, 2);
if (ret == 2) {
- /* DRM_DEBUG("got back from addr %02X = %02x\n",
- * out_buf[0], buf[0]);
- */
*ch = buf[0];
return true;
}
- DRM_DEBUG("i2c transfer returned %d\n", ret);
return false;
}
@@ -205,24 +201,24 @@ static void psb_intel_sdvo_write_cmd(struct psb_intel_output *psb_intel_output,
int i;
if (0) {
- DRM_DEBUG("%s: W: %02X ", SDVO_NAME(sdvo_priv), cmd);
+ printk(KERN_DEBUG "%s: W: %02X ", SDVO_NAME(sdvo_priv), cmd);
for (i = 0; i < args_len; i++)
- printk(KERN_INFO"%02X ", ((u8 *) args)[i]);
+ printk(KERN_CONT "%02X ", ((u8 *) args)[i]);
for (; i < 8; i++)
- printk(" ");
+ printk(KERN_CONT " ");
for (i = 0;
i <
sizeof(sdvo_cmd_names) / sizeof(sdvo_cmd_names[0]);
i++) {
if (cmd == sdvo_cmd_names[i].cmd) {
- printk("(%s)", sdvo_cmd_names[i].name);
+ printk(KERN_CONT "(%s)", sdvo_cmd_names[i].name);
break;
}
}
if (i ==
sizeof(sdvo_cmd_names) / sizeof(sdvo_cmd_names[0]))
- printk("(%02X)", cmd);
- printk("\n");
+ printk(KERN_CONT "(%02X)", cmd);
+ printk(KERN_CONT "\n");
}
for (i = 0; i < args_len; i++) {
@@ -267,17 +263,17 @@ static u8 psb_intel_sdvo_read_response(
&status);
if (0) {
- DRM_DEBUG("%s: R: ", SDVO_NAME(sdvo_priv));
+ pr_debug("%s: R: ", SDVO_NAME(sdvo_priv));
for (i = 0; i < response_len; i++)
- printk(KERN_INFO"%02X ", ((u8 *) response)[i]);
+ printk(KERN_CONT "%02X ", ((u8 *) response)[i]);
for (; i < 8; i++)
printk(" ");
if (status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP)
- printk(KERN_INFO"(%s)",
+ printk(KERN_CONT "(%s)",
cmd_status_names[status]);
else
- printk(KERN_INFO"(??? %d)", status);
- printk("\n");
+ printk(KERN_CONT "(??? %d)", status);
+ printk(KERN_CONT "\n");
}
if (status != SDVO_CMD_STATUS_PENDING)
@@ -997,7 +993,6 @@ int psb_intel_sdvo_supports_hotplug(struct drm_connector *connector)
u8 response[2];
u8 status;
struct psb_intel_output *psb_intel_output;
- DRM_DEBUG("\n");
if (!connector)
return 0;
@@ -1198,7 +1193,7 @@ void psb_intel_sdvo_init(struct drm_device *dev, int output_device)
/* Read the regs to test if we can talk to the device */
for (i = 0; i < 0x40; i++) {
if (!psb_intel_sdvo_read_byte(psb_intel_output, i, &ch[i])) {
- DRM_DEBUG("No SDVO device found on SDVO%c\n",
+ dev_dbg(dev->dev, "No SDVO device found on SDVO%c\n",
output_device == SDVOB ? 'B' : 'C');
goto err_i2c;
}
@@ -1242,8 +1237,7 @@ void psb_intel_sdvo_init(struct drm_device *dev, int output_device)
unsigned char bytes[2];
memcpy(bytes, &sdvo_priv->caps.output_flags, 2);
- DRM_DEBUG
- ("%s: No active RGB or TMDS outputs (0x%02x%02x)\n",
+ dev_dbg(dev->dev, "%s: No active RGB or TMDS outputs (0x%02x%02x)\n",
SDVO_NAME(sdvo_priv), bytes[0], bytes[1]);
goto err_i2c;
}
@@ -1267,7 +1261,7 @@ void psb_intel_sdvo_init(struct drm_device *dev, int output_device)
pixel_clock_max);
- DRM_DEBUG("%s device VID/DID: %02X:%02X.%02X, "
+ dev_dbg(dev->dev, "%s device VID/DID: %02X:%02X.%02X, "
"clock range %dMHz - %dMHz, "
"input 1: %c, input 2: %c, "
"output 1: %c, output 2: %c\n",
diff --git a/drivers/staging/gma500/psb_irq.c b/drivers/staging/gma500/psb_irq.c
index 9ea37e5..1cbfeb6 100644
--- a/drivers/staging/gma500/psb_irq.c
+++ b/drivers/staging/gma500/psb_irq.c
@@ -187,7 +187,8 @@ static void mid_pipe_event_handler(struct drm_device *dev, uint32_t pipe)
}
if (i == WAIT_STATUS_CLEAR_LOOP_COUNT)
- DRM_ERROR("%s, can't clear the status bits in pipe_stat_reg, its value = 0x%x.\n",
+ dev_err(dev->dev,
+ "%s, can't clear the status bits in pipe_stat_reg, its value = 0x%x.\n",
__func__, PSB_RVDC32(pipe_stat_reg));
if (pipe_stat_val & PIPE_VBLANK_STATUS)
@@ -219,21 +220,11 @@ irqreturn_t psb_irq_handler(DRM_IRQ_ARGS)
vdc_stat = PSB_RVDC32(PSB_INT_IDENTITY_R);
- if (vdc_stat & _MDFLD_DISP_ALL_IRQ_FLAG) {
- PSB_DEBUG_IRQ("Got DISP interrupt\n");
+ if (vdc_stat & _MDFLD_DISP_ALL_IRQ_FLAG)
dsp_int = 1;
- }
- if (vdc_stat & _PSB_IRQ_SGX_FLAG) {
- PSB_DEBUG_IRQ("Got SGX interrupt\n");
+ if (vdc_stat & _PSB_IRQ_SGX_FLAG)
sgx_int = 1;
- }
- if (vdc_stat & _PSB_IRQ_MSVDX_FLAG)
- PSB_DEBUG_IRQ("Got MSVDX interrupt\n");
-
- if (vdc_stat & _LNC_IRQ_TOPAZ_FLAG)
- PSB_DEBUG_IRQ("Got TOPAZ interrupt\n");
-
vdc_stat &= dev_priv->vdc_irq_mask;
spin_unlock(&dev_priv->irqmask_lock);
@@ -293,8 +284,6 @@ int psb_irq_postinstall(struct drm_device *dev)
(struct drm_psb_private *) dev->dev_private;
unsigned long irqflags;
- PSB_DEBUG_ENTRY("\n");
-
spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags);
/* This register is safe even if display island is off */
@@ -326,8 +315,6 @@ void psb_irq_uninstall(struct drm_device *dev)
(struct drm_psb_private *) dev->dev_private;
unsigned long irqflags;
- PSB_DEBUG_ENTRY("\n");
-
spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags);
PSB_WVDC32(0xFFFFFFFF, PSB_HWSTAM);
@@ -395,8 +382,6 @@ int psb_irq_enable_dpst(struct drm_device *dev)
(struct drm_psb_private *) dev->dev_private;
unsigned long irqflags;
- PSB_DEBUG_ENTRY("\n");
-
spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags);
/* enable DPST */
@@ -435,8 +420,6 @@ int psb_irq_disable_dpst(struct drm_device *dev)
(struct drm_psb_private *) dev->dev_private;
unsigned long irqflags;
- PSB_DEBUG_ENTRY("\n");
-
spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags);
mid_disable_pipe_event(dev_priv, 0);
@@ -472,8 +455,6 @@ int psb_enable_vblank(struct drm_device *dev, int pipe)
uint32_t reg_val = 0;
uint32_t pipeconf_reg = mid_pipeconf(pipe);
- PSB_DEBUG_ENTRY("\n");
-
if (gma_power_begin(dev, false)) {
reg_val = REG_READ(pipeconf_reg);
gma_power_end(dev);
@@ -500,8 +481,6 @@ void psb_disable_vblank(struct drm_device *dev, int pipe)
struct drm_psb_private *dev_priv = dev->dev_private;
unsigned long irqflags;
- PSB_DEBUG_ENTRY("\n");
-
spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags);
mid_disable_pipe_event(dev_priv, pipe);
@@ -535,7 +514,7 @@ u32 psb_get_vblank_counter(struct drm_device *dev, int pipe)
pipeconf_reg = PIPECCONF;
break;
default:
- DRM_ERROR("%s, invalded pipe.\n", __func__);
+ dev_err(dev->dev, "%s, invalid pipe.\n", __func__);
return 0;
}
@@ -545,7 +524,7 @@ u32 psb_get_vblank_counter(struct drm_device *dev, int pipe)
reg_val = REG_READ(pipeconf_reg);
if (!(reg_val & PIPEACONF_ENABLE)) {
- DRM_ERROR("trying to get vblank count for disabled pipe %d\n",
+ dev_err(dev->dev, "trying to get vblank count for disabled pipe %d\n",
pipe);
goto psb_get_vblank_counter_exit;
}
From: Alan Cox <[email protected]>
We are using the underlying kref in the GEM object so we don't need our own
Signed-off-by: Alan Cox <[email protected]>
---
drivers/staging/gma500/psb_fb.c | 1 -
drivers/staging/gma500/psb_gtt.c | 41 ++++++--------------------------------
drivers/staging/gma500/psb_gtt.h | 1 -
3 files changed, 6 insertions(+), 37 deletions(-)
diff --git a/drivers/staging/gma500/psb_fb.c b/drivers/staging/gma500/psb_fb.c
index 988f4db..fb75aba 100644
--- a/drivers/staging/gma500/psb_fb.c
+++ b/drivers/staging/gma500/psb_fb.c
@@ -231,7 +231,6 @@ static int psbfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
struct psb_fbdev *fbdev = info->par;
struct psb_framebuffer *psbfb = &fbdev->pfb;
char *fb_screen_base = NULL;
- struct drm_device *dev = psbfb->base.dev;
if (vma->vm_pgoff != 0)
return -EINVAL;
diff --git a/drivers/staging/gma500/psb_gtt.c b/drivers/staging/gma500/psb_gtt.c
index 54a9308..9da1375 100644
--- a/drivers/staging/gma500/psb_gtt.c
+++ b/drivers/staging/gma500/psb_gtt.c
@@ -303,8 +303,6 @@ struct gtt_range *psb_gtt_alloc_range(struct drm_device *dev, int len,
gt->in_gart = backed;
/* Ensure this is set for non GEM objects */
gt->gem.dev = dev;
- kref_init(>->kref);
-
ret = allocate_resource(dev_priv->gtt_mem, >->resource,
len, start, end, PAGE_SIZE, NULL, NULL);
if (ret == 0) {
@@ -316,18 +314,15 @@ struct gtt_range *psb_gtt_alloc_range(struct drm_device *dev, int len,
}
/**
- * psb_gtt_destroy - final free up of a gtt
- * @kref: the kref of the gtt
- *
- * Called from the kernel kref put when the final reference to our
- * GTT object is dropped. At that point we can free up the resources.
+ * psb_gtt_free_range - release GTT address space
+ * @dev: our DRM device
+ * @gt: a mapping created with psb_gtt_alloc_range
*
- * For now we handle mmap clean up here to work around limits in GEM
+ * Release a resource that was allocated with psb_gtt_alloc_range. If the object
+ * has been pinned by mmap users we clean this up here currently.
*/
-static void psb_gtt_destroy(struct kref *kref)
+void psb_gtt_free_range(struct drm_device *dev, struct gtt_range *gt)
{
- struct gtt_range *gt = container_of(kref, struct gtt_range, kref);
-
/* Undo the mmap pin if we are destroying the object */
if (gt->mmapping) {
psb_gtt_unpin(gt);
@@ -338,30 +333,6 @@ static void psb_gtt_destroy(struct kref *kref)
kfree(gt);
}
-/**
- * psb_gtt_kref_put - drop reference to a GTT object
- * @gt: the GT being dropped
- *
- * Drop a reference to a psb gtt
- */
-void psb_gtt_kref_put(struct gtt_range *gt)
-{
- kref_put(>->kref, psb_gtt_destroy);
-}
-
-/**
- * psb_gtt_free_range - release GTT address space
- * @dev: our DRM device
- * @gt: a mapping created with psb_gtt_alloc_range
- *
- * Release a resource that was allocated with psb_gtt_alloc_range
- */
-void psb_gtt_free_range(struct drm_device *dev, struct gtt_range *gt)
-{
- psb_gtt_kref_put(gt);
-}
-
-
struct psb_gtt *psb_gtt_alloc(struct drm_device *dev)
{
struct psb_gtt *tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
diff --git a/drivers/staging/gma500/psb_gtt.h b/drivers/staging/gma500/psb_gtt.h
index 7e1f21e..4d6dc5f 100644
--- a/drivers/staging/gma500/psb_gtt.h
+++ b/drivers/staging/gma500/psb_gtt.h
@@ -44,7 +44,6 @@ extern void psb_gtt_takedown(struct drm_device *dev);
struct gtt_range {
struct resource resource; /* Resource for our allocation */
u32 offset; /* GTT offset of our object */
- struct kref kref; /* Can probably go FIXME - GEM kref will do */
struct drm_gem_object gem; /* GEM high level stuff */
int in_gart; /* Currently in the GART (ref ct) */
bool stolen; /* Backed from stolen RAM */
Hi Alan
Just a thought. Shouldn't we use the DRM macros for printing debug info?
-Patrik
On Wed, Jun 8, 2011 at 12:15 PM, Alan Cox <[email protected]> wrote:
> From: Alan Cox <[email protected]>
>
> Lose all the PSB debug gunge. We can replace it with dev_dbg() like normal
> drivers if and when we need debug on stuff.
>
> Signed-off-by: Alan Cox <[email protected]>
> ---
>
> ?drivers/staging/gma500/mrst_crtc.c ? ? ? ? ?| ? 23 ++----
> ?drivers/staging/gma500/mrst_lvds.c ? ? ? ? ?| ? 12 +--
> ?drivers/staging/gma500/psb_bl.c ? ? ? ? ? ? | ? ?8 --
> ?drivers/staging/gma500/psb_drv.c ? ? ? ? ? ?| ? 33 +++------
> ?drivers/staging/gma500/psb_drv.h ? ? ? ? ? ?| ? 96 +++-----------------------
> ?drivers/staging/gma500/psb_fb.c ? ? ? ? ? ? | ? 34 +--------
> ?drivers/staging/gma500/psb_gem.c ? ? ? ? ? ?| ? ?6 +-
> ?drivers/staging/gma500/psb_gtt.c ? ? ? ? ? ?| ? ?6 +-
> ?drivers/staging/gma500/psb_intel_bios.c ? ? | ? 17 +----
> ?drivers/staging/gma500/psb_intel_display.c ?| ? 99 +++------------------------
> ?drivers/staging/gma500/psb_intel_lvds.c ? ? | ? 53 ++------------
> ?drivers/staging/gma500/psb_intel_opregion.c | ? ?7 --
> ?drivers/staging/gma500/psb_intel_sdvo.c ? ? | ? 34 ++++-----
> ?drivers/staging/gma500/psb_irq.c ? ? ? ? ? ?| ? 33 ++-------
> ?14 files changed, 87 insertions(+), 374 deletions(-)
>
> diff --git a/drivers/staging/gma500/mrst_crtc.c b/drivers/staging/gma500/mrst_crtc.c
> index fd97c80..fb9f2a2 100644
> --- a/drivers/staging/gma500/mrst_crtc.c
> +++ b/drivers/staging/gma500/mrst_crtc.c
> @@ -103,7 +103,7 @@ static const struct mrst_limit_t *mrst_limit(struct drm_crtc *crtc)
> ? ? ? ? ? ? ? ?}
> ? ? ? ?} else {
> ? ? ? ? ? ? ? ?limit = NULL;
> - ? ? ? ? ? ? ? PSB_DEBUG_ENTRY("mrst_limit Wrong display type.\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "mrst_limit Wrong display type.\n");
> ? ? ? ?}
>
> ? ? ? ?return limit;
> @@ -117,7 +117,7 @@ static void mrst_clock(int refclk, struct mrst_clock_t *clock)
>
> ?void mrstPrintPll(char *prefix, struct mrst_clock_t *clock)
> ?{
> - ? ? ? PSB_DEBUG_ENTRY("%s: dotclock = %d, ?m = %d, p1 = %d.\n",
> + ? ? ? pr_debug("%s: dotclock = %d, ?m = %d, p1 = %d.\n",
> ? ? ? ? ? ? prefix, clock->dot, clock->m, clock->p1);
> ?}
>
> @@ -149,8 +149,7 @@ mrstFindBestPLL(struct drm_crtc *crtc, int target, int refclk,
> ? ? ? ? ? ? ? ? ? ? ? ?}
> ? ? ? ? ? ? ? ?}
> ? ? ? ?}
> - ? ? ? DRM_DEBUG("mrstFindBestPLL err = %d.\n", err);
> -
> + ? ? ? dev_dbg(crtc->dev->dev, "mrstFindBestPLL err = %d.\n", err);
> ? ? ? ?return err != target;
> ?}
>
> @@ -172,8 +171,6 @@ static void mrst_crtc_dpms(struct drm_crtc *crtc, int mode)
> ? ? ? ?u32 temp;
> ? ? ? ?bool enabled;
>
> - ? ? ? PSB_DEBUG_ENTRY("mode = %d, pipe = %d\n", mode, pipe);
> -
> ? ? ? ?if (!gma_power_begin(dev, true))
> ? ? ? ? ? ? ? ?return;
>
> @@ -320,8 +317,6 @@ static int mrst_crtc_mode_set(struct drm_crtc *crtc,
> ? ? ? ?uint64_t scalingType = DRM_MODE_SCALE_FULLSCREEN;
> ? ? ? ?struct drm_encoder *encoder;
>
> - ? ? ? PSB_DEBUG_ENTRY("pipe = 0x%x\n", pipe);
> -
> ? ? ? ?if (!gma_power_begin(dev, true))
> ? ? ? ? ? ? ? ?return 0;
>
> @@ -446,10 +441,9 @@ static int mrst_crtc_mode_set(struct drm_crtc *crtc,
> ? ? ? ?ok = mrstFindBestPLL(crtc, adjusted_mode->clock, refclk, &clock);
>
> ? ? ? ?if (!ok) {
> - ? ? ? ? ? ? ? PSB_DEBUG_ENTRY(
> - ? ? ? ? ? ? ? ? ? ? ? "mrstFindBestPLL fail in mrst_crtc_mode_set.\n");
> + ? ? ? ? ? ? ? dev_dbg(dev->dev, "mrstFindBestPLL fail in mrst_crtc_mode_set.\n");
> ? ? ? ?} else {
> - ? ? ? ? ? ? ? PSB_DEBUG_ENTRY("mrst_crtc_mode_set pixel clock = %d,"
> + ? ? ? ? ? ? ? dev_dbg(dev->dev, "mrst_crtc_mode_set pixel clock = %d,"
> ? ? ? ? ? ? ? ? ? ? ? ? "m = %x, p1 = %x.\n", clock.dot, clock.m,
> ? ? ? ? ? ? ? ? ? ? ? ? clock.p1);
> ? ? ? ?}
> @@ -540,11 +534,9 @@ int mrst_pipe_set_base(struct drm_crtc *crtc,
> ? ? ? ?u32 dspcntr;
> ? ? ? ?int ret = 0;
>
> - ? ? ? PSB_DEBUG_ENTRY("\n");
> -
> ? ? ? ?/* no fb bound */
> ? ? ? ?if (!crtc->fb) {
> - ? ? ? ? ? ? ? DRM_DEBUG("No FB bound\n");
> + ? ? ? ? ? ? ? dev_dbg(dev->dev, "No FB bound\n");
> ? ? ? ? ? ? ? ?return 0;
> ? ? ? ?}
>
> @@ -574,13 +566,12 @@ int mrst_pipe_set_base(struct drm_crtc *crtc,
> ? ? ? ? ? ? ? ?dspcntr |= DISPPLANE_32BPP_NO_ALPHA;
> ? ? ? ? ? ? ? ?break;
> ? ? ? ?default:
> - ? ? ? ? ? ? ? DRM_ERROR("Unknown color depth\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "Unknown color depth\n");
> ? ? ? ? ? ? ? ?ret = -EINVAL;
> ? ? ? ? ? ? ? ?goto pipe_set_base_exit;
> ? ? ? ?}
> ? ? ? ?REG_WRITE(dspcntr_reg, dspcntr);
>
> - ? ? ? DRM_DEBUG("Writing base %08lX %08lX %d %d\n", start, offset, x, y);
> ? ? ? ?if (0 /* FIXMEAC - check what PSB needs */) {
> ? ? ? ? ? ? ? ?REG_WRITE(dspbase, offset);
> ? ? ? ? ? ? ? ?REG_READ(dspbase);
> diff --git a/drivers/staging/gma500/mrst_lvds.c b/drivers/staging/gma500/mrst_lvds.c
> index 22ea00e..aac80cc 100644
> --- a/drivers/staging/gma500/mrst_lvds.c
> +++ b/drivers/staging/gma500/mrst_lvds.c
> @@ -47,7 +47,6 @@ static void mrst_lvds_set_power(struct drm_device *dev,
> ?{
> ? ? ? ?u32 pp_status;
> ? ? ? ?struct drm_psb_private *dev_priv = dev->dev_private;
> - ? ? ? PSB_DEBUG_ENTRY("\n");
>
> ? ? ? ?if (!gma_power_begin(dev, true))
> ? ? ? ? ? ? ? ?return;
> @@ -77,8 +76,6 @@ static void mrst_lvds_dpms(struct drm_encoder *encoder, int mode)
> ? ? ? ?struct drm_device *dev = encoder->dev;
> ? ? ? ?struct psb_intel_output *output = enc_to_psb_intel_output(encoder);
>
> - ? ? ? PSB_DEBUG_ENTRY("\n");
> -
> ? ? ? ?if (mode == DRM_MODE_DPMS_ON)
> ? ? ? ? ? ? ? ?mrst_lvds_set_power(dev, output, true);
> ? ? ? ?else
> @@ -97,8 +94,6 @@ static void mrst_lvds_mode_set(struct drm_encoder *encoder,
> ? ? ? ?u32 lvds_port;
> ? ? ? ?uint64_t v = DRM_MODE_SCALE_FULLSCREEN;
>
> - ? ? ? PSB_DEBUG_ENTRY("\n");
> -
> ? ? ? ?if (!gma_power_begin(dev, true))
> ? ? ? ? ? ? ? ?return;
>
> @@ -252,8 +247,6 @@ void mrst_lvds_init(struct drm_device *dev,
> ? ? ? ?struct i2c_adapter *i2c_adap;
> ? ? ? ?struct drm_display_mode *scan; ?/* *modes, *bios_mode; */
>
> - ? ? ? PSB_DEBUG_ENTRY("\n");
> -
> ? ? ? ?psb_intel_output = kzalloc(sizeof(struct psb_intel_output), GFP_KERNEL);
> ? ? ? ?if (!psb_intel_output)
> ? ? ? ? ? ? ? ?return;
> @@ -348,8 +341,7 @@ void mrst_lvds_init(struct drm_device *dev,
>
> ? ? ? ?/* If we still don't have a mode after all that, give up. */
> ? ? ? ?if (!mode_dev->panel_fixed_mode) {
> - ? ? ? ? ? ? ? DRM_DEBUG
> - ? ? ? ? ? ? ? ? ? ("Found no modes on the lvds, ignoring the LVDS\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "Found no modes on the lvds, ignoring the LVDS\n");
> ? ? ? ? ? ? ? ?goto failed_find;
> ? ? ? ?}
>
> @@ -358,7 +350,7 @@ out:
> ? ? ? ?return;
>
> ?failed_find:
> - ? ? ? DRM_DEBUG("No LVDS modes found, disabling.\n");
> + ? ? ? dev_dbg(dev->dev, "No LVDS modes found, disabling.\n");
> ? ? ? ?if (psb_intel_output->ddc_bus)
> ? ? ? ? ? ? ? ?psb_intel_i2c_destroy(psb_intel_output->ddc_bus);
>
> diff --git a/drivers/staging/gma500/psb_bl.c b/drivers/staging/gma500/psb_bl.c
> index 2f9674d..4a00047 100644
> --- a/drivers/staging/gma500/psb_bl.c
> +++ b/drivers/staging/gma500/psb_bl.c
> @@ -56,8 +56,6 @@ int psb_set_brightness(struct backlight_device *bd)
> ? ? ? ?struct drm_device *dev = bl_get_data(psb_backlight_device);
> ? ? ? ?int level = bd->props.brightness;
>
> - ? ? ? DRM_DEBUG_DRIVER("backlight level set to %d\n", level);
> -
> ? ? ? ?/* Percentage 1-100% being valid */
> ? ? ? ?if (level < 1)
> ? ? ? ? ? ? ? ?level = 1;
> @@ -75,8 +73,6 @@ int mrst_set_brightness(struct backlight_device *bd)
> ? ? ? ?u32 blc_pwm_ctl;
> ? ? ? ?u32 max_pwm_blc;
>
> - ? ? ? DRM_DEBUG_DRIVER("backlight level set to %d\n", level);
> -
> ? ? ? ?/* Percentage 1-100% being valid */
> ? ? ? ?if (level < 1)
> ? ? ? ? ? ? ? ?level = 1;
> @@ -111,8 +107,6 @@ int mrst_set_brightness(struct backlight_device *bd)
>
> ?int psb_get_brightness(struct backlight_device *bd)
> ?{
> - ? ? ? DRM_DEBUG_DRIVER("brightness = 0x%x\n", psb_brightness);
> -
> ? ? ? ?/* return locally cached var instead of HW read (due to DPST etc.) */
> ? ? ? ?/* FIXME: ideally return actual value in case firmware fiddled with
> ? ? ? ? ? it */
> @@ -144,7 +138,7 @@ static int device_backlight_init(struct drm_device *dev)
> ? ? ? ?} else {
> ? ? ? ? ? ? ? ?/* get bl_max_freq and pol from dev_priv*/
> ? ? ? ? ? ? ? ?if (!dev_priv->lvds_bl) {
> - ? ? ? ? ? ? ? ? ? ? ? DRM_ERROR("Has no valid LVDS backlight info\n");
> + ? ? ? ? ? ? ? ? ? ? ? dev_err(dev->dev, "Has no valid LVDS backlight info\n");
> ? ? ? ? ? ? ? ? ? ? ? ?return 1;
> ? ? ? ? ? ? ? ?}
> ? ? ? ? ? ? ? ?bl_max_freq = dev_priv->lvds_bl->freq;
> diff --git a/drivers/staging/gma500/psb_drv.c b/drivers/staging/gma500/psb_drv.c
> index ab1da30..6ea06dd 100644
> --- a/drivers/staging/gma500/psb_drv.c
> +++ b/drivers/staging/gma500/psb_drv.c
> @@ -35,17 +35,14 @@
> ?#include <linux/pm_runtime.h>
> ?#include <acpi/video.h>
>
> -int drm_psb_debug;
> ?static int drm_psb_trap_pagefaults;
>
> ?int drm_psb_no_fb;
>
> ?static int psb_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
>
> -MODULE_PARM_DESC(debug, "Enable debug output");
> ?MODULE_PARM_DESC(no_fb, "Disable FBdev");
> ?MODULE_PARM_DESC(trap_pagefaults, "Error and reset on MMU pagefaults");
> -module_param_named(debug, drm_psb_debug, int, 0600);
> ?module_param_named(no_fb, drm_psb_no_fb, int, 0600);
> ?module_param_named(trap_pagefaults, drm_psb_trap_pagefaults, int, 0600);
>
> @@ -215,7 +212,8 @@ void mrst_get_fuse_settings(struct drm_device *dev)
> ? ? ? ? ? ? ? ?dev_priv->core_freq = 166;
> ? ? ? ? ? ? ? ?break;
> ? ? ? ?default:
> - ? ? ? ? ? ? ? DRM_ERROR("Invalid SKU values, SKU value = 0x%08x\n", fuse_value_tmp);
> + ? ? ? ? ? ? ? dev_warn(dev->dev, "Invalid SKU values, SKU value = 0x%08x\n",
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fuse_value_tmp);
> ? ? ? ? ? ? ? ?dev_priv->core_freq = 0;
> ? ? ? ?}
> ? ? ? ?DRM_INFO("LNC core clk is %dMHz.\n", dev_priv->core_freq);
> @@ -231,7 +229,8 @@ void mid_get_pci_revID (struct drm_psb_private *dev_priv)
> ? ? ? ?pci_read_config_dword(pci_gfx_root, 0x08, &platform_rev_id);
> ? ? ? ?dev_priv->platform_rev_id = (uint8_t) platform_rev_id;
> ? ? ? ?pci_dev_put(pci_gfx_root);
> - ? ? ? PSB_DEBUG_ENTRY("platform_rev_id is %x\n", ? ? ?dev_priv->platform_rev_id);
> + ? ? ? dev_info(dev_priv->dev->dev, "platform_rev_id is %x\n",
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? dev_priv->platform_rev_id);
> ?}
>
> ?void mrst_get_vbt_data(struct drm_psb_private *dev_priv)
> @@ -413,7 +412,7 @@ static int psb_do_init(struct drm_device *dev)
> ? ? ? ?int ret = -ENOMEM;
>
> ? ? ? ?if (pg->mmu_gatt_start & 0x0FFFFFFF) {
> - ? ? ? ? ? ? ? DRM_ERROR("Gatt must be 256M aligned. This is a bug.\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "Gatt must be 256M aligned. This is a bug.\n");
> ? ? ? ? ? ? ? ?ret = -EINVAL;
> ? ? ? ? ? ? ? ?goto out_err;
> ? ? ? ?}
> @@ -447,9 +446,6 @@ static int psb_do_init(struct drm_device *dev)
>
> ? ? ? ?spin_lock_init(&dev_priv->irqmask_lock);
>
> - ? ? ? /* FIXME: can we kill ta_mem_size ? */
> - ? ? ? dev_priv->sizes.ta_mem_size = 0;
> -
> ? ? ? ?PSB_WSGX32(0x00000000, PSB_CR_BIF_BANK0);
> ? ? ? ?PSB_WSGX32(0x00000000, PSB_CR_BIF_BANK1);
> ? ? ? ?PSB_RSGX32(PSB_CR_BIF_BANK1);
> @@ -553,7 +549,6 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)
> ? ? ? ?dev->dev_private = (void *) dev_priv;
> ? ? ? ?dev_priv->chipset = chipset;
>
> - ? ? ? PSB_DEBUG_INIT("Mapping MMIO\n");
> ? ? ? ?resource_start = pci_resource_start(dev->pdev, PSB_MMIO_RESOURCE);
>
> ? ? ? ?dev_priv->vdc_reg =
> @@ -679,7 +674,6 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)
> ? ? ? ?pm_runtime_set_active(&dev->pdev->dev);
> ?#endif
> ? ? ? ?/*Intel drm driver load is done, continue doing pvr load*/
> - ? ? ? DRM_DEBUG("Pvr driver load\n");
> ? ? ? ?return 0;
> ?out_err:
> ? ? ? ?psb_driver_unload(dev);
> @@ -721,7 +715,7 @@ static int psb_dc_state_ioctl(struct drm_device *dev, void * data,
> ? ? ? ? ? ? ? ?obj = drm_mode_object_find(dev, obj_id,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?DRM_MODE_OBJECT_CRTC);
> ? ? ? ? ? ? ? ?if (!obj) {
> - ? ? ? ? ? ? ? ? ? ? ? DRM_DEBUG("Invalid CRTC object.\n");
> + ? ? ? ? ? ? ? ? ? ? ? dev_dbg(dev->dev, "Invalid CRTC object.\n");
> ? ? ? ? ? ? ? ? ? ? ? ?return -EINVAL;
> ? ? ? ? ? ? ? ?}
>
> @@ -741,7 +735,7 @@ static int psb_dc_state_ioctl(struct drm_device *dev, void * data,
> ? ? ? ? ? ? ? ?obj = drm_mode_object_find(dev, obj_id,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?DRM_MODE_OBJECT_CONNECTOR);
> ? ? ? ? ? ? ? ?if (!obj) {
> - ? ? ? ? ? ? ? ? ? ? ? DRM_DEBUG("Invalid connector id.\n");
> + ? ? ? ? ? ? ? ? ? ? ? dev_dbg(dev->dev, "Invalid connector id.\n");
> ? ? ? ? ? ? ? ? ? ? ? ?return -EINVAL;
> ? ? ? ? ? ? ? ?}
>
> @@ -753,8 +747,6 @@ static int psb_dc_state_ioctl(struct drm_device *dev, void * data,
>
> ? ? ? ? ? ? ? ?return 0;
> ? ? ? ?}
> -
> - ? ? ? DRM_DEBUG("Bad flags 0x%x\n", flags);
> ? ? ? ?return -EINVAL;
> ?}
>
> @@ -832,7 +824,7 @@ static int psb_gamma_ioctl(struct drm_device *dev, void *data,
> ? ? ? ?obj_id = lut_arg->output_id;
> ? ? ? ?obj = drm_mode_object_find(dev, obj_id, DRM_MODE_OBJECT_CONNECTOR);
> ? ? ? ?if (!obj) {
> - ? ? ? ? ? ? ? DRM_DEBUG("Invalid Connector object.\n");
> + ? ? ? ? ? ? ? dev_dbg(dev->dev, "Invalid Connector object.\n");
> ? ? ? ? ? ? ? ?return -EINVAL;
> ? ? ? ?}
>
> @@ -873,7 +865,7 @@ static int psb_mode_operation_ioctl(struct drm_device *dev, void *data,
> ? ? ? ?case PSB_MODE_OPERATION_SET_DC_BASE:
> ? ? ? ? ? ? ? ?obj = drm_mode_object_find(dev, obj_id, DRM_MODE_OBJECT_FB);
> ? ? ? ? ? ? ? ?if (!obj) {
> - ? ? ? ? ? ? ? ? ? ? ? DRM_ERROR("Invalid FB id %d\n", obj_id);
> + ? ? ? ? ? ? ? ? ? ? ? dev_dbg(dev->dev, "Invalid FB id %d\n", obj_id);
> ? ? ? ? ? ? ? ? ? ? ? ?return -EINVAL;
> ? ? ? ? ? ? ? ?}
>
> @@ -945,7 +937,7 @@ mode_op_out:
> ? ? ? ? ? ? ? ?return ret;
>
> ? ? ? ?default:
> - ? ? ? ? ? ? ? DRM_DEBUG("Unsupported psb mode operation");
> + ? ? ? ? ? ? ? dev_dbg(dev->dev, "Unsupported psb mode operation\n");
> ? ? ? ? ? ? ? ?return -EOPNOTSUPP;
> ? ? ? ?}
>
> @@ -1336,9 +1328,6 @@ static long psb_unlocked_ioctl(struct file *filp, unsigned int cmd,
> ? ? ? ?struct drm_device *dev = file_priv->minor->dev;
> ? ? ? ?struct drm_psb_private *dev_priv = dev->dev_private;
> ? ? ? ?static unsigned int runtime_allowed;
> - ? ? ? unsigned int nr = DRM_IOCTL_NR(cmd);
> -
> - ? ? ? DRM_DEBUG("cmd = %x, nr = %x\n", cmd, nr);
>
> ? ? ? ?if (runtime_allowed == 1 && dev_priv->is_lvds_on) {
> ? ? ? ? ? ? ? ?runtime_allowed++;
> @@ -1439,7 +1428,7 @@ static int psb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> ?{
> ? ? ? ?/* MLD Added this from Inaky's patch */
> ? ? ? ?if (pci_enable_msi(pdev))
> - ? ? ? ? ? ? ? DRM_ERROR("Enable MSI failed!\n");
> + ? ? ? ? ? ? ? ?dev_warn(&pdev->dev, "Enable MSI failed!\n");
> ? ? ? ?return drm_get_pci_dev(pdev, ent, &driver);
> ?}
>
> diff --git a/drivers/staging/gma500/psb_drv.h b/drivers/staging/gma500/psb_drv.h
> index c0468ee..45752aa 100644
> --- a/drivers/staging/gma500/psb_drv.h
> +++ b/drivers/staging/gma500/psb_drv.h
> @@ -659,54 +659,12 @@ extern int psb_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
> ?#define PSB_D_MSVDX ? (1 << 9)
> ?#define PSB_D_TOPAZ ? (1 << 10)
>
> -#ifndef DRM_DEBUG_CODE
> -/* To enable debug printout, set drm_psb_debug in psb_drv.c
> - * to any combination of above print flags.
> - */
> -/* #define DRM_DEBUG_CODE 2 */
> -#endif
> -
> -extern int drm_psb_debug;
> ?extern int drm_psb_no_fb;
> ?extern int drm_idle_check_interval;
>
> -#define PSB_DEBUG_GENERAL(_fmt, _arg...) \
> - ? ? ? PSB_DEBUG(PSB_D_GENERAL, _fmt, ##_arg)
> -#define PSB_DEBUG_INIT(_fmt, _arg...) \
> - ? ? ? PSB_DEBUG(PSB_D_INIT, _fmt, ##_arg)
> -#define PSB_DEBUG_IRQ(_fmt, _arg...) \
> - ? ? ? PSB_DEBUG(PSB_D_IRQ, _fmt, ##_arg)
> -#define PSB_DEBUG_ENTRY(_fmt, _arg...) \
> - ? ? ? PSB_DEBUG(PSB_D_ENTRY, _fmt, ##_arg)
> -#define PSB_DEBUG_HV(_fmt, _arg...) \
> - ? ? ? PSB_DEBUG(PSB_D_HV, _fmt, ##_arg)
> -#define PSB_DEBUG_DBI_BF(_fmt, _arg...) \
> - ? ? ? PSB_DEBUG(PSB_D_DBI_BF, _fmt, ##_arg)
> -#define PSB_DEBUG_PM(_fmt, _arg...) \
> - ? ? ? PSB_DEBUG(PSB_D_PM, _fmt, ##_arg)
> -#define PSB_DEBUG_RENDER(_fmt, _arg...) \
> - ? ? ? PSB_DEBUG(PSB_D_RENDER, _fmt, ##_arg)
> -#define PSB_DEBUG_REG(_fmt, _arg...) \
> - ? ? ? PSB_DEBUG(PSB_D_REG, _fmt, ##_arg)
> -#define PSB_DEBUG_MSVDX(_fmt, _arg...) \
> - ? ? ? PSB_DEBUG(PSB_D_MSVDX, _fmt, ##_arg)
> -#define PSB_DEBUG_TOPAZ(_fmt, _arg...) \
> - ? ? ? PSB_DEBUG(PSB_D_TOPAZ, _fmt, ##_arg)
> -
> -#if DRM_DEBUG_CODE
> -#define PSB_DEBUG(_flag, _fmt, _arg...) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> - ? ? ? do { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> - ? ? ? ? ? ? ? if (unlikely((_flag) & drm_psb_debug)) ? ? ? ? ? ? ? ? ?\
> - ? ? ? ? ? ? ? ? ? ? ? printk(KERN_DEBUG ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"[psb:0x%02x:%s] " _fmt , _flag, ? ? ? ? \
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?__func__ , ##_arg); ? ? ? ? ? ? ? ? ? ? ?\
> - ? ? ? } while (0)
> -#else
> -#define PSB_DEBUG(_fmt, _arg...) ? ? do { } while (0)
> -#endif
>
> ?/*
> - *Utilities
> + * ? ? Utilities
> ?*/
>
> ?static inline u32 MRST_MSG_READ32(uint port, uint offset)
> @@ -749,19 +707,15 @@ static inline void MDFLD_MSG_WRITE32(uint port, uint offset, u32 value)
> ?static inline uint32_t REGISTER_READ(struct drm_device *dev, uint32_t reg)
> ?{
> ? ? ? ?struct drm_psb_private *dev_priv = dev->dev_private;
> - ? ? ? int reg_val = ioread32(dev_priv->vdc_reg + (reg));
> - ? ? ? PSB_DEBUG_REG("reg = 0x%x. reg_val = 0x%x. \n", reg, reg_val);
> - ? ? ? return reg_val;
> + ? ? ? return ioread32(dev_priv->vdc_reg + reg);
> ?}
>
> ?#define REG_READ(reg) ? ? ? ? REGISTER_READ(dev, (reg))
> +
> ?static inline void REGISTER_WRITE(struct drm_device *dev, uint32_t reg,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?uint32_t val)
> ?{
> ? ? ? ?struct drm_psb_private *dev_priv = dev->dev_private;
> - ? ? ? if ((reg < 0x70084 || reg >0x70088) && (reg < 0xa000 || reg >0xa3ff))
> - ? ? ? ? ? ? ? PSB_DEBUG_REG("reg = 0x%x, val = 0x%x. \n", reg, val);
> -
> ? ? ? ?iowrite32((val), dev_priv->vdc_reg + (reg));
> ?}
>
> @@ -771,9 +725,6 @@ static inline void REGISTER_WRITE16(struct drm_device *dev,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?uint32_t reg, uint32_t val)
> ?{
> ? ? ? ?struct drm_psb_private *dev_priv = dev->dev_private;
> -
> - ? ? ? PSB_DEBUG_REG("reg = 0x%x, val = 0x%x. \n", reg, val);
> -
> ? ? ? ?iowrite16((val), dev_priv->vdc_reg + (reg));
> ?}
>
> @@ -783,20 +734,13 @@ static inline void REGISTER_WRITE8(struct drm_device *dev,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? uint32_t reg, uint32_t val)
> ?{
> ? ? ? ?struct drm_psb_private *dev_priv = dev->dev_private;
> -
> - ? ? ? PSB_DEBUG_REG("reg = 0x%x, val = 0x%x. \n", reg, val);
> -
> ? ? ? ?iowrite8((val), dev_priv->vdc_reg + (reg));
> ?}
>
> -#define REG_WRITE8(reg, val) ? ?REGISTER_WRITE8(dev, (reg), (val))
> +#define REG_WRITE8(reg, val) ? ? ? ? ? REGISTER_WRITE8(dev, (reg), (val))
>
> -#define PSB_ALIGN_TO(_val, _align) \
> - ?(((_val) + ((_align) - 1)) & ~((_align) - 1))
> -#define PSB_WVDC32(_val, _offs) \
> - ?iowrite32(_val, dev_priv->vdc_reg + (_offs))
> -#define PSB_RVDC32(_offs) \
> - ?ioread32(dev_priv->vdc_reg + (_offs))
> +#define PSB_WVDC32(_val, _offs) ? ? ? ? ? ? ? ?iowrite32(_val, dev_priv->vdc_reg + (_offs))
> +#define PSB_RVDC32(_offs) ? ? ? ? ? ? ?ioread32(dev_priv->vdc_reg + (_offs))
>
> ?/* #define TRAP_SGX_PM_FAULT 1 */
> ?#ifdef TRAP_SGX_PM_FAULT
> @@ -810,33 +754,13 @@ static inline void REGISTER_WRITE8(struct drm_device *dev,
> ? ? ioread32(dev_priv->sgx_reg + (_offs)); ? ? ? ? ? ? ? ? ? ? \
> ?})
> ?#else
> -#define PSB_RSGX32(_offs) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> - ?ioread32(dev_priv->sgx_reg + (_offs))
> +#define PSB_RSGX32(_offs) ? ? ? ? ? ? ?ioread32(dev_priv->sgx_reg + (_offs))
> ?#endif
> -#define PSB_WSGX32(_val, _offs) \
> - ?iowrite32(_val, dev_priv->sgx_reg + (_offs))
> +#define PSB_WSGX32(_val, _offs) ? ? ? ? ? ? ? ?iowrite32(_val, dev_priv->sgx_reg + (_offs))
>
> ?#define MSVDX_REG_DUMP 0
> -#if MSVDX_REG_DUMP
> -
> -#define PSB_WMSVDX32(_val, _offs) \
> - ?printk("MSVDX: write %08x to reg 0x%08x\n", (unsigned int)(_val), (unsigned int)(_offs));\
> - ?iowrite32(_val, dev_priv->msvdx_reg + (_offs))
> -#define PSB_RMSVDX32(_offs) \
> - ?ioread32(dev_priv->msvdx_reg + (_offs))
> -
> -#else
> -
> -#define PSB_WMSVDX32(_val, _offs) \
> - ?iowrite32(_val, dev_priv->msvdx_reg + (_offs))
> -#define PSB_RMSVDX32(_offs) \
> - ?ioread32(dev_priv->msvdx_reg + (_offs))
> -
> -#endif
>
> -#define PSB_ALPL(_val, _base) ? ? ? ? ? ? ? ? ?\
> - ?(((_val) >> (_base ## _ALIGNSHIFT)) << (_base ## _SHIFT))
> -#define PSB_ALPLM(_val, _base) ? ? ? ? ? ? ? ? \
> - ?((((_val) >> (_base ## _ALIGNSHIFT)) << (_base ## _SHIFT)) & (_base ## _MASK))
> +#define PSB_WMSVDX32(_val, _offs) ? ? ?iowrite32(_val, dev_priv->msvdx_reg + (_offs))
> +#define PSB_RMSVDX32(_offs) ? ? ? ? ? ?ioread32(dev_priv->msvdx_reg + (_offs))
>
> ?#endif
> diff --git a/drivers/staging/gma500/psb_fb.c b/drivers/staging/gma500/psb_fb.c
> index 0a77abf..988f4db 100644
> --- a/drivers/staging/gma500/psb_fb.c
> +++ b/drivers/staging/gma500/psb_fb.c
> @@ -100,7 +100,6 @@ static int psbfb_kms_off(struct drm_device *dev, int suspend)
> ?{
> ? ? ? ?struct drm_framebuffer *fb = 0;
> ? ? ? ?struct psb_framebuffer *psbfb = to_psb_fb(fb);
> - ? ? ? DRM_DEBUG("psbfb_kms_off_ioctl\n");
>
> ? ? ? ?mutex_lock(&dev->mode_config.mutex);
> ? ? ? ?list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
> @@ -134,8 +133,6 @@ static int psbfb_kms_on(struct drm_device *dev, int resume)
> ? ? ? ?struct drm_framebuffer *fb = 0;
> ? ? ? ?struct psb_framebuffer *psbfb = to_psb_fb(fb);
>
> - ? ? ? DRM_DEBUG("psbfb_kms_on_ioctl\n");
> -
> ? ? ? ?mutex_lock(&dev->mode_config.mutex);
> ? ? ? ?list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
> ? ? ? ? ? ? ? ?struct fb_info *info = psbfb->fbdev;
> @@ -217,12 +214,10 @@ static int psbfb_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
>
> ?static void psbfb_vm_open(struct vm_area_struct *vma)
> ?{
> - ? ? ? DRM_DEBUG("vm_open\n");
> ?}
>
> ?static void psbfb_vm_close(struct vm_area_struct *vma)
> ?{
> - ? ? ? DRM_DEBUG("vm_close\n");
> ?}
>
> ?static struct vm_operations_struct psbfb_vm_ops = {
> @@ -237,7 +232,6 @@ static int psbfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
> ? ? ? ?struct psb_framebuffer *psbfb = &fbdev->pfb;
> ? ? ? ?char *fb_screen_base = NULL;
> ? ? ? ?struct drm_device *dev = psbfb->base.dev;
> - ? ? ? struct drm_psb_private *dev_priv = dev->dev_private;
>
> ? ? ? ?if (vma->vm_pgoff != 0)
> ? ? ? ? ? ? ? ?return -EINVAL;
> @@ -249,10 +243,6 @@ static int psbfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
>
> ? ? ? ?fb_screen_base = (char *)info->screen_base;
>
> - ? ? ? DRM_DEBUG("vm_pgoff 0x%lx, screen base %p vram_addr %p\n",
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vma->vm_pgoff, fb_screen_base,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?dev_priv->vram_addr);
> -
> ? ? ? ? /* If this is a GEM object then info->screen_base is the virtual
> ? ? ? ? ? ?kernel remapping of the object. FIXME: Review if this is
> ? ? ? ? ? ?suitable for our mmap work */
> @@ -523,14 +513,10 @@ static int psbfb_create(struct psb_fbdev *fbdev,
> ? ? ? ?info->pixmap.flags = FB_PIXMAP_SYSTEM;
> ? ? ? ?info->pixmap.scan_align = 1;
>
> - ? ? ? DRM_DEBUG("fb depth is %d\n", fb->depth);
> - ? ? ? DRM_DEBUG(" ? pitch is %d\n", fb->pitch);
> -
> - ? ? ? printk(KERN_INFO"allocated %dx%d fb\n",
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? psbfb->base.width, psbfb->base.height);
> + ? ? ? dev_info(dev->dev, "allocated %dx%d fb\n",
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? psbfb->base.width, psbfb->base.height);
>
> ? ? ? ?mutex_unlock(&dev->struct_mutex);
> -
> ? ? ? ?return 0;
> ?out_unref:
> ? ? ? ? if (backing->stolen)
> @@ -575,13 +561,11 @@ static struct drm_framebuffer *psb_user_framebuffer_create
> ?static void psbfb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?u16 blue, int regno)
> ?{
> - ? ? ? DRM_DEBUG("%s\n", __func__);
> ?}
>
> ?static void psbfb_gamma_get(struct drm_crtc *crtc, u16 *red,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?u16 *green, u16 *blue, int regno)
> ?{
> - ? ? ? DRM_DEBUG("%s\n", __func__);
> ?}
>
> ?static int psbfb_probe(struct drm_fb_helper *helper,
> @@ -591,8 +575,6 @@ static int psbfb_probe(struct drm_fb_helper *helper,
> ? ? ? ?int new_fb = 0;
> ? ? ? ?int ret;
>
> - ? ? ? DRM_DEBUG("%s\n", __func__);
> -
> ? ? ? ?if (!helper->fb) {
> ? ? ? ? ? ? ? ?ret = psbfb_create(psb_fbdev, sizes);
> ? ? ? ? ? ? ? ?if (ret)
> @@ -650,7 +632,7 @@ int psb_fbdev_init(struct drm_device *dev)
>
> ? ? ? ?fbdev = kzalloc(sizeof(struct psb_fbdev), GFP_KERNEL);
> ? ? ? ?if (!fbdev) {
> - ? ? ? ? ? ? ? DRM_ERROR("no memory\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "no memory\n");
> ? ? ? ? ? ? ? ?return -ENOMEM;
> ? ? ? ?}
>
> @@ -781,8 +763,6 @@ static void psb_setup_outputs(struct drm_device *dev)
> ? ? ? ? ? ?(struct drm_psb_private *) dev->dev_private;
> ? ? ? ?struct drm_connector *connector;
>
> - ? ? ? PSB_DEBUG_ENTRY("\n");
> -
> ? ? ? ?drm_mode_create_scaling_mode_property(dev);
>
> ? ? ? ?psb_create_backlight_property(dev);
> @@ -791,7 +771,7 @@ static void psb_setup_outputs(struct drm_device *dev)
> ? ? ? ? ? ? ? ?if (dev_priv->iLVDS_enable)
> ? ? ? ? ? ? ? ? ? ? ? ?mrst_lvds_init(dev, &dev_priv->mode_dev);
> ? ? ? ? ? ? ? ?else
> - ? ? ? ? ? ? ? ? ? ? ? DRM_ERROR("DSI is not supported\n");
> + ? ? ? ? ? ? ? ? ? ? ? dev_err(dev->dev, "DSI is not supported\n");
> ? ? ? ?} else {
> ? ? ? ? ? ? ? ?psb_intel_lvds_init(dev, &dev_priv->mode_dev);
> ? ? ? ? ? ? ? ?psb_intel_sdvo_init(dev, SDVOB);
> @@ -811,7 +791,6 @@ static void psb_setup_outputs(struct drm_device *dev)
> ? ? ? ? ? ? ? ? ? ? ? ?clone_mask = (1 << INTEL_OUTPUT_SDVO);
> ? ? ? ? ? ? ? ? ? ? ? ?break;
> ? ? ? ? ? ? ? ?case INTEL_OUTPUT_LVDS:
> - ? ? ? ? ? ? ? ? ? ? ? PSB_DEBUG_ENTRY("LVDS.\n");
> ? ? ? ? ? ? ? ? ? ? ? ?if (IS_MRST(dev))
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?crtc_mask = (1 << 0);
> ? ? ? ? ? ? ? ? ? ? ? ?else
> @@ -819,17 +798,14 @@ static void psb_setup_outputs(struct drm_device *dev)
> ? ? ? ? ? ? ? ? ? ? ? ?clone_mask = (1 << INTEL_OUTPUT_LVDS);
> ? ? ? ? ? ? ? ? ? ? ? ?break;
> ? ? ? ? ? ? ? ?case INTEL_OUTPUT_MIPI:
> - ? ? ? ? ? ? ? ? ? ? ? PSB_DEBUG_ENTRY("MIPI.\n");
> ? ? ? ? ? ? ? ? ? ? ? ?crtc_mask = (1 << 0);
> ? ? ? ? ? ? ? ? ? ? ? ?clone_mask = (1 << INTEL_OUTPUT_MIPI);
> ? ? ? ? ? ? ? ? ? ? ? ?break;
> ? ? ? ? ? ? ? ?case INTEL_OUTPUT_MIPI2:
> - ? ? ? ? ? ? ? ? ? ? ? PSB_DEBUG_ENTRY("MIPI2.\n");
> ? ? ? ? ? ? ? ? ? ? ? ?crtc_mask = (1 << 2);
> ? ? ? ? ? ? ? ? ? ? ? ?clone_mask = (1 << INTEL_OUTPUT_MIPI2);
> ? ? ? ? ? ? ? ? ? ? ? ?break;
> ? ? ? ? ? ? ? ?case INTEL_OUTPUT_HDMI:
> - ? ? ? ? ? ? ? ? ? ? ? PSB_DEBUG_ENTRY("HDMI.\n");
> ? ? ? ? ? ? ? ? ? ? ? ?crtc_mask = (1 << 1);
> ? ? ? ? ? ? ? ? ? ? ? ?clone_mask = (1 << INTEL_OUTPUT_HDMI);
> ? ? ? ? ? ? ? ? ? ? ? ?break;
> @@ -849,8 +825,6 @@ void psb_modeset_init(struct drm_device *dev)
> ? ? ? ?struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
> ? ? ? ?int i;
>
> - ? ? ? PSB_DEBUG_ENTRY("\n");
> -
> ? ? ? ?drm_mode_config_init(dev);
>
> ? ? ? ?dev->mode_config.min_width = 0;
> diff --git a/drivers/staging/gma500/psb_gem.c b/drivers/staging/gma500/psb_gem.c
> index 125ea6b..7f6f479 100644
> --- a/drivers/staging/gma500/psb_gem.c
> +++ b/drivers/staging/gma500/psb_gem.c
> @@ -87,7 +87,7 @@ static int psb_gem_create_mmap_offset(struct drm_gem_object *obj)
> ? ? ? ?list->file_offset_node = drm_mm_search_free(&mm->offset_manager,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?obj->size / PAGE_SIZE, 0, 0);
> ? ? ? ?if (!list->file_offset_node) {
> - ? ? ? ? ? ? ? DRM_ERROR("failed to allocate offset for bo %d\n", obj->name);
> + ? ? ? ? ? ? ? dev_err(dev->dev, "failed to allocate offset for bo %d\n", obj->name);
> ? ? ? ? ? ? ? ?ret = -ENOSPC;
> ? ? ? ? ? ? ? ?goto free_it;
> ? ? ? ?}
> @@ -100,7 +100,7 @@ static int psb_gem_create_mmap_offset(struct drm_gem_object *obj)
> ? ? ? ?list->hash.key = list->file_offset_node->start;
> ? ? ? ?ret = drm_ht_insert_item(&mm->offset_hash, &list->hash);
> ? ? ? ?if (ret) {
> - ? ? ? ? ? ? ? DRM_ERROR("failed to add to map hash\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "failed to add to map hash\n");
> ? ? ? ? ? ? ? ?goto free_mm;
> ? ? ? ?}
> ? ? ? ?return 0;
> @@ -283,7 +283,7 @@ int psb_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
> ? ? ? ?if (r->mmapping == 0) {
> ? ? ? ? ? ? ? ?ret = psb_gtt_pin(r);
> ? ? ? ? ? ? ? ?if (ret < 0) {
> - ? ? ? ? ? ? ? ? ? ? ? DRM_ERROR("gma500: pin failed: %d\n", ret);
> + ? ? ? ? ? ? ? ? ? ? ? dev_err(dev->dev, "gma500: pin failed: %d\n", ret);
> ? ? ? ? ? ? ? ? ? ? ? ?goto fail;
> ? ? ? ? ? ? ? ? }
> ? ? ? ? ? ? ? ?r->mmapping = 1;
> diff --git a/drivers/staging/gma500/psb_gtt.c b/drivers/staging/gma500/psb_gtt.c
> index 8fcb833..54a9308 100644
> --- a/drivers/staging/gma500/psb_gtt.c
> +++ b/drivers/staging/gma500/psb_gtt.c
> @@ -456,7 +456,7 @@ int psb_gtt_init(struct drm_device *dev, int resume)
>
> ? ? ? ?if (resume && (gtt_pages != pg->gtt_pages) &&
> ? ? ? ? ? ?(stolen_size != pg->stolen_size)) {
> - ? ? ? ? ? ? ? DRM_ERROR("GTT resume error.\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "GTT resume error.\n");
> ? ? ? ? ? ? ? ?ret = -EINVAL;
> ? ? ? ? ? ? ? ?goto out_err;
> ? ? ? ?}
> @@ -470,14 +470,14 @@ int psb_gtt_init(struct drm_device *dev, int resume)
> ? ? ? ? */
> ? ? ? ?dev_priv->gtt_map = ioremap_nocache(pg->gtt_phys_start, gtt_pages << PAGE_SHIFT);
> ? ? ? ?if (!dev_priv->gtt_map) {
> - ? ? ? ? ? ? ? DRM_ERROR("Failure to map gtt.\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "Failure to map gtt.\n");
> ? ? ? ? ? ? ? ?ret = -ENOMEM;
> ? ? ? ? ? ? ? ?goto out_err;
> ? ? ? ?}
>
> ? ? ? ?dev_priv->vram_addr = ioremap_wc(dev_priv->stolen_base, stolen_size);
> ? ? ? ?if (!dev_priv->vram_addr) {
> - ? ? ? ? ? ? ? DRM_ERROR("Failure to map stolen base.\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "Failure to map stolen base.\n");
> ? ? ? ? ? ? ? ?ret = -ENOMEM;
> ? ? ? ? ? ? ? ?goto out_err;
> ? ? ? ?}
> diff --git a/drivers/staging/gma500/psb_intel_bios.c b/drivers/staging/gma500/psb_intel_bios.c
> index 417965d..5b3e88c 100644
> --- a/drivers/staging/gma500/psb_intel_bios.c
> +++ b/drivers/staging/gma500/psb_intel_bios.c
> @@ -96,25 +96,20 @@ static void parse_backlight_data(struct drm_psb_private *dev_priv,
>
> ? ? ? ?dev_priv->lvds_bl = NULL;
>
> - ? ? ? if (lvds_opts) {
> - ? ? ? ? ? ? ? DRM_DEBUG("lvds_options found at %p\n", lvds_opts);
> + ? ? ? if (lvds_opts)
> ? ? ? ? ? ? ? ?p_type = lvds_opts->panel_type;
> - ? ? ? } else {
> - ? ? ? ? ? ? ? DRM_DEBUG("no lvds_options\n");
> + ? ? ? else
> ? ? ? ? ? ? ? ?return;
> - ? ? ? }
>
> ? ? ? ?bl_start = find_section(bdb, BDB_LVDS_BACKLIGHT);
> ? ? ? ?vbt_lvds_bl = (struct bdb_lvds_backlight *)(bl_start + 1) + p_type;
>
> ? ? ? ?lvds_bl = kzalloc(sizeof(*vbt_lvds_bl), GFP_KERNEL);
> ? ? ? ?if (!lvds_bl) {
> - ? ? ? ? ? ? ? DRM_DEBUG("No memory\n");
> + ? ? ? ? ? ? ? dev_err(dev_priv->dev->dev, "out of memory for backlight data\n");
> ? ? ? ? ? ? ? ?return;
> ? ? ? ?}
> -
> ? ? ? ?memcpy(lvds_bl, vbt_lvds_bl, sizeof(*vbt_lvds_bl));
> -
> ? ? ? ?dev_priv->lvds_bl = lvds_bl;
> ?}
>
> @@ -156,14 +151,12 @@ static void parse_lfp_panel_data(struct drm_psb_private *dev_priv,
>
> ? ? ? ?if (panel_fixed_mode->htotal > 0 && panel_fixed_mode->vtotal > 0) {
> ? ? ? ? ? ? ? ?dev_priv->lfp_lvds_vbt_mode = panel_fixed_mode;
> - ? ? ? ? ? ? ? DRM_DEBUG("Found panel mode in BIOS VBT tables:\n");
> ? ? ? ? ? ? ? ?drm_mode_debug_printmodeline(panel_fixed_mode);
> ? ? ? ?} else {
> - ? ? ? ? ? ? ? DRM_DEBUG("Ignoring bogus LVDS VBT mode.\n");
> + ? ? ? ? ? ? ? dev_dbg(dev_priv->dev->dev, "ignoring invalid LVDS VBT\n");
> ? ? ? ? ? ? ? ?dev_priv->lvds_vbt = 0;
> ? ? ? ? ? ? ? ?kfree(panel_fixed_mode);
> ? ? ? ?}
> -
> ? ? ? ?return;
> ?}
>
> @@ -257,7 +250,7 @@ bool psb_intel_init_bios(struct drm_device *dev)
> ? ? ? ?}
>
> ? ? ? ?if (!vbt) {
> - ? ? ? ? ? ? ? DRM_ERROR("VBT signature missing\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "VBT signature missing\n");
> ? ? ? ? ? ? ? ?pci_unmap_rom(pdev, bios);
> ? ? ? ? ? ? ? ?return -1;
> ? ? ? ?}
> diff --git a/drivers/staging/gma500/psb_intel_display.c b/drivers/staging/gma500/psb_intel_display.c
> index c7c55b1..be7e1f9 100644
> --- a/drivers/staging/gma500/psb_intel_display.c
> +++ b/drivers/staging/gma500/psb_intel_display.c
> @@ -350,14 +350,12 @@ int psb_intel_pipe_set_base(struct drm_crtc *crtc,
> ? ? ? ?u32 dspcntr;
> ? ? ? ?int ret = 0;
>
> - ? ? ? PSB_DEBUG_ENTRY("\n");
> -
> ? ? ? ?if (!gma_power_begin(dev, true))
> ? ? ? ? ? ? ? ?return 0;
>
> ? ? ? ?/* no fb bound */
> ? ? ? ?if (!crtc->fb) {
> - ? ? ? ? ? ? ? DRM_DEBUG("No FB bound\n");
> + ? ? ? ? ? ? ? dev_dbg(dev->dev, "No FB bound\n");
> ? ? ? ? ? ? ? ?goto psb_intel_pipe_cleaner;
> ? ? ? ?}
>
> @@ -390,7 +388,7 @@ int psb_intel_pipe_set_base(struct drm_crtc *crtc,
> ? ? ? ? ? ? ? ?dspcntr |= DISPPLANE_32BPP_NO_ALPHA;
> ? ? ? ? ? ? ? ?break;
> ? ? ? ?default:
> - ? ? ? ? ? ? ? DRM_ERROR("Unknown color depth\n");
> + ? ? ? ? ? ? ? ?dev_err(dev->dev, "Unknown color depth\n");
> ? ? ? ? ? ? ? ?ret = -EINVAL;
> ? ? ? ? ? ? ? ?psb_gtt_unpin(psbfb->gtt);
> ? ? ? ? ? ? ? ?goto psb_intel_pipe_set_base_exit;
> @@ -398,7 +396,6 @@ int psb_intel_pipe_set_base(struct drm_crtc *crtc,
> ? ? ? ?REG_WRITE(dspcntr_reg, dspcntr);
>
>
> - ? ? ? DRM_DEBUG("Writing base %08lX %08lX %d %d\n", start, offset, x, y);
> ? ? ? ?if (0 /* FIXMEAC - check what PSB needs */) {
> ? ? ? ? ? ? ? ?REG_WRITE(dspbase, offset);
> ? ? ? ? ? ? ? ?REG_READ(dspbase);
> @@ -650,7 +647,7 @@ static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,
> ? ? ? ?ok = psb_intel_find_best_PLL(crtc, adjusted_mode->clock, refclk,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &clock);
> ? ? ? ?if (!ok) {
> - ? ? ? ? ? ? ? DRM_ERROR("Couldn't find PLL settings for mode!\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "Couldn't find PLL settings for mode!\n");
> ? ? ? ? ? ? ? ?return 0;
> ? ? ? ?}
>
> @@ -714,7 +711,6 @@ static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,
> ? ? ? ?if (psb_intel_panel_fitter_pipe(dev) == pipe)
> ? ? ? ? ? ? ? ?REG_WRITE(PFIT_CONTROL, 0);
>
> - ? ? ? DRM_DEBUG("Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B');
> ? ? ? ?drm_mode_debug_printmodeline(mode);
>
> ? ? ? ?if (dpll & DPLL_VCO_ENABLE) {
> @@ -825,7 +821,7 @@ void psb_intel_crtc_load_lut(struct drm_crtc *crtc)
> ? ? ? ? ? ? ? ?palreg = PALETTE_C;
> ? ? ? ? ? ? ? ?break;
> ? ? ? ?default:
> - ? ? ? ? ? ? ? DRM_ERROR("Illegal Pipe Number.\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "Illegal Pipe Number.\n");
> ? ? ? ? ? ? ? ?return;
> ? ? ? ?}
>
> @@ -868,10 +864,8 @@ static void psb_intel_crtc_save(struct drm_crtc *crtc)
> ? ? ? ?uint32_t paletteReg;
> ? ? ? ?int i;
>
> - ? ? ? DRM_DEBUG("\n");
> -
> ? ? ? ?if (!crtc_state) {
> - ? ? ? ? ? ? ? DRM_DEBUG("No CRTC state found\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "No CRTC state found\n");
> ? ? ? ? ? ? ? ?return;
> ? ? ? ?}
>
> @@ -895,25 +889,6 @@ static void psb_intel_crtc_save(struct drm_crtc *crtc)
>
> ? ? ? ?crtc_state->saveDSPBASE = REG_READ(pipeA ? DSPABASE : DSPBBASE);
>
> - ? ? ? DRM_DEBUG("(%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x)\n",
> - ? ? ? ? ? ? ? ? ? ? ? crtc_state->saveDSPCNTR,
> - ? ? ? ? ? ? ? ? ? ? ? crtc_state->savePIPECONF,
> - ? ? ? ? ? ? ? ? ? ? ? crtc_state->savePIPESRC,
> - ? ? ? ? ? ? ? ? ? ? ? crtc_state->saveFP0,
> - ? ? ? ? ? ? ? ? ? ? ? crtc_state->saveFP1,
> - ? ? ? ? ? ? ? ? ? ? ? crtc_state->saveDPLL,
> - ? ? ? ? ? ? ? ? ? ? ? crtc_state->saveHTOTAL,
> - ? ? ? ? ? ? ? ? ? ? ? crtc_state->saveHBLANK,
> - ? ? ? ? ? ? ? ? ? ? ? crtc_state->saveHSYNC,
> - ? ? ? ? ? ? ? ? ? ? ? crtc_state->saveVTOTAL,
> - ? ? ? ? ? ? ? ? ? ? ? crtc_state->saveVBLANK,
> - ? ? ? ? ? ? ? ? ? ? ? crtc_state->saveVSYNC,
> - ? ? ? ? ? ? ? ? ? ? ? crtc_state->saveDSPSTRIDE,
> - ? ? ? ? ? ? ? ? ? ? ? crtc_state->saveDSPSIZE,
> - ? ? ? ? ? ? ? ? ? ? ? crtc_state->saveDSPPOS,
> - ? ? ? ? ? ? ? ? ? ? ? crtc_state->saveDSPBASE
> - ? ? ? ? ? ? ? );
> -
> ? ? ? ?paletteReg = pipeA ? PALETTE_A : PALETTE_B;
> ? ? ? ?for (i = 0; i < 256; ++i)
> ? ? ? ? ? ? ? ?crtc_state->savePalette[i] = REG_READ(paletteReg + (i << 2));
> @@ -934,60 +909,15 @@ static void psb_intel_crtc_restore(struct drm_crtc *crtc)
> ? ? ? ?uint32_t paletteReg;
> ? ? ? ?int i;
>
> - ? ? ? DRM_DEBUG("\n");
> -
> ? ? ? ?if (!crtc_state) {
> - ? ? ? ? ? ? ? DRM_DEBUG("No crtc state\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "No crtc state\n");
> ? ? ? ? ? ? ? ?return;
> ? ? ? ?}
>
> - ? ? ? DRM_DEBUG(
> - ? ? ? ? ? ? ? "current:(%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x)\n",
> - ? ? ? ? ? ? ? REG_READ(pipeA ? DSPACNTR : DSPBCNTR),
> - ? ? ? ? ? ? ? REG_READ(pipeA ? PIPEACONF : PIPEBCONF),
> - ? ? ? ? ? ? ? REG_READ(pipeA ? PIPEASRC : PIPEBSRC),
> - ? ? ? ? ? ? ? REG_READ(pipeA ? FPA0 : FPB0),
> - ? ? ? ? ? ? ? REG_READ(pipeA ? FPA1 : FPB1),
> - ? ? ? ? ? ? ? REG_READ(pipeA ? DPLL_A : DPLL_B),
> - ? ? ? ? ? ? ? REG_READ(pipeA ? HTOTAL_A : HTOTAL_B),
> - ? ? ? ? ? ? ? REG_READ(pipeA ? HBLANK_A : HBLANK_B),
> - ? ? ? ? ? ? ? REG_READ(pipeA ? HSYNC_A : HSYNC_B),
> - ? ? ? ? ? ? ? REG_READ(pipeA ? VTOTAL_A : VTOTAL_B),
> - ? ? ? ? ? ? ? REG_READ(pipeA ? VBLANK_A : VBLANK_B),
> - ? ? ? ? ? ? ? REG_READ(pipeA ? VSYNC_A : VSYNC_B),
> - ? ? ? ? ? ? ? REG_READ(pipeA ? DSPASTRIDE : DSPBSTRIDE),
> - ? ? ? ? ? ? ? REG_READ(pipeA ? DSPASIZE : DSPBSIZE),
> - ? ? ? ? ? ? ? REG_READ(pipeA ? DSPAPOS : DSPBPOS),
> - ? ? ? ? ? ? ? REG_READ(pipeA ? DSPABASE : DSPBBASE)
> - ? ? ? ? ? ? ? );
> -
> - ? ? ? DRM_DEBUG(
> - ? ? ? ? ? ? ? "saved: (%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x)\n",
> - ? ? ? ? ? ? ? crtc_state->saveDSPCNTR,
> - ? ? ? ? ? ? ? crtc_state->savePIPECONF,
> - ? ? ? ? ? ? ? crtc_state->savePIPESRC,
> - ? ? ? ? ? ? ? crtc_state->saveFP0,
> - ? ? ? ? ? ? ? crtc_state->saveFP1,
> - ? ? ? ? ? ? ? crtc_state->saveDPLL,
> - ? ? ? ? ? ? ? crtc_state->saveHTOTAL,
> - ? ? ? ? ? ? ? crtc_state->saveHBLANK,
> - ? ? ? ? ? ? ? crtc_state->saveHSYNC,
> - ? ? ? ? ? ? ? crtc_state->saveVTOTAL,
> - ? ? ? ? ? ? ? crtc_state->saveVBLANK,
> - ? ? ? ? ? ? ? crtc_state->saveVSYNC,
> - ? ? ? ? ? ? ? crtc_state->saveDSPSTRIDE,
> - ? ? ? ? ? ? ? crtc_state->saveDSPSIZE,
> - ? ? ? ? ? ? ? crtc_state->saveDSPPOS,
> - ? ? ? ? ? ? ? crtc_state->saveDSPBASE
> - ? ? ? ? ? ? ? );
> -
> -
> ? ? ? ?if (crtc_state->saveDPLL & DPLL_VCO_ENABLE) {
> ? ? ? ? ? ? ? ?REG_WRITE(pipeA ? DPLL_A : DPLL_B,
> ? ? ? ? ? ? ? ? ? ? ? ?crtc_state->saveDPLL & ~DPLL_VCO_ENABLE);
> ? ? ? ? ? ? ? ?REG_READ(pipeA ? DPLL_A : DPLL_B);
> - ? ? ? ? ? ? ? DRM_DEBUG("write dpll: %x\n",
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? REG_READ(pipeA ? DPLL_A : DPLL_B));
> ? ? ? ? ? ? ? ?udelay(150);
> ? ? ? ?}
>
> @@ -1044,11 +974,8 @@ static int psb_intel_crtc_cursor_set(struct drm_crtc *crtc,
> ? ? ? ?struct drm_gem_object *obj;
> ? ? ? ?int ret;
>
> - ? ? ? DRM_DEBUG("\n");
> -
> ? ? ? ?/* if we want to turn of the cursor ignore width and height */
> ? ? ? ?if (!handle) {
> - ? ? ? ? ? ? ? DRM_DEBUG("cursor off\n");
> ? ? ? ? ? ? ? ?/* turn off the cursor */
> ? ? ? ? ? ? ? ?temp = CURSOR_MODE_DISABLE;
>
> @@ -1072,7 +999,7 @@ static int psb_intel_crtc_cursor_set(struct drm_crtc *crtc,
>
> ? ? ? ?/* Currently we only support 64x64 cursors */
> ? ? ? ?if (width != 64 || height != 64) {
> - ? ? ? ? ? ? ? DRM_ERROR("we currently only support 64x64 cursors\n");
> + ? ? ? ? ? ? ? dev_dbg(dev->dev, "we currently only support 64x64 cursors\n");
> ? ? ? ? ? ? ? ?return -EINVAL;
> ? ? ? ?}
>
> @@ -1081,7 +1008,7 @@ static int psb_intel_crtc_cursor_set(struct drm_crtc *crtc,
> ? ? ? ? ? ? ? ?return -ENOENT;
>
> ? ? ? ?if (obj->size < width * height * 4) {
> - ? ? ? ? ? ? ? DRM_ERROR("buffer is to small\n");
> + ? ? ? ? ? ? ? dev_dbg(dev->dev, "buffer is to small\n");
> ? ? ? ? ? ? ? ?return -ENOMEM;
> ? ? ? ?}
>
> @@ -1090,7 +1017,7 @@ static int psb_intel_crtc_cursor_set(struct drm_crtc *crtc,
> ? ? ? ?/* Pin the memory into the GTT */
> ? ? ? ?ret = psb_gtt_pin(gt);
> ? ? ? ?if (ret) {
> - ? ? ? ? ? ? ? DRM_ERROR("Can not pin down handle 0x%x\n", handle);
> + ? ? ? ? ? ? ? dev_err(dev->dev, "Can not pin down handle 0x%x\n", handle);
> ? ? ? ? ? ? ? ?return ret;
> ? ? ? ?}
>
> @@ -1359,8 +1286,6 @@ void psb_intel_crtc_init(struct drm_device *dev, int pipe,
> ? ? ? ?int i;
> ? ? ? ?uint16_t *r_base, *g_base, *b_base;
>
> - ? ? ? PSB_DEBUG_ENTRY("\n");
> -
> ? ? ? ?/* We allocate a extra array of drm_connector pointers
> ? ? ? ? * for fbdev after the crtc */
> ? ? ? ?psb_intel_crtc =
> @@ -1373,7 +1298,7 @@ void psb_intel_crtc_init(struct drm_device *dev, int pipe,
> ? ? ? ?psb_intel_crtc->crtc_state =
> ? ? ? ? ? ? ? ?kzalloc(sizeof(struct psb_intel_crtc_state), GFP_KERNEL);
> ? ? ? ?if (!psb_intel_crtc->crtc_state) {
> - ? ? ? ? ? ? ? DRM_INFO("Crtc state error: No memory\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "Crtc state error: No memory\n");
> ? ? ? ? ? ? ? ?kfree(psb_intel_crtc);
> ? ? ? ? ? ? ? ?return;
> ? ? ? ?}
> @@ -1430,7 +1355,7 @@ int psb_intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
> ? ? ? ?struct psb_intel_crtc *crtc;
>
> ? ? ? ?if (!dev_priv) {
> - ? ? ? ? ? ? ? DRM_ERROR("called with no initialization\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "called with no initialization\n");
> ? ? ? ? ? ? ? ?return -EINVAL;
> ? ? ? ?}
>
> @@ -1438,7 +1363,7 @@ int psb_intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
> ? ? ? ? ? ? ? ? ? ? ? ?DRM_MODE_OBJECT_CRTC);
>
> ? ? ? ?if (!drmmode_obj) {
> - ? ? ? ? ? ? ? DRM_ERROR("no such CRTC id\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "no such CRTC id\n");
> ? ? ? ? ? ? ? ?return -EINVAL;
> ? ? ? ?}
>
> diff --git a/drivers/staging/gma500/psb_intel_lvds.c b/drivers/staging/gma500/psb_intel_lvds.c
> index b0a225b..1cbc9bc 100644
> --- a/drivers/staging/gma500/psb_intel_lvds.c
> +++ b/drivers/staging/gma500/psb_intel_lvds.c
> @@ -126,13 +126,13 @@ static int psb_lvds_i2c_set_brightness(struct drm_device *dev,
> ? ? ? ?out_buf[1] = (u8)blc_i2c_brightness;
>
> ? ? ? ?if (i2c_transfer(&lvds_i2c_bus->adapter, msgs, 1) == 1) {
> - ? ? ? ? ? ? ? DRM_DEBUG("I2C set brightness.(command, value) (%d, %d)\n",
> + ? ? ? ? ? ? ? dev_dbg(dev->dev, "I2C set brightness.(command, value) (%d, %d)\n",
> ? ? ? ? ? ? ? ? ? ? ? ?dev_priv->lvds_bl->brightnesscmd,
> ? ? ? ? ? ? ? ? ? ? ? ?blc_i2c_brightness);
> ? ? ? ? ? ? ? ?return 0;
> ? ? ? ?}
>
> - ? ? ? DRM_ERROR("I2C transfer error\n");
> + ? ? ? dev_err(dev->dev, "I2C transfer error\n");
> ? ? ? ?return -1;
> ?}
>
> @@ -172,10 +172,10 @@ void psb_intel_lvds_set_brightness(struct drm_device *dev, int level)
> ? ? ? ?struct drm_psb_private *dev_priv =
> ? ? ? ? ? ? ? ? ? ? ? ?(struct drm_psb_private *)dev->dev_private;
>
> - ? ? ? DRM_DEBUG("backlight level is %d\n", level);
> + ? ? ? dev_dbg(dev->dev, "backlight level is %d\n", level);
>
> ? ? ? ?if (!dev_priv->lvds_bl) {
> - ? ? ? ? ? ? ? DRM_ERROR("NO LVDS Backlight Info\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "NO LVDS Backlight Info\n");
> ? ? ? ? ? ? ? ?return;
> ? ? ? ?}
>
> @@ -289,7 +289,7 @@ static void psb_intel_lvds_save(struct drm_connector *connector)
> ? ? ? ? ? ? ? ?dev_priv->backlight_duty_cycle =
> ? ? ? ? ? ? ? ?psb_intel_lvds_get_max_backlight(dev);
>
> - ? ? ? DRM_DEBUG("(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n",
> + ? ? ? dev_dbg(dev->dev, "(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n",
> ? ? ? ? ? ? ? ? ? ? ? ?lvds_priv->savePP_ON,
> ? ? ? ? ? ? ? ? ? ? ? ?lvds_priv->savePP_OFF,
> ? ? ? ? ? ? ? ? ? ? ? ?lvds_priv->saveLVDS,
> @@ -310,7 +310,7 @@ static void psb_intel_lvds_restore(struct drm_connector *connector)
> ? ? ? ?struct psb_intel_lvds_priv *lvds_priv =
> ? ? ? ? ? ? ? ?(struct psb_intel_lvds_priv *)psb_intel_output->dev_priv;
>
> - ? ? ? DRM_DEBUG("(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n",
> + ? ? ? dev_dbg(dev->dev, "(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n",
> ? ? ? ? ? ? ? ? ? ? ? ?lvds_priv->savePP_ON,
> ? ? ? ? ? ? ? ? ? ? ? ?lvds_priv->savePP_OFF,
> ? ? ? ? ? ? ? ? ? ? ? ?lvds_priv->saveLVDS,
> @@ -351,8 +351,6 @@ int psb_intel_lvds_mode_valid(struct drm_connector *connector,
> ? ? ? ?struct drm_display_mode *fixed_mode =
> ? ? ? ? ? ?psb_intel_output->mode_dev->panel_fixed_mode;
>
> - ? ? ? PSB_DEBUG_ENTRY("\n");
> -
> ? ? ? ?if (psb_intel_output->type == INTEL_OUTPUT_MIPI2)
> ? ? ? ? ? ? ? ?fixed_mode = psb_intel_output->mode_dev->panel_fixed_mode2;
>
> @@ -387,9 +385,6 @@ bool psb_intel_lvds_mode_fixup(struct drm_encoder *encoder,
> ? ? ? ?struct psb_intel_output *psb_intel_output =
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?enc_to_psb_intel_output(encoder);
>
> - ? ? ? PSB_DEBUG_ENTRY("type = 0x%x, pipe = %d.\n",
> - ? ? ? ? ? ? ? ? ? ? ? psb_intel_output->type, psb_intel_crtc->pipe);
> -
> ? ? ? ?if (psb_intel_output->type == INTEL_OUTPUT_MIPI2)
> ? ? ? ? ? ? ? ?panel_fixed_mode = mode_dev->panel_fixed_mode2;
>
> @@ -448,8 +443,6 @@ void psb_intel_lvds_prepare(struct drm_encoder *encoder)
> ? ? ? ?struct psb_intel_output *output = enc_to_psb_intel_output(encoder);
> ? ? ? ?struct psb_intel_mode_device *mode_dev = output->mode_dev;
>
> - ? ? ? PSB_DEBUG_ENTRY("\n");
> -
> ? ? ? ?if (!gma_power_begin(dev, true))
> ? ? ? ? ? ? ? ?return;
>
> @@ -468,8 +461,6 @@ void psb_intel_lvds_commit(struct drm_encoder *encoder)
> ? ? ? ?struct psb_intel_output *output = enc_to_psb_intel_output(encoder);
> ? ? ? ?struct psb_intel_mode_device *mode_dev = output->mode_dev;
>
> - ? ? ? PSB_DEBUG_ENTRY("\n");
> -
> ? ? ? ?if (mode_dev->backlight_duty_cycle == 0)
> ? ? ? ? ? ? ? ?mode_dev->backlight_duty_cycle =
> ? ? ? ? ? ? ? ? ? ?psb_intel_lvds_get_max_backlight(dev);
> @@ -585,15 +576,11 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
> ?{
> ? ? ? ?struct drm_encoder *pEncoder = connector->encoder;
>
> - ? ? ? PSB_DEBUG_ENTRY("\n");
> -
> ? ? ? ?if (!strcmp(property->name, "scaling mode") && pEncoder) {
> ? ? ? ? ? ? ? ?struct psb_intel_crtc *pPsbCrtc =
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?to_psb_intel_crtc(pEncoder->crtc);
> ? ? ? ? ? ? ? ?uint64_t curValue;
>
> - ? ? ? ? ? ? ? PSB_DEBUG_ENTRY("scaling mode\n");
> -
> ? ? ? ? ? ? ? ?if (!pPsbCrtc)
> ? ? ? ? ? ? ? ? ? ? ? ?goto set_prop_error;
>
> @@ -631,8 +618,6 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?goto set_prop_error;
> ? ? ? ? ? ? ? ?}
> ? ? ? ?} else if (!strcmp(property->name, "backlight") && pEncoder) {
> - ? ? ? ? ? ? ? PSB_DEBUG_ENTRY("backlight\n");
> -
> ? ? ? ? ? ? ? ?if (drm_connector_property_set_value(connector,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?property,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?value))
> @@ -647,7 +632,6 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
> ? ? ? ?} else if (!strcmp(property->name, "DPMS") && pEncoder) {
> ? ? ? ? ? ? ? ?struct drm_encoder_helper_funcs *pEncHFuncs
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?= pEncoder->helper_private;
> - ? ? ? ? ? ? ? PSB_DEBUG_ENTRY("DPMS\n");
> ? ? ? ? ? ? ? ?pEncHFuncs->dpms(pEncoder, value);
> ? ? ? ?}
>
> @@ -722,7 +706,7 @@ void psb_intel_lvds_init(struct drm_device *dev,
> ? ? ? ?lvds_priv = kzalloc(sizeof(struct psb_intel_lvds_priv), GFP_KERNEL);
> ? ? ? ?if (!lvds_priv) {
> ? ? ? ? ? ? ? ?kfree(psb_intel_output);
> - ? ? ? ? ? ? ? DRM_DEBUG("LVDS private allocation error\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "LVDS private allocation error\n");
> ? ? ? ? ? ? ? ?return;
> ? ? ? ?}
>
> @@ -838,8 +822,7 @@ void psb_intel_lvds_init(struct drm_device *dev,
>
> ? ? ? ?/* If we still don't have a mode after all that, give up. */
> ? ? ? ?if (!mode_dev->panel_fixed_mode) {
> - ? ? ? ? ? ? ? DRM_DEBUG
> - ? ? ? ? ? ? ? ? ? ? ? ("Found no modes on the lvds, ignoring the LVDS\n");
> + ? ? ? ? ? ? ? dev_err(dev->dev, "Found no modes on the lvds, ignoring the LVDS\n");
> ? ? ? ? ? ? ? ?goto failed_find;
> ? ? ? ?}
>
> @@ -849,26 +832,6 @@ void psb_intel_lvds_init(struct drm_device *dev,
> ? ? ? ? */
> ?out:
> ? ? ? ?drm_sysfs_connector_add(connector);
> -
> - ? ? ? PSB_DEBUG_ENTRY("hdisplay = %d\n",
> - ? ? ? ? ? ? ? ?mode_dev->panel_fixed_mode->hdisplay);
> - ? ? ? PSB_DEBUG_ENTRY(" vdisplay = %d\n",
> - ? ? ? ? ? ? ? ?mode_dev->panel_fixed_mode->vdisplay);
> - ? ? ? PSB_DEBUG_ENTRY(" hsync_start = %d\n",
> - ? ? ? ? ? ? ? ?mode_dev->panel_fixed_mode->hsync_start);
> - ? ? ? PSB_DEBUG_ENTRY(" hsync_end = %d\n",
> - ? ? ? ? ? ? ? ?mode_dev->panel_fixed_mode->hsync_end);
> - ? ? ? PSB_DEBUG_ENTRY(" htotal = %d\n",
> - ? ? ? ? ? ? ? ?mode_dev->panel_fixed_mode->htotal);
> - ? ? ? PSB_DEBUG_ENTRY(" vsync_start = %d\n",
> - ? ? ? ? ? ? ? ?mode_dev->panel_fixed_mode->vsync_start);
> - ? ? ? PSB_DEBUG_ENTRY(" vsync_end = %d\n",
> - ? ? ? ? ? ? ? ?mode_dev->panel_fixed_mode->vsync_end);
> - ? ? ? PSB_DEBUG_ENTRY(" vtotal = %d\n",
> - ? ? ? ? ? ? ? ?mode_dev->panel_fixed_mode->vtotal);
> - ? ? ? PSB_DEBUG_ENTRY(" clock = %d\n",
> - ? ? ? ? ? ? ? ?mode_dev->panel_fixed_mode->clock);
> -
> ? ? ? ?return;
>
> ?failed_find:
> diff --git a/drivers/staging/gma500/psb_intel_opregion.c b/drivers/staging/gma500/psb_intel_opregion.c
> index 65e3e9b..51cf1d6 100644
> --- a/drivers/staging/gma500/psb_intel_opregion.c
> +++ b/drivers/staging/gma500/psb_intel_opregion.c
> @@ -58,11 +58,8 @@ int psb_intel_opregion_init(struct drm_device *dev)
> ? ? ? ?dev_priv->lid_state = NULL;
>
> ? ? ? ?pci_read_config_dword(dev->pdev, 0xfc, &opregion_phy);
> - ? ? ? if (opregion_phy == 0) {
> - ? ? ? ? ? ? ? DRM_DEBUG("Opregion not supported, won't support lid-switch\n");
> + ? ? ? if (opregion_phy == 0)
> ? ? ? ? ? ? ? ?return -ENOTSUPP;
> - ? ? ? }
> - ? ? ? DRM_DEBUG("OpRegion detected at 0x%8x\n", opregion_phy);
>
> ? ? ? ?base = ioremap(opregion_phy, 8*1024);
> ? ? ? ?if (!base)
> @@ -70,8 +67,6 @@ int psb_intel_opregion_init(struct drm_device *dev)
>
> ? ? ? ?lid_state = base + 0x01ac;
>
> - ? ? ? DRM_DEBUG("Lid switch state 0x%08x\n", *lid_state);
> -
> ? ? ? ?dev_priv->lid_state = lid_state;
> ? ? ? ?dev_priv->lid_last_state = *lid_state;
> ? ? ? ?return 0;
> diff --git a/drivers/staging/gma500/psb_intel_sdvo.c b/drivers/staging/gma500/psb_intel_sdvo.c
> index df1c006..e313ce2 100644
> --- a/drivers/staging/gma500/psb_intel_sdvo.c
> +++ b/drivers/staging/gma500/psb_intel_sdvo.c
> @@ -107,14 +107,10 @@ static bool psb_intel_sdvo_read_byte(
>
> ? ? ? ?ret = i2c_transfer(&sdvo_priv->i2c_bus->adapter, msgs, 2);
> ? ? ? ?if (ret == 2) {
> - ? ? ? ? ? ? ? /* DRM_DEBUG("got back from addr %02X = %02x\n",
> - ? ? ? ? ? ? ? ?* out_buf[0], buf[0]);
> - ? ? ? ? ? ? ? ?*/
> ? ? ? ? ? ? ? ?*ch = buf[0];
> ? ? ? ? ? ? ? ?return true;
> ? ? ? ?}
>
> - ? ? ? DRM_DEBUG("i2c transfer returned %d\n", ret);
> ? ? ? ?return false;
> ?}
>
> @@ -205,24 +201,24 @@ static void psb_intel_sdvo_write_cmd(struct psb_intel_output *psb_intel_output,
> ? ? ? ?int i;
>
> ? ? ? ?if (0) {
> - ? ? ? ? ? ? ? DRM_DEBUG("%s: W: %02X ", SDVO_NAME(sdvo_priv), cmd);
> + ? ? ? ? ? ? ? printk(KERN_DEBUG "%s: W: %02X ", SDVO_NAME(sdvo_priv), cmd);
> ? ? ? ? ? ? ? ?for (i = 0; i < args_len; i++)
> - ? ? ? ? ? ? ? ? ? ? ? printk(KERN_INFO"%02X ", ((u8 *) args)[i]);
> + ? ? ? ? ? ? ? ? ? ? ? printk(KERN_CONT "%02X ", ((u8 *) args)[i]);
> ? ? ? ? ? ? ? ?for (; i < 8; i++)
> - ? ? ? ? ? ? ? ? ? ? ? printk(" ? ");
> + ? ? ? ? ? ? ? ? ? ? ? printk(KERN_CONT " ? ");
> ? ? ? ? ? ? ? ?for (i = 0;
> ? ? ? ? ? ? ? ? ? ? i <
> ? ? ? ? ? ? ? ? ? ? sizeof(sdvo_cmd_names) / sizeof(sdvo_cmd_names[0]);
> ? ? ? ? ? ? ? ? ? ? i++) {
> ? ? ? ? ? ? ? ? ? ? ? ?if (cmd == sdvo_cmd_names[i].cmd) {
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? printk("(%s)", sdvo_cmd_names[i].name);
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? printk(KERN_CONT "(%s)", sdvo_cmd_names[i].name);
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break;
> ? ? ? ? ? ? ? ? ? ? ? ?}
> ? ? ? ? ? ? ? ?}
> ? ? ? ? ? ? ? ?if (i ==
> ? ? ? ? ? ? ? ? ? ?sizeof(sdvo_cmd_names) / sizeof(sdvo_cmd_names[0]))
> - ? ? ? ? ? ? ? ? ? ? ? printk("(%02X)", cmd);
> - ? ? ? ? ? ? ? printk("\n");
> + ? ? ? ? ? ? ? ? ? ? ? printk(KERN_CONT "(%02X)", cmd);
> + ? ? ? ? ? ? ? printk(KERN_CONT "\n");
> ? ? ? ?}
>
> ? ? ? ?for (i = 0; i < args_len; i++) {
> @@ -267,17 +263,17 @@ static u8 psb_intel_sdvo_read_response(
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &status);
>
> ? ? ? ? ? ? ? ?if (0) {
> - ? ? ? ? ? ? ? ? ? ? ? DRM_DEBUG("%s: R: ", SDVO_NAME(sdvo_priv));
> + ? ? ? ? ? ? ? ? ? ? ? pr_debug("%s: R: ", SDVO_NAME(sdvo_priv));
> ? ? ? ? ? ? ? ? ? ? ? ?for (i = 0; i < response_len; i++)
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? printk(KERN_INFO"%02X ", ((u8 *) response)[i]);
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? printk(KERN_CONT "%02X ", ((u8 *) response)[i]);
> ? ? ? ? ? ? ? ? ? ? ? ?for (; i < 8; i++)
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?printk(" ? ");
> ? ? ? ? ? ? ? ? ? ? ? ?if (status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP)
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? printk(KERN_INFO"(%s)",
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? printk(KERN_CONT "(%s)",
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cmd_status_names[status]);
> ? ? ? ? ? ? ? ? ? ? ? ?else
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? printk(KERN_INFO"(??? %d)", status);
> - ? ? ? ? ? ? ? ? ? ? ? printk("\n");
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? printk(KERN_CONT "(??? %d)", status);
> + ? ? ? ? ? ? ? ? ? ? ? printk(KERN_CONT "\n");
> ? ? ? ? ? ? ? ?}
>
> ? ? ? ? ? ? ? ?if (status != SDVO_CMD_STATUS_PENDING)
> @@ -997,7 +993,6 @@ int psb_intel_sdvo_supports_hotplug(struct drm_connector *connector)
> ? ? ? ?u8 response[2];
> ? ? ? ?u8 status;
> ? ? ? ?struct psb_intel_output *psb_intel_output;
> - ? ? ? DRM_DEBUG("\n");
>
> ? ? ? ?if (!connector)
> ? ? ? ? ? ? ? ?return 0;
> @@ -1198,7 +1193,7 @@ void psb_intel_sdvo_init(struct drm_device *dev, int output_device)
> ? ? ? ?/* Read the regs to test if we can talk to the device */
> ? ? ? ?for (i = 0; i < 0x40; i++) {
> ? ? ? ? ? ? ? ?if (!psb_intel_sdvo_read_byte(psb_intel_output, i, &ch[i])) {
> - ? ? ? ? ? ? ? ? ? ? ? DRM_DEBUG("No SDVO device found on SDVO%c\n",
> + ? ? ? ? ? ? ? ? ? ? ? dev_dbg(dev->dev, "No SDVO device found on SDVO%c\n",
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?output_device == SDVOB ? 'B' : 'C');
> ? ? ? ? ? ? ? ? ? ? ? ?goto err_i2c;
> ? ? ? ? ? ? ? ?}
> @@ -1242,8 +1237,7 @@ void psb_intel_sdvo_init(struct drm_device *dev, int output_device)
> ? ? ? ? ? ? ? ?unsigned char bytes[2];
>
> ? ? ? ? ? ? ? ?memcpy(bytes, &sdvo_priv->caps.output_flags, 2);
> - ? ? ? ? ? ? ? DRM_DEBUG
> - ? ? ? ? ? ? ? ? ? ("%s: No active RGB or TMDS outputs (0x%02x%02x)\n",
> + ? ? ? ? ? ? ? dev_dbg(dev->dev, "%s: No active RGB or TMDS outputs (0x%02x%02x)\n",
> ? ? ? ? ? ? ? ? ? ? SDVO_NAME(sdvo_priv), bytes[0], bytes[1]);
> ? ? ? ? ? ? ? ?goto err_i2c;
> ? ? ? ?}
> @@ -1267,7 +1261,7 @@ void psb_intel_sdvo_init(struct drm_device *dev, int output_device)
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? pixel_clock_max);
>
>
> - ? ? ? DRM_DEBUG("%s device VID/DID: %02X:%02X.%02X, "
> + ? ? ? dev_dbg(dev->dev, "%s device VID/DID: %02X:%02X.%02X, "
> ? ? ? ? ? ? ? ? ?"clock range %dMHz - %dMHz, "
> ? ? ? ? ? ? ? ? ?"input 1: %c, input 2: %c, "
> ? ? ? ? ? ? ? ? ?"output 1: %c, output 2: %c\n",
> diff --git a/drivers/staging/gma500/psb_irq.c b/drivers/staging/gma500/psb_irq.c
> index 9ea37e5..1cbfeb6 100644
> --- a/drivers/staging/gma500/psb_irq.c
> +++ b/drivers/staging/gma500/psb_irq.c
> @@ -187,7 +187,8 @@ static void mid_pipe_event_handler(struct drm_device *dev, uint32_t pipe)
> ? ? ? ?}
>
> ? ? ? ?if (i == WAIT_STATUS_CLEAR_LOOP_COUNT)
> - ? ? ? ? ? ? ? DRM_ERROR("%s, can't clear the status bits in pipe_stat_reg, its value = 0x%x.\n",
> + ? ? ? ? ? ? ? dev_err(dev->dev,
> + ? ? ? "%s, can't clear the status bits in pipe_stat_reg, its value = 0x%x.\n",
> ? ? ? ? ? ? ? ? ? ? ? ?__func__, PSB_RVDC32(pipe_stat_reg));
>
> ? ? ? ?if (pipe_stat_val & PIPE_VBLANK_STATUS)
> @@ -219,21 +220,11 @@ irqreturn_t psb_irq_handler(DRM_IRQ_ARGS)
>
> ? ? ? ?vdc_stat = PSB_RVDC32(PSB_INT_IDENTITY_R);
>
> - ? ? ? if (vdc_stat & _MDFLD_DISP_ALL_IRQ_FLAG) {
> - ? ? ? ? ? ? ? PSB_DEBUG_IRQ("Got DISP interrupt\n");
> + ? ? ? if (vdc_stat & _MDFLD_DISP_ALL_IRQ_FLAG)
> ? ? ? ? ? ? ? ?dsp_int = 1;
> - ? ? ? }
>
> - ? ? ? if (vdc_stat & _PSB_IRQ_SGX_FLAG) {
> - ? ? ? ? ? ? ? PSB_DEBUG_IRQ("Got SGX interrupt\n");
> + ? ? ? if (vdc_stat & _PSB_IRQ_SGX_FLAG)
> ? ? ? ? ? ? ? ?sgx_int = 1;
> - ? ? ? }
> - ? ? ? if (vdc_stat & _PSB_IRQ_MSVDX_FLAG)
> - ? ? ? ? ? ? ? PSB_DEBUG_IRQ("Got MSVDX interrupt\n");
> -
> - ? ? ? if (vdc_stat & _LNC_IRQ_TOPAZ_FLAG)
> - ? ? ? ? ? ? ? PSB_DEBUG_IRQ("Got TOPAZ interrupt\n");
> -
>
> ? ? ? ?vdc_stat &= dev_priv->vdc_irq_mask;
> ? ? ? ?spin_unlock(&dev_priv->irqmask_lock);
> @@ -293,8 +284,6 @@ int psb_irq_postinstall(struct drm_device *dev)
> ? ? ? ? ? ?(struct drm_psb_private *) dev->dev_private;
> ? ? ? ?unsigned long irqflags;
>
> - ? ? ? PSB_DEBUG_ENTRY("\n");
> -
> ? ? ? ?spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags);
>
> ? ? ? ?/* This register is safe even if display island is off */
> @@ -326,8 +315,6 @@ void psb_irq_uninstall(struct drm_device *dev)
> ? ? ? ? ? ?(struct drm_psb_private *) dev->dev_private;
> ? ? ? ?unsigned long irqflags;
>
> - ? ? ? PSB_DEBUG_ENTRY("\n");
> -
> ? ? ? ?spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags);
>
> ? ? ? ?PSB_WVDC32(0xFFFFFFFF, PSB_HWSTAM);
> @@ -395,8 +382,6 @@ int psb_irq_enable_dpst(struct drm_device *dev)
> ? ? ? ? ? ? ? ?(struct drm_psb_private *) dev->dev_private;
> ? ? ? ?unsigned long irqflags;
>
> - ? ? ? PSB_DEBUG_ENTRY("\n");
> -
> ? ? ? ?spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags);
>
> ? ? ? ?/* enable DPST */
> @@ -435,8 +420,6 @@ int psb_irq_disable_dpst(struct drm_device *dev)
> ? ? ? ? ? ?(struct drm_psb_private *) dev->dev_private;
> ? ? ? ?unsigned long irqflags;
>
> - ? ? ? PSB_DEBUG_ENTRY("\n");
> -
> ? ? ? ?spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags);
>
> ? ? ? ?mid_disable_pipe_event(dev_priv, 0);
> @@ -472,8 +455,6 @@ int psb_enable_vblank(struct drm_device *dev, int pipe)
> ? ? ? ?uint32_t reg_val = 0;
> ? ? ? ?uint32_t pipeconf_reg = mid_pipeconf(pipe);
>
> - ? ? ? PSB_DEBUG_ENTRY("\n");
> -
> ? ? ? ?if (gma_power_begin(dev, false)) {
> ? ? ? ? ? ? ? ?reg_val = REG_READ(pipeconf_reg);
> ? ? ? ? ? ? ? ?gma_power_end(dev);
> @@ -500,8 +481,6 @@ void psb_disable_vblank(struct drm_device *dev, int pipe)
> ? ? ? ?struct drm_psb_private *dev_priv = dev->dev_private;
> ? ? ? ?unsigned long irqflags;
>
> - ? ? ? PSB_DEBUG_ENTRY("\n");
> -
> ? ? ? ?spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags);
>
> ? ? ? ?mid_disable_pipe_event(dev_priv, pipe);
> @@ -535,7 +514,7 @@ u32 psb_get_vblank_counter(struct drm_device *dev, int pipe)
> ? ? ? ? ? ? ? ?pipeconf_reg = PIPECCONF;
> ? ? ? ? ? ? ? ?break;
> ? ? ? ?default:
> - ? ? ? ? ? ? ? DRM_ERROR("%s, invalded pipe.\n", __func__);
> + ? ? ? ? ? ? ? dev_err(dev->dev, "%s, invalid pipe.\n", __func__);
> ? ? ? ? ? ? ? ?return 0;
> ? ? ? ?}
>
> @@ -545,7 +524,7 @@ u32 psb_get_vblank_counter(struct drm_device *dev, int pipe)
> ? ? ? ?reg_val = REG_READ(pipeconf_reg);
>
> ? ? ? ?if (!(reg_val & PIPEACONF_ENABLE)) {
> - ? ? ? ? ? ? ? DRM_ERROR("trying to get vblank count for disabled pipe %d\n",
> + ? ? ? ? ? ? ? dev_err(dev->dev, "trying to get vblank count for disabled pipe %d\n",
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?pipe);
> ? ? ? ? ? ? ? ?goto psb_get_vblank_counter_exit;
> ? ? ? ?}
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at ?http://www.tux.org/lkml/
>
On Thu, 9 Jun 2011 03:10:03 +0200
Patrik Jakobsson <[email protected]> wrote:
> Hi Alan
>
> Just a thought. Shouldn't we use the DRM macros for printing debug info?
Linux has perfectly good printing functions and using them means we can
use dev_dbg() which supports things like nice runtime switching.
On Thu, 2011-06-09 at 09:11 +0100, Alan Cox wrote:
> On Thu, 9 Jun 2011 03:10:03 +0200
> Patrik Jakobsson <[email protected]> wrote:
>
> > Hi Alan
> >
> > Just a thought. Shouldn't we use the DRM macros for printing debug info?
>
> Linux has perfectly good printing functions and using them means we can
> use dev_dbg() which supports things like nice runtime switching.
You mean like the drm debug functions runtime switching? that predated
the kernel ones and nobody ever ported :-)
Though if psb wants to be different to other drm drivers it can lead the
way, though it'll be a total nightmare for all the people who follow
documentation on how to debug drm drivers using drm.debug=1,2,4,8. for
various code paths.
Dave.
On Thu, Jun 9, 2011 at 12:36 PM, Dave Airlie wrote:
> On Thu, 2011-06-09 at 09:11 +0100, Alan Cox wrote:
>> On Thu, 9 Jun 2011 03:10:03 +0200
>> Patrik Jakobsson wrote:
>>
>> > Hi Alan
>> >
>> > Just a thought. Shouldn't we use the DRM macros for printing debug info?
>>
>> Linux has perfectly good printing functions and using them means we can
>> use dev_dbg() which supports things like nice runtime switching.
>
> You mean like the drm debug functions runtime switching? that predated
> the kernel ones and nobody ever ported :-)
>
> Though if psb wants to be different to other drm drivers it can lead the
> way, though it'll be a total nightmare for all the people who follow
> documentation on how to debug drm drivers using drm.debug=1,2,4,8. for
> various code paths.
Yes, my concern was about drm.debug and use of all the DRM portability stuff
(like using DRM_IRQ_HANDLED instead of IRQ_HANDLED, etc...)
The portability might not be important at this point but I just wanted to raise
the question so I know what is right / wrong.
Alan, I've been working on the output code but think I've reached a dead end.
I'm up to 20000 lines of changes and it's just a big mess. I'm gonna go for
slowly fixing up the current code instead. I also got my hands on a laptop
with a gma500 so I can test that my changes doesn't break LVDS. Stay tuned.
Thanks
> Though if psb wants to be different to other drm drivers it can lead the
> way, though it'll be a total nightmare for all the people who follow
> documentation on how to debug drm drivers using drm.debug=1,2,4,8. for
> various code paths.
Actually it seems to work out nicely because you can debug DRM core
goings on and driver goings on separately. Also the driver ones can be
turned on/off on their own at runtime which is a godsend.
As you can imagine I've been testing the debugging a fair bit !
Alan
> Yes, my concern was about drm.debug and use of all the DRM portability stuff
> (like using DRM_IRQ_HANDLED instead of IRQ_HANDLED, etc...)
>
> The portability might not be important at this point but I just wanted to raise
> the question so I know what is right / wrong.
The gma500 driver uses a lot of direct Linux services rather than
disappearing into the weird world of drm_mm and the like so any
portability is going to be a bit of an illusion at best.
If someone ports it to another GPL licensed OS then I may have to
reconsider a bit, we shall see.
> Alan, I've been working on the output code but think I've reached a dead end.
> I'm up to 20000 lines of changes and it's just a big mess. I'm gonna go for
> slowly fixing up the current code instead. I also got my hands on a laptop
> with a gma500 so I can test that my changes doesn't break LVDS. Stay tuned.
Will do. Got another chunk of patches to fire at Greg shortly and I've
now beaten pretty much all of it into passing CodingStyle so hopefully
any noise will settle down at that point.
Still not ready to leave staging, passing CodingStyle and being clean are
not quite the same thing in this case !
Hi Alan.
On Thu, Jun 9, 2011 at 14:04, Alan Cox <[email protected]> wrote:
> The gma500 driver uses a lot of direct Linux services rather than
> disappearing into the weird world of drm_mm and the like so any
> portability is going to be a bit of an illusion at best.
Given that I've mucked around in drm_mm quite a bit I'd be very interested
in your opinion about what's weird in it (and presumably what could be
improved). Can you elaborate?
Thanks a lot, Daniel
--
Daniel Vetter
[email protected] - +41 (0) 79 364 57 48 - http://blog.ffwll.ch
> Given that I've mucked around in drm_mm quite a bit I'd be very interested
> in your opinion about what's weird in it (and presumably what could be
> improved). Can you elaborate?
Mostly the API, which is also somewhat poorly documented. I've not dug
into the internals beyond trying to figure out how to use it. Looking at
the users the API is non-obvious, the interface involves a mix of calls
and digging deep into struct internals.
I'd have expected an API that had allocate/free type methods and exposed
the needed information directly or very easily not one that has drivers
doing. drm_sman seems to be attempt in that direction but its also rather
odd with interfaces like
item = drm_sman_alloc(&dev_priv->sman, mem->type, tmpSize, 0,
(unsigned long)file_priv);
mutex_unlock(&dev->struct_mutex);
if (item) {
mem->offset = ((mem->type == VIA_MEM_VIDEO) ?
dev_priv->vram_offset :
dev_priv->agp_offset) + (item->mm->
offset(item->mm, item->mm_info) <<
VIA_MM_ALIGN_SHIFT); mem->index = item->user_hash.key;
where the item->... gymnastics are spectacular to say the least given the
basic function of the allocator appears to be to provide said offset in
the first place.
And ultimately this is why I went with using allocate_region and friends
plus using GEM to do handles, which was a good choice for other reasons
as GEM is rather nicely designed barring the lack of a couple of helpers
and the few lines needed to split the shmem/handle abstraction properly.
Possibly drm_sman and friends should just wrap whatever simple native
allocator exists on the OS ?
Alan
On Mon, Jun 13, 2011 at 04:44:03PM +0100, Alan Cox wrote:
> > Given that I've mucked around in drm_mm quite a bit I'd be very interested
> > in your opinion about what's weird in it (and presumably what could be
> > improved). Can you elaborate?
>
> Mostly the API, which is also somewhat poorly documented. I've not dug
> into the internals beyond trying to figure out how to use it. Looking at
> the users the API is non-obvious, the interface involves a mix of calls
> and digging deep into struct internals.
Well, I've rewritten the api but that transition is not yet complete, i.e.
the new interface is there, but no driver is converted yet. The old api
has a two-step allocation (search_free + get_block) and frees allocated
ranges with put_block. The new api has just insert_node and remove_node,
struct drm_mm_node must be allocated by the caller (to get rid of the racy
preallocation scheme and allow embedding of drm_mm_node).
There's also the lru scanning helpers (only used by intel). Under specific
conditions (should be all documented in comments) this can be used as an
eviction roaster.
Generally only node->start should be used by drivers, otherwise
drm_mm_node should be opaque. At least that's the idea.
btw, old conversion patches for i915 to the new interface are at:
http://cgit.freedesktop.org/~danvet/drm/log/?h=embed-gtt-space
When creating the new interfaces I've tried to document them. Ideas to
improve that highly welcome.
> I'd have expected an API that had allocate/free type methods and exposed
> the needed information directly or very easily not one that has drivers
> doing. drm_sman seems to be attempt in that direction but its also rather
> odd with interfaces like
Should be fixed, see above ;-)
[snip]
> Possibly drm_sman and friends should just wrap whatever simple native
> allocator exists on the OS ?
Well, drm_mm has some graphics specific magic (range restricted scans and
the eviction helpers). But simpler stuff like sman is imo just "drm likes
to reinvent the wheel". Unfortunately I don't have the hw, so I haven't
dared to touch it (the snippet you've posted is a prime example why).
Yours, Daniel
--
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48