1bf215546Sopenharmony_ci/************************************************************************** 2bf215546Sopenharmony_ci * 3bf215546Sopenharmony_ci * Copyright 2009, VMware, Inc. 4bf215546Sopenharmony_ci * All Rights Reserved. 5bf215546Sopenharmony_ci * 6bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 7bf215546Sopenharmony_ci * copy of this software and associated documentation files (the 8bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including 9bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish, 10bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to 11bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to 12bf215546Sopenharmony_ci * the following conditions: 13bf215546Sopenharmony_ci * 14bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the 15bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions 16bf215546Sopenharmony_ci * of the Software. 17bf215546Sopenharmony_ci * 18bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21bf215546Sopenharmony_ci * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22bf215546Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23bf215546Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24bf215546Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25bf215546Sopenharmony_ci * 26bf215546Sopenharmony_ci **************************************************************************/ 27bf215546Sopenharmony_ci 28bf215546Sopenharmony_ci#ifndef DRI_DRAWABLE_H 29bf215546Sopenharmony_ci#define DRI_DRAWABLE_H 30bf215546Sopenharmony_ci 31bf215546Sopenharmony_ci#include "pipe/p_compiler.h" 32bf215546Sopenharmony_ci#include "pipe/p_format.h" 33bf215546Sopenharmony_ci#include "frontend/api.h" 34bf215546Sopenharmony_ci#include "dri_util.h" 35bf215546Sopenharmony_ci 36bf215546Sopenharmony_cistruct pipe_surface; 37bf215546Sopenharmony_cistruct st_framebuffer; 38bf215546Sopenharmony_cistruct dri_context; 39bf215546Sopenharmony_ci 40bf215546Sopenharmony_cistruct dri_drawable 41bf215546Sopenharmony_ci{ 42bf215546Sopenharmony_ci struct st_framebuffer_iface base; 43bf215546Sopenharmony_ci struct st_visual stvis; 44bf215546Sopenharmony_ci 45bf215546Sopenharmony_ci struct dri_screen *screen; 46bf215546Sopenharmony_ci 47bf215546Sopenharmony_ci /* dri */ 48bf215546Sopenharmony_ci __DRIdrawable *dPriv; 49bf215546Sopenharmony_ci __DRIscreen *sPriv; 50bf215546Sopenharmony_ci 51bf215546Sopenharmony_ci __DRIbuffer old[__DRI_BUFFER_COUNT]; 52bf215546Sopenharmony_ci unsigned old_num; 53bf215546Sopenharmony_ci unsigned old_w; 54bf215546Sopenharmony_ci unsigned old_h; 55bf215546Sopenharmony_ci 56bf215546Sopenharmony_ci struct pipe_box *damage_rects; 57bf215546Sopenharmony_ci unsigned int num_damage_rects; 58bf215546Sopenharmony_ci 59bf215546Sopenharmony_ci struct pipe_resource *textures[ST_ATTACHMENT_COUNT]; 60bf215546Sopenharmony_ci struct pipe_resource *msaa_textures[ST_ATTACHMENT_COUNT]; 61bf215546Sopenharmony_ci unsigned int texture_mask, texture_stamp; 62bf215546Sopenharmony_ci int swap_interval; 63bf215546Sopenharmony_ci 64bf215546Sopenharmony_ci struct pipe_fence_handle *throttle_fence; 65bf215546Sopenharmony_ci bool flushing; /* prevents recursion in dri_flush */ 66bf215546Sopenharmony_ci 67bf215546Sopenharmony_ci /* hooks filled in by dri2 & drisw */ 68bf215546Sopenharmony_ci void (*allocate_textures)(struct dri_context *ctx, 69bf215546Sopenharmony_ci struct dri_drawable *drawable, 70bf215546Sopenharmony_ci const enum st_attachment_type *statts, 71bf215546Sopenharmony_ci unsigned count); 72bf215546Sopenharmony_ci 73bf215546Sopenharmony_ci void (*update_drawable_info)(struct dri_drawable *drawable); 74bf215546Sopenharmony_ci 75bf215546Sopenharmony_ci bool (*flush_frontbuffer)(struct dri_context *ctx, 76bf215546Sopenharmony_ci struct dri_drawable *drawable, 77bf215546Sopenharmony_ci enum st_attachment_type statt); 78bf215546Sopenharmony_ci 79bf215546Sopenharmony_ci void (*update_tex_buffer)(struct dri_drawable *drawable, 80bf215546Sopenharmony_ci struct dri_context *ctx, 81bf215546Sopenharmony_ci struct pipe_resource *res); 82bf215546Sopenharmony_ci void (*flush_swapbuffers)(struct dri_context *ctx, 83bf215546Sopenharmony_ci struct dri_drawable *drawable); 84bf215546Sopenharmony_ci}; 85bf215546Sopenharmony_ci 86bf215546Sopenharmony_cistatic inline struct dri_drawable * 87bf215546Sopenharmony_cidri_drawable(__DRIdrawable * driDrawPriv) 88bf215546Sopenharmony_ci{ 89bf215546Sopenharmony_ci return (struct dri_drawable *) (driDrawPriv) 90bf215546Sopenharmony_ci ? driDrawPriv->driverPrivate : NULL; 91bf215546Sopenharmony_ci} 92bf215546Sopenharmony_ci 93bf215546Sopenharmony_ci/*********************************************************************** 94bf215546Sopenharmony_ci * dri_drawable.c 95bf215546Sopenharmony_ci */ 96bf215546Sopenharmony_cibool 97bf215546Sopenharmony_cidri_create_buffer(__DRIscreen * sPriv, 98bf215546Sopenharmony_ci __DRIdrawable * dPriv, 99bf215546Sopenharmony_ci const struct gl_config * visual, bool isPixmap); 100bf215546Sopenharmony_ci 101bf215546Sopenharmony_civoid dri_destroy_buffer(__DRIdrawable * dPriv); 102bf215546Sopenharmony_ci 103bf215546Sopenharmony_civoid 104bf215546Sopenharmony_cidri_drawable_get_format(struct dri_drawable *drawable, 105bf215546Sopenharmony_ci enum st_attachment_type statt, 106bf215546Sopenharmony_ci enum pipe_format *format, 107bf215546Sopenharmony_ci unsigned *bind); 108bf215546Sopenharmony_ci 109bf215546Sopenharmony_civoid 110bf215546Sopenharmony_cidri_pipe_blit(struct pipe_context *pipe, 111bf215546Sopenharmony_ci struct pipe_resource *dst, 112bf215546Sopenharmony_ci struct pipe_resource *src); 113bf215546Sopenharmony_ci 114bf215546Sopenharmony_civoid 115bf215546Sopenharmony_cidri_flush(__DRIcontext *cPriv, 116bf215546Sopenharmony_ci __DRIdrawable *dPriv, 117bf215546Sopenharmony_ci unsigned flags, 118bf215546Sopenharmony_ci enum __DRI2throttleReason reason); 119bf215546Sopenharmony_ci 120bf215546Sopenharmony_ciextern const __DRItexBufferExtension driTexBufferExtension; 121bf215546Sopenharmony_ciextern const __DRI2throttleExtension dri2ThrottleExtension; 122bf215546Sopenharmony_ci#endif 123bf215546Sopenharmony_ci 124bf215546Sopenharmony_ci/* vim: set sw=3 ts=8 sts=3 expandtab: */ 125