Skip to contentSkip to conversation

gpu sharing layer for kernel

PATCH New [email protected] 7 participants 16 messages Jan 24, 2007 – Feb 7, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

This patch series contains the gpu sharing layer for kernel that I've mentioned before. It should apply against Linus's git tree.

Why do we want this?

Currently the kernel cannot provide both the fb and drm drivers with access to the device model and this means the drm cannot get any suspend/resume callbacks. This layer attempts to fix this problem by adding a bus for the gpu drivers
to attach to. Currently a lowlevel binding driver is needed along with optional
fb and drm components.

This patch series only covers the generic code and radeon initially, I'll probably target intel next.

All the patches are available at:
http://www.skynet.ie/~airlied/patches/gpu

I think maybe the radeonfb patch may not make it pass the list filter..

Dave.

#1 lore raw

PATCH 1/1 gpu: Initial gpu layer addition.

From: Dave Airlie <[email protected]>

This is the new Linux GPU driver layer generic portion. It registers a bus at system init time, and this bus can be used by lowlevel drivers to create subdevices on the GPU bus. The other GPU drivers can be registered via the lowlevel driver on the other subdevices.

---
 drivers/video/Kconfig     |    4 
 drivers/video/Makefile    |    1 
 drivers/video/gpu_layer.c |  410 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/gpu_layer.h |  118 +++++++++++++
 4 files changed, 533 insertions(+), 0 deletions(-)
drivers/video/Kconfig +4 -0
index 4e83f01..acf2df0 100644
@@ -4,6 +4,10 @@ #
 
 menu "Graphics support"
 
+config GPU
+	bool
+	default y
+
 config FIRMWARE_EDID
        bool "Enable firmware EDID"
        default y
drivers/video/Makefile +1 -0
index 309a26d..49c5d86 100644
@@ -5,6 +5,7 @@ # Rewritten to use lists instead of if-s
 # Each configuration option enables a list of files.
 
 obj-y                             += fb_notify.o
+obj-$(CONFIG_GPU)                 += gpu_layer.o
 obj-$(CONFIG_FB)                  += fb.o
 fb-y                              := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
                                      modedb.o fbcvt.o
drivers/video/gpu_layer.c new file +410 -0

410 lines not on this page · raw message

include/linux/gpu_layer.h new file +118 -0

118 lines not on this page · raw message

Signature · 1 line
1.4.1.ga3e6
#2 lore raw

PATCH 1/1 gpu/radeon: add a radeon lowlevel GPU driver

From: Dave Airlie <[email protected]>

This creates a lowlevel radeon driver which detects the card and sets up the GPU layer to use it.

---
 drivers/video/Kconfig      |    5 +
 drivers/video/Makefile     |    2 
 drivers/video/radeon_gpu.c |  343 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/radeon_gpu.h |   92 ++++++++++++
 4 files changed, 442 insertions(+), 0 deletions(-)
drivers/video/Kconfig +5 -0
index acf2df0..0a00588 100644
@@ -8,6 +8,11 @@ config GPU
 	bool
 	default y
 
+config GPU_RADEON
+	tristate "ATI Radeon gpu driver"
+	select GPU
+	default n
+
 config FIRMWARE_EDID
        bool "Enable firmware EDID"
        default y
drivers/video/Makefile +2 -0
index 49c5d86..5634725 100644
@@ -7,6 +7,8 @@ # Each configuration option enables a li
 obj-y                             += fb_notify.o
 obj-$(CONFIG_GPU)                 += gpu_layer.o
 obj-$(CONFIG_FB)                  += fb.o
+obj-$(CONFIG_GPU_RADEON)          += radeon_gpu.o
+
 fb-y                              := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
                                      modedb.o fbcvt.o
 fb-objs                           := $(fb-y)
drivers/video/radeon_gpu.c new file +343 -0

343 lines not on this page · raw message

include/linux/radeon_gpu.h new file +92 -0

92 lines not on this page · raw message

Signature · 1 line
1.4.1.ga3e6
#3 lore raw

PATCH 1/1 gpu/radeonfb: add GPU support to radeonfb

From: Dave Airlie <[email protected]>

This patch adds support to the radeonfb driver to use the new GPU layer to driver the radeon.

Cc Ben Herrenschmidt <[email protected]>
---
 drivers/video/Kconfig              |    1 
 drivers/video/aty/radeon_accel.c   |   18 +--
 drivers/video/aty/radeon_base.c    |  255 +++++++++++++++++-------------------
 drivers/video/aty/radeon_i2c.c     |    8 +
 drivers/video/aty/radeon_monitor.c |   10 +
 drivers/video/aty/radeon_pm.c      |  130 +++++++++---------
 drivers/video/aty/radeonfb.h       |   84 +-----------
 7 files changed, 217 insertions(+), 289 deletions(-)
drivers/video/Kconfig +1 -0
index 0a00588..83a6002 100644
@@ -1030,6 +1030,7 @@ config FB_MATROX_MULTIHEAD
 config FB_RADEON
 	tristate "ATI Radeon display support"
 	depends on FB && PCI
