blob: a4785369cc90ffa9cf607c5c0a27a5d46abb9ede [file] [log] [blame]
Chia-I Wue46da3e2014-08-08 21:52:48 +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 Wue46da3e2014-08-08 21:52:48 +080026 */
27
28#ifndef IMG_H
29#define IMG_H
30
Chia-I Wufeb441f2014-08-08 21:27:38 +080031#include "kmd/winsys.h"
Chia-I Wue46da3e2014-08-08 21:52:48 +080032#include "intel.h"
Chia-I Wu2b685d72014-08-14 13:45:37 +080033#include "layout.h"
Chia-I Wue46da3e2014-08-08 21:52:48 +080034#include "obj.h"
35
Chia-I Wue46da3e2014-08-08 21:52:48 +080036struct intel_img {
37 struct intel_obj obj;
Chia-I Wufeb441f2014-08-08 21:27:38 +080038
Chia-I Wueb2da592014-08-16 14:19:39 +080039 XGL_IMAGE_TYPE type;
Chia-I Wu73e326f2014-08-21 11:07:57 +080040 XGL_INT depth;
Chia-I Wuaa759372014-10-18 12:47:35 +080041 XGL_UINT mip_levels;
Chia-I Wueb2da592014-08-16 14:19:39 +080042 XGL_UINT array_size;
43 XGL_UINT samples;
Chia-I Wu2b685d72014-08-14 13:45:37 +080044 struct intel_layout layout;
Chia-I Wu9b752e12014-08-15 16:21:44 +080045
46 /* layout of separate stencil */
47 struct intel_layout *s8_layout;
48
49 XGL_SIZE total_size;
50 XGL_SIZE aux_offset;
51 XGL_SIZE s8_offset;
Chia-I Wu1db76e02014-09-15 14:21:14 +080052
53#ifdef ENABLE_WSI_X11
54 int x11_prime_fd;
55 uint32_t x11_pixmap;
56#endif
Chia-I Wue46da3e2014-08-08 21:52:48 +080057};
58
Chia-I Wufeb441f2014-08-08 21:27:38 +080059static inline struct intel_img *intel_img(XGL_IMAGE image)
60{
61 return (struct intel_img *) image;
62}
63
64static inline struct intel_img *intel_img_from_base(struct intel_base *base)
65{
66 return (struct intel_img *) base;
67}
68
69static inline struct intel_img *intel_img_from_obj(struct intel_obj *obj)
70{
71 return intel_img_from_base(&obj->base);
72}
73
74XGL_RESULT intel_img_create(struct intel_dev *dev,
75 const XGL_IMAGE_CREATE_INFO *info,
Chia-I Wu794d12a2014-09-15 14:55:25 +080076 bool scanout,
Chia-I Wufeb441f2014-08-08 21:27:38 +080077 struct intel_img **img_ret);
78
79void intel_img_destroy(struct intel_img *img);
80
Chia-I Wu251e7d92014-08-19 13:35:42 +080081XGL_RESULT XGLAPI intelOpenPeerImage(
82 XGL_DEVICE device,
83 const XGL_PEER_IMAGE_OPEN_INFO* pOpenInfo,
84 XGL_IMAGE* pImage,
85 XGL_GPU_MEMORY* pMem);
86
Chia-I Wufeb441f2014-08-08 21:27:38 +080087XGL_RESULT XGLAPI intelCreateImage(
88 XGL_DEVICE device,
89 const XGL_IMAGE_CREATE_INFO* pCreateInfo,
90 XGL_IMAGE* pImage);
91
92XGL_RESULT XGLAPI intelGetImageSubresourceInfo(
93 XGL_IMAGE image,
94 const XGL_IMAGE_SUBRESOURCE* pSubresource,
95 XGL_SUBRESOURCE_INFO_TYPE infoType,
96 XGL_SIZE* pDataSize,
97 XGL_VOID* pData);
98
Chia-I Wue46da3e2014-08-08 21:52:48 +080099#endif /* IMG_H */