[Mesa-dev] [PATCH 13/19] gallium/ilo: handle query_renderer caps
Chia-I Wu
olvaffe at gmail.com
Tue Aug 19 01:11:22 PDT 2014
On Fri, Aug 15, 2014 at 6:18 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> Implementation based on the classic driver with the following
> changes:
> - Use auxiliarry function os_get_total_physical_memory to get the
> total amount of memory.
> - Move the libdrm_intel specific get_aperture_size to the winsys.
Please call drm_intel_get_aperture_sizes() in probe_winsys() and
report the values in bytes in struct intel_winsys_info. There is no
need to export the function.
>
> Cc: Chia-I Wu <olvaffe at gmail.com>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
> src/gallium/drivers/i915/i915_screen.c | 2 +-
i915g?
> src/gallium/drivers/ilo/ilo_screen.c | 24 ++++++++++++++++++++++++
> src/gallium/winsys/intel/drm/intel_drm_winsys.c | 10 ++++++++++
> src/gallium/winsys/intel/intel_winsys.h | 3 +++
> 4 files changed, 38 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
> index f3b89b5..022d56a 100644
> --- a/src/gallium/drivers/i915/i915_screen.c
> +++ b/src/gallium/drivers/i915/i915_screen.c
> @@ -300,7 +300,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
> if (!os_get_total_physical_memory(&system_memory))
> return 0;
>
> - return MIN2(gpu_mappable_megabytes, (int) (system_memory >> 20));
> + return MIN2(gpu_mappable_megabytes, (int)(system_memory >> 20));
> }
> case PIPE_CAP_UMA:
> return 1;
> diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c
> index bd6d8dd..af341dc 100644
> --- a/src/gallium/drivers/ilo/ilo_screen.c
> +++ b/src/gallium/drivers/ilo/ilo_screen.c
> @@ -25,6 +25,7 @@
> * Chia-I Wu <olv at lunarg.com>
> */
>
> +#include "os/os_misc.h"
> #include "util/u_format_s3tc.h"
> #include "vl/vl_decoder.h"
> #include "vl/vl_video_buffer.h"
> @@ -435,6 +436,29 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
> case PIPE_CAP_DRAW_INDIRECT:
> return 0;
>
> + case PIPE_CAP_VENDOR_ID:
> + return 0x8086;
> + case PIPE_CAP_DEVICE_ID:
> + return is->dev.devid;
> + case PIPE_CAP_ACCELERATED:
> + return true;
> + case PIPE_CAP_VIDEO_MEMORY: {
> + /* Once a batch uses more than 75% of the maximum mappable size, we
> + * assume that there's some fragmentation, and we start doing extra
> + * flushing, etc. That's the big cliff apps will care about.
> + */
> + const int gpu_mappable_megabytes =
> + intel_winsys_get_aperture_size(is->winsys) * 3 / 4;
> + uint64_t system_memory;
> +
> + if (!os_get_total_physical_memory(&system_memory))
> + return 0;
> +
> + return MIN2(gpu_mappable_megabytes, (int)(system_memory >> 20));
> + }
> + case PIPE_CAP_UMA:
> + return true;
> +
> default:
> return 0;
> }
> diff --git a/src/gallium/winsys/intel/drm/intel_drm_winsys.c b/src/gallium/winsys/intel/drm/intel_drm_winsys.c
> index b7a2c4e..b394e5f 100644
> --- a/src/gallium/winsys/intel/drm/intel_drm_winsys.c
> +++ b/src/gallium/winsys/intel/drm/intel_drm_winsys.c
> @@ -223,6 +223,16 @@ intel_winsys_get_info(const struct intel_winsys *winsys)
> return &winsys->info;
> }
>
> +int
> +intel_winsys_get_aperture_size(const struct intel_winsys *winsys)
> +{
> + size_t aper_size, mappable_size;
> +
> + drm_intel_get_aperture_sizes(winsys->fd, &mappable_size, &aper_size);
> +
> + return aper_size >> 20;
> +}
> +
> struct intel_context *
> intel_winsys_create_context(struct intel_winsys *winsys)
> {
> diff --git a/src/gallium/winsys/intel/intel_winsys.h b/src/gallium/winsys/intel/intel_winsys.h
> index 197eae8..4bf9a16 100644
> --- a/src/gallium/winsys/intel/intel_winsys.h
> +++ b/src/gallium/winsys/intel/intel_winsys.h
> @@ -91,6 +91,9 @@ intel_winsys_destroy(struct intel_winsys *winsys);
> const struct intel_winsys_info *
> intel_winsys_get_info(const struct intel_winsys *winsys);
>
> +int
> +intel_winsys_get_aperture_size(const struct intel_winsys *winsys);
> +
> /**
> * Create a logical context for use with the render ring.
> */
> --
> 2.0.2
>
--
olv at LunarG.com
More information about the mesa-dev
mailing list