media/gpu/vaapi: stringifications for tests and logs
This CL uses the va/va_str.h functions vaProfileStr() and vaEntrypointStr() for better stringifications of test messages and logs. No new functionality intended, just touching logs. Bug: b:158713599 Change-Id: I1094b40adf3ed887b078fe936aebf56b04466b4f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2241503 Commit-Queue: Miguel Casas <mcasas@chromium.org> Reviewed-by: Jao-ke Chin-Lee <jchinlee@chromium.org> Cr-Commit-Position: refs/heads/master@{#777500}
This commit is contained in:
media/gpu/vaapi
@ -54,9 +54,9 @@ bool CompareImages(const DecodedImage& reference_image,
|
||||
// Uses the reference image's size as the ground truth.
|
||||
const gfx::Size image_size = reference_image.size;
|
||||
if (image_size != hw_decoded_image.size) {
|
||||
DLOG(ERROR) << "Wrong expected software decoded image size, "
|
||||
<< image_size.ToString() << " versus VaAPI provided "
|
||||
<< hw_decoded_image.size.ToString();
|
||||
LOG(ERROR) << "Wrong expected software decoded image size, "
|
||||
<< image_size.ToString() << " versus VaAPI provided "
|
||||
<< hw_decoded_image.size.ToString();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ bool CompareImages(const DecodedImage& reference_image,
|
||||
image_size.width(), image_size.height());
|
||||
}
|
||||
if (conversion_result != 0) {
|
||||
DLOG(ERROR) << "libyuv conversion error";
|
||||
LOG(ERROR) << "libyuv conversion error";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -112,12 +112,12 @@ bool CompareImages(const DecodedImage& reference_image,
|
||||
temp_v.get(), half_image_size.width(), image_size.width(),
|
||||
image_size.height());
|
||||
} else {
|
||||
DLOG(ERROR) << "HW FourCC not supported: " << FourccToString(hw_fourcc);
|
||||
LOG(ERROR) << "HW FourCC not supported: " << FourccToString(hw_fourcc);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ssim < min_ssim) {
|
||||
DLOG(ERROR) << "SSIM too low: " << ssim << " < " << min_ssim;
|
||||
LOG(ERROR) << "SSIM too low: " << ssim << " < " << min_ssim;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ VAStatus vaDestroyImage(VADisplay dpy, VAImageID image);
|
||||
VAStatus vaDestroySurfaces(VADisplay dpy, VASurfaceID *surfaces, int num_surfaces);
|
||||
int vaDisplayIsValid(VADisplay dpy);
|
||||
VAStatus vaEndPicture(VADisplay dpy, VAContextID context);
|
||||
const char *vaEntrypointStr(VAEntrypoint entrypoint);
|
||||
const char *vaErrorStr(VAStatus error_status);
|
||||
VAStatus vaExportSurfaceHandle(VADisplay dpy, VASurfaceID surface_id, uint32_t mem_type, uint32_t flags, void *descriptor);
|
||||
VAStatus vaGetConfigAttributes(VADisplay dpy, VAProfile profile, VAEntrypoint entrypoint, VAConfigAttrib *attrib_list, int num_attribs);
|
||||
@ -29,6 +30,7 @@ int vaMaxNumConfigAttributes(VADisplay dpy);
|
||||
int vaMaxNumEntrypoints(VADisplay dpy);
|
||||
int vaMaxNumImageFormats(VADisplay dpy);
|
||||
int vaMaxNumProfiles(VADisplay dpy);
|
||||
const char *vaProfileStr(VAProfile profile);
|
||||
VAStatus vaPutImage (VADisplay dpy, VASurfaceID surface, VAImageID image, int src_x, int src_y, unsigned int src_width, unsigned int src_height, int dest_x, int dest_y, unsigned int dest_width, unsigned int dest_height);
|
||||
VAStatus vaQueryConfigAttributes(VADisplay dpy, VAConfigID config_id, VAProfile *profile, VAEntrypoint *entrypoint, VAConfigAttrib *attrib_list, int *num_attribs);
|
||||
VAStatus vaQueryConfigEntrypoints(VADisplay dpy, VAProfile profile, VAEntrypoint *entrypoint_list, int *num_entrypoints);
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include <va/va.h>
|
||||
#include <va/va_str.h>
|
||||
|
||||
#include "base/files/file.h"
|
||||
#include "base/files/scoped_file.h"
|
||||
@ -161,7 +162,8 @@ TEST_F(VaapiTest, VaapiProfiles) {
|
||||
va_info[VAProfileH264ConstrainedBaseline], VAEntrypointVLD);
|
||||
}
|
||||
|
||||
EXPECT_TRUE(is_profile_supported) << " profile: " << profile.profile;
|
||||
EXPECT_TRUE(is_profile_supported)
|
||||
<< " profile: " << GetProfileName(profile.profile);
|
||||
}
|
||||
|
||||
for (const auto& profile : VaapiWrapper::GetSupportedEncodeProfiles()) {
|
||||
@ -180,7 +182,8 @@ TEST_F(VaapiTest, VaapiProfiles) {
|
||||
VAEntrypointEncSliceLP);
|
||||
}
|
||||
|
||||
EXPECT_TRUE(is_profile_supported) << " profile: " << profile.profile;
|
||||
EXPECT_TRUE(is_profile_supported)
|
||||
<< " profile: " << GetProfileName(profile.profile);
|
||||
}
|
||||
|
||||
EXPECT_EQ(VaapiWrapper::IsDecodeSupported(VAProfileJPEGBaseline),
|
||||
@ -202,9 +205,9 @@ TEST_F(VaapiTest, DefaultEntrypointIsSupported) {
|
||||
profile_and_entrypoints.first);
|
||||
const auto& supported_entrypoints = profile_and_entrypoints.second;
|
||||
EXPECT_TRUE(base::Contains(supported_entrypoints, default_entrypoint))
|
||||
<< "Default VAEntrypoint " << default_entrypoint
|
||||
<< " (mode = " << mode << ") is not supported for VAProfile = "
|
||||
<< profile_and_entrypoints.first;
|
||||
<< "Default VAEntrypoint " << vaEntrypointStr(default_entrypoint)
|
||||
<< " (VaapiWrapper mode = " << mode << ") is not supported for "
|
||||
<< vaProfileStr(profile_and_entrypoints.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <va/va.h>
|
||||
#include <va/va_drm.h>
|
||||
#include <va/va_drmcommon.h>
|
||||
#include <va/va_str.h>
|
||||
#include <va/va_version.h>
|
||||
|
||||
#include <algorithm>
|
||||
@ -294,84 +295,6 @@ static const struct {
|
||||
{VP9PROFILE_PROFILE3, VAProfileVP9Profile3},
|
||||
};
|
||||
|
||||
// Converts the given |va_profile| to the corresponding string.
|
||||
// See: http://go/gh/intel/libva/blob/master/va/va.h#L359
|
||||
std::string VAProfileToString(VAProfile va_profile) {
|
||||
switch (va_profile) {
|
||||
case VAProfileNone:
|
||||
return "VAProfileNone";
|
||||
case VAProfileMPEG2Simple:
|
||||
return "VAProfileMPEG2Simple";
|
||||
case VAProfileMPEG2Main:
|
||||
return "VAProfileMPEG2Main";
|
||||
case VAProfileMPEG4Simple:
|
||||
return "VAProfileMPEG4Simple";
|
||||
case VAProfileMPEG4AdvancedSimple:
|
||||
return "VAProfileMPEG4AdvancedSimple";
|
||||
case VAProfileMPEG4Main:
|
||||
return "VAProfileMPEG4Main";
|
||||
case VAProfileH264Baseline:
|
||||
return "VAProfileH264Baseline";
|
||||
case VAProfileH264Main:
|
||||
return "VAProfileH264Main";
|
||||
case VAProfileH264High:
|
||||
return "VAProfileH264High";
|
||||
case VAProfileVC1Simple:
|
||||
return "VAProfileVC1Simple";
|
||||
case VAProfileVC1Main:
|
||||
return "VAProfileVC1Main";
|
||||
case VAProfileVC1Advanced:
|
||||
return "VAProfileVC1Advanced";
|
||||
case VAProfileH263Baseline:
|
||||
return "VAProfileH263Baseline";
|
||||
case VAProfileJPEGBaseline:
|
||||
return "VAProfileJPEGBaseline";
|
||||
case VAProfileH264ConstrainedBaseline:
|
||||
return "VAProfileH264ConstrainedBaseline";
|
||||
case VAProfileVP8Version0_3:
|
||||
return "VAProfileVP8Version0_3";
|
||||
case VAProfileH264MultiviewHigh:
|
||||
return "VAProfileH264MultiviewHigh";
|
||||
case VAProfileH264StereoHigh:
|
||||
return "VAProfileH264StereoHigh";
|
||||
case VAProfileHEVCMain:
|
||||
return "VAProfileHEVCMain";
|
||||
case VAProfileHEVCMain10:
|
||||
return "VAProfileHEVCMain10";
|
||||
case VAProfileVP9Profile0:
|
||||
return "VAProfileVP9Profile0";
|
||||
case VAProfileVP9Profile1:
|
||||
return "VAProfileVP9Profile1";
|
||||
case VAProfileVP9Profile2:
|
||||
return "VAProfileVP9Profile2";
|
||||
case VAProfileVP9Profile3:
|
||||
return "VAProfileVP9Profile3";
|
||||
#if VA_MAJOR_VERSION >= 2 || (VA_MAJOR_VERSION == 1 && VA_MINOR_VERSION >= 2)
|
||||
case VAProfileHEVCMain12:
|
||||
return "VAProfileHEVCMain12";
|
||||
case VAProfileHEVCMain422_10:
|
||||
return "VAProfileHEVCMain422_10";
|
||||
case VAProfileHEVCMain422_12:
|
||||
return "VAProfileHEVCMain422_12";
|
||||
case VAProfileHEVCMain444:
|
||||
return "VAProfileHEVCMain444";
|
||||
case VAProfileHEVCMain444_10:
|
||||
return "VAProfileHEVCMain444_10";
|
||||
case VAProfileHEVCMain444_12:
|
||||
return "VAProfileHEVCMain444_12";
|
||||
case VAProfileHEVCSccMain:
|
||||
return "VAProfileHEVCSccMain";
|
||||
case VAProfileHEVCSccMain10:
|
||||
return "VAProfileHEVCSccMain10";
|
||||
case VAProfileHEVCSccMain444:
|
||||
return "VAProfileHEVCSccMain444";
|
||||
#endif
|
||||
default:
|
||||
NOTREACHED();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
bool IsBlackListedDriver(const std::string& va_vendor_string,
|
||||
VaapiWrapper::CodecMode mode,
|
||||
VAProfile va_profile) {
|
||||
@ -685,8 +608,8 @@ static bool GetRequiredAttribs(const base::Lock* va_lock,
|
||||
VAStatus va_res =
|
||||
vaGetConfigAttributes(va_display, profile, entrypoint, &attrib, 1);
|
||||
if (va_res != VA_STATUS_SUCCESS) {
|
||||
LOG(ERROR) << "GetConfigAttributes failed for va_profile "
|
||||
<< VAProfileToString(profile);
|
||||
LOG(ERROR) << "vaGetConfigAttributes failed for "
|
||||
<< vaProfileStr(profile);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -807,7 +730,7 @@ VASupportedProfiles::VASupportedProfiles()
|
||||
|
||||
static_assert(std::extent<decltype(supported_profiles_)>() ==
|
||||
VaapiWrapper::kCodecModeMax,
|
||||
"The array size of supported profile is incorrect.");
|
||||
"|supported_profiles_| size is incorrect.");
|
||||
|
||||
if (!display_state->Initialize())
|
||||
return;
|
||||
@ -870,8 +793,8 @@ VASupportedProfiles::GetSupportedProfileInfosForCodecModeInternal(
|
||||
if (!FillProfileInfo_Locked(va_profile, entrypoint, required_attribs,
|
||||
&profile_info)) {
|
||||
LOG(ERROR) << "FillProfileInfo_Locked failed for va_profile "
|
||||
<< VAProfileToString(va_profile) << " and entrypoint "
|
||||
<< entrypoint;
|
||||
<< vaProfileStr(va_profile) << " and entrypoint "
|
||||
<< vaEntrypointStr(entrypoint);
|
||||
continue;
|
||||
}
|
||||
supported_profile_infos.push_back(profile_info);
|
||||
@ -1286,7 +1209,7 @@ scoped_refptr<VaapiWrapper> VaapiWrapper::Create(
|
||||
VAProfile va_profile,
|
||||
const base::Closure& report_error_to_uma_cb) {
|
||||
if (!VASupportedProfiles::Get().IsProfileSupported(mode, va_profile)) {
|
||||
DVLOG(1) << "Unsupported va_profile: " << va_profile;
|
||||
DVLOG(1) << "Unsupported va_profile: " << vaProfileStr(va_profile);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -1296,7 +1219,7 @@ scoped_refptr<VaapiWrapper> VaapiWrapper::Create(
|
||||
return vaapi_wrapper;
|
||||
}
|
||||
LOG(ERROR) << "Failed to create VaapiWrapper for va_profile: "
|
||||
<< VAProfileToString(va_profile);
|
||||
<< vaProfileStr(va_profile);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user