Home | History | Annotate | Download | only in src
      1 /**
      2  * file vsp.h
      3  * Author: Binglin Chen <binglin.chen (at) intel.com>
      4  *
      5  */
      6 
      7 /**************************************************************************
      8  * Copyright (c) 2007, Intel Corporation.
      9  * All Rights Reserved.
     10  *
     11  * This program is free software; you can redistribute it and/or modify it
     12  * under the terms and conditions of the GNU General Public License,
     13  * version 2, as published by the Free Software Foundation.
     14  *
     15  * This program is distributed in the hope it will be useful, but WITHOUT
     16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     17  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
     18  * more details.
     19  *
     20  * You should have received a copy of the GNU General Public License along with
     21  * this program; if not, write to the Free Software Foundation, Inc.,
     22  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
     23  *
     24  **************************************************************************/
     25 
     26 #ifndef _VSP_FW_H_
     27 #define _VSP_FW_H_
     28 
     29 #pragma pack(4)
     30 #define VssProcPipelineMaxNumFilters 5
     31 #define VSS_PROC_MAX_INPUT_PICTURES  1
     32 #define VSS_PROC_MAX_OUTPUT_PICTURES 4
     33 
     34 /* Application IDs for applications that use secure boot
     35  * and context-switching
     36  * */
     37 #define VSP_APP_ID_NONE 0
     38 #define VSP_APP_ID_FRC_VPP 1
     39 #define VSP_APP_ID_VP8_ENC 2
     40 #define VSP_APP_ID_WIDI_ENC 3
     41 
     42 enum VssProcFilterType {
     43 	VssProcFilterDenoise,
     44 	VssProcFilterSharpening,
     45 	VssProcFilterColorEnhancement,
     46 	VssProcFilterFrameRateConversion
     47 };
     48 
     49 enum VssDenoiseType {
     50 	VssProcDegrain,
     51 	VssProcDeblock
     52 };
     53 
     54 enum VssFrcQuality {
     55 	/* VssFrcLowQuality, */
     56 	VssFrcMediumQuality,
     57 	VssFrcHighQuality
     58 };
     59 
     60 enum VssFrcConversionRate {
     61 	VssFrc2xConversionRate,
     62 	VssFrc2_5xConversionRate,
     63 	VssFrc4xConversionRate,
     64 	VssFrc1_25xConversionRate
     65 };
     66 
     67 struct VssProcPipelineParameterBuffer {
     68 	unsigned int      num_filters;
     69 	enum VssProcFilterType filter_pipeline[VssProcPipelineMaxNumFilters];
     70 	unsigned int intermediate_buffer_base;
     71 	unsigned int intermediate_buffer_size;
     72 };
     73 
     74 struct VssProcSharpenParameterBuffer {
     75 	int quality;
     76 	/* to make multiple of 32 bytes*/
     77 	unsigned int _pad[7];
     78 };
     79 
     80 struct VssProcDenoiseParameterBuffer {
     81 	enum VssDenoiseType     type;
     82 	int                value_thr;
     83 	int                cnt_thr;
     84 	int                coef;
     85 	int                temp_thr1;
     86 	int                temp_thr2;
     87 	/* to make multiple of 32 bytes*/
     88 	int                _pad[2];
     89 };
     90 
     91 struct VssProcColorEnhancementParameterBuffer {
     92 	int                temp_detect;
     93 	int                temp_correct;
     94 	int                clip_thr;
     95 	int                mid_thr;
     96 	int                luma_amm;
     97 	int                chroma_amm;
     98 	/* to make multiple of 32 bytes*/
     99 	int                _pad[2];
    100 };
    101 
    102 struct VssProcFrcParameterBuffer {
    103 	enum VssFrcQuality quality;
    104 	enum VssFrcConversionRate conversion_rate;
    105 	/* to make multiple of 32 bytes*/
    106 	int  _pad[6];
    107 };
    108 
    109 /* Set the rotation angle */
    110 #define VSP_ROTATION_NONE 0
    111 #define VSP_ROTATION_90   90
    112 #define VSP_ROTATION_180  180
    113 #define VSP_ROTATION_270  270
    114 
    115 struct VssProcPicture {
    116 	unsigned int surface_id;
    117 	/* send interupt when input or output surface is ready */
    118 	unsigned int irq;
    119 	unsigned int base;
    120 	unsigned int height;
    121 	unsigned int width;
    122 	unsigned int rot_angle;
    123 	unsigned int stride;
    124 	/* frame raw format */
    125 	unsigned int format;
    126 	/* flag indicating if frame is stored in tiled format */
    127 	unsigned int tiled;
    128 	/* to make multiple of 32 bytes*/
    129 	int _pad[7];
    130 };
    131 
    132 struct VssProcPictureParameterBuffer {
    133 	unsigned int num_input_pictures;
    134 	unsigned int num_output_pictures;
    135 	/* to make multiple of 32 bytes*/
    136 	int          _pad[6];
    137 	struct VssProcPicture input_picture[VSS_PROC_MAX_INPUT_PICTURES];
    138 	struct VssProcPicture output_picture[VSS_PROC_MAX_OUTPUT_PICTURES];
    139 };
    140 
    141 union VssProcBuffer {
    142 	struct VssProcPipelineParameterBuffer         pipeline;
    143 	struct VssProcSharpenParameterBuffer          sharpen_base;
    144 	struct VssProcDenoiseParameterBuffer          denoiser_base;
    145 	struct VssProcColorEnhancementParameterBuffer enhancer_base;
    146 	struct VssProcFrcParameterBuffer              frc;
    147 	struct VssProcPictureParameterBuffer          picture;
    148 };
    149 
    150 enum VssProcCommandType {
    151 	VssProcPipelineParameterCommand =         0xFFFE,
    152 	VssProcSharpenParameterCommand =          0xFFFD,
    153 	VssProcDenoiseParameterCommand =          0xFFFC,
    154 	VssProcColorEnhancementParameterCommand = 0xFFFB,
    155 	VssProcFrcParameterCommand =              0xFFFA,
    156 	VssProcPictureCommand =                   0xFFF9,
    157 	VspFencePictureParamCommand =             0xEBEC,
    158 	VspSetContextCommand =                    0xEBED,
    159 	Vss_Sys_STATE_BUF_COMMAND =		  0xEBEE,
    160 	VspFenceComposeCommand =		  0xEBEF
    161 };
    162 
    163 #define VSP_CMD_QUEUE_SIZE (64)
    164 #define VSP_ACK_QUEUE_SIZE (64)
    165 
    166 /*
    167  * Command types and data structure.
    168  * Each command has a type. Depending on the type there is some kind
    169  * of data in external memory,
    170  * The VSS will use its DMA to load data from the buffer into local memory.
    171  */
    172 struct vss_command_t {
    173 	unsigned int       context;
    174 	unsigned int       type;
    175 	unsigned int       buffer;
    176 	unsigned int       size;
    177 	unsigned int       buffer_id;
    178 	unsigned int       irq;
    179 	unsigned int       reserved6;
    180 	unsigned int       reserved7;
    181 };
    182 
    183 struct vss_response_t {
    184 	unsigned int       context;
    185 	unsigned int       type;
    186 	unsigned int       buffer;
    187 	unsigned int       size;
    188 	unsigned int       vss_cc;
    189 	unsigned int       reserved5;
    190 	unsigned int       reserved6;
    191 	unsigned int       reserved7;
    192 };
    193 
    194 /* Default initial values for vsp-command and vsp-response
    195 * Using those avoids the risk of uninitialized warnings when
    196 * the definition changes.
    197 */
    198 #define VSP_COMMAND_INITIALIZER {0, 0, 0, 0, 0, 0, 0, 0}
    199 #define VSP_RESPONSE_INITIALIZER {0, 0, 0, 0, 0, 0, 0, 0}
    200 
    201 /*
    202  * Response types
    203  */
    204 enum VssResponseType {
    205 	VssIdleResponse               = 0x80010000,
    206 	VssErrorResponse              = 0x80020000,
    207 	VssEndOfSequenceResponse      = 0x80030000,
    208 	VssCommandBufferReadyResponse = 0x80040000,
    209 	VssInputSurfaceReadyResponse  = 0x80050000,
    210 	VssOutputSurfaceReadyResponse = 0x80060000,
    211 	VssVp8encSetSequenceParametersResponse = 150,
    212 	VssVp8encEncodeFrameResponse
    213 };
    214 
    215 enum VssStatus {
    216 	VssOK                         = 0x8001,
    217 	VssInvalidCommandType         = 0x8002,
    218 	VssInvalidCommandArgument     = 0x8003,
    219 	VssInvalidProcPictureCommand  = 0x8004,
    220 	VssInvalidDdrAddress          = 0x8005,
    221 	VssInvalidSequenceParameters_VP8 = 0x1,
    222 	VssInvalidPictureParameters_VP8  = 0x2,
    223 	VssContextMustBeDestroyed_VP8    = 0x3,
    224 	VssInitFailure_VP8               = 0x5,
    225 	VssCorruptFrame                  = 0x6,
    226 	VssCorruptFramecontinue_VP8      = 0x7
    227 };
    228 
    229 enum FrcResponseType {
    230 	VssOutputSurfaceFreeResponse = 0x0000F001,
    231 	VssOutputSurfaceCrcResponse  = 0x0000F002
    232 };
    233 
    234 enum vsp_format {
    235 	VSP_NV12,
    236 	VSP_YV12,
    237 	VSP_UYVY,
    238 	VSP_YUY2,
    239 	VSP_NV11,
    240 	VSP_NV16,
    241 	VSP_IYUV,
    242 	VSP_TYPE_ERROR
    243 };
    244 
    245 struct vsp_data {
    246 	unsigned int fw_state;
    247 	unsigned int uninit_req;
    248 };
    249 
    250 #define VSP_SECURE_BOOT_MAGIC_NR 0xb0070001
    251 
    252 enum vsp_processor {
    253 	vsp_sp0 = 0,
    254 	vsp_sp1 = 1,
    255 	vsp_vp0 = 2,
    256 	vsp_vp1 = 3,
    257 	vsp_mea = 4
    258 };
    259 
    260 /**
    261 * Header-data/struct by PUnit to start VSP boot-processor
    262 * This struct is mapped directly into the header of the multi-application-blob
    263 *
    264 * For each value that is to be written to the VSP, the register-address to
    265 * write to is listed directly after the value to be written.
    266 *
    267 * Entries that contain values can be written directly into the VSP-system.
    268 * Offsets need to have the secure-boot-header-address added and then be written
    269 * into the VSP
    270 *
    271 * boot_start_value should always be the last value written. (Since it starts
    272 * the VSP)
    273 */
    274 struct vsp_secure_boot_header {
    275 	/* Magic number to identify header version */
    276 	unsigned int magic_number;
    277 
    278 	/* Offset to text section of boot-program in blob */
    279 	unsigned int boot_text_offset;
    280 	/* iCache base-address of boot-processor */
    281 	unsigned int boot_text_reg;
    282 
    283 	/* Value of icache-control-bits to write to boot-processor */
    284 	unsigned int boot_icache_value;
    285 	/* status&control register of boot-processor */
    286 	unsigned int boot_icache_reg;
    287 
    288 	/* Value of program counter to write to boot-processor */
    289 	/* address of main-function in boot-program */
    290 	unsigned int boot_pc_value;
    291 	/* pc-start-register of boot-processor */
    292 	unsigned int boot_pc_reg;
    293 
    294 	/* Offset of multi-application-header in blob */
    295 	unsigned int ma_header_offset;
    296 	unsigned int ma_header_reg;
    297 
    298 	/* Value to write to start the boot-processor */
    299 	unsigned int boot_start_value;
    300 	/* status&control register of boot-processor */
    301 	unsigned int boot_start_reg;
    302 };
    303 
    304 #define VSP_MULTI_APP_MAGIC_NR 0xb10b0005
    305 /*
    306  * Note: application index/id 0 is reserved.
    307  * So the maximum number of applications is one less than listed here.
    308  * */
    309 #define VSP_MULTI_APP_MAX_APPS 16
    310 
    311 /*
    312  * With a 1MB state-buffer in IMR and a 50k context-buffer-size, we could run
    313  * * max 20 apps. Using 32 as a nice round number of maximum nr of contexts.
    314  * * Actual maximum allowed contexts is currently less, since context-buffer-size
    315  * * is larger than 50k.
    316  * */
    317 #define VSP_MULTI_APP_MAX_CONTEXTS 32
    318 #define VSP_API_GENERIC_CONTEXT_ID (0xffffffff)
    319 /*
    320  * Struct used by VSP-boot-processor to start the correct application
    321  * Read from header in firmware ma-blob.
    322  * Address of the header is communicated by p-unit.
    323  *
    324  * Note: this is a VIED internal header
    325  */
    326 struct vsp_multi_app_blob_data {
    327 	unsigned int magic_number;
    328 	unsigned int offset_from_start;
    329 	/** State buffer address in virtual memory, default location on TNG B0 and ANN
    330 	 * * is 0xA0000000 (2.5GB memory offset, master port 2, 2nd IMR region) */
    331 	unsigned int imr_state_buffer_addr;
    332 	/** Size of state-buffer in IMR (in bytes). Default state buffer size for TNG
    333 	 * * B0 and ANN is 1 MB */
    334 	unsigned int imr_state_buffer_size;
    335 	/** default context-buffer size of apps in this blob (each app also has it's
    336 	 * context-size in it's header. */
    337 	unsigned int apps_default_context_buffer_size;
    338 	/**
    339 	* Address of genboot-helper-program in blob (relative to start of this header)
    340 	*/
    341 	unsigned int genboot_helper_prog_offset;
    342 	/*
    343 	 * * This table contains a zero (offset of zero) for unused entries
    344 	 * * Offsets here are relative to the start-address of this header.
    345 	 */
    346 	unsigned int application_blob_offsets[VSP_MULTI_APP_MAX_APPS];
    347 };
    348 
    349 /*
    350  * Struct for the settings of a single context. Normally placed in an array in
    351  * the multi-app header in IMR
    352  *
    353  * Context-id is determined by the position in the array, so it is not stored in
    354  * the struct itself.
    355  *
    356  * State_buffer_size and state_buffer_addr are currently not stored, since they
    357  * can/will be determined automatically based on generic IMR parameters.
    358  *
    359  * Usage field is the last field, so that it gets written last during a memory
    360  * transfer.
    361  */
    362 struct vsp_multi_app_context_settings {
    363 	unsigned int app_id;  /* Which app this context belongs to */
    364 	unsigned int usage; /* Indicates if this context is in use */
    365 };
    366 
    367 /*
    368  * Datastructure placed at the beginning of the VSP IMR state-save region.
    369  * */
    370 struct vsp_multi_app_imr_header {
    371 	/*
    372 	 * Usage field (32-bit), set to 0 by Chaabi during system bootup, set to 1
    373 	 * by VSP if it is safe for PUnit to perform a restart without power-cycle.
    374 	 * Set to any other value by VSP if VSP is running.
    375 	 * */
    376 	unsigned int vsp_and_imr_state;
    377 	/* Reserved field for 256-bit alignment of header */
    378 	unsigned int reserved_1;
    379 	/* Reserved field for 256-bit alignment of header */
    380 	unsigned int reserved_2;
    381 	/* Reserved field for 256-bit alignment of header */
    382 	unsigned int reserved_3;
    383 	/* Reserved field for 256-bit alignment of header */
    384 	unsigned int reserved_4;
    385 	/* Reserved field for 256-bit alignment of header */
    386 	unsigned int reserved_5;
    387 	/* Reserved field for 256-bit alignment of header */
    388 	unsigned int reserved_6;
    389 	/* Reserved field for 256-bit alignment of header */
    390 	unsigned int reserved_7;
    391 	/* Settings of all active/available contexts */
    392 	struct vsp_multi_app_context_settings context_settings[VSP_MULTI_APP_MAX_CONTEXTS];
    393 };
    394 
    395 enum vsp_imr_state{
    396 	/** State when no data for VSP is initialized */
    397 	vsp_imr_uninitialized = 0,
    398 	/** State where datastructures are initialized, but no VSP is running */
    399 	vsp_imr_safe_to_resume = 1,
    400 	/** State where datastructures are initialized and VSP(-API) is running */
    401 	vsp_imr_initialized = 2,
    402 	/** State where datastructures are initialized and VSP(-APP) is running */
    403 	vsp_imr_app_is_running = 3
    404 };
    405 
    406 enum vsp_ctrl_reg_addr {
    407 	VSP_SETTING_ADDR_REG      = 3,
    408 	VSP_SECBOOT_DEBUG_REG     = 4,
    409 	VSP_ENTRY_KIND_REG        = 5,
    410 	VSP_POWER_SAVING_MODE_REG = 6,
    411 	VSP_MMU_TLB_SOFT_INVALIDATE_REG = 7,
    412 	VSP_CMD_QUEUE_RD_REG      = 12,
    413 	VSP_CMD_QUEUE_WR_REG      = 13,
    414 	VSP_ACK_QUEUE_RD_REG      = 14,
    415 	VSP_ACK_QUEUE_WR_REG      = 15
    416 };
    417 
    418 struct vsp_ctrl_reg {
    419 	unsigned int reserved_2;
    420 
    421 	/* setting address from host to firmware */
    422 	unsigned int setting_addr;
    423 
    424 	/* used for sending debug-status from firmware to host */
    425 	unsigned int secboot_debug;
    426 
    427 	/* entry type from host to firmware
    428 	 * If it contains vsp_exit, uninitialize the firmware
    429 	 */
    430 	unsigned int entry_kind;
    431 
    432 	/* set the power-saving-mode setting */
    433 	unsigned int power_saving_mode;
    434 
    435 	/* config reg to request firmware to perform an MMU TLB invalidate.
    436 	* MMU TLB invalidation for VSP on TNG needs to be done through firmware
    437 	* due to a hardware bug that could trigger if TLB invalidation is done
    438 	* while VSP DMA is not idle.
    439 	*/
    440 	unsigned int mmu_tlb_soft_invalidate;
    441 
    442 	unsigned int reserved_8;
    443 	unsigned int reserved_9;
    444 	unsigned int reserved_10;
    445 	unsigned int reserved_11;
    446 
    447 	/* used for the command and response queues */
    448 	unsigned int cmd_rd;
    449 	unsigned int cmd_wr;
    450 	unsigned int ack_rd;
    451 	unsigned int ack_wr;
    452 };
    453 
    454 /* constant parameters passed from host to firmware,
    455  * address of this struct is passed via config reg
    456  * struct is written to ddr in vsp_init call, destroyed upon uninit
    457  */
    458 struct vsp_settings_t {
    459 	/* Extra field to align to 256 bit (for DMA) */
    460 	unsigned int reserved0;
    461 	unsigned int command_queue_size;
    462 	unsigned int command_queue_addr;
    463 	unsigned int response_queue_size;
    464 	unsigned int response_queue_addr;
    465 	/* Extra field to align to 256 bit (for DMA) */
    466 	unsigned int reserved5;
    467 	/* Extra field to align to 256 bit (for DMA) */
    468 	unsigned int reserved6;
    469 	unsigned int reserved7;
    470 };
    471 
    472 /**
    473 * The host should only modify the vsp_context_settings_entry when the usage
    474 * field is vsp_context_unused or vsp_context_uninit. The host can do the
    475 * following state-transitions for the usage field:
    476 * 1) vsp_context_unused->vsp_context_starting: start a new stream/context.
    477 * After this transition, the host can submit commands into the command-queue
    478 * for the context-id associated with this vsp_context_settings entry.
    479 * 2) vsp_context_deinit->vsp_context_unused: destroy resources (free state
    480 * buffer) from the no longer needed context and mark the context as being
    481 * unused.
    482 *
    483 * The VSP will only modify the vsp_context_settings_entry when the usage
    484 * field is vsp_context_starting or vsp_context_in_use. The VSP will do the
    485 * following state-transitions for the usage field:
    486 * 3) vsp_context_starting->vsp_context_in_use: Perform initialisation of
    487 * state-buffers and other VSP-side initialisation required to start a new
    488 * stream/context. This is typically done when the first command for this
    489 * context is received from the host.
    490 * 4) vsp_context_in_use->vsp_context_deinit: Mark a context as being no longer
    491 * used by the VSP. The VSP will no longer access any resource used by this
    492 * context after this transition. This transition is done after an
    493 * end-of-stream response or similar response to the host to indicate that an
    494 * application finished for a specific context.
    495 */
    496 enum vsp_context_usage {
    497 	vsp_context_unused   = 0,
    498 	vsp_context_deinit   = 1,
    499 	vsp_context_starting = 16,
    500 	vsp_context_in_use   = 17
    501 };
    502 
    503 /* default initializer to initialize vsp_settings struct
    504  * (including the extra alignment fields)
    505  */
    506 #define VSP_SETTINGS_INITIALIZER {0, 0, 0, 0, 0, 0, 0, 0}
    507 
    508 /* values passed via VSP_ENTRY_TYPE_REG
    509  * vsp_entry_booted is the default value, it means no init or resume has been
    510  * communicated by the host yet.
    511  * vsp_entry_init and vsp_entry_resume are used for initial starting of the
    512  * system and for resuming after a suspend/power-down.
    513 */
    514 enum vsp_entry_kind {
    515 	vsp_entry_booted   = 0,
    516 	vsp_entry_init     = 1,
    517 	vsp_entry_resume   = 2,
    518 	vsp_exit           = 3
    519 };
    520 
    521 /* values passed via VSP_POWER_SAVING_MODE_REG */
    522 enum vsp_power_saving_mode {
    523 	vsp_always_on              = 0,
    524 	vsp_suspend_on_empty_queue = 1,
    525 	vsp_hw_idle_on_empty_queue = 2,
    526 	vsp_suspend_and_hw_idle_on_empty_queue
    527 };
    528 
    529 /****************************
    530  * VP8enc data structures
    531  ****************************/
    532 
    533 /**
    534  * Picture data structure. Currently the same as frc
    535  */
    536 struct VssProcPictureVP8 {
    537 	uint32_t surface_id;
    538 	uint32_t irq;  /* send interupt when input or output surface is ready */
    539 	uint32_t base; /* pointer to luma picture in DDR */
    540 	uint32_t base_uv; /* pointer to chroma picture in DDR */
    541 	uint32_t height;
    542 	uint32_t width;
    543 	uint32_t stride;
    544 	uint32_t format; /* frame raw format */
    545 };
    546 
    547 /**
    548  * Enumeration for recon_buffer_mode
    549  */
    550 typedef enum {
    551 	vss_vp8enc_seq_param_recon_buffer_mode_per_seq = 0, /* send 4 ref/recon frame buffers at seq lvl */
    552 	vss_vp8enc_seq_param_recon_buffer_mode_per_pic,     /* send 1 recon frame buffer per picture */
    553 	vss_vp8enc_seq_param_recon_buffer_mode_cnt          /* nr of modes */
    554 } vss_vp8enc_seq_param_recon_buffer_mode_t;
    555 
    556 /**
    557  * Sequence parameter data structure.
    558  */
    559 struct VssVp8encSequenceParameterBuffer {
    560 	uint32_t frame_width;
    561 	uint32_t frame_height;
    562 	uint32_t frame_rate;
    563 	uint32_t error_resilient;
    564 	uint32_t num_token_partitions;
    565 	uint32_t kf_mode;
    566 	uint32_t kf_min_dist;
    567 	uint32_t kf_max_dist;
    568 	uint32_t rc_target_bitrate;
    569 	uint32_t rc_min_quantizer;
    570 	uint32_t rc_max_quantizer;
    571 	uint32_t rc_undershoot_pct;
    572 	uint32_t rc_overshoot_pct;
    573 	uint32_t rc_end_usage;
    574 	uint32_t rc_buf_sz;
    575 	uint32_t rc_buf_initial_sz;
    576 	uint32_t rc_buf_optimal_sz;
    577 	uint32_t max_intra_rate;
    578 	uint32_t cyclic_intra_refresh;
    579 	uint32_t concatenate_partitions;
    580 	uint32_t recon_buffer_mode;
    581 	uint32_t ts_number_layers;
    582 	uint32_t ts_target_bitrate[3];
    583 	uint32_t ts_rate_decimator[3];
    584 	uint32_t ts_periodicity;
    585 	uint8_t ts_layer_id[32];
    586 	struct VssProcPictureVP8 ref_frame_buffers[4];
    587 };
    588 
    589 struct VssVp8encEncodedFrame {
    590 	uint32_t frame_size;
    591 	uint32_t status;
    592 	uint32_t partitions;
    593 	uint32_t partition_size[9];
    594 	uint32_t partition_start[9];
    595 	uint32_t segments;
    596 	uint32_t quantizer[4];
    597 	uint32_t frame_flags;
    598 	uint32_t partition_id;
    599 	uint32_t buffer_level;
    600 	uint32_t quality;
    601 	uint32_t surfaceId_of_ref_frame[4];
    602 	uint32_t reserved[15];
    603 	uint32_t coded_data[1];
    604 };
    605 
    606 /**
    607  * Encode frame command buffer
    608  */
    609 struct VssVp8encPictureParameterBuffer {
    610 	struct VssProcPictureVP8 input_frame;
    611 	struct VssProcPictureVP8 recon_frame;
    612 
    613 	uint32_t version;
    614 	uint32_t pic_flags;
    615 	uint32_t prev_frame_dropped;
    616 	uint32_t cpuused;
    617 	uint32_t sharpness;
    618 	uint32_t num_token_partitions;
    619 	uint32_t encoded_frame_size;
    620 	uint32_t encoded_frame_base;
    621 };
    622 
    623 /**
    624  * Command enumeration
    625  */
    626 enum VssVp8encCommandType {
    627 	VssVp8encSetSequenceParametersCommand = 123,
    628 	VssVp8encEncodeFrameCommand,
    629 	VssVp8encEndOfSequenceCommand,
    630 	VssVp8encInit,
    631 	Vss_Sys_Ref_Frame_COMMAND
    632 };
    633 
    634 /*
    635  * Generic VSP commands
    636  *
    637  * Generic VSP commands should be sent with the context field set to
    638  * VSP_API_GENERIC_CONTEXT_ID.
    639  */
    640 enum VssGenCommandType {
    641 	/** Generic command to instruct the VSP to (create and) initialize a context.
    642 	 * * The buffer field contains the context-id of the new context to initialize.
    643 	 * The size-field contains the app-id for the new context to initialize
    644 	 */
    645 	VssGenInitializeContext       = 0xab01,
    646 	/** Generic command to instruct the VSP to de-initialize and destroy a
    647 	 * context. The buffer field contains the context-id of the context to
    648 	 * de-initialize and destroy. The size-field should always be set to 0.
    649 	 */
    650 	VssGenDestroyContext          = 0xab02
    651 };
    652 
    653 /****************************
    654  * WiDi Compose data structures
    655  ****************************/
    656 enum VssWiDi_ComposeCommandType {
    657 	VssWiDi_ComposeSetSequenceParametersCommand = 200,
    658 	VssWiDi_ComposeFrameCommand,
    659 	VssWiDi_ComposeEndOfSequenceCommand
    660 };
    661 
    662 enum VssWiDi_ComposeResponseType {
    663 	VssWiDi_ComposeSetSequenceParametersResponse = 250,
    664 	VssWiDi_ComposeFrameResponse,
    665 };
    666 
    667 enum VssWiDi_ColorFormat {
    668 	MonoChrome = 0,
    669 	YUV_4_2_0,
    670 	YUV_4_2_0_NV12,
    671 	YUV_4_2_2,
    672 	YUV_4_4_4
    673 };
    674 /**
    675  * WiDi Compose sequence parameter data structure.
    676  */
    677 struct VssWiDi_ComposeSequenceParameterBuffer {
    678 	unsigned int R_Buffer;
    679 	unsigned int G_Buffer;
    680 	unsigned int B_Buffer;
    681 	unsigned int RGBA_Buffer;
    682 	unsigned int Y_Buffer;
    683 	unsigned int UV_Buffer;
    684 	unsigned int U_Buffer;
    685 	unsigned int V_Buffer;
    686 	unsigned int A_Buffer;
    687 	int ActualWidth;
    688 	int ActualHeight;
    689 	int ProcessedWidth;
    690 	int ProcessedHeight;
    691 	int TotalMBCount;
    692 	int Stride;
    693 	/*Video related*/
    694 	int Video_IN_xsize;
    695 	int Video_IN_ysize;
    696 	int Video_IN_stride;
    697 	int Video_IN_yuv_format;
    698 
    699 	unsigned int Video_IN_Y_Buffer;
    700 	unsigned int Video_IN_UV_Buffer;
    701         unsigned int Video_IN_U_Buffer;
    702 	unsigned int Video_IN_V_Buffer;
    703 	int Video_OUT_xsize;
    704 	int Video_OUT_ysize;
    705 	int Video_OUT_stride;
    706 	int Video_OUT_yuv_format;
    707 
    708 	unsigned int Video_OUT_Y_Buffer;
    709 	unsigned int Video_OUT_UV_Buffer;
    710 	unsigned int Video_OUT_V_Buffer;
    711 
    712 	unsigned int scaled_width;
    713 	unsigned int scaled_height;
    714 	unsigned int scalefactor_dx;
    715 	unsigned int scalefactor_dy;
    716 
    717 	/*Blending related params*/
    718 	int Is_Blending_Enabled;
    719 	int ROI_width;
    720 	int ROI_height;
    721 	int ROI_x1;
    722 	int ROI_y1;
    723 	int ROI_x2;
    724 	int ROI_y2;
    725 	int alpha1;
    726 	int alpha2;
    727 	int Is_video_the_back_ground;
    728 	int Is_source_1_image_available;
    729 	int Is_source_2_image_available;
    730 	int Is_alpha_channel_available;
    731 	int Video_TotalMBCount;
    732 	int CSC_FormatSelect; /* 0: YUV420NV12; 1: YUV444; */
    733 	int CSC_InputFormatSelect; // 0: RGB Planar; 1: RGBA Interleaved
    734 };
    735 
    736 #pragma pack()
    737 #endif
    738