[Mesa-dev] [PATCH 24/25] gallium/softpipe/llvmpipe: handle query_renderer caps

Brian Paul brian.e.paul at gmail.com
Sat Feb 22 05:52:58 PST 2014


On Fri, Feb 21, 2014 at 8:04 PM, Emil Velikov <emil.l.velikov at gmail.com>wrote:

> Both drivers report 0xffffffff as vendor/device id, and the maximum
> amount of system memory as video memory. We might want to reconsider
> the latter.
>
> Cc: Brian Paul <brianp at vmware.com>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
>  src/gallium/drivers/llvmpipe/lp_screen.c | 25 +++++++++++++++++++++++++
>  src/gallium/drivers/softpipe/sp_screen.c | 25 +++++++++++++++++++++++++
>  2 files changed, 50 insertions(+)
>
> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c
> b/src/gallium/drivers/llvmpipe/lp_screen.c
> index 604f853..c28f9a7 100644
> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> @@ -245,6 +245,31 @@ llvmpipe_get_param(struct pipe_screen *screen, enum
> pipe_cap param)
>        return 11;
>     case PIPE_CAP_MAX_GL_ES2_VERSION:
>        return 20;
> +
> +   case PIPE_CAP_VENDOR_ID:
> +      return 0xFFFFFFFF;
> +   case PIPE_CAP_DEVICE_ID:
> +      return 0xFFFFFFFF;
>

Maybe just return zero since that's probably the default value returned by
a driver when it doesn't support a particular cap.



> +   case PIPE_CAP_ACCELERATED:
> +      return 0;
> +   case PIPE_CAP_VIDEO_MEMORY: {
> +      /* XXX: Do we want to return the full amount fo system memory ? */
> +      const long system_memory_pages = sysconf(_SC_PHYS_PAGES);
> +      const long system_page_size = sysconf(_SC_PAGE_SIZE);
>

I'd bet sysconf() won't work on Windows or other non-Linux systems.

We should probably have a gallium utility function for doing memory size
queries.  It would wrap whatever OS calls are needed.



> +
> +      if (system_memory_pages <= 0 || system_page_size <= 0)
> +         return 0;
> +
> +      const uint64_t system_memory_bytes = (uint64_t) system_memory_pages
> +         * (uint64_t) system_page_size;
>

Declarations cannot follow code (MSVC).



> +
> +      const unsigned system_memory_megabytes =
> +          (unsigned) (system_memory_bytes / (1024 * 1024));
> +
> +      return system_memory_megabytes;
> +   }
> +   case PIPE_CAP_UMA:
> +      return 0;
>     }
>     /* should only get here on unhandled cases */
>     debug_printf("Unexpected PIPE_CAP %d query\n", param);
> diff --git a/src/gallium/drivers/softpipe/sp_screen.c
> b/src/gallium/drivers/softpipe/sp_screen.c
> index 3a6d31a..bf91274 100644
> --- a/src/gallium/drivers/softpipe/sp_screen.c
> +++ b/src/gallium/drivers/softpipe/sp_screen.c
> @@ -195,6 +195,31 @@ softpipe_get_param(struct pipe_screen *screen, enum
> pipe_cap param)
>        return 11;
>     case PIPE_CAP_MAX_GL_ES2_VERSION:
>        return 20;
> +
> +   case PIPE_CAP_VENDOR_ID:
> +      return 0xFFFFFFFF;
> +   case PIPE_CAP_DEVICE_ID:
> +      return 0xFFFFFFFF;
> +   case PIPE_CAP_ACCELERATED:
> +      return 0;
> +   case PIPE_CAP_VIDEO_MEMORY: {
> +      /* XXX: Do we want to return the full amount fo system memory ? */
> +      const long system_memory_pages = sysconf(_SC_PHYS_PAGES);
> +      const long system_page_size = sysconf(_SC_PAGE_SIZE);
> +
> +      if (system_memory_pages <= 0 || system_page_size <= 0)
> +         return 0;
> +
> +      const uint64_t system_memory_bytes = (uint64_t) system_memory_pages
> +         * (uint64_t) system_page_size;
> +
> +      const unsigned system_memory_megabytes =
> +          (unsigned) (system_memory_bytes / (1024 * 1024));
> +
> +      return system_memory_megabytes;
> +   }
> +   case PIPE_CAP_UMA:
> +      return 0;
>     }
>     /* should only get here on unhandled cases */
>     debug_printf("Unexpected PIPE_CAP %d query\n", param);
> --
> 1.9.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140222/47ddf654/attachment.html>


More information about the mesa-dev mailing list