diff mbox series

drm/i915/display: Pass drm_i915_private as param to i915 funcs

Message ID 20230119095808.28004-1-nirmoy.das@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/display: Pass drm_i915_private as param to i915 funcs | expand

Commit Message

Nirmoy Das Jan. 19, 2023, 9:58 a.m. UTC
For i915 functions pass struct drm_i915_private directly instead of
struct drm_device.

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Suggested-by: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 2 +-
 drivers/gpu/drm/i915/display/intel_fbdev.c   | 8 ++++----
 drivers/gpu/drm/i915/display/intel_fbdev.h   | 8 ++++----
 drivers/gpu/drm/i915/i915_driver.c           | 4 +++-
 4 files changed, 12 insertions(+), 10 deletions(-)

Comments

Jani Nikula Jan. 19, 2023, 10:58 a.m. UTC | #1
On Thu, 19 Jan 2023, Nirmoy Das <nirmoy.das@intel.com> wrote:
> For i915 functions pass struct drm_i915_private directly instead of
> struct drm_device.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

but maybe let's wait until we've synced up with drm-misc-next to avoid
the unnecessary conflict in drm-tip and linux-next?


>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Suggested-by: Jani Nikula <jani.nikula@linux.intel.com>
> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 2 +-
>  drivers/gpu/drm/i915/display/intel_fbdev.c   | 8 ++++----
>  drivers/gpu/drm/i915/display/intel_fbdev.h   | 8 ++++----
>  drivers/gpu/drm/i915/i915_driver.c           | 4 +++-
>  4 files changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index c38a54efedbe..7584f65c6a7e 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -8999,7 +8999,7 @@ void intel_display_driver_register(struct drm_i915_private *i915)
>  	 * enabled. We do it last so that the async config cannot run
>  	 * before the connectors are registered.
>  	 */
> -	intel_fbdev_initial_config_async(&i915->drm);
> +	intel_fbdev_initial_config_async(i915);
>  
>  	/*
>  	 * We need to coordinate the hotplugs with the asynchronous
> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
> index 19f3b5d92a55..c2c52f8e5887 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
> @@ -547,9 +547,9 @@ static void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
>  		intel_fbdev_unregister(to_i915(ifbdev->helper.dev));
>  }
>  
> -void intel_fbdev_initial_config_async(struct drm_device *dev)
> +void intel_fbdev_initial_config_async(struct drm_i915_private *dev_priv)
>  {
> -	struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev;
> +	struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
>  
>  	if (!ifbdev)
>  		return;
> @@ -686,9 +686,9 @@ void intel_fbdev_output_poll_changed(struct drm_device *dev)
>  		drm_fb_helper_hotplug_event(&ifbdev->helper);
>  }
>  
> -void intel_fbdev_restore_mode(struct drm_device *dev)
> +void intel_fbdev_restore_mode(struct drm_i915_private *dev_priv)
>  {
> -	struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev;
> +	struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
>  
>  	if (!ifbdev)
>  		return;
> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.h b/drivers/gpu/drm/i915/display/intel_fbdev.h
> index 0e95e9472fa3..04fd523a5023 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev.h
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.h
> @@ -15,12 +15,12 @@ struct intel_framebuffer;
>  
>  #ifdef CONFIG_DRM_FBDEV_EMULATION
>  int intel_fbdev_init(struct drm_device *dev);
> -void intel_fbdev_initial_config_async(struct drm_device *dev);
> +void intel_fbdev_initial_config_async(struct drm_i915_private *dev_priv);
>  void intel_fbdev_unregister(struct drm_i915_private *dev_priv);
>  void intel_fbdev_fini(struct drm_i915_private *dev_priv);
>  void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous);
>  void intel_fbdev_output_poll_changed(struct drm_device *dev);
> -void intel_fbdev_restore_mode(struct drm_device *dev);
> +void intel_fbdev_restore_mode(struct drm_i915_private *dev_priv);
>  struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbdev);
>  #else
>  static inline int intel_fbdev_init(struct drm_device *dev)
> @@ -28,7 +28,7 @@ static inline int intel_fbdev_init(struct drm_device *dev)
>  	return 0;
>  }
>  
> -static inline void intel_fbdev_initial_config_async(struct drm_device *dev)
> +static inline void intel_fbdev_initial_config_async(struct drm_i915_private *dev_priv)
>  {
>  }
>  
> @@ -48,7 +48,7 @@ static inline void intel_fbdev_output_poll_changed(struct drm_device *dev)
>  {
>  }
>  
> -static inline void intel_fbdev_restore_mode(struct drm_device *dev)
> +static inline void intel_fbdev_restore_mode(struct drm_i915_private *i915)
>  {
>  }
>  static inline struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbdev)
> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> index 6469c7c1e154..cd6069c1762d 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -1071,7 +1071,9 @@ static int i915_driver_open(struct drm_device *dev, struct drm_file *file)
>   */
>  static void i915_driver_lastclose(struct drm_device *dev)
>  {
> -	intel_fbdev_restore_mode(dev);
> +	struct drm_i915_private *i915 = to_i915(dev);
> +
> +	intel_fbdev_restore_mode(i915);
>  
>  	vga_switcheroo_process_delayed_switch();
>  }
Nirmoy Das Jan. 19, 2023, 11:08 a.m. UTC | #2
On 1/19/2023 11:58 AM, Jani Nikula wrote:
> On Thu, 19 Jan 2023, Nirmoy Das <nirmoy.das@intel.com> wrote:
>> For i915 functions pass struct drm_i915_private directly instead of
>> struct drm_device.
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>
> but maybe let's wait until we've synced up with drm-misc-next to avoid
> the unnecessary conflict in drm-tip and linux-next?


Yes, makes sense, let's wait a bit. Thanks for reviewing,

Nirmoy

>
>
>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>> Suggested-by: Jani Nikula <jani.nikula@linux.intel.com>
>> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
>> ---
>>   drivers/gpu/drm/i915/display/intel_display.c | 2 +-
>>   drivers/gpu/drm/i915/display/intel_fbdev.c   | 8 ++++----
>>   drivers/gpu/drm/i915/display/intel_fbdev.h   | 8 ++++----
>>   drivers/gpu/drm/i915/i915_driver.c           | 4 +++-
>>   4 files changed, 12 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
>> index c38a54efedbe..7584f65c6a7e 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display.c
>> +++ b/drivers/gpu/drm/i915/display/intel_display.c
>> @@ -8999,7 +8999,7 @@ void intel_display_driver_register(struct drm_i915_private *i915)
>>   	 * enabled. We do it last so that the async config cannot run
>>   	 * before the connectors are registered.
>>   	 */
>> -	intel_fbdev_initial_config_async(&i915->drm);
>> +	intel_fbdev_initial_config_async(i915);
>>   
>>   	/*
>>   	 * We need to coordinate the hotplugs with the asynchronous
>> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
>> index 19f3b5d92a55..c2c52f8e5887 100644
>> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
>> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
>> @@ -547,9 +547,9 @@ static void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
>>   		intel_fbdev_unregister(to_i915(ifbdev->helper.dev));
>>   }
>>   
>> -void intel_fbdev_initial_config_async(struct drm_device *dev)
>> +void intel_fbdev_initial_config_async(struct drm_i915_private *dev_priv)
>>   {
>> -	struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev;
>> +	struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
>>   
>>   	if (!ifbdev)
>>   		return;
>> @@ -686,9 +686,9 @@ void intel_fbdev_output_poll_changed(struct drm_device *dev)
>>   		drm_fb_helper_hotplug_event(&ifbdev->helper);
>>   }
>>   
>> -void intel_fbdev_restore_mode(struct drm_device *dev)
>> +void intel_fbdev_restore_mode(struct drm_i915_private *dev_priv)
>>   {
>> -	struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev;
>> +	struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
>>   
>>   	if (!ifbdev)
>>   		return;
>> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.h b/drivers/gpu/drm/i915/display/intel_fbdev.h
>> index 0e95e9472fa3..04fd523a5023 100644
>> --- a/drivers/gpu/drm/i915/display/intel_fbdev.h
>> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.h
>> @@ -15,12 +15,12 @@ struct intel_framebuffer;
>>   
>>   #ifdef CONFIG_DRM_FBDEV_EMULATION
>>   int intel_fbdev_init(struct drm_device *dev);
>> -void intel_fbdev_initial_config_async(struct drm_device *dev);
>> +void intel_fbdev_initial_config_async(struct drm_i915_private *dev_priv);
>>   void intel_fbdev_unregister(struct drm_i915_private *dev_priv);
>>   void intel_fbdev_fini(struct drm_i915_private *dev_priv);
>>   void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous);
>>   void intel_fbdev_output_poll_changed(struct drm_device *dev);
>> -void intel_fbdev_restore_mode(struct drm_device *dev);
>> +void intel_fbdev_restore_mode(struct drm_i915_private *dev_priv);
>>   struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbdev);
>>   #else
>>   static inline int intel_fbdev_init(struct drm_device *dev)
>> @@ -28,7 +28,7 @@ static inline int intel_fbdev_init(struct drm_device *dev)
>>   	return 0;
>>   }
>>   
>> -static inline void intel_fbdev_initial_config_async(struct drm_device *dev)
>> +static inline void intel_fbdev_initial_config_async(struct drm_i915_private *dev_priv)
>>   {
>>   }
>>   
>> @@ -48,7 +48,7 @@ static inline void intel_fbdev_output_poll_changed(struct drm_device *dev)
>>   {
>>   }
>>   
>> -static inline void intel_fbdev_restore_mode(struct drm_device *dev)
>> +static inline void intel_fbdev_restore_mode(struct drm_i915_private *i915)
>>   {
>>   }
>>   static inline struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbdev)
>> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
>> index 6469c7c1e154..cd6069c1762d 100644
>> --- a/drivers/gpu/drm/i915/i915_driver.c
>> +++ b/drivers/gpu/drm/i915/i915_driver.c
>> @@ -1071,7 +1071,9 @@ static int i915_driver_open(struct drm_device *dev, struct drm_file *file)
>>    */
>>   static void i915_driver_lastclose(struct drm_device *dev)
>>   {
>> -	intel_fbdev_restore_mode(dev);
>> +	struct drm_i915_private *i915 = to_i915(dev);
>> +
>> +	intel_fbdev_restore_mode(i915);
>>   
>>   	vga_switcheroo_process_delayed_switch();
>>   }
Andrzej Hajda Jan. 19, 2023, 2:06 p.m. UTC | #3
On 19.01.2023 10:58, Nirmoy Das wrote:
> For i915 functions pass struct drm_i915_private directly instead of
> struct drm_device.
> 
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Suggested-by: Jani Nikula <jani.nikula@linux.intel.com>
> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>

It could be good start for boring refactoring :) of similar cases, for 
example:
intel_fbdev_restore_mode
intel_fbdev_set_suspend

Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Regards
Andrzej


> ---
>   drivers/gpu/drm/i915/display/intel_display.c | 2 +-
>   drivers/gpu/drm/i915/display/intel_fbdev.c   | 8 ++++----
>   drivers/gpu/drm/i915/display/intel_fbdev.h   | 8 ++++----
>   drivers/gpu/drm/i915/i915_driver.c           | 4 +++-
>   4 files changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index c38a54efedbe..7584f65c6a7e 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -8999,7 +8999,7 @@ void intel_display_driver_register(struct drm_i915_private *i915)
>   	 * enabled. We do it last so that the async config cannot run
>   	 * before the connectors are registered.
>   	 */
> -	intel_fbdev_initial_config_async(&i915->drm);
> +	intel_fbdev_initial_config_async(i915);
>   
>   	/*
>   	 * We need to coordinate the hotplugs with the asynchronous
> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
> index 19f3b5d92a55..c2c52f8e5887 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
> @@ -547,9 +547,9 @@ static void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
>   		intel_fbdev_unregister(to_i915(ifbdev->helper.dev));
>   }
>   
> -void intel_fbdev_initial_config_async(struct drm_device *dev)
> +void intel_fbdev_initial_config_async(struct drm_i915_private *dev_priv)
>   {
> -	struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev;
> +	struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
>   
>   	if (!ifbdev)
>   		return;
> @@ -686,9 +686,9 @@ void intel_fbdev_output_poll_changed(struct drm_device *dev)
>   		drm_fb_helper_hotplug_event(&ifbdev->helper);
>   }
>   
> -void intel_fbdev_restore_mode(struct drm_device *dev)
> +void intel_fbdev_restore_mode(struct drm_i915_private *dev_priv)
>   {
> -	struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev;
> +	struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
>   
>   	if (!ifbdev)
>   		return;
> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.h b/drivers/gpu/drm/i915/display/intel_fbdev.h
> index 0e95e9472fa3..04fd523a5023 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev.h
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.h
> @@ -15,12 +15,12 @@ struct intel_framebuffer;
>   
>   #ifdef CONFIG_DRM_FBDEV_EMULATION
>   int intel_fbdev_init(struct drm_device *dev);
> -void intel_fbdev_initial_config_async(struct drm_device *dev);
> +void intel_fbdev_initial_config_async(struct drm_i915_private *dev_priv);
>   void intel_fbdev_unregister(struct drm_i915_private *dev_priv);
>   void intel_fbdev_fini(struct drm_i915_private *dev_priv);
>   void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous);
>   void intel_fbdev_output_poll_changed(struct drm_device *dev);
> -void intel_fbdev_restore_mode(struct drm_device *dev);
> +void intel_fbdev_restore_mode(struct drm_i915_private *dev_priv);
>   struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbdev);
>   #else
>   static inline int intel_fbdev_init(struct drm_device *dev)
> @@ -28,7 +28,7 @@ static inline int intel_fbdev_init(struct drm_device *dev)
>   	return 0;
>   }
>   
> -static inline void intel_fbdev_initial_config_async(struct drm_device *dev)
> +static inline void intel_fbdev_initial_config_async(struct drm_i915_private *dev_priv)
>   {
>   }
>   
> @@ -48,7 +48,7 @@ static inline void intel_fbdev_output_poll_changed(struct drm_device *dev)
>   {
>   }
>   
> -static inline void intel_fbdev_restore_mode(struct drm_device *dev)
> +static inline void intel_fbdev_restore_mode(struct drm_i915_private *i915)
>   {
>   }
>   static inline struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbdev)
> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> index 6469c7c1e154..cd6069c1762d 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -1071,7 +1071,9 @@ static int i915_driver_open(struct drm_device *dev, struct drm_file *file)
>    */
>   static void i915_driver_lastclose(struct drm_device *dev)
>   {
> -	intel_fbdev_restore_mode(dev);
> +	struct drm_i915_private *i915 = to_i915(dev);
> +
> +	intel_fbdev_restore_mode(i915);
>   
>   	vga_switcheroo_process_delayed_switch();
>   }
Nirmoy Das Jan. 19, 2023, 3:15 p.m. UTC | #4
On 1/19/2023 3:06 PM, Andrzej Hajda wrote:
> On 19.01.2023 10:58, Nirmoy Das wrote:
>> For i915 functions pass struct drm_i915_private directly instead of
>> struct drm_device.
>>
>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>> Suggested-by: Jani Nikula <jani.nikula@linux.intel.com>
>> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
>
> It could be good start for boring refactoring :) of similar cases, for 
> example:
> intel_fbdev_restore_mode
> intel_fbdev_set_suspend
>

Ah I missed those. I was mostly looked into the intel_display.c. I can 
send another one.

> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>


Thanks,


Nirmoy

>
>
> Regards
> Andrzej
>
>
>> ---
>>   drivers/gpu/drm/i915/display/intel_display.c | 2 +-
>>   drivers/gpu/drm/i915/display/intel_fbdev.c   | 8 ++++----
>>   drivers/gpu/drm/i915/display/intel_fbdev.h   | 8 ++++----
>>   drivers/gpu/drm/i915/i915_driver.c           | 4 +++-
>>   4 files changed, 12 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
>> b/drivers/gpu/drm/i915/display/intel_display.c
>> index c38a54efedbe..7584f65c6a7e 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display.c
>> +++ b/drivers/gpu/drm/i915/display/intel_display.c
>> @@ -8999,7 +8999,7 @@ void intel_display_driver_register(struct 
>> drm_i915_private *i915)
>>        * enabled. We do it last so that the async config cannot run
>>        * before the connectors are registered.
>>        */
>> -    intel_fbdev_initial_config_async(&i915->drm);
>> +    intel_fbdev_initial_config_async(i915);
>>         /*
>>        * We need to coordinate the hotplugs with the asynchronous
>> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c 
>> b/drivers/gpu/drm/i915/display/intel_fbdev.c
>> index 19f3b5d92a55..c2c52f8e5887 100644
>> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
>> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
>> @@ -547,9 +547,9 @@ static void intel_fbdev_initial_config(void 
>> *data, async_cookie_t cookie)
>> intel_fbdev_unregister(to_i915(ifbdev->helper.dev));
>>   }
>>   -void intel_fbdev_initial_config_async(struct drm_device *dev)
>> +void intel_fbdev_initial_config_async(struct drm_i915_private 
>> *dev_priv)
>>   {
>> -    struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev;
>> +    struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
>>         if (!ifbdev)
>>           return;
>> @@ -686,9 +686,9 @@ void intel_fbdev_output_poll_changed(struct 
>> drm_device *dev)
>>           drm_fb_helper_hotplug_event(&ifbdev->helper);
>>   }
>>   -void intel_fbdev_restore_mode(struct drm_device *dev)
>> +void intel_fbdev_restore_mode(struct drm_i915_private *dev_priv)
>>   {
>> -    struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev;
>> +    struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
>>         if (!ifbdev)
>>           return;
>> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.h 
>> b/drivers/gpu/drm/i915/display/intel_fbdev.h
>> index 0e95e9472fa3..04fd523a5023 100644
>> --- a/drivers/gpu/drm/i915/display/intel_fbdev.h
>> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.h
>> @@ -15,12 +15,12 @@ struct intel_framebuffer;
>>     #ifdef CONFIG_DRM_FBDEV_EMULATION
>>   int intel_fbdev_init(struct drm_device *dev);
>> -void intel_fbdev_initial_config_async(struct drm_device *dev);
>> +void intel_fbdev_initial_config_async(struct drm_i915_private 
>> *dev_priv);
>>   void intel_fbdev_unregister(struct drm_i915_private *dev_priv);
>>   void intel_fbdev_fini(struct drm_i915_private *dev_priv);
>>   void intel_fbdev_set_suspend(struct drm_device *dev, int state, 
>> bool synchronous);
>>   void intel_fbdev_output_poll_changed(struct drm_device *dev);
>> -void intel_fbdev_restore_mode(struct drm_device *dev);
>> +void intel_fbdev_restore_mode(struct drm_i915_private *dev_priv);
>>   struct intel_framebuffer *intel_fbdev_framebuffer(struct 
>> intel_fbdev *fbdev);
>>   #else
>>   static inline int intel_fbdev_init(struct drm_device *dev)
>> @@ -28,7 +28,7 @@ static inline int intel_fbdev_init(struct 
>> drm_device *dev)
>>       return 0;
>>   }
>>   -static inline void intel_fbdev_initial_config_async(struct 
>> drm_device *dev)
>> +static inline void intel_fbdev_initial_config_async(struct 
>> drm_i915_private *dev_priv)
>>   {
>>   }
>>   @@ -48,7 +48,7 @@ static inline void 
>> intel_fbdev_output_poll_changed(struct drm_device *dev)
>>   {
>>   }
>>   -static inline void intel_fbdev_restore_mode(struct drm_device *dev)
>> +static inline void intel_fbdev_restore_mode(struct drm_i915_private 
>> *i915)
>>   {
>>   }
>>   static inline struct intel_framebuffer 
>> *intel_fbdev_framebuffer(struct intel_fbdev *fbdev)
>> diff --git a/drivers/gpu/drm/i915/i915_driver.c 
>> b/drivers/gpu/drm/i915/i915_driver.c
>> index 6469c7c1e154..cd6069c1762d 100644
>> --- a/drivers/gpu/drm/i915/i915_driver.c
>> +++ b/drivers/gpu/drm/i915/i915_driver.c
>> @@ -1071,7 +1071,9 @@ static int i915_driver_open(struct drm_device 
>> *dev, struct drm_file *file)
>>    */
>>   static void i915_driver_lastclose(struct drm_device *dev)
>>   {
>> -    intel_fbdev_restore_mode(dev);
>> +    struct drm_i915_private *i915 = to_i915(dev);
>> +
>> +    intel_fbdev_restore_mode(i915);
>>         vga_switcheroo_process_delayed_switch();
>>   }
>
Andi Shyti Feb. 10, 2023, 12:21 p.m. UTC | #5
Hi Jani,

On Thu, Jan 19, 2023 at 12:58:47PM +0200, Jani Nikula wrote:
> On Thu, 19 Jan 2023, Nirmoy Das <nirmoy.das@intel.com> wrote:
> > For i915 functions pass struct drm_i915_private directly instead of
> > struct drm_device.
> 
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> 
> but maybe let's wait until we've synced up with drm-misc-next to avoid
> the unnecessary conflict in drm-tip and linux-next?

can we push it now? Do you want me to take care of it?

Andi

> >
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Suggested-by: Jani Nikula <jani.nikula@linux.intel.com>
> > Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_display.c | 2 +-
> >  drivers/gpu/drm/i915/display/intel_fbdev.c   | 8 ++++----
> >  drivers/gpu/drm/i915/display/intel_fbdev.h   | 8 ++++----
> >  drivers/gpu/drm/i915/i915_driver.c           | 4 +++-
> >  4 files changed, 12 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > index c38a54efedbe..7584f65c6a7e 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -8999,7 +8999,7 @@ void intel_display_driver_register(struct drm_i915_private *i915)
> >  	 * enabled. We do it last so that the async config cannot run
> >  	 * before the connectors are registered.
> >  	 */
> > -	intel_fbdev_initial_config_async(&i915->drm);
> > +	intel_fbdev_initial_config_async(i915);
> >  
> >  	/*
> >  	 * We need to coordinate the hotplugs with the asynchronous
> > diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
> > index 19f3b5d92a55..c2c52f8e5887 100644
> > --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
> > +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
> > @@ -547,9 +547,9 @@ static void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
> >  		intel_fbdev_unregister(to_i915(ifbdev->helper.dev));
> >  }
> >  
> > -void intel_fbdev_initial_config_async(struct drm_device *dev)
> > +void intel_fbdev_initial_config_async(struct drm_i915_private *dev_priv)
> >  {
> > -	struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev;
> > +	struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
> >  
> >  	if (!ifbdev)
> >  		return;
> > @@ -686,9 +686,9 @@ void intel_fbdev_output_poll_changed(struct drm_device *dev)
> >  		drm_fb_helper_hotplug_event(&ifbdev->helper);
> >  }
> >  
> > -void intel_fbdev_restore_mode(struct drm_device *dev)
> > +void intel_fbdev_restore_mode(struct drm_i915_private *dev_priv)
> >  {
> > -	struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev;
> > +	struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
> >  
> >  	if (!ifbdev)
> >  		return;
> > diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.h b/drivers/gpu/drm/i915/display/intel_fbdev.h
> > index 0e95e9472fa3..04fd523a5023 100644
> > --- a/drivers/gpu/drm/i915/display/intel_fbdev.h
> > +++ b/drivers/gpu/drm/i915/display/intel_fbdev.h
> > @@ -15,12 +15,12 @@ struct intel_framebuffer;
> >  
> >  #ifdef CONFIG_DRM_FBDEV_EMULATION
> >  int intel_fbdev_init(struct drm_device *dev);
> > -void intel_fbdev_initial_config_async(struct drm_device *dev);
> > +void intel_fbdev_initial_config_async(struct drm_i915_private *dev_priv);
> >  void intel_fbdev_unregister(struct drm_i915_private *dev_priv);
> >  void intel_fbdev_fini(struct drm_i915_private *dev_priv);
> >  void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous);
> >  void intel_fbdev_output_poll_changed(struct drm_device *dev);
> > -void intel_fbdev_restore_mode(struct drm_device *dev);
> > +void intel_fbdev_restore_mode(struct drm_i915_private *dev_priv);
> >  struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbdev);
> >  #else
> >  static inline int intel_fbdev_init(struct drm_device *dev)
> > @@ -28,7 +28,7 @@ static inline int intel_fbdev_init(struct drm_device *dev)
> >  	return 0;
> >  }
> >  
> > -static inline void intel_fbdev_initial_config_async(struct drm_device *dev)
> > +static inline void intel_fbdev_initial_config_async(struct drm_i915_private *dev_priv)
> >  {
> >  }
> >  
> > @@ -48,7 +48,7 @@ static inline void intel_fbdev_output_poll_changed(struct drm_device *dev)
> >  {
> >  }
> >  
> > -static inline void intel_fbdev_restore_mode(struct drm_device *dev)
> > +static inline void intel_fbdev_restore_mode(struct drm_i915_private *i915)
> >  {
> >  }
> >  static inline struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbdev)
> > diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> > index 6469c7c1e154..cd6069c1762d 100644
> > --- a/drivers/gpu/drm/i915/i915_driver.c
> > +++ b/drivers/gpu/drm/i915/i915_driver.c
> > @@ -1071,7 +1071,9 @@ static int i915_driver_open(struct drm_device *dev, struct drm_file *file)
> >   */
> >  static void i915_driver_lastclose(struct drm_device *dev)
> >  {
> > -	intel_fbdev_restore_mode(dev);
> > +	struct drm_i915_private *i915 = to_i915(dev);
> > +
> > +	intel_fbdev_restore_mode(i915);
> >  
> >  	vga_switcheroo_process_delayed_switch();
> >  }
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center
Nirmoy Das Feb. 10, 2023, 12:27 p.m. UTC | #6
On 2/10/2023 1:21 PM, Andi Shyti wrote:
> Hi Jani,
>
> On Thu, Jan 19, 2023 at 12:58:47PM +0200, Jani Nikula wrote:
>> On Thu, 19 Jan 2023, Nirmoy Das <nirmoy.das@intel.com> wrote:
>>> For i915 functions pass struct drm_i915_private directly instead of
>>> struct drm_device.
>> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>>
>> but maybe let's wait until we've synced up with drm-misc-next to avoid
>> the unnecessary conflict in drm-tip and linux-next?
> can we push it now? Do you want me to take care of it?


