1 /************************************************************************** 2 * 3 * Copyright 2007 VMware, Inc. 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the 8 * "Software"), to deal in the Software without restriction, including 9 * without limitation the rights to use, copy, modify, merge, publish, 10 * distribute, sub license, and/or sell copies of the Software, and to 11 * permit persons to whom the Software is furnished to do so, subject to 12 * the following conditions: 13 * 14 * The above copyright notice and this permission notice (including the 15 * next paragraph) shall be included in all copies or substantial portions 16 * of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 * 26 **************************************************************************/ 27 28 /** 29 * @file 30 * 31 * Screen, Adapter or GPU 32 * 33 * These are driver functions/facilities that are context independent. 34 */ 35 36 37 #ifndef P_SCREEN_H 38 #define P_SCREEN_H 39 40 41 #include "pipe/p_compiler.h" 42 #include "pipe/p_format.h" 43 #include "pipe/p_defines.h" 44 #include "pipe/p_video_enums.h" 45 46 47 48 #ifdef __cplusplus 49 extern "C" { 50 #endif 51 52 53 /** Opaque types */ 54 struct winsys_handle; 55 struct pipe_fence_handle; 56 struct pipe_resource; 57 struct pipe_surface; 58 struct pipe_transfer; 59 struct pipe_box; 60 struct pipe_memory_info; 61 struct pipe_vertex_buffer; 62 struct pipe_vertex_element; 63 struct pipe_vertex_state; 64 struct disk_cache; 65 struct driOptionCache; 66 struct u_transfer_helper; 67 struct pipe_screen; 68 69 typedef struct pipe_vertex_state * 70 (*pipe_create_vertex_state_func)(struct pipe_screen *screen, 71 struct pipe_vertex_buffer *buffer, 72 const struct pipe_vertex_element *elements, 73 unsigned num_elements, 74 struct pipe_resource *indexbuf, 75 uint32_t full_velem_mask); 76 typedef void (*pipe_vertex_state_destroy_func)(struct pipe_screen *screen, 77 struct pipe_vertex_state *); 78 79 /** 80 * Gallium screen/adapter context. Basically everything 81 * hardware-specific that doesn't actually require a rendering 82 * context. 83 */ 84 struct pipe_screen { 85 /** 86 * Atomically incremented by drivers to track the number of contexts. 87 * If it's 0, it can be assumed that contexts are not tracked. 88 * Used by some places to skip locking if num_contexts == 1. 89 */ 90 unsigned num_contexts; 91 92 /** 93 * For drivers using u_transfer_helper: 94 */ 95 struct u_transfer_helper *transfer_helper; 96 97 void (*destroy)( struct pipe_screen * ); 98 99 const char *(*get_name)( struct pipe_screen * ); 100 101 const char *(*get_vendor)( struct pipe_screen * ); 102 103 /** 104 * Returns the device vendor. 105 * 106 * The returned value should return the actual device vendor/manufacturer, 107 * rather than a potentially generic driver string. 108 */ 109 const char *(*get_device_vendor)( struct pipe_screen * ); 110 111 /** 112 * Query an integer-valued capability/parameter/limit 113 * \param param one of PIPE_CAP_x 114 */ 115 int (*get_param)( struct pipe_screen *, enum pipe_cap param ); 116 117 /** 118 * Query a float-valued capability/parameter/limit 119 * \param param one of PIPE_CAP_x 120 */ 121 float (*get_paramf)( struct pipe_screen *, enum pipe_capf param ); 122 123 /** 124 * Query a per-shader-stage integer-valued capability/parameter/limit 125 * \param param one of PIPE_CAP_x 126 */ 127 int (*get_shader_param)( struct pipe_screen *, enum pipe_shader_type shader, 128 enum pipe_shader_cap param ); 129 130 /** 131 * Query an integer-valued capability/parameter/limit for a codec/profile 132 * \param param one of PIPE_VIDEO_CAP_x 133 */ 134 int (*get_video_param)( struct pipe_screen *, 135 enum pipe_video_profile profile, 136 enum pipe_video_entrypoint entrypoint, 137 enum pipe_video_cap param ); 138 139 /** 140 * Query a compute-specific capability/parameter/limit. 141 * \param ir_type shader IR type for which the param applies, or don't care 142 * if the param is not shader related 143 * \param param one of PIPE_COMPUTE_CAP_x 144 * \param ret pointer to a preallocated buffer that will be 145 * initialized to the parameter value, or NULL. 146 * \return size in bytes of the parameter value that would be 147 * returned. 148 */ 149 int (*get_compute_param)(struct pipe_screen *, 150 enum pipe_shader_ir ir_type, 151 enum pipe_compute_cap param, 152 void *ret); 153 154 /** 155 * Get the sample pixel grid's size. This function requires 156 * PIPE_CAP_PROGRAMMABLE_SAMPLE_LOCATIONS to be callable. 157 * 158 * \param sample_count - total number of samples 159 * \param out_width - the width of the pixel grid 160 * \param out_height - the height of the pixel grid 161 */ 162 void (*get_sample_pixel_grid)(struct pipe_screen *, unsigned sample_count, 163 unsigned *out_width, unsigned *out_height); 164 165 /** 166 * Query a timestamp in nanoseconds. The returned value should match 167 * PIPE_QUERY_TIMESTAMP. This function returns immediately and doesn't 168 * wait for rendering to complete (which cannot be achieved with queries). 169 */ 170 uint64_t (*get_timestamp)(struct pipe_screen *); 171 172 /** 173 * Return an equivalent canonical format which has the same component sizes 174 * and swizzles as the original, and it is supported by the driver. Gallium 175 * already does a first canonicalization step (see get_canonical_format() 176 * on st_cb_copyimage.c) and it calls this function (if defined) to get an 177 * alternative format if the picked is not supported by the driver. 178 */ 179 enum pipe_format (*get_canonical_format)(struct pipe_screen *, 180 enum pipe_format format); 181 182 /** 183 * Create a context. 184 * 185 * \param screen pipe screen 186 * \param priv a pointer to set in pipe_context::priv 187 * \param flags a mask of PIPE_CONTEXT_* flags 188 */ 189 struct pipe_context * (*context_create)(struct pipe_screen *screen, 190 void *priv, unsigned flags); 191 192 /** 193 * Check if the given image copy will be faster on compute 194 * \param cpu If true, this is checking against CPU fallback, 195 * otherwise the copy will be on GFX 196 */ 197 bool (*is_compute_copy_faster)( struct pipe_screen *, 198 enum pipe_format src_format, 199 enum pipe_format dst_format, 200 unsigned width, 201 unsigned height, 202 unsigned depth, 203 bool cpu ); 204 205 /** 206 * Check if the given pipe_format is supported as a texture or 207 * drawing surface. 208 * \param bindings bitmask of PIPE_BIND_* 209 */ 210 bool (*is_format_supported)( struct pipe_screen *, 211 enum pipe_format format, 212 enum pipe_texture_target target, 213 unsigned sample_count, 214 unsigned storage_sample_count, 215 unsigned bindings ); 216 217 /** 218 * Check if the given pipe_format is supported as output for this codec/profile. 219 * \param profile profile to check, may also be PIPE_VIDEO_PROFILE_UNKNOWN 220 */ 221 bool (*is_video_format_supported)( struct pipe_screen *, 222 enum pipe_format format, 223 enum pipe_video_profile profile, 224 enum pipe_video_entrypoint entrypoint ); 225 226 /** 227 * Check if we can actually create the given resource (test the dimension, 228 * overall size, etc). Used to implement proxy textures. 229 * \return TRUE if size is OK, FALSE if too large. 230 */ 231 bool (*can_create_resource)(struct pipe_screen *screen, 232 const struct pipe_resource *templat); 233 234 /** 235 * Create a new texture object, using the given template info. 236 */ 237 struct pipe_resource * (*resource_create)(struct pipe_screen *, 238 const struct pipe_resource *templat); 239 240 struct pipe_resource * (*resource_create_drawable)(struct pipe_screen *, 241 const struct pipe_resource *tmpl, 242 const void *loader_private); 243 244 struct pipe_resource * (*resource_create_front)(struct pipe_screen *, 245 const struct pipe_resource *templat, 246 const void *map_front_private); 247 248 /** 249 * Create a texture from a winsys_handle. The handle is often created in 250 * another process by first creating a pipe texture and then calling 251 * resource_get_handle. 252 * 253 * NOTE: in the case of WINSYS_HANDLE_TYPE_FD handles, the caller 254 * retains ownership of the FD. (This is consistent with 255 * EGL_EXT_image_dma_buf_import) 256 * 257 * \param usage A combination of PIPE_HANDLE_USAGE_* flags. 258 */ 259 struct pipe_resource * (*resource_from_handle)(struct pipe_screen *, 260 const struct pipe_resource *templat, 261 struct winsys_handle *handle, 262 unsigned usage); 263 264 /** 265 * Create a resource from user memory. This maps the user memory into 266 * the device address space. 267 */ 268 struct pipe_resource * (*resource_from_user_memory)(struct pipe_screen *, 269 const struct pipe_resource *t, 270 void *user_memory); 271 272 /** 273 * Unlike pipe_resource::bind, which describes what gallium frontends want, 274 * resources can have much greater capabilities in practice, often implied 275 * by the tiling layout or memory placement. This function allows querying 276 * whether a capability is supported beyond what was requested by state 277 * trackers. It's also useful for querying capabilities of imported 278 * resources where the capabilities are unknown at first. 279 * 280 * Only these flags are allowed: 281 * - PIPE_BIND_SCANOUT 282 * - PIPE_BIND_CURSOR 283 * - PIPE_BIND_LINEAR 284 */ 285 bool (*check_resource_capability)(struct pipe_screen *screen, 286 struct pipe_resource *resource, 287 unsigned bind); 288 289 /** 290 * Get a winsys_handle from a texture. Some platforms/winsys requires 291 * that the texture is created with a special usage flag like 292 * DISPLAYTARGET or PRIMARY. 293 * 294 * The context parameter can optionally be used to flush the resource and 295 * the context to make sure the resource is coherent with whatever user 296 * will use it. Some drivers may also use the context to convert 297 * the resource into a format compatible for sharing. The use case is 298 * OpenGL-OpenCL interop. The context parameter is allowed to be NULL. 299 * 300 * NOTE: for multi-planar resources (which may or may not have the planes 301 * chained through the pipe_resource next pointer) the frontend will 302 * always call this function with the first resource of the chain. It is 303 * the pipe drivers responsibility to walk the resources as needed when 304 * called with handle->plane != 0. 305 * 306 * NOTE: in the case of WINSYS_HANDLE_TYPE_FD handles, the caller 307 * takes ownership of the FD. (This is consistent with 308 * EGL_MESA_image_dma_buf_export) 309 * 310 * \param usage A combination of PIPE_HANDLE_USAGE_* flags. 311 */ 312 bool (*resource_get_handle)(struct pipe_screen *, 313 struct pipe_context *context, 314 struct pipe_resource *tex, 315 struct winsys_handle *handle, 316 unsigned usage); 317 318 /** 319 * Get info for the given pipe resource without the need to get a 320 * winsys_handle. 321 * 322 * The context parameter can optionally be used to flush the resource and 323 * the context to make sure the resource is coherent with whatever user 324 * will use it. Some drivers may also use the context to convert 325 * the resource into a format compatible for sharing. The context parameter 326 * is allowed to be NULL. 327 */ 328 bool (*resource_get_param)(struct pipe_screen *screen, 329 struct pipe_context *context, 330 struct pipe_resource *resource, 331 unsigned plane, 332 unsigned layer, 333 unsigned level, 334 enum pipe_resource_param param, 335 unsigned handle_usage, 336 uint64_t *value); 337 338 /** 339 * Get stride and offset for the given pipe resource without the need to get 340 * a winsys_handle. 341 */ 342 void (*resource_get_info)(struct pipe_screen *screen, 343 struct pipe_resource *resource, 344 unsigned *stride, 345 unsigned *offset); 346 347 /** 348 * Mark the resource as changed so derived internal resources will be 349 * recreated on next use. 350 * 351 * This is necessary when reimporting external images that can't be directly 352 * used as texture sampler source, to avoid sampling from old copies. 353 */ 354 void (*resource_changed)(struct pipe_screen *, struct pipe_resource *pt); 355 356 void (*resource_destroy)(struct pipe_screen *, 357 struct pipe_resource *pt); 358 359 360 /** 361 * Do any special operations to ensure frontbuffer contents are 362 * displayed, eg copy fake frontbuffer. 363 * \param winsys_drawable_handle an opaque handle that the calling context 364 * gets out-of-band 365 * \param subbox an optional sub region to flush 366 */ 367 void (*flush_frontbuffer)( struct pipe_screen *screen, 368 struct pipe_context *ctx, 369 struct pipe_resource *resource, 370 unsigned level, unsigned layer, 371 void *winsys_drawable_handle, 372 struct pipe_box *subbox ); 373 374 /** Set ptr = fence, with reference counting */ 375 void (*fence_reference)( struct pipe_screen *screen, 376 struct pipe_fence_handle **ptr, 377 struct pipe_fence_handle *fence ); 378 379 /** 380 * Wait for the fence to finish. 381 * 382 * If the fence was created with PIPE_FLUSH_DEFERRED, and the context is 383 * still unflushed, and the ctx parameter of fence_finish is equal to 384 * the context where the fence was created, fence_finish will flush 385 * the context prior to waiting for the fence. 386 * 387 * In all other cases, the ctx parameter has no effect. 388 * 389 * \param timeout in nanoseconds (may be PIPE_TIMEOUT_INFINITE). 390 */ 391 bool (*fence_finish)(struct pipe_screen *screen, 392 struct pipe_context *ctx, 393 struct pipe_fence_handle *fence, 394 uint64_t timeout); 395 396 /** 397 * For fences created with PIPE_FLUSH_FENCE_FD (exported fd) or 398 * by create_fence_fd() (imported fd), return the native fence fd 399 * associated with the fence. This may return -1 for fences 400 * created with PIPE_FLUSH_DEFERRED if the fence command has not 401 * been flushed yet. 402 */ 403 int (*fence_get_fd)(struct pipe_screen *screen, 404 struct pipe_fence_handle *fence); 405 406 /** 407 * Create a fence from an Win32 handle. 408 * 409 * This is used for importing a foreign/external fence handle. 410 * 411 * \param fence if not NULL, an old fence to unref and transfer a 412 * new fence reference to 413 * \param handle opaque handle representing the fence object 414 * \param type indicates which fence types backs the handle 415 */ 416 void (*create_fence_win32)(struct pipe_screen *screen, 417 struct pipe_fence_handle **fence, 418 void *handle, 419 const void *name, 420 enum pipe_fd_type type); 421 422 /** 423 * Returns a driver-specific query. 424 * 425 * If \p info is NULL, the number of available queries is returned. 426 * Otherwise, the driver query at the specified \p index is returned 427 * in \p info. The function returns non-zero on success. 428 */ 429 int (*get_driver_query_info)(struct pipe_screen *screen, 430 unsigned index, 431 struct pipe_driver_query_info *info); 432 433 /** 434 * Returns a driver-specific query group. 435 * 436 * If \p info is NULL, the number of available groups is returned. 437 * Otherwise, the driver query group at the specified \p index is returned 438 * in \p info. The function returns non-zero on success. 439 */ 440 int (*get_driver_query_group_info)(struct pipe_screen *screen, 441 unsigned index, 442 struct pipe_driver_query_group_info *info); 443 444 /** 445 * Query information about memory usage. 446 */ 447 void (*query_memory_info)(struct pipe_screen *screen, 448 struct pipe_memory_info *info); 449 450 /** 451 * Get IR specific compiler options struct. For PIPE_SHADER_IR_NIR this 452 * returns a 'struct nir_shader_compiler_options'. Drivers reporting 453 * NIR as the preferred IR must implement this. 454 */ 455 const void *(*get_compiler_options)(struct pipe_screen *screen, 456 enum pipe_shader_ir ir, 457 enum pipe_shader_type shader); 458 459 /** 460 * Returns a pointer to a driver-specific on-disk shader cache. If the 461 * driver failed to create the cache or does not support an on-disk shader 462 * cache NULL is returned. The callback itself may also be NULL if the 463 * driver doesn't support an on-disk shader cache. 464 */ 465 struct disk_cache *(*get_disk_shader_cache)(struct pipe_screen *screen); 466 467 /** 468 * Create a new texture object from the given template info, taking 469 * format modifiers into account. \p modifiers specifies a list of format 470 * modifier tokens, as defined in drm_fourcc.h. The driver then picks the 471 * best modifier among these and creates the resource. \p count must 472 * contain the size of \p modifiers array. 473 * 474 * Returns NULL if an entry in \p modifiers is unsupported by the driver, 475 * or if only DRM_FORMAT_MOD_INVALID is provided. 476 */ 477 struct pipe_resource * (*resource_create_with_modifiers)( 478 struct pipe_screen *, 479 const struct pipe_resource *templat, 480 const uint64_t *modifiers, int count); 481 482 /** 483 * Get supported modifiers for a format. 484 * If \p max is 0, the total number of supported modifiers for the supplied 485 * format is returned in \p count, with no modification to \p modifiers. 486 * Otherwise, \p modifiers is filled with upto \p max supported modifier 487 * codes, and \p count with the number of modifiers copied. 488 * The \p external_only array is used to return whether the format and 489 * modifier combination can only be used with an external texture target. 490 */ 491 void (*query_dmabuf_modifiers)(struct pipe_screen *screen, 492 enum pipe_format format, int max, 493 uint64_t *modifiers, 494 unsigned int *external_only, int *count); 495 496 /** 497 * Create a memory object from a winsys handle 498 * 499 * The underlying memory is most often allocated in by a foregin API. 500 * Then the underlying memory object is then exported through interfaces 501 * compatible with EXT_external_resources. 502 * 503 * Note: For WINSYS_HANDLE_TYPE_FD handles, the caller retains ownership 504 * of the fd. 505 * 506 * \param handle A handle representing the memory object to import 507 */ 508 struct pipe_memory_object *(*memobj_create_from_handle)(struct pipe_screen *screen, 509 struct winsys_handle *handle, 510 bool dedicated); 511 512 /** 513 * Destroy a memory object 514 * 515 * \param memobj The memory object to destroy 516 */ 517 void (*memobj_destroy)(struct pipe_screen *screen, 518 struct pipe_memory_object *memobj); 519 520 /** 521 * Create a texture from a memory object 522 * 523 * \param t texture template 524 * \param memobj The memory object used to back the texture 525 */ 526 struct pipe_resource * (*resource_from_memobj)(struct pipe_screen *screen, 527 const struct pipe_resource *t, 528 struct pipe_memory_object *memobj, 529 uint64_t offset); 530 531 /** 532 * Fill @uuid with a unique driver identifier 533 * 534 * \param uuid pointer to a memory region of PIPE_UUID_SIZE bytes 535 */ 536 void (*get_driver_uuid)(struct pipe_screen *screen, char *uuid); 537 538 /** 539 * Fill @uuid with a unique device identifier 540 * 541 * \param uuid pointer to a memory region of PIPE_UUID_SIZE bytes 542 */ 543 void (*get_device_uuid)(struct pipe_screen *screen, char *uuid); 544 545 /** 546 * Fill @luid with the locally unique identifier of the context 547 * The LUID returned, paired together with the contexts node mask, 548 * allows matching the context to an IDXGIAdapter1 object 549 * 550 * \param luid pointer to a memory region of PIPE_LUID_SIZE bytes 551 */ 552 void (*get_device_luid)(struct pipe_screen *screen, char *luid); 553 554 /** 555 * Return the device node mask identifying the context 556 * Together with the contexts LUID, this allows matching 557 * the context to an IDXGIAdapter1 object. 558 * 559 * within a linked device adapter 560 */ 561 uint32_t (*get_device_node_mask)(struct pipe_screen *screen); 562 563 /** 564 * Set the maximum number of parallel shader compiler threads. 565 */ 566 void (*set_max_shader_compiler_threads)(struct pipe_screen *screen, 567 unsigned max_threads); 568 569 /** 570 * Return whether parallel shader compilation has finished. 571 */ 572 bool (*is_parallel_shader_compilation_finished)(struct pipe_screen *screen, 573 void *shader, 574 unsigned shader_type); 575 576 /** 577 * Set the damage region (called when KHR_partial_update() is invoked). 578 * This function is passed an array of rectangles encoding the damage area. 579 * rects are using the bottom-left origin convention. 580 * nrects = 0 means 'reset the damage region'. What 'reset' implies is HW 581 * specific. For tile-based renderers, the damage extent is typically set 582 * to cover the whole resource with no damage rect (or a 0-size damage 583 * rect). This way, the existing resource content is reloaded into the 584 * local tile buffer for every tile thus making partial tile update 585 * possible. For HW operating in immediate mode, this reset operation is 586 * likely to be a NOOP. 587 */ 588 void (*set_damage_region)(struct pipe_screen *screen, 589 struct pipe_resource *resource, 590 unsigned int nrects, 591 const struct pipe_box *rects); 592 593 /** 594 * Run driver-specific NIR lowering and optimization passes. 595 * 596 * gallium frontends should call this before passing shaders to drivers, 597 * and ideally also before shader caching. 598 * 599 * The driver may return a non-NULL string to trigger GLSL link failure and 600 * logging of that message in the GLSL linker log. 601 */ 602 char *(*finalize_nir)(struct pipe_screen *screen, void *nir); 603 604 /*Separated memory/resource allocations interfaces for Vulkan */ 605 606 /** 607 * Create a resource, and retrieve the required size for it but don't allocate 608 * any backing memory. 609 */ 610 struct pipe_resource * (*resource_create_unbacked)(struct pipe_screen *, 611 const struct pipe_resource *templat, 612 uint64_t *size_required); 613 614 /** 615 * Allocate backing memory to be bound to resources. 616 */ 617 struct pipe_memory_allocation *(*allocate_memory)(struct pipe_screen *screen, 618 uint64_t size); 619 /** 620 * Free previously allocated backing memory. 621 */ 622 void (*free_memory)(struct pipe_screen *screen, 623 struct pipe_memory_allocation *); 624 625 /** 626 * Allocate fd-based memory to be bound to resources. 627 */ 628 struct pipe_memory_allocation *(*allocate_memory_fd)(struct pipe_screen *screen, 629 uint64_t size, 630 int *fd); 631 632 /** 633 * Import memory from an fd-handle. 634 */ 635 bool (*import_memory_fd)(struct pipe_screen *screen, 636 int fd, 637 struct pipe_memory_allocation **pmem, 638 uint64_t *size); 639 640 /** 641 * Free previously allocated fd-based memory. 642 */ 643 void (*free_memory_fd)(struct pipe_screen *screen, 644 struct pipe_memory_allocation *pmem); 645 646 /** 647 * Bind memory to a resource. 648 */ 649 bool (*resource_bind_backing)(struct pipe_screen *screen, 650 struct pipe_resource *pt, 651 struct pipe_memory_allocation *pmem, 652 uint64_t offset); 653 654 /** 655 * Map backing memory. 656 */ 657 void *(*map_memory)(struct pipe_screen *screen, 658 struct pipe_memory_allocation *pmem); 659 660 /** 661 * Unmap backing memory. 662 */ 663 void (*unmap_memory)(struct pipe_screen *screen, 664 struct pipe_memory_allocation *pmem); 665 666 /** 667 * Determine whether the screen supports the specified modifier 668 * 669 * Query whether the driver supports a \p modifier in combination with 670 * \p format. If \p external_only is not NULL, the value it points to will 671 * be set to 0 or a non-zero value to indicate whether the modifier and 672 * format combination is supported only with external, or also with non- 673 * external texture targets respectively. The \p external_only parameter is 674 * not used when the function returns false. 675 * 676 * \return true if the format+modifier pair is supported on \p screen, false 677 * otherwise. 678 */ 679 bool (*is_dmabuf_modifier_supported)(struct pipe_screen *screen, 680 uint64_t modifier, enum pipe_format, 681 bool *external_only); 682 683 /** 684 * Get the number of planes required for a given modifier/format pair. 685 * 686 * If not NULL, this function returns the number of planes needed to 687 * represent \p format in the layout specified by \p modifier, including 688 * any driver-specific auxiliary data planes. 689 * 690 * Must only be called on a modifier supported by the screen for the 691 * specified format. 692 * 693 * If NULL, no auxiliary planes are required for any modifier+format pairs 694 * supported by \p screen. Hence, the plane count can be derived directly 695 * from \p format. 696 * 697 * \return Number of planes needed to store image data in the layout defined 698 * by \p format and \p modifier. 699 */ 700 unsigned int (*get_dmabuf_modifier_planes)(struct pipe_screen *screen, 701 uint64_t modifier, 702 enum pipe_format format); 703 704 /** 705 * Get supported page sizes for sparse texture. 706 * 707 * \p size is the array size of \p x, \p y and \p z. 708 * 709 * \p offset sets an offset into the possible format page size array, 710 * used to pick a specific xyz size combination. 711 * 712 * \return Number of supported page sizes, 0 means not support. 713 */ 714 int (*get_sparse_texture_virtual_page_size)(struct pipe_screen *screen, 715 enum pipe_texture_target target, 716 bool multi_sample, 717 enum pipe_format format, 718 unsigned offset, unsigned size, 719 int *x, int *y, int *z); 720 721 /** 722 * Vertex state CSO functions for precomputing vertex and index buffer 723 * states for display lists. 724 */ 725 pipe_create_vertex_state_func create_vertex_state; 726 pipe_vertex_state_destroy_func vertex_state_destroy; 727 728 /** 729 * Update a timeline semaphore value stored within a driver fence object. 730 * Future waits and signals will use the new value. 731 */ 732 void (*set_fence_timeline_value)(struct pipe_screen *screen, 733 struct pipe_fence_handle *fence, 734 uint64_t value); 735 }; 736 737 738 /** 739 * Global configuration options for screen creation. 740 */ 741 struct pipe_screen_config { 742 struct driOptionCache *options; 743 const struct driOptionCache *options_info; 744 }; 745 746 747 #ifdef __cplusplus 748 } 749 #endif 750 751 #endif /* P_SCREEN_H */ 752