OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/file_descriptor_posix.h" | 5 #include "base/file_descriptor_posix.h" |
6 #include "content/common/gpu/media/va_surface.h" | 6 #include "content/common/gpu/media/va_surface.h" |
7 #include "content/common/gpu/media/vaapi_drm_picture.h" | 7 #include "content/common/gpu/media/vaapi_drm_picture.h" |
8 #include "content/common/gpu/media/vaapi_wrapper.h" | 8 #include "content/common/gpu/media/vaapi_wrapper.h" |
9 #include "third_party/libva/va/drm/va_drm.h" | 9 #include "third_party/libva/va/drm/va_drm.h" |
10 #include "third_party/libva/va/va.h" | 10 #include "third_party/libva/va/va.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 bool VaapiDrmPicture::Initialize() { | 43 bool VaapiDrmPicture::Initialize() { |
44 // We want to create a VASurface and an EGLImage out of the same | 44 // We want to create a VASurface and an EGLImage out of the same |
45 // memory buffer, so we can output decoded pictures to it using | 45 // memory buffer, so we can output decoded pictures to it using |
46 // VAAPI and also use it to paint with GL. | 46 // VAAPI and also use it to paint with GL. |
47 ui::OzonePlatform* platform = ui::OzonePlatform::GetInstance(); | 47 ui::OzonePlatform* platform = ui::OzonePlatform::GetInstance(); |
48 ui::SurfaceFactoryOzone* factory = platform->GetSurfaceFactoryOzone(); | 48 ui::SurfaceFactoryOzone* factory = platform->GetSurfaceFactoryOzone(); |
49 | 49 |
50 // Create a buffer from Ozone. | 50 // Create a buffer from Ozone. |
51 pixmap_ = factory->CreateNativePixmap(gfx::kNullAcceleratedWidget, size(), | 51 pixmap_ = factory->CreateNativePixmap( |
52 ui::SurfaceFactoryOzone::BGRA_8888, | 52 gfx::kNullAcceleratedWidget, size(), ui::SurfaceFactoryOzone::BGRA_8888, |
53 ui::SurfaceFactoryOzone::SCANOUT); | 53 ui::SurfaceFactoryOzone::SCANOUT, nullptr); |
54 if (!pixmap_) { | 54 if (!pixmap_) { |
55 LOG(ERROR) << "Failed creating an Ozone NativePixmap"; | 55 LOG(ERROR) << "Failed creating an Ozone NativePixmap"; |
56 return false; | 56 return false; |
57 } | 57 } |
58 | 58 |
59 // Get the dmabuf of the created buffer. | 59 // Get the dmabuf of the created buffer. |
60 int dmabuf_fd = pixmap_->GetDmaBufFd(); | 60 int dmabuf_fd = pixmap_->GetDmaBufFd(); |
61 if (dmabuf_fd < 0) { | 61 if (dmabuf_fd < 0) { |
62 LOG(ERROR) << "Failed to get dmabuf from an Ozone NativePixmap"; | 62 LOG(ERROR) << "Failed to get dmabuf from an Ozone NativePixmap"; |
63 return false; | 63 return false; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 scoped_refptr<gfx::GLImage> VaapiDrmPicture::GetImageToBind() { | 127 scoped_refptr<gfx::GLImage> VaapiDrmPicture::GetImageToBind() { |
128 return gl_image_; | 128 return gl_image_; |
129 } | 129 } |
130 | 130 |
131 bool VaapiDrmPicture::AllowOverlay() const { | 131 bool VaapiDrmPicture::AllowOverlay() const { |
132 return true; | 132 return true; |
133 } | 133 } |
134 | 134 |
135 } // namespace | 135 } // namespace |
OLD | NEW |