diff mbox

[v4,5/6] drm/i915: use new drm_kick_out_firmware()

Message ID 1378042612-5354-6-git-send-email-dh.herrmann@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

David Herrmann Sept. 1, 2013, 1:36 p.m. UTC
Use the new DRM infrastructure to kick out firmware DRM drivers before
loading i915.

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
---
 drivers/gpu/drm/i915/i915_dma.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Daniel Vetter Sept. 2, 2013, 7:43 a.m. UTC | #1
On Sun, Sep 01, 2013 at 03:36:51PM +0200, David Herrmann wrote:
> Use the new DRM infrastructure to kick out firmware DRM drivers before
> loading i915.
> 
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
> ---
>  drivers/gpu/drm/i915/i915_dma.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index 3e4e607..9d375a6 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -1414,9 +1414,9 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
>  	primary =
>  		pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
>  
> -	remove_conflicting_framebuffers(ap, "inteldrmfb", primary);
> -
> -	kfree(ap);
> +	drm_kick_out_firmware(ap, primary);
> +	dev_priv->dev->apertures = ap;
> +	dev_priv->dev->apert_boot = primary;

What about passing dev to drm_kick_out_firmware and shovelling these two
assignments in there? I've check your nouveau/radeon patches and I think
this would work ...
-Daniel
David Herrmann Sept. 2, 2013, 12:02 p.m. UTC | #2
Hi

On Mon, Sep 2, 2013 at 9:43 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Sun, Sep 01, 2013 at 03:36:51PM +0200, David Herrmann wrote:
>> Use the new DRM infrastructure to kick out firmware DRM drivers before
>> loading i915.
>>
>> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
>> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
>> ---
>>  drivers/gpu/drm/i915/i915_dma.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
>> index 3e4e607..9d375a6 100644
>> --- a/drivers/gpu/drm/i915/i915_dma.c
>> +++ b/drivers/gpu/drm/i915/i915_dma.c
>> @@ -1414,9 +1414,9 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
>>       primary =
>>               pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
>>
>> -     remove_conflicting_framebuffers(ap, "inteldrmfb", primary);
>> -
>> -     kfree(ap);
>> +     drm_kick_out_firmware(ap, primary);
>> +     dev_priv->dev->apertures = ap;
>> +     dev_priv->dev->apert_boot = primary;
>
> What about passing dev to drm_kick_out_firmware and shovelling these two
> assignments in there? I've check your nouveau/radeon patches and I think
> this would work ...

Yepp, that sounds reasonable. And I guess the kfree() of apertures can
also be done in drm_put_dev(). Maybe we can even to the whole stuff in
drm_pci.c, I will have a look.

Thanks
David
Daniel Vetter Sept. 2, 2013, 2:26 p.m. UTC | #3
On Mon, Sep 02, 2013 at 02:02:06PM +0200, David Herrmann wrote:
> Hi
> 
> On Mon, Sep 2, 2013 at 9:43 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> > On Sun, Sep 01, 2013 at 03:36:51PM +0200, David Herrmann wrote:
> >> Use the new DRM infrastructure to kick out firmware DRM drivers before
> >> loading i915.
> >>
> >> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> >> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
> >> ---
> >>  drivers/gpu/drm/i915/i915_dma.c | 6 +++---
> >>  1 file changed, 3 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> >> index 3e4e607..9d375a6 100644
> >> --- a/drivers/gpu/drm/i915/i915_dma.c
> >> +++ b/drivers/gpu/drm/i915/i915_dma.c
> >> @@ -1414,9 +1414,9 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
> >>       primary =
> >>               pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
> >>
> >> -     remove_conflicting_framebuffers(ap, "inteldrmfb", primary);
> >> -
> >> -     kfree(ap);
> >> +     drm_kick_out_firmware(ap, primary);
> >> +     dev_priv->dev->apertures = ap;
> >> +     dev_priv->dev->apert_boot = primary;
> >
> > What about passing dev to drm_kick_out_firmware and shovelling these two
> > assignments in there? I've check your nouveau/radeon patches and I think
> > this would work ...
> 
> Yepp, that sounds reasonable. And I guess the kfree() of apertures can
> also be done in drm_put_dev(). Maybe we can even to the whole stuff in
> drm_pci.c, I will have a look.

I like the helper approach used here since it allows drivers to pick an
appropriate spot. Moving it into drm_pci.c could be a bit ugly. Aside: I'm
pondering ideas to weed out the midlayer smell from the drm device init
sequence. I've played around with a few things and it looks like we're
really close to doing the Right Thing ;-)

Cheers, Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 3e4e607..9d375a6 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1414,9 +1414,9 @@  static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
 	primary =
 		pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
 
-	remove_conflicting_framebuffers(ap, "inteldrmfb", primary);
-
-	kfree(ap);
+	drm_kick_out_firmware(ap, primary);
+	dev_priv->dev->apertures = ap;
+	dev_priv->dev->apert_boot = primary;
 }
 
 static void i915_dump_device_info(struct drm_i915_private *dev_priv)