Skip to content

Commit

Permalink
Build fixing fl2000_drm
Browse files Browse the repository at this point in the history
  • Loading branch information
klogg committed Sep 11, 2024
1 parent 915b338 commit 70a9f14
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fl2000.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,6 @@ int fl2000_drm_init(struct usb_device *usb_dev);
void fl2000_drm_cleanup(struct usb_device *usb_dev);
/* ... and interface */
void fl2000_drm_hotplug(struct usb_device *usb_dev);
bool fl2000_drm_vblank(struct usb_device *usb_dev);
void fl2000_drm_vblank(struct usb_device *usb_dev);

#endif /* __FL2000_DRM_H__ */
33 changes: 29 additions & 4 deletions fl2000_drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ struct fl2000_drm_if {
struct drm_device drm;
struct drm_simple_display_pipe pipe;
struct usb_device *usb_dev;
bool vblank_enabled;
};

DEFINE_DRM_GEM_DMA_FOPS(fl2000_drm_driver_fops);
Expand Down Expand Up @@ -340,6 +341,24 @@ static void fl2000_display_update(struct drm_simple_display_pipe *pipe,
}
}

static void fl2000_display_enable_vblank(struct drm_simple_display_pipe *pipe)
{
struct drm_crtc *crtc = &pipe->crtc;
struct drm_device *drm = crtc->dev;
struct fl2000_drm_if *drm_if = container_of(drm, struct fl2000_drm_if, drm);

drm_if->vblank_enabled = true;
}

static void fl2000_display_disable_vblank(struct drm_simple_display_pipe *pipe)
{
struct drm_crtc *crtc = &pipe->crtc;
struct drm_device *drm = crtc->dev;
struct fl2000_drm_if *drm_if = container_of(drm, struct fl2000_drm_if, drm);

drm_if->vblank_enabled = false;
}

/* Logical pipe management (no HW configuration here) */
static const struct drm_simple_display_pipe_funcs fl2000_display_funcs = {
.mode_valid = fl2000_display_mode_valid,
Expand Down Expand Up @@ -420,20 +439,26 @@ void fl2000_drm_hotplug(struct usb_device *usb_dev)
return;
}

drm_kms_helper_hotplug_event(drm_if->drm);
drm_kms_helper_hotplug_event(&drm_if->drm);
}

bool fl2000_drm_vblank(struct usb_device *usb_dev)
void fl2000_drm_vblank(struct usb_device *usb_dev)
{
int ret;
struct fl2000_drm_if *drm_if;

drm_if = dev_get_drvdata(&usb_dev->dev);
if (!drm_if) {
dev_err(&usb_dev->dev, "Cannot find DRM structure!");
return false;
return;
}

drm_crtc_handle_vblank(drm_if->crtc);
if (!drm_if->vblank_enabled)
return;

ret = drm_crtc_handle_vblank(drm_if->crtc);
if (ret)
dev_err(&usb_dev->dev, "Cannot handle vblank event (%d)", ret);
}

static int fl2000_drm_modeset_init(struct drm_device *drm)
Expand Down

0 comments on commit 70a9f14

Please sign in to comment.