1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/*
2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Copyright © 2009 Corbin Simpson
3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * All Rights Reserved.
4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Permission is hereby granted, free of charge, to any person obtaining
6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * a copy of this software and associated documentation files (the
7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * "Software"), to deal in the Software without restriction, including
8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * without limitation the rights to use, copy, modify, merge, publish,
9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * distribute, sub license, and/or sell copies of the Software, and to
10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * permit persons to whom the Software is furnished to do so, subject to
11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * the following conditions:
12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * USE OR OTHER DEALINGS IN THE SOFTWARE.
21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * The above copyright notice and this permission notice (including the
23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * next paragraph) shall be included in all copies or substantial portions
24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * of the Software.
25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */
26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/*
27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Authors:
28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *      Corbin Simpson <MostAwesomeDude@gmail.com>
29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */
30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#ifndef RADEON_DRM_WINSYS_H
31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define RADEON_DRM_WINSYS_H
32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "radeon_winsys.h"
34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "os/os_thread.h"
35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgenum radeon_generation {
37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    R300,
38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    R600,
39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    SI
40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct radeon_drm_winsys {
43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    struct radeon_winsys base;
44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    int fd; /* DRM file descriptor */
46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    int num_cs; /* The number of command streams created. */
47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    enum radeon_generation gen;
49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    struct radeon_info info;
50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    struct pb_manager *kman;
52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    struct pb_manager *cman;
53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    struct radeon_surface_manager *surf_man;
54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    uint32_t num_cpus;      /* Number of CPUs. */
56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    struct radeon_drm_cs *hyperz_owner;
58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    pipe_mutex hyperz_owner_mutex;
59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    struct radeon_drm_cs *cmask_owner;
60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    pipe_mutex cmask_owner_mutex;
61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic INLINE struct radeon_drm_winsys *
64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgradeon_drm_winsys(struct radeon_winsys *base)
65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    return (struct radeon_drm_winsys*)base;
67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#endif
70