101e04c3fSmrg /**********************************************************
24a49301eSmrg * Copyright 2008-2009 VMware, Inc.  All rights reserved.
34a49301eSmrg *
44a49301eSmrg * Permission is hereby granted, free of charge, to any person
54a49301eSmrg * obtaining a copy of this software and associated documentation
64a49301eSmrg * files (the "Software"), to deal in the Software without
74a49301eSmrg * restriction, including without limitation the rights to use, copy,
84a49301eSmrg * modify, merge, publish, distribute, sublicense, and/or sell copies
94a49301eSmrg * of the Software, and to permit persons to whom the Software is
104a49301eSmrg * furnished to do so, subject to the following conditions:
114a49301eSmrg *
124a49301eSmrg * The above copyright notice and this permission notice shall be
134a49301eSmrg * included in all copies or substantial portions of the Software.
144a49301eSmrg *
154a49301eSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
164a49301eSmrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
174a49301eSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
184a49301eSmrg * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
194a49301eSmrg * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
204a49301eSmrg * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
214a49301eSmrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
224a49301eSmrg * SOFTWARE.
234a49301eSmrg *
244a49301eSmrg **********************************************************/
254a49301eSmrg
264a49301eSmrg#ifndef SVGA_SCREEN_H
274a49301eSmrg#define SVGA_SCREEN_H
284a49301eSmrg
294a49301eSmrg
304a49301eSmrg#include "pipe/p_screen.h"
31cdc920a0Smrg#include "os/os_thread.h"
324a49301eSmrg
334a49301eSmrg#include "svga_screen_cache.h"
344a49301eSmrg
354a49301eSmrg
364a49301eSmrgstruct svga_winsys_screen;
374a49301eSmrgstruct svga_winsys_context;
384a49301eSmrgstruct SVGACmdMemory;
394a49301eSmrg
404a49301eSmrg/**
414a49301eSmrg * Subclass of pipe_screen
424a49301eSmrg */
434a49301eSmrgstruct svga_screen
444a49301eSmrg{
454a49301eSmrg   struct pipe_screen screen;
464a49301eSmrg   struct svga_winsys_screen *sws;
474a49301eSmrg
483464ebd5Sriastradh   SVGA3dHardwareVersion hw_version;
493464ebd5Sriastradh
50af69d88dSmrg   /** Device caps */
5101e04c3fSmrg   boolean haveProvokingVertex;
52af69d88dSmrg   boolean haveLineStipple, haveLineSmooth;
537ec681f3Smrg   boolean haveBlendLogicops;
54af69d88dSmrg   float maxLineWidth, maxLineWidthAA;
55af69d88dSmrg   float maxPointSize;
567ec681f3Smrg   float pointSmoothThreshold; /** Disable point AA for sizes less than this */
57af69d88dSmrg   unsigned max_color_buffers;
5801e04c3fSmrg   unsigned max_const_buffers;
597ec681f3Smrg   unsigned max_viewports;
6001e04c3fSmrg   unsigned ms_samples;
61af69d88dSmrg
624a49301eSmrg   struct {
634a49301eSmrg      boolean force_level_surface_view;
644a49301eSmrg      boolean force_surface_view;
654a49301eSmrg      boolean no_surface_view;
664a49301eSmrg      boolean force_sampler_view;
674a49301eSmrg      boolean no_sampler_view;
6801e04c3fSmrg      boolean no_cache_index_buffers;
694a49301eSmrg   } debug;
704a49301eSmrg
714a49301eSmrg   unsigned texture_timestamp;
7201e04c3fSmrg   mtx_t tex_mutex;
733464ebd5Sriastradh
7401e04c3fSmrg   mtx_t swc_mutex; /* Used for buffer uploads */
753464ebd5Sriastradh
76af69d88dSmrg   /* which formats to translate depth formats into */
77af69d88dSmrg   struct {
78af69d88dSmrg     enum SVGA3dSurfaceFormat z16;
7901e04c3fSmrg
80af69d88dSmrg     /* note gallium order */
81af69d88dSmrg     enum SVGA3dSurfaceFormat x8z24;
82af69d88dSmrg     enum SVGA3dSurfaceFormat s8z24;
83af69d88dSmrg   } depth;
84af69d88dSmrg
854a49301eSmrg   struct svga_host_surface_cache cache;
86af69d88dSmrg
8701e04c3fSmrg   /** HUD counters */
8801e04c3fSmrg   struct {
8901e04c3fSmrg      /** Memory used by all resources (buffers and surfaces) */
9001e04c3fSmrg      uint64_t total_resource_bytes;
9101e04c3fSmrg      uint64_t num_resources;
9201e04c3fSmrg      uint64_t num_failed_allocations;
9301e04c3fSmrg   } hud;
944a49301eSmrg};
954a49301eSmrg
964a49301eSmrg#ifndef DEBUG
974a49301eSmrg/** cast wrapper */
9801e04c3fSmrgstatic inline struct svga_screen *
994a49301eSmrgsvga_screen(struct pipe_screen *pscreen)
1004a49301eSmrg{
1014a49301eSmrg   return (struct svga_screen *) pscreen;
1024a49301eSmrg}
1034a49301eSmrg#else
1044a49301eSmrgstruct svga_screen *
1054a49301eSmrgsvga_screen(struct pipe_screen *screen);
1064a49301eSmrg#endif
1074a49301eSmrg
1084a49301eSmrg#endif /* SVGA_SCREEN_H */
109