xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/svga/svga_screen.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright (c) 2008-2024 Broadcom. All Rights Reserved.
3  * The term “Broadcom” refers to Broadcom Inc.
4  * and/or its subsidiaries.
5  * SPDX-License-Identifier: MIT
6  */
7 
8 #ifndef SVGA_SCREEN_H
9 #define SVGA_SCREEN_H
10 
11 
12 #include "pipe/p_screen.h"
13 #include "util/u_thread.h"
14 
15 #include "svga_screen_cache.h"
16 
17 
18 struct svga_winsys_screen;
19 struct svga_winsys_context;
20 struct SVGACmdMemory;
21 
22 /**
23  * Subclass of pipe_screen
24  */
25 struct svga_screen
26 {
27    struct pipe_screen screen;
28    struct svga_winsys_screen *sws;
29 
30    SVGA3dHardwareVersion hw_version;
31 
32    /** Device caps */
33    bool haveProvokingVertex;
34    bool haveLineStipple, haveLineSmooth;
35    bool haveBlendLogicops;
36    float maxLineWidth, maxLineWidthAA;
37    float maxPointSize;
38    float pointSmoothThreshold; /** Disable point AA for sizes less than this */
39    unsigned max_color_buffers;
40    unsigned max_const_buffers;
41    unsigned max_viewports;
42    unsigned ms_samples;
43    unsigned forcedSampleCount; /* available with GL43 capable device only */
44    unsigned max_vs_inputs;
45    unsigned max_vs_outputs;
46    unsigned max_gs_inputs;
47 
48    struct {
49       unsigned force_level_surface_view:1;
50       unsigned force_surface_view:1;
51       unsigned no_surface_view:1;
52       unsigned force_sampler_view:1;
53       unsigned no_sampler_view:1;
54       unsigned no_cache_index_buffers:1;
55       unsigned tessellation:1;
56       unsigned sampler_state_mapping:1;
57       unsigned pad:24;
58    } debug;
59 
60    unsigned texture_timestamp;
61    mtx_t tex_mutex;
62 
63    mtx_t swc_mutex; /* Used for buffer uploads */
64 
65    /* which formats to translate depth formats into */
66    struct {
67      enum SVGA3dSurfaceFormat z16;
68 
69      /* note gallium order */
70      enum SVGA3dSurfaceFormat x8z24;
71      enum SVGA3dSurfaceFormat s8z24;
72    } depth;
73 
74    struct svga_host_surface_cache cache;
75 
76    /** HUD counters */
77    struct {
78       /** Memory used by all resources (buffers and surfaces) */
79       uint64_t total_resource_bytes;
80       uint64_t num_resources;
81       uint64_t num_failed_allocations;
82    } hud;
83 };
84 
85 #if !MESA_DEBUG
86 /** cast wrapper */
87 static inline struct svga_screen *
svga_screen(struct pipe_screen * pscreen)88 svga_screen(struct pipe_screen *pscreen)
89 {
90    return (struct svga_screen *) pscreen;
91 }
92 #else
93 struct svga_screen *
94 svga_screen(struct pipe_screen *screen);
95 #endif
96 
97 #endif /* SVGA_SCREEN_H */
98