Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: allow passing possible_crtcs to drm_writeback_connector_init()

Clients of drm_writeback_connector_init() initialize the
possible_crtcs and then invoke the call to this API.

To simplify things, allow passing possible_crtcs as a parameter
to drm_writeback_connector_init() and make changes to the
other drm drivers to make them compatible with this change.

changes in v2:
- split the changes according to their functionality

changes in v3:
- allow passing possible_crtcs for existing users of
drm_writeback_connector_init()
- squash the vendor changes into the same commit so
that each patch in the series can compile individually

changes in v4:
- keep only changes related to possible_crtcs
- add line breaks after ARRAY_SIZE
- stop using temporary variables for possible_crtcs

changes in v5:
- None

changes in v6:
- None

changes in v7:
- wrap long lines to match the coding style of existing drivers
- Fix indentation and remove parenthesis where not needed
- use u32 instead of uint32_t for possible_crtcs

Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Patchwork: https://patchwork.freedesktop.org/patch/483501/
Link: https://lore.kernel.org/r/1650984096-9964-2-git-send-email-quic_abhinavk@quicinc.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

authored by

Abhinav Kumar and committed by
Dmitry Baryshkov
57b8280a fa5186b2

+18 -11
+2 -2
drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c
··· 155 155 kwb_conn->wb_layer = kcrtc->master->wb_layer; 156 156 157 157 wb_conn = &kwb_conn->base; 158 - wb_conn->encoder.possible_crtcs = BIT(drm_crtc_index(&kcrtc->base)); 159 158 160 159 formats = komeda_get_layer_fourcc_list(&mdev->fmt_tbl, 161 160 kwb_conn->wb_layer->layer_type, ··· 163 164 err = drm_writeback_connector_init(&kms->base, wb_conn, 164 165 &komeda_wb_connector_funcs, 165 166 &komeda_wb_encoder_helper_funcs, 166 - formats, n_formats); 167 + formats, n_formats, 168 + BIT(drm_crtc_index(&kcrtc->base))); 167 169 komeda_put_fourcc_list(formats); 168 170 if (err) { 169 171 kfree(kwb_conn);
+2 -2
drivers/gpu/drm/arm/malidp_mw.c
··· 212 212 if (!malidp->dev->hw->enable_memwrite) 213 213 return 0; 214 214 215 - malidp->mw_connector.encoder.possible_crtcs = 1 << drm_crtc_index(&malidp->crtc); 216 215 drm_connector_helper_add(&malidp->mw_connector.base, 217 216 &malidp_mw_connector_helper_funcs); 218 217 ··· 222 223 ret = drm_writeback_connector_init(drm, &malidp->mw_connector, 223 224 &malidp_mw_connector_funcs, 224 225 &malidp_mw_encoder_helper_funcs, 225 - formats, n_formats); 226 + formats, n_formats, 227 + 1 << drm_crtc_index(&malidp->crtc)); 226 228 kfree(formats); 227 229 if (ret) 228 230 return ret;
+6 -1
drivers/gpu/drm/drm_writeback.c
··· 157 157 * @enc_helper_funcs: Encoder helper funcs vtable to be used by the internal encoder 158 158 * @formats: Array of supported pixel formats for the writeback engine 159 159 * @n_formats: Length of the formats array 160 + * @possible_crtcs: possible crtcs for the internal writeback encoder 160 161 * 161 162 * This function creates the writeback-connector-specific properties if they 162 163 * have not been already created, initializes the connector as ··· 175 174 struct drm_writeback_connector *wb_connector, 176 175 const struct drm_connector_funcs *con_funcs, 177 176 const struct drm_encoder_helper_funcs *enc_helper_funcs, 178 - const u32 *formats, int n_formats) 177 + const u32 *formats, int n_formats, 178 + u32 possible_crtcs) 179 179 { 180 180 struct drm_property_blob *blob; 181 181 struct drm_connector *connector = &wb_connector->base; ··· 192 190 return PTR_ERR(blob); 193 191 194 192 drm_encoder_helper_add(&wb_connector->encoder, enc_helper_funcs); 193 + 194 + wb_connector->encoder.possible_crtcs = possible_crtcs; 195 + 195 196 ret = drm_encoder_init(dev, &wb_connector->encoder, 196 197 &drm_writeback_encoder_funcs, 197 198 DRM_MODE_ENCODER_VIRTUAL, NULL);
+2 -2
drivers/gpu/drm/rcar-du/rcar_du_writeback.c
··· 200 200 { 201 201 struct drm_writeback_connector *wb_conn = &rcrtc->writeback; 202 202 203 - wb_conn->encoder.possible_crtcs = 1 << drm_crtc_index(&rcrtc->crtc); 204 203 drm_connector_helper_add(&wb_conn->base, 205 204 &rcar_du_wb_conn_helper_funcs); 206 205 ··· 207 208 &rcar_du_wb_conn_funcs, 208 209 &rcar_du_wb_enc_helper_funcs, 209 210 writeback_formats, 210 - ARRAY_SIZE(writeback_formats)); 211 + ARRAY_SIZE(writeback_formats), 212 + 1 << drm_crtc_index(&rcrtc->crtc)); 211 213 } 212 214 213 215 void rcar_du_writeback_setup(struct rcar_du_crtc *rcrtc,
+2 -1
drivers/gpu/drm/vc4/vc4_txp.c
··· 497 497 ret = drm_writeback_connector_init(drm, &txp->connector, 498 498 &vc4_txp_connector_funcs, 499 499 &vc4_txp_encoder_helper_funcs, 500 - drm_fmts, ARRAY_SIZE(drm_fmts)); 500 + drm_fmts, ARRAY_SIZE(drm_fmts), 501 + 0); 501 502 if (ret) 502 503 return ret; 503 504
+2 -2
drivers/gpu/drm/vkms/vkms_writeback.c
··· 140 140 { 141 141 struct drm_writeback_connector *wb = &vkmsdev->output.wb_connector; 142 142 143 - vkmsdev->output.wb_connector.encoder.possible_crtcs = 1; 144 143 drm_connector_helper_add(&wb->base, &vkms_wb_conn_helper_funcs); 145 144 146 145 return drm_writeback_connector_init(&vkmsdev->drm, wb, 147 146 &vkms_wb_connector_funcs, 148 147 &vkms_wb_encoder_helper_funcs, 149 148 vkms_wb_formats, 150 - ARRAY_SIZE(vkms_wb_formats)); 149 + ARRAY_SIZE(vkms_wb_formats), 150 + 1); 151 151 }
+2 -1
include/drm/drm_writeback.h
··· 150 150 struct drm_writeback_connector *wb_connector, 151 151 const struct drm_connector_funcs *con_funcs, 152 152 const struct drm_encoder_helper_funcs *enc_helper_funcs, 153 - const u32 *formats, int n_formats); 153 + const u32 *formats, int n_formats, 154 + u32 possible_crtcs); 154 155 155 156 int drm_writeback_set_fb(struct drm_connector_state *conn_state, 156 157 struct drm_framebuffer *fb);