The "no more agp" series
Subsystems (4)
cover The "no more agp" series
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
PATCH 1/15 intel-gtt: drop dcache support for i830 and later
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.
--- drivers/char/agp/intel-gtt.c | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-)
drivers/char/agp/intel-gtt.c +1 -7
@@ -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); }
Signature · 1 line
1.7.1
PATCH 2/15 intel-gtt: kill unneeded sandybridge memory types
In reply to Daniel VetterUsed for the now dead agp type_to_mask stuff.
--- drivers/char/agp/intel-gtt.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
drivers/char/agp/intel-gtt.c +0 -6
@@ -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 ;
Signature · 1 line
1.7.1
PATCH 3/15 intel-gtt: switch i81x to the write_entry helpers
In reply to Daniel VetterInitialization is still done with the old code with a few added things sprinkled in to make the intel_fake_agp helper functions work.
--- drivers/char/agp/intel-gtt.c | 152 +++++++++++++++++------------------------- 1 files changed, 60 insertions(+), 92 deletions(-)
drivers/char/agp/intel-gtt.c +60 -92
@@ -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 ; }
Signature · 1 line
1.7.1
PATCH 4/15 intel-gtt: switch i81x to the common initialization helpers
In reply to Daniel VetterStill a separate agp_bridge_driver because of the i81x-only dedicated vram support.
--- drivers/char/agp/intel-gtt.c | 197 +++++++++++++++--------------------------- 1 files changed, 71 insertions(+), 126 deletions(-)
drivers/char/agp/intel-gtt.c +71 -126
@@ -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 ;
Signature · 1 line
1.7.1
PATCH 5/15 intel-gtt: fold i81x-only dcache support into the generic driver
In reply to Daniel VetterNow the intel-gtt.c rewrite is complete!
--- drivers/char/agp/intel-gtt.c | 150 +++++++++++++++++------------------------- 1 files changed, 61 insertions(+), 89 deletions(-)
drivers/char/agp/intel-gtt.c +61 -89
@@ -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;
Signature · 1 line
1.7.1
PATCH 6/15 drm/i915|intel-gtt: consolidate intel-gtt.h headers
In reply to Daniel Vetter... and a few other defines.
--- 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
drivers/char/agp/intel-gtt.c +0 -5
@@ -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 ;
drivers/gpu/drm/i915/i915_gem.c +0 -1
@@ -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;
include/drm/intel-gtt.h +12 -0
@@ -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
include/linux/intel-gtt.h deleted +0 -20
@@ -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
Signature · 1 line
1.7.1
PATCH 7/15 drm/i915/gtt: call chipset flush directly
In reply to Daniel Vetter--- 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(-)
drivers/char/agp/intel-gtt.c +7 -0
@@ -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)
drivers/gpu/drm/i915/i915_gem.c +4 -5
@@ -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 ; }
include/drm/intel-gtt.h +1 -1
@@ -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
Signature · 1 line
1.7.1
PATCH 8/15 drm: kill drm_agp_chipset_flush
In reply to Daniel VetterNo longer used.
--- drivers/gpu/drm/drm_agpsupport.c | 6 ------ include/drm/drmP.h | 1 - 2 files changed, 0 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_agpsupport.c +0 -6
@@ -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 */
include/drm/drmP.h +0 -1
@@ -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,
Signature · 1 line
1.7.1
PATCH 9/15 agp: kill agp_flush_chipset and corresponding ioctl
In reply to Daniel VetterThe intel drm calls the chipset functions now directly. Userspace never called the corresponding ioctl, hence it can be killed, too.
--- 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(-)
drivers/char/agp/agp.h +0 -1
@@ -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 {
drivers/char/agp/compat_ioctl.c +0 -1
@@ -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 ; }
drivers/char/agp/compat_ioctl.h +0 -1
@@ -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 */
drivers/char/agp/frontend.c +0 -8
@@ -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 ; }
drivers/char/agp/generic.c +0 -7
@@ -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
drivers/char/agp/intel-gtt.c +0 -6
@@ -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 = {
include/linux/agp_backend.h +0 -1
@@ -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 */
Signature · 1 line
1.7.1
PATCH 10/15 drm/i915: track objects in the gtt
In reply to Daniel VetterThis 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.
--- drivers/gpu/drm/i915/i915_drv.h | 4 ++++ drivers/gpu/drm/i915/i915_gem.c | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +4 -0
@@ -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;
drivers/gpu/drm/i915/i915_gem.c +4 -0
@@ -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);
Signature · 1 line
1.7.1
PATCH 11/15 drm/i915: restore gtt on resume in the drm instead of in intel-gtt.ko
In reply to Daniel VetterThis 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.
--- 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
drivers/char/agp/intel-agp.c +0 -5
@@ -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
drivers/gpu/drm/i915/Makefile +1 -0
@@ -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 \
drivers/gpu/drm/i915/i915_drv.c +1 -0
@@ -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);
drivers/gpu/drm/i915/i915_drv.h +3 -0
@@ -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);
drivers/gpu/drm/i915/i915_gem_gtt.c new file +49 -0
49 lines not on this page · raw message
Signature · 1 line
1.7.1
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 12/15 agp: kill agp_rebind_memory
In reply to Daniel VetterIts only user, intel-gtt.c is now gone.
--- drivers/char/agp/generic.c | 20 -------------------- include/linux/agp_backend.h | 1 - 2 files changed, 0 insertions(+), 21 deletions(-)
drivers/char/agp/generic.c +0 -20
@@ -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 */
include/linux/agp_backend.h +0 -1
@@ -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 *);
Signature · 1 line
1.7.1
PATCH 13/15 drm/i915: move gtt handling to i915_gem_gtt.c
In reply to Daniel VetterNo more drm_*_agp in i915_gem.c!
--- 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(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -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,
drivers/gpu/drm/i915/i915_gem.c +3 -11
@@ -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 ;
drivers/gpu/drm/i915/i915_gem_gtt.c +28 -0
@@ -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 ); +}
Signature · 1 line
1.7.1
PATCH 14/15 intel-gtt: export api for drm/i915
In reply to Daniel VetterJust some minor shuffling to get rid of any agp traces in the exported functions.
--- drivers/char/agp/intel-gtt.c | 120 ++++++++++++++++++++++++------------------ include/drm/intel-gtt.h | 12 ++++ 2 files changed, 80 insertions(+), 52 deletions(-)
drivers/char/agp/intel-gtt.c +68 -52
@@ -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 ; }
include/drm/intel-gtt.h +12 -0
@@ -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
Signature · 1 line
1.7.1
PATCH 15/15 drm/i915: no more agp for gem
In reply to Daniel Vetter--- drivers/gpu/drm/i915/i915_drv.h | 9 +++-- drivers/gpu/drm/i915/i915_gem_gtt.c | 63 ++++++++++++++++++++++++---------- 2 files changed, 50 insertions(+), 22 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +6 -3
@@ -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
drivers/gpu/drm/i915/i915_gem_gtt.c +44 -19
86 lines not on this page · raw message
Signature · 1 line
1.7.1
Re: [PATCH 15/15] drm/i915: no more agp for gem
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
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 15/15] drm/i915: no more agp for gem
Quoted 4 lines · Chris Wilson
Woohoo, we kill
agp_memory. I'm in favour!Do we need to keep the
sg_tablearound, 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.
Quoted 3 lines
This fits nicely into my plans,
i915_gem_gtt.chas 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.
Quoted 7 lines
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_spacefor 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
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
Re: [PATCH 15/15] drm/i915: no more agp for gem
Quoted 4 lines · Daniel Vetter
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_memorydomain 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
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre