drm/exynos: allocate non-contigous buffers when iommu is enabled
Subsystems (3)
PATCH 1/1 drm/exynos: allocate non-contigous buffers when iommu is enabled
From: Rahul Sharma <[email protected]>
Allow to allocate non-contigous buffers when iommu is enabled. Currently, it tries to allocates contigous buffer which consistently fail for large buffers and then fall back to non contigous. Apart from being slow, this implementation is also very noisy and fills the screen with alloc fail logs.
--- drivers/gpu/drm/exynos/exynos_drm_gem.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_gem.c +10 -12
@@ -624,22 +624,20 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, args->pitch = args->width * ((args->bpp +7 ) /8 ); args->size = args->pitch * args->height; - exynos_gem_obj =exynos_drm_gem_create (dev,EXYNOS_BO_CONTIG | -EXYNOS_BO_WC , args->size); -/* -* If physically contiguous memory allocation fails and if IOMMU is -* supported then try to get buffer from non physically contiguous -* memory area. -*/ -if (IS_ERR (exynos_gem_obj) &&is_drm_iommu_supported (dev)) { -dev_warn (dev->dev,"contiguous FB allocation failed, falling back to non-contiguous\n" ); +if (is_drm_iommu_supported (dev)) { + exynos_gem_obj =exynos_drm_gem_create (dev, +EXYNOS_BO_NONCONTIG |EXYNOS_BO_WC , + args->size); + }else { exynos_gem_obj =exynos_drm_gem_create (dev, -EXYNOS_BO_NONCONTIG |EXYNOS_BO_WC , - args->size); +EXYNOS_BO_CONTIG |EXYNOS_BO_WC , + args->size); } -if (IS_ERR (exynos_gem_obj)) +if (IS_ERR (exynos_gem_obj)) { +dev_warn (dev->dev,"FB allocation failed.\n" );return PTR_ERR (exynos_gem_obj); + } ret =exynos_drm_gem_handle_create (&exynos_gem_obj->base, file_priv, &args->handle);
Signature · 1 line
1.7.9.5
Hi Inki,
The below fix doesn't affect the FB dev buffer allocation. IMO the scenario where u-boot allocates the buffer is not disturbed.
Please review the implementation.
Regards,
Rahul Sharma.
Quoted 54 lines · Rahul Sharma
From: Rahul Sharma <[email protected]>
Allow to allocate non-contigous buffers when iommu is enabled. Currently, it tries to allocates contigous buffer which consistently fail for large buffers and then fall back to non contigous. Apart from being slow, this implementation is also very noisy and fills the screen with alloc fail logs.
Change-Id I523e95aa308122ed2edc55e065ae6eb8be996541Signed-off-by Rahul Sharma <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_gem.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)drivers/gpu/drm/exynos/exynos_drm_gem.c +10
-13@@ -624,22 +624,20 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, args->pitch = args->width * ((args->bpp +7 ) /8 ); args->size = args->pitch * args->height; - exynos_gem_obj =exynos_drm_gem_create (dev,EXYNOS_BO_CONTIG | -EXYNOS_BO_WC , args->size); -/* -* If physically contiguous memory allocation fails and if IOMMU is -* supported then try to get buffer from non physically contiguous -* memory area. -*/ -if (IS_ERR (exynos_gem_obj) &&is_drm_iommu_supported (dev)) { -dev_warn (dev->dev,"contiguous FB allocation failed, falling back to non-contiguous\n" ); +if (is_drm_iommu_supported (dev)) { + exynos_gem_obj =exynos_drm_gem_create (dev, +EXYNOS_BO_NONCONTIG |EXYNOS_BO_WC , + args->size); + }else { exynos_gem_obj =exynos_drm_gem_create (dev, -EXYNOS_BO_NONCONTIG |EXYNOS_BO_WC , - args->size); +EXYNOS_BO_CONTIG |EXYNOS_BO_WC , + args->size); } -if (IS_ERR (exynos_gem_obj)) +if (IS_ERR (exynos_gem_obj)) { +dev_warn (dev->dev,"FB allocation failed.\n" );return PTR_ERR (exynos_gem_obj); + } ret =exynos_drm_gem_handle_create (&exynos_gem_obj->base, file_priv, &args->handle); --1.7.9.5
Quoted 6 lines · Rahul Sharma
Hi Inki,
The below fix doesn't affect the FB dev buffer allocation. IMO the scenario where u-boot allocates the buffer is not disturbed.
Please review the implementation.
Applied.
Thanks,
Inki Dae
Quoted 59 lines
Regards,
Rahul Sharma.Quoted 54 lines · Rahul Sharma
From: Rahul Sharma <[email protected]>
Allow to allocate non-contigous buffers when iommu is enabled. Currently, it tries to allocates contigous buffer which consistently fail for large buffers and then fall back to non contigous. Apart from being slow, this implementation is also very noisy and fills the screen with alloc fail logs.
Change-Id I523e95aa308122ed2edc55e065ae6eb8be996541Signed-off-by Rahul Sharma <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_gem.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)drivers/gpu/drm/exynos/exynos_drm_gem.c +10
-13@@ -624,22 +624,20 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, args->pitch = args->width * ((args->bpp +7 ) /8 ); args->size = args->pitch * args->height; - exynos_gem_obj =exynos_drm_gem_create (dev,EXYNOS_BO_CONTIG | -EXYNOS_BO_WC , args->size); -/* -* If physically contiguous memory allocation fails and if IOMMU is -* supported then try to get buffer from non physically contiguous -* memory area. -*/ -if (IS_ERR (exynos_gem_obj) &&is_drm_iommu_supported (dev)) { -dev_warn (dev->dev,"contiguous FB allocation failed, falling back to non-contiguous\n" ); +if (is_drm_iommu_supported (dev)) { + exynos_gem_obj =exynos_drm_gem_create (dev, +EXYNOS_BO_NONCONTIG |EXYNOS_BO_WC , + args->size); + }else { exynos_gem_obj =exynos_drm_gem_create (dev, -EXYNOS_BO_NONCONTIG |EXYNOS_BO_WC , - args->size); +EXYNOS_BO_CONTIG |EXYNOS_BO_WC , + args->size); } -if (IS_ERR (exynos_gem_obj)) +if (IS_ERR (exynos_gem_obj)) { +dev_warn (dev->dev,"FB allocation failed.\n" );return PTR_ERR (exynos_gem_obj); + } ret =exynos_drm_gem_handle_create (&exynos_gem_obj->base, file_priv, &args->handle); --1.7.9.5
Hi Rahul,
Quoted 9 lines · Rahul Sharma
From: Rahul Sharma <[email protected]>
Allow to allocate non-contigous buffers when iommu is enabled. Currently, it tries to allocates contigous buffer which consistently fail for large buffers and then fall back to non contigous. Apart from being slow, this implementation is also very noisy and fills the screen with alloc fail logs.
Change-Id: I523e95aa308122ed2edc55e065ae6eb8be996541
Not needed.
Quoted 10 lines
Signed-off-by Rahul Sharma <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_gem.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)drivers/gpu/drm/exynos/exynos_drm_gem.c +0
-0
drivers/gpu/drm/exynos/exynos_drm_gem.c int exynos_drm_gem_dumb_create(struct drm_file *file_priv, · line 633
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_gem.c +0
-7@@ -624,22 +624,20 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, args->pitch = args->width * ((args->bpp +7 ) /8 ); args->size = args->pitch * args->height; - exynos_gem_obj =exynos_drm_gem_create (dev,EXYNOS_BO_CONTIG | -EXYNOS_BO_WC , args->size); -/* -* If physically contiguous memory allocation fails and if IOMMU is -* supported then try to get buffer from non physically contiguous -* memory area. -*/
This comment could be retained after suitable modification to reflect current logic.
Quoted 23 lines
drivers/gpu/drm/exynos/exynos_drm_gem.c +10
-6-if (IS_ERR (exynos_gem_obj) &&is_drm_iommu_supported (dev)) { -dev_warn (dev->dev,"contiguous FB allocation failed, falling back to non-contiguous\n" ); +if (is_drm_iommu_supported (dev)) { + exynos_gem_obj =exynos_drm_gem_create (dev, +EXYNOS_BO_NONCONTIG |EXYNOS_BO_WC , + args->size); + }else { exynos_gem_obj =exynos_drm_gem_create (dev, -EXYNOS_BO_NONCONTIG |EXYNOS_BO_WC , - args->size); +EXYNOS_BO_CONTIG |EXYNOS_BO_WC , + args->size); } -if (IS_ERR (exynos_gem_obj)) +if (IS_ERR (exynos_gem_obj)) { +dev_warn (dev->dev,"FB allocation failed.\n" );return PTR_ERR (exynos_gem_obj); + } ret =exynos_drm_gem_handle_create (&exynos_gem_obj->base, file_priv, &args->handle); --
Quoted 1 line
1.7.9.5
Otherwise looks good.
Signature · 2 lines
With warm regards, Sachin
Thanks Sachin.
Quoted 28 lines · Sachin Kamat
Hi Rahul,
Quoted 9 lines · Rahul Sharma
From: Rahul Sharma <[email protected]>
Allow to allocate non-contigous buffers when iommu is enabled. Currently, it tries to allocates contigous buffer which consistently fail for large buffers and then fall back to non contigous. Apart from being slow, this implementation is also very noisy and fills the screen with alloc fail logs.
Change-Id: I523e95aa308122ed2edc55e065ae6eb8be996541
Not needed.
Quoted 13 lines
Signed-off-by Rahul Sharma <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_gem.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)drivers/gpu/drm/exynos/exynos_drm_gem.c +0
-0@@ -624,22 +624,20 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, args->pitch = args->width * ((args->bpp +7 ) /8 ); args->size = args->pitch * args->height;
Quoted 11 lines
drivers/gpu/drm/exynos/exynos_drm_gem.c int exynos_drm_gem_dumb_create(struct drm_file *file_priv, · line 633
Quoted 7 lines
drivers/gpu/drm/exynos/exynos_drm_gem.c +0
-7- exynos_gem_obj =exynos_drm_gem_create (dev,EXYNOS_BO_CONTIG | -EXYNOS_BO_WC , args->size); -/* -* If physically contiguous memory allocation fails and if IOMMU is -* supported then try to get buffer from non physically contiguous -* memory area. -*/ This comment could be retained after suitable modification to reflect current logic.
ok. Posting V2.
Regards,
Rahul Sharma
Quoted 31 lines
Quoted 23 lines
drivers/gpu/drm/exynos/exynos_drm_gem.c +10
-6-if (IS_ERR (exynos_gem_obj) &&is_drm_iommu_supported (dev)) { -dev_warn (dev->dev,"contiguous FB allocation failed, falling back to non-contiguous\n" ); +if (is_drm_iommu_supported (dev)) { + exynos_gem_obj =exynos_drm_gem_create (dev, +EXYNOS_BO_NONCONTIG |EXYNOS_BO_WC , + args->size); + }else { exynos_gem_obj =exynos_drm_gem_create (dev, -EXYNOS_BO_NONCONTIG |EXYNOS_BO_WC , - args->size); +EXYNOS_BO_CONTIG |EXYNOS_BO_WC , + args->size); } -if (IS_ERR (exynos_gem_obj)) +if (IS_ERR (exynos_gem_obj)) { +dev_warn (dev->dev,"FB allocation failed.\n" );return PTR_ERR (exynos_gem_obj); + } ret =exynos_drm_gem_handle_create (&exynos_gem_obj->base, file_priv, &args->handle); --Quoted 1 line
1.7.9.5
Otherwise looks good.
Reviewed-by Sachin Kamat <[email protected]>--
With warm regards,
Sachin