sencercoltu / openvr-customhmd

Generic OpenVR Driver, STM32 based HeadTracker and wireless motion controller firmware.
55 stars 15 forks source link

DirectMode did not work #1

Open vicdxxx opened 7 years ago

vicdxxx commented 7 years ago

Hi, buddy, I achieve a DirectMode in last version of OpenVR driver(Some hack maybe). But I can not finish a simple display in Jan 31 version, and I made a new driver which steamVR have a error 307. I know new version use PID and VID replace isHMDPresent and other feature in github official release log. I achieve them. Then, I follow your code to modify mine, and ignore those properties I thought it is unnecessary(trouble here?). I do not sure what I have ignored Any help is highly apprecciate!

sencercoltu commented 7 years ago

Hi,

property UsesDriverDirectMode needs to return true, function IsDisplayOnDesktop needs to return false, function IsDisplayRealDisplay, true if using steamvr directmode on a monitor (this bypasses the ivrdirectmodecomponent functions), false if you'll handle textures and layers by yourself. (i think this is what you need.)

Also, maybe it's also necessary to set DirectMode in steamvr.vrsettings to true, (but i think it's only necessary when IsDisplayRealDisplay returns true.) I've also put this into the driver.vrdrivermanifest: (without the comments) "hmd_presence" : [ ".", //make always present, put it here temporarily "1974.0001", //this is my own tracker's VID/PID "1004.61F9", //phone VID/PIV for android display "0FCE.51BA" //another phone VID/PIV for android display ]

The info above might be all wrong, I did all by experimenting, but it works for me.

Hope this helps.

On Wed, Apr 19, 2017 at 5:13 AM, vicdxxx notifications@github.com wrote:

Hi, buddy, I achieve a DirectMode in last version of OpenVR driver(Some hack maybe). But I can not finish a simple display in Jan 31 version, and I made a new driver which steamVR have a error 307. I know new version use PID and VID replace isHMDPresent and other feature in github official release log. I achieve them. Then, I follow your code to modify mine, and ignore those property I thought it is unnecessary(trouble here?). I do not sure what I have ignored Any help is highly apprecciate!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sencercoltu/openvr-customhmd/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/ADmbrBt2ZylW5C5XG3m1frN-rDddCTDLks5rxW2_gaJpZM4NBHSR .

sencercoltu commented 7 years ago

Also, this is my default.vrsettings file content for my driver: if remoteDisplay property is set, driver ignores given edid and directmode properties, and sets directmode automatically true.

{ "driver_customhmd": { "enable": true, "IPD" : 0.065, "camera": "Webcam C170", "camera2": "USB HD Camera", "monitor": "SNYD602", "supersample": 1, "edid_vid": 55629, "edid_pid": 54786, "directMode": true, "remoteDisplay": "1920x1080@127.0.0.1:1974" } }

On Wed, Apr 19, 2017 at 1:03 PM, Sencer Coltu sencercoltu@gmail.com wrote:

Hi,

property UsesDriverDirectMode needs to return true, function IsDisplayOnDesktop needs to return false, function IsDisplayRealDisplay, true if using steamvr directmode on a monitor (this bypasses the ivrdirectmodecomponent functions), false if you'll handle textures and layers by yourself. (i think this is what you need.)

Also, maybe it's also necessary to set DirectMode in steamvr.vrsettings to true, (but i think it's only necessary when IsDisplayRealDisplay returns true.) I've also put this into the driver.vrdrivermanifest: (without the comments) "hmd_presence" : [ ".", //make always present, put it here temporarily "1974.0001", //this is my own tracker's VID/PID "1004.61F9", //phone VID/PIV for android display "0FCE.51BA" //another phone VID/PIV for android display ]

The info above might be all wrong, I did all by experimenting, but it works for me.

Hope this helps.

On Wed, Apr 19, 2017 at 5:13 AM, vicdxxx notifications@github.com wrote:

Hi, buddy, I achieve a DirectMode in last version of OpenVR driver(Some hack maybe). But I can not finish a simple display in Jan 31 version, and I made a new driver which steamVR have a error 307. I know new version use PID and VID replace isHMDPresent and other feature in github official release log. I achieve them. Then, I follow your code to modify mine, and ignore those property I thought it is unnecessary(trouble here?). I do not sure what I have ignored Any help is highly apprecciate!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sencercoltu/openvr-customhmd/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/ADmbrBt2ZylW5C5XG3m1frN-rDddCTDLks5rxW2_gaJpZM4NBHSR .

vicdxxx commented 7 years ago

Thank you very much, I nearly finsih Directmode on Jan31 version refer your code. The problem left is no output image in my hmd, while all other stuffs seem correct, no error occurs, and steamvr icon turn to green. IsDisplayRealDisplay return value did trouble me, and I was not clear about "remoteDisplay" before.

dashingstag commented 7 years ago

Hi I am also facing the same problems in my own driver in that i can activate it in extended mode and it loads in my hmd if i set the HMD as my main display.

However, I can't seem to get it to work in direct mode which I assume the former type which is that it would directly display my output on my HMD. I am thinking since it can do it on extended mode it should be easy to get it to display directly or am I missing something?

I set IsDisplayondesktop to false and IsDislayRealDisplay to true to try to get it to work in "direct" mode but the compositor fails to load.

Sorry this isn't really an issue for your driver but since we are on the topic I thought I could ask. Any help would be appreciated. I have taken a look at your hmd driver but I am still unsure which parts would be relevant.

In addition, may I ask how did you get your edid pid and vid? I got my edid from a monitor asset manager but it gives me a 256 bit number . According to wiki there's a manufacturer id but how do i get the pid and vid?(my display has a usb that i can get the pid and vid from but I assume the edid pid and vid is from the monitor itself?)

Thanks for any guidance.

sencercoltu commented 7 years ago

@dashingstag:

https://en.wikipedia.org/wiki/Extended_Display_Identification_Data

According to the EDID values my manufacturerid is 4D D9 02 D6 (in bytes 8-11 of the 256 byte EDID info).

A = 00001 = 1 = ACSII 65 = 64 + 00001 B = 00010 = 2 = ASCII 66 = 64 + 00010 ... Z = 11010 = 26 = ASCII 90

so

4DD9 to bits = 0100110111011001 0 10011 01110 11001 10101 = 19 => 64 + 19 = 83 = S in ascii 00110 = 14 => 64 + 14 = 78 = N in ascii 11001 = 25 => 64 + 25 = 89 = Y in ascii Vid = SNY

Pid = 02 D6, swap bytes and it becomes D602

Check Device Manager->monitor->Properties->Details->HardwareId's, if the id matches (MONITOR/SNYD602 in my case), you got the right EDID VID/PID values. Convert to decimal and enter them in your steamvr.vrsettings file. If your card is AMD, your display should go in direct mode, if it's NVIDIA, I have no clue, beg NVIDIA to whitelist your EDID.

cjlong1213 commented 7 years ago

Hi, guys, I just DIYed a HMD and made a custom openvr driver for it. I can't choose proper display for SteamVR at extended mode, I have built driver_sample fromhttps://github.com/ValveSoftware/openvr I have two displays, each is 1680x1050. Second is on the right of first(primary one). Everything start well. HMD icon is green. I expect to see SteamVR demo on second monitor, but it is on first/primary monitor. Looks like as I set position to 0,0. I tried 1680,0 but it do not work. the default.vrsettings are as below: { "driver_sample" : { "enable" : true, "serialNumber" : "1234", "modelNumber" : "SampleModel 1", "windowX" : 1680, "windowY" : 0, "windowWidth" : 1680, "windowHeight" : 1050, "renderWidth" : 1680, "renderHeight" : 1050, "secondsFromVsyncToPhotons" : 0.011, "displayFrequency" : 60.0 } }

Thanks in anvance for any guidance.

vicdxxx commented 7 years ago

Thanks guy! I success! I will continue to undertand more details about this. It is very kind of you.

dashingstag commented 7 years ago

@sencercoltu

when you say convert to decimal do you mean (in your case) 4DD9 to deci is 19929 SNY to deci is 837889 both aren't 55629 ? EDIT: OH so you mean you have to SWAP 4D D9 as well to D9 4D to get 55629 which is the VID?

In my case my VID/PID is 12 6A 03 00 = DSJ0003 so my VID would be 12 6A swapped around to 6A 12 = 27154? wow it is like they don't want you to get the vid/pid. 👍

Also, do you know if it is different from "hmd_presence" in the driver.vrdrivermanifest?

Note: i think there is a typo in your message at "D4D9 to bits = 0100110111011001" should be "4DD9 to bits = 0100110111011001"

After doing this I get the result my steamvr fails to initialise and gives me a 109 error :/ I guess that means my hmd isnt whitelisted then.

vicdxxx commented 7 years ago

I have same problem with @cjlong1213 in desktop Mode when set isOnDesktop return true and realDisplay return false;

dashingstag commented 7 years ago

@cjlong1213

Yea I have the same issue. But I bypassed this by setting my HMD as the primary monitor. I am trying to fnd a method to directly display on my HMD without setting it as my primary display as well :(

sencercoltu commented 7 years ago

@dashingstag Bytes 8-11 are 4D D9 02 D6 4D D9 is the edid VID => swap to D94D = 55629 02 D6 is the edid PID => swap to D602 = 54786 values are stored little-endian

and there was a typo in my previous comment, it should be 4dd9 not d4d9, correcting it now.

sencercoltu commented 7 years ago

If you don't have access to the EDID bytes, you can calculate your EDID values like this: Get your monitors hardware id from Device Manager->monitor->Properties->Details->HardwareId. Mine is MONITOR/SNYD602. we will use SNYD602

Take the first 3 letters. S in ASCII is 83, N is 78, Y is 89. (http://www.asciitable.com/)

Now subtract 64 from all values. Result will be 19, 14 and 25.

Convert the values to binary (eg. in windows Calculator->Programmer mode): 19 = 10011 14 = 01100 25 = 11001

Aggregate the 3x5 bits into two bytes: (bit 15 is zero, so we can ignore it) 10011 01110 11001

Convert to decimal: 100110111011001 = 19929 = 0x4DD9

Swap bytes to D94D. This is my VID: 55629. The PID is simpler. Take the last 4 letters of the HardwareId, D602 in my case. This is my PID: 54786.

Enter these to your vrsettings.settings file under Steam/config folder. Return IsDisplayOnDesktop false, and IsDisplayRealDisplay true in your driver, and steamvr should put your monitor into direct mode if your GPU is an AMD. No clues about NVIDIA.

vicdxxx commented 7 years ago

I got what EDID contain VID and PID following your tips, new problem coming, SteamVR games runing with black screen in my driver direct mode... but it work in extended mode. I did use the textures as output so I can see the home scene while no game scene with game launch successfully.

cjlong1213 commented 7 years ago

@dashingstag @vicdxxx Hi, guys. Do you solve the extended mode issue? Would you share the solution. Many Thanks!

dashingstag commented 7 years ago

@cjlong1213 Not yet. Might change to a hmd that is Nvidia whitelisted.

AlanHau commented 7 years ago

Hi guys,

I am using NV card, can I know what's whitelist? Is it in Nvidia control panel? I tried it, but can not have direct mode work

Thanks.

shensheng27 commented 7 years ago

@AlanHau you need contact nvida to whitelist your diy hardware, so nvida graph card will let your hardware in direct mode. If you are developing openVR plugins for your hardware, i suggest implementing the ivrvirtualdisplay interface (which need no direct mode) first to check if the result is ok

AlanHau commented 7 years ago

@shensheng27 Thanks. I will have a try.

cjlong1213 commented 6 years ago

Hi guys,

You can enable direct mode setup as below:

  1. set IsDisplayOnDesktop() return false and set IsDisplayRealDisplay() return true
  2. register properties(VendorID&ProductID) to Steam runtime
  3. wihtelist your hardware to graphic card(NVIDIA) open regedit then create a new key [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\nvlddmkm] "1641970VRWhiteList"="SNY,*;"
  4. invoke NvAPI_DISP_EnableDirectMode(VendorID, 0) You can find NvAPI from Vrworks by NVIDIA. This way is using the SteamVR own direct mode, or you mast implement the IVRDriverDirectModeComponent
dashingstag commented 6 years ago

where do you find NvAPI_DISP_EnableDirectMode(VendorID, 0)?

I downloaded vrworks sdk 2.5 and nvapi but I can't find that utility function.