Page MenuHomeFreeBSD

dmabuf dtype drm patch

Authored By
val_packett.cool
Oct 2 2020, 10:58 AM
Size
1 KB
Referenced Files
None
Subscribers
None

dmabuf dtype drm patch

diff --git i/drivers/dma-buf/dma-buf.c w/drivers/dma-buf/dma-buf.c
index 9460e1024..7176f45f6 100644
--- i/drivers/dma-buf/dma-buf.c
+++ w/drivers/dma-buf/dma-buf.c
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <sys/file.h>
#include <sys/filio.h>
#include <sys/unistd.h>
+#include <sys/user.h>
#include <sys/capsicum.h>
#include <vm/vm.h>
@@ -58,6 +59,14 @@ __FBSDID("$FreeBSD$");
#undef file
#undef fget
+#ifndef DTYPE_DMABUF
+#define DTYPE_DMABUF 15
+#endif
+
+#ifndef KF_TYPE_DMABUF
+#define KF_TYPE_DMABUF 13
+#endif
+
struct db_list {
struct list_head head;
struct sx lock;
@@ -85,9 +94,6 @@ struct fileops dma_buf_fileops = {
.fo_flags = DFLAG_PASSABLE|DFLAG_SEEKABLE,
};
-/* XXX */
-#define DTYPE_DMABUF 100
-
#define fp_is_db(fp) ((fp)->f_ops == &dma_buf_fileops)
static int
@@ -131,8 +137,18 @@ static int
dma_buf_fill_kinfo(struct file *fp, struct kinfo_file *kif,
struct filedesc *fdp __unused)
{
+ struct dma_buf *db;
+
+ if (!fp_is_db(fp))
+ return (EINVAL);
+
+ db = fp->f_data;
+
+ kif->kf_type = KF_TYPE_DMABUF;
+ kif->kf_un.kf_dmabuf.kf_dmabuf_size = db->size;
+ strlcpy(kif->kf_un.kf_dmabuf.kf_dmabuf_exp_name, db->exp_name,
+ sizeof(kif->kf_un.kf_dmabuf.kf_dmabuf_exp_name));
- /* XXX pass this on to stat */
return (0);
}

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2822802
Default Alt Text
dmabuf dtype drm patch (1 KB)

Event Timeline