Skip to content

Commit 50692d1

Browse files
committed
Merge remote-tracking branch 'upstream'
2 parents f29871d + 228c14e commit 50692d1

14 files changed

Lines changed: 72 additions & 36 deletions

File tree

.github/workflows/dev-release.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,28 @@ on:
1010
jobs:
1111
pre-release:
1212
name: "Pre Release"
13-
runs-on: "ubuntu-20.04"
14-
13+
runs-on: "ubuntu-latest"
14+
container:
15+
image: ubuntu:20.04
1516
steps:
1617
- name: Install dependencies
1718
run: |
18-
sudo apt-get update -qq
19-
sudo apt-get install -y make git bc sed zip
20-
sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-dev-armhf-cross
21-
sudo apt-get install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross
19+
id
20+
apt-get update -qq
21+
apt-get install -y make git bc sed zip
22+
apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-dev-armhf-cross
23+
apt-get install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross
2224
- uses: actions/checkout@v4
2325
with:
2426
fetch-depth: 2
2527
- name: Build
2628
env:
2729
MAKEFLAGS: -j$(nproc)
2830
run: |
31+
grep PRETTY_NAME /etc/os-release
32+
id
33+
pwd
34+
git config --global --add safe.directory /__w/pcsx_rearmed/pcsx_rearmed
2935
.github/build-libretro-zip.sh arm64 CortexA73_G12B
3036
.github/build-libretro-zip.sh arm32 rpi1
3137
.github/build-libretro-zip.sh arm32 rpi2

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ OBJS += frontend/libpicofe/linux/in_evdev.o
373373
endif
374374
ifeq "$(HAVE_GLES)" "1"
375375
OBJS += frontend/libpicofe/gl.o frontend/libpicofe/gl_platform.o
376-
LDLIBS += $(LDLIBS_GLES)
376+
OBJS += frontend/libpicofe/gl_loader.o
377+
#LDLIBS += $(LDLIBS_GLES) # loaded dynamically now
377378
frontend/libpicofe/plat_sdl.o: CFLAGS += -DHAVE_GLES $(CFLAGS_GLES)
378379
frontend/libpicofe/gl_platform.o: CFLAGS += -DHAVE_GLES $(CFLAGS_GLES)
379380
frontend/libpicofe/gl.o: CFLAGS += -DHAVE_GLES $(CFLAGS_GLES)

configure

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -519,17 +519,6 @@ EOF
519519
fi
520520
fi
521521

522-
# check for VideoCore stuff for Raspberry Pi
523-
if [ -d /opt/vc/include -a -d /opt/vc/lib -a "$VIDEOCORE" != "no" ]; then
524-
CFLAGS_GLES="$CFLAGS_GLES -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
525-
LDLIBS_GLES="$LDLIBS_GLES -L/opt/vc/lib"
526-
if [ -f /opt/vc/lib/libbcm_host.so ]; then
527-
LDLIBS_GLES="$LDLIBS_GLES -lbcm_host"
528-
fi
529-
need_xlib="yes"
530-
VIDEOCORE="yes"
531-
fi
532-
533522
# check for GLES headers
534523
cat > $TMPC <<EOF
535524
#include <GLES/gl.h>
@@ -538,15 +527,14 @@ int main(void) {
538527
return (int)eglGetDisplay( (EGLNativeDisplayType)0 );
539528
}
540529
EOF
541-
if [ "$VIDEOCORE" = "yes" ] && compile_binary $CFLAGS_GLES -lbrcmEGL -lbrcmGLESv2 $LDLIBS_GLES; then
542-
have_gles="yes"
543-
LDLIBS_GLES="-lbrcmEGL -lbrcmGLESv2 $LDLIBS_GLES"
544-
elif compile_binary $CFLAGS_GLES -lEGL -lGLES_CM $LDLIBS_GLES; then
530+
if compile_binary $CFLAGS_GLES -lEGL -lGLES_CM $LDLIBS_GLES; then
545531
have_gles="yes"
546532
LDLIBS_GLES="-lEGL -lGLES_CM $LDLIBS_GLES"
547533
elif compile_binary $CFLAGS_GLES -lEGL -lGLESv1_CM $LDLIBS_GLES; then
548534
have_gles="yes"
549535
LDLIBS_GLES="-lEGL -lGLESv1_CM $LDLIBS_GLES"
536+
elif compile_object $CFLAGS_GLES; then
537+
have_gles="yes"
550538
fi
551539

