Commit 95e04659 authored by Frank Liberato's avatar Frank Liberato Committed by Commit Bot

Remove |textures_per_picture| from PictureBuffer::Init.

|textures_per_picture| is an implementation detail of the binding
texture wrapper.  This CL moves it entirely there, rather than having
it passed in from D3D11VideoDecoder.

Change-Id: I1cf12bfd4bcc52defd3610e0a9e0f94cd41129ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1876759Reviewed-by: default avatarTed Meyer <tmathmeyer@chromium.org>
Commit-Queue: Frank Liberato <liberato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709330}
parent 3a669b06
......@@ -61,15 +61,14 @@ bool CopyingTexture2DWrapper::ProcessTexture(const D3D11PictureBuffer* owner_pb,
bool CopyingTexture2DWrapper::Init(GetCommandBufferHelperCB get_helper_cb,
size_t array_slice,
gfx::Size size,
int textures_per_picture) {
gfx::Size size) {
if (!video_processor_->Init(size.width(), size.height()))
return false;
return output_texture_wrapper_->Init(
get_helper_cb,
0, // The output texture only has an array size of 1.
size, textures_per_picture);
size);
}
} // namespace media
......@@ -30,8 +30,7 @@ class MEDIA_GPU_EXPORT CopyingTexture2DWrapper : public Texture2DWrapper {
bool Init(GetCommandBufferHelperCB get_helper_cb,
size_t array_slice,
gfx::Size size,
int textures_per_picture) override;
gfx::Size size) override;
private:
std::unique_ptr<VideoProcessorProxy> video_processor_;
......
......@@ -65,8 +65,7 @@ class MockTexture2DWrapper : public Texture2DWrapper {
bool Init(GetCommandBufferHelperCB get_helper_cb,
size_t array_slice,
gfx::Size size,
int textures_per_picture) override {
gfx::Size size) override {
return MockInit();
}
......@@ -155,7 +154,7 @@ TEST_P(D3D11CopyingTexture2DWrapperTest,
auto picture_buffer =
base::MakeRefCounted<D3D11PictureBuffer>(nullptr, gfx::Size(0, 0), 0);
EXPECT_EQ(wrapper->Init(CreateMockHelperCB(), 0, {}, 0), InitSucceeds());
EXPECT_EQ(wrapper->Init(CreateMockHelperCB(), 0, {}), InitSucceeds());
EXPECT_EQ(wrapper->ProcessTexture(picture_buffer.get(), nullptr),
ProcessTextureSucceeds());
}
......
......@@ -36,15 +36,13 @@ D3D11PictureBuffer::~D3D11PictureBuffer() {
bool D3D11PictureBuffer::Init(GetCommandBufferHelperCB get_helper_cb,
ComD3D11VideoDevice video_device,
const GUID& decoder_guid,
int textures_per_picture,
std::unique_ptr<MediaLog> media_log) {
D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC view_desc = {};
view_desc.DecodeProfile = decoder_guid;
view_desc.ViewDimension = D3D11_VDOV_DIMENSION_TEXTURE2D;
view_desc.Texture2D.ArraySlice = (UINT)level_;
if (!texture_wrapper_->Init(std::move(get_helper_cb), level_, size_,
textures_per_picture)) {
if (!texture_wrapper_->Init(std::move(get_helper_cb), level_, size_)) {
media_log->AddEvent(
media_log->CreateStringEvent(MediaLogEvent::MEDIA_ERROR_LOG_ENTRY,
"error", "Failed to Init the wrapper"));
......
......@@ -56,7 +56,6 @@ class MEDIA_GPU_EXPORT D3D11PictureBuffer
bool Init(GetCommandBufferHelperCB get_helper_cb,
ComD3D11VideoDevice video_device,
const GUID& decoder_guid,
int textures_per_picture,
std::unique_ptr<MediaLog> media_log);
// Set the contents of a mailbox holder array, return true if successful.
......
......@@ -33,12 +33,14 @@ bool DefaultTexture2DWrapper::ProcessTexture(const D3D11PictureBuffer* owner_pb,
bool DefaultTexture2DWrapper::Init(GetCommandBufferHelperCB get_helper_cb,
size_t array_slice,
gfx::Size size,
int textures_per_picture) {
gfx::Size size) {
gpu_resources_ = std::make_unique<GpuResources>();
if (!gpu_resources_)
return false;
// We currently only bind NV12, which requires two GL textures.
const int textures_per_picture = 2;
// Generate mailboxes and holders.
std::vector<gpu::Mailbox> mailboxes;
for (int texture_idx = 0; texture_idx < textures_per_picture; texture_idx++) {
......
......@@ -47,12 +47,9 @@ class MEDIA_GPU_EXPORT Texture2DWrapper {
// |array_slice| Tells us which array index of the array-type Texture2D
// we should be using - if it is not an array-type, |array_slice| is 0.
// |textures_per_picture| is the number of entries present in an array-type
// Texture2D. It is 1 otherwise.
virtual bool Init(GetCommandBufferHelperCB get_helper_cb,
size_t array_slice,
gfx::Size size,
int textures_per_picture) = 0;
gfx::Size size) = 0;
private:
ComD3D11Texture2D texture_;
......@@ -67,8 +64,7 @@ class MEDIA_GPU_EXPORT DefaultTexture2DWrapper : public Texture2DWrapper {
bool Init(GetCommandBufferHelperCB get_helper_cb,
size_t array_slice,
gfx::Size size,
int textures_per_picture) override;
gfx::Size size) override;
bool ProcessTexture(const D3D11PictureBuffer* owner_pb,
MailboxHolderArray* mailbox_dest) override;
......
......@@ -611,8 +611,7 @@ void D3D11VideoDecoder::CreatePictureBuffers() {
DCHECK(!buffer->in_picture_use());
picture_buffers_.clear();
// Create each picture buffer.1
const int textures_per_picture = 2; // From the VDA
// Create each picture buffer.
for (size_t i = 0; i < TextureSelector::BUFFER_COUNT; i++) {
auto tex_wrapper = texture_selector_->CreateTextureWrapper(
device_, video_device_, device_context_, in_texture, size);
......@@ -621,7 +620,7 @@ void D3D11VideoDecoder::CreatePictureBuffers() {
new D3D11PictureBuffer(std::move(tex_wrapper), size, i));
if (!picture_buffers_[i]->Init(get_helper_cb_, video_device_,
texture_selector_->DecoderGuid(),
textures_per_picture, media_log_->Clone())) {
media_log_->Clone())) {
NotifyError("Unable to allocate PictureBuffer");
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment