drm: Fix lack of CRTC disable for drm_crtc_helper_set_config(.fb=NULL)
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 28 Nov 2011 21:10:05 +0000 (21:10 +0000)
committerDave Airlie <airlied@redhat.com>
Fri, 2 Dec 2011 10:47:15 +0000 (10:47 +0000)
commit6eebd6bb5f1ea04f04019e5c39f87a0f17ffb472
tree798912a7e21dded899b612a6828d0b104c27c25f
parent2ed4d9d648cbd4fb1c232a646dbdbdfdd373ca94
drm: Fix lack of CRTC disable for drm_crtc_helper_set_config(.fb=NULL)

Disabling the CRTC by setting its framebuffer to NULL, as used by
drm_framebuffer_cleanup(), was failing to pass the current framebuffer
to the crtc_func->disable callback. This is because of the dance within
drm_crtc_helper_set_config to pass the new_fb (NULL in this case) to the
drm_crtc_helper_set_mode with the currently attached fb as a parameter.
drm_crtc_helper_set_mode treats this as a no-op and the encoder is still
enabled. And so the current fb is forgotten before the call to
drm_helper_disable_unused_functions.

This patch treats disabling the CRTC as a simple special case rather
than adding further complexity into the configuration logic.

This fixes a pin-leak of the fb bo on Xserver close.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_crtc_helper.c