This is picked up from that on Haswell/Ivybridge.
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
static void
gen8_render_upload_constants(VADriverContextP ctx,
- struct object_surface *obj_surface)
+ struct object_surface *obj_surface,
+ unsigned int flags)
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct i965_render_state *render_state = &i965->render_state;
float brightness = (float)i965->brightness_attrib->value / 255; /* YUV is float in the shader */
float hue = (float)i965->hue_attrib->value / 180 * PI;
float saturation = (float)i965->saturation_attrib->value / DEFAULT_SATURATION;
+ float *yuv_to_rgb;
+ unsigned int color_flag;
dri_bo_map(render_state->dynamic_state.bo, 1);
assert(render_state->dynamic_state.bo->virtual);
*color_balance_base++ = cos(hue) * contrast * saturation;
*color_balance_base++ = sin(hue) * contrast * saturation;
+ color_flag = flags & VA_SRC_COLOR_MASK;
+ yuv_to_rgb = (float *)constant_buffer + 8;
+ if (color_flag == VA_SRC_BT709)
+ memcpy(yuv_to_rgb, yuv_to_rgb_bt709, sizeof(yuv_to_rgb_bt709));
+ else if (color_flag == VA_SRC_SMPTE_240)
+ memcpy(yuv_to_rgb, yuv_to_rgb_smpte_240, sizeof(yuv_to_rgb_smpte_240));
+ else
+ memcpy(yuv_to_rgb, yuv_to_rgb_bt601, sizeof(yuv_to_rgb_bt601));
+
dri_bo_unmap(render_state->dynamic_state.bo);
}
gen8_render_cc_viewport(ctx);
gen8_render_color_calc_state(ctx);
gen8_render_blend_state(ctx);
- gen8_render_upload_constants(ctx, obj_surface);
+ gen8_render_upload_constants(ctx, obj_surface, flags);
i965_render_upload_vertex(ctx, obj_surface, src_rect, dst_rect);
}
BEGIN_BATCH(batch, 11);
OUT_BATCH(batch, GEN6_3DSTATE_CONSTANT_PS | (11 - 2));
- OUT_BATCH(batch, 1);
+ OUT_BATCH(batch, URB_CS_ENTRY_SIZE);
OUT_BATCH(batch, 0);
/*DW3-4. Constant buffer 0 */
OUT_BATCH(batch, render_state->curbe_offset);
define(`bl', `g2.0<8,8,1>F')
define(`bh', `g4.0<8,8,1>F')
-define(`a0_a_x',`g7.0<0,1,0>F')
-define(`a0_a_y',`g7.16<0,1,0>F')
/* U */
pln (8) ul<1>F a0_a_x bl { align1 }; /* pixel 0-7 */
- { 0x0060005a, 0x28403ae8, 0x3a0000e0, 0x008d0040 },
- { 0x0060005a, 0x28603ae8, 0x3a0000e0, 0x008d0080 },
- { 0x0060005a, 0x28803ae8, 0x3a0000f0, 0x008d0040 },
- { 0x0060005a, 0x28a03ae8, 0x3a0000f0, 0x008d0080 },
+ { 0x0060005a, 0x28403ae8, 0x3a000140, 0x008d0040 },
+ { 0x0060005a, 0x28603ae8, 0x3a000140, 0x008d0080 },
+ { 0x0060005a, 0x28803ae8, 0x3a000150, 0x008d0040 },
+ { 0x0060005a, 0x28a03ae8, 0x3a000150, 0x008d0080 },
*/
include(`exa_wm.g4i')
-
-define(`YCbCr_base', `src_sample_base')
-
-define(`Cr', `src_sample_b')
-define(`Cr_01', `src_sample_b_01')
-define(`Cr_23', `src_sample_b_23')
-
-define(`Y', `src_sample_r')
-define(`Y_01', `src_sample_r_01')
-define(`Y_23', `src_sample_r_23')
-
-define(`Cb', `src_sample_g')
-define(`Cb_01', `src_sample_g_01')
-define(`Cb_23', `src_sample_g_23')
-
-define(`Crn', `mask_sample_g')
-define(`Crn_01', `mask_sample_g_01')
-define(`Crn_23', `mask_sample_g_23')
-
-define(`Yn', `mask_sample_r')
-define(`Yn_01', `mask_sample_r_01')
-define(`Yn_23', `mask_sample_r_23')
-
-define(`Cbn', `mask_sample_b')
-define(`Cbn_01', `mask_sample_b_01')
-define(`Cbn_23', `mask_sample_b_23')
-
- /* color space conversion function:
- * R = Clamp ( 1.164(Y-16/255) + 1.596(Cr-128/255), 0, 1)
- * G = Clamp ( 1.164(Y-16/255) - 0.813(Cr-128/255) - 0.392(Cb-128/255), 0, 1)
- * B = Clamp ( 1.164(Y-16/255) + 2.017(Cb-128/255), 0, 1)
- */
-
- /* Normalize Y, Cb and Cr:
- *
- * Yn = (Y - 16/255) * 1.164
- * Crn = Cr - 128 / 255
- * Cbn = Cb - 128 / 255
- */
-add (16) Yn<1>F Y<8;8,1>F -0.0627451F { compr align1 };
-mul (16) Yn<1>F Yn<8;8,1>F 1.164F { compr align1 };
-
-add (16) Crn<1>F Cr<8;8,1>F -0.501961F { compr align1 };
-
-add (16) Cbn<1>F Cb<8;8,1>F -0.501961F { compr align1 };
-
- /*
- * R = Y + Cr * 1.596
- */
-mov (8) acc0<1>F Yn_01.0<8;8,1>F { align1 };
-mac.sat(8) src_sample_r_01<1>F Crn_01<8;8,1>F 1.596F { align1 };
-mov (8) acc0<1>F Yn_23.0<8;8,1>F { align1 };
-mac.sat(8) src_sample_r_23<1>F Crn_23<8;8,1>F 1.596F { align1 };
-
- /*
- * G = Crn * -0.813 + Cbn * -0.392 + Y
- */
-mov (8) acc0<1>F Yn_01.0<8;8,1>F { align1 };
-mac (8) acc0<1>F Crn_01.0<8;8,1>F -0.813F { align1 };
-mac.sat(8) src_sample_g_01<1>F Cbn_01.0<8;8,1>F -0.392F { align1 };
-mov (8) acc0<1>F Yn_23.0<8;8,1>F { align1 };
-mac (8) acc0<1>F Crn_23.0<8;8,1>F -0.813F { align1 };
-mac.sat(8) src_sample_g_23<1>F Cbn_23.0<8;8,1>F -0.392F { align1 };
-
- /*
- * B = Cbn * 2.017 + Y
- */
-mov (8) acc0<1>F Yn_01.0<8;8,1>F { align1 };
-mac.sat(8) src_sample_b_01<1>F Cbn_01.0<8;8,1>F 2.017F { align1 };
-
-mov (8) acc0<1>F Yn_23.0<8;8,1>F { align1 };
-mac.sat(8) src_sample_b_23<1>F Cbn_23.0<8;8,1>F 2.017F { align1 };
- /*
- * A = 1.0
- */
-mov (16) src_sample_a<1>F 1.0F { compr align1 };
+include(`exa_yuv_gen6.g4i')
+include(`exa_yuv_rgb.gxa')
- { 0x00800040, 0x22c03ae8, 0x3e8d01c0, 0xbd808081 },
- { 0x00800041, 0x22c03ae8, 0x3e8d02c0, 0x3f94fdf4 },
- { 0x00800040, 0x23003ae8, 0x3e8d0240, 0xbf008084 },
- { 0x00800040, 0x23403ae8, 0x3e8d0200, 0xbf008084 },
- { 0x00600001, 0x24003ae0, 0x008d02c0, 0x00000000 },
- { 0x80600048, 0x21c03ae8, 0x3e8d0300, 0x3fcc49ba },
- { 0x00600001, 0x24003ae0, 0x008d02e0, 0x00000000 },
- { 0x80600048, 0x21e03ae8, 0x3e8d0320, 0x3fcc49ba },
- { 0x00600001, 0x24003ae0, 0x008d02c0, 0x00000000 },
- { 0x00600048, 0x24003ae0, 0x3e8d0300, 0xbf5020c5 },
- { 0x80600048, 0x22003ae8, 0x3e8d0340, 0xbec8b439 },
- { 0x00600001, 0x24003ae0, 0x008d02e0, 0x00000000 },
- { 0x00600048, 0x24003ae0, 0x3e8d0320, 0xbf5020c5 },
- { 0x80600048, 0x22203ae8, 0x3e8d0360, 0xbec8b439 },
- { 0x00600001, 0x24003ae0, 0x008d02c0, 0x00000000 },
- { 0x80600048, 0x22403ae8, 0x3e8d0340, 0x40011687 },
- { 0x00600001, 0x24003ae0, 0x008d02e0, 0x00000000 },
- { 0x80600048, 0x22603ae8, 0x3e8d0360, 0x40011687 },
+ { 0x00800040, 0x22c03ae8, 0x3a8d01c0, 0x000000ec },
+ { 0x00800040, 0x23003ae8, 0x3a8d0200, 0x000000fc },
+ { 0x00800040, 0x23403ae8, 0x3a8d0240, 0x0000010c },
+ { 0x00800041, 0x24003ae0, 0x3a8d02c0, 0x000000e0 },
+ { 0x00800048, 0x24003ae0, 0x3a8d0300, 0x000000e4 },
+ { 0x80800048, 0x21c03ae8, 0x3a8d0340, 0x000000e8 },
+ { 0x00800041, 0x24003ae0, 0x3a8d02c0, 0x000000f0 },
+ { 0x00800048, 0x24003ae0, 0x3a8d0300, 0x000000f4 },
+ { 0x80800048, 0x22003ae8, 0x3a8d0340, 0x000000f8 },
+ { 0x00800041, 0x24003ae0, 0x3a8d02c0, 0x00000100 },
+ { 0x00800048, 0x24003ae0, 0x3a8d0300, 0x00000104 },
+ { 0x80800048, 0x22403ae8, 0x3a8d0340, 0x00000108 },
{ 0x00800001, 0x22803ee8, 0x38000000, 0x3f800000 },