示例#1
0
def main():
    #    T1 = time.time()

    os.system("mkdir /tmp/gpu-viewer")
    gtk = MyGtk("GPU-Viewer v1.16")
    setScreenSize(gtk, Const.WIDTH_RATIO, Const.HEIGHT_RATIO1)

    if isVulkanSupported():
        vulkanTab = gtk.createTab(Const.VULKAN_PNG, Const.ICON_WIDTH, Const.ICON_HEIGHT, True)
        t2 = threading.Thread(target=Vulkan, args=(vulkanTab,))
        t2.start()
        t2.join()

    openGlTab = gtk.createTab(Const.OPEN_GL_PNG, Const.ICON_WIDTH, Const.ICON_HEIGHT, True)
    t1 = threading.Thread(target=OpenGL, args=(openGlTab,))
    t1.start()
    t1.join()

    if isOpenclSupported():
        openclTab = gtk.createTab(Const.OPEN_CL_PNG, 130, Const.ICON_HEIGHT, False)
        t4 = threading.Thread(target=openCL, args=(openclTab,))
        t4.start()
        t4.join()

    aboutTab = gtk.createTab(Const.ABOUT_US_PNG, Const.ICON_WIDTH, Const.ICON_HEIGHT, False)
    t3 = threading.Thread(target=about, args=(aboutTab,))
    t3.start()
    t3.join()

    #    print(time.time()-T1)
    gtk.connect("delete-event", quit)
    gtk.show_all()
    gtk.mainLoop()
示例#2
0
def main():
    gtk = MyGtk("GPU Viewer v1.1")

    setScreenSize(gtk, Const.WIDTH_RATIO, Const.HEIGHT_RATIO1)

    openGlTab = gtk.createTab(Const.OPEN_GL_PNG, Const.ICON_WIDTH,
                              Const.ICON_HEIGHT, True)
    OpenGL(openGlTab)

    if isVulkanSupported():
        vulkanTab = gtk.createTab(Const.VULKAN_PNG, Const.ICON_WIDTH,
                                  Const.ICON_HEIGHT, True)
        Vulkan(vulkanTab)

    aboutTab = gtk.createTab(Const.ABOUT_US_PNG, Const.ICON_WIDTH,
                             Const.ICON_HEIGHT, False)
    about(aboutTab)

    gtk.connect("delete-event", quit)
    gtk.show_all()
    gtk.mainLoop()
示例#3
0
def FrameBuffer(button):
    def GLXFB(button, value):
        FB_Store.clear()
        TreeFB.set_model(FB_Store)
        if value == 1:
            os.system(
                "glxinfo | awk '/GLX Visuals.*/{flag=1;next}/GLXFBConfigs.*/{flag=0}flag' | awk '/----.*/{flag=1;next}flag' > /tmp/FrameBufferGLXVisual.txt"
            )

            list = []
            with open("/tmp/FrameBufferGLXVisual.txt", "r") as file1:
                for line in file1:
                    list.append(line.split())

            for i in range(len(list) - 1):
                background_color = setBackgroundColor(i)
                FB_Store.append(list[i] + [background_color])
            label = "%d GLX Visuals" % (len(list) - 1)
            button.set_label(label)

        if value == 2:

            os.system(
                "glxinfo | awk '/GLXFBConfigs.*/{flag=1;next}flag' | awk '/----.*/{flag=1;next}flag' > /tmp/FrameBufferGLXFBconfigs.txt"
            )

            list = []
            with open("/tmp/FrameBufferGLXFBconfigs.txt", "r") as file1:
                for line in file1:
                    list.append(line.split())

            for i in range(len(list) - 1):
                background_color = setBackgroundColor(i)
                if list[i][6] == "r" or list[i][6] == "c":
                    pass
                else:
                    list[i].insert(6, ".")
                FB_Store.append(list[i] + [background_color])
            label = "%d  GLXFBConfigs" % (len(list) - 1)
            button.set_label(label)

    FBWin = Gtk.Window()
    FBWin.set_title("GLX Frame Buffer Configuration")
    #   FBWin.set_size_request(1000, 500)
    setScreenSize(FBWin, Const.WIDTH_RATIO, Const.HEIGHT_RATIO2)
    FBGrid = Gtk.Grid()
    FBWin.add(FBGrid)
    FBGrid.set_border_width(20)
    FBGrid.set_row_spacing(30)
    FBGLXButton = Gtk.RadioButton("GLX Visuals")
    FBGLXButton.connect("toggled", GLXFB, 1)
    FBGrid.add(FBGLXButton)
    FBConfigButton = Gtk.RadioButton.new_from_widget(FBGLXButton)
    FBConfigButton.set_label("GLXFBConfigs")
    FBConfigButton.connect("toggled", GLXFB, 2)
    FBGrid.attach_next_to(FBConfigButton, FBGLXButton, Gtk.PositionType.RIGHT,
                          1, 1)
    FBFrame = Gtk.Frame()

    FB_Store = Gtk.ListStore(str, str, str, str, str, str, str, str, str, str,
                             str, str, str, str, str, str, str, str, str, str,
                             str, str, str, str, str, str)
    TreeFB = Gtk.TreeView(FB_Store, expand=True)
    TreeFB.set_enable_search(True)
    TreeFB.set_property("enable-grid-lines", 3)

    FBConfigButton.set_active(True)
    FBGLXButton.set_active(True)

    for i, column_title in enumerate(FrameBufferList):
        FBrenderer = Gtk.CellRendererText(font=Const.FONT)
        column = Gtk.TreeViewColumn(column_title, FBrenderer, text=i)
        column.add_attribute(FBrenderer, "background", 25)
        if i < len(FrameBufferList) - 1:
            FBrenderer.set_alignment(0.5, 0.5)
            column.set_alignment(0.5)
        column.set_property("min-width", 40)
        TreeFB.append_column(column)

    FBScrollbar = createScrollbar(TreeFB)
    FBFrame.add(FBScrollbar)
    FBGrid.attach_next_to(FBFrame, FBGLXButton, Gtk.PositionType.BOTTOM, 25, 1)

    FBWin.show_all()
示例#4
0
    def __init__(self):
        super(main, self).__init__(title=Const.TITLE)

        setScreenSize(self,Const.WIDTH_RATIO,Const.HEIGHT_RATIO1)