Would be nice if this is gets picked, though I still didn't manage to 
work on Jani's follow up "dev_privs to i915" cleanup patches.

FYI: this v1, I have a v2 for this 
https://patchwork.freedesktop.org/patch/520148/?series=113083&rev=3


Regards,

Nirmoy

>
> Andi
>
>>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>>> Suggested-by: Jani Nikula <jani.nikula@linux.intel.com>
>>> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
>>> ---
>>>   drivers/gpu/drm/i915/display/intel_display.c | 2 +-
>>>   drivers/gpu/drm/i915/display/intel_fbdev.c   | 8 ++++----
>>>   drivers/gpu/drm/i915/display/intel_fbdev.h   | 8 ++++----
>>>   drivers/gpu/drm/i915/i915_driver.c           | 4 +++-
>>>   4 files changed, 12 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
>>> index c38a54efedbe..7584f65c6a7e 100644
>>> --- a/drivers/gpu/drm/i915/display/intel_display.c
>>> +++ b/drivers/gpu/drm/i915/display/intel_display.c
>>> @@ -8999,7 +8999,7 @@ void intel_display_driver_register(struct drm_i915_private *i915)
>>>   	 * enabled. We do it last so that the async config cannot run
>>>   	 * before the connectors are registered.
>>>   	 */
>>> -	intel_fbdev_initial_config_async(&i915->drm);
>>> +	intel_fbdev_initial_config_async(i915);
>>>   
>>>   	/*
>>>   	 * We need to coordinate the hotplugs with the asynchronous
>>> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
>>> index 19f3b5d92a55..c2c52f8e5887 100644
>>> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
>>> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
>>> @@ -547,9 +547,9 @@ static void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
>>>   		intel_fbdev_unregister(to_i915(ifbdev->helper.dev));
>>>   }
>>>   
>>> -void intel_fbdev_initial_config_async(struct drm_device *dev)
>>> +void intel_fbdev_initial_config_async(struct drm_i915_private *dev_priv)
>>>   {
>>> -	struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev;
>>> +	struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
>>>   
>>>   	if (!ifbdev)
>>>   		return;
>>> @@ -686,9 +686,9 @@ void intel_fbdev_output_poll_changed(struct drm_device *dev)
>>>   		drm_fb_helper_hotplug_event(&ifbdev->helper);
>>>   }
>>>   
>>> -void intel_fbdev_restore_mode(struct drm_device *dev)
>>> +void intel_fbdev_restore_mode(struct drm_i915_private *dev_priv)
>>>   {
>>> -	struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev;
>>> +	struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
>>>   
>>>   	if (!ifbdev)
>>>   		return;
>>> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.h b/drivers/gpu/drm/i915/display/intel_fbdev.h
>>> index 0e95e9472fa3..04fd523a5023 100644
>>> --- a/drivers/gpu/drm/i915/display/intel_fbdev.h
>>> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.h
>>> @@ -15,12 +15,12 @@ struct intel_framebuffer;
>>>   
>>>   #ifdef CONFIG_DRM_FBDEV_EMULATION
>>>   int intel_fbdev_init(struct drm_device *dev);
>>> -void intel_fbdev_initial_config_async(struct drm_device *dev);
>>> +void intel_fbdev_initial_config_async(struct drm_i915_private *dev_priv);
>>>   void intel_fbdev_unregister(struct drm_i915_private *dev_priv);
>>>   void intel_fbdev_fini(struct drm_i915_private *dev_priv);
>>>   void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous);
>>>   void intel_fbdev_output_poll_changed(struct drm_device *dev);
>>> -void intel_fbdev_restore_mode(struct drm_device *dev);
>>> +void intel_fbdev_restore_mode(struct drm_i915_private *dev_priv);
>>>   struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbdev);
>>>   #else
>>>   static inline int intel_fbdev_init(struct drm_device *dev)
>>> @@ -28,7 +28,7 @@ static inline int intel_fbdev_init(struct drm_device *dev)
>>>   	return 0;
>>>   }
>>>   
>>> -static inline void intel_fbdev_initial_config_async(struct drm_device *dev)
>>> +static inline void intel_fbdev_initial_config_async(struct drm_i915_private *dev_priv)
>>>   {
>>>   }
>>>   
>>> @@ -48,7 +48,7 @@ static inline void intel_fbdev_output_poll_changed(struct drm_device *dev)
>>>   {
>>>   }
>>>   
>>> -static inline void intel_fbdev_restore_mode(struct drm_device *dev)
>>> +static inline void intel_fbdev_restore_mode(struct drm_i915_private *i915)
>>>   {
>>>   }
>>>   static inline struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbdev)
>>> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
>>> index 6469c7c1e154..cd6069c1762d 100644
>>> --- a/drivers/gpu/drm/i915/i915_driver.c
>>> +++ b/drivers/gpu/drm/i915/i915_driver.c
>>> @@ -1071,7 +1071,9 @@ static int i915_driver_open(struct drm_device *dev, struct drm_file *file)
>>>    */
>>>   static void i915_driver_lastclose(struct drm_device *dev)
>>>   {
>>> -	intel_fbdev_restore_mode(dev);
>>> +	struct drm_i915_private *i915 = to_i915(dev);
>>> +
>>> +	intel_fbdev_restore_mode(i915);
>>>   
>>>   	vga_switcheroo_process_delayed_switch();
>>>   }
>> -- 
>> Jani Nikula, Intel Open Source Graphics Center
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index c38a54efedbe..7584f65c6a7e 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -8999,7 +8999,7 @@  void intel_display_driver_register(struct drm_i915_private *i915)
 	 * enabled. We do it last so that the async config cannot run
 	 * before the connectors are registered.
 	 */
