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 Use a header file hack to cope with Li...



details:   https://anonhg.NetBSD.org/src/rev/645a44b41863
branches:  trunk
changeset: 744836:645a44b41863
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Feb 14 04:35:19 2020 +0000

description:
Use a header file hack to cope with Linux/NetBSD namespace clashes.

Currently serves for:

ALIGN
mutex_init
mutex_destroy

diffstat:

 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bo_list.c                                  |  14 +--
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ctx.c                                      |  14 +--
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cz_smc.c                                   |  15 +--
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c                                   |  36 +-------
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c                                       |  14 +--
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fence.c                                    |  10 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gem.c                                      |  10 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gfx_v8_0.c                                 |  30 +-----
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_i2c.c                                      |  18 +---
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_kms.c                                      |  14 +--
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_object.c                                   |  10 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_sdma_v2_4.c                                |  10 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_sdma_v3_0.c                                |  10 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ucode.c                                    |  10 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_uvd.c                                      |  27 +-----
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vm.c                                       |  18 +---
 sys/external/bsd/drm2/dist/drm/drm_crtc.c                                                   |  24 +---
 sys/external/bsd/drm2/dist/drm/drm_dp_helper.c                                              |  14 +--
 sys/external/bsd/drm2/dist/drm/drm_dp_mst_topology.c                                        |  20 +---
 sys/external/bsd/drm2/dist/drm/drm_drv.c                                                    |  24 +----
 sys/external/bsd/drm2/dist/drm/drm_gem.c                                                    |  13 +--
 sys/external/bsd/drm2/dist/drm/drm_global.c                                                 |  12 +-
 sys/external/bsd/drm2/dist/drm/drm_prime.c                                                  |  14 +--
 sys/external/bsd/drm2/dist/drm/i915/i915_dma.c                                              |  44 ++-------
 sys/external/bsd/drm2/dist/drm/i915/i915_gem.c                                              |  22 +----
 sys/external/bsd/drm2/dist/drm/i915/i915_gem_render_state.c                                 |  10 +-
 sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c                                       |  14 +--
 sys/external/bsd/drm2/dist/drm/i915/intel_display.c                                         |  27 +-----
 sys/external/bsd/drm2/dist/drm/i915/intel_fbc.c                                             |  10 +-
 sys/external/bsd/drm2/dist/drm/i915/intel_i2c.c                                             |  12 +-
 sys/external/bsd/drm2/dist/drm/i915/intel_lrc.c                                             |  10 +-
 sys/external/bsd/drm2/dist/drm/i915/intel_pm.c                                              |  10 +-
 sys/external/bsd/drm2/dist/drm/i915/intel_psr.c                                             |  10 +-
 sys/external/bsd/drm2/dist/drm/i915/intel_runtime_pm.c                                      |  14 +--
 sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_overlay.c                  |  14 +--
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c                                        |  14 +--
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c                                 |  14 +--
 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_base.c |  13 +--
 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/i2c/nouveau_nvkm_subdev_i2c_aux.c        |  14 +--
 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/i2c/nouveau_nvkm_subdev_i2c_bus.c        |  14 +--
 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/i2c/nouveau_nvkm_subdev_i2c_pad.c        |  14 +--
 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_base.c       |  18 +---
 sys/external/bsd/drm2/dist/drm/radeon/radeon_cik.c                                          |  14 +--
 sys/external/bsd/drm2/dist/drm/radeon/radeon_device.c                                       |  41 +-------
 sys/external/bsd/drm2/dist/drm/radeon/radeon_evergreen_cs.c                                 |  15 +--
 sys/external/bsd/drm2/dist/drm/radeon/radeon_fb.c                                           |  14 +--
 sys/external/bsd/drm2/dist/drm/radeon/radeon_fence.c                                        |  10 +-
 sys/external/bsd/drm2/dist/drm/radeon/radeon_gem.c                                          |  10 +-
 sys/external/bsd/drm2/dist/drm/radeon/radeon_i2c.c                                          |  18 +---
 sys/external/bsd/drm2/dist/drm/radeon/radeon_ni.c                                           |  22 +----
 sys/external/bsd/drm2/dist/drm/radeon/radeon_object.c                                       |  10 +-
 sys/external/bsd/drm2/dist/drm/radeon/radeon_r600.c                                         |  38 +-------
 sys/external/bsd/drm2/dist/drm/radeon/radeon_si.c                                           |  26 +-----
 sys/external/bsd/drm2/dist/drm/radeon/radeon_uvd.c                                          |  22 +----
 sys/external/bsd/drm2/dist/drm/radeon/radeon_vm.c                                           |  18 +---
 sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c                                                 |  28 +-----
 sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c                                            |   8 +-
 sys/external/bsd/drm2/include/linux/nbsd-namespace.h                                        |  44 ++++++++++
 58 files changed, 290 insertions(+), 727 deletions(-)