示例#5
0
    def clickme(button):

        button.set_sensitive(False)
        os.system(
            "glxinfo -l | awk '/OpenGL core profile limits:/{flag=1}/GLX Visuals.*/{flag=0} flag' | awk '/OpenGL core profile limits:/{flag=1;next}/OpenGL version string.*/{flag=0} flag' | awk '/./'  > /tmp/gpu-viewer/OpenGL_Core_Limits.txt"
        )
        os.system(
            "cat /tmp/gpu-viewer/OpenGL_Core_Limits.txt | awk '{gsub(/=.*/,'True');print}' > /tmp/gpu-viewer/OpenGLCoreLimitsLHS.txt"
        )
        LimitsWin = Gtk.Window()
        LimitsWin.set_title("OpenGL Hardware Limits")
        #    LimitsWin.set_size_request(1000, 500)
        setScreenSize(LimitsWin, Const.WIDTH_RATIO, Const.HEIGHT_RATIO2)
        LimitsWin.set_border_width(10)
        LimitsNotebook = Gtk.Notebook()
        LimitsWin.add(LimitsNotebook)
        LimitsCoreTab = Gtk.Box("spacing=10")
        LimitsNotebook.add(LimitsCoreTab)
        LimitsNotebook.set_tab_label(LimitsCoreTab, Gtk.Label("\tCore\t"))
        LimitsCoreFrame = Gtk.Frame()
        limitsCombo = Gtk.ComboBoxText()

        # get Combo box value

        limitsCombo.remove_all()
        with open("/tmp/gpu-viewer/OpenGLCoreLimitsLHS.txt", "r") as file1:
            for line in file1:
                if ":" in line:
                    text = line[:-2]
                    limitsCombo.append_text(text.strip(" "))

        limitsCombo.insert_text(0, "Show All OpenGL Hardware Core Limits")

        LimitsCoreTab.add(LimitsCoreFrame)
        LimitsGrid = Gtk.Grid()
        LimitsGrid.set_row_spacing(5)
        LimitsCoreFrame.add(LimitsGrid)
        LimitsGrid.add(limitsCombo)
        LimitsCore_Store = Gtk.TreeStore(str, str, str)
        TreeCoreLimits = Gtk.TreeView(LimitsCore_Store, expand=True)
        TreeCoreLimits.set_property("enable-tree-lines", True)

        limitsCombo.connect("changed", showLimits, LimitsCore_Store,
                            TreeCoreLimits,
                            "/tmp/gpu-viewer/OpenGL_Core_Limits.txt")
        limitsCombo.set_active(0)

        #    showLimits(LimitRHSValue, LimitsRHS, LimitsCore_Store, TreeCoreLimits,"/tmp/gpu-viewer/OpenGLCoreLimitsLHS.txt")

        setColumns(TreeCoreLimits, LimitsTitle, Const.MWIDTH, 0.0)
        LimitsCoreScrollbar = createScrollbar(TreeCoreLimits)
        LimitsGrid.attach_next_to(LimitsCoreScrollbar, limitsCombo,
                                  Gtk.PositionType.BOTTOM, 1, 1)

        os.system(
            "glxinfo -l | awk '/OpenGL limits:/{flag=1}/GLX Visuals.*/{flag=0} flag' | awk '/OpenGL limits:/{flag=1;next}/OpenGL ES profile/{flag=0} flag' | awk '/./'  > /tmp/gpu-viewer/OpenGL_Limits.txt"
        )
        os.system(
            "cat /tmp/gpu-viewer/OpenGL_Limits.txt | awk '{gsub(/=.*/,'True');print}' > /tmp/gpu-viewer/OpenGLLimitsLHS.txt"
        )
        LimitsCompatTab = Gtk.Box("spacing=10")
        LimitsNotebook.add(LimitsCompatTab)
        LimitsNotebook.set_tab_label(LimitsCompatTab,
                                     Gtk.Label("    Compat.\t"))
        LimitsCompatFrame = Gtk.Frame()
        limitsCompatCombo = Gtk.ComboBoxText()

        limitsCompatCombo.remove_all()
        with open("/tmp/gpu-viewer/OpenGLLimitsLHS.txt", "r") as file1:
            for line in file1:
                if ":" in line:
                    text = line[:-2]
                    limitsCompatCombo.append_text(text.strip(" "))

        limitsCompatCombo.insert_text(
            0, "Show All OpenGL Hardware Compatible Limits")

        LimitsCompatTab.add(LimitsCompatFrame)
        limitsCompatGrid = Gtk.Grid()
        limitsCompatGrid.set_row_spacing(5)
        LimitsCompatFrame.add(limitsCompatGrid)
        limitsCompatGrid.add(limitsCompatCombo)
        LimitsCompat_Store = Gtk.TreeStore(str, str, str)
        TreeCompatLimits = Gtk.TreeView(LimitsCompat_Store, expand=True)
        TreeCompatLimits.set_property("enable-tree-lines", True)

        limitsCompatCombo.connect("changed", showLimits, LimitsCompat_Store,
                                  TreeCompatLimits,
                                  "/tmp/gpu-viewer/OpenGL_Limits.txt")
        limitsCompatCombo.set_active(0)

        #   showLimits(LimitRHSValue2, LimitsRHS2, LimitsCompat_Store, TreeCompatLimits,"/tmp/gpu-viewer/OpenGLLimitsLHS.txt")

        setColumns(TreeCompatLimits, LimitsTitle, Const.MWIDTH, 0.0)
        LimitsCompatScrollbar = createScrollbar(TreeCompatLimits)
        limitsCompatGrid.attach_next_to(LimitsCompatScrollbar,
                                        limitsCompatCombo,
                                        Gtk.PositionType.BOTTOM, 1, 1)

        def button_enable(win, value):
            button.set_sensitive(True)

        LimitsWin.connect("delete-event", button_enable)

        LimitsWin.show_all()
