168e480896da0393d71a15d200cddd5652fe9769
[openwrt/staging/mans0n.git] /
1 From bf9d52f5c25e447415887b7f2341d69b0cae460d Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Tue, 9 Apr 2019 12:37:28 +0100
4 Subject: [PATCH 598/782] drm: vc4: Query the display ID for each display in
5 FKMS
6
7 Replace the hard coded list of display IDs for a mailbox call
8 that returns the display ID for each display that has been
9 detected.
10
11 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
12 ---
13 drivers/gpu/drm/vc4/vc4_firmware_kms.c | 16 +++++++++++++---
14 include/soc/bcm2835/raspberrypi-firmware.h | 1 +
15 2 files changed, 14 insertions(+), 3 deletions(-)
16
17 --- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
18 +++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
19 @@ -943,7 +943,7 @@ static int vc4_fkms_bind(struct device *
20 struct vc4_crtc **crtc_list;
21 u32 num_displays, display_num;
22 int ret;
23 - const u32 display_num_lookup[] = {2, 7, 1};
24 + u32 display_id;
25
26 vc4->firmware_kms = true;
27
28 @@ -982,8 +982,18 @@ static int vc4_fkms_bind(struct device *
29 return -ENOMEM;
30
31 for (display_num = 0; display_num < num_displays; display_num++) {
32 - ret = vc4_fkms_create_screen(dev, drm, display_num,
33 - display_num_lookup[display_num],
34 + display_id = display_num;
35 + ret = rpi_firmware_property(vc4->firmware,
36 + RPI_FIRMWARE_FRAMEBUFFER_GET_DISPLAY_ID,
37 + &display_id, sizeof(display_id));
38 + /* FIXME: Determine the correct error handling here.
39 + * Should we fail to create the one "screen" but keep the
40 + * others, or fail the whole thing?
41 + */
42 + if (ret)
43 + DRM_ERROR("Failed to get display id %u\n", display_num);
44 +
45 + ret = vc4_fkms_create_screen(dev, drm, display_num, display_id,
46 &crtc_list[display_num]);
47 if (ret)
48 DRM_ERROR("Oh dear, failed to create display %u\n",
49 --- a/include/soc/bcm2835/raspberrypi-firmware.h
50 +++ b/include/soc/bcm2835/raspberrypi-firmware.h
51 @@ -117,6 +117,7 @@ enum rpi_firmware_property_tag {
52 RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF = 0x0004000f,
53 RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF = 0x00040010,
54 RPI_FIRMWARE_FRAMEBUFFER_RELEASE = 0x00048001,
55 + RPI_FIRMWARE_FRAMEBUFFER_GET_DISPLAY_ID = 0x00040016,
56 RPI_FIRMWARE_FRAMEBUFFER_SET_DISPLAY_NUM = 0x00048013,
57 RPI_FIRMWARE_FRAMEBUFFER_GET_NUM_DISPLAYS = 0x00040013,
58 RPI_FIRMWARE_FRAMEBUFFER_GET_DISPLAY_SETTINGS = 0x00040014,