aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0670-drm-amd-display-Use-stream-validation-hook.patch
diff options
context:
space:
mode:
authorWade Farnsworth <wfarnsworth@users.noreply.github.com>2019-10-22 08:08:07 -0700
committerGitHub <noreply@github.com>2019-10-22 08:08:07 -0700
commit8e0cf9ee43840bd7ee004412129ba4aa055f5fc8 (patch)
treeb13804093e413307097cd6788ccdc8b062084013 /meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0670-drm-amd-display-Use-stream-validation-hook.patch
parent9e1e1da00d8ef569d83a7a742a734dbbf5e0bd13 (diff)
parent3f8062a03dc1d1d5fa386e1f1ca59d56b86a85d1 (diff)
downloadmeta-amd-8e0cf9ee43840bd7ee004412129ba4aa055f5fc8.tar.gz
meta-amd-8e0cf9ee43840bd7ee004412129ba4aa055f5fc8.tar.bz2
meta-amd-8e0cf9ee43840bd7ee004412129ba4aa055f5fc8.zip
Merge pull request #661 from ArsalanHAwan/master-merge-warrior
master: merge warrior
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0670-drm-amd-display-Use-stream-validation-hook.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0670-drm-amd-display-Use-stream-validation-hook.patch193
1 files changed, 193 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0670-drm-amd-display-Use-stream-validation-hook.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0670-drm-amd-display-Use-stream-validation-hook.patch
new file mode 100644
index 00000000..8af58ef0
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0670-drm-amd-display-Use-stream-validation-hook.patch
@@ -0,0 +1,193 @@
+From 4d8fe3f3621332b0387043cb182686d596e5d3f5 Mon Sep 17 00:00:00 2001
+From: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
+Date: Mon, 24 Jul 2017 15:35:24 -0400
+Subject: [PATCH 0670/4131] drm/amd/display: Use stream validation hook.
+
+Use dc_validate_stream from crtc atomic_check for single stream
+validation.
+
+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>
+---
+ .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 86 ++++++++++++----------
+ 1 file changed, 48 insertions(+), 38 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
+index 30b5f9f..446bd0f 100644
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
+@@ -63,6 +63,24 @@ struct dm_connector_state {
+ #define to_dm_connector_state(x)\
+ container_of((x), struct dm_connector_state, base)
+
++static bool modeset_required(struct drm_crtc_state *crtc_state)
++{
++ if (!drm_atomic_crtc_needs_modeset(crtc_state))
++ return false;
++
++ if (!crtc_state->enable)
++ return false;
++
++ return crtc_state->active;
++}
++
++static bool modereset_required(struct drm_crtc_state *crtc_state)
++{
++ if (!drm_atomic_crtc_needs_modeset(crtc_state))
++ return false;
++
++ return !crtc_state->enable || !crtc_state->active;
++}
+
+ void amdgpu_dm_encoder_destroy(struct drm_encoder *encoder)
+ {
+@@ -1411,11 +1429,9 @@ int amdgpu_dm_connector_mode_valid(
+ int result = MODE_ERROR;
+ struct dc_sink *dc_sink;
+ struct amdgpu_device *adev = connector->dev->dev_private;
+- struct dc_validation_set val_set = { 0 };
+ /* TODO: Unhardcode stream count */
+ struct dc_stream *stream;
+ struct amdgpu_connector *aconnector = to_amdgpu_connector(connector);
+- struct validate_context *context;
+
+ if ((mode->flags & DRM_MODE_FLAG_INTERLACE) ||
+ (mode->flags & DRM_MODE_FLAG_DBLSCAN))
+@@ -1432,35 +1448,28 @@ int amdgpu_dm_connector_mode_valid(
+
+ if (NULL == dc_sink) {
+ DRM_ERROR("dc_sink is NULL!\n");
+- goto null_sink;
++ goto fail;
+ }
+
+ stream = dc_create_stream_for_sink(dc_sink);
+ if (NULL == stream) {
+ DRM_ERROR("Failed to create stream for sink!\n");
+- goto stream_create_fail;
++ goto fail;
+ }
+
+ drm_mode_set_crtcinfo(mode, 0);
+ fill_stream_properties_from_drm_display_mode(stream, mode, connector);
+
+- val_set.stream = stream;
+- val_set.surface_count = 0;
+ stream->src.width = mode->hdisplay;
+ stream->src.height = mode->vdisplay;
+ stream->dst = stream->src;
+
+- context = dc_get_validate_context(adev->dm.dc, &val_set, 1);
+-
+- if (context) {
++ if (dc_validate_stream(adev->dm.dc, stream))
+ result = MODE_OK;
+- dc_release_validate_context(context);
+- }
+
+ dc_stream_release(stream);
+
+-stream_create_fail:
+-null_sink:
++fail:
+ /* TODO: error handling*/
+ return result;
+ }
+@@ -1486,7 +1495,24 @@ static int dm_crtc_helper_atomic_check(
+ struct drm_crtc *crtc,
+ struct drm_crtc_state *state)
+ {
+- return 0;
++ struct amdgpu_device *adev = crtc->dev->dev_private;
++ struct dc *dc = adev->dm.dc;
++ struct dm_crtc_state *dm_crtc_state = to_dm_crtc_state(state);
++ int ret = -EINVAL;
++
++ if (unlikely(!dm_crtc_state->stream && modeset_required(state))) {
++ WARN_ON(1);
++ return ret;
++ }
++
++ /* In some use cases, like reset, no stream is attached */
++ if (!dm_crtc_state->stream)
++ return 0;
++
++ if (dc_validate_stream(dc, dm_crtc_state->stream))
++ return 0;
++
++ return ret;
+ }
+
+ static bool dm_crtc_helper_mode_fixup(
+@@ -2268,25 +2294,6 @@ int amdgpu_dm_encoder_init(
+ return res;
+ }
+
+-static bool modeset_required(struct drm_crtc_state *crtc_state)
+-{
+- if (!drm_atomic_crtc_needs_modeset(crtc_state))
+- return false;
+-
+- if (!crtc_state->enable)
+- return false;
+-
+- return crtc_state->active;
+-}
+-
+-static bool modereset_required(struct drm_crtc_state *crtc_state)
+-{
+- if (!drm_atomic_crtc_needs_modeset(crtc_state))
+- return false;
+-
+- return !crtc_state->enable || !crtc_state->active;
+-}
+-
+ static void manage_dm_interrupts(
+ struct amdgpu_device *adev,
+ struct amdgpu_crtc *acrtc,
+@@ -3085,7 +3092,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
+ */
+ bool lock_and_validation_needed = false;
+
+- ret = drm_atomic_helper_check(dev, state);
++ ret = drm_atomic_helper_check_modeset(dev, state);
+
+ if (ret) {
+ DRM_ERROR("Atomic state validation failed with error :%d !\n", ret);
+@@ -3107,6 +3114,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
+ }
+ }
+
++ /*TODO Move this code into dm_crtc_atomic_check once we get rid of dc_validation_set */
+ /* update changed items */
+ for_each_crtc_in_state(state, crtc, crtc_state, i) {
+ struct amdgpu_crtc *acrtc = NULL;
+@@ -3239,10 +3247,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
+ if (plane->type == DRM_PLANE_TYPE_CURSOR)
+ continue;
+
+- if (!fb || !plane_crtc || crtc != plane_crtc ||
+- (!crtc_state->planes_changed &&
+- !crtc_state->color_mgmt_changed) ||
+- !crtc_state->active)
++ if (!fb || !plane_crtc || crtc != plane_crtc || !crtc_state->active)
+ continue;
+
+ WARN_ON(!new_acrtc_state->stream);
+@@ -3278,6 +3283,11 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
+ }
+ }
+
++ /* Run this here since we want to validate the streams we created */
++ ret = drm_atomic_helper_check_planes(dev, state);
++ if (ret)
++ goto fail;
++
+ /*
+ * For full updates case when
+ * removing/adding/updating streams on once CRTC while flipping
+--
+2.7.4
+