mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
gallium: create query_memory_info implementation for sw drivers
For ATI_meminfo or NVX_gpu_memory_info on llvmpipe and softpipe. Signed-off-by: Yusuf Khan <yusisamerican@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21373>
This commit is contained in:
parent
96ba0344db
commit
689a0c4d4e
4 changed files with 26 additions and 0 deletions
|
|
@ -460,6 +460,21 @@ util_throttle_memory_usage(struct pipe_context *pipe,
|
|||
t->ring[t->flush_index].mem_usage += memory_size;
|
||||
}
|
||||
|
||||
void
|
||||
util_sw_query_memory_info(struct pipe_screen *pscreen,
|
||||
struct pipe_memory_info *info)
|
||||
{
|
||||
/* Provide query_memory_info from CPU reported memory */
|
||||
uint64_t size;
|
||||
|
||||
if (!os_get_available_system_memory(&size))
|
||||
return;
|
||||
info->avail_staging_memory = size / 1024;
|
||||
if (!os_get_total_physical_memory(&size))
|
||||
return;
|
||||
info->total_staging_memory = size / 1024;
|
||||
}
|
||||
|
||||
bool
|
||||
util_lower_clearsize_to_dword(const void *clearValue, int *clearValueSize, uint32_t *clamped)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -117,6 +117,8 @@ void util_throttle_init(struct util_throttle *t, uint64_t max_mem_usage);
|
|||
void util_throttle_deinit(struct pipe_screen *screen, struct util_throttle *t);
|
||||
void util_throttle_memory_usage(struct pipe_context *pipe,
|
||||
struct util_throttle *t, uint64_t memory_size);
|
||||
void util_sw_query_memory_info(struct pipe_screen *pscreen,
|
||||
struct pipe_memory_info *info);
|
||||
|
||||
bool
|
||||
util_lower_clearsize_to_dword(const void *clearValue, int *clearValueSize, uint32_t *clamped);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
#include "util/disk_cache.h"
|
||||
#include "util/os_misc.h"
|
||||
#include "util/os_time.h"
|
||||
#include "util/u_helpers.h"
|
||||
#include "lp_texture.h"
|
||||
#include "lp_fence.h"
|
||||
#include "lp_jit.h"
|
||||
|
|
@ -284,6 +285,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
|
|||
}
|
||||
case PIPE_CAP_UMA:
|
||||
return 1;
|
||||
case PIPE_CAP_QUERY_MEMORY_INFO:
|
||||
return 1;
|
||||
case PIPE_CAP_CLIP_HALFZ:
|
||||
return 1;
|
||||
case PIPE_CAP_POLYGON_OFFSET_CLAMP:
|
||||
|
|
@ -1073,6 +1076,8 @@ llvmpipe_create_screen(struct sw_winsys *winsys)
|
|||
|
||||
screen->base.get_timestamp = u_default_get_timestamp;
|
||||
|
||||
screen->base.query_memory_info = util_sw_query_memory_info;
|
||||
|
||||
screen->base.get_driver_uuid = llvmpipe_get_driver_uuid;
|
||||
screen->base.get_device_uuid = llvmpipe_get_device_uuid;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
|
||||
#include "compiler/nir/nir.h"
|
||||
#include "util/u_helpers.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/format/u_format.h"
|
||||
#include "util/format/u_format_s3tc.h"
|
||||
|
|
@ -282,6 +283,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
|
|||
}
|
||||
case PIPE_CAP_UMA:
|
||||
return 0;
|
||||
case PIPE_CAP_QUERY_MEMORY_INFO:
|
||||
return 1;
|
||||
case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
|
||||
return 1;
|
||||
case PIPE_CAP_CLIP_HALFZ:
|
||||
|
|
@ -594,6 +597,7 @@ softpipe_create_screen(struct sw_winsys *winsys)
|
|||
screen->base.get_shader_param = softpipe_get_shader_param;
|
||||
screen->base.get_paramf = softpipe_get_paramf;
|
||||
screen->base.get_timestamp = u_default_get_timestamp;
|
||||
screen->base.query_memory_info = util_sw_query_memory_info;
|
||||
screen->base.is_format_supported = softpipe_is_format_supported;
|
||||
screen->base.context_create = softpipe_create_context;
|
||||
screen->base.flush_frontbuffer = softpipe_flush_frontbuffer;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue