vbeinfo

changeset 4:d2c44edd8b77 tip

print the framebuffer address
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 07 Jan 2019 13:52:58 +0200
parents 5b0ef094b8fd
children
files src/main.c
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/src/main.c	Mon Jan 07 12:07:53 2019 +0200
     1.2 +++ b/src/main.c	Mon Jan 07 13:52:58 2019 +0200
     1.3 @@ -9,6 +9,7 @@
     1.4  
     1.5  struct video_mode {
     1.6  	int xres, yres, bpp;
     1.7 +	unsigned long addr;
     1.8  };
     1.9  
    1.10  void sort_modes(struct video_mode *arr, int sz, int field);
    1.11 @@ -21,6 +22,7 @@
    1.12  	uint16_t *modes;
    1.13  	struct video_mode *vmodes;
    1.14  	char *vendor, *product, *prod_rev;
    1.15 +	unsigned long prev_addr = 0;
    1.16  
    1.17  	if(!(vbe = vbe_get_info())) {
    1.18  		fprintf(stderr, "VBE not found\n");
    1.19 @@ -61,6 +63,7 @@
    1.20  		vmodes[i].xres = mode->xres;
    1.21  		vmodes[i].yres = mode->yres;
    1.22  		vmodes[i].bpp = mode->bpp;
    1.23 +		vmodes[i].addr = mode->fb_addr;
    1.24  	}
    1.25  
    1.26  	sort_modes(vmodes, nmodes, 2);
    1.27 @@ -75,6 +78,15 @@
    1.28  	}
    1.29  	putchar('\n');
    1.30  
    1.31 +	printf("fb addr:");
    1.32 +	for(i=0; i<nmodes; i++) {
    1.33 +		if(vmodes[i].addr && vmodes[i].addr != prev_addr) {
    1.34 +			printf(" %lx", vmodes[i].addr);
    1.35 +			prev_addr = vmodes[i].addr;
    1.36 +		}
    1.37 +	}
    1.38 +	putchar('\n');
    1.39 +
    1.40  	free(vmodes);
    1.41  	return 0;
    1.42  }