aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_device.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-09-21 00:33:58 -0400
committerDave Airlie <airlied@redhat.com>2009-09-21 01:00:27 -0400
commit28d520433b6375740990ab99d69b0d0067fd656b (patch)
treed3affea0fb69f84b9c924c03d78c5df23946306f /drivers/gpu/drm/radeon/radeon_device.c
parentaadd4e17452d3d5c2269cd2b000b7de7cfb6c79e (diff)
drm/vgaarb: add VGA arbitration support to the drm and kms.
VGA arb requires DRM support for non-kms drivers, to turn on/off irqs when disabling the mem/io regions. VGA arb requires KMS support for GPUs where we can turn off VGA decoding. Currently we know how to do this for intel and radeon kms drivers, which allows them to be removed from the arbiter. This patch comes from Fedora rawhide kernel. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_device.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 8a40c616b534..daf5db780956 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -29,6 +29,7 @@
29#include <drm/drmP.h> 29#include <drm/drmP.h>
30#include <drm/drm_crtc_helper.h> 30#include <drm/drm_crtc_helper.h>
31#include <drm/radeon_drm.h> 31#include <drm/radeon_drm.h>
32#include <linux/vgaarb.h>
32#include "radeon_reg.h" 33#include "radeon_reg.h"
33#include "radeon.h" 34#include "radeon.h"
34#include "radeon_asic.h" 35#include "radeon_asic.h"
@@ -480,7 +481,18 @@ void radeon_combios_fini(struct radeon_device *rdev)
480{ 481{
481} 482}
482 483
484/* if we get transitioned to only one device, tak VGA back */
485static unsigned int radeon_vga_set_decode(void *cookie, bool state)
486{
487 struct radeon_device *rdev = cookie;
483 488
489 radeon_vga_set_state(rdev, state);
490 if (state)
491 return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
492 VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
493 else
494 return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
495}
484/* 496/*
485 * Radeon device. 497 * Radeon device.
486 */ 498 */
@@ -578,6 +590,13 @@ int radeon_device_init(struct radeon_device *rdev,
578 if (r) { 590 if (r) {
579 return r; 591 return r;
580 } 592 }
593
594 /* if we have > 1 VGA cards, then disable the radeon VGA resources */
595 r = vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode);
596 if (r) {
597 return -EINVAL;
598 }
599
581 if (!rdev->new_init_path) { 600 if (!rdev->new_init_path) {
582 /* Setup errata flags */ 601 /* Setup errata flags */
583 radeon_errata(rdev); 602 radeon_errata(rdev);
@@ -586,7 +605,6 @@ int radeon_device_init(struct radeon_device *rdev,
586 /* Initialize surface registers */ 605 /* Initialize surface registers */
587 radeon_surface_init(rdev); 606 radeon_surface_init(rdev);
588 607
589 /* TODO: disable VGA need to use VGA request */
590 /* BIOS*/ 608 /* BIOS*/
591 if (!radeon_get_bios(rdev)) { 609 if (!radeon_get_bios(rdev)) {
592 if (ASIC_IS_AVIVO(rdev)) 610 if (ASIC_IS_AVIVO(rdev))
@@ -697,6 +715,7 @@ void radeon_device_fini(struct radeon_device *rdev)
697 radeon_agp_fini(rdev); 715 radeon_agp_fini(rdev);
698#endif 716#endif
699 radeon_irq_kms_fini(rdev); 717 radeon_irq_kms_fini(rdev);
718 vga_client_register(rdev->pdev, NULL, NULL, NULL);
700 radeon_fence_driver_fini(rdev); 719 radeon_fence_driver_fini(rdev);
701 radeon_clocks_fini(rdev); 720 radeon_clocks_fini(rdev);
702 radeon_object_fini(rdev); 721 radeon_object_fini(rdev);