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 */ 39 struct pipe_video_buffer * 40 d3d12_video_buffer_create(struct pipe_context *pipe, const struct pipe_video_buffer *tmpl); 41 42 /** 43 * creates a video buffer from a handle 44 */ 45 struct pipe_video_buffer * 46 d3d12_video_buffer_from_handle( struct pipe_context *pipe, 47 const struct pipe_video_buffer *tmpl, 48 struct winsys_handle *handle, 49 unsigned usage); 50 /** 51 * destroy this video buffer 52 */ 53 void 54 d3d12_video_buffer_destroy(struct pipe_video_buffer *buffer); 55 56 /** 57 * get an individual resource for each plane, 58 * only returns existing resources by reference 59 */ 60 void 61 d3d12_video_buffer_resources(struct pipe_video_buffer *buffer, 62 struct pipe_resource **resources); 63 64 /** 65 * get an individual sampler view for each plane 66 */ 67 struct pipe_sampler_view ** 68 d3d12_video_buffer_get_sampler_view_planes(struct pipe_video_buffer *buffer); 69 70 /** 71 * get an individual sampler view for each component 72 */ 73 struct pipe_sampler_view ** 74 d3d12_video_buffer_get_sampler_view_components(struct pipe_video_buffer *buffer); 75 76 /** 77 * get an individual surfaces for each plane 78 */ 79 struct pipe_surface ** 80 d3d12_video_buffer_get_surfaces(struct pipe_video_buffer *buffer); 81 82 /* 83 * destroy the associated data 84 */ 85 void 86 d3d12_video_buffer_destroy_associated_data(void *associated_data); 87 88 /** 89 * output for decoding / input for displaying 90 */ 91 struct d3d12_video_buffer 92 { 93 pipe_video_buffer base; 94 struct d3d12_resource * texture; 95 uint num_planes; 96 std::vector<pipe_surface *> surfaces; 97 std::vector<pipe_sampler_view *> sampler_view_planes; 98 std::vector<pipe_sampler_view *> sampler_view_components; 99 }; 100 101 /// 102 /// Pipe video buffer interface ends 103 /// 104 105 #endif 106