diff mbox series

[v2] drm/i915/display: Add a wrapper function for vga decode setup

Message ID 20230925065014.1252784-1-uma.shankar@intel.com (mailing list archive)
State New, archived
Headers show
Series [v2] drm/i915/display: Add a wrapper function for vga decode setup | expand

Commit Message

Shankar, Uma Sept. 25, 2023, 6:50 a.m. UTC
Some of the VGA functionality is not needed by the proposed
Intel Xe driver, while this will be utilized by i915.
Adding a wrapper function for VGA decode setup.

v2: Addressed Jani Nikula's review comments.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/i915/display/intel_vga.c |  2 --
 drivers/gpu/drm/i915/soc/intel_gmch.c    | 14 ++++++++++++++
 drivers/gpu/drm/i915/soc/intel_gmch.h    |  2 ++
 3 files changed, 16 insertions(+), 2 deletions(-)

Comments

Jani Nikula Sept. 26, 2023, 10:54 a.m. UTC | #1
On Mon, 25 Sep 2023, Uma Shankar <uma.shankar@intel.com> wrote:
> Some of the VGA functionality is not needed by the proposed
> Intel Xe driver, while this will be utilized by i915.
> Adding a wrapper function for VGA decode setup.

So, this duplicates intel_vga_set_decode() without removing the old
one. Is that the intention?

I guess the idea here is that xe doesn't build intel_gmch, so you can
add a nop version there?

BR,
Jani.



>
> v2: Addressed Jani Nikula's review comments.
>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_vga.c |  2 --
>  drivers/gpu/drm/i915/soc/intel_gmch.c    | 14 ++++++++++++++
>  drivers/gpu/drm/i915/soc/intel_gmch.h    |  2 ++
>  3 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_vga.c b/drivers/gpu/drm/i915/display/intel_vga.c
> index 286a0bdd28c6..0f65ce115035 100644
> --- a/drivers/gpu/drm/i915/display/intel_vga.c
> +++ b/drivers/gpu/drm/i915/display/intel_vga.c
> @@ -3,11 +3,9 @@
>   * Copyright © 2019 Intel Corporation
>   */
>  
> -#include <linux/pci.h>
>  #include <linux/vgaarb.h>
>  
>  #include <video/vga.h>
> -
>  #include "soc/intel_gmch.h"
>  
>  #include "i915_drv.h"
> diff --git a/drivers/gpu/drm/i915/soc/intel_gmch.c b/drivers/gpu/drm/i915/soc/intel_gmch.c
> index 49c7fb16e934..f32e9f78770a 100644
> --- a/drivers/gpu/drm/i915/soc/intel_gmch.c
> +++ b/drivers/gpu/drm/i915/soc/intel_gmch.c
> @@ -5,6 +5,7 @@
>  
>  #include <linux/pci.h>
>  #include <linux/pnp.h>
> +#include <linux/vgaarb.h>
>  
>  #include <drm/drm_managed.h>
>  #include <drm/i915_drm.h>
> @@ -167,3 +168,16 @@ int intel_gmch_vga_set_state(struct drm_i915_private *i915, bool enable_decode)
>  
>  	return 0;
>  }
> +
> +unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool enable_decode)
> +{
> +	struct drm_i915_private *i915 = pdev_to_i915(pdev);
> +
> +	intel_gmch_vga_set_state(i915, enable_decode);
> +
> +	if (enable_decode)
> +		return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
> +		       VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
> +	else
> +		return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
> +}
> diff --git a/drivers/gpu/drm/i915/soc/intel_gmch.h b/drivers/gpu/drm/i915/soc/intel_gmch.h
> index d0133eedc720..23be2d113afd 100644
> --- a/drivers/gpu/drm/i915/soc/intel_gmch.h
> +++ b/drivers/gpu/drm/i915/soc/intel_gmch.h
> @@ -8,11 +8,13 @@
>  
>  #include <linux/types.h>
>  
> +struct pci_dev;
>  struct drm_i915_private;
>  
>  int intel_gmch_bridge_setup(struct drm_i915_private *i915);
>  void intel_gmch_bar_setup(struct drm_i915_private *i915);
>  void intel_gmch_bar_teardown(struct drm_i915_private *i915);
>  int intel_gmch_vga_set_state(struct drm_i915_private *i915, bool enable_decode);
> +unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool enable_decode);
>  
>  #endif /* __INTEL_GMCH_H__ */
Jani Nikula Sept. 26, 2023, 10:55 a.m. UTC | #2
On Tue, 26 Sep 2023, Jani Nikula <jani.nikula@intel.com> wrote:
> On Mon, 25 Sep 2023, Uma Shankar <uma.shankar@intel.com> wrote:
>> Some of the VGA functionality is not needed by the proposed
>> Intel Xe driver, while this will be utilized by i915.
>> Adding a wrapper function for VGA decode setup.

