[PATCH 60/76] drm/amd/dal: Implement DCHUB interface

Harry Wentland harry.wentland at amd.com
Mon Nov 21 23:01:20 UTC 2016


From: Zeyu Fan <Zeyu.Fan at amd.com>

Signed-off-by: Zeyu Fan <Zeyu.Fan at amd.com>
Acked-by: Harry Wentland <harry.wentland at amd.com>
---
 drivers/gpu/drm/amd/dal/dc/core/dc.c               | 26 ++++++++++++++++++++++
 drivers/gpu/drm/amd/dal/dc/dc.h                    | 19 ++++++++++++++++
 .../gpu/drm/amd/dal/dc/dce110/dce110_mem_input.c   |  3 ++-
 drivers/gpu/drm/amd/dal/dc/dce80/dce80_mem_input.c |  3 ++-
 drivers/gpu/drm/amd/dal/dc/inc/hw/mem_input.h      |  3 +++
 5 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc.c b/drivers/gpu/drm/amd/dal/dc/core/dc.c
index d928b3f93ab6..0c814cf886c3 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc.c
@@ -1802,3 +1802,29 @@ const struct dc_stream_status *dc_stream_get_status(
 
 	return &stream->status;
 }
+
+bool dc_init_dchub(struct dc *dc, struct dchub_init_data *dh_data)
+{
+	int i;
+	int status_check = false;
+	struct core_dc *core_dc = DC_TO_CORE(dc);
+	struct mem_input *mi;
+
+	for (i = 0; i < core_dc->res_pool->pipe_count; i++) {
+		if (core_dc->res_pool->mis[i] != NULL) {
+			mi = core_dc->res_pool->mis[i];
+			break;
+		}
+	}
+
+
+	if (mi->funcs->mem_input_update_dchub)
+		mi->funcs->mem_input_update_dchub(mi, dh_data);
+	else
+		ASSERT(mi->funcs->mem_input_update_dchub);
+
+
+	return true;
+
+}
+
diff --git a/drivers/gpu/drm/amd/dal/dc/dc.h b/drivers/gpu/drm/amd/dal/dc/dc.h
index 26624e2661fa..4c969eb26e85 100644
--- a/drivers/gpu/drm/amd/dal/dc/dc.h
+++ b/drivers/gpu/drm/amd/dal/dc/dc.h
@@ -155,6 +155,21 @@ struct dc {
 	struct dc_debug debug;
 };
 
+enum frame_buffer_mode {
+	FRAME_BUFFER_MODE_LOCAL_ONLY = 0,
+	FRAME_BUFFER_MODE_ZFB_ONLY,
+	FRAME_BUFFER_MODE_MIXED_ZFB_AND_LOCAL,
+} ;
+
+struct dchub_init_data {
+	bool dchub_initialzied;
+	bool dchub_info_valid;
+	int64_t zfb_phys_addr_base;
+	int64_t zfb_mc_base_addr;
+	uint64_t zfb_size_in_byte;
+	enum frame_buffer_mode fb_mode;
+};
+
 struct dc_init_data {
 	struct hw_asic_id asic_id;
 	void *driver; /* ctx */
@@ -172,8 +187,11 @@ struct dc_init_data {
 };
 
 struct dc *dc_create(const struct dc_init_data *init_params);
+
 void dc_destroy(struct dc **dc);
 
+bool dc_init_dchub(struct dc *dc, struct dchub_init_data *dh_data);
+
 /*******************************************************************************
  * Surface Interfaces
  ******************************************************************************/
@@ -346,6 +364,7 @@ bool dc_post_update_surfaces_to_target(
 
 void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *updates,
 		int surface_count, struct dc_target *dc_target);
+
 /*******************************************************************************
  * Target Interfaces
  ******************************************************************************/
diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_mem_input.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_mem_input.c
index 0b778c984e9a..834a73222926 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_mem_input.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_mem_input.c
@@ -983,7 +983,8 @@ static struct mem_input_funcs dce110_mem_input_funcs = {
 	.mem_input_program_surface_config =
 			dce110_mem_input_program_surface_config,
 	.mem_input_is_flip_pending =
-			dce110_mem_input_is_flip_pending
+			dce110_mem_input_is_flip_pending,
+	.mem_input_update_dchub = NULL
 };
 /*****************************************/
 /* Constructor, Destructor               */
diff --git a/drivers/gpu/drm/amd/dal/dc/dce80/dce80_mem_input.c b/drivers/gpu/drm/amd/dal/dc/dce80/dce80_mem_input.c
index 078a608dc737..7cc3ae89b7ee 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce80/dce80_mem_input.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce80/dce80_mem_input.c
@@ -175,7 +175,8 @@ static struct mem_input_funcs dce80_mem_input_funcs = {
 	.mem_input_program_surface_config =
 			dce110_mem_input_program_surface_config,
 	.mem_input_is_flip_pending =
-			dce110_mem_input_is_flip_pending
+			dce110_mem_input_is_flip_pending,
+	.mem_input_update_dchub = NULL
 };
 
 /*****************************************/
diff --git a/drivers/gpu/drm/amd/dal/dc/inc/hw/mem_input.h b/drivers/gpu/drm/amd/dal/dc/inc/hw/mem_input.h
index c4a78eefd362..a4e91cc719d6 100644
--- a/drivers/gpu/drm/amd/dal/dc/inc/hw/mem_input.h
+++ b/drivers/gpu/drm/amd/dal/dc/inc/hw/mem_input.h
@@ -91,6 +91,9 @@ struct mem_input_funcs {
 		bool horizontal_mirror);
 
 	bool (*mem_input_is_flip_pending)(struct mem_input *mem_input);
+
+	void (*mem_input_update_dchub)(struct mem_input *mem_input,
+			struct dchub_init_data *dh_data);
 };
 
 #endif
-- 
2.10.1



More information about the amd-gfx mailing list