From: Ben Widawsky <ben@bwidawsk.net>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH] drm/i915: kick any firmware framebuffers before claiming the gtt
Date: Mon, 11 Jun 2012 16:43:15 -0700 [thread overview]
Message-ID: <20120611164315.529edb0b@bwidawsk.net> (raw)
In-Reply-To: <1339432092-30126-1-git-send-email-daniel.vetter@ffwll.ch>
We could probably fix this with a kernel command line too:
video=vesafb:mtrr:3
On Mon, 11 Jun 2012 18:28:12 +0200
Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Especially vesafb likes to map everything as uc- (yikes), and if that
> mapping hangs around still while we try to map the gtt as wc the
> kernel will downgrade our request to uc-, resulting in abyssal
> performance.
Probably every graphics device running on x86 wants this, should
we consider trying to generalize it a bit more with a DRM helper? At
the very least, I think we should consider some Kconfig changes
(comments, excluding vesafb when i915 is selected, or something).
Just to satisfy my curiousity if vesafb is loaded after, we'll run into
the same problem (like GPU offloading with vesa display)?
s/abyssal/abysmal
>
> Unfortunately we can't do this as early as readon does (i.e. as the
> first thing we do when initializing the hw) because our fb/mmio space
> region moves around on a per-gen basis. So I've had to move it below
> the gtt initialization, but that seems to work, too. The important
> thing is that we do this before we set up the gtt wc mapping.
>
> Now an altogether different question is why people compile their
> kernels with vesafb enabled, but I guess making things just work isn't
> bad per se ...
The kernel comments recommend turning it on if unsure. As above, I
think that should be corrected.
>
> v2:
> - s/radeondrmfb/inteldrmfb/
> - fix up error handling
>
> Reported-and-tested-by: "Kilarski, Bernard R" <bernard.r.kilarski@intel.com>
> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
still, a couple comments below
> ---
> drivers/gpu/drm/i915/i915_dma.c | 35 ++++++++++++++++++++++++++++-------
> 1 file changed, 28 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index 262a74d..379cb14 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -1401,6 +1401,25 @@ i915_mtrr_setup(struct drm_i915_private *dev_priv, unsigned long base,
> }
> }
>
> +static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
> +{
> + struct apertures_struct *ap;
> + struct pci_dev *pdev = dev_priv->dev->pdev;
> + bool primary = false;
> +
> + ap = alloc_apertures(1);
> + ap->ranges[0].base = dev_priv->dev->agp->base;
> + ap->ranges[0].size =
> + dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT;
> +
> +#ifdef CONFIG_X86
> + primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
> +#endif
I don't really understand the point of this bit, but I guess other
drivers do it, so meh. Also, the ifdef CONFIG_X86 is sort of pointless
in the i915 driver, but no biggie.
> +
> + remove_conflicting_framebuffers(ap, "inteldrmfb", primary);
> + kfree(ap);
> +}
> +
> /**
> * i915_driver_load - setup chip and create an initial config
> * @dev: DRM device
> @@ -1446,6 +1465,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
> goto free_priv;
> }
>
> + dev_priv->mm.gtt = intel_gtt_get();
> + if (!dev_priv->mm.gtt) {
> + DRM_ERROR("Failed to initialize GTT\n");
> + ret = -ENODEV;
> + goto put_bridge;
> + }
> +
> + i915_kick_out_firmware_fb(dev_priv);
> +
> pci_set_master(dev->pdev);
>
> /* overlay on gen2 is broken and can't address above 1G */
> @@ -1471,13 +1499,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
> goto put_bridge;
> }
>
> - dev_priv->mm.gtt = intel_gtt_get();
> - if (!dev_priv->mm.gtt) {
> - DRM_ERROR("Failed to initialize GTT\n");
> - ret = -ENODEV;
> - goto out_rmmap;
> - }
> -
> aperture_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT;
>
> dev_priv->mm.gtt_mapping =
--
Ben Widawsky, Intel Open Source Technology Center
next prev parent reply other threads:[~2012-06-11 23:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-11 15:07 [PATCH] drm/i915: kick any firmware framebuffers before claiming the gtt Daniel Vetter
2012-06-11 15:35 ` Ville Syrjälä
2012-06-11 16:13 ` Daniel Vetter
2012-06-11 16:28 ` Daniel Vetter
2012-06-11 23:43 ` Ben Widawsky [this message]
2012-06-12 8:12 ` Daniel Vetter
2012-06-12 8:24 ` Daniel Vetter
2012-06-12 8:43 ` Daniel Vetter
2012-06-12 9:28 ` Daniel Vetter
2012-06-12 11:43 ` Singh, Satyeshwar
2012-06-12 11:58 ` Chris Wilson
2012-06-12 12:16 ` Daniel Vetter
2012-06-13 11:30 ` Daniel Vetter
2012-06-12 8:52 ` Chris Wilson
2012-06-11 15:58 ` Jani Nikula
-- strict thread matches above, loose matches on Subject: below --
2012-07-01 15:09 Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120611164315.529edb0b@bwidawsk.net \
--to=ben@bwidawsk.net \
--cc=daniel.vetter@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox