Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - SDL-1.2 is broken under QNX6.4: Page 1 of 2 (29 Items)
   
SDL-1.2 is broken under QNX6.4  
Hello,

I have tested SDL 1.2.9 and SDL 1.2.13 on top of Photon/QNX 6.4 and got negative results.

For instance ... if you start the test example "graywin" ... the window of graywin is loosing at first its background. 
Now it is possible to update that window with rectangles ... but if you hide that window by an other window and than un-
hide the window of graywin ... it is loosing all added rectangles and shows now only the background =:-/.

This problem doesn't happen with QNX 6.3.2. What is different with Photon of QNX 6.4 ?


Best Regards

--Armin
Re: SDL-1.2 is broken under QNX6.4  
Which graphics driver are you using ? There were problems connected with delayed asynchronous blittings in the past.
Re: SDL-1.2 is broken under QNX6.4  
1) Regarding the first problem, you have described

Find the following code in the ./src/video/photon/SDL_ph_video.c

        if ((flags & SDL_HWSURFACE) == SDL_HWSURFACE)
        {
            PtSetArg(&args[nargs++], Pt_ARG_BASIC_FLAGS, Pt_TRUE, Pt_BASIC_PREVENT_FILL);
        }
        else
        {
            PtSetArg(&args[nargs++], Pt_ARG_FILL_COLOR, Pg_BLACK, 0);
        }

And leave the following line only:

            PtSetArg(&args[nargs++], Pt_ARG_BASIC_FLAGS, Pt_TRUE, Pt_BASIC_PREVENT_FILL);

Looks like SDL application blits background before Photon clears window content to black (somehow delayed). But in this 
case you'll get trash in place of window in case if application will not redraw the whole window at start.

2) I can't reproduce any other problems under VMWare.
Re: SDL-1.2 is broken under QNX6.4  
Thanks ... after this modification most test applications are working now as expected.

Only the test app graywin has still a problem. It's the only one which is loosing updates of the window after a hide/un-
hide sequence.

I have tested this behavior on two different machines which are providing different VGA adapters.
The type of the graphics driver makes no difference.

Do you have any idea why these problems are not present with QNX 6.3.2 ?

Best Regards

--Armin



> 1) Regarding the first problem, you have described
> 
> Find the following code in the ./src/video/photon/SDL_ph_video.c
> 
>         if ((flags & SDL_HWSURFACE) == SDL_HWSURFACE)
>         {
>             PtSetArg(&args[nargs++], Pt_ARG_BASIC_FLAGS, Pt_TRUE, Pt_BASIC_PREVENT_FILL);
>         }
>         else
>         {
>             PtSetArg(&args[nargs++], Pt_ARG_FILL_COLOR, Pg_BLACK, 0);
>         }
> 
> And leave the following line only:
> 
>             PtSetArg(&args[nargs++], Pt_ARG_BASIC_FLAGS, Pt_TRUE, Pt_BASIC_PREVENT_FILL);
> 
> Looks like SDL application blits background before Photon clears window 
> content to black (somehow delayed). But in this case you'll get trash in place
>  of window in case if application will not redraw the whole window at start.
> 
> 2) I can't reproduce any other problems under VMWare.


Re: SDL-1.2 is broken under QNX6.4  
Hello Mike,

regarding to point 2) ... iin the attachment is a small video which shows the problems with graywin.

Best Regards

--Armin

> 2) I can't reproduce any other problems under VMWare.


Attachment: Text graywin.asf 2.28 MB
Re: SDL-1.2 is broken under QNX6.4  
Hm, looks like all rendering is done directly to visible display area instead of being rendered to offscreen area. Just 
tested and got that under VMWare, svga, vesabios, tnt, radeon, i830, extreme2 all works fine, so I will ask you again 
about the graphics driver, which one are you using ?
Re: SDL-1.2 is broken under QNX6.4  
By the way, I've tested using QNX 6.4.1, not 6.4
Re: SDL-1.2 is broken under QNX6.4  
> By the way, I've tested using QNX 6.4.1, not 6.4

I did also a test with QNX 6.4.1 ... the problem happens also here.

I'm using a dual core machine with a smp kernel and the SVGA graphics driver.
(Using the non smp kernel makes no difference).

