* [PATCH 00/15] The "no more agp" series
@ 2010-11-06 14:21 Daniel Vetter
2010-11-06 14:21 ` [PATCH 01/15] intel-gtt: drop dcache support for i830 and later Daniel Vetter
` (14 more replies)
0 siblings, 15 replies; 19+ messages in thread
From: Daniel Vetter @ 2010-11-06 14:21 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Vetter
Hi all,
The first few patches are a bunch of leftover cleanups from the intel-gtt
rewrite in .36.
Tested on my i815, i855, i945 and ironlake.
Some items still on my todo-list for the gtt:
- Embed drm_mm_node.
- Kill /dev/agpgart for kms-only chips. Requires some small rework of the
init sequence.
- Fix i855 cache coherency. All these gtt optimizations only made things
worse :(
As usual, comments, flames, highly welcome. Wrt merging I think it'd be
easiest if this goes in via d-i-n completely.
Yours, Daniel
Daniel Vetter (15):
intel-gtt: drop dcache support for i830 and later
intel-gtt: kill unneeded sandybridge memory types
intel-gtt: switch i81x to the write_entry helpers
intel-gtt: switch i81x to the common initialization helpers
intel-gtt: fold i81x-only dcache support into the generic driver
drm/i915|intel-gtt: consolidate intel-gtt.h headers
drm/i915/gtt: call chipset flush directly
drm: kill drm_agp_chipset_flush
agp: kill agp_flush_chipset and corresponding ioctl
drm/i915: track objects in the gtt
drm/i915: restore gtt on resume in the drm instead of in intel-gtt.ko
agp: kill agp_rebind_memory
drm/i915: move gtt handling to i915_gem_gtt.c
intel-gtt: export api for drm/i915
drm/i915: no more agp for gem
drivers/char/agp/agp.h | 1 -
drivers/char/agp/compat_ioctl.c | 1 -
drivers/char/agp/compat_ioctl.h | 1 -
drivers/char/agp/frontend.c | 8 -
drivers/char/agp/generic.c | 27 --
drivers/char/agp/intel-agp.c | 5 -
drivers/char/agp/intel-gtt.c | 569 ++++++++++++++---------------------
drivers/gpu/drm/drm_agpsupport.c | 6 -
drivers/gpu/drm/i915/Makefile | 1 +
drivers/gpu/drm/i915/i915_drv.c | 1 +
drivers/gpu/drm/i915/i915_drv.h | 18 +-
drivers/gpu/drm/i915/i915_gem.c | 28 +-
drivers/gpu/drm/i915/i915_gem_gtt.c | 102 +++++++
include/drm/drmP.h | 1 -
include/drm/intel-gtt.h | 24 ++
include/linux/agp_backend.h | 2 -
include/linux/intel-gtt.h | 20 --
17 files changed, 381 insertions(+), 434 deletions(-)
create mode 100644 drivers/gpu/drm/i915/i915_gem_gtt.c
delete mode 100644 include/linux/intel-gtt.h
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 01/15] intel-gtt: drop dcache support for i830 and later
2010-11-06 14:21 [PATCH 00/15] The "no more agp" series Daniel Vetter
@ 2010-11-06 14:21 ` Daniel Vetter
2010-11-06 14:21 ` [PATCH 02/15] intel-gtt: kill unneeded sandybridge memory types Daniel Vetter
` (13 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Daniel Vetter @ 2010-11-06 14:21 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Vetter
i830_check_flags already disallows it, so no need to implement it
in the write_entry function. Seems to be a remnant from i810 support.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/char/agp/intel-gtt.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index fc1637c..8122aca 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -915,14 +915,8 @@ static void i830_write_entry(dma_addr_t addr, unsigned int entry,
{
u32 pte_flags = I810_PTE_VALID;
- switch (flags) {
- case AGP_DCACHE_MEMORY:
- pte_flags |= I810_PTE_LOCAL;
- break;
- case AGP_USER_CACHED_MEMORY:
+ if (flags == AGP_USER_CACHED_MEMORY)
pte_flags |= I830_PTE_SYSTEM_CACHED;
- break;
- }
writel(addr | pte_flags, intel_private.gtt + entry);
}
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 02/15] intel-gtt: kill unneeded sandybridge memory types
2010-11-06 14:21 [PATCH 00/15] The "no more agp" series Daniel Vetter
2010-11-06 14:21 ` [PATCH 01/15] intel-gtt: drop dcache support for i830 and later Daniel Vetter
@ 2010-11-06 14:21 ` Daniel Vetter
2010-11-06 14:21 ` [PATCH 03/15] intel-gtt: switch i81x to the write_entry helpers Daniel Vetter
` (12 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Daniel Vetter @ 2010-11-06 14:21 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Vetter
Used for the now dead agp type_to_mask stuff.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/char/agp/intel-gtt.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index 8122aca..b677713 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -62,12 +62,6 @@ static struct gatt_mask intel_i810_masks[] =
.type = INTEL_AGP_CACHED_MEMORY}
};
-#define INTEL_AGP_UNCACHED_MEMORY 0
-#define INTEL_AGP_CACHED_MEMORY_LLC 1
-#define INTEL_AGP_CACHED_MEMORY_LLC_GFDT 2
-#define INTEL_AGP_CACHED_MEMORY_LLC_MLC 3
-#define INTEL_AGP_CACHED_MEMORY_LLC_MLC_GFDT 4
-
struct intel_gtt_driver {
unsigned int gen : 8;
unsigned int is_g33 : 1;
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 03/15] intel-gtt: switch i81x to the write_entry helpers
2010-11-06 14:21 [PATCH 00/15] The "no more agp" series Daniel Vetter
2010-11-06 14:21 ` [PATCH 01/15] intel-gtt: drop dcache support for i830 and later Daniel Vetter
2010-11-06 14:21 ` [PATCH 02/15] intel-gtt: kill unneeded sandybridge memory types Daniel Vetter
@ 2010-11-06 14:21 ` Daniel Vetter
2010-11-06 14:21 ` [PATCH 04/15] intel-gtt: switch i81x to the common initialization helpers Daniel Vetter
` (11 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Daniel Vetter @ 2010-11-06 14:21 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Vetter
Initialization is still done with the old code with a few
added things sprinkled in to make the intel_fake_agp helper
functions work.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/char/agp/intel-gtt.c | 152 +++++++++++++++++-------------------------
1 files changed, 60 insertions(+), 92 deletions(-)
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index b677713..c0b4ae7 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -104,6 +104,9 @@ static struct _intel_private {
dma_addr_t scratch_page_dma;
} intel_private;
+static int intel_fake_agp_insert_entries(struct agp_memory *mem,
+ off_t pg_start, int type);
+
#define INTEL_GTT_GEN intel_private.driver->gen
#define IS_G33 intel_private.driver->is_g33
#define IS_PINEVIEW intel_private.driver->is_pineview
@@ -179,10 +182,12 @@ static int intel_i810_fetch_size(void)
if ((smram_miscc & I810_GFX_MEM_WIN_SIZE) == I810_GFX_MEM_WIN_32M) {
agp_bridge->current_size = (void *) (values + 1);
agp_bridge->aperture_size_idx = 1;
+ intel_private.base.gtt_total_entries = KB(32) / 4;
return values[1].size;
} else {
agp_bridge->current_size = (void *) (values);
agp_bridge->aperture_size_idx = 0;
+ intel_private.base.gtt_total_entries = KB(64) / 4;
return values[0].size;
}
@@ -209,6 +214,9 @@ static int intel_i810_configure(void)
}
}
+ intel_private.gtt = intel_private.registers + I810_PTE_BASE;
+ intel_private.scratch_page_dma = agp_bridge->scratch_page & PAGE_MASK;
+
if ((readl(intel_private.registers+I810_DRAM_CTL)
& I810_DRAM_ROW_0) == I810_DRAM_ROW_0_SDRAM) {
/* This will need to be dynamically assigned */
@@ -276,79 +284,27 @@ static void i8xx_destroy_pages(struct page *page)
static int intel_i810_insert_entries(struct agp_memory *mem, off_t pg_start,
int type)
{
- int i, j, num_entries;
- void *temp;
- int ret = -EINVAL;
- int mask_type;
-
- if (mem->page_count == 0)
- goto out;
-
- temp = agp_bridge->current_size;
- num_entries = A_SIZE_FIX(temp)->num_entries;
-
- if ((pg_start + mem->page_count) > num_entries)
- goto out_err;
-
-
- for (j = pg_start; j < (pg_start + mem->page_count); j++) {
- if (!PGE_EMPTY(agp_bridge, readl(agp_bridge->gatt_table+j))) {
- ret = -EBUSY;
- goto out_err;
- }
- }
-
- if (type != mem->type)
- goto out_err;
+ int i;
- mask_type = agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type);
+ if (type == AGP_DCACHE_MEMORY) {
+ if ((pg_start + mem->page_count)
+ > intel_private.num_dcache_entries)
+ return -EINVAL;
- switch (mask_type) {
- case AGP_DCACHE_MEMORY:
if (!mem->is_flushed)
global_cache_flush();
+
for (i = pg_start; i < (pg_start + mem->page_count); i++) {
- writel((i*4096)|I810_PTE_LOCAL|I810_PTE_VALID,
- intel_private.registers+I810_PTE_BASE+(i*4));
- }
- readl(intel_private.registers+I810_PTE_BASE+((i-1)*4));
- break;
- case AGP_PHYS_MEMORY:
- case AGP_NORMAL_MEMORY:
- if (!mem->is_flushed)
- global_cache_flush();
- for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
- writel(agp_bridge->driver->mask_memory(agp_bridge,
- page_to_phys(mem->pages[i]), mask_type),
- intel_private.registers+I810_PTE_BASE+(j*4));
+ dma_addr_t addr = i << PAGE_SHIFT;
+ intel_private.driver->write_entry(addr,
+ i, type);
}
- readl(intel_private.registers+I810_PTE_BASE+((j-1)*4));
- break;
- default:
- goto out_err;
- }
-
-out:
- ret = 0;
-out_err:
- mem->is_flushed = true;
- return ret;
-}
+ readl(intel_private.gtt+i-1);
-static int intel_i810_remove_entries(struct agp_memory *mem, off_t pg_start,
- int type)
-{
- int i;
-
- if (mem->page_count == 0)
return 0;
-
- for (i = pg_start; i < (mem->page_count + pg_start); i++) {
- writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4));
}
- readl(intel_private.registers+I810_PTE_BASE+((i-1)*4));
- return 0;
+ return intel_fake_agp_insert_entries(mem, pg_start, type);
}
/*
@@ -393,29 +349,6 @@ static struct agp_memory *alloc_agpphysmem_i8xx(size_t pg_count, int type)
return new;
}
-static struct agp_memory *intel_i810_alloc_by_type(size_t pg_count, int type)
-{
- struct agp_memory *new;
-
- if (type == AGP_DCACHE_MEMORY) {
- if (pg_count != intel_private.num_dcache_entries)
- return NULL;
-
- new = agp_create_memory(1);
- if (new == NULL)
- return NULL;
-
- new->type = AGP_DCACHE_MEMORY;
- new->page_count = pg_count;
- new->num_scratch_pages = 0;
- agp_free_page_array(new);
- return new;
- }
- if (type == AGP_PHYS_MEMORY)
- return alloc_agpphysmem_i8xx(pg_count, type);
- return NULL;
-}
-
static void intel_i810_free_by_type(struct agp_memory *curr)
{
agp_free_key(curr->key);
@@ -466,6 +399,23 @@ static int intel_gtt_setup_scratch_page(void)
return 0;
}
+static void i810_write_entry(dma_addr_t addr, unsigned int entry,
+ unsigned int flags)
+{
+ u32 pte_flags = I810_PTE_VALID;
+
+ switch (flags) {
+ case AGP_DCACHE_MEMORY:
+ pte_flags |= I810_PTE_LOCAL;
+ break;
+ case AGP_USER_CACHED_MEMORY:
+ pte_flags |= I830_PTE_SYSTEM_CACHED;
+ break;
+ }
+
+ writel(addr | pte_flags, intel_private.gtt + entry);
+}
+
static const struct aper_size_info_fixed const intel_fake_agp_sizes[] = {
{128, 32768, 5},
/* The 64M mode still requires a 128k gatt */
@@ -779,7 +729,7 @@ static void intel_gtt_cleanup(void)
iounmap(intel_private.gtt);
iounmap(intel_private.registers);
-
+
intel_gtt_teardown_scratch_page();
}
@@ -908,7 +858,7 @@ static void i830_write_entry(dma_addr_t addr, unsigned int entry,
unsigned int flags)
{
u32 pte_flags = I810_PTE_VALID;
-
+
if (flags == AGP_USER_CACHED_MEMORY)
pte_flags |= I830_PTE_SYSTEM_CACHED;
@@ -1142,6 +1092,22 @@ static void intel_fake_agp_chipset_flush(struct agp_bridge_data *bridge)
static struct agp_memory *intel_fake_agp_alloc_by_type(size_t pg_count,
int type)
{
+ struct agp_memory *new;
+
+ if (type == AGP_DCACHE_MEMORY && INTEL_GTT_GEN == 1) {
+ if (pg_count != intel_private.num_dcache_entries)
+ return NULL;
+
+ new = agp_create_memory(1);
+ if (new == NULL)
+ return NULL;
+
+ new->type = AGP_DCACHE_MEMORY;
+ new->page_count = pg_count;
+ new->num_scratch_pages = 0;
+ agp_free_page_array(new);
+ return new;
+ }
if (type == AGP_PHYS_MEMORY)
return alloc_agpphysmem_i8xx(pg_count, type);
/* always return NULL for other allocation types for now */
@@ -1352,8 +1318,8 @@ static const struct agp_bridge_driver intel_810_driver = {
.create_gatt_table = agp_generic_create_gatt_table,
.free_gatt_table = agp_generic_free_gatt_table,
.insert_memory = intel_i810_insert_entries,
- .remove_memory = intel_i810_remove_entries,
- .alloc_by_type = intel_i810_alloc_by_type,
+ .remove_memory = intel_fake_agp_remove_entries,
+ .alloc_by_type = intel_fake_agp_alloc_by_type,
.free_by_type = intel_i810_free_by_type,
.agp_alloc_page = agp_generic_alloc_page,
.agp_alloc_pages = agp_generic_alloc_pages,
@@ -1388,6 +1354,8 @@ static const struct agp_bridge_driver intel_fake_agp_driver = {
static const struct intel_gtt_driver i81x_gtt_driver = {
.gen = 1,
.dma_mask_size = 32,
+ .check_flags = i830_check_flags,
+ .write_entry = i810_write_entry,
};
static const struct intel_gtt_driver i8xx_gtt_driver = {
.gen = 2,
@@ -1405,7 +1373,7 @@ static const struct intel_gtt_driver i915_gtt_driver = {
.setup = i9xx_setup,
.cleanup = i9xx_cleanup,
/* i945 is the last gpu to need phys mem (for overlay and cursors). */
- .write_entry = i830_write_entry,
+ .write_entry = i830_write_entry,
.dma_mask_size = 32,
.check_flags = i830_check_flags,
.chipset_flush = i9xx_chipset_flush,
@@ -1593,7 +1561,7 @@ int intel_gmch_probe(struct pci_dev *pdev,
if (find_gmch(intel_gtt_chipsets[i].gmch_chip_id)) {
bridge->driver =
intel_gtt_chipsets[i].gmch_driver;
- intel_private.driver =
+ intel_private.driver =
intel_gtt_chipsets[i].gtt_driver;
break;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 04/15] intel-gtt: switch i81x to the common initialization helpers
2010-11-06 14:21 [PATCH 00/15] The "no more agp" series Daniel Vetter
` (2 preceding siblings ...)
2010-11-06 14:21 ` [PATCH 03/15] intel-gtt: switch i81x to the write_entry helpers Daniel Vetter
@ 2010-11-06 14:21 ` Daniel Vetter
2010-11-06 14:21 ` [PATCH 05/15] intel-gtt: fold i81x-only dcache support into the generic driver Daniel Vetter
` (10 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Daniel Vetter @ 2010-11-06 14:21 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Vetter
Still a separate agp_bridge_driver because of the i81x-only
dedicated vram support.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/char/agp/intel-gtt.c | 197 +++++++++++++++---------------------------
1 files changed, 71 insertions(+), 126 deletions(-)
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index c0b4ae7..8fff75a 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -42,26 +42,10 @@
/* Max amount of stolen space, anything above will be returned to Linux */
int intel_max_stolen = 32 * 1024 * 1024;
-static const struct aper_size_info_fixed intel_i810_sizes[] =
-{
- {64, 16384, 4},
- /* The 32M mode still requires a 64k gatt */
- {32, 8192, 4}
-};
-
#define AGP_DCACHE_MEMORY 1
#define AGP_PHYS_MEMORY 2
#define INTEL_AGP_CACHED_MEMORY 3
-static struct gatt_mask intel_i810_masks[] =
-{
- {.mask = I810_PTE_VALID, .type = 0},
- {.mask = (I810_PTE_VALID | I810_PTE_LOCAL), .type = AGP_DCACHE_MEMORY},
- {.mask = I810_PTE_VALID, .type = 0},
- {.mask = I810_PTE_VALID | I830_PTE_SYSTEM_CACHED,
- .type = INTEL_AGP_CACHED_MEMORY}
-};
-
struct intel_gtt_driver {
unsigned int gen : 8;
unsigned int is_g33 : 1;
@@ -97,6 +81,7 @@ static struct _intel_private {
void __iomem *i9xx_flush_page;
void *i8xx_flush_page;
};
+ char *i81x_gtt_table;
struct page *i8xx_page;
struct resource ifp_resource;
int resource_valid;
@@ -166,86 +151,6 @@ static void intel_agp_unmap_memory(struct agp_memory *mem)
intel_agp_free_sglist(mem);
}
-static int intel_i810_fetch_size(void)
-{
- u32 smram_miscc;
- struct aper_size_info_fixed *values;
-
- pci_read_config_dword(intel_private.bridge_dev,
- I810_SMRAM_MISCC, &smram_miscc);
- values = A_SIZE_FIX(agp_bridge->driver->aperture_sizes);
-
- if ((smram_miscc & I810_GMS) == I810_GMS_DISABLE) {
- dev_warn(&intel_private.bridge_dev->dev, "i810 is disabled\n");
- return 0;
- }
- if ((smram_miscc & I810_GFX_MEM_WIN_SIZE) == I810_GFX_MEM_WIN_32M) {
- agp_bridge->current_size = (void *) (values + 1);
- agp_bridge->aperture_size_idx = 1;
- intel_private.base.gtt_total_entries = KB(32) / 4;
- return values[1].size;
- } else {
- agp_bridge->current_size = (void *) (values);
- agp_bridge->aperture_size_idx = 0;
- intel_private.base.gtt_total_entries = KB(64) / 4;
- return values[0].size;
- }
-
- return 0;
-}
-
-static int intel_i810_configure(void)
-{
- struct aper_size_info_fixed *current_size;
- u32 temp;
- int i;
-
- current_size = A_SIZE_FIX(agp_bridge->current_size);
-
- if (!intel_private.registers) {
- pci_read_config_dword(intel_private.pcidev, I810_MMADDR, &temp);
- temp &= 0xfff80000;
-
- intel_private.registers = ioremap(temp, 128 * 4096);
- if (!intel_private.registers) {
- dev_err(&intel_private.pcidev->dev,
- "can't remap memory\n");
- return -ENOMEM;
- }
- }
-
- intel_private.gtt = intel_private.registers + I810_PTE_BASE;
- intel_private.scratch_page_dma = agp_bridge->scratch_page & PAGE_MASK;
-
- if ((readl(intel_private.registers+I810_DRAM_CTL)
- & I810_DRAM_ROW_0) == I810_DRAM_ROW_0_SDRAM) {
- /* This will need to be dynamically assigned */
- dev_info(&intel_private.pcidev->dev,
- "detected 4MB dedicated video ram\n");
- intel_private.num_dcache_entries = 1024;
- }
- pci_read_config_dword(intel_private.pcidev, I810_GMADDR, &temp);
- agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
- writel(agp_bridge->gatt_bus_addr | I810_PGETBL_ENABLED, intel_private.registers+I810_PGETBL_CTL);
- readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */
-
- if (agp_bridge->driver->needs_scratch_page) {
- for (i = 0; i < current_size->num_entries; i++) {
- writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4));
- }
- readl(intel_private.registers+I810_PTE_BASE+((i-1)*4)); /* PCI posting. */
- }
- global_cache_flush();
- return 0;
-}
-
-static void intel_i810_cleanup(void)
-{
- writel(0, intel_private.registers+I810_PGETBL_CTL);
- readl(intel_private.registers); /* PCI Posting. */
- iounmap(intel_private.registers);
-}
-
static void intel_fake_agp_enable(struct agp_bridge_data *bridge, u32 mode)
{
return;
@@ -281,6 +186,46 @@ static void i8xx_destroy_pages(struct page *page)
atomic_dec(&agp_bridge->current_memory_agp);
}
+#define I810_GTT_ORDER 4
+static int i810_setup(void)
+{
+ u32 reg_addr;
+ char *gtt_table;
+
+ /* i81x does not preallocate the gtt. It's always 64kb in size. */
+ gtt_table = alloc_gatt_pages(I810_GTT_ORDER);
+ if (gtt_table == NULL)
+ return -ENOMEM;
+ intel_private.i81x_gtt_table = gtt_table;
+
+ pci_read_config_dword(intel_private.pcidev, I810_MMADDR, ®_addr);
+ reg_addr &= 0xfff80000;
+
+ intel_private.registers = ioremap(reg_addr, KB(64));
+ if (!intel_private.registers)
+ return -ENOMEM;
+
+ writel(virt_to_phys(gtt_table) | I810_PGETBL_ENABLED,
+ intel_private.registers+I810_PGETBL_CTL);
+
+ intel_private.gtt_bus_addr = reg_addr + I810_PTE_BASE;
+
+ if ((readl(intel_private.registers+I810_DRAM_CTL)
+ & I810_DRAM_ROW_0) == I810_DRAM_ROW_0_SDRAM) {
+ dev_info(&intel_private.pcidev->dev,
+ "detected 4MB dedicated video ram\n");
+ intel_private.num_dcache_entries = 1024;
+ }
+
+ return 0;
+}
+
+static void i810_cleanup(void)
+{
+ writel(0, intel_private.registers+I810_PGETBL_CTL);
+ free_gatt_pages(intel_private.i81x_gtt_table, I810_GTT_ORDER);
+}
+
static int intel_i810_insert_entries(struct agp_memory *mem, off_t pg_start,
int type)
{
@@ -366,13 +311,6 @@ static void intel_i810_free_by_type(struct agp_memory *curr)
kfree(curr);
}
-static unsigned long intel_i810_mask_memory(struct agp_bridge_data *bridge,
- dma_addr_t addr, int type)
-{
- /* Type checking must be done elsewhere */
- return addr | bridge->driver->masks[type].mask;
-}
-
static int intel_gtt_setup_scratch_page(void)
{
struct page *page;
@@ -417,9 +355,9 @@ static void i810_write_entry(dma_addr_t addr, unsigned int entry,
}
static const struct aper_size_info_fixed const intel_fake_agp_sizes[] = {
+ {32, 8192, 3},
+ {64, 16384, 4},
{128, 32768, 5},
- /* The 64M mode still requires a 128k gatt */
- {64, 16384, 5},
{256, 65536, 6},
{512, 131072, 7},
};
@@ -433,6 +371,9 @@ static unsigned int intel_gtt_stolen_entries(void)
unsigned int overhead_entries, stolen_entries;
unsigned int stolen_size = 0;
+ if (INTEL_GTT_GEN == 1)
+ return 0; /* no stolen mem on i81x */
+
pci_read_config_word(intel_private.bridge_dev,
I830_GMCH_CTRL, &gmch_ctrl);
@@ -696,7 +637,18 @@ static unsigned int intel_gtt_mappable_entries(void)
{
unsigned int aperture_size;
- if (INTEL_GTT_GEN == 2) {
+ if (INTEL_GTT_GEN == 1) {
+ u32 smram_miscc;
+
+ pci_read_config_dword(intel_private.bridge_dev,
+ I810_SMRAM_MISCC, &smram_miscc);
+
+ if ((smram_miscc & I810_GFX_MEM_WIN_SIZE)
+ == I810_GFX_MEM_WIN_32M)
+ aperture_size = MB(32);
+ else
+ aperture_size = MB(64);
+ } else if (INTEL_GTT_GEN == 2) {
u16 gmch_ctrl;
pci_read_config_word(intel_private.bridge_dev,
@@ -772,12 +724,6 @@ static int intel_gtt_init(void)
/* we have to call this as early as possible after the MMIO base address is known */
intel_private.base.gtt_stolen_entries = intel_gtt_stolen_entries();
- if (intel_private.base.gtt_stolen_entries == 0) {
- intel_private.driver->cleanup();
- iounmap(intel_private.registers);
- iounmap(intel_private.gtt);
- return -ENOMEM;
- }
ret = intel_gtt_setup_scratch_page();
if (ret != 0) {
@@ -870,7 +816,7 @@ static bool intel_enable_gtt(void)
u32 gma_addr;
u8 __iomem *reg;
- if (INTEL_GTT_GEN == 2)
+ if (INTEL_GTT_GEN <= 2)
pci_read_config_dword(intel_private.pcidev, I810_GMADDR,
&gma_addr);
else
@@ -1304,19 +1250,16 @@ static int i9xx_setup(void)
static const struct agp_bridge_driver intel_810_driver = {
.owner = THIS_MODULE,
- .aperture_sizes = intel_i810_sizes,
.size_type = FIXED_APER_SIZE,
- .num_aperture_sizes = 2,
- .needs_scratch_page = true,
- .configure = intel_i810_configure,
- .fetch_size = intel_i810_fetch_size,
- .cleanup = intel_i810_cleanup,
- .mask_memory = intel_i810_mask_memory,
- .masks = intel_i810_masks,
+ .aperture_sizes = intel_fake_agp_sizes,
+ .num_aperture_sizes = ARRAY_SIZE(intel_fake_agp_sizes),
+ .configure = intel_fake_agp_configure,
+ .fetch_size = intel_fake_agp_fetch_size,
+ .cleanup = intel_gtt_cleanup,
.agp_enable = intel_fake_agp_enable,
.cache_flush = global_cache_flush,
- .create_gatt_table = agp_generic_create_gatt_table,
- .free_gatt_table = agp_generic_free_gatt_table,
+ .create_gatt_table = intel_fake_agp_create_gatt_table,
+ .free_gatt_table = intel_fake_agp_free_gatt_table,
.insert_memory = intel_i810_insert_entries,
.remove_memory = intel_fake_agp_remove_entries,
.alloc_by_type = intel_fake_agp_alloc_by_type,
@@ -1325,7 +1268,6 @@ static const struct agp_bridge_driver intel_810_driver = {
.agp_alloc_pages = agp_generic_alloc_pages,
.agp_destroy_page = agp_generic_destroy_page,
.agp_destroy_pages = agp_generic_destroy_pages,
- .agp_type_to_mask_type = agp_generic_type_to_mask_type,
};
static const struct agp_bridge_driver intel_fake_agp_driver = {
@@ -1353,7 +1295,10 @@ static const struct agp_bridge_driver intel_fake_agp_driver = {
static const struct intel_gtt_driver i81x_gtt_driver = {
.gen = 1,
+ .has_pgtbl_enable = 1,
.dma_mask_size = 32,
+ .setup = i810_setup,
+ .cleanup = i810_cleanup,
.check_flags = i830_check_flags,
.write_entry = i810_write_entry,
};
@@ -1585,8 +1530,8 @@ int intel_gmch_probe(struct pci_dev *pdev,
pci_set_consistent_dma_mask(intel_private.pcidev,
DMA_BIT_MASK(mask));
- if (bridge->driver == &intel_810_driver)
- return 1;
+ /*if (bridge->driver == &intel_810_driver)
+ return 1;*/
if (intel_gtt_init() != 0)
return 0;
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 05/15] intel-gtt: fold i81x-only dcache support into the generic driver
2010-11-06 14:21 [PATCH 00/15] The "no more agp" series Daniel Vetter
` (3 preceding siblings ...)
2010-11-06 14:21 ` [PATCH 04/15] intel-gtt: switch i81x to the common initialization helpers Daniel Vetter
@ 2010-11-06 14:21 ` Daniel Vetter
2010-11-06 14:21 ` [PATCH 06/15] drm/i915|intel-gtt: consolidate intel-gtt.h headers Daniel Vetter
` (9 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Daniel Vetter @ 2010-11-06 14:21 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Vetter
Now the intel-gtt.c rewrite is complete!
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/char/agp/intel-gtt.c | 150 +++++++++++++++++-------------------------
1 files changed, 61 insertions(+), 89 deletions(-)
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index 8fff75a..f62dc58 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -89,9 +89,6 @@ static struct _intel_private {
dma_addr_t scratch_page_dma;
} intel_private;
-static int intel_fake_agp_insert_entries(struct agp_memory *mem,
- off_t pg_start, int type);
-
#define INTEL_GTT_GEN intel_private.driver->gen
#define IS_G33 intel_private.driver->is_g33
#define IS_PINEVIEW intel_private.driver->is_pineview
@@ -226,30 +223,26 @@ static void i810_cleanup(void)
free_gatt_pages(intel_private.i81x_gtt_table, I810_GTT_ORDER);
}
-static int intel_i810_insert_entries(struct agp_memory *mem, off_t pg_start,
- int type)
+static int i810_insert_dcache_entries(struct agp_memory *mem, off_t pg_start,
+ int type)
{
int i;
- if (type == AGP_DCACHE_MEMORY) {
- if ((pg_start + mem->page_count)
- > intel_private.num_dcache_entries)
- return -EINVAL;
-
- if (!mem->is_flushed)
- global_cache_flush();
+ if ((pg_start + mem->page_count)
+ > intel_private.num_dcache_entries)
+ return -EINVAL;
- for (i = pg_start; i < (pg_start + mem->page_count); i++) {
- dma_addr_t addr = i << PAGE_SHIFT;
- intel_private.driver->write_entry(addr,
- i, type);
- }
- readl(intel_private.gtt+i-1);
+ if (!mem->is_flushed)
+ global_cache_flush();
- return 0;
+ for (i = pg_start; i < (pg_start + mem->page_count); i++) {
+ dma_addr_t addr = i << PAGE_SHIFT;
+ intel_private.driver->write_entry(addr,
+ i, type);
}
+ readl(intel_private.gtt+i-1);
- return intel_fake_agp_insert_entries(mem, pg_start, type);
+ return 0;
}
/*
@@ -956,6 +949,9 @@ static int intel_fake_agp_insert_entries(struct agp_memory *mem,
int i, j;
int ret = -EINVAL;
+ if (INTEL_GTT_GEN == 1 && type == AGP_DCACHE_MEMORY)
+ return i810_insert_dcache_entries(mem, pg_start, type);
+
if (mem->page_count == 0)
goto out;
@@ -1248,28 +1244,6 @@ static int i9xx_setup(void)
return 0;
}
-static const struct agp_bridge_driver intel_810_driver = {
- .owner = THIS_MODULE,
- .size_type = FIXED_APER_SIZE,
- .aperture_sizes = intel_fake_agp_sizes,
- .num_aperture_sizes = ARRAY_SIZE(intel_fake_agp_sizes),
- .configure = intel_fake_agp_configure,
- .fetch_size = intel_fake_agp_fetch_size,
- .cleanup = intel_gtt_cleanup,
- .agp_enable = intel_fake_agp_enable,
- .cache_flush = global_cache_flush,
- .create_gatt_table = intel_fake_agp_create_gatt_table,
- .free_gatt_table = intel_fake_agp_free_gatt_table,
- .insert_memory = intel_i810_insert_entries,
- .remove_memory = intel_fake_agp_remove_entries,
- .alloc_by_type = intel_fake_agp_alloc_by_type,
- .free_by_type = intel_i810_free_by_type,
- .agp_alloc_page = agp_generic_alloc_page,
- .agp_alloc_pages = agp_generic_alloc_pages,
- .agp_destroy_page = agp_generic_destroy_page,
- .agp_destroy_pages = agp_generic_destroy_pages,
-};
-
static const struct agp_bridge_driver intel_fake_agp_driver = {
.owner = THIS_MODULE,
.size_type = FIXED_APER_SIZE,
@@ -1389,93 +1363,92 @@ static const struct intel_gtt_driver sandybridge_gtt_driver = {
static const struct intel_gtt_driver_description {
unsigned int gmch_chip_id;
char *name;
- const struct agp_bridge_driver *gmch_driver;
const struct intel_gtt_driver *gtt_driver;
} intel_gtt_chipsets[] = {
- { PCI_DEVICE_ID_INTEL_82810_IG1, "i810", &intel_810_driver,
+ { PCI_DEVICE_ID_INTEL_82810_IG1, "i810",
&i81x_gtt_driver},
- { PCI_DEVICE_ID_INTEL_82810_IG3, "i810", &intel_810_driver,
+ { PCI_DEVICE_ID_INTEL_82810_IG3, "i810",
&i81x_gtt_driver},
- { PCI_DEVICE_ID_INTEL_82810E_IG, "i810", &intel_810_driver,
+ { PCI_DEVICE_ID_INTEL_82810E_IG, "i810",
&i81x_gtt_driver},
- { PCI_DEVICE_ID_INTEL_82815_CGC, "i815", &intel_810_driver,
+ { PCI_DEVICE_ID_INTEL_82815_CGC, "i815",
&i81x_gtt_driver},
{ PCI_DEVICE_ID_INTEL_82830_CGC, "830M",
- &intel_fake_agp_driver, &i8xx_gtt_driver},
+ &i8xx_gtt_driver},
{ PCI_DEVICE_ID_INTEL_82845G_IG, "830M",
- &intel_fake_agp_driver, &i8xx_gtt_driver},
+ &i8xx_gtt_driver},
{ PCI_DEVICE_ID_INTEL_82854_IG, "854",
- &intel_fake_agp_driver, &i8xx_gtt_driver},
+ &i8xx_gtt_driver},
{ PCI_DEVICE_ID_INTEL_82855GM_IG, "855GM",
- &intel_fake_agp_driver, &i8xx_gtt_driver},
+ &i8xx_gtt_driver},
{ PCI_DEVICE_ID_INTEL_82865_IG, "865",
- &intel_fake_agp_driver, &i8xx_gtt_driver},
+ &i8xx_gtt_driver},
{ PCI_DEVICE_ID_INTEL_E7221_IG, "E7221 (i915)",
- &intel_fake_agp_driver, &i915_gtt_driver },
+ &i915_gtt_driver },
{ PCI_DEVICE_ID_INTEL_82915G_IG, "915G",
- &intel_fake_agp_driver, &i915_gtt_driver },
+ &i915_gtt_driver },
{ PCI_DEVICE_ID_INTEL_82915GM_IG, "915GM",
- &intel_fake_agp_driver, &i915_gtt_driver },
+ &i915_gtt_driver },
{ PCI_DEVICE_ID_INTEL_82945G_IG, "945G",
- &intel_fake_agp_driver, &i915_gtt_driver },
+ &i915_gtt_driver },
{ PCI_DEVICE_ID_INTEL_82945GM_IG, "945GM",
- &intel_fake_agp_driver, &i915_gtt_driver },
+ &i915_gtt_driver },
{ PCI_DEVICE_ID_INTEL_82945GME_IG, "945GME",
- &intel_fake_agp_driver, &i915_gtt_driver },
+ &i915_gtt_driver },
{ PCI_DEVICE_ID_INTEL_82946GZ_IG, "946GZ",
- &intel_fake_agp_driver, &i965_gtt_driver },
+ &i965_gtt_driver },
{ PCI_DEVICE_ID_INTEL_82G35_IG, "G35",
- &intel_fake_agp_driver, &i965_gtt_driver },
+ &i965_gtt_driver },
{ PCI_DEVICE_ID_INTEL_82965Q_IG, "965Q",
- &intel_fake_agp_driver, &i965_gtt_driver },
+ &i965_gtt_driver },
{ PCI_DEVICE_ID_INTEL_82965G_IG, "965G",
- &intel_fake_agp_driver, &i965_gtt_driver },
+ &i965_gtt_driver },
{ PCI_DEVICE_ID_INTEL_82965GM_IG, "965GM",
- &intel_fake_agp_driver, &i965_gtt_driver },
+ &i965_gtt_driver },
{ PCI_DEVICE_ID_INTEL_82965GME_IG, "965GME/GLE",
- &intel_fake_agp_driver, &i965_gtt_driver },
+ &i965_gtt_driver },
{ PCI_DEVICE_ID_INTEL_G33_IG, "G33",
- &intel_fake_agp_driver, &g33_gtt_driver },
+ &g33_gtt_driver },
{ PCI_DEVICE_ID_INTEL_Q35_IG, "Q35",
- &intel_fake_agp_driver, &g33_gtt_driver },
+ &g33_gtt_driver },
{ PCI_DEVICE_ID_INTEL_Q33_IG, "Q33",
- &intel_fake_agp_driver, &g33_gtt_driver },
+ &g33_gtt_driver },
{ PCI_DEVICE_ID_INTEL_PINEVIEW_M_IG, "GMA3150",
- &intel_fake_agp_driver, &pineview_gtt_driver },
+ &pineview_gtt_driver },
{ PCI_DEVICE_ID_INTEL_PINEVIEW_IG, "GMA3150",
- &intel_fake_agp_driver, &pineview_gtt_driver },
+ &pineview_gtt_driver },
{ PCI_DEVICE_ID_INTEL_GM45_IG, "GM45",
- &intel_fake_agp_driver, &g4x_gtt_driver },
+ &g4x_gtt_driver },
{ PCI_DEVICE_ID_INTEL_EAGLELAKE_IG, "Eaglelake",
- &intel_fake_agp_driver, &g4x_gtt_driver },
+ &g4x_gtt_driver },
{ PCI_DEVICE_ID_INTEL_Q45_IG, "Q45/Q43",
- &intel_fake_agp_driver, &g4x_gtt_driver },
+ &g4x_gtt_driver },
{ PCI_DEVICE_ID_INTEL_G45_IG, "G45/G43",
- &intel_fake_agp_driver, &g4x_gtt_driver },
+ &g4x_gtt_driver },
{ PCI_DEVICE_ID_INTEL_B43_IG, "B43",
- &intel_fake_agp_driver, &g4x_gtt_driver },
+ &g4x_gtt_driver },
{ PCI_DEVICE_ID_INTEL_B43_1_IG, "B43",
- &intel_fake_agp_driver, &g4x_gtt_driver },
+ &g4x_gtt_driver },
{ PCI_DEVICE_ID_INTEL_G41_IG, "G41",
- &intel_fake_agp_driver, &g4x_gtt_driver },
+ &g4x_gtt_driver },
{ PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG,
- "HD Graphics", &intel_fake_agp_driver, &ironlake_gtt_driver },
+ "HD Graphics", &ironlake_gtt_driver },
{ PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG,
- "HD Graphics", &intel_fake_agp_driver, &ironlake_gtt_driver },
+ "HD Graphics", &ironlake_gtt_driver },
{ PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT1_IG,
- "Sandybridge", &intel_fake_agp_driver, &sandybridge_gtt_driver },
+ "Sandybridge", &sandybridge_gtt_driver },
{ PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT2_IG,
- "Sandybridge", &intel_fake_agp_driver, &sandybridge_gtt_driver },
+ "Sandybridge", &sandybridge_gtt_driver },
{ PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT2_PLUS_IG,
- "Sandybridge", &intel_fake_agp_driver, &sandybridge_gtt_driver },
+ "Sandybridge", &sandybridge_gtt_driver },
{ PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT1_IG,
- "Sandybridge", &intel_fake_agp_driver, &sandybridge_gtt_driver },
+ "Sandybridge", &sandybridge_gtt_driver },
{ PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT2_IG,
- "Sandybridge", &intel_fake_agp_driver, &sandybridge_gtt_driver },
+ "Sandybridge", &sandybridge_gtt_driver },
{ PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT2_PLUS_IG,
- "Sandybridge", &intel_fake_agp_driver, &sandybridge_gtt_driver },
+ "Sandybridge", &sandybridge_gtt_driver },
{ PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_IG,
- "Sandybridge", &intel_fake_agp_driver, &sandybridge_gtt_driver },
+ "Sandybridge", &sandybridge_gtt_driver },
{ 0, NULL, NULL }
};
@@ -1500,21 +1473,20 @@ int intel_gmch_probe(struct pci_dev *pdev,
struct agp_bridge_data *bridge)
{
int i, mask;
- bridge->driver = NULL;
+ intel_private.driver = NULL;
for (i = 0; intel_gtt_chipsets[i].name != NULL; i++) {
if (find_gmch(intel_gtt_chipsets[i].gmch_chip_id)) {
- bridge->driver =
- intel_gtt_chipsets[i].gmch_driver;
intel_private.driver =
intel_gtt_chipsets[i].gtt_driver;
break;
}
}
- if (!bridge->driver)
+ if (!intel_private.driver)
return 0;
+ bridge->driver = &intel_fake_agp_driver;
bridge->dev_private_data = &intel_private;
bridge->dev = pdev;
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 06/15] drm/i915|intel-gtt: consolidate intel-gtt.h headers
2010-11-06 14:21 [PATCH 00/15] The "no more agp" series Daniel Vetter
` (4 preceding siblings ...)
2010-11-06 14:21 ` [PATCH 05/15] intel-gtt: fold i81x-only dcache support into the generic driver Daniel Vetter
@ 2010-11-06 14:21 ` Daniel Vetter
2010-11-06 14:22 ` [PATCH 07/15] drm/i915/gtt: call chipset flush directly Daniel Vetter
` (8 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Daniel Vetter @ 2010-11-06 14:21 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Vetter
... and a few other defines.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/char/agp/intel-gtt.c | 5 -----
drivers/gpu/drm/i915/i915_gem.c | 1 -
include/drm/intel-gtt.h | 12 ++++++++++++
include/linux/intel-gtt.h | 20 --------------------
4 files changed, 12 insertions(+), 26 deletions(-)
delete mode 100644 include/linux/intel-gtt.h
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index f62dc58..0fca1b7 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -24,7 +24,6 @@
#include <asm/smp.h>
#include "agp.h"
#include "intel-agp.h"
-#include <linux/intel-gtt.h>
#include <drm/intel-gtt.h>
/*
@@ -42,10 +41,6 @@
/* Max amount of stolen space, anything above will be returned to Linux */
int intel_max_stolen = 32 * 1024 * 1024;
-#define AGP_DCACHE_MEMORY 1
-#define AGP_PHYS_MEMORY 2
-#define INTEL_AGP_CACHED_MEMORY 3
-
struct intel_gtt_driver {
unsigned int gen : 8;
unsigned int is_g33 : 1;
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 47c665e..6f1cbff 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -34,7 +34,6 @@
#include <linux/slab.h>
#include <linux/swap.h>
#include <linux/pci.h>
-#include <linux/intel-gtt.h>
struct change_domains {
uint32_t invalidate_domains;
diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h
index d3c8194..141fbfe 100644
--- a/include/drm/intel-gtt.h
+++ b/include/drm/intel-gtt.h
@@ -14,5 +14,17 @@ struct intel_gtt {
struct intel_gtt *intel_gtt_get(void);
+
+/* Special gtt memory types */
+#define AGP_DCACHE_MEMORY 1
+#define AGP_PHYS_MEMORY 2
+
+/* New caching attributes for gen6/sandybridge */
+#define AGP_USER_CACHED_MEMORY_LLC_MLC (AGP_USER_TYPES + 2)
+#define AGP_USER_UNCACHED_MEMORY (AGP_USER_TYPES + 4)
+
+/* flag for GFDT type */
+#define AGP_USER_CACHED_MEMORY_GFDT (1 << 3)
+
#endif
diff --git a/include/linux/intel-gtt.h b/include/linux/intel-gtt.h
deleted file mode 100644
index 1d19ab2..0000000
--- a/include/linux/intel-gtt.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Common Intel AGPGART and GTT definitions.
- */
-#ifndef _INTEL_GTT_H
-#define _INTEL_GTT_H
-
-#include <linux/agp_backend.h>
-
-/* This is for Intel only GTT controls.
- *
- * Sandybridge: AGP_USER_CACHED_MEMORY default to LLC only
- */
-
-#define AGP_USER_CACHED_MEMORY_LLC_MLC (AGP_USER_TYPES + 2)
-#define AGP_USER_UNCACHED_MEMORY (AGP_USER_TYPES + 4)
-
-/* flag for GFDT type */
-#define AGP_USER_CACHED_MEMORY_GFDT (1 << 3)
-
-#endif
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 07/15] drm/i915/gtt: call chipset flush directly
2010-11-06 14:21 [PATCH 00/15] The "no more agp" series Daniel Vetter
` (5 preceding siblings ...)
2010-11-06 14:21 ` [PATCH 06/15] drm/i915|intel-gtt: consolidate intel-gtt.h headers Daniel Vetter
@ 2010-11-06 14:22 ` Daniel Vetter
2010-11-06 14:22 ` [PATCH 08/15] drm: kill drm_agp_chipset_flush Daniel Vetter
` (7 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Daniel Vetter @ 2010-11-06 14:22 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Vetter
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/char/agp/intel-gtt.c | 7 +++++++
drivers/gpu/drm/i915/i915_gem.c | 9 ++++-----
include/drm/intel-gtt.h | 2 +-
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index 0fca1b7..853128a 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -1513,6 +1513,13 @@ struct intel_gtt *intel_gtt_get(void)
}
EXPORT_SYMBOL(intel_gtt_get);
+void intel_gtt_chipset_flush(void)
+{
+ if (intel_private.driver->chipset_flush)
+ intel_private.driver->chipset_flush();
+}
+EXPORT_SYMBOL(intel_gtt_chipset_flush);
+
void intel_gmch_remove(struct pci_dev *pdev)
{
if (intel_private.pcidev)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 6f1cbff..49e38ff 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2168,7 +2168,7 @@ i915_gem_flush(struct drm_device *dev,
drm_i915_private_t *dev_priv = dev->dev_private;
if (flush_domains & I915_GEM_DOMAIN_CPU)
- drm_agp_chipset_flush(dev);
+ intel_gtt_chipset_flush();
if ((flush_domains | invalidate_domains) & I915_GEM_GPU_DOMAINS) {
if (flush_rings & RING_RENDER)
@@ -2894,14 +2894,13 @@ i915_gem_object_flush_gtt_write_domain(struct drm_gem_object *obj)
static void
i915_gem_object_flush_cpu_write_domain(struct drm_gem_object *obj)
{
- struct drm_device *dev = obj->dev;
uint32_t old_write_domain;
if (obj->write_domain != I915_GEM_DOMAIN_CPU)
return;
i915_gem_clflush_object(obj);
- drm_agp_chipset_flush(dev);
+ intel_gtt_chipset_flush();
old_write_domain = obj->write_domain;
obj->write_domain = 0;
@@ -4897,7 +4896,7 @@ void i915_gem_detach_phys_object(struct drm_device *dev,
page_cache_release(page);
}
}
- drm_agp_chipset_flush(dev);
+ intel_gtt_chipset_flush();
obj_priv->phys_obj->cur_obj = NULL;
obj_priv->phys_obj = NULL;
@@ -4982,7 +4981,7 @@ i915_gem_phys_pwrite(struct drm_device *dev, struct drm_gem_object *obj,
if (ret)
return -EFAULT;
- drm_agp_chipset_flush(dev);
+ intel_gtt_chipset_flush();
return 0;
}
diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h
index 141fbfe..80cbf1f 100644
--- a/include/drm/intel-gtt.h
+++ b/include/drm/intel-gtt.h
@@ -13,7 +13,7 @@ struct intel_gtt {
};
struct intel_gtt *intel_gtt_get(void);
-
+void intel_gtt_chipset_flush(void);
/* Special gtt memory types */
#define AGP_DCACHE_MEMORY 1
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 08/15] drm: kill drm_agp_chipset_flush
2010-11-06 14:21 [PATCH 00/15] The "no more agp" series Daniel Vetter
` (6 preceding siblings ...)
2010-11-06 14:22 ` [PATCH 07/15] drm/i915/gtt: call chipset flush directly Daniel Vetter
@ 2010-11-06 14:22 ` Daniel Vetter
2010-11-06 14:22 ` [PATCH 09/15] agp: kill agp_flush_chipset and corresponding ioctl Daniel Vetter
` (6 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Daniel Vetter @ 2010-11-06 14:22 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Vetter
No longer used.
Cc: Dave Airlie <airlied@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/drm_agpsupport.c | 6 ------
include/drm/drmP.h | 1 -
2 files changed, 0 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c
index 252fdb9..0cb2ba5 100644
--- a/drivers/gpu/drm/drm_agpsupport.c
+++ b/drivers/gpu/drm/drm_agpsupport.c
@@ -466,10 +466,4 @@ drm_agp_bind_pages(struct drm_device *dev,
}
EXPORT_SYMBOL(drm_agp_bind_pages);
-void drm_agp_chipset_flush(struct drm_device *dev)
-{
- agp_flush_chipset(dev->agp->bridge);
-}
-EXPORT_SYMBOL(drm_agp_chipset_flush);
-
#endif /* __OS_HAS_AGP */
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index d4bc0f5..628f767 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1319,7 +1319,6 @@ extern int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
extern int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
-extern void drm_agp_chipset_flush(struct drm_device *dev);
/* Stub support (drm_stub.h) */
extern int drm_setmaster_ioctl(struct drm_device *dev, void *data,
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 09/15] agp: kill agp_flush_chipset and corresponding ioctl
2010-11-06 14:21 [PATCH 00/15] The "no more agp" series Daniel Vetter
` (7 preceding siblings ...)
2010-11-06 14:22 ` [PATCH 08/15] drm: kill drm_agp_chipset_flush Daniel Vetter
@ 2010-11-06 14:22 ` Daniel Vetter
2010-11-06 14:22 ` [PATCH 10/15] drm/i915: track objects in the gtt Daniel Vetter
` (5 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Daniel Vetter @ 2010-11-06 14:22 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Vetter
The intel drm calls the chipset functions now directly. Userspace
never called the corresponding ioctl, hence it can be killed, too.
Cc: Dave Airlie <airlied@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/char/agp/agp.h | 1 -
drivers/char/agp/compat_ioctl.c | 1 -
drivers/char/agp/compat_ioctl.h | 1 -
drivers/char/agp/frontend.c | 8 --------
drivers/char/agp/generic.c | 7 -------
drivers/char/agp/intel-gtt.c | 6 ------
include/linux/agp_backend.h | 1 -
7 files changed, 0 insertions(+), 25 deletions(-)
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h
index 5259065..3e67ddd 100644
--- a/drivers/char/agp/agp.h
+++ b/drivers/char/agp/agp.h
@@ -120,7 +120,6 @@ struct agp_bridge_driver {
void (*agp_destroy_page)(struct page *, int flags);
void (*agp_destroy_pages)(struct agp_memory *);
int (*agp_type_to_mask_type) (struct agp_bridge_data *, int);
- void (*chipset_flush)(struct agp_bridge_data *);
};
struct agp_bridge_data {
diff --git a/drivers/char/agp/compat_ioctl.c b/drivers/char/agp/compat_ioctl.c
index 9d2c97a..a48e05b 100644
--- a/drivers/char/agp/compat_ioctl.c
+++ b/drivers/char/agp/compat_ioctl.c
@@ -276,7 +276,6 @@ long compat_agp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
break;
case AGPIOC_CHIPSET_FLUSH32:
- ret_val = agpioc_chipset_flush_wrap(curr_priv);
break;
}
diff --git a/drivers/char/agp/compat_ioctl.h b/drivers/char/agp/compat_ioctl.h
index 0c9678a..f30e0fd 100644
--- a/drivers/char/agp/compat_ioctl.h
+++ b/drivers/char/agp/compat_ioctl.h
@@ -102,6 +102,5 @@ void agp_free_memory_wrap(struct agp_memory *memory);
struct agp_memory *agp_allocate_memory_wrap(size_t pg_count, u32 type);
struct agp_memory *agp_find_mem_by_key(int key);
struct agp_client *agp_find_client_by_pid(pid_t id);
-int agpioc_chipset_flush_wrap(struct agp_file_private *priv);
#endif /* _AGP_COMPAT_H */
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c
index 43412c0..0fbd898 100644
--- a/drivers/char/agp/frontend.c
+++ b/drivers/char/agp/frontend.c
@@ -958,13 +958,6 @@ static int agpioc_unbind_wrap(struct agp_file_private *priv, void __user *arg)
return agp_unbind_memory(memory);
}
-int agpioc_chipset_flush_wrap(struct agp_file_private *priv)
-{
- DBG("");
- agp_flush_chipset(agp_bridge);
- return 0;
-}
-
static long agp_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
@@ -1040,7 +1033,6 @@ static long agp_ioctl(struct file *file,
break;
case AGPIOC_CHIPSET_FLUSH:
- ret_val = agpioc_chipset_flush_wrap(curr_priv);
break;
}
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index 4956f1c..78bc8de 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -81,13 +81,6 @@ static int agp_get_key(void)
return -1;
}
-void agp_flush_chipset(struct agp_bridge_data *bridge)
-{
- if (bridge->driver->chipset_flush)
- bridge->driver->chipset_flush(bridge);
-}
-EXPORT_SYMBOL(agp_flush_chipset);
-
/*
* Use kmalloc if possible for the page list. Otherwise fall back to
* vmalloc. This speeds things up and also saves memory for small AGP
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index 853128a..d633e9d 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -1021,11 +1021,6 @@ static int intel_fake_agp_remove_entries(struct agp_memory *mem,
return 0;
}
-static void intel_fake_agp_chipset_flush(struct agp_bridge_data *bridge)
-{
- intel_private.driver->chipset_flush();
-}
-
static struct agp_memory *intel_fake_agp_alloc_by_type(size_t pg_count,
int type)
{
@@ -1259,7 +1254,6 @@ static const struct agp_bridge_driver intel_fake_agp_driver = {
.agp_alloc_pages = agp_generic_alloc_pages,
.agp_destroy_page = agp_generic_destroy_page,
.agp_destroy_pages = agp_generic_destroy_pages,
- .chipset_flush = intel_fake_agp_chipset_flush,
};
static const struct intel_gtt_driver i81x_gtt_driver = {
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h
index 09ea4a1..a479b48 100644
--- a/include/linux/agp_backend.h
+++ b/include/linux/agp_backend.h
@@ -106,6 +106,5 @@ extern int agp_rebind_memory(void);
extern void agp_enable(struct agp_bridge_data *, u32);
extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *);
extern void agp_backend_release(struct agp_bridge_data *);
-extern void agp_flush_chipset(struct agp_bridge_data *);
#endif /* _AGP_BACKEND_H */
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 10/15] drm/i915: track objects in the gtt
2010-11-06 14:21 [PATCH 00/15] The "no more agp" series Daniel Vetter
` (8 preceding siblings ...)
2010-11-06 14:22 ` [PATCH 09/15] agp: kill agp_flush_chipset and corresponding ioctl Daniel Vetter
@ 2010-11-06 14:22 ` Daniel Vetter
2010-11-06 14:22 ` [PATCH 11/15] drm/i915: restore gtt on resume in the drm instead of in intel-gtt.ko Daniel Vetter
` (4 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Daniel Vetter @ 2010-11-06 14:22 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Vetter
This is required to restore gtt mappings on resume when agp is gone.
The right way to do this would be to make sturct drm_mm_node embeddable
and use the allocation list maintained by the drm memory manager. But
that's a bigger project. Getting rid of the per bo agp_mem will save
more memory than this wastes, anyway.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/i915/i915_drv.h | 4 ++++
drivers/gpu/drm/i915/i915_gem.c | 4 ++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 6212342..e77963d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -544,6 +544,9 @@ typedef struct drm_i915_private {
struct drm_mm vram;
/** Memory allocator for GTT */
struct drm_mm gtt_space;
+ /** List of all objects in gtt_space. Used to restore gtt
+ * mappings on resume */
+ struct list_head gtt_list;
/** End of mappable part of GTT */
unsigned long gtt_mappable_end;
@@ -711,6 +714,7 @@ struct drm_i915_gem_object {
/** Current space allocated to this object in the GTT, if any. */
struct drm_mm_node *gtt_space;
+ struct list_head gtt_list;
/** This object's place on the active/flushing/inactive lists */
struct list_head ring_list;
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 49e38ff..feb1b4f 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -95,6 +95,7 @@ static void i915_gem_info_add_gtt(struct drm_i915_private *dev_priv,
min_t(size_t, obj->gtt_space->size,
dev_priv->mm.gtt_mappable_end - obj->gtt_offset);
}
+ list_add_tail(&obj->gtt_list, &dev_priv->mm.gtt_list);
}
static void i915_gem_info_remove_gtt(struct drm_i915_private *dev_priv,
@@ -107,6 +108,7 @@ static void i915_gem_info_remove_gtt(struct drm_i915_private *dev_priv,
min_t(size_t, obj->gtt_space->size,
dev_priv->mm.gtt_mappable_end - obj->gtt_offset);
}
+ list_del_init(&obj->gtt_list);
}
/**
@@ -4432,6 +4434,7 @@ struct drm_gem_object * i915_gem_alloc_object(struct drm_device *dev,
obj->base.driver_private = NULL;
obj->fence_reg = I915_FENCE_REG_NONE;
INIT_LIST_HEAD(&obj->mm_list);
+ INIT_LIST_HEAD(&obj->gtt_list);
INIT_LIST_HEAD(&obj->ring_list);
INIT_LIST_HEAD(&obj->gpu_write_list);
obj->madv = I915_MADV_WILLNEED;
@@ -4744,6 +4747,7 @@ i915_gem_load(struct drm_device *dev)
INIT_LIST_HEAD(&dev_priv->mm.pinned_list);
INIT_LIST_HEAD(&dev_priv->mm.fence_list);
INIT_LIST_HEAD(&dev_priv->mm.deferred_free_list);
+ INIT_LIST_HEAD(&dev_priv->mm.gtt_list);
init_ring_lists(&dev_priv->render_ring);
init_ring_lists(&dev_priv->bsd_ring);
init_ring_lists(&dev_priv->blt_ring);
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 11/15] drm/i915: restore gtt on resume in the drm instead of in intel-gtt.ko
2010-11-06 14:21 [PATCH 00/15] The "no more agp" series Daniel Vetter
` (9 preceding siblings ...)
2010-11-06 14:22 ` [PATCH 10/15] drm/i915: track objects in the gtt Daniel Vetter
@ 2010-11-06 14:22 ` Daniel Vetter
2010-11-06 14:22 ` [PATCH 12/15] agp: kill agp_rebind_memory Daniel Vetter
` (3 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Daniel Vetter @ 2010-11-06 14:22 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Vetter
[-- Attachment #1: Type: text/plain, Size: 4902 bytes --]
This still uses the agp functions to actually reinstate the mappings
(with a gross hack to make agp cooperate), but it wires everything
up correctly for the switchover.
The call to agp_rebind_memory can be dropped because all non-kms drivers
do all their rebinding on EnterVT.
v2: Be more paranoid and flush the chipset cache after restoring gtt
mappings.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/char/agp/intel-agp.c | 5 ---
drivers/gpu/drm/i915/Makefile | 1 +
drivers/gpu/drm/i915/i915_drv.c | 1 +
drivers/gpu/drm/i915/i915_drv.h | 3 ++
drivers/gpu/drm/i915/i915_gem_gtt.c | 49 +++++++++++++++++++++++++++++++++++
5 files changed, 54 insertions(+), 5 deletions(-)
create mode 100644 drivers/gpu/drm/i915/i915_gem_gtt.c
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index e72f49d..07e9796 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -828,14 +828,9 @@ static void __devexit agp_intel_remove(struct pci_dev *pdev)
static int agp_intel_resume(struct pci_dev *pdev)
{
struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
- int ret_val;
bridge->driver->configure();
- ret_val = agp_rebind_memory();
- if (ret_val != 0)
- return ret_val;
-
return 0;
}
#endif
diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index fdc833d..b3cdb4f 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -8,6 +8,7 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o i915_mem.o \
i915_suspend.o \
i915_gem.o \
i915_gem_debug.o \
+ i915_gem_gtt.o \
i915_gem_evict.o \
i915_gem_tiling.o \
i915_trace_points.o \
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 57e892d..786540c 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -309,6 +309,7 @@ static int i915_drm_thaw(struct drm_device *dev)
/* KMS EnterVT equivalent */
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
mutex_lock(&dev->struct_mutex);
+ i915_gem_restore_gtt_mappings(dev);
dev_priv->mm.suspended = 0;
error = i915_gem_init_ringbuffer(dev);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e77963d..5474f97 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1074,6 +1074,9 @@ void i915_gem_detach_phys_object(struct drm_device *dev,
void i915_gem_free_all_phys_object(struct drm_device *dev);
void i915_gem_release(struct drm_device * dev, struct drm_file *file_priv);
+/* i915_gem_gtt.c */
+void i915_gem_restore_gtt_mappings(struct drm_device *dev);
+
/* i915_gem_evict.c */
int i915_gem_evict_something(struct drm_device *dev, int min_size,
unsigned alignment, bool mappable);
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
new file mode 100644
index 0000000..5f21d0a
--- /dev/null
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright © 2010 Daniel Vetter
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include "drmP.h"
+#include "drm.h"
+#include "i915_drm.h"
+#include "i915_drv.h"
+#include "i915_trace.h"
+#include "intel_drv.h"
+
+void i915_gem_restore_gtt_mappings(struct drm_device *dev)
+{
+ struct drm_i915_private *dev_priv = dev->dev_private;
+ struct drm_i915_gem_object *obj_priv;
+ int ret;
+
+ list_for_each_entry(obj_priv,
+ &dev_priv->mm.gtt_list,
+ gtt_list) {
+ /* Hack to force agp to reinsert buffer object. */
+ obj_priv->agp_mem->is_bound = false;
+ ret = agp_bind_memory(obj_priv->agp_mem, obj_priv->gtt_space->start / PAGE_SIZE);
+ BUG_ON(ret != 0);
+ }
+
+ /* Be paranoid and flush the chipset cache. */
+ intel_gtt_chipset_flush();
+}
--
1.7.1
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 12/15] agp: kill agp_rebind_memory
2010-11-06 14:21 [PATCH 00/15] The "no more agp" series Daniel Vetter
` (10 preceding siblings ...)
2010-11-06 14:22 ` [PATCH 11/15] drm/i915: restore gtt on resume in the drm instead of in intel-gtt.ko Daniel Vetter
@ 2010-11-06 14:22 ` Daniel Vetter
2010-11-06 14:22 ` [PATCH 13/15] drm/i915: move gtt handling to i915_gem_gtt.c Daniel Vetter
` (2 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Daniel Vetter @ 2010-11-06 14:22 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Vetter
Its only user, intel-gtt.c is now gone.
Cc: Dave Airlie <airlied@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/char/agp/generic.c | 20 --------------------
include/linux/agp_backend.h | 1 -
2 files changed, 0 insertions(+), 21 deletions(-)
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index 78bc8de..012cba0 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -480,26 +480,6 @@ int agp_unbind_memory(struct agp_memory *curr)
}
EXPORT_SYMBOL(agp_unbind_memory);
-/**
- * agp_rebind_emmory - Rewrite the entire GATT, useful on resume
- */
-int agp_rebind_memory(void)
-{
- struct agp_memory *curr;
- int ret_val = 0;
-
- spin_lock(&agp_bridge->mapped_lock);
- list_for_each_entry(curr, &agp_bridge->mapped_list, mapped_list) {
- ret_val = curr->bridge->driver->insert_memory(curr,
- curr->pg_start,
- curr->type);
- if (ret_val != 0)
- break;
- }
- spin_unlock(&agp_bridge->mapped_lock);
- return ret_val;
-}
-EXPORT_SYMBOL(agp_rebind_memory);
/* End - Routines for handling swapping of agp_memory into the GATT */
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h
index a479b48..eaf6cd7 100644
--- a/include/linux/agp_backend.h
+++ b/include/linux/agp_backend.h
@@ -102,7 +102,6 @@ extern struct agp_memory *agp_allocate_memory(struct agp_bridge_data *, size_t,
extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *);
extern int agp_bind_memory(struct agp_memory *, off_t);
extern int agp_unbind_memory(struct agp_memory *);
-extern int agp_rebind_memory(void);
extern void agp_enable(struct agp_bridge_data *, u32);
extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *);
extern void agp_backend_release(struct agp_bridge_data *);
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 13/15] drm/i915: move gtt handling to i915_gem_gtt.c
2010-11-06 14:21 [PATCH 00/15] The "no more agp" series Daniel Vetter
` (11 preceding siblings ...)
2010-11-06 14:22 ` [PATCH 12/15] agp: kill agp_rebind_memory Daniel Vetter
@ 2010-11-06 14:22 ` Daniel Vetter
2010-11-06 14:22 ` [PATCH 14/15] intel-gtt: export api for drm/i915 Daniel Vetter
2010-11-06 14:22 ` [PATCH 15/15] drm/i915: no more agp for gem Daniel Vetter
14 siblings, 0 replies; 19+ messages in thread
From: Daniel Vetter @ 2010-11-06 14:22 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Vetter
No more drm_*_agp in i915_gem.c!
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/i915/i915_drv.h | 2 ++
drivers/gpu/drm/i915/i915_gem.c | 14 +++-----------
drivers/gpu/drm/i915/i915_gem_gtt.c | 28 ++++++++++++++++++++++++++++
3 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 5474f97..ce715ec 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1076,6 +1076,8 @@ void i915_gem_release(struct drm_device * dev, struct drm_file *file_priv);
/* i915_gem_gtt.c */
void i915_gem_restore_gtt_mappings(struct drm_device *dev);
+int i915_gem_gtt_bind_object(struct drm_gem_object *obj);
+void i915_gem_gtt_unbind_object(struct drm_gem_object *obj);
/* i915_gem_evict.c */
int i915_gem_evict_something(struct drm_device *dev, int min_size,
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index feb1b4f..1e0d5d9 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2264,8 +2264,7 @@ i915_gem_object_unbind(struct drm_gem_object *obj)
if (obj_priv->fence_reg != I915_FENCE_REG_NONE)
i915_gem_clear_fence_reg(obj);
- drm_unbind_agp(obj_priv->agp_mem);
- drm_free_agp(obj_priv->agp_mem, obj->size / PAGE_SIZE);
+ i915_gem_gtt_unbind_object(obj);
i915_gem_object_put_pages_gtt(obj);
@@ -2782,15 +2781,8 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj,
return ret;
}
- /* Create an AGP memory structure pointing at our pages, and bind it
- * into the GTT.
- */
- obj_priv->agp_mem = drm_agp_bind_pages(dev,
- obj_priv->pages,
- obj->size >> PAGE_SHIFT,
- obj_priv->gtt_space->start,
- obj_priv->agp_type);
- if (obj_priv->agp_mem == NULL) {
+ ret = i915_gem_gtt_bind_object(obj);
+ if (ret) {
i915_gem_object_put_pages_gtt(obj);
drm_mm_put_block(obj_priv->gtt_space);
obj_priv->gtt_space = NULL;
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 5f21d0a..f78c15f 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -47,3 +47,31 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev)
/* Be paranoid and flush the chipset cache. */
intel_gtt_chipset_flush();
}
+
+int i915_gem_gtt_bind_object(struct drm_gem_object *obj)
+{
+ struct drm_device *dev = obj->dev;
+ struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
+
+ /* Create an AGP memory structure pointing at our pages, and bind it
+ * into the GTT.
+ */
+ obj_priv->agp_mem = drm_agp_bind_pages(dev,
+ obj_priv->pages,
+ obj->size >> PAGE_SHIFT,
+ obj_priv->gtt_space->start,
+ obj_priv->agp_type);
+
+ if (obj_priv->agp_mem)
+ return 0;
+ else
+ return -ENOMEM;
+}
+
+void i915_gem_gtt_unbind_object(struct drm_gem_object *obj)
+{
+ struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
+
+ drm_unbind_agp(obj_priv->agp_mem);
+ drm_free_agp(obj_priv->agp_mem, obj->size / PAGE_SIZE);
+}
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 14/15] intel-gtt: export api for drm/i915
2010-11-06 14:21 [PATCH 00/15] The "no more agp" series Daniel Vetter
` (12 preceding siblings ...)
2010-11-06 14:22 ` [PATCH 13/15] drm/i915: move gtt handling to i915_gem_gtt.c Daniel Vetter
@ 2010-11-06 14:22 ` Daniel Vetter
2010-11-06 14:22 ` [PATCH 15/15] drm/i915: no more agp for gem Daniel Vetter
14 siblings, 0 replies; 19+ messages in thread
From: Daniel Vetter @ 2010-11-06 14:22 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Vetter
Just some minor shuffling to get rid of any agp traces in the
exported functions.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/char/agp/intel-gtt.c | 120 ++++++++++++++++++++++++------------------
include/drm/intel-gtt.h | 12 ++++
2 files changed, 80 insertions(+), 52 deletions(-)
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index d633e9d..d93a172 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -90,41 +90,29 @@ static struct _intel_private {
#define IS_IRONLAKE intel_private.driver->is_ironlake
#define HAS_PGTBL_EN intel_private.driver->has_pgtbl_enable
-static void intel_agp_free_sglist(struct agp_memory *mem)
-{
- struct sg_table st;
-
- st.sgl = mem->sg_list;
- st.orig_nents = st.nents = mem->page_count;
-
- sg_free_table(&st);
-
- mem->sg_list = NULL;
- mem->num_sg = 0;
-}
-
-static int intel_agp_map_memory(struct agp_memory *mem)
+int intel_gtt_map_memory(struct page **pages, unsigned int num_entries,
+ struct scatterlist **sg_list, int *num_sg)
{
struct sg_table st;
struct scatterlist *sg;
int i;
- if (mem->sg_list)
+ if (*sg_list)
return 0; /* already mapped (for e.g. resume */
- DBG("try mapping %lu pages\n", (unsigned long)mem->page_count);
+ DBG("try mapping %lu pages\n", (unsigned long)num_entries);
- if (sg_alloc_table(&st, mem->page_count, GFP_KERNEL))
+ if (sg_alloc_table(&st, num_entries, GFP_KERNEL))
goto err;
- mem->sg_list = sg = st.sgl;
+ *sg_list = sg = st.sgl;
- for (i = 0 ; i < mem->page_count; i++, sg = sg_next(sg))
- sg_set_page(sg, mem->pages[i], PAGE_SIZE, 0);
+ for (i = 0 ; i < num_entries; i++, sg = sg_next(sg))
+ sg_set_page(sg, pages[i], PAGE_SIZE, 0);
- mem->num_sg = pci_map_sg(intel_private.pcidev, mem->sg_list,
- mem->page_count, PCI_DMA_BIDIRECTIONAL);
- if (unlikely(!mem->num_sg))
+ *num_sg = pci_map_sg(intel_private.pcidev, *sg_list,
+ num_entries, PCI_DMA_BIDIRECTIONAL);
+ if (unlikely(!*num_sg))
goto err;
return 0;
@@ -133,15 +121,22 @@ err:
sg_free_table(&st);
return -ENOMEM;
}
+EXPORT_SYMBOL(intel_gtt_map_memory);
-static void intel_agp_unmap_memory(struct agp_memory *mem)
+void intel_gtt_unmap_memory(struct scatterlist *sg_list, int num_sg)
{
+ struct sg_table st;
DBG("try unmapping %lu pages\n", (unsigned long)mem->page_count);
- pci_unmap_sg(intel_private.pcidev, mem->sg_list,
- mem->page_count, PCI_DMA_BIDIRECTIONAL);
- intel_agp_free_sglist(mem);
+ pci_unmap_sg(intel_private.pcidev, sg_list,
+ num_sg, PCI_DMA_BIDIRECTIONAL);
+
+ st.sgl = sg_list;
+ st.orig_nents = st.nents = num_sg;
+
+ sg_free_table(&st);
}
+EXPORT_SYMBOL(intel_gtt_unmap_memory);
static void intel_fake_agp_enable(struct agp_bridge_data *bridge, u32 mode)
{
@@ -310,7 +305,7 @@ static int intel_gtt_setup_scratch_page(void)
get_page(page);
set_pages_uc(page, 1);
- if (USE_PCI_DMA_API && INTEL_GTT_GEN > 2) {
+ if (intel_private.base.needs_dmar) {
dma_addr = pci_map_page(intel_private.pcidev, page, 0,
PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
if (pci_dma_mapping_error(intel_private.pcidev, dma_addr))
@@ -719,6 +714,8 @@ static int intel_gtt_init(void)
return ret;
}
+ intel_private.base.needs_dmar = USE_PCI_DMA_API && INTEL_GTT_GEN > 2;
+
return 0;
}
@@ -913,10 +910,10 @@ static bool i830_check_flags(unsigned int flags)
return false;
}
-static void intel_gtt_insert_sg_entries(struct scatterlist *sg_list,
- unsigned int sg_len,
- unsigned int pg_start,
- unsigned int flags)
+void intel_gtt_insert_sg_entries(struct scatterlist *sg_list,
+ unsigned int sg_len,
+ unsigned int pg_start,
+ unsigned int flags)
{
struct scatterlist *sg;
unsigned int len, m;
@@ -937,11 +934,25 @@ static void intel_gtt_insert_sg_entries(struct scatterlist *sg_list,
}
readl(intel_private.gtt+j-1);
}
+EXPORT_SYMBOL(intel_gtt_insert_sg_entries);
+
+void intel_gtt_insert_pages(unsigned int first_entry, unsigned int num_entries,
+ struct page **pages, unsigned int flags)
+{
+ int i, j;
+
+ for (i = 0, j = first_entry; i < num_entries; i++, j++) {
+ dma_addr_t addr = page_to_phys(pages[i]);
+ intel_private.driver->write_entry(addr,
+ j, flags);
+ }
+ readl(intel_private.gtt+j-1);
+}
+EXPORT_SYMBOL(intel_gtt_insert_pages);
static int intel_fake_agp_insert_entries(struct agp_memory *mem,
off_t pg_start, int type)
{
- int i, j;
int ret = -EINVAL;
if (INTEL_GTT_GEN == 1 && type == AGP_DCACHE_MEMORY)
@@ -972,21 +983,17 @@ static int intel_fake_agp_insert_entries(struct agp_memory *mem,
if (!mem->is_flushed)
global_cache_flush();
- if (USE_PCI_DMA_API && INTEL_GTT_GEN > 2) {
- ret = intel_agp_map_memory(mem);
+ if (intel_private.base.needs_dmar) {
+ ret = intel_gtt_map_memory(mem->pages, mem->page_count,
+ &mem->sg_list, &mem->num_sg);
if (ret != 0)
return ret;
intel_gtt_insert_sg_entries(mem->sg_list, mem->num_sg,
pg_start, type);
- } else {
- for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
- dma_addr_t addr = page_to_phys(mem->pages[i]);
- intel_private.driver->write_entry(addr,
- j, type);
- }
- readl(intel_private.gtt+j-1);
- }
+ } else
+ intel_gtt_insert_pages(pg_start, mem->page_count, mem->pages,
+ type);
out:
ret = 0;
@@ -995,11 +1002,21 @@ out_err:
return ret;
}
+void intel_gtt_clear_range(unsigned int first_entry, unsigned int num_entries)
+{
+ unsigned int i;
+
+ for (i = first_entry; i < (first_entry + num_entries); i++) {
+ intel_private.driver->write_entry(intel_private.scratch_page_dma,
+ i, 0);
+ }
+ readl(intel_private.gtt+i-1);
+}
+EXPORT_SYMBOL(intel_gtt_clear_range);
+
static int intel_fake_agp_remove_entries(struct agp_memory *mem,
off_t pg_start, int type)
{
- int i;
-
if (mem->page_count == 0)
return 0;
@@ -1009,14 +1026,13 @@ static int intel_fake_agp_remove_entries(struct agp_memory *mem,
return -EINVAL;
}
- if (USE_PCI_DMA_API && INTEL_GTT_GEN > 2)
- intel_agp_unmap_memory(mem);
-
- for (i = pg_start; i < (mem->page_count + pg_start); i++) {
- intel_private.driver->write_entry(intel_private.scratch_page_dma,
- i, 0);
+ if (intel_private.base.needs_dmar) {
+ intel_gtt_unmap_memory(mem->sg_list, mem->num_sg);
+ mem->sg_list = NULL;
+ mem->num_sg = 0;
}
- readl(intel_private.gtt+i-1);
+
+ intel_gtt_clear_range(pg_start, mem->page_count);
return 0;
}
diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h
index 80cbf1f..552b0d6 100644
--- a/include/drm/intel-gtt.h
+++ b/include/drm/intel-gtt.h
@@ -10,10 +10,22 @@ struct intel_gtt {
/* Part of the gtt that is mappable by the cpu, for those chips where
* this is not the full gtt. */
unsigned int gtt_mappable_entries;
+ /* Whether i915 needs to use the dmar apis or not. */
+ unsigned int needs_dmar : 1;
};
struct intel_gtt *intel_gtt_get(void);
void intel_gtt_chipset_flush(void);
+void intel_gtt_unmap_memory(struct scatterlist *sg_list, int num_sg);
+void intel_gtt_clear_range(unsigned int first_entry, unsigned int num_entries);
+int intel_gtt_map_memory(struct page **pages, unsigned int num_entries,
+ struct scatterlist **sg_list, int *num_sg);
+void intel_gtt_insert_sg_entries(struct scatterlist *sg_list,
+ unsigned int sg_len,
+ unsigned int pg_start,
+ unsigned int flags);
+void intel_gtt_insert_pages(unsigned int first_entry, unsigned int num_entries,
+ struct page **pages, unsigned int flags);
/* Special gtt memory types */
#define AGP_DCACHE_MEMORY 1
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 15/15] drm/i915: no more agp for gem
2010-11-06 14:21 [PATCH 00/15] The "no more agp" series Daniel Vetter
` (13 preceding siblings ...)
2010-11-06 14:22 ` [PATCH 14/15] intel-gtt: export api for drm/i915 Daniel Vetter
@ 2010-11-06 14:22 ` Daniel Vetter
2010-11-06 22:20 ` Chris Wilson
14 siblings, 1 reply; 19+ messages in thread
From: Daniel Vetter @ 2010-11-06 14:22 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Vetter
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/i915/i915_drv.h | 9 +++--
drivers/gpu/drm/i915/i915_gem_gtt.c | 63 ++++++++++++++++++++++++----------
2 files changed, 50 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index ce715ec..8f54327 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -788,12 +788,15 @@ struct drm_i915_gem_object {
unsigned int fault_mappable : 1;
unsigned int pin_mappable : 1;
- /** AGP memory structure for our GTT binding. */
- DRM_AGP_MEM *agp_mem;
-
struct page **pages;
/**
+ * DMAR support
+ */
+ struct scatterlist *sg_list;
+ int num_sg;
+
+ /**
* Current offset of the object in GTT space.
*
* This is the same as gtt_space->start
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index f78c15f..0b34a1a 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -33,15 +33,24 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv;
- int ret;
list_for_each_entry(obj_priv,
&dev_priv->mm.gtt_list,
gtt_list) {
- /* Hack to force agp to reinsert buffer object. */
- obj_priv->agp_mem->is_bound = false;
- ret = agp_bind_memory(obj_priv->agp_mem, obj_priv->gtt_space->start / PAGE_SIZE);
- BUG_ON(ret != 0);
+ if (dev_priv->mm.gtt->needs_dmar) {
+ BUG_ON(!obj_priv->sg_list);
+
+ intel_gtt_insert_sg_entries(obj_priv->sg_list,
+ obj_priv->num_sg,
+ obj_priv->gtt_space->start
+ >> PAGE_SHIFT,
+ obj_priv->agp_type);
+ } else
+ intel_gtt_insert_pages(obj_priv->gtt_space->start
+ >> PAGE_SHIFT,
+ obj_priv->base.size >> PAGE_SHIFT,
+ obj_priv->pages,
+ obj_priv->agp_type);
}
/* Be paranoid and flush the chipset cache. */
@@ -51,27 +60,43 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev)
int i915_gem_gtt_bind_object(struct drm_gem_object *obj)
{
struct drm_device *dev = obj->dev;
+ struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
+ int ret;
- /* Create an AGP memory structure pointing at our pages, and bind it
- * into the GTT.
- */
- obj_priv->agp_mem = drm_agp_bind_pages(dev,
- obj_priv->pages,
- obj->size >> PAGE_SHIFT,
- obj_priv->gtt_space->start,
- obj_priv->agp_type);
+ if (dev_priv->mm.gtt->needs_dmar) {
+ ret = intel_gtt_map_memory(obj_priv->pages,
+ obj->size >> PAGE_SHIFT,
+ &obj_priv->sg_list,
+ &obj_priv->num_sg);
+ if (ret != 0)
+ return ret;
+
+ intel_gtt_insert_sg_entries(obj_priv->sg_list, obj_priv->num_sg,
+ obj_priv->gtt_space->start
+ >> PAGE_SHIFT,
+ obj_priv->agp_type);
+ } else
+ intel_gtt_insert_pages(obj_priv->gtt_space->start >> PAGE_SHIFT,
+ obj->size >> PAGE_SHIFT,
+ obj_priv->pages,
+ obj_priv->agp_type);
- if (obj_priv->agp_mem)
- return 0;
- else
- return -ENOMEM;
+ return 0;
}
void i915_gem_gtt_unbind_object(struct drm_gem_object *obj)
{
+ struct drm_device *dev = obj->dev;
+ struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
- drm_unbind_agp(obj_priv->agp_mem);
- drm_free_agp(obj_priv->agp_mem, obj->size / PAGE_SIZE);
+ if (dev_priv->mm.gtt->needs_dmar) {
+ intel_gtt_unmap_memory(obj_priv->sg_list, obj_priv->num_sg);
+ obj_priv->sg_list = NULL;
+ obj_priv->num_sg = 0;
+ }
+
+ intel_gtt_clear_range(obj_priv->gtt_space->start >> PAGE_SHIFT,
+ obj->size >> PAGE_SHIFT);
}
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 15/15] drm/i915: no more agp for gem
2010-11-06 14:22 ` [PATCH 15/15] drm/i915: no more agp for gem Daniel Vetter
@ 2010-11-06 22:20 ` Chris Wilson
2010-11-07 10:20 ` Daniel Vetter
0 siblings, 1 reply; 19+ messages in thread
From: Chris Wilson @ 2010-11-06 22:20 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Vetter
Woohoo, we kill agp_memory. I'm in favour!
Do we need to keep the sg_table around, or can we just temporary allocate
it?
This fits nicely into my plans, i915_gem_gtt.c has been a candidate to
eliminate a few of the more expensive agp routines. Thanks, I'll look more
closely at the series next week and see if there are any immediate issues.
Do we have any other big items on the horizon? [The big one that I'm
trying to shape up at the moment is a custom address_space for GEM with a
wc-cache to eliminate the major overhead incurred with shmfs that currently
necessitates the userspace bo cache.] I'd like to finish making the merges
for -next in the next couple of weeks and focus on ensuring we've
identified (and preferably fixed) all regressions before handing it over
to Dave.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 15/15] drm/i915: no more agp for gem
2010-11-06 22:20 ` Chris Wilson
@ 2010-11-07 10:20 ` Daniel Vetter
2010-11-07 10:55 ` Chris Wilson
0 siblings, 1 reply; 19+ messages in thread
From: Daniel Vetter @ 2010-11-07 10:20 UTC (permalink / raw)
To: Chris Wilson; +Cc: Daniel Vetter, intel-gfx
On Sat, Nov 06, 2010 at 10:20:07PM +0000, Chris Wilson wrote:
> Woohoo, we kill agp_memory. I'm in favour!
>
> Do we need to keep the sg_table around, or can we just temporary allocate
> it?
I've strolled around in the pci_map implementation and it looks like we
need to hand in the same sg_table for unmap. Otherwise it'll get confused,
I think. But I haven't looked too closely.
Anyway, this whole sg_table thing is total overkill for garts. A mapping
api that simply takes struct page * and returns dma_addr_t would be much
better. With arrays for efficiency but the guarantee that we can unmap
individual pages in any order we like (for reuse in differently sized
objects). But that looks like a rather big project.
> This fits nicely into my plans, i915_gem_gtt.c has been a candidate to
> eliminate a few of the more expensive agp routines. Thanks, I'll look more
> closely at the series next week and see if there are any immediate issues.
Wrt future plans: My idea behind separating the dmar mapping and the gtt
pte writing was to be able to keep around the dmar mapping even when the
bo is not bound to the gtt. Together with a phys_memory domain to avoid
cflush on rebind, that should pretty much kill aperture trashing.
> Do we have any other big items on the horizon? [The big one that I'm
> trying to shape up at the moment is a custom address_space for GEM with a
> wc-cache to eliminate the major overhead incurred with shmfs that currently
> necessitates the userspace bo cache.] I'd like to finish making the merges
> for -next in the next couple of weeks and focus on ensuring we've
> identified (and preferably fixed) all regressions before handing it over
> to Dave.
I'm currently working on making drm_mm_node embeddable. If all goes well
this should only take about a week to get into shape (including i915
parts). This has some potential for ugly merge conflicts with your stuff
(due to a driver-wide s/obj_priv->gtt_space->bla/obj_priv->gtt_space.bla)
but I think we can work around that with some clever patch ordering.
Beyond that my plans are hazy. Probably just some low-impact cleanups (the
stuff I've mentioned plus perhaps a few things in intel_ringbuffer.c).
Wrt bugfixing I'm currently only annoyed by the pageflip flickering on
essenitally all machines, kde seems to be good a this :(. And the "dpms
standby kills my backlight" bug. Both of these look like hard problems, so
don't count on me fixing them ;)
-Daniel
--
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 15/15] drm/i915: no more agp for gem
2010-11-07 10:20 ` Daniel Vetter
@ 2010-11-07 10:55 ` Chris Wilson
0 siblings, 0 replies; 19+ messages in thread
From: Chris Wilson @ 2010-11-07 10:55 UTC (permalink / raw)
To: Daniel Vetter; +Cc: Daniel Vetter, intel-gfx
On Sun, 7 Nov 2010 11:20:26 +0100, Daniel Vetter <daniel@ffwll.ch> wrote:
> Wrt future plans: My idea behind separating the dmar mapping and the gtt
> pte writing was to be able to keep around the dmar mapping even when the
> bo is not bound to the gtt. Together with a phys_memory domain to avoid
> cflush on rebind, that should pretty much kill aperture trashing.
Lots of overlap with what I am attempting right now. I've just
approached the problem from top-down and looked at reusing dead-bo as
handles into GTT space. Keeping a page cache is essential to minimise
clflush on aperture thrashing, after that the rebind penalty is next on
the CPU profiles. The observation is that workloads tend to keep reusing
the same buffer sizes, and so we can get a very good hit rate from
keeping a deferred-free list and stealing the GTT space from those dead
bo. (Now the worst offender is scanning the deferred-free list for
victims, but a win overall.)
Approaching this from the bottom up, we can start tracking inactive bound
pages in the GTT manager, such that the rebind penalty can be avoided in
far more cases. Interesting...
For the time being, I'll keep on improving my understanding of the VM by
bugfixing my current page-stealer which (I believe) is fundamental to
transferring pages between the GTT and system/swap cheaply.
[And I may look at one or two bugs. ;-]
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2010-11-07 10:55 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-06 14:21 [PATCH 00/15] The "no more agp" series Daniel Vetter
2010-11-06 14:21 ` [PATCH 01/15] intel-gtt: drop dcache support for i830 and later Daniel Vetter
2010-11-06 14:21 ` [PATCH 02/15] intel-gtt: kill unneeded sandybridge memory types Daniel Vetter
2010-11-06 14:21 ` [PATCH 03/15] intel-gtt: switch i81x to the write_entry helpers Daniel Vetter
2010-11-06 14:21 ` [PATCH 04/15] intel-gtt: switch i81x to the common initialization helpers Daniel Vetter
2010-11-06 14:21 ` [PATCH 05/15] intel-gtt: fold i81x-only dcache support into the generic driver Daniel Vetter
2010-11-06 14:21 ` [PATCH 06/15] drm/i915|intel-gtt: consolidate intel-gtt.h headers Daniel Vetter
2010-11-06 14:22 ` [PATCH 07/15] drm/i915/gtt: call chipset flush directly Daniel Vetter
2010-11-06 14:22 ` [PATCH 08/15] drm: kill drm_agp_chipset_flush Daniel Vetter
2010-11-06 14:22 ` [PATCH 09/15] agp: kill agp_flush_chipset and corresponding ioctl Daniel Vetter
2010-11-06 14:22 ` [PATCH 10/15] drm/i915: track objects in the gtt Daniel Vetter
2010-11-06 14:22 ` [PATCH 11/15] drm/i915: restore gtt on resume in the drm instead of in intel-gtt.ko Daniel Vetter
2010-11-06 14:22 ` [PATCH 12/15] agp: kill agp_rebind_memory Daniel Vetter
2010-11-06 14:22 ` [PATCH 13/15] drm/i915: move gtt handling to i915_gem_gtt.c Daniel Vetter
2010-11-06 14:22 ` [PATCH 14/15] intel-gtt: export api for drm/i915 Daniel Vetter
2010-11-06 14:22 ` [PATCH 15/15] drm/i915: no more agp for gem Daniel Vetter
2010-11-06 22:20 ` Chris Wilson
2010-11-07 10:20 ` Daniel Vetter
2010-11-07 10:55 ` Chris Wilson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox