Jump to content

Hardware Acceleration


Recommended Posts

I figured out that the Hardware Acceleration on my video card was causing problems with my PixelChecksum(). I turned it completley off, and now everything works the way I want it to.

Is there a way to first get the current Hardware Acceleration setting, then change it to none, then when the program is done running, change it back to whatever it was set at?

Link to comment
Share on other sites

here is some research ... someone can run with it...

Now for the solution I spoke of. I'm sorry that I'm not yet used to the EE customs here... :)

I have tested the solution to work on Windows 2000 with a Matrox G450 DH and on Windows XP with some ATI graphics adapter. No warranty, but it looks like it is a general solution for XP/2K.

It works as follows:

(1) Find out the position of the current video device, information on this may be found in the registry, here:

\\HKLM\HARDWARE\DEVICEMAP\VIDEO\Device\Video0

There you will find a LPSTR type of entry, pointing to a registry key for the current video device, e.g.

"\Registry\Machine\System\ControlSet001\Services\G400\Device0"

(2) Parse that string, replacing "\Registry\Machine" with HKLM (HKEY_LOCAL_MACHINE) and open the corresponding registry key,

(3) Look for a DWORD value "Acceleration.Level". If the value does not exists, hardware acceleration is set to "Full". Otherwise, "Acceleration.Level" may be one of 0x1 to 0x5, 0x5 meaning "No Acceleration", and 0x1 meaning "All but cursor acceleration" (see "Extended Display Settings").

(4) Set the desired acceleration level, or delete the entry to set "Full" acceleration mode.

(5) Let Windows reload the display settings by using the following code:

DEVMODE devMode;

BOOL success = ::EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devMode);

if (success == TRUE)

{

LONG result = ::ChangeDisplaySettings(&devMode, CDS_RESET);

printf("ChangeDisplaySettings() returned: %d\n", result);

}

First, the current display settings are loaded into the devMode variable, and then, the displayed is forced to perform a reset; at this occasion, the "Acceleration.Level" value is read out from the registry and the new acceleration level is set.

Enjoy, have fun, or do whatever you want to... :-)

f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Link to comment
Share on other sites

Well... get un nervous...

Read ... "HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\VIDEO" , "\Device\Video0"

... it returns a registry path... replace "\Registry\Machine" with "HKLM" and Write the value "Acceleration.Level" there, it is a dword. Delete the value for full acceleration. Set 1 through 6 for the level of decreased acceleration... Then run the ChangeDisplaySettings(&devMode, CDS_RESET); API

it's not hard... I'm surprised noone has written it for you yet.

Lar.

f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Link to comment
Share on other sites

  • 2 years later...

Sorry, this work:

DllCall("user32.dll", "long", "ChangeDisplaySettings", "int", 0, "dword", "CDS_RESET")

thanks for this topic I've been searching for this for long time

I wanna ask please

is this code work perfectly in all PC's (including different video cards) ???

and how to enable hardware acceleration again ??

Link to comment
Share on other sites

is this code work perfectly in all PC's (including different video cards) ???

This is Windows acceleration setting, so yes.

and how to enable hardware acceleration again ??

Enable what? Didn't you read Larry's post?

(3) Look for a DWORD value "Acceleration.Level". If the value does not exists, hardware acceleration is set to "Full". Otherwise, "Acceleration.Level" may be one of 0x1 to 0x5, 0x5 meaning "No Acceleration", and 0x1 meaning "All but cursor acceleration" (see "Extended Display Settings").

(4) Set the desired acceleration level, or delete the entry to set "Full" acceleration mode.

Link to comment
Share on other sites

This is Windows acceleration setting, so yes.

Enable what? Didn't you read Larry's post?

sorry but I found this in web by searching

Disable Hardware Acceleration Option

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Avalon.Graphics\DisableHWAcceleration]

The disable hardware acceleration option enables you to turn off (set its DOWRD value to 1) hardware acceleration for debugging and test purposes. When you see rendering artifacts in an application, try turning off hardware acceleration. If the artifact disappears, the problem might be with your video driver.

A value of 0 enables hardware acceleration.

and I'm trying to do this but I didn't find this value

would you correct me,I may be wrong?

Edited by AlienStar
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...