Example #1
0
    def radcall2(button):
        value = button.get_active()

        GL_All = []

        List = copyContentsFromFile("/tmp/gpu-viewer/Vendor1.txt")

        List = [i.strip(' ') for i in List]
        List = [i.strip('\n ') for i in List]
        List.insert(0, " ALL")

        with open("/tmp/gpu-viewer/extensions.txt", "r") as file1:
            for line in file1:
                if List[int(value)] == " ALL":
                    GL_All.append(line)
                elif List[int(value)] != " ALL":
                    if "_%s_" % List[int(value)] in line:
                        GL_All.append(line)

        OpenGLExt_list.clear()
        TreeGLExt.set_model(OpenGLExt_list_filter)

        for i in range(len(List)):
            if int(value) == i:
                frame4.set_label(List[i])

        count = len(GL_All)
        for i in range(count):
            background_color = setBackgroundColor(i)
            text = GL_All[i].strip(' ')
            OpenGLExt_list.append([text.strip('\n'), background_color])
Example #2
0
    def getPlatformNames():

        os.system("clinfo -l > /tmp/gpu-viewer/PlatnDev.txt")
        # noinspection PyPep8
        os.system(
            "cat /tmp/gpu-viewer/PlatnDev.txt | grep Platform | grep -o :.* | grep -o ' .*' > /tmp/gpu-viewer/oclPlatformNames.txt"
        )
        oclPlatformName = copyContentsFromFile(
            "/tmp/gpu-viewer/oclPlatformNames.txt")
        oclPlatformName = [i.strip(' ') for i in oclPlatformName]
        oclPlatformName = [i.strip('\n') for i in oclPlatformName]
        return oclPlatformName
Example #3
0
    def showLimits(Combo, Limits_Store, TreeLimits,openGLLimits):
        k = 0
        count = 0
        limitValue = Combo.get_active_text()
        if "Show All OpenGL Hardware Core Limits" in limitValue or "Show All OpenGL Hardware Compatible Limits" in limitValue:
            os.system(
                "cat %s > /tmp/gpu-viewer/selectOpenglLimits.txt"%openGLLimits)

            os.system("cat /tmp/gpu-viewer/selectOpenglLimits.txt | awk '{gsub(/=.*/,'True');print}' > /tmp/gpu-viewer/OpenGLLimitsLHS.txt")
            os.system("cat /tmp/gpu-viewer/selectOpenglLimits.txt | grep -o =.* | grep -o ' .*' > /tmp/gpu-viewer/OpenGLLimitsRHS.txt")

        else:
            with open(openGLLimits,"r") as file1:
                for line in file1:
                    if limitValue in line:
                        os.system("cat %s | awk '/%s:/{flag=1;next}/:.*/{flag=0}flag' > /tmp/gpu-viewer/selectOpenglLimits.txt"%(openGLLimits,limitValue))
                        os.system("cat /tmp/gpu-viewer/selectOpenglLimits.txt | awk '{gsub(/=.*/,'True');print}' > /tmp/gpu-viewer/OpenGLLimitsLHS.txt")
                        os.system("cat /tmp/gpu-viewer/selectOpenglLimits.txt | grep -o =.* | grep -o ' .*' > /tmp/gpu-viewer/OpenGLLimitsRHS.txt")


        with open("/tmp/gpu-viewer/OpenGLLimitsLHS.txt", "r") as file1:
            temp = copyContentsFromFile("/tmp/gpu-viewer/OpenGLLimitsRHS.txt")
            LimitsRHS,LimitRHSValue = appendLimitsRHS("/tmp/gpu-viewer/selectOpenglLimits.txt",temp)

            Limits_Store.clear()
            TreeLimits.set_model(Limits_Store)
            for i, line in enumerate(file1):
                background_color = setBackgroundColor(k)
                k += 1
                TreeLimits.expand_all()
                text = line.strip(' ')
                if ("TEXTURE_FORMATS" in line or "SHADING_LANGUAGE" in line) and LimitRHSValue[i] == True:
                    try:
                        iter3 = Limits_Store.append(iter2, [text.strip('\n'), LimitsRHS[i].strip('\n'), background_color])
                    except Exception:
                        iter3 = Limits_Store.append(None, [text.strip('\n'), LimitsRHS[i].strip('\n'), background_color])
                    finally:
                        pass
                elif "      " in line and LimitRHSValue[i] == False and ":" not in line:
                    Limits_Store.append(iter3, [text.strip('\n'), LimitsRHS[i].strip('\n'), background_color])
                else:
                    if ":" in line:
                        k = 0
                        text = line[:-2]
                        count += 1
                        iter2 = Limits_Store.append(None,
                                                    [text.strip('\n'), LimitsRHS[i].strip('\n'), Const.BGCOLOR3])
                        continue
                    if count > 0 and "    " in line:
                        Limits_Store.append(iter2, [text.strip('\n'), LimitsRHS[i].strip('\n'), background_color])
                    else:
                        Limits_Store.append(None, [text.strip('\n'), LimitsRHS[i].strip('\n'), background_color])
Example #4
0
    def Surface(GPUname):

        for GPU in range(len(list)):
            if GPUname == GPU:
                os.system(
                    "cat /tmp/vulkaninfo.txt | awk '/Presentable Surfaces.*/{flag=1;next}/Device Properties and Extensions.*/{flag=0}flag' | awk '/GPU id       : %d.*/{flag=1;next}/GPU id       : %d.*/{flag=0}flag' | awk '/VkSurfaceCapabilities.*/{flag=1}/Device Properties.*/{flag=0}flag'> /tmp/VKDsurface.txt"
                    % (GPU, GPU + 1))
                os.system(
                    "cat /tmp/vulkaninfo.txt | awk '/Presentable Surfaces.*/{flag=1;next}/Device Properties and Extensions.*/{flag=0}flag' | awk '/GPU id       : %d.*/{flag=1;next}/VkSurfaceCapabilities.*/{flag=0}flag' | awk '{gsub(/count =.*/,'True');print}' | grep -v type >> /tmp/VKDsurface.txt"
                    % GPU)

        os.system(
            "cat /tmp/VKDsurface.txt | awk '{gsub(/= .*/,'True');print} ' > /tmp/VKDsurface1.txt"
        )
        os.system(
            "cat /tmp/VKDsurface.txt | grep -o =.* | grep -o ' .*' > /tmp/VKDsurface2.txt"
        )
        temp = []

        temp = copyContentsFromFile("/tmp/VKDsurface2.txt")
        SurfaceRHS = []
        i = 0
        with open("/tmp/VKDsurface.txt", "r") as file1:
            for line in file1:
                if "= " in line:
                    SurfaceRHS.append(temp[i])
                    i = i + 1
                else:
                    SurfaceRHS.append(" ")

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

        Surface = [i.strip('\n ') for i in Surface]
        SurfaceTab_Store.clear()
        TreeSurface.set_model(SurfaceTab_Store)

        for i in range(len(Surface)):
            if "====" in Surface[i]:
                continue
            if "type" in Surface[i]:
                continue
            background_color = setBackgroundColor(i)
            if "VkSurfaceCapabilities" in Surface[i] or "Modes" in Surface[i] or "Formats" in Surface[i] or "Extent" in \
                    Surface[i] or "supported" in Surface[i] or "current" in Surface[i]:
                background_color = Const.BGCOLOR3
            text = Surface[i].strip('\t')
            SurfaceTab_Store.append(
                [text, SurfaceRHS[i].strip('\n'), background_color])
Example #5
0
    def Devices(GPUname):

        for i in range(len(list)):
            if GPUname == i:
                os.system(
                    "cat /tmp/vulkaninfo.txt | awk '/GPU%d/{flag=1;next}/VkPhysicalDeviceLimits:/{flag=0}flag' | awk '/==.*/{flag=1;next}flag' | grep -v driver > /tmp/VKDDeviceinfo1.txt"
                    % i)

        os.system(
            "cat /tmp/VKDDeviceinfo1.txt | awk '{gsub(/=.*/,'True');}1' > /tmp/VKDDeviceinfo.txt"
        )
        os.system(
            "cat /tmp/VKDDeviceinfo1.txt | grep -o =.* | grep -o ' .*' > /tmp/VKDDeviceinfo2.txt"
        )

        # Storing the RHS values into a list

        value = copyContentsFromFile("/tmp/VKDDeviceinfo2.txt")

        # This should take care of api version from 0.0.0 to 5.9.99
        for i in range(5):
            for k in range(10):
                for j in range(RANGE1):
                    if "(%d.%d.%d)" % (i, k, j) in value[0]:
                        value[0] = " %d.%d.%d" % (i, k, j)
                        break

        for i in range(len(value)):
            if i > 0:
                if "0x" in value[i]:
                    value[i] = int(value[i], 16)
                    value[i] = str(" %d" % value[i])

        # Printing the Details into the Treeview

        DeviceTab_Store.clear()
        TreeDevice.set_model(DeviceTab_Store)

        with open("/tmp/VKDDeviceinfo.txt", "r") as file1:
            file1.seek(0, 0)
            i = 0
            for line in file1:
                text = line.strip('\t')
                background_color = setBackgroundColor(i)
                DeviceTab_Store.append(
                    [text.strip('\n'), value[i].strip('\n'), background_color])
                i = i + 1

        for i in range(len(list)):
            if GPUname == i:
                os.system(
                    "cat /tmp/vulkaninfo.txt | awk '/GPU%d/{flag=1;next}/Device Extensions.*/{flag=0}flag' | awk '/VkPhysicalDeviceSparseProperties:/{flag=1;next}/Device Extensions.*/{flag=0}flag' | grep = | sort > /tmp/VKDDevicesparseinfo1.txt"
                    % i)

        os.system(
            "cat /tmp/VKDDevicesparseinfo1.txt | awk '{gsub(/=.*/,'True');}1' > /tmp/VKDDevicesparseinfo.txt"
        )

        fgColor, value = colorTrueFalse("/tmp/VKDDevicesparseinfo1.txt", "= 1")

        SparseTab_Store.clear()
        TreeSparse.set_model(SparseTab_Store)
        with open("/tmp/VKDDevicesparseinfo.txt", "r") as file1:
            file1.seek(0, 0)
            i = 0
            for line in file1:
                text = line.strip('\t')
                background_color = setBackgroundColor(i)
                SparseTab_Store.append([
                    text.strip('\n'), value[i].strip('\n'), background_color,
                    fgColor[i]
                ])
                i = i + 1
