Two displays framebuffer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Two displays framebuffer

5,239 Views
_andev_
Contributor II

Hi all,

I've a custom iMX6 board with two display outputs. The display output is not cloned. I

would like to have a 1280x1440 framebuffer (from 2 1280x720 outputs). Using Wayland

I get it. I can run weston with:

weston --tty=1 --use-gal2d=1 --use-gl=0 --device=/dev/fb2,/dev/fb0

and I have an extended desktop using /dev/fb0 and /dev/fb0. Then I've modified the

'weston-simple-egl' demo app to use a 1280x1408 window and I get an EGL/OpenGL ES

app running but in window mode  (no fullscreen allowed!)

Is it possible to get the same without Wayland? I would like to run an EGL/OpenGL ES

application in framebuffer mode in a 1280x1440 window.

Any comment is welcome!

Labels (1)
0 Kudos
5 Replies

2,317 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hi,

If you like to get two outpout fb with the same context, you have to use multiple-buffer rendering, set the environment variable FB_MULTI_BUFFER to an unsigned integer value, which indicates the number of buffers required. Recommended values: 2 or 3 The FB_MULTI_BUFFER variable can be set to any positive integer value. ??If set to 1, the multiple buffer function is not enabled. ??If set to 2 or 3, the driver will run as users expect. ??If set to a value more than 3, the driver will use 3 as the buffer count.

To create a window with its size different from the display size, use the environment variable FB_IGNORE_DISPLAY_SIZE. Example usage syntax: export FB_IGNORE_DISPLAY_SIZE=1 To let the driver use multiple buffers to do swap work, use the environment variable FB_MULTI_BUFFER. Example usage syntax: export FB_MULTI_BUFFER=2

To specify the display device, use the environment variable FB_FRAMEBUFFER_n, where n = any positive integer. Example usage syntax: export FB_FRAMEBUFFER_0=/dev/fb0 export FB_FRAMEBUFFER_1=/dev/fb1 export FB_FRAMEBUFFER_2=/dev/fb2 export FB_FRAMEBUFFER_3=/dev/fb3

Hope this helps

0 Kudos

2,317 Views
_andev_
Contributor II

And a little question: The code has to be modified?

This is the code fragment where I create the EGL window:

static int init_egl( int w, int h, int bpp )

{

  typedef NativeDisplayType EGLNativeDisplayType;

  typedef NativeWindowType EGLNativeWindowType;

  //EGLint            disp_w, disp_h;

  int maj, min;

  EGLNativeDisplayType disp_type;

  EGLNativeWindowType  window;

  EGLConfig         cfgs[2];

  EGLint            n_cfgs;

  EGLint            egl_attr[] = {

    EGL_BUFFER_SIZE, EGL_DONT_CARE,

    EGL_RED_SIZE,    8,

    EGL_GREEN_SIZE,  8,

    EGL_BLUE_SIZE,   8,

    EGL_DEPTH_SIZE,  8,

    EGL_NONE };

  struct {

    EGLint render_buffer[2];

    EGLint none;

  } egl_surf_attr = {

    /* double-buffering */

    .render_buffer = { EGL_RENDER_BUFFER, EGL_BACK_BUFFER },

    /* End of list */

    .none = EGL_NONE

  };

  disp_type = (EGLNativeDisplayType)EGL_DEFAULT_DISPLAY;

  dpy = eglGetDisplay(disp_type);

  if (eglInitialize(dpy, &maj, &min) != EGL_TRUE) {

      printf("eglInitialize\n");

      return 0;

  }

  if (eglGetConfigs(dpy, cfgs, 2, &n_cfgs) != EGL_TRUE) {

      printf("eglGetConfigs\n");

      goto cleanup;

  }

   

  if (eglChooseConfig(dpy, egl_attr, cfgs, 2, &n_cfgs) != EGL_TRUE) {

      printf("eglChooseConfig\n");

      goto cleanup;

  }

  disp_type = fbGetDisplay(NULL);

  window  = fbCreateWindow(disp_type, 0, 1, w, h);

  surface = eglCreateWindowSurface(dpy, cfgs[0], window, /*(EGLint*)&egl_surf_attr*/NULL);

  if (surface == EGL_NO_SURFACE) {

      printf("eglCreateWindowSurface\n");

      goto cleanup;

  }

  context = eglCreateContext(dpy, cfgs[0], EGL_NO_CONTEXT, NULL);

  if (context == EGL_NO_CONTEXT) {

      printf("eglCreateContext\n");

      goto cleanup;

  }

  if (eglMakeCurrent(dpy, surface, surface, context) != EGL_TRUE) {

      printf("eglMakeCurrent\n");

      goto cleanup;

  }

 

  return 1;

cleanup:

  deinit_egl();

  return 0;

}

0 Kudos

2,317 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hi Anonymous,

I do not see any incongruence in your EGL code, but I have tested extended desktop with X11 and Wayland and,  full Screen is not supported, I am afraid that FB wont be able to do this task without window context manager.

Regards

0 Kudos

2,317 Views
_andev_
Contributor II

Hi,

Then, if I understand you correctly, the only way to get extended desktop is X11 and Wayland, isn't it?

Fullscreen in wayland for extended desktop is planned?

Thanks!

0 Kudos

2,317 Views
_andev_
Contributor II

Hi!

Thanks for your answer! I still can't get the desired output... Maybe if I specify exactly my needs

you can help defining the correct values for the environment vars. I need

output /dev/fb2 : mode 1280x720. Opengl rectangle [x=0,y=0,w=1280,h=720]

output /dev/fb0 : mode 1280x720. Opengl rectangle [x=0,y=720,w=1280,h=720]

then the total opengl rectangle is [0,0,1280,1440]. You can imagine fb2 above fb0

I've set

export FB_MULTI_BUFFER=2

export FB_IGNORE_DISPLAY_SIZE=1

export FB_FRAMEBUFFER_0=/dev/fb2

export FB_FRAMEBUFFER_1=/dev/fb0

but all the scene is drawn in the same framebuffer, the FB_FRAMEBUFFER_0...

Thanks!

0 Kudos