In an email exchange from May 2006 (quoted below) a question was asked about
primary surfaces, and a response given that I would like to clarify.

The question gave three ways to create a 'primary surface' and the response
accepted these. But I think that only one does create a primary Surface -
the other two are just getting the Surface of a primary Layer, which is not
at all the same thing.

Method (1) does create a primary Surface:

> DFBSurfaceDescription dsc;
> IDirectFBSurface *primary;
> IDirectFB *dfb;
> 
> dsc.flags = DSDESC_CAPS;
> dsc.caps  = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
> dfb->CreateSurface( dfb, &dsc, &primary )

but surely method (2) does not:

> IDirectFB *dfb;
> IDirectFBDisplayLayer *layer;
> IDirectFBSurface *primary;
> IDirectFBWindow *window;
> 
> DFBWindowDescription wind_desc;
> 
> dfb->GetDisplayLayer (dfb, DLID_PRIMARY, &layer);
> layer->CreateWindow(layer, &wind_desc, &window);
> window->GetSurface(window, &primary);

and nor does method (3:

IDirectFB *dfb;
IDirectFBDisplayLayer *layer;
IDirectFBSurface *primary;

DFBDisplayLayerConfig config;

dfb->GetDisplayLayer (dfb, DLID_PRIMARY, &layer);
layer->SetCooperativeLevel(layer, DLSCL_EXCLUSIVE);
layer->SetConfiguration(layer, &config);
layer->GetSurface(layer, &primary);

I think a primary Surface is an abstraction. It refers to the Surface that
the application is using (and has an implication that this Surface will be
displayed). If IDirectFB:CooperativeLevel is FULLSCREEN or EXCLUSIVE then
the 'primary Surface' will be the Surface of the primary DisplayLayer. But
if IDirectFB:CooperativeLevel is NORMAL then the primary Surface will be the
Surface of a Window of the primary Layer (that Window being created
implicitly) - so this is not the Surface of the primary Layer.

Method (1) creates a primary Surface, which happens to be the Surface of the
primary Layer.

Method (2) gets a Surface of a Window of the primary Layer.

Method (3) gets a Surface of the primary Layer.

I think in this dialog the term 'primary Surface' and the meaning 'Surface
of a primary Layer' have been unintentionally confused.

It seems to me that such confusion is common.

But I would like to confirm that my interpretation is correct so that I do
not teach incorrectly.

I'd value any clarification or contradiction.

Thanks,

Chris
========================
Chris Bore
BORES Signal Processing
[EMAIL PROTECTED]
www.bores.com
Tel:    +44 1483 740138
Mobile: +44 7921 153 219 

[directfb-users] Creating primary surface
Denis Oliver Kropp dok at directfb.org 
Fri May 19 02:54:23 CEST 2006 

Previous message: [directfb-users] Creating primary surface 
Next message: [directfb-users] DirectFB-0.9.25.1 and MPlayer 
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] 

----------------------------------------------------------------------------
----

Sergio LSI wrote:
> Hi,
> 
> I am a newbie and I would like to know the difference between
> the following ways to create a primary surface
> 
> 1)
> DFBSurfaceDescription dsc;
> IDirectFBSurface *primary;
> IDirectFB *dfb;
> 
> dsc.flags = DSDESC_CAPS;
> dsc.caps  = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
> dfb->CreateSurface( dfb, &dsc, &primary )

pros
- adding one call to dfb->SetCooperativeLevel() makes it behave like 3)
- user can use options like: "force-windowed", "force-desktop",
   "pixelformat", "mode" (also window size)
- has an autograb mode for the mouse cursor (type or click in window)

cons
- no control over implicitly created window, like position
- no events from the window, only raw input events available

> 2)
> IDirectFB *dfb;
> IDirectFBDisplayLayer *layer;
> IDirectFBSurface *primary;
> IDirectFBWindow *window;
> 
> DFBWindowDescription wind_desc;
> 
> dfb->GetDisplayLayer (dfb, DLID_PRIMARY, &layer);
> layer->CreateWindow(layer, &wind_desc, &window);
> window->GetSurface(window, &primary);

pros
- can have more than one window
- direct window creation
- window control
- window events



3)
IDirectFB *dfb;
IDirectFBDisplayLayer *layer;
IDirectFBSurface *primary;

DFBDisplayLayerConfig config;

dfb->GetDisplayLayer (dfb, DLID_PRIMARY, &layer);
layer->SetCooperativeLevel(layer, DLSCL_EXCLUSIVE);
layer->SetConfiguration(layer, &config);
layer->GetSurface(layer, &primary);


pros
- direct layer configuration
- layer control


-- 
Best regards,
   Denis Oliver Kropp

.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/                 |
"------------------------------------------"



_______________________________________________
directfb-users mailing list
directfb-users@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to