Update source to Armbian-dev-202610.A311Y3
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
//
|
||||
// Copyright (c) 2026 Amlogic, Inc. All rights reserved.
|
||||
//
|
||||
// AML hardware video decoder - zero-copy via VideoDecoderPipeline
|
||||
// V4L2 DMA-BUF -> MailboxVideoFrameConverter -> GPU texture -> zero-copy
|
||||
// NM12 (NV12 multi-planar) preferred over NM21 for Mali compatibility
|
||||
|
||||
#include "media/mojo/services/gpu_mojo_media_client.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "media/base/media_log.h"
|
||||
#include "media/base/video_codecs.h"
|
||||
#include "media/base/video_decoder.h"
|
||||
#include "media/gpu/chromeos/mailbox_video_frame_converter.h"
|
||||
#include "media/gpu/chromeos/platform_video_frame_pool.h"
|
||||
#include "media/gpu/chromeos/video_decoder_pipeline.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
|
||||
namespace media {
|
||||
|
||||
class GpuMojoMediaClientAmlogic final : public GpuMojoMediaClient {
|
||||
public:
|
||||
GpuMojoMediaClientAmlogic(GpuMojoMediaClientTraits& traits)
|
||||
: GpuMojoMediaClient(traits) {}
|
||||
~GpuMojoMediaClientAmlogic() final = default;
|
||||
|
||||
protected:
|
||||
std::unique_ptr<VideoDecoder> CreatePlatformVideoDecoder(
|
||||
VideoDecoderTraits& traits) final {
|
||||
auto frame_pool = std::make_unique<PlatformVideoFramePool>();
|
||||
auto frame_converter = MailboxVideoFrameConverter::Create(
|
||||
gpu_task_runner_, traits.get_command_buffer_stub_cb);
|
||||
|
||||
// NM12 (NV12 multi-planar) first - Mali supports NV12 import
|
||||
// NM21 (NV21 multi-planar) last - Mali crashes on NV21 import
|
||||
return VideoDecoderPipeline::Create(
|
||||
gpu_workarounds_, traits.task_runner, std::move(frame_pool),
|
||||
std::move(frame_converter),
|
||||
{Fourcc(Fourcc::NM12), Fourcc(Fourcc::NV12),
|
||||
Fourcc(Fourcc::NM21), Fourcc(Fourcc::NV21)},
|
||||
traits.media_log->Clone(), /*oop_video_decoder=*/{},
|
||||
/*in_video_decoder_process=*/false);
|
||||
}
|
||||
|
||||
void NotifyPlatformDecoderSupport(
|
||||
mojo::PendingRemote<stable::mojom::StableVideoDecoder> oop_video_decoder,
|
||||
base::OnceCallback<void(
|
||||
mojo::PendingRemote<stable::mojom::StableVideoDecoder>)> cb) final {
|
||||
std::move(cb).Run(std::move(oop_video_decoder));
|
||||
}
|
||||
|
||||
std::optional<SupportedVideoDecoderConfigs>
|
||||
GetPlatformSupportedVideoDecoderConfigs() final {
|
||||
SupportedVideoDecoderConfigs configs;
|
||||
configs.emplace_back(H264PROFILE_BASELINE, H264PROFILE_HIGH,
|
||||
gfx::Size(64, 64), gfx::Size(3840, 2160), false, false);
|
||||
configs.emplace_back(VP9PROFILE_PROFILE0, VP9PROFILE_PROFILE2,
|
||||
gfx::Size(64, 64), gfx::Size(3840, 2160), false, false);
|
||||
configs.emplace_back(HEVCPROFILE_MAIN, HEVCPROFILE_MAIN10,
|
||||
gfx::Size(64, 64), gfx::Size(3840, 2160), false, false);
|
||||
configs.emplace_back(AV1PROFILE_PROFILE_MAIN, AV1PROFILE_PROFILE_MAIN,
|
||||
gfx::Size(64, 64), gfx::Size(3840, 2160), false, false);
|
||||
return configs;
|
||||
}
|
||||
|
||||
VideoDecoderType GetPlatformDecoderImplementationType() final {
|
||||
return VideoDecoderType::kV4L2;
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<GpuMojoMediaClient> CreateGpuMediaService(
|
||||
GpuMojoMediaClientTraits& traits) {
|
||||
return std::make_unique<GpuMojoMediaClientAmlogic>(traits);
|
||||
}
|
||||
|
||||
} // namespace media
|
||||
Reference in New Issue
Block a user