Skip to contentSkip to conversation

via agp patches

DISCUSSION Greg KH 5 participants 14 messages May 31, 2008 – Jun 6, 2008

Subsystems (2)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

Recently VIA has been distributing some pre-build kernel modules for their latest video cards without the source for it. So I asked, and got the patches. I've forward ported them to the current 2.6.26-rc4 tree, and they also apply cleanly to 2.6.25 as well. They are here in the three emails after this one.

I'm still working on getting some more information on exactly what these patches each do for a good changelog, but until then, if anyone has the hardware and wants to play with the code, here it is.

If anyone has any questions, please let me know.

thanks,

greg k-h

author
#1 lore raw

Looks like this adds a new device id, I have no idea why they remove another one at the same time...

---
 drivers/char/agp/via-agp.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/char/agp/via-agp.c +1 -6
@@ -389,11 +389,6 @@ static struct agp_device_ids via_agp_dev
 		.device_id  = PCI_DEVICE_ID_VIA_VT3324,
 		.chipset_name   = "CX700",
 	},
-	/* VT3336 */
-	{
-		.device_id  = PCI_DEVICE_ID_VIA_VT3336,
-		.chipset_name   = "VT3336",
-	},
 	/* P4M890 */
 	{
 		.device_id  = PCI_DEVICE_ID_VIA_P4M890,
@@ -546,8 +541,8 @@ static const struct pci_device_id agp_vi
 	ID(PCI_DEVICE_ID_VIA_3296_0),
 	ID(PCI_DEVICE_ID_VIA_P4M800CE),
 	ID(PCI_DEVICE_ID_VIA_VT3324),
-	ID(PCI_DEVICE_ID_VIA_VT3336),
 	ID(PCI_DEVICE_ID_VIA_P4M890),
+	ID(PCI_DEVICE_ID_VIA_VT3364),
 	{ }
 };
 
#2 lore raw
Quoted 3 lines · Greg KH

Looks like this adds a new device id, I have no idea why they remove another one at the same time...

I sent a patch adding the missing ident to airlied a few weeks back. I think it's currently in -mm.

The removal of the other id is a mystery to me.

Dave

Signature · 1 line
http://www.codemonkey.org.uk
author
#3 lore raw
Quoted 7 lines · Dave Jones
Quoted 3 lines · Greg KH

Looks like this adds a new device id, I have no idea why they remove another one at the same time...

I sent a patch adding the missing ident to airlied a few weeks back. I think it's currently in -mm.

Great.

Quoted 1 line

The removal of the other id is a mystery to me.

Here's what I got back from Via about this:
VT3336 is a chipset for AMD Athlon/K8 CPU. Due to K8's unique architecture, the AGP resource and behavior are different from the traditional AGP which resides only in chipset. AGP is used by 3D driver which wasn't available for the VT3336 and VT3364 generation until now. Unfortunately, by testing, VT3364 works but VT3336 doesn't. That is why the subtraction. I think other options are leaving it in the AGP, but removing it from our DRI driver. Or, just leave it in both but warn people for issues in the release note.

So it sounds like it would be good to remove that id.

thanks,

greg k-h

#4 lore raw
Quoted 25 lines · Greg KH
Quoted 7 lines · Dave Jones
Quoted 3 lines · Greg KH

Looks like this adds a new device id, I have no idea why they remove another one at the same time...

I sent a patch adding the missing ident to airlied a few weeks back. I think it's currently in -mm.

Great.

Quoted 1 line

The removal of the other id is a mystery to me.

Here's what I got back from Via about this:
VT3336 is a chipset for AMD Athlon/K8 CPU. Due to K8's unique architecture, the AGP resource and behavior are different from the traditional AGP which resides only in chipset. AGP is used by 3D driver which wasn't available for the VT3336 and VT3364 generation until now. Unfortunately, by testing, VT3364 works but VT3336 doesn't. That is why the subtraction. I think other options are leaving it in the AGP, but removing it from our DRI driver. Or, just leave it in both but warn people for issues in the release note.

Quoted 1 line

