* [RFC][PATCH] drm/prime: fixed to allocate sg table considering contiguous pages
@ 2013-04-26 8:48 Seung-Woo Kim
2013-04-26 9:14 ` Rahul Sharma
0 siblings, 1 reply; 3+ messages in thread
From: Seung-Woo Kim @ 2013-04-26 8:48 UTC (permalink / raw)
To: dri-devel, airlied; +Cc: sw0312.kim
Allocating scatter table with sg_alloc_table() does not consider
contiguous pages. Because sg_alloc_table_from_pages() merges
contigous pages into a signle scatter entry, this patch fixes to
allocate scatter table with it from drm_prime_pages_to_sg().
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
---
drivers/gpu/drm/drm_prime.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index 366910d..8c098a3 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -401,21 +401,17 @@ int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages)
{
struct sg_table *sg = NULL;
- struct scatterlist *iter;
- int i;
int ret;
sg = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
if (!sg)
goto out;
- ret = sg_alloc_table(sg, nr_pages, GFP_KERNEL);
+ ret = sg_alloc_table_from_pages(sg, pages, nr_pages,
+ 0, PAGE_SIZE * nr_pages, GFP_KERNEL);
if (ret)
goto out;
- for_each_sg(sg->sgl, iter, nr_pages, i)
- sg_set_page(iter, pages[i], PAGE_SIZE, 0);
-
return sg;
out:
kfree(sg);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC][PATCH] drm/prime: fixed to allocate sg table considering contiguous pages
2013-04-26 8:48 [RFC][PATCH] drm/prime: fixed to allocate sg table considering contiguous pages Seung-Woo Kim
@ 2013-04-26 9:14 ` Rahul Sharma
2013-04-29 2:16 ` 김승우
0 siblings, 1 reply; 3+ messages in thread
From: Rahul Sharma @ 2013-04-26 9:14 UTC (permalink / raw)
To: Seung-Woo Kim; +Cc: dri-devel@lists.freedesktop.org
[-- Attachment #1.1: Type: text/plain, Size: 1935 bytes --]
Hi Seung Woo,
I had posted the same solution at
http://lists.freedesktop.org/archives/dri-devel/2013-January/034119.html.
This has been pulled in drm-intel-next.
regards,
Rahul Sharma.
On Fri, Apr 26, 2013 at 2:18 PM, Seung-Woo Kim <sw0312.kim@samsung.com>wrote:
> Allocating scatter table with sg_alloc_table() does not consider
> contiguous pages. Because sg_alloc_table_from_pages() merges
> contigous pages into a signle scatter entry, this patch fixes to
> allocate scatter table with it from drm_prime_pages_to_sg().
>
> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
> ---
> drivers/gpu/drm/drm_prime.c | 8 ++------
> 1 files changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> index 366910d..8c098a3 100644
> --- a/drivers/gpu/drm/drm_prime.c
> +++ b/drivers/gpu/drm/drm_prime.c
> @@ -401,21 +401,17 @@ int drm_prime_fd_to_handle_ioctl(struct drm_device
> *dev, void *data,
> struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages)
> {
> struct sg_table *sg = NULL;
> - struct scatterlist *iter;
> - int i;
> int ret;
>
> sg = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
> if (!sg)
> goto out;
>
> - ret = sg_alloc_table(sg, nr_pages, GFP_KERNEL);
> + ret = sg_alloc_table_from_pages(sg, pages, nr_pages,
> + 0, PAGE_SIZE * nr_pages, GFP_KERNEL);
> if (ret)
> goto out;
>
> - for_each_sg(sg->sgl, iter, nr_pages, i)
> - sg_set_page(iter, pages[i], PAGE_SIZE, 0);
> -
> return sg;
> out:
> kfree(sg);
> --
> 1.7.4.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
--
Regards,
Rahul Sharma,
email to: rahul.sharma@samsung.com
Samsung India.
[-- Attachment #1.2: Type: text/html, Size: 2934 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC][PATCH] drm/prime: fixed to allocate sg table considering contiguous pages
2013-04-26 9:14 ` Rahul Sharma
@ 2013-04-29 2:16 ` 김승우
0 siblings, 0 replies; 3+ messages in thread
From: 김승우 @ 2013-04-29 2:16 UTC (permalink / raw)
To: Rahul Sharma; +Cc: sw0312.kim, dri-devel@lists.freedesktop.org
Hello Rahul,
Thanks for notifying.
As your comment, it is same patch with yours, so just ignore my patch.
Besg Regards,
- Seung-Woo Kim
On 2013년 04월 26일 18:14, Rahul Sharma wrote:
> Hi Seung Woo,
>
> I had posted the same solution at
> http://lists.freedesktop.org/archives/dri-devel/2013-January/034119.html.
> This has been pulled in drm-intel-next.
>
> regards,
> Rahul Sharma.
>
>
>
> On Fri, Apr 26, 2013 at 2:18 PM, Seung-Woo Kim <sw0312.kim@samsung.com>wrote:
>
>> Allocating scatter table with sg_alloc_table() does not consider
>> contiguous pages. Because sg_alloc_table_from_pages() merges
>> contigous pages into a signle scatter entry, this patch fixes to
>> allocate scatter table with it from drm_prime_pages_to_sg().
>>
>> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
>> ---
>> drivers/gpu/drm/drm_prime.c | 8 ++------
>> 1 files changed, 2 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
>> index 366910d..8c098a3 100644
>> --- a/drivers/gpu/drm/drm_prime.c
>> +++ b/drivers/gpu/drm/drm_prime.c
>> @@ -401,21 +401,17 @@ int drm_prime_fd_to_handle_ioctl(struct drm_device
>> *dev, void *data,
>> struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages)
>> {
>> struct sg_table *sg = NULL;
>> - struct scatterlist *iter;
>> - int i;
>> int ret;
>>
>> sg = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
>> if (!sg)
>> goto out;
>>
>> - ret = sg_alloc_table(sg, nr_pages, GFP_KERNEL);
>> + ret = sg_alloc_table_from_pages(sg, pages, nr_pages,
>> + 0, PAGE_SIZE * nr_pages, GFP_KERNEL);
>> if (ret)
>> goto out;
>>
>> - for_each_sg(sg->sgl, iter, nr_pages, i)
>> - sg_set_page(iter, pages[i], PAGE_SIZE, 0);
>> -
>> return sg;
>> out:
>> kfree(sg);
>> --
>> 1.7.4.1
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>>
>
>
>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
--
Seung-Woo Kim
Samsung Software R&D Center
--
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-29 2:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-26 8:48 [RFC][PATCH] drm/prime: fixed to allocate sg table considering contiguous pages Seung-Woo Kim
2013-04-26 9:14 ` Rahul Sharma
2013-04-29 2:16 ` 김승우
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.