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

Side by Side Diff: content/common/gpu/media/vaapi_video_decode_accelerator.h

Issue 43283002: Enable GLX/EGL backend switching while run HW video decode with libva. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Refined based on Fischman's comments. Created 7 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This file contains an implementation of VideoDecoderAccelerator 5 // This file contains an implementation of VideoDecoderAccelerator
6 // that utilizes hardware video decoder present on Intel CPUs. 6 // that utilizes hardware video decoder present on Intel CPUs.
7 7
8 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ 8 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_
9 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ 9 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_
10 10
(...skipping 30 matching lines...) Expand all
41 // ChildThread. A few methods on it are called on the decoder thread which is 41 // ChildThread. A few methods on it are called on the decoder thread which is
42 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread 42 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread
43 // can assume |*this| is still alive. See |weak_this_| below for more details. 43 // can assume |*this| is still alive. See |weak_this_| below for more details.
44 class CONTENT_EXPORT VaapiVideoDecodeAccelerator 44 class CONTENT_EXPORT VaapiVideoDecodeAccelerator
45 : public VideoDecodeAcceleratorImpl { 45 : public VideoDecodeAcceleratorImpl {
46 public: 46 public:
47 VaapiVideoDecodeAccelerator( 47 VaapiVideoDecodeAccelerator(
48 Display* x_display, GLXContext glx_context, 48 Display* x_display, GLXContext glx_context,
49 Client* client, 49 Client* client,
50 const base::Callback<bool(void)>& make_context_current); 50 const base::Callback<bool(void)>& make_context_current);
51 VaapiVideoDecodeAccelerator(
52 EGLDisplay egl_display, EGLContext egl_context,
53 Client* client,
54 const base::Callback<bool(void)>& make_context_current);
51 virtual ~VaapiVideoDecodeAccelerator(); 55 virtual ~VaapiVideoDecodeAccelerator();
52 56
53 // media::VideoDecodeAccelerator implementation. 57 // media::VideoDecodeAccelerator implementation.
54 virtual bool Initialize(media::VideoCodecProfile profile) OVERRIDE; 58 virtual bool Initialize(media::VideoCodecProfile profile) OVERRIDE;
55 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; 59 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE;
56 virtual void AssignPictureBuffers( 60 virtual void AssignPictureBuffers(
57 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; 61 const std::vector<media::PictureBuffer>& buffers) OVERRIDE;
58 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; 62 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE;
59 virtual void Flush() OVERRIDE; 63 virtual void Flush() OVERRIDE;
60 virtual void Reset() OVERRIDE; 64 virtual void Reset() OVERRIDE;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 void RecycleVASurfaceID(VASurfaceID va_surface_id); 150 void RecycleVASurfaceID(VASurfaceID va_surface_id);
147 151
148 // Initiate wait cycle for surfaces to be released before we release them 152 // Initiate wait cycle for surfaces to be released before we release them
149 // and allocate new ones, as requested by the decoder. 153 // and allocate new ones, as requested by the decoder.
150 void InitiateSurfaceSetChange(size_t num_pics, gfx::Size size); 154 void InitiateSurfaceSetChange(size_t num_pics, gfx::Size size);
151 // Check if the surfaces have been released or post ourselves for later. 155 // Check if the surfaces have been released or post ourselves for later.
152 void TryFinishSurfaceSetChange(); 156 void TryFinishSurfaceSetChange();
153 157
154 // Client-provided X/GLX state. 158 // Client-provided X/GLX state.
155 Display* x_display_; 159 Display* x_display_;
160 EGLDisplay egl_display_;
161 EGLContext egl_context_;
156 GLXContext glx_context_; 162 GLXContext glx_context_;
157 base::Callback<bool(void)> make_context_current_; 163 base::Callback<bool(void)> make_context_current_;
158 GLXFBConfig fb_config_; 164 GLXFBConfig fb_config_;
159 165
160 // VAVDA state. 166 // VAVDA state.
161 enum State { 167 enum State {
162 // Initialize() not called yet or failed. 168 // Initialize() not called yet or failed.
163 kUninitialized, 169 kUninitialized,
164 // DecodeTask running. 170 // DecodeTask running.
165 kDecoding, 171 kDecoding,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // Last requested number/resolution of output picture buffers. 270 // Last requested number/resolution of output picture buffers.
265 size_t requested_num_pics_; 271 size_t requested_num_pics_;
266 gfx::Size requested_pic_size_; 272 gfx::Size requested_pic_size_;
267 273
268 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); 274 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator);
269 }; 275 };
270 276
271 } // namespace content 277 } // namespace content
272 278
273 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ 279 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698