So it sounds like it would be good to remove that id.

Sounds plausible. This needs to go in the changelog. A lot of their K8 chipsets were also used on P4 (I think they abstracted the architectural differences with V-Link), but if they claim this wasn't used on any of the P4 boards, I guess they would know better than us.

(The irony here is that the cset that introduced that ID came
from a patch where someone copied a giant diff on one of VIA's earlier portals).

Dave

Signature · 1 line
http://www.codemonkey.org.uk
author
#5 lore raw
Quoted 26 lines · Dave Jones
Quoted 25 lines · Greg KH
Quoted 7 lines · Dave Jones
Quoted 3 lines · Greg KH

Looks like this adds a new device id, I have no idea why they remove another one at the same time...

I sent a patch adding the missing ident to airlied a few weeks back. I think it's currently in -mm.

Great.

Quoted 1 line

The removal of the other id is a mystery to me.

Here's what I got back from Via about this:
VT3336 is a chipset for AMD Athlon/K8 CPU. Due to K8's unique architecture, the AGP resource and behavior are different from the traditional AGP which resides only in chipset. AGP is used by 3D driver which wasn't available for the VT3336 and VT3364 generation until now. Unfortunately, by testing, VT3364 works but VT3336 doesn't. That is why the subtraction. I think other options are leaving it in the AGP, but removing it from our DRI driver. Or, just leave it in both but warn people for issues in the release note.

Quoted 3 lines
Quoted 1 line

So it sounds like it would be good to remove that id.

Sounds plausible. This needs to go in the changelog.

I will put it there.

Quoted 4 lines

A lot of their K8 chipsets were also used on P4 (I think they abstracted the architectural differences with V-Link), but if they claim this wasn't used on any of the P4 boards, I guess they would know better than us.

One would hope :)

thanks,

greg k-h

author
#6 lore raw
In reply to Greg KH

This looks like the meatiest patch, with lots of support for new hardware. Gotta love the StudlyCaps...

---
 drivers/char/drm/Kconfig              |    7 
 drivers/char/drm/Makefile             |    2 
 drivers/char/drm/drm_pciids.h         |    9 
 drivers/char/drm/via_chrome9_3d_reg.h |  395 +++++++++++
 drivers/char/drm/via_chrome9_dma.c    | 1147 ++++++++++++++++++++++++++++++++++
 drivers/char/drm/via_chrome9_dma.h    |   68 ++
 drivers/char/drm/via_chrome9_drm.c    |  993 +++++++++++++++++++++++++++++
 drivers/char/drm/via_chrome9_drm.h    |  423 ++++++++++++
 drivers/char/drm/via_chrome9_drv.c    |  153 ++++
 drivers/char/drm/via_chrome9_drv.h    |  145 ++++
 drivers/char/drm/via_chrome9_mm.c     |  388 +++++++++++
 drivers/char/drm/via_chrome9_mm.h     |   67 +
 12 files changed, 3796 insertions(+), 1 deletion(-)
