GPU 가속 크롬


11

Xubuntu 12.04를 새로 설치하고 있으며 최신 안정적인 Chromium 내에서 nVidia 카드의 GPU 가속을 활성화하는 방법을 알고 싶습니다. CPU를 100 %로 발사하지 않고 MP4 파일을 재생하고 싶었습니다.

mplayer와 vdpau를 설치했지만 제대로 작동하지만 지금까지 Chromium에서 사용할 수 없었습니다. 몇 년 전, 나는 gecko-mediaplayer를 사용했지만 플러그인은 블랙리스트에 올랐습니다 ...

어떤 아이디어?

출력은 다음과 같습니다 glxinfo | grep render.

direct rendering: Yes
OpenGL renderer string: GeForce GT 520M/PCIe/SSE2
    GL_NV_blend_square, GL_NV_compute_program5, GL_NV_conditional_render, 
    GL_NV_parameter_buffer_object2, GL_NV_path_rendering, 
    GL_NVX_conditional_render, GL_NVX_gpu_memory_info, 

그리고 여기에 출력이 있습니다 lspci | grep -i vga:

02:00.0 VGA compatible controller: NVIDIA Corporation GF119 [GeForce GT 520M] (rev a1)

Chromium은 페이지를 열 때마다 많은 경고 메시지를 표시합니다. 여기서 볼 수 있듯이 성능 경고 바다에서 잃어버린 유망한 리드를 발견했습니다.

NVIDIA: could not open the device file /dev/nvidia0 (Operation not permitted).

사용자를 비디오 그룹에 추가 한 후 Chromium은 이제 MP4를 전혀 재생할 수 없습니다 (예, CPU를 사용하지 않더라도). 이전과 동일한 오류 메시지가 표시되었지만 새로운 오류 메시지가 나타납니다.

[4296 : 4296 : 0827/100001 : ERROR : gpu_video_decode_accelerator.cc (208)] void 컨텐츠에서 구현되지 않았습니다 :: GpuVideoDecodeAccelerator :: Initialize (media :: VideoCodecProfile, IPC :: Message *) ** HW 비디오 디코딩 가속을 사용할 수 없음 **.

왜 CPU 사용량이 100 %로 증가합니까? HWA (GPU 없음)가 없어도 Chrome을 통해 mp4 비디오를 재생할 수 있으며 CPU 사용량은 <20 %입니다.

4
4 살짜리, 300 $ 컴퓨터에 1080p 비디오.
— João Pereira

답변:


7

TL; DR : 아래에서 모든 것을 시도했지만 지금이 특정한 수정 된 버그에 부딪히는 검은 색 화면이 나타나지 않으면, 지금까지 문제를 해결해야합니다. 당신이 지금 얻는다면 :

ERROR:gpu_video_decode_accelerator.cc(208)] Not implemented reached in void content::GpuVideoDecodeAccelerator::Initialize(media::VideoCodecProfile, IPC::Message\*) HW video decode acceleration not available.

아래의 모든 것을 시도한 후 --disable-gpu-sandbox또는로 Chrome / ium을 시작해보십시오 --blacklist-accelerated-compositing. 문제의이 지속이, 모든 변경 사항을 되돌릴하고 문제가 무엇인지 자세히 설명하는 버그를보고하는 경우, 무엇을 당신이 시도하고, 모든 데이터를 가능한 한 : about:gpu, about:version사용중인 드라이버, 여전히 자신을 테스트하려는 사람을위한 등 커널 버전, 운 좋게도 앞에서 언급 한 스위치를 사용하면 AMD 카드에 문제가있는 경우 "Chrome / ium에서 HWA를 사용하도록 설정" 섹션이 적합합니다. Nvidia privatives 드라이버 또는 xorg-ppa-edge를 사용하는 사용자는 Firefox로 테스트하여 문제가 발생하는지 확인해야합니다.

Nvidia 권한 문제

NVIDIA : 장치 파일 / dev / nvidia0을 열 수 없습니다 (작업이 허용되지 않음).

이것은 귀하가 video그룹의 일부가 아님을 의미합니다 . 이것은 가능한 한 쉽게 해결됩니다.

sudo adduser Hal video

그런 다음 세션을 다시 시작하면 거기에 있습니다.

출처 : http://forums.gentoo.org/viewtopic-p-7232328.html?sid=900a2d59cdb52e1a5f530598dfa1be24#7232328

Chrome / ium에서 HWA를 사용하도록 설정

