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