Commit 8471a26b authored by Dave Airlie's avatar Dave Airlie

Merge remote branch 'korg/drm-radeon-testing' into drm-linus

* korg/drm-radeon-testing:
  drm/radeon/kms: Use radeon_agp_disable when disabling AGP
  drm/radeon/kms: Disable AGP is aperture size < 32M
  drm/radeon/kms: Fix r600 blit cleanup path
  drm/radeon/kms: Do not unpin buffer in fb destruction
  drm/radeon/kms: fix displayport->dvi connector DDC.
parents 79b7dcb2 700a0cc0
...@@ -3399,9 +3399,7 @@ int r100_mc_init(struct radeon_device *rdev) ...@@ -3399,9 +3399,7 @@ int r100_mc_init(struct radeon_device *rdev)
if (rdev->flags & RADEON_IS_AGP) { if (rdev->flags & RADEON_IS_AGP) {
r = radeon_agp_init(rdev); r = radeon_agp_init(rdev);
if (r) { if (r) {
printk(KERN_WARNING "[drm] Disabling AGP\n"); radeon_agp_disable(rdev);
rdev->flags &= ~RADEON_IS_AGP;
rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
} else { } else {
rdev->mc.gtt_location = rdev->mc.agp_base; rdev->mc.gtt_location = rdev->mc.agp_base;
} }
......
...@@ -50,9 +50,7 @@ int r420_mc_init(struct radeon_device *rdev) ...@@ -50,9 +50,7 @@ int r420_mc_init(struct radeon_device *rdev)
if (rdev->flags & RADEON_IS_AGP) { if (rdev->flags & RADEON_IS_AGP) {
r = radeon_agp_init(rdev); r = radeon_agp_init(rdev);
if (r) { if (r) {
printk(KERN_WARNING "[drm] Disabling AGP\n"); radeon_agp_disable(rdev);
rdev->flags &= ~RADEON_IS_AGP;
rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
} else { } else {
rdev->mc.gtt_location = rdev->mc.agp_base; rdev->mc.gtt_location = rdev->mc.agp_base;
} }
......
...@@ -624,7 +624,6 @@ int r600_mc_init(struct radeon_device *rdev) ...@@ -624,7 +624,6 @@ int r600_mc_init(struct radeon_device *rdev)
fixed20_12 a; fixed20_12 a;
u32 tmp; u32 tmp;
int chansize, numchan; int chansize, numchan;
int r;
/* Get VRAM informations */ /* Get VRAM informations */
rdev->mc.vram_is_ddr = true; rdev->mc.vram_is_ddr = true;
...@@ -667,9 +666,6 @@ int r600_mc_init(struct radeon_device *rdev) ...@@ -667,9 +666,6 @@ int r600_mc_init(struct radeon_device *rdev)
rdev->mc.real_vram_size = rdev->mc.aper_size; rdev->mc.real_vram_size = rdev->mc.aper_size;
if (rdev->flags & RADEON_IS_AGP) { if (rdev->flags & RADEON_IS_AGP) {
r = radeon_agp_init(rdev);
if (r)
return r;
/* gtt_size is setup by radeon_agp_init */ /* gtt_size is setup by radeon_agp_init */
rdev->mc.gtt_location = rdev->mc.agp_base; rdev->mc.gtt_location = rdev->mc.agp_base;
tmp = 0xFFFFFFFFUL - rdev->mc.agp_base - rdev->mc.gtt_size; tmp = 0xFFFFFFFFUL - rdev->mc.agp_base - rdev->mc.gtt_size;
...@@ -1961,11 +1957,13 @@ int r600_suspend(struct radeon_device *rdev) ...@@ -1961,11 +1957,13 @@ int r600_suspend(struct radeon_device *rdev)
r600_wb_disable(rdev); r600_wb_disable(rdev);
r600_pcie_gart_disable(rdev); r600_pcie_gart_disable(rdev);
/* unpin shaders bo */ /* unpin shaders bo */
if (rdev->r600_blit.shader_obj) {
r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
if (unlikely(r != 0)) if (!r) {
return r;
radeon_bo_unpin(rdev->r600_blit.shader_obj); radeon_bo_unpin(rdev->r600_blit.shader_obj);
radeon_bo_unreserve(rdev->r600_blit.shader_obj); radeon_bo_unreserve(rdev->r600_blit.shader_obj);
}
}
return 0; return 0;
} }
...@@ -2026,6 +2024,11 @@ int r600_init(struct radeon_device *rdev) ...@@ -2026,6 +2024,11 @@ int r600_init(struct radeon_device *rdev)
r = radeon_fence_driver_init(rdev); r = radeon_fence_driver_init(rdev);
if (r) if (r)
return r; return r;
if (rdev->flags & RADEON_IS_AGP) {
r = radeon_agp_init(rdev);
if (r)
radeon_agp_disable(rdev);
}
r = r600_mc_init(rdev); r = r600_mc_init(rdev);
if (r) if (r)
return r; return r;
......
...@@ -512,14 +512,16 @@ void r600_blit_fini(struct radeon_device *rdev) ...@@ -512,14 +512,16 @@ void r600_blit_fini(struct radeon_device *rdev)
{ {
int r; int r;
if (rdev->r600_blit.shader_obj == NULL)
return;
/* If we can't reserve the bo, unref should be enough to destroy
* it when it becomes idle.
*/
r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
if (unlikely(r != 0)) { if (!r) {
dev_err(rdev->dev, "(%d) can't finish r600 blit\n", r);
goto out_unref;
}
radeon_bo_unpin(rdev->r600_blit.shader_obj); radeon_bo_unpin(rdev->r600_blit.shader_obj);
radeon_bo_unreserve(rdev->r600_blit.shader_obj); radeon_bo_unreserve(rdev->r600_blit.shader_obj);
out_unref: }
radeon_bo_unref(&rdev->r600_blit.shader_obj); radeon_bo_unref(&rdev->r600_blit.shader_obj);
} }
......
...@@ -1017,6 +1017,8 @@ static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v) ...@@ -1017,6 +1017,8 @@ static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v)
#define radeon_hpd_set_polarity(rdev, hpd) (rdev)->asic->hpd_set_polarity((rdev), (hpd)) #define radeon_hpd_set_polarity(rdev, hpd) (rdev)->asic->hpd_set_polarity((rdev), (hpd))
/* Common functions */ /* Common functions */
/* AGP */
extern void radeon_agp_disable(struct radeon_device *rdev);
extern int radeon_gart_table_vram_pin(struct radeon_device *rdev); extern int radeon_gart_table_vram_pin(struct radeon_device *rdev);
extern int radeon_modeset_init(struct radeon_device *rdev); extern int radeon_modeset_init(struct radeon_device *rdev);
extern void radeon_modeset_fini(struct radeon_device *rdev); extern void radeon_modeset_fini(struct radeon_device *rdev);
......
...@@ -133,6 +133,13 @@ int radeon_agp_init(struct radeon_device *rdev) ...@@ -133,6 +133,13 @@ int radeon_agp_init(struct radeon_device *rdev)
bool is_v3; bool is_v3;
int ret; int ret;
if (rdev->ddev->agp->agp_info.aper_size < 32) {
dev_warn(rdev->dev, "AGP aperture to small (%dM) "
"need at least 32M, disabling AGP\n",
rdev->ddev->agp->agp_info.aper_size);
return -EINVAL;
}
/* Acquire AGP. */ /* Acquire AGP. */
if (!rdev->ddev->agp->acquired) { if (!rdev->ddev->agp->acquired) {
ret = drm_agp_acquire(rdev->ddev); ret = drm_agp_acquire(rdev->ddev);
......
...@@ -544,6 +544,7 @@ void radeon_agp_disable(struct radeon_device *rdev) ...@@ -544,6 +544,7 @@ void radeon_agp_disable(struct radeon_device *rdev)
rdev->asic->gart_tlb_flush = &r100_pci_gart_tlb_flush; rdev->asic->gart_tlb_flush = &r100_pci_gart_tlb_flush;
rdev->asic->gart_set_page = &r100_pci_gart_set_page; rdev->asic->gart_set_page = &r100_pci_gart_set_page;
} }
rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
} }
void radeon_check_arguments(struct radeon_device *rdev) void radeon_check_arguments(struct radeon_device *rdev)
......
...@@ -357,7 +357,8 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector) ...@@ -357,7 +357,8 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector)
if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) || if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) ||
(radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)) { (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)) {
struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; struct radeon_connector_atom_dig *dig = radeon_connector->con_priv;
if (dig->dp_i2c_bus) if ((dig->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT ||
dig->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) && dig->dp_i2c_bus)
radeon_connector->edid = drm_get_edid(&radeon_connector->base, &dig->dp_i2c_bus->adapter); radeon_connector->edid = drm_get_edid(&radeon_connector->base, &dig->dp_i2c_bus->adapter);
} }
if (!radeon_connector->ddc_bus) if (!radeon_connector->ddc_bus)
...@@ -667,7 +668,6 @@ static void radeon_user_framebuffer_destroy(struct drm_framebuffer *fb) ...@@ -667,7 +668,6 @@ static void radeon_user_framebuffer_destroy(struct drm_framebuffer *fb)
radeonfb_remove(dev, fb); radeonfb_remove(dev, fb);
if (radeon_fb->obj) { if (radeon_fb->obj) {
radeon_gem_object_unpin(radeon_fb->obj);
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
drm_gem_object_unreference(radeon_fb->obj); drm_gem_object_unreference(radeon_fb->obj);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
......
...@@ -779,7 +779,6 @@ int rv770_mc_init(struct radeon_device *rdev) ...@@ -779,7 +779,6 @@ int rv770_mc_init(struct radeon_device *rdev)
fixed20_12 a; fixed20_12 a;
u32 tmp; u32 tmp;
int chansize, numchan; int chansize, numchan;
int r;
/* Get VRAM informations */ /* Get VRAM informations */
rdev->mc.vram_is_ddr = true; rdev->mc.vram_is_ddr = true;
...@@ -822,9 +821,6 @@ int rv770_mc_init(struct radeon_device *rdev) ...@@ -822,9 +821,6 @@ int rv770_mc_init(struct radeon_device *rdev)
rdev->mc.real_vram_size = rdev->mc.aper_size; rdev->mc.real_vram_size = rdev->mc.aper_size;
if (rdev->flags & RADEON_IS_AGP) { if (rdev->flags & RADEON_IS_AGP) {
r = radeon_agp_init(rdev);
if (r)
return r;
/* gtt_size is setup by radeon_agp_init */ /* gtt_size is setup by radeon_agp_init */
rdev->mc.gtt_location = rdev->mc.agp_base; rdev->mc.gtt_location = rdev->mc.agp_base;
tmp = 0xFFFFFFFFUL - rdev->mc.agp_base - rdev->mc.gtt_size; tmp = 0xFFFFFFFFUL - rdev->mc.agp_base - rdev->mc.gtt_size;
...@@ -975,11 +971,13 @@ int rv770_suspend(struct radeon_device *rdev) ...@@ -975,11 +971,13 @@ int rv770_suspend(struct radeon_device *rdev)
r600_wb_disable(rdev); r600_wb_disable(rdev);
rv770_pcie_gart_disable(rdev); rv770_pcie_gart_disable(rdev);
/* unpin shaders bo */ /* unpin shaders bo */
if (rdev->r600_blit.shader_obj) {
r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
if (likely(r == 0)) { if (likely(r == 0)) {
radeon_bo_unpin(rdev->r600_blit.shader_obj); radeon_bo_unpin(rdev->r600_blit.shader_obj);
radeon_bo_unreserve(rdev->r600_blit.shader_obj); radeon_bo_unreserve(rdev->r600_blit.shader_obj);
} }
}
return 0; return 0;
} }
...@@ -1037,6 +1035,11 @@ int rv770_init(struct radeon_device *rdev) ...@@ -1037,6 +1035,11 @@ int rv770_init(struct radeon_device *rdev)
r = radeon_fence_driver_init(rdev); r = radeon_fence_driver_init(rdev);
if (r) if (r)
return r; return r;
if (rdev->flags & RADEON_IS_AGP) {
r = radeon_agp_init(rdev);
if (r)
radeon_agp_disable(rdev);
}
r = rv770_mc_init(rdev); r = rv770_mc_init(rdev);
if (r) if (r)
return r; return r;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment