Somewhere along the line of file descriptor code refactoring the
refcounting for dmabuf file descriptors got botched. The result is
that the files never die and the associated graphics objects never get
freed. Eventually you'll run out of memory.
I noticed this after switching to a Mesa 17.3.9 build that jsg@
provided. That version might use these graphics buffers a little bit
more aggressively making me run out of memory faster. But the leakage
is there with Mesa 13.0.6 as well.
So the issue is that fnew() returns a file that has two references.
And we only need one because the DRI3 code will grab additional
references when it needs them. So we need to drop one reference.
ok?
Index: dev/pci/drm/drm_linux.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/drm_linux.c,v
retrieving revision 1.26
diff -u -p -r1.26 drm_linux.c
--- dev/pci/drm/drm_linux.c 3 Jul 2018 20:40:25 -0000 1.26
+++ dev/pci/drm/drm_linux.c 12 Aug 2018 13:38:55 -0000
@@ -912,6 +912,7 @@ dma_buf_export(const struct dma_buf_expo
dmabuf->size = info->size;
dmabuf->file = fp;
fp->f_data = dmabuf;
+ FRELE(fp, p);
return dmabuf;
}