Commit 792671d7 authored by Andrey Grodzovsky's avatar Andrey Grodzovsky Committed by Alex Deucher
Browse files

drm/amd/display: Add per surface validation hook.



For now just validate pixel format in the hook.

Signed-off-by: default avatarAndrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 49baf957
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -2535,3 +2535,14 @@ bool dc_validate_stream(const struct dc *dc, struct dc_stream *stream)

	return res == DC_OK;
}

bool dc_validate_surface(const struct dc *dc, const struct dc_surface *surface)
{
	struct core_dc *core_dc = DC_TO_CORE(dc);

	/* TODO For now validates pixel format only */
	if (core_dc->res_pool->funcs->validate_surface)
		return core_dc->res_pool->funcs->validate_surface(surface) == DC_OK;

	return true;
}
+1 −0
Original line number Diff line number Diff line
@@ -589,6 +589,7 @@ struct dc_validation_set {

bool dc_validate_stream(const struct dc *dc, struct dc_stream *stream);

bool dc_validate_surface(const struct dc *dc, const struct dc_surface *surface);
/*
 * This function takes a set of resources and checks that they are cofunctional.
 *
+11 −1
Original line number Diff line number Diff line
@@ -804,12 +804,22 @@ static void dce100_destroy_resource_pool(struct resource_pool **pool)
	*pool = NULL;
}

enum dc_status dce100_validate_surface(const struct dc_surface *surface)
{

	if (surface->format < SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
		return DC_OK;

	return DC_FAIL_SURFACE_VALIDATE;
}

static const struct resource_funcs dce100_res_pool_funcs = {
	.destroy = dce100_destroy_resource_pool,
	.link_enc_create = dce100_link_encoder_create,
	.validate_with_context = dce100_validate_with_context,
	.validate_guaranteed = dce100_validate_guaranteed,
	.validate_bandwidth = dce100_validate_bandwidth
	.validate_bandwidth = dce100_validate_bandwidth,
	.validate_surface = dce100_validate_surface,
};

static bool construct(
+2 −0
Original line number Diff line number Diff line
@@ -16,4 +16,6 @@ struct resource_pool *dce100_create_resource_pool(
	uint8_t num_virtual_links,
	struct core_dc *dc);

enum dc_status dce100_validate_surface(const struct dc_surface *surface);

#endif /* DCE100_RESOURCE_H_ */
+3 −0
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@
#include "dce/dce_11_2_d.h"
#include "dce/dce_11_2_sh_mask.h"

#include "dce100/dce100_resource.h"

#ifndef mmDP_DPHY_INTERNAL_CTRL
	#define mmDP_DPHY_INTERNAL_CTRL 0x4aa7
	#define mmDP0_DP_DPHY_INTERNAL_CTRL 0x4aa7
@@ -992,6 +994,7 @@ static const struct resource_funcs dce112_res_pool_funcs = {
	.validate_with_context = dce112_validate_with_context,
	.validate_guaranteed = dce112_validate_guaranteed,
	.validate_bandwidth = dce112_validate_bandwidth,
	.validate_surface = dce100_validate_surface
};

static void bw_calcs_data_update_from_pplib(struct core_dc *dc)
Loading