1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright 2012 Red Hat Inc. 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation 7bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 9bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 10bf215546Sopenharmony_ci * 11bf215546Sopenharmony_ci * The above copyright notice and this permission notice shall be included in 12bf215546Sopenharmony_ci * all copies or substantial portions of the Software. 13bf215546Sopenharmony_ci * 14bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 18bf215546Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19bf215546Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20bf215546Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 21bf215546Sopenharmony_ci * 22bf215546Sopenharmony_ci * Authors: Ben Skeggs 23bf215546Sopenharmony_ci * 24bf215546Sopenharmony_ci */ 25bf215546Sopenharmony_ci 26bf215546Sopenharmony_ci#include <xf86drm.h> 27bf215546Sopenharmony_ci#include <nouveau_drm.h> 28bf215546Sopenharmony_ci#include "util/format/u_format.h" 29bf215546Sopenharmony_ci#include "util/format/u_format_s3tc.h" 30bf215546Sopenharmony_ci#include "util/u_screen.h" 31bf215546Sopenharmony_ci 32bf215546Sopenharmony_ci#include "nv_object.xml.h" 33bf215546Sopenharmony_ci#include "nv_m2mf.xml.h" 34bf215546Sopenharmony_ci#include "nv30/nv30-40_3d.xml.h" 35bf215546Sopenharmony_ci#include "nv30/nv01_2d.xml.h" 36bf215546Sopenharmony_ci 37bf215546Sopenharmony_ci#include "nouveau_fence.h" 38bf215546Sopenharmony_ci#include "nv30/nv30_screen.h" 39bf215546Sopenharmony_ci#include "nv30/nv30_context.h" 40bf215546Sopenharmony_ci#include "nv30/nv30_resource.h" 41bf215546Sopenharmony_ci#include "nv30/nv30_format.h" 42bf215546Sopenharmony_ci 43bf215546Sopenharmony_ci#define RANKINE_0397_CHIPSET 0x00000003 44bf215546Sopenharmony_ci#define RANKINE_0497_CHIPSET 0x000001e0 45bf215546Sopenharmony_ci#define RANKINE_0697_CHIPSET 0x00000010 46bf215546Sopenharmony_ci#define CURIE_4097_CHIPSET 0x00000baf 47bf215546Sopenharmony_ci#define CURIE_4497_CHIPSET 0x00005450 48bf215546Sopenharmony_ci#define CURIE_4497_CHIPSET6X 0x00000088 49bf215546Sopenharmony_ci 50bf215546Sopenharmony_cistatic int 51bf215546Sopenharmony_cinv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) 52bf215546Sopenharmony_ci{ 53bf215546Sopenharmony_ci struct nv30_screen *screen = nv30_screen(pscreen); 54bf215546Sopenharmony_ci struct nouveau_object *eng3d = screen->eng3d; 55bf215546Sopenharmony_ci struct nouveau_device *dev = nouveau_screen(pscreen)->device; 56bf215546Sopenharmony_ci 57bf215546Sopenharmony_ci switch (param) { 58bf215546Sopenharmony_ci /* non-boolean capabilities */ 59bf215546Sopenharmony_ci case PIPE_CAP_MAX_RENDER_TARGETS: 60bf215546Sopenharmony_ci return (eng3d->oclass >= NV40_3D_CLASS) ? 4 : 1; 61bf215546Sopenharmony_ci case PIPE_CAP_MAX_TEXTURE_2D_SIZE: 62bf215546Sopenharmony_ci return 4096; 63bf215546Sopenharmony_ci case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: 64bf215546Sopenharmony_ci return 10; 65bf215546Sopenharmony_ci case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: 66bf215546Sopenharmony_ci return 13; 67bf215546Sopenharmony_ci case PIPE_CAP_GLSL_FEATURE_LEVEL: 68bf215546Sopenharmony_ci case PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY: 69bf215546Sopenharmony_ci return 120; 70bf215546Sopenharmony_ci case PIPE_CAP_ENDIANNESS: 71bf215546Sopenharmony_ci return PIPE_ENDIAN_LITTLE; 72bf215546Sopenharmony_ci case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT: 73bf215546Sopenharmony_ci return 16; 74bf215546Sopenharmony_ci case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: 75bf215546Sopenharmony_ci return NOUVEAU_MIN_BUFFER_MAP_ALIGN; 76bf215546Sopenharmony_ci case PIPE_CAP_MAX_VIEWPORTS: 77bf215546Sopenharmony_ci return 1; 78bf215546Sopenharmony_ci case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE: 79bf215546Sopenharmony_ci return 2048; 80bf215546Sopenharmony_ci case PIPE_CAP_MAX_TEXTURE_UPLOAD_MEMORY_BUDGET: 81bf215546Sopenharmony_ci return 8 * 1024 * 1024; 82bf215546Sopenharmony_ci case PIPE_CAP_MAX_VARYINGS: 83bf215546Sopenharmony_ci return 8; 84bf215546Sopenharmony_ci 85bf215546Sopenharmony_ci /* supported capabilities */ 86bf215546Sopenharmony_ci case PIPE_CAP_ANISOTROPIC_FILTER: 87bf215546Sopenharmony_ci case PIPE_CAP_POINT_SPRITE: 88bf215546Sopenharmony_ci case PIPE_CAP_OCCLUSION_QUERY: 89bf215546Sopenharmony_ci case PIPE_CAP_QUERY_TIME_ELAPSED: 90bf215546Sopenharmony_ci case PIPE_CAP_QUERY_TIMESTAMP: 91bf215546Sopenharmony_ci case PIPE_CAP_TEXTURE_SWIZZLE: 92bf215546Sopenharmony_ci case PIPE_CAP_DEPTH_CLIP_DISABLE: 93bf215546Sopenharmony_ci case PIPE_CAP_FS_COORD_ORIGIN_UPPER_LEFT: 94bf215546Sopenharmony_ci case PIPE_CAP_FS_COORD_ORIGIN_LOWER_LEFT: 95bf215546Sopenharmony_ci case PIPE_CAP_FS_COORD_PIXEL_CENTER_HALF_INTEGER: 96bf215546Sopenharmony_ci case PIPE_CAP_FS_COORD_PIXEL_CENTER_INTEGER: 97bf215546Sopenharmony_ci case PIPE_CAP_TGSI_TEXCOORD: 98bf215546Sopenharmony_ci case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT: 99bf215546Sopenharmony_ci case PIPE_CAP_CLEAR_SCISSORED: 100bf215546Sopenharmony_ci case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: 101bf215546Sopenharmony_ci case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY: 102bf215546Sopenharmony_ci case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: 103bf215546Sopenharmony_ci case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION: 104bf215546Sopenharmony_ci return 1; 105bf215546Sopenharmony_ci case PIPE_CAP_TEXTURE_TRANSFER_MODES: 106bf215546Sopenharmony_ci return PIPE_TEXTURE_TRANSFER_BLIT; 107bf215546Sopenharmony_ci /* nv35 capabilities */ 108bf215546Sopenharmony_ci case PIPE_CAP_DEPTH_BOUNDS_TEST: 109bf215546Sopenharmony_ci return eng3d->oclass == NV35_3D_CLASS || eng3d->oclass >= NV40_3D_CLASS; 110bf215546Sopenharmony_ci case PIPE_CAP_SUPPORTED_PRIM_MODES_WITH_RESTART: 111bf215546Sopenharmony_ci case PIPE_CAP_SUPPORTED_PRIM_MODES: 112bf215546Sopenharmony_ci return BITFIELD_MASK(PIPE_PRIM_MAX); 113bf215546Sopenharmony_ci /* nv4x capabilities */ 114bf215546Sopenharmony_ci case PIPE_CAP_BLEND_EQUATION_SEPARATE: 115bf215546Sopenharmony_ci case PIPE_CAP_NPOT_TEXTURES: 116bf215546Sopenharmony_ci case PIPE_CAP_CONDITIONAL_RENDER: 117bf215546Sopenharmony_ci case PIPE_CAP_TEXTURE_MIRROR_CLAMP: 118bf215546Sopenharmony_ci case PIPE_CAP_TEXTURE_MIRROR_CLAMP_TO_EDGE: 119bf215546Sopenharmony_ci case PIPE_CAP_PRIMITIVE_RESTART: 120bf215546Sopenharmony_ci case PIPE_CAP_PRIMITIVE_RESTART_FIXED_INDEX: 121bf215546Sopenharmony_ci return (eng3d->oclass >= NV40_3D_CLASS) ? 1 : 0; 122bf215546Sopenharmony_ci /* unsupported */ 123bf215546Sopenharmony_ci case PIPE_CAP_EMULATE_NONFIXED_PRIMITIVE_RESTART: 124bf215546Sopenharmony_ci case PIPE_CAP_DEPTH_CLIP_DISABLE_SEPARATE: 125bf215546Sopenharmony_ci case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS: 126bf215546Sopenharmony_ci case PIPE_CAP_FRAGMENT_SHADER_TEXTURE_LOD: 127bf215546Sopenharmony_ci case PIPE_CAP_FRAGMENT_SHADER_DERIVATIVES: 128bf215546Sopenharmony_ci case PIPE_CAP_INDEP_BLEND_ENABLE: 129bf215546Sopenharmony_ci case PIPE_CAP_INDEP_BLEND_FUNC: 130bf215546Sopenharmony_ci case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS: 131bf215546Sopenharmony_ci case PIPE_CAP_SHADER_STENCIL_EXPORT: 132bf215546Sopenharmony_ci case PIPE_CAP_VS_INSTANCEID: 133bf215546Sopenharmony_ci case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR: /* XXX: yes? */ 134bf215546Sopenharmony_ci case PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS: 135bf215546Sopenharmony_ci case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME: 136bf215546Sopenharmony_ci case PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS: 137bf215546Sopenharmony_ci case PIPE_CAP_MIN_TEXEL_OFFSET: 138bf215546Sopenharmony_ci case PIPE_CAP_MAX_TEXEL_OFFSET: 139bf215546Sopenharmony_ci case PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET: 140bf215546Sopenharmony_ci case PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET: 141bf215546Sopenharmony_ci case PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS: 142bf215546Sopenharmony_ci case PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS: 143bf215546Sopenharmony_ci case PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES: 144bf215546Sopenharmony_ci case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS: 145bf215546Sopenharmony_ci case PIPE_CAP_MAX_VERTEX_STREAMS: 146bf215546Sopenharmony_ci case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS: 147bf215546Sopenharmony_ci case PIPE_CAP_TEXTURE_BARRIER: 148bf215546Sopenharmony_ci case PIPE_CAP_SEAMLESS_CUBE_MAP: 149bf215546Sopenharmony_ci case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE: 150bf215546Sopenharmony_ci case PIPE_CAP_CUBE_MAP_ARRAY: 151bf215546Sopenharmony_ci case PIPE_CAP_VERTEX_COLOR_UNCLAMPED: 152bf215546Sopenharmony_ci case PIPE_CAP_FRAGMENT_COLOR_CLAMPED: 153bf215546Sopenharmony_ci case PIPE_CAP_VERTEX_COLOR_CLAMPED: 154bf215546Sopenharmony_ci case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION: 155bf215546Sopenharmony_ci case PIPE_CAP_MIXED_COLORBUFFER_FORMATS: 156bf215546Sopenharmony_ci case PIPE_CAP_START_INSTANCE: 157bf215546Sopenharmony_ci case PIPE_CAP_TEXTURE_MULTISAMPLE: 158bf215546Sopenharmony_ci case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: 159bf215546Sopenharmony_ci case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT: 160bf215546Sopenharmony_ci case PIPE_CAP_QUERY_PIPELINE_STATISTICS: 161bf215546Sopenharmony_ci case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK: 162bf215546Sopenharmony_ci case PIPE_CAP_MAX_TEXEL_BUFFER_ELEMENTS_UINT: 163bf215546Sopenharmony_ci case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES: 164bf215546Sopenharmony_ci case PIPE_CAP_VS_LAYER_VIEWPORT: 165bf215546Sopenharmony_ci case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS: 166bf215546Sopenharmony_ci case PIPE_CAP_TEXTURE_GATHER_SM5: 167bf215546Sopenharmony_ci case PIPE_CAP_FAKE_SW_MSAA: 168bf215546Sopenharmony_ci case PIPE_CAP_TEXTURE_QUERY_LOD: 169bf215546Sopenharmony_ci case PIPE_CAP_SAMPLE_SHADING: 170bf215546Sopenharmony_ci case PIPE_CAP_TEXTURE_GATHER_OFFSETS: 171bf215546Sopenharmony_ci case PIPE_CAP_VS_WINDOW_SPACE_POSITION: 172bf215546Sopenharmony_ci case PIPE_CAP_USER_VERTEX_BUFFERS: 173bf215546Sopenharmony_ci case PIPE_CAP_COMPUTE: 174bf215546Sopenharmony_ci case PIPE_CAP_DRAW_INDIRECT: 175bf215546Sopenharmony_ci case PIPE_CAP_MULTI_DRAW_INDIRECT: 176bf215546Sopenharmony_ci case PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS: 177bf215546Sopenharmony_ci case PIPE_CAP_FS_FINE_DERIVATIVE: 178bf215546Sopenharmony_ci case PIPE_CAP_CONDITIONAL_RENDER_INVERTED: 179bf215546Sopenharmony_ci case PIPE_CAP_SAMPLER_VIEW_TARGET: 180bf215546Sopenharmony_ci case PIPE_CAP_CLIP_HALFZ: 181bf215546Sopenharmony_ci case PIPE_CAP_VERTEXID_NOBASE: 182bf215546Sopenharmony_ci case PIPE_CAP_POLYGON_OFFSET_CLAMP: 183bf215546Sopenharmony_ci case PIPE_CAP_MULTISAMPLE_Z_RESOLVE: 184bf215546Sopenharmony_ci case PIPE_CAP_RESOURCE_FROM_USER_MEMORY: 185bf215546Sopenharmony_ci case PIPE_CAP_DEVICE_RESET_STATUS_QUERY: 186bf215546Sopenharmony_ci case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS: 187bf215546Sopenharmony_ci case PIPE_CAP_TEXTURE_FLOAT_LINEAR: 188bf215546Sopenharmony_ci case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR: 189bf215546Sopenharmony_ci case PIPE_CAP_TEXTURE_QUERY_SAMPLES: 190bf215546Sopenharmony_ci case PIPE_CAP_FORCE_PERSAMPLE_INTERP: 191bf215546Sopenharmony_ci case PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS: 192bf215546Sopenharmony_ci case PIPE_CAP_SHAREABLE_SHADERS: 193bf215546Sopenharmony_ci case PIPE_CAP_CLEAR_TEXTURE: 194bf215546Sopenharmony_ci case PIPE_CAP_DRAW_PARAMETERS: 195bf215546Sopenharmony_ci case PIPE_CAP_SHADER_PACK_HALF_FLOAT: 196bf215546Sopenharmony_ci case PIPE_CAP_FS_POSITION_IS_SYSVAL: 197bf215546Sopenharmony_ci case PIPE_CAP_FS_FACE_IS_INTEGER_SYSVAL: 198bf215546Sopenharmony_ci case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT: 199bf215546Sopenharmony_ci case PIPE_CAP_INVALIDATE_BUFFER: 200bf215546Sopenharmony_ci case PIPE_CAP_GENERATE_MIPMAP: 201bf215546Sopenharmony_ci case PIPE_CAP_STRING_MARKER: 202bf215546Sopenharmony_ci case PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY: 203bf215546Sopenharmony_ci case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS: 204bf215546Sopenharmony_ci case PIPE_CAP_QUERY_BUFFER_OBJECT: 205bf215546Sopenharmony_ci case PIPE_CAP_QUERY_MEMORY_INFO: 206bf215546Sopenharmony_ci case PIPE_CAP_PCI_GROUP: 207bf215546Sopenharmony_ci case PIPE_CAP_PCI_BUS: 208bf215546Sopenharmony_ci case PIPE_CAP_PCI_DEVICE: 209bf215546Sopenharmony_ci case PIPE_CAP_PCI_FUNCTION: 210bf215546Sopenharmony_ci case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT: 211bf215546Sopenharmony_ci case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR: 212bf215546Sopenharmony_ci case PIPE_CAP_CULL_DISTANCE: 213bf215546Sopenharmony_ci case PIPE_CAP_SHADER_GROUP_VOTE: 214bf215546Sopenharmony_ci case PIPE_CAP_MAX_WINDOW_RECTANGLES: 215bf215546Sopenharmony_ci case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED: 216bf215546Sopenharmony_ci case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS: 217bf215546Sopenharmony_ci case PIPE_CAP_MIXED_COLOR_DEPTH_BITS: 218bf215546Sopenharmony_ci case PIPE_CAP_SHADER_ARRAY_COMPONENTS: 219bf215546Sopenharmony_ci case PIPE_CAP_SHADER_CAN_READ_OUTPUTS: 220bf215546Sopenharmony_ci case PIPE_CAP_NATIVE_FENCE_FD: 221bf215546Sopenharmony_ci case PIPE_CAP_FBFETCH: 222bf215546Sopenharmony_ci case PIPE_CAP_LEGACY_MATH_RULES: 223bf215546Sopenharmony_ci case PIPE_CAP_DOUBLES: 224bf215546Sopenharmony_ci case PIPE_CAP_INT64: 225bf215546Sopenharmony_ci case PIPE_CAP_INT64_DIVMOD: 226bf215546Sopenharmony_ci case PIPE_CAP_TGSI_TEX_TXF_LZ: 227bf215546Sopenharmony_ci case PIPE_CAP_SHADER_CLOCK: 228bf215546Sopenharmony_ci case PIPE_CAP_POLYGON_MODE_FILL_RECTANGLE: 229bf215546Sopenharmony_ci case PIPE_CAP_SPARSE_BUFFER_PAGE_SIZE: 230bf215546Sopenharmony_ci case PIPE_CAP_SHADER_BALLOT: 231bf215546Sopenharmony_ci case PIPE_CAP_TES_LAYER_VIEWPORT: 232bf215546Sopenharmony_ci case PIPE_CAP_CAN_BIND_CONST_BUFFER_AS_VERTEX: 233bf215546Sopenharmony_ci case PIPE_CAP_POST_DEPTH_COVERAGE: 234bf215546Sopenharmony_ci case PIPE_CAP_BINDLESS_TEXTURE: 235bf215546Sopenharmony_ci case PIPE_CAP_NIR_SAMPLERS_AS_DEREF: 236bf215546Sopenharmony_ci case PIPE_CAP_QUERY_SO_OVERFLOW: 237bf215546Sopenharmony_ci case PIPE_CAP_MEMOBJ: 238bf215546Sopenharmony_ci case PIPE_CAP_LOAD_CONSTBUF: 239bf215546Sopenharmony_ci case PIPE_CAP_TILE_RASTER_ORDER: 240bf215546Sopenharmony_ci case PIPE_CAP_MAX_COMBINED_SHADER_OUTPUT_RESOURCES: 241bf215546Sopenharmony_ci case PIPE_CAP_FRAMEBUFFER_MSAA_CONSTRAINTS: 242bf215546Sopenharmony_ci case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET: 243bf215546Sopenharmony_ci case PIPE_CAP_CONTEXT_PRIORITY_MASK: 244bf215546Sopenharmony_ci case PIPE_CAP_FENCE_SIGNAL: 245bf215546Sopenharmony_ci case PIPE_CAP_CONSTBUF0_FLAGS: 246bf215546Sopenharmony_ci case PIPE_CAP_PACKED_UNIFORMS: 247bf215546Sopenharmony_ci case PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_TRIANGLES: 248bf215546Sopenharmony_ci case PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_POINTS_LINES: 249bf215546Sopenharmony_ci case PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_TRIANGLES: 250bf215546Sopenharmony_ci case PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_POINTS_LINES: 251bf215546Sopenharmony_ci case PIPE_CAP_CONSERVATIVE_RASTER_POST_DEPTH_COVERAGE: 252bf215546Sopenharmony_ci case PIPE_CAP_MAX_CONSERVATIVE_RASTER_SUBPIXEL_PRECISION_BIAS: 253bf215546Sopenharmony_ci case PIPE_CAP_PROGRAMMABLE_SAMPLE_LOCATIONS: 254bf215546Sopenharmony_ci case PIPE_CAP_IMAGE_LOAD_FORMATTED: 255bf215546Sopenharmony_ci case PIPE_CAP_TGSI_DIV: 256bf215546Sopenharmony_ci case PIPE_CAP_IMAGE_ATOMIC_INC_WRAP: 257bf215546Sopenharmony_ci case PIPE_CAP_IMAGE_STORE_FORMATTED: 258bf215546Sopenharmony_ci return 0; 259bf215546Sopenharmony_ci 260bf215546Sopenharmony_ci case PIPE_CAP_MAX_GS_INVOCATIONS: 261bf215546Sopenharmony_ci return 32; 262bf215546Sopenharmony_ci case PIPE_CAP_MAX_SHADER_BUFFER_SIZE_UINT: 263bf215546Sopenharmony_ci return 1 << 27; 264bf215546Sopenharmony_ci case PIPE_CAP_VENDOR_ID: 265bf215546Sopenharmony_ci return 0x10de; 266bf215546Sopenharmony_ci case PIPE_CAP_DEVICE_ID: { 267bf215546Sopenharmony_ci uint64_t device_id; 268bf215546Sopenharmony_ci if (nouveau_getparam(dev, NOUVEAU_GETPARAM_PCI_DEVICE, &device_id)) { 269bf215546Sopenharmony_ci NOUVEAU_ERR("NOUVEAU_GETPARAM_PCI_DEVICE failed.\n"); 270bf215546Sopenharmony_ci return -1; 271bf215546Sopenharmony_ci } 272bf215546Sopenharmony_ci return device_id; 273bf215546Sopenharmony_ci } 274bf215546Sopenharmony_ci case PIPE_CAP_ACCELERATED: 275bf215546Sopenharmony_ci return 1; 276bf215546Sopenharmony_ci case PIPE_CAP_VIDEO_MEMORY: 277bf215546Sopenharmony_ci return dev->vram_size >> 20; 278bf215546Sopenharmony_ci case PIPE_CAP_UMA: 279bf215546Sopenharmony_ci return 0; 280bf215546Sopenharmony_ci default: 281bf215546Sopenharmony_ci return u_pipe_screen_get_param_defaults(pscreen, param); 282bf215546Sopenharmony_ci } 283bf215546Sopenharmony_ci} 284bf215546Sopenharmony_ci 285bf215546Sopenharmony_cistatic float 286bf215546Sopenharmony_cinv30_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_capf param) 287bf215546Sopenharmony_ci{ 288bf215546Sopenharmony_ci struct nv30_screen *screen = nv30_screen(pscreen); 289bf215546Sopenharmony_ci struct nouveau_object *eng3d = screen->eng3d; 290bf215546Sopenharmony_ci 291bf215546Sopenharmony_ci switch (param) { 292bf215546Sopenharmony_ci case PIPE_CAPF_MIN_LINE_WIDTH: 293bf215546Sopenharmony_ci case PIPE_CAPF_MIN_LINE_WIDTH_AA: 294bf215546Sopenharmony_ci case PIPE_CAPF_MIN_POINT_SIZE: 295bf215546Sopenharmony_ci case PIPE_CAPF_MIN_POINT_SIZE_AA: 296bf215546Sopenharmony_ci return 1; 297bf215546Sopenharmony_ci case PIPE_CAPF_POINT_SIZE_GRANULARITY: 298bf215546Sopenharmony_ci case PIPE_CAPF_LINE_WIDTH_GRANULARITY: 299bf215546Sopenharmony_ci return 0.1; 300bf215546Sopenharmony_ci case PIPE_CAPF_MAX_LINE_WIDTH: 301bf215546Sopenharmony_ci case PIPE_CAPF_MAX_LINE_WIDTH_AA: 302bf215546Sopenharmony_ci return 10.0; 303bf215546Sopenharmony_ci case PIPE_CAPF_MAX_POINT_SIZE: 304bf215546Sopenharmony_ci case PIPE_CAPF_MAX_POINT_SIZE_AA: 305bf215546Sopenharmony_ci return 64.0; 306bf215546Sopenharmony_ci case PIPE_CAPF_MAX_TEXTURE_ANISOTROPY: 307bf215546Sopenharmony_ci return (eng3d->oclass >= NV40_3D_CLASS) ? 16.0 : 8.0; 308bf215546Sopenharmony_ci case PIPE_CAPF_MAX_TEXTURE_LOD_BIAS: 309bf215546Sopenharmony_ci return 15.0; 310bf215546Sopenharmony_ci case PIPE_CAPF_MIN_CONSERVATIVE_RASTER_DILATE: 311bf215546Sopenharmony_ci case PIPE_CAPF_MAX_CONSERVATIVE_RASTER_DILATE: 312bf215546Sopenharmony_ci case PIPE_CAPF_CONSERVATIVE_RASTER_DILATE_GRANULARITY: 313bf215546Sopenharmony_ci return 0.0; 314bf215546Sopenharmony_ci default: 315bf215546Sopenharmony_ci debug_printf("unknown paramf %d\n", param); 316bf215546Sopenharmony_ci return 0; 317bf215546Sopenharmony_ci } 318bf215546Sopenharmony_ci} 319bf215546Sopenharmony_ci 320bf215546Sopenharmony_cistatic int 321bf215546Sopenharmony_cinv30_screen_get_shader_param(struct pipe_screen *pscreen, 322bf215546Sopenharmony_ci enum pipe_shader_type shader, 323bf215546Sopenharmony_ci enum pipe_shader_cap param) 324bf215546Sopenharmony_ci{ 325bf215546Sopenharmony_ci struct nv30_screen *screen = nv30_screen(pscreen); 326bf215546Sopenharmony_ci struct nouveau_object *eng3d = screen->eng3d; 327bf215546Sopenharmony_ci 328bf215546Sopenharmony_ci switch (shader) { 329bf215546Sopenharmony_ci case PIPE_SHADER_VERTEX: 330bf215546Sopenharmony_ci switch (param) { 331bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_INSTRUCTIONS: 332bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS: 333bf215546Sopenharmony_ci return (eng3d->oclass >= NV40_3D_CLASS) ? 512 : 256; 334bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS: 335bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS: 336bf215546Sopenharmony_ci return (eng3d->oclass >= NV40_3D_CLASS) ? 512 : 0; 337bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH: 338bf215546Sopenharmony_ci return 0; 339bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_INPUTS: 340bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_OUTPUTS: 341bf215546Sopenharmony_ci return 16; 342bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_CONST_BUFFER0_SIZE: 343bf215546Sopenharmony_ci return ((eng3d->oclass >= NV40_3D_CLASS) ? (468 - 6): (256 - 6)) * sizeof(float[4]); 344bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_CONST_BUFFERS: 345bf215546Sopenharmony_ci return 1; 346bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_TEMPS: 347bf215546Sopenharmony_ci return (eng3d->oclass >= NV40_3D_CLASS) ? 32 : 13; 348bf215546Sopenharmony_ci case PIPE_SHADER_CAP_PREFERRED_IR: 349bf215546Sopenharmony_ci return (NOUVEAU_DEBUG & NOUVEAU_DEBUG_USE_TGSI) ? PIPE_SHADER_IR_TGSI : PIPE_SHADER_IR_NIR; 350bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: 351bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: 352bf215546Sopenharmony_ci return 0; 353bf215546Sopenharmony_ci case PIPE_SHADER_CAP_CONT_SUPPORTED: 354bf215546Sopenharmony_ci case PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED: 355bf215546Sopenharmony_ci case PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR: 356bf215546Sopenharmony_ci case PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR: 357bf215546Sopenharmony_ci case PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR: 358bf215546Sopenharmony_ci case PIPE_SHADER_CAP_INDIRECT_CONST_ADDR: 359bf215546Sopenharmony_ci case PIPE_SHADER_CAP_SUBROUTINES: 360bf215546Sopenharmony_ci case PIPE_SHADER_CAP_INTEGERS: 361bf215546Sopenharmony_ci case PIPE_SHADER_CAP_INT64_ATOMICS: 362bf215546Sopenharmony_ci case PIPE_SHADER_CAP_FP16: 363bf215546Sopenharmony_ci case PIPE_SHADER_CAP_FP16_DERIVATIVES: 364bf215546Sopenharmony_ci case PIPE_SHADER_CAP_FP16_CONST_BUFFERS: 365bf215546Sopenharmony_ci case PIPE_SHADER_CAP_INT16: 366bf215546Sopenharmony_ci case PIPE_SHADER_CAP_GLSL_16BIT_CONSTS: 367bf215546Sopenharmony_ci case PIPE_SHADER_CAP_DROUND_SUPPORTED: 368bf215546Sopenharmony_ci case PIPE_SHADER_CAP_DFRACEXP_DLDEXP_SUPPORTED: 369bf215546Sopenharmony_ci case PIPE_SHADER_CAP_LDEXP_SUPPORTED: 370bf215546Sopenharmony_ci case PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE: 371bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_SHADER_BUFFERS: 372bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_SHADER_IMAGES: 373bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTERS: 374bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTER_BUFFERS: 375bf215546Sopenharmony_ci return 0; 376bf215546Sopenharmony_ci case PIPE_SHADER_CAP_SUPPORTED_IRS: 377bf215546Sopenharmony_ci return (1 << PIPE_SHADER_IR_NIR) | (1 << PIPE_SHADER_IR_TGSI); 378bf215546Sopenharmony_ci default: 379bf215546Sopenharmony_ci debug_printf("unknown vertex shader param %d\n", param); 380bf215546Sopenharmony_ci return 0; 381bf215546Sopenharmony_ci } 382bf215546Sopenharmony_ci break; 383bf215546Sopenharmony_ci case PIPE_SHADER_FRAGMENT: 384bf215546Sopenharmony_ci switch (param) { 385bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_INSTRUCTIONS: 386bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS: 387bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS: 388bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS: 389bf215546Sopenharmony_ci return 4096; 390bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH: 391bf215546Sopenharmony_ci return 0; 392bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_INPUTS: 393bf215546Sopenharmony_ci return 8; /* should be possible to do 10 with nv4x */ 394bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_OUTPUTS: 395bf215546Sopenharmony_ci return 4; 396bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_CONST_BUFFER0_SIZE: 397bf215546Sopenharmony_ci return ((eng3d->oclass >= NV40_3D_CLASS) ? 224 : 32) * sizeof(float[4]); 398bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_CONST_BUFFERS: 399bf215546Sopenharmony_ci return 1; 400bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_TEMPS: 401bf215546Sopenharmony_ci return 32; 402bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: 403bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: 404bf215546Sopenharmony_ci return 16; 405bf215546Sopenharmony_ci case PIPE_SHADER_CAP_PREFERRED_IR: 406bf215546Sopenharmony_ci return (NOUVEAU_DEBUG & NOUVEAU_DEBUG_USE_TGSI) ? PIPE_SHADER_IR_TGSI : PIPE_SHADER_IR_NIR; 407bf215546Sopenharmony_ci case PIPE_SHADER_CAP_CONT_SUPPORTED: 408bf215546Sopenharmony_ci case PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED: 409bf215546Sopenharmony_ci case PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR: 410bf215546Sopenharmony_ci case PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR: 411bf215546Sopenharmony_ci case PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR: 412bf215546Sopenharmony_ci case PIPE_SHADER_CAP_INDIRECT_CONST_ADDR: 413bf215546Sopenharmony_ci case PIPE_SHADER_CAP_SUBROUTINES: 414bf215546Sopenharmony_ci case PIPE_SHADER_CAP_INTEGERS: 415bf215546Sopenharmony_ci case PIPE_SHADER_CAP_FP16: 416bf215546Sopenharmony_ci case PIPE_SHADER_CAP_FP16_DERIVATIVES: 417bf215546Sopenharmony_ci case PIPE_SHADER_CAP_FP16_CONST_BUFFERS: 418bf215546Sopenharmony_ci case PIPE_SHADER_CAP_INT16: 419bf215546Sopenharmony_ci case PIPE_SHADER_CAP_GLSL_16BIT_CONSTS: 420bf215546Sopenharmony_ci case PIPE_SHADER_CAP_DROUND_SUPPORTED: 421bf215546Sopenharmony_ci case PIPE_SHADER_CAP_DFRACEXP_DLDEXP_SUPPORTED: 422bf215546Sopenharmony_ci case PIPE_SHADER_CAP_LDEXP_SUPPORTED: 423bf215546Sopenharmony_ci case PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE: 424bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_SHADER_BUFFERS: 425bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_SHADER_IMAGES: 426bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTERS: 427bf215546Sopenharmony_ci case PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTER_BUFFERS: 428bf215546Sopenharmony_ci return 0; 429bf215546Sopenharmony_ci case PIPE_SHADER_CAP_SUPPORTED_IRS: 430bf215546Sopenharmony_ci return (1 << PIPE_SHADER_IR_NIR) | (1 << PIPE_SHADER_IR_TGSI); 431bf215546Sopenharmony_ci default: 432bf215546Sopenharmony_ci debug_printf("unknown fragment shader param %d\n", param); 433bf215546Sopenharmony_ci return 0; 434bf215546Sopenharmony_ci } 435bf215546Sopenharmony_ci break; 436bf215546Sopenharmony_ci default: 437bf215546Sopenharmony_ci return 0; 438bf215546Sopenharmony_ci } 439bf215546Sopenharmony_ci} 440bf215546Sopenharmony_ci 441bf215546Sopenharmony_cistatic bool 442bf215546Sopenharmony_cinv30_screen_is_format_supported(struct pipe_screen *pscreen, 443bf215546Sopenharmony_ci enum pipe_format format, 444bf215546Sopenharmony_ci enum pipe_texture_target target, 445bf215546Sopenharmony_ci unsigned sample_count, 446bf215546Sopenharmony_ci unsigned storage_sample_count, 447bf215546Sopenharmony_ci unsigned bindings) 448bf215546Sopenharmony_ci{ 449bf215546Sopenharmony_ci if (sample_count > nv30_screen(pscreen)->max_sample_count) 450bf215546Sopenharmony_ci return false; 451bf215546Sopenharmony_ci 452bf215546Sopenharmony_ci if (!(0x00000017 & (1 << sample_count))) 453bf215546Sopenharmony_ci return false; 454bf215546Sopenharmony_ci 455bf215546Sopenharmony_ci if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) 456bf215546Sopenharmony_ci return false; 457bf215546Sopenharmony_ci 458bf215546Sopenharmony_ci /* No way to render to a swizzled 3d texture. We don't necessarily know if 459bf215546Sopenharmony_ci * it's swizzled or not here, but we have to assume anyways. 460bf215546Sopenharmony_ci */ 461bf215546Sopenharmony_ci if (target == PIPE_TEXTURE_3D && (bindings & PIPE_BIND_RENDER_TARGET)) 462bf215546Sopenharmony_ci return false; 463bf215546Sopenharmony_ci 464bf215546Sopenharmony_ci /* shared is always supported */ 465bf215546Sopenharmony_ci bindings &= ~PIPE_BIND_SHARED; 466bf215546Sopenharmony_ci 467bf215546Sopenharmony_ci if (bindings & PIPE_BIND_INDEX_BUFFER) { 468bf215546Sopenharmony_ci if (format != PIPE_FORMAT_R8_UINT && 469bf215546Sopenharmony_ci format != PIPE_FORMAT_R16_UINT && 470bf215546Sopenharmony_ci format != PIPE_FORMAT_R32_UINT) 471bf215546Sopenharmony_ci return false; 472bf215546Sopenharmony_ci bindings &= ~PIPE_BIND_INDEX_BUFFER; 473bf215546Sopenharmony_ci } 474bf215546Sopenharmony_ci 475bf215546Sopenharmony_ci return (nv30_format_info(pscreen, format)->bindings & bindings) == bindings; 476bf215546Sopenharmony_ci} 477bf215546Sopenharmony_ci 478bf215546Sopenharmony_cistatic const nir_shader_compiler_options nv30_base_compiler_options = { 479bf215546Sopenharmony_ci .fuse_ffma32 = true, 480bf215546Sopenharmony_ci .fuse_ffma64 = true, 481bf215546Sopenharmony_ci .lower_bitops = true, 482bf215546Sopenharmony_ci .lower_extract_byte = true, 483bf215546Sopenharmony_ci .lower_extract_word = true, 484bf215546Sopenharmony_ci .lower_fdiv = true, 485bf215546Sopenharmony_ci .lower_fsat = true, 486bf215546Sopenharmony_ci .lower_insert_byte = true, 487bf215546Sopenharmony_ci .lower_insert_word = true, 488bf215546Sopenharmony_ci .lower_fdph = true, 489bf215546Sopenharmony_ci .lower_flrp32 = true, 490bf215546Sopenharmony_ci .lower_flrp64 = true, 491bf215546Sopenharmony_ci .lower_fmod = true, 492bf215546Sopenharmony_ci .lower_fpow = true, /* In hardware as of nv40 FS */ 493bf215546Sopenharmony_ci .lower_rotate = true, 494bf215546Sopenharmony_ci .lower_uniforms_to_ubo = true, 495bf215546Sopenharmony_ci .lower_vector_cmp = true, 496bf215546Sopenharmony_ci .force_indirect_unrolling = nir_var_all, 497bf215546Sopenharmony_ci .force_indirect_unrolling_sampler = true, 498bf215546Sopenharmony_ci .max_unroll_iterations = 32, 499bf215546Sopenharmony_ci .no_integers = true, 500bf215546Sopenharmony_ci 501bf215546Sopenharmony_ci .use_interpolated_input_intrinsics = true, 502bf215546Sopenharmony_ci}; 503bf215546Sopenharmony_ci 504bf215546Sopenharmony_cistatic const void * 505bf215546Sopenharmony_cinv30_screen_get_compiler_options(struct pipe_screen *pscreen, 506bf215546Sopenharmony_ci enum pipe_shader_ir ir, 507bf215546Sopenharmony_ci enum pipe_shader_type shader) 508bf215546Sopenharmony_ci{ 509bf215546Sopenharmony_ci struct nv30_screen *screen = nv30_screen(pscreen); 510bf215546Sopenharmony_ci assert(ir == PIPE_SHADER_IR_NIR); 511bf215546Sopenharmony_ci 512bf215546Sopenharmony_ci /* The FS compiler options are different between nv30 and nv40, and are set 513bf215546Sopenharmony_ci * up at screen creation time. 514bf215546Sopenharmony_ci */ 515bf215546Sopenharmony_ci if (shader == PIPE_SHADER_FRAGMENT) 516bf215546Sopenharmony_ci return &screen->fs_compiler_options; 517bf215546Sopenharmony_ci 518bf215546Sopenharmony_ci return &nv30_base_compiler_options; 519bf215546Sopenharmony_ci} 520bf215546Sopenharmony_ci 521bf215546Sopenharmony_cistatic void 522bf215546Sopenharmony_cinv30_screen_fence_emit(struct pipe_screen *pscreen, uint32_t *sequence) 523bf215546Sopenharmony_ci{ 524bf215546Sopenharmony_ci struct nv30_screen *screen = nv30_screen(pscreen); 525bf215546Sopenharmony_ci struct nouveau_pushbuf *push = screen->base.pushbuf; 526bf215546Sopenharmony_ci 527bf215546Sopenharmony_ci *sequence = ++screen->base.fence.sequence; 528bf215546Sopenharmony_ci 529bf215546Sopenharmony_ci assert(PUSH_AVAIL(push) + push->rsvd_kick >= 3); 530bf215546Sopenharmony_ci PUSH_DATA (push, NV30_3D_FENCE_OFFSET | 531bf215546Sopenharmony_ci (2 /* size */ << 18) | (7 /* subchan */ << 13)); 532bf215546Sopenharmony_ci PUSH_DATA (push, 0); 533bf215546Sopenharmony_ci PUSH_DATA (push, *sequence); 534bf215546Sopenharmony_ci} 535bf215546Sopenharmony_ci 536bf215546Sopenharmony_cistatic uint32_t 537bf215546Sopenharmony_cinv30_screen_fence_update(struct pipe_screen *pscreen) 538bf215546Sopenharmony_ci{ 539bf215546Sopenharmony_ci struct nv30_screen *screen = nv30_screen(pscreen); 540bf215546Sopenharmony_ci struct nv04_notify *fence = screen->fence->data; 541bf215546Sopenharmony_ci return *(uint32_t *)((char *)screen->notify->map + fence->offset); 542bf215546Sopenharmony_ci} 543bf215546Sopenharmony_ci 544bf215546Sopenharmony_cistatic void 545bf215546Sopenharmony_cinv30_screen_destroy(struct pipe_screen *pscreen) 546bf215546Sopenharmony_ci{ 547bf215546Sopenharmony_ci struct nv30_screen *screen = nv30_screen(pscreen); 548bf215546Sopenharmony_ci 549bf215546Sopenharmony_ci if (!nouveau_drm_screen_unref(&screen->base)) 550bf215546Sopenharmony_ci return; 551bf215546Sopenharmony_ci 552bf215546Sopenharmony_ci nouveau_fence_cleanup(&screen->base); 553bf215546Sopenharmony_ci 554bf215546Sopenharmony_ci nouveau_bo_ref(NULL, &screen->notify); 555bf215546Sopenharmony_ci 556bf215546Sopenharmony_ci nouveau_heap_destroy(&screen->query_heap); 557bf215546Sopenharmony_ci nouveau_heap_destroy(&screen->vp_exec_heap); 558bf215546Sopenharmony_ci nouveau_heap_destroy(&screen->vp_data_heap); 559bf215546Sopenharmony_ci 560bf215546Sopenharmony_ci nouveau_object_del(&screen->query); 561bf215546Sopenharmony_ci nouveau_object_del(&screen->fence); 562bf215546Sopenharmony_ci nouveau_object_del(&screen->ntfy); 563bf215546Sopenharmony_ci 564bf215546Sopenharmony_ci nouveau_object_del(&screen->sifm); 565bf215546Sopenharmony_ci nouveau_object_del(&screen->swzsurf); 566bf215546Sopenharmony_ci nouveau_object_del(&screen->surf2d); 567bf215546Sopenharmony_ci nouveau_object_del(&screen->m2mf); 568bf215546Sopenharmony_ci nouveau_object_del(&screen->eng3d); 569bf215546Sopenharmony_ci nouveau_object_del(&screen->null); 570bf215546Sopenharmony_ci 571bf215546Sopenharmony_ci nouveau_screen_fini(&screen->base); 572bf215546Sopenharmony_ci FREE(screen); 573bf215546Sopenharmony_ci} 574bf215546Sopenharmony_ci 575bf215546Sopenharmony_ci#define FAIL_SCREEN_INIT(str, err) \ 576bf215546Sopenharmony_ci do { \ 577bf215546Sopenharmony_ci NOUVEAU_ERR(str, err); \ 578bf215546Sopenharmony_ci screen->base.base.context_create = NULL; \ 579bf215546Sopenharmony_ci return &screen->base; \ 580bf215546Sopenharmony_ci } while(0) 581bf215546Sopenharmony_ci 582bf215546Sopenharmony_cistruct nouveau_screen * 583bf215546Sopenharmony_cinv30_screen_create(struct nouveau_device *dev) 584bf215546Sopenharmony_ci{ 585bf215546Sopenharmony_ci struct nv30_screen *screen; 586bf215546Sopenharmony_ci struct pipe_screen *pscreen; 587bf215546Sopenharmony_ci struct nouveau_pushbuf *push; 588bf215546Sopenharmony_ci struct nv04_fifo *fifo; 589bf215546Sopenharmony_ci unsigned oclass = 0; 590bf215546Sopenharmony_ci int ret, i; 591bf215546Sopenharmony_ci 592bf215546Sopenharmony_ci switch (dev->chipset & 0xf0) { 593bf215546Sopenharmony_ci case 0x30: 594bf215546Sopenharmony_ci if (RANKINE_0397_CHIPSET & (1 << (dev->chipset & 0x0f))) 595bf215546Sopenharmony_ci oclass = NV30_3D_CLASS; 596bf215546Sopenharmony_ci else 597bf215546Sopenharmony_ci if (RANKINE_0697_CHIPSET & (1 << (dev->chipset & 0x0f))) 598bf215546Sopenharmony_ci oclass = NV34_3D_CLASS; 599bf215546Sopenharmony_ci else 600bf215546Sopenharmony_ci if (RANKINE_0497_CHIPSET & (1 << (dev->chipset & 0x0f))) 601bf215546Sopenharmony_ci oclass = NV35_3D_CLASS; 602bf215546Sopenharmony_ci break; 603bf215546Sopenharmony_ci case 0x40: 604bf215546Sopenharmony_ci if (CURIE_4097_CHIPSET & (1 << (dev->chipset & 0x0f))) 605bf215546Sopenharmony_ci oclass = NV40_3D_CLASS; 606bf215546Sopenharmony_ci else 607bf215546Sopenharmony_ci if (CURIE_4497_CHIPSET & (1 << (dev->chipset & 0x0f))) 608bf215546Sopenharmony_ci oclass = NV44_3D_CLASS; 609bf215546Sopenharmony_ci break; 610bf215546Sopenharmony_ci case 0x60: 611bf215546Sopenharmony_ci if (CURIE_4497_CHIPSET6X & (1 << (dev->chipset & 0x0f))) 612bf215546Sopenharmony_ci oclass = NV44_3D_CLASS; 613bf215546Sopenharmony_ci break; 614bf215546Sopenharmony_ci default: 615bf215546Sopenharmony_ci break; 616bf215546Sopenharmony_ci } 617bf215546Sopenharmony_ci 618bf215546Sopenharmony_ci if (!oclass) { 619bf215546Sopenharmony_ci NOUVEAU_ERR("unknown 3d class for 0x%02x\n", dev->chipset); 620bf215546Sopenharmony_ci return NULL; 621bf215546Sopenharmony_ci } 622bf215546Sopenharmony_ci 623bf215546Sopenharmony_ci screen = CALLOC_STRUCT(nv30_screen); 624bf215546Sopenharmony_ci if (!screen) 625bf215546Sopenharmony_ci return NULL; 626bf215546Sopenharmony_ci 627bf215546Sopenharmony_ci pscreen = &screen->base.base; 628bf215546Sopenharmony_ci pscreen->destroy = nv30_screen_destroy; 629bf215546Sopenharmony_ci 630bf215546Sopenharmony_ci /* 631bf215546Sopenharmony_ci * Some modern apps try to use msaa without keeping in mind the 632bf215546Sopenharmony_ci * restrictions on videomem of older cards. Resulting in dmesg saying: 633bf215546Sopenharmony_ci * [ 1197.850642] nouveau E[soffice.bin[3785]] fail ttm_validate 634bf215546Sopenharmony_ci * [ 1197.850648] nouveau E[soffice.bin[3785]] validating bo list 635bf215546Sopenharmony_ci * [ 1197.850654] nouveau E[soffice.bin[3785]] validate: -12 636bf215546Sopenharmony_ci * 637bf215546Sopenharmony_ci * Because we are running out of video memory, after which the program 638bf215546Sopenharmony_ci * using the msaa visual freezes, and eventually the entire system freezes. 639bf215546Sopenharmony_ci * 640bf215546Sopenharmony_ci * To work around this we do not allow msaa visauls by default and allow 641bf215546Sopenharmony_ci * the user to override this via NV30_MAX_MSAA. 642bf215546Sopenharmony_ci */ 643bf215546Sopenharmony_ci screen->max_sample_count = debug_get_num_option("NV30_MAX_MSAA", 0); 644bf215546Sopenharmony_ci if (screen->max_sample_count > 4) 645bf215546Sopenharmony_ci screen->max_sample_count = 4; 646bf215546Sopenharmony_ci 647bf215546Sopenharmony_ci pscreen->get_param = nv30_screen_get_param; 648bf215546Sopenharmony_ci pscreen->get_paramf = nv30_screen_get_paramf; 649bf215546Sopenharmony_ci pscreen->get_shader_param = nv30_screen_get_shader_param; 650bf215546Sopenharmony_ci pscreen->context_create = nv30_context_create; 651bf215546Sopenharmony_ci pscreen->is_format_supported = nv30_screen_is_format_supported; 652bf215546Sopenharmony_ci pscreen->get_compiler_options = nv30_screen_get_compiler_options; 653bf215546Sopenharmony_ci 654bf215546Sopenharmony_ci nv30_resource_screen_init(pscreen); 655bf215546Sopenharmony_ci nouveau_screen_init_vdec(&screen->base); 656bf215546Sopenharmony_ci 657bf215546Sopenharmony_ci screen->base.fence.emit = nv30_screen_fence_emit; 658bf215546Sopenharmony_ci screen->base.fence.update = nv30_screen_fence_update; 659bf215546Sopenharmony_ci 660bf215546Sopenharmony_ci ret = nouveau_screen_init(&screen->base, dev); 661bf215546Sopenharmony_ci if (ret) 662bf215546Sopenharmony_ci FAIL_SCREEN_INIT("nv30_screen_init failed: %d\n", ret); 663bf215546Sopenharmony_ci 664bf215546Sopenharmony_ci screen->base.vidmem_bindings |= PIPE_BIND_VERTEX_BUFFER; 665bf215546Sopenharmony_ci screen->base.sysmem_bindings |= PIPE_BIND_VERTEX_BUFFER; 666bf215546Sopenharmony_ci if (oclass == NV40_3D_CLASS) { 667bf215546Sopenharmony_ci screen->base.vidmem_bindings |= PIPE_BIND_INDEX_BUFFER; 668bf215546Sopenharmony_ci screen->base.sysmem_bindings |= PIPE_BIND_INDEX_BUFFER; 669bf215546Sopenharmony_ci } 670bf215546Sopenharmony_ci 671bf215546Sopenharmony_ci screen->fs_compiler_options = nv30_base_compiler_options; 672bf215546Sopenharmony_ci screen->fs_compiler_options.lower_fsat = false; 673bf215546Sopenharmony_ci if (oclass >= NV40_3D_CLASS) 674bf215546Sopenharmony_ci screen->fs_compiler_options.lower_fpow = false; 675bf215546Sopenharmony_ci 676bf215546Sopenharmony_ci fifo = screen->base.channel->data; 677bf215546Sopenharmony_ci push = screen->base.pushbuf; 678bf215546Sopenharmony_ci push->rsvd_kick = 16; 679bf215546Sopenharmony_ci 680bf215546Sopenharmony_ci ret = nouveau_object_new(screen->base.channel, 0x00000000, NV01_NULL_CLASS, 681bf215546Sopenharmony_ci NULL, 0, &screen->null); 682bf215546Sopenharmony_ci if (ret) 683bf215546Sopenharmony_ci FAIL_SCREEN_INIT("error allocating null object: %d\n", ret); 684bf215546Sopenharmony_ci 685bf215546Sopenharmony_ci /* DMA_FENCE refuses to accept DMA objects with "adjust" filled in, 686bf215546Sopenharmony_ci * this means that the address pointed at by the DMA object must 687bf215546Sopenharmony_ci * be 4KiB aligned, which means this object needs to be the first 688bf215546Sopenharmony_ci * one allocated on the channel. 689bf215546Sopenharmony_ci */ 690bf215546Sopenharmony_ci ret = nouveau_object_new(screen->base.channel, 0xbeef1e00, 691bf215546Sopenharmony_ci NOUVEAU_NOTIFIER_CLASS, &(struct nv04_notify) { 692bf215546Sopenharmony_ci .length = 32 }, sizeof(struct nv04_notify), 693bf215546Sopenharmony_ci &screen->fence); 694bf215546Sopenharmony_ci if (ret) 695bf215546Sopenharmony_ci FAIL_SCREEN_INIT("error allocating fence notifier: %d\n", ret); 696bf215546Sopenharmony_ci 697bf215546Sopenharmony_ci /* DMA_NOTIFY object, we don't actually use this but M2MF fails without */ 698bf215546Sopenharmony_ci ret = nouveau_object_new(screen->base.channel, 0xbeef0301, 699bf215546Sopenharmony_ci NOUVEAU_NOTIFIER_CLASS, &(struct nv04_notify) { 700bf215546Sopenharmony_ci .length = 32 }, sizeof(struct nv04_notify), 701bf215546Sopenharmony_ci &screen->ntfy); 702bf215546Sopenharmony_ci if (ret) 703bf215546Sopenharmony_ci FAIL_SCREEN_INIT("error allocating sync notifier: %d\n", ret); 704bf215546Sopenharmony_ci 705bf215546Sopenharmony_ci /* DMA_QUERY, used to implement occlusion queries, we attempt to allocate 706bf215546Sopenharmony_ci * the remainder of the "notifier block" assigned by the kernel for 707bf215546Sopenharmony_ci * use as query objects 708bf215546Sopenharmony_ci */ 709bf215546Sopenharmony_ci ret = nouveau_object_new(screen->base.channel, 0xbeef0351, 710bf215546Sopenharmony_ci NOUVEAU_NOTIFIER_CLASS, &(struct nv04_notify) { 711bf215546Sopenharmony_ci .length = 4096 - 128 }, sizeof(struct nv04_notify), 712bf215546Sopenharmony_ci &screen->query); 713bf215546Sopenharmony_ci if (ret) 714bf215546Sopenharmony_ci FAIL_SCREEN_INIT("error allocating query notifier: %d\n", ret); 715bf215546Sopenharmony_ci 716bf215546Sopenharmony_ci ret = nouveau_heap_init(&screen->query_heap, 0, 4096 - 128); 717bf215546Sopenharmony_ci if (ret) 718bf215546Sopenharmony_ci FAIL_SCREEN_INIT("error creating query heap: %d\n", ret); 719bf215546Sopenharmony_ci 720bf215546Sopenharmony_ci list_inithead(&screen->queries); 721bf215546Sopenharmony_ci 722bf215546Sopenharmony_ci /* Vertex program resources (code/data), currently 6 of the constant 723bf215546Sopenharmony_ci * slots are reserved to implement user clipping planes 724bf215546Sopenharmony_ci */ 725bf215546Sopenharmony_ci if (oclass < NV40_3D_CLASS) { 726bf215546Sopenharmony_ci nouveau_heap_init(&screen->vp_exec_heap, 0, 256); 727bf215546Sopenharmony_ci nouveau_heap_init(&screen->vp_data_heap, 6, 256 - 6); 728bf215546Sopenharmony_ci } else { 729bf215546Sopenharmony_ci nouveau_heap_init(&screen->vp_exec_heap, 0, 512); 730bf215546Sopenharmony_ci nouveau_heap_init(&screen->vp_data_heap, 6, 468 - 6); 731bf215546Sopenharmony_ci } 732bf215546Sopenharmony_ci 733bf215546Sopenharmony_ci ret = nouveau_bo_wrap(screen->base.device, fifo->notify, &screen->notify); 734bf215546Sopenharmony_ci if (ret == 0) 735bf215546Sopenharmony_ci ret = nouveau_bo_map(screen->notify, 0, screen->base.client); 736bf215546Sopenharmony_ci if (ret) 737bf215546Sopenharmony_ci FAIL_SCREEN_INIT("error mapping notifier memory: %d\n", ret); 738bf215546Sopenharmony_ci 739bf215546Sopenharmony_ci ret = nouveau_object_new(screen->base.channel, 0xbeef3097, oclass, 740bf215546Sopenharmony_ci NULL, 0, &screen->eng3d); 741bf215546Sopenharmony_ci if (ret) 742bf215546Sopenharmony_ci FAIL_SCREEN_INIT("error allocating 3d object: %d\n", ret); 743bf215546Sopenharmony_ci 744bf215546Sopenharmony_ci BEGIN_NV04(push, NV01_SUBC(3D, OBJECT), 1); 745bf215546Sopenharmony_ci PUSH_DATA (push, screen->eng3d->handle); 746bf215546Sopenharmony_ci BEGIN_NV04(push, NV30_3D(DMA_NOTIFY), 13); 747bf215546Sopenharmony_ci PUSH_DATA (push, screen->ntfy->handle); 748bf215546Sopenharmony_ci PUSH_DATA (push, fifo->vram); /* TEXTURE0 */ 749bf215546Sopenharmony_ci PUSH_DATA (push, fifo->gart); /* TEXTURE1 */ 750bf215546Sopenharmony_ci PUSH_DATA (push, fifo->vram); /* COLOR1 */ 751bf215546Sopenharmony_ci PUSH_DATA (push, screen->null->handle); /* UNK190 */ 752bf215546Sopenharmony_ci PUSH_DATA (push, fifo->vram); /* COLOR0 */ 753bf215546Sopenharmony_ci PUSH_DATA (push, fifo->vram); /* ZETA */ 754bf215546Sopenharmony_ci PUSH_DATA (push, fifo->vram); /* VTXBUF0 */ 755bf215546Sopenharmony_ci PUSH_DATA (push, fifo->gart); /* VTXBUF1 */ 756bf215546Sopenharmony_ci PUSH_DATA (push, screen->fence->handle); /* FENCE */ 757bf215546Sopenharmony_ci PUSH_DATA (push, screen->query->handle); /* QUERY - intr 0x80 if nullobj */ 758bf215546Sopenharmony_ci PUSH_DATA (push, screen->null->handle); /* UNK1AC */ 759bf215546Sopenharmony_ci PUSH_DATA (push, screen->null->handle); /* UNK1B0 */ 760bf215546Sopenharmony_ci if (screen->eng3d->oclass < NV40_3D_CLASS) { 761bf215546Sopenharmony_ci BEGIN_NV04(push, SUBC_3D(0x03b0), 1); 762bf215546Sopenharmony_ci PUSH_DATA (push, 0x00100000); 763bf215546Sopenharmony_ci BEGIN_NV04(push, SUBC_3D(0x1d80), 1); 764bf215546Sopenharmony_ci PUSH_DATA (push, 3); 765bf215546Sopenharmony_ci 766bf215546Sopenharmony_ci BEGIN_NV04(push, SUBC_3D(0x1e98), 1); 767bf215546Sopenharmony_ci PUSH_DATA (push, 0); 768bf215546Sopenharmony_ci BEGIN_NV04(push, SUBC_3D(0x17e0), 3); 769bf215546Sopenharmony_ci PUSH_DATA (push, fui(0.0)); 770bf215546Sopenharmony_ci PUSH_DATA (push, fui(0.0)); 771bf215546Sopenharmony_ci PUSH_DATA (push, fui(1.0)); 772bf215546Sopenharmony_ci BEGIN_NV04(push, SUBC_3D(0x1f80), 16); 773bf215546Sopenharmony_ci for (i = 0; i < 16; i++) 774bf215546Sopenharmony_ci PUSH_DATA (push, (i == 8) ? 0x0000ffff : 0); 775bf215546Sopenharmony_ci 776bf215546Sopenharmony_ci BEGIN_NV04(push, NV30_3D(RC_ENABLE), 1); 777bf215546Sopenharmony_ci PUSH_DATA (push, 0); 778bf215546Sopenharmony_ci } else { 779bf215546Sopenharmony_ci BEGIN_NV04(push, NV40_3D(DMA_COLOR2), 2); 780bf215546Sopenharmony_ci PUSH_DATA (push, fifo->vram); 781bf215546Sopenharmony_ci PUSH_DATA (push, fifo->vram); /* COLOR3 */ 782bf215546Sopenharmony_ci 783bf215546Sopenharmony_ci BEGIN_NV04(push, SUBC_3D(0x1450), 1); 784bf215546Sopenharmony_ci PUSH_DATA (push, 0x00000004); 785bf215546Sopenharmony_ci 786bf215546Sopenharmony_ci BEGIN_NV04(push, SUBC_3D(0x1ea4), 3); /* ZCULL */ 787bf215546Sopenharmony_ci PUSH_DATA (push, 0x00000010); 788bf215546Sopenharmony_ci PUSH_DATA (push, 0x01000100); 789bf215546Sopenharmony_ci PUSH_DATA (push, 0xff800006); 790bf215546Sopenharmony_ci 791bf215546Sopenharmony_ci /* vtxprog output routing */ 792bf215546Sopenharmony_ci BEGIN_NV04(push, SUBC_3D(0x1fc4), 1); 793bf215546Sopenharmony_ci PUSH_DATA (push, 0x06144321); 794bf215546Sopenharmony_ci BEGIN_NV04(push, SUBC_3D(0x1fc8), 2); 795bf215546Sopenharmony_ci PUSH_DATA (push, 0xedcba987); 796bf215546Sopenharmony_ci PUSH_DATA (push, 0x0000006f); 797bf215546Sopenharmony_ci BEGIN_NV04(push, SUBC_3D(0x1fd0), 1); 798bf215546Sopenharmony_ci PUSH_DATA (push, 0x00171615); 799bf215546Sopenharmony_ci BEGIN_NV04(push, SUBC_3D(0x1fd4), 1); 800bf215546Sopenharmony_ci PUSH_DATA (push, 0x001b1a19); 801bf215546Sopenharmony_ci 802bf215546Sopenharmony_ci BEGIN_NV04(push, SUBC_3D(0x1ef8), 1); 803bf215546Sopenharmony_ci PUSH_DATA (push, 0x0020ffff); 804bf215546Sopenharmony_ci BEGIN_NV04(push, SUBC_3D(0x1d64), 1); 805bf215546Sopenharmony_ci PUSH_DATA (push, 0x01d300d4); 806bf215546Sopenharmony_ci 807bf215546Sopenharmony_ci BEGIN_NV04(push, NV40_3D(MIPMAP_ROUNDING), 1); 808bf215546Sopenharmony_ci PUSH_DATA (push, NV40_3D_MIPMAP_ROUNDING_MODE_DOWN); 809bf215546Sopenharmony_ci } 810bf215546Sopenharmony_ci 811bf215546Sopenharmony_ci ret = nouveau_object_new(screen->base.channel, 0xbeef3901, NV03_M2MF_CLASS, 812bf215546Sopenharmony_ci NULL, 0, &screen->m2mf); 813bf215546Sopenharmony_ci if (ret) 814bf215546Sopenharmony_ci FAIL_SCREEN_INIT("error allocating m2mf object: %d\n", ret); 815bf215546Sopenharmony_ci 816bf215546Sopenharmony_ci BEGIN_NV04(push, NV01_SUBC(M2MF, OBJECT), 1); 817bf215546Sopenharmony_ci PUSH_DATA (push, screen->m2mf->handle); 818bf215546Sopenharmony_ci BEGIN_NV04(push, NV03_M2MF(DMA_NOTIFY), 1); 819bf215546Sopenharmony_ci PUSH_DATA (push, screen->ntfy->handle); 820bf215546Sopenharmony_ci 821bf215546Sopenharmony_ci ret = nouveau_object_new(screen->base.channel, 0xbeef6201, 822bf215546Sopenharmony_ci NV10_SURFACE_2D_CLASS, NULL, 0, &screen->surf2d); 823bf215546Sopenharmony_ci if (ret) 824bf215546Sopenharmony_ci FAIL_SCREEN_INIT("error allocating surf2d object: %d\n", ret); 825bf215546Sopenharmony_ci 826bf215546Sopenharmony_ci BEGIN_NV04(push, NV01_SUBC(SF2D, OBJECT), 1); 827bf215546Sopenharmony_ci PUSH_DATA (push, screen->surf2d->handle); 828bf215546Sopenharmony_ci BEGIN_NV04(push, NV04_SF2D(DMA_NOTIFY), 1); 829bf215546Sopenharmony_ci PUSH_DATA (push, screen->ntfy->handle); 830bf215546Sopenharmony_ci 831bf215546Sopenharmony_ci if (dev->chipset < 0x40) 832bf215546Sopenharmony_ci oclass = NV30_SURFACE_SWZ_CLASS; 833bf215546Sopenharmony_ci else 834bf215546Sopenharmony_ci oclass = NV40_SURFACE_SWZ_CLASS; 835bf215546Sopenharmony_ci 836bf215546Sopenharmony_ci ret = nouveau_object_new(screen->base.channel, 0xbeef5201, oclass, 837bf215546Sopenharmony_ci NULL, 0, &screen->swzsurf); 838bf215546Sopenharmony_ci if (ret) 839bf215546Sopenharmony_ci FAIL_SCREEN_INIT("error allocating swizzled surface object: %d\n", ret); 840bf215546Sopenharmony_ci 841bf215546Sopenharmony_ci BEGIN_NV04(push, NV01_SUBC(SSWZ, OBJECT), 1); 842bf215546Sopenharmony_ci PUSH_DATA (push, screen->swzsurf->handle); 843bf215546Sopenharmony_ci BEGIN_NV04(push, NV04_SSWZ(DMA_NOTIFY), 1); 844bf215546Sopenharmony_ci PUSH_DATA (push, screen->ntfy->handle); 845bf215546Sopenharmony_ci 846bf215546Sopenharmony_ci if (dev->chipset < 0x40) 847bf215546Sopenharmony_ci oclass = NV30_SIFM_CLASS; 848bf215546Sopenharmony_ci else 849bf215546Sopenharmony_ci oclass = NV40_SIFM_CLASS; 850bf215546Sopenharmony_ci 851bf215546Sopenharmony_ci ret = nouveau_object_new(screen->base.channel, 0xbeef7701, oclass, 852bf215546Sopenharmony_ci NULL, 0, &screen->sifm); 853bf215546Sopenharmony_ci if (ret) 854bf215546Sopenharmony_ci FAIL_SCREEN_INIT("error allocating scaled image object: %d\n", ret); 855bf215546Sopenharmony_ci 856bf215546Sopenharmony_ci BEGIN_NV04(push, NV01_SUBC(SIFM, OBJECT), 1); 857bf215546Sopenharmony_ci PUSH_DATA (push, screen->sifm->handle); 858bf215546Sopenharmony_ci BEGIN_NV04(push, NV03_SIFM(DMA_NOTIFY), 1); 859bf215546Sopenharmony_ci PUSH_DATA (push, screen->ntfy->handle); 860bf215546Sopenharmony_ci BEGIN_NV04(push, NV05_SIFM(COLOR_CONVERSION), 1); 861bf215546Sopenharmony_ci PUSH_DATA (push, NV05_SIFM_COLOR_CONVERSION_TRUNCATE); 862bf215546Sopenharmony_ci 863bf215546Sopenharmony_ci nouveau_pushbuf_kick(push, push->channel); 864bf215546Sopenharmony_ci 865bf215546Sopenharmony_ci nouveau_fence_new(&screen->base, &screen->base.fence.current); 866bf215546Sopenharmony_ci return &screen->base; 867bf215546Sopenharmony_ci} 868