Before I made the modification of the background handling I saw sometimes parts of the previous contents of the SDL 
window in the current window =:-/  ...  the rest was pixel crap.

Best Regards

--Armin
Re: SDL-1.2 is broken under QNX6.4  
> Hm, looks like all rendering is done directly to visible display area instead 
> of being rendered to offscreen area. Just tested and got that under VMWare, 
> svga, vesabios, tnt, radeon, i830, extreme2 all works fine, so I will ask you 
> again about the graphics driver, which one are you using ?

I have tested all other available drivers of the VGA interface. The problem appears with the i830, the SVGA and the 
VESABIOS driver. But only with the graywin application ... 

Could it be that there is a special race condition ? I'm using a dual core CPU with 2.2GHz clock.

Best Regards

--Armin



Re: SDL-1.2 is broken under QNX6.4  
> Hello,
> 
> I have tested SDL 1.2.9 and SDL 1.2.13 on top of Photon/QNX 6.4 and got 
> negative results.
> 
> For instance ... if you start the test example "graywin" ... the window of 
> graywin is loosing at first its background. Now it is possible to update that 
> window with rectangles ... but if you hide that window by an other window and 
> than un-hide the window of graywin ... it is loosing all added rectangles and 
> shows now only the background =:-/.
> 
> This problem doesn't happen with QNX 6.3.2. What is different with Photon of 
> QNX 6.4 ?

Any comments about this question from QSS ???

--Armin



> 
> 
> Best Regards
> 
> --Armin


Re: SDL-1.2 is broken under QNX6.4  
Based on what you describe I think you run into a problem of incorrectly setup draw context. Before rendering is done 
(especially outside of normal libph draw cycle) make sure that rendering translation and clipping are set correctly:
	PgClearTranslationCx()
	PgClearClippingsCx()
	PgSetRegionCx();
	<render>
Re: SDL-1.2 is broken under QNX6.4  
> Based on what you describe I think you run into a problem of incorrectly setup
>  draw context. Before rendering is done (especially outside of normal libph 
> draw cycle) make sure that rendering translation and clipping are set 
> correctly:
> 	PgClearTranslationCx()
> 	PgClearClippingsCx()
> 	PgSetRegionCx();
> 	<render>

It is done in a similar way. Please see the blitting routine blow:

void ph_OCUpdate(_THIS, int numrects, SDL_Rect *rects)
{
    int i;

    PhPoint_t zero = {0, 0};
    PhArea_t src_rect;
    PhArea_t dest_rect;

    PgSetTranslation(&zero, 0);
    PgSetRegion(PtWidgetRid(window));
    PgSetClipping(0, NULL);

    PgFlush();
    PgWaitHWIdle();

    for (i=0; i<numrects; ++i)
    {
        if (rects[i].w == 0)  /* Clipped? */
        {
            continue;
        }

        if (rects[i].h == 0)  /* Clipped? */
        {
            continue;
        }
        
        src_rect.pos.x=rects[i].x;
        src_rect.pos.y=rects[i].y;
        dest_rect.pos.x=rects[i].x;
        dest_rect.pos.y=rects[i].y;

        src_rect.size.w=rects[i].w;
        src_rect.size.h=rects[i].h;
        dest_rect.size.w=rects[i].w;
        dest_rect.size.h=rects[i].h;
        
        PgContextBlitArea(OCImage.offscreen_context, &src_rect, NULL, &dest_rect);
    }

    if (PgFlush() < 0)
    {
        SDL_SetError("ph_OCUpdate(): PgFlush failed.\n");
    }
}

Best Regards

--Armin

Re: SDL-1.2 is broken under QNX6.4  
Try this:
      PhDCSetCurrent(NULL); 
      PgSetRegion(PtWidgetRid(window));
      PgSetTranslation(&zero, 0);
      PgSetClipping(0, NULL);
Re: SDL-1.2 is broken under QNX6.4  
> Try this:
>       PhDCSetCurrent(NULL); 
>       PgSetRegion(PtWidgetRid(window));
>       PgSetTranslation(&zero, 0);
>       PgSetClipping(0, NULL);

Hello,

I did the modification but I don't see any improvments.

Best Regards

--Armin





Re: SDL-1.2 is broken under QNX6.4  
It seems that the blit is failing. In order to debug this problem, I will need a small, self contained application that 
shows the same problem.
Re: SDL-1.2 is broken under QNX6.4  
Misha, as far as I can say, the code, which posted by Armin works fine, looks like problem was in the following code:

    oldcolor=PgSetFillColor(truecolor);
    PgDrawIRect(rect->x, rect->y+ydisp, rect->w+rect->x-1, rect->h+rect->y+ydisp-1, Pg_DRAW_FILL);
    PgSetFillColor(oldcolor);
    PgFlush();
    PgWaitHWIdle();

When I set PhDCSetCurrent(OCImage.offscreen_context); once in the application code, somewhere current draw context has 
changed (by Photon?) for this application. And I'm afraid, that in this case all rectangle fill operations are performed
 to visible display area, instead of being performed to offscreen area or to PhImage_t.

Anyway SDL 1.2.x code is real mess, that's why I want to exclude all code of SDL 1.2.x in the SDL 1.3, starting from 
scratch.
Re: SDL-1.2 is broken under QNX6.4  
> Misha, as far as I can say, the code, which posted by Armin works fine, looks 
> like problem was in the following code:
> 
>     oldcolor=PgSetFillColor(truecolor);
>     PgDrawIRect(rect->x, rect->y+ydisp, rect->w+rect->x-1, rect->h+rect->y+
> ydisp-1, Pg_DRAW_FILL);
>     PgSetFillColor(oldcolor);
>     PgFlush();
>     PgWaitHWIdle();
> 
> When I set PhDCSetCurrent(OCImage.offscreen_context); once in the application 
> code, somewhere current draw context has changed (by Photon?) for this 
> application. And I'm afraid, that in this case all rectangle fill operations 
> are performed to visible display area, instead of being performed to offscreen
>  area or to PhImage_t.
> 
> Anyway SDL 1.2.x code is real mess,

Sorry ... that's not the case.

After looking again into th sources of "graywin" I have to clearify something.

The graywin application draws its background at application start, at a resize event and at a exposure event  ... that 
means that "loosing of the rectangles" is a designed behavior iin the context of the expected events!

SDL 1.2.9 creates the resize and exposure events under QNX 6.4.1 ... but not SDL 1.2.13 !
The exposure event is also missing under QNX 6.2.3 and with SDL 1.2.9 and SDL 1.2.13 ! 

That means only SDL 1.2.9 is  fully working under QNX 6.4.x after the modification of the handling of the window 
background !!

At the end I have go back to SDL 1.2.9 ... sorry about that :)

So I don't belief that your implementation of the blit handling is in general a great mess ... its is working perfectly 
with SDL 1.2.9.

But SDL 1.2.13 has problems with the event handling (the exposure event is missing) and there are strange effects with 
the blitting. At start of graywin you can see sometimes a corrupted window contents. I saw also that the app "
testpalette"  was failing to create a correct window contents.

Best Regards

--Armin

PS: Misha ... I will send you a set of test apps and the shared lib of SDL 1.2.13.


Re: SDL-1.2 is broken under QNX6.4  
> So I don't belief that your implementation of the blit handling is in general a great mess 
> ... its is working perfectly with SDL 1.2.9.

Such code, like in photon driver of SDL 1.2, could no be well supported, if you change something in one place, it will 
blast in another part, it has a lot of legacy stuff, like support of two different OpenGL interfaces (QNX 6.1-6.2 and 6.
3), it doesn't utilize all possible hardware acceleration, etc ... Personally I think it is waste of time to continue 
supporting this code for newer QNX versions, better to make all efforts to new code, which will support GF and Photon 
with hardware accelerated OpenGL ES.
Re: SDL-1.2 is broken under QNX6.4  
> > So I don't belief that your implementation of the blit handling is in 
> general a great mess 
> > ... its is working perfectly with SDL 1.2.9.
> 
> Such code, like in photon driver of SDL 1.2, could no be well supported, if 
> you change something in one place, it will blast in another part, it has a lot
>  of legacy stuff, like support of two different OpenGL interfaces (QNX 6.1-6.2
>  and 6.3), it doesn't utilize all possible hardware acceleration, etc ... 
> Personally I think it is waste of time to continue supporting this code for 
> newer QNX versions, better to make all efforts to new code, which will support
>  GF and Photon with hardware accelerated OpenGL ES.

