Redraw coming out of low-power standby mode

We have a photon based embedded instrument that implements
a low-power standby mode.

The video card is an Ampro MiniModule II pc/104 model.

When the instrument goes into standby, we write a value to
an i/o port which places the video in a hardware suspend
mode. Per the Ampro docs, suspend mode is “a very low power
mode in which the display and CPU access to the video
controller are suspended, though the video memory content
is maintained”. It also turns off our LCD backlight.

Entering and exiting suspend mode works, with a glitch. Some
of the Photon widgets are not redrawn when exiting suspend.
If video memory is truly maintained, then I can’t see the
need to redraw, but so it goes.

What is the best way to force the existing screen widgets to
all be redrawn in their current state and position?

I have tried a PtReRealizeWidget() on the base window and
that doesn’t seem to redraw the base window background and
all the overlaid windows.

Do I need to track each displayed widget and PtReRealizeWidget()
each one of them? There’s gotta be a better way.

TIA

Hello Ken

If you emit an expose event when you come out of standby mode, it will cause
everything to redraw. This should solve your problem.

Thanks
Rodney

Ken Schumm <kwschumm@qqssoollvv.com> wrote:

We have a photon based embedded instrument that implements
a low-power standby mode.

The video card is an Ampro MiniModule II pc/104 model.

When the instrument goes into standby, we write a value to
an i/o port which places the video in a hardware suspend
mode. Per the Ampro docs, suspend mode is “a very low power
mode in which the display and CPU access to the video
controller are suspended, though the video memory content
is maintained”. It also turns off our LCD backlight.

Entering and exiting suspend mode works, with a glitch. Some
of the Photon widgets are not redrawn when exiting suspend.
If video memory is truly maintained, then I can’t see the
need to redraw, but so it goes.

What is the best way to force the existing screen widgets to
all be redrawn in their current state and position?

I have tried a PtReRealizeWidget() on the base window and
that doesn’t seem to redraw the base window background and
all the overlaid windows.

Do I need to track each displayed widget and PtReRealizeWidget()
each one of them? There’s gotta be a better way.

TIA

Sorry, just have one other thing to add

Gui Group <gui@qnx.com> wrote:

Hello Ken

If you emit an expose event when you come out of standby mode, it will cause
everything to redraw. This should solve your problem.

You have to emit this event from the device region ( Ph_DEV_RID ).

Thanks
Rodney

Thanks
Rodney

Ken Schumm <> kwschumm@qqssoollvv.com> > wrote:
We have a photon based embedded instrument that implements
a low-power standby mode.

The video card is an Ampro MiniModule II pc/104 model.

When the instrument goes into standby, we write a value to
an i/o port which places the video in a hardware suspend
mode. Per the Ampro docs, suspend mode is “a very low power
mode in which the display and CPU access to the video
controller are suspended, though the video memory content
is maintained”. It also turns off our LCD backlight.

Entering and exiting suspend mode works, with a glitch. Some
of the Photon widgets are not redrawn when exiting suspend.
If video memory is truly maintained, then I can’t see the
need to redraw, but so it goes.

What is the best way to force the existing screen widgets to
all be redrawn in their current state and position?

I have tried a PtReRealizeWidget() on the base window and
that doesn’t seem to redraw the base window background and
all the overlaid windows.

Do I need to track each displayed widget and PtReRealizeWidget()
each one of them? There’s gotta be a better way.

TIA

Thanks for the advice, but I haven’t been able to make it work.

I lifted the code I’m using from the PhEventEmit() example, which
is documented as emitting an expose event from the device region.

When this code runs coming out of standby, the base window does
update properly, but any windows/dialogs that are overlaid on the
base window remain partially undrawn.

Is the example code incorrect?

Previously, Gui Group wrote in qdn.public.qnx4.photon:

Sorry, just have one other thing to add

Gui Group <> gui@qnx.com> > wrote:
Hello Ken

If you emit an expose event when you come out of standby mode, it will cause
everything to redraw. This should solve your problem.

You have to emit this event from the device region ( Ph_DEV_RID ).

Thanks
Rodney

Thanks
Rodney

Ken Schumm <> kwschumm@qqssoollvv.com> > wrote:
We have a photon based embedded instrument that implements
a low-power standby mode.

The video card is an Ampro MiniModule II pc/104 model.

When the instrument goes into standby, we write a value to
an i/o port which places the video in a hardware suspend
mode. Per the Ampro docs, suspend mode is “a very low power
mode in which the display and CPU access to the video
controller are suspended, though the video memory content
is maintained”. It also turns off our LCD backlight.

Entering and exiting suspend mode works, with a glitch. Some
of the Photon widgets are not redrawn when exiting suspend.
If video memory is truly maintained, then I can’t see the
need to redraw, but so it goes.

What is the best way to force the existing screen widgets to
all be redrawn in their current state and position?

I have tried a PtReRealizeWidget() on the base window and
that doesn’t seem to redraw the base window background and
all the overlaid windows.

Do I need to track each displayed widget and PtReRealizeWidget()
each one of them? There’s gotta be a better way.

TIA

Hello Ken

Did you set the emitter id in the event structure to be equal to Ph_DEV_RID?

Thanks
Rodney

Ken Schumm <kwschumm@qqssoollvv.com> wrote:

Thanks for the advice, but I haven’t been able to make it work.

I lifted the code I’m using from the PhEventEmit() example, which
is documented as emitting an expose event from the device region.

When this code runs coming out of standby, the base window does
update properly, but any windows/dialogs that are overlaid on the
base window remain partially undrawn.

Is the example code incorrect?

Previously, Gui Group wrote in qdn.public.qnx4.photon:
Sorry, just have one other thing to add

Gui Group <> gui@qnx.com> > wrote:
Hello Ken

If you emit an expose event when you come out of standby mode, it will cause
everything to redraw. This should solve your problem.

You have to emit this event from the device region ( Ph_DEV_RID ).

Thanks
Rodney

Thanks
Rodney

Ken Schumm <> kwschumm@qqssoollvv.com> > wrote:
We have a photon based embedded instrument that implements
a low-power standby mode.

The video card is an Ampro MiniModule II pc/104 model.

When the instrument goes into standby, we write a value to
an i/o port which places the video in a hardware suspend
mode. Per the Ampro docs, suspend mode is “a very low power
mode in which the display and CPU access to the video
controller are suspended, though the video memory content
is maintained”. It also turns off our LCD backlight.

Entering and exiting suspend mode works, with a glitch. Some
of the Photon widgets are not redrawn when exiting suspend.
If video memory is truly maintained, then I can’t see the
need to redraw, but so it goes.

What is the best way to force the existing screen widgets to
all be redrawn in their current state and position?

I have tried a PtReRealizeWidget() on the base window and
that doesn’t seem to redraw the base window background and
all the overlaid windows.

Do I need to track each displayed widget and PtReRealizeWidget()
each one of them? There’s gotta be a better way.

TIA

Yes. Here’s the relevent code that executes when coming out
of standby:

----- cut --------

/*

  • Emit an expose event to force a complete screen redraw
    */

{
PhEvent_t event ;
PhRect_t rect ;

event.type = Ph_EV_EXPOSE ;
event.subtype = 0 ;
event.flags = Ph_EVENT_INCLUSIVE ; // Tried with zero, too
event.emitter.rid = Ph_DEV_RID ;
event.num_rects = 1 ;
event.data_len = 0 ;
rect.ul.x = rect.ul.y = SHRT_MIN ;
rect.lr.x = rect.lr.y = SHRT_MAX ;
PhEventEmit( &event, &rect, NULL ) ;
}

----- cut --------

My test has one dialog on top of the base window, and the solid
grey dialog background and a label aren’t redrawn.


Previously, Gui Group wrote in qdn.public.qnx4.photon:

Hello Ken

Did you set the emitter id in the event structure to be equal to Ph_DEV_RID?

Thanks
Rodney

Ken Schumm <> kwschumm@qqssoollvv.com> > wrote:
Thanks for the advice, but I haven’t been able to make it work.

I lifted the code I’m using from the PhEventEmit() example, which
is documented as emitting an expose event from the device region.

When this code runs coming out of standby, the base window does
update properly, but any windows/dialogs that are overlaid on the
base window remain partially undrawn.

Is the example code incorrect?

Previously, Gui Group wrote in qdn.public.qnx4.photon:
Sorry, just have one other thing to add

Gui Group <> gui@qnx.com> > wrote:
Hello Ken

If you emit an expose event when you come out of standby mode, it will cause
everything to redraw. This should solve your problem.

You have to emit this event from the device region ( Ph_DEV_RID ).

Thanks
Rodney

Thanks
Rodney

Ken Schumm <> kwschumm@qqssoollvv.com> > wrote:
We have a photon based embedded instrument that implements
a low-power standby mode.

The video card is an Ampro MiniModule II pc/104 model.

When the instrument goes into standby, we write a value to
an i/o port which places the video in a hardware suspend
mode. Per the Ampro docs, suspend mode is “a very low power
mode in which the display and CPU access to the video
controller are suspended, though the video memory content
is maintained”. It also turns off our LCD backlight.

