blob: 3066f67e0ebcc423769264100d20ecc04ce1a9bb [file] [log] [blame]
Chia-I Wue54854a2014-08-05 10:23:50 +08001/*
2 * XGL
3 *
4 * Copyright (C) 2014 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25#ifndef DEV_H
26#define DEV_H
27
Chia-I Wue09b5362014-08-07 09:25:14 +080028#include "intel.h"
Chia-I Wue54854a2014-08-05 10:23:50 +080029#include "gpu.h"
Chia-I Wua2161db2014-08-15 16:34:34 +080030#include "obj.h"
Chia-I Wue54854a2014-08-05 10:23:50 +080031
Chia-I Wue54854a2014-08-05 10:23:50 +080032struct intel_queue;
33struct intel_winsys;
34
35struct intel_dev_dbg_msg_filter {
36 XGL_INT msg_code;
37 XGL_DBG_MSG_FILTER filter;
38 bool triggered;
39
40 struct intel_dev_dbg_msg_filter *next;
41};
42
43struct intel_dev_dbg {
44 struct intel_base_dbg base;
45
46 struct intel_dev_dbg_msg_filter *filters;
47};
48
49struct intel_dev {
50 struct intel_base base;
51
52 struct intel_gpu *gpu;
53 struct intel_winsys *winsys;
54 struct intel_queue *queues[INTEL_GPU_ENGINE_COUNT];
Chia-I Wu7ec9f342014-08-19 10:47:53 +080055
56 XGL_VALIDATION_LEVEL validation_level;
57 bool disable_pipeline_loads;
58 bool force_object_memory_reqs;
59 bool force_large_image_alignment;
Chia-I Wue54854a2014-08-05 10:23:50 +080060};
61
Chia-I Wue54854a2014-08-05 10:23:50 +080062static inline struct intel_dev *intel_dev(XGL_DEVICE dev)
63{
64 return (struct intel_dev *) dev;
65}
66
67static inline struct intel_dev_dbg *intel_dev_dbg(struct intel_dev *dev)
68{
69 return (struct intel_dev_dbg *) dev->base.dbg;
70}
71
Chia-I Wue54854a2014-08-05 10:23:50 +080072XGL_RESULT intel_dev_create(struct intel_gpu *gpu,
73 const XGL_DEVICE_CREATE_INFO *info,
74 struct intel_dev **dev_ret);
75void intel_dev_destroy(struct intel_dev *dev);
76
77void intel_dev_get_heap_props(const struct intel_dev *dev,
78 XGL_MEMORY_HEAP_PROPERTIES *props);
79
80XGL_RESULT intel_dev_add_msg_filter(struct intel_dev *dev,
81 XGL_INT msg_code,
82 XGL_DBG_MSG_FILTER filter);
83
84void intel_dev_remove_msg_filter(struct intel_dev *dev,
85 XGL_INT msg_code);
86
Chia-I Wu82d3d8b2014-08-09 13:07:44 +080087void intel_dev_log(struct intel_dev *dev,
88 XGL_DBG_MSG_TYPE msg_type,
89 XGL_VALIDATION_LEVEL validation_level,
Chia-I Wuaabb3602014-08-19 14:18:23 +080090 struct intel_base *src_object,
Chia-I Wu82d3d8b2014-08-09 13:07:44 +080091 XGL_SIZE location,
92 XGL_INT msg_code,
93 const char *format, ...);
94
Chia-I Wua207aba2014-08-05 15:13:37 +080095XGL_RESULT XGLAPI intelCreateDevice(
96 XGL_PHYSICAL_GPU gpu,
97 const XGL_DEVICE_CREATE_INFO* pCreateInfo,
98 XGL_DEVICE* pDevice);
99
100XGL_RESULT XGLAPI intelDestroyDevice(
101 XGL_DEVICE device);
102
103XGL_RESULT XGLAPI intelGetMemoryHeapCount(
104 XGL_DEVICE device,
105 XGL_UINT* pCount);
106
107XGL_RESULT XGLAPI intelGetMemoryHeapInfo(
108 XGL_DEVICE device,
109 XGL_UINT heapId,
110 XGL_MEMORY_HEAP_INFO_TYPE infoType,
111 XGL_SIZE* pDataSize,
112 XGL_VOID* pData);
113
Chia-I Wu49dbee82014-08-06 12:48:47 +0800114XGL_RESULT XGLAPI intelGetDeviceQueue(
115 XGL_DEVICE device,
116 XGL_QUEUE_TYPE queueType,
117 XGL_UINT queueIndex,
118 XGL_QUEUE* pQueue);
119
Chia-I Wu49dbee82014-08-06 12:48:47 +0800120XGL_RESULT XGLAPI intelDeviceWaitIdle(
121 XGL_DEVICE device);
122
Chia-I Wu7ec9f342014-08-19 10:47:53 +0800123XGL_RESULT XGLAPI intelDbgSetValidationLevel(
124 XGL_DEVICE device,
125 XGL_VALIDATION_LEVEL validationLevel);
126
127XGL_RESULT XGLAPI intelDbgSetMessageFilter(
128 XGL_DEVICE device,
129 XGL_INT msgCode,
130 XGL_DBG_MSG_FILTER filter);
131
132XGL_RESULT XGLAPI intelDbgSetDeviceOption(
133 XGL_DEVICE device,
134 XGL_DBG_DEVICE_OPTION dbgOption,
135 XGL_SIZE dataSize,
136 const XGL_VOID* pData);
137
Chia-I Wue54854a2014-08-05 10:23:50 +0800138#endif /* DEV_H */