From this point of view I have to agree.

--Armin



Re: SDL-1.2 is broken under QNX6.4  
> It seems that the blit is failing. In order to debug this problem, I will need
>  a small, self contained application that shows the same problem.

Just a question.

I did the following test sequence:

1) after installing (make install) SDL 1.2.9 I used graywin and other test applications
2) after make, make install of SDL 1.2.13 I used the test app graywin and got the picture provided in the attachment.
3)after the second start of graywin and other apps all was OK  ... 

Could it be that the shared library of SDL 1.2.9 was still in memory and has been used at the first start of graywin 
vers. 1.2.13??  There is always used the same name of the shared lib by SDL 1.2.9 and SDL 1.2.13 ...

Best Regards

--Armin

PS: if so then the remaining problem with SDL 1.2.13 would be the event handling ...
Attachment: Image IMG_3078.JPG 75.81 KB
Re: SDL-1.2 is broken under QNX6.4  
Armin, I've updated few days ago a SDL 1.3 project at foundry: http://community.qnx.com/sf/projects/
qnx_community_sdl_project and SDL 1.3 itself concerning Photon support.

You could use SDL 1.3 in SDL 1.2 compatibility mode now (through including SDL_compat.h for the old API), my tests 
showed, that SDL 1.3 in compatibility mode even faster than original SDL 1.2, but there are still no fullscreen modes 
and overlays support.
Re: SDL-1.2 is broken under QNX6.4  
> Armin, I've updated few days ago a SDL 1.3 project at foundry: http://
> community.qnx.com/sf/projects/qnx_community_sdl_project and SDL 1.3 itself 
> concerning Photon support.
> 
> You could use SDL 1.3 in SDL 1.2 compatibility mode now (through including 
> SDL_compat.h for the old API), my tests showed, that SDL 1.3 in compatibility 
> mode even faster than original SDL 1.2, but there are still no fullscreen 
> modes and overlays support.

OK ... that sounds interesting. Did you test the handling of the shape of the cursor?
SDL_SetCursor and SDL_GetCursor are not working in version 1.2.9.

--Armin



Re: SDL-1.2 is broken under QNX6.4  
> Armin, I've updated few days ago a SDL 1.3 project at foundry: http://
> community.qnx.com/sf/projects/qnx_community_sdl_project and SDL 1.3 itself 
> concerning Photon support.
> 
> You could use SDL 1.3 in SDL 1.2 compatibility mode now (through including 
> SDL_compat.h for the old API), my tests showed, that SDL 1.3 in compatibility 
> mode even faster than original SDL 1.2, but there are still no fullscreen 
> modes and overlays support.

I think there is a general problem in the handling of the cursor and that's also true for your version 1.3 of SDL.

IMHO, the cursor of Photon must be switched off and replaced by a private SDL cursor if the cursor is in a focused SDL 
controlled region.

--Armin


 


Re: SDL-1.2 is broken under QNX6.4  
> I think there is a general problem in the handling of the cursor and that's 
> also true for your version 1.3 of SDL.
> 
> IMHO, the cursor of Photon must be switched off and replaced by a private SDL 
> cursor if the cursor is in a focused SDL controlled region.

Looks like you are using QNX 6.4.0, where custom cursors are not supported in Photon. But in QNX 6.4.1 and QNX 6.3.2 all
 works fine.
Re: SDL-1.2 is broken under QNX6.4  
> > I think there is a general problem in the handling of the cursor and that's 
> 
> > also true for your version 1.3 of SDL.
> > 
> > IMHO, the cursor of Photon must be switched off and replaced by a private 
> SDL 
> > cursor if the cursor is in a focused SDL controlled region.
> 
> Looks like you are using QNX 6.4.0, where custom cursors are not supported in 
> Photon. But in QNX 6.4.1 and QNX 6.3.2 all works fine.

However ... I have tested now with 6.4.1:  the modification of the cursor is now working, but the position of the 
modified cursor is allways wrong. Please have a look to the attached picture. It shows the cursor after selecting the 
right bottom corner of window 1.

Best Regards

--Armin

PS: this examole application has been developt with DACHSview: http://www.dachs.net/img/dView.jpg
Attachment: Image surf.jpg 172.35 KB