Example #6
0
    def Queues(GPUname):

        for i in range(len(list)):
            if GPUname == i:
                os.system(
                    "cat /tmp/vulkaninfo.txt | awk '/GPU%d/{flag=1;next}/VkPhysicalDeviceMemoryProperties:/{flag=0}flag'|awk '/VkQueue.*/{flag=1; next}/VkPhysicalDeviceMemoryProperties:/{flag=0} flag' > /tmp/VKDQueues.txt"
                    % i)

        os.system(
            "cat /tmp/VKDQueues.txt | grep Count | grep -o =.* | grep -o ' .*' > /tmp/VKDQueuecount.txt"
        )
        os.system(
            "cat /tmp/VKDQueues.txt | grep times | grep -o =.* | grep -o ' .*' > /tmp/VKDQueuebits.txt"
        )
        os.system(
            "cat /tmp/VKDQueues.txt | grep Flags | grep -o =.* | grep -o ' .*' > /tmp/VKDQueueFlags.txt"
        )

        qCount = []
        qBits = []
        GBit = []
        CBit = []
        TBit = []
        SBit = []
        width = []
        height = []
        depth = []
        Gfg = []
        Cfg = []
        Tfg = []
        Sfg = []

        with open("/tmp/VKDQueues.txt", "r") as file1:
            for line in file1:
                for i in range(10):
                    for j in range(10):
                        for k in range(10):
                            if "(%d, %d, %d)" % (i, j, k) in line:
                                width.append("%d" % i)
                                height.append("%d" % j)
                                depth.append("%d" % k)

        # finding and storing the value for Flags
        Gfg, GBit = colorTrueFalse("/tmp/VKDQueueFlags.txt", "GRAPHICS")
        Cfg, CBit = colorTrueFalse("/tmp/VKDQueueFlags.txt", "COMPUTE")
        Tfg, TBit = colorTrueFalse("/tmp/VKDQueueFlags.txt", "TRANSFER")
        Sfg, SBit = colorTrueFalse("/tmp/VKDQueueFlags.txt", "SPARSE")

        qCount = copyContentsFromFile("/tmp/VKDQueuecount.txt")

        qBits = copyContentsFromFile("/tmp/VKDQueuebits.txt")

        QueueTab_Store.clear()
        TreeQueue.set_model(QueueTab_Store)
        for i in range(len(qCount)):
            background_color = setBackgroundColor(i)
            QueueTab_Store.append([
                i,
                int(qCount[i]),
                int(qBits[i]), GBit[i], CBit[i], TBit[i], SBit[i], width[i],
                height[i], depth[i], background_color, Gfg[i], Cfg[i], Tfg[i],
                Sfg[i]
            ])
        label = "Queues (%d)" % len(qCount)
        notebook.set_tab_label(QueueTab, Gtk.Label(label))
Example #7
0
def Vulkan(tab2):
    # Creating Tabs for different Features

    # Creating Feature Tab

    def Devices(GPUname):

        for i in range(len(list)):
            if GPUname == i:
                os.system(
                    "cat /tmp/vulkaninfo.txt | awk '/GPU%d/{flag=1;next}/VkPhysicalDeviceLimits:/{flag=0}flag' | awk '/==.*/{flag=1;next}flag' | grep -v driver > /tmp/VKDDeviceinfo1.txt"
                    % i)

        os.system(
            "cat /tmp/VKDDeviceinfo1.txt | awk '{gsub(/=.*/,'True');}1' > /tmp/VKDDeviceinfo.txt"
        )
        os.system(
            "cat /tmp/VKDDeviceinfo1.txt | grep -o =.* | grep -o ' .*' > /tmp/VKDDeviceinfo2.txt"
        )

        # Storing the RHS values into a list

        value = copyContentsFromFile("/tmp/VKDDeviceinfo2.txt")

        # This should take care of api version from 0.0.0 to 5.9.99
        for i in range(5):
            for k in range(10):
                for j in range(RANGE1):
                    if "(%d.%d.%d)" % (i, k, j) in value[0]:
                        value[0] = " %d.%d.%d" % (i, k, j)
                        break

        for i in range(len(value)):
            if i > 0:
                if "0x" in value[i]:
                    value[i] = int(value[i], 16)
                    value[i] = str(" %d" % value[i])

        # Printing the Details into the Treeview

        DeviceTab_Store.clear()
        TreeDevice.set_model(DeviceTab_Store)

        with open("/tmp/VKDDeviceinfo.txt", "r") as file1:
            file1.seek(0, 0)
            i = 0
            for line in file1:
                text = line.strip('\t')
                background_color = setBackgroundColor(i)
                DeviceTab_Store.append(
                    [text.strip('\n'), value[i].strip('\n'), background_color])
                i = i + 1

        for i in range(len(list)):
            if GPUname == i:
                os.system(
                    "cat /tmp/vulkaninfo.txt | awk '/GPU%d/{flag=1;next}/Device Extensions.*/{flag=0}flag' | awk '/VkPhysicalDeviceSparseProperties:/{flag=1;next}/Device Extensions.*/{flag=0}flag' | grep = | sort > /tmp/VKDDevicesparseinfo1.txt"
                    % i)

        os.system(
            "cat /tmp/VKDDevicesparseinfo1.txt | awk '{gsub(/=.*/,'True');}1' > /tmp/VKDDevicesparseinfo.txt"
        )

        fgColor, value = colorTrueFalse("/tmp/VKDDevicesparseinfo1.txt", "= 1")

        SparseTab_Store.clear()
        TreeSparse.set_model(SparseTab_Store)
        with open("/tmp/VKDDevicesparseinfo.txt", "r") as file1:
            file1.seek(0, 0)
            i = 0
            for line in file1:
                text = line.strip('\t')
                background_color = setBackgroundColor(i)
                SparseTab_Store.append([
                    text.strip('\n'), value[i].strip('\n'), background_color,
                    fgColor[i]
                ])
                i = i + 1

    def Features(GPUname):

        for i in range(len(list)):
            if GPUname == i:
                os.system(
                    "cat /tmp/vulkaninfo.txt | awk '/GPU%d/{flag=1;next}/Format Properties:/{flag=0}flag' | awk '/VkPhysicalDeviceFeatures:/{flag=1; next}/Format Properties:/{flag=0}flag' | awk '/==/{flag=1 ; next} flag' | grep = | sort > /tmp/VKDFeatures1.txt"
                    % i)

        os.system(
            "cat /tmp/VKDFeatures1.txt | awk '{gsub(/= 1/,'True');print}' | awk '{gsub(/= 0/,'False');print}' > /tmp/VKDFeatures.txt"
        )

        fgColor, value = colorTrueFalse("/tmp/VKDFeatures1.txt", "= 1")

        FeaturesTab_Store.clear()
        TreeFeatures.set_model(FeaturesTab_Store)
        i = 0
        with open("/tmp/VKDFeatures.txt", "r") as file1:
            for line in file1:
                text = line.strip('\t')
                background_color = setBackgroundColor(i)
                FeaturesTab_Store.append([
                    text.strip('\n'), value[i].strip('\n'), background_color,
                    fgColor[i]
                ])
                i = i + 1

    def Limits(GPUname):

        for i in range(len(list)):
            if GPUname == i:
                os.system(
                    "cat /tmp/vulkaninfo.txt | awk '/GPU%d/{flag=1;next}/VkPhysicalDeviceSparseProperties:/{flag=0}flag'| awk '/--/{flag=1 ; next} flag' | sort > /tmp/VKDlimits1.txt"
                    % i)

        os.system(
            "cat /tmp/VKDlimits1.txt | awk '{gsub(/=.*/,'True');}1' > /tmp/VKDlimits.txt"
        )
        os.system(
            "cat /tmp/VKDlimits1.txt | grep -o '=.*' | grep -o '[ -].*' > /tmp/VKDlimits2.txt"
        )

        value = copyContentsFromFile("/tmp/VKDlimits2.txt")

        # finding and converting any hexadecimal value to decimal

        for i in range(len(value)):
            if "0x" in value[i]:
                value[i] = str(int(value[i], 16))

        LimitsTab_Store.clear()
        TreeLimits.set_model(LimitsTab_Store)

        value = [i.strip(' ') for i in value]
        with open("/tmp/VKDlimits.txt", "r") as file1:
            i = 0
            for line in file1:
                text = line.strip('\t')
                background_color = setBackgroundColor(i)
                LimitsTab_Store.append(
                    [text.strip('\n'), value[i].strip('\n'), background_color])
                i = i + 1

    def Extensions(GPUname):

        for i in range(len(list)):
            if GPUname == i:
                os.system(
                    "cat /tmp/vulkaninfo.txt | awk '/GPU%d/{flag=1;next}/VkQueueFamilyProperties/{flag=0}flag'|awk '/Device Extensions/{flag=1; next}/VkQueueFamilyProperties/{flag=0} flag' | grep VK_ | sort > /tmp/VKDExtensions1.txt"
                    % i)

        os.system(
            "cat /tmp/VKDExtensions1.txt | awk '{gsub(/:.*/,'True');print} ' > /tmp/VKDExtensions.txt"
        )

        # This should take care of further versioning till 100
        with open("/tmp/VKDExtensions1.txt", "r") as file1:
            value = []
            for line in file1:
                for j in range(RANGE1):
                    if ": extension revision %2d" % j in line:
                        value.append("0.0.%d" % j)
                        break

        ExtensionTab_Store.clear()
        TreeExtension.set_model(ExtensionTab_Store)

        with open("/tmp/VKDExtensions.txt", "r") as file1:
            count = len(file1.readlines())
            label = "Extensions (%d)" % count
            notebook.set_tab_label(ExtensionTab, Gtk.Label(label))
            file1.seek(0, 0)
            i = 0
            for line in file1:
                text = line.strip('\t')
                background_color = setBackgroundColor(i)
                ExtensionTab_Store.append(
                    [text.strip('\n'), value[i].strip('\n'), background_color])
                i = i + 1

    def Format(GPUname):

        for i in range(len(list)):
            if GPUname == i:
                os.system(
                    "cat /tmp/vulkaninfo.txt | awk '/GPU%d/{flag=1;next}/Device Properties/{flag=0}flag'|awk '/Format Properties/{flag=1; next}/Device Properties/{flag=0} flag' | grep ^FORMAT_ | grep -o _.* | grep -o [a-zA-Z].* > /tmp/VKDFORMATS.txt"
                    % i)
                os.system(
                    "cat /tmp/vulkaninfo.txt | awk '/GPU%d/{flag=1;next}/Device Properties/{flag=0}flag'|awk '/Format Properties/{flag=1; next}/Device Properties/{flag=0} flag' | awk 'f{print;f=0} /linearTiling.*/{f=1}'> /tmp/VKDFORMATSlinear.txt"
                    % i)
                os.system(
                    "cat /tmp/vulkaninfo.txt | awk '/GPU%d/{flag=1;next}/Device Properties/{flag=0}flag'|awk '/Format Properties/{flag=1; next}/Device Properties/{flag=0} flag' | awk 'f{print;f=0} /optimalTiling.*/{f=1}'> /tmp/VKDFORMATSoptimal.txt"
                    % i)
                os.system(
                    "cat /tmp/vulkaninfo.txt | awk '/GPU%d/{flag=1;next}/Device Properties/{flag=0}flag'|awk '/Format Properties/{flag=1; next}/Device Properties/{flag=0} flag' | awk 'f{print;f=0} /bufferFeatures.*/{f=1}'> /tmp/VKDFORMATSBuffer.txt"
                    % i)

        linear = []
        optimal = []
        Buffer = []
        linearfg = []

        # Linear values

        linearfg, linear = colorTrueFalse("/tmp/VKDFORMATSlinear.txt", "VK")

        # Optimal Values
        optimalfg, optimal = colorTrueFalse("/tmp/VKDFORMATSoptimal.txt", "VK")

        # Buffer Values
        Bufferfg, Buffer = colorTrueFalse("/tmp/VKDFORMATSBuffer.txt", "VK")

        count = len(linear)
        # counting the number of formats supported
        Formats = 0
        for i in range(count):
            if linear[i] == "true" or optimal[i] == "true" or Buffer[
                    i] == "true":
                Formats = Formats + 1
        FormatsTab_Store.clear()
        TreeFormats.set_model(FormatsTab_Store)
        with open("/tmp/VKDFORMATS.txt", "r") as file1:
            file1.seek(0, 0)
            label = "Formats (%d)" % Formats
            notebook.set_tab_label(FormatsTab, Gtk.Label(label))
            i = 0
            for line in file1:
                background_color = setBackgroundColor(i)
                FormatsTab_Store.append([
                    line.strip('\n'), linear[i].strip('\n'),
                    optimal[i].strip('\n'), Buffer[i].strip('\n'),
                    background_color, linearfg[i], optimalfg[i], Bufferfg[i]
                ])
                i = i + 1

    def MemoryTypes(GPUname):

        for i in range(len(list)):
            if GPUname == i:
                os.system(
                    "cat /tmp/vulkaninfo.txt | awk '/GPU%d/{flag=1;next}/VkPhysicalDeviceFeatures:/{flag=0}flag'|awk '/VkPhysicalDeviceMemoryProperties:/{flag=1; next}/VkPhysicalDeviceFeatures:/{flag=0} flag' > /tmp/VKDMemoryType.txt"
                    % i)

        with open("/tmp/VKDMemoryType.txt", "r") as file1:
            heapIndex = []
            for line in file1:
                for j in range(RANGE1):
                    if "heapIndex" in line:
                        if "= %d" % j in line:
                            heapIndex.append(j)
                            break

        Device_Local = []
        Host_Visible = []
        Host_Coherent = []
        Host_Cached = []
        Lazily_Allocated = []
        Flags = []
        Mcount = 0
        LAfg = []
        HCAfg = []
        HCOfg = []
        HVfg = []
        DLfg = []

        with open("/tmp/VKDMemoryType.txt", "r") as file1:
            for line in file1:
                if "memoryTypes" in line:
                    Mcount = Mcount + 1
                for i in range(32):
                    if " %s:" % hex(i) in line:
                        dec = int(hex(i), 16)
                        binary = bin(dec)[2:]
                        for j in range(len(binary)):
                            if binary[j] == '0':
                                Flags.insert(j, "false")
                            if binary[j] == '1':
                                Flags.insert(j, "true")
                        for j in range(5 - len(binary)):
                            Flags.insert(0, "false")
                        for i in range(len(Flags)):
                            if i == 0:
                                Lazily_Allocated.append(Flags[i])
                                if Flags[i] == "false":
                                    LAfg.append(Const.COLOR2)
                                else:
                                    LAfg.append(Const.COLOR1)
                            elif i == 1:
                                Host_Cached.append(Flags[i])
                                if Flags[i] == "false":
                                    HCAfg.append(Const.COLOR2)
                                else:
                                    HCAfg.append(Const.COLOR1)
                            elif i == 2:
                                Host_Coherent.append(Flags[i])
                                if Flags[i] == "false":
                                    HCOfg.append(Const.COLOR2)
                                else:
                                    HCOfg.append(Const.COLOR1)
                            elif i == 3:
                                Host_Visible.append(Flags[i])
                                if Flags[i] == "false":
                                    HVfg.append(Const.COLOR2)
                                else:
                                    HVfg.append(Const.COLOR1)
                            elif i == 4:
                                Device_Local.append(Flags[i])
                                if Flags[i] == "false":
                                    DLfg.append(Const.COLOR2)
                                else:
                                    DLfg.append(Const.COLOR1)

        MemoryTab_Store.clear()
        TreeMemory.set_model(MemoryTab_Store)
        for i in range(Mcount):
            background_color = setBackgroundColor(i)
            MemoryTab_Store.append([
                i, heapIndex[i], Device_Local[i].strip('\n'),
                Host_Visible[i].strip('\n'), Host_Coherent[i].strip('\n'),
                Host_Cached[i].strip('\n'), Lazily_Allocated[i].strip('\n'),
                background_color, DLfg[i], HVfg[i], HCOfg[i], HCAfg[i], LAfg[i]
            ])

        HCount = 0
        size = []
        HEAP_DEVICE_LOCAL = []

        with open("/tmp/VKDMemoryType.txt", "r") as file1:
            Heapfg = []
            for line in file1:
                if "memoryHeaps" in line:
                    HCount = HCount + 1
                if "HEAP_DEVICE_LOCAL" in line:
                    HEAP_DEVICE_LOCAL.append("true")
                    Heapfg.append(Const.COLOR1)
                if "None" in line:
                    HEAP_DEVICE_LOCAL.append("false")
                    Heapfg.append(Const.COLOR2)
                if "size " in line:
                    for j in range(1024):
                        for k in range(RANGE1):
                            if "(%d.%02d GiB)" % (j, k) in line:
                                size.append("%d.%02d GB" % (j, k))
                                break
                            elif "(%d.%02d MiB)" % (j, k) in line:
                                size.append("%d.%02d MB" % (j, k))
                                break

        HeapTab_Store.clear()
        TreeHeap.set_model(HeapTab_Store)

        for i in range(HCount):
            background_color = setBackgroundColor(i)
            HeapTab_Store.append([
                i, size[i].strip('\n'), HEAP_DEVICE_LOCAL[i].strip('\n'),
                background_color, Heapfg[i]
            ])

        label = "Memory Types (%d) & Heaps (%d)" % (Mcount, HCount)
        notebook.set_tab_label(MemoryTab, Gtk.Label(label))

    def Queues(GPUname):

        for i in range(len(list)):
            if GPUname == i:
                os.system(
                    "cat /tmp/vulkaninfo.txt | awk '/GPU%d/{flag=1;next}/VkPhysicalDeviceMemoryProperties:/{flag=0}flag'|awk '/VkQueue.*/{flag=1; next}/VkPhysicalDeviceMemoryProperties:/{flag=0} flag' > /tmp/VKDQueues.txt"
                    % i)

        os.system(
            "cat /tmp/VKDQueues.txt | grep Count | grep -o =.* | grep -o ' .*' > /tmp/VKDQueuecount.txt"
        )
        os.system(
            "cat /tmp/VKDQueues.txt | grep times | grep -o =.* | grep -o ' .*' > /tmp/VKDQueuebits.txt"
        )
        os.system(
            "cat /tmp/VKDQueues.txt | grep Flags | grep -o =.* | grep -o ' .*' > /tmp/VKDQueueFlags.txt"
        )

        qCount = []
        qBits = []
        GBit = []
        CBit = []
        TBit = []
        SBit = []
        width = []
        height = []
        depth = []
        Gfg = []
        Cfg = []
        Tfg = []
        Sfg = []

        with open("/tmp/VKDQueues.txt", "r") as file1:
            for line in file1:
                for i in range(10):
                    for j in range(10):
                        for k in range(10):
                            if "(%d, %d, %d)" % (i, j, k) in line:
                                width.append("%d" % i)
                                height.append("%d" % j)
                                depth.append("%d" % k)

        # finding and storing the value for Flags
        Gfg, GBit = colorTrueFalse("/tmp/VKDQueueFlags.txt", "GRAPHICS")
        Cfg, CBit = colorTrueFalse("/tmp/VKDQueueFlags.txt", "COMPUTE")
        Tfg, TBit = colorTrueFalse("/tmp/VKDQueueFlags.txt", "TRANSFER")
        Sfg, SBit = colorTrueFalse("/tmp/VKDQueueFlags.txt", "SPARSE")

        qCount = copyContentsFromFile("/tmp/VKDQueuecount.txt")

        qBits = copyContentsFromFile("/tmp/VKDQueuebits.txt")

        QueueTab_Store.clear()
        TreeQueue.set_model(QueueTab_Store)
        for i in range(len(qCount)):
            background_color = setBackgroundColor(i)
            QueueTab_Store.append([
                i,
                int(qCount[i]),
                int(qBits[i]), GBit[i], CBit[i], TBit[i], SBit[i], width[i],
                height[i], depth[i], background_color, Gfg[i], Cfg[i], Tfg[i],
                Sfg[i]
            ])
        label = "Queues (%d)" % len(qCount)
        notebook.set_tab_label(QueueTab, Gtk.Label(label))

    def Instance():

        os.system(
            "cat /tmp/vulkaninfo.txt | awk '/Instance Extensions	count.*/{flag=1;next}/Layers: count.*/{flag=0}flag'| grep VK_ | sort > /tmp/VKDInstanceExtensions1.txt"
        )
        os.system(
            "cat /tmp/VKDInstanceExtensions1.txt | awk '{gsub(/:.*/,'True');print} ' > /tmp/VKDInstanceExtensions.txt"
        )

        # This should take care of further versioning till RANGE1
        with open("/tmp/VKDInstanceExtensions1.txt", "r") as file1:
            value = []
            for line in file1:
                for j in range(RANGE1):
                    if ": extension revision %2d" % j in line:
                        value.append("0.0.%d" % j)
                        break
        InstanceTab_Store.clear()
        TreeInstance.set_model(InstanceTab_Store)
        with open("/tmp/VKDInstanceExtensions.txt", "r") as file1:
            count1 = len(file1.readlines())
            label = "Instances (%d)" % count1
            notebook.set_tab_label(InstanceTab, Gtk.Label(label))
            file1.seek(0, 0)
            i = 0
            for line in file1:
                text = line.strip('\t')
                background_color = setBackgroundColor(i)
                InstanceTab_Store.append(
                    [text.strip('\n'), value[i].strip('\n'), background_color])
                i = i + 1

        os.system(
            "cat /tmp/vulkaninfo.txt | awk '/Layers: count.*/{flag=1;next}/Presentable Surfaces.*/{flag=0}flag' > /tmp/VKDLayer1.txt"
        )
        os.system(
            "cat /tmp/VKDLayer1.txt | grep _LAYER_ | awk '{gsub(/\(.*/,'True');print} ' > /tmp/VKDLayer.txt"
        )

        Vversion = []
        with open("/tmp/VKDLayer1.txt", "r") as file1:
            for line in file1:
                for j in range(RANGE1):
                    if "Vulkan version 1.0.%d," % j in line:
                        Vversion.append("1.0.%d" % j)

        LVersion = []
        with open("/tmp/VKDLayer1.txt", "r") as file1:
            for line in file1:
                for j in range(RANGE1):
                    if "layer version %d" % j in line:
                        LVersion.append("0.0.%d" % j)
                        break

        ECount = []
        with open("/tmp/VKDLayer1.txt", "r") as file1:
            for line in file1:
                for j in range(RANGE1):
                    if "Layer Extensions	count = %d" % j in line:
                        ECount.append("%d" % j)
                        break

        LayerTab_Store.clear()
        TreeLayer.set_model(LayerTab_Store)
        count2 = len(LVersion)
        label = "Instances (%d) & Layers (%d)" % (count1, count2)
        notebook.set_tab_label(InstanceTab, Gtk.Label(label))
        with open("/tmp/VKDLayer.txt", "r") as file1:
            i = 0
            for line in file1:
                background_color = setBackgroundColor(i)
                LayerTab_Store.append([
                    line.strip('\n'), Vversion[i].strip('\n'),
                    LVersion[i].strip('\n'), ECount[i].strip('\n'),
                    background_color
                ])
                i = i + 1

    def Surface(GPUname):

        for GPU in range(len(list)):
            if GPUname == GPU:
                os.system(
                    "cat /tmp/vulkaninfo.txt | awk '/Presentable Surfaces.*/{flag=1;next}/Device Properties and Extensions.*/{flag=0}flag' | awk '/GPU id       : %d.*/{flag=1;next}/GPU id       : %d.*/{flag=0}flag' | awk '/VkSurfaceCapabilities.*/{flag=1}/Device Properties.*/{flag=0}flag'> /tmp/VKDsurface.txt"
                    % (GPU, GPU + 1))
                os.system(
                    "cat /tmp/vulkaninfo.txt | awk '/Presentable Surfaces.*/{flag=1;next}/Device Properties and Extensions.*/{flag=0}flag' | awk '/GPU id       : %d.*/{flag=1;next}/VkSurfaceCapabilities.*/{flag=0}flag' | awk '{gsub(/count =.*/,'True');print}' | grep -v type >> /tmp/VKDsurface.txt"
                    % GPU)

        os.system(
            "cat /tmp/VKDsurface.txt | awk '{gsub(/= .*/,'True');print} ' > /tmp/VKDsurface1.txt"
        )
        os.system(
            "cat /tmp/VKDsurface.txt | grep -o =.* | grep -o ' .*' > /tmp/VKDsurface2.txt"
        )
        temp = []

        temp = copyContentsFromFile("/tmp/VKDsurface2.txt")
        SurfaceRHS = []
        i = 0
        with open("/tmp/VKDsurface.txt", "r") as file1:
            for line in file1:
                if "= " in line:
                    SurfaceRHS.append(temp[i])
                    i = i + 1
                else:
                    SurfaceRHS.append(" ")

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

        Surface = [i.strip('\n ') for i in Surface]
        SurfaceTab_Store.clear()
        TreeSurface.set_model(SurfaceTab_Store)

        for i in range(len(Surface)):
            if "====" in Surface[i]:
                continue
            if "type" in Surface[i]:
                continue
            background_color = setBackgroundColor(i)
            if "VkSurfaceCapabilities" in Surface[i] or "Modes" in Surface[i] or "Formats" in Surface[i] or "Extent" in \
                    Surface[i] or "supported" in Surface[i] or "current" in Surface[i]:
                background_color = Const.BGCOLOR3
            text = Surface[i].strip('\t')
            SurfaceTab_Store.append(
                [text, SurfaceRHS[i].strip('\n'), background_color])

    def radcall(combo):
        text = combo.get_active()
        for i in range(len(list)):
            if text == i:
                Devices(text)
                Features(text)
                Limits(text)
                Extensions(text)
                Format(text)
                MemoryTypes(text)
                Queues(text)
                Surface(text)
            Instance()
        os.system("rm /tmp/VKD*.txt")

    grid = Gtk.Grid()
    tab2.add(grid)
    DevicesFrame = Gtk.Frame()
    grid.add(DevicesFrame)

    notebook = Gtk.Notebook()
    grid.attach(notebook, 0, 2, 1, 1)
    # ----------------Creating the Device Info Tab ------------

    DeviceTab = Gtk.VBox(spacing=10)
    DeviceGrid = createSubTab(DeviceTab, notebook, "Device")

    DeviceTab_Store = Gtk.ListStore(str, str, str)
    TreeDevice = Gtk.TreeView(DeviceTab_Store, expand=True)

    setColumns(TreeDevice, DeviceTitle, Const.MWIDTH, 0.0)

    DeviceScrollbar = createScrollbar(TreeDevice)
    DeviceGrid.add(DeviceScrollbar)

    SparseGrid = createSubFrame(DeviceTab)

    SparseTab_Store = Gtk.ListStore(str, str, str, str)
    TreeSparse = Gtk.TreeView(SparseTab_Store, expand=True)
    TreeSparse.set_enable_search(True)
    for i, column_title in enumerate(SparseTitle):
        Sparserenderer = Gtk.CellRendererText(font=Const.FONT)
        column = Gtk.TreeViewColumn(column_title, Sparserenderer, text=i)
        column.set_sort_column_id(i)
        column.set_resizable(True)
        column.set_reorderable(True)
        column.set_property("min-width", Const.MWIDTH)
        if i == 1:
            column.add_attribute(Sparserenderer, "foreground", 3)
        column.add_attribute(Sparserenderer, "background", 2)
        TreeSparse.append_column(column)

    SparseScrollbar = createScrollbar(TreeSparse)
    SparseGrid.add(SparseScrollbar)

    # -----------------Creating the Features Tab-----------------

    FeatureTab = Gtk.VBox(spacing=10)
    FeaturesGrid = createSubTab(FeatureTab, notebook, "Features")

    FeaturesTab_Store = Gtk.ListStore(str, str, str, str)
    TreeFeatures = Gtk.TreeView(FeaturesTab_Store, expand=True)
    TreeFeatures.set_enable_search(True)
    for i, column_title in enumerate(FeaturesTitle):
        Featurerenderer = Gtk.CellRendererText(font=Const.FONT)
        column = Gtk.TreeViewColumn(column_title, Featurerenderer, text=i)
        column.set_sort_column_id(i)
        column.set_resizable(True)
        column.set_reorderable(True)
        if i == 1:
            column.add_attribute(Featurerenderer, "foreground", 3)
        column.add_attribute(Featurerenderer, "background", 2)
        column.set_property("min-width", MWIDTH)
        TreeFeatures.append_column(column)

    FeatureScrollbar = createScrollbar(TreeFeatures)
    FeaturesGrid.add(FeatureScrollbar)

    # ------------ Creating the Limits Tab -------------------------------------------
    LimitsTab = Gtk.VBox(spacing=10)
    LimitsGrid = createSubTab(LimitsTab, notebook, "Limits")

    LimitsTab_Store = Gtk.ListStore(str, str, str)
    TreeLimits = Gtk.TreeView(LimitsTab_Store, expand=True)
    TreeLimits.set_enable_search(True)

    setColumns(TreeLimits, LimitsTitle, Const.MWIDTH, 0.0)

    LimitsScrollbar = createScrollbar(TreeLimits)
    LimitsGrid.add(LimitsScrollbar)

    # ------------ Creating the Extensions Tab-------------------------------------------

    ExtensionTab = Gtk.VBox(spacing=10)
    ExtensionGrid = createSubTab(ExtensionTab, notebook, "Extensions")

    ExtensionTab_Store = Gtk.ListStore(str, str, str)
    TreeExtension = Gtk.TreeView(ExtensionTab_Store, expand=True)
    TreeExtension.set_enable_search(True)

    setColumns(TreeExtension, ExtensionsTitle, Const.MWIDTH, 0.0)

    ExtensionScrollbar = createScrollbar(TreeExtension)
    ExtensionGrid.add(ExtensionScrollbar)
    # ------------Creating the Formats Tab --------------------------------------------------

    FormatsTab = Gtk.VBox(spacing=10)
    FormatsGrid = createSubTab(FormatsTab, notebook, "Formats")

    FormatsTab_Store = Gtk.ListStore(str, str, str, str, str, str, str, str)
    TreeFormats = Gtk.TreeView(FormatsTab_Store, expand=True)
    TreeFormats.set_enable_search(True)
    for i, column_title in enumerate(FormatsTitle):
        Formatsrenderer = Gtk.CellRendererText(font=Const.FONT)
        column = Gtk.TreeViewColumn(column_title, Formatsrenderer, text=i)
        column.add_attribute(Formatsrenderer, "background", 4)
        column.set_sort_column_id(i)
        column.set_resizable(True)
        column.set_reorderable(True)
        column.set_property("min-width", MWIDTH)
        column.set_property("min-width", 100)
        if 1 <= i < 4:
            column.add_attribute(Formatsrenderer, "foreground", i + 4)
        TreeFormats.append_column(column)

    FormatsScrollbar = createScrollbar(TreeFormats)
    FormatsGrid.add(FormatsScrollbar)

    # ------------------------Memory Types & Heaps----------------------------------------------

    MemoryTab = Gtk.VBox(spacing=10)
    MemoryGrid = createSubTab(MemoryTab, notebook, "Memory Types & Heaps")

    MemoryTab_Store = Gtk.ListStore(int, int, str, str, str, str, str, str,
                                    str, str, str, str, str)
    TreeMemory = Gtk.TreeView(MemoryTab_Store, expand=True)
    TreeMemory.set_enable_search(True)

    for i, column_title in enumerate(MemoryTitle):
        Memoryrenderer = Gtk.CellRendererText(font=Const.FONT)
        column = Gtk.TreeViewColumn(column_title, Memoryrenderer, text=i)
        column.add_attribute(Memoryrenderer, "background", 7)
        column.set_sort_column_id(i)
        column.set_resizable(True)
        column.set_reorderable(True)
        if 2 <= i < 7:
            column.set_property("min-width", 100)
            column.add_attribute(Memoryrenderer, "foreground", i + 6)
        TreeMemory.append_column(column)

    MemoryScrollbar = createScrollbar(TreeMemory)
    MemoryGrid.add(MemoryScrollbar)

    HeapGrid = createSubFrame(MemoryTab)

    HeapTab_Store = Gtk.ListStore(int, str, str, str, str)
    TreeHeap = Gtk.TreeView(HeapTab_Store, expand=True)
    TreeHeap.set_enable_search(True)
    for i, column_title in enumerate(HeapTitle):
        Heaprenderer = Gtk.CellRendererText(font=Const.FONT)
        column = Gtk.TreeViewColumn(column_title, Heaprenderer, text=i)
        column.set_resizable(True)
        column.set_reorderable(True)
        column.set_sort_column_id(i)
        if i == 1:
            column.set_property("min-width", 200)
        column.add_attribute(Heaprenderer, "background", 3)
        if i == 2:
            column.add_attribute(Heaprenderer, "foreground", 4)
        TreeHeap.append_column(column)

    HeapScrollbar = createScrollbar(TreeHeap)
    HeapGrid.add(HeapScrollbar)
    # -------------------------Creating the Queues Tab -----------------------------------------------------

    QueueTab = Gtk.VBox(spacing=10)
    QueueGrid = createSubTab(QueueTab, notebook, "Queue")

    QueueTab_Store = Gtk.ListStore(int, int, int, str, str, str, str, str, str,
                                   str, str, str, str, str, str)
    TreeQueue = Gtk.TreeView(QueueTab_Store, expand=True)
    TreeQueue.set_enable_search(True)

    for i, column_title in enumerate(QueueTitle):
        Queuerenderer = Gtk.CellRendererText(font=Const.FONT)
        Queuerenderer.set_alignment(0.5, 0.5)
        column = Gtk.TreeViewColumn(column_title, Queuerenderer, text=i)
        column.set_alignment(0.5)
        column.add_attribute(Queuerenderer, "background", 10)
        column.set_sort_column_id(i)
        column.set_resizable(True)
        column.set_reorderable(True)
        if 2 < i < 7:
            column.add_attribute(Queuerenderer, "foreground", i + 8)
        TreeQueue.append_column(column)

    QueueScrollbar = createScrollbar(TreeQueue)
    QueueGrid.add(QueueScrollbar)

    # -------------------------Creating the Instances & Layers ---------------------------------------------

    InstanceTab = Gtk.VBox(spacing=10)
    InstanceGrid = createSubTab(InstanceTab, notebook, "Instances & layers")

    InstanceTab_Store = Gtk.ListStore(str, str, str)
    TreeInstance = Gtk.TreeView(InstanceTab_Store, expand=True)
    TreeInstance.set_enable_search(True)

    setColumns(TreeInstance, InstanceTitle, 300, 0.0)

    InstanceScrollbar = createScrollbar(TreeInstance)
    InstanceGrid.add(InstanceScrollbar)

    LayerGrid = createSubFrame(InstanceTab)

    LayerTab_Store = Gtk.ListStore(str, str, str, str, str)
    TreeLayer = Gtk.TreeView(LayerTab_Store, expand=True)
    TreeLayer.set_enable_search(TreeLayer)

    setColumns(TreeLayer, LayerTitle, 100, 0.0)

    LayerScrollbar = createScrollbar(TreeLayer)
    LayerGrid.add(LayerScrollbar)

    # ------------------ Creating the Surface Tab --------------------------------------------------
    SurfaceTab_Store = Gtk.ListStore(str, str, str)
    TreeSurface = Gtk.TreeView(SurfaceTab_Store, expand=True)
    with open("/tmp/vulkaninfo.txt", "r") as file1:
        for line in file1:
            if "VkSurfaceCapabilities" in line:
                SurfaceTab = Gtk.VBox(spacing=10)
                SurfaceGrid = createSubTab(SurfaceTab, notebook, "Surface")

                for i, column_title in enumerate(SurfaceTitle):
                    Surfacerenderer = Gtk.CellRendererText(font=Const.FONT)
                    column = Gtk.TreeViewColumn(column_title,
                                                Surfacerenderer,
                                                text=i)
                    column.add_attribute(Surfacerenderer, "background", 2)
                    column.set_property("min-width", MWIDTH)
                    TreeSurface.append_column(column)

                SurfaceScrollbar = createScrollbar(TreeSurface)
                SurfaceGrid.add(SurfaceScrollbar)
                break

    DevicesGrid = Gtk.Grid()
    DevicesGrid.set_border_width(20)
    DevicesGrid.set_column_spacing(40)
    DevicesFrame.add(DevicesGrid)

    #	grid.set_column_spacing(40)
    grid.set_row_spacing(30)
    os.system(
        "cat /tmp/vulkaninfo.txt | grep Name | grep -o  =.* | grep -o ' .*' > /tmp/GPU.txt"
    )

    list = copyContentsFromFile("/tmp/GPU.txt")

    list = [i.strip('\n ') for i in list]

    DS = Gtk.Label()
    DS.set_text("Available Device(s) :")
    DevicesGrid.attach(DS, 0, 1, 1, 1)
    gpu_store = Gtk.ListStore(str)
    for i in list:
        gpu_store.append([i])

    gpu_combo = Gtk.ComboBox.new_with_model(gpu_store)
    gpu_combo.connect("changed", radcall)
    renderer_text = Gtk.CellRendererText()
    gpu_combo.pack_start(renderer_text, True)
    gpu_combo.add_attribute(renderer_text, "text", 0)
    gpu_combo.set_entry_text_column(0)
    gpu_combo.set_active(0)

    DevicesGrid.attach_next_to(gpu_combo, DS, Gtk.PositionType.RIGHT, 20, 1)

    tab2.show_all()
