Set Resolution at Runtime

I was curious, so I tried it myself and it works.

I made a simple test like this.

int main(int argc, char *argv[]) {
	
	if(argc <=1 ){
		printf("missing arguments\n");
		exit(EXIT_FAILURE);		
	}
	
	int x = atoi(argv[1]);
	int y = atoi(argv[2]);
	
	printf("H:= %d, V:= %d\n", x, y);

   /*LittlevGL init*/
    lv_init();

	display_init(x,y);
...
}

and here' the display init taken from the example.

static void display_init(const int x, const int y) {

    /*Linux frame buffer device init*/
    fbdev_init();

    /*Add a display to 
     * the LittlevGL for the frame buffer driver
     */
    static lv_disp_buf_t disp_buf;
    static lv_color_t buf_1[LV_HOR_RES_MAX * LV_VER_RES_MAX];            /*A screen sized buffer*/
    static lv_color_t buf_2[LV_HOR_RES_MAX * LV_VER_RES_MAX];            /*Another screen sized buffer*/
    lv_disp_buf_init(&disp_buf, buf_1, buf_2, LV_HOR_RES_MAX * LV_VER_RES_MAX);   /*Initialize the display buffer*/
    
    lv_disp_drv_t disp_drv;
    lv_disp_drv_init(&disp_drv);            /* Basic initialization */
    
    /*Set the resolution of the display*/
    disp_drv.hor_res = x;
    disp_drv.ver_res = y;

    /*Used to copy the buffer's content to the display*/
    disp_drv.flush_cb = fbdev_flush;
 
    /*Set a display buffer*/
    disp_drv.buffer = &disp_buf;
    
    lv_disp_drv_register(&disp_drv);
	
}

I did however get an error if I declare buf1 buf2 like this:

 static lv_color_t buf_1[x*y]; 

for not being constant.