summaryrefslogtreecommitdiffstats
path: root/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp
blob: 1380bd5b815eb1f66b30bfe9eef24bab4d27a3a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#include "brcmbuffer.h"

#include <EGL/eglext.h>

#include <EGL/eglext_brcm.h>

QT_BEGIN_NAMESPACE

BrcmBuffer::BrcmBuffer(struct ::wl_client *client, uint32_t id, const QSize &size, EGLint *data, size_t count)
    : QtWaylandServer::wl_buffer(client, id, 1)
    , m_handle(count)
    , m_size(size)
{
    for (size_t i = 0; i < count; ++i)
        m_handle[i] = data[i];
}

BrcmBuffer::~BrcmBuffer()
{
    static PFNEGLDESTROYGLOBALIMAGEBRCMPROC eglDestroyGlobalImage =
        (PFNEGLDESTROYGLOBALIMAGEBRCMPROC) eglGetProcAddress("eglDestroyGlobalImageBRCM");
    eglDestroyGlobalImage(handle());
}

void BrcmBuffer::buffer_destroy_resource(Resource *)
{
    delete this;
}

void BrcmBuffer::buffer_destroy(Resource *resource)
{
    wl_resource_destroy(resource->handle);
}

QT_END_NAMESPACE