Bug 2176 - DGA mode detection sets imageHeight and imageWidth to 0
Summary: DGA mode detection sets imageHeight and imageWidth to 0
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: 6.9.0
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords: patch
Depends on:
Blocks: xorg-7.5
  Show dependency treegraph
 
Reported: 2004-12-30 12:07 UTC by James A Wright
Modified: 2009-08-31 18:04 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Fixed 6.9.0 Source (19.25 KB, text/ascii)
2006-03-05 04:56 UTC, James A Wright
no flags Details
diff of the fixed source and the original 6.9.0 source (1.24 KB, text/plain)
2006-03-05 04:58 UTC, James A Wright
no flags Details

Description James A Wright 2004-12-30 12:07:17 UTC
"xc/programs/XServer/hw/xfree86/drivers/ati/radeon_dga.c"

Line 114:
currentMode->imageHeight    = (info->FbMapSize / currentMode->bytesPerScanline);

On my Radeon IGP chipset with 64MB of VideoRam, this value is calculated as
65536 (0x010000). Although here the variable is a 32 bit integer, later in the
dga library this value is truncated to a 16 bit integer, causing the driver to
report the imageHeight as zero. I added a single line beneath the current Line
144 to clamp the value to the max a 16 bit iteger can hold;

if (currentMode->imageHeight > 0xFFFF) currentMode->imageHeight = 0xFFFF;

This fixes the problem for my radeon, but I think the other ati drivers may
suffer from the same problem, but I do not have the hardware to test.
Comment 1 Maggioni Marcello 2005-02-24 23:53:13 UTC
Can I ask you the issues that you get without this line added? 
 
Thanks 
Comment 2 James A Wright 2005-02-25 10:10:14 UTC
(In reply to comment #1)
> Can I ask you the issues that you get without this line added? 
>  
> Thanks 


The problem is that the imageWidth is set to zero, so when an application tries
to detect a useable DGA mode, these modes are skipped (assuming the application
checks the available widths and heights). I also submitted the same bug report
to the XFree86 devs, and I believe they fixed it in a more general manner by
clamping the co-ords to 16 bit values in "Xext/xf86dga2.c"
Comment 3 T. Hood 2005-09-26 07:07:26 UTC
Has this bug been fixed?
Comment 4 James A Wright 2006-03-05 04:56:50 UTC
Created attachment 4819 [details]
Fixed 6.9.0 Source

I have modified "xc/programs/Xserver/Xext/xf86dga2.c" (which i have 
taken from xorg 6.9.0) and fixed this problem.
Comment 5 James A Wright 2006-03-05 04:58:46 UTC
Created attachment 4820 [details]
diff of the fixed source and the original 6.9.0 source
Comment 6 Daniel Stone 2007-02-27 01:24:54 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 7 Daniel Stone 2009-08-31 18:04:04 UTC
dga == dead dead dead.


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.