Bug 80738 - Possible wrong variable used in nouveau_allocate_surface
Summary: Possible wrong variable used in nouveau_allocate_surface
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/nouveau (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Nouveau Project
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-01 02:27 UTC by pstglia
Modified: 2014-07-01 02:58 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description pstglia 2014-07-01 02:27:04 UTC
Hi,

I was analyzing xf86 video nouveau code and found a possible bug on nouveau_allocate_surface (nv_accel_common.c src file)


When setting tile_mode for NV_FERMI/NVC0 or higher families, it uses tile_mode to calculate height. However, instead of using "cfg.nvc0.tile_mode" it is using "cfg.nv50.tile_mode". See bellow:


                if (pNv->Architecture >= NV_FERMI) {
                        if      (height > 64) cfg.nvc0.tile_mode = 0x040;
                        else if (height > 32) cfg.nvc0.tile_mode = 0x030;
                        else if (height > 16) cfg.nvc0.tile_mode = 0x020;
                        else if (height >  8) cfg.nvc0.tile_mode = 0x010;
                        else                  cfg.nvc0.tile_mode = 0x000;

                        if (usage_hint & NOUVEAU_CREATE_PIXMAP_ZETA)
                                cfg.nvc0.memtype = (bpp == 16) ? 0x01 : 0x11;
                        else
                                cfg.nvc0.memtype = 0xfe;

                        height = NOUVEAU_ALIGN(height,
                                 NVC0_TILE_HEIGHT(cfg.nv50.tile_mode));


If this is intentional, please mark this bug as Invalid and sorry for disturbing.

Regards,
Paulo Sérgio Travaglia
Comment 1 Ben Skeggs 2014-07-01 02:58:06 UTC
It's a typo.  Fortunately, it shouldn't cause any issue as the fields should be at the same offsets due to the union.

I've pushed a fix for the typo. Thanks for pointing it out!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.