summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@virtuousgeek.org>2008-10-06 16:08:12 -0700
committerJesse Barnes <jbarnes@virtuousgeek.org>2008-10-06 16:08:12 -0700
commit5e04b5ad1b618655e201cbf1f5b2585aa6be0c17 (patch)
tree96348af22fd2933c983b126560d1ab662d70b528 /src
parent979bb109c6d76fe18b9e29f55afb2548f890bbfe (diff)
parent260cbcfe61868175ba3e649ce07d43f57601f9be (diff)
Merge branch 'master' of ssh://git.freedesktop.org/git/xorg/driver/xf86-video-intel
Diffstat (limited to 'src')
-rw-r--r--src/brw_defines.h3
-rw-r--r--src/brw_structs.h22
-rw-r--r--src/common.h17
-rw-r--r--src/i810.h3
-rw-r--r--src/i810_driver.c10
-rw-r--r--src/i830.h2
-rw-r--r--src/i830_bios.c53
-rw-r--r--src/i830_driver.c9
-rw-r--r--src/i830_modes.c1
-rw-r--r--src/i965_render.c63
-rw-r--r--src/i965_video.c2
11 files changed, 98 insertions, 87 deletions
diff --git a/src/brw_defines.h b/src/brw_defines.h
index 13cb4396..0df2491c 100644
--- a/src/brw_defines.h
+++ b/src/brw_defines.h
@@ -466,6 +466,9 @@
#define BRW_SURFACE_BUFFER 4
#define BRW_SURFACE_NULL 7
+#define BRW_BORDER_COLOR_MODE_DEFAULT 0
+#define BRW_BORDER_COLOR_MODE_LEGACY 1
+
#define BRW_TEXCOORDMODE_WRAP 0
#define BRW_TEXCOORDMODE_MIRROR 1
#define BRW_TEXCOORDMODE_CLAMP 2
diff --git a/src/brw_structs.h b/src/brw_structs.h
index ef7906b4..022915d1 100644
--- a/src/brw_structs.h
+++ b/src/brw_structs.h
@@ -840,10 +840,26 @@ struct brw_wm_unit_state
float global_depth_offset_scale;
};
-struct brw_sampler_default_color {
+/* The hardware supports two different modes for border color. The
+ * default (OpenGL) mode uses floating-point color channels, while the
+ * legacy mode uses 4 bytes.
+ *
+ * More significantly, the legacy mode respects the components of the
+ * border color for channels not present in the source, (whereas the
+ * default mode will ignore the border color's alpha channel and use
+ * alpha==1 for an RGB source, for example).
+ *
+ * The legacy mode matches the semantics specified by the Render
+ * extension.
+ */
+struct brw_sampler_default_border_color {
float color[4];
};
+struct brw_sampler_legacy_border_color {
+ uint8_t color[4];
+};
+
struct brw_sampler_state
{
@@ -857,7 +873,7 @@ struct brw_sampler_state
unsigned int base_level:5;
unsigned int pad:1;
unsigned int lod_preclamp:1;
- unsigned int default_color_mode:1;
+ unsigned int border_color_mode:1;
unsigned int pad0:1;
unsigned int disable:1;
} ss0;
@@ -876,7 +892,7 @@ struct brw_sampler_state
struct
{
unsigned int pad:5;
- unsigned int default_color_pointer:27;
+ unsigned int border_color_pointer:27;
} ss2;
struct
diff --git a/src/common.h b/src/common.h
index 840d30ab..acd5f4a2 100644
--- a/src/common.h
+++ b/src/common.h
@@ -81,8 +81,6 @@ extern void I830InitpScrn(ScrnInfoPtr pScrn);
extern int I830EntityIndex;
extern const char *I810vgahwSymbols[];
extern const char *I810ramdacSymbols[];
-extern const char *I810int10Symbols[];
-extern const char *I810vbeSymbols[];
extern const char *I810ddcSymbols[];
extern const char *I810fbSymbols[];
extern const char *I810xaaSymbols[];
@@ -106,21 +104,6 @@ extern void I830DPRINTF_stub(const char *filename, int line,
#define RecPtr pI810
#endif
-/* BIOS debug macro */
-#define xf86ExecX86int10_wrapper(pInt, pScrn) do { \
- ErrorF("Executing (ax == 0x%x) BIOS call at %s:%d\n", pInt->ax, __FILE__, __LINE__); \
- if (I810_DEBUG & DEBUG_VERBOSE_BIOS) { \
- ErrorF("Checking Error state before execution\n"); \
- PrintErrorState(pScrn); \
- } \
- xf86ExecX86int10(pInt); \
- if(I810_DEBUG & DEBUG_VERBOSE_BIOS) { \
- ErrorF("Checking Error state after execution\n"); \
- usleep(50000); \
- PrintErrorState(pScrn); \
- } \
-} while (0)
-
static inline void memset_volatile(volatile void *b, int c, size_t len)
{
int i;
diff --git a/src/i810.h b/src/i810.h
index e7331f6d..7ea20439 100644
--- a/src/i810.h
+++ b/src/i810.h
@@ -47,7 +47,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xaa.h"
#include "xf86Cursor.h"
#include "xf86xv.h"
-#include "xf86int10.h"
#include "vbe.h"
#include "vgaHW.h"
@@ -276,6 +275,8 @@ typedef struct _I810Rec {
int drmMinor;
} I810Rec;
+extern const char *I810vbeSymbols[];
+
#define I810PTR(p) ((I810Ptr)((p)->driverPrivate))
#define I810_SELECT_FRONT 0
diff --git a/src/i810_driver.c b/src/i810_driver.c
index a7f408c4..cc28ad8b 100644
--- a/src/i810_driver.c
+++ b/src/i810_driver.c
@@ -342,14 +342,6 @@ const char *I810ddcSymbols[] = {
NULL
};
-const char *I810int10Symbols[] = {
- "xf86ExecX86int10",
- "xf86InitInt10",
- "xf86Int10AllocPages",
- "xf86int10Addr",
- NULL
-};
-
const char *I810xaaSymbols[] = {
"XAACreateInfoRec",
"XAADestroyInfoRec",
@@ -518,7 +510,7 @@ i810Setup(pointer module, pointer opts, int *errmaj, int *errmin)
#endif
I810shadowFBSymbols,
I810vbeSymbols, vbeOptionalSymbols,
- I810ddcSymbols, I810int10Symbols, NULL);
+ I810ddcSymbols, NULL);
/*
* The return value must be non-NULL on success even though there
diff --git a/src/i830.h b/src/i830.h
index 491dfd00..5b782369 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -56,8 +56,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xaa.h"
#include "xf86Cursor.h"
#include "xf86xv.h"
-#include "xf86int10.h"
-#include "vbe.h"
#include "vgaHW.h"
#include "xf86Crtc.h"
#include "xf86RandR12.h"
diff --git a/src/i830_bios.c b/src/i830_bios.c
index 2cb0b07b..007530dc 100644
--- a/src/i830_bios.c
+++ b/src/i830_bios.c
@@ -47,9 +47,6 @@
(bios[_addr + 2] << 16) \
(bios[_addr + 3] << 24))
-/* XXX */
-#define INTEL_VBIOS_SIZE (64 * 1024)
-
static void *
find_section(struct bdb_header *bdb, int section_id)
{
@@ -162,6 +159,8 @@ parse_general_features(I830Ptr pI830, struct bdb_header *bdb)
}
}
+#define INTEL_VBIOS_SIZE (64 * 1024) /* XXX */
+
/**
* i830_bios_init - map VBIOS, find VBT
*
@@ -180,34 +179,44 @@ i830_bios_init(ScrnInfoPtr pScrn)
struct bdb_header *bdb;
int vbt_off, bdb_off;
unsigned char *bios;
- vbeInfoPtr pVbe;
- pointer pVBEModule = NULL;
+ int ret;
+ int size;
- bios = xalloc(INTEL_VBIOS_SIZE);
+#if XSERVER_LIBPCIACCESS
+ size = pI830->PciInfo->rom_size;
+ if (size == 0) {
+ size = INTEL_VBIOS_SIZE;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "libpciaccess reported 0 rom size, guessing %dkB\n",
+ size / 1024);
+ }
+#else
+ size = INTEL_VBIOS_SIZE;
+#endif
+ bios = xalloc(size);
if (bios == NULL)
return -1;
- /* Load vbe module */
- if (!(pVBEModule = xf86LoadSubModule(pScrn, "vbe")))
- return FALSE;
- xf86LoaderReqSymLists(I810vbeSymbols, NULL);
-
- pVbe = VBEInit(NULL, pI830->pEnt->index);
- if (pVbe != NULL) {
- memcpy(bios, xf86int10Addr(pVbe->pInt10,
- pVbe->pInt10->BIOSseg << 4),
- INTEL_VBIOS_SIZE);
- vbeFree (pVbe);
- } else {
#if XSERVER_LIBPCIACCESS
- pci_device_read_rom (pI830->PciInfo, bios);
+ ret = pci_device_read_rom (pI830->PciInfo, bios);
+ if (ret != 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "libpciaccess failed to read %dkB video BIOS: %s\n",
+ size / 1024, strerror(-ret));
+ xfree (bios);
+ return -1;
+ }
#else
- xf86ReadPciBIOS(0, pI830->PciTag, 0, bios, INTEL_VBIOS_SIZE);
-#endif
+ /* xf86ReadPciBIOS returns the length read */
+ ret = xf86ReadPciBIOS(0, pI830->PciTag, 0, bios, size);
+ if (ret <= 0) {
+ xfree (bios);
+ return -1;
}
+#endif
vbt_off = INTEL_BIOS_16(0x1a);
- if (vbt_off >= INTEL_VBIOS_SIZE) {
+ if (vbt_off >= size) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Bad VBT offset: 0x%x\n",
vbt_off);
xfree(bios);
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 53219c39..3a2a9a40 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -191,7 +191,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "dixstruct.h"
#include "xf86xv.h"
#include <X11/extensions/Xv.h>
-#include "vbe.h"
#include "shadow.h"
#include "i830.h"
#include "i830_display.h"
@@ -441,9 +440,6 @@ I830DetectMemory(ScrnInfoPtr pScrn)
uint16_t gmch_ctrl;
int memsize = 0, gtt_size;
int range;
-#if 0
- VbeInfoBlock *vbeInfo;
-#endif
#if XSERVER_LIBPCIACCESS
struct pci_device *bridge = intel_host_bridge ();
@@ -1420,11 +1416,6 @@ I830LoadSyms(ScrnInfoPtr pScrn)
if (pI830->use_drm_mode)
return TRUE;
- /* Load int10 module */
- if (!xf86LoadSubModule(pScrn, "int10"))
- return FALSE;
- xf86LoaderReqSymLists(I810int10Symbols, NULL);
-
/* The vgahw module should be loaded here when needed */
if (!xf86LoadSubModule(pScrn, "vgahw"))
return FALSE;
diff --git a/src/i830_modes.c b/src/i830_modes.c
index 06921a50..4aa493ea 100644
--- a/src/i830_modes.c
+++ b/src/i830_modes.c
@@ -31,7 +31,6 @@
* Authors: David Dawes <dawes@xfree86.org>
* Eric Anholt <eric.anholt@intel.com>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbeModes.c,v 1.6 2002/11/02 01:38:25 dawes Exp $
*/
/*
* Modified by Alan Hourihane <alanh@tungstengraphics.com>
diff --git a/src/i965_render.c b/src/i965_render.c
index 7dee5f3f..9ee273c0 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -209,7 +209,7 @@ static Bool i965_check_composite_texture(PicturePtr pPict, int unit)
I830FALLBACK("Unsupported picture format 0x%x\n",
(int)pPict->format);
- if (pPict->repeat && pPict->repeatType != RepeatNormal)
+ if (pPict->repeatType > RepeatReflect)
I830FALLBACK("extended repeat (%d) not supported\n",
pPict->repeatType);
@@ -427,6 +427,8 @@ typedef enum {
typedef enum {
SAMPLER_STATE_EXTEND_NONE,
SAMPLER_STATE_EXTEND_REPEAT,
+ SAMPLER_STATE_EXTEND_PAD,
+ SAMPLER_STATE_EXTEND_REFLECT,
SAMPLER_STATE_EXTEND_COUNT
} sampler_state_extend_t;
@@ -494,8 +496,8 @@ typedef struct _gen4_state {
[SAMPLER_STATE_FILTER_COUNT]
[SAMPLER_STATE_EXTEND_COUNT][2];
- struct brw_sampler_default_color sampler_default_color;
- PAD64 (brw_sampler_default_color, 0);
+ struct brw_sampler_legacy_border_color sampler_border_color;
+ PAD64 (brw_sampler_legacy_border_color, 0);
/* Index by [src_blend][dst_blend] */
brw_cc_unit_state_padded cc_state[BRW_BLENDFACTOR_COUNT]
@@ -564,13 +566,16 @@ static void
sampler_state_init (struct brw_sampler_state *sampler_state,
sampler_state_filter_t filter,
sampler_state_extend_t extend,
- int default_color_offset)
+ int border_color_offset)
{
/* PS kernel use this sampler */
memset(sampler_state, 0, sizeof(*sampler_state));
sampler_state->ss0.lod_preclamp = 1; /* GL mode */
- sampler_state->ss0.default_color_mode = 0; /* GL mode */
+
+ /* We use the legacy mode to get the semantics specified by
+ * the Render extension. */
+ sampler_state->ss0.border_color_mode = BRW_BORDER_COLOR_MODE_LEGACY;
switch(filter) {
default:
@@ -596,10 +601,20 @@ sampler_state_init (struct brw_sampler_state *sampler_state,
sampler_state->ss1.s_wrap_mode = BRW_TEXCOORDMODE_WRAP;
sampler_state->ss1.t_wrap_mode = BRW_TEXCOORDMODE_WRAP;
break;
+ case SAMPLER_STATE_EXTEND_PAD:
+ sampler_state->ss1.r_wrap_mode = BRW_TEXCOORDMODE_CLAMP;
+ sampler_state->ss1.s_wrap_mode = BRW_TEXCOORDMODE_CLAMP;
+ sampler_state->ss1.t_wrap_mode = BRW_TEXCOORDMODE_CLAMP;
+ break;
+ case SAMPLER_STATE_EXTEND_REFLECT:
+ sampler_state->ss1.r_wrap_mode = BRW_TEXCOORDMODE_MIRROR;
+ sampler_state->ss1.s_wrap_mode = BRW_TEXCOORDMODE_MIRROR;
+ sampler_state->ss1.t_wrap_mode = BRW_TEXCOORDMODE_MIRROR;
+ break;
}
- assert((default_color_offset & 31) == 0);
- sampler_state->ss2.default_color_pointer = default_color_offset >> 5;
+ assert((border_color_offset & 31) == 0);
+ sampler_state->ss2.border_color_pointer = border_color_offset >> 5;
sampler_state->ss3.chroma_key_enable = 0; /* disable chromakey */
}
@@ -722,13 +737,13 @@ gen4_state_init (struct gen4_render_state *render_state)
card_state->vs_state.vs6.vs_enable = 0;
card_state->vs_state.vs6.vert_cache_disable = 1;
- /* Set up the sampler default color (always transparent black) */
- memset(&card_state->sampler_default_color, 0,
- sizeof(card_state->sampler_default_color));
- card_state->sampler_default_color.color[0] = 0.0; /* R */
- card_state->sampler_default_color.color[1] = 0.0; /* G */
- card_state->sampler_default_color.color[2] = 0.0; /* B */
- card_state->sampler_default_color.color[3] = 0.0; /* A */
+ /* Set up the sampler border color (always transparent black) */
+ memset(&card_state->sampler_border_color, 0,
+ sizeof(card_state->sampler_border_color));
+ card_state->sampler_border_color.color[0] = 0; /* R */
+ card_state->sampler_border_color.color[1] = 0; /* G */
+ card_state->sampler_border_color.color[2] = 0; /* B */
+ card_state->sampler_border_color.color[3] = 0; /* A */
card_state->cc_viewport.min_depth = -1.e35;
card_state->cc_viewport.max_depth = 1.e35;
@@ -748,12 +763,12 @@ gen4_state_init (struct gen4_render_state *render_state)
i, j,
state_base_offset +
offsetof (gen4_state_t,
- sampler_default_color));
+ sampler_border_color));
sampler_state_init (&card_state->sampler_state[i][j][k][l][1],
k, l,
state_base_offset +
offsetof (gen4_state_t,
- sampler_default_color));
+ sampler_border_color));
}
}
}
@@ -828,13 +843,17 @@ sampler_state_filter_from_picture (int filter)
}
static sampler_state_extend_t
-sampler_state_extend_from_picture (int repeat)
+sampler_state_extend_from_picture (int repeat_type)
{
- switch (repeat) {
+ switch (repeat_type) {
case RepeatNone:
return SAMPLER_STATE_EXTEND_NONE;
case RepeatNormal:
return SAMPLER_STATE_EXTEND_REPEAT;
+ case RepeatPad:
+ return SAMPLER_STATE_EXTEND_PAD;
+ case RepeatReflect:
+ return SAMPLER_STATE_EXTEND_REFLECT;
default:
return -1;
}
@@ -1010,17 +1029,17 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture,
src_filter = sampler_state_filter_from_picture (pSrcPicture->filter);
if (src_filter < 0)
I830FALLBACK ("Bad src filter 0x%x\n", pSrcPicture->filter);
- src_extend = sampler_state_extend_from_picture (pSrcPicture->repeat);
+ src_extend = sampler_state_extend_from_picture (pSrcPicture->repeatType);
if (src_extend < 0)
- I830FALLBACK ("Bad src repeat 0x%x\n", pSrcPicture->repeat);
+ I830FALLBACK ("Bad src repeat 0x%x\n", pSrcPicture->repeatType);
if (pMaskPicture) {
mask_filter = sampler_state_filter_from_picture (pMaskPicture->filter);
if (mask_filter < 0)
I830FALLBACK ("Bad mask filter 0x%x\n", pMaskPicture->filter);
- mask_extend = sampler_state_extend_from_picture (pMaskPicture->repeat);
+ mask_extend = sampler_state_extend_from_picture (pMaskPicture->repeatType);
if (mask_extend < 0)
- I830FALLBACK ("Bad mask repeat 0x%x\n", pMaskPicture->repeat);
+ I830FALLBACK ("Bad mask repeat 0x%x\n", pMaskPicture->repeatType);
} else {
mask_filter = SAMPLER_STATE_FILTER_NEAREST;
mask_extend = SAMPLER_STATE_EXTEND_NONE;
diff --git a/src/i965_video.c b/src/i965_video.c
index 4c79259b..78f69ee5 100644
--- a/src/i965_video.c
+++ b/src/i965_video.c
@@ -254,7 +254,7 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
ps_kernel_static = &ps_kernel_planar_static[0][0];
ps_kernel_static_size = sizeof (ps_kernel_planar_static);
src_width[1] = src_width[0] = width;
- src_width[1] = src_height[0] = height;
+ src_height[1] = src_height[0] = height;
src_pitch[1] = src_pitch[0] = video_pitch * 2;
src_width[4] = src_width[5] = src_width[2] = src_width[3] = width / 2;
src_height[4] = src_height[5] = src_height[2] = src_height[3] = height / 2;