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/linux amdgpu_fb.c



details:   https://anonhg.NetBSD.org/src/rev/41414c4f8164
branches:  trunk
changeset: 1028793:41414c4f8164
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 12:02:38 2021 +0000

description:
amdgpu_fb.c
amdgpu_fence.c
amdgpu_gart.c
amdgpu_fixpt31_32.c
amdgpu_fiji_smumgr.c
amdgpu_gem.c
amdgpu_gfx_v10_0.c
amdgpu_gfx_v6_0.c through amdgpu_gfx_v9_0.c
amdgpu_gmc.c
amdgpu_gmc_v6_0.c through amdgpu_gmc_v10_0.c
amdgpu_gtt_mgr.c
some amdgpu_h* files
some amdgpu_i* files
some amdgpu_j* files
amdgpu_kms.c
some amdgpu_m* and amdgpu_n* files

diffstat:

 sys/external/bsd/common/include/linux/printk.h                                   |   4 +-
 sys/external/bsd/drm2/amdgpu/amdgpu_module.c                                     |  10 +-
 sys/external/bsd/drm2/amdgpu/files.amdgpu                                        |   8 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h                               |   4 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bo_list.c                       |   8 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cs.c                            |  15 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c                            |  63 ++++-----
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fence.c                         |   7 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c                          |  31 ++--
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.h                          |   6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gem.c                           |  22 ++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gfx_v10_0.c                     |  32 ++--
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gfx_v6_0.c                      |  10 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gfx_v7_0.c                      |  10 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gfx_v8_0.c                      |   8 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gfx_v9_0.c                      |  30 ++--
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gmc.c                           |  33 ++++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gmc_v10_0.c                     |  10 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gmc_v6_0.c                      |  10 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gmc_v7_0.c                      |  15 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gmc_v8_0.c                      |   6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gmc_v9_0.c                      |  12 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gtt_mgr.c                       |  19 ++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ids.c                           |  10 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ih.c                            |   8 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_irq.c                           |  16 ++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_jpeg_v1_0.c                     |   6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_jpeg_v2_0.c                     |   6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_jpeg_v2_5.c                     |   6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_kms.c                           |   6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_mes_v10_1.c                     |   6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_navi10_reg_init.c               |  36 ++--
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_navi12_reg_init.c               |  36 ++--
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_navi14_reg_init.c               |  36 ++--
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_nv.c                            |   6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_rlc.h                           |   8 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ttm.c                           |  16 ++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ttm.h                           |   6 +-
 sys/external/bsd/drm2/dist/drm/amd/display/dc/basics/amdgpu_fixpt31_32.c         |   8 +-
 sys/external/bsd/drm2/dist/drm/amd/display/dc/gpio/amdgpu_hw_ddc.c               |   6 +-
 sys/external/bsd/drm2/dist/drm/amd/display/dc/gpio/amdgpu_hw_gpio.c              |   8 +-
 sys/external/bsd/drm2/dist/drm/amd/display/dc/gpio/amdgpu_hw_hpd.c               |   7 +-
 sys/external/bsd/drm2/dist/drm/amd/display/dc/hdcp/amdgpu_hdcp_msg.c             |  10 +-
 sys/external/bsd/drm2/dist/drm/amd/display/modules/hdcp/amdgpu_hdcp1_execution.c |   6 +-
 sys/external/bsd/drm2/dist/drm/amd/display/modules/hdcp/amdgpu_hdcp_ddc.c        |   5 +-
 sys/external/bsd/drm2/dist/drm/amd/display/modules/hdcp/amdgpu_hdcp_log.c        |  10 +-
 sys/external/bsd/drm2/dist/drm/amd/display/modules/hdcp/hdcp.h                   |   4 +-
 sys/external/bsd/drm2/dist/drm/amd/display/modules/inc/mod_hdcp.h                |   6 +-
 sys/external/bsd/drm2/dist/drm/amd/powerplay/amdgpu_navi10_ppt.c                 |  10 +-
 sys/external/bsd/drm2/dist/drm/amd/powerplay/smumgr/amdgpu_fiji_smumgr.c         |   6 +-
 sys/external/bsd/drm2/dist/drm/amd/powerplay/smumgr/amdgpu_iceland_smumgr.c      |   6 +-
 sys/external/bsd/drm2/include/linux/dma-fence.h                                  |   4 +-
 sys/external/bsd/drm2/include/linux/hash.h                                       |   8 +-
 sys/external/bsd/drm2/include/linux/hashtable.h                                  |   3 +-
 sys/external/bsd/drm2/include/uapi/linux/kfd_ioctl.h                             |  37 +++++
 sys/external/bsd/drm2/linux/linux_dma_fence.c                                    |  10 +-
 56 files changed, 448 insertions(+), 287 deletions(-)

