drivers/gpu/drm/drm_colorop.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/drm_colorop.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/drm_colorop.c
Extension
.c
Size
19137 bytes
Lines
647
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: exported/initcall integration point
Status
integration 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

// SPDX-License-Identifier: MIT
/*
 * Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Authors: AMD
 *
 */

#include <drm/drm_colorop.h>
#include <drm/drm_print.h>
#include <drm/drm_drv.h>
#include <drm/drm_plane.h>

#include "drm_crtc_internal.h"

/**
 * DOC: overview
 *
 * When userspace signals the &DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE it
 * should use the COLOR_PIPELINE plane property and associated colorops
 * for any color operation on the &drm_plane. Setting of all old color
 * properties, such as COLOR_ENCODING and COLOR_RANGE, will be rejected
 * and the values of the properties will be ignored.
 *
 * Colorops are only advertised and valid for atomic drivers and atomic
 * userspace that signals the &DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE
 * client cap.
 *
 * A colorop represents a single color operation. Colorops are chained
 * via the NEXT property and make up color pipelines. Color pipelines
 * are advertised and selected via the COLOR_PIPELINE &drm_plane
 * property.
 *
 * A colorop will be of a certain type, advertised by the read-only TYPE
 * property. Each type of colorop will advertise a different set of
 * properties and is programmed in a different manner. Types can be
 * enumerated 1D curves, 1D LUTs, 3D LUTs, matrices, etc. See the
 * &drm_colorop_type documentation for information on each type.
 *
 * If a colorop advertises the BYPASS property it can be bypassed.
 *
 * Information about colorop and color pipeline design decisions can be
 * found at rfc/color_pipeline.rst, but note that this document will
 * grow stale over time.
 */

static const struct drm_prop_enum_list drm_colorop_type_enum_list[] = {
	{ DRM_COLOROP_1D_CURVE, "1D Curve" },
	{ DRM_COLOROP_1D_LUT, "1D LUT" },
	{ DRM_COLOROP_CTM_3X4, "3x4 Matrix"},
	{ DRM_COLOROP_MULTIPLIER, "Multiplier"},
	{ DRM_COLOROP_3D_LUT, "3D LUT"},
};

static const char * const colorop_curve_1d_type_names[] = {
	[DRM_COLOROP_1D_CURVE_SRGB_EOTF] = "sRGB EOTF",
	[DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF] = "sRGB Inverse EOTF",
	[DRM_COLOROP_1D_CURVE_PQ_125_EOTF] = "PQ 125 EOTF",
	[DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF] = "PQ 125 Inverse EOTF",
	[DRM_COLOROP_1D_CURVE_BT2020_INV_OETF] = "BT.2020 Inverse OETF",
	[DRM_COLOROP_1D_CURVE_BT2020_OETF] = "BT.2020 OETF",
	[DRM_COLOROP_1D_CURVE_GAMMA22] = "Gamma 2.2",
	[DRM_COLOROP_1D_CURVE_GAMMA22_INV] = "Gamma 2.2 Inverse",
};

static const struct drm_prop_enum_list drm_colorop_lut1d_interpolation_list[] = {
	{ DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR, "Linear" },
};


static const struct drm_prop_enum_list drm_colorop_lut3d_interpolation_list[] = {
	{ DRM_COLOROP_LUT3D_INTERPOLATION_TETRAHEDRAL, "Tetrahedral" },

Annotation

Implementation Notes