552540
if check_c64_tools; then
@@ -563,7 +551,7 @@ if [ "$have_dynamic" = "yes" ]; then
563551
if [ "$builtin_gpu" != "unai" ]; then
564552
plugins="$plugins plugins/gpu_unai/gpu_unai.so"
565553
fi
566-
if [ "$have_gles" = "yes" ]; then
554+
if [ "$have_gles" = "yes" -a "x$LDLIBS_GLES" != "x" ]; then
567555
plugins="$plugins plugins/gpu-gles/gpu_gles.so"
568556
fi
569557
if [ "$have_neon_gpu" = "yes" -a "$builtin_gpu" != "neon" ]; then

deps/lightrec/.gitrepo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[subrepo]
77
remote = https://github.com/pcercuei/lightrec.git
88
branch = master
9-
commit = 8293acf768e57060bb3ee66eeb0942d3d06b964e
10-
parent = b7027dbf9b020077be29014680d96b19c97f7d20
9+
commit = a173cf409e11fbbdd4801aacc683a3d7592f499c
10+
parent = 8da7189ef558eacaa80a37d542ade67b6717c812
1111
method = merge
1212
cmdver = 0.4.6

deps/lightrec/disassembler.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ static const char * const std_opcodes[] = {
4040
[OP_SWR] = "swr ",
4141
[OP_LWC2] = "lwc2 ",
4242
[OP_SWC2] = "swc2 ",
43+
[OP_META_BIOS] = "bios ",
4344
[OP_META_MULT2] = "mult2 ",
4445
[OP_META_MULTU2] = "multu2 ",
4546
[OP_META_LWU] = "lwu ",
@@ -467,6 +468,10 @@ static int print_op(union code c, u32 pc, char *buf, size_t len,
467468
lightrec_reg_name(c.i.rt),
468469
(s16)c.i.imm,
469470
lightrec_reg_name(c.i.rs));
471+
case OP_META_BIOS:
472+
return snprintf(buf, len, "%s0x%x",
473+
std_opcodes[c.i.op],
474+
c.opcode & 0x03ffffff);
470475
case OP_META:
471476
return snprintf(buf, len, "%s%s,%s",
472477
meta_opcodes[c.m.op],
@@ -492,7 +497,7 @@ void lightrec_print_disassembly(const struct block *block, const u32 *code_ptr)
492497
const char * const *flags_ptr;
493498
size_t nb_flags, count, count2;
494499
char buf[256], buf2[256], buf3[256];
495-
unsigned int i;
500+
unsigned int i, nb_spaces1, nb_spaces2;
496501
u32 pc, branch_pc, code;
497502
bool is_io;
498503

@@ -518,7 +523,10 @@ void lightrec_print_disassembly(const struct block *block, const u32 *code_ptr)
518523

519524
print_flags(buf3, sizeof(buf3), op, flags_ptr, nb_flags, is_io);
520525

526+
nb_spaces1 = (*buf2 || *buf3) ? 30 - (int)count : 0;
527+
nb_spaces2 = *buf3 ? 30 - (int)count2 : 0;
528+
521529
printf(X32_FMT" (0x%x)\t%s%*c%s%*c%s\n", pc, i << 2,
522-
buf, 30 - (int)count, ' ', buf2, 30 - (int)count2, ' ', buf3);
530+
buf, nb_spaces1, ' ', buf2, nb_spaces2, ' ', buf3);
523531
}
524532
}

