Younes Manton | fcb595c | 2009-10-01 22:16:10 -0400 | [diff] [blame] | 1 | /************************************************************************** |
Younes Manton | 8046846 | 2010-03-05 23:26:03 -0500 | [diff] [blame] | 2 | * |
Younes Manton | fcb595c | 2009-10-01 22:16:10 -0400 | [diff] [blame] | 3 | * Copyright 2009 Younes Manton. |
| 4 | * All Rights Reserved. |
Younes Manton | 8046846 | 2010-03-05 23:26:03 -0500 | [diff] [blame] | 5 | * |
Younes Manton | fcb595c | 2009-10-01 22:16:10 -0400 | [diff] [blame] | 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * copy of this software and associated documentation files (the |
| 8 | * "Software"), to deal in the Software without restriction, including |
| 9 | * without limitation the rights to use, copy, modify, merge, publish, |
| 10 | * distribute, sub license, and/or sell copies of the Software, and to |
| 11 | * permit persons to whom the Software is furnished to do so, subject to |
| 12 | * the following conditions: |
Younes Manton | 8046846 | 2010-03-05 23:26:03 -0500 | [diff] [blame] | 13 | * |
Younes Manton | fcb595c | 2009-10-01 22:16:10 -0400 | [diff] [blame] | 14 | * The above copyright notice and this permission notice (including the |
| 15 | * next paragraph) shall be included in all copies or substantial portions |
| 16 | * of the Software. |
Younes Manton | 8046846 | 2010-03-05 23:26:03 -0500 | [diff] [blame] | 17 | * |
Younes Manton | fcb595c | 2009-10-01 22:16:10 -0400 | [diff] [blame] | 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
José Fonseca | 8771285 | 2014-01-17 16:27:50 +0000 | [diff] [blame] | 21 | * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR |
Younes Manton | fcb595c | 2009-10-01 22:16:10 -0400 | [diff] [blame] | 22 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 23 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 24 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Younes Manton | 8046846 | 2010-03-05 23:26:03 -0500 | [diff] [blame] | 25 | * |
Younes Manton | fcb595c | 2009-10-01 22:16:10 -0400 | [diff] [blame] | 26 | **************************************************************************/ |
| 27 | |
Younes Manton | e44c856 | 2009-09-27 20:18:02 -0400 | [diff] [blame] | 28 | #ifndef xvmc_private_h |
| 29 | #define xvmc_private_h |
| 30 | |
| 31 | #include <X11/Xlib.h> |
| 32 | #include <X11/extensions/XvMClib.h> |
Christian König | b486766 | 2011-04-12 20:38:21 +0200 | [diff] [blame] | 33 | |
Kai Wasserbäch | 7ea5506 | 2011-08-27 17:51:56 +0200 | [diff] [blame] | 34 | #include "pipe/p_video_state.h" |
Christian König | efaf024 | 2011-04-13 19:32:49 +0200 | [diff] [blame] | 35 | |
Kai Wasserbäch | 7ea5506 | 2011-08-27 17:51:56 +0200 | [diff] [blame] | 36 | #include "util/u_debug.h" |
| 37 | #include "util/u_math.h" |
Younes Manton | e44c856 | 2009-09-27 20:18:02 -0400 | [diff] [blame] | 38 | |
Kai Wasserbäch | 7ea5506 | 2011-08-27 17:51:56 +0200 | [diff] [blame] | 39 | #include "vl/vl_csc.h" |
| 40 | #include "vl/vl_compositor.h" |
Christian König | c7b65dc | 2011-04-13 18:50:18 +0200 | [diff] [blame] | 41 | |
Younes Manton | e44c856 | 2009-09-27 20:18:02 -0400 | [diff] [blame] | 42 | #define BLOCK_SIZE_SAMPLES 64 |
| 43 | #define BLOCK_SIZE_BYTES (BLOCK_SIZE_SAMPLES * 2) |
| 44 | |
Christian König | f2f7064 | 2013-07-15 03:48:04 -0600 | [diff] [blame] | 45 | struct pipe_video_codec; |
Christian König | b486766 | 2011-04-12 20:38:21 +0200 | [diff] [blame] | 46 | struct pipe_video_buffer; |
| 47 | |
Christian König | 4a0b80f | 2011-03-25 23:38:50 +0100 | [diff] [blame] | 48 | struct pipe_sampler_view; |
Younes Manton | e44c856 | 2009-09-27 20:18:02 -0400 | [diff] [blame] | 49 | struct pipe_fence_handle; |
| 50 | |
| 51 | typedef struct |
| 52 | { |
Christian König | 1448e82 | 2012-02-15 17:20:50 +0100 | [diff] [blame] | 53 | struct vl_screen *vscreen; |
| 54 | struct pipe_context *pipe; |
Christian König | f2f7064 | 2013-07-15 03:48:04 -0600 | [diff] [blame] | 55 | struct pipe_video_codec *decoder; |
Christian König | e5f78a7 | 2011-04-03 16:09:23 +0200 | [diff] [blame] | 56 | |
Christian König | c7b65dc | 2011-04-13 18:50:18 +0200 | [diff] [blame] | 57 | enum VL_CSC_COLOR_STANDARD color_standard; |
| 58 | struct vl_procamp procamp; |
Christian König | bd5fd67 | 2011-07-08 14:44:19 +0200 | [diff] [blame] | 59 | struct vl_compositor compositor; |
Christian König | 32c4381 | 2012-02-25 13:09:17 +0100 | [diff] [blame] | 60 | struct vl_compositor_state cstate; |
Christian König | c7b65dc | 2011-04-13 18:50:18 +0200 | [diff] [blame] | 61 | |
Younes Manton | 5eb822c | 2010-04-18 12:16:40 -0400 | [diff] [blame] | 62 | unsigned short subpicture_max_width; |
| 63 | unsigned short subpicture_max_height; |
Christian König | f3f212a | 2011-04-27 12:05:46 +0200 | [diff] [blame] | 64 | |
Younes Manton | e44c856 | 2009-09-27 20:18:02 -0400 | [diff] [blame] | 65 | } XvMCContextPrivate; |
| 66 | |
| 67 | typedef struct |
| 68 | { |
Christian König | d9ad3aa | 2011-04-06 00:06:20 +0200 | [diff] [blame] | 69 | struct pipe_video_buffer *video_buffer; |
| 70 | |
Maarten Lankhorst | a09754c | 2011-09-02 16:20:02 +0200 | [diff] [blame] | 71 | /* nonzero if this picture is already being decoded */ |
Jan Vesely | a2f2eeb | 2014-12-02 15:14:16 -0500 | [diff] [blame] | 72 | unsigned picture_structure; |
Christian König | 884cb79 | 2011-03-24 20:33:32 +0100 | [diff] [blame] | 73 | |
Christian König | d3770d6 | 2011-08-10 18:07:01 +0200 | [diff] [blame] | 74 | XvMCSurface *ref[2]; |
Christian König | 884cb79 | 2011-03-24 20:33:32 +0100 | [diff] [blame] | 75 | |
Christian König | 104ac00 | 2011-04-24 20:08:11 +0200 | [diff] [blame] | 76 | struct pipe_fence_handle *fence; |
Younes Manton | 8046846 | 2010-03-05 23:26:03 -0500 | [diff] [blame] | 77 | |
| 78 | /* The subpicture associated with this surface, if any. */ |
| 79 | XvMCSubpicture *subpicture; |
Younes Manton | 8046846 | 2010-03-05 23:26:03 -0500 | [diff] [blame] | 80 | |
| 81 | /* Some XvMC functions take a surface but not a context, |
| 82 | so we keep track of which context each surface belongs to. */ |
| 83 | XvMCContext *context; |
Younes Manton | e44c856 | 2009-09-27 20:18:02 -0400 | [diff] [blame] | 84 | } XvMCSurfacePrivate; |
| 85 | |
Younes Manton | 5f73069 | 2009-11-22 16:40:15 -0500 | [diff] [blame] | 86 | typedef struct |
| 87 | { |
Christian König | 4a0b80f | 2011-03-25 23:38:50 +0100 | [diff] [blame] | 88 | struct pipe_sampler_view *sampler; |
Younes Manton | 8046846 | 2010-03-05 23:26:03 -0500 | [diff] [blame] | 89 | |
Christian König | 849a0b0 | 2011-03-26 11:46:07 +0100 | [diff] [blame] | 90 | /* optional palette for this subpicture */ |
| 91 | struct pipe_sampler_view *palette; |
| 92 | |
Christian König | d645dc6 | 2012-02-25 13:53:29 +0100 | [diff] [blame] | 93 | struct u_rect src_rect; |
| 94 | struct u_rect dst_rect; |
Christian König | efaf024 | 2011-04-13 19:32:49 +0200 | [diff] [blame] | 95 | |
Younes Manton | 8046846 | 2010-03-05 23:26:03 -0500 | [diff] [blame] | 96 | /* The surface this subpicture is currently associated with, if any. */ |
| 97 | XvMCSurface *surface; |
| 98 | |
| 99 | /* Some XvMC functions take a subpicture but not a context, |
| 100 | so we keep track of which context each subpicture belongs to. */ |
| 101 | XvMCContext *context; |
| 102 | } XvMCSubpicturePrivate; |
Younes Manton | 5f73069 | 2009-11-22 16:40:15 -0500 | [diff] [blame] | 103 | |
Younes Manton | 8580b7a | 2010-03-05 23:14:49 -0500 | [diff] [blame] | 104 | #define XVMC_OUT 0 |
| 105 | #define XVMC_ERR 1 |
| 106 | #define XVMC_WARN 2 |
| 107 | #define XVMC_TRACE 3 |
Christian König | b486766 | 2011-04-12 20:38:21 +0200 | [diff] [blame] | 108 | |
Ilia Mirkin | a2a1a58 | 2015-07-20 19:58:43 -0400 | [diff] [blame] | 109 | static inline void XVMC_MSG(int level, const char *fmt, ...) |
Younes Manton | 8580b7a | 2010-03-05 23:14:49 -0500 | [diff] [blame] | 110 | { |
Christian König | b486766 | 2011-04-12 20:38:21 +0200 | [diff] [blame] | 111 | static int debug_level = -1; |
Younes Manton | 8580b7a | 2010-03-05 23:14:49 -0500 | [diff] [blame] | 112 | |
Christian König | b486766 | 2011-04-12 20:38:21 +0200 | [diff] [blame] | 113 | if (debug_level == -1) { |
Christian König | c7b65dc | 2011-04-13 18:50:18 +0200 | [diff] [blame] | 114 | debug_level = MAX2(debug_get_num_option("XVMC_DEBUG", 0), 0); |
Younes Manton | 8580b7a | 2010-03-05 23:14:49 -0500 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | if (level <= debug_level) { |
| 118 | va_list ap; |
| 119 | va_start(ap, fmt); |
| 120 | _debug_vprintf(fmt, ap); |
| 121 | va_end(ap); |
| 122 | } |
| 123 | } |
| 124 | |
Younes Manton | e44c856 | 2009-09-27 20:18:02 -0400 | [diff] [blame] | 125 | #endif /* xvmc_private_h */ |