13bfa90b6Smrg/*
23bfa90b6Smrg * Copyright 2011 VMWare, Inc.
33bfa90b6Smrg * All Rights Reserved.
43bfa90b6Smrg *
53bfa90b6Smrg * Permission is hereby granted, free of charge, to any person obtaining a
63bfa90b6Smrg * copy of this software and associated documentation files (the
73bfa90b6Smrg * "Software"), to deal in the Software without restriction, including
83bfa90b6Smrg * without limitation the rights to use, copy, modify, merge, publish,
93bfa90b6Smrg * distribute, sub license, and/or sell copies of the Software, and to
103bfa90b6Smrg * permit persons to whom the Software is furnished to do so, subject to
113bfa90b6Smrg * the following conditions:
123bfa90b6Smrg *
133bfa90b6Smrg * The above copyright notice and this permission notice (including the
143bfa90b6Smrg * next paragraph) shall be included in all copies or substantial portions
153bfa90b6Smrg * of the Software.
163bfa90b6Smrg *
173bfa90b6Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
183bfa90b6Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
193bfa90b6Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
203bfa90b6Smrg * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
213bfa90b6Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
223bfa90b6Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
233bfa90b6Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
243bfa90b6Smrg *
253bfa90b6Smrg * Author: Thomas Hellstrom <thellstrom@vmware.com>
263bfa90b6Smrg */
273bfa90b6Smrg#ifndef _VMWGFX_SAA_PRIV_H_
283bfa90b6Smrg#define _VMWGFX_SAA_PRIV_H_
293bfa90b6Smrg
303bfa90b6Smrg#define VMWGFX_PIX_MALLOC  (1 << 0)
313bfa90b6Smrg#define VMWGFX_PIX_GMR     (1 << 1)
323bfa90b6Smrg#define VMWGFX_PIX_SURFACE (1 << 2)
333bfa90b6Smrg
343bfa90b6Smrg#include <xorg-server.h>
353bfa90b6Smrg#include <picturestr.h>
363bfa90b6Smrg#include "vmwgfx_saa.h"
373bfa90b6Smrg
383bfa90b6Smrgstruct vmwgfx_saa {
393bfa90b6Smrg    struct saa_driver driver;
403bfa90b6Smrg    struct vmwgfx_dma_ctx *ctx;
413bfa90b6Smrg    struct xa_tracker *xat;
423bfa90b6Smrg    struct xa_context *xa_ctx;
433bfa90b6Smrg    ScreenPtr pScreen;
443bfa90b6Smrg    int drm_fd;
453bfa90b6Smrg    struct vmwgfx_saa_pixmap *src_vpix;
463bfa90b6Smrg    struct vmwgfx_saa_pixmap *dst_vpix;
473bfa90b6Smrg    Bool present_copy;
483bfa90b6Smrg    Bool diff_valid;
493bfa90b6Smrg    int xdiff;
503bfa90b6Smrg    int ydiff;
513bfa90b6Smrg    RegionRec present_region;
523bfa90b6Smrg    uint32_t src_handle;
533bfa90b6Smrg    Bool can_optimize_dma;
543bfa90b6Smrg    Bool use_present_opt;
553bfa90b6Smrg    Bool only_hw_presents;
563bfa90b6Smrg    Bool rendercheck;
5722f7e8e5Smrg    Bool is_master;
5822f7e8e5Smrg    Bool known_prime_format;
5934a0776dSmrg    Bool has_screen_targets;
603bfa90b6Smrg    void (*present_flush) (ScreenPtr pScreen);
613bfa90b6Smrg    struct _WsbmListHead sync_x_list;
6222f7e8e5Smrg    struct _WsbmListHead pixmaps;
633bfa90b6Smrg    struct vmwgfx_composite *vcomp;
643bfa90b6Smrg};
653bfa90b6Smrg
663bfa90b6Smrgstatic inline struct vmwgfx_saa *
673bfa90b6Smrgto_vmwgfx_saa(struct saa_driver *driver) {
683bfa90b6Smrg    return (struct vmwgfx_saa *) driver;
693bfa90b6Smrg}
703bfa90b6Smrg
713bfa90b6Smrg/*
723bfa90b6Smrg * In vmwgfx_saa.c
733bfa90b6Smrg */
743bfa90b6Smrg
753bfa90b6SmrgBool
763bfa90b6Smrgvmwgfx_hw_kill(struct vmwgfx_saa *vsaa,
773bfa90b6Smrg	       struct saa_pixmap *spix);
783bfa90b6SmrgBool
793bfa90b6Smrgvmwgfx_create_hw(struct vmwgfx_saa *vsaa,
8025dbecb6Smrg		 PixmapPtr pixmap,
8125dbecb6Smrg		 Bool shared);
823bfa90b6Smrg
833bfa90b6Smrg
843bfa90b6Smrg/*
853bfa90b6Smrg * vmwgfx_xa_surface.c
863bfa90b6Smrg */
873bfa90b6Smrg
883bfa90b6Smrgenum xa_formats
893bfa90b6Smrgvmwgfx_xa_format(enum _PictFormatShort format);
903bfa90b6SmrgBool
913bfa90b6Smrgvmwgfx_hw_validate(PixmapPtr pixmap, RegionPtr region);
9225dbecb6SmrgBool
9325dbecb6Smrgvmwgfx_hw_dri2_stage(PixmapPtr pixmap, unsigned int depth);
943bfa90b6SmrgBool
953bfa90b6Smrgvmwgfx_hw_accel_stage(PixmapPtr pixmap, unsigned int depth,
963bfa90b6Smrg		      uint32_t add_flags, uint32_t remove_flags);
973bfa90b6SmrgBool
983bfa90b6Smrgvmwgfx_hw_composite_src_stage(PixmapPtr pixmap,
993bfa90b6Smrg			      enum _PictFormatShort pict_format);
1003bfa90b6SmrgBool
1013bfa90b6Smrgvmwgfx_hw_composite_dst_stage(PixmapPtr pixmap,
1023bfa90b6Smrg			      enum _PictFormatShort pict_format);
1033bfa90b6SmrgBool
1043bfa90b6Smrgvmwgfx_hw_commit(PixmapPtr pixmap);
1053bfa90b6Smrg
106591e32d7SsnjBool
107591e32d7Ssnjvmwgfx_xa_surface_redefine(struct vmwgfx_saa_pixmap *vpix,
108591e32d7Ssnj			   struct xa_surface *srf,
109591e32d7Ssnj			   int width,
110591e32d7Ssnj			   int height,
111591e32d7Ssnj			   int depth,
112591e32d7Ssnj			   enum xa_surface_type stype,
113591e32d7Ssnj			   enum xa_formats rgb_format,
114591e32d7Ssnj			   unsigned int new_flags,
115591e32d7Ssnj			   int copy_contents);
116591e32d7Ssnj
1173bfa90b6Smrg/*
1183bfa90b6Smrg * vmwgfx_xa_composite.c
1193bfa90b6Smrg */
1203bfa90b6Smrg
1213bfa90b6Smrgstruct vmwgfx_composite;
1223bfa90b6Smrg
1233bfa90b6Smrgvoid
1243bfa90b6Smrgvmwgfx_free_composite(struct vmwgfx_composite *vcomp);
1253bfa90b6Smrgstruct vmwgfx_composite *
1263bfa90b6Smrgvmwgfx_alloc_composite(void);
1273bfa90b6Smrg
1283bfa90b6SmrgBool
1293bfa90b6Smrgvmwgfx_xa_update_comp(struct xa_composite *comp,
1303bfa90b6Smrg		      PixmapPtr src_pix,
1313bfa90b6Smrg		      PixmapPtr mask_pix,
1323bfa90b6Smrg		      PixmapPtr dst_pix);
1333bfa90b6Smrg
1343bfa90b6Smrgstruct xa_composite *
1353bfa90b6Smrgvmwgfx_xa_setup_comp(struct vmwgfx_composite *vcomp,
1363bfa90b6Smrg		     int op,
1373bfa90b6Smrg		     PicturePtr src_pict,
1383bfa90b6Smrg		     PicturePtr mask_pict,
1393bfa90b6Smrg		     PicturePtr dst_pict);
1403bfa90b6Smrg
1413bfa90b6Smrg
1423bfa90b6Smrg#endif
143