Pablo Cepedal
|
Widget flicks if not rectangular
|
Pablo Cepedal
11/09/2012 1:30 PM
post97048
|
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.
|
|
|
Misha Nefedov
|
Re: Widget flicks if not rectangular
|
Misha Nefedov
11/09/2012 1:33 PM
post97049
|
Re: Widget flicks if not rectangular
Put your raw widget inside of a PtOSContainer widget.
|
|
|
Pablo Cepedal
|
Re: Widget flicks if not rectangular
|
Pablo Cepedal
11/09/2012 1:35 PM
post97050
|
Re: Widget flicks if not rectangular
Thanks for the quick answer. I'll try that and tell you how it went.
|
|
|
Pablo Cepedal
|
Re: Widget flicks if not rectangular
|
Pablo Cepedal
11/09/2012 1:49 PM
post97052
|
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.
|
|
|
Derek Leach
|
RE: Widget flicks if not rectangular
|
Derek Leach
11/09/2012 1:50 PM
post97053
|
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
|
|
|
Pablo Cepedal
|
Re: Widget flicks if not rectangular
|
Pablo Cepedal
11/09/2012 2:57 PM
post97054
|
Re: Widget flicks if not rectangular
So, you are saying I should use PdOffscreenContext_t instead? I'll try that.
Thx.
|
|
|
Derek Leach
|
RE: Widget flicks if not rectangular
|
Derek Leach
11/09/2012 2:54 PM
post97055
|
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
|
|
|
Pablo Cepedal
|
Re: RE: Widget flicks if not rectangular
|
Pablo Cepedal
11/09/2012 3:17 PM
post97057
|
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.
|
|
|
Derek Leach
|
RE: RE: Widget flicks if not rectangular
|
Derek Leach
11/09/2012 3:18 PM
post97058
|
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
|
|
|
Pablo Cepedal
|
Re: RE: RE: Widget flicks if not rectangular
|
Pablo Cepedal
11/09/2012 3:36 PM
post97060
|
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.
|
|
|
Derek Leach
|
RE: RE: RE: Widget flicks if not rectangular
|
Derek Leach
11/09/2012 3:39 PM
post97062
|
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
|
|
|
Pablo Cepedal
|
Re: RE: RE: Widget flicks if not rectangular
|
Pablo Cepedal
11/12/2012 5:56 AM
post97082
|
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.
|
|
|
Derek Leach
|
RE: RE: RE: Widget flicks if not rectangular
|
Derek Leach
11/12/2012 8:24 AM
post97087
|
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
|
|
|
Pablo Cepedal
|
Re: RE: RE: RE: Widget flicks if not rectangular
|
Pablo Cepedal
11/12/2012 9:17 AM
post97094
|
Re: RE: RE: RE: Widget flicks if not rectangular
> Are you using 6.5.0 OS?
Misha, I'm using 6.4.1
|
|
|
Pablo Cepedal
|
Re: RE: RE: RE: Widget flicks if not rectangular
|
Pablo Cepedal
11/12/2012 10:06 AM
post97100
|
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
|
|
|
Derek Leach
|
RE: RE: RE: RE: Widget flicks if not rectangular
|
Derek Leach
11/12/2012 10:12 AM
post97101
|
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
|
|
|
Derek Leach
|
RE: RE: RE: RE: Widget flicks if not rectangular
|
Derek Leach
11/12/2012 10:27 AM
post97102
|
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
|
|
|
Pablo Cepedal
|
Re: RE: RE: RE: RE: Widget flicks if not rectangular
|
Pablo Cepedal
11/12/2012 12:14 PM
post97108
|
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.
|
|
|
Derek Leach
|
RE: RE: RE: RE: RE: Widget flicks if not rectangular
|
Derek Leach
11/13/2012 11:48 AM
post97150
|
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
|
|
|
Pablo Cepedal
|
Widget flicks if not rectangular
|
Pablo Cepedal
11/13/2012 2:13 PM
post97156
|
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.
|
|
|
Pablo Cepedal
|
Re: Widget flicks if not rectangular
|
Pablo Cepedal
11/21/2012 6:03 AM
post97331
|
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.
|
|
|
Derek Leach
|
RE: Widget flicks if not rectangular
|
Derek Leach
11/21/2012 8:35 AM
post97336
|
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
|
|
|
Pablo Cepedal
|
Re: RE: Widget flicks if not rectangular
|
Pablo Cepedal
11/21/2012 10:39 AM
post97340
|
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.
|
|
|
Derek Leach
|
RE: RE: RE: Widget flicks if not rectangular
|
Derek Leach
11/12/2012 8:25 AM
post97088
|
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
|
|
|
Derek Leach
|
Re: Widget flicks if not rectangular
|
Derek Leach
11/22/2012 8:54 AM
post97383
|
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
|
|
|
|