1 /* 2 * vdpau_video_x11.h - VDPAU backend for VA-API (X11 rendering) 3 * 4 * libva-vdpau-driver (C) 2009-2011 Splitted-Desktop Systems 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 19 */ 20 21 #ifndef VDPAU_VIDEO_X11_H 22 #define VDPAU_VIDEO_X11_H 23 24 #include "vdpau_driver.h" 25 #include <pthread.h> 26 #include "uasyncqueue.h" 27 28 typedef struct object_output object_output_t; 29 struct object_output { 30 struct object_base base; 31 unsigned int refcount; 32 Drawable drawable; 33 unsigned int width; 34 unsigned int height; 35 unsigned int max_width; 36 unsigned int max_height; 37 VdpPresentationQueue vdp_flip_queue; 38 VdpPresentationQueueTarget vdp_flip_target; 39 VdpOutputSurface vdp_output_surfaces[VDPAU_MAX_OUTPUT_SURFACES]; 40 unsigned int vdp_output_surfaces_dirty[VDPAU_MAX_OUTPUT_SURFACES]; 41 pthread_mutex_t vdp_output_surfaces_lock; 42 unsigned int current_output_surface; 43 unsigned int displayed_output_surface; 44 unsigned int queued_surfaces; 45 unsigned int fields; 46 unsigned int is_window : 1; /* drawable is a window */ 47 unsigned int size_changed : 1; /* size changed since previous vaPutSurface() and user noticed the change */ 48 }; 49 50 // Create output surface 51 object_output_p 52 output_surface_create( 53 vdpau_driver_data_t *driver_data, 54 Drawable drawable, 55 unsigned int width, 56 unsigned int height 57 ) attribute_hidden; 58 59 // Destroy output surface 60 void 61 output_surface_destroy( 62 vdpau_driver_data_t *driver_data, 63 object_output_p obj_output 64 ) attribute_hidden; 65 66 // Reference output surface 67 object_output_p 68 output_surface_ref( 69 vdpau_driver_data_t *driver_data, 70 object_output_p obj_output 71 ) attribute_hidden; 72 73 // Unreference output surface 74 // NOTE: this destroys the surface if refcount reaches zero 75 void 76 output_surface_unref( 77 vdpau_driver_data_t *driver_data, 78 object_output_p obj_output 79 ) attribute_hidden; 80 81 // Looks up output surface 82 object_output_p 83 output_surface_lookup(object_surface_p obj_surface, Drawable drawable) 84 attribute_hidden; 85 86 // Ensure output surface size matches drawable size 87 int 88 output_surface_ensure_size( 89 vdpau_driver_data_t *driver_data, 90 object_output_p obj_output, 91 unsigned int width, 92 unsigned int height 93 ) attribute_hidden; 94 95 // Render surface to the VDPAU output surface 96 VAStatus 97 render_surface( 98 vdpau_driver_data_t *driver_data, 99 object_surface_p obj_surface, 100 object_output_p obj_output, 101 const VARectangle *source_rect, 102 const VARectangle *target_rect, 103 unsigned int flags 104 ) attribute_hidden; 105 106 // Render subpictures to the VDPAU output surface 107 VAStatus 108 render_subpictures( 109 vdpau_driver_data_t *driver_data, 110 object_surface_p obj_surface, 111 object_output_p obj_output, 112 const VARectangle *source_rect, 113 const VARectangle *target_rect 114 ) attribute_hidden; 115 116 // Render surface to a Drawable 117 VAStatus 118 put_surface( 119 vdpau_driver_data_t *driver_data, 120 VASurfaceID surface, 121 Drawable drawable, 122 unsigned int drawable_width, 123 unsigned int drawable_height, 124 const VARectangle *source_rect, 125 const VARectangle *target_rect, 126 unsigned int flags 127 ) attribute_hidden; 128 129 // Queue surface for display 130 VAStatus 131 queue_surface( 132 vdpau_driver_data_t *driver_data, 133 object_surface_p obj_surface, 134 object_output_p obj_output 135 ) attribute_hidden; 136 137 // vaPutSurface 138 VAStatus 139 vdpau_PutSurface( 140 VADriverContextP ctx, 141 VASurfaceID surface, 142 VADrawable draw, 143 short srcx, 144 short srcy, 145 unsigned short srcw, 146 unsigned short srch, 147 short destx, 148 short desty, 149 unsigned short destw, 150 unsigned short desth, 151 VARectangle *cliprects, 152 unsigned int number_cliprects, 153 unsigned int flags 154 ) attribute_hidden; 155 156 #endif /* VDPAU_VIDEO_X11_H */ 157