+static inline void
+vl_video_buffer_adjust_size(unsigned *width, unsigned *height, unsigned plane,
+ enum pipe_video_chroma_format chroma_format,
+ bool interlaced)
+{
+ if (interlaced) {
+ *height /= 2;
+ }
+ if (plane > 0) {
+ if (chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420) {
+ *width /= 2;
+ *height /= 2;
+ } else if (chroma_format == PIPE_VIDEO_CHROMA_FORMAT_422) {
+ *width /= 2;
+ }
+ }
+}
+
+/**
+ * get subformats for each plane
+ */
+const enum pipe_format *
+vl_video_buffer_formats(struct pipe_screen *screen, enum pipe_format format);
+
+/**
+ * get YUV plane order
+ */
+const unsigned *
+vl_video_buffer_plane_order(enum pipe_format format);
+
+/**
+ * get maximum size of video buffers
+ */
+unsigned
+vl_video_buffer_max_size(struct pipe_screen *screen);
+
+/**
+ * check if video buffer format is supported for a codec/profile
+ * can be used as default implementation of screen->is_video_format_supported
+ */
+boolean
+vl_video_buffer_is_format_supported(struct pipe_screen *screen,
+ enum pipe_format format,
+ enum pipe_video_profile profile,
+ enum pipe_video_entrypoint entrypoint);
+
+/*
+ * set the associated data for the given video buffer
+ */
+void
+vl_video_buffer_set_associated_data(struct pipe_video_buffer *vbuf,
+ struct pipe_video_codec *vcodec,
+ void *associated_data,
+ void (*destroy_associated_data)(void *));
+
+/*
+ * get the associated data for the given video buffer
+ */
+void *
+vl_video_buffer_get_associated_data(struct pipe_video_buffer *vbuf,
+ struct pipe_video_codec *vcodec);
+
+/**
+ * fill a resource template for the given plane
+ */
+void
+vl_video_buffer_template(struct pipe_resource *templ,
+ const struct pipe_video_buffer *templat,
+ enum pipe_format resource_format,
+ unsigned depth, unsigned array_size,
+ unsigned usage, unsigned plane);
+