drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c- Extension
.c- Size
- 57383 bytes
- Lines
- 1964
- 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.
- 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/debugfs.hlinux/dma-buf.hdrm/drm_atomic.hdrm/drm_atomic_uapi.hdrm/drm_blend.hdrm/drm_damage_helper.hdrm/drm_framebuffer.hdrm/drm_gem_atomic_helper.hlinux/soc/qcom/ubwc.hmsm_drv.hdpu_kms.hdpu_hw_sspp.hdpu_hw_util.hdpu_trace.hdpu_crtc.hdpu_vbif.hdpu_plane.h
Detected Declarations
struct dpu_planefunction _dpu_plane_calc_bwfunction _dpu_plane_calc_clkfunction _dpu_plane_calc_fill_levelfunction _dpu_plane_set_qos_lutfunction _dpu_plane_set_qos_ctrlfunction _dpu_plane_sspp_clk_force_ctrlfunction _dpu_plane_set_ot_limitfunction _dpu_plane_set_qos_remapfunction _dpu_plane_setup_scaler3function _dpu_plane_setup_pixel_extfunction _dpu_plane_setup_scalerfunction _dpu_plane_color_fill_pipefunction _dpu_plane_color_fillfunction dpu_plane_prepare_fbfunction dpu_plane_cleanup_fbfunction dpu_plane_check_inline_rotationfunction dpu_plane_atomic_check_pipefunction drm_rect_heightfunction drm_rect_widthfunction drm_rect_heightfunction dpu_plane_atomic_check_nossppfunction drm_rect_heightfunction dpu_plane_splitfunction dpu_plane_is_multirect_capablefunction dpu_plane_is_parallel_capablefunction dpu_plane_is_multirect_parallel_capablefunction dpu_plane_get_single_pipe_in_stagefunction drm_rect_widthfunction dpu_plane_atomic_check_ssppfunction dpu_plane_try_multirect_parallelfunction dpu_plane_try_multirect_sharedfunction dpu_plane_atomic_checkfunction dpu_plane_assign_resource_in_stagefunction dpu_plane_virtual_assign_resourcesfunction dpu_plane_assign_resourcesfunction dpu_assign_plane_resourcesfunction dpu_plane_flush_cscfunction dpu_plane_flushfunction dpu_plane_set_errorfunction dpu_plane_sspp_update_pipefunction dpu_plane_sspp_atomic_updatefunction _dpu_plane_atomic_disablefunction dpu_plane_atomic_updatefunction dpu_plane_destroy_statefunction dpu_plane_duplicate_statefunction dpu_plane_atomic_print_statefunction dpu_plane_reset
Annotated Snippet
struct dpu_plane {
struct drm_plane base;
enum dpu_sspp pipe;
uint32_t color_fill;
bool is_error;
bool is_rt_pipe;
const struct dpu_mdss_cfg *catalog;
};
static const uint64_t supported_format_modifiers[] = {
DRM_FORMAT_MOD_QCOM_COMPRESSED,
DRM_FORMAT_MOD_LINEAR,
DRM_FORMAT_MOD_INVALID
};
#define to_dpu_plane(x) container_of(x, struct dpu_plane, base)
static struct dpu_kms *_dpu_plane_get_kms(struct drm_plane *plane)
{
struct msm_drm_private *priv = plane->dev->dev_private;
return to_dpu_kms(priv->kms);
}
/**
* _dpu_plane_calc_bw - calculate bandwidth required for a plane
* @catalog: Points to dpu catalog structure
* @fmt: Pointer to source buffer format
* @mode: Pointer to drm display mode
* @pipe_cfg: Pointer to pipe configuration
* Result: Updates calculated bandwidth in the plane state.
* BW Equation: src_w * src_h * bpp * fps * (v_total / v_dest)
* Prefill BW Equation: line src bytes * line_time
*/
static u64 _dpu_plane_calc_bw(const struct dpu_mdss_cfg *catalog,
const struct msm_format *fmt,
const struct drm_display_mode *mode,
struct dpu_sw_pipe_cfg *pipe_cfg)
{
int src_width, src_height, dst_height, fps;
u64 plane_pixel_rate, plane_bit_rate;
u64 plane_prefill_bw;
u64 plane_bw;
u32 hw_latency_lines;
u64 scale_factor;
int vbp, vpw, vfp;
src_width = drm_rect_width(&pipe_cfg->src_rect);
src_height = drm_rect_height(&pipe_cfg->src_rect);
dst_height = drm_rect_height(&pipe_cfg->dst_rect);
fps = drm_mode_vrefresh(mode);
vbp = mode->vtotal - mode->vsync_end;
vpw = mode->vsync_end - mode->vsync_start;
vfp = mode->vsync_start - mode->vdisplay;
hw_latency_lines = catalog->perf->min_prefill_lines;
scale_factor = src_height > dst_height ?
mult_frac(src_height, 1, dst_height) : 1;
plane_pixel_rate = src_width * mode->vtotal * fps;
plane_bit_rate = plane_pixel_rate * fmt->bpp;
plane_bw = plane_bit_rate * scale_factor;
plane_prefill_bw = plane_bw * hw_latency_lines;
if ((vbp+vpw) > hw_latency_lines)
do_div(plane_prefill_bw, (vbp+vpw));
else if ((vbp+vpw+vfp) < hw_latency_lines)
do_div(plane_prefill_bw, (vbp+vpw+vfp));
else
do_div(plane_prefill_bw, hw_latency_lines);
return max(plane_bw, plane_prefill_bw);
}
/**
* _dpu_plane_calc_clk - calculate clock required for a plane
* @mode: Pointer to drm display mode
* @pipe_cfg: Pointer to pipe configuration
* Result: Updates calculated clock in the plane state.
* Clock equation: dst_w * v_total * fps * (src_h / dst_h)
*/
static u64 _dpu_plane_calc_clk(const struct drm_display_mode *mode,
struct dpu_sw_pipe_cfg *pipe_cfg)
{
int dst_width, src_height, dst_height, fps;
u64 plane_clk;
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/dma-buf.h`, `drm/drm_atomic.h`, `drm/drm_atomic_uapi.h`, `drm/drm_blend.h`, `drm/drm_damage_helper.h`, `drm/drm_framebuffer.h`, `drm/drm_gem_atomic_helper.h`.
- Detected declarations: `struct dpu_plane`, `function _dpu_plane_calc_bw`, `function _dpu_plane_calc_clk`, `function _dpu_plane_calc_fill_level`, `function _dpu_plane_set_qos_lut`, `function _dpu_plane_set_qos_ctrl`, `function _dpu_plane_sspp_clk_force_ctrl`, `function _dpu_plane_set_ot_limit`, `function _dpu_plane_set_qos_remap`, `function _dpu_plane_setup_scaler3`.
- 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.