Files
erofs-linux/include/drm/drm_colorop.h
T
Linus Torvalds 4b99990cdf Merge tag 'drm-next-2026-06-17' of https://gitlab.freedesktop.org/drm/kernel
Pull drm updates from Dave Airlie:
 "Highlights:
   - xe: add initial CRI platform support
   - amdgpu: initial HDMI 2.1 FRL support
   - rust: add some new type concepts for device lifetimes
   - scheduler: moves to a fair algorithm and lots of cleanups

  But it's mostly the usual mountain of changes across the board.

  core:
   - add docbook for DRM_IOCTL_SYNCOBJ_EVENTFD
   - change signature of drm_connector_attach_hdr_output_metadata_property
   - dedup counter and timestamp retrieval in vblank code
   - parse AMD VSDB v3 in CTA extension blocks
   - add P230, Y7, XYYY2101010, T430, XVUY210101010 formats
   - don't call drop master on file close if not master
   - use drm_printf_indent in atomic / bridge
   - fix 32b format descriptions
   - docs: fix toctree
   - hdmi: add common TMDS character rates
   - fix drm_syncobj_find_fence leak

  rust:
   - introduce Higher-Ranked lifetime types
   - replace drvdata with scoped registration data
   - add GPUVM immediate mode abstraction for rust GPU drivers
   - introduce DeviceContext type state for drm::Device

  bridge:
   - clarify drm_bridge_get/put
   - create drm_get_bridge_by_endpoint and use it
   - analogix_dp: add panel probing
   - ite-it6211 - use drm audio hdmi helpers

  buddy:
   - add lockdep annotations

  dp:
   - add PR and VRR updates
   - mst: fix buffer overflows
   - add Adaptive Sync SDP decoding support
   - fix OOB reads in dp-mst

  ttm:
   - bump fpfn/lpfn to 64-bit

  scheduler:
   - change default to fair scheduler
   - map runqueue 1:1 with scheduler

  dma-buf:
   - port selftests to kunit
   - convert dma-buf system/heap allocators to module
   - add separate DMABUF_HEAPS_SYSTEM_CC_SHARED Kconfig

  udmabuf:
   - revert hugetlb support
   - fix error with CONFIG_DMA_API_DEBUG

  dma-fence:
   - fix tracepoints lifetime
   - remove unused signal on any support

  ras:
   - add clear error counter netlink command to drm ras

  gpusvm:
   - reject VMAs with VM_IO or VM_PFNMAP when creating SVM ranges
   - use IOVA allocations

  pagemap:
   - use IOVA allocations

  panels:
   - update to use ref counts
   - add support for CSW PNB601LS1-2, LGD LP116WHA-SPB1
   - add support for waveshare panels
   - CMN N116BCN-EA1, CMN N140HCA-EEK, IVO M140NWFQ R5,
   - IVO, R140NWFW R0, BOE NT140*, BOE NV133FHM-N4F,
   - AUO B140*, AUO B133HAN06.6 and AUO B116XTN02.3 eDP panels
   - Surface Pro 12 Panel

  xe:
   - add CRI PCI-IDs
   - debugfs add multi-lrc info
   - engine init cleanup
   - PF fair scheduling auto provisioning
   - system controller support for CRI/Xe3p
   - PXP state machine fixes
   - Reset/wedge/unload corner case fixes
   - Wedge path memory allocation fixes
   - PAT type cleanups
   - Reject unsafe PAT for CPU cached memory
   - OA improvements for CRI device memory
   - kernel doc syntax in xe headers
   - xe_drm.h documentation fixes
   - include guard cleanups
   - VF CCS memory pool
   - i915/xe step unification
   - Xe3p GT tuning fixes
   - forcewake cleanup in GT and GuC
   - admin-only PF mode
   - enable hwmon energy attributes for CRI
   - enable GT_MI_USER_INTERRUPT
   - refactor emit functions
   - oa workarounds
   - multi_queue: allow QUEUE_TIMESTAMP register
   - convert stolen memory to ttm range manager
   - use xe2 style blitter as a feature flag
   - make drm_driver const
   - add/use IRQ page to HW engine definition
   - fix oops when display disabled

  i915:
   - enable PIPEDMC_ERROR interrupt
   - more common display code refactoring
   - restructure DP/HDMI sink format handling
   - eliminate FB usage from lowlevel pinning code
   - panel replay bw optimization
   - integrate sharpness filter into the scaler
   - new fb_pin abstraction for xe/i915 fb transparent handling
   - skip inactive MST connectors on HDCP
   - start switching to display specific registers
   - use polling when irq unavailable
   - Adaptive-sync SDP prep

  amdgpu:
   - use drm_display_info for AMD VSDB data
   - Initial HDMI 2.1 FRL support
   - Initial DCN 4.2.1 support
   - GART fixes for non-4k pages
   - GC 11.5.6/SDMA 6.4.0/and other new IPs
   - GFX9/DCE6/Hawaii/SDMA4/GART/Userq fixes
   - Finish support for using multiple SDMA queues for TTM operations
   - SWSMU updates
   - GC 12.1 updates
   - SMU 15.0.8 updates
   - DCN 4.2 updates
   - DC type conversion fixes
   - Enable DC power module
   - Replay/PSR updates
   - SMU 13.x updates
   - Compute queue quantum MQD updates
   - ASPM fix
   - Align VKMS with common implementation
   - DC analog support fixes
   - UVD 3 fixes
   - TCC harvesting fixes for SI
   - GC 11 APU module reload fix
   - NBIO 6.3.2 support
   - IH 7.1 updates
   - DC cursor fixes
   - VCN/JPEG user fence fixes
   - DC support for connectors without DDC
   - Prefer ROM BAR for default VGA device
   - DC bandwidth fixes
   - Add PTL support for profiler
   - Introduce dc_plane_cm and migrate surface update color path
   - Add FRL registers for HDMI 2.1
   - Restructure VM state machine
   - Auxless ALPM support
   - GEM_OP locking/warning fixes
   - switch to system_dfl_wq

  amdkfd:
   - GPUVM TLB flush fix
   - Hotplug fix
   - Boundary check fixes
   - SVM fixes
   - CRIU fixes
   - add profiler API
   - MES 12.1 updates

  msm:
   - core:
     - fix shrinker documentation
     - IFPC enabled for gen8
     - PERFCNTR_CONFIG ioctl support
   - GPU:
     - reworked UBWC handling
     - a810 support
   - MDSS:
     - add support for Milos platform
     - reworked UBWC handling
   - DisplayPort:
     - reworked HPD handling as prep for MST
   - DPU:
     - Milos platform support
     - reworked UBWC handling
   - DSI:
     - Milos platform support

  nova:
   - Hopper/Blackwell enablement (GH100/GB100/GB202)
     - FSP support
     - 32-bit firmware support
     - HAL functions
   - refactor GSP boot/unload
   - GA100 support
   - VBIOS hardening/refactoring
   - Adopt higher order lifetime types

  tyr:
   - define register blocks
   - add shmem backed GEM objects
   - adopt higher order lifetime types
   - move clock cleanup into Drop

  radeon:
   - Hawaii SMU fixes
   - CS parser fix
   - use struct drm_edid instead of edid

  amdxdna:
   - export per-client BO memory via fdinfo
   - AIE4 device support
   - support medium/lower power modes
   - expandable device heap support
   - revert read-only user-pointer BO mappings

  ivpu:
   - support frequency limiting

  panthor:
   - enable GEM shrinker support
   - add eviction and reclaim info to fdinfo

  v3d:
   - enable runtime PM

  mgag200:
   - support XRGB1555 + C8

  ast:
   - support XRGB1555 + C8
   - use constants for lots of registers
   - fix register handling

  imagination:
   - fence handling refactoring

  nouveau:
   - fix sched double call
   - expose VBIOS on GSP-RM systems
   - add GA100 support

  virtio:
   - add VIRTIO_GPU_F_BLOB_ALIGNMENT flag
   - add deferred mapping support

  gud:
   - add RCade Display Adapter

  hibmc:
   - fix no connectors usage

  mediatek:
   - hdmi: convert error handling
   - simplify mtk_crtc allocation

  exynos:
   - move fbdev emulation to drm client buffers
   - use drm format helpers for geometry/size
   - adopt core DMA tracking
   - fix framebuffer offset handling

  renesas:
   - add RZ/T2H SOC support

  versilicon:
   - add cursor plane support

  tegra:
   - use drm client for framebuffer"

* tag 'drm-next-2026-06-17' of https://gitlab.freedesktop.org/drm/kernel: (1731 commits)
  dma-buf: move system_cc_shared heap under separate Kconfig
  accel/amdxdna: Clear sva pointer after unbind
  agp/amd64: Fix broken error propagation in agp_amd64_probe()
  accel/amdxdna: Require carveout when PASID and force_iova are disabled
  drm/amdkfd: always resume_all after suspend_all
  drm/amdgpu/gfx: move fault and EOP IRQ get/put to hw_init/hw_fini
  drm/amd/display: Consult MCCS FreeSync cap only if requested & supported
  drm/amd/pm: Use strscpy in profile mode parsing
  drm/amdkfd: Fix infinite loop parsing CRAT with zero subtype length
  drm/amdkfd: fix sysfs topology prop length on buffer truncation
  drm/amdgpu: drop retry loop in amdgpu_hmm_range_get_pages
  drm/amd/pm: bound OD parameter parsing to stack array size
  drm/amd/pm: Stop pp_od_clk_voltage emit at PAGE_SIZE
  drm/amdkfd: Unwind debug trap enable on copy_to_user failure
  drm/amdgpu: validate the mes firmware version for gfx12.1
  drm/amdgpu: validate the mes firmware version for gfx12
  drm/amdgpu: compare MES firmware version ucode for gfx11
  drm/amdkfd: Add bounds check for AMDKFD_IOC_WAIT_EVENTS
  drm/amdgpu: restart the CS if some parts of the VM are still invalidated
  drm/amd/display: use unsigned types for local pipe and REG_GET counters
  ...
