]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h
drm/komeda: Rename main engine clk name "mclk" to "aclk"
[linux.git] / drivers / gpu / drm / arm / display / komeda / komeda_pipeline.h
index b1f813a349a49ad060bd052fb2cd0e7fbd888b27..1a9b2cf8061a03c629aac8191f8e23fe764d8f50 100644 (file)
@@ -124,7 +124,7 @@ struct komeda_component {
        /**
         * @funcs: chip functions to access HW
         */
-       struct komeda_component_funcs *funcs;
+       const struct komeda_component_funcs *funcs;
 };
 
 /**
@@ -235,16 +235,27 @@ struct komeda_layer_state {
        /* layer specific configuration state */
        u16 hsize, vsize;
        u32 rot;
+       u16 afbc_crop_l;
+       u16 afbc_crop_r;
+       u16 afbc_crop_t;
+       u16 afbc_crop_b;
        dma_addr_t addr[3];
 };
 
 struct komeda_scaler {
        struct komeda_component base;
-       /* scaler features and caps */
+       struct malidp_range hsize, vsize;
+       u32 max_upscaling;
+       u32 max_downscaling;
 };
 
 struct komeda_scaler_state {
        struct komeda_component_state base;
+       u16 hsize_in, vsize_in;
+       u16 hsize_out, vsize_out;
+       u8 en_scaling : 1,
+          en_alpha : 1, /* enable alpha processing */
+          en_img_enhancement : 1;
 };
 
 struct komeda_compiz {
@@ -303,10 +314,18 @@ struct komeda_data_flow_cfg {
        u32 rot;
        int blending_zorder;
        u8 pixel_blend_mode, layer_alpha;
+       u8 en_scaling : 1,
+          en_img_enhancement : 1;
 };
 
-/** struct komeda_pipeline_funcs */
 struct komeda_pipeline_funcs {
+       /* check if the aclk (main engine clock) can satisfy the clock
+        * requirements of the downscaling that specified by dflow
+        */
+       int (*downscaling_clk_check)(struct komeda_pipeline *pipe,
+                                    struct drm_display_mode *mode,
+                                    unsigned long aclk_rate,
+                                    struct komeda_data_flow_cfg *dflow);
        /* dump_register: Optional, dump registers to seq_file */
        void (*dump_register)(struct komeda_pipeline *pipe,
                              struct seq_file *sf);
@@ -324,8 +343,6 @@ struct komeda_pipeline {
        struct komeda_dev *mdev;
        /** @pxlclk: pixel clock */
        struct clk *pxlclk;
-       /** @aclk: AXI clock */
-       struct clk *aclk;
        /** @id: pipeline id */
        int id;
        /** @avail_comps: available components mask of pipeline */
@@ -346,8 +363,8 @@ struct komeda_pipeline {
        struct komeda_improc *improc;
        /** @ctrlr: timing controller */
        struct komeda_timing_ctrlr *ctrlr;
-       /** @funcs: chip pipeline functions */
-       struct komeda_pipeline_funcs *funcs; /* private pipeline functions */
+       /** @funcs: chip private pipeline functions */
+       const struct komeda_pipeline_funcs *funcs;
 
        /** @of_node: pipeline dt node */
        struct device_node *of_node;
@@ -397,12 +414,15 @@ struct komeda_pipeline_state {
 /* pipeline APIs */
 struct komeda_pipeline *
 komeda_pipeline_add(struct komeda_dev *mdev, size_t size,
-                   struct komeda_pipeline_funcs *funcs);
+                   const struct komeda_pipeline_funcs *funcs);
 void komeda_pipeline_destroy(struct komeda_dev *mdev,
                             struct komeda_pipeline *pipe);
 int komeda_assemble_pipelines(struct komeda_dev *mdev);
 struct komeda_component *
 komeda_pipeline_get_component(struct komeda_pipeline *pipe, int id);
+struct komeda_component *
+komeda_pipeline_get_first_component(struct komeda_pipeline *pipe,
+                                   u32 comp_mask);
 
 void komeda_pipeline_dump_register(struct komeda_pipeline *pipe,
                                   struct seq_file *sf);
@@ -411,7 +431,7 @@ void komeda_pipeline_dump_register(struct komeda_pipeline *pipe,
 struct komeda_component *
 komeda_component_add(struct komeda_pipeline *pipe,
                     size_t comp_sz, u32 id, u32 hw_id,
-                    struct komeda_component_funcs *funcs,
+                    const struct komeda_component_funcs *funcs,
                     u8 max_active_inputs, u32 supported_inputs,
                     u8 max_active_outputs, u32 __iomem *reg,
                     const char *name_fmt, ...);
@@ -419,14 +439,29 @@ komeda_component_add(struct komeda_pipeline *pipe,
 void komeda_component_destroy(struct komeda_dev *mdev,
                              struct komeda_component *c);
 
+static inline struct komeda_component *
+komeda_component_pickup_output(struct komeda_component *c, u32 avail_comps)
+{
+       u32 avail_inputs = c->supported_outputs & (avail_comps);
+
+       return komeda_pipeline_get_first_component(c->pipeline, avail_inputs);
+}
+
 struct komeda_plane_state;
 struct komeda_crtc_state;
 struct komeda_crtc;
 
+void pipeline_composition_size(struct komeda_crtc_state *kcrtc_st,
+                              u16 *hsize, u16 *vsize);
+
 int komeda_build_layer_data_flow(struct komeda_layer *layer,
                                 struct komeda_plane_state *kplane_st,
                                 struct komeda_crtc_state *kcrtc_st,
                                 struct komeda_data_flow_cfg *dflow);
+int komeda_build_wb_data_flow(struct komeda_layer *wb_layer,
+                             struct drm_connector_state *conn_st,
+                             struct komeda_crtc_state *kcrtc_st,
+                             struct komeda_data_flow_cfg *dflow);
 int komeda_build_display_data_flow(struct komeda_crtc *kcrtc,
                                   struct komeda_crtc_state *kcrtc_st);
 
@@ -441,4 +476,6 @@ void komeda_pipeline_disable(struct komeda_pipeline *pipe,
 void komeda_pipeline_update(struct komeda_pipeline *pipe,
                            struct drm_atomic_state *old_state);
 
+void komeda_complete_data_flow_cfg(struct komeda_data_flow_cfg *dflow);
+
 #endif /* _KOMEDA_PIPELINE_H_*/