Constructs an AndroidDisplayContext for this backend. This awlays returns a valid (ex:
non-null) handle to the context. The name
parameter is from crosvm commandline and the
client of crosvm will use it to locate and communicate to the AndroidDisplayContext. For
example, this can be a path to UNIX domain socket where a RPC binder server listens on.
error_callback
is a function pointer to an error reporting function, and will be used by
this and other functions below when something goes wrong. The returned context should be
destroyed by calling destroy_android_display_context
if this backend is no longer in use.
Creates an Android Surface (which is also called as Window) of given size. If the surface
can’t be created for whatever reason, null pointer is returned, in which case we shouldn’t
proceed further.
Destroys the AndroidDisplayContext created from create_android_display_context
.
Destroys the Android surface created from create_android_surface
.
Obtains one buffer from the given Android Surface. The information about the buffer (buffer
address, size, stride, etc) is reported via the ANativeWindow_Buffer
struct. It shouldn’t
be null. The size of the buffer is guaranteed to be bigger than (width * stride * 4) bytes.
This function locks the buffer for the client, which means the caller has the exclusive
access to the buffer until it is returned back to Android display stack (surfaceflinger) by
calling post_android_surface_buffer
. This function may fail (in which case false is
returned), then the caller shouldn’t try to read out_buffer
or use the buffer in any way.
Posts the buffer obtained from get_android_surface_buffer
to the Android display system
so that it can be displayed on the screen. Once this is called, the caller shouldn’t use
the buffer any more.