[PATCH 3/8] intel-gtt: Return whether we have local memory or not

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux