File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -1284,13 +1284,21 @@ get_gpu() {
12841284 {if(!seen[a[i]]++) print a[i]}}' ) )
12851285 IFS=" $old_ifs "
12861286
1287- # Number the GPUs if more than one exists.
1288- (( ${# gpus[@]} > 1 )) && gpu_num=1
1287+ # Remove duplicate Intel Graphics outputs.
1288+ # This fixes cases where the outputs are both
1289+ # Intel but not entirely identical.
1290+ #
1291+ # Checking the first two array elements should
1292+ # be safe since there won't be 2 intel outputs if
1293+ # there's a dedicated GPU in play.
1294+ [[ " ${gpus[0]} " == * Intel* && \
1295+ " ${gpus[1]} " == * Intel* ]] && \
1296+ unset -v " gpus[0]"
12891297
12901298 for gpu in " ${gpus[@]} " ; do
12911299 # GPU shorthand tests.
1292- [[ " $gpu_type " == " dedicated" && " $gpu " =~ (i | I)ntel ]] || \
1293- [[ " $gpu_type " == " integrated" && ! " $gpu " =~ (i | I)ntel ]] && \
1300+ [[ " $gpu_type " == " dedicated" && " $gpu " == * Intel * ]] || \
1301+ [[ " $gpu_type " == " integrated" && ! " $gpu " == * Intel * ]] && \
12941302 { unset -v gpu; continue ; }
12951303
12961304 case " $gpu " in
@@ -1336,7 +1344,6 @@ get_gpu() {
13361344 fi
13371345
13381346 prin " ${subtitle: +${subtitle}${gpu_name} } " " $gpu "
1339- (( ++ gpu_num))
13401347 done
13411348
13421349 return
You can’t perform that action at this time.
0 commit comments