Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Side by Side Diff: content/common/gpu/media/gpu_jpeg_decode_accelerator.cc

Issue 1872393002: Enable VAAPI accelerated decode on Linux Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing JPEG change Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/common/BUILD.gn ('k') | content/common/gpu/media/gpu_video_decode_accelerator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h" 5 #include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/containers/hash_tables.h" 11 #include "base/containers/hash_tables.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/shared_memory.h" 13 #include "base/memory/shared_memory.h"
14 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 #include "base/thread_task_runner_handle.h" 16 #include "base/thread_task_runner_handle.h"
17 #include "base/trace_event/trace_event.h" 17 #include "base/trace_event/trace_event.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "gpu/ipc/service/gpu_channel.h" 19 #include "gpu/ipc/service/gpu_channel.h"
20 #include "ipc/ipc_message_macros.h" 20 #include "ipc/ipc_message_macros.h"
21 #include "ipc/message_filter.h" 21 #include "ipc/message_filter.h"
22 #include "media/filters/jpeg_parser.h" 22 #include "media/filters/jpeg_parser.h"
23 #include "media/gpu/ipc/common/media_messages.h" 23 #include "media/gpu/ipc/common/media_messages.h"
24 #include "ui/gfx/geometry/size.h" 24 #include "ui/gfx/geometry/size.h"
25 25
26 #if defined(OS_CHROMEOS) 26 #if defined(OS_CHROMEOS) || defined(OS_LINUX)
27 #if defined(ARCH_CPU_X86_FAMILY) 27 #if defined(ARCH_CPU_X86_FAMILY)
28 #include "content/common/gpu/media/vaapi_jpeg_decode_accelerator.h" 28 #include "content/common/gpu/media/vaapi_jpeg_decode_accelerator.h"
29 #endif 29 #endif
30 #if defined(USE_V4L2_CODEC) 30 #if defined(USE_V4L2_CODEC)
31 #include "content/common/gpu/media/v4l2_device.h" 31 #include "content/common/gpu/media/v4l2_device.h"
32 #include "content/common/gpu/media/v4l2_jpeg_decode_accelerator.h" 32 #include "content/common/gpu/media/v4l2_jpeg_decode_accelerator.h"
33 #endif 33 #endif
34 #endif 34 #endif
35 35
36 namespace { 36 namespace {
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 decoder.reset(new V4L2JpegDecodeAccelerator(device, io_task_runner)); 394 decoder.reset(new V4L2JpegDecodeAccelerator(device, io_task_runner));
395 #endif 395 #endif
396 return decoder; 396 return decoder;
397 } 397 }
398 398
399 // static 399 // static
400 std::unique_ptr<media::JpegDecodeAccelerator> 400 std::unique_ptr<media::JpegDecodeAccelerator>
401 GpuJpegDecodeAccelerator::CreateVaapiJDA( 401 GpuJpegDecodeAccelerator::CreateVaapiJDA(
402 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) { 402 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) {
403 std::unique_ptr<media::JpegDecodeAccelerator> decoder; 403 std::unique_ptr<media::JpegDecodeAccelerator> decoder;
404 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) 404 #if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY)
405 decoder.reset(new VaapiJpegDecodeAccelerator(io_task_runner)); 405 decoder.reset(new VaapiJpegDecodeAccelerator(io_task_runner));
406 #endif 406 #endif
407 return decoder; 407 return decoder;
408 } 408 }
409 409
410 // static 410 // static
411 bool GpuJpegDecodeAccelerator::IsSupported() { 411 bool GpuJpegDecodeAccelerator::IsSupported() {
412 const GpuJpegDecodeAccelerator::CreateJDAFp create_jda_fps[] = { 412 const GpuJpegDecodeAccelerator::CreateJDAFp create_jda_fps[] = {
413 &GpuJpegDecodeAccelerator::CreateV4L2JDA, 413 &GpuJpegDecodeAccelerator::CreateV4L2JDA,
414 &GpuJpegDecodeAccelerator::CreateVaapiJDA, 414 &GpuJpegDecodeAccelerator::CreateVaapiJDA,
415 }; 415 };
416 for (const auto& create_jda_function : create_jda_fps) { 416 for (const auto& create_jda_function : create_jda_fps) {
417 std::unique_ptr<media::JpegDecodeAccelerator> accelerator = 417 std::unique_ptr<media::JpegDecodeAccelerator> accelerator =
418 (*create_jda_function)(base::ThreadTaskRunnerHandle::Get()); 418 (*create_jda_function)(base::ThreadTaskRunnerHandle::Get());
419 if (accelerator && accelerator->IsSupported()) 419 if (accelerator && accelerator->IsSupported())
420 return true; 420 return true;
421 } 421 }
422 return false; 422 return false;
423 } 423 }
424 424
425 } // namespace content 425 } // namespace content
OLDNEW
« no previous file with comments | « content/common/BUILD.gn ('k') | content/common/gpu/media/gpu_video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698