Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. There is no picture in lcd
Qt 6.11 is out! See what's new in the release blog

There is no picture in lcd

Scheduled Pinned Locked Moved Solved General and Desktop
23 Posts 3 Posters 6.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi and welcome to devnet,

    There's not enough details:

    • What version of Qt are you using ?
    • What backend do you want to use for your application
    • What error message did you got ?
    • What hardware are you targeting ?
    • What distribution is it running ?
    • How are you starting your application on the device ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    1
    • J junzhang

      Hi,
      l cross compiling qt for armv7, and then write an example to test, the code below

      int main(int argc, char *argv[])
      {
       QApplication a(argc, argv);
          MainWindow w;
          w.setStyleSheet("background-color:blue;");
          w.show();
      }
      but there is no picture in lcd, l change the code below
      int main(int argc, char *argv[])
      {
      	int fbFd = 0;
      	const char *devfile = "/dev/fb0";
      	fbFd = open(devfile, O_RDWR);
      	if (ioctl(fbFd, FBIOGET_VSCREENINFO, &vinfo) == -1) {
      		perror("Error reading variable information");
      		exit(3);
          }
          if (fbFd == -1) {
      		perror("Error: cannot open framebuffer device");
      		exit(1);
          }
      	if(ioctl(fbFd, FBIOPAN_DISPLAY, &vinfo)!= 0)
          {
              return -1;
          }
      	if(ioctl(fbFd, FBIOPAN_DISPLAY, &vinfo)!= 0)
          {
              return -1;
          }
      	
          QApplication a(argc, argv);
          MainWindow w;
      
          w.setStyleSheet("background-color:blue;");
          w.show();
      	if (ioctl(fbFd, FBIOGET_VSCREENINFO, &vinfo) == -1) {
      		perror("Error reading variable information");
      		exit(3);
          }
      	if (ioctl(fbFd, FBIOGET_FSCREENINFO, &finfo) == -1) {
      		perror("Error reading fixed information");
      		exit(2);
          }
      	if(ioctl(fbFd, FBIOPAN_DISPLAY, &vinfo)!= 0)
          {
              return -1;
          }
          return a.exec();
      }
      

      after compile and then download, the lcd can show picture,
      so, why we must add this code? whether there is wrong for my cross compiling?

      Edit: p3c0

      D Offline
      D Offline
      Devopia53
      wrote on last edited by
      #3

      @junzhang

      Hi.

      What is the platform plugin are you setting?
      If it is not setting, the QT_QPA_PLATFORM environment variable parameter can be used to setting or the -platform command-line can be used with the same syntax.

      Like this(for example):
      QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0
      or
      ./yourapp -platform linuxfb:fb=/dev/fb0

      1 Reply Last reply
      0
      • J Offline
        J Offline
        junzhang
        wrote on last edited by
        #4

        Dear Devopia53,
        how can l set my platform plugin?
        my profile is below:

        export TSLIB_ROOT=/usr/local/tslib
        export TSLIB_TSDEVICE=/dev/event0
        export TSLIB_FBDEVICE=/dev/fb0
        export TSLIB_PLUGINDIR=/usr/local/tslib/lib/ts
        export TSLIB_CONSOLEDEVICE=none
        export TSLIB_CONFFILE=/usr/local/tslib/etc/ts.conf
        export POINTERCAL_FILE=/etc/pointercal
        export TSLIB_CALIBFILE=/etc/pointercal
        #export QWS_SIZE=128x128
        export QWS_MOUSE_PROTO=Tslib:/dev/event0
        export QTDIR=/usr/local/qt
        export QPEDIR=/usr/local/qt
        export QWS_DISPLAY=LinuxFb:/dev/fb0
        export LD_LIBRARY_PATH=$TSLIB_ROOT/lib:$QTDIR/lib:$LD_LIBRARY_PATH
        export QT_QWS_FONTDIR=$QTDIR/lib/fonts
        export LD_LIBRARY_PATH=/usr/local/qtlib/lib:$LD_LIBRARY_PATH
        export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #5

          Using Qt 4?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          J 1 Reply Last reply
          0
          • SGaistS SGaist

            Using Qt 4?

            J Offline
            J Offline
            junzhang
            wrote on last edited by
            #6

            @SGaist
            yes, qt4.8.5

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #7

              Did you check the permissions on the frame buffer device ?

              On a side note, if locked on Qt 4, the you should go with 4.8.7 which is the latest and last version of the Qt 4 series. Otherwise, you should go with Qt 5.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              J 1 Reply Last reply
              0
              • SGaistS SGaist

                Did you check the permissions on the frame buffer device ?

                On a side note, if locked on Qt 4, the you should go with 4.8.7 which is the latest and last version of the Qt 4 series. Otherwise, you should go with Qt 5.

                J Offline
                J Offline
                junzhang
                wrote on last edited by
                #8

                @SGaist
                here is my cross compile config:
                sudo ./configure --prefix=/usr/local/qt4.8.5-arm -opensource -release -shared -Declarative -importdir /opt/imports -fast -no-largefile -qt-sql-sqlite -qt3support -exceptions -xmlpatterns -no-glib -no-phonon -no-mmx -no-3dnow -no-sse -no-sse2 -svg -no-webkit -qt-zlib -qt-libtiff -qt-libpng -qt-libjpeg -make libs -make tools -nomake examples -nomake docs -nomake demo -no-nis -no-cups -iconv -no-dbus -xplatform qws/linux-arm-g++ -embedded arm -little-endian -qt-freetype -depths 16,24,32 -qt-gfx-linuxfb -qt-gfx-transformed -qt-gfx-multiscreen -no-gfx-vnc -no-gfx-qvfb -qt-kbd-linuxinput -no-kbd-qvfb -armfpa -no-mouse-qvfb -qt-mouse-linuxtp -qt-mouse-tslib -DQT_QLOCALE_USES_FCVT -DQT_NO_QWS_CURSOR -no-pch -I/usr/local/tslib/include -L/usr/local/tslib/lib -confirm-license

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #9

                  That doesn't answer my question about the permissions of /dev/fb0 on your target.

                  On a side note, never develop nor build as root. If something goes wrong there's no restriction at what can be destroyed on your system.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  J 1 Reply Last reply
                  1
                  • SGaistS SGaist

                    That doesn't answer my question about the permissions of /dev/fb0 on your target.

                    On a side note, never develop nor build as root. If something goes wrong there's no restriction at what can be destroyed on your system.

                    J Offline
                    J Offline
                    junzhang
                    wrote on last edited by
                    #10

                    @SGaist
                    / # ls /dev/fb0 -l
                    crw-rw---- 1 root root 29, 0 Jan 1 00:00 /dev/fb0

                    when l use Qt/qt/qt-everywhere-opensource-src-4.8.5/examples/qws/framebuffer to test, it's ok,
                    your mean it's maybe to compile use "sudo"?
                    l will re-compile it with no "sudo".

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #11

                      How are you calling your application on the command line ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      J 2 Replies Last reply
                      0
                      • SGaistS SGaist

                        How are you calling your application on the command line ?

                        J Offline
                        J Offline
                        junzhang
                        wrote on last edited by
                        #12

                        @SGaist
                        ./test_demo -qws

                        1 Reply Last reply
                        0
                        • SGaistS SGaist

                          How are you calling your application on the command line ?

                          J Offline
                          J Offline
                          junzhang
                          wrote on last edited by
                          #13

                          @SGaist
                          l use normal user to cross compile qt5.7.0, it's still unshow anything unless l add "ioctl(fbFd, FBIOGET_FSCREENINFO, &finfo)".and it just to show one frame,
                          my cross compile steps is below:

                          1. download tslib1.4.tar.gz$ ./autogen.sh
                            $ tar zxvf tslib1.4.tar.gz
                            $ ./configure CC=arm-none-linux-gnueabihf-gcc CXX=arm-none-linux-gnueabihf-g++ --prefix=/usr/local/tslib --host=arm-none-linux-gnueabihf ac_cv_func_malloc_0_nonnull=yes
                            $make
                            $sudo make install

                          2. download qt-everywhere-opensource-src-5.7.0.tar.gz
                            2.1: tar zxvf qt-everywhere-opensource-src-5.7.0.tar.gz
                            2.2: vim qt-everywhere-opensource-src-5.7.0/qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf

                             include(../common/linux.conf)
                            + QT_QPA_DEFAULT_PLATFORM = linux #eglfs 
                            +QMAKE_CFLAGS_RELEASE += -O2 -march=armv7-a
                            + QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv7-a
                            

                            arm-linux-geneabi-xxx change to arm-none-linux-geneabi-xxx
                            2.3: vim build.sh

                            #!/bin/sh
                            ./configure
                            -v
                            -prefix /opt/qt5.7.0
                            -release
                            -opensource
                            -make libs
                            -xplatform linux-arm-gnueabi-g++
                            -optimized-qmake
                            -pch
                            -qt-sql-sqlite
                            -qt-libjpeg
                            -qt-zlib
                            -no-opengl
                            -skip qt3d
                            -skip qtcanvas3d
                            -skip qtpurchasing
                            -no-sse2
                            -no-openssl
                            -no-nis
                            -no-cups
                            -no-glib
                            -no-iconv
                            -nomake examples
                            -nomake tools
                            -skip qtvirtualkeyboard
                            -I/usr/local/tslib/include
                            -L/usr/local/tslib/lib

                            exit
                            2.4: ./build.sh
                            2.5: make
                            2.6: sudo make install

                          3. tar /usr/local/tslib and /opt/qt5.7.0

                          4. for arm platform
                            4.1: cp qt5.7.0.tar.gz and tslib.tar.gz to /opt
                            4.2: tar zxvf qt5.7.0.tar.gz and tar zxvf tslib.tar.gz
                            4.3: vim /etc/profile
                            #add for qt
                            export TSLIB_ROOT=/opt/tslib
                            export QT_ROOT=/opt/qt5.7.0
                            export TSLIB_TSDEVICE=/dev/input/event0
                            export TSLIB_TSEVENTTYPE=input
                            export TSLIB_CONFFILE=/opt/tslib/etc/ts.conf
                            export TSLIB_CALIBFILE=/etc/pointercal
                            export TSLIB_PLUGINDIR=/opt/tslib/lib/ts
                            export TSLIB_CONSOLEDEVICE=none
                            export TSLIB_FBDEVICE=/dev/fb0
                            export QWS_MOUSE_PROTO=tslib:/dev/input/event0
                            export LD_LIBRARY_PATH=/lib:/usr/lib:$QT_ROOT/lib:$TSLIB_ROOT/lib:$TSLIB_ROOT/lib/
                            export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
                            export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
                            export QT_QPA_FONTDIR=$QT_ROOT/lib/fonts
                            export QT_QPA_GENERIC_PLUGINS=tslib
                            4.4: source /etc/profile
                            4.5: cd /opt/tslib/bin and then run ./ts_calibrate
                            4.6: write an test example
                            qmake test_qt.pro
                            make
                            adb push test_qt /home/demo
                            4.6: cd /home/demo and then ./test_qt

                          after l run ./test_qt, there is nothing in lcd,so l write test framebuffer code to test fb driver, it's show ok,
                          but if l add "ioctl(fbFd, FBIOPAN_DISPLAY, &vinfo)" in test_qt demo, it's show ok, but it just show one frame, unable to self-refresh,

                          for step 4.5 and 4.6, l use another method to test, but there is still nothing in lcd.
                          4.5: ./ts_calibrate -qws
                          4.6: ./test_qt -qws

                          note: there is no touch screen in my whole steps.

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #14

                            What OS are you running on your target ?

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            J 1 Reply Last reply
                            0
                            • SGaistS SGaist

                              What OS are you running on your target ?

                              J Offline
                              J Offline
                              junzhang
                              wrote on last edited by
                              #15

                              @SGaist
                              / # uname -a
                              uname -a
                              Linux mdm9607 3.18.20 #1 PREEMPT Mon Feb 13 10:40:15 CST 2017 armv7l GNU/Linux
                              / #

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #16

                                The distribution would be more useful.

                                Also, are you running your application as root ?

                                What exact message are you getting on the console when you launch the application ?

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                J 2 Replies Last reply
                                0
                                • SGaistS SGaist

                                  The distribution would be more useful.

                                  Also, are you running your application as root ?

                                  What exact message are you getting on the console when you launch the application ?

                                  J Offline
                                  J Offline
                                  junzhang
                                  wrote on last edited by junzhang
                                  #17

                                  @SGaist
                                  yes, we run an application with root access.
                                  we test with Qt/examples/qws/framebuffer, the message is below:

                                  root@mdm9607:/home# ./framebuffer
                                  ./framebuffer
                                  The framebuffer device was opened successfully.

                                  Fixed screen info:
                                  id: mdssfb_20000
                                  smem_start: 0x8fc80000
                                  smem_len: 155648
                                  type: 0
                                  type_aux: 0
                                  visual: 2
                                  xpanstep: 1
                                  ypanstep: 1
                                  ywrapstep: 0
                                  line_length: 480
                                  mmio_start: 0x0
                                  mmio_len: 0
                                  accel: 0

                                  The framebuffer device was mapped to memory successfully.

                                  Successfully switched to graphics mode.

                                  Variable screen info:
                                  xres: 240
                                  yres: 320
                                  xres_virtual: 240
                                  yres_virtual: 320
                                  yoffset: 0
                                  xoffset: 0
                                  bits_per_pixel: 16
                                  grayscale: 0
                                  red: offset: 11, length: 5, msb_right: 0
                                  green: offset: 5, length: 6, msb_right: 0
                                  blue: offset: 0, length: 5, msb_right: 0
                                  transp: offset: 0, length: 0, msb_right: 0
                                  nonstd: 0
                                  activate: 16
                                  height: -1
                                  width: -1
                                  accel_flags: 0x0
                                  pixclock: 0
                                  left_margin: 0
                                  right_margin: 0
                                  upper_margin: 0
                                  lower_margin: 0
                                  hsync_len: 0
                                  vsync_len: 0
                                  sync: 0
                                  vmode: 0

                                  Frame Buffer Performance test...
                                  Average: 395 usecs
                                  Bandwidth: 375.791 MByte/Sec
                                  Max. FPS: 2531.646 fps

                                  Will draw 3 rectangles on the screen,
                                  they should be colored red, green and blue (in that order).
                                  Done.
                                  root@mdm9607:/home#

                                  l change the Qt/examples/qws/framebuffer/main.c
                                  void drawRect_rgb16(int x0, int y0, int width, int height, int color)
                                  {
                                  const int bytesPerPixel = 2;
                                  const int stride = finfo.line_length / bytesPerPixel;
                                  const int red = (color & 0xff0000) >> (16 + 3);
                                  const int green = (color & 0xff00) >> (8 + 2);
                                  const int blue = (color & 0xff) >> 3;
                                  const short color16 = blue | (green << 5) | (red << (5 + 6));

                                  short *dest = (short*)(frameBuffer)
                                  	  + (y0 + vinfo.yoffset) * stride
                                  	  + (x0 + vinfo.xoffset);
                                  
                                  int x, y;
                                  for (y = 0; y < height; ++y) {
                                      for (x = 0; x < width; ++x) {
                                          dest[x] = color16;
                                      }
                                      dest += stride;
                                  }//add by junzhang
                                  if(ioctl(fbFd, FBIOPAN_DISPLAY, &vinfo)!= 0)
                                  {
                                      return -1;
                                  }//
                                  

                                  }
                                  there is nothing in lcd unless l add that code when l test with framebuffer example, the message is the same whether l add that code or not.

                                  1 Reply Last reply
                                  0
                                  • SGaistS SGaist

                                    The distribution would be more useful.

                                    Also, are you running your application as root ?

                                    What exact message are you getting on the console when you launch the application ?

                                    J Offline
                                    J Offline
                                    junzhang
                                    wrote on last edited by
                                    #18

                                    @SGaist
                                    l want to add
                                    if(ioctl(fbFd, FBIOPAN_DISPLAY, &vinfo)!= 0)
                                    {
                                    return -1;
                                    }/
                                    to the code which update framebuffer in Qt,
                                    it's mean that if something update in Qt, it will be write data to framebuffer, so, i will add that code in the function which update framebuffer.
                                    it's that ok?
                                    if ok, pls tell which function update framebuffer. thx.

                                    1 Reply Last reply
                                    0
                                    • SGaistS Offline
                                      SGaistS Offline
                                      SGaist
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #19

                                      You likely should check the QLinuxFbScreen class.

                                      Interested in AI ? www.idiap.ch
                                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      J 1 Reply Last reply
                                      0
                                      • SGaistS SGaist

                                        You likely should check the QLinuxFbScreen class.

                                        J Offline
                                        J Offline
                                        junzhang
                                        wrote on last edited by
                                        #20

                                        @SGaist
                                        thx, l found it and it's show ok.

                                        1 Reply Last reply
                                        0
                                        • SGaistS Offline
                                          SGaistS Offline
                                          SGaist
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #21

                                          Do you mean by adding you ioctl code ?

                                          Interested in AI ? www.idiap.ch
                                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          J 1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved