[patch] i915: take struct_mutex in i915_dma_cleanup()

2010-06-23 Thread Dan Carpenter
intel_cleanup_ring_buffer() calls drm_gem_object_unreference() (as
opposed to drm_gem_object_unreference_unlocked()) so it needs to be
called with "struct_mutex" held.  If we don't hold the lock, it triggers
a BUG_ON(!mutex_is_locked(&dev->struct_mutex));

I also audited the other places that call intel_cleanup_ring_buffer()
and they all hold the lock so they're OK.

This was introduced in: 8187a2b70e3 "drm/i915: introduce
intel_ring_buffer structure (V2)" and it's a regression from v2.6.34.

Addresses: https://bugzilla.kernel.org/show_bug.cgi?id=16247

Signed-off-by: Dan Carpenter 
Reported-by: Benny Halevy 
Tested-by: Benny Halevy 

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 59a2bf8..3325af1 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -128,9 +128,11 @@ static int i915_dma_cleanup(struct drm_device * dev)
if (dev->irq_enabled)
drm_irq_uninstall(dev);
 
+   mutex_lock(&dev->struct_mutex);
intel_cleanup_ring_buffer(dev, &dev_priv->render_ring);
if (HAS_BSD(dev))
intel_cleanup_ring_buffer(dev, &dev_priv->bsd_ring);
+   mutex_unlock(&dev->struct_mutex);
 
/* Clear the HWS virtual address at teardown */
if (I915_NEED_GFX_HWS(dev))

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 28671] Seg. fault and Oops with Radeon KMS (v2.6.34) on PPC ATI Radeon AGP r420 JH.

2010-06-23 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=28671

--- Comment #12 from Brett Witherspoon  
2010-06-23 13:19:06 PDT ---
Ok I will pull from the git tree and give those a try.

Changing the AGP mode did not improve any of the symptoms. Also disabling one
or all of the EXA options did not seem to help either. Adding an additional
"RenderAccel" "False" did show some of the wm but it would still lock. The
"NoAccel" option seems to be the only one that makes a difference. 

I am happy to test or help in anyway I can.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/radeon/kms: fix typos in evergreen command checker

2010-06-23 Thread Alex Deucher
Signed-off-by: Alex Deucher 
---
 drivers/gpu/drm/radeon/evergreen_cs.c |4 ++--
 drivers/gpu/drm/radeon/reg_srcs/evergreen |   10 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c 
b/drivers/gpu/drm/radeon/evergreen_cs.c
index 64516b9..010963d 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -1197,7 +1197,7 @@ static int evergreen_packet3_check(struct 
radeon_cs_parser *p,
DRM_ERROR("bad SET_RESOURCE (tex)\n");
return -EINVAL;
}
-   ib[idx+1+(i*8)+3] += 
(u32)((reloc->lobj.gpu_offset >> 8) & 0x);
+   ib[idx+1+(i*8)+2] += 
(u32)((reloc->lobj.gpu_offset >> 8) & 0x);
if (reloc->lobj.tiling_flags & 
RADEON_TILING_MACRO)
ib[idx+1+(i*8)+1] |= 
TEX_ARRAY_MODE(ARRAY_2D_TILED_THIN1);
else if (reloc->lobj.tiling_flags & 
RADEON_TILING_MICRO)
@@ -1209,7 +1209,7 @@ static int evergreen_packet3_check(struct 
radeon_cs_parser *p,
DRM_ERROR("bad SET_RESOURCE (tex)\n");
return -EINVAL;
}
-   ib[idx+1+(i*8)+4] += 
(u32)((reloc->lobj.gpu_offset >> 8) & 0x);
+   ib[idx+1+(i*8)+3] += 
(u32)((reloc->lobj.gpu_offset >> 8) & 0x);
mipmap = reloc->robj;
r = evergreen_check_texture_resource(p,  
idx+1+(i*8),
texture, mipmap);
diff --git a/drivers/gpu/drm/radeon/reg_srcs/evergreen 
b/drivers/gpu/drm/radeon/reg_srcs/evergreen
index b5c757f..f78fd59 100644
--- a/drivers/gpu/drm/radeon/reg_srcs/evergreen
+++ b/drivers/gpu/drm/radeon/reg_srcs/evergreen
@@ -80,8 +80,8 @@ evergreen 0x9400
 0x00028010 DB_RENDER_OVERRIDE2
 0x00028028 DB_STENCIL_CLEAR
 0x0002802C DB_DEPTH_CLEAR
-0x00028034 PA_SC_SCREEN_SCISSOR_BR
 0x00028030 PA_SC_SCREEN_SCISSOR_TL
+0x00028034 PA_SC_SCREEN_SCISSOR_BR
 0x0002805C DB_DEPTH_SLICE
 0x00028140 SQ_ALU_CONST_BUFFER_SIZE_PS_0
 0x00028144 SQ_ALU_CONST_BUFFER_SIZE_PS_1
@@ -460,8 +460,8 @@ evergreen 0x9400
 0x00028844 SQ_PGM_RESOURCES_PS
 0x00028848 SQ_PGM_RESOURCES_2_PS
 0x0002884C SQ_PGM_EXPORTS_PS
-0x0002885C SQ_PGM_RESOURCES_VS
-0x00028860 SQ_PGM_RESOURCES_2_VS
+0x00028860 SQ_PGM_RESOURCES_VS
+0x00028864 SQ_PGM_RESOURCES_2_VS
 0x00028878 SQ_PGM_RESOURCES_GS
 0x0002887C SQ_PGM_RESOURCES_2_GS
 0x00028890 SQ_PGM_RESOURCES_ES
@@ -469,8 +469,8 @@ evergreen 0x9400
 0x000288A8 SQ_PGM_RESOURCES_FS
 0x000288BC SQ_PGM_RESOURCES_HS
 0x000288C0 SQ_PGM_RESOURCES_2_HS
-0x000288D0 SQ_PGM_RESOURCES_LS
-0x000288D4 SQ_PGM_RESOURCES_2_LS
+0x000288D4 SQ_PGM_RESOURCES_LS
+0x000288D8 SQ_PGM_RESOURCES_2_LS
 0x000288E8 SQ_LDS_ALLOC
 0x000288EC SQ_LDS_ALLOC_PS
 0x000288F0 SQ_VTX_SEMANTIC_CLEAR
-- 
1.7.0.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


No subject

2010-06-23 Thread

--=20
controlled by gamma light


[patch] i915: take struct_mutex in i915_dma_cleanup()

2010-06-23 Thread Dan Carpenter
intel_cleanup_ring_buffer() calls drm_gem_object_unreference() (as
opposed to drm_gem_object_unreference_unlocked()) so it needs to be
called with "struct_mutex" held.  If we don't hold the lock, it triggers
a BUG_ON(!mutex_is_locked(&dev->struct_mutex));

I also audited the other places that call intel_cleanup_ring_buffer()
and they all hold the lock so they're OK.

This was introduced in: 8187a2b70e3 "drm/i915: introduce
intel_ring_buffer structure (V2)" and it's a regression from v2.6.34.

Addresses: https://bugzilla.kernel.org/show_bug.cgi?id=16247

Signed-off-by: Dan Carpenter 
Reported-by: Benny Halevy 
Tested-by: Benny Halevy 

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 59a2bf8..3325af1 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -128,9 +128,11 @@ static int i915_dma_cleanup(struct drm_device * dev)
if (dev->irq_enabled)
drm_irq_uninstall(dev);

+   mutex_lock(&dev->struct_mutex);
intel_cleanup_ring_buffer(dev, &dev_priv->render_ring);
if (HAS_BSD(dev))
intel_cleanup_ring_buffer(dev, &dev_priv->bsd_ring);
+   mutex_unlock(&dev->struct_mutex);

/* Clear the HWS virtual address at teardown */
if (I915_NEED_GFX_HWS(dev))



[Bug 28671] Seg. fault and Oops with Radeon KMS (v2.6.34) on PPC ATI Radeon AGP r420 JH.

2010-06-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=28671

--- Comment #12 from Brett Witherspoon  
2010-06-23 13:19:06 PDT ---
Ok I will pull from the git tree and give those a try.

Changing the AGP mode did not improve any of the symptoms. Also disabling one
or all of the EXA options did not seem to help either. Adding an additional
"RenderAccel" "False" did show some of the wm but it would still lock. The
"NoAccel" option seems to be the only one that makes a difference. 

I am happy to test or help in anyway I can.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


[PATCH] drm/radeon/kms: fix typos in evergreen command checker

2010-06-23 Thread Alex Deucher
Signed-off-by: Alex Deucher 
---
 drivers/gpu/drm/radeon/evergreen_cs.c |4 ++--
 drivers/gpu/drm/radeon/reg_srcs/evergreen |   10 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c 
b/drivers/gpu/drm/radeon/evergreen_cs.c
index 64516b9..010963d 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -1197,7 +1197,7 @@ static int evergreen_packet3_check(struct 
radeon_cs_parser *p,
DRM_ERROR("bad SET_RESOURCE (tex)\n");
return -EINVAL;
}
-   ib[idx+1+(i*8)+3] += 
(u32)((reloc->lobj.gpu_offset >> 8) & 0x);
+   ib[idx+1+(i*8)+2] += 
(u32)((reloc->lobj.gpu_offset >> 8) & 0x);
if (reloc->lobj.tiling_flags & 
RADEON_TILING_MACRO)
ib[idx+1+(i*8)+1] |= 
TEX_ARRAY_MODE(ARRAY_2D_TILED_THIN1);
else if (reloc->lobj.tiling_flags & 
RADEON_TILING_MICRO)
@@ -1209,7 +1209,7 @@ static int evergreen_packet3_check(struct 
radeon_cs_parser *p,
DRM_ERROR("bad SET_RESOURCE (tex)\n");
return -EINVAL;
}
-   ib[idx+1+(i*8)+4] += 
(u32)((reloc->lobj.gpu_offset >> 8) & 0x);
+   ib[idx+1+(i*8)+3] += 
(u32)((reloc->lobj.gpu_offset >> 8) & 0x);
mipmap = reloc->robj;
r = evergreen_check_texture_resource(p,  
idx+1+(i*8),
texture, mipmap);
diff --git a/drivers/gpu/drm/radeon/reg_srcs/evergreen 
b/drivers/gpu/drm/radeon/reg_srcs/evergreen
index b5c757f..f78fd59 100644
--- a/drivers/gpu/drm/radeon/reg_srcs/evergreen
+++ b/drivers/gpu/drm/radeon/reg_srcs/evergreen
@@ -80,8 +80,8 @@ evergreen 0x9400
 0x00028010 DB_RENDER_OVERRIDE2
 0x00028028 DB_STENCIL_CLEAR
 0x0002802C DB_DEPTH_CLEAR
-0x00028034 PA_SC_SCREEN_SCISSOR_BR
 0x00028030 PA_SC_SCREEN_SCISSOR_TL
+0x00028034 PA_SC_SCREEN_SCISSOR_BR
 0x0002805C DB_DEPTH_SLICE
 0x00028140 SQ_ALU_CONST_BUFFER_SIZE_PS_0
 0x00028144 SQ_ALU_CONST_BUFFER_SIZE_PS_1
@@ -460,8 +460,8 @@ evergreen 0x9400
 0x00028844 SQ_PGM_RESOURCES_PS
 0x00028848 SQ_PGM_RESOURCES_2_PS
 0x0002884C SQ_PGM_EXPORTS_PS
-0x0002885C SQ_PGM_RESOURCES_VS
-0x00028860 SQ_PGM_RESOURCES_2_VS
+0x00028860 SQ_PGM_RESOURCES_VS
+0x00028864 SQ_PGM_RESOURCES_2_VS
 0x00028878 SQ_PGM_RESOURCES_GS
 0x0002887C SQ_PGM_RESOURCES_2_GS
 0x00028890 SQ_PGM_RESOURCES_ES
@@ -469,8 +469,8 @@ evergreen 0x9400
 0x000288A8 SQ_PGM_RESOURCES_FS
 0x000288BC SQ_PGM_RESOURCES_HS
 0x000288C0 SQ_PGM_RESOURCES_2_HS
-0x000288D0 SQ_PGM_RESOURCES_LS
-0x000288D4 SQ_PGM_RESOURCES_2_LS
+0x000288D4 SQ_PGM_RESOURCES_LS
+0x000288D8 SQ_PGM_RESOURCES_2_LS
 0x000288E8 SQ_LDS_ALLOC
 0x000288EC SQ_LDS_ALLOC_PS
 0x000288F0 SQ_VTX_SEMANTIC_CLEAR
-- 
1.7.0.1



[patch] i915: take struct_mutex in i915_dma_cleanup()

2010-06-23 Thread Jesse Barnes
On Wed, 23 Jun 2010 13:19:55 +0200
Dan Carpenter  wrote:

