anbox-platform-sdk
1.23.0
Anbox Platform SDK API documentation
|
GraphicsProcessor allows integration with the graphics engine inside Anbox. More...
#include <graphics_processor.h>
Public Member Functions | |
GraphicsProcessor ()=default | |
virtual | ~GraphicsProcessor ()=default |
GraphicsProcessor (const GraphicsProcessor &)=delete | |
GraphicsProcessor & | operator= (const GraphicsProcessor &)=delete |
virtual EGLDisplay | create_display () |
Create an EGL display. More... | |
virtual int | initialize (AnboxGraphicsConfiguration *configuration) |
Initialize the graphics processor. More... | |
virtual void | begin_frame () |
Called from Anbox when a new frame is started. More... | |
virtual void | finish_frame () |
Called from Anbox when a frame was fully rendered. More... | |
virtual EGLSurface | create_offscreen_surface (EGLDisplay display, EGLConfig config, const EGLint *attribs) |
Create an offscreen EGL surface for the given display, configuration and attributes. More... | |
virtual bool | destroy_offscreen_surface (EGLDisplay display, EGLSurface surface) |
virtual bool | present (AnboxGraphicsBuffer *buffer, AnboxCallback *callback) |
Present the given buffer to a display or other output. More... | |
virtual bool | present (AnboxGraphicsBuffer2 *buffer, AnboxCallback *callback) |
Present the given buffer to a display or other output. More... | |
virtual bool | create_buffer (uint32_t width, uint32_t height, uint32_t format, uint32_t usage, AnboxGraphicsBuffer2 **buffer) |
Create a buffer with the given specifications. More... | |
GraphicsProcessor allows integration with the graphics engine inside Anbox.
Definition at line 28 of file graphics_processor.h.
|
default |
|
virtualdefault |
|
delete |
|
inlinevirtual |
Called from Anbox when a new frame is started.
This function is called by Anbox from its render thread after the call to eglMakeCurrent to make the main rendering surface and context current. Any operation performed should be as fast as possible to not delay the frame for too long.
Definition at line 70 of file graphics_processor.h.
|
inlinevirtual |
Create a buffer with the given specifications.
width | Width of the buffer in pixels |
height | Height of the buffer in pixels |
format | Color format of the buffer. See AnboxGraphicsBufferPixelFormat |
usage | Usage flags of the buffer. See AnboxGraphicsBufferUsage |
buffer | Allocated buffer object. See AnboxGraphicsBuffer2 |
Definition at line 199 of file graphics_processor.h.
|
inlinevirtual |
Create an EGL display.
This function is called by Anbox when it initializes the rendering pipeline to create an EGLDisplay to use for rendering. In case that a platform provides no implementation or EGL_NO_DISPLAY is returned Anbox will use EGL_DEFAULT_DISPLAY to create an EGLDisplay
Definition at line 45 of file graphics_processor.h.
|
inlinevirtual |
Create an offscreen EGL surface for the given display, configuration and attributes.
If not implemented Anbox will use eglCreatePbufferSurface as fallback.
display | EGL display to create the surface for |
config | EGL configuration to create the surface for |
attribs | Attributes to used for the surface creation |
Definition at line 92 of file graphics_processor.h.
|
inlinevirtual |
Destroy a surface created with create_offscreen_surface.
If not implemented Anbox will use eglDestroySurface as fallback.
display | EGL display the surface was created for |
surface | EGL surface to destroy |
Definition at line 108 of file graphics_processor.h.
|
inlinevirtual |
Called from Anbox when a frame was fully rendered.
This function is called by Anbox from its render thread before its calling eglSwapBuffers on the main EGL surface. Any operation performed should be as fast as possible to not delay the frame for too long.
Definition at line 79 of file graphics_processor.h.
|
inlinevirtual |
Initialize the graphics processor.
This function is called by Anbox when the rendering pipeline is initialized. The configuration structure is provided from Anbox and has to be filled out by the platform. Anbox initializes the provided structure with its defaults.
configuration | Configuration initialized with default values from Anbox |
Definition at line 57 of file graphics_processor.h.
|
delete |
|
inlinevirtual |
Present the given buffer to a display or other output.
DEPRECATED: This variant of the present method is deprecated and should no longer be used. Instead use the variant which takes the AnboxGraphicsBuffer2 structure.
Used when graphics implementation is ANBOX_GRAPHICS_IMPLEMENTATION_TYPE_DIRECT_RENDERING or ANBOX_GRAPHICS_IMPLEMENTATION_TYPE_HOST_RENDERING
This method will be called by Anbox when Android has submitted a new buffer to be presented on the output managed by the platform. The buffer contains information about dimension, format and the handle to the buffer itself.
The buffer handle is opaque to Anbox and it's up to the platform to map it to something which it can handle. For all GPUs the handle is a file descriptor of a DMA buffer (see https://www.kernel.org/doc/html/latest/driver-api/dma-buf.html) which can imported into APIs like EGL or Vulkan for further processing. For software rendering the handle is a memfd (https://man7.org/linux/man-pages/man2/memfd_create.2.html) pointing to a shared memory region containing the buffer data.
When the platform has finished presenting the buffer it has to call the provided callback in order to return the buffer to Anbox for reuse. Not returning the buffer will cause the rendering pipeline to become stuck.
If present returns false it is expected that #callback is not called by the implementation.
buffer | Buffer to be presented on the output |
callback | A callback to be called by the platform when the buffer has been presented |
Definition at line 146 of file graphics_processor.h.
|
inlinevirtual |
Present the given buffer to a display or other output.
Used when graphics implementation is ANBOX_GRAPHICS_IMPLEMENTATION_TYPE_DIRECT_RENDERING or ANBOX_GRAPHICS_IMPLEMENTATION_TYPE_HOST_RENDERING
This method will be called by Anbox when Android has submitted a new buffer to be presented on the output managed by the platform. The buffer contains information about dimension, format and the handle to the buffer itself.
The buffer handle is opaque to Anbox and it's up to the platform to map it to something which it can handle. For all GPUs the handle is a file descriptor of a DMA buffer (see https://www.kernel.org/doc/html/latest/driver-api/dma-buf.html) which can imported into APIs like EGL or Vulkan for further processing. For software rendering the handle is a memfd (https://man7.org/linux/man-pages/man2/memfd_create.2.html) pointing to a shared memory region containing the buffer data.
Passed buffer objects are reused by the caller so the given address for the AnboxGraphicsBuffer2 can be used as identifier for cache implementations.
When the platform has finished presenting the buffer it has to call the provided callback in order to return the buffer to Anbox for reuse. Not returning the buffer will cause the rendering pipeline to become stuck.
If present returns false it is expected that #callback is not called by the implementation.
buffer | Buffer to be presented on the output |
callback | A callback to be called by the platform when the buffer has been presented |
Definition at line 183 of file graphics_processor.h.