hardware/intel/intel-driver
Révision | 8bb367b05ac09b3358cb8defe2a39d5ba98a4a78 (tree) |
---|---|
l'heure | 2015-09-06 16:13:58 |
Auteur | Zhao Yakui <yakui.zhao@inte...> |
Commiter | Xiang, Haihao |
Call wrapped driver to handle config/context related with VP9 decoding
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Sean V Kelley <seanvk@posteo.de>
(cherry picked from commit 815d17f944b13ebc1eca62572dbec0c49ea01999)
@@ -421,6 +421,8 @@ va_enc_packed_type_to_idx(int packed_type) | ||
421 | 421 | return idx; |
422 | 422 | } |
423 | 423 | |
424 | +#define CALL_VTABLE(vawr, status, param) status = (vawr->vtable->param) | |
425 | + | |
424 | 426 | VAStatus |
425 | 427 | i965_QueryConfigProfiles(VADriverContextP ctx, |
426 | 428 | VAProfile *profile_list, /* out */ |
@@ -901,6 +903,22 @@ i965_CreateConfig(VADriverContextP ctx, | ||
901 | 903 | vaStatus = VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT; |
902 | 904 | } |
903 | 905 | |
906 | + if ((vaStatus == VA_STATUS_SUCCESS) && | |
907 | + (profile == VAProfileVP9Profile0)) { | |
908 | + | |
909 | + if (i965->wrapper_pdrvctx) { | |
910 | + VAGenericID wrapper_config; | |
911 | + | |
912 | + CALL_VTABLE(i965->wrapper_pdrvctx, vaStatus, | |
913 | + vaCreateConfig(i965->wrapper_pdrvctx, profile, | |
914 | + entrypoint, attrib_list, | |
915 | + num_attribs, &wrapper_config)); | |
916 | + | |
917 | + if (vaStatus == VA_STATUS_SUCCESS) | |
918 | + obj_config->wrapper_config = wrapper_config; | |
919 | + } | |
920 | + } | |
921 | + | |
904 | 922 | /* Error recovery */ |
905 | 923 | if (VA_STATUS_SUCCESS != vaStatus) { |
906 | 924 | i965_destroy_config(&i965->config_heap, (struct object_base *)obj_config); |
@@ -923,6 +941,14 @@ i965_DestroyConfig(VADriverContextP ctx, VAConfigID config_id) | ||
923 | 941 | return vaStatus; |
924 | 942 | } |
925 | 943 | |
944 | + if ((obj_config->wrapper_config != VA_INVALID_ID) && | |
945 | + i965->wrapper_pdrvctx) { | |
946 | + CALL_VTABLE(i965->wrapper_pdrvctx, vaStatus, | |
947 | + vaDestroyConfig(i965->wrapper_pdrvctx, | |
948 | + obj_config->wrapper_config)); | |
949 | + obj_config->wrapper_config = VA_INVALID_ID; | |
950 | + } | |
951 | + | |
926 | 952 | i965_destroy_config(&i965->config_heap, (struct object_base *)obj_config); |
927 | 953 | return VA_STATUS_SUCCESS; |
928 | 954 | } |
@@ -1948,6 +1974,30 @@ i965_CreateContext(VADriverContextP ctx, | ||
1948 | 1974 | return VA_STATUS_ERROR_INVALID_CONFIG; |
1949 | 1975 | obj_context->codec_state.base.chroma_formats = attrib->value; |
1950 | 1976 | |
1977 | + if (obj_config->wrapper_config != VA_INVALID_ID) { | |
1978 | + /* The wrapper_pdrvctx should exist when wrapper_config is valid. | |
1979 | + * So it won't check i965->wrapper_pdrvctx again. | |
1980 | + * Fixme if it is incorrect. | |
1981 | + */ | |
1982 | + VAGenericID wrapper_context; | |
1983 | + | |
1984 | + /* | |
1985 | + * The render_surface is not passed when calling | |
1986 | + * vaCreateContext. | |
1987 | + * If it is needed, we must get the wrapped surface | |
1988 | + * for the corresponding Surface_list. | |
1989 | + * So the wrapped surface conversion is deferred. | |
1990 | + */ | |
1991 | + CALL_VTABLE(i965->wrapper_pdrvctx, vaStatus, | |
1992 | + vaCreateContext(i965->wrapper_pdrvctx, | |
1993 | + obj_config->wrapper_config, | |
1994 | + picture_width, picture_height, | |
1995 | + flag, NULL, 0, | |
1996 | + &wrapper_context)); | |
1997 | + | |
1998 | + if (vaStatus == VA_STATUS_SUCCESS) | |
1999 | + obj_context->wrapper_context = wrapper_context; | |
2000 | + } | |
1951 | 2001 | /* Error recovery */ |
1952 | 2002 | if (VA_STATUS_SUCCESS != vaStatus) { |
1953 | 2003 | i965_destroy_context(&i965->context_heap, (struct object_base *)obj_context); |
@@ -1963,15 +2013,25 @@ i965_DestroyContext(VADriverContextP ctx, VAContextID context) | ||
1963 | 2013 | { |
1964 | 2014 | struct i965_driver_data *i965 = i965_driver_data(ctx); |
1965 | 2015 | struct object_context *obj_context = CONTEXT(context); |
2016 | + VAStatus va_status = VA_STATUS_SUCCESS; | |
1966 | 2017 | |
1967 | 2018 | ASSERT_RET(obj_context, VA_STATUS_ERROR_INVALID_CONTEXT); |
1968 | 2019 | |
1969 | 2020 | if (i965->current_context_id == context) |
1970 | 2021 | i965->current_context_id = VA_INVALID_ID; |
1971 | 2022 | |
2023 | + if ((obj_context->wrapper_context != VA_INVALID_ID) && | |
2024 | + i965->wrapper_pdrvctx) { | |
2025 | + CALL_VTABLE(i965->wrapper_pdrvctx, va_status, | |
2026 | + vaDestroyContext(i965->wrapper_pdrvctx, | |
2027 | + obj_context->wrapper_context)); | |
2028 | + | |
2029 | + obj_context->wrapper_context = VA_INVALID_ID; | |
2030 | + } | |
2031 | + | |
1972 | 2032 | i965_destroy_context(&i965->context_heap, (struct object_base *)obj_context); |
1973 | 2033 | |
1974 | - return VA_STATUS_SUCCESS; | |
2034 | + return va_status; | |
1975 | 2035 | } |
1976 | 2036 | |
1977 | 2037 | static void |