Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 3698a75

Browse files
committed
Merge tag 'drm-intel-next-fixes-2023-08-24' of git://anongit.freedesktop.org/drm/drm-intel into drm-next
- Fix TLB invalidation (Alan) - Fix Display HPD polling (Imre) Signed-off-by: Dave Airlie <[email protected]> From: Rodrigo Vivi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/ZOdOP31OE/[email protected]
2 parents bc609f4 + cfd48ad commit 3698a75

File tree

4 files changed

+50
-25
lines changed

4 files changed

+50
-25
lines changed

drivers/gpu/drm/drm_probe_helper.c

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,26 @@ static bool drm_kms_helper_enable_hpd(struct drm_device *dev)
262262
}
263263

264264
#define DRM_OUTPUT_POLL_PERIOD (10*HZ)
265+
static void reschedule_output_poll_work(struct drm_device *dev)
266+
{
267+
unsigned long delay = DRM_OUTPUT_POLL_PERIOD;
268+
269+
if (dev->mode_config.delayed_event)
270+
/*
271+
* FIXME:
272+
*
273+
* Use short (1s) delay to handle the initial delayed event.
274+
* This delay should not be needed, but Optimus/nouveau will
275+
* fail in a mysterious way if the delayed event is handled as
276+
* soon as possible like it is done in
277+
* drm_helper_probe_single_connector_modes() in case the poll
278+
* was enabled before.
279+
*/
280+
delay = HZ;
281+
282+
schedule_delayed_work(&dev->mode_config.output_poll_work, delay);
283+
}
284+
265285
/**
266286
* drm_kms_helper_poll_enable - re-enable output polling.
267287
* @dev: drm_device
@@ -279,37 +299,41 @@ static bool drm_kms_helper_enable_hpd(struct drm_device *dev)
279299
*/
280300
void drm_kms_helper_poll_enable(struct drm_device *dev)
281301
{
282-
bool poll = false;
283-
unsigned long delay = DRM_OUTPUT_POLL_PERIOD;
284-
285302
if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll ||
286303
dev->mode_config.poll_running)
287304
return;
288305

289-
poll = drm_kms_helper_enable_hpd(dev);
290-
291-
if (dev->mode_config.delayed_event) {
292-
/*
293-
* FIXME:
294-
*
295-
* Use short (1s) delay to handle the initial delayed event.
296-
* This delay should not be needed, but Optimus/nouveau will
297-
* fail in a mysterious way if the delayed event is handled as
298-
* soon as possible like it is done in
299-
* drm_helper_probe_single_connector_modes() in case the poll
300-
* was enabled before.
301-
*/
302-
poll = true;
303-
delay = HZ;
304-
}
305-
306-
if (poll)
307-
schedule_delayed_work(&dev->mode_config.output_poll_work, delay);
306+
if (drm_kms_helper_enable_hpd(dev) ||
307+
dev->mode_config.delayed_event)
308+
reschedule_output_poll_work(dev);
308309

309310
dev->mode_config.poll_running = true;
310311
}
311312
EXPORT_SYMBOL(drm_kms_helper_poll_enable);
312313

314+
/**
315+
* drm_kms_helper_poll_reschedule - reschedule the output polling work
316+
* @dev: drm_device
317+
*
318+
* This function reschedules the output polling work, after polling for a
319+
* connector has been enabled.
320+
*
321+
* Drivers must call this helper after enabling polling for a connector by
322+
* setting %DRM_CONNECTOR_POLL_CONNECT / %DRM_CONNECTOR_POLL_DISCONNECT flags
323+
* in drm_connector::polled. Note that after disabling polling by clearing these
324+
* flags for a connector will stop the output polling work automatically if
325+
* the polling is disabled for all other connectors as well.
326+
*
327+
* The function can be called only after polling has been enabled by calling
328+
* drm_kms_helper_poll_init() / drm_kms_helper_poll_enable().
329+
*/
330+
void drm_kms_helper_poll_reschedule(struct drm_device *dev)
331+
{
332+
if (dev->mode_config.poll_running)
333+
reschedule_output_poll_work(dev);
334+
}
335+
EXPORT_SYMBOL(drm_kms_helper_poll_reschedule);
336+
313337
static enum drm_connector_status
314338
drm_helper_probe_detect_ctx(struct drm_connector *connector, bool force)
315339
{

drivers/gpu/drm/i915/display/intel_hotplug.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ intel_hpd_irq_storm_switch_to_polling(struct drm_i915_private *dev_priv)
211211

212212
/* Enable polling and queue hotplug re-enabling. */
213213
if (hpd_disabled) {
214-
drm_kms_helper_poll_enable(&dev_priv->drm);
214+
drm_kms_helper_poll_reschedule(&dev_priv->drm);
215215
mod_delayed_work(dev_priv->unordered_wq,
216216
&dev_priv->display.hotplug.reenable_work,
217217
msecs_to_jiffies(HPD_STORM_REENABLE_DELAY));
@@ -661,7 +661,7 @@ static void i915_hpd_poll_init_work(struct work_struct *work)
661661
drm_connector_list_iter_end(&conn_iter);
662662

663663
if (enabled)
664-
drm_kms_helper_poll_enable(&dev_priv->drm);
664+
drm_kms_helper_poll_reschedule(&dev_priv->drm);
665665

666666
mutex_unlock(&dev_priv->drm.mode_config.mutex);
667667

drivers/gpu/drm/i915/i915_vma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ void vma_invalidate_tlb(struct i915_address_space *vm, u32 *tlb)
13561356
*/
13571357
for_each_gt(gt, vm->i915, id)
13581358
WRITE_ONCE(tlb[id],
1359-
intel_gt_next_invalidate_tlb_full(vm->gt));
1359+
intel_gt_next_invalidate_tlb_full(gt));
13601360
}
13611361

13621362
static void __vma_put_pages(struct i915_vma *vma, unsigned int count)

include/drm/drm_probe_helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ void drm_kms_helper_connector_hotplug_event(struct drm_connector *connector);
2525

2626
void drm_kms_helper_poll_disable(struct drm_device *dev);
2727
void drm_kms_helper_poll_enable(struct drm_device *dev);
28+
void drm_kms_helper_poll_reschedule(struct drm_device *dev);
2829
bool drm_kms_helper_is_poll_worker(void);
2930

3031
enum drm_mode_status drm_crtc_helper_mode_valid_fixed(struct drm_crtc *crtc,

0 commit comments

Comments
 (0)