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

Merged
merged 20 commits into from
May 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a9d0bf5
Update .gitignore
irql-notlessorequal Mar 17, 2025
4b9a588
i965/drv: Add `get_hw_formats` pointer in `hw_codec_info`
irql-notlessorequal Mar 17, 2025
90cbeb7
i965/gen6: Implement `get_hw_formats`
irql-notlessorequal Mar 17, 2025
b1db8dd
i965: Implement `get_hw_formats` for ILK and CTG
irql-notlessorequal Mar 17, 2025
8954807
i965/gen7: Implement `get_hw_formats`
irql-notlessorequal Mar 17, 2025
f8b1e44
i965: Implement `get_hw_formats` for Gen 8 and newer
irql-notlessorequal Mar 17, 2025
0c13d95
i965/drv: Use `get_hw_formats`
irql-notlessorequal Mar 17, 2025
0477443
i965/drv: Improvements for 0c13d95b06b65be499e156ab4150d4900665b24e
irql-notlessorequal Mar 17, 2025
702c026
i965/media: Improvements for ILK and CTG.
irql-notlessorequal Mar 17, 2025
65e6a39
i965: Fix all `get_hw_formats` implementations.
irql-notlessorequal Mar 17, 2025
af24f79
i965/gen6: Expose RGBX in the VPP.
irql-notlessorequal Mar 31, 2025
2bb3974
i965/media: Expose RGBX in the VPP for ILK.
irql-notlessorequal Mar 31, 2025
0a336b0
i965/gen6: Re-order the formats.
irql-notlessorequal Apr 19, 2025
8293e2e
i965/gen7: Remove reference to `VAProfileHEVCMain10`
irql-notlessorequal Apr 19, 2025
443cb0a
i965/media: Minor nits.
irql-notlessorequal Apr 19, 2025
1f3dae9
i965/gen7: Fix VAEntrypointEncSlice handling.
irql-notlessorequal Apr 19, 2025
5a8ed3b
i965/gen7: Minor nit.
irql-notlessorequal Apr 19, 2025
99c008d
i965/gen8: Minor nit.
irql-notlessorequal Apr 19, 2025
a5090c1
Update NEWS
irql-notlessorequal May 31, 2025
2e02d90
Merge branch 'master' into vpp-per-gen
irql-notlessorequal May 31, 2025
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
8 changes: 8 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ Copyright (C) 2009-2023 Intel Corporation

Version 2.4.5 - XX.XX.XXXX (IRQL fork)

* Expose RGBX as a VPP format on ILK
* Expose RGBA/BGRA as a VPP format on ILK

Ironlake is affected by the same issue as Sandybridge with
these formats, meaning that a workaround is needed for Chromium.

* Don't advertise VAProfileHEVCMain10 format support on HSW and IVB.

Version 2.4.4 - 06.Apr.2025 (IRQL fork)

* Add RPM packaging (Thanks @sergiorussia)
Expand Down
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