Skip to content

Commit 5feba0e

Browse files
vsyrjalajnikula
authored andcommitted
drm/i915: Fix overlay frontbuffer tracking
We don't have a persistent fb holding a reference to the frontbuffer object, so every time we do the get+put we throw the frontbuffer object immediately away. And so the next time around we get a pristine frontbuffer object with bits==0 even for the old vma. This confuses the frontbuffer tracking code which understandably expects the old frontbuffer to have the overlay's bit set. Fix this by hanging on to the frontbuffer reference until the next flip. And just to make this a bit more clear let's track the frontbuffer explicitly instead of just grabbing it via the old vma. Cc: stable@vger.kernel.org Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/1136 Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210209021918.16234-2-ville.syrjala@linux.intel.com Fixes: 8e7cb17 ("drm/i915: Extract intel_frontbuffer active tracking") Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (cherry picked from commit 553c23b) Signed-off-by: Jani Nikula <jani.nikula@intel.com>
1 parent 2f51312 commit 5feba0e

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ struct intel_overlay {
182182
struct intel_crtc *crtc;
183183
struct i915_vma *vma;
184184
struct i915_vma *old_vma;
185+
struct intel_frontbuffer *frontbuffer;
185186
bool active;
186187
bool pfit_active;
187188
u32 pfit_vscale_ratio; /* shifted-point number, (1<<12) == 1.0 */
@@ -282,21 +283,19 @@ static void intel_overlay_flip_prepare(struct intel_overlay *overlay,
282283
struct i915_vma *vma)
283284
{
284285
enum pipe pipe = overlay->crtc->pipe;
285-
struct intel_frontbuffer *from = NULL, *to = NULL;
286+
struct intel_frontbuffer *frontbuffer = NULL;
286287

287288
drm_WARN_ON(&overlay->i915->drm, overlay->old_vma);
288289

289-
if (overlay->vma)
290-
from = intel_frontbuffer_get(overlay->vma->obj);
291290
if (vma)
292-
to = intel_frontbuffer_get(vma->obj);
291+
frontbuffer = intel_frontbuffer_get(vma->obj);
293292

294-
intel_frontbuffer_track(from, to, INTEL_FRONTBUFFER_OVERLAY(pipe));
293+
intel_frontbuffer_track(overlay->frontbuffer, frontbuffer,
294+
INTEL_FRONTBUFFER_OVERLAY(pipe));
295295

296-
if (to)
297-
intel_frontbuffer_put(to);
298-
if (from)
299-
intel_frontbuffer_put(from);
296+
if (overlay->frontbuffer)
297+
intel_frontbuffer_put(overlay->frontbuffer);
298+
overlay->frontbuffer = frontbuffer;
300299

301300
intel_frontbuffer_flip_prepare(overlay->i915,
302301
INTEL_FRONTBUFFER_OVERLAY(pipe));

0 commit comments

Comments
 (0)