Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Widget flicks if not rectangular: Page 1 of 2 (28 Items)
   
Widget flicks if not rectangular  
Hi, i'm new to Photon developing and I have a problem with my app.

I'm using a PtRaw widget to display some graphic made with Photon functions such as PgDrawPolygon, etc. The raw widget 
is damaged (and therefore, redrawn) every 200ms with a timer_cb. The raw widget's width and height is the same as the 
app window.

On top of the raw widget there are some other widgets as labels that update their value every 200ms too.

The problem is that those labels that have rectangular borders are ok but those that have an image background 
(Pt_ARG_LABEL_IMAGE) or rounded borders (Pt_ARG_HIGHLIGHT_ROUNDNESS) flick when the raw widget beneath them damages.

I've tried to fix that by changing some flags but didn't get anywhere.

I'm trying to work it out using layers but I don't know if that's a possible solution. Is there any other way to avoid 
this? If it is, how can I know if my HW supports layers?

Thanks in advance.
Re: Widget flicks if not rectangular  
Put your raw widget inside of a PtOSContainer widget.
Re: Widget flicks if not rectangular  
Thanks for the quick answer. I'll try that and tell you how it went.
Re: Widget flicks if not rectangular  
Misha, I've tried putting the raw widget inside a PtOSContainer but the widgets still flicks.

I'm using a PmMemoryContext_t to do the offscreen drawing with
PmMemStart() and PmMemStop() and flushing it into a PhImage_t.
The draw function of the raw widget uses PgDrawPhImage to flush the image into the widget and sets the new values of the
 label widgets with PtSetResource.

I've also tried with PtHold() and PtRelease() but that didn't work either.

Is there any other workaround? Am I missing some PtOSContainer operation?

Thanks again.
RE: Widget flicks if not rectangular  
Yes, there is a separate PtOSContainer widget, make it the parent of the PtRaw, do not use the PmMemoryContext_t.

-----Original Message-----
From: Pablo Cepedal [mailto:community-noreply@qnx.com] 
Sent: November-09-12 1:49 PM
To: photon-graphics
Subject: Re: Widget flicks if not rectangular

Misha, I've tried putting the raw widget inside a PtOSContainer but the widgets still flicks.

I'm using a PmMemoryContext_t to do the offscreen drawing with
PmMemStart() and PmMemStop() and flushing it into a PhImage_t.
The draw function of the raw widget uses PgDrawPhImage to flush the image into the widget and sets the new values of the
 label widgets with PtSetResource.

I've also tried with PtHold() and PtRelease() but that didn't work either.

Is there any other workaround? Am I missing some PtOSContainer operation?

Thanks again.



_______________________________________________

Photon microGUI
http://community.qnx.com/sf/go/post97052
To cancel your subscription to this discussion, please e-mail photon-graphics-unsubscribe@community.qnx.com
Re: Widget flicks if not rectangular  
So, you are saying I should use PdOffscreenContext_t instead? I'll try that.

Thx.
RE: Widget flicks if not rectangular  
No, I am say to make a PtOSContainer widget, then make the PtOSContainer widget the parent of the PtRaw widget.

-----Original Message-----
From: Pablo Cepedal [mailto:community-noreply@qnx.com] 
Sent: November-09-12 2:58 PM
To: photon-graphics
Subject: Re: Widget flicks if not rectangular

So, you are saying I should use PdOffscreenContext_t instead? I'll try that.

Thx.



_______________________________________________

Photon microGUI
http://community.qnx.com/sf/go/post97054
To cancel your subscription to this discussion, please e-mail photon-graphics-unsubscribe@community.qnx.com
Re: RE: Widget flicks if not rectangular  
That's the way I did before, but it didn't fix the problem, I gues because I was still using PmMemoryContext_t. I'm 
trying with PdOffscreenContext_t and it seems to help with the flick in the label widgets but now the PtRaw widget 
started blinking. I guess it still needs some workaround migrating from PmMemoryContext_t to PdOffscreenContext_t.
RE: RE: Widget flicks if not rectangular  
Ok, you should not need PmMemoryContext_t at all, just the PtOSContainer as the parent of the PtRaw.  What graphics 
driver are you using?

-----Original Message-----
From: Pablo Cepedal [mailto:community-noreply@qnx.com] 
Sent: November-09-12 3:17 PM
To: photon-graphics
Subject: Re: RE: Widget flicks if not rectangular

That's the way I did before, but it didn't fix the problem, I gues because I was still using PmMemoryContext_t. I'm 
trying with PdOffscreenContext_t and it seems to help with the flick in the label widgets but now the PtRaw widget 
started blinking. I guess it still needs some workaround migrating from PmMemoryContext_t to PdOffscreenContext_t.



