Skip to content

Commit 670f934

Browse files
6by9popcornmix
authored andcommitted
drm/vc4: fkms: Add firmware-kms mode
This is a squash of all firmware-kms related patches from previous branches, up to and including "drm/vc4: Set the possible crtcs mask correctly for planes with FKMS" plus a couple of minor fixups for the 5.9 branch. Please refer to earlier branches for full history. This patch includes work by Eric Anholt, James Hughes, Phil Elwell, Dave Stevenson, Dom Cobley, and Jonathon Bell. Signed-off-by: Dave Stevenson <[email protected]> drm/vc4: Fixup firmware-kms after "drm/atomic: Pass the full state to CRTC atomic enable/disable" Prototype for those calls changed, so amend fkms (which isn't upstream) to match. Signed-off-by: Dave Stevenson <[email protected]> drm/vc4: Fixup fkms for API change Atomic flush and check changed API, so fix up the downstream-only FKMS driver. Signed-off-by: Dave Stevenson <[email protected]> drm/vc4: Make normalize_zpos conditional on using fkms Eric's view was that there was no point in having zpos support on vc4 as all the planes had the same functionality. Can be later squashed into (and fixes): drm/vc4: Add firmware-kms mode Signed-off-by: Dom Cobley <[email protected]> drm/vc4: FKMS: Change of Broadcast RGB mode needs a mode change The Broadcast RGB (aka HDMI limited/full range) property is only notified to the firmware on mode change, so this needs to be signalled when set. raspberrypi/firmware#1580 Signed-off-by: Dave Stevenson <[email protected]> vc4/drv: Only notify firmware of display done with kms fkms driver still wants firmware display to be active Signed-off-by: Dom Cobley <[email protected]> ydrm/vc4: fkms: Fix margin calculations for the right/bottom edges The calculations clipped the right/bottom edge of the clipped range based on the left/top margins. #4447 Signed-off-by: Dave Stevenson <[email protected]> drm/vc4: fkms: Use new devm_rpi_firmware_get api drm/kms: Add allow_fb_modifiers Signed-off-by: Dom Cobley <[email protected]> drm/vc4: Add async update support for cursor planes Now that cursors are implemented as regular planes, all cursor movements result in atomic updates. As the firmware-kms driver doesn't support asynchronous updates, these are synchronous, which limits the update rate to the screen refresh rate. Xorg seems unaware of this (or at least of the effect of this), because if the mouse is configured with a higher update rate than the screen then continuous mouse movement results in an increasing backlog of mouse events - cue extreme lag. Add minimal support for asynchronous updates - limited to cursor planes - to eliminate the lag. See: #4971 #4988 Signed-off-by: Phil Elwell <[email protected]> drivers/gpu/drm/vc4: Add missing 32-bit RGB formats The missing 32-bit per pixel ABGR and various "RGB with an X value" formats are added. Change sent by Dave Stevenson. Signed-off-by: David Plowman <[email protected]> drm: vc4: Fixup duplicated macro definition in vc4_firmware_kms Both vc4_drv.h and vc4_firmware_kms.c had definitions for to_vc4_crtc. Rename the fkms one to make it unique, and drop the magic define vc4_crtc vc4_kms_crtc define to_vc4_crtc to_vc4_kms_crtc that renamed half the variable and function names in a slightly unexpected way. Signed-off-by: Dave Stevenson <[email protected]> drm/vc4: Fix FKMS for when the YUV chroma planes are different buffers The code was assuming that it was a single buffer with offsets, when kmstest uses separate buffers and 0 offsets for each plane. Signed-off-by: Dave Stevenson <[email protected]> drm/vc4: fkms: Rename plane related functions The name collide with the Full KMS functions that are going to be made public. Signed-off-by: Maxime Ripard <[email protected]> drm/vc4_fkms: Fix up interrupt handler for both 2835/2711 and 2712 2712 has switched from using the SMI peripheral to another interrupt source for the vsync interrupt, so handle both sources cleanly. Signed-off-by: Dave Stevenson <[email protected]> drm/vc4: fkms: No SMI abuse needed on BCM2712 Since we don't use the (absent) SMI block to create interrupts on BCM2712, there's no need to map any registers. Signed-off-by: Phil Elwell <[email protected]>
1 parent 69a13cb commit 670f934

File tree

7 files changed

+2324
-24
lines changed

7 files changed

+2324
-24
lines changed

drivers/gpu/drm/vc4/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ vc4-y := \
99
vc4_dpi.o \
1010
vc4_dsi.o \
1111
vc4_fence.o \
12+
vc4_firmware_kms.o \
1213
vc4_kms.o \
1314
vc4_gem.o \
1415
vc4_hdmi.o \

drivers/gpu/drm/vc4/vc4_debugfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ vc4_debugfs_init(struct drm_minor *minor)
2424
struct vc4_dev *vc4 = to_vc4_dev(minor->dev);
2525
struct drm_device *drm = &vc4->base;
2626

27-
drm_WARN_ON(drm, vc4_hvs_debugfs_init(minor));
27+
if (vc4->hvs)
28+
drm_WARN_ON(drm, vc4_hvs_debugfs_init(minor));
2829

2930
if (vc4->v3d) {
3031
drm_WARN_ON(drm, vc4_bo_debugfs_init(minor));

drivers/gpu/drm/vc4/vc4_drv.c

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,18 @@ static const struct of_device_id vc4_dma_range_matches[] = {
300300
{}
301301
};
302302

303+
/*
304+
* we need this helper function for determining presence of fkms
305+
* before it's been bound
306+
*/
307+
static bool firmware_kms(void)
308+
{
309+
return of_device_is_available(of_find_compatible_node(NULL, NULL,
310+
"raspberrypi,rpi-firmware-kms")) ||
311+
of_device_is_available(of_find_compatible_node(NULL, NULL,
312+
"raspberrypi,rpi-firmware-kms-2711"));
313+
}
314+
303315
static int vc4_drm_bind(struct device *dev)
304316
{
305317
struct platform_device *pdev = to_platform_device(dev);
@@ -380,7 +392,7 @@ static int vc4_drm_bind(struct device *dev)
380392
if (ret)
381393
goto err;
382394

383-
if (firmware) {
395+
if (firmware && !firmware_kms()) {
384396
ret = rpi_firmware_property(firmware,
385397
RPI_FIRMWARE_NOTIFY_DISPLAY_DONE,
386398
NULL, 0);
@@ -398,16 +410,20 @@ static int vc4_drm_bind(struct device *dev)
398410
if (ret)
399411
goto err;
400412

401-
ret = vc4_plane_create_additional_planes(drm);
402-
if (ret)
403-
goto err;
413+
if (!vc4->firmware_kms) {
414+
ret = vc4_plane_create_additional_planes(drm);
415+
if (ret)
416+
goto err;
417+
}
404418

405419
ret = vc4_kms_load(drm);
406420
if (ret < 0)
407421
goto err;
408422

409-
drm_for_each_crtc(crtc, drm)
410-
vc4_crtc_disable_at_boot(crtc);
423+
if (!vc4->firmware_kms) {
424+
drm_for_each_crtc(crtc, drm)
425+
vc4_crtc_disable_at_boot(crtc);
426+
}
411427

412428
ret = drm_dev_register(drm, 0);
413429
if (ret < 0)
@@ -453,6 +469,7 @@ static struct platform_driver *const component_drivers[] = {
453469
&vc4_dsi_driver,
454470
&vc4_txp_driver,
455471
&vc4_crtc_driver,
472+
&vc4_firmware_kms_driver,
456473
&vc4_v3d_driver,
457474
};
458475

drivers/gpu/drm/vc4/vc4_drv.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,12 @@ struct vc4_dev {
9696

9797
unsigned int irq;
9898

99+
bool firmware_kms;
100+
struct rpi_firmware *firmware;
101+
99102
struct vc4_hvs *hvs;
100103
struct vc4_v3d *v3d;
104+
struct vc4_fkms *fkms;
101105

102106
struct vc4_hang_state *hang_state;
103107

@@ -1007,6 +1011,9 @@ extern struct platform_driver vc4_dsi_driver;
10071011
/* vc4_fence.c */
10081012
extern const struct dma_fence_ops vc4_fence_ops;
10091013

1014+
/* vc4_firmware_kms.c */
1015+
extern struct platform_driver vc4_firmware_kms_driver;
1016+
10101017
/* vc4_gem.c */
10111018
int vc4_gem_init(struct drm_device *dev);
10121019
int vc4_submit_cl_ioctl(struct drm_device *dev, void *data,

0 commit comments

Comments
 (0)