#include "i965_render.h"
#include "intel_media.h"
-#define HAS_PP(ctx) (IS_IRONLAKE((ctx)->intel.device_id) || \
- IS_GEN6((ctx)->intel.device_id) || \
- IS_GEN7((ctx)->intel.device_id) || \
- IS_GEN8((ctx)->intel.device_id))
+#define HAS_PP(ctx) (IS_IRONLAKE((ctx)->intel.device_info) || \
+ IS_GEN6((ctx)->intel.device_info) || \
+ IS_GEN7((ctx)->intel.device_info) || \
+ IS_GEN8((ctx)->intel.device_info))
#define SURFACE_STATE_PADDED_SIZE SURFACE_STATE_PADDED_SIZE_GEN8
struct object_image *obj_image;
dri_bo *bo;
int fourcc = pp_get_surface_fourcc(ctx, surface);
- const int U = (fourcc == VA_FOURCC('Y', 'V', '1', '2') ||
- fourcc == VA_FOURCC('I', 'M', 'C', '1')) ? 2 : 1;
- const int V = (fourcc == VA_FOURCC('Y', 'V', '1', '2') ||
- fourcc == VA_FOURCC('I', 'M', 'C', '1')) ? 1 : 2;
- int interleaved_uv = fourcc == VA_FOURCC('N', 'V', '1', '2');
- int packed_yuv = (fourcc == VA_FOURCC('Y', 'U', 'Y', '2') || fourcc == VA_FOURCC('U', 'Y', 'V', 'Y'));
- int rgbx_format = (fourcc == VA_FOURCC('R', 'G', 'B', 'A') ||
- fourcc == VA_FOURCC('R', 'G', 'B', 'X') ||
- fourcc == VA_FOURCC('B', 'G', 'R', 'A') ||
- fourcc == VA_FOURCC('B', 'G', 'R', 'X'));
+ const int U = (fourcc == VA_FOURCC_YV12 ||
+ fourcc == VA_FOURCC_YV16 ||
+ fourcc == VA_FOURCC_IMC1) ? 2 : 1;
+ const int V = (fourcc == VA_FOURCC_YV12 ||
+ fourcc == VA_FOURCC_YV16 ||
+ fourcc == VA_FOURCC_IMC1) ? 1 : 2;
+ int interleaved_uv = fourcc == VA_FOURCC_NV12;
+ int packed_yuv = (fourcc == VA_FOURCC_YUY2 || fourcc == VA_FOURCC_UYVY);
+ int rgbx_format = (fourcc == VA_FOURCC_RGBA ||
+ fourcc == VA_FOURCC_RGBX ||
+ fourcc == VA_FOURCC_BGRA ||
+ fourcc == VA_FOURCC_BGRX);
if (surface->type == I965_SURFACE_TYPE_SURFACE) {
obj_surface = (struct object_surface *)surface->base;
height[2] = obj_image->image.height / 2;
pitch[2] = obj_image->image.pitches[V];
offset[2] = obj_image->image.offsets[V];
+ if (fourcc == VA_FOURCC_YV16 || fourcc == VA_FOURCC_422H) {
+ width[1] = obj_image->image.width / 2;
+ height[1] = obj_image->image.height;
+ width[2] = obj_image->image.width / 2;
+ height[2] = obj_image->image.height;
+ }
}
}
struct gen7_pp_static_parameter *pp_static_parameter = pp_context->pp_static_parameter;
/* the format is MSB: X-B-G-R */
pp_static_parameter->grf2.save_avs_rgb_swap = 0;
- if ((fourcc == VA_FOURCC('B', 'G', 'R', 'A')) ||
- (fourcc == VA_FOURCC('B', 'G', 'R', 'X'))) {
+ if ((fourcc == VA_FOURCC_BGRA) ||
+ (fourcc == VA_FOURCC_BGRX)) {
/* It is stored as MSB: X-R-G-B */
pp_static_parameter->grf2.save_avs_rgb_swap = 1;
}
int format0 = SURFACE_FORMAT_Y8_UNORM;
switch (fourcc) {
- case VA_FOURCC('Y', 'U', 'Y', '2'):
+ case VA_FOURCC_YUY2:
format0 = SURFACE_FORMAT_YCRCB_NORMAL;
break;
- case VA_FOURCC('U', 'Y', 'V', 'Y'):
+ case VA_FOURCC_UYVY:
format0 = SURFACE_FORMAT_YCRCB_SWAPY;
break;
/* Only R8G8B8A8_UNORM is supported for BGRX or RGBX */
format0 = SURFACE_FORMAT_R8G8B8A8_UNORM;
pp_static_parameter->grf2.src_avs_rgb_swap = 0;
- if ((fourcc == VA_FOURCC('B', 'G', 'R', 'A')) ||
- (fourcc == VA_FOURCC('B', 'G', 'R', 'X'))) {
+ if ((fourcc == VA_FOURCC_BGRA) ||
+ (fourcc == VA_FOURCC_BGRX)) {
pp_static_parameter->grf2.src_avs_rgb_swap = 1;
}
}
struct gen7_pp_static_parameter *pp_static_parameter = pp_context->pp_static_parameter;
int fourcc = pp_get_surface_fourcc(ctx, surface);
- if (fourcc == VA_FOURCC('Y', 'U', 'Y', '2')) {
+ if (fourcc == VA_FOURCC_YUY2) {
pp_static_parameter->grf2.di_destination_packed_y_component_offset = 0;
pp_static_parameter->grf2.di_destination_packed_u_component_offset = 1;
pp_static_parameter->grf2.di_destination_packed_v_component_offset = 3;
- } else if (fourcc == VA_FOURCC('U', 'Y', 'V', 'Y')) {
+ } else if (fourcc == VA_FOURCC_UYVY) {
pp_static_parameter->grf2.di_destination_packed_y_component_offset = 1;
pp_static_parameter->grf2.di_destination_packed_u_component_offset = 0;
pp_static_parameter->grf2.di_destination_packed_v_component_offset = 2;
pp_static_parameter->grf2.avs_wa_width = src_width;
pp_static_parameter->grf2.avs_wa_one_div_256_width = (float) 1.0 / (256 * src_width);
pp_static_parameter->grf2.avs_wa_five_div_256_width = (float) 5.0 / (256 * src_width);
+ pp_static_parameter->grf2.alpha = 255;
pp_static_parameter->grf3.sampler_load_horizontal_scaling_step_ratio = (float) pp_avs_context->src_w / dw;
pp_static_parameter->grf4.sampler_load_vertical_scaling_step = (float) src_rect->height / src_height / dst_rect->height;
struct i965_driver_data *i965 = i965_driver_data(ctx);
int param_size = 64;
- if (IS_GEN8(i965->intel.device_id))
+ if (IS_GEN8(i965->intel.device_info))
param_size = sizeof(struct gen7_pp_static_parameter);
BEGIN_BATCH(batch, 4);
unsigned int *command_ptr;
param_size = sizeof(struct gen7_pp_inline_parameter);
- if (IS_GEN8(i965->intel.device_id))
+ if (IS_GEN8(i965->intel.device_info))
param_size = sizeof(struct gen7_pp_inline_parameter);
x_steps = pp_context->pp_x_steps(pp_context->private_context);
dri_bo_unmap(command_buffer);
- if (IS_GEN8(i965->intel.device_id)) {
+ if (IS_GEN8(i965->intel.device_info)) {
BEGIN_BATCH(batch, 3);
OUT_BATCH(batch, MI_BATCH_BUFFER_START | (1 << 8) | (1 << 0));
OUT_RELOC(batch, command_buffer,
return va_status;
}
-void
+static void
gen8_post_processing_context_finalize(struct i965_post_processing_context *pp_context)
{
dri_bo_unreference(pp_context->surface_state_binding_table.bo);
void
gen8_post_processing_context_init(VADriverContextP ctx,
- struct i965_post_processing_context *pp_context,
+ void *data,
struct intel_batchbuffer *batch)
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
unsigned int kernel_offset, end_offset;
unsigned char *kernel_ptr;
struct pp_module *pp_module;
+ struct i965_post_processing_context *pp_context = data;
{
pp_context->vfe_gpu_state.max_num_threads = 60;
}
pp_context->intel_post_processing = gen8_post_processing;
+ pp_context->finalize = gen8_post_processing_context_finalize;
assert(NUM_PP_MODULES == ARRAY_ELEMS(pp_modules_gen8));
- if (IS_GEN8(i965->intel.device_id))
+ if (IS_GEN8(i965->intel.device_info))
memcpy(pp_context->pp_modules, pp_modules_gen8, sizeof(pp_context->pp_modules));
else {
/* should never get here !!! */
dri_bo_unmap(pp_context->instruction_state.bo);
/* static & inline parameters */
- if (IS_GEN8(i965->intel.device_id)) {
+ if (IS_GEN8(i965->intel.device_info)) {
pp_context->pp_static_parameter = calloc(sizeof(struct gen7_pp_static_parameter), 1);
pp_context->pp_inline_parameter = calloc(sizeof(struct gen7_pp_inline_parameter), 1);
}