Skip to content


Expected behaviour of "graphics_get_display_size" in bcm_host? #14

benosteen opened this Issue · 2 comments

2 participants


Calling "graphics_get_display_size" seems to always return 1920x1080, regardless of the current display size. Is this expected behaviour?

Is there a way to get the true output resolution, in the same manner as the tvservice utility?


#include "bcm_host.h"
success = graphics_get_display_size(0 /* LCD */, &width, &height);

width and height seem to return 1920 and 1080 respectively, regardless to output mode. My HDMI is currently set to "state 0x12001a, 1280x720 @ 50Hz, progressive". It returns 1920x1080 even when using composite out.


It was fixed on 21 April in our source tree, so you need a newer than that.
If you are interested this is the implementation:

int32_t graphics_get_display_size( const uint16_t display_number,
                                                    uint32_t *width,
                                                    uint32_t *height)
   DISPMANX_DISPLAY_HANDLE_T display_handle = 0;
   int32_t success = -1;

   if (display_handle == 0) {
      // Display must be opened first.
      display_handle = vc_dispmanx_display_open(display_number);
   if (display_handle) {
      success = vc_dispmanx_display_get_info(display_handle, &mode_info);

      if( success >= 0 )
         if( NULL != width )
            *width = mode_info.width;

         if( NULL != height )
            *height = mode_info.height;

   if ( display_handle )
      display_handle = 0;

   return success;

Brilliant :) Thanks!

@benosteen benosteen closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.