diff options
author | rnoland <rnoland@FreeBSD.org> | 2009-02-25 20:24:13 +0000 |
---|---|---|
committer | rnoland <rnoland@FreeBSD.org> | 2009-02-25 20:24:13 +0000 |
commit | 35f0e5ba8fbb4c47932378b8941120b11386e5ae (patch) | |
tree | 65bf3123733437cb4e8c62cdb4ab7e774c5a898e /sys/dev/drm | |
parent | 4abf3eb20011187bff9c7381d361fc9f7fef90bf (diff) | |
download | FreeBSD-src-35f0e5ba8fbb4c47932378b8941120b11386e5ae.zip FreeBSD-src-35f0e5ba8fbb4c47932378b8941120b11386e5ae.tar.gz |
The GM45 handles vblank differently. Pull the changes from Intel in.
MFC after: 2 Weeks
Diffstat (limited to 'sys/dev/drm')
-rw-r--r-- | sys/dev/drm/i915_dma.c | 6 | ||||
-rw-r--r-- | sys/dev/drm/i915_drv.c | 1 | ||||
-rw-r--r-- | sys/dev/drm/i915_drv.h | 1 | ||||
-rw-r--r-- | sys/dev/drm/i915_irq.c | 13 | ||||
-rw-r--r-- | sys/dev/drm/i915_reg.h | 5 |
5 files changed, 25 insertions, 1 deletions
diff --git a/sys/dev/drm/i915_dma.c b/sys/dev/drm/i915_dma.c index 241e9dd..a59aa38 100644 --- a/sys/dev/drm/i915_dma.c +++ b/sys/dev/drm/i915_dma.c @@ -868,6 +868,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/sys/dev/drm/i915_drv.c b/sys/dev/drm/i915_drv.c index aa7f3f1..4e7a4f7 100644 --- a/sys/dev/drm/i915_drv.c +++ b/sys/dev/drm/i915_drv.c @@ -81,7 +81,6 @@ static void i915_configure(struct drm_device *dev) dev->driver->preclose = i915_driver_preclose; dev->driver->lastclose = i915_driver_lastclose; dev->driver->device_is_agp = i915_driver_device_is_agp; - dev->driver->get_vblank_counter = i915_get_vblank_counter; dev->driver->enable_vblank = i915_enable_vblank; dev->driver->disable_vblank = i915_disable_vblank; dev->driver->irq_preinstall = i915_driver_irq_preinstall; diff --git a/sys/dev/drm/i915_drv.h b/sys/dev/drm/i915_drv.h index eb87adc..b67eff8 100644 --- a/sys/dev/drm/i915_drv.h +++ b/sys/dev/drm/i915_drv.h @@ -449,6 +449,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/sys/dev/drm/i915_irq.c b/sys/dev/drm/i915_irq.c index 3407e82..f30dcde 100644 --- a/sys/dev/drm/i915_irq.c +++ b/sys/dev/drm/i915_irq.c @@ -170,6 +170,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/sys/dev/drm/i915_reg.h b/sys/dev/drm/i915_reg.h index 003223d..a9142d0 100644 --- a/sys/dev/drm/i915_reg.h +++ b/sys/dev/drm/i915_reg.h @@ -1329,6 +1329,9 @@ __FBSDID("$FreeBSD$"); #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 @@ -1397,6 +1400,8 @@ __FBSDID("$FreeBSD$"); #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 |