rpms/kernel/devel drm-modesetting-radeon.patch, 1.64, 1.65 kernel.spec, 1.1419, 1.1420

Dave Airlie airlied at fedoraproject.org
Thu Mar 12 01:45:21 UTC 2009


Author: airlied

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv23607

Modified Files:
	drm-modesetting-radeon.patch kernel.spec 
Log Message:
* Thu Mar 12 2009 Dave Airlie <airlied at redhat.com>
- radeon kms - bug fix irq and ib handling on r300 + suspend test hook
- fix sparc build with kms from spot


drm-modesetting-radeon.patch:

Index: drm-modesetting-radeon.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/drm-modesetting-radeon.patch,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- drm-modesetting-radeon.patch	10 Mar 2009 01:09:12 -0000	1.64
+++ drm-modesetting-radeon.patch	12 Mar 2009 01:45:19 -0000	1.65
@@ -1,3 +1,59 @@
+commit 35b84c0dc0b9c007e542a448417f0341ddf78cd1
+Author: Dave Airlie <airlied at redhat.com>
+Date:   Thu Mar 12 11:39:05 2009 +1000
+
+    drm/radeon: Don't try to use agp symbols if we don't have AGP
+    
+    The radeon_buffer.c addition that gets pulled into the DRM driver as
+    part of Kernel Mode Setting (even if you disable KMS for the Radeon
+    driver) was assuming that it was safe to use symbols from the AGP code,
+    but that isn't safe on platforms where __OS_HAS_AGP is 0. Such as
+    sparc64. :)
+    
+    This patch gets the code building again. It probably should go into the
+    actual kms patch, but if you would prefer this go as a separate patch, I
+    can apply it. With this, we can get rawhide building for sparc64, so I'm
+    eager to see it applied in one way or another.
+    
+    Signed-off-by: Tom "spot" Callaway <tcallawa at redhat.com>
+
+commit 547fe8513d4058efb8fe0eed856c7531305b320f
+Author: Dave Airlie <airlied at dhcp-1-203.bne.redhat.com>
+Date:   Thu Mar 12 10:58:05 2009 +1000
+
+    radeon: fixup the IB getting routine
+    
+    This makes the IB get routine a lot smarter and hopefully
+    fixes some cases where it exits
+
+commit 7d0361c240495ee5ed5c5a4490084dc258e1eda2
+Author: Dave Airlie <airlied at dhcp-1-203.bne.redhat.com>
+Date:   Thu Mar 12 10:57:17 2009 +1000
+
+    radeon: loop inside irq handler.
+    
+    This makes us not leave the irq handler until we are finished.
+    
+    it appears there is a race with getting interrupts and clearing them somewhere
+    
+    only happens on r300 hw for me
+
+commit 7dab6d7b968d623b3c2f99173590f17c7cc248b6
+Author: Dave Airlie <airlied at redhat.com>
+Date:   Wed Mar 11 18:50:06 2009 +1000
+
+    radeon: add suspend test hook
+    
+    this debugfs entry just does a driver suspend then resume cycle
+
+commit 2c1f8464844f8760563e70499de38a8070031d9e
+Author: Dave Airlie <airlied at redhat.com>
+Date:   Wed Mar 11 11:40:13 2009 +1000
+
+    drm: add page alloc debugging for the page allocator
+    
+    this just prints the page counts in debugfs
+
 commit 85510fb358cb3c0e3d526a93389a8d847b7398c0
 Author: Dave Airlie <airlied at redhat.com>
 Date:   Tue Mar 10 19:01:37 2009 +1000
@@ -5106,6 +5162,18 @@
 +	}
 +}
 +EXPORT_SYMBOL(drm_helper_set_connector_dpms);
+diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
+index c77c6c6..2cba5f5 100644
+--- a/drivers/gpu/drm/drm_debugfs.c
++++ b/drivers/gpu/drm/drm_debugfs.c
+@@ -48,6 +48,7 @@ static struct drm_info_list drm_debugfs_list[] = {
+ 	{"bufs", drm_bufs_info, 0},
+ 	{"gem_names", drm_gem_name_info, DRIVER_GEM},
+ 	{"gem_objects", drm_gem_object_info, DRIVER_GEM},
++	{"page_alloc", drm_page_alloc_info, 0},
+ #if DRM_DEBUG_CODE
+ 	{"vma", drm_vma_info, 0},
+ #endif
 diff --git a/drivers/gpu/drm/drm_dma.c b/drivers/gpu/drm/drm_dma.c
 index 7a8e2fb..0b2df71 100644
 --- a/drivers/gpu/drm/drm_dma.c
@@ -5747,6 +5815,32 @@
  	list_del(&file_priv->lhead);
  	mutex_unlock(&dev->struct_mutex);
  
+diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c
+index 60a1b6c..c6bde4c 100644
+--- a/drivers/gpu/drm/drm_info.c
++++ b/drivers/gpu/drm/drm_info.c
+@@ -35,6 +35,7 @@
+ 
+ #include <linux/seq_file.h>
+ #include "drmP.h"
++#include "drm_page_alloc.h"
+ 
+ /**
+  * Called when "/proc/dri/.../name" is read.
+@@ -273,6 +274,13 @@ int drm_gem_object_info(struct seq_file *m, void* data)
+ 	return 0;
+ }
+ 
++int drm_page_alloc_info(struct seq_file *m, void *data)
++{
++	seq_printf(m, "Cached: %d/%d\n", drm_page_alloc_data.cached_pages_in_list, drm_page_alloc_data.total_cached_pages);
++	seq_printf(m, "Uncached: %d/%d\n", drm_page_alloc_data.uncached_pages_in_list, drm_page_alloc_data.total_uncached_pages);
++	return 0;
++}
++
+ #if DRM_DEBUG_CODE
+ 
+ int drm_vma_info(struct seq_file *m, void *data)
 diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c
 index 0c707f5..4942f9d 100644
 --- a/drivers/gpu/drm/drm_memory.c
@@ -5874,10 +5968,10 @@
  static void *agp_remap(unsigned long offset, unsigned long size,
 diff --git a/drivers/gpu/drm/drm_page_alloc.c b/drivers/gpu/drm/drm_page_alloc.c
 new file mode 100644
-index 0000000..cbbd966
+index 0000000..fad6ae3
 --- /dev/null
 +++ b/drivers/gpu/drm/drm_page_alloc.c
-@@ -0,0 +1,158 @@
+@@ -0,0 +1,171 @@
 +/*
 + * Copyright (c) Red Hat Inc.
 +
@@ -5914,13 +6008,15 @@
 +#include "drmP.h"
 +#include <asm/agp.h>
 +
++#include "drm_page_alloc.h"
++
 +static struct list_head uncached_free_list;
 +static struct list_head cached_free_list;
 +
 +static struct mutex page_alloc_mutex;
 +static int page_alloc_inited;
-+static int total_uncached_pages;
-+static int total_cached_pages;
++
++struct drm_page_alloc_usage drm_page_alloc_data;
 +
 +/* add 1MB at a time */
 +#define NUM_PAGES_TO_ADD 256
@@ -5957,10 +6053,12 @@
 +			map_page_into_agp(page);
 +#endif
 +			list_add(&page->lru, &uncached_free_list);
-+			total_uncached_pages++;
++			drm_page_alloc_data.total_uncached_pages++;
++			drm_page_alloc_data.uncached_pages_in_list++;
 +		} else {
 +			list_add(&page->lru, &cached_free_list);
-+			total_cached_pages++;
++			drm_page_alloc_data.total_cached_pages++;
++			drm_page_alloc_data.cached_pages_in_list++;
 +		}
 +	}
 +	return i;
