blob: 76ee90d5a8294d22e0ceef97e36378cb0ad14076 [file] [log] [blame]
Chia-I Wu214dac62014-08-05 11:07:40 +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.
Chia-I Wu44e42362014-09-02 08:32:09 +080023 *
24 * Authors:
25 * Chia-I Wu <olv@lunarg.com>
Chia-I Wu214dac62014-08-05 11:07:40 +080026 */
27
28#include <stdio.h>
29#include <sys/types.h>
30#include <sys/stat.h>
31#include <fcntl.h>
32#include <unistd.h>
33
34#include "genhw/genhw.h"
Chia-I Wud8965932014-10-13 13:32:37 +080035#include "kmd/winsys.h"
Chia-I Wuec841722014-08-25 22:36:01 +080036#include "queue.h"
Chia-I Wu214dac62014-08-05 11:07:40 +080037#include "gpu.h"
Chia-I Wu1db76e02014-09-15 14:21:14 +080038#include "wsi_x11.h"
39
40static struct intel_gpu *intel_gpus;
41
Chia-I Wu1076a872015-01-18 16:02:55 +080042static const char * const intel_gpu_exts[INTEL_EXT_COUNT] = {
Chia-I Wu1db76e02014-09-15 14:21:14 +080043#ifdef ENABLE_WSI_X11
44 [INTEL_EXT_WSI_X11] = "XGL_WSI_X11",
45#endif
46};
Chia-I Wu214dac62014-08-05 11:07:40 +080047
Chia-I Wuf07865e2014-09-15 13:52:21 +080048static int gpu_open_primary_node(struct intel_gpu *gpu)
49{
50 /* cannot not open gpu->primary_node directly */
51 return gpu->primary_fd_internal;
52}
53
54static void gpu_close_primary_node(struct intel_gpu *gpu)
55{
Chia-I Wu1db76e02014-09-15 14:21:14 +080056 if (gpu->primary_fd_internal >= 0)
Chia-I Wuf07865e2014-09-15 13:52:21 +080057 gpu->primary_fd_internal = -1;
Chia-I Wuf07865e2014-09-15 13:52:21 +080058}
59
60static int gpu_open_render_node(struct intel_gpu *gpu)
61{
62 if (gpu->render_fd_internal < 0 && gpu->render_node) {
63 gpu->render_fd_internal = open(gpu->render_node, O_RDWR);
64 if (gpu->render_fd_internal < 0) {
65 icd_log(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0,
66 0, "failed to open %s", gpu->render_node);
67 }
68 }
69
70 return gpu->render_fd_internal;
71}
72
73static void gpu_close_render_node(struct intel_gpu *gpu)
74{
75 if (gpu->render_fd_internal >= 0) {
76 close(gpu->render_fd_internal);
77 gpu->render_fd_internal = -1;
78 }
79}
80
Chia-I Wu214dac62014-08-05 11:07:40 +080081static const char *gpu_get_name(const struct intel_gpu *gpu)
82{
83 const char *name = NULL;
84
85 if (gen_is_hsw(gpu->devid)) {
86 if (gen_is_desktop(gpu->devid))
87 name = "Intel(R) Haswell Desktop";
88 else if (gen_is_mobile(gpu->devid))
89 name = "Intel(R) Haswell Mobile";
90 else if (gen_is_server(gpu->devid))
91 name = "Intel(R) Haswell Server";
92 }
93 else if (gen_is_ivb(gpu->devid)) {
94 if (gen_is_desktop(gpu->devid))
95 name = "Intel(R) Ivybridge Desktop";
96 else if (gen_is_mobile(gpu->devid))
97 name = "Intel(R) Ivybridge Mobile";
98 else if (gen_is_server(gpu->devid))
99 name = "Intel(R) Ivybridge Server";
100 }
101 else if (gen_is_snb(gpu->devid)) {
102 if (gen_is_desktop(gpu->devid))
103 name = "Intel(R) Sandybridge Desktop";
104 else if (gen_is_mobile(gpu->devid))
105 name = "Intel(R) Sandybridge Mobile";
106 else if (gen_is_server(gpu->devid))
107 name = "Intel(R) Sandybridge Server";
108 }
109
110 if (!name)
111 name = "Unknown Intel Chipset";
112
113 return name;
114}
115
Chia-I Wuf07865e2014-09-15 13:52:21 +0800116static struct intel_gpu *gpu_create(int gen, int devid,
117 const char *primary_node,
118 const char *render_node)
Chia-I Wu214dac62014-08-05 11:07:40 +0800119{
120 struct intel_gpu *gpu;
Chia-I Wuf07865e2014-09-15 13:52:21 +0800121 size_t primary_len, render_len;
Chia-I Wu214dac62014-08-05 11:07:40 +0800122
123 gpu = icd_alloc(sizeof(*gpu), 0, XGL_SYSTEM_ALLOC_API_OBJECT);
124 if (!gpu)
125 return NULL;
126
127 memset(gpu, 0, sizeof(*gpu));
128
Chia-I Wu214dac62014-08-05 11:07:40 +0800129 gpu->devid = devid;
130
Chia-I Wuf07865e2014-09-15 13:52:21 +0800131 primary_len = strlen(primary_node);
132 render_len = (render_node) ? strlen(render_node) : 0;
133
134 gpu->primary_node = icd_alloc(primary_len + 1 +
135 ((render_len) ? (render_len + 1) : 0), 0, XGL_SYSTEM_ALLOC_INTERNAL);
136 if (!gpu->primary_node) {
Chia-I Wu214dac62014-08-05 11:07:40 +0800137 icd_free(gpu);
138 return NULL;
139 }
Chia-I Wuf07865e2014-09-15 13:52:21 +0800140
141 memcpy(gpu->primary_node, primary_node, primary_len + 1);
142
143 if (render_node) {
144 gpu->render_node = gpu->primary_node + primary_len + 1;
145 memcpy(gpu->render_node, render_node, render_len + 1);
146 }
Chia-I Wu214dac62014-08-05 11:07:40 +0800147
148 gpu->gen_opaque = gen;
149
Chia-I Wu960f1952014-08-28 23:27:10 +0800150 switch (intel_gpu_gen(gpu)) {
151 case INTEL_GEN(7.5):
152 gpu->gt = gen_get_hsw_gt(devid);
153 break;
154 case INTEL_GEN(7):
155 gpu->gt = gen_get_ivb_gt(devid);
156 break;
157 case INTEL_GEN(6):
158 gpu->gt = gen_get_snb_gt(devid);
159 break;
160 }
161
Mike Stroyan9fca7122015-02-09 13:08:26 -0700162 /* 150K dwords */
163 gpu->max_batch_buffer_size = sizeof(uint32_t) * 150*1024;
Chia-I Wud6109bb2014-08-21 09:12:19 +0800164
165 /* the winsys is prepared for one reloc every two dwords, then minus 2 */
166 gpu->batch_buffer_reloc_count =
167 gpu->max_batch_buffer_size / sizeof(uint32_t) / 2 - 2;
Chia-I Wu214dac62014-08-05 11:07:40 +0800168
Chia-I Wuf07865e2014-09-15 13:52:21 +0800169 gpu->primary_fd_internal = -1;
170 gpu->render_fd_internal = -1;
171
Chia-I Wu214dac62014-08-05 11:07:40 +0800172 return gpu;
173}
174
175static void gpu_destroy(struct intel_gpu *gpu)
176{
Chia-I Wuf07865e2014-09-15 13:52:21 +0800177 intel_gpu_close(gpu);
Chia-I Wu1db76e02014-09-15 14:21:14 +0800178
179#ifdef ENABLE_WSI_X11
180 if (gpu->x11)
181 intel_wsi_x11_destroy(gpu->x11);
182#endif
183
Chia-I Wuf07865e2014-09-15 13:52:21 +0800184 icd_free(gpu->primary_node);
Chia-I Wu214dac62014-08-05 11:07:40 +0800185 icd_free(gpu);
186}
187
Chia-I Wu214dac62014-08-05 11:07:40 +0800188/**
189 * Return true if \p gpu is a valid intel_gpu.
190 */
191bool intel_gpu_is_valid(const struct intel_gpu *gpu)
192{
193 const struct intel_gpu *iter = intel_gpus;
194
195 while (iter) {
196 if (iter == gpu)
197 return true;
198 iter = iter->next;
199 }
200
201 return false;
202}
203
204static int devid_to_gen(int devid)
205{
206 int gen;
207
208 if (gen_is_hsw(devid))
209 gen = INTEL_GEN(7.5);
210 else if (gen_is_ivb(devid))
211 gen = INTEL_GEN(7);
212 else if (gen_is_snb(devid))
213 gen = INTEL_GEN(6);
214 else
215 gen = -1;
216
Chia-I Wubfce58e2014-08-28 23:23:33 +0800217#ifdef INTEL_GEN_SPECIALIZED
218 if (gen != INTEL_GEN(INTEL_GEN_SPECIALIZED))
219 gen = -1;
220#endif
221
Chia-I Wu214dac62014-08-05 11:07:40 +0800222 return gen;
223}
224
Chia-I Wuf07865e2014-09-15 13:52:21 +0800225XGL_RESULT intel_gpu_add(int devid, const char *primary_node,
226 const char *render_node, struct intel_gpu **gpu_ret)
Chia-I Wu214dac62014-08-05 11:07:40 +0800227{
228 const int gen = devid_to_gen(devid);
229 struct intel_gpu *gpu;
230
231 if (gen < 0) {
232 icd_log(XGL_DBG_MSG_WARNING, XGL_VALIDATION_LEVEL_0, XGL_NULL_HANDLE,
233 0, 0, "unsupported device id 0x%04x", devid);
234 return XGL_ERROR_INITIALIZATION_FAILED;
235 }
236
Chia-I Wuf07865e2014-09-15 13:52:21 +0800237 gpu = gpu_create(gen, devid, primary_node, render_node);
Chia-I Wu214dac62014-08-05 11:07:40 +0800238 if (!gpu)
239 return XGL_ERROR_OUT_OF_MEMORY;
240
241 gpu->next = intel_gpus;
242 intel_gpus = gpu;
243
244 *gpu_ret = gpu;
245
246 return XGL_SUCCESS;
247}
248
249void intel_gpu_remove_all(void)
250{
251 struct intel_gpu *gpu = intel_gpus;
252
253 while (gpu) {
254 struct intel_gpu *next = gpu->next;
255
256 gpu_destroy(gpu);
257 gpu = next;
258 }
259
260 intel_gpus = NULL;
261}
262
263struct intel_gpu *intel_gpu_get_list(void)
264{
265 return intel_gpus;
266}
267
268void intel_gpu_get_props(const struct intel_gpu *gpu,
269 XGL_PHYSICAL_GPU_PROPERTIES *props)
270{
271 const char *name;
272 size_t name_len;
273
Chia-I Wu214dac62014-08-05 11:07:40 +0800274 props->apiVersion = INTEL_API_VERSION;
275 props->driverVersion = INTEL_DRIVER_VERSION;
276
277 props->vendorId = 0x8086;
278 props->deviceId = gpu->devid;
279
280 props->gpuType = XGL_GPU_TYPE_INTEGRATED;
281
282 /* copy GPU name */
283 name = gpu_get_name(gpu);
284 name_len = strlen(name);
285 if (name_len > sizeof(props->gpuName) - 1)
286 name_len = sizeof(props->gpuName) - 1;
287 memcpy(props->gpuName, name, name_len);
288 props->gpuName[name_len] = '\0';
289
Chia-I Wud6109bb2014-08-21 09:12:19 +0800290 props->maxMemRefsPerSubmission = gpu->batch_buffer_reloc_count;
Chia-I Wu214dac62014-08-05 11:07:40 +0800291
Chia-I Wu214dac62014-08-05 11:07:40 +0800292 /* no size limit, but no bounded buffer could exceed 2GB */
293 props->maxInlineMemoryUpdateSize = 2u << 30;
294
295 props->maxBoundDescriptorSets = 1;
296 props->maxThreadGroupSize = 512;
297
298 /* incremented every 80ns */
299 props->timestampFrequency = 1000 * 1000 * 1000 / 80;
300
301 props->multiColorAttachmentClears = false;
302}
303
304void intel_gpu_get_perf(const struct intel_gpu *gpu,
305 XGL_PHYSICAL_GPU_PERFORMANCE *perf)
306{
307 /* TODO */
308 perf->maxGpuClock = 1.0f;
309 perf->aluPerClock = 1.0f;
310 perf->texPerClock = 1.0f;
311 perf->primsPerClock = 1.0f;
312 perf->pixelsPerClock = 1.0f;
313}
314
315void intel_gpu_get_queue_props(const struct intel_gpu *gpu,
316 enum intel_gpu_engine_type engine,
317 XGL_PHYSICAL_GPU_QUEUE_PROPERTIES *props)
318{
Chia-I Wu214dac62014-08-05 11:07:40 +0800319 switch (engine) {
320 case INTEL_GPU_ENGINE_3D:
321 props->queueFlags = XGL_QUEUE_GRAPHICS_BIT | XGL_QUEUE_COMPUTE_BIT;
322 props->queueCount = 1;
Chia-I Wuec841722014-08-25 22:36:01 +0800323 props->maxAtomicCounters = INTEL_QUEUE_ATOMIC_COUNTER_COUNT;
Chia-I Wu214dac62014-08-05 11:07:40 +0800324 props->supportsTimestamps = true;
325 break;
326 default:
327 assert(!"unknown engine type");
328 return;
329 }
330}
331
332void intel_gpu_get_memory_props(const struct intel_gpu *gpu,
333 XGL_PHYSICAL_GPU_MEMORY_PROPERTIES *props)
334{
Chia-I Wu214dac62014-08-05 11:07:40 +0800335 props->supportsMigration = false;
336
Chia-I Wu54c0c4b2014-08-06 13:48:25 +0800337 /* no winsys support for DRM_I915_GEM_USERPTR yet */
338 props->supportsPinning = false;
Chia-I Wu214dac62014-08-05 11:07:40 +0800339}
340
Chia-I Wu3f4bd102014-12-19 13:14:42 +0800341int intel_gpu_get_max_threads(const struct intel_gpu *gpu,
342 XGL_PIPELINE_SHADER_STAGE stage)
343{
344 switch (intel_gpu_gen(gpu)) {
345 case INTEL_GEN(7.5):
346 switch (stage) {
347 case XGL_SHADER_STAGE_VERTEX:
348 return (gpu->gt >= 2) ? 280 : 70;
349 case XGL_SHADER_STAGE_FRAGMENT:
350 return (gpu->gt == 3) ? 408 :
351 (gpu->gt == 2) ? 204 : 102;
352 default:
353 break;
354 }
355 break;
356 case INTEL_GEN(7):
357 switch (stage) {
358 case XGL_SHADER_STAGE_VERTEX:
359 return (gpu->gt == 2) ? 128 : 36;
360 case XGL_SHADER_STAGE_FRAGMENT:
361 return (gpu->gt == 2) ? 172 : 48;
362 default:
363 break;
364 }
365 break;
366 case INTEL_GEN(6):
367 switch (stage) {
368 case XGL_SHADER_STAGE_VERTEX:
369 return (gpu->gt == 2) ? 60 : 24;
370 case XGL_SHADER_STAGE_FRAGMENT:
371 return (gpu->gt == 2) ? 80 : 40;
372 default:
373 break;
374 }
375 break;
376 default:
377 break;
378 }
379
380 icd_log(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, XGL_NULL_HANDLE,
381 0, 0, "unknown Gen or shader stage");
382
383 switch (stage) {
384 case XGL_SHADER_STAGE_VERTEX:
385 return 1;
386 case XGL_SHADER_STAGE_FRAGMENT:
387 return 4;
388 default:
389 return 1;
390 }
391}
392
Chia-I Wu1db76e02014-09-15 14:21:14 +0800393void intel_gpu_associate_x11(struct intel_gpu *gpu,
394 struct intel_wsi_x11 *x11,
395 int fd)
396{
397#ifdef ENABLE_WSI_X11
398 gpu->x11 = x11;
399 gpu->primary_fd_internal = fd;
400#endif
401}
402
Chia-I Wu214dac62014-08-05 11:07:40 +0800403XGL_RESULT intel_gpu_open(struct intel_gpu *gpu)
404{
Chia-I Wud8965932014-10-13 13:32:37 +0800405 int fd;
Chia-I Wu214dac62014-08-05 11:07:40 +0800406
Chia-I Wud8965932014-10-13 13:32:37 +0800407 assert(!gpu->winsys);
408
409 fd = gpu_open_primary_node(gpu);
410 if (fd < 0)
411 fd = gpu_open_render_node(gpu);
412 if (fd < 0)
413 return XGL_ERROR_UNKNOWN;
414
415 gpu->winsys = intel_winsys_create_for_fd(fd);
416 if (!gpu->winsys) {
417 icd_log(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, XGL_NULL_HANDLE,
418 0, 0, "failed to create GPU winsys");
419 intel_gpu_close(gpu);
420 return XGL_ERROR_UNKNOWN;
421 }
422
423 return XGL_SUCCESS;
Chia-I Wu214dac62014-08-05 11:07:40 +0800424}
425
426void intel_gpu_close(struct intel_gpu *gpu)
427{
Chia-I Wud8965932014-10-13 13:32:37 +0800428 if (gpu->winsys) {
429 intel_winsys_destroy(gpu->winsys);
430 gpu->winsys = NULL;
431 }
432
Chia-I Wuf07865e2014-09-15 13:52:21 +0800433 gpu_close_primary_node(gpu);
434 gpu_close_render_node(gpu);
Chia-I Wu214dac62014-08-05 11:07:40 +0800435}
436
Chia-I Wu1db76e02014-09-15 14:21:14 +0800437enum intel_ext_type intel_gpu_lookup_extension(const struct intel_gpu *gpu,
438 const char *ext)
Chia-I Wu214dac62014-08-05 11:07:40 +0800439{
Chia-I Wu1db76e02014-09-15 14:21:14 +0800440 enum intel_ext_type type;
441
442 for (type = 0; type < ARRAY_SIZE(intel_gpu_exts); type++) {
443 if (intel_gpu_exts[type] && strcmp(intel_gpu_exts[type], ext) == 0)
444 break;
445 }
446
447 assert(type < INTEL_EXT_COUNT || type == INTEL_EXT_INVALID);
448
449 return type;
Chia-I Wu214dac62014-08-05 11:07:40 +0800450}
Chia-I Wubec90a02014-08-06 12:33:03 +0800451
Chia-I Wu96177272015-01-03 15:27:41 +0800452ICD_EXPORT XGL_RESULT XGLAPI xglGetGpuInfo(
Chia-I Wubec90a02014-08-06 12:33:03 +0800453 XGL_PHYSICAL_GPU gpu_,
454 XGL_PHYSICAL_GPU_INFO_TYPE infoType,
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600455 size_t* pDataSize,
456 void* pData)
Chia-I Wubec90a02014-08-06 12:33:03 +0800457{
458 const struct intel_gpu *gpu = intel_gpu(gpu_);
459 XGL_RESULT ret = XGL_SUCCESS;
460
461 switch (infoType) {
462 case XGL_INFO_TYPE_PHYSICAL_GPU_PROPERTIES:
Chia-I Wubec90a02014-08-06 12:33:03 +0800463 *pDataSize = sizeof(XGL_PHYSICAL_GPU_PROPERTIES);
Jon Ashburn408daec2014-12-05 09:23:52 -0700464 if (pData == NULL) {
465 return ret;
466 }
Chia-I Wubec90a02014-08-06 12:33:03 +0800467 intel_gpu_get_props(gpu, pData);
468 break;
469
470 case XGL_INFO_TYPE_PHYSICAL_GPU_PERFORMANCE:
Chia-I Wubec90a02014-08-06 12:33:03 +0800471 *pDataSize = sizeof(XGL_PHYSICAL_GPU_PERFORMANCE);
Jon Ashburn408daec2014-12-05 09:23:52 -0700472 if (pData == NULL) {
473 return ret;
474 }
Chia-I Wubec90a02014-08-06 12:33:03 +0800475 intel_gpu_get_perf(gpu, pData);
476 break;
477
478 case XGL_INFO_TYPE_PHYSICAL_GPU_QUEUE_PROPERTIES:
479 /*
480 * XGL Programmers guide, page 33:
481 * to determine the data size an application calls
482 * xglGetGpuInfo() with a NULL data pointer. The
483 * expected data size for all queue property structures
484 * is returned in pDataSize
485 */
486 *pDataSize = sizeof(XGL_PHYSICAL_GPU_QUEUE_PROPERTIES) *
487 INTEL_GPU_ENGINE_COUNT;
488 if (pData != NULL) {
489 XGL_PHYSICAL_GPU_QUEUE_PROPERTIES *dst = pData;
490 int engine;
491
492 for (engine = 0; engine < INTEL_GPU_ENGINE_COUNT; engine++) {
493 intel_gpu_get_queue_props(gpu, engine, dst);
494 dst++;
495 }
496 }
497 break;
498
499 case XGL_INFO_TYPE_PHYSICAL_GPU_MEMORY_PROPERTIES:
Chia-I Wubec90a02014-08-06 12:33:03 +0800500 *pDataSize = sizeof(XGL_PHYSICAL_GPU_MEMORY_PROPERTIES);
Jon Ashburn408daec2014-12-05 09:23:52 -0700501 if (pData == NULL) {
502 return ret;
503 }
Chia-I Wubec90a02014-08-06 12:33:03 +0800504 intel_gpu_get_memory_props(gpu, pData);
505 break;
506
507 default:
508 ret = XGL_ERROR_INVALID_VALUE;
509 }
510
511 return ret;
512}
513
Chia-I Wu96177272015-01-03 15:27:41 +0800514ICD_EXPORT XGL_RESULT XGLAPI xglGetExtensionSupport(
Chia-I Wubec90a02014-08-06 12:33:03 +0800515 XGL_PHYSICAL_GPU gpu_,
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600516 const char* pExtName)
Chia-I Wubec90a02014-08-06 12:33:03 +0800517{
518 struct intel_gpu *gpu = intel_gpu(gpu_);
Chia-I Wu7461fcf2014-12-27 15:16:07 +0800519 const enum intel_ext_type ext = intel_gpu_lookup_extension(gpu, pExtName);
Chia-I Wubec90a02014-08-06 12:33:03 +0800520
Chia-I Wu1db76e02014-09-15 14:21:14 +0800521 return (ext != INTEL_EXT_INVALID) ?
Chia-I Wubec90a02014-08-06 12:33:03 +0800522 XGL_SUCCESS : XGL_ERROR_INVALID_EXTENSION;
523}
Chia-I Wu251e7d92014-08-19 13:35:42 +0800524
Chia-I Wu96177272015-01-03 15:27:41 +0800525ICD_EXPORT XGL_RESULT XGLAPI xglGetMultiGpuCompatibility(
Chia-I Wu452f5e82014-08-31 12:39:05 +0800526 XGL_PHYSICAL_GPU gpu0_,
527 XGL_PHYSICAL_GPU gpu1_,
Chia-I Wu251e7d92014-08-19 13:35:42 +0800528 XGL_GPU_COMPATIBILITY_INFO* pInfo)
529{
Chia-I Wu452f5e82014-08-31 12:39:05 +0800530 const struct intel_gpu *gpu0 = intel_gpu(gpu0_);
531 const struct intel_gpu *gpu1 = intel_gpu(gpu1_);
532 XGL_FLAGS compat = XGL_GPU_COMPAT_IQ_MATCH_BIT |
533 XGL_GPU_COMPAT_PEER_TRANSFER_BIT |
534 XGL_GPU_COMPAT_SHARED_MEMORY_BIT |
535 XGL_GPU_COMPAT_SHARED_GPU0_DISPLAY_BIT |
536 XGL_GPU_COMPAT_SHARED_GPU1_DISPLAY_BIT;
537
538 if (intel_gpu_gen(gpu0) == intel_gpu_gen(gpu1))
539 compat |= XGL_GPU_COMPAT_ASIC_FEATURES_BIT;
540
541 pInfo->compatibilityFlags = compat;
542
543 return XGL_SUCCESS;
Chia-I Wu251e7d92014-08-19 13:35:42 +0800544}