summaryrefslogtreecommitdiffstats
path: root/sys/dev/drm2/i915/i915_drv.c
diff options
context:
space:
mode:
authordumbbell <dumbbell@FreeBSD.org>2015-04-28 19:35:05 +0000
committerdumbbell <dumbbell@FreeBSD.org>2015-04-28 19:35:05 +0000
commitea79a6539f43803c0c31ce2924f403be84b383cb (patch)
tree5f6306edb9b0d44300b67836b2a0b9b018a4aa15 /sys/dev/drm2/i915/i915_drv.c
parent616b358cb6cac89dff87e789620e451b9828c6f3 (diff)
downloadFreeBSD-src-ea79a6539f43803c0c31ce2924f403be84b383cb.zip
FreeBSD-src-ea79a6539f43803c0c31ce2924f403be84b383cb.tar.gz
drm: Update the device-independent code to match Linux 3.8.13
This update brings few features: o Support for the setmaster/dropmaster ioctls. For instance, they are used to run multiple X servers simultaneously. o Support for minor devices. The only user-visible change is a new entry in /dev/dri but it is useless at the moment. This is a first step to support render nodes [1]. The main benefit is to greatly reduce the diff with Linux (at the expense of an unreadable commit diff). Hopefully, next upgrades will be easier. No updates were made to the drivers, beside adapting them to API changes. [1] https://en.wikipedia.org/wiki/Direct_Rendering_Manager#Render_nodes r280814 is merged at the same time to avoid a short window where RANDR might be broken: drm: Import Linux commit 9bc3cd5673d84d29272fa7181a4dfca83cbb48c1 Author: Ville Syrjälä <ville.syrjala@linux.intel.com> Date: Fri May 31 12:17:08 2013 +0000 drm: Sort connector modes based on vrefresh Keeping the modes sorted by vrefresh before the pixel clock makes the mode list somehow more pleasing to the eye. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com> PR: 198936 (r280814) Tested by: Many people MFC of: r280183, r280187 (original commit by glebius), r280814 Relnotes: yes
Diffstat (limited to 'sys/dev/drm2/i915/i915_drv.c')
-rw-r--r--sys/dev/drm2/i915/i915_drv.c45
1 files changed, 18 insertions, 27 deletions
diff --git a/sys/dev/drm2/i915/i915_drv.c b/sys/dev/drm2/i915/i915_drv.c
index ef6a151..d38c1c9 100644
--- a/sys/dev/drm2/i915/i915_drv.c
+++ b/sys/dev/drm2/i915/i915_drv.c
@@ -298,13 +298,11 @@ static int i915_drm_freeze(struct drm_device *dev)
pci_save_state(dev->pdev);
#endif
- DRM_LOCK(dev);
/* If KMS is active, we do the leavevt stuff here */
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
- error = -i915_gem_idle(dev);
+ error = i915_gem_idle(dev);
if (error) {
- DRM_UNLOCK(dev);
- device_printf(dev->device,
+ device_printf(dev->dev,
"GEM idle failed, resume might fail\n");
return (error);
}
@@ -317,7 +315,6 @@ static int i915_drm_freeze(struct drm_device *dev)
/* Modeset on resume, not lid events */
dev_priv->modeset_on_lid = 0;
- DRM_UNLOCK(dev);
return 0;
}
@@ -331,13 +328,13 @@ i915_suspend(device_t kdev)
dev = device_get_softc(kdev);
if (dev == NULL || dev->dev_private == NULL) {
DRM_ERROR("DRM not initialized, aborting suspend.\n");
- return -ENODEV;
+ return ENODEV;
}
DRM_DEBUG_KMS("starting suspend\n");
error = i915_drm_freeze(dev);
if (error)
- return (error);
+ return (-error);
error = bus_generic_suspend(kdev);
DRM_DEBUG_KMS("finished suspend %d\n", error);
@@ -349,9 +346,10 @@ static int i915_drm_thaw(struct drm_device *dev)
struct drm_i915_private *dev_priv = dev->dev_private;
int error = 0;
- DRM_LOCK(dev);
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+ DRM_LOCK(dev);
i915_gem_restore_gtt_mappings(dev);
+ DRM_UNLOCK(dev);
}
i915_restore_state(dev);
@@ -362,6 +360,7 @@ static int i915_drm_thaw(struct drm_device *dev)
if (HAS_PCH_SPLIT(dev))
ironlake_init_pch_refclk(dev);
+ DRM_LOCK(dev);
dev_priv->mm.suspended = 0;
error = i915_gem_init_hw(dev);
@@ -377,15 +376,12 @@ static int i915_drm_thaw(struct drm_device *dev)
/* Resume the modeset for every activated CRTC */
drm_helper_resume_force_mode(dev);
sx_xunlock(&dev->mode_config.mutex);
- DRM_LOCK(dev);
}
intel_opregion_init(dev);
dev_priv->modeset_on_lid = 0;
- DRM_UNLOCK(dev);
-
return error;
}
@@ -404,9 +400,9 @@ i915_resume(device_t kdev)
pci_set_master(dev->pdev);
#endif
- ret = -i915_drm_thaw(dev);
+ ret = i915_drm_thaw(dev);
if (ret != 0)
- return (ret);
+ return (-ret);
drm_kms_helper_poll_enable(dev);
ret = bus_generic_resume(kdev);
@@ -420,9 +416,9 @@ i915_probe(device_t kdev)
const struct intel_device_info *info;
int error;
- error = drm_probe(kdev, i915_pciidlist);
+ error = drm_probe_helper(kdev, i915_pciidlist);
if (error != 0)
- return (error);
+ return (-error);
info = i915_get_device_id(pci_get_device(kdev));
if (info == NULL)
return (ENXIO);
@@ -434,13 +430,10 @@ int i915_modeset;
static int
i915_attach(device_t kdev)
{
- struct drm_device *dev;
- dev = device_get_softc(kdev);
if (i915_modeset == 1)
i915_driver_info.driver_features |= DRIVER_MODESET;
- dev->driver = &i915_driver_info;
- return (drm_attach(kdev, i915_pciidlist));
+ return (-drm_attach_helper(kdev, i915_pciidlist, &i915_driver_info));
}
static struct fb_info *
@@ -483,7 +476,7 @@ static device_method_t i915_methods[] = {
DEVMETHOD(device_attach, i915_attach),
DEVMETHOD(device_suspend, i915_suspend),
DEVMETHOD(device_resume, i915_resume),
- DEVMETHOD(device_detach, drm_detach),
+ DEVMETHOD(device_detach, drm_generic_detach),
/* Framebuffer service methods */
DEVMETHOD(fb_getinfo, i915_fb_helper_getinfo),
@@ -773,7 +766,7 @@ i965_reset_complete(struct drm_device *dev)
{
u8 gdrst;
- gdrst = pci_read_config(dev->device, I965_GDRST, 1);
+ gdrst = pci_read_config(dev->dev, I965_GDRST, 1);
return (gdrst & GRDOM_RESET_ENABLE) == 0;
}
@@ -788,8 +781,8 @@ i965_do_reset(struct drm_device *dev)
* well as the reset bit (GR/bit 0). Setting the GR bit
* triggers the reset; when done, the hardware will clear it.
*/
- gdrst = pci_read_config(dev->device, I965_GDRST, 1);
- pci_write_config(dev->device, I965_GDRST,
+ gdrst = pci_read_config(dev->dev, I965_GDRST, 1);
+ pci_write_config(dev->dev, I965_GDRST,
gdrst | GRDOM_RENDER | GRDOM_RESET_ENABLE, 1);
ret = wait_for(i965_reset_complete(dev), 500);
@@ -797,8 +790,8 @@ i965_do_reset(struct drm_device *dev)
return ret;
/* We can't reset render&media without also resetting display ... */
- gdrst = pci_read_config(dev->device, I965_GDRST, 1);
- pci_write_config(dev->device, I965_GDRST,
+ gdrst = pci_read_config(dev->dev, I965_GDRST, 1);
+ pci_write_config(dev->dev, I965_GDRST,
gdrst | GRDOM_MEDIA | GRDOM_RESET_ENABLE, 1);
return wait_for(i965_reset_complete(dev), 500);
@@ -949,9 +942,7 @@ int i915_reset(struct drm_device *dev)
if (drm_core_check_feature(dev, DRIVER_MODESET))
intel_modeset_init_hw(dev);
- DRM_LOCK(dev);
drm_irq_uninstall(dev);
- DRM_UNLOCK(dev);
drm_irq_install(dev);
} else
DRM_UNLOCK(dev);
OpenPOWER on IntegriCloud