Entering and exiting suspend mode works, with a glitch. Some
of the Photon widgets are not redrawn when exiting suspend.
If video memory is truly maintained, then I can’t see the
need to redraw, but so it goes.

What is the best way to force the existing screen widgets to
all be redrawn in their current state and position?

I have tried a PtReRealizeWidget() on the base window and
that doesn’t seem to redraw the base window background and
all the overlaid windows.

Do I need to track each displayed widget and PtReRealizeWidget()
each one of them? There’s gotta be a better way.

TIA
\

Hello Ken

What happens when instead of declaring PhEvent_t event; you declare PhEvent_t event = {0};?
I’ve been told that the reason your not seeing the behaviour that you are expecting is
because the event that you are emiting will on be enqueued to a region that has the
same id as that which is soecified in the events collector id. The collector id is
probably being initialized to junk and therefore the event is not going to the places
that you want it to. It’s a problem in our docs. It has been fixed in the QNX 6 docs.

Ken Schumm <kwschumm@qqssoollvv.com> wrote:

Yes. Here’s the relevent code that executes when coming out
of standby:

----- cut --------

/*

  • Emit an expose event to force a complete screen redraw
    */

{
PhEvent_t event ;
PhRect_t rect ;

event.type = Ph_EV_EXPOSE ;
event.subtype = 0 ;
event.flags = Ph_EVENT_INCLUSIVE ; // Tried with zero, too
event.emitter.rid = Ph_DEV_RID ;
event.num_rects = 1 ;
event.data_len = 0 ;
rect.ul.x = rect.ul.y = SHRT_MIN ;
rect.lr.x = rect.lr.y = SHRT_MAX ;
PhEventEmit( &event, &rect, NULL ) ;
}

----- cut --------

My test has one dialog on top of the base window, and the solid
grey dialog background and a label aren’t redrawn.



Previously, Gui Group wrote in qdn.public.qnx4.photon:
Hello Ken

Did you set the emitter id in the event structure to be equal to Ph_DEV_RID?

Thanks
Rodney

Ken Schumm <> kwschumm@qqssoollvv.com> > wrote:
Thanks for the advice, but I haven’t been able to make it work.

I lifted the code I’m using from the PhEventEmit() example, which
is documented as emitting an expose event from the device region.

When this code runs coming out of standby, the base window does
update properly, but any windows/dialogs that are overlaid on the
base window remain partially undrawn.

Is the example code incorrect?

Previously, Gui Group wrote in qdn.public.qnx4.photon:
Sorry, just have one other thing to add

Gui Group <> gui@qnx.com> > wrote:
Hello Ken

If you emit an expose event when you come out of standby mode, it will cause
everything to redraw. This should solve your problem.

You have to emit this event from the device region ( Ph_DEV_RID ).

Thanks
Rodney

Thanks
Rodney

Ken Schumm <> kwschumm@qqssoollvv.com> > wrote:
We have a photon based embedded instrument that implements
a low-power standby mode.

The video card is an Ampro MiniModule II pc/104 model.

When the instrument goes into standby, we write a value to
an i/o port which places the video in a hardware suspend
mode. Per the Ampro docs, suspend mode is “a very low power
mode in which the display and CPU access to the video
controller are suspended, though the video memory content
is maintained”. It also turns off our LCD backlight.

Entering and exiting suspend mode works, with a glitch. Some
of the Photon widgets are not redrawn when exiting suspend.
If video memory is truly maintained, then I can’t see the
need to redraw, but so it goes.

What is the best way to force the existing screen widgets to
all be redrawn in their current state and position?

I have tried a PtReRealizeWidget() on the base window and
that doesn’t seem to redraw the base window background and
all the overlaid windows.

Do I need to track each displayed widget and PtReRealizeWidget()
each one of them? There’s gotta be a better way.

TIA
\

Previously, Gui Group wrote in qdn.public.qnx4.photon:

Hello Ken

What happens when instead of declaring PhEvent_t event; you declare PhEvent_t event = {0};?
I’ve been told that the reason your not seeing the behaviour that you are expecting is
because the event that you are emiting will on be enqueued to a region that has the
same id as that which is soecified in the events collector id. The collector id is
probably being initialized to junk and therefore the event is not going to the places
that you want it to. It’s a problem in our docs. It has been fixed in the QNX 6 docs.

That didn’t make any difference.

Perhaps I should expound on our gui design.

It is a 320x240 full screen app running without pdm or pwm. The base
window covers the entire screen. The mid-section of the base window
is where various instrument dialogs are displayed, which display the
measurements for the user. There is always a dialog displayed in this
area.

