Skip to content

Commit 598f79f

Browse files
committed
drm/vc4: Add a mode for using the closed firmware for display.
Signed-off-by: Eric Anholt <[email protected]>
1 parent 112f31e commit 598f79f

File tree

5 files changed

+689
-2
lines changed

5 files changed

+689
-2
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_drv.o \
1010
vc4_dpi.o \
1111
vc4_dsi.o \
12+
vc4_firmware_kms.o \
1213
vc4_kms.o \
1314
vc4_gem.o \
1415
vc4_hdmi.o \

drivers/gpu/drm/vc4/vc4_crtc.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
151151
int vblank_lines;
152152
int ret = 0;
153153

154+
if (vc4->firmware_kms)
155+
return 0;
156+
154157
/*
155158
* XXX Doesn't work well in interlaced mode yet, partially due
156159
* to problems in vc4 kms or drm core interlaced mode handling,
@@ -639,6 +642,11 @@ int vc4_enable_vblank(struct drm_device *dev, unsigned int crtc_id)
639642
struct vc4_dev *vc4 = to_vc4_dev(dev);
640643
struct vc4_crtc *vc4_crtc = vc4->crtc[crtc_id];
641644

645+
if (vc4->firmware_kms) {
646+
/* XXX: Can we mask the SMI interrupt? */
647+
return 0;
648+
}
649+
642650
CRTC_WRITE(PV_INTEN, PV_INT_VFP_START);
643651

644652
return 0;
@@ -649,6 +657,11 @@ void vc4_disable_vblank(struct drm_device *dev, unsigned int crtc_id)
649657
struct vc4_dev *vc4 = to_vc4_dev(dev);
650658
struct vc4_crtc *vc4_crtc = vc4->crtc[crtc_id];
651659

660+
if (vc4->firmware_kms) {
661+
/* XXX: Can we mask the SMI interrupt? */
662+
return;
663+
}
664+
652665
CRTC_WRITE(PV_INTEN, 0);
653666
}
654667

drivers/gpu/drm/vc4/vc4_drv.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,15 @@ void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index)
4747

4848
static void vc4_drm_preclose(struct drm_device *dev, struct drm_file *file)
4949
{
50+
struct vc4_dev *vc4 = to_vc4_dev(dev);
5051
struct drm_crtc *crtc;
5152

52-
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
53-
vc4_cancel_page_flip(crtc, file);
53+
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
54+
if (vc4->firmware_kms)
55+
vc4_fkms_cancel_page_flip(crtc, file);
56+
else
57+
vc4_cancel_page_flip(crtc, file);
58+
}
5459
}
5560

5661
void vc4_dump_regs32(const struct debugfs_reg32 *regs, unsigned int num_regs,
@@ -331,6 +336,7 @@ static struct platform_driver *const component_drivers[] = {
331336
&vc4_dsi_driver,
332337
&vc4_hvs_driver,
333338
&vc4_crtc_driver,
339+
&vc4_firmware_kms_driver,
334340
&vc4_v3d_driver,
335341
};
336342

drivers/gpu/drm/vc4/vc4_drv.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ struct debugfs_reg32;
1414
struct vc4_dev {
1515
struct drm_device *dev;
1616

17+
bool firmware_kms;
18+
struct rpi_firmware *firmware;
19+
1720
struct vc4_hdmi *hdmi;
1821
struct vc4_hvs *hvs;
1922
struct vc4_crtc *crtc[3];
@@ -461,6 +464,10 @@ int vc4_dpi_debugfs_regs(struct seq_file *m, void *unused);
461464
extern struct platform_driver vc4_dsi_driver;
462465
int vc4_dsi_debugfs_regs(struct seq_file *m, void *unused);
463466

467+
/* vc4_firmware_kms.c */
468+
extern struct platform_driver vc4_firmware_kms_driver;
469+
void vc4_fkms_cancel_page_flip(struct drm_crtc *crtc, struct drm_file *file);
470+
464471
/* vc4_gem.c */
465472
void vc4_gem_init(struct drm_device *dev);
466473
void vc4_gem_destroy(struct drm_device *dev);

0 commit comments

Comments
 (0)