Gui redraw performance

Hi

I am experiencing poor graphics performance in my application, and I am
seeking guidance on the best way to get the best performance for my type of
application.

My application has a PtRaw widget into which I draw an image. The widget is
damaged at a regualr interval by a timer and needs to be completely redrawn.

The Raw canvas is 800x400 pixels The image I am drawing is 800x400 and has
the Pg_IMAGE_DIRECT_888 attribute set.
It is created by PhCreateImage().

Unfortunately, how the image is populated with data is currently a black box
to me, but I have to display its contents on the screen.

My problem is that on an 800Mz laptop with LCD display I see the image drawn
raster fashion from top to bottom of the display, which results in a
flicker.

On my ultimate target platform (which is slower) the flicker is unbearable.

To add to the problem, I then need to overlay information or simple popup
menus on the image.

Before I start to blame the performance of the graphics drivers (which are
not common between my two test scenarios) I would be interested in getting
ideas about the most effective use of the photon libraries for getting the
best flicker free graphics performance in such an application.

Any thought would be much appreciated.

Regards
Nic

Hello Nic

Is the image in shared memory? Putting it in shared memry would help if
it’s not already there. Also, can you render it in an offscreen context
and then do a context blit from the offscreen context to the raw widget?
This should reduce the amount of flicker.

Rodney


Nic Smith wrote:

Hi

I am experiencing poor graphics performance in my application, and I am
seeking guidance on the best way to get the best performance for my type of
application.

My application has a PtRaw widget into which I draw an image. The widget is
damaged at a regualr interval by a timer and needs to be completely redrawn.

The Raw canvas is 800x400 pixels The image I am drawing is 800x400 and has
the Pg_IMAGE_DIRECT_888 attribute set.
It is created by PhCreateImage().

Unfortunately, how the image is populated with data is currently a black box
to me, but I have to display its contents on the screen.

My problem is that on an 800Mz laptop with LCD display I see the image drawn
raster fashion from top to bottom of the display, which results in a
flicker.

On my ultimate target platform (which is slower) the flicker is unbearable.

To add to the problem, I then need to overlay information or simple popup
menus on the image.

Before I start to blame the performance of the graphics drivers (which are
not common between my two test scenarios) I would be interested in getting
ideas about the most effective use of the photon libraries for getting the
best flicker free graphics performance in such an application.

Any thought would be much appreciated.

Regards
Nic

Hi Rodney

Thanks for your input.

You mention two concepts here that I have read about, but not investigated.
I suspect I may need to break into the black box in order to make these
changes though.

It is not clear to me though how these approaches impact drawing
performance.

Currently in the black box the image is created with
PhCreateImage(NULL,…) then a memory context is created with
PmMemCreateMC().

Outside of the black box I request the MC, start it, render the image, then
flush and stop the MC. THEN I damage the widget.

In the call back for drawing the widget I do the recommended canvas
translations then call PgDrawPhImagemx() passing in the the already rendered
image.

Will either of the two techniques you mention improve the performance of
this ?

If so, which photon functions should I take a look at ?

Regards
Nic


“Rodney Dowdall” <rdowdall@qnx.com> wrote in message
news:caup8t$fen$1@inn.qnx.com

Hello Nic

Is the image in shared memory? Putting it in shared memry would help if
it’s not already there. Also, can you render it in an offscreen context
and then do a context blit from the offscreen context to the raw widget?
This should reduce the amount of flicker.

Rodney


Nic Smith wrote:
Hi

I am experiencing poor graphics performance in my application, and I am
seeking guidance on the best way to get the best performance for my type
of
application.

My application has a PtRaw widget into which I draw an image. The widget
is
damaged at a regualr interval by a timer and needs to be completely
redrawn.

The Raw canvas is 800x400 pixels The image I am drawing is 800x400 and
has
the Pg_IMAGE_DIRECT_888 attribute set.
It is created by PhCreateImage().

Unfortunately, how the image is populated with data is currently a black
box
to me, but I have to display its contents on the screen.

My problem is that on an 800Mz laptop with LCD display I see the image
drawn
raster fashion from top to bottom of the display, which results in a
flicker.

On my ultimate target platform (which is slower) the flicker is
unbearable.

To add to the problem, I then need to overlay information or simple
popup
menus on the image.

Before I start to blame the performance of the graphics drivers (which
are
not common between my two test scenarios) I would be interested in
getting
ideas about the most effective use of the photon libraries for getting
the
best flicker free graphics performance in such an application.

Any thought would be much appreciated.

Regards
Nic

Hello Nic

Please see below.

Nic Smith wrote:

Hi Rodney

Thanks for your input.

You mention two concepts here that I have read about, but not investigated.
I suspect I may need to break into the black box in order to make these
changes though.

It is not clear to me though how these approaches impact drawing
performance.

Currently in the black box the image is created with
PhCreateImage(NULL,…) then a memory context is created with
PmMemCreateMC().

Depends on why they are using the memory context. If they are trying to
composite the image before you draw it then leave this the way it is.
The offscreen option should still work.

Outside of the black box I request the MC, start it, render the image, then
flush and stop the MC. THEN I damage the widget.

Create an offscreen context using PdCreateOffscreenContext.
Make the Offscreen Context current by using PhDCSetCurrent, saving the
old draw context.
Draw the image in to the offscreen context using PhDrawImage.
Set the old dc to current use PhDCSetCurrent and the previously saved DC.



In the call back for drawing the widget I do the recommended canvas
translations then call PgDrawPhImagemx() passing in the the already rendered
image.

Here, instead of drawing the image every single time, Just do a
PDContextBlit from your offscreen context to the raw widget. A blit is
much faster than drawing the image.

Please note that this will just get you up and running to see if you are
in fact seeing a reduction in screen flicker. You may have to take
additional work to take in to account loss of OFfscreenContext, which
can happen if there is a mode change. Also, if you change the image you
will have to redraw it in to your offscreen context.

Thanks,
Rodney


Will either of the two techniques you mention improve the performance of
this ?

If so, which photon functions should I take a look at ?

Regards
Nic


“Rodney Dowdall” <> rdowdall@qnx.com> > wrote in message
news:caup8t$fen$> 1@inn.qnx.com> …

Hello Nic

Is the image in shared memory? Putting it in shared memry would help if
it’s not already there. Also, can you render it in an offscreen context
and then do a context blit from the offscreen context to the raw widget?
This should reduce the amount of flicker.

Rodney


Nic Smith wrote:

Hi

I am experiencing poor graphics performance in my application, and I am
seeking guidance on the best way to get the best performance for my type

of

application.

My application has a PtRaw widget into which I draw an image. The widget

is

damaged at a regualr interval by a timer and needs to be completely

redrawn.

The Raw canvas is 800x400 pixels The image I am drawing is 800x400 and

has

the Pg_IMAGE_DIRECT_888 attribute set.
It is created by PhCreateImage().

Unfortunately, how the image is populated with data is currently a black

box

to me, but I have to display its contents on the screen.

My problem is that on an 800Mz laptop with LCD display I see the image

drawn

raster fashion from top to bottom of the display, which results in a
flicker.

On my ultimate target platform (which is slower) the flicker is

unbearable.

To add to the problem, I then need to overlay information or simple

popup

menus on the image.

Before I start to blame the performance of the graphics drivers (which

are

not common between my two test scenarios) I would be interested in

getting

ideas about the most effective use of the photon libraries for getting

the

best flicker free graphics performance in such an application.

Any thought would be much appreciated.

Regards
Nic

\

Rodney Dowdall wrote:

Hello Nic

Please see below.

Nic Smith wrote:

Hi Rodney

Thanks for your input.

You mention two concepts here that I have read about, but not
investigated.
I suspect I may need to break into the black box in order to make these
changes though.

It is not clear to me though how these approaches impact drawing
performance.

Currently in the black box the image is created with
PhCreateImage(NULL,…) then a memory context is created with
PmMemCreateMC().


Depends on why they are using the memory context. If they are trying to
composite the image before you draw it then leave this the way it is.
The offscreen option should still work.


Outside of the black box I request the MC, start it, render the image,
then
flush and stop the MC. THEN I damage the widget.


Create an offscreen context using PdCreateOffscreenContext.
Make the Offscreen Context current by using PhDCSetCurrent, saving the
old draw context.
Draw the image in to the offscreen context using PhDrawImage.

Sorry, PgDrawImageMx…

Set the old dc to current use PhDCSetCurrent and the previously saved DC.




In the call back for drawing the widget I do the recommended canvas
translations then call PgDrawPhImagemx() passing in the the already
rendered
image.


Here, instead of drawing the image every single time, Just do a
PDContextBlit from your offscreen context to the raw widget. A blit is
much faster than drawing the image.

Please note that this will just get you up and running to see if you are
in fact seeing a reduction in screen flicker. You may have to take
additional work to take in to account loss of OFfscreenContext, which
can happen if there is a mode change. Also, if you change the image you
will have to redraw it in to your offscreen context.

Thanks,
Rodney



Will either of the two techniques you mention improve the performance of
this ?

If so, which photon functions should I take a look at ?

Regards
Nic


“Rodney Dowdall” <> rdowdall@qnx.com> > wrote in message
news:caup8t$fen$> 1@inn.qnx.com> …

Hello Nic

Is the image in shared memory? Putting it in shared memry would help if
it’s not already there. Also, can you render it in an offscreen context
and then do a context blit from the offscreen context to the raw widget?
This should reduce the amount of flicker.

Rodney


Nic Smith wrote:

Hi

I am experiencing poor graphics performance in my application, and I am
seeking guidance on the best way to get the best performance for my
type


of

application.

My application has a PtRaw widget into which I draw an image. The
widget


is

damaged at a regualr interval by a timer and needs to be completely


redrawn.

The Raw canvas is 800x400 pixels The image I am drawing is 800x400 and


has

the Pg_IMAGE_DIRECT_888 attribute set.
It is created by PhCreateImage().

Unfortunately, how the image is populated with data is currently a
black


box

to me, but I have to display its contents on the screen.

My problem is that on an 800Mz laptop with LCD display I see the image


drawn

raster fashion from top to bottom of the display, which results in a
flicker.

On my ultimate target platform (which is slower) the flicker is


unbearable.

To add to the problem, I then need to overlay information or simple


popup

menus on the image.

Before I start to blame the performance of the graphics drivers (which


are

not common between my two test scenarios) I would be interested in


getting

ideas about the most effective use of the photon libraries for getting


the

best flicker free graphics performance in such an application.

Any thought would be much appreciated.

Regards
Nic

\

Nic Smith wrote:

Hi

I am experiencing poor graphics performance in my application, and I am
seeking guidance on the best way to get the best performance for my type of
application.

My application has a PtRaw widget into which I draw an image. The widget is
damaged at a regualr interval by a timer and needs to be completely redrawn.

If you’re using PhAB, just enclose your PtRaw widget in
an OScontainer widget. The flicker will go away.

John Nagle
Team Overbot