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()
def openCL(tab): 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 def selectDevice(combo): value = combo.get_active() getDeviceDetails(value) getDeviceMemoryImageDetails(value) getDeviceVectorDetails(value) getDeviceQueueExecutionCapabilities(value) def getDeviceNames(value): 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/PlatnDev.txt | awk '/%s.*/{flag=1;next}/Platform.*/{flag=0}flag'| grep -o :.* | grep -o ' .*' | awk /./ > /tmp/gpu-viewer/oclDeviceNames.txt" % oclPlatformslocal[value]) Devices_store.clear() Devices_combo.set_model(Devices_store) oclDeviceNames = copyContentsFromFile( "/tmp/gpu-viewer/oclDeviceNames.txt") oclDeviceNames = [i.strip(' ') for i in oclDeviceNames] oclDeviceNames = [i.strip('\n') for i in oclDeviceNames] numberOfDevicesEntry.set_text(str(len(oclDeviceNames))) numberOfDevicesEntry.set_editable(False) for i in oclDeviceNames: Devices_store.append([i]) Devices_combo.set_active(0) def getPlatfromDetails(value): 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 '/Number of platforms.*/{flag=1;next}/Number of devices/{flag=0}flag' | awk '/%s/{flag=1;next}/Platform Name/{flag=0}flag' | awk /./> /tmp/gpu-viewer/oclPlatformDetails.txt" % oclPlatformslocal[value]) os.system( "cat /tmp/gpu-viewer/oclPlatformDetails.txt | grep -o Platform.* | awk '{gsub(/ .*/,'True');print}' > /tmp/gpu-viewer/oclPlatformDetailsLHS.txt" ) os.system( "cat /tmp/gpu-viewer/oclPlatformDetails.txt | grep -o Platform.* | awk '{gsub(/Platform.* /,'True');print}' > /tmp/gpu-viewer/oclPlatformDetailsRHS.txt" ) oclPlatformDetailsLHS = copyContentsFromFile( "/tmp/gpu-viewer/oclPlatformDetailsLHS.txt") oclPlatformDetailsRHS = copyContentsFromFile( '/tmp/gpu-viewer/oclPlatformDetailsRHS.txt') platformDetails_Store.clear() platformDetailsTreeView.set_model(platformDetails_Store) for i in range(len(oclPlatformDetailsLHS)): platformDetailsTreeView.expand_all() background_color = setBackgroundColor(i) if "Extensions" in oclPlatformDetailsLHS[ i] and "suffix" not in oclPlatformDetailsLHS[i]: oclPlatformExtensions = oclPlatformDetailsRHS[i].split(' ') iter = platformDetails_Store.append(None, [ oclPlatformDetailsLHS[i].strip('\n'), str(len(oclPlatformExtensions)), background_color ]) for j in range(len(oclPlatformExtensions)): background_color = setBackgroundColor(j) platformDetails_Store.append(iter, [ oclPlatformExtensions[j].strip('\n'), " ", background_color ]) else: platformDetails_Store.append(None, [ oclPlatformDetailsLHS[i].strip('\n'), oclPlatformDetailsRHS[i].strip('\n'), background_color ]) 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] ]) def getDeviceMemoryImageDetails(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 '/Address.*/{flag=1;print}/Queue.*/{flag=0}flag' | uniq > /tmp/gpu-viewer/oclDeviceMemoryImageDetails.txt" % (oclPlatformslocal[value2], oclPlatformslocal[value2 + 1], value + 1)) os.system( "cat /tmp/gpu-viewer/oclDeviceMemoryImageDetails.txt | awk '{gsub(/ .*/,'True');print}' > /tmp/gpu-viewer/oclDeviceMemoryImageDetailsLHS.txt" ) os.system( "cat /tmp/gpu-viewer/oclDeviceMemoryImageDetails.txt | awk '{gsub(/^ .* /,'True');print}' > /tmp/gpu-viewer/oclDeviceMemoryImageDetailsRHS.txt" ) oclDeviceMemoryImageDetailsLHS = copyContentsFromFile( "/tmp/gpu-viewer/oclDeviceMemoryImageDetailsLHS.txt") oclDeviceMemoryImageDetailsRHS = copyContentsFromFile( "/tmp/gpu-viewer/oclDeviceMemoryImageDetailsRHS.txt") oclDeviceMemoryImageDetailsLHS = [ i.strip('\n') for i in oclDeviceMemoryImageDetailsLHS ] oclDeviceMemoryImageDetailsRHS = [ i.strip('\n') for i in oclDeviceMemoryImageDetailsRHS ] DeviceMemoryImage_store.clear() DeviceMemoryImageTreeview.set_model(DeviceMemoryImage_store) fgcolor = [] for i in range(len(oclDeviceMemoryImageDetailsRHS)): if "Yes" in oclDeviceMemoryImageDetailsRHS[i]: fgcolor.append("GREEN") elif "No" in oclDeviceMemoryImageDetailsRHS[ i] and "None" not in oclDeviceMemoryImageDetailsRHS[i]: fgcolor.append("RED") else: fgcolor.append("BLACK") for i in range(len(oclDeviceMemoryImageDetailsLHS)): DeviceMemoryImageTreeview.expand_all() if " " in oclDeviceMemoryImageDetailsLHS[i]: if "Base address alignment for 2D image buffers" in oclDeviceMemoryImageDetailsLHS[ i]: oclDeviceMemoryImageDetailsLHS[ i] = " Base address alignment for 2D image buffers" oclDeviceMemoryImageDetailsRHS[ i] = oclDeviceMemoryImageDetailsRHS[i][ len(oclDeviceMemoryImageDetailsLHS[i]):].strip(' ') DeviceMemoryImageTreeview.expand_all() oclDeviceMemoryImageDetailsLHS[ i] = oclDeviceMemoryImageDetailsLHS[i].strip(" ") DeviceMemoryImage_store.append(iter, [ oclDeviceMemoryImageDetailsLHS[i].strip('\n'), oclDeviceMemoryImageDetailsRHS[i].strip('\n'), setBackgroundColor(i), fgcolor[i] ]) else: if oclDeviceMemoryImageDetailsLHS[ i] in oclDeviceMemoryImageDetailsRHS[i]: oclDeviceMemoryImageDetailsRHS[ i] = oclDeviceMemoryImageDetailsRHS[i][ len(oclDeviceMemoryImageDetailsLHS[i]):].strip(' ') iter = DeviceMemoryImage_store.append( None, [ oclDeviceMemoryImageDetailsLHS[i].strip('\n'), oclDeviceMemoryImageDetailsRHS[i].strip('\n'), setBackgroundColor(i), fgcolor[i] ]) elif "Built-in" in oclDeviceMemoryImageDetailsLHS[i]: oclDeviceKernels = oclDeviceMemoryImageDetailsRHS[i].split( ';') iter = DeviceMemoryImage_store.append( None, [ oclDeviceMemoryImageDetailsLHS[i].strip('\n'), str(len(oclDeviceKernels) - 1).strip('\n'), setBackgroundColor(i), fgcolor[i] ]) for j in range(len(oclDeviceKernels) - 1): DeviceMemoryImageTreeview.expand_all() DeviceMemoryImage_store.append(iter, [ oclDeviceKernels[j].strip('\n'), " ", setBackgroundColor(j), '#fff' ]) else: iter = DeviceMemoryImage_store.append( None, [ oclDeviceMemoryImageDetailsLHS[i].strip('\n'), oclDeviceMemoryImageDetailsRHS[i].strip('\n'), setBackgroundColor(i), fgcolor[i] ]) 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] ]) 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] ]) def selectPlatform(combo): value = combo.get_active() getDeviceNames(value) getPlatfromDetails(value) # os.system("rm /tmp/gpu-viewer/ocl*.txt") mainGrid = Gtk.Grid() tab.add(mainGrid) oclNotebook = Gtk.Notebook() mainGrid.attach(oclNotebook, 0, 2, 1, 1) platformDetailsTab = Gtk.Box(spacing=10) platformDetailsGrid = createSubTab(platformDetailsTab, oclNotebook, "Platform Details") platformDetails_Store = Gtk.TreeStore(str, str, str) platformDetailsTreeView = Gtk.TreeView(model=platformDetails_Store, expand=True) platformDetailsTreeView.set_property("enable-tree-lines", True) setColumns(platformDetailsTreeView, platformDetailsHeader, Const.MWIDTH, 0.0) platformScrollbar = createScrollbar(platformDetailsTreeView) platformDetailsGrid.add(platformScrollbar) DeviceDetailsTab = Gtk.Box(spacing=10) DeviceDetailsGrid = createSubTab(DeviceDetailsTab, oclNotebook, "Device Details") DeviceDetails_Store = Gtk.TreeStore(str, str, str, str) DeviceDetailsTreeView = Gtk.TreeView(model=DeviceDetails_Store, expand=True) DeviceDetailsTreeView.set_property("enable-tree-lines", True) setOclColumns(DeviceDetailsTreeView, deviceDetailsHeader) DeviceDetailsScrollbar = createScrollbar(DeviceDetailsTreeView) DeviceDetailsGrid.add(DeviceDetailsScrollbar) # Device Memory Details ... DeviceMemoryImageTab = Gtk.Box(spacing=10) DeviceMemoryImageGrid = createSubTab(DeviceMemoryImageTab, oclNotebook, "Device Memory & Image Details") DeviceMemoryImage_store = Gtk.TreeStore(str, str, str, str) DeviceMemoryImageTreeview = Gtk.TreeView(model=DeviceMemoryImage_store, expand=True) DeviceMemoryImageTreeview.set_property("enable-tree-lines", True) setOclColumns(DeviceMemoryImageTreeview, deviceMemoryImageHeader) DeviceMemoryImageScrollbar = createScrollbar(DeviceMemoryImageTreeview) DeviceMemoryImageGrid.add(DeviceMemoryImageScrollbar) # Device Queue & Execution capabilities DeviceQueueExecutionTab = Gtk.Box(spacing=10) DeviceQueueExecutionGrid = createSubTab( DeviceQueueExecutionTab, oclNotebook, "Device Queue & Execution Capabilities") DeviceQueueExecution_store = Gtk.TreeStore(str, str, str, str) DeviceQueueExecutionTreeView = Gtk.TreeView( model=DeviceQueueExecution_store, expand=True) DeviceQueueExecutionTreeView.set_property("enable-tree-lines", True) setOclColumns(DeviceQueueExecutionTreeView, deviceMemoryImageHeader) DeviceQueueExecutionScrollbar = createScrollbar( DeviceQueueExecutionTreeView) DeviceQueueExecutionGrid.add(DeviceQueueExecutionScrollbar) # Device Vector Details DeviceVectorTab = Gtk.Box(spacing=10) DeviceVectorGrid = createSubTab(DeviceVectorTab, oclNotebook, "Device Vector Details") DeviceVector_store = Gtk.TreeStore(str, str, str, str) DeviceVectorTreeview = Gtk.TreeView(model=DeviceVector_store, expand=True) DeviceVectorTreeview.set_property("enable-tree-lines", True) setOclColumns(DeviceVectorTreeview, deviceMemoryImageHeader) DeviceVectorScrollbar = createScrollbar(DeviceVectorTreeview) DeviceVectorGrid.add(DeviceVectorScrollbar) # The Platform Drop Down platformGrid = Gtk.Grid() platformGrid.set_border_width(20) platformGrid.set_column_spacing(20) platformGrid.set_row_spacing(10) # mainGrid.set_row_spacing(10) platformFrame = Gtk.Frame(hexpand=True) mainGrid.add(platformFrame) platformFrame.add(platformGrid) platformLabel = Gtk.Label() platformLabel.set_text("Platform Name :") platformGrid.attach(platformLabel, 0, 1, 1, 1) platform_store = Gtk.ListStore(str) oclPlatforms = getPlatformNames() AvailableDevices = Gtk.Label() AvailableDevices.set_label("Available Device(s) :") platformGrid.attach_next_to(AvailableDevices, platformLabel, Gtk.PositionType.BOTTOM, 2, 1) Devices_store = Gtk.ListStore(str) Devices_combo = Gtk.ComboBox.new_with_model(Devices_store) Devices_combo.connect("changed", selectDevice) Devices_renderer = Gtk.CellRendererText(font="BOLD") Devices_combo.pack_start(Devices_renderer, True) Devices_combo.add_attribute(Devices_renderer, "text", 0) platformGrid.attach_next_to(Devices_combo, AvailableDevices, Gtk.PositionType.RIGHT, 20, 1) numberOfDevicesEntry = Gtk.Entry() for i in oclPlatforms: platform_store.append([i]) platform_combo = Gtk.ComboBox.new_with_model(platform_store) platform_combo.connect("changed", selectPlatform) platform_renderer = Gtk.CellRendererText(font="BOLD") platform_combo.pack_start(platform_renderer, True) platform_combo.add_attribute(platform_renderer, "text", 0) platform_combo.set_active(0) platformGrid.attach_next_to(platform_combo, platformLabel, Gtk.PositionType.RIGHT, 21, 1) numberOfPlatforms = Gtk.Label() numberOfPlatforms.set_label("No. of Platforms :") platformGrid.attach_next_to(numberOfPlatforms, platform_combo, Gtk.PositionType.RIGHT, 10, 1) numberOfPlatformsEntry = Gtk.Entry() numberOfPlatformsEntry.set_text(str(len(oclPlatforms))) numberOfPlatformsEntry.set_editable(False) platformGrid.attach_next_to(numberOfPlatformsEntry, numberOfPlatforms, Gtk.PositionType.RIGHT, 1, 1) numberOfDevices = Gtk.Label() numberOfDevices.set_label("No. Of Devices :") platformGrid.attach_next_to(numberOfDevices, Devices_combo, Gtk.PositionType.RIGHT, 10, 1) numberOfDevicesEntry.set_max_length(2) platformGrid.attach_next_to(numberOfDevicesEntry, numberOfDevices, Gtk.PositionType.RIGHT, 1, 1) tab.show_all()
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()
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 vdpauinfo(tab2): def vdpauInformation(): os.system( "cat /tmp/gpu-viewer/vdpauinfo.txt | grep -E 'API|string' > /tmp/gpu-viewer/vdpauInformation.txt" ) with open("/tmp/gpu-viewer/vdpauInformation.txt", "r") as file: for i, line in enumerate(file): vdpauinfoStore.append(None, [ ' '.join(line.split()[0:2]).strip('[]'), ' '.join( line.split()[2:]).strip('[]'), setBackgroundColor(i) ]) iter = vdpauinfoStore.append( None, ["Supported Codecs:", ' ', Const.BGCOLOR3]) with open("/tmp/gpu-viewer/vdpauDecoder.txt", "r") as file1: i = 1 for line in file1: if "not" not in line: vdpauinfoStore.append(iter, [ "", line.split()[0].strip('\n'), setBackgroundColor(i) ]) i = i + 1 treeVdpauInfo.expand_all() def decoderCapabilities(): os.system( "cat /tmp/gpu-viewer/vdpauinfo.txt | awk '/Decoder capabilities:/{flag=1;next}/Output surface:/{flag=0}flag' | awk '/------.*/{flag=1;next}/Output surface:/{flag=0}flag' | awk '/./'> /tmp/gpu-viewer/vdpauDecoder.txt" ) with open("/tmp/gpu-viewer/vdpauDecoder.txt", "r") as file1: for i, line in enumerate(file1): if "not" in line: decoderStore.append([ line.split()[0].strip('\n'), "not supported", "not supported", "not supported", "not supported", setBackgroundColor(i) ]) else: decoderStore.append([ line.split()[0].strip('\n'), line.split()[1].strip('\n'), line.split()[2].strip('\n'), line.split()[3].strip('\n'), line.split()[4].strip('\n'), setBackgroundColor(i) ]) def videoSurfaceLimits(): os.system( "cat /tmp/gpu-viewer/vdpauinfo.txt | awk '/Video surface:/{flag=1;next}/Decoder capabilities:/{flag=0}flag' | awk '/-------.*/{flag=1;next}/Bitmap surface:/{flag=0}flag' | awk '/./' > /tmp/gpu-viewer/vdpauVideoSurfaceLimits.txt" ) iter = surfaceVideoStore.append( None, ["Video Surface", "", "", "", Const.BGCOLOR3]) with open("/tmp/gpu-viewer/vdpauVideoSurfaceLimits.txt", "r") as file1: for i, line in enumerate(file1): surfaceVideoStore.append(iter, [ line.split()[0].strip('\n'), line.split()[1].strip('\n'), line.split()[2].strip('\n'), (' '.join(line.split()[3:]).strip('[]')), setBackgroundColor(i) ]) os.system( "cat /tmp/gpu-viewer/vdpauinfo.txt | awk '/Output surface:/{flag=1;next}/Bitmap surface:/{flag=0}flag' | awk '/-------.*/{flag=1;next}/Bitmap surface:/{flag=0}flag' | awk '/./' > /tmp/gpu-viewer/vdpauSurfaceOutputLimits.txt" ) iter = surfaceVideoStore.append( None, ["Output Surface", "", "", "", Const.BGCOLOR3]) with open("/tmp/gpu-viewer/vdpauSurfaceOutputLimits.txt", "r") as file: for i, line in enumerate(file): surfaceVideoStore.append(iter, [ line.split()[0].strip('\n'), line.split()[1].strip('\n'), line.split()[2], (' '.join(line.split()[4:]).strip('[]')), setBackgroundColor(i) ]) os.system( "cat /tmp/gpu-viewer/vdpauinfo.txt | awk '/Bitmap surface:/{flag=1;next}/Video mixer:/{flag=0}flag' | awk '/-------.*/{flag=1;next}/Video mixer:/{flag=0}flag' | awk '/./' > /tmp/gpu-viewer/vdpauSurfaceBitmapLimits.txt" ) iter = surfaceVideoStore.append( None, ["Bitmap Surface", "", "", "", Const.BGCOLOR3]) with open("/tmp/gpu-viewer/vdpauSurfaceBitmapLimits.txt", "r") as file: for i, line in enumerate(file): surfaceVideoStore.append(iter, [ line.split()[0].strip('\n'), line.split()[1].strip('\n'), line.split()[2].strip('\n'), "", setBackgroundColor(i) ]) treeSurfaceVideoLimits.expand_all() def VideoMixerFeature(): os.system( "cat /tmp/gpu-viewer/vdpauinfo.txt | awk '/feature name/{flag=1;next}/parameter name.*/{flag=0}flag' | awk '/-------.*/{flag=1;next}/Output surface:/{flag=0}flag' | awk '/./' > /tmp/gpu-viewer/vdpauVideoMixerFeature.txt" ) iter = videoMixerFeatureStore.append( None, ["Features", "", Const.BGCOLOR3, ""]) with open("/tmp/gpu-viewer/vdpauVideoMixerFeature.txt", "r") as file2: for i, line in enumerate(file2): if 'y' in line: text = "true" fgcolor = Const.COLOR1 else: text = "false" fgcolor = Const.COLOR2 if "HIGH" in line: videoMixerFeatureStore.append( iter, [(' '.join(line.split()[0:5])).strip('[]'), text, setBackgroundColor(i), fgcolor]) else: videoMixerFeatureStore.append(iter, [ line.split()[0].strip('\n'), text, setBackgroundColor(i), fgcolor ]) os.system( "cat /tmp/gpu-viewer/vdpauinfo.txt | awk '/parameter name/{flag=1;next}/attribute name.*/{flag=0}flag' | awk '/-------.*/{flag=1;next}/Output surface:/{flag=0}flag' | awk '/./' > /tmp/gpu-viewer/vdpauVideoMixerParameter.txt" ) iter = videoMixerFeatureStore.append( None, ["Parameters", "", Const.BGCOLOR3, ""]) with open("/tmp/gpu-viewer/vdpauVideoMixerParameter.txt", "r") as file2: for i, line in enumerate(file2): if line.split()[1].strip('\n') == 'y': text = "true" fgcolor = Const.COLOR1 else: text = "false" fgcolor = Const.COLOR2 videoMixerFeatureStore.append(iter, [ line.split()[0].strip('\n'), text, setBackgroundColor(i), fgcolor ]) os.system( "cat /tmp/gpu-viewer/vdpauinfo.txt | awk '/Video mixer:/{flag=1;next}/Output surface:/{flag=0}flag' | awk '/attribute name/{flag=1;next}/Output surface:/{flag=0}flag' | awk '/-------.*/{flag=1;next}/Output surface:/{flag=0}flag' | awk '/./' > /tmp/gpu-viewer/vdpauVideoMixerAttribute.txt" ) iter = videoMixerFeatureStore.append( None, ["Attributes", "", Const.BGCOLOR3, ""]) with open("/tmp/gpu-viewer/vdpauVideoMixerAttribute.txt", "r") as file2: for i, line in enumerate(file2): if line.split()[1].strip('\n') == 'y': text = "true" fgcolor = Const.COLOR1 else: text = "false" fgcolor = Const.COLOR2 videoMixerFeatureStore.append(iter, [ line.split()[0].strip('\n'), text, setBackgroundColor(i), fgcolor ]) treeVideoMixerFeature.expand_all() grid = Gtk.Grid() tab2.add(grid) DevicesFrame = Gtk.Frame() grid.add(DevicesFrame) notebook = Gtk.Notebook() notebook.set_property("scrollable", True) notebook.set_property("enable-popup", True) grid.attach(notebook, 0, 2, 1, 1) # ------- VDPAU information ------------------------------- vdpauinfoTab = Gtk.Box(spacing=20) vdpauinfoGrid = createSubTab(vdpauinfoTab, notebook, "VDPAU Information") vdpauinfoStore = Gtk.TreeStore(str, str, str) treeVdpauInfo = Gtk.TreeView(vdpauinfoStore, expand=True) setColumns(treeVdpauInfo, vdpauinfoTitle, 300, 0.0) vdpauinfoScrollbar = createScrollbar(treeVdpauInfo) vdpauinfoGrid.add(vdpauinfoScrollbar) # ------- Decoder Capabilities ---------------------------- decoderTab = Gtk.Box(spacing=20) decoderGrid = createSubTab(decoderTab, notebook, "Decoder Capabilities") decoderStore = Gtk.ListStore(str, str, str, str, str, str) treeDecoder = Gtk.TreeView(decoderStore, expand=True) setColumns(treeDecoder, decoderTitle, 300, 0.0) decoderScrollbar = createScrollbar(treeDecoder) decoderGrid.add(decoderScrollbar) # -------- Surface Limits ----------------------------------- surfaceTab = Gtk.Box(spacing=20) surfaceGrid = createSubTab(surfaceTab, notebook, "Surface Limits") surfaceVideoStore = Gtk.TreeStore(str, str, str, str, str) treeSurfaceVideoLimits = Gtk.TreeView(surfaceVideoStore, expand=True) treeSurfaceVideoLimits.set_property("enable-tree-lines", True) setColumns(treeSurfaceVideoLimits, surfaceVideoTitle, 300, 0.0) surfaceVideoScrollbar = createScrollbar(treeSurfaceVideoLimits) surfaceGrid.add(surfaceVideoScrollbar) # -------- Video Mixer --------------------------------------- videoMixerTab = Gtk.Box(spacing=20) videoMixerGrid = createSubTab(videoMixerTab, notebook, "Video Mixer") videoMixerGrid.set_row_spacing(20) videoMixerFeatureStore = Gtk.TreeStore(str, str, str, str) treeVideoMixerFeature = Gtk.TreeView(videoMixerFeatureStore, expand=True) treeVideoMixerFeature.set_property("enable-tree-lines", True) treeVideoMixerFeature.set_enable_search(True) for i, column_title in enumerate(videoMixerFeatureTitle): videoMixerrenderer = Gtk.CellRendererText() # Queuerenderer.set_alignment(0.5, 0.5) column = Gtk.TreeViewColumn(column_title, videoMixerrenderer, text=i) # column.set_alignment(0.5) column.add_attribute(videoMixerrenderer, "background", 2) column.set_sort_column_id(i) column.set_resizable(True) column.set_reorderable(True) if i > 0: column.add_attribute(videoMixerrenderer, "foreground", 3) treeVideoMixerFeature.set_property("can-focus", False) treeVideoMixerFeature.append_column(column) videoMixerFeatureScrollbar = createScrollbar(treeVideoMixerFeature) videoMixerGrid.add(videoMixerFeatureScrollbar) decoderCapabilities() videoSurfaceLimits() VideoMixerFeature() vdpauInformation()