dri/i965: fix incorrect rgbFormat in intelCreateBuffer().
It is incorrect to assume that pixel format is always in BGR byte order. We need to check bitmask parameters (such as |redMask|) to determine whether the RGB or BGR byte order is requested. v2: reformat code to stay within 80 character per line limit. v3: just fix the byte order problem first and investigate SRGB later. v4: rebased on top of the GLES3 sRGB workaround fix. v5: rebased on top of the GLES3 sRGB workaround fix v2. Signed-off-by: Haixia Shi <hshi@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
e303e88a9c
commit
35ade36c88
|
@ -1000,14 +1000,18 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
|
|||
fb->Visual.samples = num_samples;
|
||||
}
|
||||
|
||||
if (mesaVis->redBits == 5)
|
||||
rgbFormat = MESA_FORMAT_B5G6R5_UNORM;
|
||||
else if (mesaVis->sRGBCapable)
|
||||
rgbFormat = MESA_FORMAT_B8G8R8A8_SRGB;
|
||||
else if (mesaVis->alphaBits == 0)
|
||||
rgbFormat = MESA_FORMAT_B8G8R8X8_UNORM;
|
||||
else {
|
||||
rgbFormat = MESA_FORMAT_B8G8R8A8_SRGB;
|
||||
if (mesaVis->redBits == 5) {
|
||||
rgbFormat = mesaVis->redMask == 0x1f ? MESA_FORMAT_R5G6B5_UNORM
|
||||
: MESA_FORMAT_B5G6R5_UNORM;
|
||||
} else if (mesaVis->sRGBCapable) {
|
||||
rgbFormat = mesaVis->redMask == 0xff ? MESA_FORMAT_R8G8B8A8_SRGB
|
||||
: MESA_FORMAT_B8G8R8A8_SRGB;
|
||||
} else if (mesaVis->alphaBits == 0) {
|
||||
rgbFormat = mesaVis->redMask == 0xff ? MESA_FORMAT_R8G8B8X8_UNORM
|
||||
: MESA_FORMAT_B8G8R8X8_UNORM;
|
||||
} else {
|
||||
rgbFormat = mesaVis->redMask == 0xff ? MESA_FORMAT_R8G8B8A8_SRGB
|
||||
: MESA_FORMAT_B8G8R8A8_SRGB;
|
||||
fb->Visual.sRGBCapable = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue