17ec681f3Smrg/************************************************************************** 27ec681f3Smrg * 37ec681f3Smrg * Copyright 2009, VMware, Inc. 47ec681f3Smrg * All Rights Reserved. 57ec681f3Smrg * 67ec681f3Smrg * Permission is hereby granted, free of charge, to any person obtaining a 77ec681f3Smrg * copy of this software and associated documentation files (the 87ec681f3Smrg * "Software"), to deal in the Software without restriction, including 97ec681f3Smrg * without limitation the rights to use, copy, modify, merge, publish, 107ec681f3Smrg * distribute, sub license, and/or sell copies of the Software, and to 117ec681f3Smrg * permit persons to whom the Software is furnished to do so, subject to 127ec681f3Smrg * the following conditions: 137ec681f3Smrg * 147ec681f3Smrg * The above copyright notice and this permission notice (including the 157ec681f3Smrg * next paragraph) shall be included in all copies or substantial portions 167ec681f3Smrg * of the Software. 177ec681f3Smrg * 187ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 197ec681f3Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 207ec681f3Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 217ec681f3Smrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 227ec681f3Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 237ec681f3Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 247ec681f3Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 257ec681f3Smrg * 267ec681f3Smrg **************************************************************************/ 277ec681f3Smrg 287ec681f3Smrg#ifndef DRI_DRAWABLE_H 297ec681f3Smrg#define DRI_DRAWABLE_H 307ec681f3Smrg 317ec681f3Smrg#include "pipe/p_compiler.h" 327ec681f3Smrg#include "pipe/p_format.h" 337ec681f3Smrg#include "frontend/api.h" 347ec681f3Smrg 357ec681f3Smrgstruct pipe_surface; 367ec681f3Smrgstruct st_framebuffer; 377ec681f3Smrgstruct dri_context; 387ec681f3Smrg 397ec681f3Smrgstruct dri_drawable 407ec681f3Smrg{ 417ec681f3Smrg struct st_framebuffer_iface base; 427ec681f3Smrg struct st_visual stvis; 437ec681f3Smrg 447ec681f3Smrg struct dri_screen *screen; 457ec681f3Smrg 467ec681f3Smrg /* dri */ 477ec681f3Smrg __DRIdrawable *dPriv; 487ec681f3Smrg __DRIscreen *sPriv; 497ec681f3Smrg 507ec681f3Smrg __DRIbuffer old[__DRI_BUFFER_COUNT]; 517ec681f3Smrg unsigned old_num; 527ec681f3Smrg unsigned old_w; 537ec681f3Smrg unsigned old_h; 547ec681f3Smrg 557ec681f3Smrg struct pipe_box *damage_rects; 567ec681f3Smrg unsigned int num_damage_rects; 577ec681f3Smrg 587ec681f3Smrg struct pipe_resource *textures[ST_ATTACHMENT_COUNT]; 597ec681f3Smrg struct pipe_resource *msaa_textures[ST_ATTACHMENT_COUNT]; 607ec681f3Smrg unsigned int texture_mask, texture_stamp; 617ec681f3Smrg 627ec681f3Smrg struct pipe_fence_handle *throttle_fence; 637ec681f3Smrg bool flushing; /* prevents recursion in dri_flush */ 647ec681f3Smrg 657ec681f3Smrg /* hooks filled in by dri2 & drisw */ 667ec681f3Smrg void (*allocate_textures)(struct dri_context *ctx, 677ec681f3Smrg struct dri_drawable *drawable, 687ec681f3Smrg const enum st_attachment_type *statts, 697ec681f3Smrg unsigned count); 707ec681f3Smrg 717ec681f3Smrg void (*update_drawable_info)(struct dri_drawable *drawable); 727ec681f3Smrg 737ec681f3Smrg bool (*flush_frontbuffer)(struct dri_context *ctx, 747ec681f3Smrg struct dri_drawable *drawable, 757ec681f3Smrg enum st_attachment_type statt); 767ec681f3Smrg 777ec681f3Smrg void (*update_tex_buffer)(struct dri_drawable *drawable, 787ec681f3Smrg struct dri_context *ctx, 797ec681f3Smrg struct pipe_resource *res); 807ec681f3Smrg void (*flush_swapbuffers)(struct dri_context *ctx, 817ec681f3Smrg struct dri_drawable *drawable); 827ec681f3Smrg}; 837ec681f3Smrg 847ec681f3Smrgstatic inline struct dri_drawable * 857ec681f3Smrgdri_drawable(__DRIdrawable * driDrawPriv) 867ec681f3Smrg{ 877ec681f3Smrg return (struct dri_drawable *) (driDrawPriv) 887ec681f3Smrg ? driDrawPriv->driverPrivate : NULL; 897ec681f3Smrg} 907ec681f3Smrg 917ec681f3Smrg/*********************************************************************** 927ec681f3Smrg * dri_drawable.c 937ec681f3Smrg */ 947ec681f3Smrgbool 957ec681f3Smrgdri_create_buffer(__DRIscreen * sPriv, 967ec681f3Smrg __DRIdrawable * dPriv, 977ec681f3Smrg const struct gl_config * visual, bool isPixmap); 987ec681f3Smrg 997ec681f3Smrgvoid dri_destroy_buffer(__DRIdrawable * dPriv); 1007ec681f3Smrg 1017ec681f3Smrgvoid 1027ec681f3Smrgdri_drawable_get_format(struct dri_drawable *drawable, 1037ec681f3Smrg enum st_attachment_type statt, 1047ec681f3Smrg enum pipe_format *format, 1057ec681f3Smrg unsigned *bind); 1067ec681f3Smrg 1077ec681f3Smrgvoid 1087ec681f3Smrgdri_pipe_blit(struct pipe_context *pipe, 1097ec681f3Smrg struct pipe_resource *dst, 1107ec681f3Smrg struct pipe_resource *src); 1117ec681f3Smrg 1127ec681f3Smrgvoid 1137ec681f3Smrgdri_flush(__DRIcontext *cPriv, 1147ec681f3Smrg __DRIdrawable *dPriv, 1157ec681f3Smrg unsigned flags, 1167ec681f3Smrg enum __DRI2throttleReason reason); 1177ec681f3Smrg 1187ec681f3Smrgextern const __DRItexBufferExtension driTexBufferExtension; 1197ec681f3Smrgextern const __DRI2throttleExtension dri2ThrottleExtension; 1207ec681f3Smrg#endif 1217ec681f3Smrg 1227ec681f3Smrg/* vim: set sw=3 ts=8 sts=3 expandtab: */ 123