anbox-platform-sdk  1.23.0
Anbox Platform SDK API documentation
graphics_processor.h
Go to the documentation of this file.
1 /*
2  * This file is part of Anbox Platform SDK
3  *
4  * Copyright 2021 Canonical Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #ifndef ANBOX_SDK_GRAPHICS_PROCESSOR_H_
20 #define ANBOX_SDK_GRAPHICS_PROCESSOR_H_
21 
23 
24 namespace anbox {
29  public:
30  GraphicsProcessor() = default;
31  virtual ~GraphicsProcessor() = default;
34 
45  virtual EGLDisplay create_display() { return EGL_NO_DISPLAY; }
46 
57  virtual int initialize(AnboxGraphicsConfiguration* configuration) {
58  (void) configuration;
59  return 0;
60  };
61 
70  virtual void begin_frame() { };
71 
79  virtual void finish_frame() { };
80 
92  virtual EGLSurface create_offscreen_surface(EGLDisplay display, EGLConfig config, const EGLint* attribs) {
93  (void) display;
94  (void) config;
95  (void) attribs;
96  return EGL_NO_SURFACE;
97  }
98 
108  virtual bool destroy_offscreen_surface(EGLDisplay display, EGLSurface surface) {
109  (void) display;
110  (void) surface;
111  return false;
112  }
113 
145  [[deprecated("Use GraphicsProcessor::present(AnboxGraphicsBuffer2* buffer, AnboxCallback* callback) instead")]]
146  virtual bool present(AnboxGraphicsBuffer* buffer, AnboxCallback* callback) {
147  (void) buffer;
148  (void) callback;
149  return false;
150  }
151 
183  virtual bool present(AnboxGraphicsBuffer2* buffer, AnboxCallback* callback) {
184  (void) buffer;
185  (void) callback;
186  return false;
187  }
188 
199  virtual bool create_buffer(uint32_t width, uint32_t height, uint32_t format,
200  uint32_t usage, AnboxGraphicsBuffer2** buffer) {
201  (void) width;
202  (void) height;
203  (void) format;
204  (void) usage;
205  (void) buffer;
206  return false;
207  }
208 };
209 } // namespace anbox
210 
211 #endif
GraphicsProcessor allows integration with the graphics engine inside Anbox.
virtual bool destroy_offscreen_surface(EGLDisplay display, EGLSurface surface)
virtual bool present(AnboxGraphicsBuffer2 *buffer, AnboxCallback *callback)
Present the given buffer to a display or other output.
GraphicsProcessor & operator=(const GraphicsProcessor &)=delete
virtual EGLSurface create_offscreen_surface(EGLDisplay display, EGLConfig config, const EGLint *attribs)
Create an offscreen EGL surface for the given display, configuration and attributes.
virtual EGLDisplay create_display()
Create an EGL display.
virtual void begin_frame()
Called from Anbox when a new frame is started.
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.
virtual void finish_frame()
Called from Anbox when a frame was fully rendered.
virtual int initialize(AnboxGraphicsConfiguration *configuration)
Initialize the graphics processor.
GraphicsProcessor(const GraphicsProcessor &)=delete
virtual bool present(AnboxGraphicsBuffer *buffer, AnboxCallback *callback)
Present the given buffer to a display or other output.
virtual ~GraphicsProcessor()=default
Generic callback wrapper.
Definition: types.h:314
Graphics buffer.
Definition: types.h:292
Graphics buffer.
Definition: types.h:273
AnboxDisplaySpec describes properties of the Anbox rendering pipeline the platform plugin can influen...
Definition: types.h:1233