Opened 3 years ago

Closed 23 months ago

#12585 closed defect (fixed)

PSP: Pixel Format RGBA8888@4 is not supported

Reported by: lolbot-iichan Owned by: rsn8887
Priority: normal Component: Port: PSP
Version: Keywords:
Cc: Game: Wintermute

Description

NOTE:
RGBA8888@4 is Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)
It's explicitly used at various engines: Full Pipe, Gnap (little endian), Griffon, Groovie 2, SCI32 (HQ videos), Sludge, Sword25, Ultima 8, Wintermute

TESTCASE 1:

  1. Download nightly build (e.g. https://buildbot.scummvm.org/snapshots/master/psp-master-01e08d5c.tar.xz)
  2. Unpack it to ms0:/PSP/GAME/ folder
  3. Download a Wintermute game (e.g. Chivalry is Not Dead, http://games.squinky.me/downloads/chivalry/chivalry.zip)
  4. Add this game and start it

EXPECTED RESULT:
Game starts

ACTUAL RESULT:
PSP becomes unresponsible and crashes

LOGS:
ms0:/PSP/GAME/psp-master-01e08d5c/SCUMMTRACE.TXT file is created with several lines:

Error in static void PSPPixelFormat::convertFromScummvmPixelFormat(const Graphics::PixelFormat*, PSPPixelFormat::Type&, PSPPixelFormat::Type&, bool&): Unknown Scummvm pixel format.
Error in static void PSPPixelFormat::convertFromScummvmPixelFormat(const Graphics::PixelFormat*, PSPPixelFormat::Type&, PSPPixelFormat::Type&, bool&): 	rLoss[0], gLoss[0], bLoss[0], aLoss[0]
 	rShift[24], gShift[16], bShift[8], aShift[0]
Error in void Buffer::setPixelFormat(PSPPixelFormat::Type, bool): Unhandled buffer format[7]
Error in void PSPPixelFormat::set(PSPPixelFormat::Type, bool): Unhandled value of pixel type[7]
Error in void Palette::setPixelFormats(PSPPixelFormat::Type, PSPPixelFormat::Type, bool): Unhandled bufferType[7]
Error in static void PSPPixelFormat::convertFromScummvmPixelFormat(const Graphics::PixelFormat*, PSPPixelFormat::Type&, PSPPixelFormat::Type&, bool&): Unknown Scummvm pixel format.
Error in static void PSPPixelFormat::convertFromScummvmPixelFormat(const Graphics::PixelFormat*, PSPPixelFormat::Type&, PSPPixelFormat::Type&, bool&): 	rLoss[0], gLoss[0], bLoss[0], aLoss[0]
 	rShift[24], gShift[16], bShift[8], aShift[0]
Error in static void PSPPixelFormat::convertFromScummvmPixelFormat(const Graphics::PixelFormat*, PSPPixelFormat::Type&, PSPPixelFormat::Type&, bool&): Unknown Scummvm pixel format.
Error in static void PSPPixelFormat::convertFromScummvmPixelFormat(const Graphics::PixelFormat*, PSPPixelFormat::Type&, PSPPixelFormat::Type&, bool&): 	rLoss[0], gLoss[0], bLoss[0], aLoss[0]
 	rShift[24], gShift[16], bShift[8], aShift[0]
Error in void Buffer::setPixelFormat(PSPPixelFormat::Type, bool): Unhandled buffer format[7]
Error in void PSPPixelFormat::set(PSPPixelFormat::Type, bool): Unhandled value of pixel type[7]
Error in void Palette::setPixelFormats(PSPPixelFormat::Type, PSPPixelFormat::Type, bool): Unhandled bufferType[7]
Error in static void PSPPixelFormat::convertFromScummvmPixelFormat(const Graphics::PixelFormat*, PSPPixelFormat::Type&, PSPPixelFormat::Type&, bool&): Unknown Scummvm pixel format.
Error in static void PSPPixelFormat::convertFromScummvmPixelFormat(const Graphics::PixelFormat*, PSPPixelFormat::Type&, PSPPixelFormat::Type&, bool&): 	rLoss[0], gLoss[0], bLoss[0], aLoss[0]
	rShift[24], gShift[16], bShift[8], aShift[0]

TESTCASE 2:

  1. Download nightly build (e.g. https://buildbot.scummvm.org/snapshots/master/psp-master-01e08d5c.tar.xz)
  2. Unpack it to ms0:/PSP/GAME/ folder
  3. Download the Testbed files (scummvm/dists/engine-data/testbed-audiocd-files/ folder)
  4. Add Testbed as a game and start it
  5. Customize the testsuite list to run "Graphics Subsystem" tests
  6. Run all the tests

EXPECTED RESULT:
All the tests runs correctly

ACTUAL RESULT:
There are 2 tests dedicated to Pixel Formats.
First one shows Pixel Formats provided by backend. They are all fine.
Second one shows Pixel Formats explicitly requested for some engines. This test fails for "RGBA8888@4" format.
ScummVM displays garbade and becomes unusable.
However, it does not hangs which may be more useful (or less useful) for debugging.

LOGS:
ms0:/PSP/GAME/psp-master-01e08d5c/SCUMMTRACE.TXT file is created with several lines:

Error in static void PSPPixelFormat::convertFromScummvmPixelFormat(const Graphics::PixelFormat*, PSPPixelFormat::Type&, PSPPixelFormat::Type&, bool&): Unknown Scummvm pixel format.
Error in static void PSPPixelFormat::convertFromScummvmPixelFormat(const Graphics::PixelFormat*, PSPPixelFormat::Type&, PSPPixelFormat::Type&, bool&): 	rLoss[0], gLoss[0], bLoss[0], aLoss[0]
	rShift[24], gShift[16], bShift[8], aShift[0]
Error in void Buffer::setPixelFormat(PSPPixelFormat::Type, bool): Unhandled buffer format[7]
Error in void PSPPixelFormat::set(PSPPixelFormat::Type, bool): Unhandled value of pixel type[7]
Error in void Palette::setPixelFormats(PSPPixelFormat::Type, PSPPixelFormat::Type, bool): Unhandled bufferType[7]
Error in static void PSPPixelFormat::convertFromScummvmPixelFormat(const Graphics::PixelFormat*, PSPPixelFormat::Type&, PSPPixelFormat::Type&, bool&): Unknown Scummvm pixel format.
Error in static void PSPPixelFormat::convertFromScummvmPixelFormat(const Graphics::PixelFormat*, PSPPixelFormat::Type&, PSPPixelFormat::Type&, bool&): 	rLoss[0], gLoss[0], bLoss[0], aLoss[0]
	rShift[24], gShift[16], bShift[8], aShift[0]
Error in uint32 PSPPixelFormat::swapRedBlue32(uint32) const: invalid format[7] for swapping
Error in uint32 PSPPixelFormat::swapRedBlue32(uint32) const: invalid format[7] for swapping
Error in uint32 PSPPixelFormat::swapRedBlue32(uint32) const: invalid format[7] for swapping
Error in uint32 PSPPixelFormat::swapRedBlue32(uint32) const: invalid format[7] for swapping
Error in uint32 PSPPixelFormat::swapRedBlue32(uint32) const: invalid format[7] for swapping
Error in uint32 PSPPixelFormat::swapRedBlue32(uint32) const: invalid format[7] for swapping
Error in uint32 PSPPixelFormat::swapRedBlue32(uint32) const: invalid format[7] for swapping
Error in uint32 PSPPixelFormat::swapRedBlue32(uint32) const: invalid format[7] for swapping
Error in uint32 PSPPixelFormat::swapRedBlue32(uint32) const: invalid format[7] for swapping

Change History (6)

comment:1 by lolbot-iichan, 3 years ago

I wonder if it should be fixed at the port or at the engines...
Maybe it's fine to switch some of them (all of them) to supported ABGR8888@4 format?

comment:2 by sev-, 3 years ago

Priority: highnormal

comment:3 by rsn8887, 2 years ago

Since the PSP doesn't support this pixel format, there is no easy fix. The backend currently only allows an optimized swap of red and blue. Swapping all the bytes around to change RGBA to ABGR pixels for every single draw of the screen is most definitely prohibitively slow on this platform.

One 32bit gfx mode should be enough for the Frontend, IMO. I think this needs a fix in the engines, because the engines can convert pixel format when loading assets, instead of on every single pixel draw.

Last edited 2 years ago by rsn8887 (previous) (diff)

comment:4 by rsn8887, 2 years ago

I was able to tie into the the existing optimized memory copy code to do the swap in the backend. This should be fixed by this commit:
https://github.com/scummvm/scummvm/commit/6ae4512a42f865385b790fe803353f578423a8e6

Version 0, edited 2 years ago by rsn8887 (next)

comment:5 by dwatteau, 2 years ago

@rsn8887: Thanks! I've tested in PPSSPP that Griffon Legend now properly starts there.

From the PSP side, this issue can probably be closed, then? It's possible to reopen this issue if someone still sees a problem somewhere.

comment:6 by dwatteau, 23 months ago

Owner: set to rsn8887
Resolution: fixed
Status: newclosed

Closing this in good faith, since a fix was pushed.

Note: See TracTickets for help on using tickets.