]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
drm/amd/display: add stream ID and otg instance in dc_stream_state
authorJun Lei <Jun.Lei@amd.com>
Fri, 23 Nov 2018 20:21:02 +0000 (15:21 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 14 Jan 2019 20:04:37 +0000 (15:04 -0500)
[why]
stream ID allows DMs to avoid memory address comparisons to compare
stream equality.
otg_instance allows DC to more rigorously define when otg_instance
can change.  specifically, it is now defined to be only mutable when dc_stream_state
changes.  This is better than a "get status" function which prevents efficient
caching of otherwise very stable information.

[how]
stream ID follows similar pattern to sink ID, which is already implemented

otg_instance is an output which occurs on all dc_stream modification functions

Signed-off-by: Jun Lei <Jun.Lei@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Leo Li <sunpeng.li@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_stream.c
drivers/gpu/drm/amd/display/dc/dc_stream.h
drivers/gpu/drm/amd/display/dc/dc_types.h

index a3cd93825dcf43285f212feb7b14088c7316478c..7b9174b1432f345809cc6ce2c1c08c041c56a2ff 100644 (file)
@@ -669,6 +669,7 @@ static bool construct(struct dc *dc,
        dc_ctx->dc = dc;
        dc_ctx->asic_id = init_params->asic_id;
        dc_ctx->dc_sink_id_count = 0;
+       dc_ctx->dc_stream_id_count = 0;
        dc->ctx = dc_ctx;
 
        dc->current_state = dc_create_state();
@@ -1045,6 +1046,7 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c
        /* Program all planes within new context*/
        for (i = 0; i < context->stream_count; i++) {
                const struct dc_link *link = context->streams[i]->link;
+               struct dc_stream_status *status;
 
                if (!context->streams[i]->mode_changed)
                        continue;
@@ -1069,6 +1071,9 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c
                        }
                }
 
+               status = dc_stream_get_status(context->streams[i]);
+               context->streams[i]->out.otg_offset = status->primary_otg_inst;
+
                CONN_MSG_MODE(link, "{%dx%d, %dx%d@%dKhz}",
                                context->streams[i]->timing.h_addressable,
                                context->streams[i]->timing.v_addressable,
index 8f9dc6f54bf109f24dc3e12709103eae1c72b949..336586ba46392c1999cf99e528937eef864e15ab 100644 (file)
@@ -107,6 +107,9 @@ static void construct(struct dc_stream_state *stream,
        stream->out_transfer_func = dc_create_transfer_func();
        stream->out_transfer_func->type = TF_TYPE_BYPASS;
        stream->out_transfer_func->ctx = stream->ctx;
+
+       stream->stream_id = stream->ctx->dc_stream_id_count;
+       stream->ctx->dc_stream_id_count++;
 }
 
 static void destruct(struct dc_stream_state *stream)
index 8a778dd5f69eec9c8172e72cfc9677516358663b..0dfad73d1743d1ff1f381753e7d499d3e233ee65 100644 (file)
@@ -127,6 +127,18 @@ struct dc_stream_state {
        /* Computed state bits */
        bool mode_changed : 1;
 
+       /* Output from DC when stream state is committed or altered
+        * DC may only access these values during:
+        * dc_commit_state, dc_commit_state_no_check, dc_commit_streams
+        * values may not change outside of those calls
+        */
+       struct {
+               // For interrupt management, some hardware instance
+               // offsets need to be exposed to DM
+               uint8_t otg_offset;
+       } out;
+
+       uint32_t stream_id;
 };
 
 struct dc_stream_update {
index 0b20ae23f169241aae3368470a339ad32a5d7255..07cd165c389c78de677691901f6a82a2f8fbcdad 100644 (file)
@@ -99,6 +99,7 @@ struct dc_context {
        struct gpio_service *gpio_service;
        struct i2caux *i2caux;
        uint32_t dc_sink_id_count;
+       uint32_t dc_stream_id_count;
        uint64_t fbc_gpu_addr;
 };