@@ -5983,6 +6081,10 @@
 +
 +	page = list_first_entry(free_list, struct page, lru);
 +	list_del(&page->lru);
++	if (cached)
++		drm_page_alloc_data.cached_pages_in_list--;
++	else
++		drm_page_alloc_data.uncached_pages_in_list--;
 +
 +	mutex_unlock(&page_alloc_mutex);
 +	return page;
@@ -5991,10 +6093,13 @@
 +void drm_put_page(struct page *page, int cached)
 +{
 +	mutex_lock(&page_alloc_mutex);
-+	if (cached)
++	if (cached) {
++		drm_page_alloc_data.cached_pages_in_list++;
 +		list_add(&page->lru, &cached_free_list);
-+	else
++	} else {
++		drm_page_alloc_data.uncached_pages_in_list++;
 +		list_add(&page->lru, &uncached_free_list);
++	}
 +	mutex_unlock(&page_alloc_mutex);
 +}
 +
@@ -6009,6 +6114,8 @@
 +		list_del(&page->lru);
 +		drm_page_put(page, cached);
 +	}
++	drm_page_alloc_data.total_cached_pages = 0;
++	drm_page_alloc_data.total_uncached_pages = 0;
 +}
 +
 +int drm_page_alloc_init(void)
@@ -6036,6 +6143,45 @@
 +	drm_release_all_pages(1);
 +}
 +
+diff --git a/drivers/gpu/drm/drm_page_alloc.h b/drivers/gpu/drm/drm_page_alloc.h
+new file mode 100644
+index 0000000..9cf1138
+--- /dev/null
++++ b/drivers/gpu/drm/drm_page_alloc.h
+@@ -0,0 +1,33 @@
++/*
++ * Copyright (c) Red Hat Inc.
++
++ * Permission is hereby granted, free of charge, to any person obtaining a
++ * copy of this software and associated documentation files (the "Software"),
++ * to deal in the Software without restriction, including without limitation
++ * the rights to use, copy, modify, merge, publish, distribute, sub license,
++ * and/or sell copies of the Software, and to permit persons to whom the
++ * Software is furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice (including the
++ * next paragraph) shall be included in all copies or substantial portions
++ * of the Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
++ * DEALINGS IN THE SOFTWARE.
++ *
++ * Authors: Dave Airlie <airlied at redhat.com>
++ */
++
++struct drm_page_alloc_usage {
++	int total_uncached_pages;
++	int total_cached_pages;
++	int cached_pages_in_list;
++	int uncached_pages_in_list;
++};
++
++extern struct drm_page_alloc_usage drm_page_alloc_data;
 diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
 index d009661..5d45cbf 100644
 --- a/drivers/gpu/drm/drm_stub.c
@@ -15701,10 +15847,10 @@
 +}
 diff --git a/drivers/gpu/drm/radeon/radeon_buffer.c b/drivers/gpu/drm/radeon/radeon_buffer.c
 new file mode 100644
-index 0000000..bd5761a
+index 0000000..86ab054
 --- /dev/null
 +++ b/drivers/gpu/drm/radeon/radeon_buffer.c
-@@ -0,0 +1,456 @@
+@@ -0,0 +1,457 @@
 +/**************************************************************************
 + * 
 + * Copyright 2007 Dave Airlie
@@ -15743,10 +15889,11 @@
 +struct drm_ttm_backend *radeon_create_ttm_backend_entry(struct drm_device * dev)
 +{
 +	drm_radeon_private_t *dev_priv = dev->dev_private;
-+
++#if __OS_HAS_AGP
 +	if (dev_priv->flags & RADEON_IS_AGP)
 +		return drm_agp_init_ttm(dev);
 +	else
++#endif
 +		return ati_pcigart_init_ttm(dev, &dev_priv->gart_info, radeon_gart_flush);
 +}
 +
@@ -24795,10 +24942,10 @@
 +
 diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
 new file mode 100644
-index 0000000..9ba22e2
+index 0000000..f2b6931
 --- /dev/null
 +++ b/drivers/gpu/drm/radeon/radeon_gem.c
-@@ -0,0 +1,1568 @@
+@@ -0,0 +1,1574 @@
 +/*
 + * Copyright 2008 Red Hat Inc.
 + *
@@ -26036,48 +26183,54 @@
 +	return ret;
 +}
 +
++/* check the free list - if nothing update the free list without waiting
++ * if still nothing block until we get something */
 +int radeon_gem_ib_get(struct drm_radeon_cs_parser *parser)
 +{
 +	int i, index = -1;
 +	int ret;
 +	int no_wait = 1;
 +	drm_radeon_private_t *dev_priv = parser->dev->dev_private;
++	int pass = 0;
 +
-+	for (i = 0; i < RADEON_NUM_IB; i++) {
++restart_find:
++	if (pass == 1)
++		no_wait = 0;
 +
++	for (i = 0; i < RADEON_NUM_IB; i++) {
 +		if (!(dev_priv->ib_alloc_bitmap & (1 << i))){
 +			index = i;
 +			break;
 +		}
 +	}
 +
-+retry_wait:
-+	/* if all in use we need to wait */
 +	if (index == -1) {
++		/* if all in use do a first pass over them - non waiting */
 +		for (i = 0; i < RADEON_NUM_IB; i++) {
 +			if (dev_priv->ib_alloc_bitmap & (1 << i)) {
 +				mutex_lock(&dev_priv->ib_objs[i]->bo->mutex);
 +				ret = drm_bo_wait(dev_priv->ib_objs[i]->bo, 0, 1, no_wait, 0);
 +				mutex_unlock(&dev_priv->ib_objs[i]->bo->mutex);
++				if (ret == -EAGAIN)
++					goto restart_find;
 +				if (ret)
 +					continue;
 +				dev_priv->ib_alloc_bitmap &= ~(1 << i);
-+				index = i;
-+				break;
++				if (pass == 1) {
++					index = i;
++					break;
++				}
 +			}
 +		}
++		pass++;
++		if (pass < 2)
++			goto restart_find;
 +	}
 +
-+	if (index == -1 && no_wait == 1) {
-+		no_wait = 0;
-+		goto retry_wait;
-+	}
-+
-+	if (index == -1 && no_wait == 0) {
++	if (index == -1) {
 +		DRM_ERROR("Major case fail to allocate IB from freelist %llx\n", dev_priv->ib_alloc_bitmap);
 +		return -EINVAL;
 +	}
-+		
 +
 +	if (parser->chunks[parser->ib_index].length_dw > RADEON_IB_SIZE / sizeof(uint32_t))
 +		return -EINVAL;
@@ -26369,10 +26522,10 @@
 +
 diff --git a/drivers/gpu/drm/radeon/radeon_gem_debugfs.c b/drivers/gpu/drm/radeon/radeon_gem_debugfs.c
 new file mode 100644
-index 0000000..d685d5b
+index 0000000..93f36ce
 --- /dev/null
 +++ b/drivers/gpu/drm/radeon/radeon_gem_debugfs.c
-@@ -0,0 +1,165 @@
+@@ -0,0 +1,179 @@
 +/*
 + * Copyright © 2008 Intel Corporation
 + *
@@ -26516,10 +26669,24 @@
 +	return 0;
 +}
 +
++static int radeon_suspend_test(struct seq_file *m, void *data)
++{
++	struct drm_info_node *node = (struct drm_info_node *) m->private;
++	struct drm_device *dev = node->minor->dev;
++	pm_message_t msg;
++
++	msg.event = PM_EVENT_USER_SUSPEND;
++	radeon_suspend(dev, msg);
++	radeon_resume(dev);
++	
++	return 0;
++}
++
 +static struct drm_info_list radeon_gem_debugfs_list[] = {
 +	{"radeon_gem_interrupt", radeon_interrupt_info, 0, NULL},
 +	{"radeon_gem_ring", radeon_ring_info, 0, NULL},
 +	{"radeon_gem_ib", radeon_ib_info, 0, NULL},
++	{"radeon_suspend_test", radeon_suspend_test, 0, NULL},
 +};
 +
 +
@@ -26740,26 +26907,65 @@
 +}
 +
 diff --git a/drivers/gpu/drm/radeon/radeon_irq.c b/drivers/gpu/drm/radeon/radeon_irq.c
-index 9836c70..26ee45e 100644
+index 9836c70..b6f5786 100644
 --- a/drivers/gpu/drm/radeon/radeon_irq.c
 +++ b/drivers/gpu/drm/radeon/radeon_irq.c
-@@ -195,11 +195,14 @@ irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS)
+@@ -154,11 +154,10 @@ static inline u32 radeon_acknowledge_irqs(drm_radeon_private_t *dev_priv, u32 *r
+ 	} else
+ 		irq_mask |= RADEON_CRTC_VBLANK_STAT | RADEON_CRTC2_VBLANK_STAT;
+ 
+-	irqs &=	irq_mask;
+-
+ 	if (irqs)
+ 		RADEON_WRITE(RADEON_GEN_INT_STATUS, irqs);
+ 
++	irqs &=	irq_mask;
+ 	return irqs;
+ }
+ 
+@@ -195,41 +194,49 @@ irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS)
  	if (!stat)
  		return IRQ_NONE;
  
-+	atomic_inc(&dev_priv->irq_received);
- 	stat &= dev_priv->irq_enable_reg;
+-	stat &= dev_priv->irq_enable_reg;
++	while (stat) {
++		atomic_inc(&dev_priv->irq_received);
++		stat &= dev_priv->irq_enable_reg;
  
- 	/* SW interrupt */
+-	/* SW interrupt */
 -	if (stat & RADEON_SW_INT_TEST)
-+	if (stat & RADEON_SW_INT_TEST) {
- 		DRM_WAKEUP(&dev_priv->swi_queue);
-+		radeon_fence_handler(dev);
-+	}
+-		DRM_WAKEUP(&dev_priv->swi_queue);
++		/* SW interrupt */
++		if (stat & RADEON_SW_INT_TEST) {
++			DRM_WAKEUP(&dev_priv->swi_queue);
++			radeon_fence_handler(dev);
++		}
  
- 	/* VBLANK interrupt */
- 	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS600) {
-@@ -216,20 +219,23 @@ irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS)
+-	/* VBLANK interrupt */
+-	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS600) {
+-		if (r500_disp_int & R500_D1_VBLANK_INTERRUPT)
+-			drm_handle_vblank(dev, 0);
+-		if (r500_disp_int & R500_D2_VBLANK_INTERRUPT)
+-			drm_handle_vblank(dev, 1);
+-	} else {
+-		if (stat & RADEON_CRTC_VBLANK_STAT)
+-			drm_handle_vblank(dev, 0);
+-		if (stat & RADEON_CRTC2_VBLANK_STAT)
+-			drm_handle_vblank(dev, 1);
++		/* VBLANK interrupt */
++		if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS600) {
++			if (r500_disp_int & R500_D1_VBLANK_INTERRUPT)
++				drm_handle_vblank(dev, 0);
++			if (r500_disp_int & R500_D2_VBLANK_INTERRUPT)
++				drm_handle_vblank(dev, 1);
++		} else {
++			if (stat & RADEON_CRTC_VBLANK_STAT)
++				drm_handle_vblank(dev, 0);
++			if (stat & RADEON_CRTC2_VBLANK_STAT)
++				drm_handle_vblank(dev, 1);
++		}
++		stat = radeon_acknowledge_irqs(dev_priv, &r500_disp_int);
+ 	}
  	return IRQ_HANDLED;
  }
  
