This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
#include "firmware_gate.h"
|
||||
#include "probe_platform.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef CHIMERA_GFX_PS5_ALLOWED_FIRMWARE
|
||||
#define CHIMERA_GFX_PS5_ALLOWED_FIRMWARE "NONE"
|
||||
#endif
|
||||
|
||||
static void write_log(void *userdata, const char *line) {
|
||||
FILE *stream = (FILE *)userdata;
|
||||
(void)fprintf(stream, "%s\n", line);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
chimera_gfx_ps5_loader loader;
|
||||
chimera_gfx_probe_ops ops;
|
||||
chimera_gfx_probe_report report;
|
||||
chimera_gfx_status status;
|
||||
|
||||
if (argc != 4 || strcmp(argv[1], "--firmware") != 0 ||
|
||||
strcmp(argv[3], "--acknowledge-read-only-probe") != 0) {
|
||||
(void)fprintf(
|
||||
stderr, "refusing: exact firmware and acknowledgement required\n");
|
||||
return 64;
|
||||
}
|
||||
if (!chimera_gfx_firmware_gate_allows(CHIMERA_GFX_PS5_ALLOWED_FIRMWARE,
|
||||
argv[2])) {
|
||||
(void)fprintf(stderr, "refusing: firmware is not allowlisted\n");
|
||||
return 77;
|
||||
}
|
||||
|
||||
chimera_gfx_ps5_make_loader_ops(&loader, write_log, stdout, &ops);
|
||||
status = chimera_gfx_ps5_probe_symbols(&ops, &report);
|
||||
(void)fprintf(stdout,
|
||||
"{\"event\":\"summary\",\"resolved\":%lu,"
|
||||
"\"total\":%lu,\"status\":\"%s\"}\n",
|
||||
(unsigned long)report.resolved_count,
|
||||
(unsigned long)report.symbol_count,
|
||||
chimera_gfx_status_string(status));
|
||||
return status == CHIMERA_GFX_STATUS_OK ? 0 : 1;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# Legacy clear-screen placeholder (permanently disabled)
|
||||
|
||||
This directory deliberately contains no source and is not referenced by the
|
||||
build. The reviewable Phase-1 design lives in `samples/phase1_videoout_clear/`
|
||||
behind `CHIMERA_GFX_BUILD_PHASE1_VIDEOOUT_CLEAR=OFF` by default. Keeping this
|
||||
placeholder sourceless prevents an older target name from becoming runnable by
|
||||
accident.
|
||||
@@ -0,0 +1,30 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
#include <stddef.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef CHIMERA_GFX_PS5_ALLOWED_FIRMWARE
|
||||
#error "The exact firmware build gate is required"
|
||||
#endif
|
||||
|
||||
#ifndef CHIMERA_GFX_LIFECYCLE_BUILD_ID
|
||||
#error "A deterministic lifecycle build ID is required"
|
||||
#endif
|
||||
|
||||
typedef struct notify_request {
|
||||
char reserved[45];
|
||||
char message[3075];
|
||||
} notify_request_t;
|
||||
|
||||
int sceKernelSendNotificationRequest(int device, notify_request_t *request,
|
||||
size_t size, int flags);
|
||||
|
||||
static notify_request_t request = {
|
||||
.message = "Chimera GFX lifecycle " CHIMERA_GFX_LIFECYCLE_BUILD_ID
|
||||
" fw " CHIMERA_GFX_PS5_ALLOWED_FIRMWARE};
|
||||
|
||||
int main(void) {
|
||||
const int result =
|
||||
sceKernelSendNotificationRequest(0, &request, sizeof(request), 0);
|
||||
|
||||
_exit(result == 0 ? 0 : 1);
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
#define SDL_MAIN_HANDLED
|
||||
#include <SDL.h>
|
||||
|
||||
#include "firmware_gate.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef CHIMERA_GFX_PS5_ALLOWED_FIRMWARE
|
||||
#define CHIMERA_GFX_PS5_ALLOWED_FIRMWARE "NONE"
|
||||
#endif
|
||||
|
||||
#define CHIMERA_GFX_PHASE1_WIDTH 1920
|
||||
#define CHIMERA_GFX_PHASE1_HEIGHT 1080
|
||||
#define CHIMERA_GFX_PHASE1_HOLD_MS 1000u
|
||||
|
||||
static void log_stage(const char *stage, int success) {
|
||||
(void)fprintf(stdout, "{\"stage\":\"%s\",\"success\":%s}\n", stage,
|
||||
success != 0 ? "true" : "false");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
SDL_Window *window = NULL;
|
||||
SDL_Surface *surface = NULL;
|
||||
Uint32 color;
|
||||
int result = 1;
|
||||
|
||||
if (argc != 4 || strcmp(argv[1], "--firmware") != 0 ||
|
||||
strcmp(argv[3], "--acknowledge-phase1-videoout-clear") != 0) {
|
||||
(void)fprintf(
|
||||
stderr, "refusing: exact firmware and acknowledgement required\n");
|
||||
return 64;
|
||||
}
|
||||
if (!chimera_gfx_firmware_gate_allows(CHIMERA_GFX_PS5_ALLOWED_FIRMWARE,
|
||||
argv[2])) {
|
||||
(void)fprintf(stderr, "refusing: firmware is not allowlisted\n");
|
||||
return 77;
|
||||
}
|
||||
|
||||
log_stage("firmware_gate", 1);
|
||||
SDL_SetMainReady();
|
||||
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
|
||||
log_stage("video_init", 0);
|
||||
goto cleanup;
|
||||
}
|
||||
log_stage("video_init", 1);
|
||||
|
||||
window = SDL_CreateWindow("chimera-gfx controlled clear", 0, 0,
|
||||
CHIMERA_GFX_PHASE1_WIDTH,
|
||||
CHIMERA_GFX_PHASE1_HEIGHT, SDL_WINDOW_SHOWN);
|
||||
if (window == NULL) {
|
||||
log_stage("window_create", 0);
|
||||
goto cleanup;
|
||||
}
|
||||
log_stage("window_create", 1);
|
||||
|
||||
surface = SDL_GetWindowSurface(window);
|
||||
if (surface == NULL) {
|
||||
log_stage("surface_acquire", 0);
|
||||
goto cleanup;
|
||||
}
|
||||
log_stage("surface_acquire", 1);
|
||||
|
||||
color = SDL_MapRGBA(surface->format, 0x18u, 0x2au, 0x41u, 0xffu);
|
||||
if (SDL_FillRect(surface, NULL, color) != 0) {
|
||||
log_stage("cpu_fill", 0);
|
||||
goto cleanup;
|
||||
}
|
||||
log_stage("cpu_fill", 1);
|
||||
|
||||
/* This is the only requested display mutation and the hardware gate. */
|
||||
if (SDL_UpdateWindowSurface(window) != 0) {
|
||||
log_stage("single_present", 0);
|
||||
goto cleanup;
|
||||
}
|
||||
log_stage("single_present", 1);
|
||||
SDL_Delay(CHIMERA_GFX_PHASE1_HOLD_MS);
|
||||
result = 0;
|
||||
|
||||
cleanup:
|
||||
if (window != NULL) {
|
||||
SDL_DestroyWindow(window);
|
||||
}
|
||||
SDL_Quit();
|
||||
log_stage("cleanup", 1);
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user