graphics_get_display_size wrong?

4 posts
by mehmooda » Tue Jun 12, 2012 9:04 pm
I'm trying to get the display size from within a GL program.

graphics_get_display_size is returning 1920x1080 ... no matter what resolution I am actually in. This is noticeable in the hello_triangle demo ... By which the cube is only partially visible.

Is this the intended behaviour of graphics_get_display_size or is it supposed to return 1280x720 in this situation

The code I'm using to test this:

Code: Select all
#include "bcm_host.h"
#include "GLES/gl.h"
#include "EGL/egl.h"
#include <stdio.h>
#include <assert.h>
EGLDisplay display;
EGLConfig config;
EGLContext context;
uint32_t screen_width;
uint32_t screen_height;

int main(){
   EGLBoolean result;
   EGLint num_config;

   static const EGLint attribute_list[] =
      EGL_RED_SIZE, 8,
      EGL_GREEN_SIZE, 8,
      EGL_BLUE_SIZE, 8,
      EGL_ALPHA_SIZE, 8,
   display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
   result = eglInitialize(display, NULL, NULL);
   result = eglChooseConfig(display, attribute_list, &config, 1, &num_config);
   context = eglCreateContext(display, config, EGL_NO_CONTEXT, NULL);
   graphics_get_display_size(0 /* LCD */, &screen_width, &screen_height);


Code: Select all
pi@raspberrypi:~$ /opt/vc/bin/tvservice -m CEA
Group CEA has 9 modes:
           mode 1: 640x480 @ 60Hz, progressive
           mode 2: 720x480 @ 60Hz, progressive
           mode 3: 720x480 @ 60Hz, progressive
  (native) mode 4: 1280x720 @ 60Hz, progressive
           mode 5: 1920x1080 @ 60Hz, interlaced
  (native) mode 17: 720x576 @ 50Hz, progressive
           mode 18: 720x576 @ 50Hz, progressive
           mode 19: 1280x720 @ 50Hz, progressive
           mode 20: 1920x1080 @ 50Hz, interlaced
pi@raspberrypi:~$ /opt/vc/bin/tvservice -s
state 0x12001a, 1280x720 @ 60Hz, progressive

Oh and I have to force CEA mode 4 otherwise it defaults to mode 17
Posts: 2
Joined: Tue Jun 12, 2012 8:48 pm
by finnw » Tue Jun 12, 2012 9:06 pm
I think this is a bug in an early version of the firmware.

rpi-update fixed it for me.
Posts: 24
Joined: Wed May 16, 2012 7:05 pm
by mehmooda » Tue Jun 12, 2012 9:35 pm
I stand corrected ...

rpi-update did fix the graphics_get_display_size issue ... Although the CEA 17 default problem is still there
Posts: 2
Joined: Tue Jun 12, 2012 8:48 pm
by RichardUK » Tue Jun 19, 2012 10:08 pm
I have run my RPi on three different monitors, all 1080p, two were at work. One of the work ones displayed the image at a lower res but the RPi thought it was running at 1080p just as you have seen. The display was off centre as if half the screen of off to the right.
User avatar
Posts: 205
Joined: Fri Jun 01, 2012 5:12 pm