I guess "wrapper function" is now a misnomer? There's no wrapping here?

>
> So, this duplicates intel_vga_set_decode() without removing the old
> one. Is that the intention?
>
> I guess the idea here is that xe doesn't build intel_gmch, so you can
> add a nop version there?
>
> BR,
> Jani.
>
>
>
>>
>> v2: Addressed Jani Nikula's review comments.
>>
>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> ---
>>  drivers/gpu/drm/i915/display/intel_vga.c |  2 --
>>  drivers/gpu/drm/i915/soc/intel_gmch.c    | 14 ++++++++++++++
>>  drivers/gpu/drm/i915/soc/intel_gmch.h    |  2 ++
>>  3 files changed, 16 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_vga.c b/drivers/gpu/drm/i915/display/intel_vga.c
>> index 286a0bdd28c6..0f65ce115035 100644
>> --- a/drivers/gpu/drm/i915/display/intel_vga.c
>> +++ b/drivers/gpu/drm/i915/display/intel_vga.c
>> @@ -3,11 +3,9 @@
>>   * Copyright © 2019 Intel Corporation
>>   */
>>  
>> -#include <linux/pci.h>
>>  #include <linux/vgaarb.h>
>>  
>>  #include <video/vga.h>
>> -
>>  #include "soc/intel_gmch.h"
>>  
>>  #include "i915_drv.h"
>> diff --git a/drivers/gpu/drm/i915/soc/intel_gmch.c b/drivers/gpu/drm/i915/soc/intel_gmch.c
>> index 49c7fb16e934..f32e9f78770a 100644
>> --- a/drivers/gpu/drm/i915/soc/intel_gmch.c
>> +++ b/drivers/gpu/drm/i915/soc/intel_gmch.c
>> @@ -5,6 +5,7 @@
>>  
>>  #include <linux/pci.h>
>>  #include <linux/pnp.h>
>> +#include <linux/vgaarb.h>
>>  
>>  #include <drm/drm_managed.h>
>>  #include <drm/i915_drm.h>
>> @@ -167,3 +168,16 @@ int intel_gmch_vga_set_state(struct drm_i915_private *i915, bool enable_decode)
>>  
>>  	return 0;
>>  }
>> +
>> +unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool enable_decode)
>> +{
>> +	struct drm_i915_private *i915 = pdev_to_i915(pdev);
>> +
>> +	intel_gmch_vga_set_state(i915, enable_decode);
>> +
>> +	if (enable_decode)
>> +		return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
>> +		       VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
>> +	else
>> +		return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
>> +}
>> diff --git a/drivers/gpu/drm/i915/soc/intel_gmch.h b/drivers/gpu/drm/i915/soc/intel_gmch.h
>> index d0133eedc720..23be2d113afd 100644
>> --- a/drivers/gpu/drm/i915/soc/intel_gmch.h
>> +++ b/drivers/gpu/drm/i915/soc/intel_gmch.h
>> @@ -8,11 +8,13 @@
>>  
>>  #include <linux/types.h>
>>  
>> +struct pci_dev;
>>  struct drm_i915_private;
>>  
>>  int intel_gmch_bridge_setup(struct drm_i915_private *i915);
>>  void intel_gmch_bar_setup(struct drm_i915_private *i915);
>>  void intel_gmch_bar_teardown(struct drm_i915_private *i915);
>>  int intel_gmch_vga_set_state(struct drm_i915_private *i915, bool enable_decode);
>> +unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool enable_decode);
>>  
>>  #endif /* __INTEL_GMCH_H__ */
Shankar, Uma Sept. 26, 2023, 6:57 p.m. UTC | #3
> -----Original Message-----
> From: Nikula, Jani <jani.nikula@intel.com>
> Sent: Tuesday, September 26, 2023 4:25 PM
> To: Shankar, Uma <uma.shankar@intel.com>; intel-gfx@lists.freedesktop.org
> Cc: Shankar, Uma <uma.shankar@intel.com>
> Subject: Re: [v2] drm/i915/display: Add a wrapper function for vga decode setup
> 
> On Mon, 25 Sep 2023, Uma Shankar <uma.shankar@intel.com> wrote:
> > Some of the VGA functionality is not needed by the proposed Intel Xe
> > driver, while this will be utilized by i915.
> > Adding a wrapper function for VGA decode setup.
> 
> So, this duplicates intel_vga_set_decode() without removing the old one. Is that
> the intention?

