libretro / libretro/RetroArch

[Video] Support for placeholder screen frames

Open
#14,406 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

prs welcome video
Dominant language
C
Stars
14.1k
Forks
2.2k
Avg merge
7h 35m
Merged PRs (30d)
51

Description

Description

I've been seeing some confusion when RetroArch destroys its graphics interface just before launching content; since this is one of the few safe places to update our current core, netplay does its core updating there.
Because there isn't a graphics interface running, some seem to be confusing a slow connection/buildbot with either a crash or a deadlock while the core is being downloaded.

I've raised concerns about this counterintuitive behavior in the past, but lack familiary with RetroArch's video driver code.
I don't know how many contributors are still around that can implement what I am about to propose, but here is an idea for a simple, high-level implementation that allows us to create a static frame and have RetroArch display this frame until destroyed for when we have no graphics interface running.

bool video_driver_create_placeholder(uint32_t color, const char *text, uint32_t text_color);
void video_driver_destroy_placeholder(void);

video_driver_create_placeholder should be responsible for figuring the size of the frame, its center (for drawing the text) and what should be the best font and font size to use (these parameters can be determined by looking at the configuration and platform specific data). Once the frame has been generated, this same function should be responsible for initializing the correct video driver, queueing our previously generated frame as its output.
color and text_color parameters are represented as 32-bits RGBA in this example.

This is how our netplay updater would work with it:

         if (task_push_update_single_core(path_core,
               settings->bools.core_updater_auto_backup,
               settings->uints.core_updater_auto_backup_history_size,
               settings->paths.directory_libretro,
               settings->paths.directory_core_assets))
         {
            /* We must wait for the update to finish
               before starting the core. */
            video_driver_create_placeholder(0x000000FF,
               "Netplay is checking for core updates. Please, standby...",
               0xFFFFFFFF);
            task_queue_wait(NULL, NULL);
            video_driver_destroy_placeholder();
         }

In this example, we would have a black frame with a white text message (Netplay is checking for core updates. Please, standby...) at the center of the frame, until the core updater task completed.

I've mainly focused on the netplay core updater feature, but this placeholder could be used by any subroutine running while the graphics interface is down.

Expected behavior

Intuitive behavior while the graphics interface is not running.

Actual behavior

Counterintuitive behavior by not displaying anything.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the video driver teardown path and the netplay core updater flow shown in the issue, then identify where a graphics interface can be initialized and destroyed safely. Done means a static frame with centered text remains visible while the update task runs and disappears when the task completes, without disrupting content launch.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
computer-graphics, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.