| 1 |
/* |
| 2 |
* Copyright (C) 2017-2018 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "RenderBufferPoolDMA.h" |
| 10 |
|
| 11 |
#include "RenderBufferDMA.h" |
| 12 |
#include "cores/RetroPlayer/rendering/VideoRenderers/RPRendererDMA.h" |
| 13 |
|
| 14 |
#include <drm_fourcc.h> |
| 15 |
|
| 16 |
using namespace KODI; |
| 17 |
using namespace RETRO; |
| 18 |
|
| 19 |
CRenderBufferPoolDMA::CRenderBufferPoolDMA(CRenderContext& context) : m_context(context) |
| 20 |
{ |
| 21 |
} |
| 22 |
|
| 23 |
bool CRenderBufferPoolDMA::IsCompatible(const CRenderVideoSettings& renderSettings) const |
| 24 |
{ |
| 25 |
if (!CRPRendererDMA::SupportsScalingMethod(renderSettings.GetScalingMethod())) |
| 26 |
return false; |
| 27 |
|
| 28 |
return true; |
| 29 |
} |
| 30 |
|
| 31 |
IRenderBuffer* CRenderBufferPoolDMA::CreateRenderBuffer(void* header /* = nullptr */) |
| 32 |
{ |
| 33 |
return new CRenderBufferDMA(m_context, m_fourcc); |
| 34 |
} |
| 35 |
|
| 36 |
bool CRenderBufferPoolDMA::ConfigureInternal() |
| 37 |
{ |
| 38 |
switch (m_format) |
| 39 |
{ |
| 40 |
case AV_PIX_FMT_0RGB32: |
| 41 |
{ |
| 42 |
m_fourcc = DRM_FORMAT_ARGB8888; |
| 43 |
return true; |
| 44 |
} |
| 45 |
case AV_PIX_FMT_RGB555: |
| 46 |
{ |
| 47 |
m_fourcc = DRM_FORMAT_ARGB1555; |
| 48 |
return true; |
| 49 |
} |
| 50 |
case AV_PIX_FMT_RGB565: |
| 51 |
{ |
| 52 |
m_fourcc = DRM_FORMAT_RGB565; |
| 53 |
return true; |
| 54 |
} |
| 55 |
default: |
| 56 |
break; // we shouldn't even get this far if we are given an unsupported pixel format |
| 57 |
} |
| 58 |
|
| 59 |
return false; |
| 60 |
} |