2026-06-17 10:21:00 +01:00

485 lines
13 KiB
C

/* 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
*
*/
#ifndef __DRM_COLOROP_H__
#define __DRM_COLOROP_H__
#include <drm/drm_mode_object.h>
#include <drm/drm_mode.h>
#include <drm/drm_property.h>
/* DRM colorop flags */
#define DRM_COLOROP_FLAG_ALLOW_BYPASS (1<<0) /* Allow bypass on the drm_colorop */
/**
* enum drm_colorop_curve_1d_type - type of 1D curve
*
* Describes a 1D curve to be applied by the DRM_COLOROP_1D_CURVE colorop.
*/
enum drm_colorop_curve_1d_type {
/**
* @DRM_COLOROP_1D_CURVE_SRGB_EOTF:
*
* enum string "sRGB EOTF"
*
* sRGB piece-wise electro-optical transfer function. Transfer
* characteristics as defined by IEC 61966-2-1 sRGB. Equivalent
* to H.273 TransferCharacteristics code point 13 with
* MatrixCoefficients set to 0.
*/
DRM_COLOROP_1D_CURVE_SRGB_EOTF,
/**
* @DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF:
*
* enum string "sRGB Inverse EOTF"
*
* The inverse of &DRM_COLOROP_1D_CURVE_SRGB_EOTF
*/
DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF,
/**
* @DRM_COLOROP_1D_CURVE_PQ_125_EOTF:
*
* enum string "PQ 125 EOTF"
*
* The PQ transfer function, scaled by 125.0f, so that 10,000
* nits correspond to 125.0f.
*
* Transfer characteristics of the PQ function as defined by
* SMPTE ST 2084 (2014) for 10-, 12-, 14-, and 16-bit systems
* and Rec. ITU-R BT.2100-2 perceptual quantization (PQ) system,
* represented by H.273 TransferCharacteristics code point 16.
*/
DRM_COLOROP_1D_CURVE_PQ_125_EOTF,
/**
* @DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF:
*
* enum string "PQ 125 Inverse EOTF"
*
* The inverse of DRM_COLOROP_1D_CURVE_PQ_125_EOTF.
*/
DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF,
/**
* @DRM_COLOROP_1D_CURVE_BT2020_INV_OETF:
*
* enum string "BT.2020 Inverse OETF"
*
* The inverse of &DRM_COLOROP_1D_CURVE_BT2020_OETF
*/
DRM_COLOROP_1D_CURVE_BT2020_INV_OETF,
/**
* @DRM_COLOROP_1D_CURVE_BT2020_OETF:
*
* enum string "BT.2020 OETF"
*
* The BT.2020/BT.709 transfer function. The BT.709 and BT.2020
* transfer functions are the same, the only difference is that
* BT.2020 is defined with more precision for 10 and 12-bit
* encodings.
*
*
*/
DRM_COLOROP_1D_CURVE_BT2020_OETF,
/**
* @DRM_COLOROP_1D_CURVE_GAMMA22:
*
* enum string "Gamma 2.2"
*
* A gamma 2.2 power function. This applies a power curve with
* gamma value of 2.2 to the input values.
*/
DRM_COLOROP_1D_CURVE_GAMMA22,
/**
* @DRM_COLOROP_1D_CURVE_GAMMA22_INV:
*
* enum string "Gamma 2.2 Inverse"
*
* The inverse of &DRM_COLOROP_1D_CURVE_GAMMA22
*/
DRM_COLOROP_1D_CURVE_GAMMA22_INV,
/**
* @DRM_COLOROP_1D_CURVE_COUNT:
*
* enum value denoting the size of the enum
*/
DRM_COLOROP_1D_CURVE_COUNT
};
/**
* struct drm_colorop_state - mutable colorop state
*/
struct drm_colorop_state {
/** @colorop: backpointer to the colorop */
struct drm_colorop *colorop;
/*
* Color properties
*
* The following fields are not always valid, their usage depends
* on the colorop type. See their associated comment for more
* information.
*/
/**
* @bypass:
*
* When the property BYPASS exists on this colorop, this stores
* the requested bypass state: true if colorop shall be bypassed,
* false if colorop is enabled.
*/
bool bypass;
/**
* @curve_1d_type:
*
* Type of 1D curve.
*/
enum drm_colorop_curve_1d_type curve_1d_type;
/**
* @multiplier:
*
* Multiplier to 'gain' the plane. Format is S31.32 sign-magnitude.
*/
uint64_t multiplier;
/**
* @data:
*
* Data blob for any TYPE that requires such a blob. The
* interpretation of the blob is TYPE-specific.
*
* See the &drm_colorop_type documentation for how blob is laid
* out.
*/
struct drm_property_blob *data;
/**
* @lut1d_interpolation:
*
* Interpolation for DRM_COLOROP_1D_LUT
*/
enum drm_colorop_lut1d_interpolation_type lut1d_interpolation;
/**
* @lut3d_interpolation:
*
* Interpolation for DRM_COLOROP_3D_LUT
*/
enum drm_colorop_lut3d_interpolation_type lut3d_interpolation;
/** @state: backpointer to global drm_atomic_commit */
struct drm_atomic_commit *state;
};
/**
* struct drm_colorop_funcs - driver colorop control functions
*/
struct drm_colorop_funcs {
/**
* @destroy:
*
* Clean up colorop resources. This is called at driver unload time
* through drm_mode_config_cleanup()
*/
void (*destroy)(struct drm_colorop *colorop);
};
/**
* struct drm_colorop - DRM color operation control structure
*
* A colorop represents one color operation. They can be chained via
* the 'next' pointer to build a color pipeline.
*
* Since colorops cannot stand-alone and are used to describe colorop
* operations on a plane they don't have their own locking mechanism but
* are locked and programmed along with their associated &drm_plane.
*
*/
struct drm_colorop {
/** @dev: parent DRM device */
struct drm_device *dev;
/**
* @head:
*
* List of all colorops on @dev, linked from &drm_mode_config.colorop_list.
* Invariant over the lifetime of @dev and therefore does not need
* locking.
*/
struct list_head head;
/**
* @index: Position inside the mode_config.list, can be used as an array
* index. It is invariant over the lifetime of the colorop.
*/
unsigned int index;
/** @base: base mode object */
struct drm_mode_object base;
/**
* @plane:
*
* The plane on which the colorop sits. A drm_colorop is always unique
* to a plane.
*/
struct drm_plane *plane;
/**
* @state:
*
* Current atomic state for this colorop.
*
* This is protected by @mutex. Note that nonblocking atomic commits
* access the current colorop state without taking locks.
*/
struct drm_colorop_state *state;
/*
* Color properties
*
* The following fields are not always valid, their usage depends
* on the colorop type. See their associated comment for more
* information.
*/
/** @properties: property tracking for this colorop */
struct drm_object_properties properties;
/**
* @type:
*
* Read-only
* Type of color operation
*/
enum drm_colorop_type type;
/**
* @next:
*
* Read-only
* Pointer to next drm_colorop in pipeline
*/
struct drm_colorop *next;
/**
* @type_property:
*
* Read-only "TYPE" property for specifying the type of
* this color operation. The type is enum drm_colorop_type.
*/
struct drm_property *type_property;
/**
* @bypass_property:
*
* Boolean property to control enablement of the color
* operation. Only present if DRM_COLOROP_FLAG_ALLOW_BYPASS
* flag is set. When present, setting bypass to "true" shall
* always be supported to allow compositors to quickly fall
* back to alternate methods of color processing. This is
* important since setting color operations can fail due to
* unique HW constraints.
*/
struct drm_property *bypass_property;
/**
* @size:
*
* Number of entries of the custom LUT. This should be read-only.
*/
uint32_t size;
/**
* @lut1d_interpolation_property:
*
* Property for DRM_COLOROP_1D_LUT interpolation
*/
struct drm_property *lut1d_interpolation_property;
/**
* @curve_1d_type_property:
*
* Sub-type for DRM_COLOROP_1D_CURVE type.
*/
struct drm_property *curve_1d_type_property;
/**
* @multiplier_property:
*
* Multiplier property for plane gain
*/
struct drm_property *multiplier_property;
/**
* @size_property:
*
* Size property for custom LUT from userspace.
*/
struct drm_property *size_property;
/**
* @lut3d_interpolation_property:
*
* Property for DRM_COLOROP_3D_LUT interpolation
*/
struct drm_property *lut3d_interpolation_property;
/**
* @data_property:
*
* blob property for any TYPE that requires a blob of data,
* such as 1DLUT, CTM, 3DLUT, etc.
*
* The way this blob is interpreted depends on the TYPE of
* this
*/
struct drm_property *data_property;
/**
* @next_property:
*
* Read-only property to next colorop in the pipeline
*/
struct drm_property *next_property;
/** @funcs: colorop control functions */
const struct drm_colorop_funcs *funcs;
};
#define obj_to_colorop(x) container_of(x, struct drm_colorop, base)
/**
* drm_colorop_find - look up a Colorop object from its ID
* @dev: DRM device
* @file_priv: drm file to check for lease against.
* @id: &drm_mode_object ID
*
* This can be used to look up a Colorop from its userspace ID. Only used by
* drivers for legacy IOCTLs and interface, nowadays extensions to the KMS
* userspace interface should be done using &drm_property.
*/
static inline struct drm_colorop *drm_colorop_find(struct drm_device *dev,
struct drm_file *file_priv,
uint32_t id)
{
struct drm_mode_object *mo;
mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_COLOROP);
return mo ? obj_to_colorop(mo) : NULL;
}
void drm_colorop_pipeline_destroy(struct drm_device *dev);
void drm_colorop_cleanup(struct drm_colorop *colorop);
int drm_plane_colorop_curve_1d_init(struct drm_device *dev, struct drm_colorop *colorop,
struct drm_plane *plane, const struct drm_colorop_funcs *funcs,
u64 supported_tfs, uint32_t flags);
int drm_plane_colorop_curve_1d_lut_init(struct drm_device *dev, struct drm_colorop *colorop,
struct drm_plane *plane,
const struct drm_colorop_funcs *funcs,
uint32_t lut_size,
enum drm_colorop_lut1d_interpolation_type interpolation,
uint32_t flags);
int drm_plane_colorop_ctm_3x4_init(struct drm_device *dev, struct drm_colorop *colorop,
struct drm_plane *plane, const struct drm_colorop_funcs *funcs,
uint32_t flags);
int drm_plane_colorop_mult_init(struct drm_device *dev, struct drm_colorop *colorop,
struct drm_plane *plane, const struct drm_colorop_funcs *funcs,
uint32_t flags);
int drm_plane_colorop_3dlut_init(struct drm_device *dev, struct drm_colorop *colorop,
struct drm_plane *plane, const struct drm_colorop_funcs *funcs,
uint32_t lut_size,
enum drm_colorop_lut3d_interpolation_type interpolation,
uint32_t flags);
struct drm_colorop_state *
drm_atomic_helper_colorop_duplicate_state(struct drm_colorop *colorop);
void drm_colorop_atomic_destroy_state(struct drm_colorop *colorop,
struct drm_colorop_state *state);
/**
* drm_colorop_reset - reset colorop atomic state
* @colorop: drm colorop
*
* Resets the atomic state for @colorop by freeing the state pointer (which might
* be NULL, e.g. at driver load time) and allocating a new empty state object.
*/
void drm_colorop_reset(struct drm_colorop *colorop);
void drm_colorop_destroy(struct drm_colorop *colorop);
/**
* drm_colorop_index - find the index of a registered colorop
* @colorop: colorop to find index for
*
* Given a registered colorop, return the index of that colorop within a DRM
* device's list of colorops.
*/
static inline unsigned int drm_colorop_index(const struct drm_colorop *colorop)
{
return colorop->index;
}
#define drm_for_each_colorop(colorop, dev) \
list_for_each_entry(colorop, &(dev)->mode_config.colorop_list, head)
/**
* drm_get_colorop_type_name - return a string for colorop type
* @type: colorop type to compute name of
*
* In contrast to the other drm_get_*_name functions this one here returns a
* const pointer and hence is threadsafe.
*/
const char *drm_get_colorop_type_name(enum drm_colorop_type type);
/**
* drm_get_colorop_curve_1d_type_name - return a string for 1D curve type
* @type: 1d curve type to compute name of
*
* In contrast to the other drm_get_*_name functions this one here returns a
* const pointer and hence is threadsafe.
*/
const char *drm_get_colorop_curve_1d_type_name(enum drm_colorop_curve_1d_type type);
const char *
drm_get_colorop_lut1d_interpolation_name(enum drm_colorop_lut1d_interpolation_type type);
const char *
drm_get_colorop_lut3d_interpolation_name(enum drm_colorop_lut3d_interpolation_type type);
void drm_colorop_set_next_property(struct drm_colorop *colorop, struct drm_colorop *next);
#endif /* __DRM_COLOROP_H__ */