On 11/11/26 20:43, Dave Airlie via B4 Relay wrote: > From: Dave Airlie <[email protected]> > > Split the caps view accessor into per-capability queries so DM and the > DAL modules no longer read through struct dc_caps: > > - scalar getters for is_apu, ips/dmcub support, max links/streams/ > planes/slave planes/cursor size/v_total, vtotal_limited_by_fp2, > i2c speed, PCON/DSC/fused-io support, SubVP processing delay and > MALL size > - dc_dmub_supports_psr()/dc_dmub_supports_aux_backlight() for the > DMUB capability bits > - dc_get_color_caps() copies out the color pipeline capabilities > - dc_get_plane_caps() returns the static plane capability array > > The KUnit tests keep installing fake capabilities through the > dc_test_caps() view of their own fake DC. > > No production code outside the dc directory reads struct dc members > through a caps view anymore. > > Part of making the struct dc sub-structures opaque outside DC. > > Signed-off-by: Dave Airlie <[email protected]> > ---
<snip> > > unsigned int dc_get_disable_ips(const struct dc *dc) > diff --git a/drivers/gpu/drm/amd/display/dc/inc/dc.h > b/drivers/gpu/drm/amd/display/dc/inc/dc.h > index 31baba820f6c..7a49f2ee1d77 100644 > --- a/drivers/gpu/drm/amd/display/dc/inc/dc.h > +++ b/drivers/gpu/drm/amd/display/dc/inc/dc.h > @@ -2351,8 +2351,38 @@ struct dc_context *dc_get_ctx(const struct dc *dc); > /* The ASIC display engine version. */ > enum dce_version dc_get_dce_version(const struct dc *dc); > > -/* Capabilities detected at dc_create() time. Read-only. */ > -const struct dc_caps *dc_get_caps(const struct dc *dc); > +/* > + * Capabilities detected at dc_create() time. Read-only; prefer the > + * purpose-built queries below over reaching into the caps structure. > + */ > +bool dc_is_apu(const struct dc *dc); > +bool dc_get_ips_support(const struct dc *dc); > +bool dc_get_dmcub_support(const struct dc *dc); > +unsigned int dc_get_max_links(const struct dc *dc); > +unsigned int dc_get_max_streams(const struct dc *dc); > +unsigned int dc_get_max_planes(const struct dc *dc); > +unsigned int dc_get_max_slave_planes(const struct dc *dc); > +unsigned int dc_get_max_cursor_size(const struct dc *dc); > +unsigned int dc_get_max_v_total(const struct dc *dc); > +bool dc_get_vtotal_limited_by_fp2(const struct dc *dc); > +unsigned int dc_get_i2c_speed_in_khz(const struct dc *dc); > +bool dc_get_dp_hdmi21_pcon_support(const struct dc *dc); > +bool dc_get_edp_dsc_support(const struct dc *dc); > +bool dc_get_fused_io_support(const struct dc *dc); > +unsigned int dc_get_subvp_fw_processing_delay_us(const struct dc *dc); > +unsigned int dc_get_mall_size_total(const struct dc *dc); > +bool dc_dmub_supports_psr(const struct dc *dc); > +bool dc_dmub_supports_aux_backlight(const struct dc *dc); > + > +/* Copy out the color pipeline capabilities. */ > +void dc_get_color_caps(const struct dc *dc, struct dc_color_caps *caps); > + > +/* > + * Return the static plane capability array and its entry count. > + * Valid until the DC is destroyed. > + */ > +const struct dc_plane_cap *dc_get_plane_caps(const struct dc *dc, > + unsigned int *count); > This creates some API bloat. What about creating a new public struct header and throwing dc_caps (or a subset of it) in there? The intent to decouple how DC stores and reports caps is valid. Harry
