Bug 49788 - vega statetracker unpack method for RGB 565 is wrong
Summary: vega statetracker unpack method for RGB 565 is wrong
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: All All
: medium major
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-11 04:22 UTC by Andreas Betz
Modified: 2012-05-11 06:30 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Andreas Betz 2012-05-11 04:22:44 UTC
Hi,

i just wanted to show an RGB 565 image using the OpenVG emulation of mesa and i've found that MESA calculates the RGB 565 wrong.

in src/galium/state_trackers/vega/cg_translate.c
function _vega_unpack_float_span_rgba
the case for VG_sRGB_565 is calculated the following way:

clr[0] = ((*src >> 10) & 31)/31.;
clr[1] = ((*src >>  5) & 95)/95.;
clr[2] = ((*src >>  0) & 31)/31.;

That is wrong.

The correct code is:
clr[0] = ((*src >> 11) & 31)/31.;
clr[1] = ((*src >>  5) & 63)/63.;
clr[2] = ((*src >>  0) & 31)/31.;

Greetings
Andy
Comment 1 Brian Paul 2012-05-11 06:30:14 UTC
I'll commit this fix shortly.  Thanks!


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.