[Mesa-dev] [PATCH] ilo: fold drm_intel_get_aperture_sizes() within probe_winsys()
Chia-I Wu
olvaffe at gmail.com
Tue Aug 19 02:27:13 PDT 2014
On Tue, Aug 19, 2014 at 5:02 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> ... and store the value in intel_winsys_info/ilo_dev_info.
One nitpick: use size_t and report in bytes. I will make the change
and commit. Thanks. I wasn't aware the patch has gone in (kind of
catching up mails today).
>
> Suggested-by: Chia-I Wu <olvaffe at gmail.com>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
>
> Hello Chia-I
>
> Hope I've understood you correctly this time :)
> -Emil
>
> src/gallium/drivers/ilo/ilo_common.h | 1 +
> src/gallium/drivers/ilo/ilo_screen.c | 4 ++--
> src/gallium/winsys/intel/drm/intel_drm_winsys.c | 14 ++++----------
> src/gallium/winsys/intel/intel_winsys.h | 6 +++---
> 4 files changed, 10 insertions(+), 15 deletions(-)
>
> diff --git a/src/gallium/drivers/ilo/ilo_common.h b/src/gallium/drivers/ilo/ilo_common.h
> index dd31f74..11bd0c9 100644
> --- a/src/gallium/drivers/ilo/ilo_common.h
> +++ b/src/gallium/drivers/ilo/ilo_common.h
> @@ -75,6 +75,7 @@ struct ilo_dev_info {
> bool has_ppgtt;
> bool has_timestamp;
> bool has_gen7_sol_reset;
> + int aperture_size;
>
> int gen;
> int gt;
> diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c
> index ad59d6d..8c67e6a 100644
> --- a/src/gallium/drivers/ilo/ilo_screen.c
> +++ b/src/gallium/drivers/ilo/ilo_screen.c
> @@ -448,8 +448,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
> * 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;
> + const int gpu_mappable_megabytes = is->dev.aperture_size * 3 / 4;
> uint64_t system_memory;
>
> if (!os_get_total_physical_memory(&system_memory))
> @@ -645,6 +644,7 @@ init_dev(struct ilo_dev_info *dev, const struct intel_winsys_info *info)
> dev->has_ppgtt = info->has_ppgtt;
> dev->has_timestamp = info->has_timestamp;
> dev->has_gen7_sol_reset = info->has_gen7_sol_reset;
> + dev->aperture_size = info->aperture_size;
>
> if (!dev->has_logical_context) {
> ilo_err("missing hardware logical context support\n");
> diff --git a/src/gallium/winsys/intel/drm/intel_drm_winsys.c b/src/gallium/winsys/intel/drm/intel_drm_winsys.c
> index b394e5f..d7fdeb2 100644
> --- a/src/gallium/winsys/intel/drm/intel_drm_winsys.c
> +++ b/src/gallium/winsys/intel/drm/intel_drm_winsys.c
> @@ -115,6 +115,7 @@ static bool
> probe_winsys(struct intel_winsys *winsys)
> {
> struct intel_winsys_info *info = &winsys->info;
> + size_t aper_size, mappable_size;
> int val;
>
> /*
> @@ -157,6 +158,9 @@ probe_winsys(struct intel_winsys *winsys)
> get_param(winsys, I915_PARAM_HAS_GEN7_SOL_RESET, &val);
> info->has_gen7_sol_reset = val;
>
> + drm_intel_get_aperture_sizes(winsys->fd, &mappable_size, &aper_size);
> + info->aperture_size = aper_size >> 20;
> +
> return true;
> }
>
> @@ -223,16 +227,6 @@ 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 4bf9a16..9058ab2 100644
> --- a/src/gallium/winsys/intel/intel_winsys.h
> +++ b/src/gallium/winsys/intel/intel_winsys.h
> @@ -80,6 +80,9 @@ struct intel_winsys_info {
>
> /* valid flags for intel_winsys_submit_bo() */
> bool has_gen7_sol_reset;
> +
> + /* the size of the aperture in MiB */
> + int aperture_size;
> };
>
> struct intel_winsys *
> @@ -91,9 +94,6 @@ 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
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
--
olv at LunarG.com
More information about the mesa-dev
mailing list