drm/amd/display: create sink_id in dc_sink structure to idenitify all sinks
authorAlvin lee <alvin.lee3@amd.com>
Fri, 18 May 2018 18:14:38 +0000 (14:14 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 15 Jun 2018 17:24:43 +0000 (12:24 -0500)
Signed-off-by: Alvin lee <alvin.lee3@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@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_sink.c
drivers/gpu/drm/amd/display/dc/dc.h
drivers/gpu/drm/amd/display/dc/dc_types.h

index 2c05630..53ce7fa 100644 (file)
@@ -481,6 +481,7 @@ static bool construct(struct dc *dc,
        dc_ctx->driver_context = init_params->driver;
        dc_ctx->dc = dc;
        dc_ctx->asic_id = init_params->asic_id;
+       dc_ctx->dc_sink_id_count = 0;
        dc->ctx = dc_ctx;
 
        dc->current_state = dc_create_state();
index 25fae38..9971b51 100644 (file)
@@ -53,6 +53,10 @@ static bool construct(struct dc_sink *sink, const struct dc_sink_init_data *init
        sink->dongle_max_pix_clk = init_params->dongle_max_pix_clk;
        sink->converter_disable_audio = init_params->converter_disable_audio;
        sink->dc_container_id = NULL;
+       sink->sink_id = init_params->link->ctx->dc_sink_id_count;
+       // increment dc_sink_id_count because we don't want two sinks with same ID
+       // unless they are actually the same
+       init_params->link->ctx->dc_sink_id_count++;
 
        return true;
 }
index 9954d0e..7ebce76 100644 (file)
@@ -666,9 +666,13 @@ struct dc_sink {
        struct dc_link *link;
        struct dc_context *ctx;
 
+       uint32_t sink_id;
+
        /* private to dc_sink.c */
+       // refcount must be the last member in dc_sink, since we want the
+       // sink structure to be logically cloneable up to (but not including)
+       // refcount
        struct kref refcount;
-
 };
 
 void dc_sink_retain(struct dc_sink *sink);
index e026ce5..c96e526 100644 (file)
@@ -92,6 +92,7 @@ struct dc_context {
        bool created_bios;
        struct gpio_service *gpio_service;
        struct i2caux *i2caux;
+       uint32_t dc_sink_id_count;
        uint64_t fbc_gpu_addr;
 };