[PATCH 4/5] nouveau: add dynamic gpu power off support.

Peter Wu uwretep at gmail.com
Mon Sep 10 09:30:13 PDT 2012


Hi Dave,

> +int nouveau_dynamic_power_set_state(struct drm_device *dev, int state)
> +{
> +	struct nouveau_drm *drm = nouveau_drm(dev);
> +	pm_message_t pmm = { .event = PM_EVENT_SUSPEND };
> +
> +	if (state == DRM_SWITCH_POWER_DYNAMIC_OFF) {
> +		dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF;
In existing set_state code, this switch_power_state is first set to 
DRM_SWITCH_POWER_CHANGING. Is it sensible to do the same thing here?

> +		drm_kms_helper_poll_disable(drm->dev);
> +		vga_switcheroo_set_dynamic_switch(dev->pdev, VGA_SWITCHEROO_OFF, 
false);
> +		nouveau_switcheroo_optimus_dsm();
> +		nouveau_drm_suspend(drm->dev->pdev, pmm);
> +		vga_switcheroo_set_dynamic_switch(dev->pdev, VGA_SWITCHEROO_OFF, 
true);
> +	} else if (state == DRM_SWITCH_POWER_ON) {
> +		vga_switcheroo_set_dynamic_switch(dev->pdev, VGA_SWITCHEROO_ON, 
true);
> +		nouveau_drm_resume(dev->pdev);
> +		vga_switcheroo_set_dynamic_switch(dev->pdev, VGA_SWITCHEROO_ON, 
false);
> +		drm_kms_helper_poll_enable(dev);
> +		dev->switch_power_state = DRM_SWITCH_POWER_ON;
Same here.

> +	}
> +
> +	return 0;
> +}

Regards,
Peter


More information about the dri-devel mailing list