Example #8
0
    def getDeviceQueueExecutionCapabilities(value):

        value2 = platform_combo.get_active()

        oclPlatformslocal = []
        oclPlatformslocal = oclPlatformslocal + oclPlatforms
        oclPlatformslocal.append("BLANK")

        for i in range(len(oclPlatformslocal)):
            oclPlatformslocal[i] = [
                j.replace("(", "\(") for j in oclPlatformslocal[i]
            ]
            oclPlatformslocal[i] = [
                j.replace(")", "\)") for j in oclPlatformslocal[i]
            ]
            oclPlatformslocal[i] = ''.join(oclPlatformslocal[i])

        os.system(
            "cat /tmp/gpu-viewer/clinfo.txt |  awk '/%s/&& ++n == 2,/%s/' | awk '/Device Name.*/&& ++n == %d,/Extensions.*/' | awk '/Queue.*/{flag=1;print}/Extensions.*/{flag=0}flag' | grep -v Available | uniq > /tmp/gpu-viewer/oclDeviceQueueExecutionDetails.txt"
            % (oclPlatformslocal[value2], oclPlatformslocal[value2 + 1],
               value + 1))
        os.system(
            "cat /tmp/gpu-viewer/oclDeviceQueueExecutionDetails.txt | awk '{gsub(/     .*/,'True');print}' > /tmp/gpu-viewer/oclDeviceQueueExecutionDetailsLHS.txt"
        )
        os.system(
            "cat /tmp/gpu-viewer/oclDeviceQueueExecutionDetails.txt | awk '{gsub(/^ .*        /,'True');print}' > /tmp/gpu-viewer/oclDeviceQueueExecutionDetailsRHS.txt"
        )

        oclDeviceQueueExecutionDetailsLHS = copyContentsFromFile(
            "/tmp/gpu-viewer/oclDeviceQueueExecutionDetailsLHS.txt")
        oclDeviceQueueExecutionDetailsRHS = copyContentsFromFile(
            "/tmp/gpu-viewer/oclDeviceQueueExecutionDetailsRHS.txt")

        oclDeviceQueueExecutionDetailsLHS = [
            i.strip('\n') for i in oclDeviceQueueExecutionDetailsLHS
        ]
        oclDeviceQueueExecutionDetailsRHS = [
            i.strip('\n') for i in oclDeviceQueueExecutionDetailsRHS
        ]

        DeviceQueueExecution_store.clear()
        DeviceQueueExecutionTreeView.set_model(DeviceQueueExecution_store)
        fgcolor = []

        for i in range(len(oclDeviceQueueExecutionDetailsRHS)):
            if "Yes" in oclDeviceQueueExecutionDetailsRHS[i]:
                fgcolor.append("GREEN")
            elif "No" in oclDeviceQueueExecutionDetailsRHS[
                    i] and "None" not in oclDeviceQueueExecutionDetailsRHS[i]:
                fgcolor.append("RED")
            else:
                fgcolor.append("BLACK")

        for i in range(len(oclDeviceQueueExecutionDetailsLHS)):
            DeviceQueueExecutionTreeView.expand_all()
            if "    " in oclDeviceQueueExecutionDetailsLHS[i]:
                oclDeviceQueueExecutionDetailsLHS[
                    i] = oclDeviceQueueExecutionDetailsLHS[i].strip("  ")
                DeviceQueueExecution_store.append(iter, [
                    oclDeviceQueueExecutionDetailsLHS[i].strip('\n'),
                    oclDeviceQueueExecutionDetailsRHS[i].strip('\n'),
                    setBackgroundColor(i), fgcolor[i]
                ])
            else:
                if oclDeviceQueueExecutionDetailsLHS[
                        i] in oclDeviceQueueExecutionDetailsRHS[i]:
                    oclDeviceQueueExecutionDetailsRHS[
                        i] = oclDeviceQueueExecutionDetailsRHS[i][len(
                            oclDeviceQueueExecutionDetailsLHS[i]):].strip(' ')
                    iter = DeviceQueueExecution_store.append(
                        None, [
                            oclDeviceQueueExecutionDetailsLHS[i].strip('\n'),
                            oclDeviceQueueExecutionDetailsRHS[i].strip('\n'),
                            setBackgroundColor(i), fgcolor[i]
                        ])
                elif "Built-in" in oclDeviceQueueExecutionDetailsLHS[i]:
                    oclDeviceKernels = oclDeviceQueueExecutionDetailsRHS[
                        i].split(';')
                    iter = DeviceQueueExecution_store.append(
                        None, [
                            oclDeviceQueueExecutionDetailsLHS[i].strip('\n'),
                            str(len(oclDeviceKernels) - 1).strip('\n'),
                            setBackgroundColor(i), fgcolor[i]
                        ])
                    for j in range(len(oclDeviceKernels) - 1):
                        DeviceQueueExecutionTreeView.expand_all()
                        DeviceQueueExecution_store.append(
                            iter, [
                                oclDeviceKernels[j].strip('\n'), " ",
                                setBackgroundColor(j), '#fff'
                            ])
                else:
                    iter = DeviceQueueExecution_store.append(
                        None, [
                            oclDeviceQueueExecutionDetailsLHS[i].strip('\n'),
                            oclDeviceQueueExecutionDetailsRHS[i].strip('\n'),
                            setBackgroundColor(i), fgcolor[i]
                        ])
