Skip to content

Commit

Permalink
#1260: stub implementation - builds against nvenc7
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@13060 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jul 21, 2016
1 parent 89ca631 commit 8c95f14
Show file tree
Hide file tree
Showing 5 changed files with 2,589 additions and 8 deletions.
13 changes: 10 additions & 3 deletions src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def is_msvc():
nvenc4_sdk = WIN32_BUILD_LIB_PREFIX + "nvenc_4.0.0_sdk"
nvenc5_sdk = WIN32_BUILD_LIB_PREFIX + "nvenc_5.0.1_sdk"
nvenc6_sdk = WIN32_BUILD_LIB_PREFIX + "nvidia_video_sdk_6.0.1"
nvenc7_sdk = WIN32_BUILD_LIB_PREFIX + "Video_Codec_SDK_7.0.1"
nvapi_path = WIN32_BUILD_LIB_PREFIX + "NVAPI"
try:
import pycuda
Expand All @@ -186,10 +187,12 @@ def is_msvc():
nvenc4_ENABLED = DEFAULT and pycuda and os.path.exists(nvenc4_sdk) and is_msvc()
nvenc5_ENABLED = DEFAULT and pycuda and os.path.exists(nvenc5_sdk) and is_msvc()
nvenc6_ENABLED = DEFAULT and pycuda and os.path.exists(nvenc6_sdk) and is_msvc()
nvenc7_ENABLED = DEFAULT and pycuda and os.path.exists(nvenc7_sdk) and is_msvc()
else:
nvenc4_ENABLED = DEFAULT and pkg_config_ok("--exists", "nvenc4")
nvenc5_ENABLED = DEFAULT and pkg_config_ok("--exists", "nvenc5")
nvenc6_ENABLED = DEFAULT and pkg_config_ok("--exists", "nvenc6")
nvenc7_ENABLED = DEFAULT and pkg_config_ok("--exists", "nvenc7")

memoryview_ENABLED = sys.version>='2.7'
csc_opencl_ENABLED = DEFAULT and pkg_config_ok("--exists", "OpenCL") and check_pyopencl_AMD()
Expand Down Expand Up @@ -1014,6 +1017,7 @@ def pkgconfig(*pkgs_options, **ekw):
"xpra/codecs/nvenc4/encoder.c",
"xpra/codecs/nvenc5/encoder.c",
"xpra/codecs/nvenc6/encoder.c",
"xpra/codecs/nvenc7/encoder.c",
"xpra/codecs/cuda_common/BGRA_to_NV12.fatbin",
"xpra/codecs/cuda_common/BGRA_to_U.fatbin",
"xpra/codecs/cuda_common/BGRA_to_V.fatbin",
Expand Down Expand Up @@ -2183,14 +2187,15 @@ def osx_pkgconfig(*pkgs_options, **ekw):
toggle_packages(nvenc4_ENABLED, "xpra.codecs.nvenc4")
toggle_packages(nvenc5_ENABLED, "xpra.codecs.nvenc5")
toggle_packages(nvenc6_ENABLED, "xpra.codecs.nvenc6")
toggle_packages(nvenc4_ENABLED or nvenc5_ENABLED or nvenc6_ENABLED, "xpra.codecs.cuda_common", "xpra.codecs.nv_util")
toggle_packages(nvenc7_ENABLED, "xpra.codecs.nvenc7")
toggle_packages(nvenc4_ENABLED or nvenc5_ENABLED or nvenc6_ENABLED or nvenc7_ENABLED, "xpra.codecs.cuda_common", "xpra.codecs.nv_util")
if (nvenc4_ENABLED or nvenc5_ENABLED or nvenc6_ENABLED) and WIN32:
cython_add(Extension("xpra.codecs.nvapi_version",
["xpra/codecs/nvapi_version.pyx"],
**pkgconfig("nvapi")
))

if nvenc4_ENABLED or nvenc5_ENABLED or nvenc6_ENABLED:
if nvenc4_ENABLED or nvenc5_ENABLED or nvenc6_ENABLED or nvenc7_ENABLED:
#find nvcc:
path_options = os.environ.get("PATH", "").split(os.path.pathsep)
if WIN32:
Expand Down Expand Up @@ -2304,7 +2309,9 @@ def osx_pkgconfig(*pkgs_options, **ekw):
add_data_files(CUDA_BIN, ["xpra/codecs/cuda_common/%s.fatbin" % x for x in kernels])
for nvenc_version, _nvenc_version_enabled in {4 : nvenc4_ENABLED,
5 : nvenc5_ENABLED,
6 : nvenc6_ENABLED}.items():
6 : nvenc6_ENABLED,
7 : nvenc7_ENABLED,
}.items():
if not _nvenc_version_enabled:
continue
nvencmodule = "nvenc%s" % nvenc_version
Expand Down
8 changes: 4 additions & 4 deletions src/xpra/codecs/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#these codecs may well not load because we
#do not require the libraries to be installed
NOWARN = ["nvenc4", "nvenc5", "nvenc6", "opencl", "opencv"]
NOWARN = ["nvenc4", "nvenc5", "nvenc6", "nvenc7", "opencl", "opencv"]

SELFTEST = os.environ.get("XPRA_CODEC_SELFTEST", "1")=="1"
FULL_SELFTEST = os.environ.get("XPRA_CODEC_FULL_SELFTEST", "0")=="1"
Expand Down Expand Up @@ -162,7 +162,7 @@ def load_codecs(encoders=True, decoders=True, csc=True):
codec_import_check("enc_x265", "x265 encoder", "xpra.codecs.enc_x265", "xpra.codecs.enc_x265.encoder", "Encoder")
add_codec_version("x265", "xpra.codecs.enc_x265.encoder")

for v in (4, 5, 6):
for v in (4, 5, 6, 7):
codec_import_check("nvenc%s" % v, "nvenc encoder", "xpra.codecs.nvenc%s" % v, "xpra.codecs.nvenc%s.encoder" % v, "Encoder")
add_codec_version("nvenc%s" % v, "xpra.codecs.nvenc%s.encoder" % v)

Expand Down Expand Up @@ -214,7 +214,7 @@ def load_codecs(encoders=True, decoders=True, csc=True):
log("done loading codecs")
log("found:")
#print("codec_status=%s" % codecs)
for name in ALL_CODECS:
for name in sorted(ALL_CODECS):
log("* %s : %s %s" % (name.ljust(20), str(name in codecs).ljust(10), codecs.get(name, "")))
log("codecs versions:")
for name, version in codec_versions.items():
Expand All @@ -239,7 +239,7 @@ def has_codec(name):


CSC_CODECS = "csc_swscale", "csc_cython", "csc_opencl", "csc_libyuv", "csc_opencv"
ENCODER_CODECS = "enc_pillow", "enc_vpx", "enc_webp", "enc_x264", "enc_x265", "nvenc4", "nvenc5", "nvenc6", "xvid"
ENCODER_CODECS = "enc_pillow", "enc_vpx", "enc_webp", "enc_x264", "enc_x265", "nvenc4", "nvenc5", "nvenc6", "nvenc7", "xvid"
DECODER_CODECS = "dec_pillow", "dec_vpx", "dec_webp", "dec_avcodec2"

ALL_CODECS = tuple(set(CSC_CODECS + ENCODER_CODECS + DECODER_CODECS))
Expand Down
4 changes: 4 additions & 0 deletions src/xpra/codecs/nvenc7/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This file is part of Xpra.
# Copyright (C) 2015 Antoine Martin <[email protected]>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.
Loading

0 comments on commit 8c95f14

Please sign in to comment.