va_subpicture.c revision 3fac09ad873b8a5239f84d07dc12e8b08a117561
1/**************************************************************************
2 *
3 * Copyright 2010 Thomas Balling Sørensen & Orasanu Lucian.
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 <va/va.h>
29#include <va/va_backend.h>
30#include <pipe/p_format.h>
31#include "va_private.h"
32
33#define NUM_FORMAT_SUPPORTED 2
34
35typedef struct  {
36	enum pipe_format;
37	VAImageFormat       va_format;
38    unsigned int        va_flags;
39} va_subpicture_formats_supported_t;
40
41static const va_subpicture_formats_supported_t va_subpicture_formats_supported[NUM_FORMAT_SUPPORTED] =
42{
43	{ PIPE_FORMAT_B8G8R8A8_UNORM,
44      { VA_FOURCC('B','G','R','A'), VA_LSB_FIRST, 32,
45        32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 },
46      0 },
47    { PIPE_FORMAT_R8G8B8A8_UNORM,
48	  { VA_FOURCC('R','G','B','A'), VA_LSB_FIRST, 32,
49        32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 },
50      0 }
51};
52
53VAStatus
54vlVaQuerySubpictureFormats(		VADriverContextP ctx,
55                                VAImageFormat *format_list,
56                                unsigned int *flags,
57                                unsigned int *num_formats)
58{
59	if (!ctx)
60		return VA_STATUS_ERROR_INVALID_CONTEXT;
61
62	if (!(format_list && flags && num_formats))
63		return VA_STATUS_ERROR_UNKNOWN;
64
65	int n = 0;
66	/* Query supported formats */
67	for (n = 0; n < NUM_FORMAT_SUPPORTED; n++)
68	{
69		flags[n] = va_subpicture_formats_supported[n].va_flags;
70		format_list[n] = va_subpicture_formats_supported[n].va_format;
71	}
72
73	return VA_STATUS_SUCCESS;
74}
75
76
77VAStatus vlVaCreateSubpicture(		VADriverContextP ctx,
78                                    VAImageID image,
79                                    VASubpictureID *subpicture)
80{
81	if (!ctx)
82		return VA_STATUS_ERROR_INVALID_CONTEXT;
83
84	return VA_STATUS_ERROR_UNIMPLEMENTED;
85}
86
87VAStatus vlVaDestroySubpicture(		VADriverContextP ctx,
88                                    VASubpictureID subpicture)
89{
90	if (!ctx)
91		return VA_STATUS_ERROR_INVALID_CONTEXT;
92
93	return VA_STATUS_ERROR_UNIMPLEMENTED;
94}
95
96VAStatus vlVaSubpictureImage(		VADriverContextP ctx,
97                                    VASubpictureID subpicture,
98                                    VAImageID image)
99{
100	if (!ctx)
101		return VA_STATUS_ERROR_INVALID_CONTEXT;
102
103	return VA_STATUS_ERROR_UNIMPLEMENTED;
104}
105
106VAStatus vlVaSetSubpictureChromakey(	VADriverContextP ctx,
107                                        VASubpictureID subpicture,
108                                        unsigned int chromakey_min,
109                                        unsigned int chromakey_max,
110                                        unsigned int chromakey_mask)
111{
112	if (!ctx)
113		return VA_STATUS_ERROR_INVALID_CONTEXT;
114
115	return VA_STATUS_ERROR_UNIMPLEMENTED;
116}
117
118VAStatus vlVaSetSubpictureGlobalAlpha(	VADriverContextP ctx,
119                                        VASubpictureID subpicture,
120                                        float global_alpha)
121{
122	if (!ctx)
123		return VA_STATUS_ERROR_INVALID_CONTEXT;
124
125	return VA_STATUS_ERROR_UNIMPLEMENTED;
126}
127
128VAStatus vlVaAssociateSubpicture(	VADriverContextP ctx,
129                                    VASubpictureID subpicture,
130                                    VASurfaceID *target_surfaces,
131                                    int num_surfaces,
132                                    short src_x,
133                                    short src_y,
134                                    unsigned short src_width,
135                                    unsigned short src_height,
136                                    short dest_x,
137                                    short dest_y,
138                                    unsigned short dest_width,
139                                    unsigned short dest_height,
140                                    unsigned int flags)
141{
142	if (!ctx)
143		return VA_STATUS_ERROR_INVALID_CONTEXT;
144
145	return VA_STATUS_ERROR_UNIMPLEMENTED;
146}
147
148VAStatus vlVaDeassociateSubpicture(	VADriverContextP ctx,
149                                    VASubpictureID subpicture,
150                                    VASurfaceID *target_surfaces,
151                                    int num_surfaces)
152{
153	if (!ctx)
154		return VA_STATUS_ERROR_INVALID_CONTEXT;
155
156	return VA_STATUS_ERROR_UNIMPLEMENTED;
157}
158