0541-drm-vc4-Use-drm_malloc_ab-to-fix-large-rendering-job.patch 1.9 KB

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