Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/drm amdgpu: Make amdgpu_file_to_fpriv ...



details:   https://anonhg.NetBSD.org/src/rev/93e9b3e6e6d5
branches:  trunk
changeset: 1028882:93e9b3e6e6d5
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 12:23:42 2021 +0000

description:
amdgpu: Make amdgpu_file_to_fpriv work.

diffstat:

 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_drv.c |  14 ++++++++++----
 sys/external/bsd/drm2/dist/include/drm/drm_file.h      |   7 ++++---
 sys/external/bsd/drm2/drm/drm_cdevsw.c                 |   6 +++---
 3 files changed, 17 insertions(+), 10 deletions(-)

diffs (98 lines):

diff -r 53ab88fb27de -r 93e9b3e6e6d5 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_drv.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_drv.c    Sun Dec 19 12:23:34 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_drv.c    Sun Dec 19 12:23:42 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_drv.c,v 1.7 2021/12/19 12:01:48 riastradh Exp $ */
+/*     $NetBSD: amdgpu_drv.c,v 1.8 2021/12/19 12:23:42 riastradh Exp $ */
 
 /*
  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_drv.c,v 1.7 2021/12/19 12:01:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_drv.c,v 1.8 2021/12/19 12:23:42 riastradh Exp $");
 
 #include <drm/amdgpu_drm.h>
 #include <drm/drm_drv.h>
@@ -1376,7 +1376,6 @@
 static const struct uvm_pagerops amdgpu_gem_uvm_ops;
 #endif
 
-#ifndef __NetBSD__
 int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
 {
         struct drm_file *file;
@@ -1384,15 +1383,22 @@
        if (!filp)
                return -EINVAL;
 
+#ifdef __NetBSD__
+       if (filp->f_ops != &drm_fileops)
+               return -EINVAL;
+       file = filp->f_data;
+       if (file->minor->dev->driver != &kms_driver)
+               return -EINVAL;
+#else
        if (filp->f_op != &amdgpu_driver_kms_fops) {
                return -EINVAL;
        }
 
        file = filp->private_data;
+#endif
        *fpriv = file->driver_priv;
        return 0;
 }
-#endif
 
 static bool
 amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
diff -r 53ab88fb27de -r 93e9b3e6e6d5 sys/external/bsd/drm2/dist/include/drm/drm_file.h
--- a/sys/external/bsd/drm2/dist/include/drm/drm_file.h Sun Dec 19 12:23:34 2021 +0000
+++ b/sys/external/bsd/drm2/dist/include/drm/drm_file.h Sun Dec 19 12:23:42 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_file.h,v 1.7 2021/12/19 01:59:03 riastradh Exp $   */
+/*     $NetBSD: drm_file.h,v 1.8 2021/12/19 12:23:42 riastradh Exp $   */
 
 /*
  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -391,8 +391,9 @@
 }
 
 #ifdef __NetBSD__
-extern int drm_open_file(struct drm_file *, void *, struct drm_minor *);
-extern void drm_close_file(struct drm_file *);
+extern const struct fileops drm_fileops;
+int drm_open_file(struct drm_file *, void *, struct drm_minor *);
+void drm_close_file(struct drm_file *);
 #else
 int drm_open(struct inode *inode, struct file *filp);
 ssize_t drm_read(struct file *filp, char __user *buffer,
diff -r 53ab88fb27de -r 93e9b3e6e6d5 sys/external/bsd/drm2/drm/drm_cdevsw.c
--- a/sys/external/bsd/drm2/drm/drm_cdevsw.c    Sun Dec 19 12:23:34 2021 +0000
+++ b/sys/external/bsd/drm2/drm/drm_cdevsw.c    Sun Dec 19 12:23:42 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_cdevsw.c,v 1.28 2021/12/19 11:36:41 riastradh Exp $        */
+/*     $NetBSD: drm_cdevsw.c,v 1.29 2021/12/19 12:23:42 riastradh Exp $        */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_cdevsw.c,v 1.28 2021/12/19 11:36:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_cdevsw.c,v 1.29 2021/12/19 12:23:42 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -101,7 +101,7 @@
        .d_flag = D_NEGOFFSAFE,
 };
 
-static const struct fileops drm_fileops = {
+const struct fileops drm_fileops = {
        .fo_name = "drm",
        .fo_read = drm_read,
        .fo_write = fbadop_write,



Home | Main Index | Thread Index | Old Index