xilinx_drm_plane_remove_manager(crtc->plane_manager);
}
+/* crtc set config helper */
+int xilinx_drm_crtc_helper_set_config(struct drm_mode_set *set)
+{
+ struct drm_device *drm = set->crtc->dev;
+
+ xilinx_drm_set_config(drm, set);
+
+ return drm_crtc_helper_set_config(set);
+}
+
/* cancel page flip functions */
void xilinx_drm_crtc_cancel_page_flip(struct drm_crtc *base_crtc,
struct drm_file *file)
static struct drm_crtc_funcs xilinx_drm_crtc_funcs = {
.destroy = xilinx_drm_crtc_destroy,
- .set_config = drm_crtc_helper_set_config,
+ .set_config = xilinx_drm_crtc_helper_set_config,
.page_flip = xilinx_drm_crtc_page_flip,
};
return xilinx_drm_crtc_get_align(private->crtc);
}
+void xilinx_drm_set_config(struct drm_device *drm, struct drm_mode_set *set)
+{
+ struct xilinx_drm_private *private = drm->dev_private;
+
+ if (private && private->fb)
+ xilinx_drm_fb_set_config(private->fb, set);
+}
+
/* poll changed handler */
static void xilinx_drm_output_poll_changed(struct drm_device *drm)
{
}
struct drm_device;
+struct drm_mode_set;
bool xilinx_drm_check_format(struct drm_device *drm, uint32_t fourcc);
uint32_t xilinx_drm_get_format(struct drm_device *drm);
unsigned int xilinx_drm_get_align(struct drm_device *drm);
+void xilinx_drm_set_config(struct drm_device *drm, struct drm_mode_set *set);
#endif /* _XILINX_DRM_H_ */
struct xilinx_drm_fb *fb;
unsigned int align;
unsigned int vres_mult;
+ struct drm_display_mode old_mode;
+ bool mode_backup;
};
static inline struct xilinx_drm_fbdev *to_fbdev(struct drm_fb_helper *fb_helper)
return ret;
}
+/**
+ * xilinx_drm_fb_set_config - synchronize resolution changes with fbdev
+ * @fb_helper: fb helper structure
+ * @set: mode set configuration
+ */
+void xilinx_drm_fb_set_config(struct drm_fb_helper *fb_helper,
+ struct drm_mode_set *set)
+{
+ if (fb_helper && set) {
+ struct xilinx_drm_fbdev *fbdev = to_fbdev(fb_helper);
+
+ if (fbdev && fb_helper->crtc_info &&
+ fb_helper->crtc_info[0].mode_set.mode && set->mode) {
+ if (!fbdev->mode_backup) {
+ fbdev->old_mode =
+ *fb_helper->crtc_info[0].mode_set.mode;
+ fbdev->mode_backup = true;
+ }
+ drm_mode_copy(fb_helper->crtc_info[0].mode_set.mode,
+ set->mode);
+ }
+ }
+}
+
int
xilinx_drm_fb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
{
*/
void xilinx_drm_fb_restore_mode(struct drm_fb_helper *fb_helper)
{
+ struct xilinx_drm_fbdev *fbdev = to_fbdev(fb_helper);
+
+ /* restore old display mode */
+ if (fb_helper && fbdev && fbdev->mode_backup &&
+ fb_helper->crtc_info &&
+ fb_helper->crtc_info[0].mode_set.mode) {
+ drm_mode_copy(fb_helper->crtc_info[0].mode_set.mode,
+ &(fbdev->old_mode));
+ fbdev->mode_backup = false;
+ }
+
if (fb_helper)
drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper);
}
*/
void xilinx_drm_fb_hotplug_event(struct drm_fb_helper *fb_helper)
{
+ if (fb_helper) {
+ struct xilinx_drm_fbdev *fbdev = to_fbdev(fb_helper);
+
+ if (fbdev)
+ fbdev->mode_backup = false;
+ }
+
if (fb_helper)
drm_fb_helper_hotplug_event(fb_helper);
}
struct drm_file *file_priv,
struct drm_mode_fb_cmd2 *mode_cmd);
void xilinx_drm_fb_hotplug_event(struct drm_fb_helper *fb_helper);
+void xilinx_drm_fb_set_config(struct drm_fb_helper *fb_helper,
+ struct drm_mode_set *set);
#endif /* _XILINX_DRM_FB_H_ */