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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
From 075c7a31e291db4d8199daad35512d7260424994 Mon Sep 17 00:00:00 2001
From: Roman Li <Roman.Li@amd.com>
Date: Tue, 6 Feb 2018 18:47:26 -0500
Subject: [PATCH 3568/4131] drm/amd/display: Make FBC work without fbdev
emulation
Previously, FBC dynamic allocation relied on connector modes
populated during dm init. This is only the case if
DRM_FBDEV_EMULATION config flag is enabled.
Moving fbc allocation from dm_late_init() to
amdgpu_dm_connector_get_modes() where actual modes init happens.
Signed-off-by: Roman Li <Roman.Li@amd.com>
Reviewed-by: Shirish Shankarappa <Shirish.S@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 38 +++++++++--------------
1 file changed, 15 insertions(+), 23 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index b82d76e..93de32d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -349,35 +349,28 @@ static void hotplug_notify_work_func(struct work_struct *work)
#if defined(CONFIG_DRM_AMD_DC_FBC)
/* Allocate memory for FBC compressed data */
-static void amdgpu_dm_fbc_init(struct amdgpu_device *adev)
+static void amdgpu_dm_fbc_init(struct drm_connector *connector)
{
+ struct drm_device *dev = connector->dev;
+ struct amdgpu_device *adev = dev->dev_private;
struct dm_comressor_info *compressor = &adev->dm.compressor;
- struct drm_connector *conn;
- struct drm_device *dev = adev->ddev;
+ struct amdgpu_dm_connector *aconn = to_amdgpu_dm_connector(connector);
+ struct drm_display_mode *mode;
unsigned long max_size = 0;
if (adev->dm.dc->fbc_compressor == NULL)
return;
- if (compressor->bo_ptr)
+ if (aconn->dc_link->connector_signal != SIGNAL_TYPE_EDP)
return;
- drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
-
- /* For eDP connector find a mode requiring max size */
- list_for_each_entry(conn,
- &dev->mode_config.connector_list, head) {
- struct amdgpu_dm_connector *aconn;
+ if (compressor->bo_ptr)
+ return;
- aconn = to_amdgpu_dm_connector(conn);
- if (aconn->dc_link->connector_signal == SIGNAL_TYPE_EDP) {
- struct drm_display_mode *mode;
- list_for_each_entry(mode, &conn->modes, head) {
- if (max_size < mode->hdisplay * mode->vdisplay)
- max_size = mode->htotal * mode->vtotal;
- }
- }
+ list_for_each_entry(mode, &connector->modes, head) {
+ if (max_size < mode->htotal * mode->vtotal)
+ max_size = mode->htotal * mode->vtotal;
}
if (max_size) {
@@ -394,7 +387,6 @@ static void amdgpu_dm_fbc_init(struct amdgpu_device *adev)
}
- drm_modeset_unlock(&dev->mode_config.connection_mutex);
}
#endif
@@ -572,9 +564,6 @@ static int dm_late_init(void *handle)
{
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-#if defined(CONFIG_DRM_AMD_DC_FBC)
- amdgpu_dm_fbc_init(adev);
-#endif
return detect_mst_link_for_all_connectors(adev->ddev);
}
@@ -3481,9 +3470,12 @@ static int amdgpu_dm_connector_get_modes(struct drm_connector *connector)
struct edid *edid = amdgpu_dm_connector->edid;
encoder = helper->best_encoder(connector);
-
amdgpu_dm_connector_ddc_get_modes(connector, edid);
amdgpu_dm_connector_add_common_modes(encoder, connector);
+
+#if defined(CONFIG_DRM_AMD_DC_FBC)
+ amdgpu_dm_fbc_init(connector);
+#endif
return amdgpu_dm_connector->num_modes;
}
--
2.7.4
|