From: Dave Airlie Date: Mon, 18 Oct 2010 23:48:34 +0000 (+1000) Subject: Merge branch 'drm-fixes' of /home/airlied/kernel/linux-2.6 into drm-core-next X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b7ae5056c94a8191c1fd0b5697707377516c0c5d;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git Merge branch 'drm-fixes' of /home/airlied/kernel/linux-2.6 into drm-core-next Conflicts: drivers/gpu/drm/i915/intel_fb.c drivers/gpu/drm/radeon/r600_blit_kms.c drivers/gpu/drm/ttm/ttm_bo.c --- b7ae5056c94a8191c1fd0b5697707377516c0c5d diff --cc drivers/gpu/drm/i915/intel_fb.c index b937ccfa7bec,b61966c126d3..521622b9be7a --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c @@@ -225,9 -238,11 +225,9 @@@ static void intel_fbdev_destroy(struct drm_framebuffer_cleanup(&ifb->base); if (ifb->obj) { - drm_gem_object_handle_unreference_unlocked(ifb->obj); - drm_gem_object_unreference_unlocked(ifb->obj); + drm_gem_object_unreference(ifb->obj); + ifb->obj = NULL; } - - return 0; } int intel_fbdev_init(struct drm_device *dev) diff --cc drivers/gpu/drm/radeon/r600.c index 7c5f855a43e6,7b65e4efe8af..83ba9644dcb9 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c @@@ -1917,8 -1918,8 +1918,9 @@@ void r600_pciep_wreg(struct radeon_devi */ void r600_cp_stop(struct radeon_device *rdev) { + rdev->mc.active_vram_size = rdev->mc.visible_vram_size; WREG32(R_0086D8_CP_ME_CNTL, S_0086D8_CP_ME_HALT(1)); + WREG32(SCRATCH_UMSK, 0); } int r600_init_microcode(struct radeon_device *rdev) diff --cc drivers/gpu/drm/radeon/r600_blit_kms.c index 39d566dbabfa,3473c00781ff..8362974ef41a --- a/drivers/gpu/drm/radeon/r600_blit_kms.c +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c @@@ -533,18 -532,7 +533,19 @@@ int r600_blit_init(struct radeon_devic memcpy(ptr + rdev->r600_blit.ps_offset, r6xx_ps, r6xx_ps_size * 4); radeon_bo_kunmap(rdev->r600_blit.shader_obj); radeon_bo_unreserve(rdev->r600_blit.shader_obj); + +done: + r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); + if (unlikely(r != 0)) + return r; + r = radeon_bo_pin(rdev->r600_blit.shader_obj, RADEON_GEM_DOMAIN_VRAM, + &rdev->r600_blit.shader_gpu_addr); + radeon_bo_unreserve(rdev->r600_blit.shader_obj); + if (r) { + dev_err(rdev->dev, "(%d) pin blit object failed\n", r); + return r; + } + rdev->mc.active_vram_size = rdev->mc.real_vram_size; return 0; } diff --cc drivers/gpu/drm/radeon/rv770.c index ff1cc58920c0,9490da700749..ab83f688263a --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c @@@ -267,8 -267,8 +267,9 @@@ static void rv770_mc_program(struct rad */ void r700_cp_stop(struct radeon_device *rdev) { + rdev->mc.active_vram_size = rdev->mc.visible_vram_size; WREG32(CP_ME_CNTL, (CP_ME_HALT | CP_PFP_HALT)); + WREG32(SCRATCH_UMSK, 0); } static int rv770_cp_load_microcode(struct radeon_device *rdev) diff --cc drivers/gpu/drm/ttm/ttm_bo.c index af7b57a47fbc,db809e034cc4..1e9bb2156dcf --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@@ -438,6 -441,43 +438,42 @@@ out_err return ret; } + /** + * Call bo::reserved and with the lru lock held. + * Will release GPU memory type usage on destruction. + * This is the place to put in driver specific hooks. + * Will release the bo::reserved lock and the + * lru lock on exit. + */ + + static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo) + { + struct ttm_bo_global *glob = bo->glob; + + if (bo->ttm) { + + /** + * Release the lru_lock, since we don't want to have + * an atomic requirement on ttm_tt[unbind|destroy]. + */ + + spin_unlock(&glob->lru_lock); + ttm_tt_unbind(bo->ttm); + ttm_tt_destroy(bo->ttm); + bo->ttm = NULL; + spin_lock(&glob->lru_lock); + } + + if (bo->mem.mm_node) { - drm_mm_put_block(bo->mem.mm_node); - bo->mem.mm_node = NULL; ++ ttm_bo_mem_put(bo, &bo->mem); + } + + atomic_set(&bo->reserved, 0); + wake_up_all(&bo->event_queue); + spin_unlock(&glob->lru_lock); + } + + /** * If bo idle, remove from delayed- and lru lists, and unref. * If not idle, and already on delayed list, do nothing.