@@ -26768,7 +26974,6 @@
  {
  	drm_radeon_private_t *dev_priv = dev->dev_private;
  	unsigned int ret;
-+	int i;
  	RING_LOCALS;
  
 -	atomic_inc(&dev_priv->swi_emitted);
@@ -26791,7 +26996,7 @@
  
  	return ret;
  }
-@@ -240,13 +246,13 @@ static int radeon_wait_irq(struct drm_device * dev, int swi_nr)
+@@ -240,13 +247,13 @@ static int radeon_wait_irq(struct drm_device * dev, int swi_nr)
  	    (drm_radeon_private_t *) dev->dev_private;
  	int ret = 0;
  
@@ -26807,7 +27012,7 @@
  
  	return ret;
  }
-@@ -340,7 +346,6 @@ int radeon_driver_irq_postinstall(struct drm_device *dev)
+@@ -340,7 +347,6 @@ int radeon_driver_irq_postinstall(struct drm_device *dev)
  	drm_radeon_private_t *dev_priv =
  	    (drm_radeon_private_t *) dev->dev_private;
  
@@ -35515,7 +35720,7 @@
  
  /**
 diff --git a/include/drm/drmP.h b/include/drm/drmP.h
-index ccbcd13..99e348d 100644
+index ccbcd13..b61b0c6 100644
 --- a/include/drm/drmP.h
 +++ b/include/drm/drmP.h
 @@ -147,9 +147,23 @@ struct drm_device;
@@ -35653,7 +35858,15 @@
  extern void drm_agp_chipset_flush(struct drm_device *dev);
  
  				/* Stub support (drm_stub.h) */