diffs (truncated from 2418 to 300 lines):

diff -r 62dd994ac665 -r 41414c4f8164 sys/external/bsd/common/include/linux/printk.h
--- a/sys/external/bsd/common/include/linux/printk.h    Sun Dec 19 12:02:20 2021 +0000
+++ b/sys/external/bsd/common/include/linux/printk.h    Sun Dec 19 12:02:38 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: printk.h,v 1.11 2021/12/19 11:38:37 riastradh Exp $    */
+/*     $NetBSD: printk.h,v 1.12 2021/12/19 12:02:38 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -58,6 +58,8 @@
 #define        KERN_DEBUG      "kern debug: "
 #define        KERN_CONT       ""
 
+#define        printk_ratelimit()      0 /* XXX */
+
 struct va_format {
        const char      *fmt;
        va_list         *va;
diff -r 62dd994ac665 -r 41414c4f8164 sys/external/bsd/drm2/amdgpu/amdgpu_module.c
--- a/sys/external/bsd/drm2/amdgpu/amdgpu_module.c      Sun Dec 19 12:02:20 2021 +0000
+++ b/sys/external/bsd/drm2/amdgpu/amdgpu_module.c      Sun Dec 19 12:02:38 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_module.c,v 1.6 2021/12/19 12:01:48 riastradh Exp $      */
+/*     $NetBSD: amdgpu_module.c,v 1.7 2021/12/19 12:02:38 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_module.c,v 1.6 2021/12/19 12:01:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_module.c,v 1.7 2021/12/19 12:02:38 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/module.h>
@@ -43,6 +43,7 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_sysctl.h>
 
+#include <linux/idr.h>
 #include <linux/mutex.h>
 
 #include "amdgpu.h"
@@ -59,6 +60,9 @@
 extern struct drm_driver *const amdgpu_drm_driver;
 extern struct amdgpu_mgpu_info mgpu_info;
 
+/* XXX Kludge to replace DEFINE_IDA in amdgpu_ids.c.  */
+extern struct ida amdgpu_pasid_ida;
+
 struct drm_sysctl_def amdgpu_def = DRM_SYSCTL_INIT();
 
 static int
@@ -74,6 +78,7 @@
        amdgpu_drm_driver->driver_features |= DRIVER_MODESET;
 
        linux_mutex_init(&mgpu_info.mutex);
+       ida_init(&amdgpu_pasid_ida);
 
 #if notyet                     /* XXX amdgpu acpi */
        amdgpu_register_atpx_handler();
@@ -108,6 +113,7 @@
        amdgpu_unregister_atpx_handler();
 #endif
 
+       ida_destroy(&amdgpu_pasid_ida);
        linux_mutex_destroy(&mgpu_info.mutex);
 }
 
diff -r 62dd994ac665 -r 41414c4f8164 sys/external/bsd/drm2/amdgpu/files.amdgpu
--- a/sys/external/bsd/drm2/amdgpu/files.amdgpu Sun Dec 19 12:02:20 2021 +0000
+++ b/sys/external/bsd/drm2/amdgpu/files.amdgpu Sun Dec 19 12:02:38 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.amdgpu,v 1.20 2021/12/19 12:01:30 riastradh Exp $
+#      $NetBSD: files.amdgpu,v 1.21 2021/12/19 12:02:38 riastradh Exp $
 
 version        20180827
 
@@ -49,6 +49,10 @@
 # -Wtype-limits raises warnings about code that is careful to avoid
 # overflow in arithmetic, which is the opposite of helpful.  &@!#*
 makeoptions    amdgpu  "CWARNFLAGS.amdgpu_bo_list.c"+="-Wno-type-limits"
+makeoptions    amdgpu  "CWARNFLAGS.amdgpu_hw_ddc.c"+="-Wno-type-limits"
+makeoptions    amdgpu  "CWARNFLAGS.amdgpu_hw_generic.c"+="-Wno-type-limits"
+makeoptions    amdgpu  "CWARNFLAGS.amdgpu_hw_hpd.c"+="-Wno-type-limits"
+makeoptions    amdgpu  "CWARNFLAGS.amdgpu_navi10_ppt.c"+="-Wno-type-limits"
 
 ifdef amd64
 makeoptions    amdgpu  "COPTS.amdgpu_dcn20_resource.c"+="-mhard-float -msse -msse2"
@@ -63,6 +67,8 @@
 makeoptions    amdgpu  "COPTS.amdgpu_display_rq_dlg_calc_20.c"+="-mhard-float -msse -msse2"
 makeoptions    amdgpu  "COPTS.amdgpu_display_rq_dlg_calc_20v2.c"+="-mhard-float -msse -msse2"
 makeoptions    amdgpu  "COPTS.amdgpu_display_rq_dlg_calc_21.c"+="-mhard-float -msse -msse2"
+makeoptions    amdgpu  "COPTS.amdgpu_dml1_display_rq_dlg_calc.c"+="-mhard-float -msse -msse2"
+makeoptions    amdgpu  "COPTS.amdgpu_dml_common_defs.c"+="-mhard-float -msse -msse2"
 endif
 
 # Local additions.
diff -r 62dd994ac665 -r 41414c4f8164 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h        Sun Dec 19 12:02:20 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h        Sun Dec 19 12:02:38 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu.h,v 1.6 2021/12/19 11:35:06 riastradh Exp $     */
+/*     $NetBSD: amdgpu.h,v 1.7 2021/12/19 12:02:39 riastradh Exp $     */
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -953,7 +953,7 @@
        atomic64_t gart_pin_size;
 
        /* soc15 register offset based on ip, instance and  segment */
-       uint32_t                *reg_offset[MAX_HWIP][HWIP_MAX_INSTANCE];
+       const uint32_t          *reg_offset[MAX_HWIP][HWIP_MAX_INSTANCE];
 
        /* delayed work_func for deferring clockgating during resume */
        struct delayed_work     delayed_init_work;
diff -r 62dd994ac665 -r 41414c4f8164 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bo_list.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bo_list.c        Sun Dec 19 12:02:20 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bo_list.c        Sun Dec 19 12:02:38 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_bo_list.c,v 1.8 2021/12/19 10:59:01 riastradh Exp $     */
+/*     $NetBSD: amdgpu_bo_list.c,v 1.9 2021/12/19 12:02:39 riastradh Exp $     */
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_bo_list.c,v 1.8 2021/12/19 10:59:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_bo_list.c,v 1.9 2021/12/19 12:02:39 riastradh Exp $");
 
 #include <linux/uaccess.h>
 
@@ -100,7 +100,11 @@
                struct amdgpu_bo_list_entry *entry;
                struct drm_gem_object *gobj;
                struct amdgpu_bo *bo;
+#ifdef __NetBSD__
+               struct vmspace *usermm;
+#else
                struct mm_struct *usermm;
+#endif
 
                gobj = drm_gem_object_lookup(filp, info[i].bo_handle);
                if (!gobj) {
diff -r 62dd994ac665 -r 41414c4f8164 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cs.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cs.c     Sun Dec 19 12:02:20 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cs.c     Sun Dec 19 12:02:38 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_cs.c,v 1.6 2021/12/19 10:59:01 riastradh Exp $  */
+/*     $NetBSD: amdgpu_cs.c,v 1.7 2021/12/19 12:02:39 riastradh Exp $  */
 
 /*
  * Copyright 2008 Jerome Glisse.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_cs.c,v 1.6 2021/12/19 10:59:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_cs.c,v 1.7 2021/12/19 12:02:39 riastradh Exp $");
 
 #include <linux/file.h>
 #include <linux/pagemap.h>
@@ -479,16 +479,19 @@
 
        list_for_each_entry(lobj, validated, tv.head) {
                struct amdgpu_bo *bo = ttm_to_amdgpu_bo(lobj->tv.bo);
+#ifdef __NetBSD__
+               struct vmspace *usermm;
+#else
                struct mm_struct *usermm;
+#endif
 
                usermm = amdgpu_ttm_tt_get_usermm(bo->tbo.ttm);
-#ifdef __NetBSD__              /* XXX amdgpu userptr */
-               if (usermm)
-                       return -EPERM;
+#ifdef __NetBSD__
+               if (usermm && usermm != curproc->p_vmspace)
 #else
                if (usermm && usermm != current->mm)
+#endif
                        return -EPERM;
-#endif
 
                if (amdgpu_ttm_tt_is_userptr(bo->tbo.ttm) &&
                    lobj->user_invalidated && lobj->user_pages) {
diff -r 62dd994ac665 -r 41414c4f8164 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c     Sun Dec 19 12:02:20 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c     Sun Dec 19 12:02:38 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_fb.c,v 1.9 2021/12/19 10:46:43 riastradh Exp $  */
+/*     $NetBSD: amdgpu_fb.c,v 1.10 2021/12/19 12:02:39 riastradh Exp $ */
 
 /*
  * Copyright © 2007 David Airlie
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_fb.c,v 1.9 2021/12/19 10:46:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_fb.c,v 1.10 2021/12/19 12:02:39 riastradh Exp $");
 
 #include <linux/module.h>
 #include <linux/pm_runtime.h>
@@ -57,6 +57,8 @@
    the helper contains a pointer to amdgpu framebuffer baseclass.
 */
 
+#ifndef __NetBSD__
+
 static int
 amdgpufb_open(struct fb_info *info, int user)
 {
@@ -80,7 +82,6 @@
        return 0;
 }
 
-#ifndef __NetBSD__
 static const struct fb_ops amdgpufb_ops = {
        .owner = THIS_MODULE,
        DRM_FB_HELPER_DEFAULT_OPS,
@@ -90,6 +91,7 @@
        .fb_copyarea = drm_fb_helper_cfb_copyarea,
        .fb_imageblit = drm_fb_helper_cfb_imageblit,
 };
+
 #endif
 
 
@@ -213,17 +215,13 @@
 {
        struct amdgpu_fbdev *rfbdev = (struct amdgpu_fbdev *)helper;
        struct amdgpu_device *adev = rfbdev->adev;
-#ifndef __NetBSD__
        struct fb_info *info;
-#endif
        struct drm_framebuffer *fb = NULL;
        struct drm_mode_fb_cmd2 mode_cmd;
        struct drm_gem_object *gobj = NULL;
        struct amdgpu_bo *abo = NULL;
        int ret;
-#ifndef __NetBSD__
        unsigned long tmp;
-#endif
 
        mode_cmd.width = sizes->surface_width;
        mode_cmd.height = sizes->surface_height;
@@ -242,40 +240,14 @@
 
        abo = gem_to_amdgpu_bo(gobj);
 
-#ifdef __NetBSD__
-       ret = amdgpu_framebuffer_init(adev->ddev, &rfbdev->rfb, &mode_cmd, gobj);
-       if (ret) {
-               DRM_ERROR("failed to initialize framebuffer %d\n", ret);
-               goto out_unref;
-       }
-
-       (void)memset(rbo->kptr, 0, amdgpu_bo_size(rbo));
-
-    {
-       static const struct amdgpufb_attach_args zero_afa;
-       struct amdgpufb_attach_args afa = zero_afa;
-
-       afa.afa_fb_helper = helper;
-       afa.afa_fb_sizes = *sizes;
-       afa.afa_fb_ptr = rbo->kptr;
-       afa.afa_fb_linebytes = mode_cmd.pitches[0];
-
-       helper->fbdev = config_found(adev->ddev->dev, &afa, NULL,
-           CFARGS(.iattr = "amdgpufbbus"));
-       if (helper->fbdev == NULL) {
-               DRM_ERROR("failed to attach amdgpufb\n");
-               goto out_unref;
-       }
-    }
-       fb = &rfbdev->rfb.base;
-       rfbdev->helper.fb = fb;
-#else  /* __NetBSD__ */
+#ifndef __NetBSD__
        /* okay we have an object now allocate the framebuffer */
        info = drm_fb_helper_alloc_fbi(helper);
        if (IS_ERR(info)) {
                ret = PTR_ERR(info);
                goto out;
        }
+#endif
 
        ret = amdgpu_display_framebuffer_init(adev->ddev, &rfbdev->rfb,
                                              &mode_cmd, gobj);
@@ -289,6 +261,27 @@
        /* setup helper */
        rfbdev->helper.fb = fb;
 
+#ifdef __NetBSD__
+    {
+       static const struct amdgpufb_attach_args zero_afa;



Home | Main Index | Thread Index | Old Index