_______________________________________________

Photon microGUI
http://community.qnx.com/sf/go/post97057
To cancel your subscription to this discussion, please e-mail photon-graphics-unsubscribe@community.qnx.com
Re: RE: RE: Widget flicks if not rectangular  
> Ok, you should not need PmMemoryContext_t at all, just the PtOSContainer as 
> the parent of the PtRaw.  What graphics driver are you using?

I've tried svga and vesabios.
RE: RE: RE: Widget flicks if not rectangular  
Ok, that is the problem, I would expect svga to work better, because it has a backbuffer.
What version of the OS are you using?
Please post the output of:  pci -v

-----Original Message-----
From: Pablo Cepedal [mailto:community-noreply@qnx.com] 
Sent: November-09-12 3:36 PM
To: photon-graphics
Subject: Re: RE: RE: Widget flicks if not rectangular

> Ok, you should not need PmMemoryContext_t at all, just the 
> PtOSContainer as the parent of the PtRaw.  What graphics driver are you using?

I've tried svga and vesabios.



_______________________________________________

Photon microGUI
http://community.qnx.com/sf/go/post97060
To cancel your subscription to this discussion, please e-mail photon-graphics-unsubscribe@community.qnx.com
Re: RE: RE: Widget flicks if not rectangular  
Ok, that is the problem, I would expect svga to work better, because it has a backbuffer.
What version of the OS are you using?
Please post the output of:  pci -v
------------------------------------------
Derek, thans a lot for your help. I'm using QNX 6.4.1 and here's the output of pci -v attached.
Attachment: Text pci-v_output.txt 17.85 KB
RE: RE: RE: Widget flicks if not rectangular  
Are you using 6.5.0 OS?

-----Original Message-----
From: Pablo Cepedal [mailto:community-noreply@qnx.com] 
Sent: November-12-12 5:57 AM
To: photon-graphics
Subject: Re: RE: RE: Widget flicks if not rectangular

Ok, that is the problem, I would expect svga to work better, because it has a backbuffer.
What version of the OS are you using?
Please post the output of:  pci -v
------------------------------------------
Derek, thans a lot for your help. I'm using QNX 6.4.1 and here's the output of pci -v attached.



_______________________________________________

Photon microGUI
http://community.qnx.com/sf/go/post97082
To cancel your subscription to this discussion, please e-mail photon-graphics-unsubscribe@community.qnx.com
Re: RE: RE: RE: Widget flicks if not rectangular  
> Are you using 6.5.0 OS?

Misha, I'm using 6.4.1
Re: RE: RE: RE: Widget flicks if not rectangular  
I have one question about the PtOSContainer as "parent" of PtRaw. I'm using PhAB to make the app, so I'm putting the 
PtRaw widget inside the PtOSContainer (so it's his child in the Module Tree). ¿Is it enough doing this or should I add 
something inside the app code?

Thx
RE: RE: RE: RE: Widget flicks if not rectangular  
It should be enough.  I am waiting for Misha to come back, so I can discuss with him (he is in a meeting).

-----Original Message-----
From: Pablo Cepedal [mailto:community-noreply@qnx.com] 
Sent: November-12-12 10:06 AM
To: photon-graphics
Subject: Re: RE: RE: RE: Widget flicks if not rectangular

I have one question about the PtOSContainer as "parent" of PtRaw. I'm using PhAB to make the app, so I'm putting the 
PtRaw widget inside the PtOSContainer (so it's his child in the Module Tree). ¿Is it enough doing this or should I add 
something inside the app code?

Thx



_______________________________________________

Photon microGUI
http://community.qnx.com/sf/go/post97100
To cancel your subscription to this discussion, please e-mail photon-graphics-unsubscribe@community.qnx.com
RE: RE: RE: RE: Widget flicks if not rectangular  
Hi Pablo,

The buttons would also need to be parented to the PtOSContainer:

PtOSContainer <--- PtRaw
                               <--- PtButton's

6.5.0 also contains single-pass rendering, which provide better performance.

The problem is, that SVGA and vesabios drivers do not provide offscreen memory, and your NVidia chipset does not have an
 accelerated driver to take advantage of this.

Please parent the buttons and labels to the PtOSContainer as well.  If there is no improvement, please post a simple 
test case for our review, that demonstrates the problem.

Regards,
Derek

-----Original Message-----
From: Pablo Cepedal [mailto:community-noreply@qnx.com] 
Sent: November-12-12 10:06 AM
To: photon-graphics
Subject: Re: RE: RE: RE: Widget flicks if not rectangular

I have one question about the PtOSContainer as "parent" of PtRaw. I'm using PhAB to make the app, so I'm putting the 
PtRaw widget inside the PtOSContainer (so it's his child in the Module Tree). ¿Is it enough doing this or should I add 
something inside the app code?

Thx



_______________________________________________

Photon microGUI
http://community.qnx.com/sf/go/post97100
To cancel your subscription to this discussion, please e-mail photon-graphics-unsubscribe@community.qnx.com
Re: RE: RE: RE: RE: Widget flicks if not rectangular  
Hi. I've tried reparenting the labels into PtOSContainer but I can still see the screen/image sweeping.


The app is something like this:

1) A window created in PhAB that contains:
	- PtOSContainer
		- PtRaw (PtOSContainer's child)
		- PtLabel (PtOSContainer's child)
		
2) A timer_cb that ticks every 200 ms. This cb does the following:
	2.1) Updates the app state (data input).
	2.2) Render function (that makes conversions from data input (GPS) and screen)
		This function makes some calculations and uses the Photon primitives:
		
		First:
		// Fills a rectangle the same size of the screen with a certain color
		PgSetFillColor();
		PgDrawRect(r, Pg_DRAW_FILL);
		
		Then:
		// Draws the polygons and lines needed.
		PgDrawPolygon()
		PgSetStrokeColor()
		PgDrawLine()
		...
		
	2.3) Damages the PtRaw widget.
	
3) The draw_function that runs with every PtDamageWidget() does this:
	3.1) Sets the label's text with: PtSetResource(ABW_speed_label, Pt_ARG_TEXT_STRING, speed, strlen(speed));
	3.2) PgDrawPhImage(&pos, VidImg1, NULL)... where:
		- &pos is a PhPoint_t {0,0}
		- VidImg1 is the image that was formerly modified with every 200 ms loop in PmMemoryContext_t and flushed into the 
PtRaw widget.
		

The idea of this is to show some GPS map (along with some other data, generated in item 2.2) and to put some controls 
and labels on top of that graphic.
Please let me know if this is enough or if you need some more details/code.

Thanks for your time.
RE: RE: RE: RE: RE: Widget flicks if not rectangular  
Hi Pablo,

We would like a self-contained test case, that we can compile.  It does not need to be your exact code, just something 
that represents it.
It is quite possible that "tearing" will occur, with an unaccelerated driver, but we would be surprised if there was 
flickering.
If you can send us the test case that we can compile and run, we will give the best solution we can think of.

Regards,
Derek

-----Original Message-----
From: Pablo Cepedal [mailto:community-noreply@qnx.com] 
Sent: November-12-12 12:15 PM
To: photon-graphics
Subject: Re: RE: RE: RE: RE: Widget flicks if not rectangular

Hi. I've tried reparenting the labels into PtOSContainer but I can still see the screen/image sweeping.


The app is something like this:

1) A window created in PhAB that contains:
	- PtOSContainer
		- PtRaw (PtOSContainer's child)
		- PtLabel (PtOSContainer's child)
		
2) A timer_cb that ticks every 200 ms. This cb does the following:
	2.1) Updates the app state (data input).
	2.2) Render function (that makes conversions from data input (GPS) and screen)
		This function makes some calculations and uses the Photon primitives:
		
		First:
		// Fills a rectangle the same size of the screen with a certain color
		PgSetFillColor();
		PgDrawRect(r, Pg_DRAW_FILL);
		
		Then:
		// Draws the polygons and lines needed.
		PgDrawPolygon()
		PgSetStrokeColor()
		PgDrawLine()
		...
		
	2.3) Damages the PtRaw widget.
	
3) The draw_function that runs with every PtDamageWidget() does this:
	3.1) Sets the label's text with: PtSetResource(ABW_speed_label, Pt_ARG_TEXT_STRING, speed, strlen(speed));
	3.2) PgDrawPhImage(&pos, VidImg1, NULL)... where:
		- &pos is a PhPoint_t {0,0}
		- VidImg1 is the image that was formerly modified with every 200 ms loop in PmMemoryContext_t and flushed into the 
PtRaw widget.
		

The idea of this is to show some GPS map (along with some other data, generated in item 2.2) and to put some controls 
and labels on top of that graphic.
Please let me know if this is enough or if you need some more details/code.

Thanks for your time.



_______________________________________________

Photon microGUI
http://community.qnx.com/sf/go/post97108
To cancel your subscription to this discussion, please e-mail photon-graphics-unsubscribe@community.qnx.com
Widget flicks if not rectangular  
Derek, first of all, thanks again for all your help.

I'll try to make a self-contained example of what I'm trying to do.
It's a bit complicated because I'm trying to reuse an application we've already made without PhAB.
The critical part of the application updates its state using messaging with some existing modules and updates an image 
every 200 ms.
This image is the same size of the full screen, 640 x 480 and on top of that we need to have some indicators, such as 
labels that also update their value every 200ms.
The app needs to run on an embedded AMD Geode LX-800 chipset with a 640 x 480 screen, 256Mb RAM and 1Gb EEPROM.
I'm developing on a PC with ASUS MB, AMD Sempron processor and 512Mb RAM running QNX 6.4.1 with svga drivers.

I think it's because of my bad english that "flickering" may not be the most accurate term for what I see on screen but 
it's the closest word that I know for that but I don't know the exact meaning of "tearing".

I've attached the .tar file with the basics of the project.

Thanks in advance.
Attachment: Compressed file test-case.tar 40 KB
Re: Widget flicks if not rectangular  
Hi Derek. I just wanted to know if you had the chance to get into this topic again.
Thanks again and sorry for my insistence.
RE: Widget flicks if not rectangular  
Hi Pablo,

Not yet, will look at it today for a preliminary look over.
Do you have a support contact at QNX?

Regards,
Derek

-----Original Message-----
From: Pablo Cepedal [mailto:community-noreply@qnx.com] 
Sent: November-21-12 6:03 AM
To: photon-graphics
Subject: Re: Widget flicks if not rectangular

Hi Derek. I just wanted to know if you had the chance to get into this topic again.
Thanks again and sorry for my insistence.



_______________________________________________

Photon microGUI
http://community.qnx.com/sf/go/post97331
To cancel your subscription to this discussion, please e-mail photon-graphics-unsubscribe@community.qnx.com
Re: RE: Widget flicks if not rectangular  
Derek, we have a support contact at Tempel, a QNX sales representative for Argentina.

Thanks again for your help.
RE: RE: RE: Widget flicks if not rectangular  
Just for the forum, Pablo is using this VGA chipset:

Class          = Display (VGA)
Vendor ID      = 10deh, nVidia Corporation 
Device ID      = 3d6h, Unknown Unknown
PCI index      = 0h
Class Codes    = 030000h
Revision ID    = a2h
Bus number     = 0
Device number  = 13
Function num   = 0
Status Reg     = b0h
Command Reg    = 7h
Header type    = 0h Single-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 0h
Cache Line Size= 0h

-----Original Message-----
From: Pablo Cepedal [mailto:community-noreply@qnx.com] 
Sent: November-12-12 5:57 AM
To: photon-graphics
Subject: Re: RE: RE: Widget flicks if not rectangular

Ok, that is the problem, I would expect svga to work better, because it has a backbuffer.
What version of the OS are you using?
Please post the output of:  pci -v
------------------------------------------
Derek, thans a lot for your help. I'm using QNX 6.4.1 and here's the output of pci -v attached.



_______________________________________________

Photon microGUI
http://community.qnx.com/sf/go/post97082
To cancel your subscription to this discussion, please e-mail photon-graphics-unsubscribe@community.qnx.com
Re: Widget flicks if not rectangular  
Hi Pablo,

You can find the information I am about to discuss at the following URL:

http://www.qnx.com/developers/docs/6.4.0/photon/widget_ref/ptraw.html

After reviewing, and fixing the test case to compile, there were several drawing issues that needed to be addressed to 
avoid tearing, and or flickering.

1) Set the repeat value for the PtTimer widget
2) Removed the call to RRender() from the PtTimer tick handler callback.
3) Integrated the RRender() call directly into PtRaw draw_f() callback.
4) Implemented proper canvas calculation and clip rectangle setting in PtRaw draw_f callback.

After these issues were addressed, I changed the code to update the float numerical value in the PtLabel on every draw 
pass, to simulate draw updates.  I also modified the coordinates of the polygon draw, so that a simple animation would 
occur.

We tested the new code on a Pentium D processor with the vesabios, and svga driver, and did not witness any tearing or 
flickering.  The main issue with the original version of the code, was drawing outside the draw scope of the PtRaw draw 
flow (calling RRender() from tick handler).

Try the modified test case (see attached), and determine if it flickers on your target setup.  If no flicker is 
witnessed on your target setup with the modified test case, please modify your code to follow the sample coding 
principals.  If you still encounter flicker after updating your application, change the test case to more truly 
represent your application.

Regards,
Derek
Attachment: Compressed file test-case-good.tar 40 KB