Skip to content

Commit 6357c81

Browse files
committed
Merge tag 'drm-fixes-2019-03-01' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "Three final fixes, one for a feature that is new in this kernel, one bochs fix for qemu riscv and one atomic modesetting fix. I've left a few of the other late fixes until next as I didn't want to throw in anything that wasn't really necessary" * tag 'drm-fixes-2019-03-01' of git://anongit.freedesktop.org/drm/drm: drm/bochs: Fix the ID mismatch error drm: Block fb changes for async plane updates drm/amd/display: Use vrr friendly pageflip throttling in DC.
2 parents bf23aba + 17fb465 commit 6357c81

File tree

4 files changed

+37
-4
lines changed

4 files changed

+37
-4
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ struct amdgpu_crtc {
405405
struct amdgpu_flip_work *pflip_works;
406406
enum amdgpu_flip_status pflip_status;
407407
int deferred_flip_completion;
408+
u64 last_flip_vblank;
408409
/* pll sharing */
409410
struct amdgpu_atom_ss ss;
410411
bool ss_enabled;

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,11 @@ static void dm_pflip_high_irq(void *interrupt_params)
303303
return;
304304
}
305305

306+
/* Update to correct count(s) if racing with vblank irq */
307+
amdgpu_crtc->last_flip_vblank = drm_crtc_accurate_vblank_count(&amdgpu_crtc->base);
306308

307309
/* wake up userspace */
308310
if (amdgpu_crtc->event) {
309-
/* Update to correct count(s) if racing with vblank irq */
310-
drm_crtc_accurate_vblank_count(&amdgpu_crtc->base);
311-
312311
drm_crtc_send_vblank_event(&amdgpu_crtc->base, amdgpu_crtc->event);
313312

314313
/* page flip completed. clean up */
@@ -4828,6 +4827,8 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
48284827
to_dm_crtc_state(drm_atomic_get_old_crtc_state(state, pcrtc));
48294828
int planes_count = 0;
48304829
unsigned long flags;
4830+
u64 last_flip_vblank;
4831+
bool vrr_active = acrtc_state->freesync_config.state == VRR_STATE_ACTIVE_VARIABLE;
48314832

48324833
/* update planes when needed */
48334834
for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
@@ -4859,6 +4860,16 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
48594860
/* In commit tail framework this cannot happen */
48604861
WARN_ON(1);
48614862
}
4863+
4864+
/* For variable refresh rate mode only:
4865+
* Get vblank of last completed flip to avoid > 1 vrr flips per
4866+
* video frame by use of throttling, but allow flip programming
4867+
* anywhere in the possibly large variable vrr vblank interval
4868+
* for fine-grained flip timing control and more opportunity to
4869+
* avoid stutter on late submission of amdgpu_dm_do_flip() calls.
4870+
*/
4871+
last_flip_vblank = acrtc_attach->last_flip_vblank;
4872+
48624873
spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
48634874

48644875
if (!pflip_needed || plane->type == DRM_PLANE_TYPE_OVERLAY) {
@@ -4882,10 +4893,18 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
48824893
if (plane->type == DRM_PLANE_TYPE_PRIMARY)
48834894
drm_crtc_vblank_get(crtc);
48844895

4896+
/* Use old throttling in non-vrr fixed refresh rate mode
4897+
* to keep flip scheduling based on target vblank counts
4898+
* working in a backwards compatible way, e.g., clients
4899+
* using GLX_OML_sync_control extension.
4900+
*/
4901+
if (!vrr_active)
4902+
last_flip_vblank = drm_crtc_vblank_count(crtc);
4903+
48854904
amdgpu_dm_do_flip(
48864905
crtc,
48874906
fb,
4888-
(uint32_t)drm_crtc_vblank_count(crtc) + *wait_for_vblank,
4907+
(uint32_t) last_flip_vblank + *wait_for_vblank,
48894908
dc_state);
48904909
}
48914910

drivers/gpu/drm/bochs/bochs_drv.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ static int bochs_pci_probe(struct pci_dev *pdev,
154154
if (IS_ERR(dev))
155155
return PTR_ERR(dev);
156156

157+
ret = pci_enable_device(pdev);
158+
if (ret)
159+
goto err_free_dev;
160+
157161
dev->pdev = pdev;
158162
pci_set_drvdata(pdev, dev);
159163

drivers/gpu/drm/drm_atomic_helper.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,6 +1602,15 @@ int drm_atomic_helper_async_check(struct drm_device *dev,
16021602
old_plane_state->crtc != new_plane_state->crtc)
16031603
return -EINVAL;
16041604

1605+
/*
1606+
* FIXME: Since prepare_fb and cleanup_fb are always called on
1607+
* the new_plane_state for async updates we need to block framebuffer
1608+
* changes. This prevents use of a fb that's been cleaned up and
1609+
* double cleanups from occuring.
1610+
*/
1611+
if (old_plane_state->fb != new_plane_state->fb)
1612+
return -EINVAL;
1613+
16051614
funcs = plane->helper_private;
16061615
if (!funcs->atomic_async_update)
16071616
return -EINVAL;

0 commit comments

Comments
 (0)