deps/lightrec/disassembler.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ enum standard_opcodes {
111111
OP_LWC2 = 0x32,
112112
OP_SWC2 = 0x3a,
113113

114+
OP_META_BIOS = 0x3b,
115+
114116
OP_META = 0x3c,
115117

116118
OP_META_MULT2 = 0x19,

deps/lightrec/emitter.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,19 +1215,24 @@ static void rec_io(struct lightrec_cstate *state,
12151215
union code c = block->opcode_list[offset].c;
12161216
u32 flags = block->opcode_list[offset].flags;
12171217
bool is_tagged = LIGHTREC_FLAGS_GET_IO_MODE(flags);
1218+
bool load_delay = op_flag_load_delay(flags) && !state->no_load_delay;
1219+
u8 zero, reg = load_delay ? REG_TEMP : c.i.rt;
12181220
u32 lut_entry;
1219-
u8 zero;
12201221

12211222
jit_note(__FILE__, __LINE__);
12221223

12231224
lightrec_clean_reg_if_loaded(reg_cache, _jit, c.i.rs, false);
12241225

12251226
if (read_rt && likely(c.i.rt))
1226-
lightrec_clean_reg_if_loaded(reg_cache, _jit, c.i.rt, true);
1227+
lightrec_clean_reg_if_loaded(reg_cache, _jit, reg, true);
12271228
else if (load_rt)
1229+
lightrec_clean_reg_if_loaded(reg_cache, _jit, reg, false);
1230+
1231+
if (load_delay) {
1232+
/* lightrec_rw() might read the actual target register (in case
1233+
* of LWL/LWR), so we need to keep it in sync. */
12281234
lightrec_clean_reg_if_loaded(reg_cache, _jit, c.i.rt, false);
12291235

1230-
if (op_flag_load_delay(flags) && !state->no_load_delay) {
12311236
/* Clear state->in_delay_slot_n. This notifies the lightrec_rw
12321237
* wrapper that it should write the REG_TEMP register instead of
12331238
* the actual output register of the opcode. */

deps/lightrec/lightrec.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,6 +1362,9 @@ static unsigned int lightrec_get_mips_block_len(const u32 *src)
13621362
if (is_syscall(c))
13631363
return i;
13641364

1365+
if (c.i.op == OP_META_BIOS)
1366+
return i;
1367+
13651368
if (is_unconditional_jump(c))
13661369
return i + 1;
13671370
}

deps/lightrec/optimizer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ static u64 opcode_read_mask(union code op)
101101
case OP_J:
102102
case OP_JAL:
103103
case OP_LUI:
104+
case OP_META_BIOS:
104105
return 0;
105106
case OP_BEQ:
106107
if (op.i.rs == op.i.rt)

deps/lightrec/recompiler.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct recompiler {
4343

4444
pthread_mutex_t alloc_mutex;
4545

46-
unsigned int nb_recs;
46+
unsigned int nb_recs, nb_cpus;
4747
struct recompiler_thd thds[];
4848
};
4949

@@ -232,6 +232,7 @@ struct recompiler *lightrec_recompiler_init(struct lightrec_state *state)
232232
rec->pause = false;
233233
rec->must_flush = false;
234234
rec->nb_recs = nb_recs;
235+
rec->nb_cpus = nb_cpus;
235236
slist_init(&rec->slist);
236237

237238
ret = pthread_cond_init(&rec->cond, NULL);
@@ -341,6 +342,17 @@ int lightrec_recompiler_add(struct recompiler *rec, struct block *block)
341342
/* The block to compile is already in the queue -
342343
* increment its counter to increase its priority */
343344
block_rec->requests++;
345+
346+
if (rec->nb_cpus == 1) {
347+
/* On single-core CPUs, if we got a request for
348+
* a block that's already in the queue, we'll
349+
* probably get many more before the compiler
350+
* thread can run, which means that the block
351+
* will be interpreted until then, wasting a lot
352+
* of performance. In that case, it is better to
353+
* just let the compiler thread run now. */
354+
pthread_cond_wait(&rec->cond2, &rec->mutex);
355+
}
344356
goto out_unlock;
345357
}
346358

0 commit comments

Comments
 (0)