Lines Matching refs:dev
65 #define RING_LOCK_TEST_WITH_RETURN(dev, file) do { \
66 if (LP_RING(dev->dev_private)->obj == NULL) \
67 LOCK_TEST_WITH_RETURN(dev, file); \
73 if (I915_NEED_GFX_HWS(dev_priv->dev)) {
84 void i915_update_dri1_breadcrumb(struct drm_device *dev)
86 drm_i915_private_t *dev_priv = dev->dev_private;
89 if (dev->primary->master) {
90 master_priv = dev->primary->master->driver_priv;
97 static void i915_write_hws_pga(struct drm_device *dev)
99 drm_i915_private_t *dev_priv = dev->dev_private;
103 if (INTEL_INFO(dev)->gen >= 4)
112 static void i915_free_hws(struct drm_device *dev)
114 drm_i915_private_t *dev_priv = dev->dev_private;
124 drm_core_ioremapfree(&dev_priv->dri1.gfx_hws_cpu_addr, dev);
131 void i915_kernel_lost_context(struct drm_device * dev)
133 drm_i915_private_t *dev_priv = dev->dev_private;
141 if (drm_core_check_feature(dev, DRIVER_MODESET))
150 if (!dev->primary->master)
153 master_priv = dev->primary->master->driver_priv;
158 static int i915_dma_cleanup(struct drm_device * dev)
160 drm_i915_private_t *dev_priv = dev->dev_private;
167 if (dev->irq_enabled)
168 (void) drm_irq_uninstall(dev);
170 mutex_lock(&dev->struct_mutex);
173 mutex_unlock(&dev->struct_mutex);
176 if (I915_NEED_GFX_HWS(dev))
177 i915_free_hws(dev);
182 static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init)
184 drm_i915_private_t *dev_priv = dev->dev_private;
185 struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
188 master_priv->sarea = drm_getsarea(dev);
198 (void) i915_dma_cleanup(dev);
204 ret = intel_render_ring_init_dri(dev,
208 (void) i915_dma_cleanup(dev);
227 static int i915_dma_resume(struct drm_device * dev)
229 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
250 i915_write_hws_pga(dev);
261 if (drm_core_check_feature(dev, DRIVER_MODESET))
266 retcode = i915_initialize(dev, init);
269 retcode = i915_dma_cleanup(dev);
272 retcode = i915_dma_resume(dev);
353 static int i915_emit_cmds(struct drm_device * dev, int *buffer, int dwords)
355 drm_i915_private_t *dev_priv = dev->dev_private;
383 i915_emit_box(struct drm_device *dev,
387 struct drm_i915_private *dev_priv = dev->dev_private;
397 if (INTEL_INFO(dev)->gen >= 4) {
427 static void i915_emit_breadcrumb(struct drm_device *dev)
429 drm_i915_private_t *dev_priv = dev->dev_private;
430 struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
447 static int i915_dispatch_cmdbuffer(struct drm_device * dev,
460 i915_kernel_lost_context(dev);
466 ret = i915_emit_box(dev, &cliprects[i],
472 ret = i915_emit_cmds(dev, cmdbuf, cmd->sz / 4);
477 i915_emit_breadcrumb(dev);
481 static int i915_dispatch_batchbuffer(struct drm_device * dev,
485 struct drm_i915_private *dev_priv = dev->dev_private;
494 i915_kernel_lost_context(dev);
499 ret = i915_emit_box(dev, &cliprects[i],
505 if (!IS_I830(dev) && !IS_845G(dev)) {
510 if (INTEL_INFO(dev)->gen >= 4) {
531 if (IS_G4X(dev) || IS_GEN5(dev)) {
539 i915_emit_breadcrumb(dev);
543 static int i915_dispatch_flip(struct drm_device * dev)
545 drm_i915_private_t *dev_priv = dev->dev_private;
547 dev->primary->master->driver_priv;
558 i915_kernel_lost_context(dev);
597 static int i915_quiescent(struct drm_device * dev)
599 i915_kernel_lost_context(dev);
600 return intel_ring_idle(LP_RING(dev->dev_private));
608 if (drm_core_check_feature(dev, DRIVER_MODESET))
611 RING_LOCK_TEST_WITH_RETURN(dev, file);
613 mutex_lock(&dev->struct_mutex);
614 ret = i915_quiescent(dev);
615 mutex_unlock(&dev->struct_mutex);
623 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
624 struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
631 if (drm_core_check_feature(dev, DRIVER_MODESET))
642 RING_LOCK_TEST_WITH_RETURN(dev, file);
663 mutex_lock(&dev->struct_mutex);
664 ret = i915_dispatch_batchbuffer(dev, batch, cliprects);
665 mutex_unlock(&dev->struct_mutex);
679 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
680 struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
691 if (drm_core_check_feature(dev, DRIVER_MODESET))
694 RING_LOCK_TEST_WITH_RETURN(dev, file);
726 mutex_lock(&dev->struct_mutex);
727 ret = i915_dispatch_cmdbuffer(dev, cmdbuf, cliprects, batch_data);
728 mutex_unlock(&dev->struct_mutex);
745 static int i915_emit_irq(struct drm_device * dev)
747 drm_i915_private_t *dev_priv = dev->dev_private;
748 struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
750 i915_kernel_lost_context(dev);
771 static int i915_wait_irq(struct drm_device * dev, int irq_nr)
773 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
774 struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
810 drm_i915_private_t *dev_priv = dev->dev_private;
814 if (drm_core_check_feature(dev, DRIVER_MODESET))
822 RING_LOCK_TEST_WITH_RETURN(dev, file);
824 mutex_lock(&dev->struct_mutex);
825 result = i915_emit_irq(dev);
826 mutex_unlock(&dev->struct_mutex);
841 drm_i915_private_t *dev_priv = dev->dev_private;
844 if (drm_core_check_feature(dev, DRIVER_MODESET))
852 return i915_wait_irq(dev, irqwait->irq_seq);
858 drm_i915_private_t *dev_priv = dev->dev_private;
861 if (drm_core_check_feature(dev, DRIVER_MODESET))
902 if (drm_core_check_feature(dev, DRIVER_MODESET))
907 RING_LOCK_TEST_WITH_RETURN(dev, file);
909 mutex_lock(&dev->struct_mutex);
910 ret = i915_dispatch_flip(dev);
911 mutex_unlock(&dev->struct_mutex);
919 drm_i915_private_t *dev_priv = dev->dev_private;
930 value = dev->pdev->irq ? 1 : 0;
939 value = dev->pci_device;
973 value = INTEL_INFO(dev)->gen >= 4;
982 value = HAS_LLC(dev);
991 value = i915_semaphore_is_enabled(dev);
1026 drm_i915_private_t *dev_priv = dev->dev_private;
1061 drm_i915_private_t *dev_priv = dev->dev_private;
1065 if (drm_core_check_feature(dev, DRIVER_MODESET))
1068 if (!I915_NEED_GFX_HWS(dev))
1076 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
1086 dev_priv->dri1.gfx_hws_cpu_addr.offset = (u_offset_t)dev->agp_aperbase + hws->addr;
1092 drm_core_ioremap(&dev_priv->dri1.gfx_hws_cpu_addr, dev);
1094 (void) i915_dma_cleanup(dev);
1111 static int i915_get_bridge_dev(struct drm_device *dev)
1113 struct drm_i915_private *dev_priv = dev->dev_private;
1120 if (INTEL_INFO(dev)->gen >= 6)
1128 if (ldi_ident_from_dip(dev->devinfo, &bridge_dev->ldi_id)) {
1139 (void) sprintf(name, "/dev/agp/agptarget%d", i);
1186 struct drm_device *dev = cookie;
1188 (void) intel_modeset_vga_set_state(dev, state);
1197 static int i915_load_modeset_init(struct drm_device *dev)
1199 struct drm_i915_private *dev_priv = dev->dev_private;
1202 ret = intel_parse_bios(dev);
1209 ret = i915_gem_init_stolen(dev);
1214 if (dev->driver->irq_uninstall)
1215 dev->driver->irq_uninstall(dev);
1217 ret = drm_irq_install(dev);
1223 intel_modeset_init(dev);
1225 ret = i915_gem_init(dev);
1230 intel_modeset_gem_init(dev);
1234 dev->vblank_disable_allowed = 1;
1235 if (INTEL_INFO(dev)->num_pipes == 0) {
1241 ret = intel_fbdev_init(dev);
1245 drm_register_fbops(dev);
1249 intel_hpd_init(dev);
1262 intel_fbdev_initial_config(dev);
1267 drm_kms_helper_poll_init(dev);
1275 mutex_lock(&dev->struct_mutex);
1276 i915_gem_cleanup_ringbuffer(dev);
1277 i915_gem_context_fini(dev);
1278 mutex_unlock(&dev->struct_mutex);
1279 i915_gem_cleanup_aliasing_ppgtt(dev);
1282 drm_irq_uninstall(dev);
1284 i915_gem_cleanup_stolen(dev);
1290 int i915_master_create(struct drm_device *dev, struct drm_master *master)
1303 void i915_master_destroy(struct drm_device *dev, struct drm_master *master)
1335 * @dev: DRM device
1341 static void intel_early_sanitize_regs(struct drm_device *dev)
1343 struct drm_i915_private *dev_priv = dev->dev_private;
1345 if (HAS_FPGA_DBG_UNCLAIMED(dev))
1351 * @dev: DRM device
1360 int i915_driver_load(struct drm_device *dev, unsigned long flags)
1370 if (info->gen >= 6 && !drm_core_check_feature(dev, DRIVER_MODESET))
1374 dev->counters += 4;
1375 dev->types[6] = _DRM_STAT_IRQ;
1376 dev->types[7] = _DRM_STAT_PRIMARY;
1377 dev->types[8] = _DRM_STAT_SECONDARY;
1378 dev->types[9] = _DRM_STAT_DMA;
1384 dev->dev_private = (void *)dev_priv;
1385 dev_priv->dev = dev;
1391 mmio_bar = IS_GEN2(dev) ? 1 : 0;
1392 base = drm_get_resource_start(dev, mmio_bar);
1393 size = drm_get_resource_len(dev, mmio_bar);
1400 if (drm_ioremap(dev, dev_priv->regs)) {
1407 intel_early_sanitize_regs(dev);
1417 * All tasks on the workqueue are expected to acquire the dev mutex
1421 dev_priv->wq = create_workqueue(dev->devinfo, "i915");
1429 dev_priv->other_wq = create_workqueue(dev->devinfo, "i915_other");
1437 intel_detect_pch(dev);
1439 intel_irq_init(dev);
1440 intel_pm_init(dev);
1441 intel_gt_sanitize(dev);
1442 intel_gt_init(dev);
1444 if (intel_setup_gmbus(dev) != 0)
1448 intel_setup_bios(dev);
1450 i915_gem_load(dev);
1465 if (!IS_I945G(dev) && !IS_I945GM(dev))
1466 pci_enable_msi(dev->pdev);
1477 if (IS_VALLEYVIEW(dev))
1480 if (INTEL_INFO(dev)->num_pipes) {
1481 ret = drm_vblank_init(dev, INTEL_INFO(dev)->num_pipes);
1489 if (HAS_POWER_WELL(dev))
1490 i915_init_power_well(dev);
1492 if (IS_GEN7(dev))
1499 (void *) dev);
1518 int i915_driver_unload(struct drm_device *dev)
1520 struct drm_i915_private *dev_priv = dev->dev_private;
1523 if (HAS_POWER_WELL(dev))
1524 i915_remove_power_well(dev);
1526 mutex_lock(&dev->struct_mutex);
1527 ret = i915_gpu_idle(dev);
1530 i915_gem_retire_requests(dev);
1531 mutex_unlock(&dev->struct_mutex);
1549 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
1550 (void) drm_irq_uninstall(dev);
1551 /* XXX FIXME vga_client_register(dev->pdev, NULL, NULL, NULL); */
1554 if (dev->pdev->msi_enabled)
1555 pci_disable_msi(dev->pdev);
1557 i915_free_hws(dev);//XXX should still be here ??
1559 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
1561 intel_fbdev_fini(dev);
1562 intel_modeset_cleanup(dev);
1564 mutex_lock(&dev->struct_mutex);
1565 i915_gem_free_all_phys_object(dev);
1566 i915_gem_cleanup_ringbuffer(dev);
1567 i915_gem_context_fini(dev);
1568 mutex_unlock(&dev->struct_mutex);
1570 i915_gem_cleanup_aliasing_ppgtt(dev);
1571 i915_gem_cleanup_stolen(dev);
1572 if (!I915_NEED_GFX_HWS(dev))
1573 i915_free_hws(dev);
1574 i915_gem_lastclose(dev);
1576 teardown_scratch_page(dev);
1584 dev_priv->gtt.gtt_remove(dev);
1587 (void) drm_rmmap(dev, dev_priv->regs);
1602 kfree(dev->dev_private, sizeof(drm_i915_private_t));
1603 dev->dev_private = NULL;
1609 i915_driver_firstopen(struct drm_device *dev)
1612 struct drm_i915_private *dev_priv = dev->dev_private;
1613 struct pci_dev *pdev = dev->pdev;
1620 if (i915_get_bridge_dev(dev)) {
1629 if (INTEL_INFO(dev)->gen >= 6) {
1631 dev->agp_aperbase = aperbase & GEN6_GTT_BASE_MASK;
1633 dev->agp_aperbase = dev->agp->agp_info.agpi_aperbase;
1636 ret = i915_gem_gtt_init(dev);
1644 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
1645 ret = i915_load_modeset_init(dev);
1660 int i915_driver_open(struct drm_device *dev, struct drm_file *file_priv)
1684 * @dev: DRM device
1694 void i915_driver_lastclose(struct drm_device * dev)
1696 drm_i915_private_t *dev_priv = dev->dev_private;
1704 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
1705 intel_fb_restore_mode(dev);
1709 i915_gem_lastclose(dev);
1711 (void) i915_dma_cleanup(dev);
1714 void i915_driver_preclose(struct drm_device * dev, struct drm_file *file_priv)
1716 i915_gem_context_close(dev, file_priv);
1717 i915_gem_release(dev, file_priv);
1720 void i915_driver_entervt(struct drm_device *dev)
1722 struct drm_i915_private *dev_priv = dev->dev_private;
1730 (void) i915_restore_state(dev);
1731 if (IS_HASWELL(dev))
1732 intel_modeset_setup_hw_state(dev, false);
1734 intel_modeset_setup_hw_state(dev, true);
1739 void i915_driver_leavevt(struct drm_device *dev)
1741 drm_i915_private_t *dev_priv = dev->dev_private;
1746 (void) i915_save_state(dev);
1748 if (IS_HASWELL(dev))
1749 intel_modeset_disable(dev);
1755 void i915_driver_postclose(struct drm_device *dev, struct drm_file *file_priv)
1820 int i915_driver_device_is_agp(struct drm_device * dev)