1/*
2 * Copyright © Microsoft Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24
25#ifndef D3D12_VIDEO_BUFFER_H
26#define D3D12_VIDEO_BUFFER_H
27
28#include "pipe/p_context.h"
29#include "pipe/p_video_codec.h"
30#include <vector>
31
32///
33/// Pipe video buffer interface starts
34///
35
36/**
37 * creates a video buffer
38 */
39struct pipe_video_buffer *
40d3d12_video_buffer_create(struct pipe_context *pipe, const struct pipe_video_buffer *tmpl);
41
42/**
43 * destroy this video buffer
44 */
45void
46d3d12_video_buffer_destroy(struct pipe_video_buffer *buffer);
47
48/**
49 * get an individual sampler view for each plane
50 */
51struct pipe_sampler_view **
52d3d12_video_buffer_get_sampler_view_planes(struct pipe_video_buffer *buffer);
53
54/**
55 * get an individual sampler view for each component
56 */
57struct pipe_sampler_view **
58d3d12_video_buffer_get_sampler_view_components(struct pipe_video_buffer *buffer);
59
60/**
61 * get an individual surfaces for each plane
62 */
63struct pipe_surface **
64d3d12_video_buffer_get_surfaces(struct pipe_video_buffer *buffer);
65
66/*
67 * destroy the associated data
68 */
69void
70d3d12_video_buffer_destroy_associated_data(void *associated_data);
71
72/**
73 * output for decoding / input for displaying
74 */
75struct d3d12_video_buffer
76{
77   pipe_video_buffer                       base;
78   struct d3d12_resource *                 texture;
79   uint                                    num_planes;
80   std::vector<pipe_surface *>      surfaces;
81   std::vector<pipe_sampler_view *> sampler_view_planes;
82   std::vector<pipe_sampler_view *> sampler_view_components;
83};
84
85///
86/// Pipe video buffer interface ends
87///
88
89#endif
90