void radeondrm_doswitch(void *v) { struct rasops_info *ri = v; struct radeon_device *rdev = ri->ri_hw; struct radeon_crtc *radeon_crtc; int i, crtc; rasops_show_screen(ri, rdev->switchcookie, 0, NULL, NULL); for (crtc = 0; crtc < rdev->num_crtc; crtc++) { for (i = 0; i < 256; i++) { radeon_crtc = rdev->mode_info.crtcs[crtc]; radeon_crtc->lut_r[i] = rasops_cmap[3 * i] << 2; radeon_crtc->lut_g[i] = rasops_cmap[(3 * i) + 1] << 2; radeon_crtc->lut_b[i] = rasops_cmap[(3 * i) + 2] << 2; } } #ifdef __sparc64__ fbwscons_setcolormap(&rdev->sf, radeondrm_setcolor); #endif drm_modeset_lock_all(rdev->ddev); drm_fb_helper_restore_fbdev_mode((void *)rdev->mode_info.rfbdev); drm_modeset_unlock_all(rdev->ddev); if (rdev->switchcb) (rdev->switchcb)(rdev->switchcbarg, 0, 0); }
/** * lastclose - clean up after all DRM clients have exited * @dev: DRM device * * Take care of cleaning up after all DRM clients have exited. In the * mode setting case, we want to restore the kernel's initial mode (just * in case the last client left us in a bad state). */ static void dev_lastclose(struct drm_device *dev) { int i; /* we don't support vga-switcheroo.. so just make sure the fbdev * mode is active */ struct omap_drm_private *priv = dev->dev_private; int ret; DBG("lastclose: dev=%p", dev); /* need to restore default rotation state.. not sure if there is * a cleaner way to restore properties to default state? Maybe * a flag that properties should automatically be restored to * default state on lastclose? */ for (i = 0; i < priv->num_crtcs; i++) { drm_object_property_set_value(&priv->crtcs[i]->base, priv->rotation_prop, 0); } for (i = 0; i < priv->num_planes; i++) { drm_object_property_set_value(&priv->planes[i]->base, priv->rotation_prop, 0); } ret = drm_fb_helper_restore_fbdev_mode(priv->fbdev); if (ret) DBG("failed to restore crtc mode"); }
void intel_fb_restore_mode(struct drm_device *dev) { int ret; drm_i915_private_t *dev_priv = dev->dev_private; ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper); if (ret) DRM_DEBUG("failed to restore crtc mode\n"); }
/** * lastclose - clean up after all DRM clients have exited * @dev: DRM device * * Take care of cleaning up after all DRM clients have exited. In the * mode setting case, we want to restore the kernel's initial mode (just * in case the last client left us in a bad state). */ static void dev_lastclose(struct drm_device *dev) { /* we don't support vga-switcheroo.. so just make sure the fbdev * mode is active */ struct omap_drm_private *priv = dev->dev_private; int ret; DBG("lastclose: dev=%p", dev); ret = drm_fb_helper_restore_fbdev_mode(priv->fbdev); if (ret) DBG("failed to restore crtc mode"); }
/** * radeon_driver_firstopen_kms - drm callback for last close * * @dev: drm dev pointer * * Switch vga switcheroo state after last close (all asics). */ void radeon_driver_lastclose_kms(struct drm_device *dev) { struct radeon_device *rdev = dev->dev_private; #ifdef __sparc64__ fbwscons_setcolormap(&rdev->sf, radeondrm_setcolor); #endif drm_modeset_lock_all(dev); drm_fb_helper_restore_fbdev_mode((void *)rdev->mode_info.rfbdev); drm_modeset_unlock_all(dev); #ifdef notyet vga_switcheroo_process_delayed_switch(); #endif }
void intel_fbdev_restore_mode(struct drm_device *dev) { int ret; struct drm_i915_private *dev_priv = dev->dev_private; if (INTEL_INFO(dev)->num_pipes == 0) return; drm_modeset_lock_all(dev); ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper); if (ret) DRM_DEBUG("failed to restore crtc mode\n"); drm_modeset_unlock_all(dev); }
/** * lastclose - clean up after all DRM clients have exited * @dev: DRM device * * Take care of cleaning up after all DRM clients have exited. In the * mode setting case, we want to restore the kernel's initial mode (just * in case the last client left us in a bad state). */ static void dev_lastclose(struct drm_device *dev) { int i; /* we don't support vga-switcheroo.. so just make sure the fbdev * mode is active */ struct omap_drm_private *priv = dev->dev_private; int ret; DBG("lastclose: dev=%p", dev); if (priv->rotation_prop) { /* need to restore default rotation state.. not sure * if there is a cleaner way to restore properties to * default state? Maybe a flag that properties should * automatically be restored to default state on * lastclose? */ for (i = 0; i < priv->num_crtcs; i++) { drm_object_property_set_value(&priv->crtcs[i]->base, priv->rotation_prop, 0); } for (i = 0; i < priv->num_planes; i++) { drm_object_property_set_value(&priv->planes[i]->base, priv->rotation_prop, 0); } } if (priv->fbdev) { drm_modeset_lock_all(dev); ret = drm_fb_helper_restore_fbdev_mode(priv->fbdev); drm_modeset_unlock_all(dev); if (ret) DBG("failed to restore crtc mode"); /* * Flush crtcs to finish any pending work. * This makes sure the fbdev mode has been restored. */ for (i = 0; i < priv->num_crtcs; i++) omap_crtc_flush(priv->crtcs[i]); } }
void intel_fb_restore_mode(struct drm_device *dev) { int ret; drm_i915_private_t *dev_priv = dev->dev_private; struct drm_mode_config *config = &dev->mode_config; struct drm_plane *plane; mutex_lock(&dev->mode_config.mutex); ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper); if (ret) DRM_DEBUG("failed to restore crtc mode\n"); list_for_each_entry(plane, &config->plane_list, head) plane->funcs->disable_plane(plane); mutex_unlock(&dev->mode_config.mutex); }
void intel_fb_restore_mode(struct drm_device *dev) { int ret; drm_i915_private_t *dev_priv = dev->dev_private; struct drm_mode_config *config = &dev->mode_config; struct drm_plane *plane; rw_enter_write(&dev->mode_config.rwl); ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper); if (ret) DRM_DEBUG("failed to restore crtc mode\n"); /* Be sure to shut off any planes that may be active */ list_for_each_entry(plane, &config->plane_list, head) plane->funcs->disable_plane(plane); rw_exit_write(&dev->mode_config.rwl); }
void radeondrm_attachhook(struct device *self) { struct radeon_device *rdev = (struct radeon_device *)self; int r, acpi_status; /* radeon_device_init should report only fatal error * like memory allocation failure or iomapping failure, * or memory manager initialization failure, it must * properly initialize the GPU MC controller and permit * VRAM allocation */ r = radeon_device_init(rdev, rdev->ddev); if (r) { dev_err(&dev->pdev->dev, "Fatal error during GPU init\n"); radeon_fatal_error = 1; radeondrm_forcedetach(rdev); return; } /* Again modeset_init should fail only on fatal error * otherwise it should provide enough functionalities * for shadowfb to run */ r = radeon_modeset_init(rdev); if (r) dev_err(&dev->pdev->dev, "Fatal error during modeset init\n"); /* Call ACPI methods: require modeset init * but failure is not fatal */ if (!r) { acpi_status = radeon_acpi_init(rdev); if (acpi_status) DRM_DEBUG("Error during ACPI methods call\n"); } { struct wsemuldisplaydev_attach_args aa; struct rasops_info *ri = &rdev->ro; task_set(&rdev->switchtask, radeondrm_doswitch, ri); if (ri->ri_bits == NULL) return; #ifdef __sparc64__ fbwscons_setcolormap(&rdev->sf, radeondrm_setcolor); #endif drm_modeset_lock_all(rdev->ddev); drm_fb_helper_restore_fbdev_mode((void *)rdev->mode_info.rfbdev); drm_modeset_unlock_all(rdev->ddev); #ifndef __sparc64__ ri->ri_flg = RI_CENTER | RI_VCONS | RI_WRONLY; rasops_init(ri, 160, 160); ri->ri_hw = rdev; #else ri = &rdev->sf.sf_ro; #endif radeondrm_stdscreen.capabilities = ri->ri_caps; radeondrm_stdscreen.nrows = ri->ri_rows; radeondrm_stdscreen.ncols = ri->ri_cols; radeondrm_stdscreen.textops = &ri->ri_ops; radeondrm_stdscreen.fontwidth = ri->ri_font->fontwidth; radeondrm_stdscreen.fontheight = ri->ri_font->fontheight; aa.console = rdev->console; aa.scrdata = &radeondrm_screenlist; aa.accessops = &radeondrm_accessops; aa.accesscookie = ri; aa.defaultscreens = 0; if (rdev->console) { long defattr; ri->ri_ops.alloc_attr(ri->ri_active, 0, 0, 0, &defattr); wsdisplay_cnattach(&radeondrm_stdscreen, ri->ri_active, ri->ri_ccol, ri->ri_crow, defattr); } /* * Now that we've taken over the console, disable decoding of * VGA legacy addresses, and opt out of arbitration. */ radeon_vga_set_state(rdev, false); pci_disable_legacy_vga(&rdev->dev); printf("%s: %dx%d\n", rdev->dev.dv_xname, ri->ri_width, ri->ri_height); config_found_sm(&rdev->dev, &aa, wsemuldisplaydevprint, wsemuldisplaydevsubmatch); } }