Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu/virtual_dce: No need to pin the fb's bo

For virtual display, no need to pin the fb's bo.

Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Emily Deng and committed by
Alex Deucher
094e640d e3d09307

+15 -22
+12 -8
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
··· 188 188 goto cleanup; 189 189 } 190 190 191 - r = amdgpu_bo_pin(new_abo, amdgpu_display_supported_domains(adev)); 192 - if (unlikely(r != 0)) { 193 - DRM_ERROR("failed to pin new abo buffer before flip\n"); 194 - goto unreserve; 191 + if (!adev->enable_virtual_display) { 192 + r = amdgpu_bo_pin(new_abo, amdgpu_display_supported_domains(adev)); 193 + if (unlikely(r != 0)) { 194 + DRM_ERROR("failed to pin new abo buffer before flip\n"); 195 + goto unreserve; 196 + } 195 197 } 196 198 197 199 r = amdgpu_ttm_alloc_gart(&new_abo->tbo); ··· 213 211 amdgpu_bo_get_tiling_flags(new_abo, &tiling_flags); 214 212 amdgpu_bo_unreserve(new_abo); 215 213 216 - work->base = amdgpu_bo_gpu_offset(new_abo); 214 + if (!adev->enable_virtual_display) 215 + work->base = amdgpu_bo_gpu_offset(new_abo); 217 216 work->target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) + 218 217 amdgpu_get_vblank_counter_kms(dev, work->crtc_id); 219 218 ··· 245 242 goto cleanup; 246 243 } 247 244 unpin: 248 - if (unlikely(amdgpu_bo_unpin(new_abo) != 0)) { 249 - DRM_ERROR("failed to unpin new abo in error path\n"); 250 - } 245 + if (!adev->enable_virtual_display) 246 + if (unlikely(amdgpu_bo_unpin(new_abo) != 0)) 247 + DRM_ERROR("failed to unpin new abo in error path\n"); 248 + 251 249 unreserve: 252 250 amdgpu_bo_unreserve(new_abo); 253 251
+3 -14
drivers/gpu/drm/amd/amdgpu/dce_virtual.c
··· 167 167 struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); 168 168 169 169 dce_virtual_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); 170 - if (crtc->primary->fb) { 171 - int r; 172 - struct amdgpu_bo *abo; 173 - 174 - abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]); 175 - r = amdgpu_bo_reserve(abo, true); 176 - if (unlikely(r)) 177 - DRM_ERROR("failed to reserve abo before unpin\n"); 178 - else { 179 - amdgpu_bo_unpin(abo); 180 - amdgpu_bo_unreserve(abo); 181 - } 182 - } 183 170 184 171 amdgpu_crtc->pll_id = ATOM_PPLL_INVALID; 185 172 amdgpu_crtc->encoder = NULL; ··· 679 692 spin_unlock_irqrestore(&adev->ddev->event_lock, flags); 680 693 681 694 drm_crtc_vblank_put(&amdgpu_crtc->base); 682 - schedule_work(&works->unpin_work); 695 + amdgpu_bo_unref(&works->old_abo); 696 + kfree(works->shared); 697 + kfree(works); 683 698 684 699 return 0; 685 700 }