示例#6
0
def FrameBuffer(button):
    FBWin = Gtk.Window()
    FBWin.set_border_width(10)
    FBWin.set_title("GLX Frame Buffer Configuration")
    #   FBWin.set_size_request(1000, 500)
    setScreenSize(FBWin, Const.WIDTH_RATIO, Const.HEIGHT_RATIO2)

    FBNotebook = Gtk.Notebook()
    FBWin.add(FBNotebook)

    FBGLX_Store = Gtk.ListStore(str, str, str, str, str, str, str, str, str,
                                str, str, str, str, str, str, str, str, str,
                                str, str, str, str, str, str, str, str)
    TreeFBGLX = Gtk.TreeView(FBGLX_Store, expand=True)
    TreeFBGLX.set_enable_search(True)
    TreeFBGLX.set_property("enable-grid-lines", 3)

    FBGLXTab = Gtk.Box(spacing=10)
    FBGLXGrid = createSubTab(FBGLXTab, FBNotebook, "GLX Visuals")
    FBConfigTab = Gtk.Box(spacing=10)
    FBConfigGrid = createSubTab(FBConfigTab, FBNotebook, "GLX FBConfigs")

    button.set_sensitive(False)

    os.system(
        "cat /tmp/gpu-viewer/glxinfo.txt  | awk '/GLX Visuals.*/{flag=1;next}/GLXFBConfigs.*/{flag=0}flag' | awk '/----.*/{flag=1;next}flag' > /tmp/gpu-viewer/FrameBufferGLXVisual.txt"
    )

    list = []
    with open("/tmp/gpu-viewer/FrameBufferGLXVisual.txt", "r") as file1:
        for line in file1:
            list.append(line.split())

    for i in range(len(list) - 1):
        background_color = setBackgroundColor(i)
        FBGLX_Store.append(list[i] + [background_color])
    label1 = "%d GLX Visuals" % (len(list) - 1)
    FBNotebook.set_tab_label(FBGLXTab, Gtk.Label(label1))

    FBConfig_Store = Gtk.ListStore(str, str, str, str, str, str, str, str, str,
                                   str, str, str, str, str, str, str, str, str,
                                   str, str, str, str, str, str, str, str)
    TreeFBConfig = Gtk.TreeView(FBConfig_Store, expand=True)
    TreeFBConfig.set_enable_search(True)
    TreeFBConfig.set_property("enable-grid-lines", 3)

    os.system(
        "cat /tmp/gpu-viewer/glxinfo.txt | awk '/GLXFBConfigs.*/{flag=1;next}flag' | awk '/----.*/{flag=1;next}flag' > /tmp/gpu-viewer/FrameBufferGLXFBconfigs.txt"
    )

    list = []
    with open("/tmp/gpu-viewer/FrameBufferGLXFBconfigs.txt", "r") as file1:
        for line in file1:
            list.append(line.split())

    for i in range(len(list) - 1):
        background_color = setBackgroundColor(i)
        if list[i][6] == "r" or list[i][6] == "c":
            pass
        else:
            list[i].insert(6, ".")
        FBConfig_Store.append(list[i] + [background_color])
    label2 = "%d  GLX FBConfigs" % (len(list) - 1)
    FBNotebook.set_tab_label(FBConfigTab, Gtk.Label(label2))

    setColumnFrameBuffer(TreeFBGLX, Const.FRAMEBUFFERLIST)

    FBGLXScrollbar = createScrollbar(TreeFBGLX)
    FBGLXGrid.add(FBGLXScrollbar)

    setColumnFrameBuffer(TreeFBConfig, Const.FRAMEBUFFERLIST)

    FBConfigScrollbar = createScrollbar(TreeFBConfig)
    FBConfigGrid.add(FBConfigScrollbar)

    def button_enable(win, value):
        button.set_sensitive(True)

    FBWin.connect("delete-event", button_enable)

    FBWin.show_all()