Example #9
0
    def getDeviceVectorDetails(value):

        value2 = platform_combo.get_active()

        oclPlatformslocal = []
        oclPlatformslocal = oclPlatformslocal + oclPlatforms
        oclPlatformslocal.append("BLANK")

        for i in range(len(oclPlatformslocal)):
            oclPlatformslocal[i] = [
                j.replace("(", "\(") for j in oclPlatformslocal[i]
            ]
            oclPlatformslocal[i] = [
                j.replace(")", "\)") for j in oclPlatformslocal[i]
            ]
            oclPlatformslocal[i] = ''.join(oclPlatformslocal[i])

        os.system(
            "cat /tmp/gpu-viewer/clinfo.txt | awk '/%s/&& ++n == 2,/%s/' | awk '/Device Name.*/&& ++n == %d,/Extensions.*/'| awk '/Preferred \/.*/{flag=1;print}/Address.*/{flag=0}flag' | uniq > /tmp/gpu-viewer/oclDeviceVectorDetails.txt"
            % (oclPlatformslocal[value2], oclPlatformslocal[value2 + 1],
               value + 1))
        os.system(
            "cat /tmp/gpu-viewer/oclDeviceVectorDetails.txt | awk '{gsub(/     .*/,'True');print}' > /tmp/gpu-viewer/oclDeviceVectorDetailsLHS.txt"
        )
        os.system(
            "cat /tmp/gpu-viewer/oclDeviceVectorDetails.txt | awk '{gsub(/.*          /,'True');print}' > /tmp/gpu-viewer/oclDeviceVectorDetailsRHS.txt"
        )

        oclDeviceVectorDetailsLHS = copyContentsFromFile(
            "/tmp/gpu-viewer/oclDeviceVectorDetailsLHS.txt")
        oclDeviceVectorDetailsRHS = copyContentsFromFile(
            "/tmp/gpu-viewer/oclDeviceVectorDetailsRHS.txt")

        oclDeviceVectorDetailsLHS = [
            i.strip('\n') for i in oclDeviceVectorDetailsLHS
        ]
        oclDeviceVectorDetailsRHS = [
            i.strip('\n') for i in oclDeviceVectorDetailsRHS
        ]
        DeviceVector_store.clear()
        DeviceVectorTreeview.set_model(DeviceVector_store)
        fgcolor = []

        for i in range(len(oclDeviceVectorDetailsRHS)):
            if "Yes" in oclDeviceVectorDetailsRHS[i]:
                fgcolor.append("GREEN")
            elif "No" in oclDeviceVectorDetailsRHS[
                    i] and "None" not in oclDeviceVectorDetailsRHS[i]:
                fgcolor.append("RED")
            else:
                fgcolor.append("BLACK")

        for i in range(len(oclDeviceVectorDetailsLHS)):
            DeviceVectorTreeview.expand_all()
            if "    " in oclDeviceVectorDetailsLHS[i]:
                DeviceVectorTreeview.expand_all()
                if "Correctly-rounded divide and sqrt operations" in oclDeviceVectorDetailsLHS[
                        i]:
                    oclDeviceVectorDetailsLHS[
                        i] = "    Correctly-rounded divide and sqrt operations"
                    oclDeviceVectorDetailsRHS[i] = oclDeviceVectorDetailsRHS[
                        i][len(oclDeviceVectorDetailsLHS[i]):].strip(' ')
                oclDeviceVectorDetailsLHS[i] = oclDeviceVectorDetailsLHS[
                    i].strip("  ")
                DeviceVector_store.append(iter, [
                    oclDeviceVectorDetailsLHS[i].strip('\n'),
                    oclDeviceVectorDetailsRHS[i],
                    setBackgroundColor(i), fgcolor[i]
                ])
            else:
                if oclDeviceVectorDetailsLHS[i] in oclDeviceVectorDetailsRHS[
                        i]:
                    oclDeviceVectorDetailsRHS[i] = oclDeviceVectorDetailsRHS[
                        i].strip(oclDeviceVectorDetailsLHS[i])
                iter = DeviceVector_store.append(None, [
                    oclDeviceVectorDetailsLHS[i].strip('\n'),
                    oclDeviceVectorDetailsRHS[i].strip('\n'),
                    setBackgroundColor(i), fgcolor[i]
                ])
Example #10
0
    def getDeviceDetails(value):

        value2 = platform_combo.get_active()

        oclPlatformslocal = []
        oclPlatformslocal = oclPlatformslocal + oclPlatforms
        oclPlatformslocal.append("BLANK")

        for i in range(len(oclPlatformslocal)):
            oclPlatformslocal[i] = [
                j.replace("(", "\(") for j in oclPlatformslocal[i]
            ]
            oclPlatformslocal[i] = [
                j.replace(")", "\)") for j in oclPlatformslocal[i]
            ]
            oclPlatformslocal[i] = ''.join(oclPlatformslocal[i])

        os.system(
            "cat /tmp/gpu-viewer/clinfo.txt | awk '/%s/&& ++n == 2,/%s*/' | awk '/Device Name.*/&& ++n == %d,/Preferred \/.*/' | grep -v Preferred | grep -v Available > /tmp/gpu-viewer/oclDeviceDetails.txt"
            % (oclPlatformslocal[value2], oclPlatformslocal[value2 + 1],
               value + 1))
        os.system(
            "cat /tmp/gpu-viewer/clinfo.txt |  awk '/%s/&& ++n == 2,/%s/' | awk '/Device Name.*/&& ++n == %d,/Extensions.*/'| awk '/Extensions|Available/' >> /tmp/gpu-viewer/oclDeviceDetails.txt"
            % (oclPlatformslocal[value2], oclPlatformslocal[value2 + 1],
               value + 1))
        os.system(
            "cat /tmp/gpu-viewer/oclDeviceDetails.txt | awk '{gsub(/     .*/,'True');print}' > /tmp/gpu-viewer/oclDeviceDetailsLHS.txt"
        )
        os.system(
            "cat /tmp/gpu-viewer/oclDeviceDetails.txt | awk '{gsub(/^ .*        /,'True');print}' > /tmp/gpu-viewer/oclDeviceDetailsRHS.txt"
        )

        oclDeviceDetailsLHS = copyContentsFromFile(
            "/tmp/gpu-viewer/oclDeviceDetailsLHS.txt")
        oclDeviceDetailsRHS = copyContentsFromFile(
            "/tmp/gpu-viewer/oclDeviceDetailsRHS.txt")

        DeviceDetails_Store.clear()
        DeviceDetailsTreeView.set_model(DeviceDetails_Store)
        fgcolor = []

        for i in range(len(oclDeviceDetailsRHS)):
            if "Yes" in oclDeviceDetailsRHS[i]:
                fgcolor.append("GREEN")
            elif "No" in oclDeviceDetailsRHS[
                    i] and "None" not in oclDeviceDetailsRHS[i]:
                fgcolor.append("RED")
            else:
                fgcolor.append("BLACK")

        for i in range(len(oclDeviceDetailsLHS)):
            DeviceDetailsTreeView.expand_all()
            if "    " in oclDeviceDetailsLHS[i]:
                oclDeviceDetailsLHS[i] = oclDeviceDetailsLHS[i].strip("  ")
                DeviceDetails_Store.append(iter, [
                    oclDeviceDetailsLHS[i].strip('\n'),
                    oclDeviceDetailsRHS[i].strip('\n'),
                    setBackgroundColor(i), fgcolor[i]
                ])
            else:
                if "Number of devices" in oclDeviceDetailsLHS[i]:
                    oclDeviceDetailsLHS[i] = "  Number of devices"
                    oclDeviceDetailsRHS[i] = oclDeviceDetailsRHS[i][
                        len(oclDeviceDetailsLHS[i]):].strip(' ')
                if "Extensions" in oclDeviceDetailsLHS[i]:
                    oclDeviceExtenstions = oclDeviceDetailsRHS[i].split(' ')
                    iter = DeviceDetails_Store.append(None, [
                        oclDeviceDetailsLHS[i].strip('\n'),
                        str(len(oclDeviceExtenstions)).strip('\n'),
                        setBackgroundColor(i), fgcolor[i]
                    ])
                    for j in range(len(oclDeviceExtenstions)):
                        DeviceDetailsTreeView.expand_all()
                        DeviceDetails_Store.append(iter, [
                            oclDeviceExtenstions[j].strip('\n'), " ",
                            setBackgroundColor(j), '#fff'
                        ])
                else:
                    iter = DeviceDetails_Store.append(None, [
                        oclDeviceDetailsLHS[i].strip('\n'),
                        oclDeviceDetailsRHS[i].strip('\n'),
                        setBackgroundColor(i), fgcolor[i]
                    ])
