render_init()/render_terminate() callback functions for each platform
[platform/upstream/libva-intel-driver.git] / src / i965_drv_video.h
index 48519cd..2de9928 100644 (file)
@@ -40,8 +40,9 @@
 #include "i965_mutext.h"
 #include "object_heap.h"
 #include "intel_driver.h"
+#include "i965_fourcc.h"
 
-#define I965_MAX_PROFILES                       11
+#define I965_MAX_PROFILES                       20
 #define I965_MAX_ENTRYPOINTS                    5
 #define I965_MAX_CONFIG_ATTRIBUTES              10
 #define I965_MAX_IMAGE_FORMATS                  10
 #define I965_SURFACE_FLAG_TOP_FIELD_FIRST       0x00000001
 #define I965_SURFACE_FLAG_BOTTOME_FIELD_FIRST   0x00000002
 
+#define DEFAULT_BRIGHTNESS      0
+#define DEFAULT_CONTRAST        50
+#define DEFAULT_HUE             0
+#define DEFAULT_SATURATION      50
+
 struct i965_surface
 {
     struct object_base *base;
@@ -73,6 +79,7 @@ struct i965_kernel
     const uint32_t (*bin)[4];
     int size;
     dri_bo *bo;
+    unsigned int kernel_offset;
 };
 
 struct buffer_store
@@ -102,6 +109,7 @@ struct decode_state
     struct buffer_store *bit_plane;
     struct buffer_store *huffman_table;
     struct buffer_store **slice_datas;
+    struct buffer_store *probability_data;
     VASurfaceID current_render_target;
     int max_slice_params;
     int max_slice_datas;
@@ -133,7 +141,7 @@ struct encode_state
     int num_slice_params_ext;
     int last_packed_header_type;
 
-    struct buffer_store *misc_param[8];
+    struct buffer_store *misc_param[16];
 
     VASurfaceID current_render_target;
     struct object_surface *input_yuv_object;
@@ -202,11 +210,11 @@ struct object_surface
     struct object_subpic *obj_subpic[I965_MAX_SUBPIC_SUM];
     unsigned int subpic_render_idx;
 
-    int width;
-    int height;
+    int width;          /* the pitch of plane 0 in bytes in horizontal direction */
+    int height;         /* the pitch of plane 0 in bytes in vertical direction */
     int size;
-    int orig_width;
-    int orig_height;
+    int orig_width;     /* the width of plane 0 in pixels */
+    int orig_height;    /* the height of plane 0 in pixels */
     int flags;
     unsigned int fourcc;    
     dri_bo *bo;
@@ -221,6 +229,10 @@ struct object_surface
     int cb_cr_width;
     int cb_cr_height;
     int cb_cr_pitch;
+    /* user specified attributes see: VASurfaceAttribExternalBuffers/VA_SURFACE_ATTRIB_MEM_TYPE_VA */
+    uint32_t user_disable_tiling : 1;
+    uint32_t user_h_stride_set   : 1;
+    uint32_t user_v_stride_set   : 1;
 };
 
 struct object_buffer 
@@ -274,6 +286,8 @@ struct hw_codec_info
     struct hw_context *(*dec_hw_context_init)(VADriverContextP, struct object_config *);
     struct hw_context *(*enc_hw_context_init)(VADriverContextP, struct object_config *);
     struct hw_context *(*proc_hw_context_init)(VADriverContextP, struct object_config *);
+    bool (*render_init)(VADriverContextP);
+
     int max_width;
     int max_height;
 
@@ -291,6 +305,8 @@ struct hw_codec_info
     unsigned int has_tiled_surface:1;
     unsigned int has_di_motion_adptive:1;
     unsigned int has_di_motion_compensated:1;
+    unsigned int has_vp8_decoding:1;
+    unsigned int has_vp8_encoding:1;
 
     unsigned int num_filters;
     struct i965_filter filters[VAProcFilterCount];
@@ -308,11 +324,12 @@ struct i965_driver_data
     struct object_heap buffer_heap;
     struct object_heap image_heap;
     struct object_heap subpic_heap;
-    struct hw_codec_info *codec_info;
+    const struct hw_codec_info *codec_info;
 
     _I965Mutex render_mutex;
     _I965Mutex pp_mutex;
     struct intel_batchbuffer *batch;
+    struct intel_batchbuffer *pp_batch;
     struct i965_render_state render_state;
     void *pp_context;
     char va_vendor[256];
@@ -320,6 +337,10 @@ struct i965_driver_data
     VADisplayAttribute *display_attributes;
     unsigned int num_display_attributes;
     VADisplayAttribute *rotation_attrib;
+    VADisplayAttribute *brightness_attrib;
+    VADisplayAttribute *contrast_attrib;
+    VADisplayAttribute *hue_attrib;
+    VADisplayAttribute *saturation_attrib;
     VAContextID current_context_id;
 
     /* VA/DRI (X11) specific data */
@@ -355,7 +376,7 @@ i965_driver_data(VADriverContextP ctx)
     return (struct i965_driver_data *)(ctx->pDriverData);
 }
 
-void 
+VAStatus
 i965_check_alloc_surface_bo(VADriverContextP ctx,
                             struct object_surface *obj_surface,
                             int tiled,
@@ -366,8 +387,8 @@ int
 va_enc_packed_type_to_idx(int packed_type);
 
 /* reserve 2 byte for internal using */
-#define CODED_H264      0
-#define CODED_MPEG2     1
+#define CODEC_H264      0
+#define CODEC_MPEG2     1
 
 #define H264_DELIMITER0 0x00
 #define H264_DELIMITER1 0x00
@@ -396,6 +417,10 @@ extern VAStatus i965_MapBuffer(VADriverContextP ctx,
 
 extern VAStatus i965_UnmapBuffer(VADriverContextP ctx, VABufferID buf_id);
 
+extern VAStatus i965_DestroySurfaces(VADriverContextP ctx,
+                     VASurfaceID *surface_list,
+                     int num_surfaces);
+
 #define I965_SURFACE_MEM_NATIVE             0
 #define I965_SURFACE_MEM_GEM_FLINK          1
 #define I965_SURFACE_MEM_DRM_PRIME          2