mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
nvdecoder: Enable zero-copy only if explicitly enabled
Keep pre-1.24 behavior unless user specifies the number of output surface size. We are calculating output surface size conservatively, and it can result in over allocation. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6102>
This commit is contained in:
parent
59358e439d
commit
cfa8386dd0
7 changed files with 43 additions and 39 deletions
|
@ -225402,12 +225402,12 @@
|
||||||
"writable": true
|
"writable": true
|
||||||
},
|
},
|
||||||
"num-output-surfaces": {
|
"num-output-surfaces": {
|
||||||
"blurb": "Maximum number of output surfaces simultaneously mapped in CUDA output mode (0 = auto)",
|
"blurb": "Maximum number of output surfaces simultaneously mapped in CUDA output mode (0 = auto, 1 = always copy)",
|
||||||
"conditionally-available": false,
|
"conditionally-available": false,
|
||||||
"construct": false,
|
"construct": false,
|
||||||
"construct-only": false,
|
"construct-only": false,
|
||||||
"controllable": false,
|
"controllable": false,
|
||||||
"default": "0",
|
"default": "1",
|
||||||
"max": "64",
|
"max": "64",
|
||||||
"min": "0",
|
"min": "0",
|
||||||
"mutable": "ready",
|
"mutable": "ready",
|
||||||
|
@ -227333,12 +227333,12 @@
|
||||||
"writable": true
|
"writable": true
|
||||||
},
|
},
|
||||||
"num-output-surfaces": {
|
"num-output-surfaces": {
|
||||||
"blurb": "Maximum number of output surfaces simultaneously mapped in CUDA output mode (0 = auto)",
|
"blurb": "Maximum number of output surfaces simultaneously mapped in CUDA output mode (0 = auto, 1 = always copy)",
|
||||||
"conditionally-available": false,
|
"conditionally-available": false,
|
||||||
"construct": false,
|
"construct": false,
|
||||||
"construct-only": false,
|
"construct-only": false,
|
||||||
"controllable": false,
|
"controllable": false,
|
||||||
"default": "0",
|
"default": "1",
|
||||||
"max": "64",
|
"max": "64",
|
||||||
"min": "0",
|
"min": "0",
|
||||||
"mutable": "ready",
|
"mutable": "ready",
|
||||||
|
@ -227555,12 +227555,12 @@
|
||||||
"writable": true
|
"writable": true
|
||||||
},
|
},
|
||||||
"num-output-surfaces": {
|
"num-output-surfaces": {
|
||||||
"blurb": "Maximum number of output surfaces simultaneously mapped in CUDA output mode (0 = auto)",
|
"blurb": "Maximum number of output surfaces simultaneously mapped in CUDA output mode (0 = auto, 1 = always copy)",
|
||||||
"conditionally-available": false,
|
"conditionally-available": false,
|
||||||
"construct": false,
|
"construct": false,
|
||||||
"construct-only": false,
|
"construct-only": false,
|
||||||
"controllable": false,
|
"controllable": false,
|
||||||
"default": "0",
|
"default": "1",
|
||||||
"max": "64",
|
"max": "64",
|
||||||
"min": "0",
|
"min": "0",
|
||||||
"mutable": "ready",
|
"mutable": "ready",
|
||||||
|
@ -227944,12 +227944,12 @@
|
||||||
"writable": true
|
"writable": true
|
||||||
},
|
},
|
||||||
"num-output-surfaces": {
|
"num-output-surfaces": {
|
||||||
"blurb": "Maximum number of output surfaces simultaneously mapped in CUDA output mode (0 = auto)",
|
"blurb": "Maximum number of output surfaces simultaneously mapped in CUDA output mode (0 = auto, 1 = always copy)",
|
||||||
"conditionally-available": false,
|
"conditionally-available": false,
|
||||||
"construct": false,
|
"construct": false,
|
||||||
"construct-only": false,
|
"construct-only": false,
|
||||||
"controllable": false,
|
"controllable": false,
|
||||||
"default": "0",
|
"default": "1",
|
||||||
"max": "64",
|
"max": "64",
|
||||||
"min": "0",
|
"min": "0",
|
||||||
"mutable": "ready",
|
"mutable": "ready",
|
||||||
|
@ -228043,12 +228043,12 @@
|
||||||
"writable": true
|
"writable": true
|
||||||
},
|
},
|
||||||
"num-output-surfaces": {
|
"num-output-surfaces": {
|
||||||
"blurb": "Maximum number of output surfaces simultaneously mapped in CUDA output mode (0 = auto)",
|
"blurb": "Maximum number of output surfaces simultaneously mapped in CUDA output mode (0 = auto, 1 = always copy)",
|
||||||
"conditionally-available": false,
|
"conditionally-available": false,
|
||||||
"construct": false,
|
"construct": false,
|
||||||
"construct-only": false,
|
"construct-only": false,
|
||||||
"controllable": false,
|
"controllable": false,
|
||||||
"default": "0",
|
"default": "1",
|
||||||
"max": "64",
|
"max": "64",
|
||||||
"min": "0",
|
"min": "0",
|
||||||
"mutable": "ready",
|
"mutable": "ready",
|
||||||
|
|
|
@ -94,7 +94,7 @@ enum
|
||||||
PROP_MAX_DISPLAY_DELAY,
|
PROP_MAX_DISPLAY_DELAY,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_NUM_OUTPUT_SURFACES 0
|
#define DEFAULT_NUM_OUTPUT_SURFACES 1
|
||||||
#define DEFAULT_MAX_DISPLAY_DELAY -1
|
#define DEFAULT_MAX_DISPLAY_DELAY -1
|
||||||
|
|
||||||
static GTypeClass *parent_class = nullptr;
|
static GTypeClass *parent_class = nullptr;
|
||||||
|
@ -162,16 +162,17 @@ gst_nv_av1_dec_class_init (GstNvAV1DecClass * klass,
|
||||||
/**
|
/**
|
||||||
* GstNvAV1Dec:num-output-surfaces:
|
* GstNvAV1Dec:num-output-surfaces:
|
||||||
*
|
*
|
||||||
* The number of output surfaces (0 = auto). This property will be used to
|
* The number of output surfaces (0 = auto, 1 = always copy).
|
||||||
* calculate the CUVIDDECODECREATEINFO.ulNumOutputSurfaces parameter
|
* This property will be used to calculate
|
||||||
* in case of CUDA output mode
|
* the CUVIDDECODECREATEINFO.ulNumOutputSurfaces parameter in case of
|
||||||
|
* CUDA output mode.
|
||||||
*
|
*
|
||||||
* Since: 1.24
|
* Since: 1.24
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (object_class, PROP_NUM_OUTPUT_SURFACES,
|
g_object_class_install_property (object_class, PROP_NUM_OUTPUT_SURFACES,
|
||||||
g_param_spec_uint ("num-output-surfaces", "Num Output Surfaces",
|
g_param_spec_uint ("num-output-surfaces", "Num Output Surfaces",
|
||||||
"Maximum number of output surfaces simultaneously mapped in CUDA "
|
"Maximum number of output surfaces simultaneously mapped in CUDA "
|
||||||
"output mode (0 = auto)",
|
"output mode (0 = auto, 1 = always copy)",
|
||||||
0, 64, DEFAULT_NUM_OUTPUT_SURFACES,
|
0, 64, DEFAULT_NUM_OUTPUT_SURFACES,
|
||||||
(GParamFlags) (GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
|
(GParamFlags) (GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
|
||||||
G_PARAM_STATIC_STRINGS)));
|
G_PARAM_STATIC_STRINGS)));
|
||||||
|
|
|
@ -411,9 +411,8 @@ gst_nv_decoder_new_picture (GstNvDecoder * decoder, GstCodecPicture * picture)
|
||||||
|
|
||||||
if (!decoder->object) {
|
if (!decoder->object) {
|
||||||
if (decoder->output_type == GST_NV_DECODER_OUTPUT_TYPE_CUDA) {
|
if (decoder->output_type == GST_NV_DECODER_OUTPUT_TYPE_CUDA) {
|
||||||
if (decoder->num_output_surfaces == 0 ||
|
if (decoder->num_output_surfaces == 0) {
|
||||||
decoder->num_output_surfaces < decoder->downstream_min_buffers) {
|
/* Auto mode */
|
||||||
/* Auto mode or user specified num-output-surfaces value is too small */
|
|
||||||
decoder->create_info.ulNumOutputSurfaces =
|
decoder->create_info.ulNumOutputSurfaces =
|
||||||
decoder->downstream_min_buffers + 2;
|
decoder->downstream_min_buffers + 2;
|
||||||
} else {
|
} else {
|
||||||
|
@ -877,7 +876,7 @@ gst_nv_decoder_output_picture (GstNvDecoder * decoder,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (videodec->input_segment.rate > 0 &&
|
if (decoder->num_output_surfaces != 1 && videodec->input_segment.rate > 0 &&
|
||||||
decoder->output_type == GST_NV_DECODER_OUTPUT_TYPE_CUDA &&
|
decoder->output_type == GST_NV_DECODER_OUTPUT_TYPE_CUDA &&
|
||||||
(guint) decoder->create_info.ulNumOutputSurfaces >=
|
(guint) decoder->create_info.ulNumOutputSurfaces >=
|
||||||
decoder->downstream_min_buffers) {
|
decoder->downstream_min_buffers) {
|
||||||
|
|
|
@ -150,7 +150,7 @@ enum
|
||||||
PROP_MAX_DISPLAY_DELAY,
|
PROP_MAX_DISPLAY_DELAY,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_NUM_OUTPUT_SURFACES 0
|
#define DEFAULT_NUM_OUTPUT_SURFACES 1
|
||||||
#define DEFAULT_MAX_DISPLAY_DELAY -1
|
#define DEFAULT_MAX_DISPLAY_DELAY -1
|
||||||
|
|
||||||
static GTypeClass *parent_class = nullptr;
|
static GTypeClass *parent_class = nullptr;
|
||||||
|
@ -229,16 +229,17 @@ gst_nv_h264_dec_class_init (GstNvH264DecClass * klass,
|
||||||
/**
|
/**
|
||||||
* GstNvH264Dec:num-output-surfaces:
|
* GstNvH264Dec:num-output-surfaces:
|
||||||
*
|
*
|
||||||
* The number of output surfaces (0 = auto). This property will be used to
|
* The number of output surfaces (0 = auto, 1 = always copy).
|
||||||
* calculate the CUVIDDECODECREATEINFO.ulNumOutputSurfaces parameter
|
* This property will be used to calculate
|
||||||
* in case of CUDA output mode
|
* the CUVIDDECODECREATEINFO.ulNumOutputSurfaces parameter in case of
|
||||||
|
* CUDA output mode.
|
||||||
*
|
*
|
||||||
* Since: 1.24
|
* Since: 1.24
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (object_class, PROP_NUM_OUTPUT_SURFACES,
|
g_object_class_install_property (object_class, PROP_NUM_OUTPUT_SURFACES,
|
||||||
g_param_spec_uint ("num-output-surfaces", "Num Output Surfaces",
|
g_param_spec_uint ("num-output-surfaces", "Num Output Surfaces",
|
||||||
"Maximum number of output surfaces simultaneously mapped in CUDA "
|
"Maximum number of output surfaces simultaneously mapped in CUDA "
|
||||||
"output mode (0 = auto)",
|
"output mode (0 = auto, 1 = always copy)",
|
||||||
0, 64, DEFAULT_NUM_OUTPUT_SURFACES,
|
0, 64, DEFAULT_NUM_OUTPUT_SURFACES,
|
||||||
(GParamFlags) (GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
|
(GParamFlags) (GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
|
||||||
G_PARAM_STATIC_STRINGS)));
|
G_PARAM_STATIC_STRINGS)));
|
||||||
|
|
|
@ -149,7 +149,7 @@ enum
|
||||||
PROP_MAX_DISPLAY_DELAY,
|
PROP_MAX_DISPLAY_DELAY,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_NUM_OUTPUT_SURFACES 0
|
#define DEFAULT_NUM_OUTPUT_SURFACES 1
|
||||||
#define DEFAULT_MAX_DISPLAY_DELAY -1
|
#define DEFAULT_MAX_DISPLAY_DELAY -1
|
||||||
|
|
||||||
static GTypeClass *parent_class = nullptr;
|
static GTypeClass *parent_class = nullptr;
|
||||||
|
@ -225,16 +225,17 @@ gst_nv_h265_dec_class_init (GstNvH265DecClass * klass,
|
||||||
/**
|
/**
|
||||||
* GstNvH265Dec:num-output-surfaces:
|
* GstNvH265Dec:num-output-surfaces:
|
||||||
*
|
*
|
||||||
* The number of output surfaces (0 = auto). This property will be used to
|
* The number of output surfaces (0 = auto, 1 = always copy).
|
||||||
* calculate the CUVIDDECODECREATEINFO.ulNumOutputSurfaces parameter
|
* This property will be used to calculate
|
||||||
* in case of CUDA output mode
|
* the CUVIDDECODECREATEINFO.ulNumOutputSurfaces parameter in case of
|
||||||
|
* CUDA output mode.
|
||||||
*
|
*
|
||||||
* Since: 1.24
|
* Since: 1.24
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (object_class, PROP_NUM_OUTPUT_SURFACES,
|
g_object_class_install_property (object_class, PROP_NUM_OUTPUT_SURFACES,
|
||||||
g_param_spec_uint ("num-output-surfaces", "Num Output Surfaces",
|
g_param_spec_uint ("num-output-surfaces", "Num Output Surfaces",
|
||||||
"Maximum number of output surfaces simultaneously mapped in CUDA "
|
"Maximum number of output surfaces simultaneously mapped in CUDA "
|
||||||
"output mode (0 = auto)",
|
"output mode (0 = auto, 1 = always copy)",
|
||||||
0, 64, DEFAULT_NUM_OUTPUT_SURFACES,
|
0, 64, DEFAULT_NUM_OUTPUT_SURFACES,
|
||||||
(GParamFlags) (GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
|
(GParamFlags) (GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
|
||||||
G_PARAM_STATIC_STRINGS)));
|
G_PARAM_STATIC_STRINGS)));
|
||||||
|
|
|
@ -78,7 +78,7 @@ enum
|
||||||
PROP_MAX_DISPLAY_DELAY,
|
PROP_MAX_DISPLAY_DELAY,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_NUM_OUTPUT_SURFACES 0
|
#define DEFAULT_NUM_OUTPUT_SURFACES 1
|
||||||
#define DEFAULT_MAX_DISPLAY_DELAY -1
|
#define DEFAULT_MAX_DISPLAY_DELAY -1
|
||||||
|
|
||||||
static GTypeClass *parent_class = nullptr;
|
static GTypeClass *parent_class = nullptr;
|
||||||
|
@ -148,16 +148,17 @@ gst_nv_vp8_dec_class_init (GstNvVp8DecClass * klass,
|
||||||
/**
|
/**
|
||||||
* GstNvVp8Dec:num-output-surfaces:
|
* GstNvVp8Dec:num-output-surfaces:
|
||||||
*
|
*
|
||||||
* The number of output surfaces (0 = auto). This property will be used to
|
* The number of output surfaces (0 = auto, 1 = always copy).
|
||||||
* calculate the CUVIDDECODECREATEINFO.ulNumOutputSurfaces parameter
|
* This property will be used to calculate
|
||||||
* in case of CUDA output mode
|
* the CUVIDDECODECREATEINFO.ulNumOutputSurfaces parameter in case of
|
||||||
|
* CUDA output mode.
|
||||||
*
|
*
|
||||||
* Since: 1.24
|
* Since: 1.24
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (object_class, PROP_NUM_OUTPUT_SURFACES,
|
g_object_class_install_property (object_class, PROP_NUM_OUTPUT_SURFACES,
|
||||||
g_param_spec_uint ("num-output-surfaces", "Num Output Surfaces",
|
g_param_spec_uint ("num-output-surfaces", "Num Output Surfaces",
|
||||||
"Maximum number of output surfaces simultaneously mapped in CUDA "
|
"Maximum number of output surfaces simultaneously mapped in CUDA "
|
||||||
"output mode (0 = auto)",
|
"output mode (0 = auto, 1 = always copy)",
|
||||||
0, 64, DEFAULT_NUM_OUTPUT_SURFACES,
|
0, 64, DEFAULT_NUM_OUTPUT_SURFACES,
|
||||||
(GParamFlags) (GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
|
(GParamFlags) (GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
|
||||||
G_PARAM_STATIC_STRINGS)));
|
G_PARAM_STATIC_STRINGS)));
|
||||||
|
|
|
@ -79,7 +79,7 @@ enum
|
||||||
PROP_MAX_DISPLAY_DELAY,
|
PROP_MAX_DISPLAY_DELAY,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_NUM_OUTPUT_SURFACES 0
|
#define DEFAULT_NUM_OUTPUT_SURFACES 1
|
||||||
#define DEFAULT_MAX_DISPLAY_DELAY -1
|
#define DEFAULT_MAX_DISPLAY_DELAY -1
|
||||||
|
|
||||||
static GTypeClass *parent_class = nullptr;
|
static GTypeClass *parent_class = nullptr;
|
||||||
|
@ -151,16 +151,17 @@ gst_nv_vp9_dec_class_init (GstNvVp9DecClass * klass,
|
||||||
/**
|
/**
|
||||||
* GstNvVp9Dec:num-output-surfaces:
|
* GstNvVp9Dec:num-output-surfaces:
|
||||||
*
|
*
|
||||||
* The number of output surfaces (0 = auto). This property will be used to
|
* The number of output surfaces (0 = auto, 1 = always copy).
|
||||||
* calculate the CUVIDDECODECREATEINFO.ulNumOutputSurfaces parameter
|
* This property will be used to calculate
|
||||||
* in case of CUDA output mode
|
* the CUVIDDECODECREATEINFO.ulNumOutputSurfaces parameter in case of
|
||||||
|
* CUDA output mode.
|
||||||
*
|
*
|
||||||
* Since: 1.24
|
* Since: 1.24
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (object_class, PROP_NUM_OUTPUT_SURFACES,
|
g_object_class_install_property (object_class, PROP_NUM_OUTPUT_SURFACES,
|
||||||
g_param_spec_uint ("num-output-surfaces", "Num Output Surfaces",
|
g_param_spec_uint ("num-output-surfaces", "Num Output Surfaces",
|
||||||
"Maximum number of output surfaces simultaneously mapped in CUDA "
|
"Maximum number of output surfaces simultaneously mapped in CUDA "
|
||||||
"output mode (0 = auto)",
|
"output mode (0 = auto, 1 = always copy)",
|
||||||
0, 64, DEFAULT_NUM_OUTPUT_SURFACES,
|
0, 64, DEFAULT_NUM_OUTPUT_SURFACES,
|
||||||
(GParamFlags) (GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
|
(GParamFlags) (GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
|
||||||
G_PARAM_STATIC_STRINGS)));
|
G_PARAM_STATIC_STRINGS)));
|
||||||
|
|
Loading…
Reference in a new issue