From: ville.syrjala@linux.intel.com
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 3/8] intel-gtt: Return whether we have local memory or not
Date: Thu, 28 Nov 2013 17:15:05 +0200 [thread overview]
Message-ID: <1385651710-7768-4-git-send-email-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <1385651710-7768-1-git-send-email-ville.syrjala@linux.intel.com>
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/char/agp/intel-gtt.c | 16 ++++++++++------
drivers/gpu/drm/i915/i915_gem_gtt.c | 3 ++-
include/drm/intel-gtt.h | 3 ++-
3 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index 078968d..99ff699 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -68,6 +68,7 @@ static struct _intel_private {
u32 PGETBL_save;
u32 __iomem *gtt; /* I915G */
bool clear_fake_agp; /* on first access via agp, fill with scratch */
+ bool has_local_memory;
int num_dcache_entries;
void __iomem *i9xx_flush_page;
char *i81x_gtt_table;
@@ -345,14 +346,15 @@ static const struct aper_size_info_fixed intel_fake_agp_sizes[] = {
{512, 131072, 7},
};
-static unsigned int intel_gtt_stolen_size(void)
+static unsigned int intel_gtt_stolen_size(bool *has_local_memory)
{
u16 gmch_ctrl;
u8 rdct;
- int local = 0;
static const int ddt[4] = { 0, 16, 32, 64 };
unsigned int stolen_size = 0;
+ *has_local_memory = false;
+
if (INTEL_GTT_GEN == 1)
return 0; /* no stolen mem on i81x */
@@ -375,7 +377,7 @@ static unsigned int intel_gtt_stolen_size(void)
rdct = readb(intel_private.registers+I830_RDRAM_CHANNEL_TYPE);
stolen_size = (I830_RDRAM_ND(rdct) + 1) *
MB(ddt[I830_RDRAM_DDT(rdct)]);
- local = 1;
+ *has_local_memory = true;
break;
default:
stolen_size = 0;
@@ -430,7 +432,7 @@ static unsigned int intel_gtt_stolen_size(void)
if (stolen_size > 0) {
dev_info(&intel_private.bridge_dev->dev, "detected %dK %s memory\n",
- stolen_size / KB(1), local ? "local" : "stolen");
+ stolen_size / KB(1), *has_local_memory ? "local" : "stolen");
} else {
dev_info(&intel_private.bridge_dev->dev,
"no pre-allocated video memory detected\n");
@@ -655,7 +657,7 @@ static int intel_gtt_init(void)
global_cache_flush(); /* FIXME: ? */
#endif
- intel_private.stolen_size = intel_gtt_stolen_size();
+ intel_private.stolen_size = intel_gtt_stolen_size(&intel_private.has_local_memory);
intel_private.needs_dmar = USE_PCI_DMA_API && INTEL_GTT_GEN > 2;
@@ -1423,12 +1425,14 @@ int intel_gmch_probe(struct pci_dev *bridge_pdev, struct pci_dev *gpu_pdev,
EXPORT_SYMBOL(intel_gmch_probe);
void intel_gtt_get(size_t *gtt_total, size_t *stolen_size,
- phys_addr_t *mappable_base, unsigned long *mappable_end)
+ phys_addr_t *mappable_base, unsigned long *mappable_end,
+ bool *has_local_memory)
{
*gtt_total = intel_private.gtt_total_entries << PAGE_SHIFT;
*stolen_size = intel_private.stolen_size;
*mappable_base = intel_private.gma_bus_addr;
*mappable_end = intel_private.gtt_mappable_entries << PAGE_SHIFT;
+ *has_local_memory = intel_private.has_local_memory;
}
EXPORT_SYMBOL(intel_gtt_get);
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index a54eaab..70b148c 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1426,6 +1426,7 @@ static int i915_gmch_probe(struct drm_device *dev,
unsigned long *mappable_end)
{
struct drm_i915_private *dev_priv = dev->dev_private;
+ bool has_local_memory;
int ret;
ret = intel_gmch_probe(dev_priv->bridge_dev, dev_priv->dev->pdev, NULL);
@@ -1434,7 +1435,7 @@ static int i915_gmch_probe(struct drm_device *dev,
return -EIO;
}
- intel_gtt_get(gtt_total, stolen, mappable_base, mappable_end);
+ intel_gtt_get(gtt_total, stolen, mappable_base, mappable_end, &has_local_memory);
dev_priv->gtt.do_idle_maps = needs_idle_maps(dev_priv->dev);
dev_priv->gtt.base.clear_range = i915_ggtt_clear_range;
diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h
index b08bdad..827fe29 100644
--- a/include/drm/intel-gtt.h
+++ b/include/drm/intel-gtt.h
@@ -4,7 +4,8 @@
#define _DRM_INTEL_GTT_H
void intel_gtt_get(size_t *gtt_total, size_t *stolen_size,
- phys_addr_t *mappable_base, unsigned long *mappable_end);
+ phys_addr_t *mappable_base, unsigned long *mappable_end,
+ bool *has_local_memory);
int intel_gmch_probe(struct pci_dev *bridge_pdev, struct pci_dev *gpu_pdev,
struct agp_bridge_data *bridge);
--
1.8.3.2
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2013-11-28 15:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-28 15:15 [PATCH 0/8] Gen2 stolen/local memory support ville.syrjala
2013-11-28 15:15 ` [PATCH 1/8] x86: Add vfunc for Intel graphics stolen memory base address ville.syrjala
2013-11-28 15:15 ` [PATCH 2/8] x86: Add Intel graphics stolen memory quirk for gen2 platforms ville.syrjala
2013-11-30 12:58 ` Ingo Molnar
2013-11-28 15:15 ` ville.syrjala [this message]
2013-11-28 15:15 ` [PATCH 4/8] intel-gtt: Assume last 128KB of stolen contains the GTT entries on gen2 ville.syrjala
2013-11-28 15:15 ` [PATCH 5/8] intel-gtt: Use i810_write_entry() on gen2 platforms ville.syrjala
2013-11-28 15:15 ` [PATCH 6/8] drm/i915: Add I915_CACHE_LOCAL to indicate local memory ville.syrjala
2013-11-28 15:15 ` [PATCH 7/8] drm/i915: Keep track if we have " ville.syrjala
2013-11-28 15:15 ` [PATCH 8/8] drm/i915: Determine the stolen memory base address on gen2 ville.syrjala
2013-11-28 16:32 ` Chris Wilson
2013-11-28 18:01 ` Ville Syrjälä
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=1385651710-7768-4-git-send-email-ville.syrjala@linux.intel.com \
--to=ville.syrjala@linux.intel.com \
--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