From: Russell King <rmk+ker...@arm.linux.org.uk>

Running the cairo trace "firefox-36-20090609" results in the Xorg server
trying to queue up 319M of buffer objects in a single commit (due to the
number of drawing operations that will fit into a 32K command buffer.)
This causes the commit ioctl to return -ENOSPC as the MMU is unable to
map all these buffer objects simultaneously.

There are three workarounds possible:
- Increase the GPU MMU table size
- Decrease the command buffer size
- Implement reconstruction of the command buffer on -ENOSPC return

All three should be implemented, but the first is only applicable to the
kernel.

Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
---
 drivers/staging/etnaviv/etnaviv_iommu.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/etnaviv/etnaviv_iommu.c 
b/drivers/staging/etnaviv/etnaviv_iommu.c
index 73ba65205705..9efb7d6092b4 100644
--- a/drivers/staging/etnaviv/etnaviv_iommu.c
+++ b/drivers/staging/etnaviv/etnaviv_iommu.c
@@ -25,7 +25,7 @@
 #include "etnaviv_iommu.h"
 #include "state_hi.xml.h"

-#define PT_SIZE                SZ_512K
+#define PT_SIZE                SZ_2M
 #define PT_ENTRIES     (PT_SIZE / sizeof(u32))

 #define GPU_MEM_START  0x80000000
@@ -88,7 +88,7 @@ static void pgtable_write(struct etnaviv_iommu_domain_pgtable 
*pgtable,

 static int __etnaviv_iommu_init(struct etnaviv_iommu_domain *etnaviv_domain)
 {
-       u32 iova, *p;
+       u32 *p;
        int ret, i;

        etnaviv_domain->bad_page_cpu = dma_alloc_coherent(etnaviv_domain->dev,
@@ -110,11 +110,9 @@ static int __etnaviv_iommu_init(struct 
etnaviv_iommu_domain *etnaviv_domain)
                return ret;
        }

-       for (iova = etnaviv_domain->domain.geometry.aperture_start;
-            iova < etnaviv_domain->domain.geometry.aperture_end; iova += 
SZ_4K) {
-               pgtable_write(&etnaviv_domain->pgtable, iova,
-                             etnaviv_domain->bad_page_dma);
-       }
+       for (i = 0; i < PT_ENTRIES; i++)
+               etnaviv_domain->pgtable.pgtable[i] =
+                       etnaviv_domain->bad_page_dma;

        spin_lock_init(&etnaviv_domain->map_lock);

-- 
2.5.1

Reply via email to