DRM/Radeon Cleanup
Subsystems (3)
cover DRM/Radeon Cleanup
Whilst working on my failing Radeon GPU:
Subject: Re: Curious experiences with a Radeon on the fritz
Date: Wed, 21 Sep 2011 18:52:19 -0000
Message-ID: <[email protected]>
http://lists.freedesktop.org/archives/dri-devel/2011-September/014506.html
I made the following trivial improvements to the DRM/Radeon code along the way ([6] fixes a bug):
[1] DRM: comment: drm_crtc{=>_helper}_set_mode
[2] DRM: comment: halve -> half
[3] DRM: cleanup: Remove unused `gamma_size'
[4] DRM: comment: gdm_proc_lists -> drm_proc_lists
[5] DRM: cleanup: `size == 0' is never true
[6] DRM: bug: RADEON_DEBUGFS_MAX_{NUM_FILES => COMPONENTS}
[7] DRM: cleanup: Remove unsused `tmp'
Here is the overall difference:
drivers/gpu/drm/drm_crtc_helper.c | 2 +- drivers/gpu/drm/drm_fb_helper.c | 3 --- drivers/gpu/drm/drm_irq.c | 4 ++-- drivers/gpu/drm/drm_proc.c | 2 +- drivers/gpu/drm/radeon/radeon.h | 2 +- drivers/gpu/drm/radeon/radeon_bios.c | 2 +- drivers/gpu/drm/radeon/radeon_combios.c | 2 +- drivers/gpu/drm/radeon/radeon_device.c | 13 ++++++++----- 8 files changed, 15 insertions(+), 15 deletions(-)
Sincerely,
Michael Witten
Signature · 1 line
1.7.6.409.ge7a85
PATCH 1/7 DRM: comment: drm_crtc{=>_helper}_set_mode
Date: Thu, 15 Sep 2011 21:06:24 +0000
--- drivers/gpu/drm/drm_crtc_helper.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/drm_crtc_helper.c +1 -1
@@ -303,19 +303,19 @@ drm_crtc_prepare_encoders(struct drm_device *dev) }/** -* drm_crtc_set_mode - set a mode +* drm_crtc_helper_set_mode - set a mode * @crtc: CRTC to program * @mode: mode to use * @x: width of mode * @y: height of mode * * LOCKING: * Caller must hold mode config lock. * * Try to set @mode on @crtc. Give @crtc and its associated connectors a chance * to fixup or reject the mode prior to trying to set it. * * RETURNS: * True if the mode was set successfully, or false otherwise. */ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
Signature · 1 line
1.7.6.409.ge7a85
PATCH 2/7 DRM: comment: halve -> half
In reply to Michael WittenDate: Thu, 15 Sep 2011 21:07:26 +0000
--- drivers/gpu/drm/drm_irq.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_irq.c +2 -2
@@ -493,8 +493,8 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc)/* Dot clock in Hz: */ dotclock = (u64 ) crtc->hwmode.clock *1000 ; -/* Fields of interlaced scanout modes are only halve a frame duration. -* Double the dotclock to get halve the frame-/line-/pixelduration. +/* Fields of interlaced scanout modes are only half a frame duration. +* Double the dotclock to get half the frame-/line-/pixelduration. */ if (crtc->hwmode.flags &DRM_MODE_FLAG_INTERLACE ) dotclock *=2 ;
Signature · 1 line
1.7.6.409.ge7a85
PATCH 3/7 DRM: cleanup: Remove unused `gamma_size'
In reply to Michael WittenDate: Thu, 15 Sep 2011 21:12:19 +0000
--- drivers/gpu/drm/drm_fb_helper.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +0 -3
@@ -760,7 +760,6 @@ int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,int i;struct fb_info *info;struct drm_fb_helper_surface_size sizes; -int gamma_size =0 ;memset (&sizes,0 ,sizeof (struct drm_fb_helper_surface_size )); sizes.surface_depth =24 ;
@@ -810,8 +809,6 @@ int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, desired_mode = fb_helper->crtc_info[i].desired_mode;if (desired_mode) { -if (gamma_size ==0 ) - gamma_size = fb_helper->crtc_info[i].mode_set.crtc->gamma_size;if (desired_mode->hdisplay < sizes.fb_width) sizes.fb_width = desired_mode->hdisplay;if (desired_mode->vdisplay < sizes.fb_height)
Signature · 1 line
1.7.6.409.ge7a85
PATCH 4/7 DRM: comment: gdm_proc_lists -> drm_proc_lists
In reply to Michael WittenDate: Thu, 15 Sep 2011 14:43:00 +0000
--- drivers/gpu/drm/drm_proc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/drm_proc.c +1 -1
@@ -87,7 +87,7 @@ static const struct file_operations drm_proc_fops = {* \return Zero on success, non-zero on failure * * Create a given set of proc files represented by an array of -* gdm_proc_lists in the given root directory. +* drm_proc_lists in the given root directory. */ int drm_proc_create_files (struct drm_info_list *files,int count,struct proc_dir_entry *root,struct drm_minor *minor)
Signature · 1 line
1.7.6.409.ge7a85
PATCH 5/7 DRM: cleanup: `size == 0' is never true
In reply to Michael WittenDate: Fri, 16 Sep 2011 20:09:22 +0000
--- drivers/gpu/drm/radeon/radeon_bios.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/radeon/radeon_bios.c +1 -1
@@ -59,7 +59,7 @@ static bool igp_read_bios_from_vram(struct radeon_device *rdev)return false; } -if (size ==0 || bios[0 ] !=0x55 || bios[1 ] !=0xaa ) { +if (bios[0 ] !=0x55 || bios[1 ] !=0xaa ) {iounmap (bios);return false; }
Signature · 1 line
1.7.6.409.ge7a85
PATCH 6/7 DRM: bug: RADEON_DEBUGFS_MAX_{NUM_FILES => COMPONENTS}
In reply to Michael WittenDate: Fri, 16 Sep 2011 20:45:30 +0000
The value of RADEON_DEBUGFS_MAX_NUM_FILES has been used to specify the size of an array, each element of which looks like this:
struct radeon_debugfs {
struct drm_info_list *files;
unsigned num_files;
};Consequently, the number of debugfs files may be much greater than RADEON_DEBUGFS_MAX_NUM_FILES, something that the current code ignores:
if ((_radeon_debugfs_count + nfiles) > RADEON_DEBUGFS_MAX_NUM_FILES) {
DRM_ERROR("Reached maximum number of debugfs files.\n");
DRM_ERROR("Report so we increase RADEON_DEBUGFS_MAX_NUM_FILES.\n");
return -EINVAL;
}This commit fixes this make, and accordingly renames:
RADEON_DEBUGFS_MAX_NUM_FILES
to:
RADEON_DEBUGFS_MAX_COMPONENTS
--- drivers/gpu/drm/radeon/radeon.h | 2 +- drivers/gpu/drm/radeon/radeon_device.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/radeon.h +1 -1
@@ -102,7 +102,7 @@ extern int radeon_pcie_gen2;#define RADEON_FENCE_JIFFIES_TIMEOUT (HZ / 2)/* RADEON_IB_POOL_SIZE must be a power of 2 */ #define RADEON_IB_POOL_SIZE 16 -#define RADEON_DEBUGFS_MAX_NUM_FILES 32 +#define RADEON_DEBUGFS_MAX_COMPONENTS 32#define RADEONFB_CONN_LIMIT 4#define RADEON_BIOS_NUM_SCRATCH 8
drivers/gpu/drm/radeon/radeon_device.c +8 -5
@@ -981,7 +981,7 @@ struct radeon_debugfs {struct drm_info_list *files;unsigned num_files; }; -static struct radeon_debugfs _radeon_debugfs[RADEON_DEBUGFS_MAX_NUM_FILES ]; +static struct radeon_debugfs _radeon_debugfs[RADEON_DEBUGFS_MAX_COMPONENTS ];static unsigned _radeon_debugfs_count =0 ; int radeon_debugfs_add_files(struct radeon_device *rdev,
@@ -996,14 +996,17 @@ int radeon_debugfs_add_files(struct radeon_device *rdev,return 0 ; } } -if ((_radeon_debugfs_count + nfiles) >RADEON_DEBUGFS_MAX_NUM_FILES ) { -DRM_ERROR ("Reached maximum number of debugfs files.\n" ); -DRM_ERROR ("Report so we increase RADEON_DEBUGFS_MAX_NUM_FILES.\n" ); + + i = _radeon_debugfs_count +1 ; +if (i >RADEON_DEBUGFS_MAX_COMPONENTS ) { +DRM_ERROR ("Reached maximum number of debugfs components.\n" ); +DRM_ERROR ("Report so we increase " +"RADEON_DEBUGFS_MAX_COMPONENTS.\n" );return -EINVAL ; } _radeon_debugfs[_radeon_debugfs_count].files = files; _radeon_debugfs[_radeon_debugfs_count].num_files = nfiles; - _radeon_debugfs_count++; + _radeon_debugfs_count = i;#if defined(CONFIG_DEBUG_FS ) drm_debugfs_create_files(files, nfiles, rdev->ddev->control->debugfs_root,
Signature · 1 line
1.7.6.409.ge7a85
PATCH 7/7 DRM: cleanup: Remove unsused `tmp'
In reply to Michael WittenDate: Wed, 21 Sep 2011 02:10:43 +0000
--- drivers/gpu/drm/radeon/radeon_combios.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/radeon/radeon_combios.c +1 -1
@@ -1227,7 +1227,7 @@ struct radeon_encoder_lvds *radeon_combios_get_lvds_info(struct radeon_encoderuint16_t lcd_info;uint32_t panel_setup;char stmp[30 ]; -int tmp, i; +int i;struct radeon_encoder_lvds *lvds =NULL ; lcd_info =combios_get_table_offset (dev,COMBIOS_LCD_INFO_TABLE );
Signature · 1 line
1.7.6.409.ge7a85
Re: [PATCH 7/7] DRM: cleanup: Remove unsused `tmp'
Quoted 12 lines · Michael Witten
Date: Wed, 21 Sep 2011 02:10:43 +0000
Signed-off-by Michael Witten <[email protected]>--- drivers/gpu/drm/radeon/radeon_combios.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/gpu/drm/radeon/radeon_combios.c +0
-0
drivers/gpu/drm/radeon/radeon_combios.c struct radeon_encoder_lvds *radeon_combios_get_lvds_info(struct radeon_encoder · line 1233
Quoted 8 lines
drivers/gpu/drm/radeon/radeon_combios.c +1
-1@@ -1227,7 +1227,7 @@ struct radeon_encoder_lvds *radeon_combios_get_lvds_info(struct radeon_encoderuint16_t lcd_info;uint32_t panel_setup;char stmp[30 ]; -int tmp, i; +int i;struct radeon_encoder_lvds *lvds =NULL ; lcd_info =combios_get_table_offset (dev,COMBIOS_LCD_INFO_TABLE );
It's not unused here. Maybe it is for you because you disabled reading some values from the VBIOS?
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 7/7] DRM: cleanup: Remove unsused `tmp'
2011/9/22 Michel Dänzer <[email protected]>:
Quoted 20 lines · Michael Witten
Quoted 19 lines
Date: Wed, 21 Sep 2011 02:10:43 +0000
Signed-off-by Michael Witten <[email protected]>---
drivers/gpu/drm/radeon/radeon_combios.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)drivers/gpu/drm/radeon/radeon_combios.c +1
-1@@ -1227,7 +1227,7 @@ struct radeon_encoder_lvds *radeon_combios_get_lvds_info(struct radeon_encoder uint16_t lcd_info; uint32_t panel_setup; char stmp[30]; - int tmp, i; + int i; struct radeon_encoder_lvds *lvds = NULL;
Quoted 4 lines
drivers/gpu/drm/radeon/radeon_combios.c struct radeon_encoder_lvds *radeon_combios_get_lvds_info(struct radeon_encoder · line 1233
Quoted 1 line
drivers/gpu/drm/radeon/radeon_combios.c +0
-0lcd_info = combios_get_table_offset(dev, COMBIOS_LCD_INFO_TABLE);It's not unused here. Maybe it is for you because you disabled reading some values from the VBIOS?
Woops! :-P
You are correct.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 trivial: Remove unused variable `tmp' from `radeon_combios_get_lvds_info()'
In reply to Michael Witten--- drivers/gpu/drm/radeon/radeon_combios.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_combios.c +1 -1
@@ -1175,7 +1175,7 @@ struct radeon_encoder_lvds *radeon_combios_get_lvds_info(struct radeon_encoderuint16_t lcd_info;uint32_t panel_setup;char stmp[30 ]; -int tmp, i; +int i;struct radeon_encoder_lvds *lvds =NULL ; lcd_info =combios_get_table_offset (dev,COMBIOS_LCD_INFO_TABLE );
Signature · 6 lines
1.7.11.2.252.gc4a64c8 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] trivial: Remove unused variable `tmp' from `radeon_combios_get_lvds_info()'
Quoted 20 lines
Signed-off-by Michael Witten <[email protected]>--- drivers/gpu/drm/radeon/radeon_combios.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/radeon/radeon_combios.c +1
-1@@ -1175,7 +1175,7 @@ struct radeon_encoder_lvds *radeon_combios_get_lvds_info(struct radeon_encoderuint16_t lcd_info;uint32_t panel_setup;char stmp[30 ]; -int tmp, i; +int i;struct radeon_encoder_lvds *lvds =NULL ; lcd_info =combios_get_table_offset (dev,COMBIOS_LCD_INFO_TABLE );Signature · 1 line
1.7.11.2.252.gc4a64c8
PLEASE IGNORE THIS!
I made the same mistake that I did 3.5 years ago; the variable `tmp' is NOT unused:
http://article.gmane.org/gmane.comp.video.dri.devel/60785
Sorry for the irritation.
Sincerely,
Michael Witten
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 20 lines · Michael Witten
Whilst working on my failing Radeon GPU:
Subject: Re: Curious experiences with a Radeon on the fritz
Date: Wed, 21 Sep 2011 18:52:19 -0000
Message-ID: <[email protected]>
http://lists.freedesktop.org/archives/dri-devel/2011-September/014506.htmlI made the following trivial improvements to the DRM/Radeon code along the way ([6] fixes a bug):
[1] DRM: comment: drm_crtc{=>_helper}_set_mode
[2] DRM: comment: halve -> half
[3] DRM: cleanup: Remove unused `gamma_size'
[4] DRM: comment:gdm_proc_lists->drm_proc_lists
[5] DRM: cleanup: `size == 0' is never true
[6] DRM: bug: RADEON_DEBUGFS_MAX_{NUM_FILES => COMPONENTS}
[7] DRM: cleanup: Remove unsused `tmp'Here is the overall difference:
Quoted 9 lines
drivers/gpu/drm/drm_crtc_helper.c | 2 +- drivers/gpu/drm/drm_fb_helper.c | 3 --- drivers/gpu/drm/drm_irq.c | 4 ++-- drivers/gpu/drm/drm_proc.c | 2 +- drivers/gpu/drm/radeon/radeon.h | 2 +- drivers/gpu/drm/radeon/radeon_bios.c | 2 +- drivers/gpu/drm/radeon/radeon_combios.c | 2 +- drivers/gpu/drm/radeon/radeon_device.c | 13 ++++++++----- 8 files changed, 15 insertions(+), 15 deletions(-)
When you get the chance, David, please apply all but [4] and [7].
* Patch [4] is not really helpful, because it poorly changes a comment in what is deprecated, probably erroneous code anyway.
* [7] was a mistake on my part.
PATCH 1/1 DRM: bug: RADEON_DEBUGFS_MAX_{NUM_FILES => COMPONENTS}
Date: Fri, 16 Sep 2011 20:45:30 +0000
The value of RADEON_DEBUGFS_MAX_NUM_FILES has been used to specify the size of an array, each element of which looks like this:
struct radeon_debugfs {
struct drm_info_list *files;
unsigned num_files;
};Consequently, the number of debugfs files may be much greater than RADEON_DEBUGFS_MAX_NUM_FILES, something that the current code ignores:
if ((_radeon_debugfs_count + nfiles) > RADEON_DEBUGFS_MAX_NUM_FILES) {
DRM_ERROR("Reached maximum number of debugfs files.\n");
DRM_ERROR("Report so we increase RADEON_DEBUGFS_MAX_NUM_FILES.\n");
return -EINVAL;
}This commit fixes this mistake, and accordingly renames:
RADEON_DEBUGFS_MAX_NUM_FILES
to:
RADEON_DEBUGFS_MAX_COMPONENTS
--- drivers/gpu/drm/radeon/radeon.h | 2 +- drivers/gpu/drm/radeon/radeon_device.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/radeon.h +1 -1
@@ -102,7 +102,7 @@ extern int radeon_pcie_gen2;#define RADEON_FENCE_JIFFIES_TIMEOUT (HZ / 2)/* RADEON_IB_POOL_SIZE must be a power of 2 */ #define RADEON_IB_POOL_SIZE 16 -#define RADEON_DEBUGFS_MAX_NUM_FILES 32 +#define RADEON_DEBUGFS_MAX_COMPONENTS 32#define RADEONFB_CONN_LIMIT 4#define RADEON_BIOS_NUM_SCRATCH 8
drivers/gpu/drm/radeon/radeon_device.c +8 -5
@@ -981,7 +981,7 @@ struct radeon_debugfs {struct drm_info_list *files;unsigned num_files; }; -static struct radeon_debugfs _radeon_debugfs[RADEON_DEBUGFS_MAX_NUM_FILES ]; +static struct radeon_debugfs _radeon_debugfs[RADEON_DEBUGFS_MAX_COMPONENTS ];static unsigned _radeon_debugfs_count =0 ; int radeon_debugfs_add_files(struct radeon_device *rdev,
@@ -996,14 +996,17 @@ int radeon_debugfs_add_files(struct radeon_device *rdev,return 0 ; } } -if ((_radeon_debugfs_count + nfiles) >RADEON_DEBUGFS_MAX_NUM_FILES ) { -DRM_ERROR ("Reached maximum number of debugfs files.\n" ); -DRM_ERROR ("Report so we increase RADEON_DEBUGFS_MAX_NUM_FILES.\n" ); + + i = _radeon_debugfs_count +1 ; +if (i >RADEON_DEBUGFS_MAX_COMPONENTS ) { +DRM_ERROR ("Reached maximum number of debugfs components.\n" ); +DRM_ERROR ("Report so we increase " +"RADEON_DEBUGFS_MAX_COMPONENTS.\n" );return -EINVAL ; } _radeon_debugfs[_radeon_debugfs_count].files = files; _radeon_debugfs[_radeon_debugfs_count].num_files = nfiles; - _radeon_debugfs_count++; + _radeon_debugfs_count = i;#if defined(CONFIG_DEBUG_FS ) drm_debugfs_create_files(files, nfiles, rdev->ddev->control->debugfs_root,
Signature · 1 line
1.7.6.409.ge7a85
Re: [PATCH] DRM: bug: RADEON_DEBUGFS_MAX_{NUM_FILES => COMPONENTS}
Quoted 84 lines · Michael Witten
Date: Fri, 16 Sep 2011 20:45:30 +0000
The value of
RADEON_DEBUGFS_MAX_NUM_FILEShas been used to specify the size of an array, each element of which looks like this:struct
radeon_debugfs{
structdrm_info_list*files;
unsigned num_files;
};Consequently, the number of debugfs files may be much greater than
RADEON_DEBUGFS_MAX_NUM_FILES, something that the current code ignores:if ((
_radeon_debugfs_count+ nfiles) >RADEON_DEBUGFS_MAX_NUM_FILES) {DRM_ERROR("Reached maximum number of debugfs files.\n");DRM_ERROR("Report so we increase RADEON_DEBUGFS_MAX_NUM_FILES.\n"); return-EINVAL;
}This commit fixes this mistake, and accordingly renames:
RADEON_DEBUGFS_MAX_NUM_FILES
to:
RADEON_DEBUGFS_MAX_COMPONENTS
Signed-off-by Michael Witten <[email protected]>---
drivers/gpu/drm/radeon/radeon.h | 2 +-drivers/gpu/drm/radeon/radeon_device.c| 13 ++++++++-----2 files changed, 9 insertions(+), 6 deletions(-)drivers/gpu/drm/radeon/radeon.h +1
-1@@ -102,7 +102,7 @@ extern int radeon_pcie_gen2; #define RADEON_FENCE_JIFFIES_TIMEOUT (HZ / 2) /* RADEON_IB_POOL_SIZE must be a power of 2 */ #define RADEON_IB_POOL_SIZE 16 -#define RADEON_DEBUGFS_MAX_NUM_FILES 32 +#define RADEON_DEBUGFS_MAX_COMPONENTS 32 #define RADEONFB_CONN_LIMIT 4 #define RADEON_BIOS_NUM_SCRATCH 8drivers/gpu/drm/radeon/radeon_device.c +8
-6@@ -981,7 +981,7 @@ struct radeon_debugfs { struct drm_info_list *files; unsigned num_files; }; -static struct radeon_debugfs _radeon_debugfs[RADEON_DEBUGFS_MAX_NUM_FILES ]; +static struct radeon_debugfs _radeon_debugfs[RADEON_DEBUGFS_MAX_COMPONENTS ]; static unsigned _radeon_debugfs_count = 0; int radeon_debugfs_add_files(struct radeon_device *rdev,@@ -996,14 +996,17 @@ int radeon_debugfs_add_files(struct radeon_device *rdev, return 0; } } - if ((_radeon_debugfs_count + nfiles) > RADEON_DEBUGFS_MAX_NUM_FILES) { - DRM_ERROR("Reached maximum number of debugfs files.\n"); - DRM_ERROR("Report so we increase RADEON_DEBUGFS_MAX_NUM_FILES.\n"); + + i = _radeon_debugfs_count + 1; + if (i > RADEON_DEBUGFS_MAX_COMPONENTS) { + DRM_ERROR("Reached maximum number of debugfs components.\n"); + DRM_ERROR("Report so we increase " + "RADEON_DEBUGFS_MAX_COMPONENTS.\n"); return -EINVAL; } _radeon_debugfs[_radeon_debugfs_count].files = files; _radeon_debugfs[_radeon_debugfs_count].num_files = nfiles; - _radeon_debugfs_count++; + _radeon_debugfs_count = i; #if defined(CONFIG_DEBUG_FS) drm_debugfs_create_files(files, nfiles, rdev->ddev->control->debugfs_root, --
Quoted 3 lines
1.7.6.409.ge7a85
This patch has not yet been applied. What's wrong?
Sincerely,
Michael Witten
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] DRM: bug: RADEON_DEBUGFS_MAX_{NUM_FILES => COMPONENTS}
Maybe you are looking at the wrong branch, but I see it in drm-next (it has been there since Oct 10)
Quoted 85 lines · Michael Witten
On Fri, Oct 7, 2011 at 19:20, Michael Witten <[email protected]> wrote:
Date: Fri, 16 Sep 2011 20:45:30 +0000The value of
RADEON_DEBUGFS_MAX_NUM_FILEShas been used to specify the size of an array, each element of which looks like this:struct
radeon_debugfs{
structdrm_info_list*files;
unsigned num_files;
};Consequently, the number of debugfs files may be much greater than
RADEON_DEBUGFS_MAX_NUM_FILES, something that the current code ignores:if ((
_radeon_debugfs_count+ nfiles) >RADEON_DEBUGFS_MAX_NUM_FILES) {DRM_ERROR("Reached maximum number of debugfs files.\n");DRM_ERROR("Report so we increase RADEON_DEBUGFS_MAX_NUM_FILES.\n"); return-EINVAL;
}This commit fixes this mistake, and accordingly renames:
RADEON_DEBUGFS_MAX_NUM_FILES
to:
RADEON_DEBUGFS_MAX_COMPONENTS
Signed-off-by Michael Witten <[email protected]>---
drivers/gpu/drm/radeon/radeon.h | 2 +-drivers/gpu/drm/radeon/radeon_device.c| 13 ++++++++-----2 files changed, 9 insertions(+), 6 deletions(-)drivers/gpu/drm/radeon/radeon.h +1
-1@@ -102,7 +102,7 @@ extern int radeon_pcie_gen2; #define RADEON_FENCE_JIFFIES_TIMEOUT (HZ / 2) /* RADEON_IB_POOL_SIZE must be a power of 2 */ #define RADEON_IB_POOL_SIZE 16 -#define RADEON_DEBUGFS_MAX_NUM_FILES 32 +#define RADEON_DEBUGFS_MAX_COMPONENTS 32 #define RADEONFB_CONN_LIMIT 4 #define RADEON_BIOS_NUM_SCRATCH 8drivers/gpu/drm/radeon/radeon_device.c +8
-6@@ -981,7 +981,7 @@ struct radeon_debugfs { struct drm_info_list *files; unsigned num_files; }; -static struct radeon_debugfs _radeon_debugfs[RADEON_DEBUGFS_MAX_NUM_FILES ]; +static struct radeon_debugfs _radeon_debugfs[RADEON_DEBUGFS_MAX_COMPONENTS ]; static unsigned _radeon_debugfs_count = 0; int radeon_debugfs_add_files(struct radeon_device *rdev,@@ -996,14 +996,17 @@ int radeon_debugfs_add_files(struct radeon_device *rdev, return 0; } } - if ((_radeon_debugfs_count + nfiles) > RADEON_DEBUGFS_MAX_NUM_FILES) { - DRM_ERROR("Reached maximum number of debugfs files.\n"); - DRM_ERROR("Report so we increase RADEON_DEBUGFS_MAX_NUM_FILES.\n"); + + i = _radeon_debugfs_count + 1; + if (i > RADEON_DEBUGFS_MAX_COMPONENTS) { + DRM_ERROR("Reached maximum number of debugfs components.\n"); + DRM_ERROR("Report so we increase " + "RADEON_DEBUGFS_MAX_COMPONENTS.\n"); return -EINVAL; } _radeon_debugfs[_radeon_debugfs_count].files = files; _radeon_debugfs[_radeon_debugfs_count].num_files = nfiles; - _radeon_debugfs_count++; + _radeon_debugfs_count = i; #if defined(CONFIG_DEBUG_FS) drm_debugfs_create_files(files, nfiles, rdev->ddev->control->debugfs_root, --
Quoted 3 lines
1.7.6.409.ge7a85
This patch has not yet been applied. What's wrong?
Sincerely,
Michael Witten
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] DRM: bug: RADEON_DEBUGFS_MAX_{NUM_FILES => COMPONENTS}
Quoted 8 lines · Ilija Hadzic
Quoted 1 line · Michael Witten
This patch has not yet been applied. What's wrong?
Maybe you are looking at the wrong branch, but I see it in drm-next (it has been there since Oct 10)
Well! I feel silly!
Thanks.