aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2016-04-21 07:52:38 -0400
committerLucas Stach <l.stach@pengutronix.de>2016-04-21 09:08:54 -0400
commit2144fff7df8e76654fa72b0a9d2324ce2e0c8a5c (patch)
tree75db331b1843f6b894188eb47bdb235e93a50fdd /drivers/gpu/drm
parentc3b46c73264b03000d1e18b22f5caf63332547c9 (diff)
drm/etnaviv: don't move linear memory window on 3D cores without MC2.0
On cores with MC1.0 the memory window offset is not properly respected by all engines in the core, leading to different views of the memory if the offset in non-zero. This causes relocs for those engines to be wrong and might lead to other subtile problems. Rather than trying to work around this, just disable the linear memory window offset for those cores. Suggested-by: Russell King <linux@arm.linux.org.uk> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gpu.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 09198d0b5814..306dde18a94a 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -572,6 +572,24 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
572 goto fail; 572 goto fail;
573 } 573 }
574 574
575 /*
576 * Set the GPU linear window to be at the end of the DMA window, where
577 * the CMA area is likely to reside. This ensures that we are able to
578 * map the command buffers while having the linear window overlap as
579 * much RAM as possible, so we can optimize mappings for other buffers.
580 *
581 * For 3D cores only do this if MC2.0 is present, as with MC1.0 it leads
582 * to different views of the memory on the individual engines.
583 */
584 if (!(gpu->identity.features & chipFeatures_PIPE_3D) ||
585 (gpu->identity.minor_features0 & chipMinorFeatures0_MC20)) {
586 u32 dma_mask = (u32)dma_get_required_mask(gpu->dev);
587 if (dma_mask < PHYS_OFFSET + SZ_2G)
588 gpu->memory_base = PHYS_OFFSET;
589 else
590 gpu->memory_base = dma_mask - SZ_2G + 1;
591 }
592
575 ret = etnaviv_hw_reset(gpu); 593 ret = etnaviv_hw_reset(gpu);
576 if (ret) 594 if (ret)
577 goto fail; 595 goto fail;
@@ -1566,7 +1584,6 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev)
1566{ 1584{
1567 struct device *dev = &pdev->dev; 1585 struct device *dev = &pdev->dev;
1568 struct etnaviv_gpu *gpu; 1586 struct etnaviv_gpu *gpu;
1569 u32 dma_mask;
1570 int err = 0; 1587 int err = 0;
1571 1588
1572 gpu = devm_kzalloc(dev, sizeof(*gpu), GFP_KERNEL); 1589 gpu = devm_kzalloc(dev, sizeof(*gpu), GFP_KERNEL);
@@ -1576,18 +1593,6 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev)
1576 gpu->dev = &pdev->dev; 1593 gpu->dev = &pdev->dev;
1577 mutex_init(&gpu->lock); 1594 mutex_init(&gpu->lock);
1578 1595
1579 /*
1580 * Set the GPU linear window to be at the end of the DMA window, where
1581 * the CMA area is likely to reside. This ensures that we are able to
1582 * map the command buffers while having the linear window overlap as
1583 * much RAM as possible, so we can optimize mappings for other buffers.
1584 */
1585 dma_mask = (u32)dma_get_required_mask(dev);
1586 if (dma_mask < PHYS_OFFSET + SZ_2G)
1587 gpu->memory_base = PHYS_OFFSET;
1588 else
1589 gpu->memory_base = dma_mask - SZ_2G + 1;
1590
1591 /* Map registers: */ 1596 /* Map registers: */
1592 gpu->mmio = etnaviv_ioremap(pdev, NULL, dev_name(gpu->dev)); 1597 gpu->mmio = etnaviv_ioremap(pdev, NULL, dev_name(gpu->dev));
1593 if (IS_ERR(gpu->mmio)) 1598 if (IS_ERR(gpu->mmio))