Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +0800 | [diff] [blame] | 1 | /* |
| 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 Wu | 44e4236 | 2014-09-02 08:32:09 +0800 | [diff] [blame] | 23 | * |
| 24 | * Authors: |
| 25 | * Chia-I Wu <olv@lunarg.com> |
Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +0800 | [diff] [blame] | 26 | */ |
| 27 | |
| 28 | #ifndef IMG_H |
| 29 | #define IMG_H |
| 30 | |
Chia-I Wu | feb441f | 2014-08-08 21:27:38 +0800 | [diff] [blame] | 31 | #include "kmd/winsys.h" |
Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +0800 | [diff] [blame] | 32 | #include "intel.h" |
Chia-I Wu | 2b685d7 | 2014-08-14 13:45:37 +0800 | [diff] [blame] | 33 | #include "layout.h" |
Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +0800 | [diff] [blame] | 34 | #include "obj.h" |
| 35 | |
Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +0800 | [diff] [blame] | 36 | struct intel_img { |
| 37 | struct intel_obj obj; |
Chia-I Wu | feb441f | 2014-08-08 21:27:38 +0800 | [diff] [blame] | 38 | |
Chia-I Wu | eb2da59 | 2014-08-16 14:19:39 +0800 | [diff] [blame] | 39 | XGL_IMAGE_TYPE type; |
Chia-I Wu | 73e326f | 2014-08-21 11:07:57 +0800 | [diff] [blame] | 40 | XGL_INT depth; |
Chia-I Wu | eb2da59 | 2014-08-16 14:19:39 +0800 | [diff] [blame] | 41 | XGL_UINT array_size; |
| 42 | XGL_UINT samples; |
Chia-I Wu | 2b685d7 | 2014-08-14 13:45:37 +0800 | [diff] [blame] | 43 | struct intel_layout layout; |
Chia-I Wu | 9b752e1 | 2014-08-15 16:21:44 +0800 | [diff] [blame] | 44 | |
| 45 | /* layout of separate stencil */ |
| 46 | struct intel_layout *s8_layout; |
| 47 | |
| 48 | XGL_SIZE total_size; |
| 49 | XGL_SIZE aux_offset; |
| 50 | XGL_SIZE s8_offset; |
Chia-I Wu | 1db76e0 | 2014-09-15 14:21:14 +0800 | [diff] [blame^] | 51 | |
| 52 | #ifdef ENABLE_WSI_X11 |
| 53 | int x11_prime_fd; |
| 54 | uint32_t x11_pixmap; |
| 55 | #endif |
Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +0800 | [diff] [blame] | 56 | }; |
| 57 | |
Chia-I Wu | feb441f | 2014-08-08 21:27:38 +0800 | [diff] [blame] | 58 | static inline struct intel_img *intel_img(XGL_IMAGE image) |
| 59 | { |
| 60 | return (struct intel_img *) image; |
| 61 | } |
| 62 | |
| 63 | static inline struct intel_img *intel_img_from_base(struct intel_base *base) |
| 64 | { |
| 65 | return (struct intel_img *) base; |
| 66 | } |
| 67 | |
| 68 | static inline struct intel_img *intel_img_from_obj(struct intel_obj *obj) |
| 69 | { |
| 70 | return intel_img_from_base(&obj->base); |
| 71 | } |
| 72 | |
| 73 | XGL_RESULT intel_img_create(struct intel_dev *dev, |
| 74 | const XGL_IMAGE_CREATE_INFO *info, |
Chia-I Wu | 794d12a | 2014-09-15 14:55:25 +0800 | [diff] [blame] | 75 | bool scanout, |
Chia-I Wu | feb441f | 2014-08-08 21:27:38 +0800 | [diff] [blame] | 76 | struct intel_img **img_ret); |
| 77 | |
| 78 | void intel_img_destroy(struct intel_img *img); |
| 79 | |
Chia-I Wu | 251e7d9 | 2014-08-19 13:35:42 +0800 | [diff] [blame] | 80 | XGL_RESULT XGLAPI intelOpenPeerImage( |
| 81 | XGL_DEVICE device, |
| 82 | const XGL_PEER_IMAGE_OPEN_INFO* pOpenInfo, |
| 83 | XGL_IMAGE* pImage, |
| 84 | XGL_GPU_MEMORY* pMem); |
| 85 | |
Chia-I Wu | feb441f | 2014-08-08 21:27:38 +0800 | [diff] [blame] | 86 | XGL_RESULT XGLAPI intelCreateImage( |
| 87 | XGL_DEVICE device, |
| 88 | const XGL_IMAGE_CREATE_INFO* pCreateInfo, |
| 89 | XGL_IMAGE* pImage); |
| 90 | |
| 91 | XGL_RESULT XGLAPI intelGetImageSubresourceInfo( |
| 92 | XGL_IMAGE image, |
| 93 | const XGL_IMAGE_SUBRESOURCE* pSubresource, |
| 94 | XGL_SUBRESOURCE_INFO_TYPE infoType, |
| 95 | XGL_SIZE* pDataSize, |
| 96 | XGL_VOID* pData); |
| 97 | |
Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +0800 | [diff] [blame] | 98 | #endif /* IMG_H */ |