+	select GPU_RADEON
 	select I2C_ALGOBIT if FB_RADEON_I2C
 	select I2C if FB_RADEON_I2C
 	select FB_DDC if FB_RADEON_I2C
drivers/video/aty/radeon_accel.c +9 -9
index 3ca27cb..b0413d3 100644
@@ -203,9 +203,9 @@ void radeonfb_engine_reset(struct radeon
 	host_path_cntl = INREG(HOST_PATH_CNTL);
 	rbbm_soft_reset = INREG(RBBM_SOFT_RESET);
 
-	if (rinfo->family == CHIP_FAMILY_R300 ||
-	    rinfo->family == CHIP_FAMILY_R350 ||
-	    rinfo->family == CHIP_FAMILY_RV350) {
+	if (rinfo->gpu_info->family == CHIP_FAMILY_R300 ||
+	    rinfo->gpu_info->family == CHIP_FAMILY_R350 ||
+	    rinfo->gpu_info->family == CHIP_FAMILY_RV350) {
 		u32 tmp;
 
 		OUTREG(RBBM_SOFT_RESET, (rbbm_soft_reset |
@@ -241,9 +241,9 @@ void radeonfb_engine_reset(struct radeon
 	INREG(HOST_PATH_CNTL);
 	OUTREG(HOST_PATH_CNTL, host_path_cntl);
 
-	if (rinfo->family != CHIP_FAMILY_R300 ||
-	    rinfo->family != CHIP_FAMILY_R350 ||
-	    rinfo->family != CHIP_FAMILY_RV350)
+	if (rinfo->gpu_info->family != CHIP_FAMILY_R300 ||
+	    rinfo->gpu_info->family != CHIP_FAMILY_R350 ||
+	    rinfo->gpu_info->family != CHIP_FAMILY_RV350)
 		OUTREG(RBBM_SOFT_RESET, rbbm_soft_reset);
 
 	OUTREG(CLOCK_CNTL_INDEX, clock_cntl_index);
@@ -260,9 +260,9 @@ void radeonfb_engine_init (struct radeon
 	radeonfb_engine_reset(rinfo);
 
 	radeon_fifo_wait (1);
-	if ((rinfo->family != CHIP_FAMILY_R300) &&
-	    (rinfo->family != CHIP_FAMILY_R350) &&
-	    (rinfo->family != CHIP_FAMILY_RV350))
+	if ((rinfo->gpu_info->family != CHIP_FAMILY_R300) &&
+	    (rinfo->gpu_info->family != CHIP_FAMILY_R350) &&
+	    (rinfo->gpu_info->family != CHIP_FAMILY_RV350))
 		OUTREG(RB2D_DSTCACHE_MODE, 0);
 
 	radeon_fifo_wait (3);
drivers/video/aty/radeon_base.c +122 -133

639 lines not on this page · raw message

drivers/video/aty/radeon_i2c.c +4 -4
index e7c5b21..09614b3 100644
@@ -74,7 +74,7 @@ static int radeon_setup_i2c_bus(struct r
 	chan->adapter.owner		= THIS_MODULE;
 	chan->adapter.id		= I2C_HW_B_RADEON;
 	chan->adapter.algo_data		= &chan->algo;
-	chan->adapter.dev.parent	= &chan->rinfo->pdev->dev;
+	chan->adapter.dev.parent	= &chan->rinfo->gdev->dev;
 	chan->algo.setsda		= radeon_gpio_setsda;
 	chan->algo.setscl		= radeon_gpio_setscl;
 	chan->algo.getsda		= radeon_gpio_getsda;
@@ -92,9 +92,9 @@ static int radeon_setup_i2c_bus(struct r
 
 	rc = i2c_bit_add_bus(&chan->adapter);
 	if (rc == 0)
-		dev_dbg(&chan->rinfo->pdev->dev, "I2C bus %s registered.\n", name);
+		dev_dbg(&chan->rinfo->gdev->dev, "I2C bus %s registered.\n", name);
 	else
-		dev_warn(&chan->rinfo->pdev->dev, "Failed to register I2C bus %s.\n", name);
+		dev_warn(&chan->rinfo->gdev->dev, "Failed to register I2C bus %s.\n", name);
 	return rc;
 }
 
@@ -155,7 +155,7 @@ int radeon_probe_i2c_connector(struct ra
 	}
 	if (edid[0x14] & 0x80) {
 		/* Fix detection using BIOS tables */
-		if (rinfo->is_mobility /*&& conn == ddc_dvi*/ &&
+		if (rinfo->gpu_info->is_mobility /*&& conn == ddc_dvi*/ &&
 		    (INREG(LVDS_GEN_CNTL) & LVDS_ON)) {
 			RTRACE("radeonfb: I2C (port %d) ... found LVDS panel\n", conn);
 			return MT_LCD;
drivers/video/aty/radeon_monitor.c +5 -5
index 38c7dbf..8625f5d 100644
@@ -328,8 +328,8 @@ static int __devinit radeon_crt_is_conne
 	ulData            |=  (DAC_FORCE_BLANK_OFF_EN
 			       |DAC_FORCE_DATA_EN
 			       |DAC_FORCE_DATA_SEL_MASK);
-	if ((rinfo->family == CHIP_FAMILY_RV250) ||
-	    (rinfo->family == CHIP_FAMILY_RV280))
+	if ((rinfo->gpu_info->family == CHIP_FAMILY_RV250) ||
+	    (rinfo->gpu_info->family == CHIP_FAMILY_RV280))
 	    ulData |= (0x01b6 << DAC_FORCE_DATA_SHIFT);
 	else
 	    ulData |= (0x01ac << DAC_FORCE_DATA_SHIFT);
@@ -494,7 +494,7 @@ #endif /* DEBUG */
 		/*
 		 * Old single head cards
 		 */
-		if (!rinfo->has_CRTC2) {
+		if (!rinfo->gpu_info->has_CRTC2) {
 #ifdef CONFIG_PPC_OF
 			if (rinfo->mon1_type == MT_NONE)
 				rinfo->mon1_type = radeon_probe_OF_head(rinfo, 0,
@@ -560,7 +560,7 @@ #ifdef CONFIG_FB_RADEON_I2C
 				ddc_crt2_used = 1;
 		}
 #endif /* CONFIG_FB_RADEON_I2C */
-		if (rinfo->mon1_type == MT_NONE && rinfo->is_mobility &&
+		if (rinfo->mon1_type == MT_NONE && rinfo->gpu_info->is_mobility &&
 		    ((rinfo->bios_seg && (INREG(BIOS_4_SCRATCH) & 4))
 		     || (INREG(LVDS_GEN_CNTL) & LVDS_ON))) {
 			rinfo->mon1_type = MT_LCD;
@@ -632,7 +632,7 @@ #endif /* CONFIG_FB_RADEON_I2C */
 	       radeon_get_mon_name(rinfo->mon1_type));
 	if (rinfo->mon1_EDID)
 		printk(KERN_INFO "radeonfb: EDID probed\n");
-	if (!rinfo->has_CRTC2)
+	if (!rinfo->gpu_info->has_CRTC2)
 		return;
 	printk(KERN_INFO "radeonfb: Monitor 2 type %s found\n",
 	       radeon_get_mon_name(rinfo->mon2_type));
drivers/video/aty/radeon_pm.c +67 -63

404 lines not on this page · raw message

drivers/video/aty/radeonfb.h +9 -75

145 lines not on this page · raw message

Signature · 1 line
1.4.1.ga3e6
#4 lore raw

PATCH 1/1 gpu/drm: Add GPU layer support to generic DRM

From: Dave Airlie <[email protected]>

This patch adds the GPU layer support to the drm library. It doesn't touch any drivers just adds the gpu layer to the drm code.

---
 drivers/char/drm/Makefile     |    2 +
 drivers/char/drm/drmP.h       |   16 ++++++++++
 drivers/char/drm/drm_drv.c    |   10 +++++--
 drivers/char/drm/drm_gpu.c    |   63 +++++++++++++++++++++++++++++++++++++++++
 drivers/char/drm/drm_ioctl.c  |    8 +++--
 drivers/char/drm/drm_memory.c |    1 +
 drivers/char/drm/drm_stub.c   |   31 ++++++++++----------
 drivers/char/drm/drm_sysfs.c  |    8 +++++
 8 files changed, 114 insertions(+), 25 deletions(-)
drivers/char/drm/Makefile +1 -1
index 3ad0f64..7438e29 100644
@@ -6,7 +6,7 @@ drm-objs    :=	drm_auth.o drm_bufs.o drm
 		drm_drv.o drm_fops.o drm_ioctl.o drm_irq.o \
 		drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \
 		drm_agpsupport.o drm_scatter.o ati_pcigart.o drm_pci.o \
-		drm_sysfs.o drm_hashtab.o drm_sman.o drm_mm.o
+		drm_sysfs.o drm_hashtab.o drm_sman.o drm_mm.o drm_gpu.o
 
 tdfx-objs   := tdfx_drv.o
 r128-objs   := r128_drv.o r128_cce.o r128_state.o r128_irq.o
drivers/char/drm/drmP.h +16 -0
index 6dcdceb..7fb9ec9 100644
@@ -52,6 +52,7 @@ #include <linux/proc_fs.h>
 #include <linux/init.h>
 #include <linux/file.h>
 #include <linux/pci.h>
+#include <linux/gpu_layer.h>
 #include <linux/jiffies.h>
 #include <linux/smp_lock.h>	/* For (un)lock_kernel */
 #include <linux/mm.h>
@@ -544,6 +545,10 @@ typedef struct drm_mm {
  * a family of cards. There will one drm_device for each card present
  * in this family
  */
+
+#define DRM_DRV_PCI 1
+#define DRM_DRV_GPU 2
+
 struct drm_device;
 
 struct drm_driver {
@@ -604,6 +609,9 @@ struct drm_driver {
 	drm_ioctl_desc_t *ioctls;
 	int num_ioctls;
 	struct file_operations fops;
+	int drv_type;
+
+	struct gpu_driver gpu_driver;
 	struct pci_driver pci_driver;
 };
 
@@ -728,6 +736,8 @@ typedef struct drm_device {
 
 	drm_agp_head_t *agp;	/**< AGP data */
 
+	/* a pointer to the GPU device */
+	struct gpu_device *gdev;
 	struct pci_dev *pdev;		/**< PCI device structure */
 	int pci_vendor;			/**< PCI vendor id */
 	int pci_device;			/**< PCI device id */
@@ -817,9 +827,12 @@ #endif
 /******************************************************************/
 /** \name Internal function definitions */
 /*@{*/
+extern void drm_gpu_cleanup(struct gpu_device *gdev);
+extern int drm_gpu_get_dev(struct gpu_device *gdev, struct drm_driver *driver, void *driver_id, struct pci_dev *pdev);
 
 				/* Driver support (drm_drv.h) */
 extern int drm_init(struct drm_driver *driver);
+extern void drm_cleanup(drm_device_t * dev);
 extern void drm_exit(struct drm_driver *driver);
 extern int drm_ioctl(struct inode *inode, struct file *filp,
 		     unsigned int cmd, unsigned long arg);
@@ -1003,9 +1016,12 @@ extern int drm_agp_bind_memory(DRM_AGP_M
 extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle);
 
 				/* Stub support (drm_stub.h) */
+extern int drm_fill_in_dev(drm_device_t * dev, unsigned long driver_data,
+			   struct drm_driver *driver);
 extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
 		       struct drm_driver *driver);
 extern int drm_put_dev(drm_device_t * dev);
+extern int drm_get_head(drm_device_t * dev, drm_head_t * head);
 extern int drm_put_head(drm_head_t * head);
 extern unsigned int drm_debug;
 extern unsigned int drm_cards_limit;
drivers/char/drm/drm_drv.c +7 -3
index a70af0d..2c94231 100644
@@ -275,6 +275,8 @@ int drm_init(struct drm_driver *driver)
 
 	drm_mem_init();
 
+	driver->drv_type = DRM_DRV_PCI;
+
 	for (i = 0; driver->pci_driver.id_table[i].vendor != 0; i++) {
 		pid = (struct pci_device_id *)&driver->pci_driver.id_table[i];
 
@@ -300,7 +302,7 @@ EXPORT_SYMBOL(drm_init);
  *
  * \sa drm_init
  */
-static void drm_cleanup(drm_device_t * dev)
+void drm_cleanup(drm_device_t * dev)
 {
 	DRM_DEBUG("\n");
 
@@ -360,8 +362,10 @@ void drm_exit(struct drm_driver *driver)
 		dev = head->dev;
 		if (dev) {
 			/* release the pci driver */
-			if (dev->pdev)
-				pci_dev_put(dev->pdev);
+			if (dev->pdev && (dev->driver->drv_type == DRM_DRV_PCI)) {
+				if (dev->pdev)
+					pci_dev_put(dev->pdev);
+			}
 			drm_cleanup(dev);
 		}
 	}
drivers/char/drm/drm_gpu.c new file +63 -0

63 lines not on this page · raw message

drivers/char/drm/drm_ioctl.c +4 -4
index 5658955..a34f9c4 100644
@@ -110,12 +110,12 @@ int drm_setunique(struct inode *inode, s
 	dev->unique[dev->unique_len] = '\0';
 
 	dev->devname =
-	    drm_alloc(strlen(dev->driver->pci_driver.name) +
+	    drm_alloc(strlen(dev->driver->name) +
 		      strlen(dev->unique) + 2, DRM_MEM_DRIVER);
 	if (!dev->devname)
 		return -ENOMEM;
 
-	sprintf(dev->devname, "%s@%s", dev->driver->pci_driver.name,
+	sprintf(dev->devname, "%s@%s", dev->driver->name,
 		dev->unique);
 
 	/* Return error if the busid submitted doesn't match the device's actual
@@ -157,12 +157,12 @@ static int drm_set_busid(drm_device_t * 
 		DRM_ERROR("Unique buffer overflowed\n");
 
 	dev->devname =
-	    drm_alloc(strlen(dev->driver->pci_driver.name) + dev->unique_len +
+	    drm_alloc(strlen(dev->driver->name) + dev->unique_len +
 		      2, DRM_MEM_DRIVER);
 	if (dev->devname == NULL)
 		return -ENOMEM;
 
-	sprintf(dev->devname, "%s@%s", dev->driver->pci_driver.name,
+	sprintf(dev->devname, "%s@%s", dev->driver->name,
 		dev->unique);
 
 	return 0;
drivers/char/drm/drm_memory.c +1 -0
index 5681cae..96d962d 100644
@@ -44,6 +44,7 @@ #else
 void drm_mem_init(void)
 {
 }
+EXPORT_SYMBOL(drm_mem_init);
 
 /**
  * Called when "/proc/dri/%dev%/mem" is read.
drivers/char/drm/drm_stub.c +15 -16
index 120d102..6b0fef4 100644
@@ -53,9 +53,8 @@ drm_head_t **drm_heads;
 struct class *drm_class;
 struct proc_dir_entry *drm_proc_root;
 
-static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
-			   const struct pci_device_id *ent,
-			   struct drm_driver *driver)
+int drm_fill_in_dev(drm_device_t * dev, unsigned long driver_data,
+		    struct drm_driver *driver)
 {
 	int retcode;
 
@@ -66,15 +65,6 @@ static int drm_fill_in_dev(drm_device_t 
 	mutex_init(&dev->struct_mutex);
 	mutex_init(&dev->ctxlist_mutex);
 
-	dev->pdev = pdev;
-	dev->pci_device = pdev->device;
-	dev->pci_vendor = pdev->vendor;
-
-#ifdef __alpha__
-	dev->hose = pdev->sysdata;
-#endif
-	dev->irq = pdev->irq;
-
 	dev->maplist = drm_calloc(1, sizeof(*dev->maplist), DRM_MEM_MAPS);
 	if (dev->maplist == NULL)
 		return -ENOMEM;
@@ -96,7 +86,7 @@ #endif
 	dev->driver = driver;
 
 	if (dev->driver->load)
-		if ((retcode = dev->driver->load(dev, ent->driver_data)))
+		if ((retcode = dev->driver->load(dev, driver_data)))
 			goto error_out_unreg;
 
 	if (drm_core_has_AGP(dev)) {
@@ -142,7 +132,7 @@ #endif
  * create the proc init entry via proc_init(). This routines assigns
  * minor numbers to secondary heads of multi-headed cards
  */
-static int drm_get_head(drm_device_t * dev, drm_head_t * head)
+int drm_get_head(drm_device_t * dev, drm_head_t * head)
 {
 	drm_head_t **heads = drm_heads;
 	int ret;
@@ -215,14 +205,23 @@ int drm_get_dev(struct pci_dev *pdev, co
 	if (ret)
 		goto err_g1;
 
-	if ((ret = drm_fill_in_dev(dev, pdev, ent, driver))) {
+	dev->pdev = pdev;
+	dev->pci_device = pdev->device;
+	dev->pci_vendor = pdev->vendor;
+
+#ifdef __alpha__
+	dev->hose = pdev->sysdata;
+#endif
+	dev->irq = pdev->irq;
+
+	if ((ret = drm_fill_in_dev(dev, ent->driver_data, driver))) {
 		printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
 		goto err_g2;
 	}
 	if ((ret = drm_get_head(dev, &dev->primary)))
 		goto err_g2;
 	
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
+	DRM_INFO("Initialized PCI %s %d.%d.%d %s on minor %d\n",
 		 driver->name, driver->major, driver->minor, driver->patchlevel,
 		 driver->date, dev->primary.minor);
 
drivers/char/drm/drm_sysfs.c +7 -1
index cc8e2eb..fd25766 100644
@@ -108,10 +108,16 @@ struct class_device *drm_sysfs_device_ad
 {
 	struct class_device *class_dev;
 	int i, j, err;
+	struct device *dev;
+
+	if (head->dev->driver->drv_type == DRM_DRV_PCI)
+		dev = &(head->dev->pdev)->dev;
+	else
+		dev = &(head->dev->gdev)->dev;
 
 	class_dev = class_device_create(cs, NULL,
 					MKDEV(DRM_MAJOR, head->minor),
-					&(head->dev->pdev)->dev,
+					dev,
 					"card%d", head->minor);
 	if (IS_ERR(class_dev)) {
 		err = PTR_ERR(class_dev);
Signature · 1 line
1.4.1.ga3e6
#5 lore raw

PATCH 1/1 drm/gpu/radeon: Add radeon DRM support to use GPU layer

From: Dave Airlie <[email protected]>

This ports the radeon DRM to use the GPU layer to bind to the PCI device.

---
 drivers/char/drm/Kconfig      |    1 +
 drivers/char/drm/radeon_drv.c |   54 ++++++++++++++++++++++++++++++++++++-----
 drivers/char/drm/radeon_drv.h |    4 ++-
 3 files changed, 50 insertions(+), 9 deletions(-)
drivers/char/drm/Kconfig +1 -0
index ef833a1..18cf194 100644
@@ -34,6 +34,7 @@ config DRM_R128
 config DRM_RADEON
 	tristate "ATI Radeon"
 	depends on DRM && PCI
+	select GPU_RADEON
 	help
 	  Choose this option if you have an ATI Radeon graphics card.  There
 	  are both PCI and AGP versions.  You don't need to choose this to
drivers/char/drm/radeon_drv.c +47 -7

90 lines not on this page · raw message

drivers/char/drm/radeon_drv.h +2 -2
index 8b105f1..650fc8e 100644
@@ -103,7 +103,7 @@ #define DRIVER_PATCHLEVEL	0
 /*
  * Radeon chip families
  */
-enum radeon_family {
+enum radeondrm_family {
 	CHIP_R100,
 	CHIP_RV100,
 	CHIP_RS100,
@@ -132,7 +132,7 @@ enum radeon_cp_microcode_version {
 /*
  * Chip flags
  */
-enum radeon_chip_flags {
+enum radeondrm_chip_flags {
 	RADEON_FAMILY_MASK = 0x0000ffffUL,
 	RADEON_FLAGS_MASK = 0xffff0000UL,
 	RADEON_IS_MOBILITY = 0x00010000UL,
Signature · 1 line
1.4.1.ga3e6
#6 lore raw

Re: [PATCH] gpu/radeonfb: add GPU support to radeonfb

In reply to [email protected]
Quoted 4 lines · On Wed, 2007-01-24 at 22:20 +1100, [email protected] wrote:

From: Dave Airlie <[email protected]>

This patch adds support to the radeonfb driver to use the new GPU layer to driver the radeon.

Unfortunately, that also massively collides with a giant radeonfb update that's been simmering on my HD for some time (mostly the work of Solomon Peachy to support ATOM BIOS and newer cards).

I really need to finish some bits in there and push it out. Dave, you want to push your stuff first or you prefer re-adapting your stuff on top of mine ? I'll try to dig a patch to put in -mm for a while next week.

Ben.

#7 lore raw

Re: [PATCH] gpu/radeonfb: add GPU support to radeonfb

Quoted 4 lines
Quoted 3 lines

This patch adds support to the radeonfb driver to use the new GPU layer to driver the radeon.

Quoted 8 lines

Unfortunately, that also massively collides with a giant radeonfb update that's been simmering on my HD for some time (mostly the work of Solomon Peachy to support ATOM BIOS and newer cards).

I really need to finish some bits in there and push it out. Dave, you want to push your stuff first or you prefer re-adapting your stuff on top of mine ? I'll try to dig a patch to put in -mm for a while next week.

I can wait for yours as gpu_layer has become a background task that I just pick up every few weeks and dust off.. :-)

Dave.

#8 lore raw
In reply to [email protected]
Quoted 2 lines · On Wed, Jan 24, 2007 at 10:20:18PM +1100, [email protected] wrote:

This patch series contains the gpu sharing layer for kernel that I've mentioned before. It should apply against Linus's git tree.

Yeah!

Quoted 7 lines

Why do we want this?

Currently the kernel cannot provide both the fb and drm drivers with access to the device model and this means the drm cannot get any suspend/resume callbacks. This layer attempts to fix this problem by adding a bus for the gpu drivers to attach to. Currently a lowlevel binding driver is needed along with optional fb and drm components.

If we were to allow this kind of "sharing" for all PCI devices would that work out instead? Or would this layer still be needed?

thanks,

greg k-h

#9 lore raw
Quoted 10 lines
Quoted 7 lines

Why do we want this?

Currently the kernel cannot provide both the fb and drm drivers with access to the device model and this means the drm cannot get any suspend/resume callbacks. This layer attempts to fix this problem by adding a bus for the gpu drivers to attach to. Currently a lowlevel binding driver is needed along with optional fb and drm components.

If we were to allow this kind of "sharing" for all PCI devices would that work out instead? Or would this layer still be needed?

Initially this layer wouldn't be needed, but I'd like to add some awareness to the drivers, so the drm can tell the fb to stop doing stuff and vice-versa if necessary.... but perhaps that could be done with a generic layer also.. or via the lowlevel driver I have...

Dave.

#10 lore raw
Quoted 8 lines · Dave Airlie
Quoted 8 lines
Quoted 7 lines

Why do we want this?

Currently the kernel cannot provide both the fb and drm drivers with access to the device model and this means the drm cannot get any suspend/resume callbacks. This layer attempts to fix this problem by adding a bus for the gpu drivers to attach to. Currently a lowlevel binding driver is needed along with optional fb and drm components.

Quoted 7 lines
Quoted 2 lines

If we were to allow this kind of "sharing" for all PCI devices would that work out instead? Or would this layer still be needed?

Initially this layer wouldn't be needed, but I'd like to add some awareness to the drivers, so the drm can tell the fb to stop doing stuff and vice-versa if necessary.... but perhaps that could be done with a generic layer also.. or via the lowlevel driver I have...

Ok, I have no objection to this layer right now, as it solves your problem, and while I would like some time in the future to add such a layer for the PCI devices, it is no where on my todo plate just yet...

thanks,

greg k-h

#11 lore raw
Quoted 12 lines · Greg Kroah-Hartman
Quoted 11 lines · Dave Airlie
Quoted 10 lines
Quoted 7 lines

Why do we want this?

Currently the kernel cannot provide both the fb and drm drivers with access to the device model and this means the drm cannot get any suspend/resume callbacks. This layer attempts to fix this problem by adding a bus for the gpu drivers to attach to. Currently a lowlevel binding driver is needed along with optional fb and drm components.

If we were to allow this kind of "sharing" for all PCI devices would that work out instead? Or would this layer still be needed?

Quoted 8 lines
Quoted 4 lines

Initially this layer wouldn't be needed, but I'd like to add some awareness to the drivers, so the drm can tell the fb to stop doing stuff and vice-versa if necessary.... but perhaps that could be done with a generic layer also.. or via the lowlevel driver I have...

Ok, I have no objection to this layer right now, as it solves your problem, and while I would like some time in the future to add such a layer for the PCI devices, it is no where on my todo plate just yet...

It's been bubbling its way up my todo too, as agpgart is starting to get bug reports due to conflicts when the EDAC drivers or watchdog drivers 'claim' the south bridge ID before agp gets a chance to init.

Someone sent me some patches a few weeks back, but I seem to have mislaid them. I'll turf them up and get the sender to send them to lkml. They should at the least, make a starting point.

Dave

Signature · 1 line
http://www.codemonkey.org.uk
#12 lore raw
In reply to Dave Airlie
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

Why do we want this?

Currently the kernel cannot provide both the fb and drm drivers with access to the device model and this means the drm cannot get any suspend/resume callbacks. This layer attempts to fix this problem by adding a bus for the gpu drivers to attach to. Currently a lowlevel binding driver is needed along with optional fb and drm components.

Quoted 7 lines
Quoted 2 lines

If we were to allow this kind of "sharing" for all PCI devices would that work out instead? Or would this layer still be needed?

Initially this layer wouldn't be needed, but I'd like to add some awareness to the drivers, so the drm can tell the fb to stop doing stuff and vice-versa if necessary.... but perhaps that could be done with a generic layer also.. or via the lowlevel driver I have...

I have a idea. Greg asked me to move my display class away from the
class_device method. One of the nice things about using class_device_register is that it handles all the attributes for you :-) So while going throught the core code for device handling I discovered that struct device has a struct class. I found it alot easier to have class field in the device point to the class you want to use. With device registeration the class is setup up for you.
The idea was to have the a linked list of classes inside of
struct device. Then have a way to register/unregister that class with the device. This way struct device and struct device_driver are per hardware but struct class could be used to handle different interfaces to that same hardware. What do you think? I could do a example with hardware that registers a fbdev drivers as well as a backlight. Plus nobody is using the class field in struct device at this time.

#13 lore raw
In reply to Greg KH
Quoted 6 lines · On Wed, Jan 24, 2007 at 10:20:18PM +1100, [email protected] wrote:
Quoted 2 lines

This patch series contains the gpu sharing layer for kernel that I've mentioned before. It should apply against Linus's git tree.

Yeah!

Finally after all these years!!!! Sorry about the delayed response I was busy with work.

Quoted 10 lines
Quoted 7 lines

Why do we want this?

Currently the kernel cannot provide both the fb and drm drivers with access to the device model and this means the drm cannot get any suspend/resume callbacks. This layer attempts to fix this problem by adding a bus for the gpu drivers to attach to. Currently a lowlevel binding driver is needed along with optional fb and drm components.

If we were to allow this kind of "sharing" for all PCI devices would that work out instead? Or would this layer still be needed?

Please do this. Its not only fbdev but backlight and display support. Note display support is not main stream yet. Greg sent me a email about the DRM team needing a CRT class as well. That will be a different discussion. Plus some cards have tuners as well. So this device sharing is needed. It would also be really nice to prevent driver collisions. For example vesafb and a fbdev driver controlling the same hardware or acpi backlight versus the graphics card backlight support.

#14 lore raw
In reply to [email protected]

Hi Dave,

Quoted 2 lines · [email protected] writes:

This patch series contains the gpu sharing layer for kernel that I've mentioned before. It should apply against Linus's git tree.

I gave the patches a go on my PowerBook. I had to make a few changes to get it to compile. Works fine so far: I switched between VTs and X with an accelerated GLX client active a few times, no problems.

When I did a sleep/resume cycle it wedged on resume, but I expect this is due to my hacking up radeonfb_early_resume(), as seen in the last hunk below, which was just aimed at just getting it to compile.

drivers/video/aty/radeon_backlight.c +6 -6
index 3abfd4a..560568b 100644
@@ -105,7 +105,7 @@ static int radeon_bl_update_status(struct backlight_device *bd)
 		   RADEON_PIXCLK_LVDS_ALWAYS_ON bit is off
 		*/
 		tmpPixclksCntl = INPLL(PIXCLKS_CNTL);
-		if (rinfo->is_mobility || rinfo->is_IGP)
+		if (rinfo->gpu_info->is_mobility || rinfo->gpu_info->is_IGP)
 			OUTPLLP(PIXCLKS_CNTL, 0, ~PIXCLK_LVDS_ALWAYS_ONb);
 		lvds_gen_cntl &= ~(LVDS_BL_MOD_LEVEL_MASK | LVDS_BL_MOD_EN);
 		lvds_gen_cntl |= (radeon_bl_get_level_brightness(pdata, 0) <<
@@ -119,7 +119,7 @@ static int radeon_bl_update_status(struct backlight_device *bd)
 		rinfo->pending_lvds_gen_cntl = lvds_gen_cntl;
 		mod_timer(&rinfo->lvds_timer,
 			  jiffies + msecs_to_jiffies(rinfo->panel_info.pwr_delay));
-		if (rinfo->is_mobility || rinfo->is_IGP)
+		if (rinfo->gpu_info->is_mobility || rinfo->gpu_info->is_IGP)
 			OUTPLL(PIXCLKS_CNTL, tmpPixclksCntl);
 	}
 	rinfo->init_state.lvds_gen_cntl &= ~LVDS_STATE_MASK;
@@ -176,10 +176,10 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo)
 	 * direction backlight should work on a given panel?
 	 */
 	pdata->negative =
-		(rinfo->family != CHIP_FAMILY_RV200 &&
-		 rinfo->family != CHIP_FAMILY_RV250 &&
-		 rinfo->family != CHIP_FAMILY_RV280 &&
-		 rinfo->family != CHIP_FAMILY_RV350);
+		(rinfo->gpu_info->family != CHIP_FAMILY_RV200 &&
+		 rinfo->gpu_info->family != CHIP_FAMILY_RV250 &&
+		 rinfo->gpu_info->family != CHIP_FAMILY_RV280 &&
+		 rinfo->gpu_info->family != CHIP_FAMILY_RV350);
 
 #ifdef CONFIG_PMAC_BACKLIGHT
 	pdata->negative = pdata->negative ||
drivers/video/aty/radeon_base.c +2 -1
index f634c43..c8cc173 100644
@@ -1837,7 +1837,8 @@ static int radeonfb_set_par(struct fb_info *info)
 
 #ifdef CONFIG_BOOTX_TEXT
 	/* Update debug text engine */
-	btext_update_display(rinfo->fb_base_phys, mode->xres, mode->yres,
+	btext_update_display(rinfo->gpu_info->fb_base_phys,
+			     mode->xres, mode->yres,
 			     rinfo->depth, info->fix.line_length);
 #endif
 
drivers/video/aty/radeon_monitor.c +3 -3
index 8625f5d..4cd4f34 100644
@@ -122,7 +122,7 @@ static int __devinit radeon_probe_OF_head(struct radeonfb_info *rinfo, int head_
         while (dp == NULL)
 		return MT_NONE;
 
-	if (rinfo->has_CRTC2) {
+	if (rinfo->gpu_info->has_CRTC2) {
 		const char *pname;
 		int len, second = 0;
 
@@ -141,7 +141,7 @@ static int __devinit radeon_probe_OF_head(struct radeonfb_info *rinfo, int head_
 				/* Maybe check for LVDS_GEN_CNTL here ? I need to check out
 				 * what OF does when booting with lid closed
 				 */
-				if (mt == MT_DFP && rinfo->is_mobility)
+				if (mt == MT_DFP && rinfo->gpu_info->is_mobility)
 					mt = MT_LCD;
 				return mt;
 			} else if (pname[len-1] == 'B' && head_no == 1)
@@ -655,7 +655,7 @@ static void radeon_fixup_panel_info(struct radeonfb_info *rinfo)
 	 * PPC only for now...
 	 */
 	if (!rinfo->panel_info.use_bios_dividers && rinfo->mon1_type == MT_LCD
-	    && rinfo->is_mobility) {
+	    && rinfo->gpu_info->is_mobility) {
 		int ppll_div_sel;
 		u32 ppll_divn;
 		ppll_div_sel = INREG8(CLOCK_CNTL_INDEX + 1) & 0x3;
drivers/video/aty/radeon_pm.c +2 -2
index 9a59804..f113616 100644
@@ -957,7 +957,7 @@ static void radeon_pm_setup_for_suspend(struct radeonfb_info *rinfo)
 #ifdef CONFIG_PPC_PMAC
 	if (machine_is(powermac)) {
 		/* AGP PLL control */
-		if (rinfo->family <= CHIP_FAMILY_RV280) {
+		if (rinfo->gpu_info->family <= CHIP_FAMILY_RV280) {
 			OUTREG(BUS_CNTL1, INREG(BUS_CNTL1) |  BUS_CNTL1__AGPCLK_VALID);
 			OUTREG(BUS_CNTL1,
 			       (INREG(BUS_CNTL1) & ~BUS_CNTL1__MOBILE_PLATFORM_SEL_MASK)
@@ -2817,7 +2817,7 @@ static void radeonfb_early_resume(void *data)
         struct radeonfb_info *rinfo = data;
 
 	rinfo->no_schedule = 1;
-	radeonfb_pci_resume(rinfo->pdev);
+	radeonfb_gpu_resume(rinfo->gpu_info->info.device);
 	rinfo->no_schedule = 0;
 }
 #endif /* CONFIG_PPC_OF */
Signature · 4 lines
Paul Collins
Wellington, New Zealand

Dag vijandelijk luchtschip de huismeester is dood
#15 lore raw
Quoted 6 lines
Quoted 2 lines · [email protected] writes:

This patch series contains the gpu sharing layer for kernel that I've mentioned before. It should apply against Linus's git tree.

Quoted 8 lines

I gave the patches a go on my PowerBook. I had to make a few changes to get it to compile. Works fine so far: I switched between VTs and X with an accelerated GLX client active a few times, no problems.

When I did a sleep/resume cycle it wedged on resume, but I expect this is due to my hacking up radeonfb_early_resume(), as seen in the last hunk below, which was just aimed at just getting it to compile.

Hi Paul,

I suspected some problem on PPC alright as I didn't have a radeon based one to test on, I'll incorporate your changes and I'll fix the suspend/resume to work properly :-)

Dave.