545.23.06

This commit is contained in:
Andy Ritger
2023-10-17 09:25:29 -07:00
parent f59818b751
commit b5bf85a8e3
917 changed files with 132480 additions and 110015 deletions

View File

@@ -25,6 +25,7 @@
#define __NV_COMMON_UTILS_H__
#include "nvtypes.h"
#include "nvmisc.h"
#if !defined(TRUE)
#define TRUE NV_TRUE
@@ -95,4 +96,25 @@ static inline unsigned short PALETTE_DEPTH_SHIFT(unsigned short val, int depth)
return NV_UNDER_REPLICATE(val, depth, 8);
}
/*
* Use __builtin_ffs where it is supported, or provide an equivalent
* implementation for platforms like riscv where it is not.
*/
#if defined(__GNUC__) && !NVCPU_IS_RISCV64
static inline int nv_ffs(int x)
{
return __builtin_ffs(x);
}
#else
static inline int nv_ffs(int x)
{
if (x == 0)
return 0;
LOWESTBITIDX_32(x);
return 1 + x;
}
#endif
#endif /* __NV_COMMON_UTILS_H__ */

View File

@@ -32,6 +32,7 @@
#include "nvtypes.h"
#include "nvmisc.h"
#include "nv_common_utils.h"
#include <nvlimits.h> /* NV_MAX_SUBDEVICES */
typedef struct {
@@ -299,7 +300,7 @@ static inline int nvDpyIdListToNvControlVal(NVDpyIdList dpyIdList)
static inline NVDpyId nvNvControlValToDpyId(int val)
{
NVDpyId dpyId;
dpyId.opaqueDpyId = (val == 0) ? 0 : 1 << (__builtin_ffs(val)-1);
dpyId.opaqueDpyId = (val == 0) ? 0 : 1 << (nv_ffs(val)-1);
return dpyId;
}
@@ -316,7 +317,7 @@ static inline NVDpyIdList nvNvControlValToDpyIdList(int val)
static inline NVDpyId nvNvU32ToDpyId(NvU32 val)
{
NVDpyId dpyId;
dpyId.opaqueDpyId = (val == 0) ? 0 : 1 << (__builtin_ffs(val)-1);
dpyId.opaqueDpyId = (val == 0) ? 0 : 1 << (nv_ffs(val)-1);
return dpyId;
}
@@ -340,7 +341,7 @@ static inline NvU32 nvDpyIdListToNvU32(NVDpyIdList dpyIdList)
/* Return the bit position of dpyId: a number in the range [0..31]. */
static inline NvU32 nvDpyIdToIndex(NVDpyId dpyId)
{
return __builtin_ffs(dpyId.opaqueDpyId) - 1;
return nv_ffs(dpyId.opaqueDpyId) - 1;
}
/* Return a display ID that is not in the list passed in. */
@@ -352,7 +353,7 @@ static inline NVDpyId nvNewDpyId(NVDpyIdList excludeList)
return nvInvalidDpyId();
}
dpyId.opaqueDpyId =
1U << (__builtin_ffs(~excludeList.opaqueDpyIdList) - 1);
1U << (nv_ffs(~excludeList.opaqueDpyIdList) - 1);
return dpyId;
}

View File

@@ -67,7 +67,7 @@ void nvPushAcquireTimelineSemaphore(
NvU64 val);
NvBool nvPushDecodeMethod(NvU32 header, NvU32 *count);
void nvPushSetObject(NvPushChannelPtr p, NvU32 subch, NvU32 object[NV_MAX_SUBDEVICES]);
void nvPushSetObject(NvPushChannelPtr p, NvU32 subch, NvU32 *object);
void nvPushSetSubdeviceMask(NvPushChannelPtr p, NvU32 mask);
void __nvPushMakeRoom(NvPushChannelPtr, NvU32 count);

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 1993-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 1993-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 1993-2018 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 1993-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -971,7 +971,7 @@ static NvU32 GetSetObjectHandle(NvPushChannelPtr pChannel, NvU32 handle,
}
// Issue a SET_OBJECT method on the specified subchannel.
void nvPushSetObject(NvPushChannelPtr p, NvU32 subch, NvU32 object[NV_MAX_SUBDEVICES])
void nvPushSetObject(NvPushChannelPtr p, NvU32 subch, NvU32 *object)
{
const NvPushDeviceRec *pDevice = p->pDevice;
const NvU32 oldSubDevMask = p->currentSubDevMask;