vaapi_picture_tfp.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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
  3. // found in the LICENSE file.
  4. #ifndef MEDIA_GPU_VAAPI_VAAPI_PICTURE_TFP_H_
  5. #define MEDIA_GPU_VAAPI_VAAPI_PICTURE_TFP_H_
  6. #include <stdint.h>
  7. #include "base/memory/raw_ptr.h"
  8. #include "base/memory/ref_counted.h"
  9. #include "media/gpu/vaapi/vaapi_picture.h"
  10. #include "ui/gfx/geometry/size.h"
  11. #include "ui/gfx/x/connection.h"
  12. #include "ui/gl/gl_bindings.h"
  13. namespace gl {
  14. class GLImageGLX;
  15. }
  16. namespace media {
  17. class VaapiWrapper;
  18. // Implementation of VaapiPicture for the X11 backends with Texture-From-Pixmap
  19. // extension.
  20. class VaapiTFPPicture : public VaapiPicture {
  21. public:
  22. VaapiTFPPicture(scoped_refptr<VaapiWrapper> vaapi_wrapper,
  23. const MakeGLContextCurrentCallback& make_context_current_cb,
  24. const BindGLImageCallback& bind_image_cb,
  25. int32_t picture_buffer_id,
  26. const gfx::Size& size,
  27. const gfx::Size& visible_size,
  28. uint32_t texture_id,
  29. uint32_t client_texture_id,
  30. uint32_t texture_target);
  31. VaapiTFPPicture(const VaapiTFPPicture&) = delete;
  32. VaapiTFPPicture& operator=(const VaapiTFPPicture&) = delete;
  33. ~VaapiTFPPicture() override;
  34. // VaapiPicture implementation.
  35. VaapiStatus Allocate(gfx::BufferFormat format) override;
  36. bool ImportGpuMemoryBufferHandle(
  37. gfx::BufferFormat format,
  38. gfx::GpuMemoryBufferHandle gpu_memory_buffer_handle) override;
  39. bool DownloadFromSurface(scoped_refptr<VASurface> va_surface) override;
  40. private:
  41. VaapiStatus Initialize();
  42. const raw_ptr<x11::Connection> connection_;
  43. x11::Pixmap x_pixmap_;
  44. scoped_refptr<gl::GLImageGLX> glx_image_;
  45. };
  46. } // namespace media
  47. #endif // MEDIA_GPU_VAAPI_VAAPI_PICTURE_TFP_H_