Skip to content

Commit

Permalink
Disables the checking function has_gpu_screen. The function did not f…
Browse files Browse the repository at this point in the history
…ulfill its purpose.

The tag 'name:NVIDIA-G' only appears in 'xrandr --listproviders', when on-demand has already been enabled.
If nvidia or intel are enabled, it does not appear.
As a consequence the option is only listed in the drop down menu, when it is active.
There was no chance to select it, if this was not the case.
Not sure whether there is another option to check, whether on-demand is actually supported by the running X-server.
Nevertheless, this implementation did not serve its purpose.
  • Loading branch information
marsch84 authored and flexiondotorg committed Apr 4, 2020
1 parent 5a36478 commit e9e8d1a
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions usr/bin/mate-optimus-applet
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,6 @@ def nvidia_detected(capability):
print(' - nvidia-detector: Skipped')
return True

def has_gpu_screen(capability):
if capability == 'on-demand':
providers = subprocess.Popen(['xrandr', '--listproviders'], stdout=PIPE, stderr=DEVNULL)
for line in providers.stdout.readlines():
text = line.rstrip().decode('utf-8')
if 'name:NVIDIA-G' in text:
print(' - xrandr: NVIDIA GPU screen detected.')
return True
print(' - xrandr: NVIDIA GPU screen not detected.')
return False
else:
print(' - xrandr: NVIDIA GPU screen check skipped.')
return True

def gpu_loaded(gpu):
# Does prime-switch report that the GPU is available?
if gpu == 'intel' or gpu == 'amdgpu' or gpu == 'radeon':
Expand Down Expand Up @@ -123,8 +109,7 @@ def check_capability(capability):
if gpu_loaded(capability) and \
prime_capable() and \
nvidia_detected(capability) and \
prime_select_features(capability) and \
has_gpu_screen(capability):
prime_select_features(capability):
print(' - ' + capability + ': is supported')
return True
else:
Expand Down

0 comments on commit e9e8d1a

Please sign in to comment.