HEVC: Capability reporting fails for HEVC encoder (Workaround inside) #58

Open
Xaymar opened this Issue Jan 19, 2017 · 9 comments

Projects

None yet

2 participants

@Xaymar
Contributor
Xaymar commented Jan 19, 2017

Affected Drivers: 17.1.1 and any other HEVC supporting Driver before this
Hardware: RX 480 (the one sent to me by Mikhail), Intel i5-4690, Gigabyte H97-D3H, 16GB DDR3

Figured there'd be one or the other problem when testing HEVC but this wasn't one I was actually expecting. For an unknown reason CreateComponent fails if InitDX11/InitDX9/InitOpenGL/InitOpenCL is called on the context it is in. (I'd also like to add that HEVC is not present in the ReLive codec dropdown, not sure if intended.)

Example Code:

	const wchar_t* encoders[] = {
		AMFVideoEncoderVCE_AVC,
		AMFVideoEncoder_HEVC
	};
	for (auto enc : encoders) {
		auto amf = AMF::GetInstance();
		auto amffactory = amf->GetFactory();

		amf::AMFContextPtr context;
		if (amffactory->CreateContext(&context) == AMF_OK) {
			//context->InitDX11(); // <-- Causes CreateComponent to fail.
			//context->InitDX11(dx11device); // <-- does the same, even if forcing DX11 to the RX GPU
			amf::AMFComponentPtr component;
			if (amffactory->CreateComponent(context, enc, &component) == AMF_OK) {

				printDebugInfo(component);
				component->Terminate();
			}
			context->Terminate();
		}
	}

This affects the VCEEncoderD3D and CapabilityManager sample applications, as both will fail with a AMF_NOT_FOUND result instead of doing actual work.

@MikhailAMD
Contributor

Please try to uninstall all drivers: one via Control Panel "Uninstall a program" and then after reboot via Device Manager with deletion of the files. You may need to do it several times till you see Microsoft Basic driver. Windows may install default AMD driver after that or not. Then Install 7.1.1.
Try to remove other GPUs.

@Xaymar
Contributor
Xaymar commented Jan 19, 2017 edited

There are no other GPUs in the System, the Intel integrated one is disabled in UEFI/BIOS for OpenCL incompatibility reasons. I also did the following (all while not connected to the internet):

  1. Removed Driver using Add and Remove Programs
  2. Reboot
  3. Verified that the Device in Device Manager is called Microsoft Basic Display Adapter
  4. Uninstalled that one too just to be safe
  5. Removed all AMD GPU related drivers (c0*.inf in DriverStore/FileRepository)
  6. Reboot
  7. Install 17.1.1
  8. Reboot

After that I tried the test code above and the samples provided with HEVC. The test code stops working properly as soon as InitDX11 is called (CreateComponent fails with AMF_NOT_FOUND). The examples also fail with AMF_NOT_FOUND.

@MikhailAMD
Contributor

could you please provide debug output?

@Xaymar
Contributor
Xaymar commented Jan 19, 2017

My bad, the test code no longer fails, I merely had the wrong log file open. What fails now with HEVC in the samples in pCaps->Init, as can be seen in the VCEEncoderD3D output.

I'm not sure how to produce debug output from the samples as they are pretty far abstracted and I've not spent much time learning their internal structure.

@MikhailAMD
Contributor

Just run them under debugger and copy debug output.

@Xaymar
Contributor
Xaymar commented Jan 19, 2017

Does "my System stopped responding and i had to hard reset" count as debug output?

@Xaymar
Contributor
Xaymar commented Jan 19, 2017 edited

Right, after figuring out why that happened (hint: typing HIEGHT instead of HEIGHT does not result in the same setting) here is the debug output:

Might want to restrict the width and height setting to certain limits in the runtime itself, so that bad software doesn't end up in bad rep for AMD later on.

@MikhailAMD
Contributor

OK, got the bug. Will fix in the next driver. For now please use AMFComponent:Init() return as an indicator of HEVC encoder presence.

@MikhailAMD
Contributor

Another and better way-around: insert AMFComponent::Init() call before getting caps
AMF_RESULT hr = pEncoder->Init(amf::AMF_SURFACE_NV12, 1920, 1080);
if (pEncoder->GetCaps(&encoderCaps) == AMF_OK)
{
}

@Xaymar Xaymar changed the title from HEVC: CreateComponent with HEVC fails with reason AMF_NOT_FOUND after Init*() call to HEVC: Capability reporting fails for HEVC encoder (Workaround inside) Jan 20, 2017
@rigaya rigaya added a commit to rigaya/VCEEnc that referenced this issue Jan 30, 2017
@rigaya rigaya HEVCでの機能情報が取得できなかったのを修正。
現状では、HEVCでのAMFComponent::GetCaps()は、AMFComponent::Init()を呼んでおかないと成功しない。
GPUOpen-LibrariesAndSDKs/AMF#58
4884eab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment