1*61046927SAndroid Build Coastguard Worker /**************************************************************************
2*61046927SAndroid Build Coastguard Worker *
3*61046927SAndroid Build Coastguard Worker * Copyright 2010 Younes Manton og Thomas Balling Sørensen.
4*61046927SAndroid Build Coastguard Worker * All Rights Reserved.
5*61046927SAndroid Build Coastguard Worker *
6*61046927SAndroid Build Coastguard Worker * Permission is hereby granted, free of charge, to any person obtaining a
7*61046927SAndroid Build Coastguard Worker * copy of this software and associated documentation files (the
8*61046927SAndroid Build Coastguard Worker * "Software"), to deal in the Software without restriction, including
9*61046927SAndroid Build Coastguard Worker * without limitation the rights to use, copy, modify, merge, publish,
10*61046927SAndroid Build Coastguard Worker * distribute, sub license, and/or sell copies of the Software, and to
11*61046927SAndroid Build Coastguard Worker * permit persons to whom the Software is furnished to do so, subject to
12*61046927SAndroid Build Coastguard Worker * the following conditions:
13*61046927SAndroid Build Coastguard Worker *
14*61046927SAndroid Build Coastguard Worker * The above copyright notice and this permission notice (including the
15*61046927SAndroid Build Coastguard Worker * next paragraph) shall be included in all copies or substantial portions
16*61046927SAndroid Build Coastguard Worker * of the Software.
17*61046927SAndroid Build Coastguard Worker *
18*61046927SAndroid Build Coastguard Worker * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19*61046927SAndroid Build Coastguard Worker * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20*61046927SAndroid Build Coastguard Worker * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21*61046927SAndroid Build Coastguard Worker * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22*61046927SAndroid Build Coastguard Worker * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23*61046927SAndroid Build Coastguard Worker * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24*61046927SAndroid Build Coastguard Worker * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25*61046927SAndroid Build Coastguard Worker *
26*61046927SAndroid Build Coastguard Worker **************************************************************************/
27*61046927SAndroid Build Coastguard Worker
28*61046927SAndroid Build Coastguard Worker #include "util/compiler.h"
29*61046927SAndroid Build Coastguard Worker
30*61046927SAndroid Build Coastguard Worker #include "util/u_memory.h"
31*61046927SAndroid Build Coastguard Worker #include "util/u_debug.h"
32*61046927SAndroid Build Coastguard Worker #include "util/format/u_format.h"
33*61046927SAndroid Build Coastguard Worker #include "util/u_sampler.h"
34*61046927SAndroid Build Coastguard Worker
35*61046927SAndroid Build Coastguard Worker #include "vdpau_private.h"
36*61046927SAndroid Build Coastguard Worker
37*61046927SAndroid Build Coastguard Worker /**
38*61046927SAndroid Build Coastguard Worker * Create a VdpDevice object for use with X11.
39*61046927SAndroid Build Coastguard Worker */
40*61046927SAndroid Build Coastguard Worker PUBLIC VdpStatus
vdp_imp_device_create_x11(Display * display,int screen,VdpDevice * device,VdpGetProcAddress ** get_proc_address)41*61046927SAndroid Build Coastguard Worker vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device,
42*61046927SAndroid Build Coastguard Worker VdpGetProcAddress **get_proc_address)
43*61046927SAndroid Build Coastguard Worker {
44*61046927SAndroid Build Coastguard Worker struct pipe_screen *pscreen;
45*61046927SAndroid Build Coastguard Worker struct pipe_resource *res, res_tmpl;
46*61046927SAndroid Build Coastguard Worker struct pipe_sampler_view sv_tmpl;
47*61046927SAndroid Build Coastguard Worker vlVdpDevice *dev = NULL;
48*61046927SAndroid Build Coastguard Worker VdpStatus ret;
49*61046927SAndroid Build Coastguard Worker
50*61046927SAndroid Build Coastguard Worker if (!(display && device && get_proc_address))
51*61046927SAndroid Build Coastguard Worker return VDP_STATUS_INVALID_POINTER;
52*61046927SAndroid Build Coastguard Worker
53*61046927SAndroid Build Coastguard Worker if (!vlCreateHTAB()) {
54*61046927SAndroid Build Coastguard Worker ret = VDP_STATUS_RESOURCES;
55*61046927SAndroid Build Coastguard Worker goto no_htab;
56*61046927SAndroid Build Coastguard Worker }
57*61046927SAndroid Build Coastguard Worker
58*61046927SAndroid Build Coastguard Worker dev = CALLOC(1, sizeof(vlVdpDevice));
59*61046927SAndroid Build Coastguard Worker if (!dev) {
60*61046927SAndroid Build Coastguard Worker ret = VDP_STATUS_RESOURCES;
61*61046927SAndroid Build Coastguard Worker goto no_dev;
62*61046927SAndroid Build Coastguard Worker }
63*61046927SAndroid Build Coastguard Worker
64*61046927SAndroid Build Coastguard Worker pipe_reference_init(&dev->reference, 1);
65*61046927SAndroid Build Coastguard Worker
66*61046927SAndroid Build Coastguard Worker dev->vscreen = vl_dri3_screen_create(display, screen);
67*61046927SAndroid Build Coastguard Worker #ifdef HAVE_X11_DRI2
68*61046927SAndroid Build Coastguard Worker if (!dev->vscreen)
69*61046927SAndroid Build Coastguard Worker dev->vscreen = vl_dri2_screen_create(display, screen);
70*61046927SAndroid Build Coastguard Worker #endif
71*61046927SAndroid Build Coastguard Worker if (!dev->vscreen)
72*61046927SAndroid Build Coastguard Worker dev->vscreen = vl_xlib_swrast_screen_create(display, screen);
73*61046927SAndroid Build Coastguard Worker if (!dev->vscreen) {
74*61046927SAndroid Build Coastguard Worker ret = VDP_STATUS_RESOURCES;
75*61046927SAndroid Build Coastguard Worker goto no_vscreen;
76*61046927SAndroid Build Coastguard Worker }
77*61046927SAndroid Build Coastguard Worker
78*61046927SAndroid Build Coastguard Worker pscreen = dev->vscreen->pscreen;
79*61046927SAndroid Build Coastguard Worker dev->context = pipe_create_multimedia_context(pscreen);
80*61046927SAndroid Build Coastguard Worker if (!dev->context) {
81*61046927SAndroid Build Coastguard Worker ret = VDP_STATUS_RESOURCES;
82*61046927SAndroid Build Coastguard Worker goto no_context;
83*61046927SAndroid Build Coastguard Worker }
84*61046927SAndroid Build Coastguard Worker
85*61046927SAndroid Build Coastguard Worker if (!pscreen->get_param(pscreen, PIPE_CAP_NPOT_TEXTURES)) {
86*61046927SAndroid Build Coastguard Worker ret = VDP_STATUS_NO_IMPLEMENTATION;
87*61046927SAndroid Build Coastguard Worker goto no_context;
88*61046927SAndroid Build Coastguard Worker }
89*61046927SAndroid Build Coastguard Worker
90*61046927SAndroid Build Coastguard Worker memset(&res_tmpl, 0, sizeof(res_tmpl));
91*61046927SAndroid Build Coastguard Worker
92*61046927SAndroid Build Coastguard Worker res_tmpl.target = PIPE_TEXTURE_2D;
93*61046927SAndroid Build Coastguard Worker res_tmpl.format = PIPE_FORMAT_R8G8B8A8_UNORM;
94*61046927SAndroid Build Coastguard Worker res_tmpl.width0 = 1;
95*61046927SAndroid Build Coastguard Worker res_tmpl.height0 = 1;
96*61046927SAndroid Build Coastguard Worker res_tmpl.depth0 = 1;
97*61046927SAndroid Build Coastguard Worker res_tmpl.array_size = 1;
98*61046927SAndroid Build Coastguard Worker res_tmpl.bind = PIPE_BIND_SAMPLER_VIEW;
99*61046927SAndroid Build Coastguard Worker res_tmpl.usage = PIPE_USAGE_DEFAULT;
100*61046927SAndroid Build Coastguard Worker
101*61046927SAndroid Build Coastguard Worker if (!CheckSurfaceParams(pscreen, &res_tmpl)) {
102*61046927SAndroid Build Coastguard Worker ret = VDP_STATUS_NO_IMPLEMENTATION;
103*61046927SAndroid Build Coastguard Worker goto no_resource;
104*61046927SAndroid Build Coastguard Worker }
105*61046927SAndroid Build Coastguard Worker
106*61046927SAndroid Build Coastguard Worker res = pscreen->resource_create(pscreen, &res_tmpl);
107*61046927SAndroid Build Coastguard Worker if (!res) {
108*61046927SAndroid Build Coastguard Worker ret = VDP_STATUS_RESOURCES;
109*61046927SAndroid Build Coastguard Worker goto no_resource;
110*61046927SAndroid Build Coastguard Worker }
111*61046927SAndroid Build Coastguard Worker
112*61046927SAndroid Build Coastguard Worker memset(&sv_tmpl, 0, sizeof(sv_tmpl));
113*61046927SAndroid Build Coastguard Worker u_sampler_view_default_template(&sv_tmpl, res, res->format);
114*61046927SAndroid Build Coastguard Worker
115*61046927SAndroid Build Coastguard Worker sv_tmpl.swizzle_r = PIPE_SWIZZLE_1;
116*61046927SAndroid Build Coastguard Worker sv_tmpl.swizzle_g = PIPE_SWIZZLE_1;
117*61046927SAndroid Build Coastguard Worker sv_tmpl.swizzle_b = PIPE_SWIZZLE_1;
118*61046927SAndroid Build Coastguard Worker sv_tmpl.swizzle_a = PIPE_SWIZZLE_1;
119*61046927SAndroid Build Coastguard Worker
120*61046927SAndroid Build Coastguard Worker dev->dummy_sv = dev->context->create_sampler_view(dev->context, res, &sv_tmpl);
121*61046927SAndroid Build Coastguard Worker pipe_resource_reference(&res, NULL);
122*61046927SAndroid Build Coastguard Worker if (!dev->dummy_sv) {
123*61046927SAndroid Build Coastguard Worker ret = VDP_STATUS_RESOURCES;
124*61046927SAndroid Build Coastguard Worker goto no_resource;
125*61046927SAndroid Build Coastguard Worker }
126*61046927SAndroid Build Coastguard Worker
127*61046927SAndroid Build Coastguard Worker *device = vlAddDataHTAB(dev);
128*61046927SAndroid Build Coastguard Worker if (*device == 0) {
129*61046927SAndroid Build Coastguard Worker ret = VDP_STATUS_ERROR;
130*61046927SAndroid Build Coastguard Worker goto no_handle;
131*61046927SAndroid Build Coastguard Worker }
132*61046927SAndroid Build Coastguard Worker
133*61046927SAndroid Build Coastguard Worker if (!vl_compositor_init(&dev->compositor, dev->context)) {
134*61046927SAndroid Build Coastguard Worker ret = VDP_STATUS_ERROR;
135*61046927SAndroid Build Coastguard Worker goto no_compositor;
136*61046927SAndroid Build Coastguard Worker }
137*61046927SAndroid Build Coastguard Worker
138*61046927SAndroid Build Coastguard Worker (void) mtx_init(&dev->mutex, mtx_plain);
139*61046927SAndroid Build Coastguard Worker
140*61046927SAndroid Build Coastguard Worker *get_proc_address = &vlVdpGetProcAddress;
141*61046927SAndroid Build Coastguard Worker
142*61046927SAndroid Build Coastguard Worker return VDP_STATUS_OK;
143*61046927SAndroid Build Coastguard Worker
144*61046927SAndroid Build Coastguard Worker no_compositor:
145*61046927SAndroid Build Coastguard Worker vlRemoveDataHTAB(*device);
146*61046927SAndroid Build Coastguard Worker no_handle:
147*61046927SAndroid Build Coastguard Worker pipe_sampler_view_reference(&dev->dummy_sv, NULL);
148*61046927SAndroid Build Coastguard Worker no_resource:
149*61046927SAndroid Build Coastguard Worker dev->context->destroy(dev->context);
150*61046927SAndroid Build Coastguard Worker no_context:
151*61046927SAndroid Build Coastguard Worker dev->vscreen->destroy(dev->vscreen);
152*61046927SAndroid Build Coastguard Worker no_vscreen:
153*61046927SAndroid Build Coastguard Worker FREE(dev);
154*61046927SAndroid Build Coastguard Worker no_dev:
155*61046927SAndroid Build Coastguard Worker vlDestroyHTAB();
156*61046927SAndroid Build Coastguard Worker no_htab:
157*61046927SAndroid Build Coastguard Worker return ret;
158*61046927SAndroid Build Coastguard Worker }
159*61046927SAndroid Build Coastguard Worker
160*61046927SAndroid Build Coastguard Worker /**
161*61046927SAndroid Build Coastguard Worker * Create a VdpPresentationQueueTarget for use with X11.
162*61046927SAndroid Build Coastguard Worker */
163*61046927SAndroid Build Coastguard Worker VdpStatus
vlVdpPresentationQueueTargetCreateX11(VdpDevice device,Drawable drawable,VdpPresentationQueueTarget * target)164*61046927SAndroid Build Coastguard Worker vlVdpPresentationQueueTargetCreateX11(VdpDevice device, Drawable drawable,
165*61046927SAndroid Build Coastguard Worker VdpPresentationQueueTarget *target)
166*61046927SAndroid Build Coastguard Worker {
167*61046927SAndroid Build Coastguard Worker vlVdpPresentationQueueTarget *pqt;
168*61046927SAndroid Build Coastguard Worker VdpStatus ret;
169*61046927SAndroid Build Coastguard Worker
170*61046927SAndroid Build Coastguard Worker if (!drawable)
171*61046927SAndroid Build Coastguard Worker return VDP_STATUS_INVALID_HANDLE;
172*61046927SAndroid Build Coastguard Worker
173*61046927SAndroid Build Coastguard Worker vlVdpDevice *dev = vlGetDataHTAB(device);
174*61046927SAndroid Build Coastguard Worker if (!dev)
175*61046927SAndroid Build Coastguard Worker return VDP_STATUS_INVALID_HANDLE;
176*61046927SAndroid Build Coastguard Worker
177*61046927SAndroid Build Coastguard Worker pqt = CALLOC(1, sizeof(vlVdpPresentationQueueTarget));
178*61046927SAndroid Build Coastguard Worker if (!pqt)
179*61046927SAndroid Build Coastguard Worker return VDP_STATUS_RESOURCES;
180*61046927SAndroid Build Coastguard Worker
181*61046927SAndroid Build Coastguard Worker DeviceReference(&pqt->device, dev);
182*61046927SAndroid Build Coastguard Worker pqt->drawable = drawable;
183*61046927SAndroid Build Coastguard Worker
184*61046927SAndroid Build Coastguard Worker *target = vlAddDataHTAB(pqt);
185*61046927SAndroid Build Coastguard Worker if (*target == 0) {
186*61046927SAndroid Build Coastguard Worker ret = VDP_STATUS_ERROR;
187*61046927SAndroid Build Coastguard Worker goto no_handle;
188*61046927SAndroid Build Coastguard Worker }
189*61046927SAndroid Build Coastguard Worker
190*61046927SAndroid Build Coastguard Worker return VDP_STATUS_OK;
191*61046927SAndroid Build Coastguard Worker
192*61046927SAndroid Build Coastguard Worker no_handle:
193*61046927SAndroid Build Coastguard Worker FREE(pqt);
194*61046927SAndroid Build Coastguard Worker return ret;
195*61046927SAndroid Build Coastguard Worker }
196*61046927SAndroid Build Coastguard Worker
197*61046927SAndroid Build Coastguard Worker /**
198*61046927SAndroid Build Coastguard Worker * Destroy a VdpPresentationQueueTarget.
199*61046927SAndroid Build Coastguard Worker */
200*61046927SAndroid Build Coastguard Worker VdpStatus
vlVdpPresentationQueueTargetDestroy(VdpPresentationQueueTarget presentation_queue_target)201*61046927SAndroid Build Coastguard Worker vlVdpPresentationQueueTargetDestroy(VdpPresentationQueueTarget presentation_queue_target)
202*61046927SAndroid Build Coastguard Worker {
203*61046927SAndroid Build Coastguard Worker vlVdpPresentationQueueTarget *pqt;
204*61046927SAndroid Build Coastguard Worker
205*61046927SAndroid Build Coastguard Worker pqt = vlGetDataHTAB(presentation_queue_target);
206*61046927SAndroid Build Coastguard Worker if (!pqt)
207*61046927SAndroid Build Coastguard Worker return VDP_STATUS_INVALID_HANDLE;
208*61046927SAndroid Build Coastguard Worker
209*61046927SAndroid Build Coastguard Worker vlRemoveDataHTAB(presentation_queue_target);
210*61046927SAndroid Build Coastguard Worker DeviceReference(&pqt->device, NULL);
211*61046927SAndroid Build Coastguard Worker FREE(pqt);
212*61046927SAndroid Build Coastguard Worker
213*61046927SAndroid Build Coastguard Worker return VDP_STATUS_OK;
214*61046927SAndroid Build Coastguard Worker }
215*61046927SAndroid Build Coastguard Worker
216*61046927SAndroid Build Coastguard Worker /**
217*61046927SAndroid Build Coastguard Worker * Destroy a VdpDevice.
218*61046927SAndroid Build Coastguard Worker */
219*61046927SAndroid Build Coastguard Worker VdpStatus
vlVdpDeviceDestroy(VdpDevice device)220*61046927SAndroid Build Coastguard Worker vlVdpDeviceDestroy(VdpDevice device)
221*61046927SAndroid Build Coastguard Worker {
222*61046927SAndroid Build Coastguard Worker vlVdpDevice *dev = vlGetDataHTAB(device);
223*61046927SAndroid Build Coastguard Worker if (!dev)
224*61046927SAndroid Build Coastguard Worker return VDP_STATUS_INVALID_HANDLE;
225*61046927SAndroid Build Coastguard Worker
226*61046927SAndroid Build Coastguard Worker vlRemoveDataHTAB(device);
227*61046927SAndroid Build Coastguard Worker DeviceReference(&dev, NULL);
228*61046927SAndroid Build Coastguard Worker
229*61046927SAndroid Build Coastguard Worker return VDP_STATUS_OK;
230*61046927SAndroid Build Coastguard Worker }
231*61046927SAndroid Build Coastguard Worker
232*61046927SAndroid Build Coastguard Worker /**
233*61046927SAndroid Build Coastguard Worker * Free a VdpDevice.
234*61046927SAndroid Build Coastguard Worker */
235*61046927SAndroid Build Coastguard Worker void
vlVdpDeviceFree(vlVdpDevice * dev)236*61046927SAndroid Build Coastguard Worker vlVdpDeviceFree(vlVdpDevice *dev)
237*61046927SAndroid Build Coastguard Worker {
238*61046927SAndroid Build Coastguard Worker mtx_destroy(&dev->mutex);
239*61046927SAndroid Build Coastguard Worker vl_compositor_cleanup(&dev->compositor);
240*61046927SAndroid Build Coastguard Worker pipe_sampler_view_reference(&dev->dummy_sv, NULL);
241*61046927SAndroid Build Coastguard Worker dev->context->destroy(dev->context);
242*61046927SAndroid Build Coastguard Worker dev->vscreen->destroy(dev->vscreen);
243*61046927SAndroid Build Coastguard Worker FREE(dev);
244*61046927SAndroid Build Coastguard Worker vlDestroyHTAB();
245*61046927SAndroid Build Coastguard Worker }
246*61046927SAndroid Build Coastguard Worker
247*61046927SAndroid Build Coastguard Worker /**
248*61046927SAndroid Build Coastguard Worker * Retrieve a VDPAU function pointer.
249*61046927SAndroid Build Coastguard Worker */
250*61046927SAndroid Build Coastguard Worker VdpStatus
vlVdpGetProcAddress(VdpDevice device,VdpFuncId function_id,void ** function_pointer)251*61046927SAndroid Build Coastguard Worker vlVdpGetProcAddress(VdpDevice device, VdpFuncId function_id, void **function_pointer)
252*61046927SAndroid Build Coastguard Worker {
253*61046927SAndroid Build Coastguard Worker vlVdpDevice *dev = vlGetDataHTAB(device);
254*61046927SAndroid Build Coastguard Worker if (!dev)
255*61046927SAndroid Build Coastguard Worker return VDP_STATUS_INVALID_HANDLE;
256*61046927SAndroid Build Coastguard Worker
257*61046927SAndroid Build Coastguard Worker if (!function_pointer)
258*61046927SAndroid Build Coastguard Worker return VDP_STATUS_INVALID_POINTER;
259*61046927SAndroid Build Coastguard Worker
260*61046927SAndroid Build Coastguard Worker if (!vlGetFuncFTAB(function_id, function_pointer))
261*61046927SAndroid Build Coastguard Worker return VDP_STATUS_INVALID_FUNC_ID;
262*61046927SAndroid Build Coastguard Worker
263*61046927SAndroid Build Coastguard Worker VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Got proc address %p for id %d\n", *function_pointer, function_id);
264*61046927SAndroid Build Coastguard Worker
265*61046927SAndroid Build Coastguard Worker return VDP_STATUS_OK;
266*61046927SAndroid Build Coastguard Worker }
267*61046927SAndroid Build Coastguard Worker
268*61046927SAndroid Build Coastguard Worker #define _ERROR_TYPE(TYPE,STRING) case TYPE: return STRING;
269*61046927SAndroid Build Coastguard Worker
270*61046927SAndroid Build Coastguard Worker /**
271*61046927SAndroid Build Coastguard Worker * Retrieve a string describing an error code.
272*61046927SAndroid Build Coastguard Worker */
273*61046927SAndroid Build Coastguard Worker char const *
vlVdpGetErrorString(VdpStatus status)274*61046927SAndroid Build Coastguard Worker vlVdpGetErrorString (VdpStatus status)
275*61046927SAndroid Build Coastguard Worker {
276*61046927SAndroid Build Coastguard Worker switch (status) {
277*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_OK,"The operation completed successfully; no error.");
278*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_NO_IMPLEMENTATION,"No backend implementation could be loaded.");
279*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_DISPLAY_PREEMPTED,"The display was preempted, or a fatal error occurred. The application must re-initialize VDPAU.");
280*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_HANDLE,"An invalid handle value was provided. Either the handle does not exist at all, or refers to an object of an incorrect type.");
281*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_POINTER,"An invalid pointer was provided. Typically, this means that a NULL pointer was provided for an 'output' parameter.");
282*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_CHROMA_TYPE,"An invalid/unsupported VdpChromaType value was supplied.");
283*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_Y_CB_CR_FORMAT,"An invalid/unsupported VdpYCbCrFormat value was supplied.");
284*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_RGBA_FORMAT,"An invalid/unsupported VdpRGBAFormat value was supplied.");
285*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_INDEXED_FORMAT,"An invalid/unsupported VdpIndexedFormat value was supplied.");
286*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_COLOR_STANDARD,"An invalid/unsupported VdpColorStandard value was supplied.");
287*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_COLOR_TABLE_FORMAT,"An invalid/unsupported VdpColorTableFormat value was supplied.");
288*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_BLEND_FACTOR,"An invalid/unsupported VdpOutputSurfaceRenderBlendFactor value was supplied.");
289*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_BLEND_EQUATION,"An invalid/unsupported VdpOutputSurfaceRenderBlendEquation value was supplied.");
290*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_FLAG,"An invalid/unsupported flag value/combination was supplied.");
291*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_DECODER_PROFILE,"An invalid/unsupported VdpDecoderProfile value was supplied.");
292*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_VIDEO_MIXER_FEATURE,"An invalid/unsupported VdpVideoMixerFeature value was supplied.");
293*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_VIDEO_MIXER_PARAMETER,"An invalid/unsupported VdpVideoMixerParameter value was supplied.");
294*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_VIDEO_MIXER_ATTRIBUTE,"An invalid/unsupported VdpVideoMixerAttribute value was supplied.");
295*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_VIDEO_MIXER_PICTURE_STRUCTURE,"An invalid/unsupported VdpVideoMixerPictureStructure value was supplied.");
296*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_FUNC_ID,"An invalid/unsupported VdpFuncId value was supplied.");
297*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_SIZE,"The size of a supplied object does not match the object it is being used with.\
298*61046927SAndroid Build Coastguard Worker For example, a VdpVideoMixer is configured to process VdpVideoSurface objects of a specific size.\
299*61046927SAndroid Build Coastguard Worker If presented with a VdpVideoSurface of a different size, this error will be raised.");
300*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_VALUE,"An invalid/unsupported value was supplied.\
301*61046927SAndroid Build Coastguard Worker This is a catch-all error code for values of type other than those with a specific error code.");
302*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_INVALID_STRUCT_VERSION,"An invalid/unsupported structure version was specified in a versioned structure. \
303*61046927SAndroid Build Coastguard Worker This implies that the implementation is older than the header file the application was built against.");
304*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_RESOURCES,"The system does not have enough resources to complete the requested operation at this time.");
305*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_HANDLE_DEVICE_MISMATCH,"The set of handles supplied are not all related to the same VdpDevice.When performing operations \
306*61046927SAndroid Build Coastguard Worker that operate on multiple surfaces, such as VdpOutputSurfaceRenderOutputSurface or VdpVideoMixerRender, \
307*61046927SAndroid Build Coastguard Worker all supplied surfaces must have been created within the context of the same VdpDevice object. \
308*61046927SAndroid Build Coastguard Worker This error is raised if they were not.");
309*61046927SAndroid Build Coastguard Worker _ERROR_TYPE(VDP_STATUS_ERROR,"A catch-all error, used when no other error code applies.");
310*61046927SAndroid Build Coastguard Worker default: return "Unknown Error";
311*61046927SAndroid Build Coastguard Worker }
312*61046927SAndroid Build Coastguard Worker }
313*61046927SAndroid Build Coastguard Worker
314*61046927SAndroid Build Coastguard Worker void
vlVdpDefaultSamplerViewTemplate(struct pipe_sampler_view * templ,struct pipe_resource * res)315*61046927SAndroid Build Coastguard Worker vlVdpDefaultSamplerViewTemplate(struct pipe_sampler_view *templ, struct pipe_resource *res)
316*61046927SAndroid Build Coastguard Worker {
317*61046927SAndroid Build Coastguard Worker const struct util_format_description *desc;
318*61046927SAndroid Build Coastguard Worker
319*61046927SAndroid Build Coastguard Worker memset(templ, 0, sizeof(*templ));
320*61046927SAndroid Build Coastguard Worker u_sampler_view_default_template(templ, res, res->format);
321*61046927SAndroid Build Coastguard Worker
322*61046927SAndroid Build Coastguard Worker desc = util_format_description(res->format);
323*61046927SAndroid Build Coastguard Worker if (desc->swizzle[0] == PIPE_SWIZZLE_0)
324*61046927SAndroid Build Coastguard Worker templ->swizzle_r = PIPE_SWIZZLE_1;
325*61046927SAndroid Build Coastguard Worker if (desc->swizzle[1] == PIPE_SWIZZLE_0)
326*61046927SAndroid Build Coastguard Worker templ->swizzle_g = PIPE_SWIZZLE_1;
327*61046927SAndroid Build Coastguard Worker if (desc->swizzle[2] == PIPE_SWIZZLE_0)
328*61046927SAndroid Build Coastguard Worker templ->swizzle_b = PIPE_SWIZZLE_1;
329*61046927SAndroid Build Coastguard Worker if (desc->swizzle[3] == PIPE_SWIZZLE_0)
330*61046927SAndroid Build Coastguard Worker templ->swizzle_a = PIPE_SWIZZLE_1;
331*61046927SAndroid Build Coastguard Worker }
332