Skip to content

Commit

Permalink
drm/vc4: Add a mode for using the closed firmware for display.
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Anholt <eric@anholt.net>
  • Loading branch information
anholt authored and popcornmix committed Dec 6, 2016
1 parent ac94ad1 commit cf0a617
Show file tree
Hide file tree
Showing 5 changed files with 682 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/gpu/drm/vc4/Makefile
Expand Up @@ -8,6 +8,7 @@ vc4-y := \
vc4_crtc.o \
vc4_drv.o \
vc4_dpi.o \
vc4_firmware_kms.o \
vc4_kms.o \
vc4_gem.o \
vc4_hdmi.o \
Expand Down
13 changes: 13 additions & 0 deletions drivers/gpu/drm/vc4/vc4_crtc.c
Expand Up @@ -163,6 +163,9 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
int vblank_lines;
int ret = 0;

if (vc4->firmware_kms)
return 0;

/* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */

/* Get optional system timestamp before query. */
Expand Down Expand Up @@ -656,6 +659,11 @@ int vc4_enable_vblank(struct drm_device *dev, unsigned int crtc_id)
struct vc4_dev *vc4 = to_vc4_dev(dev);
struct vc4_crtc *vc4_crtc = vc4->crtc[crtc_id];

if (vc4->firmware_kms) {
/* XXX: Can we mask the SMI interrupt? */
return 0;
}

CRTC_WRITE(PV_INTEN, PV_INT_VFP_START);

return 0;
Expand All @@ -666,6 +674,11 @@ void vc4_disable_vblank(struct drm_device *dev, unsigned int crtc_id)
struct vc4_dev *vc4 = to_vc4_dev(dev);
struct vc4_crtc *vc4_crtc = vc4->crtc[crtc_id];

if (vc4->firmware_kms) {
/* XXX: Can we mask the SMI interrupt? */
return;
}

CRTC_WRITE(PV_INTEN, 0);
}

Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/vc4/vc4_drv.c
Expand Up @@ -292,6 +292,7 @@ static struct platform_driver *const component_drivers[] = {
&vc4_dpi_driver,
&vc4_hvs_driver,
&vc4_crtc_driver,
&vc4_firmware_kms_driver,
&vc4_v3d_driver,
};

Expand Down
7 changes: 7 additions & 0 deletions drivers/gpu/drm/vc4/vc4_drv.h
Expand Up @@ -12,6 +12,9 @@
struct vc4_dev {
struct drm_device *dev;

bool firmware_kms;
struct rpi_firmware *firmware;

struct vc4_hdmi *hdmi;
struct vc4_hvs *hvs;
struct vc4_crtc *crtc[3];
Expand Down Expand Up @@ -460,6 +463,10 @@ void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index);
extern struct platform_driver vc4_dpi_driver;
int vc4_dpi_debugfs_regs(struct seq_file *m, void *unused);

/* vc4_firmware_kms.c */
extern struct platform_driver vc4_firmware_kms_driver;
void vc4_fkms_cancel_page_flip(struct drm_crtc *crtc, struct drm_file *file);

/* vc4_gem.c */
void vc4_gem_init(struct drm_device *dev);
void vc4_gem_destroy(struct drm_device *dev);
Expand Down

0 comments on commit cf0a617

Please sign in to comment.