diffs (truncated from 3344 to 300 lines):

diff -r 9d03e3b12dbf -r 645a44b41863 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        Fri Feb 14 04:30:04 2020 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bo_list.c        Fri Feb 14 04:35:19 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_bo_list.c,v 1.5 2020/02/14 04:30:04 riastradh Exp $     */
+/*     $NetBSD: amdgpu_bo_list.c,v 1.6 2020/02/14 04:35:19 riastradh Exp $     */
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -31,12 +31,14 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_bo_list.c,v 1.5 2020/02/14 04:30:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_bo_list.c,v 1.6 2020/02/14 04:35:19 riastradh Exp $");
 
 #include <drm/drmP.h>
 #include "amdgpu.h"
 #include "amdgpu_trace.h"
 
+#include <linux/nbsd-namespace.h>
+
 static int amdgpu_bo_list_create(struct amdgpu_fpriv *fpriv,
                                 struct amdgpu_bo_list **result,
                                 int *id)
@@ -60,11 +62,7 @@
        idr_preload_end();
        *id = r;
 
-#ifdef __NetBSD__
-       linux_mutex_init(&(*result)->lock);
-#else
        mutex_init(&(*result)->lock);
-#endif
        (*result)->num_entries = 0;
        (*result)->array = NULL;
 
@@ -185,11 +183,7 @@
        for (i = 0; i < list->num_entries; ++i)
                amdgpu_bo_unref(&list->array[i].robj);
 
-#ifdef __NetBSD__
-       linux_mutex_destroy(&list->lock);
-#else
        mutex_destroy(&list->lock);
-#endif
        drm_free_large(list->array);
        kfree(list);
 }
diff -r 9d03e3b12dbf -r 645a44b41863 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ctx.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ctx.c    Fri Feb 14 04:30:04 2020 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ctx.c    Fri Feb 14 04:35:19 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_ctx.c,v 1.4 2018/08/27 14:14:28 riastradh Exp $ */
+/*     $NetBSD: amdgpu_ctx.c,v 1.5 2020/02/14 04:35:19 riastradh Exp $ */
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -25,11 +25,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_ctx.c,v 1.4 2018/08/27 14:14:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_ctx.c,v 1.5 2020/02/14 04:35:19 riastradh Exp $");
 
 #include <drm/drmP.h>
 #include "amdgpu.h"
 
+#include <linux/nbsd-namespace.h>
+
 int amdgpu_ctx_init(struct amdgpu_device *adev, bool kernel,
                    struct amdgpu_ctx *ctx)
 {
@@ -295,11 +297,7 @@
 
 void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr)
 {
-#ifdef __NetBSD__
-       linux_mutex_init(&mgr->lock);
-#else
        mutex_init(&mgr->lock);
-#endif
        idr_init(&mgr->ctx_handles);
 }
 
@@ -317,9 +315,5 @@
        }
 
        idr_destroy(&mgr->ctx_handles);
-#ifdef __NetBSD__
-       linux_mutex_destroy(&mgr->lock);
-#else
        mutex_destroy(&mgr->lock);
-#endif
 }
diff -r 9d03e3b12dbf -r 645a44b41863 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cz_smc.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cz_smc.c Fri Feb 14 04:30:04 2020 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cz_smc.c Fri Feb 14 04:35:19 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_cz_smc.c,v 1.3 2020/02/14 04:30:04 riastradh Exp $      */
+/*     $NetBSD: amdgpu_cz_smc.c,v 1.4 2020/02/14 04:35:19 riastradh Exp $      */
 
 /*
  * Copyright 2014 Advanced Micro Devices, Inc.
@@ -23,7 +23,7 @@
  *
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_cz_smc.c,v 1.3 2020/02/14 04:30:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_cz_smc.c,v 1.4 2020/02/14 04:35:19 riastradh Exp $");
 
 #include <linux/firmware.h>
 #include <asm/byteorder.h>
@@ -43,6 +43,8 @@
 #include "gca/gfx_8_0_d.h"
 #include "gca/gfx_8_0_sh_mask.h"
 
+#include <linux/nbsd-namespace.h>
+
 uint32_t cz_get_argument(struct amdgpu_device *adev)
 {
        return RREG32(mmSMU_MP1_SRBM2P_ARG_0);
@@ -833,21 +835,12 @@
        adev->smu.fw_flags = 0;
        priv->toc_buffer.data_size = 4096;
 
-#ifdef __NetBSD__              /* XXX ALIGN means something else */
-       priv->smu_buffer.data_size =
-                               round_up(UCODE_ID_RLC_SCRATCH_SIZE_BYTE, 32) +
-                               round_up(UCODE_ID_RLC_SRM_ARAM_SIZE_BYTE, 32) +
-                               round_up(UCODE_ID_RLC_SRM_DRAM_SIZE_BYTE, 32) +
-                               round_up(sizeof(struct SMU8_MultimediaPowerLogData), 32) +
-                               round_up(sizeof(struct SMU8_Fusion_ClkTable), 32);
-#else
        priv->smu_buffer.data_size =
                                ALIGN(UCODE_ID_RLC_SCRATCH_SIZE_BYTE, 32) +
                                ALIGN(UCODE_ID_RLC_SRM_ARAM_SIZE_BYTE, 32) +
                                ALIGN(UCODE_ID_RLC_SRM_DRAM_SIZE_BYTE, 32) +
                                ALIGN(sizeof(struct SMU8_MultimediaPowerLogData), 32) +
                                ALIGN(sizeof(struct SMU8_Fusion_ClkTable), 32);
-#endif
 
        /* prepare toc buffer and smu buffer:
        * 1. create amdgpu_bo for toc buffer and smu buffer
diff -r 9d03e3b12dbf -r 645a44b41863 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c Fri Feb 14 04:30:04 2020 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c Fri Feb 14 04:35:19 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_device.c,v 1.4 2018/08/27 14:54:08 riastradh Exp $      */
+/*     $NetBSD: amdgpu_device.c,v 1.5 2020/02/14 04:35:19 riastradh Exp $      */
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -28,7 +28,7 @@
  *          Jerome Glisse
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_device.c,v 1.4 2018/08/27 14:54:08 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_device.c,v 1.5 2020/02/14 04:35:19 riastradh Exp $");
 
 #include <linux/console.h>
 #include <linux/slab.h>
@@ -49,6 +49,8 @@
 #include "vi.h"
 #include "bif/bif_4_1_d.h"
 
+#include <linux/nbsd-namespace.h>
+
 static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev);
 static void amdgpu_debugfs_regs_cleanup(struct amdgpu_device *adev);
 
@@ -973,11 +975,7 @@
 static void amdgpu_atombios_fini(struct amdgpu_device *adev)
 {
        if (adev->mode_info.atom_context) {
-#ifdef __NetBSD__
-               linux_mutex_destroy(&adev->mode_info.atom_context->mutex);
-#else
                mutex_destroy(&adev->mode_info.atom_context->mutex);
-#endif
                kfree(adev->mode_info.atom_context->scratch);
        }
        kfree(adev->mode_info.atom_context);
@@ -1033,11 +1031,7 @@
                return -ENOMEM;
        }
 
-#ifdef __NetBSD__
-       linux_mutex_init(&adev->mode_info.atom_context->mutex);
-#else
        mutex_init(&adev->mode_info.atom_context->mutex);
-#endif
        amdgpu_atombios_scratch_regs_init(adev);
        amdgpu_atom_allocate_fb_scratch(adev->mode_info.atom_context);
        return 0;
@@ -1557,24 +1551,14 @@
 
        /* mutex initialization are all done here so we
         * can recall function without having locking issues */
+       mutex_init(&adev->ring_lock);
        atomic_set(&adev->irq.ih.lock, 0);
-#ifdef __NetBSD__
-       linux_mutex_init(&adev->ring_lock);
-       linux_mutex_init(&adev->gem.mutex);
-       linux_mutex_init(&adev->pm.mutex);
-       linux_mutex_init(&adev->gfx.gpu_clock_mutex);
-       linux_mutex_init(&adev->srbm_mutex);
-       linux_mutex_init(&adev->grbm_idx_mutex);
-       linux_mutex_init(&adev->mn_lock);
-#else
-       mutex_init(&adev->ring_lock);
        mutex_init(&adev->gem.mutex);
        mutex_init(&adev->pm.mutex);
        mutex_init(&adev->gfx.gpu_clock_mutex);
        mutex_init(&adev->srbm_mutex);
        mutex_init(&adev->grbm_idx_mutex);
        mutex_init(&adev->mn_lock);
-#endif
        hash_init(adev->mn_hash);
 
        amdgpu_check_arguments(adev);
@@ -1814,15 +1798,6 @@
        spin_lock_destroy(&adev->pcie_idx_lock);
        spin_lock_destroy(&adev->smc_idx_lock);
        spin_lock_destroy(&adev->mmio_idx_lock);
-#ifdef __NetBSD__
-       linux_mutex_destroy(&adev->mn_lock);
-       linux_mutex_destroy(&adev->grbm_idx_mutex);
-       linux_mutex_destroy(&adev->srbm_mutex);
-       linux_mutex_destroy(&adev->gfx.gpu_clock_mutex);
-       linux_mutex_destroy(&adev->pm.mutex);
-       linux_mutex_destroy(&adev->gem.mutex);
-       linux_mutex_destroy(&adev->ring_lock);
-#else
        mutex_destroy(&adev->mn_lock);
        mutex_destroy(&adev->grbm_idx_mutex);
        mutex_destroy(&adev->srbm_mutex);
@@ -1830,7 +1805,6 @@
        mutex_destroy(&adev->pm.mutex);
        mutex_destroy(&adev->gem.mutex);
        mutex_destroy(&adev->ring_lock);
-#endif
 }
 
 
diff -r 9d03e3b12dbf -r 645a44b41863 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c     Fri Feb 14 04:30:04 2020 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c     Fri Feb 14 04:35:19 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_fb.c,v 1.3 2018/08/27 14:04:50 riastradh Exp $  */
+/*     $NetBSD: amdgpu_fb.c,v 1.4 2020/02/14 04:35:19 riastradh Exp $  */
 
 /*
  * Copyright © 2007 David Airlie
@@ -26,7 +26,7 @@
  *     David Airlie
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_fb.c,v 1.3 2018/08/27 14:04:50 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_fb.c,v 1.4 2020/02/14 04:35:19 riastradh Exp $");
 
 #include <linux/module.h>
 #include <linux/slab.h>
@@ -47,6 +47,8 @@
 #include "amdgpufb.h"
 #endif
 
+#include <linux/nbsd-namespace.h>
+
 /* object hierarchy -
    this contains a helper + a amdgpu fb
    the helper contains a pointer to amdgpu framebuffer baseclass.
@@ -132,17 +134,9 @@
        mode_cmd->pitches[0] = amdgpu_align_pitch(adev, mode_cmd->width, bpp,
                                                  fb_tiled) * ((bpp + 1) / 8);
 
-#ifdef __NetBSD__              /* XXX ALIGN means something else.  */
-       height = round_up(mode_cmd->height, 8);
-#else
        height = ALIGN(mode_cmd->height, 8);
-#endif
        size = mode_cmd->pitches[0] * height;
-#ifdef __NetBSD__              /* XXX ALIGN means something else.  */
-       aligned_size = round_up(size, PAGE_SIZE);
-#else
        aligned_size = ALIGN(size, PAGE_SIZE);
-#endif
        ret = amdgpu_gem_object_create(adev, aligned_size, 0,
                                       AMDGPU_GEM_DOMAIN_VRAM,
                                       AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
diff -r 9d03e3b12dbf -r 645a44b41863 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fence.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fence.c  Fri Feb 14 04:30:04 2020 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fence.c  Fri Feb 14 04:35:19 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_fence.c,v 1.4 2020/02/14 04:30:04 riastradh Exp $       */
+/*     $NetBSD: amdgpu_fence.c,v 1.5 2020/02/14 04:35:19 riastradh Exp $       */
 
 /*
  * Copyright 2009 Jerome Glisse.
@@ -31,7 +31,7 @@



Home | Main Index | Thread Index | Old Index