> intel_cleanup_ring_buffer() calls drm_gem_object_unreference() (as
> opposed to drm_gem_object_unreference_unlocked()) so it needs to be
> called with "struct_mutex" held.  If we don't hold the lock, it triggers
> a BUG_ON(!mutex_is_locked(&dev->struct_mutex));
> 
> I also audited the other places that call intel_cleanup_ring_buffer()
> and they all hold the lock so they're OK.
> 
> This was introduced in: 8187a2b70e3 "drm/i915: introduce
> intel_ring_buffer structure (V2)" and it's a regression from v2.6.34.
> 
> Addresses: https://bugzilla.kernel.org/show_bug.cgi?id=16247
> 
> Signed-off-by: Dan Carpenter 
> Reported-by: Benny Halevy 
> Tested-by: Benny Halevy 

Reminds me, Gordon can you add module unload testing to your set of
basic daily tests?  To unload you need to unbind the fbcon interface
first, my script is like this:

echo 0 > /sys/class/vtconsole/vtcon1/bind
rmmod i915
rmmod drm_kms_helper
rmmod drm
modprobe i915
echo 1 > /sys/class/vtconsole/vtcon1/bind

If unload and re-load doesn't work please file a bug and see if you can
bisect it.

Thanks,
-- 
Jesse Barnes, Intel Open Source Technology Center


[patch] i915: return -EFAULT if copy_to_user fails

2010-06-23 Thread Dan Carpenter
copy_to_user() returns the number of bytes remaining to be copied and
I'm pretty sure we want to return a negative error code here.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 9ded3da..22691b4 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3707,6 +3707,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
if (ret != 0) {
DRM_ERROR("copy %d cliprects failed: %d\n",
  args->num_cliprects, ret);
+   ret = -EFAULT;
goto pre_mutex_err;
}
}


[patch] i915: remove unneed NULL checks

2010-06-23 Thread Dan Carpenter
We don't need to check the list cursor in a list_for_each_entry().  It's
always non-null.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index cc8131f..8a2bdfc 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -745,7 +745,7 @@ bool intel_pipe_has_type (struct drm_crtc *crtc, int type)
 struct drm_encoder *l_entry;

 list_for_each_entry(l_entry, &mode_config->encoder_list, head) {
-   if (l_entry && l_entry->crtc == crtc) {
+   if (l_entry->crtc == crtc) {
struct intel_encoder *intel_encoder = 
enc_to_intel_encoder(l_entry);
if (intel_encoder->type == type)
return true;
@@ -3322,7 +3322,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,

list_for_each_entry(encoder, &mode_config->encoder_list, head) {

-   if (!encoder || encoder->crtc != crtc)
+   if (encoder->crtc != crtc)
continue;

intel_encoder = enc_to_intel_encoder(encoder);


[patch] i915: cleanup: use ARRAY_SIZE()

2010-06-23 Thread Dan Carpenter
NUM_TV_MODES is the same as  ARRAY_SIZE(tv_modes).  In the end, I
decided it was cleaner to remove NUM_TV_MODES and just use
ARRAY_SIZE(tv_modes) through out.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index 6d553c2..ee4de98 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -896,8 +896,6 @@ static const struct tv_mode tv_modes[] = {
},
 };

-#define NUM_TV_MODES sizeof(tv_modes) / sizeof (tv_modes[0])
-
 static void
 intel_tv_dpms(struct drm_encoder *encoder, int mode)
 {
@@ -1512,7 +1510,7 @@ intel_tv_set_property(struct drm_connector *connector, 
struct drm_property *prop
tv_priv->margin[TV_MARGIN_BOTTOM] = val;
changed = true;
} else if (property == dev->mode_config.tv_mode_property) {
-   if (val >= NUM_TV_MODES) {
+   if (val >= ARRAY_SIZE(tv_modes)) {
ret = -EINVAL;
goto out;
}
@@ -1693,13 +1691,13 @@ intel_tv_init(struct drm_device *dev)
connector->doublescan_allowed = false;

/* Create TV properties then attach current values */
-   tv_format_names = kmalloc(sizeof(char *) * NUM_TV_MODES,
+   tv_format_names = kmalloc(sizeof(char *) * ARRAY_SIZE(tv_modes),
  GFP_KERNEL);
if (!tv_format_names)
goto out;
-   for (i = 0; i < NUM_TV_MODES; i++)
+   for (i = 0; i < ARRAY_SIZE(tv_modes); i++)
tv_format_names[i] = tv_modes[i].name;
-   drm_mode_create_tv_properties(dev, NUM_TV_MODES, tv_format_names);
+   drm_mode_create_tv_properties(dev, ARRAY_SIZE(tv_modes), 
tv_format_names);

drm_connector_attach_property(connector, 
dev->mode_config.tv_mode_property,
   initial_mode);