[Mesa-dev] [PATCH 16/19] gallium/nouveau: handle query_renderer caps
Roland Scheidegger
sroland at vmware.com
Thu Aug 14 15:52:03 PDT 2014
Am 15.08.2014 00:33, schrieb Ilia Mirkin:
> Hm, I wonder what GETPARAM_PCI_DEVICE returns for GK20A. Also, not
> 100% sure what UMA means, but GK20A (NVEA) would defnitely qualify.
> Not sure about the other IGP's that steal vram from the system. All
> IGPs end in 0xa-0xf though, so they're easy to detect. (But some might
> have dedicated vram, not 100% sure.)
The definition of UMA is probably slightly weird - last time this came
up display memory also needed to be in the same pool, hence
softpipe/llvmpipe do not qualify even.
Roland
>
> On Thu, Aug 14, 2014 at 6:18 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
>> ---
>> src/gallium/drivers/nouveau/nv30/nv30_screen.c | 20 ++++++++++++++++++++
>> src/gallium/drivers/nouveau/nv50/nv50_screen.c | 26 +++++++++++++++++++++-----
>> src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 24 ++++++++++++++++++++----
>> 3 files changed, 61 insertions(+), 9 deletions(-)
>>
>> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
>> index 2860188..e6540a2 100644
>> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
>> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
>> @@ -23,6 +23,8 @@
>> *
>> */
>>
>> +#include <xf86drm.h>
>> +#include <nouveau_drm.h>
>> #include "util/u_format.h"
>> #include "util/u_format_s3tc.h"
>>
>> @@ -49,6 +51,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>> {
>> struct nv30_screen *screen = nv30_screen(pscreen);
>> struct nouveau_object *eng3d = screen->eng3d;
>> + struct nouveau_device *dev = nouveau_screen(pscreen)->device;
>>
>> switch (param) {
>> /* non-boolean capabilities */
>> @@ -149,6 +152,23 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>> case PIPE_CAP_COMPUTE:
>> case PIPE_CAP_DRAW_INDIRECT:
>> return 0;
>> +
>> + case PIPE_CAP_VENDOR_ID:
>> + return 0x10de;
>> + case PIPE_CAP_DEVICE_ID: {
>> + uint64_t device_id;
>> + if (nouveau_getparam(dev, NOUVEAU_GETPARAM_PCI_DEVICE, &device_id)) {
>> + NOUVEAU_ERR("NOUVEAU_GETPARAM_PCI_DEVICE failed.\n");
>> + return -1;
>> + }
>> + return device_id;
>> + }
>> + case PIPE_CAP_ACCELERATED:
>> + return 1;
>> + case PIPE_CAP_VIDEO_MEMORY:
>> + return dev->vram_size >> 20;
>> + case PIPE_CAP_UMA:
>> + return 0;
>> }
>>
>> debug_printf("unknown param %d\n", param);
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>> index 7b1b112..d15daf0 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>> @@ -20,6 +20,9 @@
>> * OTHER DEALINGS IN THE SOFTWARE.
>> */
>>
>> +#include <errno.h>
>> +#include <xf86drm.h>
>> +#include <nouveau_drm.h>
>> #include "util/u_format.h"
>> #include "util/u_format_s3tc.h"
>> #include "pipe/p_screen.h"
>> @@ -30,11 +33,6 @@
>> #include "nouveau_vp3_video.h"
>>
>> #include "nv_object.xml.h"
>> -#include <errno.h>
>> -
>> -#ifndef NOUVEAU_GETPARAM_GRAPH_UNITS
>> -# define NOUVEAU_GETPARAM_GRAPH_UNITS 13
>> -#endif
>>
>> /* affected by LOCAL_WARPS_LOG_ALLOC / LOCAL_WARPS_NO_CLAMP */
>> #define LOCAL_WARPS_ALLOC 32
>> @@ -83,6 +81,7 @@ static int
>> nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>> {
>> const uint16_t class_3d = nouveau_screen(pscreen)->class_3d;
>> + struct nouveau_device *dev = nouveau_screen(pscreen)->device;
>>
>> switch (param) {
>> /* non-boolean caps */
>> @@ -201,6 +200,23 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>> case PIPE_CAP_COMPUTE:
>> case PIPE_CAP_DRAW_INDIRECT:
>> return 0;
>> +
>> + case PIPE_CAP_VENDOR_ID:
>> + return 0x10de;
>> + case PIPE_CAP_DEVICE_ID: {
>> + uint64_t device_id;
>> + if (nouveau_getparam(dev, NOUVEAU_GETPARAM_PCI_DEVICE, &device_id)) {
>> + NOUVEAU_ERR("NOUVEAU_GETPARAM_PCI_DEVICE failed.\n");
>> + return -1;
>> + }
>> + return device_id;
>> + }
>> + case PIPE_CAP_ACCELERATED:
>> + return 1;
>> + case PIPE_CAP_VIDEO_MEMORY:
>> + return dev->vram_size >> 20;
>> + case PIPE_CAP_UMA:
>> + return 0;
>> }
>>
>> NOUVEAU_ERR("unknown PIPE_CAP %d\n", param);
>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>> index d372a0f..afe5d57 100644
>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>> @@ -20,6 +20,8 @@
>> * OTHER DEALINGS IN THE SOFTWARE.
>> */
>>
>> +#include <xf86drm.h>
>> +#include <nouveau_drm.h>
>> #include "util/u_format.h"
>> #include "util/u_format_s3tc.h"
>> #include "pipe/p_screen.h"
>> @@ -34,10 +36,6 @@
>>
>> #include "nvc0/mme/com9097.mme.h"
>>
>> -#ifndef NOUVEAU_GETPARAM_GRAPH_UNITS
>> -# define NOUVEAU_GETPARAM_GRAPH_UNITS 13
>> -#endif
>> -
>> static boolean
>> nvc0_screen_is_format_supported(struct pipe_screen *pscreen,
>> enum pipe_format format,
>> @@ -69,6 +67,7 @@ static int
>> nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>> {
>> const uint16_t class_3d = nouveau_screen(pscreen)->class_3d;
>> + struct nouveau_device *dev = nouveau_screen(pscreen)->device;
>>
>> switch (param) {
>> /* non-boolean caps */
>> @@ -185,6 +184,23 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>> case PIPE_CAP_FAKE_SW_MSAA:
>> case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>> return 0;
>> +
>> + case PIPE_CAP_VENDOR_ID:
>> + return 0x10de;
>> + case PIPE_CAP_DEVICE_ID: {
>> + uint64_t device_id;
>> + if (nouveau_getparam(dev, NOUVEAU_GETPARAM_PCI_DEVICE, &device_id)) {
>> + NOUVEAU_ERR("NOUVEAU_GETPARAM_PCI_DEVICE failed.\n");
>> + return -1;
>> + }
>> + return device_id;
>> + }
>> + case PIPE_CAP_ACCELERATED:
>> + return 1;
>> + case PIPE_CAP_VIDEO_MEMORY:
>> + return dev->vram_size >> 20;
>> + case PIPE_CAP_UMA:
>> + return 0;
>> }
>>
>> NOUVEAU_ERR("unknown PIPE_CAP %d\n", param);
>> --
>> 2.0.2
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=F4msKE2WxRzA%2BwN%2B25muztFm5TSPwE8HKJfWfR2NgfY%3D%0A&m=zma23NIB9Fgy3rPvfWvVvrLD1jhur4zvFETQziu4DEk%3D%0A&s=2563d398fe9784583eb0fe0b2b363f3d1a15b718c8bfc274a9992e9eea689f67
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=F4msKE2WxRzA%2BwN%2B25muztFm5TSPwE8HKJfWfR2NgfY%3D%0A&m=zma23NIB9Fgy3rPvfWvVvrLD1jhur4zvFETQziu4DEk%3D%0A&s=2563d398fe9784583eb0fe0b2b363f3d1a15b718c8bfc274a9992e9eea689f67
>
More information about the mesa-dev
mailing list