1 From d00d0711df4da66465ba5086e99c5936ea3b9577 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Tue, 9 Apr 2019 14:00:07 +0100
4 Subject: [PATCH 606/703] drm/vc4: Set the display number when querying the
7 Without this the two displays got set to the same resolution.
8 (Requires a firmware bug fix to work).
10 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
12 drivers/gpu/drm/vc4/vc4_firmware_kms.c | 37 +++++++++++++++++++-------
13 1 file changed, 27 insertions(+), 10 deletions(-)
15 --- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
16 +++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
17 @@ -75,6 +75,13 @@ struct mailbox_blank_display {
21 +struct mailbox_get_width_height {
22 + struct rpi_firmware_property_tag_header tag1;
24 + struct rpi_firmware_property_tag_header tag2;
28 static const struct vc_image_format {
29 u32 drm; /* DRM_FORMAT_* */
30 u32 vc_image; /* VC_IMAGE_* */
31 @@ -192,6 +199,7 @@ struct vc4_fkms_connector {
34 struct drm_encoder *encoder;
38 static inline struct vc4_fkms_connector *
39 @@ -723,21 +731,27 @@ vc4_fkms_connector_detect(struct drm_con
40 static int vc4_fkms_connector_get_modes(struct drm_connector *connector)
42 struct drm_device *dev = connector->dev;
43 + struct vc4_fkms_connector *fkms_connector =
44 + to_vc4_fkms_connector(connector);
45 struct vc4_dev *vc4 = to_vc4_dev(dev);
48 struct drm_display_mode *mode;
49 + struct mailbox_get_width_height wh = {
50 + .tag1 = {RPI_FIRMWARE_FRAMEBUFFER_SET_DISPLAY_NUM, 4, 0, },
51 + .display = fkms_connector->display_idx,
52 + .tag2 = { RPI_FIRMWARE_FRAMEBUFFER_GET_PHYSICAL_WIDTH_HEIGHT,
57 + ret = rpi_firmware_property_list(vc4->firmware, &wh, sizeof(wh));
59 - ret = rpi_firmware_property(vc4->firmware,
60 - RPI_FIRMWARE_FRAMEBUFFER_GET_PHYSICAL_WIDTH_HEIGHT,
63 DRM_ERROR("Failed to get screen size: %d (0x%08x 0x%08x)\n",
65 + ret, wh.wh[0], wh.wh[1]);
69 - mode = drm_cvt_mode(dev, wh[0], wh[1], 60 /* vrefresh */,
70 + mode = drm_cvt_mode(dev, wh.wh[0], wh.wh[1], 60 /* vrefresh */,
72 drm_mode_probed_add(connector, mode);
74 @@ -772,8 +786,9 @@ static const struct drm_connector_helper
75 .best_encoder = vc4_fkms_connector_best_encoder,
78 -static struct drm_connector *vc4_fkms_connector_init(struct drm_device *dev,
79 - struct drm_encoder *encoder)
80 +static struct drm_connector *
81 +vc4_fkms_connector_init(struct drm_device *dev, struct drm_encoder *encoder,
84 struct drm_connector *connector = NULL;
85 struct vc4_fkms_connector *fkms_connector;
86 @@ -788,6 +803,7 @@ static struct drm_connector *vc4_fkms_co
87 connector = &fkms_connector->base;
89 fkms_connector->encoder = encoder;
90 + fkms_connector->display_idx = display_idx;
92 drm_connector_init(dev, connector, &vc4_fkms_connector_funcs,
93 DRM_MODE_CONNECTOR_HDMIA);
94 @@ -904,7 +920,8 @@ static int vc4_fkms_create_screen(struct
95 drm_encoder_helper_add(&vc4_encoder->base,
96 &vc4_fkms_encoder_helper_funcs);
98 - vc4_crtc->connector = vc4_fkms_connector_init(drm, &vc4_encoder->base);
99 + vc4_crtc->connector = vc4_fkms_connector_init(drm, &vc4_encoder->base,
101 if (IS_ERR(vc4_crtc->connector)) {
102 ret = PTR_ERR(vc4_crtc->connector);
103 goto err_destroy_encoder;