No Jani, it's a fumble ☹. Will fix it.

> I guess the idea here is that xe doesn't build intel_gmch, so you can add a nop
> version there?

Yes right.

Regards,
Uma Shankar

> 
> BR,
> Jani.
> 
> 
> 
> >
> > v2: Addressed Jani Nikula's review comments.
> >
> > Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_vga.c |  2 --
> >  drivers/gpu/drm/i915/soc/intel_gmch.c    | 14 ++++++++++++++
> >  drivers/gpu/drm/i915/soc/intel_gmch.h    |  2 ++
> >  3 files changed, 16 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_vga.c
> > b/drivers/gpu/drm/i915/display/intel_vga.c
> > index 286a0bdd28c6..0f65ce115035 100644
> > --- a/drivers/gpu/drm/i915/display/intel_vga.c
> > +++ b/drivers/gpu/drm/i915/display/intel_vga.c
> > @@ -3,11 +3,9 @@
> >   * Copyright © 2019 Intel Corporation
> >   */
> >
> > -#include <linux/pci.h>
> >  #include <linux/vgaarb.h>
> >
> >  #include <video/vga.h>
> > -
> >  #include "soc/intel_gmch.h"
> >
> >  #include "i915_drv.h"
> > diff --git a/drivers/gpu/drm/i915/soc/intel_gmch.c
> > b/drivers/gpu/drm/i915/soc/intel_gmch.c
> > index 49c7fb16e934..f32e9f78770a 100644
> > --- a/drivers/gpu/drm/i915/soc/intel_gmch.c
> > +++ b/drivers/gpu/drm/i915/soc/intel_gmch.c
> > @@ -5,6 +5,7 @@
> >
> >  #include <linux/pci.h>
> >  #include <linux/pnp.h>
> > +#include <linux/vgaarb.h>
> >
> >  #include <drm/drm_managed.h>
> >  #include <drm/i915_drm.h>
> > @@ -167,3 +168,16 @@ int intel_gmch_vga_set_state(struct
> > drm_i915_private *i915, bool enable_decode)
> >
> >  	return 0;
> >  }
> > +
> > +unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool
> > +enable_decode) {
> > +	struct drm_i915_private *i915 = pdev_to_i915(pdev);
> > +
> > +	intel_gmch_vga_set_state(i915, enable_decode);
> > +
> > +	if (enable_decode)
> > +		return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
> > +		       VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
> > +	else
> > +		return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM; }
> > diff --git a/drivers/gpu/drm/i915/soc/intel_gmch.h
> > b/drivers/gpu/drm/i915/soc/intel_gmch.h
> > index d0133eedc720..23be2d113afd 100644
> > --- a/drivers/gpu/drm/i915/soc/intel_gmch.h
> > +++ b/drivers/gpu/drm/i915/soc/intel_gmch.h
> > @@ -8,11 +8,13 @@
> >
> >  #include <linux/types.h>
> >
> > +struct pci_dev;
> >  struct drm_i915_private;
> >
> >  int intel_gmch_bridge_setup(struct drm_i915_private *i915);  void
> > intel_gmch_bar_setup(struct drm_i915_private *i915);  void
> > intel_gmch_bar_teardown(struct drm_i915_private *i915);  int
> > intel_gmch_vga_set_state(struct drm_i915_private *i915, bool
> > enable_decode);
> > +unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool
> > +enable_decode);
> >
> >  #endif /* __INTEL_GMCH_H__ */
> 
> --
> Jani Nikula, Intel
Shankar, Uma Sept. 26, 2023, 6:58 p.m. UTC | #4
> -----Original Message-----
> From: Nikula, Jani <jani.nikula@intel.com>
> Sent: Tuesday, September 26, 2023 4:26 PM
> To: Shankar, Uma <uma.shankar@intel.com>; intel-gfx@lists.freedesktop.org
> Cc: Shankar, Uma <uma.shankar@intel.com>
> Subject: Re: [v2] drm/i915/display: Add a wrapper function for vga decode setup
> 
> On Tue, 26 Sep 2023, Jani Nikula <jani.nikula@intel.com> wrote:
> > On Mon, 25 Sep 2023, Uma Shankar <uma.shankar@intel.com> wrote:
> >> Some of the VGA functionality is not needed by the proposed Intel Xe
> >> driver, while this will be utilized by i915.
> >> Adding a wrapper function for VGA decode setup.
> 
> I guess "wrapper function" is now a misnomer? There's no wrapping here?

