Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set custom resolution? #53

Open
MACTEP434 opened this issue Nov 30, 2021 · 7 comments
Open

How to set custom resolution? #53

MACTEP434 opened this issue Nov 30, 2021 · 7 comments

Comments

@MACTEP434
Copy link

MACTEP434 commented Nov 30, 2021

Hi! This part of code doesn't work

var displayTest = new DisplayDevice(2147881091);
var timing = displayTest.CalculateTiming(800, 600, 60, false);
var res1 = new CustomResolution(800, 600, NvAPIWrapper.Native.Display.ColorFormat.P8, timing);
displayTest.TrialCustomResolution(res1);
displayTest.SaveCustomResolution();

Crashed on TrialCustomResolution (NvAPI error).
Help please

@MACTEP434 MACTEP434 changed the title How to set custom resolution& How to set custom resolution? Nov 30, 2021
@falahati
Copy link
Owner

falahati commented Nov 30, 2021

usually, it's a timing problem. Change the color format to A8R8G8B8 and try again; otherwise, play with other variables; get the current timing and compare it with the one you have to see if you have to copy something over.

@MACTEP434
Copy link
Author

MACTEP434 commented Dec 1, 2021

usually, it's a timing problem. Change the color format to A8R8G8B8 and try again; otherwise, play with other variables; get the current timing and compare it with the one you have to see if you have to copy something over.

Maybe my var displayTest = new DisplayDevice(2147881091); - is single display?
Im trying to set custom resolution before bulid mosiac.

Stacktrace:
at NvAPIWrapper.Native.DisplayApi.TryCustomDisplay(IDictionary```2 displayIdCustomDisplayPairs)
at CrodMosaic.NET.Program.Main(String[] args) in C:\CobraDev\NvAPI\CrodMosaic.NET\CrodMosaic.NET\Program.cs:line 32

@falahati
Copy link
Owner

falahati commented Dec 1, 2021

these files might be useful as an example for grid management (mosaic v2) set of APIs:
https://github.com/falahati/HeliosDisplayManagement/tree/master/HeliosDisplayManagement.Shared/NVIDIA

otherwise, I have no new input here; the driver can reject a timing for absolutely any reason and NVAPI is not great with error messages. so my guess is the same as before.

Maybe my `var displayTest = new DisplayDevice(2147881091);` - is single display?

DisplayDevice represents a single physical display device. I don't like the fact that you are using a const for the id, would rather see a code to get all display devices and find the right one. but yeah if the number is correct, it is a display device. also, I don't think you add a custom resolution while in the surround mode.

@falahati
Copy link
Owner

falahati commented Dec 1, 2021

There is six types of display in NVAPI:

  1. DisplayDevice: Represents a physical display, your own monitor
  2. Display: A logical connected display
  3. UnattachedDisplay: A logical disconnected display
  4. GridTopologyDisplay: A physical display used in the mosaic arrangement
  5. PathTargetInfo: A logical display device presented to windows (could be a physical device or Nvidia Surround virtual device)
  6. PathInfo: A logical screen created by windows (contains one or more PathTargetInfo that contains one Display)

@MACTEP434
Copy link
Author

I need a beer on this weekend, and try again.....

@coccoalberto97
Copy link

coccoalberto97 commented Apr 4, 2022

Hello, I'm also facing issues setting a custom resolution using this library.

var displays = Display.GetDisplays(); foreach (var display in displays) { DisplayDevice displayTest = display.DisplayDevice; var timing = displayTest.CalculateTiming(1920, 1080, 60, false); var res1 = new CustomResolution(1920, 1080, NvAPIWrapper.Native.Display.ColorFormat.A8R8G8B8, timing); try{ displayTest.TrialCustomResolution(res1); displayTest.SaveCustomResolution(); .LogInformation(display.Name); }catch(Exception e){ _logger.LogError(e, "Error"); } }

Error NVAPI_ERROR:
at NvAPIWrapper.Native.DisplayApi.TryCustomDisplay(IDictionary`2 displayIdCustomDisplayPairs)
at NvAPIWrapper.Display.DisplayDevice.TrialCustomResolution(CustomResolution customResolution, UInt32[] displayIds, Boolean hardwareModeSetOnly)
at NvAPIWrapper.Display.DisplayDevice.TrialCustomResolution(CustomResolution customResolution, Boolean hardwareModeSetOnly)

@FoLLgoTT
Copy link

I got the same problem. But when I use the overload with refreshRate of CustomResolution() it works. With ColorFormat I never got it to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants