aboutsummaryrefslogtreecommitdiff
path: root/drivers/mxc/amd-gpu/common/gsl_context.c
blob: c999247b3afdaf18884e75c2abd42773938f0e16 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* Copyright (c) 2008-2010, Advanced Micro Devices. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 *
 */

#include "gsl.h"
#include "gsl_hal.h"
#include "gsl_context.h"

//////////////////////////////////////////////////////////////////////////////
// functions
//////////////////////////////////////////////////////////////////////////////

KGSL_API int
kgsl_context_create(gsl_deviceid_t device_id, gsl_context_type_t type, unsigned int *drawctxt_id, gsl_flags_t flags)
{
    gsl_device_t* device  = &gsl_driver.device[device_id-1];
    int status;

    GSL_API_MUTEX_LOCK();

    if (device->ftbl.context_create)
    {
        status = device->ftbl.context_create(device, type, drawctxt_id, flags);
    }
    else
    {
        status = GSL_FAILURE;
    }

    GSL_API_MUTEX_UNLOCK();

    return status;
}

//----------------------------------------------------------------------------

KGSL_API int
kgsl_context_destroy(gsl_deviceid_t device_id, unsigned int drawctxt_id)
{
    gsl_device_t* device  = &gsl_driver.device[device_id-1];
    int status;

    GSL_API_MUTEX_LOCK();

    if (device->ftbl.context_destroy)
    {
        status = device->ftbl.context_destroy(device, drawctxt_id);
    }
    else
    {
        status = GSL_FAILURE;
    }

    GSL_API_MUTEX_UNLOCK();

    return status;
}

//----------------------------------------------------------------------------