summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorAndrey Grodzovsky <Andrey.Grodzovsky@amd.com>2017-07-26 15:51:31 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-09-26 18:15:54 -0400
commit792671d7e1e28995c6a63104fac1208e19a0ab08 (patch)
treef24a6d9b7f64e55ff4eb9cd5005f0b2282b8c8f0 /drivers/gpu/drm/amd
parent49baf95740b4f233ea286ebbe7c1066c03f5dd3b (diff)
drm/amd/display: Add per surface validation hook.
For now just validate pixel format in the hook. Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com> Reviewed-by: Tony Cheng <Tony.Cheng@amd.com> Acked-by: Harry Wentland <Harry.Wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/display/dc/core/dc_resource.c11
-rw-r--r--drivers/gpu/drm/amd/display/dc/dc.h1
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c12
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.h2
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c3
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c5
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c4
-rw-r--r--drivers/gpu/drm/amd/display/dc/inc/core_types.h2
8 files changed, 37 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index d381e380e974..1f4237fc3e53 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -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;
+}
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 58bfb867b71c..e9c9b91d1286 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -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.
*
diff --git a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
index 9ac246f05110..59f4caf057f7 100644
--- a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
@@ -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(
diff --git a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.h b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.h
index bfd7518c94c9..13fc637eb731 100644
--- a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.h
+++ b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.h
@@ -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_ */
diff --git a/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c b/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
index 9589208ea0c8..495f38750ae4 100644
--- a/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
@@ -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)
diff --git a/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c b/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
index f829b6e58bcb..b31307b9d3e3 100644
--- a/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
@@ -60,6 +60,8 @@
#include "vega10/NBIO/nbio_6_1_offset.h"
#include "reg_helper.h"
+#include "dce100/dce100_resource.h"
+
#ifndef mmDP0_DP_DPHY_INTERNAL_CTRL
#define mmDP0_DP_DPHY_INTERNAL_CTRL 0x210f
#define mmDP0_DP_DPHY_INTERNAL_CTRL_BASE_IDX 2
@@ -698,7 +700,8 @@ static const struct resource_funcs dce120_res_pool_funcs = {
.link_enc_create = dce120_link_encoder_create,
.validate_with_context = dce112_validate_with_context,
.validate_guaranteed = dce112_validate_guaranteed,
- .validate_bandwidth = dce112_validate_bandwidth
+ .validate_bandwidth = dce112_validate_bandwidth,
+ .validate_surface = dce100_validate_surface
};
static void bw_calcs_data_update_from_pplib(struct core_dc *dc)
diff --git a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
index 92f01ed97621..6eeb5e9f656f 100644
--- a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
@@ -49,6 +49,7 @@
#include "dce/dce_audio.h"
#include "dce/dce_hwseq.h"
#include "dce80/dce80_hw_sequencer.h"
+#include "dce100/dce100_resource.h"
#include "reg_helper.h"
@@ -823,7 +824,8 @@ static const struct resource_funcs dce80_res_pool_funcs = {
.link_enc_create = dce80_link_encoder_create,
.validate_with_context = dce80_validate_with_context,
.validate_guaranteed = dce80_validate_guaranteed,
- .validate_bandwidth = dce80_validate_bandwidth
+ .validate_bandwidth = dce80_validate_bandwidth,
+ .validate_surface = dce100_validate_surface
};
static bool construct(
diff --git a/drivers/gpu/drm/amd/display/dc/inc/core_types.h b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
index b312bb3b3350..ab389abf4e79 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/core_types.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
@@ -105,6 +105,8 @@ struct resource_funcs {
struct validate_context *context,
const struct resource_pool *pool,
struct dc_stream *stream);
+
+ enum dc_status (*validate_surface)(const struct dc_surface *surface);
};
struct audio_support{