drivers/char/drm/drm_pciids.h +8 -1
@@ -339,10 +339,17 @@
 	{0x1106, 0x3108, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
 	{0x1106, 0x3344, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
 	{0x1106, 0x3343, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-	{0x1106, 0x3230, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VIA_DX9_0}, \
 	{0x1106, 0x3157, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VIA_PRO_GROUP_A}, \
 	{0, 0, 0}
 
+
+#define via_chrome9DRV_PCI_IDS \
+	{0x1106, 0x3225, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1106, 0x3230, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VIA_CHROME9_DX9_0}, \
+	{0x1106, 0x3371, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1106, 0x1122, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VIA_CHROME9_PCIE_GROUP},\
+	{0, 0, 0}
+
 #define i810_PCI_IDS \
 	{0x8086, 0x7121, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
 	{0x8086, 0x7123, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
drivers/char/drm/Kconfig +7 -0
@@ -99,6 +99,13 @@ config DRM_VIA
 	  Choose this option if you have a Via unichrome or compatible video
 	  chipset. If M is selected the module will be called via.
 
+config DRM_VIA_CHROME9
+	tristate "Via unichrome9 video cards"
+	depends on DRM
+	help
+	  Choose this option if you have a Via unichrome9 or compatible video
+	  chipset. If M is selected the module will be called via_chrome9.
+
 config DRM_SAVAGE
 	tristate "Savage video cards"
 	depends on DRM
drivers/char/drm/Makefile +2 -0
@@ -18,6 +18,7 @@ radeon-objs := radeon_drv.o radeon_cp.o 
 sis-objs    := sis_drv.o sis_mm.o
 savage-objs := savage_drv.o savage_bci.o savage_state.o
 via-objs    := via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o via_dmablit.o
+via_chrome9-objs := via_chrome9_drv.o via_chrome9_drm.o via_chrome9_mm.o via_chrome9_dma.o
 
 ifeq ($(CONFIG_COMPAT),y)
 drm-objs    += drm_ioc32.o
@@ -38,3 +39,4 @@ obj-$(CONFIG_DRM_I915)  += i915.o
 obj-$(CONFIG_DRM_SIS)   += sis.o
 obj-$(CONFIG_DRM_SAVAGE)+= savage.o
 obj-$(CONFIG_DRM_VIA)	+=via.o
+obj-$(CONFIG_DRM_VIA_CHROME9) += via_chrome9.o
drivers/char/drm/via_chrome9_3d_reg.h new file +395 -0

395 lines not on this page · raw message

drivers/char/drm/via_chrome9_dma.c new file +1147 -0

1,147 lines not on this page · raw message

drivers/char/drm/via_chrome9_dma.h new file +68 -0

68 lines not on this page · raw message

drivers/char/drm/via_chrome9_drm.c new file +993 -0

993 lines not on this page · raw message

drivers/char/drm/via_chrome9_drm.h new file +423 -0

355 lines not on this page · raw message

drivers/char/drm/via_chrome9_drv.c new file +153 -0

153 lines not on this page · raw message

drivers/char/drm/via_chrome9_drv.h new file +145 -0

145 lines not on this page · raw message

drivers/char/drm/via_chrome9_mm.c new file +388 -0

388 lines not on this page · raw message

drivers/char/drm/via_chrome9_mm.h new file +67 -0

67 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#7 lore raw
Quoted 11 lines · On Fri, 30 May 2008 17:33:54 -0700 Greg KH <[email protected]> wrote:

This looks like the meatiest patch, with lots of support for new hardware. Gotta love the StudlyCaps...

+ * 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:

Do we think the above is GPL compatible, do VIA think so, do VIA care to say in writing they consider it is if there are questions ?

#8 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"AC" == Alan Cox <[email protected]> writes:

AC> Do we think the above is GPL compatible, do VIA think so, do VIA AC> care to say in writing they consider it is if there are questions?

It seems to me that's just an MIT variant, identical to what Fedora calls the "Modern Style with sublicense"
http://fedoraproject.org/wiki/Licensing/MIT which is GPL compatible according to the FSF at least (although the FSF prefers that it not be called "the MIT license" for various reasons).

- J<

author
#9 lore raw
In reply to Alan Cox
Quoted 15 lines · Alan Cox
Quoted 11 lines · On Fri, 30 May 2008 17:33:54 -0700 Greg KH <[email protected]> wrote:

This looks like the meatiest patch, with lots of support for new hardware. Gotta love the StudlyCaps...

+ * 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:

Quoted 2 lines

Do we think the above is GPL compatible, do VIA think so, do VIA care to say in writing they consider it is if there are questions ?

As Via states in this patch later on:

	MODULE_LICENSE("GPL and additional rights");

Yes, I think it is fair to say it is GPL compatible. Isn't this just a variant of the BSD license?

thanks,

greg k-h

#10 lore raw
Quoted 6 lines

As Via states in this patch later on:

	MODULE_LICENSE("GPL and additional rights");

Yes, I think it is fair to say it is GPL compatible. Isn't this just a variant of the BSD license?

Well VIA said in the LICENCSE GPL and .. so that is fine.

author
#11 lore raw
In reply to Greg KH

This primarily looks like coding style cleanup, removing some typedefs and fixing lines that are longer than 80 characters.

If there are any real code changes in here, I didn't notice them.

---
 drivers/char/drm/via_3d_reg.h   |   12 -
 drivers/char/drm/via_dma.c      |  353 +++++++++++++++++++++++++++-------------
 drivers/char/drm/via_dmablit.c  |  325 +++++++++++++++++++++---------------
 drivers/char/drm/via_dmablit.h  |   22 +-
 drivers/char/drm/via_drm.h      |  142 ++++++++++------
 drivers/char/drm/via_drv.c      |   13 +
 drivers/char/drm/via_drv.h      |   93 ++++++----
 drivers/char/drm/via_irq.c      |   66 ++++---
 drivers/char/drm/via_map.c      |   75 +++++++-
 drivers/char/drm/via_mm.c       |  249 ++++++++++++++++++++++------
 drivers/char/drm/via_verifier.c |  269 +++++++++++++++---------------
 drivers/char/drm/via_verifier.h |   64 +++----
 drivers/char/drm/via_video.c    |   70 ++++---
 13 files changed, 1111 insertions(+), 642 deletions(-)
drivers/char/drm/via_3d_reg.h +6 -6
@@ -1605,18 +1605,18 @@
 #define HC_ACMD_H4COUNT_MASK    0x01fffe00
 #define HC_ACMD_H4COUNT_SHIFT   9
 
-/********************************************************************************
+/******************************************************************************
 ** Define Header
-********************************************************************************/
+*******************************************************************************/
 #define HC_HEADER2		0xF210F110
 
-/********************************************************************************
+/******************************************************************************
 ** Define Dummy Value
-********************************************************************************/
+*******************************************************************************/
 #define HC_DUMMY		0xCCCCCCCC
-/********************************************************************************
+/******************************************************************************
 ** Define for DMA use
-********************************************************************************/
+*******************************************************************************/
 #define HALCYON_HEADER2     0XF210F110
 #define HALCYON_FIRECMD     0XEE100000
 #define HALCYON_FIREMASK    0XFFF00000
drivers/char/drm/via_dmablit.c +186 -139

679 lines not on this page · raw message

drivers/char/drm/via_dmablit.h +11 -11
@@ -35,30 +35,30 @@
 #define VIA_NUM_BLIT_ENGINES 2
 #define VIA_NUM_BLIT_SLOTS 8
 
-struct _drm_via_descriptor;
+struct drm_via_descriptor;
 
-typedef struct _drm_via_sg_info {
+struct drm_via_sg_info {
 	struct page **pages;
 	unsigned long num_pages;
-	struct _drm_via_descriptor **desc_pages;
+	struct drm_via_descriptor **desc_pages;
 	int num_desc_pages;
 	int num_desc;
 	enum dma_data_direction direction;
 	unsigned char *bounce_buffer;
-        dma_addr_t chain_start;
+	dma_addr_t chain_start;
 	uint32_t free_on_sequence;
-        unsigned int descriptors_per_page;
+	unsigned int descriptors_per_page;
 	int aborted;
 	enum {
-	        dr_via_device_mapped,
+		dr_via_device_mapped,
 		dr_via_desc_pages_alloc,
 		dr_via_pages_locked,
 		dr_via_pages_alloc,
 		dr_via_sg_init
 	} state;
-} drm_via_sg_info_t;
+};
 
-typedef struct _drm_via_blitq {
+struct drm_via_blitq {
 	struct drm_device *dev;
 	uint32_t cur_blit_handle;
 	uint32_t done_blit_handle;
@@ -68,15 +68,15 @@ typedef struct _drm_via_blitq {
 	unsigned num_free;
 	unsigned num_outstanding;
 	unsigned long end;
-        int aborting;
+	int aborting;
 	int is_active;
-	drm_via_sg_info_t *blits[VIA_NUM_BLIT_SLOTS];
+	struct drm_via_sg_info *blits[VIA_NUM_BLIT_SLOTS];
 	spinlock_t blit_lock;
 	wait_queue_head_t blit_queue[VIA_NUM_BLIT_SLOTS];
 	wait_queue_head_t busy_queue;
 	struct work_struct wq;
 	struct timer_list poll_timer;
-} drm_via_blitq_t;
+};
 
 
 /*
drivers/char/drm/via_dma.c +243 -110

636 lines not on this page · raw message

drivers/char/drm/via_drm.h +94 -48

263 lines not on this page · raw message

drivers/char/drm/via_drv.c +11 -2
@@ -37,10 +37,17 @@ static struct pci_device_id pciidlist[] 
 	viadrv_PCI_IDS
 };
 
+int  via_driver_open(struct drm_device *dev, struct drm_file *priv)
+{
+    priv->authenticated = 1;
+    return 0;
+}
+
 static struct drm_driver driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ |
 	    DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL,
+	.open = via_driver_open,
 	.load = via_driver_load,
 	.unload = via_driver_unload,
 	.context_dtor = via_final_context,
@@ -68,8 +75,10 @@ static struct drm_driver driver = {
 		 .fasync = drm_fasync,
 	},
 	.pci_driver = {
-		 .name = DRIVER_NAME,
-		 .id_table = pciidlist,
+		.name = DRIVER_NAME,
+		.id_table = pciidlist,
+		.suspend = via_drm_suspend,
+		.resume = via_drm_resume,
 	},
 
 	.name = DRIVER_NAME,
drivers/char/drm/via_drv.h +57 -36

155 lines not on this page · raw message

drivers/char/drm/via_irq.c +39 -27

147 lines not on this page · raw message

drivers/char/drm/via_map.c +63 -12

127 lines not on this page · raw message

drivers/char/drm/via_mm.c +197 -52

342 lines not on this page · raw message

drivers/char/drm/via_verifier.c +136 -133

542 lines not on this page · raw message

drivers/char/drm/via_verifier.h +32 -32

64 lines not on this page · raw message

drivers/char/drm/via_video.c +36 -34

70 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#12 lore raw
In reply to Greg KH
Quoted 6 lines · Greg KH

Recently VIA has been distributing some pre-build kernel modules for their latest video cards without the source for it. So I asked, and got the patches. I've forward ported them to the current 2.6.26-rc4 tree, and they also apply cleanly to 2.6.25 as well. They are here in the three emails after this one.

Quoted 6 lines

I'm still working on getting some more information on exactly what these patches each do for a good changelog, but until then, if anyone has the hardware and wants to play with the code, here it is.

If anyone has any questions, please let me know.

Like I can pull the cleanups and style one no problems, but really any functional changes
need to be explained with some detail, and the drm changes need to be submitted to [email protected]
and Thomas Hellstrom would need to at least understand them before we could let them into the kernel.

also adding support to the kernel without some idea of what userspace can use it isn't going to happen.

VIA need to deal with the openchrome project to get those sort of changes into an upstream X.org related driver.

Dave.

author
#13 lore raw
Quoted 11 lines · Dave Airlie
Quoted 10 lines · Greg KH

Recently VIA has been distributing some pre-build kernel modules for their latest video cards without the source for it. So I asked, and got the patches. I've forward ported them to the current 2.6.26-rc4 tree, and they also apply cleanly to 2.6.25 as well. They are here in the three emails after this one.

I'm still working on getting some more information on exactly what these patches each do for a good changelog, but until then, if anyone has the hardware and wants to play with the code, here it is.

Quoted 8 lines
Quoted 2 lines

If anyone has any questions, please let me know.

Like I can pull the cleanups and style one no problems, but really any functional changes need to be explained with some detail, and the drm changes need to be submitted to [email protected] and Thomas Hellstrom would need to at least understand them before we could let them into the kernel.

Ok, I'm pushing back on them to get this information, and the userspace portions to match up so that we can see, and actually use this new kernel driver.

Quoted 2 lines

VIA need to deal with the openchrome project to get those sort of changes into an upstream X.org related driver.

I agree, am trying to get them to do this...

thanks,

greg k-h