1 /**************************************************************************
3 * Copyright 2010 Thomas Balling Sørensen & Orasanu Lucian.
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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
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.
26 **************************************************************************/
28 #include <util/u_memory.h>
29 #include <util/u_format.h>
30 #include <util/u_debug.h>
31 #include <pipe/p_format.h>
33 #include <va/va_backend.h>
34 #include "va_private.h"
37 enum pipe_format pipe_format
;
38 VAImageFormat va_format
;
39 } va_image_formats_supported_t
;
41 static const va_image_formats_supported_t va_image_formats_supported
[VA_MAX_IMAGE_FORMATS_SUPPORTED
] =
43 { PIPE_FORMAT_B8G8R8A8_UNORM
,
44 { VA_FOURCC('B','G','R','A'), VA_LSB_FIRST
, 32, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 }},
45 { PIPE_FORMAT_R8G8B8A8_UNORM
,
46 { VA_FOURCC_RGBA
, VA_LSB_FIRST
, 32, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 }}
49 boolean
vlCreateHTAB(void);
50 void vlDestroyHTAB(void);
51 vlHandle
vlAddDataHTAB(void *data
);
52 void* vlGetDataHTAB(vlHandle handle
);
55 vlVaQueryImageFormats ( VADriverContextP ctx
,
56 VAImageFormat
*format_list
,
60 return VA_STATUS_ERROR_INVALID_CONTEXT
;
62 if (!(format_list
&& num_formats
))
63 return VA_STATUS_ERROR_UNKNOWN
;
67 num_formats
[0] = VA_MAX_IMAGE_FORMATS_SUPPORTED
;
69 /* Query supported formats */
70 for (n
= 0; n
< VA_MAX_IMAGE_FORMATS_SUPPORTED
; n
++)
72 format_list
[n
] = va_image_formats_supported
[n
].va_format
;
75 return VA_STATUS_SUCCESS
;
78 VAStatus
vlVaCreateImage( VADriverContextP ctx
,
79 VAImageFormat
*format
,
85 return VA_STATUS_ERROR_INVALID_CONTEXT
;
88 return VA_STATUS_ERROR_UNKNOWN
;
90 if (!(width
&& height
))
91 return VA_STATUS_ERROR_INVALID_IMAGE_FORMAT
;
94 return VA_STATUS_ERROR_UNKNOWN
;
96 switch (format
->fourcc
) {
97 case VA_FOURCC('B','G','R','A'):
98 VA_INFO("Creating BGRA image of size %dx%d\n",width
,height
);
101 VA_INFO("Creating RGBA image of size %dx%d\n",width
,height
);
104 VA_ERROR("Couldn't create image of type %0x08\n",format
->fourcc
);
105 return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT
;
109 VA_INFO("Image %p created successfully\n",format
);
111 return VA_STATUS_SUCCESS
;
114 VAStatus
vlVaDeriveImage( VADriverContextP ctx
,
119 return VA_STATUS_ERROR_INVALID_CONTEXT
;
122 return VA_STATUS_ERROR_UNIMPLEMENTED
;
125 VAStatus
vlVaDestroyImage( VADriverContextP ctx
,
129 return VA_STATUS_ERROR_INVALID_CONTEXT
;
132 return VA_STATUS_ERROR_UNIMPLEMENTED
;
135 VAStatus
vlVaSetImagePalette( VADriverContextP ctx
,
137 unsigned char *palette
)
140 return VA_STATUS_ERROR_INVALID_CONTEXT
;
143 return VA_STATUS_ERROR_UNIMPLEMENTED
;
146 VAStatus
vlVaGetImage( VADriverContextP ctx
,
155 return VA_STATUS_ERROR_INVALID_CONTEXT
;
158 return VA_STATUS_ERROR_UNIMPLEMENTED
;
161 VAStatus
vlVaPutImage( VADriverContextP ctx
,
166 unsigned int src_width
,
167 unsigned int src_height
,
170 unsigned int dest_width
,
171 unsigned int dest_height
)
174 return VA_STATUS_ERROR_INVALID_CONTEXT
;
177 return VA_STATUS_ERROR_UNIMPLEMENTED
;