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 generate_skip_frames;
    582 	uint32_t max_num_dropped_frames;
    583 	uint32_t ts_number_layers;
    584 	uint32_t ts_target_bitrate[3];
    585 	uint32_t ts_rate_decimator[3];
    586 	uint32_t ts_periodicity;
    587 	uint8_t ts_layer_id[32];
    588 	struct VssProcPictureVP8 ref_frame_buffers[4];
    589 };
    590 
    591 struct VssVp8encEncodedFrame {
    592 	uint32_t frame_size;
    593 	uint32_t status;
    594 	uint32_t partitions;
    595 	uint32_t partition_size[9];
    596 	uint32_t partition_start[9];
    597 	uint32_t segments;
    598 	uint32_t quantizer[4];
    599 	uint32_t frame_flags;
    600 	uint32_t partition_id;
    601 	uint32_t buffer_level[3];
    602 	uint32_t quality;
    603 	uint32_t overflow_bytes;
    604 	uint32_t surfaceId_of_ref_frame[4];
    605 	uint32_t reserved[15];
    606 	uint32_t coded_data[1];
    607 };
    608 
    609 /**
    610  * Encode frame command buffer
    611  */
    612 struct VssVp8encPictureParameterBuffer {
    613 	struct VssProcPictureVP8 input_frame;
    614 	struct VssProcPictureVP8 recon_frame;
    615 
    616 	uint32_t version;
    617 	uint32_t pic_flags;
    618 	uint32_t prev_frame_dropped;
    619 	uint32_t cpuused;
    620 	uint32_t sharpness;
    621 	uint32_t num_token_partitions;
    622 	uint32_t encoded_frame_size;
    623 	uint32_t encoded_frame_base;
    624 };
    625 
    626 /**
    627  * Command enumeration
    628  */
    629 enum VssVp8encCommandType {
    630 	VssVp8encSetSequenceParametersCommand = 123,
    631 	VssVp8encEncodeFrameCommand,
    632 	VssVp8encEndOfSequenceCommand,
    633 	VssVp8encInit,
    634 	Vss_Sys_Ref_Frame_COMMAND
    635 };
    636 
    637 /*
    638  * Generic VSP commands
    639  *
    640  * Generic VSP commands should be sent with the context field set to
    641  * VSP_API_GENERIC_CONTEXT_ID.
    642  */
    643 enum VssGenCommandType {
    644 	/** Generic command to instruct the VSP to (create and) initialize a context.
    645 	 * * The buffer field contains the context-id of the new context to initialize.
    646 	 * The size-field contains the app-id for the new context to initialize
    647 	 */
    648 	VssGenInitializeContext       = 0xab01,
    649 	/** Generic command to instruct the VSP to de-initialize and destroy a
    650 	 * context. The buffer field contains the context-id of the context to
    651 	 * de-initialize and destroy. The size-field should always be set to 0.
    652 	 */
    653 	VssGenDestroyContext          = 0xab02
    654 };
    655 
    656 /****************************
    657  * WiDi Compose data structures
    658  ****************************/
    659 enum VssWiDi_ComposeCommandType {
    660 	VssWiDi_ComposeSetSequenceParametersCommand = 200,
    661 	VssWiDi_ComposeFrameCommand,
    662 	VssWiDi_ComposeEndOfSequenceCommand
    663 };
    664 
    665 enum VssWiDi_ComposeResponseType {
    666 	VssWiDi_ComposeSetSequenceParametersResponse = 250,
    667 	VssWiDi_ComposeFrameResponse,
    668 };
    669 
    670 enum VssWiDi_ColorFormat {
    671 	MonoChrome = 0,
    672 	YUV_4_2_0,
    673 	YUV_4_2_0_NV12,
    674 	YUV_4_2_2,
    675 	YUV_4_4_4
    676 };
    677 /**
    678  * WiDi Compose sequence parameter data structure.
    679  */
    680 struct VssWiDi_ComposeSequenceParameterBuffer {
    681 	unsigned int R_Buffer;
    682 	unsigned int G_Buffer;
    683 	unsigned int B_Buffer;
    684 	unsigned int RGBA_Buffer;
    685 	unsigned int Y_Buffer;
    686 	unsigned int UV_Buffer;
    687 	unsigned int U_Buffer;
    688 	unsigned int V_Buffer;
    689 	unsigned int A_Buffer;
    690 	int ActualWidth;
    691 	int ActualHeight;
    692 	int ProcessedWidth;
    693 	int ProcessedHeight;
    694 	int TotalMBCount;
    695 	int Stride;
    696 	/*Video related*/
    697 	int Video_IN_xsize;
    698 	int Video_IN_ysize;
    699 	int Video_IN_stride;
    700 	int Video_IN_yuv_format;
    701 
    702 	unsigned int Video_IN_Y_Buffer;
    703 	unsigned int Video_IN_UV_Buffer;
    704         unsigned int Video_IN_U_Buffer;
    705 	unsigned int Video_IN_V_Buffer;
    706 	int Video_OUT_xsize;
    707 	int Video_OUT_ysize;
    708 	int Video_OUT_stride;
    709 	int Video_OUT_yuv_format;
    710 
    711 	unsigned int Video_OUT_Y_Buffer;
    712 	unsigned int Video_OUT_UV_Buffer;
    713 	unsigned int Video_OUT_V_Buffer;
    714 
    715 	unsigned int scaled_width;
    716 	unsigned int scaled_height;
    717 	unsigned int scalefactor_dx;
    718 	unsigned int scalefactor_dy;
    719 
    720 	/*Blending related params*/
    721 	int Is_Blending_Enabled;
    722 	int ROI_width;
    723 	int ROI_height;
    724 	int ROI_x1;
    725 	int ROI_y1;
    726 	int ROI_x2;
    727 	int ROI_y2;
    728 	int alpha1;
    729 	int alpha2;
    730 	int Is_video_the_back_ground;
    731 	int Is_source_1_image_available;
    732 	int Is_source_2_image_available;
    733 	int Is_alpha_channel_available;
    734 	int Video_TotalMBCount;
    735 	int CSC_FormatSelect; /* 0: YUV420NV12; 1: YUV444; */
    736 	int CSC_InputFormatSelect; // 0: RGB Planar; 1: RGBA Interleaved
    737 };
    738 
    739 #pragma pack()
    740 #endif
    741