-	intel_fbdev_initial_config_async(&i915->drm);
+	intel_fbdev_initial_config_async(i915);
 
 	/*
 	 * We need to coordinate the hotplugs with the asynchronous
diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
index 19f3b5d92a55..c2c52f8e5887 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -547,9 +547,9 @@  static void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
 		intel_fbdev_unregister(to_i915(ifbdev->helper.dev));
 }
 
-void intel_fbdev_initial_config_async(struct drm_device *dev)
+void intel_fbdev_initial_config_async(struct drm_i915_private *dev_priv)
 {
-	struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev;
+	struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
 
 	if (!ifbdev)
 		return;
@@ -686,9 +686,9 @@  void intel_fbdev_output_poll_changed(struct drm_device *dev)
 		drm_fb_helper_hotplug_event(&ifbdev->helper);
 }
 
-void intel_fbdev_restore_mode(struct drm_device *dev)
+void intel_fbdev_restore_mode(struct drm_i915_private *dev_priv)
 {
-	struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev;
+	struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
 
 	if (!ifbdev)
 		return;
diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.h b/drivers/gpu/drm/i915/display/intel_fbdev.h
index 0e95e9472fa3..04fd523a5023 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.h
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.h
@@ -15,12 +15,12 @@  struct intel_framebuffer;
 
 #ifdef CONFIG_DRM_FBDEV_EMULATION
 int intel_fbdev_init(struct drm_device *dev);
-void intel_fbdev_initial_config_async(struct drm_device *dev);
+void intel_fbdev_initial_config_async(struct drm_i915_private *dev_priv);
 void intel_fbdev_unregister(struct drm_i915_private *dev_priv);
 void intel_fbdev_fini(struct drm_i915_private *dev_priv);
 void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous);
 void intel_fbdev_output_poll_changed(struct drm_device *dev);
-void intel_fbdev_restore_mode(struct drm_device *dev);
+void intel_fbdev_restore_mode(struct drm_i915_private *dev_priv);
 struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbdev);
 #else
 static inline int intel_fbdev_init(struct drm_device *dev)
@@ -28,7 +28,7 @@  static inline int intel_fbdev_init(struct drm_device *dev)
 	return 0;
 }
 
-static inline void intel_fbdev_initial_config_async(struct drm_device *dev)
+static inline void intel_fbdev_initial_config_async(struct drm_i915_private *dev_priv)
 {
 }
 
@@ -48,7 +48,7 @@  static inline void intel_fbdev_output_poll_changed(struct drm_device *dev)
 {
 }
 
-static inline void intel_fbdev_restore_mode(struct drm_device *dev)
+static inline void intel_fbdev_restore_mode(struct drm_i915_private *i915)
 {
 }
 static inline struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbdev)
diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
index 6469c7c1e154..cd6069c1762d 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -1071,7 +1071,9 @@  static int i915_driver_open(struct drm_device *dev, struct drm_file *file)
  */
 static void i915_driver_lastclose(struct drm_device *dev)
 {
-	intel_fbdev_restore_mode(dev);
+	struct drm_i915_private *i915 = to_i915(dev);
+
+	intel_fbdev_restore_mode(i915);
 
 	vga_switcheroo_process_delayed_switch();
 }