presentation.c revision 6710e690f6ccd2c917d6a39be7d55a037470fccb
1/************************************************************************** 2 * 3 * Copyright 2010 Thomas Balling Sørensen. 4 * All Rights Reserved. 5 * 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: 13 * 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. 17 * 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. 21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 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. 25 * 26 **************************************************************************/ 27 28#include "vdpau_private.h" 29#include <vdpau/vdpau.h> 30#include <util/u_debug.h> 31#include <util/u_memory.h> 32 33VdpStatus 34vlVdpPresentationQueueTargetDestroy(VdpPresentationQueueTarget presentation_queue_target) 35{ 36 return VDP_STATUS_NO_IMPLEMENTATION; 37} 38 39VdpStatus 40vlVdpPresentationQueueCreate(VdpDevice device, 41 VdpPresentationQueueTarget presentation_queue_target, 42 VdpPresentationQueue *presentation_queue) 43{ 44 vlVdpPresentationQueue *pq = NULL; 45 struct pipe_video_context *context; 46 VdpStatus ret; 47 48 _debug_printf("[VDPAU] Creating PresentationQueue\n"); 49 50 if (!presentation_queue) 51 return VDP_STATUS_INVALID_POINTER; 52 53 vlVdpDevice *dev = vlGetDataHTAB(device); 54 if (!dev) 55 return VDP_STATUS_INVALID_HANDLE; 56 57 vlVdpPresentationQueueTarget *pqt = vlGetDataHTAB(presentation_queue_target); 58 if (!pqt) 59 return VDP_STATUS_INVALID_HANDLE; 60 61 if (dev != pqt->device) 62 return VDP_STATUS_HANDLE_DEVICE_MISMATCH; 63 64 context = dev->context->vpipe; 65 66 pq = CALLOC(1, sizeof(vlVdpPresentationQueue)); 67 if (!pq) 68 return VDP_STATUS_RESOURCES; 69 70 pq->device = dev; 71 pq->compositor = context->create_compositor(context); 72 if (!pq->compositor) { 73 ret = VDP_STATUS_ERROR; 74 goto no_compositor; 75 } 76 77 *presentation_queue = vlAddDataHTAB(pq); 78 if (*presentation_queue == 0) { 79 ret = VDP_STATUS_ERROR; 80 goto no_handle; 81 } 82 83 return VDP_STATUS_OK; 84no_handle: 85no_compositor: 86 FREE(pq); 87 return ret; 88} 89 90VdpStatus 91vlVdpPresentationQueueDestroy(VdpPresentationQueue presentation_queue) 92{ 93 return VDP_STATUS_NO_IMPLEMENTATION; 94} 95 96VdpStatus 97vlVdpPresentationQueueSetBackgroundColor(VdpPresentationQueue presentation_queue, 98 VdpColor *const background_color) 99{ 100 if (!background_color) 101 return VDP_STATUS_INVALID_POINTER; 102 103 return VDP_STATUS_NO_IMPLEMENTATION; 104} 105 106VdpStatus 107vlVdpPresentationQueueGetBackgroundColor(VdpPresentationQueue presentation_queue, 108 VdpColor *const background_color) 109{ 110 if (!background_color) 111 return VDP_STATUS_INVALID_POINTER; 112 113 return VDP_STATUS_NO_IMPLEMENTATION; 114} 115 116VdpStatus 117vlVdpPresentationQueueGetTime(VdpPresentationQueue presentation_queue, 118 VdpTime *current_time) 119{ 120 if (!current_time) 121 return VDP_STATUS_INVALID_POINTER; 122 123 return VDP_STATUS_NO_IMPLEMENTATION; 124} 125 126VdpStatus 127vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue, 128 VdpOutputSurface surface, 129 uint32_t clip_width, 130 uint32_t clip_height, 131 VdpTime earliest_presentation_time) 132{ 133 return VDP_STATUS_NO_IMPLEMENTATION; 134} 135 136VdpStatus 137vlVdpPresentationQueueBlockUntilSurfaceIdle(VdpPresentationQueue presentation_queue, 138 VdpOutputSurface surface, 139 VdpTime *first_presentation_time) 140{ 141 if (!first_presentation_time) 142 return VDP_STATUS_INVALID_POINTER; 143 144 //return VDP_STATUS_NO_IMPLEMENTATION; 145 return VDP_STATUS_OK; 146} 147 148VdpStatus 149vlVdpPresentationQueueQuerySurfaceStatus(VdpPresentationQueue presentation_queue, 150 VdpOutputSurface surface, 151 VdpPresentationQueueStatus *status, 152 VdpTime *first_presentation_time) 153{ 154 if (!(status && first_presentation_time)) 155 return VDP_STATUS_INVALID_POINTER; 156 157 return VDP_STATUS_NO_IMPLEMENTATION; 158} 159