Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - PdGetDevices() and PdSetTagetDevice(): can't get what to do: (11 Items)
   
PdGetDevices() and PdSetTagetDevice(): can't get what to do  
PdGetDevices() returns array of rids, it's ok with this function. Clear and understandable.

a) PdSetTargetDevice() requires DC, and documentation mentions, that I can pass PdOffscreenContext_t to it, so I need to
 create it.

b) PdCreateOffscreenContext() and PdCreateOffscreenContextGF() documentation mentions, that before offscreen context 
creation I must target this function to the specific device, go to step a).

This looks a bit of recursive for me.

What to do if I have two different video cards which are handled by Photon ? As far as I understand, PdGetDevices() 
returns two rids in array. But what to do next ? How to target PdCreateOffscreenContext() or 
PdCreateOffscreenContextGF() to specific video driver, for right memory allocation. I can imaging what would be if 
memory was allocated by one driver and then was passed it to another driver :-/
RE: PdGetDevices() and PdSetTagetDevice(): can't get what to do  
Yeah, it can get confusing, it is so flexible it is rigid sometimes :)
 
In the general case, you do not need to call PdGetDevices() and PdSetTargetDevice(), because by default the library sets
 everything up for the primary display device.
 
Now, if you had two graphics cards in the machine, you could use PdGetDevices() to find the information of the graphics 
regions.  You when then call:
 
PdSetTargetDevice(NULL, target_rid_of_device_to_use);
PdCreateOffscreenContext(..................);
 
The first parameter of PdSetTargetDevice() is the 'default' draw context you want everything referenced against ... by 
default it is the draw context contained in the global _Ph_.  If you were using another draw context as your 'default', 
you would pass it in there ... but yes, from the docs it can appear that there is a circular dependency.
 
I hope this is a little more clear now.  It does not help anything that 'void *' were used in all these prototypes.
 
Kind Regards,
-Derek

________________________________

From: Mike Gorchak [mailto:community-noreply@qnx.com]
Sent: Fri 27/03/2009 4:03 AM
To: photon-graphics
Subject: PdGetDevices() and PdSetTagetDevice(): can't get what to do



PdGetDevices() returns array of rids, it's ok with this function. Clear and understandable.

a) PdSetTargetDevice() requires DC, and documentation mentions, that I can pass PdOffscreenContext_t to it, so I need to
 create it.

b) PdCreateOffscreenContext() and PdCreateOffscreenContextGF() documentation mentions, that before offscreen context 
creation I must target this function to the specific device, go to step a).

This looks a bit of recursive for me.

What to do if I have two different video cards which are handled by Photon ? As far as I understand, PdGetDevices() 
returns two rids in array. But what to do next ? How to target PdCreateOffscreenContext() or 
PdCreateOffscreenContextGF() to specific video driver, for right memory allocation. I can imaging what would be if 
memory was allocated by one driver and then was passed it to another driver :-/


_______________________________________________
Photon microGUI
http://community.qnx.com/sf/go/post25421



Attachment: Text winmail.dat 5.01 KB
Re: RE: PdGetDevices() and PdSetTagetDevice(): can't get what to do  
> I hope this is a little more clear now.  It does not help anything that 'void 
> *' were used in all these prototypes.

Thank you, it is completely clear for me now, and I have a new bug report :) Got really strange PgGetGraphicsHWCaps() 
and PgGetVideoModeInfo() functions behavior in my application, they are both return -1 as return code. My thoughts was 
about it is due to incorrect PdSetTargetDevice() function call ...

Photon uses devg-extreme2 and devg-radeon video drivers, running at 1680x1050x32 @ 60Hz (both video drivers), it is a 
custom video mode. Looks like when custom video mode is set, photon can't return anything when I call 
PgGetGraphicsHWCaps() function, due to current mode is not listed by Photon internals. This problem could be reproduced 
using also one driver only.

All I need is save current graphics mode, set my own and after application shutdown restore original video mode. Is it 
possible somehow to this for custom video modes ?
RE: RE: PdGetDevices() and PdSetTagetDevice(): can't get what to do  
Oh no ... I have filed PR##### for me to investigate this.  io-graphics is making gf calls, but also maintains a table, 
I will have to determine the root cause.
 
What if you queried the graphics region, and used the settings from that, does it work then?
 
PhWindowQueryVisible() using Ph_QUERY_GRAPHICS ... of course, this does not give the colour bits :(
but you can bits from ... hey, I got a crazy idea ...
 
osc = PdCreateOffscreenContext(0, 0, 0, Pg_OSC_MAIN_DISPLAY);
 
The reference osc->dim for the resolution, and osc->format for the pixel format ... messy, but it just might work, then 
call:
 
PhDCRelease(osc);
 
-Derek

________________________________

From: Mike Gorchak [mailto:community-noreply@qnx.com]
Sent: Fri 27/03/2009 5:52 AM
To: photon-graphics
Subject: Re: RE: PdGetDevices() and PdSetTagetDevice(): can't get what to do



> I hope this is a little more clear now.  It does not help anything that 'void
> *' were used in all these prototypes.

Thank you, it is completely clear for me now, and I have a new bug report :) Got really strange PgGetGraphicsHWCaps() 
and PgGetVideoModeInfo() functions behavior in my application, they are both return -1 as return code. My thoughts was 
about it is due to incorrect PdSetTargetDevice() function call ...

Photon uses devg-extreme2 and devg-radeon video drivers, running at 1680x1050x32 @ 60Hz (both video drivers), it is a 
custom video mode. Looks like when custom video mode is set, photon can't return anything when I call 
PgGetGraphicsHWCaps() function, due to current mode is not listed by Photon internals. This problem could be reproduced 
using also one driver only.

All I need is save current graphics mode, set my own and after application shutdown restore original video mode. Is it 
possible somehow to this for custom video modes ?


_______________________________________________
Photon microGUI
http://community.qnx.com/sf/go/post25425



Attachment: Text winmail.dat 5.14 KB
Re: RE: RE: PdGetDevices() and PdSetTagetDevice(): can't get what to do  
It will work, but ... how to setup original video mode, which was before my video mode switching ? PgSetVideoMode() 
requires mode number, but looks like I have problem with it ...
RE: RE: RE: PdGetDevices() and PdSetTagetDevice(): can't get what to do  
ouch ... you are correct ... can this even be accomplished with gf calls, or they error out as well?

________________________________

From: Mike Gorchak [mailto:community-noreply@qnx.com]
Sent: Fri 27/03/2009 6:25 AM
To: photon-graphics
Subject: Re: RE: RE: PdGetDevices() and PdSetTagetDevice(): can't get what to do



It will work, but ... how to setup original video mode, which was before my video mode switching ? PgSetVideoMode() 
requires mode number, but looks like I have problem with it ...


_______________________________________________
Photon microGUI
http://community.qnx.com/sf/go/post25429



Attachment: Text winmail.dat 3.57 KB
Re: RE: RE: RE: PdGetDevices() and PdSetTagetDevice(): can't get what to do  
> ouch ... you are correct ... can this even be accomplished with gf calls, or 
> they error out as well?

No gf_display_set_mode() works fine, but after GF's mode switch I must somehow tell to Photon in which video it now 
works ... dunno how to do this.
RE: RE: RE: RE: PdGetDevices() and PdSetTagetDevice(): can't get what to do  
Oh, now I get it ... because even if the GF call works, Photon will assume it is in another resolution, and everything 
will get screwed up on the display ... correct?

________________________________

From: Mike Gorchak [mailto:community-noreply@qnx.com]
Sent: Fri 27/03/2009 7:03 AM
To: photon-graphics
Subject: Re: RE: RE: RE: PdGetDevices() and PdSetTagetDevice(): can't get what to do



> ouch ... you are correct ... can this even be accomplished with gf calls, or
> they error out as well?

No gf_display_set_mode() works fine, but after GF's mode switch I must somehow tell to Photon in which video it now 
works ... dunno how to do this.


_______________________________________________
Photon microGUI
http://community.qnx.com/sf/go/post25432



Attachment: Text winmail.dat 3.72 KB
Re: RE: RE: RE: RE: PdGetDevices() and PdSetTagetDevice(): can't get what to do  
> Oh, now I get it ... because even if the GF call works, Photon will assume it 
> is in another resolution, and everything will get screwed up on the display ..
> . correct?

yes, you are quite correct :)
RE: RE: PdGetDevices() and PdSetTagetDevice(): can't get what to do  
 

Filed PR66817 for your reference.

_______________________________________________
Photon microGUI
http://community.qnx.com/sf/go/post25425


Attachment: Text winmail.dat 3.02 KB
Re: RE: RE: PdGetDevices() and PdSetTagetDevice(): can't get what to do  
Another strange thing. When I call PdSetTagetDevice(NULL, rid[0]) twice, the second call returns an error (-1), is that 
supposed to be like that ?

It is suitable to not store which device is currently targeted, and always setup required target device before Pd/Pg 
function call (maybe bad way, but good for applications, which calling Pd/Pg functions not so frequently).