Welcome to the Linux Foundation Forum!

problems with framebuffer and graphics driver

edited October 2016 in Software Development

Hello,

i have a problem with the linux-framebuffer and this code:


  1. #include <sys/types.h>
  2. #include <sys/stat.h>
  3. #include <sys/mman.h>
  4. #include <sys/ioctl.h>
  5. #include <fcntl.h>
  6. #include <linux/fb.h>
  7. #include <unistd.h>
  8. #include <stdio.h>
  9. int main(int argc, char **argv) {
  10. int row, col, width, height, bitspp, bytespp;
  11. unsigned int *data;
  12. int fd = open("/dev/fb0", O_RDWR);
  13. struct fb_var_screeninfo screeninfo;
  14. ioctl(fd, FBIOGET_VSCREENINFO, &screeninfo);
  15. bitspp = screeninfo.bits_per_pixel;
  16. if(bitspp != 32) {
  17. printf("Farbaufloesung = %i Bits pro Pixel\n", bitspp);
  18. printf("Bitte aendern Sie die Farbtiefe auf 32 Bits pro Pixel\n");
  19. close(fd);
  20. return 1;
  21. }
  22. width = screeninfo.xres;
  23. height = screeninfo.yres;
  24. bytespp = bitspp/8;
  25. if(sizeof(unsigned int) != bytespp) {
  26. close(fd);
  27. return 1;
  28. }
  29. data = (unsigned int*) mmap(0, width * height * bytespp, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
  30. int x=0;
  31. int i=1;
  32. while(1){
  33. for(row = 0; row < height; row++){
  34. for(col = 0; col < width; col++){
  35. data[row * width + col] = 0xFFFFFF;
  36. if(col == x){
  37. data[row * width + col] = 0x0;
  38. }
  39. }
  40. }
  41. x+=i;
  42. if(x==width || x == 0){
  43. i*=-1;
  44. }
  45. }
  46. munmap(data, width * height * bytespp);
  47. close(fd);
  48. return 0;
  49. }

if i am running this program with the NVIDIA binary driver version 367.57 it looks like this:

but if i am running the code with the xorg nouveaudriver it looks like this:

the "framerate" of the NVIDIA driver is really bad worse than the xorg-driver.

i ran this program a time ago with another driver that i dont know and there it ran faster (like the xorg-driver).

why runs the program different with different drivers and how can i solve this?

my system looks like this:


  1. System: Host: S5520 Kernel: 4.8.0-26-generic x86_64 (64 bit) Desktop: Unity 7.5.0 Distro: Ubuntu 16.10
  2. Machine: System: Intel product: TERRA Server v: ....................
  3. Mobo: Intel model: S5520HC v: E26045-454
  4. BIOS: Intel v: S5500.86B.01.00.0064.050520141428 date: 05/05/2014
  5. CPU(s): 2 Hexa core Intel Xeon X5650s (-HT-MCP-SMP-) cache: 24576 KB
  6. clock speeds: max: 2661 MHz 1: 1596 MHz 2: 1596 MHz 3: 1596 MHz 4: 1596 MHz 5: 1596 MHz 6: 1596 MHz
  7. 7: 1596 MHz 8: 1596 MHz 9: 1596 MHz 10: 1596 MHz 11: 1596 MHz 12: 1596 MHz 13: 1596 MHz 14: 1596 MHz
  8. 15: 1596 MHz 16: 1596 MHz 17: 1596 MHz 18: 1596 MHz 19: 1596 MHz 20: 1596 MHz 21: 1596 MHz
  9. 22: 1596 MHz 23: 1596 MHz 24: 1596 MHz
  10. Graphics: Card: NVIDIA GK106 [GeForce GTX 650 Ti]
  11. Display Server: X.Org 1.18.4 drivers: nouveau (unloaded: fbdev,vesa) Resolution: 1440x900@59.89hz
  12. GLX Renderer: Gallium 0.4 on NVE6 GLX Version: 3.0 Mesa 12.0.3

 

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training