Example #11
0
def OpenGL(tab1):
    grid = Gtk.Grid()
    grid.set_row_spacing(10)
    grid.set_column_spacing(10)
    tab1.add(grid)
    grid4 = Gtk.Grid()
    #    grid4.set_row_spacing(5)
    frame1 = Gtk.Frame(label="", expand=True)
    grid.attach(frame1, 0, 0, 12, 1)
    frame1.add(grid4)
    OpenGLInfo_list = Gtk.ListStore(str, str, str)
    os.system("glxinfo -s > /tmp/gpu-viewer/glxinfo.txt")
    os.system(
        "cat /tmp/gpu-viewer/glxinfo.txt | grep string | grep -v glx > /tmp/gpu-viewer/OpenGL_Information.txt"
    )
    os.system(
        "es2_info | awk '/EGL_VERSION|VENDOR/' >> /tmp/gpu-viewer/OpenGL_Information.txt"
    )
    os.system(
        "cat /tmp/gpu-viewer/OpenGL_Information.txt | grep -o :.* | grep -o ' .*' > /tmp/gpu-viewer/OpenGLRHS.txt"
    )
    os.system(
        "cat /tmp/gpu-viewer/glxinfo.txt | grep memory: | grep -o :.* | grep -o ' .*' >> /tmp/gpu-viewer/OpenGLRHS.txt"
    )
    os.system(
        "cat /tmp/gpu-viewer/OpenGL_Information.txt | awk '{gsub(/string|:.*/,'True');print}' > /tmp/gpu-viewer/OpenGLLHS.txt"
    )
    os.system(
        "cat /tmp/gpu-viewer/glxinfo.txt | grep memory: | awk '{gsub(/:.*/,'True');print}' >> /tmp/gpu-viewer/OpenGLLHS.txt"
    )
    value = copyContentsFromFile("/tmp/gpu-viewer/OpenGLRHS.txt")

    with open("/tmp/gpu-viewer/OpenGLLHS.txt", "r") as file1:
        for i, line in enumerate(file1):
            text = line.strip(" ")
            background_color = setBackgroundColor(i)
            OpenGLInfo_list.append(
                [text.strip('\n'), value[i].strip('\n'), background_color])

    TreeGL = Gtk.TreeView(OpenGLInfo_list, expand=True)
    # TreeGL.set_enable_search(True)
    setColumns(TreeGL, Title2, Const.MWIDTH, 0.0)

    scrollable_treelist = createScrollbar(TreeGL)
    grid4.add(scrollable_treelist)

    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()

    def showLimits(Combo, Limits_Store, TreeLimits, openGLLimits):
        k = 0
        count = 0
        limitValue = Combo.get_active_text()
        if "Show All OpenGL Hardware Core Limits" in limitValue or "Show All OpenGL Hardware Compatible Limits" in limitValue:
            os.system("cat %s > /tmp/gpu-viewer/selectOpenglLimits.txt" %
                      openGLLimits)

            os.system(
                "cat /tmp/gpu-viewer/selectOpenglLimits.txt | awk '{gsub(/=.*/,'True');print}' > /tmp/gpu-viewer/OpenGLLimitsLHS.txt"
            )
            os.system(
                "cat /tmp/gpu-viewer/selectOpenglLimits.txt | grep -o =.* | grep -o ' .*' > /tmp/gpu-viewer/OpenGLLimitsRHS.txt"
            )

        else:
            with open(openGLLimits, "r") as file1:
                for line in file1:
                    if limitValue in line:
                        os.system(
                            "cat %s | awk '/%s:/{flag=1;next}/:.*/{flag=0}flag' > /tmp/gpu-viewer/selectOpenglLimits.txt"
                            % (openGLLimits, limitValue))
                        os.system(
                            "cat /tmp/gpu-viewer/selectOpenglLimits.txt | awk '{gsub(/=.*/,'True');print}' > /tmp/gpu-viewer/OpenGLLimitsLHS.txt"
                        )
                        os.system(
                            "cat /tmp/gpu-viewer/selectOpenglLimits.txt | grep -o =.* | grep -o ' .*' > /tmp/gpu-viewer/OpenGLLimitsRHS.txt"
                        )

        with open("/tmp/gpu-viewer/OpenGLLimitsLHS.txt", "r") as file1:
            temp = copyContentsFromFile("/tmp/gpu-viewer/OpenGLLimitsRHS.txt")
            LimitsRHS, LimitRHSValue = appendLimitsRHS(
                "/tmp/gpu-viewer/selectOpenglLimits.txt", temp)

            Limits_Store.clear()
            TreeLimits.set_model(Limits_Store)
            for i, line in enumerate(file1):
                background_color = setBackgroundColor(k)
                k += 1
                TreeLimits.expand_all()
                text = line.strip(' ')
                if ("TEXTURE_FORMATS" in line or "SHADING_LANGUAGE"
                        in line) and LimitRHSValue[i] == True:
                    try:
                        iter3 = Limits_Store.append(iter2, [
                            text.strip('\n'), LimitsRHS[i].strip('\n'),
                            background_color
                        ])
                    except Exception:
                        iter3 = Limits_Store.append(None, [
                            text.strip('\n'), LimitsRHS[i].strip('\n'),
                            background_color
                        ])
                    finally:
                        pass
                elif "      " in line and LimitRHSValue[
                        i] == False and ":" not in line:
                    Limits_Store.append(iter3, [
                        text.strip('\n'), LimitsRHS[i].strip('\n'),
                        background_color
                    ])
                else:
                    if ":" in line:
                        k = 0
                        text = line[:-2]
                        count += 1
                        iter2 = Limits_Store.append(None, [
                            text.strip('\n'), LimitsRHS[i].strip('\n'),
                            Const.BGCOLOR3
                        ])
                        continue
                    if count > 0 and "    " in line:
                        Limits_Store.append(iter2, [
                            text.strip('\n'), LimitsRHS[i].strip('\n'),
                            background_color
                        ])
                    else:
                        Limits_Store.append(None, [
                            text.strip('\n'), LimitsRHS[i].strip('\n'),
                            background_color
                        ])

