drm/amd/display: Blank phantom OTG before enabling
[sfrench/cifs-2.6.git] / drivers / gpu / drm / amd / display / dc / dcn32 / dcn32_hwseq.c
index 680e7fa8d18abce9e28b29bd867990c4c22c6392..cae5e1e68c860eeba5604df2448159a37c19c902 100644 (file)
@@ -1573,3 +1573,49 @@ void dcn32_init_blank(
        if (opp)
                hws->funcs.wait_for_blank_complete(opp);
 }
+
+void dcn32_blank_phantom(struct dc *dc,
+               struct timing_generator *tg,
+               int width,
+               int height)
+{
+       struct dce_hwseq *hws = dc->hwseq;
+       enum dc_color_space color_space;
+       struct tg_color black_color = {0};
+       struct output_pixel_processor *opp = NULL;
+       uint32_t num_opps, opp_id_src0, opp_id_src1;
+       uint32_t otg_active_width, otg_active_height;
+       uint32_t i;
+
+       /* program opp dpg blank color */
+       color_space = COLOR_SPACE_SRGB;
+       color_space_to_black_color(dc, color_space, &black_color);
+
+       otg_active_width = width;
+       otg_active_height = height;
+
+       /* get the OPTC source */
+       tg->funcs->get_optc_source(tg, &num_opps, &opp_id_src0, &opp_id_src1);
+       ASSERT(opp_id_src0 < dc->res_pool->res_cap->num_opp);
+
+       for (i = 0; i < dc->res_pool->res_cap->num_opp; i++) {
+               if (dc->res_pool->opps[i] != NULL && dc->res_pool->opps[i]->inst == opp_id_src0) {
+                       opp = dc->res_pool->opps[i];
+                       break;
+               }
+       }
+
+       if (opp && opp->funcs->opp_set_disp_pattern_generator)
+               opp->funcs->opp_set_disp_pattern_generator(
+                               opp,
+                               CONTROLLER_DP_TEST_PATTERN_SOLID_COLOR,
+                               CONTROLLER_DP_COLOR_SPACE_UDEFINED,
+                               COLOR_DEPTH_UNDEFINED,
+                               &black_color,
+                               otg_active_width,
+                               otg_active_height,
+                               0);
+
+       if (tg->funcs->is_tg_enabled(tg))
+               hws->funcs.wait_for_blank_complete(opp);
+}