hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/gpu/drm/radeon/radeon_kms.c
....@@ -25,15 +25,21 @@
2525 * Alex Deucher
2626 * Jerome Glisse
2727 */
28
-#include <drm/drmP.h>
29
-#include <drm/drm_fb_helper.h>
30
-#include "radeon.h"
31
-#include <drm/radeon_drm.h>
32
-#include "radeon_asic.h"
3328
34
-#include <linux/vga_switcheroo.h>
35
-#include <linux/slab.h>
29
+#include <linux/pci.h>
3630 #include <linux/pm_runtime.h>
31
+#include <linux/slab.h>
32
+#include <linux/uaccess.h>
33
+#include <linux/vga_switcheroo.h>
34
+
35
+#include <drm/drm_agpsupport.h>
36
+#include <drm/drm_fb_helper.h>
37
+#include <drm/drm_file.h>
38
+#include <drm/drm_ioctl.h>
39
+#include <drm/radeon_drm.h>
40
+
41
+#include "radeon.h"
42
+#include "radeon_asic.h"
3743
3844 #if defined(CONFIG_VGA_SWITCHEROO)
3945 bool radeon_has_atpx(void);
....@@ -71,6 +77,11 @@
7177
7278 radeon_modeset_fini(rdev);
7379 radeon_device_fini(rdev);
80
+
81
+ if (dev->agp)
82
+ arch_phys_wc_del(dev->agp->agp_mtrr);
83
+ kfree(dev->agp);
84
+ dev->agp = NULL;
7485
7586 done_free:
7687 kfree(rdev);
....@@ -147,7 +158,7 @@
147158 }
148159
149160 if (radeon_is_px(dev)) {
150
- dev_pm_set_driver_flags(dev->dev, DPM_FLAG_NEVER_SKIP);
161
+ dev_pm_set_driver_flags(dev->dev, DPM_FLAG_NO_DIRECT_COMPLETE);
151162 pm_runtime_use_autosuspend(dev->dev);
152163 pm_runtime_set_autosuspend_delay(dev->dev, 5000);
153164 pm_runtime_set_active(dev->dev);
....@@ -743,14 +754,15 @@
743754 /**
744755 * radeon_get_vblank_counter_kms - get frame count
745756 *
746
- * @dev: drm dev pointer
747
- * @pipe: crtc to get the frame count from
757
+ * @crtc: crtc to get the frame count from
748758 *
749759 * Gets the frame count on the requested crtc (all asics).
750760 * Returns frame count on success, -EINVAL on failure.
751761 */
752
-u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
762
+u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc)
753763 {
764
+ struct drm_device *dev = crtc->dev;
765
+ unsigned int pipe = crtc->index;
754766 int vpos, hpos, stat;
755767 u32 count;
756768 struct radeon_device *rdev = dev->dev_private;
....@@ -812,25 +824,26 @@
812824 /**
813825 * radeon_enable_vblank_kms - enable vblank interrupt
814826 *
815
- * @dev: drm dev pointer
816827 * @crtc: crtc to enable vblank interrupt for
817828 *
818829 * Enable the interrupt on the requested crtc (all asics).
819830 * Returns 0 on success, -EINVAL on failure.
820831 */
821
-int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
832
+int radeon_enable_vblank_kms(struct drm_crtc *crtc)
822833 {
834
+ struct drm_device *dev = crtc->dev;
835
+ unsigned int pipe = crtc->index;
823836 struct radeon_device *rdev = dev->dev_private;
824837 unsigned long irqflags;
825838 int r;
826839
827
- if (crtc < 0 || crtc >= rdev->num_crtc) {
828
- DRM_ERROR("Invalid crtc %d\n", crtc);
840
+ if (pipe >= rdev->num_crtc) {
841
+ DRM_ERROR("Invalid crtc %d\n", pipe);
829842 return -EINVAL;
830843 }
831844
832845 spin_lock_irqsave(&rdev->irq.lock, irqflags);
833
- rdev->irq.crtc_vblank_int[crtc] = true;
846
+ rdev->irq.crtc_vblank_int[pipe] = true;
834847 r = radeon_irq_set(rdev);
835848 spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
836849 return r;
....@@ -839,23 +852,24 @@
839852 /**
840853 * radeon_disable_vblank_kms - disable vblank interrupt
841854 *
842
- * @dev: drm dev pointer
843855 * @crtc: crtc to disable vblank interrupt for
844856 *
845857 * Disable the interrupt on the requested crtc (all asics).
846858 */
847
-void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)
859
+void radeon_disable_vblank_kms(struct drm_crtc *crtc)
848860 {
861
+ struct drm_device *dev = crtc->dev;
862
+ unsigned int pipe = crtc->index;
849863 struct radeon_device *rdev = dev->dev_private;
850864 unsigned long irqflags;
851865
852
- if (crtc < 0 || crtc >= rdev->num_crtc) {
853
- DRM_ERROR("Invalid crtc %d\n", crtc);
866
+ if (pipe >= rdev->num_crtc) {
867
+ DRM_ERROR("Invalid crtc %d\n", pipe);
854868 return;
855869 }
856870
857871 spin_lock_irqsave(&rdev->irq.lock, irqflags);
858
- rdev->irq.crtc_vblank_int[crtc] = false;
872
+ rdev->irq.crtc_vblank_int[pipe] = false;
859873 radeon_irq_set(rdev);
860874 spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
861875 }