about:gpuChrome / ium에서 섹션을 확인해야합니다 . 이전 PC의 HW 가속은 기본적으로 비활성화되어 있으며의 설정을 재정의해야만 활성화 할 수 있습니다 about:flags.

  • 를 열고 about:flags주소 표시 줄에
  • Override software redendering list를 찾으십시오
  • "사용"을 클릭하십시오
  • Chrome / ium 다시 시작

크롬을 사용하여 시작할 수도 chrome --ignore-gpu-blacklist있지만 매번 그렇게 해야하는 것은 이상적이지 않습니다.

이것은 내 GPU 페이지입니다

이게 내 깃발이야


1
글쎄, chrome : // gpu에서 "재정의 소프트웨어 렌더링 목록 재정의"를 활성화하고 크롬을 다시 열었고 HTML5 포함 비디오 태그 (소스는 MP4)를 포함하는 로컬 페이지를 열었지만 CPU는 여전히 100 %를 초과하고 있습니다. 그런 다음 gecko-mediaplayer를 설치하고 무시 블랙리스트 매개 변수를 사용하여 크롬을 재부팅하고 다시 열었습니다. 다른 아이디어가 있습니까? 내 그래픽 기능 상태는 귀하의 것과 동일합니다.
— João Pereira

비디오 디코딩이 실제로 작동하는지 잘 모르겠습니다. Ubuntu 12.04에서 Chrome 29를 실행하고 있는데 "Mac 및 Linux에서는 가속 비디오 디코딩을 사용할 수 없습니다. : 137247, 133828"이라는 메시지가 표시되므로 "Hardware Accelerated"라는 메시지가 표시됩니다.
— gertvdijk

이제, 우리가 Chromium이 입을 어디에 두어도 돈을 벌 수 있다면 ...
— João Pereira

1
@Braiam 정말 확실하지 않다면 죄송합니다. 나에게도 도움이되지만 "문제 감지"출력 (강제 옵션을 비활성화 한 경우)에 표시된대로 작동하지 않는 것 같습니다. 또한 버그 리포트 (참조 code.google.com/p/chromium/issues/detail?id=137247 )
— gertvdijk

1
@gertvdijk 예, 그 보고서를 본 적이 있습니다. 우리는 버그 보고서를 좋아하지 않기 때문에 문제가 없다고 생각되는 카드 (소수)를 천천히 활성화하고 사용자에게 잘 작동하는 카드를 남겨 둡니다. 실제 성능의 0.1 %로 실행됩니다.
— Braiam

0

리눅스 / 크롬에서 비디오 디코딩 솔루션 :

GpuVideoDecodeAccelerator 기능은 몇 개월 동안 크롬 리눅스 코드에서 비활성화되었습니다 (ChromiumOS 제외) 크롬을 다음과 같이 패치해야합니다.

https://bazaar.launchpad.net/~saiarcot895/chromium-browser/chromium-browser.utopic.beta/view/head:/debian/patches/enable_vaapi_on_linux.diff

또는이 위대한 PPA를 사용하십시오 :

https://launchpad.net/~saiarcot895/+archive/ubuntu/chromium-beta

H264 용 Intel SandyBridge에서 libva로 테스트 한 결과 훌륭합니다. VP8에 대해 모른다.

여기에 요청 된 전체 패치는 다음과 같습니다.

Index: beta.vivid/content/common/gpu/media/gpu_video_decode_accelerator.cc
===================================================================
--- beta.vivid.orig/content/common/gpu/media/gpu_video_decode_accelerator.cc    2014-12-04 09:32:45.344607112 -0500
+++ beta.vivid/content/common/gpu/media/gpu_video_decode_accelerator.cc 2014-12-04 09:32:45.341607169 -0500
@@ -31,7 +31,7 @@
 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11)
 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h"
 #include "content/common/gpu/media/v4l2_video_device.h"
-#elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11)
+#elif (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11)
 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h"
 #include "ui/gl/gl_context_glx.h"
 #include "ui/gl/gl_implementation.h"
@@ -272,7 +272,7 @@
       make_context_current_,
       device.Pass(),
       io_message_loop_));
-#elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11)
+#elif (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11)
   if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) {
     VLOG(1) << "HW video decode acceleration not available without "
                "DesktopGL (GLX).";
Index: beta.vivid/content/content_common.gypi
===================================================================
--- beta.vivid.orig/content/content_common.gypi 2014-12-04 09:32:45.344607112 -0500
+++ beta.vivid/content/content_common.gypi  2014-12-04 09:32:45.341607169 -0500
@@ -769,7 +769,7 @@
         '<(DEPTH)/third_party/khronos',
       ],
     }],