-@@ -1368,6 +1424,8 @@ extern int drm_ati_pcigart_init(struct drm_device *dev,
+@@ -1349,6 +1405,7 @@ extern int drm_bufs_info(struct seq_file *m, void *data);
+ extern int drm_vblank_info(struct seq_file *m, void *data);
+ extern int drm_clients_info(struct seq_file *m, void* data);
+ extern int drm_gem_name_info(struct seq_file *m, void *data);
++extern int drm_page_alloc_info(struct seq_file *m, void *data);
+ extern int drm_gem_object_info(struct seq_file *m, void* data);
+ 
+ #if DRM_DEBUG_CODE
+@@ -1368,6 +1425,8 @@ extern int drm_ati_pcigart_init(struct drm_device *dev,
  				struct drm_ati_pcigart_info * gart_info);
  extern int drm_ati_pcigart_cleanup(struct drm_device *dev,
  				   struct drm_ati_pcigart_info * gart_info);
@@ -35662,7 +35875,7 @@
  
  extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
  				       size_t align, dma_addr_t maxaddr);
-@@ -1525,6 +1583,39 @@ extern void drm_free(void *pt, size_t size, int area);
+@@ -1525,6 +1584,39 @@ extern void drm_free(void *pt, size_t size, int area);
  extern void *drm_calloc(size_t nmemb, size_t size, int area);
  #endif
  


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1419
retrieving revision 1.1420
diff -u -r1.1419 -r1.1420
--- kernel.spec	12 Mar 2009 00:22:03 -0000	1.1419
+++ kernel.spec	12 Mar 2009 01:45:20 -0000	1.1420
@@ -1822,6 +1822,10 @@
 # and build.
 
 %changelog
+* Thu Mar 12 2009 Dave Airlie <airlied at redhat.com>
+- radeon kms - bug fix irq and ib handling on r300 + suspend test hook
+- fix sparc build with kms from spot
+
 * Wed Mar 11 2009 Chuck Ebbert <cebbert at redhat.com>
 - 2.6.29-rc7-git5
 - Dropped ingo-fix-atom-failures.patch, merged upstream.




More information about the fedora-extras-commits mailing list