1 /**************************************************************************
3 * Copyright 2010 Thomas Balling Sørensen & Orasanu Lucian.
4 * Copyright 2014 Advanced Micro Devices, Inc.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sub license, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
15 * The above copyright notice and this permission notice (including the
16 * next paragraph) shall be included in all copies or substantial portions
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22 * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR
23 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 **************************************************************************/
29 #include "pipe/p_screen.h"
30 #include "pipe/p_video_codec.h"
32 #include "util/u_memory.h"
33 #include "vl/vl_winsys.h"
35 #include "va_private.h"
37 static struct VADriverVTable vtable
=
40 &vlVaQueryConfigProfiles
,
41 &vlVaQueryConfigEntrypoints
,
42 &vlVaGetConfigAttributes
,
45 &vlVaQueryConfigAttributes
,
51 &vlVaBufferSetNumElements
,
59 &vlVaQuerySurfaceStatus
,
60 &vlVaQuerySurfaceError
,
62 &vlVaQueryImageFormats
,
69 &vlVaQuerySubpictureFormats
,
70 &vlVaCreateSubpicture
,
71 &vlVaDestroySubpicture
,
73 &vlVaSetSubpictureChromakey
,
74 &vlVaSetSubpictureGlobalAlpha
,
75 &vlVaAssociateSubpicture
,
76 &vlVaDeassociateSubpicture
,
77 &vlVaQueryDisplayAttributes
,
78 &vlVaGetDisplayAttributes
,
79 &vlVaSetDisplayAttributes
,
86 VA_DRIVER_INIT_FUNC(VADriverContextP ctx
)
91 return VA_STATUS_ERROR_INVALID_CONTEXT
;
93 drv
= CALLOC(1, sizeof(vlVaDriver
));
95 return VA_STATUS_ERROR_ALLOCATION_FAILED
;
97 drv
->vscreen
= vl_screen_create(ctx
->native_dpy
, ctx
->x11_screen
);
100 return VA_STATUS_ERROR_ALLOCATION_FAILED
;
103 ctx
->pDriverData
= (void *)drv
;
104 ctx
->version_major
= 0;
105 ctx
->version_minor
= 1;
106 *ctx
->vtable
= vtable
;
107 ctx
->max_profiles
= 1;
108 ctx
->max_entrypoints
= 1;
109 ctx
->max_attributes
= 1;
110 ctx
->max_image_formats
= 1;
111 ctx
->max_subpic_formats
= 1;
112 ctx
->max_display_attributes
= 1;
113 ctx
->str_vendor
= "mesa gallium vaapi";
115 return VA_STATUS_SUCCESS
;
119 vlVaCreateContext(VADriverContextP ctx
, VAConfigID config_id
, int picture_width
,
120 int picture_height
, int flag
, VASurfaceID
*render_targets
,
121 int num_render_targets
, VAContextID
*conext
)
124 return VA_STATUS_ERROR_INVALID_CONTEXT
;
126 return VA_STATUS_ERROR_UNIMPLEMENTED
;
130 vlVaDestroyContext(VADriverContextP ctx
, VAContextID context
)
133 return VA_STATUS_ERROR_INVALID_CONTEXT
;
135 return VA_STATUS_ERROR_UNIMPLEMENTED
;
139 vlVaTerminate(VADriverContextP ctx
)
144 return VA_STATUS_ERROR_INVALID_CONTEXT
;
146 drv
= ctx
->pDriverData
;
147 vl_screen_destroy(drv
->vscreen
);
150 return VA_STATUS_SUCCESS
;