We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3943 - [PATCH] General SDL_HINT_VIDEO_DOUBLE_BUFFER hint support
Summary: [PATCH] General SDL_HINT_VIDEO_DOUBLE_BUFFER hint support
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.6
Hardware: All All
: P2 normal
Assignee: Brandon Schaefer
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-06 00:36 UTC by Manuel Alfayate Corchete
Modified: 2017-11-07 17:12 UTC (History)
1 user (show)

See Also:


Attachments
Patch that adds a general hint for low-latency video in some drivers (6.50 KB, patch)
2017-11-06 00:36 UTC, Manuel Alfayate Corchete
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel Alfayate Corchete 2017-11-06 00:36:44 UTC
Created attachment 3069 [details]
Patch that adds a general hint for low-latency video in some drivers

Hello,

I have made a new patch that adds a general SDL_HINT_VIDEO_DOUBLE_BUFFER hint, as suggested by Alex Szpakowski.

NOTE that the specific KMSDRM double buffer hint (SDL_HINT_KMSDRM_DOUBLE_BUFFER) was already merged, so this patch removes that hint because the idea is using SDL_HINT_VIDEO_DOUBLE_BUFFER for all drivers that support it. The drivers that currently support it are listed in SDL_hints.h.

Currently, KMSDRM and RaspberryPi drivers support the SDL_HINT_VIDEO_DOUBLE_BUFFER hint, so the SDL_VIDEO_DOUBLE_BUFFER enviroment variable must be set for it to activate.

The KMSDRM code for double buffering is already merged, as I said, so regarding the KMSDRM driver this patch only changes the hint it honors to from SDL_HINT_KMSDRM_DOUBLE_BUFFER to SDL_HINT_VIDEO_DOUBLE_BUFFER, in order to "standarize" it.

This patch includes the RaspberryPi code for double buffering, so the previous unmerged patch (https://bugzilla.libsdl.org/show_bug.cgi?id=3914) is OBSOLETE.
***Merge this instead.***

I would like this merged ASAP because this has to be the last patch I can do in a while (starting studies again, no time for programming).

Thanks
Comment 1 Brandon Schaefer 2017-11-07 15:54:50 UTC
I dont have my raspi near to test for a few days. It was working on kmsdrm, and we should merge this before the other HINT is released. Wont be easy to remove the other one due to being in a public header once its been released. So Ill just double check all is compiling at lease then merge.
Comment 2 Brandon Schaefer 2017-11-07 16:27:01 UTC
Im not to familiar with rasberrypi code and its APIs. I dont really see where the other thread is? Does vc_dispmanx_vsync_callback callback from a different thread? Looking it up just seemed to do a dispatch (with locking but seems to happen on the same thread that calls it?). Though I could easily be missing something!
Comment 3 Manuel Alfayate Corchete 2017-11-07 17:03:35 UTC
(In reply to Brandon Schaefer from comment #2)
> Im not to familiar with rasberrypi code and its APIs. I dont really see
> where the other thread is? Does vc_dispmanx_vsync_callback callback from a
> different thread? Looking it up just seemed to do a dispatch (with locking
> but seems to happen on the same thread that calls it?). Though I could
> easily be missing something!

The vc_dispmanx_vsync_callback function is called from the dispmanx side on every frame: It starts happening when it is passed to vc_dispmanx_vsync_callback(displaydata->dispman_display, RPI_vsync_callback, (void*)wdata);

Thats why you dont see it called explicitly: its automatically called from an internal dispmanx thread outside SDL2. That's how It works.

I agree that merging is urgent.
Comment 4 Brandon Schaefer 2017-11-07 17:12:29 UTC
That makes sense, just wanted to double check, as I dont have a raspi to dig around right now. Ill double check the code in a few days when I can, Thank you again for the patch!

https://hg.libsdl.org/SDL/rev/2ce56475ad57