Enable Hardware Acceleration for Windows Services RRS feed

  • Question

  • Hello,
      I Created a windows service using Windows Service C# and top shelf (to enable console application over windows service project for debugging) in the windows service i am working with Matrox Imaging Library . Everything is working fine both as a windows service c# and console application. Now there is a little problem i am facing is that when ever i run my windows service c# as console application then it's processing status as hardware acceleration else when ever run as windows service registered in Service of windows 10 then it's processing status is software implementation.  I tried a lot of solutions such as task scheduler, AlwaysUp application, Session 0 stuff, tried to start this windows service from inside another console app all are showing 'Software Implementation' but i can't find a perfect solution. Need some Quick Suggestions. Thanks  
    Wednesday, March 27, 2019 8:39 AM

All replies

  • How are you setting this "hardware acceleration" thing that you mention. Is this a feature of the library you're using?

    If so then you'll need to post your question in their forums as they are likely looking at the runtime environment and determining what is supported. A service won't have access to the desktop so if the library is looking for information from the user settings then it won't find anything. The workaround, temporarily, would be to run the service (or task) under a user account that is configured the way you want. But, again, this would be dependent upon the library writer's code so you'll need to ask them.

    Michael Taylor

    Wednesday, March 27, 2019 2:27 PM
  • Hi Michael,
       Thanks for your reply. I am Using Matrox Imaging Library and the code is as follow:

    MIL.MseqInquire(MilCompressContext, MIL.M_CONTEXT, MIL.M_CODEC_TYPE, ref SeqSystemType);
    if (SeqSystemType == MIL.M_HARDWARE + MIL.M_QSV)
         log.Info("Live image capture and compression to file using Hardware acceleration.");
    else // MIL.M_SOFTWARE + MIL.M_QSV
         log.Info("Live image capture and compression to file using Software implementation.");

    When i Run my windows Service C# as Console application using topshelf then if block is executed and when i run it Via installing windows service using powershell then else block is executed. I Don't know why. I am trying multiple solutions from 2 weeks to make this window service run using hardware acceleration but i can't.

    note : Bold is from Matrox Imaging Library

    Wednesday, March 27, 2019 2:44 PM
  • That's an implementation detail of the library then so you'll need to contact them to see what they are looking for. If it is a .NET assembly then you could disassemble the code and look yourself but contacting them may be easier.

    As a test you can change your windows service to run under your user account and see if it works correctly. If so then they are looking at some settings in the user profile (maybe the use of the newer Windows theme or something) so you can configure a user account that has the necessary options and then run the service as that. If it doesn't then they may be looking at something like the interactive user environment which would be harder to do in a service.

    Alternatively they may provide an alternative approach to enabling the feature that works with a service. You'd need to ask them though.

    Michael Taylor

    Wednesday, March 27, 2019 2:51 PM