core: Add GraphicsBufferOptions::software
The software flag indicates whether the graphics buffer allocator needs to allocate a buffer suitable for software rendering. Its intended usage is to allow the gbm allocator to allocate both dmabuf and dumb buffers.
This commit is contained in:
parent
1833d790f5
commit
7782cb6853
6 changed files with 13 additions and 0 deletions
|
@ -80,6 +80,7 @@ std::shared_ptr<VirtualQPainterBufferSlot> VirtualQPainterSwapchain::acquire()
|
|||
ShmGraphicsBuffer *buffer = m_allocator->allocate(GraphicsBufferOptions{
|
||||
.size = m_size,
|
||||
.format = m_format,
|
||||
.software = true,
|
||||
});
|
||||
if (!buffer) {
|
||||
qCDebug(KWIN_VIRTUAL) << "Did not get a new Buffer from Shm Pool";
|
||||
|
|
|
@ -84,6 +84,7 @@ std::shared_ptr<WaylandQPainterBufferSlot> WaylandQPainterSwapchain::acquire()
|
|||
ShmGraphicsBuffer *buffer = m_allocator->allocate(GraphicsBufferOptions{
|
||||
.size = m_size,
|
||||
.format = m_format,
|
||||
.software = true,
|
||||
});
|
||||
if (!buffer) {
|
||||
qCDebug(KWIN_WAYLAND_BACKEND) << "Did not get a new Buffer from Shm Pool";
|
||||
|
|
|
@ -91,6 +91,7 @@ std::shared_ptr<X11WindowedQPainterLayerBuffer> X11WindowedQPainterLayerSwapchai
|
|||
ShmGraphicsBuffer *graphicsBuffer = m_allocator->allocate(GraphicsBufferOptions{
|
||||
.size = m_size,
|
||||
.format = m_format,
|
||||
.software = true,
|
||||
});
|
||||
if (!graphicsBuffer) {
|
||||
qCWarning(KWIN_X11WINDOWED) << "Failed to allocate a shared memory graphics buffer";
|
||||
|
|
|
@ -24,6 +24,10 @@ GbmGraphicsBufferAllocator::~GbmGraphicsBufferAllocator()
|
|||
|
||||
GbmGraphicsBuffer *GbmGraphicsBufferAllocator::allocate(const GraphicsBufferOptions &options)
|
||||
{
|
||||
if (options.software) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!options.modifiers.isEmpty() && !(options.modifiers.size() == 1 && options.modifiers.first() == DRM_FORMAT_MOD_INVALID)) {
|
||||
gbm_bo *bo = gbm_bo_create_with_modifiers(m_gbmDevice,
|
||||
options.size.width(),
|
||||
|
|
|
@ -29,6 +29,9 @@ struct GraphicsBufferOptions
|
|||
|
||||
/// An optional list of modifiers, see DRM_FORMAT_MOD_*.
|
||||
QVector<uint64_t> modifiers;
|
||||
|
||||
/// Whether the graphics buffer should be suitable for software rendering.
|
||||
bool software = false;
|
||||
};
|
||||
|
||||
class KWIN_EXPORT GraphicsBufferAllocator
|
||||
|
|
|
@ -38,6 +38,9 @@ const ShmAttributes *ShmGraphicsBuffer::shmAttributes() const
|
|||
|
||||
ShmGraphicsBuffer *ShmGraphicsBufferAllocator::allocate(const GraphicsBufferOptions &options)
|
||||
{
|
||||
if (!options.software) {
|
||||
return nullptr;
|
||||
}
|
||||
if (!options.modifiers.isEmpty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue