drm/rockchip: fix some loader logo bugs
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / rockchip / rockchip_drm_drv.h
index 31c90c8e9737e12e3a6840673550d316b2b7a8fa..f41cf66dfd91d7a0d22b97bf8ed7095a2d722b02 100644 (file)
@@ -34,14 +34,20 @@ struct iommu_domain;
 
 /*
  * Rockchip drm private crtc funcs.
+ * @loader_protect: protect loader logo crtc's power
  * @enable_vblank: enable crtc vblank irq.
  * @disable_vblank: disable crtc vblank irq.
  */
 struct rockchip_crtc_funcs {
+       int (*loader_protect)(struct drm_crtc *crtc, bool on);
        int (*enable_vblank)(struct drm_crtc *crtc);
        void (*disable_vblank)(struct drm_crtc *crtc);
        void (*wait_for_update)(struct drm_crtc *crtc);
        void (*cancel_pending_vblank)(struct drm_crtc *crtc, struct drm_file *file_priv);
+       int (*debugfs_dump)(struct drm_crtc *crtc, struct seq_file *s);
+       enum drm_mode_status (*mode_valid)(struct drm_crtc *crtc,
+                                          const struct drm_display_mode *mode,
+                                          int output_type);
 };
 
 struct drm_rockchip_subdrv {
@@ -64,6 +70,10 @@ struct rockchip_atomic_commit {
 
 struct rockchip_crtc_state {
        struct drm_crtc_state base;
+       int left_margin;
+       int right_margin;
+       int top_margin;
+       int bottom_margin;
        int afbdc_win_format;
        int afbdc_win_width;
        int afbdc_win_height;
@@ -73,6 +83,7 @@ struct rockchip_crtc_state {
        int dsp_layer_sel;
        int output_type;
        int output_mode;
+       int bus_format;
 };
 
 #define to_rockchip_crtc_state(s) \
@@ -90,9 +101,11 @@ struct rockchip_drm_file_private {
 
 struct rockchip_logo {
        struct sg_table *sgt;
+       struct drm_mm_node mm;
        dma_addr_t dma_addr;
        phys_addr_t start;
        phys_addr_t size;
+       size_t iommu_map_size;
        int count;
 };
 
@@ -117,9 +130,14 @@ struct rockchip_drm_private {
        unsigned int cpu_fence_context;
        atomic_t cpu_fence_seqno;
 #endif
+       /* protect drm_mm on multi-threads */
+       struct mutex mm_lock;
        struct drm_mm mm;
 };
 
+#ifndef MODULE
+void rockchip_free_loader_memory(struct drm_device *drm);
+#endif
 void rockchip_drm_atomic_work(struct work_struct *work);
 int rockchip_register_crtc_funcs(struct drm_crtc *crtc,
                                 const struct rockchip_crtc_funcs *crtc_funcs);