Commit d92b66b8 authored by james qian wang (Arm Technology China)'s avatar james qian wang (Arm Technology China) Committed by Liviu Dudau

drm/komeda: Add writeback scaling support

1. Add scaler to writeback pipeline to enable the writeback scaling support
2. Display HW can not do upscaling for writeback, check it when validate.

v2: Rebase
Signed-off-by: default avatarJames Qian Wang (Arm Technology China) <james.qian.wang@arm.com>
Signed-off-by: default avatarLiviu Dudau <liviu.dudau@arm.com>
parent 6d30cbfb
...@@ -470,4 +470,6 @@ void komeda_pipeline_disable(struct komeda_pipeline *pipe, ...@@ -470,4 +470,6 @@ void komeda_pipeline_disable(struct komeda_pipeline *pipe,
void komeda_pipeline_update(struct komeda_pipeline *pipe, void komeda_pipeline_update(struct komeda_pipeline *pipe,
struct drm_atomic_state *old_state); struct drm_atomic_state *old_state);
void komeda_complete_data_flow_cfg(struct komeda_data_flow_cfg *dflow);
#endif /* _KOMEDA_PIPELINE_H_*/ #endif /* _KOMEDA_PIPELINE_H_*/
...@@ -390,6 +390,7 @@ komeda_scaler_check_cfg(struct komeda_scaler *scaler, ...@@ -390,6 +390,7 @@ komeda_scaler_check_cfg(struct komeda_scaler *scaler,
struct komeda_data_flow_cfg *dflow) struct komeda_data_flow_cfg *dflow)
{ {
u32 hsize_in, vsize_in, hsize_out, vsize_out; u32 hsize_in, vsize_in, hsize_out, vsize_out;
u32 max_upscaling;
hsize_in = dflow->in_w; hsize_in = dflow->in_w;
vsize_in = dflow->in_h; vsize_in = dflow->in_h;
...@@ -408,13 +409,21 @@ komeda_scaler_check_cfg(struct komeda_scaler *scaler, ...@@ -408,13 +409,21 @@ komeda_scaler_check_cfg(struct komeda_scaler *scaler,
return -EINVAL; return -EINVAL;
} }
if (!scaling_ratio_valid(hsize_in, hsize_out, scaler->max_upscaling, /* If input comes from compiz that means the scaling is for writeback
* and scaler can not do upscaling for writeback
*/
if (has_bit(dflow->input.component->id, KOMEDA_PIPELINE_COMPIZS))
max_upscaling = 1;
else
max_upscaling = scaler->max_upscaling;
if (!scaling_ratio_valid(hsize_in, hsize_out, max_upscaling,
scaler->max_downscaling)) { scaler->max_downscaling)) {
DRM_DEBUG_ATOMIC("Invalid horizontal scaling ratio"); DRM_DEBUG_ATOMIC("Invalid horizontal scaling ratio");
return -EINVAL; return -EINVAL;
} }
if (!scaling_ratio_valid(vsize_in, vsize_out, scaler->max_upscaling, if (!scaling_ratio_valid(vsize_in, vsize_out, max_upscaling,
scaler->max_downscaling)) { scaler->max_downscaling)) {
DRM_DEBUG_ATOMIC("Invalid vertical scaling ratio"); DRM_DEBUG_ATOMIC("Invalid vertical scaling ratio");
return -EINVAL; return -EINVAL;
...@@ -614,6 +623,17 @@ komeda_timing_ctrlr_validate(struct komeda_timing_ctrlr *ctrlr, ...@@ -614,6 +623,17 @@ komeda_timing_ctrlr_validate(struct komeda_timing_ctrlr *ctrlr,
return 0; return 0;
} }
void komeda_complete_data_flow_cfg(struct komeda_data_flow_cfg *dflow)
{
u32 w = dflow->in_w;
u32 h = dflow->in_h;
if (drm_rotation_90_or_270(dflow->rot))
swap(w, h);
dflow->en_scaling = (w != dflow->out_w) || (h != dflow->out_h);
}
int komeda_build_layer_data_flow(struct komeda_layer *layer, int komeda_build_layer_data_flow(struct komeda_layer *layer,
struct komeda_plane_state *kplane_st, struct komeda_plane_state *kplane_st,
struct komeda_crtc_state *kcrtc_st, struct komeda_crtc_state *kcrtc_st,
...@@ -641,16 +661,18 @@ int komeda_build_layer_data_flow(struct komeda_layer *layer, ...@@ -641,16 +661,18 @@ int komeda_build_layer_data_flow(struct komeda_layer *layer,
return err; return err;
} }
/* writeback data path: compiz -> scaler -> wb_layer -> memory */
int komeda_build_wb_data_flow(struct komeda_layer *wb_layer, int komeda_build_wb_data_flow(struct komeda_layer *wb_layer,
struct drm_connector_state *conn_st, struct drm_connector_state *conn_st,
struct komeda_crtc_state *kcrtc_st, struct komeda_crtc_state *kcrtc_st,
struct komeda_data_flow_cfg *dflow) struct komeda_data_flow_cfg *dflow)
{ {
if ((dflow->in_w != dflow->out_w) || struct drm_connector *conn = conn_st->connector;
(dflow->in_h != dflow->out_h)) { int err;
DRM_DEBUG_ATOMIC("current do not support scaling writeback.\n");
return -EINVAL; err = komeda_scaler_validate(conn, kcrtc_st, dflow);
} if (err)
return err;
return komeda_wb_layer_validate(wb_layer, conn_st, dflow); return komeda_wb_layer_validate(wb_layer, conn_st, dflow);
} }
......
...@@ -16,7 +16,6 @@ komeda_plane_init_data_flow(struct drm_plane_state *st, ...@@ -16,7 +16,6 @@ komeda_plane_init_data_flow(struct drm_plane_state *st,
struct komeda_data_flow_cfg *dflow) struct komeda_data_flow_cfg *dflow)
{ {
struct drm_framebuffer *fb = st->fb; struct drm_framebuffer *fb = st->fb;
u32 w, h;
memset(dflow, 0, sizeof(*dflow)); memset(dflow, 0, sizeof(*dflow));
...@@ -37,12 +36,7 @@ komeda_plane_init_data_flow(struct drm_plane_state *st, ...@@ -37,12 +36,7 @@ komeda_plane_init_data_flow(struct drm_plane_state *st,
dflow->in_w = st->src_w >> 16; dflow->in_w = st->src_w >> 16;
dflow->in_h = st->src_h >> 16; dflow->in_h = st->src_h >> 16;
w = dflow->in_w; komeda_complete_data_flow_cfg(dflow);
h = dflow->in_h;
if (drm_rotation_90_or_270(dflow->rot))
swap(w, h);
dflow->en_scaling = (w != dflow->out_w) || (h != dflow->out_h);
return 0; return 0;
} }
......
...@@ -31,6 +31,8 @@ komeda_wb_init_data_flow(struct komeda_layer *wb_layer, ...@@ -31,6 +31,8 @@ komeda_wb_init_data_flow(struct komeda_layer *wb_layer,
dflow->pixel_blend_mode = DRM_MODE_BLEND_PIXEL_NONE; dflow->pixel_blend_mode = DRM_MODE_BLEND_PIXEL_NONE;
dflow->rot = DRM_MODE_ROTATE_0; dflow->rot = DRM_MODE_ROTATE_0;
komeda_complete_data_flow_cfg(dflow);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment