-
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support assign linux dedicated gpu
- Loading branch information
Showing
26 changed files
with
341 additions
and
420 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { app as elec } from 'electron' | ||
import { LauncherAppPlugin } from '~/app' | ||
import { LaunchService } from '~/launch' | ||
import { kSettings } from '~/settings' | ||
|
||
export const pluginNvdiaGPULinux: LauncherAppPlugin = async (app) => { | ||
app.registry.get(LaunchService).then((servi) => { | ||
servi.registerMiddleware({ | ||
name: 'nvidia-gpu-linux', | ||
async onBeforeLaunch(input, output) { | ||
if (app.platform.os !== 'linux') return | ||
const settings = await app.registry.get(kSettings) | ||
if (settings.linuxEnableDedicatedGPUOptimization) { | ||
const env = output.extraExecOption?.env || {} | ||
const info = (await elec.getGPUInfo('basic')) as any | ||
const gpus = | ||
info?.gpuDevice | ||
?.filter((v: any) => v?.vendorId !== 5140) | ||
.map((v: any) => v.vendorId) || [] | ||
if (gpus.some((g: string) => g?.toLowerCase().includes('nvidia'))) { | ||
env.__NV_PRIME_RENDER_OFFLOAD = '1' | ||
env.__GLX_VENDOR_LIBRARY_NAME = 'nvidia' | ||
output.extraExecOption = { ...output.extraExecOption, env } | ||
} | ||
} | ||
}, | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<template> | ||
<div | ||
class="v-heading w-full" | ||
> | ||
<h3 class="text-h5 my-4"> | ||
<slot /> | ||
</h3> | ||
<v-divider /> | ||
</div> | ||
</template> | ||
<style scoped> | ||
.v-heading { | ||
display: inline-block; | ||
top: 0; | ||
padding: 0 16px; | ||
z-index: 3; | ||
} | ||
.text-h5 { | ||
font-size: 1.4rem !important; | ||
font-weight: 400; | ||
line-height: 1.8rem; | ||
letter-spacing: normal !important; | ||
font-family: "Roboto", sans-serif; | ||
text-transform: none !important; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<template> | ||
<v-list-item @click="emit('input', !value)"> | ||
<v-list-item-action class="self-center"> | ||
<v-checkbox | ||
v-model="model" | ||
hide-details | ||
@click.stop | ||
/> | ||
</v-list-item-action> | ||
<v-list-item-content> | ||
<v-list-item-title> | ||
{{ title }} | ||
</v-list-item-title> | ||
<v-list-item-subtitle v-if="description"> | ||
{{ description }} | ||
</v-list-item-subtitle> | ||
</v-list-item-content> | ||
</v-list-item> | ||
</template> | ||
<script setup lang="ts"> | ||
import { useVModel } from '@vueuse/core' | ||
const props = defineProps<{ | ||
value: boolean | ||
title: string | ||
description?: string | ||
}>() | ||
const emit = defineEmits<{ | ||
(event: 'input', value: boolean): void | ||
}>() | ||
const model = useVModel(props, 'value', emit) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<template> | ||
<v-list-item> | ||
<v-list-item-content> | ||
<v-list-item-title> | ||
<slot | ||
v-if="slots.title" | ||
name="title" | ||
/> | ||
<template v-else> | ||
{{ title }} | ||
</template> | ||
</v-list-item-title> | ||
<v-list-item-subtitle> | ||
{{ description }} | ||
</v-list-item-subtitle> | ||
</v-list-item-content> | ||
<v-list-item-action> | ||
<v-select | ||
v-model="model" | ||
filled | ||
style="max-width: 185px" | ||
hide-details | ||
:items="items" | ||
/> | ||
</v-list-item-action> | ||
</v-list-item> | ||
</template> | ||
<script setup lang="ts"> | ||
import { useVModel } from '@vueuse/core' | ||
const props = defineProps<{ | ||
title: string | ||
description?: string | ||
select: string | ||
items: Array<{ text: string; value: string }> | ||
}>() | ||
const emit = defineEmits<{ | ||
(event: 'update:select', value: string): void | ||
}>() | ||
const slots = useSlots() | ||
const model = useVModel(props, 'select', emit) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.