Skip to content

Commit 1f721eb

Browse files
Timur Kristófalexdeucher
authored andcommitted
drm/amd/display: Share dce100_validate_global with DCE6-8
The dce100_validate_global function was verbatim exactly the same as dce60_validate_global and dce80_validate_global. Share dce100_validate_global between DCE6-10 to save code size. Signed-off-by: Timur Kristóf <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Mario Limonciello <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent ee352f6 commit 1f721eb

File tree

4 files changed

+7
-63
lines changed

4 files changed

+7
-63
lines changed

drivers/gpu/drm/amd/display/dc/resource/dce100/dce100_resource.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ static bool dce100_validate_surface_sets(
898898
return true;
899899
}
900900

901-
static enum dc_status dce100_validate_global(
901+
enum dc_status dce100_validate_global(
902902
struct dc *dc,
903903
struct dc_state *context)
904904
{

drivers/gpu/drm/amd/display/dc/resource/dce100/dce100_resource.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ struct resource_pool *dce100_create_resource_pool(
4141

4242
enum dc_status dce100_validate_plane(const struct dc_plane_state *plane_state, struct dc_caps *caps);
4343

44+
enum dc_status dce100_validate_global(
45+
struct dc *dc,
46+
struct dc_state *context);
47+
4448
enum dc_status dce100_validate_bandwidth(
4549
struct dc *dc,
4650
struct dc_state *context,

drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -864,36 +864,6 @@ static void dce60_resource_destruct(struct dce110_resource_pool *pool)
864864
}
865865
}
866866

867-
static bool dce60_validate_surface_sets(
868-
struct dc_state *context)
869-
{
870-
int i;
871-
872-
for (i = 0; i < context->stream_count; i++) {
873-
if (context->stream_status[i].plane_count == 0)
874-
continue;
875-
876-
if (context->stream_status[i].plane_count > 1)
877-
return false;
878-
879-
if (context->stream_status[i].plane_states[0]->format
880-
>= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
881-
return false;
882-
}
883-
884-
return true;
885-
}
886-
887-
static enum dc_status dce60_validate_global(
888-
struct dc *dc,
889-
struct dc_state *context)
890-
{
891-
if (!dce60_validate_surface_sets(context))
892-
return DC_FAIL_SURFACE_VALIDATE;
893-
894-
return DC_OK;
895-
}
896-
897867
static void dce60_destroy_resource_pool(struct resource_pool **pool)
898868
{
899869
struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool);
@@ -910,7 +880,7 @@ static const struct resource_funcs dce60_res_pool_funcs = {
910880
.validate_bandwidth = dce100_validate_bandwidth,
911881
.validate_plane = dce100_validate_plane,
912882
.add_stream_to_ctx = dce100_add_stream_to_ctx,
913-
.validate_global = dce60_validate_global,
883+
.validate_global = dce100_validate_global,
914884
.find_first_free_match_stream_enc_for_link = dce100_find_first_free_match_stream_enc_for_link
915885
};
916886

drivers/gpu/drm/amd/display/dc/resource/dce80/dce80_resource.c

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -870,36 +870,6 @@ static void dce80_resource_destruct(struct dce110_resource_pool *pool)
870870
}
871871
}
872872

873-
static bool dce80_validate_surface_sets(
874-
struct dc_state *context)
875-
{
876-
int i;
877-
878-
for (i = 0; i < context->stream_count; i++) {
879-
if (context->stream_status[i].plane_count == 0)
880-
continue;
881-
882-
if (context->stream_status[i].plane_count > 1)
883-
return false;
884-
885-
if (context->stream_status[i].plane_states[0]->format
886-
>= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
887-
return false;
888-
}
889-
890-
return true;
891-
}
892-
893-
static enum dc_status dce80_validate_global(
894-
struct dc *dc,
895-
struct dc_state *context)
896-
{
897-
if (!dce80_validate_surface_sets(context))
898-
return DC_FAIL_SURFACE_VALIDATE;
899-
900-
return DC_OK;
901-
}
902-
903873
static void dce80_destroy_resource_pool(struct resource_pool **pool)
904874
{
905875
struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool);
@@ -916,7 +886,7 @@ static const struct resource_funcs dce80_res_pool_funcs = {
916886
.validate_bandwidth = dce100_validate_bandwidth,
917887
.validate_plane = dce100_validate_plane,
918888
.add_stream_to_ctx = dce100_add_stream_to_ctx,
919-
.validate_global = dce80_validate_global,
889+
.validate_global = dce100_validate_global,
920890
.find_first_free_match_stream_enc_for_link = dce100_find_first_free_match_stream_enc_for_link
921891
};
922892

0 commit comments

Comments
 (0)