Skip to content

Commit b87577b

Browse files
committed
drm: try harder to avoid regression when merging mode bits
For QXL hw we really want the bits to be replaced as we change the preferred mode on the fly, and the same goes for virgl when I get to it, however the original fix for this seems to have caused a wierd regression on Intel G33 that in a stunning display of failure at opposition to his normal self, Daniel failed to diagnose. So we are left doing this, ugly ugly ugly ugly, Daniel you fixed that G33 yet?, ugly, ugly. Tested-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
1 parent 885ac04 commit b87577b

6 files changed

Lines changed: 57 additions & 26 deletions

File tree

‎drivers/gpu/drm/drm_modes.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,7 @@ EXPORT_SYMBOL(drm_mode_sort);
10131013
/**
10141014
* drm_mode_connector_list_update - update the mode list for the connector
10151015
* @connector: the connector to update
1016+
* @merge_type_bits: whether to merge or overright type bits.
10161017
*
10171018
* This moves the modes from the @connector probed_modes list
10181019
* to the actual mode list. It compares the probed mode against the current
@@ -1021,7 +1022,8 @@ EXPORT_SYMBOL(drm_mode_sort);
10211022
* This is just a helper functions doesn't validate any modes itself and also
10221023
* doesn't prune any invalid modes. Callers need to do that themselves.
10231024
*/
1024-
void drm_mode_connector_list_update(struct drm_connector *connector)
1025+
void drm_mode_connector_list_update(struct drm_connector *connector,
1026+
bool merge_type_bits)
10251027
{
10261028
struct drm_display_mode *mode;
10271029
struct drm_display_mode *pmode, *pt;
@@ -1039,7 +1041,10 @@ void drm_mode_connector_list_update(struct drm_connector *connector)
10391041
/* if equal delete the probed mode */
10401042
mode->status = pmode->status;
10411043
/* Merge type bits together */
1042-
mode->type |= pmode->type;
1044+
if (merge_type_bits)
1045+
mode->type |= pmode->type;
1046+
else
1047+
mode->type = pmode->type;
10431048
list_del(&pmode->head);
10441049
drm_mode_destroy(connector->dev, pmode);
10451050
break;

‎drivers/gpu/drm/drm_probe_helper.c‎

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -82,26 +82,8 @@ static void drm_mode_validate_flag(struct drm_connector *connector,
8282
return;
8383
}
8484

85-
/**
86-
* drm_helper_probe_single_connector_modes - get complete set of display modes
87-
* @connector: connector to probe
88-
* @maxX: max width for modes
89-
* @maxY: max height for modes
90-
*
91-
* Based on the helper callbacks implemented by @connector try to detect all
92-
* valid modes. Modes will first be added to the connector's probed_modes list,
93-
* then culled (based on validity and the @maxX, @maxY parameters) and put into
94-
* the normal modes list.
95-
*
96-
* Intended to be use as a generic implementation of the ->fill_modes()
97-
* @connector vfunc for drivers that use the crtc helpers for output mode
98-
* filtering and detection.
99-
*
100-
* Returns:
101-
* The number of modes found on @connector.
102-
*/
103-
int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
104-
uint32_t maxX, uint32_t maxY)
85+
static int drm_helper_probe_single_connector_modes_merge_bits(struct drm_connector *connector,
86+
uint32_t maxX, uint32_t maxY, bool merge_type_bits)
10587
{
10688
struct drm_device *dev = connector->dev;
10789
struct drm_display_mode *mode;
@@ -155,7 +137,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
155137
if (count == 0)
156138
goto prune;
157139

158-
drm_mode_connector_list_update(connector);
140+
drm_mode_connector_list_update(connector, merge_type_bits);
159141

160142
if (maxX && maxY)
161143
drm_mode_validate_size(dev, &connector->modes, maxX, maxY);
@@ -194,8 +176,48 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
194176

195177
return count;
196178
}
179+
180+
/**
181+
* drm_helper_probe_single_connector_modes - get complete set of display modes
182+
* @connector: connector to probe
183+
* @maxX: max width for modes
184+
* @maxY: max height for modes
185+
*
186+
* Based on the helper callbacks implemented by @connector try to detect all
187+
* valid modes. Modes will first be added to the connector's probed_modes list,
188+
* then culled (based on validity and the @maxX, @maxY parameters) and put into
189+
* the normal modes list.
190+
*
191+
* Intended to be use as a generic implementation of the ->fill_modes()
192+
* @connector vfunc for drivers that use the crtc helpers for output mode
193+
* filtering and detection.
194+
*
195+
* Returns:
196+
* The number of modes found on @connector.
197+
*/
198+
int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
199+
uint32_t maxX, uint32_t maxY)
200+
{
201+
return drm_helper_probe_single_connector_modes_merge_bits(connector, maxX, maxY, true);
202+
}
197203
EXPORT_SYMBOL(drm_helper_probe_single_connector_modes);
198204