-    ['target_arch != "arm" and chromeos == 1 and use_x11 == 1', {
+    ['target_arch != "arm" and (chromeos == 1 or desktop_linux == 1) and use_x11 == 1', {
       'dependencies': [
         '../media/media.gyp:media',
         '../third_party/libyuv/libyuv.gyp:libyuv',
Index: beta.vivid/content/content_gpu.gypi
===================================================================
--- beta.vivid.orig/content/content_gpu.gypi    2014-12-04 09:32:45.344607112 -0500
+++ beta.vivid/content/content_gpu.gypi 2014-12-04 09:32:45.341607169 -0500
@@ -40,7 +40,7 @@
         ],
       },
     }],
-    ['target_arch!="arm" and chromeos == 1', {
+    ['target_arch!="arm" and (chromeos == 1 or desktop_linux == 1)', {
       'include_dirs': [
         '<(DEPTH)/third_party/libva',
       ],
Index: beta.vivid/content/content_tests.gypi
===================================================================
--- beta.vivid.orig/content/content_tests.gypi  2014-12-04 09:32:45.344607112 -0500
+++ beta.vivid/content/content_tests.gypi   2014-12-04 09:32:45.342607150 -0500
@@ -1556,7 +1556,7 @@
           },
         ]
     }],
-    ['chromeos==1 and use_x11 == 1 and target_arch != "arm"', {
+    ['(chromeos==1 or desktop_linux==1) and use_x11 == 1 and target_arch != "arm"', {
       'targets': [
           {
             'target_name': 'vaapi_h264_decoder_unittest',
Index: beta.vivid/content/public/common/content_switches.cc
===================================================================
--- beta.vivid.orig/content/public/common/content_switches.cc   2014-12-04 09:32:45.344607112 -0500
+++ beta.vivid/content/public/common/content_switches.cc    2014-12-04 09:32:45.342607150 -0500
@@ -930,7 +930,7 @@
 // Disable web audio API.
 const char kDisableWebAudio[]               = "disable-webaudio";

-#if defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
 // Disables panel fitting (used for mirror mode).
 const char kDisablePanelFitting[]           = "disable-panel-fitting";

Index: beta.vivid/content/public/common/content_switches.h
===================================================================
--- beta.vivid.orig/content/public/common/content_switches.h    2014-12-04 09:32:45.344607112 -0500
+++ beta.vivid/content/public/common/content_switches.h 2014-12-04 09:32:45.342607150 -0500
@@ -268,7 +268,7 @@

 CONTENT_EXPORT extern const char kDisableWebAudio[];

-#if defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
 CONTENT_EXPORT extern const char kDisablePanelFitting[];
 CONTENT_EXPORT extern const char kDisableVaapiAcceleratedVideoEncode[];
 #endif
Index: beta.vivid/media/media.gyp
===================================================================
--- beta.vivid.orig/media/media.gyp 2014-12-04 09:32:45.344607112 -0500
+++ beta.vivid/media/media.gyp  2014-12-04 09:32:45.342607150 -0500
@@ -672,7 +672,7 @@
           ],
         }],
         # For VaapiVideoEncodeAccelerator.
-        ['target_arch != "arm" and chromeos == 1 and use_x11 == 1', {
+        ['target_arch != "arm" and (chromeos == 1 or desktop_linux == 1) and use_x11 == 1', {
           'sources': [
             'filters/h264_bitstream_buffer.cc',
             'filters/h264_bitstream_buffer.h',
Index: beta.vivid/gpu/config/software_rendering_list_json.cc
===================================================================
--- beta.vivid.orig/gpu/config/software_rendering_list_json.cc  2014-12-04 09:32:45.344607112 -0500
+++ beta.vivid/gpu/config/software_rendering_list_json.cc   2014-12-04 09:32:45.343607131 -0500
@@ -508,8 +508,8 @@
     },
     {
       "id": 48,
-      "description": "Accelerated video decode is unavailable on Mac and Linux",
-      "cr_bugs": [137247, 133828],
+      "description": "Accelerated video decode is unavailable on Mac",
+      "cr_bugs": [133828],
       "exceptions": [
         {
           "os": {
@@ -525,6 +525,11 @@
           "os": {
             "type": "android"
           }
+        },
+        {
+          "os": {
+            "type": "linux"
+          }
         }
       ],
       "features": [
Index: beta.vivid/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
===================================================================
--- beta.vivid.orig/content/common/sandbox_linux/bpf_gpu_policy_linux.cc    2014-12-04 09:32:45.344607112 -0500
+++ beta.vivid/content/common/sandbox_linux/bpf_gpu_policy_linux.cc 2014-12-04 09:32:45.343607131 -0500
@@ -21,6 +21,8 @@
 #include "base/logging.h"
 #include "base/memory/scoped_ptr.h"
 #include "build/build_config.h"
+// Auto-generated for dlopen libva libraries
+#include "content/common/gpu/media/va_stubs.h"
 #include "content/common/sandbox_linux/sandbox_bpf_base_policy_linux.h"
 #include "content/common/sandbox_linux/sandbox_seccomp_bpf_linux.h"
 #include "content/common/set_process_title.h"
@@ -30,6 +32,8 @@
 #include "sandbox/linux/seccomp-bpf-helpers/syscall_sets.h"
 #include "sandbox/linux/services/linux_syscalls.h"
 #include "sandbox/linux/syscall_broker/broker_process.h"
+#include "third_party/libva/va/va.h"
+#include "third_party/libva/va/va_x11.h"

 using sandbox::BrokerProcess;
 using sandbox::SyscallSets;
@@ -38,6 +42,14 @@
 using sandbox::bpf_dsl::ResultExpr;
 using sandbox::bpf_dsl::Trap;

+using content_common_gpu_media::kModuleVa;
+using content_common_gpu_media::InitializeStubs;
+using content_common_gpu_media::StubPathMap;
+
+// libva-x11 depends on libva, so dlopen libva-x11 is enough
+static const base::FilePath::CharType kVaLib[] =
+    FILE_PATH_LITERAL("libva-x11.so.1");
+
 namespace content {

 namespace {
@@ -238,19 +250,38 @@
     // Accelerated video dlopen()'s some shared objects
     // inside the sandbox, so preload them now.
     if (IsAcceleratedVideoEnabled()) {
-      const char* I965DrvVideoPath = NULL;
+      StubPathMap paths;
+      paths[kModuleVa].push_back(kVaLib);
+      if (!InitializeStubs(paths)) {
+        return false;
+      }

-      if (IsArchitectureX86_64()) {
-        I965DrvVideoPath = "/usr/lib64/va/drivers/i965_drv_video.so";
-      } else if (IsArchitectureI386()) {
-        I965DrvVideoPath = "/usr/lib/va/drivers/i965_drv_video.so";
+      // libva drivers won't get loaded even above two libraries get dlopened.
+      // Thus, libva calls will fail after post sandbox stage.
+      //
+      // To get the va driver loadded before sandboxing, upstream simply dlopen
+      // the hard-coded va driver path because ChromeOS is the only platform
+      // that Google want to support libva.
+      //
+      // While generic linux distros ship va driver as anywhere they want.
+      // Fortunately, the va driver will be loadded when vaInitialize() get
+      // called.
+      // So the following code is to call vaInitialize() before sandboxing.
+      Display* x_display = XOpenDisplay(NULL);
+      VADisplay va_display = vaGetDisplay(x_display);
+      if (!vaDisplayIsValid(va_display)) {
+        DVLOG(1) << "Failed to call vaGetDisplay()";
+        return false;
       }

-      dlopen(I965DrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
-      dlopen("libva.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
-      dlopen("libva-x11.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
-    }
-  }
+      int major_version, minor_version;
+      if (vaInitialize(va_display, &major_version, &minor_version)
+          != VA_STATUS_SUCCESS) {
+        DVLOG(1) << "Failed to call vaInitialize()";
+        return false;
+      }
+    }  // end of IsAcceleratedVideoDecodeEnabled()
+  }  // end of IsArchitectureX86_64() || IsArchitectureI386()

   return true;
 }

1
이 이론적으로 질문에 대답 할 수 있습니다 동안, 바람직 할 것이다 여기에 대한 대답의 본질적인 부분을 포함하고 참조 할 수 있도록 링크를 제공합니다.
— MadMike

내가 의미하는 바는 소스를 얻고 패치를 적용하고 컴파일하는 방법에 대한 단계를 포함하는 것이 었습니다. 또는 PPA를 추가하고 브라우저를 설치하는 방법에 대해 설명합니다.
— MadMike
당사 사이트를 사용함과 동시에 당사의 쿠키 정책과 개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.