Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

Quicksync not available to a service process?

karl_lillevold
Beginner
2,872 Views

We have been using a simple MFXInit() to test of Quicksync is available, but I now realized that when we run our program as a service, the very same MFXInit() always fails. That leads me to believe Quicksync (or any is not available to a Windows service... 

Much to my disappointment, I found this thread : http://software.intel.com/en-us/forums/topic/311956, which leads me to indicate there is no solution for this problem, with graphics drivers not available to "session 0" .. (I have no experience with Windows services - others have worked on that part in our project). Very unfortunate - we relied on Quicksync for much improved transcoding performance.

-Karl L.

0 Kudos
38 Replies
SergeyKostrov
Valued Contributor II
1,156 Views
>>...I am still awaiting an answer to how you are suggesting this can be solving in practice... Karl, Windows NT Services are designed to work as the background processes and in order to help you I requested ( already twice ) a list of parameters ( arguments ) used in CreateService Win32 API function. Could you or a developer who works on these codes post it?
0 Kudos
karl_lillevold
Beginner
1,156 Views

Sergey: Thanks for trying to help, even when the Intel expert has posted it is impossible with Windows 7. So here you go:

CreateService(
schSCManager,
pServiceName,
pServiceName,
SERVICE_ALL_ACCESS,
dwServiceType,
dwStartType,
SERVICE_ERROR_NORMAL,
pExePath,
NULL,
NULL,
NULL,
NULL,
NULL);

0 Kudos
Bernard
Valued Contributor I
1,156 Views
@karl Can you check the registry settings of your service?Please look for this value "SERVICE_INTERACTIVE_PROCESS".If this value is present your service will be pinned to visible window station.
0 Kudos
karl_lillevold
Beginner
1,156 Views

According to http://msdn.microsoft.com/en-us/library/windows/desktop/ms683502(v=vs.85).aspx : "Important  Services cannot directly interact with a user as of Windows Vista. Therefore, the techniques mentioned in the section titled Using an Interactive Service should not be used in new code."

The SERVICE_INTERACTIVE_PROCESS flag is mentioned in the Using an Interactive Service.

0 Kudos
Bernard
Valued Contributor I
1,156 Views

Here is the excerpt from the article mentioned by you

"The NoInteractiveServices value defaults to 1, which means that no service is allowed to run interactively, regardless of whether it has SERVICE_INTERACTIVE_PROCESS. When NoInteractiveServices is set to a 0, services with SERVICE_INTERACTIVE_PROCESS are allowed to run interactively."

0 Kudos
karl_lillevold
Beginner
1,156 Views

Before that, like I already quoted:::::: : "Important  Services cannot directly interact with a user as of Windows Vista. Therefore, the techniques mentioned in the section titled Using an Interactive Service should not be used in new code."

Anyway, the SERVICE_INTERACTIVE_PROCESS_FLAG corresponds to the same checkbox as is located in the Log On tab of a service property, which I asked you above. So now I tried both methods - setting it in the registry -> modifies the check box. Setting the check box -> modifies the registry. So to answer my own question: Yes, this flag and that checkbox is the same.

And to re-iterate: I tried that already (tried again now), and the result is the same I wrote above: "Are you describing the "Allow service to interact with desktop" in the Log On tab for service properties? I tried this, and it makes no difference for Quicksync availability. I was also told "It's a deprecated option for interop with very old services"."

0 Kudos
karl_lillevold
Beginner
1,156 Views

The only alternative, as I suggested above, which is possible when a user is logged on and has our systray app running, is to transmit the encoding parameters to the systray using IPC (named pipes), to have it start our encoding process. It's a little messy, and prone to errors, if for instance users log off mid-encoding, but with Quicksync's amazing encoding speed, may be worth the effort when we have time.

Suggestion to Intel: you should create something like Lucid's Virtu (http://www.lucidlogix.com/product-virtu-gpu.html) , which I use on my home system. How it works, I don't know, but it allows Quicksync to be used with a discrete graphics card installed.

This, however, would be some kind of user space process with a defined API in your SDK, which transmits the function calls via IPC to that user process, that would allow Quicksync to be used by services on Windows 7. I already applied for a patent ;) Probably not possible or viable though, just speculating on something I have only brief knowledge about.

0 Kudos
SergeyKostrov
Valued Contributor II
1,156 Views
Thanks, Karl. >>... >>CreateService( >>schSCManager, >>pServiceName, >>pServiceName, >>SERVICE_ALL_ACCESS, - [ SergeyK ] This is what I wanted to see >>dwServiceType >>... What flags do you set for dwServiceType argument? PS: Take into account that information on MSDN ( after two updates during last a couple of years ) sometimes is Not reflecting realities (!). For example, you could read that some feature is Not available and actually that is Not correct and the feature is available, and so on.
0 Kudos
karl_lillevold
Beginner
1,156 Views

Sounds like we are back to the service type flag, as iliyapolak has already suggested. We have tried SERVICE_INTERACTIVE_PROCESS, as a flag to CreateService, setting it via the registry, and setting the checkbox. These three appear to be identical in their function, and for Quicksync, also tested all three variations thereof, makes zero difference.

0 Kudos
karl_lillevold
Beginner
1,156 Views

{{Off topic: just posted a reply, it was queued for approval. Why are some replies posted immediately, some queued for approval? This is why I ended up with duplicates...}}

0 Kudos
SergeyKostrov
Valued Contributor II
1,156 Views
Karl, if your post doesn't appear after a couple of hours please post it again. Thanks in advance.
0 Kudos
karl_lillevold
Beginner
1,156 Views

I didn't save it, and won't retype it. I am sure it will show up.

0 Kudos
SergeyKostrov
Valued Contributor II
1,156 Views
Karl, I'd like to clarify one thing. >>>>...Could you add a call to Win32 API function GetLastError just right after the call to MFXInit? What is an error code? >> >>...In any case, the error is MFX_ERR_UNSUPPORTED ( -3 )... The error code MFX_ERR_UNSUPPORTED doesn't look like an error ( it is negative! ) from GetLastError Win32 API function. It looks like the error code from MFXInit function. GetLastError always returns positive error codes (!). Would you be able to get the error code from GetLastError Win32 API function? This is what needs to be done: ... MfxErrorCode = MFXInit(); LastErrorCode = GetLastError(); ...
0 Kudos
karl_lillevold
Beginner
1,156 Views

As you know, the MFX error is MFX_ERR_UNSUPPORTED (The function cannot find the desired SDK implementation or version.)

The corresponding GetLastError is ERROR_MOD_NOT_FOUND 126 (0x7E) The specified module could not be found.

This seems like a logical match to me. When not run as a service there are no errors.

{{I am still waiting for my other reply to be approved, but the summary is that the parameter you asked about to CreateService: I tried OR-ing with the same deprecated (since Vista) SERVICE_INTERACTIVE_PROCESS flag 0x00000100 discussed above, and the effect is the same. The registry gets the flag ORed in, and the Log On Interactive check box gets marked. So three ways to set the same parameter, neither of which has any effect on the Quicksync availability - return code from MFXInit}}

0 Kudos
Bernard
Valued Contributor I
1,156 Views

>>> I tried OR-ing with the same deprecated (since Vista) SERVICE_INTERACTIVE_PROCESS flag 0x00000100 discussed above.>>>

I did not know that this flag is deprecated.My source of information did not state that clearly.

0 Kudos
SergeyKostrov
Valued Contributor II
1,156 Views
>>...The corresponding GetLastError is ERROR_MOD_NOT_FOUND 126 (0x7E) The specified module could not >>be found... That error is related to LoadLibrary or LoadLibraryEx Win32 API functions. Could you verify with MS Depends all dependant modules? Also, consider the following: - Issue with User Account Control ( UAC ) attribute ( look at Visual Studio project settings ) - Problem with Policies ( take a look at UI application for setting Policies on a Windows ) - Access Rights issues for your Windows Service
0 Kudos
karl_lillevold
Beginner
1,156 Views

Look, guys (Sergey and iliyapolak): While I do appreciate your attempts at help, the Intel expert has stated access to Quicksync is impossible from services under Windows 7. I have done what I can to satisfy your requests for more information, but frankly, I don't see the point in continuing this exercise in futility. 

0 Kudos
Bernard
Valued Contributor I
1,156 Views

Hi Karl,

it seems that nothing can be done.

0 Kudos
Reply