All of lore.kernel.org
 help / color / mirror / Atom feed
From: airlied@linux.ie
To: linux-kernel@vger.kernel.org
Cc: Dave Airlie <airlied@linux.ie>
Subject: [PATCH] drm/gpu/radeon: Add radeon DRM support to use GPU layer
Date: Wed, 24 Jan 2007 22:20:23 +1100	[thread overview]
Message-ID: <11696376452577-git-send-email-airlied@linux.ie> (raw)
In-Reply-To: <1169637642487-git-send-email-airlied@linux.ie>

From: Dave Airlie <airlied@linux.ie>

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

Signed-off-by: Dave Airlie <airlied@linux.ie>
---
 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(-)

diff --git a/drivers/char/drm/Kconfig b/drivers/char/drm/Kconfig
index ef833a1..18cf194 100644
--- a/drivers/char/drm/Kconfig
+++ b/drivers/char/drm/Kconfig
@@ -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
diff --git a/drivers/char/drm/radeon_drv.c b/drivers/char/drm/radeon_drv.c
index 2eb652e..d8911bc 100644
--- a/drivers/char/drm/radeon_drv.c
+++ b/drivers/char/drm/radeon_drv.c
@@ -31,6 +31,8 @@
 
 #include "drmP.h"
 #include "drm.h"
+#include <linux/pm.h>
+#include <linux/radeon_gpu.h>
 #include "radeon_drm.h"
 #include "radeon_drv.h"
 
@@ -52,10 +54,23 @@ static int dri_library_name(struct drm_d
 		        "r300"));
 }
 
+static int __devinit radeondrm_gpu_register (struct gpu_device *gdev, void *driver_id);
+static void __devexit radeondrm_gpu_unregister (struct gpu_device *gdev);
+
 static struct pci_device_id pciidlist[] = {
 	radeon_PCI_IDS
 };
 
+static int radeondrm_suspend(struct device *dev, pm_message_t state)
+{
+	return 0;
+}
+
+static int radeondrm_resume(struct device *dev)
+{
+	return 0;
+}
+
 static struct drm_driver driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
@@ -92,12 +107,18 @@ #ifdef CONFIG_COMPAT
 		 .compat_ioctl = radeon_compat_ioctl,
 #endif
 	},
-
-	.pci_driver = {
+	.drv_type = DRM_DRV_GPU,
+	.gpu_driver = {
 		 .name = DRIVER_NAME,
-		 .id_table = pciidlist,
-	},
-
+		 .drv_type = GPU_DRM,
+		 .driver = {
+		             .suspend = radeondrm_suspend,
+			     .resume = radeondrm_resume,
+		 },
+		 .probe = radeondrm_gpu_register,
+		 .remove = __devexit_p(radeondrm_gpu_unregister),
+		 .id_table = (void *)pciidlist,
+	 },
 	.name = DRIVER_NAME,
 	.desc = DRIVER_DESC,
 	.date = DRIVER_DATE,
@@ -106,15 +127,34 @@ #endif
 	.patchlevel = DRIVER_PATCHLEVEL,
 };
 
+
+static int __devinit radeondrm_gpu_register(struct gpu_device *gdev, void *driver_id)
+{
+	int retval;
+	struct radeon_gpu_info *gpu_info;
+
+	gpu_info = dev_get_drvdata(gdev->dev.parent);
+
+	retval = drm_gpu_get_dev(gdev, &driver, driver_id, gpu_info->pdev);
+	return retval;
+}
+
+static void __devexit radeondrm_gpu_unregister (struct gpu_device *gdev)
+{
+	drm_gpu_cleanup(gdev);
+}
+
 static int __init radeon_init(void)
 {
 	driver.num_ioctls = radeon_max_ioctl;
-	return drm_init(&driver);
+	drm_mem_init();
+
+	return radeon_gpu_register_driver(&driver.gpu_driver, THIS_MODULE);
 }
 
 static void __exit radeon_exit(void)
 {
-	drm_exit(&driver);
+	gpu_unregister_driver(&driver.gpu_driver);
 }
 
 module_init(radeon_init);
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h
index 8b105f1..650fc8e 100644
--- a/drivers/char/drm/radeon_drv.h
+++ b/drivers/char/drm/radeon_drv.h
@@ -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,
-- 
1.4.1.ga3e6

  reply	other threads:[~2007-01-24 11:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-24 11:20 gpu sharing layer for kernel airlied
2007-01-24 11:20 ` [PATCH] gpu: Initial gpu layer addition airlied
2007-01-24 11:20   ` [PATCH] gpu/radeon: add a radeon lowlevel GPU driver airlied
2007-01-24 11:20     ` [PATCH] gpu/radeonfb: add GPU support to radeonfb airlied
2007-01-24 11:20       ` [PATCH] gpu/drm: Add GPU layer support to generic DRM airlied
2007-01-24 11:20         ` airlied [this message]
2007-01-25  0:07       ` [PATCH] gpu/radeonfb: add GPU support to radeonfb Benjamin Herrenschmidt
2007-01-30 19:50         ` Dave Airlie
2007-01-24 21:46 ` gpu sharing layer for kernel Greg KH
2007-01-24 22:39   ` Dave Airlie
2007-01-25 22:06     ` Greg KH
2007-01-28 21:16       ` Dave Jones
2007-02-07 18:42     ` James Simmons
2007-02-06 19:40   ` James Simmons
2007-01-25  7:56 ` Paul Collins
2007-01-30 19:49   ` Dave Airlie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11696376452577-git-send-email-airlied@linux.ie \
    --to=airlied@linux.ie \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.