Skip to content

Commit f2d022a

Browse files
committed
drm/omap: fix the handling of fb ref counts
With the recent primary-plane changes for drm, the primary plane's framebuffer needs to be ref counted the same way as for non-primary-planes. This was not done by the omapdrm driver, which caused the ref count to drop to 0 too early, causing problems. This patch moves the fb unref and ref from omap_plane_update to omap_plane_mode_set. This way the fb refs are updated for both primary and non-primary cases, as omap_plane_update calls omap_plane_mode_set. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
1 parent 38e5597 commit f2d022a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎drivers/gpu/drm/omapdrm/omap_plane.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ int omap_plane_mode_set(struct drm_plane *plane,
225225
omap_plane->apply_done_cb.arg = arg;
226226
}
227227

228+
if (plane->fb)
229+
drm_framebuffer_unreference(plane->fb);
230+
231+
drm_framebuffer_reference(fb);
232+
228233
plane->fb = fb;
229234
plane->crtc = crtc;
230235

@@ -241,11 +246,6 @@ static int omap_plane_update(struct drm_plane *plane,
241246
struct omap_plane *omap_plane = to_omap_plane(plane);
242247
omap_plane->enabled = true;
243248

244-
if (plane->fb)
245-
drm_framebuffer_unreference(plane->fb);
246-
247-
drm_framebuffer_reference(fb);
248-
249249
/* omap_plane_mode_set() takes adjusted src */
250250
switch (omap_plane->win.rotation & 0xf) {
251251
case BIT(DRM_ROTATE_90):

0 commit comments

Comments
 (0)