1bf215546Sopenharmony_ci /**********************************************************
2bf215546Sopenharmony_ci * Copyright 2008-2009 VMware, Inc.  All rights reserved.
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person
5bf215546Sopenharmony_ci * obtaining a copy of this software and associated documentation
6bf215546Sopenharmony_ci * files (the "Software"), to deal in the Software without
7bf215546Sopenharmony_ci * restriction, including without limitation the rights to use, copy,
8bf215546Sopenharmony_ci * modify, merge, publish, distribute, sublicense, and/or sell copies
9bf215546Sopenharmony_ci * of the Software, and to permit persons to whom the Software is
10bf215546Sopenharmony_ci * furnished to do so, subject to the following conditions:
11bf215546Sopenharmony_ci *
12bf215546Sopenharmony_ci * The above copyright notice and this permission notice shall be
13bf215546Sopenharmony_ci * included in all copies or substantial portions of the Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16bf215546Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18bf215546Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19bf215546Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20bf215546Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21bf215546Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22bf215546Sopenharmony_ci * SOFTWARE.
23bf215546Sopenharmony_ci *
24bf215546Sopenharmony_ci **********************************************************/
25bf215546Sopenharmony_ci
26bf215546Sopenharmony_ci#ifndef SVGA_SCREEN_H
27bf215546Sopenharmony_ci#define SVGA_SCREEN_H
28bf215546Sopenharmony_ci
29bf215546Sopenharmony_ci
30bf215546Sopenharmony_ci#include "pipe/p_screen.h"
31bf215546Sopenharmony_ci#include "os/os_thread.h"
32bf215546Sopenharmony_ci
33bf215546Sopenharmony_ci#include "svga_screen_cache.h"
34bf215546Sopenharmony_ci
35bf215546Sopenharmony_ci
36bf215546Sopenharmony_cistruct svga_winsys_screen;
37bf215546Sopenharmony_cistruct svga_winsys_context;
38bf215546Sopenharmony_cistruct SVGACmdMemory;
39bf215546Sopenharmony_ci
40bf215546Sopenharmony_ci/**
41bf215546Sopenharmony_ci * Subclass of pipe_screen
42bf215546Sopenharmony_ci */
43bf215546Sopenharmony_cistruct svga_screen
44bf215546Sopenharmony_ci{
45bf215546Sopenharmony_ci   struct pipe_screen screen;
46bf215546Sopenharmony_ci   struct svga_winsys_screen *sws;
47bf215546Sopenharmony_ci
48bf215546Sopenharmony_ci   SVGA3dHardwareVersion hw_version;
49bf215546Sopenharmony_ci
50bf215546Sopenharmony_ci   /** Device caps */
51bf215546Sopenharmony_ci   boolean haveProvokingVertex;
52bf215546Sopenharmony_ci   boolean haveLineStipple, haveLineSmooth;
53bf215546Sopenharmony_ci   boolean haveBlendLogicops;
54bf215546Sopenharmony_ci   float maxLineWidth, maxLineWidthAA;
55bf215546Sopenharmony_ci   float maxPointSize;
56bf215546Sopenharmony_ci   float pointSmoothThreshold; /** Disable point AA for sizes less than this */
57bf215546Sopenharmony_ci   unsigned max_color_buffers;
58bf215546Sopenharmony_ci   unsigned max_const_buffers;
59bf215546Sopenharmony_ci   unsigned max_viewports;
60bf215546Sopenharmony_ci   unsigned ms_samples;
61bf215546Sopenharmony_ci   unsigned forcedSampleCount; /* available with GL43 capable device only */
62bf215546Sopenharmony_ci   unsigned max_vs_inputs;
63bf215546Sopenharmony_ci   unsigned max_vs_outputs;
64bf215546Sopenharmony_ci   unsigned max_gs_inputs;
65bf215546Sopenharmony_ci
66bf215546Sopenharmony_ci   struct {
67bf215546Sopenharmony_ci      unsigned force_level_surface_view:1;
68bf215546Sopenharmony_ci      unsigned force_surface_view:1;
69bf215546Sopenharmony_ci      unsigned no_surface_view:1;
70bf215546Sopenharmony_ci      unsigned force_sampler_view:1;
71bf215546Sopenharmony_ci      unsigned no_sampler_view:1;
72bf215546Sopenharmony_ci      unsigned no_cache_index_buffers:1;
73bf215546Sopenharmony_ci      unsigned tessellation:1;
74bf215546Sopenharmony_ci      unsigned sampler_state_mapping:1;
75bf215546Sopenharmony_ci      unsigned nir:1;
76bf215546Sopenharmony_ci      unsigned pad:23;
77bf215546Sopenharmony_ci   } debug;
78bf215546Sopenharmony_ci
79bf215546Sopenharmony_ci   unsigned texture_timestamp;
80bf215546Sopenharmony_ci   mtx_t tex_mutex;
81bf215546Sopenharmony_ci
82bf215546Sopenharmony_ci   mtx_t swc_mutex; /* Used for buffer uploads */
83bf215546Sopenharmony_ci
84bf215546Sopenharmony_ci   /* which formats to translate depth formats into */
85bf215546Sopenharmony_ci   struct {
86bf215546Sopenharmony_ci     enum SVGA3dSurfaceFormat z16;
87bf215546Sopenharmony_ci
88bf215546Sopenharmony_ci     /* note gallium order */
89bf215546Sopenharmony_ci     enum SVGA3dSurfaceFormat x8z24;
90bf215546Sopenharmony_ci     enum SVGA3dSurfaceFormat s8z24;
91bf215546Sopenharmony_ci   } depth;
92bf215546Sopenharmony_ci
93bf215546Sopenharmony_ci   struct svga_host_surface_cache cache;
94bf215546Sopenharmony_ci
95bf215546Sopenharmony_ci   /** HUD counters */
96bf215546Sopenharmony_ci   struct {
97bf215546Sopenharmony_ci      /** Memory used by all resources (buffers and surfaces) */
98bf215546Sopenharmony_ci      uint64_t total_resource_bytes;
99bf215546Sopenharmony_ci      uint64_t num_resources;
100bf215546Sopenharmony_ci      uint64_t num_failed_allocations;
101bf215546Sopenharmony_ci   } hud;
102bf215546Sopenharmony_ci};
103bf215546Sopenharmony_ci
104bf215546Sopenharmony_ci#ifndef DEBUG
105bf215546Sopenharmony_ci/** cast wrapper */
106bf215546Sopenharmony_cistatic inline struct svga_screen *
107bf215546Sopenharmony_cisvga_screen(struct pipe_screen *pscreen)
108bf215546Sopenharmony_ci{
109bf215546Sopenharmony_ci   return (struct svga_screen *) pscreen;
110bf215546Sopenharmony_ci}
111bf215546Sopenharmony_ci#else
112bf215546Sopenharmony_cistruct svga_screen *
113bf215546Sopenharmony_cisvga_screen(struct pipe_screen *screen);
114bf215546Sopenharmony_ci#endif
115bf215546Sopenharmony_ci
116bf215546Sopenharmony_ci#endif /* SVGA_SCREEN_H */
117