rpms/kernel/devel drm-vga-arb.patch, 1.2, 1.3 kernel.spec, 1.1667, 1.1668 linux-2.6-vga-arb.patch, 1.2, 1.3
Dave Airlie
airlied at fedoraproject.org
Wed Jul 29 00:35:00 UTC 2009
Author: airlied
Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13907
Modified Files:
drm-vga-arb.patch kernel.spec linux-2.6-vga-arb.patch
Log Message:
* Wed Jul 29 2009 Dave Airlie <airlied at redhat.com>
- update VGA arb patches
drm-vga-arb.patch:
drivers/gpu/drm/drm_irq.c | 27 +++++++++++++++++++++++++++
drivers/gpu/drm/i915/i915_dma.c | 20 ++++++++++++++++++++
drivers/gpu/drm/i915/i915_drv.h | 1 +
drivers/gpu/drm/i915/i915_reg.h | 1 +
drivers/gpu/drm/i915/intel_display.c | 23 +++++++++++++++++++++++
drivers/gpu/drm/i915/intel_drv.h | 1 +
drivers/gpu/drm/radeon/r100.c | 14 ++++++++++++++
drivers/gpu/drm/radeon/radeon.h | 2 ++
drivers/gpu/drm/radeon/radeon_asic.h | 9 +++++++++
drivers/gpu/drm/radeon/radeon_device.c | 20 +++++++++++++++++++-
include/drm/drmP.h | 4 +++-
11 files changed, 120 insertions(+), 2 deletions(-)
Index: drm-vga-arb.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/drm-vga-arb.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- drm-vga-arb.patch 27 Jul 2009 03:04:07 -0000 1.2
+++ drm-vga-arb.patch 29 Jul 2009 00:34:59 -0000 1.3
@@ -1,4 +1,4 @@
-From c45aab9228c3a2e349bf6d1f3fa2575102fc8240 Mon Sep 17 00:00:00 2001
+From 7f8919f77fb703526f87b56d11e76cd46cc6da3f Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied at redhat.com>
Date: Thu, 16 Jul 2009 14:33:58 +1000
Subject: [PATCH] drm: add support to drm for VGA arbitration.
@@ -14,7 +14,7 @@ intel/kms: add support to disable VGA de
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
drivers/gpu/drm/drm_irq.c | 27 +++++++++++++++++++++++++++
- drivers/gpu/drm/i915/i915_dma.c | 25 +++++++++++++++++++++++++
+ drivers/gpu/drm/i915/i915_dma.c | 20 ++++++++++++++++++++
drivers/gpu/drm/i915/i915_drv.h | 1 +
drivers/gpu/drm/i915/i915_reg.h | 1 +
drivers/gpu/drm/i915/intel_display.c | 23 +++++++++++++++++++++++
@@ -22,9 +22,9 @@ Signed-off-by: Dave Airlie <airlied at redh
drivers/gpu/drm/radeon/r100.c | 14 ++++++++++++++
drivers/gpu/drm/radeon/radeon.h | 2 ++
drivers/gpu/drm/radeon/radeon_asic.h | 9 +++++++++
- drivers/gpu/drm/radeon/radeon_device.c | 24 +++++++++++++++++++++++-
+ drivers/gpu/drm/radeon/radeon_device.c | 20 +++++++++++++++++++-
include/drm/drmP.h | 3 +++
- 11 files changed, 129 insertions(+), 1 deletions(-)
+ 11 files changed, 120 insertions(+), 1 deletions(-)
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index b4a3dbc..dffc73d 100644
@@ -86,7 +86,7 @@ index b4a3dbc..dffc73d 100644
free_irq(dev->pdev->irq, dev);
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
-index 8c47831..2530fb0 100644
+index 8c47831..f7e1342 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -33,6 +33,7 @@
@@ -97,44 +97,39 @@ index 8c47831..2530fb0 100644
#define I915_DRV "i915_drv"
/* Really want an OS-independent resettable timer. Would like to have
-@@ -984,6 +985,21 @@ static int i915_probe_agp(struct drm_device *dev, uint32_t *aperture_size,
+@@ -984,6 +985,19 @@ static int i915_probe_agp(struct drm_device *dev, uint32_t *aperture_size,
return 0;
}
-+/* if we get transitioned to only one device, tak VGA back */
-+static unsigned int i915_vga_count_notify(void *cookie, int new_count)
++/* true = enable decode, false = disable decoder */
++static unsigned int i915_vga_set_decode(void *cookie, bool state)
+{
+ struct drm_device *dev = cookie;
+
-+ if (new_count == 1) {
-+ intel_modeset_vga_set_state(dev, true);
++ intel_modeset_vga_set_state(dev, state);
++ if (state)
+ return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
+ VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
-+ } else {
-+ intel_modeset_vga_set_state(dev, false);
++ else
+ return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
-+ }
+}
+
static int i915_load_modeset_init(struct drm_device *dev,
unsigned long prealloc_size,
unsigned long agp_size)
-@@ -1029,6 +1045,14 @@ static int i915_load_modeset_init(struct drm_device *dev,
+@@ -1029,6 +1043,11 @@ static int i915_load_modeset_init(struct drm_device *dev,
if (ret)
DRM_INFO("failed to find VBIOS tables\n");
+ /* if we have > 1 VGA cards, then disable the radeon VGA resources */
-+ ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_count_notify);
-+ if (ret > 1) {
-+ /* false is turn off VGA decode */
-+ intel_modeset_vga_set_state(dev, false);
-+ vga_set_legacy_decoding(dev->pdev, VGA_RSRC_NORMAL_IO|VGA_RSRC_NORMAL_MEM);
-+ }
++ ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode);
++ if (ret)
++ goto destroy_ringbuffer;
+
ret = drm_irq_install(dev);
if (ret)
goto destroy_ringbuffer;
-@@ -1278,6 +1302,7 @@ int i915_driver_unload(struct drm_device *dev)
+@@ -1278,6 +1297,7 @@ int i915_driver_unload(struct drm_device *dev)
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
drm_irq_uninstall(dev);
@@ -329,7 +324,7 @@ index e2e5673..59c505c 100644
.mc_init = &r520_mc_init,
.mc_fini = &r520_mc_fini,
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
-index f97563d..b391d12 100644
+index f97563d..d84e924 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -29,6 +29,7 @@
@@ -340,44 +335,40 @@ index f97563d..b391d12 100644
#include "radeon_reg.h"
#include "radeon.h"
#include "radeon_asic.h"
-@@ -440,7 +441,20 @@ void radeon_combios_fini(struct radeon_device *rdev)
+@@ -440,7 +441,18 @@ void radeon_combios_fini(struct radeon_device *rdev)
int radeon_modeset_init(struct radeon_device *rdev);
void radeon_modeset_fini(struct radeon_device *rdev);
+/* if we get transitioned to only one device, tak VGA back */
-+static unsigned int radeon_vga_count_notify(void *cookie, int new_count)
++static unsigned int radeon_vga_set_decode(void *cookie, bool state)
+{
+ struct radeon_device *rdev = cookie;
-+ if (new_count == 1) {
-+ radeon_vga_set_state(rdev, true);
++ radeon_vga_set_state(rdev, state);
++ if (state)
+ return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
+ VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
-+ } else {
-+ radeon_vga_set_state(rdev, false);
++ else
+ return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
-+ }
+}
/*
* Radeon device.
*/
-@@ -516,7 +530,14 @@ int radeon_device_init(struct radeon_device *rdev,
+@@ -516,7 +528,12 @@ int radeon_device_init(struct radeon_device *rdev,
/* Initialize surface registers */
radeon_surface_init(rdev);
- /* TODO: disable VGA need to use VGA request */
+ /* if we have > 1 VGA cards, then disable the radeon VGA resources */
-+ ret = vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_count_notify);
-+ if (ret > 1) {
-+ /* false is turn off VGA decode */
-+ radeon_vga_set_state(rdev, false);
-+ vga_set_legacy_decoding(rdev->pdev, VGA_RSRC_NORMAL_IO|VGA_RSRC_NORMAL_MEM);
++ ret = vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode);
++ if (ret) {
++ return -EINVAL;
+ }
+
/* BIOS*/
if (!radeon_get_bios(rdev)) {
if (ASIC_IS_AVIVO(rdev))
-@@ -652,6 +673,7 @@ void radeon_device_fini(struct radeon_device *rdev)
+@@ -652,6 +669,7 @@ void radeon_device_fini(struct radeon_device *rdev)
radeon_agp_fini(rdev);
#endif
radeon_irq_kms_fini(rdev);
Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1667
retrieving revision 1.1668
diff -u -p -r1.1667 -r1.1668
--- kernel.spec 28 Jul 2009 21:10:45 -0000 1.1667
+++ kernel.spec 29 Jul 2009 00:34:59 -0000 1.1668
@@ -1906,6 +1906,9 @@ fi
# and build.
%changelog
+* Wed Jul 29 2009 Dave Airlie <airlied at redhat.com>
+- update VGA arb patches
+
* Tue Jul 28 2009 Adam Jackson <ajax at redhat.com>
- Remove the pcspkr modalias. If you're still living in 1994, load it
by hand.
linux-2.6-vga-arb.patch:
drivers/gpu/Makefile | 2
drivers/gpu/vga/Kconfig | 10
drivers/gpu/vga/Makefile | 1
drivers/gpu/vga/vgaarb.c | 1150 +++++++++++++++++++++++++++++++++++++++++++++++
drivers/pci/pci.c | 44 +
drivers/video/Kconfig | 2
include/linux/pci.h | 2
include/linux/vgaarb.h | 196 +++++++-
8 files changed, 1405 insertions(+), 2 deletions(-)
Index: linux-2.6-vga-arb.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-vga-arb.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- linux-2.6-vga-arb.patch 27 Jul 2009 03:04:07 -0000 1.2
+++ linux-2.6-vga-arb.patch 29 Jul 2009 00:34:59 -0000 1.3
@@ -1,4 +1,4 @@
-From eba2469d77b9f7d42f08bbd094312678cedae237 Mon Sep 17 00:00:00 2001
+From 61fc475f99444cf1ae1f417b55680f16ab510a00 Mon Sep 17 00:00:00 2001
From: Tiago Vignatti <tiago.vignatti at nokia.com>
Date: Tue, 14 Jul 2009 15:57:29 +0300
Subject: [PATCH] vga: implements VGA arbitration on Linux
@@ -6,18 +6,23 @@ Subject: [PATCH] vga: implements VGA arb
changes since last patch:
fixup unlock userspace api so it can't go < 0
add exports for vga put/get/tryget
+fix up so the arb doesn't turn off vga decodes
+on hw until first used. This worksaround an
+X.org problem with older X servers which fail
+at detecting boot device if doesn't have the VGA
+bit enabled. Newer pciacccess + X server fix this.
Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
drivers/gpu/Makefile | 2 +-
drivers/gpu/vga/Kconfig | 10 +
drivers/gpu/vga/Makefile | 1 +
- drivers/gpu/vga/vgaarb.c | 1125 ++++++++++++++++++++++++++++++++++++++++++++++
+ drivers/gpu/vga/vgaarb.c | 1150 ++++++++++++++++++++++++++++++++++++++++++++++
drivers/pci/pci.c | 44 ++
drivers/video/Kconfig | 2 +
include/linux/pci.h | 2 +
- include/linux/vgaarb.h | 198 ++++++++
- 8 files changed, 1383 insertions(+), 1 deletions(-)
+ include/linux/vgaarb.h | 195 ++++++++
+ 8 files changed, 1405 insertions(+), 1 deletions(-)
create mode 100644 drivers/gpu/vga/Kconfig
create mode 100644 drivers/gpu/vga/Makefile
create mode 100644 drivers/gpu/vga/vgaarb.c
@@ -55,10 +60,10 @@ index 0000000..7cc8c1e
+obj-$(CONFIG_VGA_ARB) += vgaarb.o
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
new file mode 100644
-index 0000000..ab77d4b
+index 0000000..3925e6c
--- /dev/null
+++ b/drivers/gpu/vga/vgaarb.c
-@@ -0,0 +1,1125 @@
+@@ -0,0 +1,1150 @@
+/*
+ * vgaarb.c
+ *
@@ -86,6 +91,7 @@ index 0000000..ab77d4b
+
+#include <linux/vgaarb.h>
+
++static void vga_arbiter_notify_clients(void);
+/*
+ * We keep a list of all vga devices in the system to speed
+ * up the various operations of the arbiter
@@ -104,11 +110,12 @@ index 0000000..ab77d4b
+ /* allow IRQ enable/disable hook */
+ void *cookie;
+ void (*irq_set_state)(void *cookie, bool enable);
-+ unsigned int (*count_notify)(void *cookie, int new_count);
++ unsigned int (*set_vga_decode)(void *cookie, bool decode);
+};
+
+static LIST_HEAD(vga_list);
+static int vga_count;
++static bool vga_arbiter_used;
+static DEFINE_SPINLOCK(vga_lock);
+static DECLARE_WAIT_QUEUE_HEAD(vga_wait_queue);
+
@@ -182,6 +189,21 @@ index 0000000..ab77d4b
+ vgadev->irq_set_state(vgadev->cookie, state);
+}
+
++
++/* If we don't ever use VGA arb we should avoid
++ turning off anything anywhere due to old X servers getting
++ confused about the boot device not being VGA */
++static void vga_check_first_use(void)
++{
++ /* we should inform all GPUs in the system that
++ * VGA arb has occured and to try and disable resources
++ * if they can */
++ if (!vga_arbiter_used) {
++ vga_arbiter_used = true;
++ vga_arbiter_notify_clients();
++ }
++}
++
+static struct vga_device *__vga_tryget(struct vga_device *vgadev,
+ unsigned int rsrc)
+{
@@ -353,6 +375,7 @@ index 0000000..ab77d4b
+ wait_queue_t wait;
+ int rc = 0;
+
++ vga_check_first_use();
+ /* The one who calls us should check for this, but lets be sure... */
+ if (pdev == NULL)
+ pdev = vga_default_device();
@@ -402,6 +425,8 @@ index 0000000..ab77d4b
+ unsigned long flags;
+ int rc = 0;
+
++ vga_check_first_use();
++
+ /* The one who calls us should check for this, but lets be sure... */
+ if (pdev == NULL)
+ pdev = vga_default_device();
@@ -516,7 +541,6 @@ index 0000000..ab77d4b
+ if (vga_default == NULL &&
+ ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK))
+ vga_default = pci_dev_get(pdev);
-+
+#endif
+
+ /* Add to the list */
@@ -579,7 +603,7 @@ index 0000000..ab77d4b
+ goto bail;
+
+ /* don't let userspace futz with kernel driver decodes */
-+ if (userspace && vgadev->count_notify)
++ if (userspace && vgadev->set_vga_decode)
+ goto bail;
+
+ old_decodes = vgadev->decodes;
@@ -609,7 +633,7 @@ index 0000000..ab77d4b
+/* call with NULL to unregister */
+int vga_client_register(struct pci_dev *pdev, void *cookie,
+ void (*irq_set_state)(void *cookie, bool state),
-+ unsigned int (*count_notify)(void *cookie, int vga_count))
++ unsigned int (*set_vga_decode)(void *cookie, bool decode))
+{
+ int ret = -1;
+ struct vga_device *vgadev;
@@ -621,7 +645,7 @@ index 0000000..ab77d4b
+ goto bail;
+
+ vgadev->irq_set_state = irq_set_state;
-+ vgadev->count_notify = count_notify;
++ vgadev->set_vga_decode = set_vga_decode;
+ vgadev->cookie = cookie;
+ ret = vga_count;
+
@@ -837,8 +861,6 @@ index 0000000..ab77d4b
+ goto done;
+ }
+
-+
-+
+ pdev = priv->target;
+ if (priv->target == NULL) {
+ ret_val = -ENODEV;
@@ -1113,11 +1135,19 @@ index 0000000..ab77d4b
+ struct vga_device *vgadev;
+ unsigned long flags;
+ uint32_t new_decodes;
++ bool new_state;
++
++ if (!vga_arbiter_used)
++ return;
+
+ spin_lock_irqsave(&vga_lock, flags);
+ list_for_each_entry(vgadev, &vga_list, list) {
-+ if (vgadev->count_notify) {
-+ new_decodes = vgadev->count_notify(vgadev->cookie, vga_count);
++ if (vga_count > 1)
++ new_state = false;
++ else
++ new_state = true;
++ if (vgadev->set_vga_decode) {
++ new_decodes = vgadev->set_vga_decode(vgadev->cookie, new_state);
+ vgadev->decodes = new_decodes;
+ vgadev->owns &= new_decodes;
+ }
@@ -1267,10 +1297,10 @@ index 115fb7b..7ba6eba 100644
#include <linux/dmapool.h>
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
new file mode 100644
-index 0000000..229561d
+index 0000000..68229ce
--- /dev/null
+++ b/include/linux/vgaarb.h
-@@ -0,0 +1,198 @@
+@@ -0,0 +1,195 @@
+/*
+ * vgaarb.c
+ *
@@ -1447,12 +1477,9 @@ index 0000000..229561d
+ * If a client can't disable its GPUs VGA resources, then we
+ * need to be able to ask it to turn off its irqs when we
+ * turn off its mem and io decoding.
-+ * count_notify -
++ * set_vga_decode
+ * If a client can disable its GPU VGA resource, it will
-+ * get a count_notify callback everytime a new VGA device shows
-+ * up in the system via hotplug. The client is expected to
-+ * disable VGA legacy decoding if the VGA device goes above 1.
-+ * It can re-enable VGA decoding if the number of devices goes to 0
++ * get a callback from this to set the encode/decode state
+ *
+ * Clients with disable abilities should check the return value
+ * of this function and if the VGA device count is > 1, should
@@ -1466,7 +1493,7 @@ index 0000000..229561d
+ */
+int vga_client_register(struct pci_dev *pdev, void *cookie,
+ void (*irq_set_state)(void *cookie, bool state),
-+ unsigned int (*count_notify)(void *cookie, int vga_count));
++ unsigned int (*set_vga_decode)(void *cookie, bool state));
+
+#endif /* LINUX_VGA_H */
--
More information about the fedora-extras-commits
mailing list