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 "media/gpu/vaapi_tfp_picture.h" | 5 #include "media/gpu/vaapi_tfp_picture.h" |
6 | 6 |
7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
8 | 8 |
9 #include "media/gpu/va_surface.h" | 9 #include "media/gpu/va_surface.h" |
10 #include "media/gpu/vaapi_wrapper.h" | 10 #include "media/gpu/vaapi_wrapper.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 picture_buffer_id, | 29 picture_buffer_id, |
30 size, | 30 size, |
31 texture_id, | 31 texture_id, |
32 client_texture_id), | 32 client_texture_id), |
33 x_display_(gfx::GetXDisplay()), | 33 x_display_(gfx::GetXDisplay()), |
34 x_pixmap_(0) {} | 34 x_pixmap_(0) {} |
35 | 35 |
36 VaapiTFPPicture::~VaapiTFPPicture() { | 36 VaapiTFPPicture::~VaapiTFPPicture() { |
37 if (glx_image_.get() && make_context_current_cb_.Run()) { | 37 if (glx_image_.get() && make_context_current_cb_.Run()) { |
38 glx_image_->ReleaseTexImage(GL_TEXTURE_2D); | 38 glx_image_->ReleaseTexImage(GL_TEXTURE_2D); |
39 glx_image_->Destroy(true); | |
40 DCHECK_EQ(glGetError(), static_cast<GLenum>(GL_NO_ERROR)); | 39 DCHECK_EQ(glGetError(), static_cast<GLenum>(GL_NO_ERROR)); |
41 } | 40 } |
42 | 41 |
43 if (x_pixmap_) | 42 if (x_pixmap_) |
44 XFreePixmap(x_display_, x_pixmap_); | 43 XFreePixmap(x_display_, x_pixmap_); |
45 } | 44 } |
46 | 45 |
47 bool VaapiTFPPicture::Initialize() { | 46 bool VaapiTFPPicture::Initialize() { |
48 DCHECK(x_pixmap_); | 47 DCHECK(x_pixmap_); |
49 | 48 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 return false; | 96 return false; |
98 } | 97 } |
99 | 98 |
100 bool VaapiTFPPicture::DownloadFromSurface( | 99 bool VaapiTFPPicture::DownloadFromSurface( |
101 const scoped_refptr<VASurface>& va_surface) { | 100 const scoped_refptr<VASurface>& va_surface) { |
102 return vaapi_wrapper_->PutSurfaceIntoPixmap(va_surface->id(), x_pixmap_, | 101 return vaapi_wrapper_->PutSurfaceIntoPixmap(va_surface->id(), x_pixmap_, |
103 va_surface->size()); | 102 va_surface->size()); |
104 } | 103 } |
105 | 104 |
106 } // namespace media | 105 } // namespace media |
OLD | NEW |