Skip to content

Commit 57b8280

Browse files
Abhinav Kumarlumag
authored andcommitted
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 <[email protected]> Acked-by: Liviu Dudau <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/483501/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent fa5186b commit 57b8280

File tree

7 files changed

+18
-11
lines changed

7 files changed

+18
-11
lines changed

drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms,
155155
kwb_conn->wb_layer = kcrtc->master->wb_layer;
156156

157157
wb_conn = &kwb_conn->base;
158-
wb_conn->encoder.possible_crtcs = BIT(drm_crtc_index(&kcrtc->base));
159158

160159
formats = komeda_get_layer_fourcc_list(&mdev->fmt_tbl,
161160
kwb_conn->wb_layer->layer_type,
@@ -164,7 +163,8 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms,
164163
err = drm_writeback_connector_init(&kms->base, wb_conn,
165164
&komeda_wb_connector_funcs,
166165
&komeda_wb_encoder_helper_funcs,
167-
formats, n_formats);
166+
formats, n_formats,
167+
BIT(drm_crtc_index(&kcrtc->base)));
168168
komeda_put_fourcc_list(formats);
169169
if (err) {
170170
kfree(kwb_conn);

drivers/gpu/drm/arm/malidp_mw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ int malidp_mw_connector_init(struct drm_device *drm)
212212
if (!malidp->dev->hw->enable_memwrite)
213213
return 0;
214214

215-
malidp->mw_connector.encoder.possible_crtcs = 1 << drm_crtc_index(&malidp->crtc);
216215
drm_connector_helper_add(&malidp->mw_connector.base,
217216
&malidp_mw_connector_helper_funcs);
218217

@@ -223,7 +222,8 @@ int malidp_mw_connector_init(struct drm_device *drm)
223222
ret = drm_writeback_connector_init(drm, &malidp->mw_connector,
224223
&malidp_mw_connector_funcs,
225224
&malidp_mw_encoder_helper_funcs,
226-
formats, n_formats);
225+
formats, n_formats,
226+
1 << drm_crtc_index(&malidp->crtc));
227227
kfree(formats);
228228
if (ret)
229229
return ret;

drivers/gpu/drm/drm_writeback.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ static const struct drm_encoder_funcs drm_writeback_encoder_funcs = {
157157
* @enc_helper_funcs: Encoder helper funcs vtable to be used by the internal encoder
158158
* @formats: Array of supported pixel formats for the writeback engine
159159
* @n_formats: Length of the formats array
160+
* @possible_crtcs: possible crtcs for the internal writeback encoder
160161
*
161162
* This function creates the writeback-connector-specific properties if they
162163
* have not been already created, initializes the connector as
@@ -174,7 +175,8 @@ int drm_writeback_connector_init(struct drm_device *dev,
174175
struct drm_writeback_connector *wb_connector,
175176
const struct drm_connector_funcs *con_funcs,
176177
const struct drm_encoder_helper_funcs *enc_helper_funcs,
177-
const u32 *formats, int n_formats)
178+
const u32 *formats, int n_formats,
179+
u32 possible_crtcs)
178180
{
179181
struct drm_property_blob *blob;
180182
struct drm_connector *connector = &wb_connector->base;
@@ -190,6 +192,9 @@ int drm_writeback_connector_init(struct drm_device *dev,
190192
return PTR_ERR(blob);
191193

192194
drm_encoder_helper_add(&wb_connector->encoder, enc_helper_funcs);
195+
196+
wb_connector->encoder.possible_crtcs = possible_crtcs;
197+
193198
ret = drm_encoder_init(dev, &wb_connector->encoder,
194199
&drm_writeback_encoder_funcs,
195200
DRM_MODE_ENCODER_VIRTUAL, NULL);

drivers/gpu/drm/rcar-du/rcar_du_writeback.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,15 @@ int rcar_du_writeback_init(struct rcar_du_device *rcdu,
200200
{
201201
struct drm_writeback_connector *wb_conn = &rcrtc->writeback;
202202

203-
wb_conn->encoder.possible_crtcs = 1 << drm_crtc_index(&rcrtc->crtc);
204203
drm_connector_helper_add(&wb_conn->base,
205204
&rcar_du_wb_conn_helper_funcs);
206205

207206
return drm_writeback_connector_init(&rcdu->ddev, wb_conn,
208207
&rcar_du_wb_conn_funcs,
209208
&rcar_du_wb_enc_helper_funcs,
210209
writeback_formats,
211-
ARRAY_SIZE(writeback_formats));
210+
ARRAY_SIZE(writeback_formats),
211+
1 << drm_crtc_index(&rcrtc->crtc));
212212
}
213213

214214
void rcar_du_writeback_setup(struct rcar_du_crtc *rcrtc,

drivers/gpu/drm/vc4/vc4_txp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,8 @@ static int vc4_txp_bind(struct device *dev, struct device *master, void *data)
497497
ret = drm_writeback_connector_init(drm, &txp->connector,
498498
&vc4_txp_connector_funcs,
499499
&vc4_txp_encoder_helper_funcs,
500-
drm_fmts, ARRAY_SIZE(drm_fmts));
500+
drm_fmts, ARRAY_SIZE(drm_fmts),
501+
0);
501502
if (ret)
502503
return ret;
503504

drivers/gpu/drm/vkms/vkms_writeback.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ int vkms_enable_writeback_connector(struct vkms_device *vkmsdev)
140140
{
141141
struct drm_writeback_connector *wb = &vkmsdev->output.wb_connector;
142142

143-
vkmsdev->output.wb_connector.encoder.possible_crtcs = 1;
144143
drm_connector_helper_add(&wb->base, &vkms_wb_conn_helper_funcs);
145144

146145
return drm_writeback_connector_init(&vkmsdev->drm, wb,
147146
&vkms_wb_connector_funcs,
148147
&vkms_wb_encoder_helper_funcs,
149148
vkms_wb_formats,
150-
ARRAY_SIZE(vkms_wb_formats));
149+
ARRAY_SIZE(vkms_wb_formats),
150+
1);
151151
}

include/drm/drm_writeback.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ int drm_writeback_connector_init(struct drm_device *dev,
150150
struct drm_writeback_connector *wb_connector,
151151
const struct drm_connector_funcs *con_funcs,
152152
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);
154155

155156
int drm_writeback_set_fb(struct drm_connector_state *conn_state,
156157
struct drm_framebuffer *fb);

0 commit comments

Comments
 (0)