You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

libdrm-nouveau-drop-rendering.patch 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. diff --git a/libdrm/nouveau/nouveau_private.h b/libdrm/nouveau/nouveau_private.h
  2. index 67144e3..9ce87fb 100644
  3. --- a/libdrm/nouveau/nouveau_private.h
  4. +++ b/libdrm/nouveau/nouveau_private.h
  5. @@ -41,6 +41,7 @@
  6. struct nouveau_pushbuf_priv {
  7. struct nouveau_pushbuf base;
  8. + int no_aper_update;
  9. int use_cal;
  10. uint32_t cal_suffix0;
  11. uint32_t cal_suffix1;
  12. diff --git a/libdrm/nouveau/nouveau_pushbuf.c b/libdrm/nouveau/nouveau_pushbuf.c
  13. index fbcddd7..d434a5f 100644
  14. --- a/libdrm/nouveau/nouveau_pushbuf.c
  15. +++ b/libdrm/nouveau/nouveau_pushbuf.c
  16. @@ -202,10 +202,17 @@ nouveau_pushbuf_init_call(struct nouveau_channel *chan)
  17. req.channel = chan->id;
  18. req.handle = 0;
  19. ret = drmCommandWriteRead(nouveau_device(dev)->fd,
  20. - DRM_NOUVEAU_GEM_PUSHBUF_CALL,
  21. + DRM_NOUVEAU_GEM_PUSHBUF_CALL2,
  22. &req, sizeof(req));
  23. - if (ret)
  24. - return;
  25. + if (ret) {
  26. + ret = drmCommandWriteRead(nouveau_device(dev)->fd,
  27. + DRM_NOUVEAU_GEM_PUSHBUF_CALL2,
  28. + &req, sizeof(req));
  29. + if (ret)
  30. + return;
  31. +
  32. + nvpb->no_aper_update = 1;
  33. + }
  34. for (i = 0; i < CALPB_BUFFERS; i++) {
  35. ret = nouveau_bo_new(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP,
  36. @@ -282,14 +289,18 @@ restart_cal:
  37. nvpb->current_offset;
  38. req.suffix0 = nvpb->cal_suffix0;
  39. req.suffix1 = nvpb->cal_suffix1;
  40. - ret = drmCommandWriteRead(nvdev->fd,
  41. - DRM_NOUVEAU_GEM_PUSHBUF_CALL,
  42. + ret = drmCommandWriteRead(nvdev->fd, nvpb->no_aper_update ?
  43. + DRM_NOUVEAU_GEM_PUSHBUF_CALL :
  44. + DRM_NOUVEAU_GEM_PUSHBUF_CALL2,
  45. &req, sizeof(req));
  46. if (ret == -EAGAIN)
  47. goto restart_cal;
  48. nvpb->cal_suffix0 = req.suffix0;
  49. nvpb->cal_suffix1 = req.suffix1;
  50. - assert(ret == 0);
  51. + if (!nvpb->no_aper_update) {
  52. + nvdev->base.vm_vram_size = req.vram_available;
  53. + nvdev->base.vm_gart_size = req.gart_available;
  54. + }
  55. } else {
  56. struct drm_nouveau_gem_pushbuf req;
  57. @@ -305,7 +316,6 @@ restart_push:
  58. &req, sizeof(req));
  59. if (ret == -EAGAIN)
  60. goto restart_push;
  61. - assert(ret == 0);
  62. }
  63. @@ -328,12 +338,11 @@ restart_push:
  64. nvpb->nr_relocs = 0;
  65. /* Allocate space for next push buffer */
  66. - ret = nouveau_pushbuf_space(chan, min);
  67. - assert(!ret);
  68. + assert(!nouveau_pushbuf_space(chan, min));
  69. if (chan->flush_notify)
  70. chan->flush_notify(chan);
  71. - return 0;
  72. + return ret;
  73. }
  74. diff --git a/shared-core/nouveau_drm.h b/shared-core/nouveau_drm.h
  75. index 2050357..1e67c44 100644
  76. --- a/shared-core/nouveau_drm.h
  77. +++ b/shared-core/nouveau_drm.h
  78. @@ -155,6 +155,9 @@ struct drm_nouveau_gem_pushbuf_call {
  79. uint64_t relocs;
  80. uint32_t suffix0;
  81. uint32_t suffix1;
  82. + /* below only accessed for CALL2 */
  83. + uint64_t vram_available;
  84. + uint64_t gart_available;
  85. };
  86. struct drm_nouveau_gem_pin {
  87. @@ -212,5 +215,6 @@ struct drm_nouveau_sarea {
  88. #define DRM_NOUVEAU_GEM_CPU_PREP 0x45
  89. #define DRM_NOUVEAU_GEM_CPU_FINI 0x46
  90. #define DRM_NOUVEAU_GEM_INFO 0x47
  91. +#define DRM_NOUVEAU_GEM_PUSHBUF_CALL2 0x48
  92. #endif /* __NOUVEAU_DRM_H__ */