205+
/**
206+
* drm_helper_probe_single_connector_modes_nomerge - get complete set of display modes
207+
* @connector: connector to probe
208+
* @maxX: max width for modes
209+
* @maxY: max height for modes
210+
*
211+
* This operates like drm_hehlper_probe_single_connector_modes except it
212+
* replaces the mode bits instead of merging them for preferred modes.
213+
*/
214+
int drm_helper_probe_single_connector_modes_nomerge(struct drm_connector *connector,
215+
uint32_t maxX, uint32_t maxY)
216+
{
217+
return drm_helper_probe_single_connector_modes_merge_bits(connector, maxX, maxY, false);
218+
}
219+
EXPORT_SYMBOL(drm_helper_probe_single_connector_modes_nomerge);
220+
199221
/**
200222
* drm_kms_helper_hotplug_event - fire off KMS hotplug events
201223
* @dev: drm_device whose connector state changed

‎drivers/gpu/drm/qxl/qxl_display.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ static const struct drm_connector_funcs qxl_connector_funcs = {
841841
.save = qxl_conn_save,
842842
.restore = qxl_conn_restore,
843843
.detect = qxl_conn_detect,
844-
.fill_modes = drm_helper_probe_single_connector_modes,
844+
.fill_modes = drm_helper_probe_single_connector_modes_nomerge,
845845
.set_property = qxl_conn_set_property,
846846
.destroy = qxl_conn_destroy,
847847
};

‎drivers/gpu/drm/vmwgfx/vmwgfx_kms.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2001,7 +2001,7 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector,
20012001
if (du->pref_mode)
20022002
list_move(&du->pref_mode->head, &connector->probed_modes);
20032003

2004-
drm_mode_connector_list_update(connector);
2004+
drm_mode_connector_list_update(connector, true);
20052005

20062006
return 1;
20072007
}

‎include/drm/drm_crtc_helper.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ extern void drm_helper_resume_force_mode(struct drm_device *dev);
165165
extern int drm_helper_probe_single_connector_modes(struct drm_connector
166166
*connector, uint32_t maxX,
167167
uint32_t maxY);
168+
extern int drm_helper_probe_single_connector_modes_nomerge(struct drm_connector
169+
*connector,
170+
uint32_t maxX,
171+
uint32_t maxY);
168172
extern void drm_kms_helper_poll_init(struct drm_device *dev);
169173
extern void drm_kms_helper_poll_fini(struct drm_device *dev);
170174
extern bool drm_helper_hpd_irq_event(struct drm_device *dev);

‎include/drm/drm_modes.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ void drm_mode_validate_size(struct drm_device *dev,
223223
void drm_mode_prune_invalid(struct drm_device *dev,
224224
struct list_head *mode_list, bool verbose);
225225
void drm_mode_sort(struct list_head *mode_list);
226-
void drm_mode_connector_list_update(struct drm_connector *connector);
226+
void drm_mode_connector_list_update(struct drm_connector *connector, bool merge_type_bits);
227227

228228
/* parsing cmdline modes */
229229
bool

0 commit comments

Comments
 (0)