Skip to contentSkip to conversation

drm/exynos: fix gem buffer allocation type checking

PATCH In review Inki Dae 2 participants 3 messages Dec 27, 2012

Subsystems (3)
lore
Share & tools
lore

Inki Dae

author maintainer
#0 lore raw

PATCH 1/1 drm/exynos: fix gem buffer allocation type checking

This patch fixes gem buffer allocation type checking. EXYNOS_BO_CONTIG has 0 so the checking should be fixed to 'if (!(flags & EXYNOS_BO_NONCONTIG))'

---
 drivers/gpu/drm/exynos/exynos_drm_buf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_buf.c +1 -1
index 74592d1..911f7fd 100644
@@ -38,7 +38,7 @@ static int lowlevel_buffer_allocate(struct drm_device *dev,
 	 * region will be allocated else physically contiguous
 	 * as possible.
 	 */
-	if (flags & EXYNOS_BO_CONTIG)
+	if (!(flags & EXYNOS_BO_NONCONTIG))
 		dma_set_attr(DMA_ATTR_FORCE_CONTIGUOUS, &buf->dma_attrs);
 
 	/*
Signature · 1 line
1.7.4.1
#1 lore raw
Quoted 17 lines · Inki Dae

This patch fixes gem buffer allocation type checking. EXYNOS_BO_CONTIG has 0 so the checking should be fixed to 'if (!(flags & EXYNOS_BO_NONCONTIG))'

---
 drivers/gpu/drm/exynos/exynos_drm_buf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_buf.c +0 -0
index 74592d1..911f7fd 100644

drivers/gpu/drm/exynos/exynos_drm_buf.c static int lowlevel_buffer_allocate(struct drm_device · line 44

Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_buf.c +1 -1
@@ -38,7 +38,7 @@ static int lowlevel_buffer_allocate(struct drm_device
 *dev,
         * region will be allocated else physically contiguous
         * as possible.
         */
-       if (flags & EXYNOS_BO_CONTIG)
+       if (!(flags & EXYNOS_BO_NONCONTIG))
                dma_set_attr(DMA_ATTR_FORCE_CONTIGUOUS, &buf->dma_attrs);
 

Hi Mr. Dae,

If iommu is supported, we would have called arm_iommu_attach_device. So dma_alloc_attrs will always call arm_iommu_alloc_attrs.

If iommu is not supported, dma_alloc_attrs will call arm_dma_alloc which will
anyway allocate a contiguous buffer if possible.

With this code, we are forcing the root framebuffer (fbdev) to be contiguous since fbdev
allocation does not pass noncontig flag.

Why do we need to force the allocation of a contiguous buffer when iommu is supported?

Regards,
Prathyush

Quoted 9 lines
        /*

--
1.7.4.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#2 lore raw

2012/12/27 Prathyush K <[email protected]>

Quoted 35 lines · Inki Dae
Quoted 18 lines

This patch fixes gem buffer allocation type checking. EXYNOS_BO_CONTIG has 0 so the checking should be fixed to 'if (!(flags & EXYNOS_BO_NONCONTIG))'

---
 drivers/gpu/drm/exynos/exynos_drm_buf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_buf.c +0 -0
index 74592d1..911f7fd 100644

drivers/gpu/drm/exynos/exynos_drm_buf.c static int lowlevel_buffer_allocate(struct drm_device · line 44

Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_buf.c +1 -1
@@ -38,7 +38,7 @@ static int lowlevel_buffer_allocate(struct drm_device
 *dev,
         * region will be allocated else physically contiguous
         * as possible.
         */
-       if (flags & EXYNOS_BO_CONTIG)
+       if (!(flags & EXYNOS_BO_NONCONTIG))
                dma_set_attr(DMA_ATTR_FORCE_CONTIGUOUS, &buf->dma_attrs);
 

Hi Mr. Dae,

If iommu is supported, we would have called arm_iommu_attach_device. So dma_alloc_attrs will always call arm_iommu_alloc_attrs.

Quoted 9 lines

If iommu is not supported, dma_alloc_attrs will call arm_dma_alloc which will
anyway allocate a contiguous buffer if possible.

With this code, we are forcing the root framebuffer (fbdev) to be contiguous since fbdev
allocation does not pass noncontig flag.

we could use noncontig flag simply like below,

          if (iommu is supported)
                  exynos_drm_gem_create(dev, EXYNOS_BO_NONCONTIG, size);
          else
                  exynos_drm_gem_create(dev, EXYNOS_BO_CONTIG, size);
Quoted 4 lines

Why do we need to force the allocation of a contiguous buffer when iommu is supported?

Simply saying, the reason is that we want to pass boot logo drew by boot loader without iommu to kernel side without memory copy.

Quoted 15 lines

Regards,
Prathyush

Quoted 9 lines
        /*

--
1.7.4.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Quoted 6 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel