Skip to content

i965/drv: Move to per-gen HW format queries #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ TAGS
.VERSION*
# IRQL fork
.vscode/c_cpp_properties.json
.vscode/settings.json
86 changes: 86 additions & 0 deletions src/gen6_mfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1964,3 +1964,89 @@ gen6_dec_hw_context_init(VADriverContextP ctx, struct object_config *obj_config)

return (struct hw_context *)gen6_mfd_context;
}

void gen6_get_hw_formats(VADriverContextP ctx, struct object_config *obj_config,
struct i965_driver_data* data, int *i, VASurfaceAttrib *attribs)
{
switch (obj_config->entrypoint)
{
case VAEntrypointVLD:
{
attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_NV12;
(*i)++;

break;
}

case VAEntrypointVideoProc:
{
attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_YUY2;
(*i)++;

/**
* Previously the driver claimed to support RGBA on SNB,
* this however isn't true since the conversion shader does
* NOT support the alpha channel.
*
* This also applies to BGRA and ARGB which would mean that
* we need to use a workaround shader to make it possible
* to use these formats.
*/

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_RGBX;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_BGRA;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_ARGB;
(*i)++;

FALLTHROUGH;
}

case VAEntrypointEncSlice:
{
attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_NV12;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_I420;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_YV12;
(*i)++;

break;
}

default:
{
i965_log_debug(ctx, "gen6_get_hw_formats: Ignoring unknown entrypoint %#010x\n", obj_config->entrypoint);
break;
}
}
}
181 changes: 181 additions & 0 deletions src/gen7_mfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3239,3 +3239,184 @@ gen7_dec_hw_context_init(VADriverContextP ctx, struct object_config *obj_config)
gen7_mfd_context->driver_context = ctx;
return (struct hw_context *)gen7_mfd_context;
}

static inline void gen7_get_hw_dec_formats(VADriverContextP ctx, struct object_config *obj_config,
struct i965_driver_data* data, int *i, VASurfaceAttrib *attribs)
{
switch (obj_config->profile)
{
case VAProfileJPEGBaseline:
{
attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_IMC3;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_IMC1;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_Y800;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_411P;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_422H;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_422V;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_444P;
(*i)++;

break;
}

default:
{
attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_NV12;
(*i)++;

break;
}
}
}

static inline void gen7_get_hw_enc_formats(VADriverContextP ctx, struct object_config *obj_config,
struct i965_driver_data* data, int *i, VASurfaceAttrib *attribs)
{
attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_NV12;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_I420;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_YV12;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_IMC3;
(*i)++;
}

static inline void gen7_get_hw_vpp_formats(VADriverContextP ctx, struct object_config *obj_config,
struct i965_driver_data* data, int *i, VASurfaceAttrib *attribs)
{
attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_RGBA;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_RGBX;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_BGRA;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_BGRX;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_ARGB;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_YUY2;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_UYVY;
(*i)++;

attribs[*i].type = VASurfaceAttribPixelFormat;
attribs[*i].value.type = VAGenericValueTypeInteger;
attribs[*i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
attribs[*i].value.value.i = VA_FOURCC_YV16;
(*i)++;
}

void gen7_get_hw_formats(VADriverContextP ctx, struct object_config *obj_config,
struct i965_driver_data* data, int *i, VASurfaceAttrib *attribs)
{
switch (obj_config->entrypoint)
{
case VAEntrypointVLD:
{
gen7_get_hw_dec_formats(ctx, obj_config, data, i, attribs);
break;
}

case VAEntrypointVideoProc:
{
gen7_get_hw_vpp_formats(ctx, obj_config, data, i, attribs);

/**
* We also support the encoding formats
* in the VPP for IVB and HSW.
*/
FALLTHROUGH;
}

case VAEntrypointEncSlice:
{
gen7_get_hw_enc_formats(ctx, obj_config, data, i, attribs);
break;
}

default:
{
i965_log_debug(ctx, "gen7_get_hw_formats: Ignoring unknown entrypoint %#010x\n", obj_config->entrypoint);
break;
}
}
}
Loading