1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
From 691a0c6d58c5159f8cd692c18669b57181edb44a Mon Sep 17 00:00:00 2001
From: "Leo (Sunpeng) Li" <sunpeng.li@amd.com>
Date: Wed, 3 Jan 2018 13:04:21 -0500
Subject: [PATCH 3251/4131] drm/amd/display: Early return on crc get
If crc is disabled, early return when getting crc's. That way, we avoid
reading extra registers within the pflip high irq.
Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 1 +
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c | 34 +++++++++++++---------
2 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
index 996ab81..11ecb7c 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
@@ -212,6 +212,7 @@ struct dm_crtc_state {
struct dc_stream_state *stream;
bool crc_first_skipped;
+ bool crc_enabled;
};
#define to_dm_crtc_state(x) container_of(x, struct dm_crtc_state, base)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c
index d36d07f..2fcf84b 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c
@@ -52,7 +52,6 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name,
{
struct dm_crtc_state *crtc_state = to_dm_crtc_state(crtc->state);
struct dc_stream_state *stream_state = crtc_state->stream;
- bool ret;
enum amdgpu_dm_pipe_crc_source source = dm_parse_crc_source(src_name);
@@ -63,22 +62,25 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name,
}
if (source == AMDGPU_DM_PIPE_CRC_SOURCE_AUTO) {
- ret = dc_stream_configure_crc(stream_state->ctx->dc,
- stream_state,
- true, true);
+ if (dc_stream_configure_crc(stream_state->ctx->dc,
+ stream_state,
+ true, true))
+ crtc_state->crc_enabled = true;
+ else
+ return -EINVAL;
} else {
- ret = dc_stream_configure_crc(stream_state->ctx->dc,
- stream_state,
- false, false);
+ if (dc_stream_configure_crc(stream_state->ctx->dc,
+ stream_state,
+ false, false))
+ crtc_state->crc_enabled = false;
+ else
+ return -EINVAL;
}
- if (ret) {
- *values_cnt = 3;
- /* Reset crc_skipped flag on dm state */
- crtc_state->crc_first_skipped = false;
- return 0;
- }
- return -EINVAL;
+ *values_cnt = 3;
+ /* Reset crc_skipped flag on dm state */
+ crtc_state->crc_first_skipped = false;
+ return 0;
}
/**
@@ -94,6 +96,10 @@ void amdgpu_dm_crtc_handle_crc_irq(struct drm_crtc *crtc)
struct dc_stream_state *stream_state = crtc_state->stream;
uint32_t crcs[3];
+ /* Early return if CRC capture is not enabled. */
+ if (!crtc_state->crc_enabled)
+ return;
+
/*
* Since flipping and crc enablement happen asynchronously, we - more
* often than not - will be returning an 'uncooked' crc on first frame.
--
2.7.4
|