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. Optimizing GPU Usage for Large Images in Qt Application
Forum Updated to NodeBB v4.3 + New Features

Optimizing GPU Usage for Large Images in Qt Application

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 5 Posters 865 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.
  • A Offline
    A Offline
    Alexandre Henrique
    wrote on last edited by
    #1

    I'm developing an application and need to use an image of 20,000 by 20,000 with a total of 700 MB. Using Qt's QImage, I'm experiencing GPU usage of 1.5 GB. However, when using the same image resized to 10,000 by 10,000, the GPU usage drops to 500 MB. What would be the best way to reduce this GPU usage without resizing?

    Note: Qt version 5.15 and the initial image is in PNG format.
    Note2: I've generated a DDS image of 20,000 by 20,000 with a total of 500 MB, but I'm unable to display it.

    Christian EhrlicherC C 2 Replies Last reply
    0
    • A Alexandre Henrique

      I'm developing an application and need to use an image of 20,000 by 20,000 with a total of 700 MB. Using Qt's QImage, I'm experiencing GPU usage of 1.5 GB. However, when using the same image resized to 10,000 by 10,000, the GPU usage drops to 500 MB. What would be the best way to reduce this GPU usage without resizing?

      Note: Qt version 5.15 and the initial image is in PNG format.
      Note2: I've generated a DDS image of 20,000 by 20,000 with a total of 500 MB, but I'm unable to display it.

      Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      A QImage will never be in the GPU memory. Maybe a QPixmap.
      But handling such big images is nothing where Qt can help you - you should handle this by yourself if you want it in gpu only memory (e.g. by using OpenGL or similar).

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      A 2 Replies Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        A QImage will never be in the GPU memory. Maybe a QPixmap.
        But handling such big images is nothing where Qt can help you - you should handle this by yourself if you want it in gpu only memory (e.g. by using OpenGL or similar).

        A Offline
        A Offline
        Alexandre Henrique
        wrote on last edited by
        #3

        @Christian-Ehrlicher said in Optimizing GPU Usage for Large Images in Qt Application:

        A QImage will never be in the GPU memory. Maybe a QPixmap.

        I'm sorry, but Image QML Type shouldn't be using my GPU memory, should be using my Ram instead?

        Christian EhrlicherC 1 Reply Last reply
        0
        • A Alexandre Henrique

          @Christian-Ehrlicher said in Optimizing GPU Usage for Large Images in Qt Application:

          A QImage will never be in the GPU memory. Maybe a QPixmap.

          I'm sorry, but Image QML Type shouldn't be using my GPU memory, should be using my Ram instead?

          Christian EhrlicherC Online
          Christian EhrlicherC Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Alexandre-Henrique QImage <-> QML Image - you said QImage...

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          A 1 Reply Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            @Alexandre-Henrique QImage <-> QML Image - you said QImage...

            A Offline
            A Offline
            Alexandre Henrique
            wrote on last edited by
            #5

            @Christian-Ehrlicher I'm sorry. So, Qml Image should use GPU memory? If so, can i manage to change to Ram?

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SamiV123
              wrote on last edited by
              #6

              Maybe you should consider creating a mechanism to tile your data.

              So instead of working with a single 20k by 20k image you create an image abstraction that allows you to map only parts of the image into memory at any time in smaller chunks.

              It all depends of course what you want to achieve exactly.

              A 1 Reply Last reply
              3
              • S SamiV123

                Maybe you should consider creating a mechanism to tile your data.

                So instead of working with a single 20k by 20k image you create an image abstraction that allows you to map only parts of the image into memory at any time in smaller chunks.

                It all depends of course what you want to achieve exactly.

                A Offline
                A Offline
                Alexandre Henrique
                wrote on last edited by
                #7

                @SamiV123 This kind of solution with smaller chunks will not be appliable here. Do i have any way to force my image to use memory ram instead of gpu memory?

                1 Reply Last reply
                0
                • Christian EhrlicherC Christian Ehrlicher

                  A QImage will never be in the GPU memory. Maybe a QPixmap.
                  But handling such big images is nothing where Qt can help you - you should handle this by yourself if you want it in gpu only memory (e.g. by using OpenGL or similar).

                  A Offline
                  A Offline
                  Alexandre Henrique
                  wrote on last edited by
                  #8

                  @Christian-Ehrlicher said in Optimizing GPU Usage for Large Images in Qt Application:

                  QPixmap

                  And thanks for this. I'm trying to open my image with QImage and use QQuickImageProvider Class to my Qml Application to see if my image consumes my ram instead my vram.

                  1 Reply Last reply
                  0
                  • A Alexandre Henrique

                    I'm developing an application and need to use an image of 20,000 by 20,000 with a total of 700 MB. Using Qt's QImage, I'm experiencing GPU usage of 1.5 GB. However, when using the same image resized to 10,000 by 10,000, the GPU usage drops to 500 MB. What would be the best way to reduce this GPU usage without resizing?

                    Note: Qt version 5.15 and the initial image is in PNG format.
                    Note2: I've generated a DDS image of 20,000 by 20,000 with a total of 500 MB, but I'm unable to display it.

                    C Offline
                    C Offline
                    ChrisW67
                    wrote on last edited by ChrisW67
                    #9

                    @Alexandre-Henrique said in Optimizing GPU Usage for Large Images in Qt Application:

                    20,000 by 20,000 with a total of 700 MB

                    A 20k square is 4e8 pixels. At one byte-per-pixel monochrome this is at least ~400MB, and two or more bytes-per-pixel would be bigger than 700MB. Are you sure of the memory measurement and that this is the image itself?

                    A 1 Reply Last reply
                    0
                    • C ChrisW67

                      @Alexandre-Henrique said in Optimizing GPU Usage for Large Images in Qt Application:

                      20,000 by 20,000 with a total of 700 MB

                      A 20k square is 4e8 pixels. At one byte-per-pixel monochrome this is at least ~400MB, and two or more bytes-per-pixel would be bigger than 700MB. Are you sure of the memory measurement and that this is the image itself?

                      A Offline
                      A Offline
                      Alexandre Henrique
                      wrote on last edited by
                      #10

                      @ChrisW67 it's a compressed png, when it loads in my vram the image is descompressed i think, and that's why is consuming that much of my GPU. I am trying to change it to my ram instead of my vram. But still without success.

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        SimonSchroeder
                        wrote on last edited by
                        #11

                        At some point the image needs to be decompressed. This most likely happens in RAM first and is then send over to the GPU. Have you thought, what the GPU might be doing with the image? It just resizes it to the viewport. The best you can do is to dynamically resize the image to the viewport size and have Qt copy that to the GPU instead. If you are zoomed in, just send that part of the image instead of the whole image.

                        Because QML is heavily using the GPU in the background (it is faster) the GPU needs to have access to the image it should display. On most computers the GPU cannot directly access the RAM.

                        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