-
Notifications
You must be signed in to change notification settings - Fork 6
Home
V4L2 renderer is another renderer for Weston. V4L2 renderer is designed to compose surfaces using V4L2 media controller API. However, due to the nature of V4L2 media controller API, how underlying V4L2 media controller device composes surfaces solely depends on each device. Therefore, the V4L2 renderer consists from 2 components; V4L2 renderer core, and a V4L2 renderer device.
In order to pass around buffers efficiently, V4L2 renderer makes use of DMABUF. The compositor should pass DMABUF where it wants compositions to be taken place. For instance, for the DRM compositor, it could be achieved via PRIME.
The V4L2 renderer core does the jobs that are generic to specific devices:
- Find appropriate V4L2 renderer device for the underlying media controller device.
- Import wl_shm and wl_kms buffer types. Wl_kms could be found at http://github.com/thayama/wayland-kms/.
- Manage output buffer.
- Calculate positions of surfaces that the renderer needs to repaint.
V4L2 renderer device manages the V4L2 media controller device, and is specific to each device. It should implement interfaces defined in src/v4l2-renderer-device.h.
struct v4l2_device_interface {
struct v4l2_renderer_device *(*init)(struct media_device *media);
struct v4l2_renderer_output *(*create_output)(struct v4l2_renderer_device *dev, int width, int height);
void (*set_output_buffer)(struct v4l2_renderer_output *out, int dmafd);
struct v4l2_surface_state *(*create_surface)(struct v4l2_renderer_device *dev);
int (*attach_buffer)(struct v4l2_surface_state *vs);
void (*begin_compose)(struct v4l2_renderer_device *dev, struct v4l2_renderer_output *out);
void (*finish_compose)(struct v4l2_renderer_device *dev);
int (*draw_view)(struct v4l2_renderer_device *dev, struct v4l2_surface_state *vs);
uint32_t (*get_capabilities)(void);
};