i965: Add a new brw_device_info structure.

The idea is that struct brw_device_info should store statically-known
information about hardware features.  Using the new family name in the
PCI ID table, we can easily grab the right structure.

This is basically the equivalent of intel_device_info in the kernel.

This patch also makes the new structure available from intel_screen, but
nothing uses it.  Right now, it looks very redundant with existing
fields, but that will change.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Kenneth Graunke 2013-07-04 12:11:36 -07:00
parent 4a29b9a066
commit 6e9f427ed8
6 changed files with 150 additions and 0 deletions

View file

@ -45,6 +45,7 @@ i965_FILES = \
brw_context.c \
brw_cubemap_normalize.cpp \
brw_curbe.c \
brw_device_info.c \
brw_disasm.c \
brw_draw.c \
brw_draw_upload.c \

View file

@ -0,0 +1,97 @@
/*
* Copyright © 2013 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include <stdio.h>
#include <stdlib.h>
#include "brw_device_info.h"
static const struct brw_device_info brw_device_info_i965 = {
.gen = 4,
};
static const struct brw_device_info brw_device_info_g4x = {
.gen = 4,
.is_g4x = true,
};
static const struct brw_device_info brw_device_info_ilk = {
.gen = 5,
};
static const struct brw_device_info brw_device_info_snb_gt1 = {
.gen = 6,
.gt = 2,
.has_hiz_and_separate_stencil = true,
.has_llc = true,
};
static const struct brw_device_info brw_device_info_snb_gt2 = {
.gen = 6,
.gt = 2,
.has_hiz_and_separate_stencil = true,
.has_llc = true,
};
#define GEN7_FEATURES \
.gen = 7, \
.has_hiz_and_separate_stencil = true, \
.must_use_separate_stencil = true, \
.has_llc = true
static const struct brw_device_info brw_device_info_ivb_gt1 = {
GEN7_FEATURES, .is_ivybridge = true, .gt = 1,
};
static const struct brw_device_info brw_device_info_ivb_gt2 = {
GEN7_FEATURES, .is_ivybridge = true, .gt = 2,
};
static const struct brw_device_info brw_device_info_byt = {
GEN7_FEATURES, .is_baytrail = true, .gt = 1,
.has_llc = false,
};
static const struct brw_device_info brw_device_info_hsw_gt1 = {
GEN7_FEATURES, .is_haswell = true, .gt = 1,
};
static const struct brw_device_info brw_device_info_hsw_gt2 = {
GEN7_FEATURES, .is_haswell = true, .gt = 2,
};
static const struct brw_device_info brw_device_info_hsw_gt3 = {
GEN7_FEATURES, .is_haswell = true, .gt = 3,
};
const struct brw_device_info *
brw_get_device_info(int devid)
{
switch (devid) {
#undef CHIPSET
#define CHIPSET(id, family, name) case id: return &brw_device_info_##family;
#include "pci_ids/i965_pci_ids.h"
default:
fprintf(stderr, "Unknown Intel device.");
abort();
}
}

View file

@ -0,0 +1,44 @@
/*
* Copyright © 2013 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
*/
#pragma once
#include <stdbool.h>
struct brw_device_info
{
int gen; /**< Generation number: 4, 5, 6, 7, ... */
int gt;
bool is_g4x;
bool is_ivybridge;
bool is_baytrail;
bool is_haswell;
bool has_hiz_and_separate_stencil;
bool must_use_separate_stencil;
bool has_llc;
};
const struct brw_device_info *brw_get_device_info(int devid);

View file

@ -25,6 +25,9 @@
*
*/
#pragma once
#include <stdbool.h>
#define PCI_CHIP_IGD_GM 0xA011
#define PCI_CHIP_IGD_G 0xA001

View file

@ -1257,6 +1257,7 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
return false;
intelScreen->deviceID = drm_intel_bufmgr_gem_get_devid(intelScreen->bufmgr);
intelScreen->devinfo = brw_get_device_info(intelScreen->deviceID);
if (IS_GEN7(intelScreen->deviceID)) {
intelScreen->gen = 7;

View file

@ -32,12 +32,16 @@
#include <sys/time.h>
#include "dri_util.h"
#include "intel_bufmgr.h"
#include "intel_chipset.h"
#include "brw_device_info.h"
#include "i915_drm.h"
#include "xmlconfig.h"
struct intel_screen
{
int deviceID;
const struct brw_device_info *devinfo;
int gen;
__DRIscreen *driScrnPriv;