[PATCH] Fix unused variable warnings.

Kusanagi Kouichi slash at ac.auone-net.jp
Mon Nov 30 17:26:35 PST 2009


On 2009-11-30 11:13:20 -0500, Alex Deucher wrote:
> On Thu, Nov 26, 2009 at 11:30 PM, Kusanagi Kouichi
> <slash at ac.auone-net.jp> wrote:
> > r6xx_accel.c: In function 'wait_3d_idle_clean':
> > r6xx_accel.c:117: warning: unused variable 'info'
> > r6xx_accel.c: In function 'wait_3d_idle':
> > r6xx_accel.c:132: warning: unused variable 'info'
> > r6xx_accel.c: In function 'cp_set_surface_sync':
> > r6xx_accel.c:282: warning: unused variable 'info'
> > r6xx_accel.c: In function 'fs_setup':
> > r6xx_accel.c:385: warning: unused variable 'info'
> > r6xx_accel.c: In function 'vs_setup':
> > r6xx_accel.c:408: warning: unused variable 'info'
> > r6xx_accel.c: In function 'ps_setup':
> > r6xx_accel.c:435: warning: unused variable 'info'
> > r6xx_accel.c: In function 'set_alu_consts':
> > r6xx_accel.c:465: warning: unused variable 'info'
> > r6xx_accel.c: In function 'set_bool_consts':
> > r6xx_accel.c:479: warning: unused variable 'info'
> > r6xx_accel.c: In function 'set_vtx_resource':
> > r6xx_accel.c:491: warning: unused variable 'info'
> > r6xx_accel.c: In function 'set_tex_resource':
> > r6xx_accel.c:524: warning: unused variable 'info'
> > r6xx_accel.c: In function 'set_tex_sampler':
> > r6xx_accel.c:591: warning: unused variable 'info'
> > r6xx_accel.c: In function 'set_screen_scissor':
> > r6xx_accel.c:643: warning: unused variable 'info'
> > r6xx_accel.c: In function 'set_vport_scissor':
> > r6xx_accel.c:656: warning: unused variable 'info'
> > r6xx_accel.c: In function 'set_generic_scissor':
> > r6xx_accel.c:672: warning: unused variable 'info'
> > r6xx_accel.c: In function 'set_window_scissor':
> > r6xx_accel.c:686: warning: unused variable 'info'
> > r6xx_accel.c: In function 'set_clip_rect':
> > r6xx_accel.c:700: warning: unused variable 'info'
> > r6xx_accel.c: In function 'draw_immd':
> > r6xx_accel.c:1109: warning: unused variable 'info'
> > r6xx_accel.c: In function 'draw_auto':
> > r6xx_accel.c:1147: warning: unused variable 'info'
> >
> > These are really unused.
> 
> info is used in the accel macros when XF86DRM_MODE is defined.
> 
> Alex

Oops! Then, how about this patch?

diff --git a/src/r6xx_accel.c b/src/r6xx_accel.c
index 69e17e4..91c337a 100644
--- a/src/r6xx_accel.c
+++ b/src/r6xx_accel.c
@@ -124,7 +124,9 @@ void R600IBDiscard(ScrnInfoPtr pScrn, drmBufPtr ib)
 void
 wait_3d_idle_clean(ScrnInfoPtr pScrn, drmBufPtr ib)
 {
+#ifdef XF86DRM_MODE
     RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
 
     //flush caches, don't generate timestamp
     BEGIN_BATCH(5);
@@ -139,7 +141,9 @@ wait_3d_idle_clean(ScrnInfoPtr pScrn, drmBufPtr ib)
 void
 wait_3d_idle(ScrnInfoPtr pScrn, drmBufPtr ib)
 {
+#ifdef XF86DRM_MODE
     RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
 
     BEGIN_BATCH(3);
     EREG(ib, WAIT_UNTIL,                          WAIT_3D_IDLE_bit);
@@ -289,7 +293,9 @@ void
 cp_set_surface_sync(ScrnInfoPtr pScrn, drmBufPtr ib, uint32_t sync_type, uint32_t size, uint64_t mc_addr,
 		    struct radeon_bo *bo, uint32_t rdomains, uint32_t wdomain)
 {
+#ifdef XF86DRM_MODE
     RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
     uint32_t cp_coher_size;
     if (size == 0xffffffff)
 	cp_coher_size = 0xffffffff;
@@ -392,7 +398,9 @@ void cp_wait_vline_sync(ScrnInfoPtr pScrn, drmBufPtr ib, PixmapPtr pPix,
 void
 fs_setup(ScrnInfoPtr pScrn, drmBufPtr ib, shader_config_t *fs_conf)
 {
+#ifdef XF86DRM_MODE
     RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
     uint32_t sq_pgm_resources;
 
     sq_pgm_resources = ((fs_conf->num_gprs << NUM_GPRS_shift) |
@@ -415,7 +423,9 @@ fs_setup(ScrnInfoPtr pScrn, drmBufPtr ib, shader_config_t *fs_conf)
 void
 vs_setup(ScrnInfoPtr pScrn, drmBufPtr ib, shader_config_t *vs_conf)
 {
+#ifdef XF86DRM_MODE
     RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
     uint32_t sq_pgm_resources;
 
     sq_pgm_resources = ((vs_conf->num_gprs << NUM_GPRS_shift) |
@@ -442,7 +452,9 @@ vs_setup(ScrnInfoPtr pScrn, drmBufPtr ib, shader_config_t *vs_conf)
 void
 ps_setup(ScrnInfoPtr pScrn, drmBufPtr ib, shader_config_t *ps_conf)
 {
+#ifdef XF86DRM_MODE
     RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
     uint32_t sq_pgm_resources;
 
     sq_pgm_resources = ((ps_conf->num_gprs << NUM_GPRS_shift) |
@@ -472,7 +484,9 @@ ps_setup(ScrnInfoPtr pScrn, drmBufPtr ib, shader_config_t *ps_conf)
 void
 set_alu_consts(ScrnInfoPtr pScrn, drmBufPtr ib, int offset, int count, float *const_buf)
 {
+#ifdef XF86DRM_MODE
     RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
     int i;
     const int countreg = count * (SQ_ALU_CONSTANT_offset >> 2);
 
@@ -486,7 +500,9 @@ set_alu_consts(ScrnInfoPtr pScrn, drmBufPtr ib, int offset, int count, float *co
 void
 set_bool_consts(ScrnInfoPtr pScrn, drmBufPtr ib, int offset, uint32_t val)
 {
+#ifdef XF86DRM_MODE
     RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
     /* bool register order is: ps, vs, gs; one register each
      * 1 bits per bool; 32 bools each for ps, vs, gs.
      */
@@ -498,7 +514,9 @@ set_bool_consts(ScrnInfoPtr pScrn, drmBufPtr ib, int offset, uint32_t val)
 void
 set_vtx_resource(ScrnInfoPtr pScrn, drmBufPtr ib, vtx_resource_t *res)
 {
+#ifdef XF86DRM_MODE
     RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
     uint32_t sq_vtx_constant_word2;
 
     sq_vtx_constant_word2 = ((((res->vb_addr) >> 32) & BASE_ADDRESS_HI_mask) |
@@ -531,7 +549,9 @@ set_vtx_resource(ScrnInfoPtr pScrn, drmBufPtr ib, vtx_resource_t *res)
 void
 set_tex_resource(ScrnInfoPtr pScrn, drmBufPtr ib, tex_resource_t *tex_res)
 {
+#ifdef XF86DRM_MODE
     RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
     uint32_t sq_tex_resource_word0, sq_tex_resource_word1, sq_tex_resource_word4;
     uint32_t sq_tex_resource_word5, sq_tex_resource_word6;
 
@@ -598,7 +618,9 @@ set_tex_resource(ScrnInfoPtr pScrn, drmBufPtr ib, tex_resource_t *tex_res)
 void
 set_tex_sampler (ScrnInfoPtr pScrn, drmBufPtr ib, tex_sampler_t *s)
 {
+#ifdef XF86DRM_MODE
     RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
     uint32_t sq_tex_sampler_word0, sq_tex_sampler_word1, sq_tex_sampler_word2;
 
     sq_tex_sampler_word0 = ((s->clamp_x       << SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_shift)		|
@@ -650,7 +672,9 @@ set_tex_sampler (ScrnInfoPtr pScrn, drmBufPtr ib, tex_sampler_t *s)
 void
 set_screen_scissor(ScrnInfoPtr pScrn, drmBufPtr ib, int x1, int y1, int x2, int y2)
 {
+#ifdef XF86DRM_MODE
     RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
 
     BEGIN_BATCH(6);
     EREG(ib, PA_SC_SCREEN_SCISSOR_TL,              ((x1 << PA_SC_SCREEN_SCISSOR_TL__TL_X_shift) |
@@ -663,7 +687,9 @@ set_screen_scissor(ScrnInfoPtr pScrn, drmBufPtr ib, int x1, int y1, int x2, int
 void
 set_vport_scissor(ScrnInfoPtr pScrn, drmBufPtr ib, int id, int x1, int y1, int x2, int y2)
 {
+#ifdef XF86DRM_MODE
     RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
 
     BEGIN_BATCH(6);
     EREG(ib, PA_SC_VPORT_SCISSOR_0_TL +
@@ -679,7 +705,9 @@ set_vport_scissor(ScrnInfoPtr pScrn, drmBufPtr ib, int id, int x1, int y1, int x
 void
 set_generic_scissor(ScrnInfoPtr pScrn, drmBufPtr ib, int x1, int y1, int x2, int y2)
 {
+#ifdef XF86DRM_MODE
     RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
 
     BEGIN_BATCH(6);
     EREG(ib, PA_SC_GENERIC_SCISSOR_TL,            ((x1 << PA_SC_GENERIC_SCISSOR_TL__TL_X_shift) |
@@ -693,7 +721,9 @@ set_generic_scissor(ScrnInfoPtr pScrn, drmBufPtr ib, int x1, int y1, int x2, int
 void
 set_window_scissor(ScrnInfoPtr pScrn, drmBufPtr ib, int x1, int y1, int x2, int y2)
 {
+#ifdef XF86DRM_MODE
     RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
 
     BEGIN_BATCH(6);
     EREG(ib, PA_SC_WINDOW_SCISSOR_TL,             ((x1 << PA_SC_WINDOW_SCISSOR_TL__TL_X_shift) |
@@ -707,7 +737,9 @@ set_window_scissor(ScrnInfoPtr pScrn, drmBufPtr ib, int x1, int y1, int x2, int
 void
 set_clip_rect(ScrnInfoPtr pScrn, drmBufPtr ib, int id, int x1, int y1, int x2, int y2)
 {
+#ifdef XF86DRM_MODE
     RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
 
     BEGIN_BATCH(6);
     EREG(ib, PA_SC_CLIPRECT_0_TL +
@@ -1116,7 +1148,9 @@ set_default_state(ScrnInfoPtr pScrn, drmBufPtr ib)
 void
 draw_immd(ScrnInfoPtr pScrn, drmBufPtr ib, draw_config_t *draw_conf, uint32_t *indices)
 {
+#ifdef XF86DRM_MODE
     RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
     uint32_t i, count;
 
     // calculate num of packets
@@ -1154,7 +1188,9 @@ draw_immd(ScrnInfoPtr pScrn, drmBufPtr ib, draw_config_t *draw_conf, uint32_t *i
 void
 draw_auto(ScrnInfoPtr pScrn, drmBufPtr ib, draw_config_t *draw_conf)
 {
+#ifdef XF86DRM_MODE
     RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
 
     BEGIN_BATCH(10);
     EREG(ib, VGT_PRIMITIVE_TYPE, draw_conf->prim_type);


More information about the xorg-driver-ati mailing list