drivers/gpu/drm/amd/display/include/fixed31_32.h

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/include/fixed31_32.h

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/amd/display/include/fixed31_32.h
Extension
.h
Size
11663 bytes
Lines
541
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct fixed31_32 {
	long long value;
};


/*
 * @brief
 * Useful constants
 */

static const struct fixed31_32 dc_fixpt_zero = { 0 };
static const struct fixed31_32 dc_fixpt_epsilon = { 1LL };
static const struct fixed31_32 dc_fixpt_half = { 0x80000000LL };
static const struct fixed31_32 dc_fixpt_one = { 0x100000000LL };

/*
 * @brief
 * Initialization routines
 */

/*
 * @brief
 * result = numerator / denominator
 */
struct fixed31_32 dc_fixpt_from_fraction(long long numerator, long long denominator);

/*
 * @brief
 * result = arg
 */
static inline struct fixed31_32 dc_fixpt_from_int(int arg)
{
	struct fixed31_32 res;

	res.value = (long long) arg << FIXED31_32_BITS_PER_FRACTIONAL_PART;

	return res;
}

/*
 * @brief
 * Unary operators
 */

/*
 * @brief
 * result = -arg
 */
static inline struct fixed31_32 dc_fixpt_neg(struct fixed31_32 arg)
{
	struct fixed31_32 res;

	res.value = -arg.value;

	return res;
}

/*
 * @brief
 * result = abs(arg) := (arg >= 0) ? arg : -arg
 */
static inline struct fixed31_32 dc_fixpt_abs(struct fixed31_32 arg)
{
	if (arg.value < 0)
		return dc_fixpt_neg(arg);
	else
		return arg;
}

/*
 * @brief
 * Binary relational operators
 */

/*
 * @brief
 * result = arg1 < arg2
 */
static inline bool dc_fixpt_lt(struct fixed31_32 arg1, struct fixed31_32 arg2)
{
	return arg1.value < arg2.value;
}

/*
 * @brief
 * result = arg1 <= arg2
 */
static inline bool dc_fixpt_le(struct fixed31_32 arg1, struct fixed31_32 arg2)
{
	return arg1.value <= arg2.value;

Annotation

Implementation Notes