From patchwork Fri Apr 26 08:48:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seung-Woo Kim X-Patchwork-Id: 2491651 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id D6A05DF230 for ; Fri, 26 Apr 2013 08:49:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C238DE604C for ; Fri, 26 Apr 2013 01:49:18 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 50C2AE604C for ; Fri, 26 Apr 2013 01:48:41 -0700 (PDT) Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MLU00EDMTSKU190@mailout1.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 26 Apr 2013 17:48:40 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.112]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 47.05.13955.76F3A715; Fri, 26 Apr 2013 17:48:39 +0900 (KST) X-AuditID: cbfee68f-b7f066d000003683-34-517a3f670188 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 44.44.08957.76F3A715; Fri, 26 Apr 2013 17:48:39 +0900 (KST) Received: from localhost.localdomain ([10.90.8.56]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MLU003BUTT1GG40@mmp1.samsung.com>; Fri, 26 Apr 2013 17:48:39 +0900 (KST) From: Seung-Woo Kim To: dri-devel@lists.freedesktop.org, airlied@linux.ie Subject: [RFC][PATCH] drm/prime: fixed to allocate sg table considering contiguous pages Date: Fri, 26 Apr 2013 17:48:43 +0900 Message-id: <1366966123-31432-1-git-send-email-sw0312.kim@samsung.com> X-Mailer: git-send-email 1.7.4.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrELMWRmVeSWpSXmKPExsWyRsSkQDfdvirQYPoiPYvecyeZLK58fc9m MWPySzYHZo/t3x6wetzvPs7k0bdlFWMAcxSXTUpqTmZZapG+XQJXRvfntcwFTzkrvu7czNzA 2MnRxcjJISFgItF06DE7hC0mceHeerYuRi4OIYGljBK/z81lgSm6+eYMI0RiEaPEvDMvWSCc ZiaJu6v7GUGq2AR0JPYv+c0KYosImEqcvXyNGcRmFpCS2LYUZCwnh7BAlMT9vcvB6lkEVCXW Nl0Gq+EVcJP4e2wKG8Q2BYkF996CnSEhcJ1N4vTkDlaIBgGJb5MPAW3mAErISmw6wAxRLylx cMUNlgmMggsYGVYxiqYWJBcUJ6UXGesVJ+YWl+al6yXn525iBIbf6X/P+ncw3j1gfYgxGWjc RGYp0eR8YPjmlcQbGpsZWZiamBobmVuakSasJM6r1mIdKCSQnliSmp2aWpBaFF9UmpNafIiR iYNTqoFRMvHobN+gqDk2M+TuZP9umGew5E1EXuHvAs6zTWsjjcSdl/Dc/6FoGar/2GHtUVep ZVsdLBaV7NvqVNBZYtUsbZZ5qnF/xv+TSceCUp53af6artv90736WMhi4f8cxjo5TJv25p4/ cOWM98fX24wetKq8a01WS5/S+6VGyc6eh+nXMcFZPf1KLMUZiYZazEXFiQBms0BRVQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPIsWRmVeSWpSXmKPExsVy+t9jAd10+6pAgx+r1S16z51ksrjy9T2b xYzJL9kcmD22f3vA6nG/+ziTR9+WVYwBzFENjDYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYG hrqGlhbmSgp5ibmptkouPgG6bpk5QKuUFMoSc0qBQgGJxcVK+naYJoSGuOlawDRG6PqGBMH1 GBmggYQ1jBndn9cyFzzlrPi6czNzA2MnRxcjJ4eEgInEzTdnGCFsMYkL99azdTFycQgJLGKU mHfmJQuE08wkcXd1P1gVm4COxP4lv1lBbBEBU4mzl68xg9jMAlIS25aCdHNyCAtESdzfuxys nkVAVWJt02WwGl4BN4m/x6awQWxTkFhw7y3bBEbuBYwMqxhFUwuSC4qT0nMN9YoTc4tL89L1 kvNzNzGCg/uZ1A7GlQ0WhxgFOBiVeHgdHCoDhVgTy4orcw8xSnAwK4nwXp0BFOJNSaysSi3K jy8qzUktPsSYDLR9IrOUaHI+MPLySuINjU3MjCyNzA0tjIzNSRNWEuc90GodKCSQnliSmp2a WpBaBLOFiYNTqoGxNcPHf7/92RX6HrWbT/xw9tOfF+0acE79ziTDCA9m41vSM9Ull155M5W5 fVbc/YDN/3VYv31gclTc2vFuhduZtaGJHm7LElSMtFns9rXdyl7les1Y8+szfdHKnV94kv0f ubtnRL21/CiRf+Xejsd9i+vn2Jdt0jhvFCGz+/ILPvbCyxdm3rqlxFKckWioxVxUnAgAuKyt GrICAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: sw0312.kim@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org 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 --- 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);