#  LimitsFrame = Gtk.Frame()
#  grid.attach(LimitsFrame, 0, 1, 2, 1)

    Button_Limits = Gtk.Button("Show OpenGL Limits")
    Button_Limits.connect("clicked", clickme)
    grid.attach(Button_Limits, 0, 1, 2, 1)
    #  LimitsFrame.add(Button_Limits)
    # grid4.attach(Button_Limits, 0, 1, 2, 1)

    # vendorFrame = Gtk.Frame()
    # grid.attach_next_to(vendorFrame,LimitsFrame,Gtk.PositionType.RIGHT,1,1)

    #  FBFrame = Gtk.Frame()
    Button_FB = Gtk.Button.new_with_label(
        "Show GLX Frame Buffer Configuration")
    Button_FB.connect("clicked", FrameBuffer)
    #  FBFrame.add(Button_FB)

    with open("/tmp/gpu-viewer/OpenGLRHS.txt", "r") as file1:
        for line in file1:
            if "Intel" in line:
                vendorImg = fetchImageFromUrl(Const.INTEL_LOGO_PNG,
                                              Const.ICON_WIDTH,
                                              Const.ICON_HEIGHT, True)
                grid.attach_next_to(Gtk.Image.new_from_pixbuf(vendorImg),
                                    Button_Limits, Gtk.PositionType.RIGHT, 1,
                                    1)
                break
            elif "NVIDIA" in line:
                vendorImg = fetchImageFromUrl(Const.GTX_LOGO_PNG,
                                              Const.ICON_WIDTH,
                                              Const.ICON_HEIGHT, True)
                grid.attach_next_to(Gtk.Image.new_from_pixbuf(vendorImg),
                                    Button_Limits, Gtk.PositionType.RIGHT, 1,
                                    1)
                break
            elif "AMD" in line or "ATI" in line:
                vendorImg = fetchImageFromUrl(Const.AMD_LOGO_PNG,
                                              Const.ICON_WIDTH,
                                              Const.ICON_HEIGHT, True)
                grid.attach_next_to(Gtk.Image.new_from_pixbuf(vendorImg),
                                    Button_Limits, Gtk.PositionType.RIGHT, 1,
                                    1)
                break

        # vendorFrame.add(Gtk.Image.new_from_pixbuf(vendorImg))
        grid.attach(Button_FB, 3, 1, 2, 1)

    # End of Frame 1
    OpenGLExt_list = Gtk.ListStore(str, str)
    OpenGLExt_list_filter = OpenGLExt_list.filter_new()
    TreeGLExt = Gtk.TreeView(OpenGLExt_list_filter, expand=True)
    TreeGLExt.set_headers_visible(False)
    frame4 = Gtk.Frame(label=" ")

    def radcall2(button):
        value = button.get_active()

        GL_All = []

        List = copyContentsFromFile("/tmp/gpu-viewer/Vendor1.txt")

        List = [i.strip(' ') for i in List]
        List = [i.strip('\n ') for i in List]
        List.insert(0, " ALL")

        with open("/tmp/gpu-viewer/extensions.txt", "r") as file1:
            for line in file1:
                if List[int(value)] == " ALL":
                    GL_All.append(line)
                elif List[int(value)] != " ALL":
                    if "_%s_" % List[int(value)] in line:
                        GL_All.append(line)

        OpenGLExt_list.clear()
        TreeGLExt.set_model(OpenGLExt_list_filter)

        for i in range(len(List)):
            if int(value) == i:
                frame4.set_label(List[i])

        count = len(GL_All)
        for i in range(count):
            background_color = setBackgroundColor(i)
            text = GL_All[i].strip(' ')
            OpenGLExt_list.append([text.strip('\n'), background_color])

    VendorExt_list = Gtk.ListStore(str, bool, str)
    TreeVendor = Gtk.TreeView(VendorExt_list, expand=True)

    Vendor_Store = Gtk.ListStore(str)
    Vendor_Combo = Gtk.ComboBox.new_with_model(Vendor_Store)

    def Radio(value):

        if 1 <= value <= 2:
            os.system(
                "cat /tmp/gpu-viewer/extensions.txt | awk 'gsub(/GL_|_.*/,'true')'| uniq > /tmp/gpu-viewer/Vendor.txt"
            )
            os.system(
                "cat /tmp/gpu-viewer/extensions.txt | awk 'gsub(/GLX_|_.*/,'true')'| uniq >> /tmp/gpu-viewer/Vendor.txt"
            )
            os.system(
                "cat /tmp/gpu-viewer/Vendor.txt | sort | uniq | grep -v GLX | grep -v GL$  > /tmp/gpu-viewer/Vendor1.txt"
            )

        if value == 3:
            os.system(
                "cat /tmp/gpu-viewer/extensions.txt | awk 'gsub(/EGL_|_.*/,'true')'| sort | uniq > /tmp/gpu-viewer/Vendor1.txt"
            )

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

        vendorList = [i.strip(' ') for i in vendorList]
        vendorList = [i.strip('\n ') for i in vendorList]
        vendorList.insert(0, "Total")

        with open("/tmp/gpu-viewer/extensions.txt", "r") as file1:
            for i in range(len(vendorList)):
                file1.seek(0, 0)
                GL_All = []
                for line in file1:
                    if vendorList[i] == "Total":
                        GL_All.append(line)
                    elif vendorList[i] != "Total":
                        if "_%s_" % vendorList[i] in line:
                            GL_All.append(line)
                vCount.append(len(GL_All))

        NewList = []
        for i in range(len(vendorList)):
            NewList.append("%s (%d)" % (vendorList[i], vCount[i]))

        VendorExt_list.clear()
        TreeVendor.set_model(VendorExt_list)
        Toggle = []
        for i in range(len(NewList) - 1):
            Toggle.append(False)
        Vendor_Store.clear()
        Vendor_Combo.set_model(Vendor_Store)
        Toggle.insert(True, 0)
        for i in range(len(NewList)):
            background_color = setBackgroundColor(i)
            VendorExt_list.append([NewList[i], Toggle[i], background_color])
            Vendor_Store.append([NewList[i]])

    def radcall(button, value):
        if value == 1:
            try:
                switch.set_active(True)
                switch.set_sensitive(True)
            except:
                pass
            os.system(
                "cat /tmp/gpu-viewer/glxinfo.txt | awk '/OpenGL extensions/{flag=1;next}/OpenGL ES profile/{flag=0} flag' | grep GL_ | sort > /tmp/gpu-viewer/extensions.txt"
            )
            os.system(
                "cat /tmp/gpu-viewer/glxinfo.txt  | awk '/client glx extensions/{flag=1; next}/GLX version/{flag=0} flag' | grep GLX_ | sort >> /tmp/gpu-viewer/extensions.txt"
            )

        elif value == 2:
            switch.set_active(True)
            switch.set_sensitive(False)
            os.system(
                "cat /tmp/gpu-viewer/glxinfo.txt  | awk '/OpenGL ES profile/{flag=1;next}/80 GLX Visuals/{flag=0} flag' | grep GL_ | sort > /tmp/gpu-viewer/extensions.txt"
            )

        elif value == 3:
            switch.set_active(True)
            switch.set_sensitive(False)
            os.system(
                "es2_info | awk '/EGL_EXTENSIONS.*/{flag=1;next}/EGL_CLIENT.*/{flag=0}flag'| awk '{n=split($0,a,/,/);{for (i=1;i<=n;i++) print a[i]}}' | grep -o EGL.* > /tmp/gpu-viewer/extensions.txt"
            )

        Radio(value)
        Vendor_Combo.set_active(0)

    frame2 = Gtk.Frame(label="Extensions\t")
    grid.attach(frame2, 0, 2, 12, 1)
    grid1 = Gtk.Grid()
    #grid1.set_row_spacing(5)
    grid1.set_border_width(5)
    frame2.add(grid1)

    OpenGLRad = Gtk.RadioButton()
    RadioImg1 = fetchImageFromUrl(Const.OPEN_GL_PNG, 90, 70, True)
    OpenGLRad.set_image(Gtk.Image.new_from_pixbuf(RadioImg1))
    OpenGLRad.connect("clicked", radcall, 1)
    grid1.add(OpenGLRad)
    OpenGLRadES = Gtk.RadioButton.new_from_widget(OpenGLRad)
    RadioImg2 = fetchImageFromUrl(Const.OPEN_GL_ES_PNG, 100, 70, True)
    OpenGLRadES.set_image(Gtk.Image.new_from_pixbuf(RadioImg2))
    OpenGLRadES.connect("clicked", radcall, 2)
    eglRad = Gtk.RadioButton.new_from_widget(OpenGLRadES)
    eglRad.connect("clicked", radcall, 3)
    RadioImg3 = fetchImageFromUrl(Const.EGL_PNG, 70, 70, True)
    eglRad.set_image(Gtk.Image.new_from_pixbuf(RadioImg3))
    with open("/tmp/gpu-viewer/OpenGLLHS.txt", "r") as file1:
        for line in file1:
            if "OpenGL ES" in line:
                grid1.attach_next_to(OpenGLRadES, OpenGLRad,
                                     Gtk.PositionType.RIGHT, 1, 1)
                continue
            elif "EGL_VERSION" in line:
                grid1.attach_next_to(eglRad, OpenGLRadES,
                                     Gtk.PositionType.RIGHT, 1, 1)
                break
            else:
                OpenGLRadES.set_visible(False)
                eglRad.set_visible(False)

    OpenGLRad.set_active(False)

    # OpenGLRadES.set_active(True)
    # os.system("rm /tmp/gpu-viewer/OpenGL*.txt")
    # End of Frame 2 and grid 1
    # Start of Frame 3

    def searchTree(model, iter, data=None):
        search_query = entry.get_text().lower()
        for i in range(TreeGLExt.get_n_columns()):
            value = model.get_value(iter, i).lower()
            if search_query in value:
                return True

    def switchCall(self, value):
        if switch.get_active():
            os.system(
                "cat /tmp/gpu-viewer/glxinfo.txt | awk '/OpenGL extensions/{flag=1;next}/OpenGL ES profile/{flag=0} flag' | grep GL_ | sort > /tmp/gpu-viewer/extensions.txt"
            )
            os.system(
                "cat /tmp/gpu-viewer/glxinfo.txt  | awk '/client glx extensions/{flag=1; next}/GLX version/{flag=0} flag' | grep GLX_ | sort >> /tmp/gpu-viewer/extensions.txt"
            )
        else:
            os.system(
                "cat /tmp/gpu-viewer/glxinfo.txt | awk '/OpenGL core profile extensions:/{flag=1;next}/OpenGL version*/{flag=0} flag' | grep GL_ | sort > /tmp/gpu-viewer/extensions.txt"
            )
            os.system(
                "cat /tmp/gpu-viewer/glxinfo.txt  | awk '/client glx extensions/{flag=1; next}/GLX version/{flag=0} flag' | grep GLX_ | sort >> /tmp/gpu-viewer/extensions.txt"
            )
        Radio(1)
        Vendor_Combo.set_active(0)

    Vendor_Combo = Gtk.ComboBox.new_with_model(Vendor_Store)
    Vendor_Combo.connect("changed", radcall2)
    Vendor_renderer = Gtk.CellRendererText()
    Vendor_Combo.pack_start(Vendor_renderer, True)
    Vendor_Combo.add_attribute(Vendor_renderer, "text", 0)
    # Vendor_Combo.set_entry_text_column(0)
    Vendor_Combo.set_active(0)
    grid1.attach_next_to(Vendor_Combo, OpenGLRad, Gtk.PositionType.BOTTOM, 1,
                         1)

    switch = Gtk.Switch()
    switch.connect("notify::active", switchCall)
    switch.set_active(True)

    coreLabel = Gtk.Label("Core")
    comptLabel = Gtk.Label("\t\tCompat.")

    grid1.attach_next_to(coreLabel, Vendor_Combo, Gtk.PositionType.RIGHT, 1, 1)

    grid1.attach_next_to(switch, coreLabel, Gtk.PositionType.RIGHT, 1, 1)
    grid1.attach_next_to(comptLabel, switch, Gtk.PositionType.RIGHT, 4, 1)
    TreeGLExt.set_enable_search(True)
    TreeGLExt.set_headers_visible(True)
    setColumns(TreeGLExt, Title1, Const.MWIDTH, 0.0)

    grid.attach(frame4, 0, 3, 12, 1)
    grid3 = Gtk.Grid()
    #grid3.set_row_spacing(2)
    frame4.add(grid3)
    frameSearch = Gtk.Frame()
    entry = Gtk.SearchEntry()
    entry.set_placeholder_text("Type here to filter extensions.....")
    entry.connect("search-changed", refresh_filter, OpenGLExt_list_filter)
    entry.grab_focus()
    frameSearch.add(entry)
    scrollable_treelist2 = createScrollbar(TreeGLExt)
    grid3.attach(frameSearch, 0, 0, 1, 1)
    grid3.attach_next_to(scrollable_treelist2, frameSearch,
                         Gtk.PositionType.BOTTOM, 1, 1)

    OpenGLExt_list_filter.set_visible_func(searchTree)

    tab1.show_all()