drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c- Extension
.c- Size
- 84860 bytes
- Lines
- 2948
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/kthread.hlinux/seq_file.hdrm/drm_atomic.hdrm/drm_crtc.hdrm/drm_file.hdrm/drm_probe_helper.hdrm/drm_framebuffer.hmsm_drv.hdpu_kms.hdpu_hwio.hdpu_hw_catalog.hdpu_hw_intf.hdpu_hw_ctl.hdpu_hw_cwb.hdpu_hw_dspp.hdpu_hw_dsc.hdpu_hw_merge3d.hdpu_hw_cdm.hdpu_formats.hdpu_encoder_phys.hdpu_crtc.hdpu_trace.hdpu_core_irq.hdisp/msm_disp_snapshot.h
Detected Declarations
struct dpu_encoder_virtenum dpu_enc_rc_eventsenum dpu_enc_rc_statesfunction dpu_encoder_get_drm_fmtfunction dpu_encoder_needs_periph_flushfunction dpu_encoder_is_widebus_enabledfunction dpu_encoder_is_dsc_enabledfunction dpu_encoder_get_crc_values_cntfunction dpu_encoder_setup_misrfunction dpu_encoder_get_crcfunction _dpu_encoder_setup_ditherfunction dpu_encoder_helper_report_irq_timeoutfunction dpu_encoder_helper_wait_for_irqfunction dpu_encoder_get_vsync_countfunction dpu_encoder_get_linecountfunction dpu_encoder_helper_split_configfunction dpu_encoder_use_dsc_mergefunction dpu_encoder_update_topologyfunction atomic_checkfunction dpu_encoder_needs_modesetfunction dpu_encoder_update_topologyfunction _dpu_encoder_update_vsync_sourcefunction _dpu_encoder_irq_enablefunction _dpu_encoder_irq_disablefunction _dpu_encoder_resource_enablefunction _dpu_encoder_resource_disablefunction dpu_encoder_resource_controlfunction dpu_encoder_prepare_wb_jobfunction dpu_encoder_cleanup_wb_jobfunction dpu_encoder_virt_atomic_mode_setfunction _dpu_encoder_virt_enable_helperfunction dpu_encoder_virt_runtime_resumefunction dpu_encoder_virt_atomic_enablefunction dpu_encoder_virt_atomic_disablefunction dpu_encoder_vblank_callbackfunction dpu_encoder_underrun_callbackfunction dpu_encoder_assign_crtcfunction dpu_encoder_toggle_vblank_for_crtcfunction dpu_encoder_frame_done_callbackfunction dpu_encoder_off_workfunction _dpu_encoder_trigger_flushfunction _dpu_encoder_trigger_startfunction dpu_encoder_helper_trigger_startfunction dpu_encoder_helper_wait_event_timeoutfunction dpu_encoder_helper_hw_resetfunction _dpu_encoder_kickoff_physfunction dpu_encoder_trigger_kickoff_pendingfunction _dpu_encoder_calculate_linetime
Annotated Snippet
struct dpu_encoder_virt {
struct drm_encoder base;
spinlock_t enc_spinlock;
bool enabled;
bool commit_done_timedout;
unsigned int num_phys_encs;
struct dpu_encoder_phys *phys_encs[MAX_PHYS_ENCODERS_PER_VIRTUAL];
struct dpu_encoder_phys *cur_master;
struct dpu_encoder_phys *cur_slave;
struct dpu_hw_pingpong *hw_pp[MAX_CHANNELS_PER_ENC];
struct dpu_hw_cwb *hw_cwb[MAX_CWB_PER_ENC];
struct dpu_hw_dsc *hw_dsc[MAX_CHANNELS_PER_ENC];
unsigned int dsc_mask;
unsigned int cwb_mask;
bool intfs_swapped;
struct drm_crtc *crtc;
struct drm_connector *connector;
struct mutex enc_lock;
DECLARE_BITMAP(frame_busy_mask, MAX_PHYS_ENCODERS_PER_VIRTUAL);
atomic_t frame_done_timeout_ms;
atomic_t frame_done_timeout_cnt;
struct timer_list frame_done_timer;
struct msm_display_info disp_info;
bool idle_pc_supported;
struct mutex rc_lock;
enum dpu_enc_rc_states rc_state;
struct delayed_work delayed_off_work;
struct msm_display_topology topology;
u32 idle_timeout;
bool wide_bus_en;
/* DSC configuration */
struct drm_dsc_config *dsc;
};
#define to_dpu_encoder_virt(x) container_of(x, struct dpu_encoder_virt, base)
static u32 dither_matrix[DITHER_MATRIX_SZ] = {
15, 7, 13, 5, 3, 11, 1, 9, 12, 4, 14, 6, 0, 8, 2, 10
};
/**
* dpu_encoder_get_drm_fmt - return DRM fourcc format
* @phys_enc: Pointer to physical encoder structure
*/
u32 dpu_encoder_get_drm_fmt(struct dpu_encoder_phys *phys_enc)
{
struct drm_encoder *drm_enc;
struct dpu_encoder_virt *dpu_enc;
struct drm_display_info *info;
struct drm_display_mode *mode;
drm_enc = phys_enc->parent;
dpu_enc = to_dpu_encoder_virt(drm_enc);
info = &dpu_enc->connector->display_info;
mode = &phys_enc->cached_mode;
if (drm_mode_is_420_only(info, mode))
return DRM_FORMAT_YUV420;
return DRM_FORMAT_RGB888;
}
/**
* dpu_encoder_needs_periph_flush - return true if physical encoder requires
* peripheral flush
* @phys_enc: Pointer to physical encoder structure
*/
bool dpu_encoder_needs_periph_flush(struct dpu_encoder_phys *phys_enc)
{
struct drm_encoder *drm_enc;
struct dpu_encoder_virt *dpu_enc;
struct msm_display_info *disp_info;
struct msm_drm_private *priv;
struct drm_display_mode *mode;
drm_enc = phys_enc->parent;
dpu_enc = to_dpu_encoder_virt(drm_enc);
disp_info = &dpu_enc->disp_info;
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/kthread.h`, `linux/seq_file.h`, `drm/drm_atomic.h`, `drm/drm_crtc.h`, `drm/drm_file.h`, `drm/drm_probe_helper.h`, `drm/drm_framebuffer.h`.
- Detected declarations: `struct dpu_encoder_virt`, `enum dpu_enc_rc_events`, `enum dpu_enc_rc_states`, `function dpu_encoder_get_drm_fmt`, `function dpu_encoder_needs_periph_flush`, `function dpu_encoder_is_widebus_enabled`, `function dpu_encoder_is_dsc_enabled`, `function dpu_encoder_get_crc_values_cnt`, `function dpu_encoder_setup_misr`, `function dpu_encoder_get_crc`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.