From: Zhao Junwang zhjwpku@gmail.com
when the first modeset calls prepare_fb, bo->pin_count change from 0 to 1, then the second modeset with the same fb, that should set bo->pin_count to 2, and then when cleanup_fb was called, bo->pin_count should be 2 to 1.
But in the cirrus_bo_pin, it will set bo->pin_count = 1 at the end of the function, this results that bo->bin_count will never be larger than 1 no matter how many times cirrus_bo_pin was called.
So we need to add a condition before bo->pin_count = 1
V2: if (bo->pin_count) early_exit; do_the_real_pinning work
Cc: Daniel Vetter daniel.vetter@ffwll.ch Cc: Gerd Hoffmann kraxel@redhat.com Cc: Matthew Garrett mjg59@coreos.com Cc: Dave Airlie airlied@redhat.com Signed-off-by: Zhao Junwang zhjwpku@gmail.com --- drivers/gpu/drm/cirrus/cirrus_ttm.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c b/drivers/gpu/drm/cirrus/cirrus_ttm.c index dfffd52..756b6d0 100644 --- a/drivers/gpu/drm/cirrus/cirrus_ttm.c +++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c @@ -364,6 +364,8 @@ int cirrus_bo_pin(struct cirrus_bo *bo, u32 pl_flag, u64 *gpu_addr) bo->pin_count++; if (gpu_addr) *gpu_addr = cirrus_bo_gpu_offset(bo); + + return 0; }
cirrus_ttm_placement(bo, pl_flag);