]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amd/display: Move hdr_metadata from plane to stream
authorAnthony Koo <Anthony.Koo@amd.com>
Mon, 23 Oct 2017 21:02:02 +0000 (17:02 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 4 Dec 2017 21:41:37 +0000 (16:41 -0500)
Need to move HDR Metadata from Surface to Stream since there is only one
infoframe possible per stream.

Also cleaning up some duplicate definitions.

Signed-off-by: Anthony Koo <anthony.koo@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c
drivers/gpu/drm/amd/display/dc/core/dc_debug.c
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
drivers/gpu/drm/amd/display/dc/dc.h
drivers/gpu/drm/amd/display/dc/dc_hw_types.h
drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c

index bc596df85ca9498d7b5c60718d30afd3f1fa37c2..55317c029d44f4b7d7c033c8651c9fb16231d2b2 100644 (file)
@@ -1007,6 +1007,7 @@ bool dc_commit_planes_to_stream(
                flip_addr[i].address = plane_states[i]->address;
                flip_addr[i].flip_immediate = plane_states[i]->flip_immediate;
                plane_info[i].color_space = plane_states[i]->color_space;
+               plane_info[i].input_tf = plane_states[i]->input_tf;
                plane_info[i].format = plane_states[i]->format;
                plane_info[i].plane_size = plane_states[i]->plane_size;
                plane_info[i].rotation = plane_states[i]->rotation;
@@ -1132,12 +1133,12 @@ static enum surface_update_type get_plane_info_update_type(
 
        /* Full update parameters */
        temp_plane_info.color_space = u->surface->color_space;
+       temp_plane_info.input_tf = u->surface->input_tf;
        temp_plane_info.dcc = u->surface->dcc;
        temp_plane_info.horizontal_mirror = u->surface->horizontal_mirror;
        temp_plane_info.plane_size = u->surface->plane_size;
        temp_plane_info.rotation = u->surface->rotation;
        temp_plane_info.stereo_format = u->surface->stereo_format;
-       temp_plane_info.input_csc_enabled = u->surface->input_csc_color_matrix.enable_adjustment;
 
        if (surface_index == 0)
                temp_plane_info.visible = u->plane_info->visible;
@@ -1218,7 +1219,6 @@ static enum surface_update_type det_surface_update(
                overall_type = type;
 
        if (u->in_transfer_func ||
-               u->hdr_static_metadata ||
                u->input_csc_color_matrix) {
                if (overall_type < UPDATE_TYPE_MED)
                        overall_type = UPDATE_TYPE_MED;
@@ -1350,14 +1350,25 @@ static void commit_planes_for_stream(struct dc *dc,
                                        pipe_ctx->top_pipe->plane_state == pipe_ctx->plane_state))
                                dc->hwss.set_input_transfer_func(
                                                pipe_ctx, pipe_ctx->plane_state);
+               }
+       }
+
+       if (update_type > UPDATE_TYPE_FAST) {
+               for (j = 0; j < dc->res_pool->pipe_count; j++) {
+                       struct pipe_ctx *pipe_ctx =
+                                       &context->res_ctx.pipe_ctx[j];
+
+                       if (!pipe_ctx->stream)
+                               continue;
 
                        if (stream_update != NULL &&
-                                       stream_update->out_transfer_func != NULL) {
+                               stream_update->out_transfer_func != NULL) {
                                dc->hwss.set_output_transfer_func(
                                                pipe_ctx, pipe_ctx->stream);
                        }
 
-                       if (srf_updates[i].hdr_static_metadata) {
+                       if (stream_update != NULL &&
+                               stream_update->hdr_static_metadata) {
                                resource_build_info_frame(pipe_ctx);
                                dc->hwss.update_info_frame(pipe_ctx);
                        }
index 6acee5426e4bd64737f583d718d9f1a9fdeaa827..2e509382935fecf7366f0d086c030d061071f008 100644 (file)
@@ -137,6 +137,7 @@ void pre_surface_trace(
                                "plane_state->tiling_info.gfx8.pipe_config = %d;\n"
                                "plane_state->tiling_info.gfx8.array_mode = %d;\n"
                                "plane_state->color_space = %d;\n"
+                               "plane_state->input_tf = %d;\n"
                                "plane_state->dcc.enable = %d;\n"
                                "plane_state->format = %d;\n"
                                "plane_state->rotation = %d;\n"
@@ -144,6 +145,7 @@ void pre_surface_trace(
                                plane_state->tiling_info.gfx8.pipe_config,
                                plane_state->tiling_info.gfx8.array_mode,
                                plane_state->color_space,
+                               plane_state->input_tf,
                                plane_state->dcc.enable,
                                plane_state->format,
                                plane_state->rotation,
@@ -184,6 +186,7 @@ void update_surface_trace(
                if (update->plane_info) {
                        SURFACE_TRACE(
                                        "plane_info->color_space = %d;\n"
+                                       "plane_info->input_tf = %d;\n"
                                        "plane_info->format = %d;\n"
                                        "plane_info->plane_size.grph.surface_pitch = %d;\n"
                                        "plane_info->plane_size.grph.surface_size.height = %d;\n"
@@ -192,6 +195,7 @@ void update_surface_trace(
                                        "plane_info->plane_size.grph.surface_size.y = %d;\n"
                                        "plane_info->rotation = %d;\n",
                                        update->plane_info->color_space,
+                                       update->plane_info->input_tf,
                                        update->plane_info->format,
                                        update->plane_info->plane_size.grph.surface_pitch,
                                        update->plane_info->plane_size.grph.surface_size.height,
index b7422d3b71efb64a18087213b2e0c08a28e00adf..15e518aba9169dab08cf2c7994dd6579333844f7 100644 (file)
@@ -2319,20 +2319,13 @@ static void set_spd_info_packet(
 
 static void set_hdr_static_info_packet(
                struct encoder_info_packet *info_packet,
-               struct dc_plane_state *plane_state,
                struct dc_stream_state *stream)
 {
        uint16_t i = 0;
        enum signal_type signal = stream->signal;
-       struct dc_hdr_static_metadata hdr_metadata;
        uint32_t data;
 
-       if (!plane_state)
-               return;
-
-       hdr_metadata = plane_state->hdr_static_ctx;
-
-       if (!hdr_metadata.hdr_supported)
+       if (!stream->hdr_static_metadata.hdr_supported)
                return;
 
        if (dc_is_hdmi_signal(signal)) {
@@ -2352,55 +2345,55 @@ static void set_hdr_static_info_packet(
                i = 2;
        }
 
-       data = hdr_metadata.is_hdr;
+       data = stream->hdr_static_metadata.is_hdr;
        info_packet->sb[i++] = data ? 0x02 : 0x00;
        info_packet->sb[i++] = 0x00;
 
-       data = hdr_metadata.chromaticity_green_x / 2;
+       data = stream->hdr_static_metadata.chromaticity_green_x / 2;
        info_packet->sb[i++] = data & 0xFF;
        info_packet->sb[i++] = (data & 0xFF00) >> 8;
 
-       data = hdr_metadata.chromaticity_green_y / 2;
+       data = stream->hdr_static_metadata.chromaticity_green_y / 2;
        info_packet->sb[i++] = data & 0xFF;
        info_packet->sb[i++] = (data & 0xFF00) >> 8;
 
-       data = hdr_metadata.chromaticity_blue_x / 2;
+       data = stream->hdr_static_metadata.chromaticity_blue_x / 2;
        info_packet->sb[i++] = data & 0xFF;
        info_packet->sb[i++] = (data & 0xFF00) >> 8;
 
-       data = hdr_metadata.chromaticity_blue_y / 2;
+       data = stream->hdr_static_metadata.chromaticity_blue_y / 2;
        info_packet->sb[i++] = data & 0xFF;
        info_packet->sb[i++] = (data & 0xFF00) >> 8;
 
-       data = hdr_metadata.chromaticity_red_x / 2;
+       data = stream->hdr_static_metadata.chromaticity_red_x / 2;
        info_packet->sb[i++] = data & 0xFF;
        info_packet->sb[i++] = (data & 0xFF00) >> 8;
 
-       data = hdr_metadata.chromaticity_red_y / 2;
+       data = stream->hdr_static_metadata.chromaticity_red_y / 2;
        info_packet->sb[i++] = data & 0xFF;
        info_packet->sb[i++] = (data & 0xFF00) >> 8;
 
-       data = hdr_metadata.chromaticity_white_point_x / 2;
+       data = stream->hdr_static_metadata.chromaticity_white_point_x / 2;
        info_packet->sb[i++] = data & 0xFF;
        info_packet->sb[i++] = (data & 0xFF00) >> 8;
 
-       data = hdr_metadata.chromaticity_white_point_y / 2;
+       data = stream->hdr_static_metadata.chromaticity_white_point_y / 2;
        info_packet->sb[i++] = data & 0xFF;
        info_packet->sb[i++] = (data & 0xFF00) >> 8;
 
-       data = hdr_metadata.max_luminance;
+       data = stream->hdr_static_metadata.max_luminance;
        info_packet->sb[i++] = data & 0xFF;
        info_packet->sb[i++] = (data & 0xFF00) >> 8;
 
-       data = hdr_metadata.min_luminance;
+       data = stream->hdr_static_metadata.min_luminance;
        info_packet->sb[i++] = data & 0xFF;
        info_packet->sb[i++] = (data & 0xFF00) >> 8;
 
-       data = hdr_metadata.maximum_content_light_level;
+       data = stream->hdr_static_metadata.maximum_content_light_level;
        info_packet->sb[i++] = data & 0xFF;
        info_packet->sb[i++] = (data & 0xFF00) >> 8;
 
-       data = hdr_metadata.maximum_frame_average_light_level;
+       data = stream->hdr_static_metadata.maximum_frame_average_light_level;
        info_packet->sb[i++] = data & 0xFF;
        info_packet->sb[i++] = (data & 0xFF00) >> 8;
 
@@ -2551,16 +2544,14 @@ void resource_build_info_frame(struct pipe_ctx *pipe_ctx)
 
                set_spd_info_packet(&info->spd, pipe_ctx->stream);
 
-               set_hdr_static_info_packet(&info->hdrsmd,
-                               pipe_ctx->plane_state, pipe_ctx->stream);
+               set_hdr_static_info_packet(&info->hdrsmd, pipe_ctx->stream);
 
        } else if (dc_is_dp_signal(signal)) {
                set_vsc_info_packet(&info->vsc, pipe_ctx->stream);
 
                set_spd_info_packet(&info->spd, pipe_ctx->stream);
 
-               set_hdr_static_info_packet(&info->hdrsmd,
-                               pipe_ctx->plane_state, pipe_ctx->stream);
+               set_hdr_static_info_packet(&info->hdrsmd, pipe_ctx->stream);
        }
 
        patch_gamut_packet_checksum(&info->gamut);
index 9833b9de650fea7a05c2cad185294a21e97d58d9..e39371797eeb1842c63911f68f97a26d1071be13 100644 (file)
@@ -334,24 +334,6 @@ enum color_transfer_func {
        transfer_func_gamma_26
 };
 
-enum color_color_space {
-       color_space_unsupported,
-       color_space_srgb,
-       color_space_bt601,
-       color_space_bt709,
-       color_space_xv_ycc_bt601,
-       color_space_xv_ycc_bt709,
-       color_space_xr_rgb,
-       color_space_bt2020,
-       color_space_adobe,
-       color_space_dci_p3,
-       color_space_sc_rgb_ms_ref,
-       color_space_display_native,
-       color_space_app_ctrl,
-       color_space_dolby_vision,
-       color_space_custom_coordinates
-};
-
 struct dc_hdr_static_metadata {
        /* display chromaticities and white point in units of 0.00001 */
        unsigned int chromaticity_green_x;
@@ -427,7 +409,6 @@ struct dc_plane_state {
        union dc_tiling_info tiling_info;
 
        struct dc_plane_dcc_param dcc;
-       struct dc_hdr_static_metadata hdr_static_ctx;
 
        struct dc_gamma *gamma_correction;
        struct dc_transfer_func *in_transfer_func;
@@ -435,13 +416,12 @@ struct dc_plane_state {
        struct csc_transform input_csc_color_matrix;
        struct fixed31_32 coeff_reduction_factor;
 
-       // sourceContentAttribute cache
-       bool is_source_input_valid;
-       struct dc_hdr_static_metadata source_input_mastering_info;
-       enum color_color_space source_input_color_space;
-       enum color_transfer_func source_input_tf;
+       // TODO: No longer used, remove
+       struct dc_hdr_static_metadata hdr_static_ctx;
 
        enum dc_color_space color_space;
+       enum color_transfer_func input_tf;
+
        enum surface_pixel_format format;
        enum dc_rotation_angle rotation;
        enum plane_stereo_format stereo_format;
@@ -467,7 +447,8 @@ struct dc_plane_info {
        enum surface_pixel_format format;
        enum dc_rotation_angle rotation;
        enum plane_stereo_format stereo_format;
-       enum dc_color_space color_space; /*todo: wrong place, fits in scaling info*/
+       enum dc_color_space color_space;
+       enum color_transfer_func input_tf;
        bool horizontal_mirror;
        bool visible;
        bool per_pixel_alpha;
@@ -488,13 +469,13 @@ struct dc_surface_update {
        struct dc_flip_addrs *flip_addr;
        struct dc_plane_info *plane_info;
        struct dc_scaling_info *scaling_info;
+
        /* following updates require alloc/sleep/spin that is not isr safe,
         * null means no updates
         */
        /* gamma TO BE REMOVED */
        struct dc_gamma *gamma;
        struct dc_transfer_func *in_transfer_func;
-       struct dc_hdr_static_metadata *hdr_static_metadata;
 
        struct csc_transform *input_csc_color_matrix;
        struct fixed31_32 *coeff_reduction_factor;
@@ -591,6 +572,7 @@ struct dc_stream_state {
 
        struct freesync_context freesync_ctx;
 
+       struct dc_hdr_static_metadata hdr_static_metadata;
        struct dc_transfer_func *out_transfer_func;
        struct colorspace_transform gamut_remap_matrix;
        struct csc_transform csc_color_matrix;
@@ -631,6 +613,7 @@ struct dc_stream_update {
        struct rect src;
        struct rect dst;
        struct dc_transfer_func *out_transfer_func;
+       struct dc_hdr_static_metadata *hdr_static_metadata;
 };
 
 bool dc_is_stream_unchanged(
index 1a9f57fb0838cb434d2cc7e30e2a23f33b7ba99d..ea58d106fb5568d80e0c28c8679b4424656d40f0 100644 (file)
@@ -492,15 +492,24 @@ struct dc_cursor_attributes {
 enum dc_color_space {
        COLOR_SPACE_UNKNOWN,
        COLOR_SPACE_SRGB,
+       COLOR_SPACE_XR_RGB,
        COLOR_SPACE_SRGB_LIMITED,
+       COLOR_SPACE_MSREF_SCRGB,
        COLOR_SPACE_YCBCR601,
        COLOR_SPACE_YCBCR709,
+       COLOR_SPACE_XV_YCC_709,
+       COLOR_SPACE_XV_YCC_601,
        COLOR_SPACE_YCBCR601_LIMITED,
        COLOR_SPACE_YCBCR709_LIMITED,
        COLOR_SPACE_2020_RGB_FULLRANGE,
        COLOR_SPACE_2020_RGB_LIMITEDRANGE,
        COLOR_SPACE_2020_YCBCR,
        COLOR_SPACE_ADOBERGB,
+       COLOR_SPACE_DCIP3,
+       COLOR_SPACE_DISPLAYNATIVE,
+       COLOR_SPACE_DOLBYVISION,
+       COLOR_SPACE_APPCTRL,
+       COLOR_SPACE_CUSTOMPOINTS,
 };
 
 enum dc_dither_option {
index e42b6eb1c1f0e133d4ae4c33d6fe804033db275e..4748975fd47e27b068a9c28366aad98570ecadce 100644 (file)
@@ -437,10 +437,19 @@ static void dce110_stream_encoder_dp_set_stream_attribute(
                case COLOR_SPACE_2020_RGB_FULLRANGE:
                case COLOR_SPACE_2020_RGB_LIMITEDRANGE:
                case COLOR_SPACE_2020_YCBCR:
+               case COLOR_SPACE_XR_RGB:
+               case COLOR_SPACE_MSREF_SCRGB:
                case COLOR_SPACE_ADOBERGB:
-               case COLOR_SPACE_UNKNOWN:
+               case COLOR_SPACE_DCIP3:
+               case COLOR_SPACE_XV_YCC_709:
+               case COLOR_SPACE_XV_YCC_601:
                case COLOR_SPACE_YCBCR601_LIMITED:
                case COLOR_SPACE_YCBCR709_LIMITED:
+               case COLOR_SPACE_DISPLAYNATIVE:
+               case COLOR_SPACE_DOLBYVISION:
+               case COLOR_SPACE_APPCTRL:
+               case COLOR_SPACE_CUSTOMPOINTS:
+               case COLOR_SPACE_UNKNOWN:
                        /* do nothing */
                        break;
                }
index 61e11a1161bbea25b2fd148c363e9c81607e023f..58d019cacaa210d13f12cc8802a7a8a874f4aadd 100644 (file)
@@ -2279,8 +2279,7 @@ static void set_plane_config(
        dce_enable_fe_clock(dc->hwseq, pipe_ctx->pipe_idx, true);
 
        set_default_colors(pipe_ctx);
-       if (pipe_ctx->stream->csc_color_matrix.enable_adjustment
-                       == true) {
+       if (pipe_ctx->stream->csc_color_matrix.enable_adjustment == true) {
                tbl_entry.color_space =
                        pipe_ctx->stream->output_color_space;
 
index cf594fb44328ed6db6073b812125cf45d924d546..adabd2ad55942156dc92ccdfb252841a5f4a203b 100644 (file)
@@ -1556,8 +1556,7 @@ static void program_csc_matrix(struct pipe_ctx *pipe_ctx,
        int i;
        struct out_csc_color_matrix tbl_entry;
 
-       if (pipe_ctx->stream->csc_color_matrix.enable_adjustment
-                               == true) {
+       if (pipe_ctx->stream->csc_color_matrix.enable_adjustment == true) {
                        enum dc_color_space color_space =
                                pipe_ctx->stream->output_color_space;