When the user presses standby, the gui draws a giant button (transparent
fill) that covers the entire base window, then writes to an i/o port to
go into low power mode. The purpose of the giant button is so the user
can press anywhere on the screen to exit standby.

When the user touches the “giant button” to exit standby, it is
destroyed with PtDestroyWidget(), then the code you recommended runs
to issue an expose event from the device region.

The base window is redrawn properly, but the dialog is not. The dialog
contains a measurement field that is refreshed 3 times a second, and a
static label. At screen refresh time, the measurement value is displayed,
but the static label and background of the dialog remain blank. I suspect
that without the screen refresh the entire dialog would be blank.

Hey Ken

Can you try moving the giant button to a dialog box that covers the screen
and then just remove the dialog box when the user wants to come out of
standby mode. See what happens when you do that.

Thanks
Rodney

Ken Schumm <kwschumm@qqssoollvv.com> wrote:

Previously, Gui Group wrote in qdn.public.qnx4.photon:
Hello Ken

What happens when instead of declaring PhEvent_t event; you declare PhEvent_t event = {0};?
I’ve been told that the reason your not seeing the behaviour that you are expecting is
because the event that you are emiting will on be enqueued to a region that has the
same id as that which is soecified in the events collector id. The collector id is
probably being initialized to junk and therefore the event is not going to the places
that you want it to. It’s a problem in our docs. It has been fixed in the QNX 6 docs.


That didn’t make any difference.

Perhaps I should expound on our gui design.

It is a 320x240 full screen app running without pdm or pwm. The base
window covers the entire screen. The mid-section of the base window
is where various instrument dialogs are displayed, which display the
measurements for the user. There is always a dialog displayed in this
area.

When the user presses standby, the gui draws a giant button (transparent
fill) that covers the entire base window, then writes to an i/o port to
go into low power mode. The purpose of the giant button is so the user
can press anywhere on the screen to exit standby.

When the user touches the “giant button” to exit standby, it is
destroyed with PtDestroyWidget(), then the code you recommended runs
to issue an expose event from the device region.

The base window is redrawn properly, but the dialog is not. The dialog
contains a measurement field that is refreshed 3 times a second, and a
static label. At screen refresh time, the measurement value is displayed,
but the static label and background of the dialog remain blank. I suspect
that without the screen refresh the entire dialog would be blank.

The giant button is already on a dialog box - I neglected to make that
clear.

I added some code when coming out of standy mode that does this:

PtWidget_t *current ;

current = PtWidgetChildFront( ABW_base ) ;
PtDamageWidget( current ) ;

This seems to fix our immediate problem, but I’d sure like to know
why this code is necessary.

Is it something to do with the fact that we don’t run pwm? The
ramifications of NOT running pwm do not seem to be well documented.

Previously, Gui Group wrote in qdn.public.qnx4.photon:

Hey Ken

Can you try moving the giant button to a dialog box that covers the screen
and then just remove the dialog box when the user wants to come out of
standby mode. See what happens when you do that.

Thanks
Rodney
[…]

Hello Ken

About the only thing one of the developers can come up with here, is that the
driver needs a little time to get started up before it starts receiving
commands to draw. To test this you could place a delay after the button
is destroyed and the dialog box removed to see if that improves the situation.

Thanks
Rodney

Ken Schumm <kwschumm@ih8spamqsolv.com> wrote:

The giant button is already on a dialog box - I neglected to make that
clear.

I added some code when coming out of standy mode that does this:

PtWidget_t *current ;

current = PtWidgetChildFront( ABW_base ) ;
PtDamageWidget( current ) ;

This seems to fix our immediate problem, but I’d sure like to know
why this code is necessary.

Is it something to do with the fact that we don’t run pwm? The
ramifications of NOT running pwm do not seem to be well documented.

Previously, Gui Group wrote in qdn.public.qnx4.photon:
Hey Ken

Can you try moving the giant button to a dialog box that covers the screen
and then just remove the dialog box when the user wants to come out of
standby mode. See what happens when you do that.

Thanks
Rodney
[…]

Sorry Ken

I didn’t quite grasp what the developer was trying to explain to me. Basically the
steps that you should take BEFORE the button is destroyed is:

tell the hardware to get out of standby
give the hardware and driver some time to get ready
then destroy the dialog to emit an expose

Thanks
Rodney



Gui Group <gui@qnx.com> wrote:

Hello Ken

About the only thing one of the developers can come up with here, is that the
driver needs a little time to get started up before it starts receiving
commands to draw. To test this you could place a delay after the button
is destroyed and the dialog box removed to see if that improves the situation.

Thanks
Rodney

Ken Schumm <> kwschumm@ih8spamqsolv.com> > wrote:
The giant button is already on a dialog box - I neglected to make that
clear.

I added some code when coming out of standy mode that does this:

PtWidget_t *current ;

current = PtWidgetChildFront( ABW_base ) ;
PtDamageWidget( current ) ;

This seems to fix our immediate problem, but I’d sure like to know
why this code is necessary.

Is it something to do with the fact that we don’t run pwm? The
ramifications of NOT running pwm do not seem to be well documented.

Previously, Gui Group wrote in qdn.public.qnx4.photon:
Hey Ken

Can you try moving the giant button to a dialog box that covers the screen
and then just remove the dialog box when the user wants to come out of
standby mode. See what happens when you do that.

Thanks
Rodney
[…]

That seems to do the job.

I tried a delay of a five milliseconds before the button was destroyed, and
that didn’t work. When increased to 1/2 second it works. There are no specs
for how long it takes for the video controller to start back up (it’s an
EPSON part).

Thanks again, and tell your developer congrats for me!


Previously, Gui Group wrote in qdn.public.qnx4.photon:

Sorry Ken

I didn’t quite grasp what the developer was trying to explain to me. Basically the
steps that you should take BEFORE the button is destroyed is:

tell the hardware to get out of standby
give the hardware and driver some time to get ready
then destroy the dialog to emit an expose

Thanks
Rodney



Gui Group <> gui@qnx.com> > wrote:
Hello Ken

About the only thing one of the developers can come up with here, is that the
driver needs a little time to get started up before it starts receiving
commands to draw. To test this you could place a delay after the button
is destroyed and the dialog box removed to see if that improves the situation.

Thanks
Rodney

Ken Schumm <> kwschumm@ih8spamqsolv.com> > wrote:
The giant button is already on a dialog box - I neglected to make that
clear.

I added some code when coming out of standy mode that does this:

PtWidget_t *current ;

current = PtWidgetChildFront( ABW_base ) ;
PtDamageWidget( current ) ;

This seems to fix our immediate problem, but I’d sure like to know
why this code is necessary.

Is it something to do with the fact that we don’t run pwm? The
ramifications of NOT running pwm do not seem to be well documented.

Previously, Gui Group wrote in qdn.public.qnx4.photon:
Hey Ken

Can you try moving the giant button to a dialog box that covers the screen
and then just remove the dialog box when the user wants to come out of
standby mode. See what happens when you do that.

Thanks
Rodney
[…]

Hello Ken

Glad to hear it worked. The developer who gave me that information usually reads these
groups, so he’ll see you congrats ( how do you figure I knew that I had to post a followup
to that incorrect post about putting the delay after the button was destroyed :slight_smile: ).

Thanks
Rodney

Ken Schumm <kwschumm@ih8spamqsolv.com> wrote:

That seems to do the job.

I tried a delay of a five milliseconds before the button was destroyed, and
that didn’t work. When increased to 1/2 second it works. There are no specs
for how long it takes for the video controller to start back up (it’s an
EPSON part).

Thanks again, and tell your developer congrats for me!



Previously, Gui Group wrote in qdn.public.qnx4.photon:
Sorry Ken

I didn’t quite grasp what the developer was trying to explain to me. Basically the
steps that you should take BEFORE the button is destroyed is:

tell the hardware to get out of standby
give the hardware and driver some time to get ready
then destroy the dialog to emit an expose

Thanks
Rodney



Gui Group <> gui@qnx.com> > wrote:
Hello Ken

About the only thing one of the developers can come up with here, is that the
driver needs a little time to get started up before it starts receiving
commands to draw. To test this you could place a delay after the button
is destroyed and the dialog box removed to see if that improves the situation.

Thanks
Rodney

Ken Schumm <> kwschumm@ih8spamqsolv.com> > wrote:
The giant button is already on a dialog box - I neglected to make that
clear.

I added some code when coming out of standy mode that does this:

PtWidget_t *current ;

current = PtWidgetChildFront( ABW_base ) ;
PtDamageWidget( current ) ;

This seems to fix our immediate problem, but I’d sure like to know
why this code is necessary.

Is it something to do with the fact that we don’t run pwm? The
ramifications of NOT running pwm do not seem to be well documented.

Previously, Gui Group wrote in qdn.public.qnx4.photon:
Hey Ken

Can you try moving the giant button to a dialog box that covers the screen
and then just remove the dialog box when the user wants to come out of
standby mode. See what happens when you do that.

Thanks
Rodney
[…]