summaryrefslogtreecommitdiff
path: root/chromium/media/gpu/vaapi/vaapi_wrapper.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/media/gpu/vaapi/vaapi_wrapper.h
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-85-based.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/media/gpu/vaapi/vaapi_wrapper.h')
-rw-r--r--chromium/media/gpu/vaapi/vaapi_wrapper.h69
1 files changed, 38 insertions, 31 deletions
diff --git a/chromium/media/gpu/vaapi/vaapi_wrapper.h b/chromium/media/gpu/vaapi/vaapi_wrapper.h
index 7f087039c58..c4d005ba456 100644
--- a/chromium/media/gpu/vaapi/vaapi_wrapper.h
+++ b/chromium/media/gpu/vaapi/vaapi_wrapper.h
@@ -322,9 +322,9 @@ class MEDIA_GPU_EXPORT VaapiWrapper
// Useful when a pending job is to be cancelled (on reset or error).
void DestroyPendingBuffers();
- // Execute job in hardware on target |va_surface_id| and destroy pending
- // buffers. Return false if Execute() fails.
- bool ExecuteAndDestroyPendingBuffers(VASurfaceID va_surface_id);
+ // Executes job in hardware on target |va_surface_id| and destroys pending
+ // buffers. Returns false if Execute() fails.
+ virtual bool ExecuteAndDestroyPendingBuffers(VASurfaceID va_surface_id);
#if defined(USE_X11)
// Put data from |va_surface_id| into |x_pixmap| of size
@@ -343,28 +343,37 @@ class MEDIA_GPU_EXPORT VaapiWrapper
VAImageFormat* format,
const gfx::Size& size);
- // Upload contents of |frame| into |va_surface_id| for encode.
- bool UploadVideoFrameToSurface(const VideoFrame& frame,
- VASurfaceID va_surface_id,
- const gfx::Size& va_surface_size);
+ // Uploads contents of |frame| into |va_surface_id| for encode.
+ virtual bool UploadVideoFrameToSurface(const VideoFrame& frame,
+ VASurfaceID va_surface_id,
+ const gfx::Size& va_surface_size);
- // Create a buffer of |size| bytes to be used as encode output.
- bool CreateVABuffer(size_t size, VABufferID* buffer_id);
+ // Creates a buffer of |size| bytes to be used as encode output.
+ virtual bool CreateVABuffer(size_t size, VABufferID* buffer_id);
- // Download the contents of the buffer with given |buffer_id| into a buffer of
- // size |target_size|, pointed to by |target_ptr|. The number of bytes
+ // Gets the encoded frame linear size of the buffer with given |buffer_id|.
+ // |sync_surface_id| will be used as a sync point, i.e. it will have to become
+ // idle before starting the acquirement. |sync_surface_id| should be the
+ // source surface passed to the encode job. Returns 0 if it fails for any
+ // reason.
+ virtual uint64_t GetEncodedChunkSize(VABufferID buffer_id,
+ VASurfaceID sync_surface_id);
+
+ // Downloads the contents of the buffer with given |buffer_id| into a buffer
+ // of size |target_size|, pointed to by |target_ptr|. The number of bytes
// downloaded will be returned in |coded_data_size|. |sync_surface_id| will
// be used as a sync point, i.e. it will have to become idle before starting
// the download. |sync_surface_id| should be the source surface passed
- // to the encode job.
- bool DownloadFromVABuffer(VABufferID buffer_id,
- VASurfaceID sync_surface_id,
- uint8_t* target_ptr,
- size_t target_size,
- size_t* coded_data_size);
+ // to the encode job. Returns false if it fails for any reason. For example,
+ // the linear size of the resulted encoded frame is larger than |target_size|.
+ virtual bool DownloadFromVABuffer(VABufferID buffer_id,
+ VASurfaceID sync_surface_id,
+ uint8_t* target_ptr,
+ size_t target_size,
+ size_t* coded_data_size);
// Deletes the VA buffer identified by |buffer_id|.
- void DestroyVABuffer(VABufferID buffer_id);
+ virtual void DestroyVABuffer(VABufferID buffer_id);
// Destroy all previously-allocated (and not yet destroyed) buffers.
void DestroyVABuffers();
@@ -374,23 +383,27 @@ class MEDIA_GPU_EXPORT VaapiWrapper
// For H.264 encoding, the value represents the maximum number of reference
// frames for both the reference picture list 0 (bottom 16 bits) and the
// reference picture list 1 (top 16 bits).
- bool GetVAEncMaxNumOfRefFrames(VideoCodecProfile profile,
- size_t* max_ref_frames);
+ virtual bool GetVAEncMaxNumOfRefFrames(VideoCodecProfile profile,
+ size_t* max_ref_frames);
+
+ // Checks if the driver supports frame rotation.
+ bool IsRotationSupported();
// Blits a VASurface |va_surface_src| into another VASurface
- // |va_surface_dest| applying pixel format conversion, cropping and scaling
- // if needed. |src_rect| and |dest_rect| are optional. They can be used to
- // specify the area used in the blit.
+ // |va_surface_dest| applying pixel format conversion, rotation, cropping
+ // and scaling if needed. |src_rect| and |dest_rect| are optional. They can
+ // be used to specify the area used in the blit.
bool BlitSurface(const VASurface& va_surface_src,
const VASurface& va_surface_dest,
base::Optional<gfx::Rect> src_rect = base::nullopt,
- base::Optional<gfx::Rect> dest_rect = base::nullopt);
+ base::Optional<gfx::Rect> dest_rect = base::nullopt,
+ VideoRotation rotation = VIDEO_ROTATION_0);
// Initialize static data before sandbox is enabled.
static void PreSandboxInitialization();
// vaDestroySurfaces() a vector or a single VASurfaceID.
- void DestroySurfaces(std::vector<VASurfaceID> va_surfaces);
+ virtual void DestroySurfaces(std::vector<VASurfaceID> va_surfaces);
virtual void DestroySurface(VASurfaceID va_surface_id);
protected:
@@ -425,12 +438,6 @@ class MEDIA_GPU_EXPORT VaapiWrapper
void DestroyPendingBuffers_Locked() EXCLUSIVE_LOCKS_REQUIRED(va_lock_);
- // Attempt to set render mode to "render to texture.". Failure is non-fatal.
- void TryToSetVADisplayAttributeToLocalGPU();
-
- // Check low-power encode support for |profile| and |mode|.
- bool IsLowPowerEncSupported(VAProfile va_profile, CodecMode mode) const;
-
const CodecMode mode_;
// Pointer to VADisplayState's member |va_lock_|. Guaranteed to be valid for