sdm: Apply de-interlacing on SDM layer
Apply the de-interlacing adjustment on SDM layer. It helps to remove
de-interlacing from multiple modules: Scalar, MDP and Rotator driver.
Change-Id: I6d34210ea2106f7781de49bfba170e5dc4f981a3
diff --git a/sdm/libs/core/fb/hw_device.cpp b/sdm/libs/core/fb/hw_device.cpp
index e350254..05cce03 100644
--- a/sdm/libs/core/fb/hw_device.cpp
+++ b/sdm/libs/core/fb/hw_device.cpp
@@ -228,9 +228,6 @@
mdp_layer.bg_color = layer.solid_fill_color;
if (pipe_info->scale_data.enable_pixel_ext) {
- if ((mdp_layer.flags & MDP_LAYER_DEINTERLACE) && (layer.transform.rotation == 90.0f)) {
- mdp_buffer.width = pipe_info->scale_data.src_width;
- }
SetHWScaleData(pipe_info->scale_data, mdp_layer_count);
mdp_layer.flags |= MDP_LAYER_ENABLE_PIXEL_EXT;
}
@@ -595,10 +592,6 @@
}
}
- if (input_buffer->flags.interlace) {
- *mdp_flags |= MDP_LAYER_DEINTERLACE;
- }
-
if (input_buffer->flags.secure) {
*mdp_flags |= MDP_LAYER_SECURE_SESSION;
}
diff --git a/sdm/libs/hwc/hwc_display.cpp b/sdm/libs/hwc/hwc_display.cpp
index 09aa779..cf888fc 100644
--- a/sdm/libs/hwc/hwc_display.cpp
+++ b/sdm/libs/hwc/hwc_display.cpp
@@ -55,6 +55,16 @@
}
}
+static void ApplyDeInterlaceAdjustment(Layer *layer) {
+ // De-interlacing adjustment
+ if (layer->input_buffer->flags.interlace) {
+ float height = (layer->src_rect.bottom - layer->src_rect.top) / 2.0f;
+ layer->src_rect.bottom = layer->src_rect.top + floorf(height);
+ layer->input_buffer->height /= 2;
+ layer->input_buffer->width *= 2;
+ }
+}
+
HWCDisplay::HWCDisplay(CoreInterface *core_intf, hwc_procs_t const **hwc_procs, DisplayType type,
int id, bool needs_blit)
: core_intf_(core_intf), hwc_procs_(hwc_procs), type_(type), id_(id), needs_blit_(needs_blit) {
@@ -490,6 +500,8 @@
SetRect(scaled_display_frame, &layer.dst_rect);
SetRect(hwc_layer.sourceCropf, &layer.src_rect);
+ ApplyDeInterlaceAdjustment(&layer);
+
for (size_t j = 0; j < hwc_layer.visibleRegionScreen.numRects; j++) {
SetRect(hwc_layer.visibleRegionScreen.rects[j], &layer.visible_regions.rect[j]);
}