kernel: bump kernel 4.4 to 4.4.129 for 17.01
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.4 / 0541-drm-vc4-Use-drm_malloc_ab-to-fix-large-rendering-job.patch
1 From ed5a62d83a6a9bd2b318f0ed9bf9b3d28376f8f7 Mon Sep 17 00:00:00 2001
2 From: Eric Anholt <eric@anholt.net>
3 Date: Tue, 19 Jul 2016 11:32:44 -0700
4 Subject: [PATCH] drm/vc4: Use drm_malloc_ab to fix large rendering jobs.
5
6 If you exceeded the size that kmalloc would return, you'd get a dmesg
7 warning and a return from the job submit. We can handle much
8 allocations with vmalloc, and drm_malloc_ab makes that decision.
9
10 Fixes failure in piglit's scissor-many.
11
12 Signed-off-by: Eric Anholt <eric@anholt.net>
13 (cherry picked from commit ece7267dccf0e9e08cb6e8dc6b7ad2be9c4eb444)
14 ---
15 drivers/gpu/drm/vc4/vc4_gem.c | 10 +++++-----
16 1 file changed, 5 insertions(+), 5 deletions(-)
17
18 --- a/drivers/gpu/drm/vc4/vc4_gem.c
19 +++ b/drivers/gpu/drm/vc4/vc4_gem.c
20 @@ -549,8 +549,8 @@ vc4_cl_lookup_bos(struct drm_device *dev
21 return -EINVAL;
22 }
23
24 - exec->bo = kcalloc(exec->bo_count, sizeof(struct drm_gem_cma_object *),
25 - GFP_KERNEL);
26 + exec->bo = drm_calloc_large(exec->bo_count,
27 + sizeof(struct drm_gem_cma_object *));
28 if (!exec->bo) {
29 DRM_ERROR("Failed to allocate validated BO pointers\n");
30 return -ENOMEM;
31 @@ -624,7 +624,7 @@ vc4_get_bcl(struct drm_device *dev, stru
32 * read the contents back for validation, and I think the
33 * bo->vaddr is uncached access.
34 */
35 - temp = kmalloc(temp_size, GFP_KERNEL);
36 + temp = drm_malloc_ab(temp_size, 1);
37 if (!temp) {
38 DRM_ERROR("Failed to allocate storage for copying "
39 "in bin/render CLs.\n");
40 @@ -699,7 +699,7 @@ vc4_get_bcl(struct drm_device *dev, stru
41 ret = vc4_wait_for_seqno(dev, exec->bin_dep_seqno, ~0ull, true);
42
43 fail:
44 - kfree(temp);
45 + drm_free_large(temp);
46 return ret;
47 }
48
49 @@ -712,7 +712,7 @@ vc4_complete_exec(struct drm_device *dev
50 if (exec->bo) {
51 for (i = 0; i < exec->bo_count; i++)
52 drm_gem_object_unreference_unlocked(&exec->bo[i]->base);
53 - kfree(exec->bo);
54 + drm_free_large(exec->bo);
55 }
56
57 while (!list_empty(&exec->unref_list)) {