drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.c- Extension
.c- Size
- 7351 bytes
- Lines
- 258
- 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.
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hdrm/drm_managed.hdpu_hw_mdss.hdpu_hw_util.hdpu_hw_catalog.hdpu_hw_cdm.hdpu_kms.h
Detected Declarations
function dpu_hw_cdm_setup_cdwnfunction dpu_hw_cdm_enablefunction dpu_hw_cdm_bind_pingpong_blk
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2023, The Linux Foundation. All rights reserved.
*/
#include <linux/bitfield.h>
#include <drm/drm_managed.h>
#include "dpu_hw_mdss.h"
#include "dpu_hw_util.h"
#include "dpu_hw_catalog.h"
#include "dpu_hw_cdm.h"
#include "dpu_kms.h"
#define CDM_CSC_10_OPMODE 0x000
#define CDM_CSC_10_BASE 0x004
#define CDM_CDWN2_OP_MODE 0x100
#define CDM_CDWN2_CLAMP_OUT 0x104
#define CDM_CDWN2_PARAMS_3D_0 0x108
#define CDM_CDWN2_PARAMS_3D_1 0x10C
#define CDM_CDWN2_COEFF_COSITE_H_0 0x110
#define CDM_CDWN2_COEFF_COSITE_H_1 0x114
#define CDM_CDWN2_COEFF_COSITE_H_2 0x118
#define CDM_CDWN2_COEFF_OFFSITE_H_0 0x11C
#define CDM_CDWN2_COEFF_OFFSITE_H_1 0x120
#define CDM_CDWN2_COEFF_OFFSITE_H_2 0x124
#define CDM_CDWN2_COEFF_COSITE_V 0x128
#define CDM_CDWN2_COEFF_OFFSITE_V 0x12C
#define CDM_CDWN2_OUT_SIZE 0x130
#define CDM_HDMI_PACK_OP_MODE 0x200
#define CDM_CSC_10_MATRIX_COEFF_0 0x004
#define CDM_MUX 0x224
/* CDM CDWN2 sub-block bit definitions */
#define CDM_CDWN2_OP_MODE_EN BIT(0)
#define CDM_CDWN2_OP_MODE_ENABLE_H BIT(1)
#define CDM_CDWN2_OP_MODE_ENABLE_V BIT(2)
#define CDM_CDWN2_OP_MODE_BITS_OUT_8BIT BIT(7)
#define CDM_CDWN2_V_PIXEL_METHOD_MASK GENMASK(6, 5)
#define CDM_CDWN2_H_PIXEL_METHOD_MASK GENMASK(4, 3)
/* CDM CSC10 sub-block bit definitions */
#define CDM_CSC10_OP_MODE_EN BIT(0)
#define CDM_CSC10_OP_MODE_SRC_FMT_YUV BIT(1)
#define CDM_CSC10_OP_MODE_DST_FMT_YUV BIT(2)
/* CDM HDMI pack sub-block bit definitions */
#define CDM_HDMI_PACK_OP_MODE_EN BIT(0)
/*
* Horizontal coefficients for cosite chroma downscale
* s13 representation of coefficients
*/
static u32 cosite_h_coeff[] = {0x00000016, 0x000001cc, 0x0100009e};
/*
* Horizontal coefficients for offsite chroma downscale
*/
static u32 offsite_h_coeff[] = {0x000b0005, 0x01db01eb, 0x00e40046};
/*
* Vertical coefficients for cosite chroma downscale
*/
static u32 cosite_v_coeff[] = {0x00080004};
/*
* Vertical coefficients for offsite chroma downscale
*/
static u32 offsite_v_coeff[] = {0x00060002};
static int dpu_hw_cdm_setup_cdwn(struct dpu_hw_cdm *ctx, struct dpu_hw_cdm_cfg *cfg)
{
struct dpu_hw_blk_reg_map *c = &ctx->hw;
u32 opmode;
u32 out_size;
switch (cfg->h_cdwn_type) {
case CDM_CDWN_DISABLE:
opmode = 0;
break;
case CDM_CDWN_PIXEL_DROP:
opmode = CDM_CDWN2_OP_MODE_ENABLE_H |
FIELD_PREP(CDM_CDWN2_H_PIXEL_METHOD_MASK,
CDM_CDWN2_METHOD_PIXEL_DROP);
break;
case CDM_CDWN_AVG:
opmode = CDM_CDWN2_OP_MODE_ENABLE_H |
Annotation
- Immediate include surface: `linux/bitfield.h`, `drm/drm_managed.h`, `dpu_hw_mdss.h`, `dpu_hw_util.h`, `dpu_hw_catalog.h`, `dpu_hw_cdm.h`, `dpu_kms.h`.
- Detected declarations: `function dpu_hw_cdm_setup_cdwn`, `function dpu_hw_cdm_enable`, `function dpu_hw_cdm_bind_pingpong_blk`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.