amdgpu_glamor.h revision 90f2b693
1d6c0b56eSmrg/* 2d6c0b56eSmrg * Copyright © 2011 Intel Corporation. 3d6c0b56eSmrg * 2012 Advanced Micro Devices, Inc. 4d6c0b56eSmrg * 5d6c0b56eSmrg * Permission is hereby granted, free of charge, to any person 6d6c0b56eSmrg * obtaining a copy of this software and associated documentation 7d6c0b56eSmrg * files (the "Software"), to deal in the Software without 8d6c0b56eSmrg * restriction, including without limitation the rights to use, copy, 9d6c0b56eSmrg * modify, merge, publish, distribute, sublicense, and/or sell copies 10d6c0b56eSmrg * of the Software, and to permit persons to whom the Software is 11d6c0b56eSmrg * furnished to do so, subject to the following conditions: 12d6c0b56eSmrg * 13d6c0b56eSmrg * The above copyright notice and this permission notice (including 14d6c0b56eSmrg * the next paragraph) shall be included in all copies or substantial 15d6c0b56eSmrg * portions of the Software. 16d6c0b56eSmrg * 17d6c0b56eSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18d6c0b56eSmrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19d6c0b56eSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20d6c0b56eSmrg * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21d6c0b56eSmrg * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22d6c0b56eSmrg * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23d6c0b56eSmrg * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24d6c0b56eSmrg * DEALINGS IN THE SOFTWARE. 25d6c0b56eSmrg */ 26d6c0b56eSmrg 27d6c0b56eSmrg#ifndef AMDGPU_GLAMOR_H 28d6c0b56eSmrg#define AMDGPU_GLAMOR_H 29d6c0b56eSmrg 30d6c0b56eSmrg#include "xf86xv.h" 31d6c0b56eSmrg 3290f2b693Smrg#ifdef USE_GLAMOR 3390f2b693Smrg 34d6c0b56eSmrg#define GLAMOR_FOR_XORG 1 35d6c0b56eSmrg#include <glamor.h> 36d6c0b56eSmrg 37d6c0b56eSmrg#define AMDGPU_CREATE_PIXMAP_SHARED(usage) \ 38d6c0b56eSmrg ((usage) == AMDGPU_CREATE_PIXMAP_DRI2 || \ 39d6c0b56eSmrg (usage) == CREATE_PIXMAP_USAGE_SHARED) 40d6c0b56eSmrg 41d6c0b56eSmrg#ifndef GLAMOR_NO_DRI3 42d6c0b56eSmrg#define GLAMOR_NO_DRI3 0 43d6c0b56eSmrg#define glamor_fd_from_pixmap glamor_dri3_fd_from_pixmap 44d6c0b56eSmrg#define glamor_pixmap_from_fd glamor_egl_dri3_pixmap_from_fd 45d6c0b56eSmrg#endif 46d6c0b56eSmrg 47d6c0b56eSmrg#ifndef GLAMOR_INVERTED_Y_AXIS 48d6c0b56eSmrg#define GLAMOR_INVERTED_Y_AXIS 0 49d6c0b56eSmrg#endif 50d6c0b56eSmrg#ifndef GLAMOR_USE_SCREEN 51d6c0b56eSmrg#define GLAMOR_USE_SCREEN 0 52d6c0b56eSmrg#endif 53d6c0b56eSmrg#ifndef GLAMOR_USE_PICTURE_SCREEN 54d6c0b56eSmrg#define GLAMOR_USE_PICTURE_SCREEN 0 55d6c0b56eSmrg#endif 56d6c0b56eSmrg 57d6c0b56eSmrgstruct amdgpu_pixmap; 58d6c0b56eSmrg 59d6c0b56eSmrgBool amdgpu_glamor_pre_init(ScrnInfoPtr scrn); 60d6c0b56eSmrgBool amdgpu_glamor_init(ScreenPtr screen); 61d6c0b56eSmrgvoid amdgpu_glamor_fini(ScreenPtr screen); 62d6c0b56eSmrgvoid amdgpu_glamor_screen_init(ScreenPtr screen); 63d6c0b56eSmrgBool amdgpu_glamor_create_screen_resources(ScreenPtr screen); 64d6c0b56eSmrgvoid amdgpu_glamor_free_screen(int scrnIndex, int flags); 65d6c0b56eSmrg 66d6c0b56eSmrgvoid amdgpu_glamor_flush(ScrnInfoPtr pScrn); 67d6c0b56eSmrgvoid amdgpu_glamor_finish(ScrnInfoPtr pScrn); 68d6c0b56eSmrg 69d6c0b56eSmrgBool 70504d986fSmrgamdgpu_glamor_create_textured_pixmap(PixmapPtr pixmap, struct amdgpu_buffer *bo); 71d6c0b56eSmrgvoid amdgpu_glamor_exchange_buffers(PixmapPtr src, PixmapPtr dst); 72504d986fSmrgPixmapPtr amdgpu_glamor_set_pixmap_bo(DrawablePtr drawable, PixmapPtr pixmap); 73d6c0b56eSmrg 74d6c0b56eSmrgXF86VideoAdaptorPtr amdgpu_glamor_xv_init(ScreenPtr pScreen, int num_adapt); 75d6c0b56eSmrg 7690f2b693Smrg#else /* !USE_GLAMOR */ 7790f2b693Smrg 7890f2b693Smrgstatic inline Bool amdgpu_glamor_pre_init(ScrnInfoPtr scrn) { return FALSE; } 7990f2b693Smrgstatic inline Bool amdgpu_glamor_init(ScreenPtr screen) { return FALSE; } 8090f2b693Smrgstatic inline void amdgpu_glamor_fini(ScreenPtr screen) { } 8190f2b693Smrgstatic inline Bool amdgpu_glamor_create_screen_resources(ScreenPtr screen) { return FALSE; } 8290f2b693Smrg 8390f2b693Smrgstatic inline Bool amdgpu_glamor_create_textured_pixmap(PixmapPtr pixmap, struct amdgpu_buffer *bo) { return TRUE; } 8490f2b693Smrg 8590f2b693Smrgstatic inline void amdgpu_glamor_exchange_buffers(PixmapPtr src, PixmapPtr dst) {} 8690f2b693Smrgstatic inline PixmapPtr amdgpu_glamor_set_pixmap_bo(DrawablePtr drawable, PixmapPtr pixmap) { return pixmap; } 8790f2b693Smrg 8890f2b693Smrgstatic inline XF86VideoAdaptorPtr amdgpu_glamor_xv_init(ScreenPtr pScreen, int num_adapt) { return NULL; } 8990f2b693Smrg 9090f2b693Smrgstatic inline void amdgpu_glamor_flush(ScrnInfoPtr pScrn) { } 9190f2b693Smrgstatic inline void amdgpu_glamor_finish(ScrnInfoPtr pScrn) { } 9290f2b693Smrg 9390f2b693Smrg#endif /* USE_GLAMOR */ 9490f2b693Smrg 95d6c0b56eSmrg#endif /* AMDGPU_GLAMOR_H */ 96