Yeah, will re-phrase it.

Regards,
Uma Shankar

> >
> > So, this duplicates intel_vga_set_decode() without removing the old
> > one. Is that the intention?
> >
> > I guess the idea here is that xe doesn't build intel_gmch, so you can
> > add a nop version there?
> >
> > BR,
> > Jani.
> >
> >
> >
> >>
> >> v2: Addressed Jani Nikula's review comments.
> >>
> >> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> >> ---
> >>  drivers/gpu/drm/i915/display/intel_vga.c |  2 --
> >>  drivers/gpu/drm/i915/soc/intel_gmch.c    | 14 ++++++++++++++
> >>  drivers/gpu/drm/i915/soc/intel_gmch.h    |  2 ++
> >>  3 files changed, 16 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/i915/display/intel_vga.c
> >> b/drivers/gpu/drm/i915/display/intel_vga.c
> >> index 286a0bdd28c6..0f65ce115035 100644
> >> --- a/drivers/gpu/drm/i915/display/intel_vga.c
> >> +++ b/drivers/gpu/drm/i915/display/intel_vga.c
> >> @@ -3,11 +3,9 @@
> >>   * Copyright © 2019 Intel Corporation
> >>   */
> >>
> >> -#include <linux/pci.h>
> >>  #include <linux/vgaarb.h>
> >>
> >>  #include <video/vga.h>
> >> -
> >>  #include "soc/intel_gmch.h"
> >>
> >>  #include "i915_drv.h"
> >> diff --git a/drivers/gpu/drm/i915/soc/intel_gmch.c
> >> b/drivers/gpu/drm/i915/soc/intel_gmch.c
> >> index 49c7fb16e934..f32e9f78770a 100644
> >> --- a/drivers/gpu/drm/i915/soc/intel_gmch.c
> >> +++ b/drivers/gpu/drm/i915/soc/intel_gmch.c
> >> @@ -5,6 +5,7 @@
> >>
> >>  #include <linux/pci.h>
> >>  #include <linux/pnp.h>
> >> +#include <linux/vgaarb.h>
> >>
> >>  #include <drm/drm_managed.h>
> >>  #include <drm/i915_drm.h>
> >> @@ -167,3 +168,16 @@ int intel_gmch_vga_set_state(struct
> >> drm_i915_private *i915, bool enable_decode)
> >>
> >>  	return 0;
> >>  }
> >> +
> >> +unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool
> >> +enable_decode) {
> >> +	struct drm_i915_private *i915 = pdev_to_i915(pdev);
> >> +
> >> +	intel_gmch_vga_set_state(i915, enable_decode);
> >> +
> >> +	if (enable_decode)
> >> +		return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
> >> +		       VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
> >> +	else
> >> +		return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM; }
> >> diff --git a/drivers/gpu/drm/i915/soc/intel_gmch.h
> >> b/drivers/gpu/drm/i915/soc/intel_gmch.h
> >> index d0133eedc720..23be2d113afd 100644
> >> --- a/drivers/gpu/drm/i915/soc/intel_gmch.h
> >> +++ b/drivers/gpu/drm/i915/soc/intel_gmch.h
> >> @@ -8,11 +8,13 @@
> >>
> >>  #include <linux/types.h>
> >>
> >> +struct pci_dev;
> >>  struct drm_i915_private;
> >>
> >>  int intel_gmch_bridge_setup(struct drm_i915_private *i915);  void
> >> intel_gmch_bar_setup(struct drm_i915_private *i915);  void
> >> intel_gmch_bar_teardown(struct drm_i915_private *i915);  int
> >> intel_gmch_vga_set_state(struct drm_i915_private *i915, bool
> >> enable_decode);
> >> +unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool
> >> +enable_decode);
> >>
> >>  #endif /* __INTEL_GMCH_H__ */
> 
> --
> Jani Nikula, Intel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_vga.c b/drivers/gpu/drm/i915/display/intel_vga.c
index 286a0bdd28c6..0f65ce115035 100644
--- a/drivers/gpu/drm/i915/display/intel_vga.c
+++ b/drivers/gpu/drm/i915/display/intel_vga.c
@@ -3,11 +3,9 @@ 
  * Copyright © 2019 Intel Corporation
  */
 
-#include <linux/pci.h>
 #include <linux/vgaarb.h>
 
 #include <video/vga.h>
-
 #include "soc/intel_gmch.h"
 
 #include "i915_drv.h"
diff --git a/drivers/gpu/drm/i915/soc/intel_gmch.c b/drivers/gpu/drm/i915/soc/intel_gmch.c
index 49c7fb16e934..f32e9f78770a 100644
--- a/drivers/gpu/drm/i915/soc/intel_gmch.c
+++ b/drivers/gpu/drm/i915/soc/intel_gmch.c
@@ -5,6 +5,7 @@ 
 
 #include <linux/pci.h>
 #include <linux/pnp.h>
+#include <linux/vgaarb.h>
 
 #include <drm/drm_managed.h>
 #include <drm/i915_drm.h>
@@ -167,3 +168,16 @@  int intel_gmch_vga_set_state(struct drm_i915_private *i915, bool enable_decode)
 
 	return 0;
 }
+
+unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool enable_decode)
+{
+	struct drm_i915_private *i915 = pdev_to_i915(pdev);
+
+	intel_gmch_vga_set_state(i915, enable_decode);
+
+	if (enable_decode)
+		return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
+		       VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
+	else
+		return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
+}
diff --git a/drivers/gpu/drm/i915/soc/intel_gmch.h b/drivers/gpu/drm/i915/soc/intel_gmch.h
index d0133eedc720..23be2d113afd 100644
--- a/drivers/gpu/drm/i915/soc/intel_gmch.h
+++ b/drivers/gpu/drm/i915/soc/intel_gmch.h
@@ -8,11 +8,13 @@ 
 
 #include <linux/types.h>
 
+struct pci_dev;
 struct drm_i915_private;
 
 int intel_gmch_bridge_setup(struct drm_i915_private *i915);
 void intel_gmch_bar_setup(struct drm_i915_private *i915);
 void intel_gmch_bar_teardown(struct drm_i915_private *i915);
 int intel_gmch_vga_set_state(struct drm_i915_private *i915, bool enable_decode);
+unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool enable_decode);
 
 #endif /* __INTEL_GMCH_H__ */