Re: [Intel-gfx] [PATCH V2 3/3] i915: ignore lid open event when resuming
On Mon, Feb 04, 2013 at 03:10:11PM +0800, Zhang Rui wrote: > i915 driver needs to do modeset when > 1. system resumes from sleep > 2. lid is opened > > In PM_SUSPEND_MEM state, all the GPEs are cleared when system resumes, > thus it is the i915_resume code does the modeset rather than > intel_lid_notify(). > > But in PM_SUSPEND_FREEZE state, this will be broken because > system is still responsive to the lid events. > 1. When we close the lid in Freeze state, intel_lid_notify() sets > modeset_on_lid. > 2. When we reopen the lid, intel_lid_notify() will do a modeset, >before the system is resumed. > here is the error log, > > [92146.548074] WARNING: at drivers/gpu/drm/i915/intel_display.c:1028 > intel_wait_for_pipe_off+0x184/0x190 [i915]() > [92146.548076] Hardware name: VGN-Z540N > [92146.548078] pipe_off wait timed out > [92146.548167] Modules linked in: hid_generic usbhid hid > snd_hda_codec_realtek snd_hda_intel snd_hda_codec parport_pc snd_hwdep ppdev > snd_pcm_oss i915 snd_mixer_oss snd_pcm arc4 iwldvm snd_seq_dummy mac80211 > snd_seq_oss snd_seq_midi fbcon tileblit font bitblit softcursor > drm_kms_helper snd_rawmidi snd_seq_midi_event coretemp drm snd_seq kvm btusb > bluetooth snd_timer iwlwifi pcmcia tpm_infineon i2c_algo_bit joydev > snd_seq_device intel_agp cfg80211 snd intel_gtt yenta_socket pcmcia_rsrc > sony_laptop agpgart microcode psmouse tpm_tis serio_raw mxm_wmi soundcore > snd_page_alloc tpm acpi_cpufreq lpc_ich pcmcia_core tpm_bios mperf processor > lp parport firewire_ohci firewire_core crc_itu_t sdhci_pci sdhci thermal > e1000e > [92146.548173] Pid: 4304, comm: kworker/0:0 Tainted: GW > 3.8.0-rc3-s0i3-v3-test+ #9 > [92146.548175] Call Trace: > [92146.548189] [] warn_slowpath_common+0x72/0xa0 > [92146.548227] [] ? intel_wait_for_pipe_off+0x184/0x190 [i915] > [92146.548263] [] ? intel_wait_for_pipe_off+0x184/0x190 [i915] > [92146.548270] [] warn_slowpath_fmt+0x33/0x40 > [92146.548307] [] intel_wait_for_pipe_off+0x184/0x190 [i915] > [92146.548344] [] intel_disable_pipe+0x102/0x190 [i915] > [92146.548380] [] ? intel_disable_plane+0x64/0x80 [i915] > [92146.548417] [] i9xx_crtc_disable+0xbc/0x150 [i915] > [92146.548456] [] intel_crtc_update_dpms+0x5e/0x90 [i915] > [92146.548493] [] intel_modeset_setup_hw_state+0x42f/0x8f0 [i915] > [92146.548535] [] intel_lid_notify+0x9b/0xc0 [i915] > [92146.548543] [] notifier_call_chain+0x43/0x60 > [92146.548550] [] __blocking_notifier_call_chain+0x41/0x80 > [92146.548556] [] blocking_notifier_call_chain+0x1f/0x30 > [92146.548563] [] acpi_lid_send_state+0x78/0xa4 > [92146.548569] [] acpi_button_notify+0x3b/0xf1 > [92146.548577] [] ? acpi_os_execute+0x17/0x19 > [92146.548582] [] ? acpi_ec_sync_query+0xa5/0xbc > [92146.548589] [] acpi_device_notify+0x16/0x18 > [92146.548595] [] acpi_ev_notify_dispatch+0x38/0x4f > [92146.548600] [] acpi_os_execute_deferred+0x20/0x2b > [92146.548607] [] process_one_work+0x128/0x3f0 > [92146.548613] [] ? common_interrupt+0x33/0x38 > [92146.548618] [] ? wake_up_worker+0x30/0x30 > [92146.548624] [] ? acpi_os_wait_events_complete+0x1e/0x1e > [92146.548629] [] worker_thread+0x119/0x3b0 > [92146.548634] [] ? manage_workers+0x240/0x240 > [92146.548640] [] kthread+0x94/0xa0 > [92146.548647] [] ? ftrace_raw_output_sched_stat_runtime+0x70/0xf0 > [92146.548652] [] ret_from_kernel_thread+0x1b/0x28 > [92146.548658] [] ? kthread_create_on_node+0xc0/0xc0 > > three different modeset flags are introduced in this patch > MODESET_ON_LID: do modeset on next lid open event > MODESET_DONE: modeset already done > MODESET_ON_RESUME: do modeset when system is resumed > > In this way, > 1. when lid is closed, MODESET_ON_LID is set so that >we'll do modeset on next lid open event. > 2. when lid is opened, MODESET_DONE is set >so that duplicate lid open events will be ignored. > 3. when system suspends, MODESET_ON_RESUME is set. >In this case, we will not do modeset on any lid events. > > Plus, locking mechanism is also introduced to avoid racing. > > Signed-off-by: Zhang Rui Looks nice, two tiny bikesheds below. > --- > drivers/gpu/drm/i915/i915_dma.c |1 + > drivers/gpu/drm/i915/i915_drv.c | 14 +- > drivers/gpu/drm/i915/i915_drv.h | 11 +-- > drivers/gpu/drm/i915/intel_lvds.c | 33 - > 4 files changed, 39 insertions(+), 20 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c > index 99daa89..c7cb546 100644 > --- a/drivers/gpu/drm/i915/i915_dma.c > +++ b/drivers/gpu/drm/i915/i915_dma.c > @@ -1585,6 +1585,7 @@ int i915_driver_load(struct drm_device *dev, unsigned > long flags) > spin_lock_init(&dev_priv->dpio_lock); > > mutex_init(&dev_priv->rps.hw_lock); > + mutex_init(&dev_priv->modeset_lock); > > if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) > dev_priv->num_pipe = 3; > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/driver
Re: [Intel-gfx] [PATCH V2 3/3] i915: ignore lid open event when resuming
On Mon, 2013-02-04 at 16:25 +0100, Daniel Vetter wrote: > On Mon, Feb 04, 2013 at 03:10:11PM +0800, Zhang Rui wrote: > > i915 driver needs to do modeset when > > 1. system resumes from sleep > > 2. lid is opened > > > > In PM_SUSPEND_MEM state, all the GPEs are cleared when system resumes, > > thus it is the i915_resume code does the modeset rather than > > intel_lid_notify(). > > > > But in PM_SUSPEND_FREEZE state, this will be broken because > > system is still responsive to the lid events. > > 1. When we close the lid in Freeze state, intel_lid_notify() sets > > modeset_on_lid. > > 2. When we reopen the lid, intel_lid_notify() will do a modeset, > >before the system is resumed. > > here is the error log, > > > > [92146.548074] WARNING: at drivers/gpu/drm/i915/intel_display.c:1028 > > intel_wait_for_pipe_off+0x184/0x190 [i915]() > > [92146.548076] Hardware name: VGN-Z540N > > [92146.548078] pipe_off wait timed out > > [92146.548167] Modules linked in: hid_generic usbhid hid > > snd_hda_codec_realtek snd_hda_intel snd_hda_codec parport_pc snd_hwdep > > ppdev snd_pcm_oss i915 snd_mixer_oss snd_pcm arc4 iwldvm snd_seq_dummy > > mac80211 snd_seq_oss snd_seq_midi fbcon tileblit font bitblit softcursor > > drm_kms_helper snd_rawmidi snd_seq_midi_event coretemp drm snd_seq kvm > > btusb bluetooth snd_timer iwlwifi pcmcia tpm_infineon i2c_algo_bit joydev > > snd_seq_device intel_agp cfg80211 snd intel_gtt yenta_socket pcmcia_rsrc > > sony_laptop agpgart microcode psmouse tpm_tis serio_raw mxm_wmi soundcore > > snd_page_alloc tpm acpi_cpufreq lpc_ich pcmcia_core tpm_bios mperf > > processor lp parport firewire_ohci firewire_core crc_itu_t sdhci_pci sdhci > > thermal e1000e > > [92146.548173] Pid: 4304, comm: kworker/0:0 Tainted: GW > > 3.8.0-rc3-s0i3-v3-test+ #9 > > [92146.548175] Call Trace: > > [92146.548189] [] warn_slowpath_common+0x72/0xa0 > > [92146.548227] [] ? intel_wait_for_pipe_off+0x184/0x190 [i915] > > [92146.548263] [] ? intel_wait_for_pipe_off+0x184/0x190 [i915] > > [92146.548270] [] warn_slowpath_fmt+0x33/0x40 > > [92146.548307] [] intel_wait_for_pipe_off+0x184/0x190 [i915] > > [92146.548344] [] intel_disable_pipe+0x102/0x190 [i915] > > [92146.548380] [] ? intel_disable_plane+0x64/0x80 [i915] > > [92146.548417] [] i9xx_crtc_disable+0xbc/0x150 [i915] > > [92146.548456] [] intel_crtc_update_dpms+0x5e/0x90 [i915] > > [92146.548493] [] intel_modeset_setup_hw_state+0x42f/0x8f0 [i915] > > [92146.548535] [] intel_lid_notify+0x9b/0xc0 [i915] > > [92146.548543] [] notifier_call_chain+0x43/0x60 > > [92146.548550] [] __blocking_notifier_call_chain+0x41/0x80 > > [92146.548556] [] blocking_notifier_call_chain+0x1f/0x30 > > [92146.548563] [] acpi_lid_send_state+0x78/0xa4 > > [92146.548569] [] acpi_button_notify+0x3b/0xf1 > > [92146.548577] [] ? acpi_os_execute+0x17/0x19 > > [92146.548582] [] ? acpi_ec_sync_query+0xa5/0xbc > > [92146.548589] [] acpi_device_notify+0x16/0x18 > > [92146.548595] [] acpi_ev_notify_dispatch+0x38/0x4f > > [92146.548600] [] acpi_os_execute_deferred+0x20/0x2b > > [92146.548607] [] process_one_work+0x128/0x3f0 > > [92146.548613] [] ? common_interrupt+0x33/0x38 > > [92146.548618] [] ? wake_up_worker+0x30/0x30 > > [92146.548624] [] ? acpi_os_wait_events_complete+0x1e/0x1e > > [92146.548629] [] worker_thread+0x119/0x3b0 > > [92146.548634] [] ? manage_workers+0x240/0x240 > > [92146.548640] [] kthread+0x94/0xa0 > > [92146.548647] [] ? > > ftrace_raw_output_sched_stat_runtime+0x70/0xf0 > > [92146.548652] [] ret_from_kernel_thread+0x1b/0x28 > > [92146.548658] [] ? kthread_create_on_node+0xc0/0xc0 > > > > three different modeset flags are introduced in this patch > > MODESET_ON_LID: do modeset on next lid open event > > MODESET_DONE: modeset already done > > MODESET_ON_RESUME: do modeset when system is resumed > > > > In this way, > > 1. when lid is closed, MODESET_ON_LID is set so that > >we'll do modeset on next lid open event. > > 2. when lid is opened, MODESET_DONE is set > >so that duplicate lid open events will be ignored. > > 3. when system suspends, MODESET_ON_RESUME is set. > >In this case, we will not do modeset on any lid events. > > > > Plus, locking mechanism is also introduced to avoid racing. > > > > Signed-off-by: Zhang Rui > > Looks nice, two tiny bikesheds below. > Great, thanks for reviewing. Refreshed patch attached. >From 0d597b4859535c79ed545160cf4af9e6b5970e3c Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Thu, 24 Jan 2013 13:27:22 +0800 Subject: [PATCH V3 3/3] i915: ignore lid open event when resuming i915 driver needs to do modeset when 1. system resumes from sleep 2. lid is opened In PM_SUSPEND_MEM state, all the GPEs are cleared when system resumes, thus it is the i915_resume code does the modeset rather than intel_lid_notify(). But in PM_SUSPEND_FREEZE state, this will be broken because system is still responsive to the lid events. 1. When we close the lid in Freeze state, intel_li
Re: [Intel-gfx] [PATCH V2 3/3] i915: ignore lid open event when resuming
On Tue, 2013-02-05 at 07:58 +0800, Zhang Rui wrote: > On Mon, 2013-02-04 at 16:25 +0100, Daniel Vetter wrote: > > On Mon, Feb 04, 2013 at 03:10:11PM +0800, Zhang Rui wrote: > > > i915 driver needs to do modeset when > > > 1. system resumes from sleep > > > 2. lid is opened > > > > > > In PM_SUSPEND_MEM state, all the GPEs are cleared when system resumes, > > > thus it is the i915_resume code does the modeset rather than > > > intel_lid_notify(). > > > > > > But in PM_SUSPEND_FREEZE state, this will be broken because > > > system is still responsive to the lid events. > > > 1. When we close the lid in Freeze state, intel_lid_notify() sets > > > modeset_on_lid. > > > 2. When we reopen the lid, intel_lid_notify() will do a modeset, > > >before the system is resumed. > > > here is the error log, > > > > > > [92146.548074] WARNING: at drivers/gpu/drm/i915/intel_display.c:1028 > > > intel_wait_for_pipe_off+0x184/0x190 [i915]() > > > [92146.548076] Hardware name: VGN-Z540N > > > [92146.548078] pipe_off wait timed out > > > [92146.548167] Modules linked in: hid_generic usbhid hid > > > snd_hda_codec_realtek snd_hda_intel snd_hda_codec parport_pc snd_hwdep > > > ppdev snd_pcm_oss i915 snd_mixer_oss snd_pcm arc4 iwldvm snd_seq_dummy > > > mac80211 snd_seq_oss snd_seq_midi fbcon tileblit font bitblit softcursor > > > drm_kms_helper snd_rawmidi snd_seq_midi_event coretemp drm snd_seq kvm > > > btusb bluetooth snd_timer iwlwifi pcmcia tpm_infineon i2c_algo_bit joydev > > > snd_seq_device intel_agp cfg80211 snd intel_gtt yenta_socket pcmcia_rsrc > > > sony_laptop agpgart microcode psmouse tpm_tis serio_raw mxm_wmi soundcore > > > snd_page_alloc tpm acpi_cpufreq lpc_ich pcmcia_core tpm_bios mperf > > > processor lp parport firewire_ohci firewire_core crc_itu_t sdhci_pci > > > sdhci thermal e1000e > > > [92146.548173] Pid: 4304, comm: kworker/0:0 Tainted: GW > > > 3.8.0-rc3-s0i3-v3-test+ #9 > > > [92146.548175] Call Trace: > > > [92146.548189] [] warn_slowpath_common+0x72/0xa0 > > > [92146.548227] [] ? intel_wait_for_pipe_off+0x184/0x190 [i915] > > > [92146.548263] [] ? intel_wait_for_pipe_off+0x184/0x190 [i915] > > > [92146.548270] [] warn_slowpath_fmt+0x33/0x40 > > > [92146.548307] [] intel_wait_for_pipe_off+0x184/0x190 [i915] > > > [92146.548344] [] intel_disable_pipe+0x102/0x190 [i915] > > > [92146.548380] [] ? intel_disable_plane+0x64/0x80 [i915] > > > [92146.548417] [] i9xx_crtc_disable+0xbc/0x150 [i915] > > > [92146.548456] [] intel_crtc_update_dpms+0x5e/0x90 [i915] > > > [92146.548493] [] intel_modeset_setup_hw_state+0x42f/0x8f0 > > > [i915] > > > [92146.548535] [] intel_lid_notify+0x9b/0xc0 [i915] > > > [92146.548543] [] notifier_call_chain+0x43/0x60 > > > [92146.548550] [] __blocking_notifier_call_chain+0x41/0x80 > > > [92146.548556] [] blocking_notifier_call_chain+0x1f/0x30 > > > [92146.548563] [] acpi_lid_send_state+0x78/0xa4 > > > [92146.548569] [] acpi_button_notify+0x3b/0xf1 > > > [92146.548577] [] ? acpi_os_execute+0x17/0x19 > > > [92146.548582] [] ? acpi_ec_sync_query+0xa5/0xbc > > > [92146.548589] [] acpi_device_notify+0x16/0x18 > > > [92146.548595] [] acpi_ev_notify_dispatch+0x38/0x4f > > > [92146.548600] [] acpi_os_execute_deferred+0x20/0x2b > > > [92146.548607] [] process_one_work+0x128/0x3f0 > > > [92146.548613] [] ? common_interrupt+0x33/0x38 > > > [92146.548618] [] ? wake_up_worker+0x30/0x30 > > > [92146.548624] [] ? acpi_os_wait_events_complete+0x1e/0x1e > > > [92146.548629] [] worker_thread+0x119/0x3b0 > > > [92146.548634] [] ? manage_workers+0x240/0x240 > > > [92146.548640] [] kthread+0x94/0xa0 > > > [92146.548647] [] ? > > > ftrace_raw_output_sched_stat_runtime+0x70/0xf0 > > > [92146.548652] [] ret_from_kernel_thread+0x1b/0x28 > > > [92146.548658] [] ? kthread_create_on_node+0xc0/0xc0 > > > > > > three different modeset flags are introduced in this patch > > > MODESET_ON_LID: do modeset on next lid open event > > > MODESET_DONE: modeset already done > > > MODESET_ON_RESUME: do modeset when system is resumed > > > > > > In this way, > > > 1. when lid is closed, MODESET_ON_LID is set so that > > >we'll do modeset on next lid open event. > > > 2. when lid is opened, MODESET_DONE is set > > >so that duplicate lid open events will be ignored. > > > 3. when system suspends, MODESET_ON_RESUME is set. > > >In this case, we will not do modeset on any lid events. > > > > > > Plus, locking mechanism is also introduced to avoid racing. > > > > > > Signed-off-by: Zhang Rui > > > > Looks nice, two tiny bikesheds below. > > > Great, thanks for reviewing. Refreshed patch attached. oops, forgot to update the changelog and comments. refreshed patch attached. >From b584fcebb6d715a317f192c88606b875ee88ce78 Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Thu, 24 Jan 2013 13:27:22 +0800 Subject: [PATCH V3 3/3] i915: ignore lid open event when resuming i915 driver needs to do modeset when 1. system resumes from sleep 2. lid is op
Re: [Intel-gfx] [PATCH V2 3/3] i915: ignore lid open event when resuming
On Tue, Feb 05, 2013 at 03:41:53PM +0800, Zhang Rui wrote: > oops, forgot to update the changelog and comments. > refreshed patch attached. > > From b584fcebb6d715a317f192c88606b875ee88ce78 Mon Sep 17 00:00:00 2001 > From: Zhang Rui > Date: Thu, 24 Jan 2013 13:27:22 +0800 > Subject: [PATCH V3 3/3] i915: ignore lid open event when resuming > > i915 driver needs to do modeset when > 1. system resumes from sleep > 2. lid is opened Patch applied, thanks. There's been a bit of a merge conflict and one tiny checkpatch error, both fixed while applying. I plan to push this patch to drm-next for 3.9. -Daniel > > In PM_SUSPEND_MEM state, all the GPEs are cleared when system resumes, > thus it is the i915_resume code does the modeset rather than > intel_lid_notify(). > > But in PM_SUSPEND_FREEZE state, this will be broken because > system is still responsive to the lid events. > 1. When we close the lid in Freeze state, intel_lid_notify() sets > modeset_on_lid. > 2. When we reopen the lid, intel_lid_notify() will do a modeset, >before the system is resumed. > here is the error log, > > [92146.548074] WARNING: at drivers/gpu/drm/i915/intel_display.c:1028 > intel_wait_for_pipe_off+0x184/0x190 [i915]() > [92146.548076] Hardware name: VGN-Z540N > [92146.548078] pipe_off wait timed out > [92146.548167] Modules linked in: hid_generic usbhid hid > snd_hda_codec_realtek snd_hda_intel snd_hda_codec parport_pc snd_hwdep ppdev > snd_pcm_oss i915 snd_mixer_oss snd_pcm arc4 iwldvm snd_seq_dummy mac80211 > snd_seq_oss snd_seq_midi fbcon tileblit font bitblit softcursor > drm_kms_helper snd_rawmidi snd_seq_midi_event coretemp drm snd_seq kvm btusb > bluetooth snd_timer iwlwifi pcmcia tpm_infineon i2c_algo_bit joydev > snd_seq_device intel_agp cfg80211 snd intel_gtt yenta_socket pcmcia_rsrc > sony_laptop agpgart microcode psmouse tpm_tis serio_raw mxm_wmi soundcore > snd_page_alloc tpm acpi_cpufreq lpc_ich pcmcia_core tpm_bios mperf processor > lp parport firewire_ohci firewire_core crc_itu_t sdhci_pci sdhci thermal > e1000e > [92146.548173] Pid: 4304, comm: kworker/0:0 Tainted: GW > 3.8.0-rc3-s0i3-v3-test+ #9 > [92146.548175] Call Trace: > [92146.548189] [] warn_slowpath_common+0x72/0xa0 > [92146.548227] [] ? intel_wait_for_pipe_off+0x184/0x190 [i915] > [92146.548263] [] ? intel_wait_for_pipe_off+0x184/0x190 [i915] > [92146.548270] [] warn_slowpath_fmt+0x33/0x40 > [92146.548307] [] intel_wait_for_pipe_off+0x184/0x190 [i915] > [92146.548344] [] intel_disable_pipe+0x102/0x190 [i915] > [92146.548380] [] ? intel_disable_plane+0x64/0x80 [i915] > [92146.548417] [] i9xx_crtc_disable+0xbc/0x150 [i915] > [92146.548456] [] intel_crtc_update_dpms+0x5e/0x90 [i915] > [92146.548493] [] intel_modeset_setup_hw_state+0x42f/0x8f0 [i915] > [92146.548535] [] intel_lid_notify+0x9b/0xc0 [i915] > [92146.548543] [] notifier_call_chain+0x43/0x60 > [92146.548550] [] __blocking_notifier_call_chain+0x41/0x80 > [92146.548556] [] blocking_notifier_call_chain+0x1f/0x30 > [92146.548563] [] acpi_lid_send_state+0x78/0xa4 > [92146.548569] [] acpi_button_notify+0x3b/0xf1 > [92146.548577] [] ? acpi_os_execute+0x17/0x19 > [92146.548582] [] ? acpi_ec_sync_query+0xa5/0xbc > [92146.548589] [] acpi_device_notify+0x16/0x18 > [92146.548595] [] acpi_ev_notify_dispatch+0x38/0x4f > [92146.548600] [] acpi_os_execute_deferred+0x20/0x2b > [92146.548607] [] process_one_work+0x128/0x3f0 > [92146.548613] [] ? common_interrupt+0x33/0x38 > [92146.548618] [] ? wake_up_worker+0x30/0x30 > [92146.548624] [] ? acpi_os_wait_events_complete+0x1e/0x1e > [92146.548629] [] worker_thread+0x119/0x3b0 > [92146.548634] [] ? manage_workers+0x240/0x240 > [92146.548640] [] kthread+0x94/0xa0 > [92146.548647] [] ? ftrace_raw_output_sched_stat_runtime+0x70/0xf0 > [92146.548652] [] ret_from_kernel_thread+0x1b/0x28 > [92146.548658] [] ? kthread_create_on_node+0xc0/0xc0 > > three different modeset flags are introduced in this patch > MODESET_ON_LID_OPEN: do modeset on next lid open event > MODESET_DONE: modeset already done > MODESET_SUSPENDED: suspended, only do modeset when system is resumed > > In this way, > 1. when lid is closed, MODESET_ON_LID_OPEN is set so that >we'll do modeset on next lid open event. > 2. when lid is opened, MODESET_DONE is set >so that duplicate lid open events will be ignored. > 3. when system suspends, MODESET_SUSPENDED is set. >In this case, we will not do modeset on any lid events. > > Plus, locking mechanism is also introduced to avoid racing. > > Signed-off-by: Zhang Rui > --- > drivers/gpu/drm/i915/i915_dma.c |1 + > drivers/gpu/drm/i915/i915_drv.c | 14 +- > drivers/gpu/drm/i915/i915_drv.h | 11 +-- > drivers/gpu/drm/i915/intel_lvds.c | 33 - > 4 files changed, 39 insertions(+), 20 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c > index 99daa89..a5115d8 100644 > --- a/dri
Re: [Intel-gfx] [PATCH V2 3/3] i915: ignore lid open event when resuming
On Tuesday, February 05, 2013 11:07:11 AM Daniel Vetter wrote: > On Tue, Feb 05, 2013 at 03:41:53PM +0800, Zhang Rui wrote: > > oops, forgot to update the changelog and comments. > > refreshed patch attached. > > > > From b584fcebb6d715a317f192c88606b875ee88ce78 Mon Sep 17 00:00:00 2001 > > From: Zhang Rui > > Date: Thu, 24 Jan 2013 13:27:22 +0800 > > Subject: [PATCH V3 3/3] i915: ignore lid open event when resuming > > > > i915 driver needs to do modeset when > > 1. system resumes from sleep > > 2. lid is opened > > Patch applied, thanks. There's been a bit of a merge conflict and one tiny > checkpatch error, both fixed while applying. I plan to push this patch to > drm-next for 3.9. Thanks Daniel! I will take the other patches from the series, then. Rafael > > In PM_SUSPEND_MEM state, all the GPEs are cleared when system resumes, > > thus it is the i915_resume code does the modeset rather than > > intel_lid_notify(). > > > > But in PM_SUSPEND_FREEZE state, this will be broken because > > system is still responsive to the lid events. > > 1. When we close the lid in Freeze state, intel_lid_notify() sets > > modeset_on_lid. > > 2. When we reopen the lid, intel_lid_notify() will do a modeset, > >before the system is resumed. > > here is the error log, > > > > [92146.548074] WARNING: at drivers/gpu/drm/i915/intel_display.c:1028 > > intel_wait_for_pipe_off+0x184/0x190 [i915]() > > [92146.548076] Hardware name: VGN-Z540N > > [92146.548078] pipe_off wait timed out > > [92146.548167] Modules linked in: hid_generic usbhid hid > > snd_hda_codec_realtek snd_hda_intel snd_hda_codec parport_pc snd_hwdep > > ppdev snd_pcm_oss i915 snd_mixer_oss snd_pcm arc4 iwldvm snd_seq_dummy > > mac80211 snd_seq_oss snd_seq_midi fbcon tileblit font bitblit softcursor > > drm_kms_helper snd_rawmidi snd_seq_midi_event coretemp drm snd_seq kvm > > btusb bluetooth snd_timer iwlwifi pcmcia tpm_infineon i2c_algo_bit joydev > > snd_seq_device intel_agp cfg80211 snd intel_gtt yenta_socket pcmcia_rsrc > > sony_laptop agpgart microcode psmouse tpm_tis serio_raw mxm_wmi soundcore > > snd_page_alloc tpm acpi_cpufreq lpc_ich pcmcia_core tpm_bios mperf > > processor lp parport firewire_ohci firewire_core crc_itu_t sdhci_pci sdhci > > thermal e1000e > > [92146.548173] Pid: 4304, comm: kworker/0:0 Tainted: GW > > 3.8.0-rc3-s0i3-v3-test+ #9 > > [92146.548175] Call Trace: > > [92146.548189] [] warn_slowpath_common+0x72/0xa0 > > [92146.548227] [] ? intel_wait_for_pipe_off+0x184/0x190 [i915] > > [92146.548263] [] ? intel_wait_for_pipe_off+0x184/0x190 [i915] > > [92146.548270] [] warn_slowpath_fmt+0x33/0x40 > > [92146.548307] [] intel_wait_for_pipe_off+0x184/0x190 [i915] > > [92146.548344] [] intel_disable_pipe+0x102/0x190 [i915] > > [92146.548380] [] ? intel_disable_plane+0x64/0x80 [i915] > > [92146.548417] [] i9xx_crtc_disable+0xbc/0x150 [i915] > > [92146.548456] [] intel_crtc_update_dpms+0x5e/0x90 [i915] > > [92146.548493] [] intel_modeset_setup_hw_state+0x42f/0x8f0 [i915] > > [92146.548535] [] intel_lid_notify+0x9b/0xc0 [i915] > > [92146.548543] [] notifier_call_chain+0x43/0x60 > > [92146.548550] [] __blocking_notifier_call_chain+0x41/0x80 > > [92146.548556] [] blocking_notifier_call_chain+0x1f/0x30 > > [92146.548563] [] acpi_lid_send_state+0x78/0xa4 > > [92146.548569] [] acpi_button_notify+0x3b/0xf1 > > [92146.548577] [] ? acpi_os_execute+0x17/0x19 > > [92146.548582] [] ? acpi_ec_sync_query+0xa5/0xbc > > [92146.548589] [] acpi_device_notify+0x16/0x18 > > [92146.548595] [] acpi_ev_notify_dispatch+0x38/0x4f > > [92146.548600] [] acpi_os_execute_deferred+0x20/0x2b > > [92146.548607] [] process_one_work+0x128/0x3f0 > > [92146.548613] [] ? common_interrupt+0x33/0x38 > > [92146.548618] [] ? wake_up_worker+0x30/0x30 > > [92146.548624] [] ? acpi_os_wait_events_complete+0x1e/0x1e > > [92146.548629] [] worker_thread+0x119/0x3b0 > > [92146.548634] [] ? manage_workers+0x240/0x240 > > [92146.548640] [] kthread+0x94/0xa0 > > [92146.548647] [] ? > > ftrace_raw_output_sched_stat_runtime+0x70/0xf0 > > [92146.548652] [] ret_from_kernel_thread+0x1b/0x28 > > [92146.548658] [] ? kthread_create_on_node+0xc0/0xc0 > > > > three different modeset flags are introduced in this patch > > MODESET_ON_LID_OPEN: do modeset on next lid open event > > MODESET_DONE: modeset already done > > MODESET_SUSPENDED: suspended, only do modeset when system is resumed > > > > In this way, > > 1. when lid is closed, MODESET_ON_LID_OPEN is set so that > >we'll do modeset on next lid open event. > > 2. when lid is opened, MODESET_DONE is set > >so that duplicate lid open events will be ignored. > > 3. when system suspends, MODESET_SUSPENDED is set. > >In this case, we will not do modeset on any lid events. > > > > Plus, locking mechanism is also introduced to avoid racing. > > > > Signed-off-by: Zhang Rui > > --- > > drivers/gpu/drm/i915/i915_dma.c |1 + > > drivers/gpu/drm/i915/i915_drv.c | 14
Re: [Intel-gfx] [PATCH V2 3/3] i915: ignore lid open event when resuming
On Tue, 2013-02-05 at 11:07 +0100, Daniel Vetter wrote: > On Tue, Feb 05, 2013 at 03:41:53PM +0800, Zhang Rui wrote: > > oops, forgot to update the changelog and comments. > > refreshed patch attached. > > > > From b584fcebb6d715a317f192c88606b875ee88ce78 Mon Sep 17 00:00:00 2001 > > From: Zhang Rui > > Date: Thu, 24 Jan 2013 13:27:22 +0800 > > Subject: [PATCH V3 3/3] i915: ignore lid open event when resuming > > > > i915 driver needs to do modeset when > > 1. system resumes from sleep > > 2. lid is opened > > Patch applied, thanks. There's been a bit of a merge conflict and one tiny > checkpatch error, both fixed while applying. I plan to push this patch to > drm-next for 3.9. > -Daniel > great, thanks! -rui > > > > In PM_SUSPEND_MEM state, all the GPEs are cleared when system resumes, > > thus it is the i915_resume code does the modeset rather than > > intel_lid_notify(). > > > > But in PM_SUSPEND_FREEZE state, this will be broken because > > system is still responsive to the lid events. > > 1. When we close the lid in Freeze state, intel_lid_notify() sets > > modeset_on_lid. > > 2. When we reopen the lid, intel_lid_notify() will do a modeset, > >before the system is resumed. > > here is the error log, > > > > [92146.548074] WARNING: at drivers/gpu/drm/i915/intel_display.c:1028 > > intel_wait_for_pipe_off+0x184/0x190 [i915]() > > [92146.548076] Hardware name: VGN-Z540N > > [92146.548078] pipe_off wait timed out > > [92146.548167] Modules linked in: hid_generic usbhid hid > > snd_hda_codec_realtek snd_hda_intel snd_hda_codec parport_pc snd_hwdep > > ppdev snd_pcm_oss i915 snd_mixer_oss snd_pcm arc4 iwldvm snd_seq_dummy > > mac80211 snd_seq_oss snd_seq_midi fbcon tileblit font bitblit softcursor > > drm_kms_helper snd_rawmidi snd_seq_midi_event coretemp drm snd_seq kvm > > btusb bluetooth snd_timer iwlwifi pcmcia tpm_infineon i2c_algo_bit joydev > > snd_seq_device intel_agp cfg80211 snd intel_gtt yenta_socket pcmcia_rsrc > > sony_laptop agpgart microcode psmouse tpm_tis serio_raw mxm_wmi soundcore > > snd_page_alloc tpm acpi_cpufreq lpc_ich pcmcia_core tpm_bios mperf > > processor lp parport firewire_ohci firewire_core crc_itu_t sdhci_pci sdhci > > thermal e1000e > > [92146.548173] Pid: 4304, comm: kworker/0:0 Tainted: GW > > 3.8.0-rc3-s0i3-v3-test+ #9 > > [92146.548175] Call Trace: > > [92146.548189] [] warn_slowpath_common+0x72/0xa0 > > [92146.548227] [] ? intel_wait_for_pipe_off+0x184/0x190 [i915] > > [92146.548263] [] ? intel_wait_for_pipe_off+0x184/0x190 [i915] > > [92146.548270] [] warn_slowpath_fmt+0x33/0x40 > > [92146.548307] [] intel_wait_for_pipe_off+0x184/0x190 [i915] > > [92146.548344] [] intel_disable_pipe+0x102/0x190 [i915] > > [92146.548380] [] ? intel_disable_plane+0x64/0x80 [i915] > > [92146.548417] [] i9xx_crtc_disable+0xbc/0x150 [i915] > > [92146.548456] [] intel_crtc_update_dpms+0x5e/0x90 [i915] > > [92146.548493] [] intel_modeset_setup_hw_state+0x42f/0x8f0 [i915] > > [92146.548535] [] intel_lid_notify+0x9b/0xc0 [i915] > > [92146.548543] [] notifier_call_chain+0x43/0x60 > > [92146.548550] [] __blocking_notifier_call_chain+0x41/0x80 > > [92146.548556] [] blocking_notifier_call_chain+0x1f/0x30 > > [92146.548563] [] acpi_lid_send_state+0x78/0xa4 > > [92146.548569] [] acpi_button_notify+0x3b/0xf1 > > [92146.548577] [] ? acpi_os_execute+0x17/0x19 > > [92146.548582] [] ? acpi_ec_sync_query+0xa5/0xbc > > [92146.548589] [] acpi_device_notify+0x16/0x18 > > [92146.548595] [] acpi_ev_notify_dispatch+0x38/0x4f > > [92146.548600] [] acpi_os_execute_deferred+0x20/0x2b > > [92146.548607] [] process_one_work+0x128/0x3f0 > > [92146.548613] [] ? common_interrupt+0x33/0x38 > > [92146.548618] [] ? wake_up_worker+0x30/0x30 > > [92146.548624] [] ? acpi_os_wait_events_complete+0x1e/0x1e > > [92146.548629] [] worker_thread+0x119/0x3b0 > > [92146.548634] [] ? manage_workers+0x240/0x240 > > [92146.548640] [] kthread+0x94/0xa0 > > [92146.548647] [] ? > > ftrace_raw_output_sched_stat_runtime+0x70/0xf0 > > [92146.548652] [] ret_from_kernel_thread+0x1b/0x28 > > [92146.548658] [] ? kthread_create_on_node+0xc0/0xc0 > > > > three different modeset flags are introduced in this patch > > MODESET_ON_LID_OPEN: do modeset on next lid open event > > MODESET_DONE: modeset already done > > MODESET_SUSPENDED: suspended, only do modeset when system is resumed > > > > In this way, > > 1. when lid is closed, MODESET_ON_LID_OPEN is set so that > >we'll do modeset on next lid open event. > > 2. when lid is opened, MODESET_DONE is set > >so that duplicate lid open events will be ignored. > > 3. when system suspends, MODESET_SUSPENDED is set. > >In this case, we will not do modeset on any lid events. > > > > Plus, locking mechanism is also introduced to avoid racing. > > > > Signed-off-by: Zhang Rui > > --- > > drivers/gpu/drm/i915/i915_dma.c |1 + > > drivers/gpu/drm/i915/i915_drv.c | 14 +- > > drivers/gpu/drm/i915/i915_d
Re: [Intel-gfx] [PATCH V2 3/3] i915: ignore lid open event when resuming
On Tue, 2013-02-05 at 11:14 +0100, Rafael J. Wysocki wrote: > On Tuesday, February 05, 2013 11:07:11 AM Daniel Vetter wrote: > > On Tue, Feb 05, 2013 at 03:41:53PM +0800, Zhang Rui wrote: > > > oops, forgot to update the changelog and comments. > > > refreshed patch attached. > > > > > > From b584fcebb6d715a317f192c88606b875ee88ce78 Mon Sep 17 00:00:00 2001 > > > From: Zhang Rui > > > Date: Thu, 24 Jan 2013 13:27:22 +0800 > > > Subject: [PATCH V3 3/3] i915: ignore lid open event when resuming > > > > > > i915 driver needs to do modeset when > > > 1. system resumes from sleep > > > 2. lid is opened > > > > Patch applied, thanks. There's been a bit of a merge conflict and one tiny > > checkpatch error, both fixed while applying. I plan to push this patch to > > drm-next for 3.9. > > Thanks Daniel! > > I will take the other patches from the series, then. > great, thank you, Rafael. -rui > Rafael > > > > > In PM_SUSPEND_MEM state, all the GPEs are cleared when system resumes, > > > thus it is the i915_resume code does the modeset rather than > > > intel_lid_notify(). > > > > > > But in PM_SUSPEND_FREEZE state, this will be broken because > > > system is still responsive to the lid events. > > > 1. When we close the lid in Freeze state, intel_lid_notify() sets > > > modeset_on_lid. > > > 2. When we reopen the lid, intel_lid_notify() will do a modeset, > > >before the system is resumed. > > > here is the error log, > > > > > > [92146.548074] WARNING: at drivers/gpu/drm/i915/intel_display.c:1028 > > > intel_wait_for_pipe_off+0x184/0x190 [i915]() > > > [92146.548076] Hardware name: VGN-Z540N > > > [92146.548078] pipe_off wait timed out > > > [92146.548167] Modules linked in: hid_generic usbhid hid > > > snd_hda_codec_realtek snd_hda_intel snd_hda_codec parport_pc snd_hwdep > > > ppdev snd_pcm_oss i915 snd_mixer_oss snd_pcm arc4 iwldvm snd_seq_dummy > > > mac80211 snd_seq_oss snd_seq_midi fbcon tileblit font bitblit softcursor > > > drm_kms_helper snd_rawmidi snd_seq_midi_event coretemp drm snd_seq kvm > > > btusb bluetooth snd_timer iwlwifi pcmcia tpm_infineon i2c_algo_bit joydev > > > snd_seq_device intel_agp cfg80211 snd intel_gtt yenta_socket pcmcia_rsrc > > > sony_laptop agpgart microcode psmouse tpm_tis serio_raw mxm_wmi soundcore > > > snd_page_alloc tpm acpi_cpufreq lpc_ich pcmcia_core tpm_bios mperf > > > processor lp parport firewire_ohci firewire_core crc_itu_t sdhci_pci > > > sdhci thermal e1000e > > > [92146.548173] Pid: 4304, comm: kworker/0:0 Tainted: GW > > > 3.8.0-rc3-s0i3-v3-test+ #9 > > > [92146.548175] Call Trace: > > > [92146.548189] [] warn_slowpath_common+0x72/0xa0 > > > [92146.548227] [] ? intel_wait_for_pipe_off+0x184/0x190 [i915] > > > [92146.548263] [] ? intel_wait_for_pipe_off+0x184/0x190 [i915] > > > [92146.548270] [] warn_slowpath_fmt+0x33/0x40 > > > [92146.548307] [] intel_wait_for_pipe_off+0x184/0x190 [i915] > > > [92146.548344] [] intel_disable_pipe+0x102/0x190 [i915] > > > [92146.548380] [] ? intel_disable_plane+0x64/0x80 [i915] > > > [92146.548417] [] i9xx_crtc_disable+0xbc/0x150 [i915] > > > [92146.548456] [] intel_crtc_update_dpms+0x5e/0x90 [i915] > > > [92146.548493] [] intel_modeset_setup_hw_state+0x42f/0x8f0 > > > [i915] > > > [92146.548535] [] intel_lid_notify+0x9b/0xc0 [i915] > > > [92146.548543] [] notifier_call_chain+0x43/0x60 > > > [92146.548550] [] __blocking_notifier_call_chain+0x41/0x80 > > > [92146.548556] [] blocking_notifier_call_chain+0x1f/0x30 > > > [92146.548563] [] acpi_lid_send_state+0x78/0xa4 > > > [92146.548569] [] acpi_button_notify+0x3b/0xf1 > > > [92146.548577] [] ? acpi_os_execute+0x17/0x19 > > > [92146.548582] [] ? acpi_ec_sync_query+0xa5/0xbc > > > [92146.548589] [] acpi_device_notify+0x16/0x18 > > > [92146.548595] [] acpi_ev_notify_dispatch+0x38/0x4f > > > [92146.548600] [] acpi_os_execute_deferred+0x20/0x2b > > > [92146.548607] [] process_one_work+0x128/0x3f0 > > > [92146.548613] [] ? common_interrupt+0x33/0x38 > > > [92146.548618] [] ? wake_up_worker+0x30/0x30 > > > [92146.548624] [] ? acpi_os_wait_events_complete+0x1e/0x1e > > > [92146.548629] [] worker_thread+0x119/0x3b0 > > > [92146.548634] [] ? manage_workers+0x240/0x240 > > > [92146.548640] [] kthread+0x94/0xa0 > > > [92146.548647] [] ? > > > ftrace_raw_output_sched_stat_runtime+0x70/0xf0 > > > [92146.548652] [] ret_from_kernel_thread+0x1b/0x28 > > > [92146.548658] [] ? kthread_create_on_node+0xc0/0xc0 > > > > > > three different modeset flags are introduced in this patch > > > MODESET_ON_LID_OPEN: do modeset on next lid open event > > > MODESET_DONE: modeset already done > > > MODESET_SUSPENDED: suspended, only do modeset when system is resumed > > > > > > In this way, > > > 1. when lid is closed, MODESET_ON_LID_OPEN is set so that > > >we'll do modeset on next lid open event. > > > 2. when lid is opened, MODESET_DONE is set > > >so that duplicate lid open events will be ignored. > > > 3. when system suspends