libretro / pcsx_rearmed

ARM optimized PCSX fork
GNU General Public License v2.0
166 stars 118 forks source link

Black screen on 32 bit Os #830

Closed Speedvicio closed 4 months ago

Speedvicio commented 4 months ago

Hi! I'm on win 7 32bit Os, the pc is a Asus eeepc 701 with a integrated intel gma 915 GPU. When I run pcsx_rearmed with dynarec enabled, the screen stuck on a black screen and retroarch task start to increase the use of internal memory. If you disable dynarec, this problem do not occur, also I remember that one of first core porting was working fine.

notaz commented 4 months ago

@pcercuei Lightrec seems to be broken on 32bit on both Linux/Windows. Here is the Linux log excerpt:

DEBUG: Block size: 30 opcodes
DEBUG: Blocks created: 1
DEBUG: Block fully tagged, skipping first pass
DEBUG: Creating code block at address 0x0, code size: 196 new: 196
ERROR: Unable to compile block!
DEBUG: Block fully tagged, skipping first pass
<repeats the last 3 lines tons of times>
Running out of code space. Cleaning block cache...
DEBUG: Re-try to alloc 196 bytes...
ERROR: Could not alloc even after removing old blocks!

And then continues flooding the user's logs until killed. I think having abort() (or something) there would be better...

pcercuei commented 4 months ago

Strange, x86 worked not so long ago.

Here there are actually two errors in one:

pcercuei commented 4 months ago

@notaz Can you try this?

diff --git a/deps/lightrec/lightrec.c b/deps/lightrec/lightrec.c
index 1cfc427490..09c9b29a03 100644
--- a/deps/lightrec/lightrec.c
+++ b/deps/lightrec/lightrec.c
@@ -877,6 +877,13 @@ static void * lightrec_emit_code(struct lightrec_state *state,

        if (has_code_buffer) {
                jit_get_code(&code_size);
+
+#ifdef __i386__
+               /* Lightning's code size estimation routine is buggy on x86 and
+                * will return a value that's too small. */
+               code_size *= 2;
+#endif
+
                code = lightrec_alloc_code(state, (size_t) code_size);

                if (!code) {

If this works I'll commit it to Lightrec and send you a PR.

EDIT: It works.