mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-31 11:28:31 +00:00
gstreamer-encoder: Add SPICE_ENCODE_GPU to select gpu for encoding using va
Add the ability for multi gpu systems to set the gpu used for encoding while using the va encoder.
This commit is contained in:
parent
4cf369f5f2
commit
e77845e5c5
@ -968,11 +968,29 @@ static bool gst_features_lookup(const gchar *feature_name)
|
||||
return true;
|
||||
}
|
||||
|
||||
static const gchar *get_encode_gpu(){
|
||||
|
||||
const gchar* env_encode_gpu_str = g_getenv("SPICE_ENCODE_GPU");
|
||||
if ((!env_encode_gpu_str) || (strcmp(env_encode_gpu_str, "renderD128") == 0)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_autoptr(GRegex) regex = g_regex_new("renderD1[[:digit:]]{2}", 0, 0, NULL);
|
||||
if (g_regex_match(regex, env_encode_gpu_str, 0, NULL)) {
|
||||
return env_encode_gpu_str;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gchar *find_best_hw_plugin(const gchar *codec_name)
|
||||
{
|
||||
static const char plugins[][16] = {"va","msdk", "vaapi"};
|
||||
char plugins[][16] = {"va","msdk", "vaapi"};
|
||||
gchar *feature_name;
|
||||
int i;
|
||||
const gchar *encode_gpu = get_encode_gpu();
|
||||
if (encode_gpu) {
|
||||
g_strlcat(plugins[0], encode_gpu, sizeof(plugins[0]));
|
||||
}
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS(plugins); i++) {
|
||||
feature_name = !codec_name ? g_strconcat(plugins[i], "postproc", NULL) :
|
||||
@ -2123,7 +2141,7 @@ VideoEncoder *gstreamer_encoder_new(SpiceVideoCodecType codec_type,
|
||||
pthread_mutex_init(&encoder->outbuf_mutex, NULL);
|
||||
pthread_cond_init(&encoder->outbuf_cond, NULL);
|
||||
encoder->scaling = 1;
|
||||
printf("Trying Codec: %s", get_gst_codec_name(encoder));
|
||||
printf("Trying Codec: %s \n", get_gst_codec_name(encoder));
|
||||
/* All the other fields are initialized to zero by g_new0(). */
|
||||
|
||||
if (!create_pipeline(encoder)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user