Path: blob/21.2-virgl/src/intel/vulkan/anv_gem_stubs.c
4547 views
/*1* Copyright © 2015 Intel Corporation2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223#include <sys/mman.h>24#include <sys/syscall.h>2526#include "util/anon_file.h"27#include "anv_private.h"2829uint32_t30anv_gem_create(struct anv_device *device, uint64_t size)31{32int fd = os_create_anonymous_file(size, "fake bo");33if (fd == -1)34return 0;3536assert(fd != 0);3738return fd;39}4041void42anv_gem_close(struct anv_device *device, uint32_t gem_handle)43{44close(gem_handle);45}4647uint32_t48anv_gem_create_regions(struct anv_device *device, uint64_t anv_bo_size,49uint32_t num_regions,50struct drm_i915_gem_memory_class_instance *regions)51{52return 0;53}5455void*56anv_gem_mmap(struct anv_device *device, uint32_t gem_handle,57uint64_t offset, uint64_t size, uint32_t flags)58{59/* Ignore flags, as they're specific to I915_GEM_MMAP. */60(void) flags;6162return mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,63gem_handle, offset);64}6566/* This is just a wrapper around munmap, but it also notifies valgrind that67* this map is no longer valid. Pair this with anv_gem_mmap().68*/69void70anv_gem_munmap(struct anv_device *device, void *p, uint64_t size)71{72munmap(p, size);73}7475uint32_t76anv_gem_userptr(struct anv_device *device, void *mem, size_t size)77{78int fd = os_create_anonymous_file(size, "fake bo");79if (fd == -1)80return 0;8182assert(fd != 0);8384return fd;85}8687int88anv_gem_busy(struct anv_device *device, uint32_t gem_handle)89{90return 0;91}9293int94anv_gem_wait(struct anv_device *device, uint32_t gem_handle, int64_t *timeout_ns)95{96return 0;97}9899int100anv_gem_execbuffer(struct anv_device *device,101struct drm_i915_gem_execbuffer2 *execbuf)102{103return 0;104}105106int107anv_gem_set_tiling(struct anv_device *device,108uint32_t gem_handle, uint32_t stride, uint32_t tiling)109{110return 0;111}112113int114anv_gem_get_tiling(struct anv_device *device, uint32_t gem_handle)115{116return 0;117}118119int120anv_gem_set_caching(struct anv_device *device, uint32_t gem_handle,121uint32_t caching)122{123return 0;124}125126int127anv_gem_set_domain(struct anv_device *device, uint32_t gem_handle,128uint32_t read_domains, uint32_t write_domain)129{130return 0;131}132133int134anv_gem_get_param(int fd, uint32_t param)135{136unreachable("Unused");137}138139uint64_t140anv_gem_get_drm_cap(int fd, uint32_t capability)141{142return 0;143}144145bool146anv_gem_get_bit6_swizzle(int fd, uint32_t tiling)147{148unreachable("Unused");149}150151int152anv_gem_create_context(struct anv_device *device)153{154unreachable("Unused");155}156157int158anv_gem_destroy_context(struct anv_device *device, int context)159{160unreachable("Unused");161}162163int164anv_gem_set_context_param(int fd, int context, uint32_t param, uint64_t value)165{166unreachable("Unused");167}168169int170anv_gem_get_context_param(int fd, int context, uint32_t param, uint64_t *value)171{172unreachable("Unused");173}174175bool176anv_gem_has_context_priority(int fd)177{178unreachable("Unused");179}180181int182anv_gem_context_get_reset_stats(int fd, int context,183uint32_t *active, uint32_t *pending)184{185unreachable("Unused");186}187188int189anv_gem_handle_to_fd(struct anv_device *device, uint32_t gem_handle)190{191unreachable("Unused");192}193194uint32_t195anv_gem_fd_to_handle(struct anv_device *device, int fd)196{197unreachable("Unused");198}199200int201anv_gem_sync_file_merge(struct anv_device *device, int fd1, int fd2)202{203unreachable("Unused");204}205206int207anv_gem_syncobj_export_sync_file(struct anv_device *device, uint32_t handle)208{209unreachable("Unused");210}211212int213anv_gem_syncobj_import_sync_file(struct anv_device *device,214uint32_t handle, int fd)215{216unreachable("Unused");217}218219uint32_t220anv_gem_syncobj_create(struct anv_device *device, uint32_t flags)221{222unreachable("Unused");223}224225void226anv_gem_syncobj_destroy(struct anv_device *device, uint32_t handle)227{228unreachable("Unused");229}230231int232anv_gem_syncobj_handle_to_fd(struct anv_device *device, uint32_t handle)233{234unreachable("Unused");235}236237uint32_t238anv_gem_syncobj_fd_to_handle(struct anv_device *device, int fd)239{240unreachable("Unused");241}242243void244anv_gem_syncobj_reset(struct anv_device *device, uint32_t handle)245{246unreachable("Unused");247}248249bool250anv_gem_supports_syncobj_wait(int fd)251{252return false;253}254255int256anv_i915_query(int fd, uint64_t query_id, void *buffer,257int32_t *buffer_len)258{259unreachable("Unused");260}261262int263anv_gem_create_context_engines(struct anv_device *device,264const struct drm_i915_query_engine_info *info,265int num_engines,266uint16_t *engine_classes)267{268unreachable("Unused");269}270271struct drm_i915_query_engine_info *272anv_gem_get_engine_info(int fd)273{274unreachable("Unused");275}276277int278anv_gem_count_engines(const struct drm_i915_query_engine_info *info,279uint16_t engine_class)280{281unreachable("Unused");282}283284int285anv_gem_syncobj_wait(struct anv_device *device,286const uint32_t *handles, uint32_t num_handles,287int64_t abs_timeout_ns, bool wait_all)288{289unreachable("Unused");290}291292int293anv_gem_reg_read(int fd, uint32_t offset, uint64_t *result)294{295unreachable("Unused");296}297298int299anv_gem_syncobj_timeline_wait(struct anv_device *device,300const uint32_t *handles, const uint64_t *points,301uint32_t num_items, int64_t abs_timeout_ns,302bool wait_all, bool wait_materialize)303{304unreachable("Unused");305}306307int308anv_gem_syncobj_timeline_signal(struct anv_device *device,309const uint32_t *handles, const uint64_t *points,310uint32_t num_items)311{312unreachable("Unused");313}314315int316anv_gem_syncobj_timeline_query(struct anv_device *device,317const uint32_t *handles, uint64_t *points,318uint32_t num_items)319{320unreachable("Unused");321}322323324