EGL_MESA_screen_surface version 4

Brian Paul brian.paul at tungstengraphics.com
Wed Mar 23 18:24:59 PST 2005


Jon Smirl wrote:
> On Wed, 23 Mar 2005 16:38:34 -0700, Brian Paul
> <brian.paul at tungstengraphics.com> wrote:
> 
>>Actually, here's a scenario to consider.  Suppose one wants to change
>>the screen's size in the EGL application.  Also suppose there's a
>>hardware restriction such that only one screen surface can exist at a
>>time (either for lack of memory or because of memory layout restrictions).
>>
>>The basic idea is that the currently displayed screen surface must be
>>deallocated before a new one can be created.  Can people cope with
>>that?  Or should there be a function to resize an existing screen surface?
> 
> 
> Why wouldn't you do something like:
> eglShowSurfaceMESA(EGL_NO_SURFACE, EGL_NO_MODE_MESA);
> destroy the surface
> create a new one
> eglShowSurfaceMESA(the new surface, mode);

That would be fine by me.  I'm just suggesting that an alternative 
might be:

create a surface
...
eglResizeSurfaceMESA(dpy, surf, newWidth, newHeight).


I've thought about this before in the case of Pbuffers.  Suppose that 
hardware pbuffers have to be a multiple of, say, 32 pixels in width 
and height.  If someone allocates a pbuffer of size 100x100 and later 
wants to resize it to 120x120, there's really no need to reallocate 
the memory since it would have initially been created at 128x128.  The 
resize routine could be far more efficient than a destroy/create 
operation.

So if pbuffers were being used to store top-level Xgl windows this 
could save a lot of work when the user's resizing the window with the 
mouse.


> Did you note somewhere that it is illegal to destroy a surface while
> it is being displayed?

Good catch.  I'll add a new issue to the spec.


> Why is there a eglCreateScreenSurfaceMESA() in addition to
> elgCreateSurface(), shouldn't all surfaces be created equal?

EGL defines window surfaces, pixmap surfaces and pbuffer surfaces. 
Each is a little different.  I felt it was better to define a 4th type 
of surface than overload an existing surface type with new capabilities.


> Then if
> you try to scanout a surface first it needs to compatible with the
> mode. Next Mesa needs to move it into VRAM if it already isn't there.
> There should be no reason that surfaces that aren't being scanned out
> can't migrate to AGP memory.

Sure.  Or any other memory.


> In the composited desktop model all top level window get their own
> surface then the desktop composits them into a single image. Now let's
> assume these top level windows are compatible with monitor modes. If
> all surfaces are created equal I should be able to transparently make
> each top level window full screen and rotate through them.

I think that assumption is a bit optimistic.  Top-level windows might 
very well be stored as textures (perhaps stored in a format that can't 
be directly scanned out), or pbuffers, or FB objects.  I wonder if 
Dave Reveman has a preference?

But if top-level windows could be directly scanned out, that could be 
cool.

I guess the key thing about eglCreateScreenSurfaceMESA() is the fact 
that you're asserting that you want to create a surface especially for 
scan-out.  I guess you could pass a new flag to 
eglCreateWindow/Pixmap/PbufferSurface() to indicate that intention, 
but that feels like a hack to me.

-Brian


More information about the dri-egl mailing list