psb_output.h revision 2f768e2db3e4074a6e9a3d5f0f6e321233d96e4c
1/* 2 * INTEL CONFIDENTIAL 3 * Copyright 2007 Intel Corporation. All Rights Reserved. 4 * 5 * The source code contained or described herein and all documents related to 6 * the source code ("Material") are owned by Intel Corporation or its suppliers 7 * or licensors. Title to the Material remains with Intel Corporation or its 8 * suppliers and licensors. The Material may contain trade secrets and 9 * proprietary and confidential information of Intel Corporation and its 10 * suppliers and licensors, and is protected by worldwide copyright and trade 11 * secret laws and treaty provisions. No part of the Material may be used, 12 * copied, reproduced, modified, published, uploaded, posted, transmitted, 13 * distributed, or disclosed in any way without Intel's prior express written 14 * permission. 15 * 16 * No license under any patent, copyright, trade secret or other intellectual 17 * property right is granted to or conferred upon you by disclosure or delivery 18 * of the Materials, either expressly, by implication, inducement, estoppel or 19 * otherwise. Any license under such intellectual property rights must be 20 * express and approved by Intel in writing. 21 */ 22 23#ifndef _PSB_OUTPUT_H_ 24#define _PSB_OUTPUT_H_ 25#include <inttypes.h> 26#include "psb_drv_video.h" 27#include "psb_drm.h" 28#include "psb_surface.h" 29#include "hwdefs/img_types.h" 30#include <va/va.h> 31#include <linux/fb.h> 32#include <fcntl.h> 33 34#ifndef ANDROID 35#include <va/va_x11.h> 36#else 37#define Drawable unsigned int 38#define Bool int 39#define LOG_TAG "pvr_drv_video" 40#endif 41 42#define PSB_MAX_IMAGE_FORMATS 5 /* sizeof(psb__CreateImageFormat)/sizeof(VAImageFormat) */ 43#define PSB_MAX_SUBPIC_FORMATS 3 /* sizeof(psb__SubpicFormat)/sizeof(VAImageFormat) */ 44#define PSB_MAX_DISPLAY_ATTRIBUTES 6 /* sizeof(psb__DisplayAttribute)/sizeof(VADisplayAttribute) */ 45 46#define PSB_SUPPORTED_SUBPIC_FLAGS 0 /* No alpha or chroma key support */ 47 48 49#define CLAMP(_X) ( (_X)= ((_X)<0?0:((_X)>255?255:(_X)) ) ) 50 51#define HUE_DEFAULT_VALUE 0 52#define HUE_MIN -180 53#define HUE_MAX 180 54#define HUE_STEPSIZE 0.1 55 56#define BRIGHTNESS_DEFAULT_VALUE 0 57#define BRIGHTNESS_MIN -100 58#define BRIGHTNESS_MAX 100 59#define BRIGHTNESS_STEPSIZE 0.1 60 61#define CONTRAST_DEFAULT_VALUE 1 62#define CONTRAST_MIN 0 63#define CONTRAST_MAX 2 64#define CONTRAST_STEPSIZE 0.0001 65 66#define SATURATION_DEFAULT_VALUE 1 67#define SATURATION_MIN 0 68#define SATURATION_MAX 3 69#define SATURATION_STEPSIZE 0.0001 70 71#define PSB_DRIDDX_VERSION_MAJOR 0 72#define PSB_DRIDDX_VERSION_MINOR 1 73#define PSB_DRIDDX_VERSION_PATCH 0 74 75#define psb__ImageNV12 \ 76{ \ 77 VA_FOURCC_NV12, \ 78 VA_LSB_FIRST, \ 79 16, \ 80 0, \ 81 0, \ 82 0, \ 83 0, \ 84 0 \ 85} 86 87#define psb__ImageAYUV \ 88{ \ 89 VA_FOURCC_AYUV, \ 90 VA_LSB_FIRST, \ 91 32, \ 92 0, \ 93 0, \ 94 0, \ 95 0, \ 96 0 \ 97} 98 99#define psb__ImageAI44 \ 100{ \ 101 VA_FOURCC_AI44, \ 102 VA_LSB_FIRST, \ 103 16, \ 104 0, \ 105 0, \ 106 0, \ 107 0, \ 108 0, \ 109} 110 111#define psb__ImageRGBA \ 112{ \ 113 VA_FOURCC_RGBA, \ 114 VA_LSB_FIRST, \ 115 32, \ 116 32, \ 117 0xff, \ 118 0xff00, \ 119 0xff0000, \ 120 0xff000000 \ 121} 122 123#define psb__ImageYV16 \ 124{ \ 125 VA_FOURCC_YV16, \ 126 VA_LSB_FIRST, \ 127 16, \ 128 0, \ 129 0, \ 130 0, \ 131 0, \ 132 0, \ 133} 134 135VAStatus psb__destroy_subpicture(psb_driver_data_p driver_data, object_subpic_p obj_subpic); 136VAStatus psb__destroy_image(psb_driver_data_p driver_data, object_image_p obj_image); 137 138/* 139 * VAImage call these buffer routines 140 */ 141VAStatus psb__CreateBuffer( 142 psb_driver_data_p driver_data, 143 object_context_p obj_context, /* in */ 144 VABufferType type, /* in */ 145 unsigned int size, /* in */ 146 unsigned int num_elements, /* in */ 147 void *data, /* in */ 148 VABufferID *buf_desc /* out */ 149); 150 151VAStatus psb_DestroyBuffer( 152 VADriverContextP ctx, 153 VABufferID buffer_id 154); 155 156VAStatus psb_initOutput( 157 VADriverContextP ctx 158); 159 160 161VAStatus psb_deinitOutput( 162 VADriverContextP ctx 163); 164 165VAStatus psb_PutSurfaceBuf( 166 VADriverContextP ctx, 167 VASurfaceID surface, 168 unsigned char* data, 169 int* data_len, 170 short srcx, 171 short srcy, 172 unsigned short srcw, 173 unsigned short srch, 174 short destx, 175 short desty, 176 unsigned short destw, 177 unsigned short desth, 178 VARectangle *cliprects, /* client supplied clip list */ 179 unsigned int number_cliprects, /* number of clip rects in the clip list */ 180 unsigned int flags /* de-interlacing flags */ 181); 182 183VAStatus psb_PutSurface( 184 VADriverContextP ctx, 185 VASurfaceID surface, 186 void* draw, /* X Drawable */ 187 short srcx, 188 short srcy, 189 unsigned short srcw, 190 unsigned short srch, 191 short destx, 192 short desty, 193 unsigned short destw, 194 unsigned short desth, 195 VARectangle *cliprects, /* client supplied clip list */ 196 unsigned int number_cliprects, /* number of clip rects in the clip list */ 197 unsigned int flags /* de-interlacing flags */ 198); 199 200VAStatus psb_QueryImageFormats( 201 VADriverContextP ctx, 202 VAImageFormat *format_list, /* out */ 203 int *num_formats /* out */ 204); 205 206VAStatus psb_CreateImage( 207 VADriverContextP ctx, 208 VAImageFormat *format, 209 int width, 210 int height, 211 VAImage *image /* out */ 212); 213 214VAStatus psb_DeriveImage( 215 VADriverContextP ctx, 216 VASurfaceID surface, 217 VAImage *image /* out */ 218); 219 220VAStatus psb_DestroyImage( 221 VADriverContextP ctx, 222 VAImageID image 223); 224 225VAStatus psb_SetImagePalette ( 226 VADriverContextP ctx, 227 VAImageID image, 228 /* 229 * pointer to an array holding the palette data. The size of the array is 230 * num_palette_entries * entry_bytes in size. The order of the components 231 * in the palette is described by the component_order in VAImage struct 232 */ 233 unsigned char *palette 234); 235 236VAStatus psb_GetImage( 237 VADriverContextP ctx, 238 VASurfaceID surface, 239 int x, /* coordinates of the upper left source pixel */ 240 int y, 241 unsigned int width, /* width and height of the region */ 242 unsigned int height, 243 VAImageID image 244); 245 246VAStatus psb_PutImage( 247 VADriverContextP ctx, 248 VASurfaceID surface, 249 VAImageID image, 250 int src_x, 251 int src_y, 252 unsigned int src_width, 253 unsigned int src_height, 254 int dest_x, 255 int dest_y, 256 unsigned int dest_width, 257 unsigned int dest_height 258); 259 260VAStatus psb_QuerySubpictureFormats( 261 VADriverContextP ctx, 262 VAImageFormat *format_list, /* out */ 263 unsigned int *flags, /* out */ 264 unsigned int *num_formats /* out */ 265); 266 267VAStatus psb_CreateSubpicture( 268 VADriverContextP ctx, 269 VAImageID image, 270 VASubpictureID *subpicture /* out */ 271); 272 273VAStatus psb_DestroySubpicture( 274 VADriverContextP ctx, 275 VASubpictureID subpicture 276); 277 278VAStatus psb_SetSubpictureImage ( 279 VADriverContextP ctx, 280 VASubpictureID subpicture, 281 VAImageID image 282); 283 284 285VAStatus psb_SetSubpictureChromakey( 286 VADriverContextP ctx, 287 VASubpictureID subpicture, 288 unsigned int chromakey_min, 289 unsigned int chromakey_max, 290 unsigned int chromakey_mask 291); 292 293VAStatus psb_SetSubpictureGlobalAlpha( 294 VADriverContextP ctx, 295 VASubpictureID subpicture, 296 float global_alpha 297); 298 299VAStatus psb_AssociateSubpicture( 300 VADriverContextP ctx, 301 VASubpictureID subpicture, 302 VASurfaceID *target_surfaces, 303 int num_surfaces, 304 short src_x, /* upper left offset in subpicture */ 305 short src_y, 306 unsigned short src_width, 307 unsigned short src_height, 308 short dest_x, /* upper left offset in surface */ 309 short dest_y, 310 unsigned short dest_width, 311 unsigned short dest_height, 312 /* 313 * whether to enable chroma-keying or global-alpha 314 * see VA_SUBPICTURE_XXX values 315 */ 316 unsigned int flags 317); 318 319VAStatus psb_DeassociateSubpicture( 320 VADriverContextP ctx, 321 VASubpictureID subpicture, 322 VASurfaceID *target_surfaces, 323 int num_surfaces 324); 325 326void psb_SurfaceDeassociateSubpict( 327 psb_driver_data_p driver_data, 328 object_surface_p obj_surface 329); 330 331/* 332 * Query display attributes 333 * The caller must provide a "attr_list" array that can hold at 334 * least vaMaxNumDisplayAttributes() entries. The actual number of attributes 335 * returned in "attr_list" is returned in "num_attributes". 336 */ 337VAStatus psb_QueryDisplayAttributes ( 338 VADriverContextP ctx, 339 VADisplayAttribute *attr_list, /* out */ 340 int *num_attributes /* out */ 341); 342 343/* 344 * Get display attributes 345 * This function returns the current attribute values in "attr_list". 346 * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field 347 * from vaQueryDisplayAttributes() can have their values retrieved. 348 */ 349VAStatus psb_GetDisplayAttributes ( 350 VADriverContextP ctx, 351 VADisplayAttribute *attr_list, /* in/out */ 352 int num_attributes 353); 354 355/* 356 * Set display attributes 357 * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field 358 * from vaQueryDisplayAttributes() can be set. If the attribute is not settable or 359 * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPPORTED 360 */ 361VAStatus psb_SetDisplayAttributes ( 362 VADriverContextP ctx, 363 VADisplayAttribute *attr_list, 364 int num_attributes 365); 366 367#endif /* _PSB_OUTPUT_H_ */ 368