aboutsummaryrefslogtreecommitdiff
path: root/shared-core
diff options
context:
space:
mode:
Diffstat (limited to 'shared-core')
-rw-r--r--shared-core/i915_dma.c6
-rw-r--r--shared-core/i915_drv.h1
-rw-r--r--shared-core/i915_irq.c13
-rw-r--r--shared-core/i915_reg.h5
4 files changed, 25 insertions, 0 deletions
diff --git a/shared-core/i915_dma.c b/shared-core/i915_dma.c
index 7f458c79..b97b576f 100644
--- a/shared-core/i915_dma.c
+++ b/shared-core/i915_dma.c
@@ -864,6 +864,12 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
ret = drm_addmap(dev, base, size, _DRM_REGISTERS,
_DRM_KERNEL | _DRM_DRIVER, &dev_priv->mmio_map);
+
+ if (IS_GM45(dev))
+ dev->driver->get_vblank_counter = gm45_get_vblank_counter;
+ else
+ dev->driver->get_vblank_counter = i915_get_vblank_counter;
+
#ifdef I915_HAVE_GEM
i915_gem_load(dev);
#endif
diff --git a/shared-core/i915_drv.h b/shared-core/i915_drv.h
index 97e6fe2c..aa97aabb 100644
--- a/shared-core/i915_drv.h
+++ b/shared-core/i915_drv.h
@@ -446,6 +446,7 @@ extern int i915_vblank_pipe_get(struct drm_device *dev, void *data,
extern int i915_enable_vblank(struct drm_device *dev, int crtc);
extern void i915_disable_vblank(struct drm_device *dev, int crtc);
extern u32 i915_get_vblank_counter(struct drm_device *dev, int crtc);
+extern u32 gm45_get_vblank_counter(struct drm_device *dev, int crtc);
extern int i915_vblank_swap(struct drm_device *dev, void *data,
struct drm_file *file_priv);
diff --git a/shared-core/i915_irq.c b/shared-core/i915_irq.c
index 77ff8d8b..50ff93a4 100644
--- a/shared-core/i915_irq.c
+++ b/shared-core/i915_irq.c
@@ -167,6 +167,19 @@ u32 i915_get_vblank_counter(struct drm_device *dev, int pipe)
return count;
}
+u32 gm45_get_vblank_counter(struct drm_device *dev, int pipe)
+{
+ drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+ int reg = pipe ? PIPEB_FRMCOUNT_GM45 : PIPEA_FRMCOUNT_GM45;
+
+ if (!i915_pipe_enabled(dev, pipe)) {
+ DRM_ERROR("trying to get vblank count for disabled pipe %d\n", pipe);
+ return 0;
+ }
+
+ return I915_READ(reg);
+}
+
irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
{
struct drm_device *dev = (struct drm_device *) arg;
diff --git a/shared-core/i915_reg.h b/shared-core/i915_reg.h
index 5c2d9f20..75647757 100644
--- a/shared-core/i915_reg.h
+++ b/shared-core/i915_reg.h
@@ -1326,6 +1326,9 @@
#define PIPE_FRAME_LOW_SHIFT 24
#define PIPE_PIXEL_MASK 0x00ffffff
#define PIPE_PIXEL_SHIFT 0
+/* GM45+ just has to be different */
+#define PIPEA_FRMCOUNT_GM45 0x70040
+#define PIPEA_FLIPCOUNT_GM45 0x70044
/* Cursor A & B regs */
#define CURACNTR 0x70080
@@ -1394,6 +1397,8 @@
#define PIPEBSTAT 0x71024
#define PIPEBFRAMEHIGH 0x71040
#define PIPEBFRAMEPIXEL 0x71044
+#define PIPEB_FRMCOUNT_GM45 0x71040
+#define PIPEB_FLIPCOUNT_GM45 0x71044
/* Display B control */
#define DSPBCNTR 0x71180