diff options
Diffstat (limited to 'src')
45 files changed, 1059 insertions, 835 deletions
diff --git a/src/bios_reader/bios_dumper.c b/src/bios_reader/bios_dumper.c index 6f163d56..e2f3064e 100644 --- a/src/bios_reader/bios_dumper.c +++ b/src/bios_reader/bios_dumper.c @@ -31,6 +31,7 @@ #include <stdarg.h> #include <sys/stat.h> #include <fcntl.h> +#include <unistd.h> #include <errno.h> #include <pciaccess.h> #include <err.h> diff --git a/src/bios_reader/bios_reader.c b/src/bios_reader/bios_reader.c index 9ec73c13..ffa27f03 100644 --- a/src/bios_reader/bios_reader.c +++ b/src/bios_reader/bios_reader.c @@ -38,7 +38,7 @@ /* Make a fake pI830 so we can easily pull i830_bios.c code in here. */ struct _fake_i830 { - CARD8 *VBIOS; + uint8_t *VBIOS; }; struct _fake_i830 I830; struct _fake_i830 *pI830 = &I830; @@ -93,7 +93,7 @@ int main(int argc, char **argv) struct lvds_bdb_2 *lvds2; struct lvds_bdb_2_fp_params *fpparam; struct lvds_bdb_2_fp_edid_dtd *fptiming; - CARD8 *timing_ptr; + uint8_t *timing_ptr; id = INTEL_BIOS_8(start); block_size = INTEL_BIOS_16(start + 1) + 3; diff --git a/src/ch7017/ch7017.c b/src/ch7017/ch7017.c index 76f9cf77..759fc24b 100644 --- a/src/ch7017/ch7017.c +++ b/src/ch7017/ch7017.c @@ -29,6 +29,7 @@ #include "config.h" #endif +#include <stdint.h> #include <unistd.h> #include "xf86.h" @@ -47,16 +48,16 @@ struct ch7017_priv { I2CDevRec d; - CARD8 save_hapi; - CARD8 save_vali; - CARD8 save_valo; - CARD8 save_ailo; - CARD8 save_lvds_pll_vco; - CARD8 save_feedback_div; - CARD8 save_lvds_control_2; - CARD8 save_outputs_enable; - CARD8 save_lvds_power_down; - CARD8 save_power_management; + uint8_t save_hapi; + uint8_t save_vali; + uint8_t save_valo; + uint8_t save_ailo; + uint8_t save_lvds_pll_vco; + uint8_t save_feedback_div; + uint8_t save_lvds_control_2; + uint8_t save_outputs_enable; + uint8_t save_lvds_power_down; + uint8_t save_power_management; }; static void @@ -65,7 +66,7 @@ static void ch7017_dpms(I2CDevPtr d, int mode); static Bool -ch7017_read(struct ch7017_priv *priv, int addr, CARD8 *val) +ch7017_read(struct ch7017_priv *priv, int addr, uint8_t *val) { if (!xf86I2CReadByte(&priv->d, addr, val)) { xf86DrvMsg(priv->d.pI2CBus->scrnIndex, X_ERROR, @@ -77,7 +78,7 @@ ch7017_read(struct ch7017_priv *priv, int addr, CARD8 *val) } static Bool -ch7017_write(struct ch7017_priv *priv, int addr, CARD8 val) +ch7017_write(struct ch7017_priv *priv, int addr, uint8_t val) { if (!xf86I2CWriteByte(&priv->d, addr, val)) { xf86DrvMsg(priv->d.pI2CBus->scrnIndex, X_ERROR, @@ -93,7 +94,7 @@ static void * ch7017_init(I2CBusPtr b, I2CSlaveAddr addr) { struct ch7017_priv *priv; - CARD8 val; + uint8_t val; priv = xcalloc(1, sizeof(struct ch7017_priv)); if (priv == NULL) @@ -149,11 +150,11 @@ static void ch7017_mode_set(I2CDevPtr d, DisplayModePtr mode, DisplayModePtr adjusted_mode) { struct ch7017_priv *priv = d->DriverPrivate.ptr; - CARD8 lvds_pll_feedback_div, lvds_pll_vco_control; - CARD8 outputs_enable, lvds_control_2, lvds_power_down; - CARD8 horizontal_active_pixel_input; - CARD8 horizontal_active_pixel_output, vertical_active_line_output; - CARD8 active_input_line_output; + uint8_t lvds_pll_feedback_div, lvds_pll_vco_control; + uint8_t outputs_enable, lvds_control_2, lvds_power_down; + uint8_t horizontal_active_pixel_input; + uint8_t horizontal_active_pixel_output, vertical_active_line_output; + uint8_t active_input_line_output; xf86DrvMsg(priv->d.pI2CBus->scrnIndex, X_INFO, "Registers before mode setting\n"); @@ -228,7 +229,7 @@ static void ch7017_dpms(I2CDevPtr d, int mode) { struct ch7017_priv *priv = d->DriverPrivate.ptr; - CARD8 val; + uint8_t val; ch7017_read(priv, CH7017_LVDS_POWER_DOWN, &val); @@ -258,7 +259,7 @@ static void ch7017_dump_regs(I2CDevPtr d) { struct ch7017_priv *priv = d->DriverPrivate.ptr; - CARD8 val; + uint8_t val; #define DUMP(reg) \ do { \ diff --git a/src/ch7xxx/ch7xxx.c b/src/ch7xxx/ch7xxx.c index 51fa78e6..8a439e42 100644 --- a/src/ch7xxx/ch7xxx.c +++ b/src/ch7xxx/ch7xxx.c @@ -30,6 +30,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "config.h" #endif +#include <stdint.h> #include <string.h> #include "xf86.h" #include "xf86_OSproc.h" @@ -50,7 +51,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ static struct ch7xxx_id_struct { - CARD8 vid; + uint8_t vid; char *name; } ch7xxx_ids[] = { { CH7011_VID, "CH7011" }, @@ -62,7 +63,7 @@ static struct ch7xxx_id_struct { #define ID_ARRAY_SIZE (sizeof(ch7xxx_ids) / sizeof(ch7xxx_ids[0])) struct ch7xxx_reg_state { - CARD8 regs[CH7xxx_NUM_REGS]; + uint8_t regs[CH7xxx_NUM_REGS]; }; struct ch7xxx_priv { @@ -71,13 +72,13 @@ struct ch7xxx_priv { struct ch7xxx_reg_state SavedReg; struct ch7xxx_reg_state ModeReg; - CARD8 save_TCTL, save_TPCP, save_TPD, save_TPVT; - CARD8 save_TLPF, save_TCT, save_PM, save_IDF; + uint8_t save_TCTL, save_TPCP, save_TPD, save_TPVT; + uint8_t save_TLPF, save_TCT, save_PM, save_IDF; }; static void ch7xxx_save(I2CDevPtr d); -static char *ch7xxx_get_id(CARD8 vid) +static char *ch7xxx_get_id(uint8_t vid) { int i; @@ -126,7 +127,7 @@ ch7xxx_init(I2CBusPtr b, I2CSlaveAddr addr) { /* this will detect the CH7xxx chip on the specified i2c bus */ struct ch7xxx_priv *dev_priv; - CARD8 vendor, device; + uint8_t vendor, device; char *name; dev_priv = xcalloc(1, sizeof(struct ch7xxx_priv)); @@ -187,7 +188,7 @@ static xf86OutputStatus ch7xxx_detect(I2CDevPtr d) { struct ch7xxx_priv *dev_priv = d->DriverPrivate.ptr; - CARD8 cdet, orig_pm, pm; + uint8_t cdet, orig_pm, pm; ch7xxx_read(dev_priv, CH7xxx_PM, &orig_pm); @@ -219,7 +220,7 @@ static void ch7xxx_mode_set(I2CDevPtr d, DisplayModePtr mode, DisplayModePtr adjusted_mode) { struct ch7xxx_priv *dev_priv = d->DriverPrivate.ptr; - CARD8 tvco, tpcp, tpd, tlpf, idf; + uint8_t tvco, tpcp, tpd, tlpf, idf; if (mode->Clock <= 65000) { tvco = 0x23; diff --git a/src/common.h b/src/common.h index 09f28f88..9a3e0ac3 100644 --- a/src/common.h +++ b/src/common.h @@ -121,15 +121,6 @@ extern void I830DPRINTF_stub(const char *filename, int line, } \ } while (0) -#define OUT_RING(n) do { \ - if (I810_DEBUG & DEBUG_VERBOSE_RING) \ - ErrorF( "OUT_RING %lx: %x, (mask %x)\n", \ - (unsigned long)(outring), (unsigned int)(n), ringmask); \ - *(volatile unsigned int *)(virt + outring) = n; \ - outring += 4; ringused += 4; \ - outring &= ringmask; \ -} while (0) - static inline void memset_volatile(volatile void *b, int c, size_t len) { int i; @@ -147,97 +138,15 @@ static inline void memcpy_volatile(volatile void *dst, const void *src, ((volatile char *)dst)[i] = ((volatile char *)src)[i]; } -/** Copies a given number of bytes to the ring */ -#define OUT_RING_COPY(n, ptr) do { \ - if (I810_DEBUG & DEBUG_VERBOSE_RING) \ - ErrorF("OUT_RING_DATA %d bytes\n", n); \ - memcpy_volatile(virt + outring, ptr, n); \ - outring += n; \ - ringused += n; \ - outring &= ringmask; \ -} while (0) - -/** Pads the ring with a given number of zero bytes */ -#define OUT_RING_PAD(n) do { \ - if (I810_DEBUG & DEBUG_VERBOSE_RING) \ - ErrorF("OUT_RING_PAD %d bytes\n", n); \ - memset_volatile(virt + outring, 0, n); \ - outring += n; \ - ringused += n; \ - outring &= ringmask; \ -} while (0) - -union intfloat { - float f; - unsigned int ui; -}; - -#define OUT_RING_F(x) do { \ - union intfloat tmp; \ - tmp.f = (float)(x); \ - OUT_RING(tmp.ui); \ -} while(0) - -#define ADVANCE_LP_RING() do { \ - if (ringused > needed) \ - FatalError("%s: ADVANCE_LP_RING: exceeded allocation %d/%d\n ", \ - __FUNCTION__, ringused, needed); \ - else if (ringused < needed) \ - FatalError("%s: ADVANCE_LP_RING: under-used allocation %d/%d\n ", \ - __FUNCTION__, ringused, needed); \ - RecPtr->LpRing->tail = outring; \ - RecPtr->LpRing->space -= ringused; \ - if (outring & 0x07) \ - FatalError("%s: ADVANCE_LP_RING: " \ - "outring (0x%x) isn't on a QWord boundary\n", \ - __FUNCTION__, outring); \ - OUTREG(LP_RING + RING_TAIL, outring); \ -} while (0) - -/* - * XXX Note: the head/tail masks are different for 810 and i830. - * If the i810 always sets the higher bits to 0, then this shouldn't be - * a problem. Check this! - */ -#define DO_RING_IDLE() do { \ - int _head; \ - int _tail; \ - do { \ - _head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK; \ - _tail = INREG(LP_RING + RING_TAIL) & I830_TAIL_MASK; \ - DELAY(10); \ - } while (_head != _tail); \ -} while( 0) - - -#define BEGIN_LP_RING(n) \ - unsigned int outring, ringmask, ringused = 0; \ - volatile unsigned char *virt; \ - int needed; \ - if ((n) & 1) \ - ErrorF("BEGIN_LP_RING called with odd argument: %d\n", n); \ - if ((n) > 2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) \ - DO_RING_IDLE(); \ - needed = (n) * 4; \ - if (RecPtr->LpRing->space < needed) \ - WaitRingFunc(pScrn, needed, 0); \ - outring = RecPtr->LpRing->tail; \ - ringmask = RecPtr->LpRing->tail_mask; \ - virt = RecPtr->LpRing->virtual_start; \ - if (I810_DEBUG & DEBUG_VERBOSE_RING) \ - ErrorF( "BEGIN_LP_RING %d in %s\n", n, FUNCTION_NAME); - - - /* Memory mapped register access macros */ -#define INREG8(addr) *(volatile CARD8 *)(RecPtr->MMIOBase + (addr)) -#define INREG16(addr) *(volatile CARD16 *)(RecPtr->MMIOBase + (addr)) -#define INREG(addr) *(volatile CARD32 *)(RecPtr->MMIOBase + (addr)) -#define INGTT(addr) *(volatile CARD32 *)(RecPtr->GTTBase + (addr)) +#define INREG8(addr) *(volatile uint8_t *)(RecPtr->MMIOBase + (addr)) +#define INREG16(addr) *(volatile uint16_t *)(RecPtr->MMIOBase + (addr)) +#define INREG(addr) *(volatile uint32_t *)(RecPtr->MMIOBase + (addr)) +#define INGTT(addr) *(volatile uint32_t *)(RecPtr->GTTBase + (addr)) #define POSTING_READ(addr) (void)INREG(addr) #define OUTREG8(addr, val) do { \ - *(volatile CARD8 *)(RecPtr->MMIOBase + (addr)) = (val); \ + *(volatile uint8_t *)(RecPtr->MMIOBase + (addr)) = (val); \ if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) { \ ErrorF("OUTREG8(0x%lx, 0x%lx) in %s\n", (unsigned long)(addr), \ (unsigned long)(val), FUNCTION_NAME); \ @@ -245,7 +154,7 @@ union intfloat { } while (0) #define OUTREG16(addr, val) do { \ - *(volatile CARD16 *)(RecPtr->MMIOBase + (addr)) = (val); \ + *(volatile uint16_t *)(RecPtr->MMIOBase + (addr)) = (val); \ if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) { \ ErrorF("OUTREG16(0x%lx, 0x%lx) in %s\n", (unsigned long)(addr), \ (unsigned long)(val), FUNCTION_NAME); \ @@ -253,7 +162,7 @@ union intfloat { } while (0) #define OUTREG(addr, val) do { \ - *(volatile CARD32 *)(RecPtr->MMIOBase + (addr)) = (val); \ + *(volatile uint32_t *)(RecPtr->MMIOBase + (addr)) = (val); \ if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) { \ ErrorF("OUTREG(0x%lx, 0x%lx) in %s\n", (unsigned long)(addr), \ (unsigned long)(val), FUNCTION_NAME); \ @@ -65,6 +65,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #endif #include "common.h" +#include "i810_ring.h" #define I810_VERSION 4000 #define I810_NAME "intel" @@ -85,11 +86,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. typedef struct _I810Rec *I810Ptr; typedef void (*I810WriteIndexedByteFunc)(I810Ptr pI810, IOADDRESS addr, - CARD8 index, CARD8 value); -typedef CARD8(*I810ReadIndexedByteFunc)(I810Ptr pI810, IOADDRESS addr, - CARD8 index); -typedef void (*I810WriteByteFunc)(I810Ptr pI810, IOADDRESS addr, CARD8 value); -typedef CARD8(*I810ReadByteFunc)(I810Ptr pI810, IOADDRESS addr); + uint8_t index, uint8_t value); +typedef uint8_t(*I810ReadIndexedByteFunc)(I810Ptr pI810, IOADDRESS addr, + uint8_t index); +typedef void (*I810WriteByteFunc)(I810Ptr pI810, IOADDRESS addr, + uint8_t value); +typedef uint8_t(*I810ReadByteFunc)(I810Ptr pI810, IOADDRESS addr); extern void I810SetTiledMemory(ScrnInfoPtr pScrn, int nr, unsigned start, unsigned pitch, unsigned size); diff --git a/src/i810_cursor.c b/src/i810_cursor.c index c293a3d5..30f42d14 100644 --- a/src/i810_cursor.c +++ b/src/i810_cursor.c @@ -130,8 +130,8 @@ static Bool I810UseHWCursorARGB (ScreenPtr pScreen, CursorPtr pCurs) static void I810LoadCursorARGB (ScrnInfoPtr pScrn, CursorPtr pCurs) { I810Ptr pI810 = I810PTR(pScrn); - CARD32 *pcurs = (CARD32 *) (pI810->FbBase + pI810->CursorStart); - CARD32 *image = (CARD32 *) pCurs->bits->argb; + uint32_t *pcurs = (uint32_t *) (pI810->FbBase + pI810->CursorStart); + uint32_t *image = (uint32_t *) pCurs->bits->argb; int x, y, w, h; #ifdef ARGB_CURSOR @@ -171,7 +171,7 @@ static void I810LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) { I810Ptr pI810 = I810PTR(pScrn); - CARD8 *pcurs = (CARD8 *) (pI810->FbBase + pI810->CursorStart); + uint8_t *pcurs = (uint8_t *) (pI810->FbBase + pI810->CursorStart); int x, y; #ifdef ARGB_CURSOR diff --git a/src/i810_driver.c b/src/i810_driver.c index 53121a6a..4b716608 100644 --- a/src/i810_driver.c +++ b/src/i810_driver.c @@ -1609,7 +1609,7 @@ I810Save(ScrnInfoPtr pScrn) { vgaHWPtr hwp; I810Ptr pI810; - CARD32 temp; + uint32_t temp; hwp = VGAHWPTR(pScrn); pI810 = I810PTR(pScrn); @@ -1770,9 +1770,9 @@ DoRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, I810RegPtr i810Reg, /* Setting the OVRACT Register for video overlay */ { - CARD32 LCD_TV_Control = INREG(LCD_TV_C); - CARD32 TV_HTotal = INREG(LCD_TV_HTOTAL); - CARD32 ActiveStart, ActiveEnd; + uint32_t LCD_TV_Control = INREG(LCD_TV_C); + uint32_t TV_HTotal = INREG(LCD_TV_HTOTAL); + uint32_t ActiveStart, ActiveEnd; if((LCD_TV_Control & LCD_TV_ENABLE) && !(LCD_TV_Control & LCD_TV_VGAMOD) diff --git a/src/i810_io.c b/src/i810_io.c index abe1d6f0..3fd8e4e3 100644 --- a/src/i810_io.c +++ b/src/i810_io.c @@ -71,19 +71,19 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "i810.h" #endif -#define minb(p) *(volatile CARD8 *)(pI810->MMIOBase + (p)) -#define moutb(p,v) *(volatile CARD8 *)(pI810->MMIOBase + (p)) = (v) +#define minb(p) *(volatile uint8_t *)(pI810->MMIOBase + (p)) +#define moutb(p,v) *(volatile uint8_t *)(pI810->MMIOBase + (p)) = (v) static void -I810WriteControlPIO(I810Ptr pI810, IOADDRESS addr, CARD8 index, CARD8 val) +I810WriteControlPIO(I810Ptr pI810, IOADDRESS addr, uint8_t index, uint8_t val) { addr += pI810->ioBase; outb(addr, index); outb(addr + 1, val); } -static CARD8 -I810ReadControlPIO(I810Ptr pI810, IOADDRESS addr, CARD8 index) +static uint8_t +I810ReadControlPIO(I810Ptr pI810, IOADDRESS addr, uint8_t index) { addr += pI810->ioBase; outb(addr, index); @@ -91,12 +91,12 @@ I810ReadControlPIO(I810Ptr pI810, IOADDRESS addr, CARD8 index) } static void -I810WriteStandardPIO(I810Ptr pI810, IOADDRESS addr, CARD8 val) +I810WriteStandardPIO(I810Ptr pI810, IOADDRESS addr, uint8_t val) { outb(pI810->ioBase + addr, val); } -static CARD8 +static uint8_t I810ReadStandardPIO(I810Ptr pI810, IOADDRESS addr) { return inb(pI810->ioBase + addr); @@ -112,26 +112,26 @@ I810SetPIOAccess(I810Ptr pI810) } static void -I810WriteControlMMIO(I810Ptr pI810, IOADDRESS addr, CARD8 index, CARD8 val) +I810WriteControlMMIO(I810Ptr pI810, IOADDRESS addr, uint8_t index, uint8_t val) { moutb(addr, index); moutb(addr + 1, val); } -static CARD8 -I810ReadControlMMIO(I810Ptr pI810, IOADDRESS addr, CARD8 index) +static uint8_t +I810ReadControlMMIO(I810Ptr pI810, IOADDRESS addr, uint8_t index) { moutb(addr, index); return minb(addr + 1); } static void -I810WriteStandardMMIO(I810Ptr pI810, IOADDRESS addr, CARD8 val) +I810WriteStandardMMIO(I810Ptr pI810, IOADDRESS addr, uint8_t val) { moutb(addr, val); } -static CARD8 +static uint8_t I810ReadStandardMMIO(I810Ptr pI810, IOADDRESS addr) { return minb(addr); diff --git a/src/i810_memory.c b/src/i810_memory.c index 82d86eb2..222b5cf7 100644 --- a/src/i810_memory.c +++ b/src/i810_memory.c @@ -260,8 +260,8 @@ I810SetTiledMemory(ScrnInfoPtr pScrn, int nr, unsigned int start, { I810Ptr pI810 = I810PTR(pScrn); I810RegPtr i810Reg = &pI810->ModeReg; - CARD32 val; - CARD32 fence_mask = 0; + uint32_t val; + uint32_t fence_mask = 0; if (nr < 0 || nr > 7) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "%s - fence %d out of range\n", diff --git a/src/i810_ring.h b/src/i810_ring.h new file mode 100644 index 00000000..e6e354fd --- /dev/null +++ b/src/i810_ring.h @@ -0,0 +1,90 @@ +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright © 2002 David Dawes + +All Rights Reserved. + +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, sub license, 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 NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. + +**************************************************************************/ + +#ifndef _INTEL_RING_H +#define _INTEL_RING_H + +#define OUT_RING(n) do { \ + if (I810_DEBUG & DEBUG_VERBOSE_RING) \ + ErrorF("OUT_RING %lx: %x, (mask %x)\n", \ + (unsigned long)(outring), (unsigned int)(n), ringmask); \ + *(volatile unsigned int *)(virt + outring) = n; \ + outring += 4; ringused += 4; \ + outring &= ringmask; \ +} while (0) + +#define ADVANCE_LP_RING() do { \ + if (ringused > needed) \ + FatalError("%s: ADVANCE_LP_RING: exceeded allocation %d/%d\n ", \ + __FUNCTION__, ringused, needed); \ + else if (ringused < needed) \ + FatalError("%s: ADVANCE_LP_RING: under-used allocation %d/%d\n ", \ + __FUNCTION__, ringused, needed); \ + pI810->LpRing->tail = outring; \ + pI810->LpRing->space -= ringused; \ + if (outring & 0x07) \ + FatalError("%s: ADVANCE_LP_RING: " \ + "outring (0x%x) isn't on a QWord boundary\n", \ + __FUNCTION__, outring); \ + OUTREG(LP_RING + RING_TAIL, outring); \ +} while (0) + +/* + * XXX Note: the head/tail masks are different for 810 and i830. + * If the i810 always sets the higher bits to 0, then this shouldn't be + * a problem. Check this! + */ +#define DO_RING_IDLE() do { \ + int _head; \ + int _tail; \ + do { \ + _head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK; \ + _tail = INREG(LP_RING + RING_TAIL) & I830_TAIL_MASK; \ + DELAY(10); \ + } while (_head != _tail); \ +} while( 0) + +#define BEGIN_LP_RING(n) \ + unsigned int outring, ringmask, ringused = 0; \ + volatile unsigned char *virt; \ + int needed; \ + if ((n) & 1) \ + ErrorF("BEGIN_LP_RING called with odd argument: %d\n", n); \ + if ((n) > 2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) \ + DO_RING_IDLE(); \ + needed = (n) * 4; \ + if (pI810->LpRing->space < needed) \ + WaitRingFunc(pScrn, needed, 0); \ + outring = pI810->LpRing->tail; \ + ringmask = pI810->LpRing->tail_mask; \ + virt = pI810->LpRing->virtual_start; \ + if (I810_DEBUG & DEBUG_VERBOSE_RING) \ + ErrorF( "BEGIN_LP_RING %d in %s\n", n, FUNCTION_NAME); + +#endif /* _INTEL_RING_H */ diff --git a/src/i810_video.c b/src/i810_video.c index b3dc90e5..418f2952 100644 --- a/src/i810_video.c +++ b/src/i810_video.c @@ -271,43 +271,43 @@ static XF86ImageRec Images[NUM_IMAGES] = /* *INDENT-ON* */ typedef struct { - CARD32 OBUF_0Y; - CARD32 OBUF_1Y; - CARD32 OBUF_0U; - CARD32 OBUF_0V; - CARD32 OBUF_1U; - CARD32 OBUF_1V; - CARD32 OV0STRIDE; - CARD32 YRGB_VPH; - CARD32 UV_VPH; - CARD32 HORZ_PH; - CARD32 INIT_PH; - CARD32 DWINPOS; - CARD32 DWINSZ; - CARD32 SWID; - CARD32 SWIDQW; - CARD32 SHEIGHT; - CARD32 YRGBSCALE; - CARD32 UVSCALE; - CARD32 OV0CLRC0; - CARD32 OV0CLRC1; - CARD32 DCLRKV; - CARD32 DCLRKM; - CARD32 SCLRKVH; - CARD32 SCLRKVL; - CARD32 SCLRKM; - CARD32 OV0CONF; - CARD32 OV0CMD; + uint32_t OBUF_0Y; + uint32_t OBUF_1Y; + uint32_t OBUF_0U; + uint32_t OBUF_0V; + uint32_t OBUF_1U; + uint32_t OBUF_1V; + uint32_t OV0STRIDE; + uint32_t YRGB_VPH; + uint32_t UV_VPH; + uint32_t HORZ_PH; + uint32_t INIT_PH; + uint32_t DWINPOS; + uint32_t DWINSZ; + uint32_t SWID; + uint32_t SWIDQW; + uint32_t SHEIGHT; + uint32_t YRGBSCALE; + uint32_t UVSCALE; + uint32_t OV0CLRC0; + uint32_t OV0CLRC1; + uint32_t DCLRKV; + uint32_t DCLRKM; + uint32_t SCLRKVH; + uint32_t SCLRKVL; + uint32_t SCLRKM; + uint32_t OV0CONF; + uint32_t OV0CMD; } I810OverlayRegRec, *I810OverlayRegPtr; typedef struct { - CARD32 YBuf0offset; - CARD32 UBuf0offset; - CARD32 VBuf0offset; + uint32_t YBuf0offset; + uint32_t UBuf0offset; + uint32_t VBuf0offset; - CARD32 YBuf1offset; - CARD32 UBuf1offset; - CARD32 VBuf1offset; + uint32_t YBuf1offset; + uint32_t UBuf1offset; + uint32_t VBuf1offset; unsigned char currentBuf; @@ -315,9 +315,9 @@ typedef struct { int contrast; RegionRec clip; - CARD32 colorKey; + uint32_t colorKey; - CARD32 videoStatus; + uint32_t videoStatus; Time offTime; Time freeTime; FBLinearPtr linear; @@ -1,4 +1,3 @@ - /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -97,6 +96,7 @@ Bool I830XAAInit(ScreenPtr pScreen); typedef struct _I830OutputRec I830OutputRec, *I830OutputPtr; #include "common.h" +#include "i830_ring.h" #include "i830_sdvo.h" #include "i2c_vid.h" @@ -127,11 +127,12 @@ typedef struct _I830OutputRec I830OutputRec, *I830OutputPtr; typedef struct _I830Rec *I830Ptr; typedef void (*I830WriteIndexedByteFunc)(I830Ptr pI830, IOADDRESS addr, - CARD8 index, CARD8 value); -typedef CARD8(*I830ReadIndexedByteFunc)(I830Ptr pI830, IOADDRESS addr, - CARD8 index); -typedef void (*I830WriteByteFunc)(I830Ptr pI830, IOADDRESS addr, CARD8 value); -typedef CARD8(*I830ReadByteFunc)(I830Ptr pI830, IOADDRESS addr); + uint8_t index, uint8_t value); +typedef uint8_t(*I830ReadIndexedByteFunc)(I830Ptr pI830, IOADDRESS addr, + uint8_t index); +typedef void (*I830WriteByteFunc)(I830Ptr pI830, IOADDRESS addr, + uint8_t value); +typedef uint8_t(*I830ReadByteFunc)(I830Ptr pI830, IOADDRESS addr); enum tile_format { TILE_NONE, @@ -265,7 +266,7 @@ typedef struct _I830CrtcPrivateRec { int dpms_mode; /* Lookup table values to be set when the CRTC is enabled */ - CARD8 lut_r[256], lut_g[256], lut_b[256]; + uint8_t lut_r[256], lut_g[256], lut_b[256]; i830_memory *rotate_mem; /* Card virtual address of the cursor */ @@ -400,6 +401,13 @@ typedef struct _I830Rec { /* Regions allocated either from the above pools, or from agpgart. */ I830RingBuffer *LpRing; + /** Number of bytes being emitted in the current BEGIN_LP_RING */ + unsigned int ring_emitting; + /** Number of bytes that have been emitted in the current BEGIN_LP_RING */ + unsigned int ring_used; + /** Offset in the ring for the next DWORD emit */ + uint32_t ring_next; + #ifdef I830_XV /* For Xvideo */ i830_memory *overlay_regs; @@ -462,7 +470,7 @@ typedef struct _I830Rec { pciVideoPtr PciInfo; PCITAG PciTag; #endif - CARD8 variant; + uint8_t variant; unsigned int BR[20]; @@ -517,8 +525,8 @@ typedef struct _I830Rec { /** Transform pointers for src/mask, or NULL if identity */ PictTransform *transform[2]; /* i915 EXA render state */ - CARD32 mapstate[6]; - CARD32 samplerstate[6]; + uint32_t mapstate[6]; + uint32_t samplerstate[6]; Bool directRenderingDisabled; /* DRI disabled in PreInit. */ Bool directRenderingEnabled; /* DRI enabled this generation. */ @@ -541,8 +549,8 @@ typedef struct _I830Rec { Bool StolenOnly; Bool swfSaved; - CARD32 saveSWF0; - CARD32 saveSWF4; + uint32_t saveSWF0; + uint32_t saveSWF4; Bool checkDevices; @@ -565,70 +573,70 @@ typedef struct _I830Rec { enum backlight_control backlight_control_method; - CARD32 saveDSPACNTR; - CARD32 saveDSPBCNTR; - CARD32 savePIPEACONF; - CARD32 savePIPEBCONF; - CARD32 savePIPEASRC; - CARD32 savePIPEBSRC; - CARD32 saveFPA0; - CARD32 saveFPA1; - CARD32 saveDPLL_A; - CARD32 saveDPLL_A_MD; - CARD32 saveHTOTAL_A; - CARD32 saveHBLANK_A; - CARD32 saveHSYNC_A; - CARD32 saveVTOTAL_A; - CARD32 saveVBLANK_A; - CARD32 saveVSYNC_A; - CARD32 saveBCLRPAT_A; - CARD32 saveDSPASTRIDE; - CARD32 saveDSPASIZE; - CARD32 saveDSPAPOS; - CARD32 saveDSPABASE; - CARD32 saveDSPASURF; - CARD32 saveDSPATILEOFF; - CARD32 saveFPB0; - CARD32 saveFPB1; - CARD32 saveDPLL_B; - CARD32 saveDPLL_B_MD; - CARD32 saveHTOTAL_B; - CARD32 saveHBLANK_B; - CARD32 saveHSYNC_B; - CARD32 saveVTOTAL_B; - CARD32 saveVBLANK_B; - CARD32 saveVSYNC_B; - CARD32 saveBCLRPAT_B; - CARD32 saveDSPBSTRIDE; - CARD32 saveDSPBSIZE; - CARD32 saveDSPBPOS; - CARD32 saveDSPBBASE; - CARD32 saveDSPBSURF; - CARD32 saveDSPBTILEOFF; - CARD32 saveVCLK_DIVISOR_VGA0; - CARD32 saveVCLK_DIVISOR_VGA1; - CARD32 saveVCLK_POST_DIV; - CARD32 saveVGACNTRL; - CARD32 saveADPA; - CARD32 saveLVDS; - CARD32 saveDVOA; - CARD32 saveDVOB; - CARD32 saveDVOC; - CARD32 savePP_ON; - CARD32 savePP_OFF; - CARD32 savePP_CONTROL; - CARD32 savePP_CYCLE; - CARD32 savePFIT_CONTROL; - CARD32 savePaletteA[256]; - CARD32 savePaletteB[256]; - CARD32 saveSWF[17]; - CARD32 saveBLC_PWM_CTL; - CARD32 saveBLC_PWM_CTL2; - CARD32 saveFBC_CFB_BASE; - CARD32 saveFBC_LL_BASE; - CARD32 saveFBC_CONTROL2; - CARD32 saveFBC_CONTROL; - CARD32 saveFBC_FENCE_OFF; + uint32_t saveDSPACNTR; + uint32_t saveDSPBCNTR; + uint32_t savePIPEACONF; + uint32_t savePIPEBCONF; + uint32_t savePIPEASRC; + uint32_t savePIPEBSRC; + uint32_t saveFPA0; + uint32_t saveFPA1; + uint32_t saveDPLL_A; + uint32_t saveDPLL_A_MD; + uint32_t saveHTOTAL_A; + uint32_t saveHBLANK_A; + uint32_t saveHSYNC_A; + uint32_t saveVTOTAL_A; + uint32_t saveVBLANK_A; + uint32_t saveVSYNC_A; + uint32_t saveBCLRPAT_A; + uint32_t saveDSPASTRIDE; + uint32_t saveDSPASIZE; + uint32_t saveDSPAPOS; + uint32_t saveDSPABASE; + uint32_t saveDSPASURF; + uint32_t saveDSPATILEOFF; + uint32_t saveFPB0; + uint32_t saveFPB1; + uint32_t saveDPLL_B; + uint32_t saveDPLL_B_MD; + uint32_t saveHTOTAL_B; + uint32_t saveHBLANK_B; + uint32_t saveHSYNC_B; + uint32_t saveVTOTAL_B; + uint32_t saveVBLANK_B; + uint32_t saveVSYNC_B; + uint32_t saveBCLRPAT_B; + uint32_t saveDSPBSTRIDE; + uint32_t saveDSPBSIZE; + uint32_t saveDSPBPOS; + uint32_t saveDSPBBASE; + uint32_t saveDSPBSURF; + uint32_t saveDSPBTILEOFF; + uint32_t saveVCLK_DIVISOR_VGA0; + uint32_t saveVCLK_DIVISOR_VGA1; + uint32_t saveVCLK_POST_DIV; + uint32_t saveVGACNTRL; + uint32_t saveADPA; + uint32_t saveLVDS; + uint32_t saveDVOA; + uint32_t saveDVOB; + uint32_t saveDVOC; + uint32_t savePP_ON; + uint32_t savePP_OFF; + uint32_t savePP_CONTROL; + uint32_t savePP_CYCLE; + uint32_t savePFIT_CONTROL; + uint32_t savePaletteA[256]; + uint32_t savePaletteB[256]; + uint32_t saveSWF[17]; + uint32_t saveBLC_PWM_CTL; + uint32_t saveBLC_PWM_CTL2; + uint32_t saveFBC_CFB_BASE; + uint32_t saveFBC_LL_BASE; + uint32_t saveFBC_CONTROL2; + uint32_t saveFBC_CONTROL; + uint32_t saveFBC_FENCE_OFF; enum last_3d *last_3d; diff --git a/src/i830_bios.c b/src/i830_bios.c index 7ed791e6..0a28fb4a 100644 --- a/src/i830_bios.c +++ b/src/i830_bios.c @@ -171,7 +171,7 @@ i830_bios_get_panel_mode(ScrnInfoPtr pScrn, Bool *wants_dither) struct lvds_bdb_2_fp_params *fpparam; struct lvds_bdb_2_fp_edid_dtd *fptiming; DisplayModePtr fixed_mode; - CARD8 *timing_ptr; + uint8_t *timing_ptr; id = INTEL_BIOS_8(start); block_size = INTEL_BIOS_16(start + 1) + 3; diff --git a/src/i830_bios.h b/src/i830_bios.h index 9e8356a1..95230f5a 100644 --- a/src/i830_bios.h +++ b/src/i830_bios.h @@ -28,24 +28,25 @@ #ifndef _I830_BIOS_H_ #define _I830_BIOS_H_ +#include <stdint.h> #include <xf86str.h> struct vbt_header { char signature[20]; /**< Always starts with 'VBT$' */ - CARD16 version; /**< decimal */ - CARD16 header_size; /**< in bytes */ - CARD16 vbt_size; /**< in bytes */ - CARD8 vbt_checksum; - CARD8 reserved0; - CARD32 bdb_offset; /**< from beginning of VBT */ - CARD32 aim_offset[4]; /**< from beginning of VBT */ + uint16_t version; /**< decimal */ + uint16_t header_size; /**< in bytes */ + uint16_t vbt_size; /**< in bytes */ + uint8_t vbt_checksum; + uint8_t reserved0; + uint32_t bdb_offset; /**< from beginning of VBT */ + uint32_t aim_offset[4]; /**< from beginning of VBT */ } __attribute__((packed)); struct bdb_header { char signature[16]; /**< Always 'BIOS_DATA_BLOCK' */ - CARD16 version; /**< decimal */ - CARD16 header_size; /**< in bytes */ - CARD16 bdb_size; /**< in bytes */ + uint16_t version; /**< decimal */ + uint16_t header_size; /**< in bytes */ + uint16_t bdb_size; /**< in bytes */ } __attribute__((packed)); #define LVDS_CAP_EDID (1 << 6) @@ -56,89 +57,89 @@ struct bdb_header { #define LVDS_CAP_PFIT_GRAPHICS (1 << 1) #define LVDS_CAP_PFIT_TEXT (1 << 0) struct lvds_bdb_1 { - CARD8 id; /**< 40 */ - CARD16 size; - CARD8 panel_type; - CARD8 reserved0; - CARD16 caps; + uint8_t id; /**< 40 */ + uint16_t size; + uint8_t panel_type; + uint8_t reserved0; + uint16_t caps; } __attribute__((packed)); struct lvds_bdb_2_fp_params { - CARD16 x_res; - CARD16 y_res; - CARD32 lvds_reg; - CARD32 lvds_reg_val; - CARD32 pp_on_reg; - CARD32 pp_on_reg_val; - CARD32 pp_off_reg; - CARD32 pp_off_reg_val; - CARD32 pp_cycle_reg; - CARD32 pp_cycle_reg_val; - CARD32 pfit_reg; - CARD32 pfit_reg_val; - CARD16 terminator; + uint16_t x_res; + uint16_t y_res; + uint32_t lvds_reg; + uint32_t lvds_reg_val; + uint32_t pp_on_reg; + uint32_t pp_on_reg_val; + uint32_t pp_off_reg; + uint32_t pp_off_reg_val; + uint32_t pp_cycle_reg; + uint32_t pp_cycle_reg_val; + uint32_t pfit_reg; + uint32_t pfit_reg_val; + uint16_t terminator; } __attribute__((packed)); struct lvds_bdb_2_fp_edid_dtd { - CARD16 dclk; /**< In 10khz */ - CARD8 hactive; - CARD8 hblank; - CARD8 high_h; /**< 7:4 = hactive 11:8, 3:0 = hblank 11:8 */ - CARD8 vactive; - CARD8 vblank; - CARD8 high_v; /**< 7:4 = vactive 11:8, 3:0 = vblank 11:8 */ - CARD8 hsync_off; - CARD8 hsync_pulse_width; - CARD8 vsync_off; - CARD8 high_hsync_off; /**< 7:6 = hsync off 9:8 */ - CARD8 h_image; - CARD8 v_image; - CARD8 max_hv; - CARD8 h_border; - CARD8 v_border; - CARD8 flags; + uint16_t dclk; /**< In 10khz */ + uint8_t hactive; + uint8_t hblank; + uint8_t high_h; /**< 7:4 = hactive 11:8, 3:0 = hblank 11:8 */ + uint8_t vactive; + uint8_t vblank; + uint8_t high_v; /**< 7:4 = vactive 11:8, 3:0 = vblank 11:8 */ + uint8_t hsync_off; + uint8_t hsync_pulse_width; + uint8_t vsync_off; + uint8_t high_hsync_off; /**< 7:6 = hsync off 9:8 */ + uint8_t h_image; + uint8_t v_image; + uint8_t max_hv; + uint8_t h_border; + uint8_t v_border; + uint8_t flags; #define FP_EDID_FLAG_VSYNC_POSITIVE (1 << 2) #define FP_EDID_FLAG_HSYNC_POSITIVE (1 << 1) } __attribute__((packed)); struct lvds_bdb_2_entry { - CARD16 fp_params_offset; /**< From beginning of BDB */ - CARD8 fp_params_size; - CARD16 fp_edid_dtd_offset; - CARD8 fp_edid_dtd_size; - CARD16 fp_edid_pid_offset; - CARD8 fp_edid_pid_size; + uint16_t fp_params_offset; /**< From beginning of BDB */ + uint8_t fp_params_size; + uint16_t fp_edid_dtd_offset; + uint8_t fp_edid_dtd_size; + uint16_t fp_edid_pid_offset; + uint8_t fp_edid_pid_size; } __attribute__((packed)); struct lvds_bdb_2 { - CARD8 id; /**< 41 */ - CARD16 size; - CARD8 table_size; /* not sure on this one */ + uint8_t id; /**< 41 */ + uint16_t size; + uint8_t table_size; /* not sure on this one */ struct lvds_bdb_2_entry panels[16]; } __attribute__((packed)); struct aimdb_header { char signature[16]; char oem_device[20]; - CARD16 aimdb_version; - CARD16 aimdb_header_size; - CARD16 aimdb_size; + uint16_t aimdb_version; + uint16_t aimdb_header_size; + uint16_t aimdb_size; } __attribute__((packed)); struct aimdb_block { - CARD8 aimdb_id; - CARD16 aimdb_size; + uint8_t aimdb_id; + uint16_t aimdb_size; } __attribute__((packed)); struct vch_panel_data { - CARD16 fp_timing_offset; - CARD8 fp_timing_size; - CARD16 dvo_timing_offset; - CARD8 dvo_timing_size; - CARD16 text_fitting_offset; - CARD8 text_fitting_size; - CARD16 graphics_fitting_offset; - CARD8 graphics_fitting_size; + uint16_t fp_timing_offset; + uint8_t fp_timing_size; + uint16_t dvo_timing_offset; + uint8_t dvo_timing_size; + uint16_t text_fitting_offset; + uint8_t text_fitting_size; + uint16_t graphics_fitting_offset; + uint8_t graphics_fitting_size; } __attribute__((packed)); struct vch_bdb_22 { diff --git a/src/i830_crt.c b/src/i830_crt.c index 82a774aa..3705233b 100644 --- a/src/i830_crt.c +++ b/src/i830_crt.c @@ -39,7 +39,7 @@ i830_crt_dpms(xf86OutputPtr output, int mode) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); - CARD32 temp; + uint32_t temp; temp = INREG(ADPA); temp &= ~(ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE); @@ -109,7 +109,7 @@ i830_crt_mode_set(xf86OutputPtr output, DisplayModePtr mode, xf86CrtcPtr crtc = output->crtc; I830CrtcPrivatePtr i830_crtc = crtc->driver_private; int dpll_md_reg; - CARD32 adpa, dpll_md; + uint32_t adpa, dpll_md; if (i830_crtc->pipe == 0) dpll_md_reg = DPLL_A_MD; @@ -158,7 +158,7 @@ i830_crt_detect_hotplug(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); - CARD32 temp; + uint32_t temp; const int timeout_ms = 1000; int starttime, curtime; @@ -199,13 +199,13 @@ i830_crt_detect_load (xf86CrtcPtr crtc, ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); I830CrtcPrivatePtr i830_crtc = I830CrtcPrivate(crtc); - CARD32 save_bclrpat; - CARD32 save_vtotal; - CARD32 vtotal, vactive; - CARD32 vsample; - CARD32 vblank, vblank_start, vblank_end; - CARD32 dsl; - CARD8 st00; + uint32_t save_bclrpat; + uint32_t save_vtotal; + uint32_t vtotal, vactive; + uint32_t vsample; + uint32_t vblank, vblank_start, vblank_end; + uint32_t dsl; + uint8_t st00; int bclrpat_reg, pipeconf_reg, pipe_dsl_reg; int vtotal_reg, vblank_reg, vsync_reg; int pipe = i830_crtc->pipe; @@ -245,7 +245,7 @@ i830_crt_detect_load (xf86CrtcPtr crtc, if (IS_I9XX (pI830)) { - CARD32 pipeconf = INREG(pipeconf_reg); + uint32_t pipeconf = INREG(pipeconf_reg); OUTREG(pipeconf_reg, pipeconf | PIPECONF_FORCE_BORDER); st00 = pI830->readStandard (pI830, 0x3c2); @@ -263,8 +263,8 @@ i830_crt_detect_load (xf86CrtcPtr crtc, */ if (vblank_start <= vactive && vblank_end >= vtotal) { - CARD32 vsync = INREG(vsync_reg); - CARD32 vsync_start = (vsync & 0xffff) + 1; + uint32_t vsync = INREG(vsync_reg); + uint32_t vsync_start = (vsync & 0xffff) + 1; vblank_start = vsync_start; OUTREG(vblank_reg, (vblank_start - 1) | ((vblank_end - 1) << 16)); diff --git a/src/i830_cursor.c b/src/i830_cursor.c index 52eb2661..43a65cb9 100644 --- a/src/i830_cursor.c +++ b/src/i830_cursor.c @@ -90,7 +90,7 @@ I830InitHWCursor(ScrnInfoPtr pScrn) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); I830Ptr pI830 = I830PTR(pScrn); - CARD32 temp; + uint32_t temp; int i; DPRINTF(PFX, "I830InitHWCursor\n"); @@ -141,7 +141,7 @@ i830_crtc_load_cursor_image (xf86CrtcPtr crtc, unsigned char *src) { I830Ptr pI830 = I830PTR(crtc->scrn); I830CrtcPrivatePtr intel_crtc = crtc->driver_private; - CARD8 *pcurs; + uint8_t *pcurs; pcurs = pI830->FbBase + intel_crtc->cursor_offset; @@ -155,9 +155,9 @@ i830_crtc_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image) { I830Ptr pI830 = I830PTR(crtc->scrn); I830CrtcPrivatePtr intel_crtc = crtc->driver_private; - CARD32 *pcurs; + uint32_t *pcurs; - pcurs = (CARD32 *) (pI830->FbBase + intel_crtc->cursor_argb_offset); + pcurs = (uint32_t *) (pI830->FbBase + intel_crtc->cursor_argb_offset); intel_crtc->cursor_is_argb = TRUE; memcpy (pcurs, image, I810_CURSOR_Y * I810_CURSOR_X * 4); @@ -170,7 +170,7 @@ i830_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y) ScrnInfoPtr scrn = crtc->scrn; I830Ptr pI830 = I830PTR(scrn); I830CrtcPrivatePtr intel_crtc = I830CrtcPrivate(crtc); - CARD32 temp; + uint32_t temp; temp = 0; if (x < 0) { @@ -204,7 +204,7 @@ i830_crtc_show_cursor (xf86CrtcPtr crtc) I830Ptr pI830 = I830PTR(scrn); I830CrtcPrivatePtr intel_crtc = I830CrtcPrivate(crtc); int pipe = intel_crtc->pipe; - CARD32 temp; + uint32_t temp; int cursor_control = (pipe == 0 ? CURSOR_A_CONTROL : CURSOR_B_CONTROL); @@ -242,7 +242,7 @@ i830_crtc_hide_cursor (xf86CrtcPtr crtc) I830Ptr pI830 = I830PTR(scrn); I830CrtcPrivatePtr intel_crtc = I830CrtcPrivate(crtc); int pipe = intel_crtc->pipe; - CARD32 temp; + uint32_t temp; int cursor_control = (pipe == 0 ? CURSOR_A_CONTROL : CURSOR_B_CONTROL); diff --git a/src/i830_debug.c b/src/i830_debug.c index f589de73..15b02ceb 100644 --- a/src/i830_debug.c +++ b/src/i830_debug.c @@ -45,7 +45,8 @@ #include "i810_reg.h" -#define DEBUGSTRING(func) static char *func(I830Ptr pI830, int reg, CARD32 val) +#define DEBUGSTRING(func) static char *func(I830Ptr pI830, int reg, \ + uint32_t val) DEBUGSTRING(i830_debug_xyminus1) { @@ -486,8 +487,8 @@ DEBUGSTRING(i810_debug_fence_new) static struct i830SnapshotRec { int reg; char *name; - char *(*debug_output)(I830Ptr pI830, int reg, CARD32 val); - CARD32 val; + char *(*debug_output)(I830Ptr pI830, int reg, uint32_t val); + uint32_t val; } i830_snapshot[] = { DEFINEREG2(VCLK_DIVISOR_VGA0, i830_debug_fp), DEFINEREG2(VCLK_DIVISOR_VGA1, i830_debug_fp), @@ -668,7 +669,7 @@ void i830CompareRegsToSnapshot(ScrnInfoPtr pScrn, char *where) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Comparing regs from server start up to %s\n", where); for (i = 0; i < NUM_I830_SNAPSHOTREGS; i++) { - CARD32 val = INREG(i830_snapshot[i].reg); + uint32_t val = INREG(i830_snapshot[i].reg); if (i830_snapshot[i].val == val) continue; @@ -752,7 +753,7 @@ void i830DumpRegs (ScrnInfoPtr pScrn) xf86DrvMsg (pScrn->scrnIndex, X_INFO, "DumpRegsBegin\n"); for (i = 0; i < NUM_I830_SNAPSHOTREGS; i++) { - CARD32 val = INREG(i830_snapshot[i].reg); + uint32_t val = INREG(i830_snapshot[i].reg); if (i830_snapshot[i].debug_output != NULL) { char *debug = i830_snapshot[i].debug_output(pI830, @@ -783,7 +784,7 @@ void i830DumpRegs (ScrnInfoPtr pScrn) dpll = INREG(pipe == 0 ? DPLL_A : DPLL_B); if (IS_I9XX(pI830)) { - CARD32 lvds = INREG(LVDS); + uint32_t lvds = INREG(LVDS); if ((lvds & LVDS_PORT_EN) && (lvds & LVDS_PIPEB_SELECT) == (pipe << 30)) { @@ -845,7 +846,7 @@ void i830DumpRegs (ScrnInfoPtr pScrn) } else { - CARD32 lvds = INREG(LVDS); + uint32_t lvds = INREG(LVDS); if (IS_I85X (pI830) && (lvds & LVDS_PORT_EN) && (lvds & LVDS_PIPEB_SELECT) == (pipe << 30)) @@ -957,27 +958,27 @@ i830_dump_error_state(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); - ErrorF("pgetbl_ctl: 0x%" PRIx32 "getbl_err: 0x%" PRIx32 "\n", + ErrorF("pgetbl_ctl: 0x%08x getbl_err: 0x%08x\n", INREG(PGETBL_CTL), INREG(PGE_ERR)); - ErrorF("ipeir: %" PRIx32 " iphdr: %" PRIx32 "\n", INREG(IPEIR), - INREG(IPEHR)); + ErrorF("ipeir: 0x%08x iphdr: 0x%08x\n", INREG(IPEIR), INREG(IPEHR)); - ErrorF("LP ring tail: %" PRIx32 " head: %" PRIx32 " len: %" PRIx32 " start %" PRIx32 "\n", + ErrorF("LP ring tail: 0x%08x head: 0x%08x len: 0x%08x start 0x%08x\n", INREG(LP_RING + RING_TAIL), INREG(LP_RING + RING_HEAD) & HEAD_ADDR, INREG(LP_RING + RING_LEN), INREG(LP_RING + RING_START)); - ErrorF("eir: %x esr: %x emr: %x\n", + ErrorF("eir: 0x%04x esr: 0x%04x emr: 0x%04x\n", INREG16(EIR), INREG16(ESR), INREG16(EMR)); - ErrorF("instdone: %x instpm: %x\n", INREG16(INST_DONE), INREG8(INST_PM)); + ErrorF("instdone: 0x%04x instpm: 0x%04x\n", + INREG16(INST_DONE), INREG8(INST_PM)); - ErrorF("memmode: %" PRIx32 " instps: %" PRIx32 "\n", INREG(MEMMODE), - INREG(INST_PS)); + ErrorF("memmode: 0x%08x instps: 0x%08x\n", + INREG(MEMMODE), INREG(INST_PS)); - ErrorF("hwstam: %x ier: %x imr: %x iir: %x\n", + ErrorF("hwstam: 0x%04x ier: 0x%04x imr: 0x%04x iir: 0x%04x\n", INREG16(HWSTAM), INREG16(IER), INREG16(IMR), INREG16(IIR)); i830_dump_ring (pScrn); } @@ -987,73 +988,80 @@ i965_dump_error_state(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); - ErrorF("pgetbl_ctl: 0x%" PRIx32 " pgetbl_err: 0x%" PRIx32 "\n", + ErrorF("pgetbl_ctl: 0x%08x pgetbl_err: 0x%08x\n", INREG(PGETBL_CTL), INREG(PGE_ERR)); - ErrorF("ipeir: %" PRIx32 " iphdr: %" PRIx32 "\n", INREG(IPEIR_I965), INREG(IPEHR_I965)); + ErrorF("ipeir: 0x%08x iphdr: 0x%08x\n", + INREG(IPEIR_I965), INREG(IPEHR_I965)); - ErrorF("LP ring tail: %" PRIx32 " head: %" PRIx32 " len: %" PRIx32 " start %" PRIx32 "\n", + ErrorF("LP ring tail: 0x%08x head: %x len: 0x%08x start 0x%08x\n", INREG(LP_RING + RING_TAIL), INREG(LP_RING + RING_HEAD) & HEAD_ADDR, - INREG(LP_RING + RING_LEN), INREG(LP_RING + RING_START)); - - ErrorF("Err ID (eir): %x Err Status (esr): %x Err Mask (emr): %x\n", - (int)INREG(EIR), (int)INREG(ESR), (int)INREG(EMR)); - - ErrorF("instdone: %x instdone_1: %x\n", (int)INREG(INST_DONE_I965), - (int)INREG(INST_DONE_1)); - ErrorF("instpm: %x\n", (int)INREG(INST_PM)); - - ErrorF("memmode: %" PRIx32 " instps: %" PRIx32 "\n", INREG(MEMMODE), INREG(INST_PS_I965)); - - ErrorF("HW Status mask (hwstam): %x\nIRQ enable (ier): %x " - "imr: %x iir: %x\n", - (int)INREG(HWSTAM), (int)INREG(IER), (int)INREG(IMR), - (int)INREG(IIR)); - - ErrorF("acthd: %" PRIx32 " dma_fadd_p: %" PRIx32 "\n", INREG(ACTHD), INREG(DMA_FADD_P)); - ErrorF("ecoskpd: %" PRIx32 " excc: %" PRIx32 "\n", INREG(ECOSKPD), INREG(EXCC)); - - ErrorF("cache_mode: %x/%x\n", (int)INREG(CACHE_MODE_0), - (int)INREG(CACHE_MODE_1)); - ErrorF("mi_arb_state: %x\n", (int)INREG(MI_ARB_STATE)); - - ErrorF("IA_VERTICES_COUNT_QW %x/%x\n", - (int)INREG(IA_VERTICES_COUNT_QW), - (int)INREG(IA_VERTICES_COUNT_QW+4)); - ErrorF("IA_PRIMITIVES_COUNT_QW %x/%x\n", - (int)INREG(IA_PRIMITIVES_COUNT_QW), - (int)INREG(IA_PRIMITIVES_COUNT_QW+4)); - - ErrorF("VS_INVOCATION_COUNT_QW %x/%x\n", - (int)INREG(VS_INVOCATION_COUNT_QW), - (int)INREG(VS_INVOCATION_COUNT_QW+4)); - - ErrorF("GS_INVOCATION_COUNT_QW %x/%x\n", - (int)INREG(GS_INVOCATION_COUNT_QW), - (int)INREG(GS_INVOCATION_COUNT_QW+4)); - ErrorF("GS_PRIMITIVES_COUNT_QW %x/%x\n", - (int)INREG(GS_PRIMITIVES_COUNT_QW), - (int)INREG(GS_PRIMITIVES_COUNT_QW+4)); - - ErrorF("CL_INVOCATION_COUNT_QW %x/%x\n", - (int)INREG(CL_INVOCATION_COUNT_QW), - (int)INREG(CL_INVOCATION_COUNT_QW+4)); - ErrorF("CL_PRIMITIVES_COUNT_QW %x/%x\n", - (int)INREG(CL_PRIMITIVES_COUNT_QW), - (int)INREG(CL_PRIMITIVES_COUNT_QW+4)); - - ErrorF("PS_INVOCATION_COUNT_QW %x/%x\n", - (int)INREG(PS_INVOCATION_COUNT_QW), - (int)INREG(PS_INVOCATION_COUNT_QW+4)); - ErrorF("PS_DEPTH_COUNT_QW %x/%x\n", - (int)INREG(PS_DEPTH_COUNT_QW), - (int)INREG(PS_DEPTH_COUNT_QW+4)); - - ErrorF("WIZ_CTL %x\n", (int)INREG(WIZ_CTL)); - ErrorF("TS_CTL %x TS_DEBUG_DATA %x\n", (int)INREG(TS_CTL), - (int)INREG(TS_DEBUG_DATA)); - ErrorF("TD_CTL %x / %x\n", (int)INREG(TD_CTL), (int)INREG(TD_CTL2)); + INREG(LP_RING + RING_LEN), + INREG(LP_RING + RING_START)); + + ErrorF("Err ID (eir): 0x%08x\n" + "Err Status (esr): 0x%08x\n" + "Err Mask (emr): 0x%08x\n", + INREG(EIR), INREG(ESR), INREG(EMR)); + + ErrorF("instdone: 0x%08x instdone_1: 0x%08x\n", + INREG(INST_DONE_I965), INREG(INST_DONE_1)); + ErrorF("instpm: 0x%08x\n", INREG(INST_PM)); + + ErrorF("memmode: 0x%08x instps: 0x%08x\n", + INREG(MEMMODE), INREG(INST_PS_I965)); + + ErrorF("HW Status mask (hwstam): 0x%08x\nIRQ enable (ier): 0x%08x " + "imr: 0x%08x iir: 0x%08x\n", + INREG(HWSTAM), INREG(IER), INREG(IMR), INREG(IIR)); + + ErrorF("acthd: 0x%08x dma_fadd_p: 0x%08x\n", + INREG(ACTHD), INREG(DMA_FADD_P)); + ErrorF("ecoskpd: 0x%08x excc: 0x%08x\n", + INREG(ECOSKPD), INREG(EXCC)); + + ErrorF("cache_mode: 0x%08x/0x%08x\n", INREG(CACHE_MODE_0), + INREG(CACHE_MODE_1)); + ErrorF("mi_arb_state: 0x%08x\n", INREG(MI_ARB_STATE)); + + ErrorF("IA_VERTICES_COUNT_QW 0x%08x/0x%08x\n", + INREG(IA_VERTICES_COUNT_QW), + INREG(IA_VERTICES_COUNT_QW+4)); + ErrorF("IA_PRIMITIVES_COUNT_QW 0x%08x/0x%08x\n", + INREG(IA_PRIMITIVES_COUNT_QW), + INREG(IA_PRIMITIVES_COUNT_QW+4)); + + ErrorF("VS_INVOCATION_COUNT_QW 0x%08x/0x%08x\n", + INREG(VS_INVOCATION_COUNT_QW), + INREG(VS_INVOCATION_COUNT_QW+4)); + + ErrorF("GS_INVOCATION_COUNT_QW 0x%08x/0x%08x\n", + INREG(GS_INVOCATION_COUNT_QW), + INREG(GS_INVOCATION_COUNT_QW+4)); + ErrorF("GS_PRIMITIVES_COUNT_QW 0x%08x/0x%08x\n", + INREG(GS_PRIMITIVES_COUNT_QW), + INREG(GS_PRIMITIVES_COUNT_QW+4)); + + ErrorF("CL_INVOCATION_COUNT_QW 0x%08x/0x%08x\n", + INREG(CL_INVOCATION_COUNT_QW), + INREG(CL_INVOCATION_COUNT_QW+4)); + ErrorF("CL_PRIMITIVES_COUNT_QW 0x%08x/0x%08x\n", + INREG(CL_PRIMITIVES_COUNT_QW), + INREG(CL_PRIMITIVES_COUNT_QW+4)); + + ErrorF("PS_INVOCATION_COUNT_QW 0x%08x/0x%08x\n", + INREG(PS_INVOCATION_COUNT_QW), + INREG(PS_INVOCATION_COUNT_QW+4)); + ErrorF("PS_DEPTH_COUNT_QW 0x%08x/0x%08x\n", + INREG(PS_DEPTH_COUNT_QW), + INREG(PS_DEPTH_COUNT_QW+4)); + + ErrorF("WIZ_CTL 0x%08x\n", INREG(WIZ_CTL)); + ErrorF("TS_CTL 0x%08x TS_DEBUG_DATA 0x%08x\n", INREG(TS_CTL), + INREG(TS_DEBUG_DATA)); + ErrorF("TD_CTL 0x%08x / 0x%08x\n", + INREG(TD_CTL), INREG(TD_CTL2)); } /** diff --git a/src/i830_display.c b/src/i830_display.c index ea6d067d..b5898966 100644 --- a/src/i830_display.c +++ b/src/i830_display.c @@ -767,7 +767,7 @@ i830_crtc_dpms(xf86CrtcPtr crtc, int mode) int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF; int dspcntr_reg = (plane == 0) ? DSPACNTR : DSPBCNTR; int dspbase_reg = (plane == 0) ? DSPABASE : DSPBBASE; - CARD32 temp; + uint32_t temp; /* XXX: When our outputs are all unaware of DPMS modes other than off and * on, we should map those modes to DPMSModeOff in the CRTC. @@ -1012,7 +1012,7 @@ i830_get_core_clock_speed(ScrnInfoPtr pScrn) pci_device_cfg_read_u16 (bridge, &hpllcc, I855_HPLLCC); #else PCITAG bridge = pciTag(0, 0, 0); /* This is always the host bridge */ - CARD16 hpllcc = pciReadWord(bridge, I855_HPLLCC); + uint16_t hpllcc = pciReadWord(bridge, I855_HPLLCC); #endif /* Assume that the hardware is in the high speed state. This @@ -1040,7 +1040,7 @@ i830_get_core_clock_speed(ScrnInfoPtr pScrn) static int i830_panel_fitter_pipe(I830Ptr pI830) { - CARD32 pfit_control; + uint32_t pfit_control; /* i830 doesn't have a panel fitter */ if (IS_I830(pI830)) @@ -1097,7 +1097,7 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, int i; int refclk; intel_clock_t clock; - CARD32 dpll = 0, fp = 0, dspcntr, pipeconf; + uint32_t dpll = 0, fp = 0, dspcntr, pipeconf; Bool ok, is_sdvo = FALSE, is_dvo = FALSE; Bool is_crt = FALSE, is_lvds = FALSE, is_tv = FALSE; @@ -1295,7 +1295,7 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, */ if (is_lvds) { - CARD32 lvds = INREG(LVDS); + uint32_t lvds = INREG(LVDS); lvds |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP | LVDS_PIPEB_SELECT; /* Set the B0-B3 data pairs corresponding to whether we're going to @@ -1508,9 +1508,9 @@ i830DescribeOutputConfiguration(ScrnInfoPtr pScrn) for (i = 0; i < xf86_config->num_crtc; i++) { xf86CrtcPtr crtc = xf86_config->crtc[i]; I830CrtcPrivatePtr intel_crtc = crtc ? crtc->driver_private : NULL; - CARD32 dspcntr = intel_crtc->plane == 0 ? INREG(DSPACNTR) : + uint32_t dspcntr = intel_crtc->plane == 0 ? INREG(DSPACNTR) : INREG(DSPBCNTR); - CARD32 pipeconf = i == 0 ? INREG(PIPEACONF) : + uint32_t pipeconf = i == 0 ? INREG(PIPEACONF) : INREG(PIPEBCONF); Bool hw_plane_enable = (dspcntr & DISPLAY_PLANE_ENABLE) != 0; Bool hw_pipe_enable = (pipeconf & PIPEACONF_ENABLE) != 0; @@ -1686,8 +1686,8 @@ i830_crtc_clock_get(ScrnInfoPtr pScrn, xf86CrtcPtr crtc) I830Ptr pI830 = I830PTR(pScrn); I830CrtcPrivatePtr intel_crtc = crtc->driver_private; int pipe = intel_crtc->pipe; - CARD32 dpll = INREG((pipe == 0) ? DPLL_A : DPLL_B); - CARD32 fp; + uint32_t dpll = INREG((pipe == 0) ? DPLL_A : DPLL_B); + uint32_t fp; intel_clock_t clock; if ((dpll & DISPLAY_RATE_SELECT_FPA1) == 0) diff --git a/src/i830_dri.c b/src/i830_dri.c index 141b970f..768c724f 100644 --- a/src/i830_dri.c +++ b/src/i830_dri.c @@ -993,7 +993,7 @@ I830DRIFinishScreenInit(ScreenPtr pScreen) * Otherwise will have to sync again??? */ static void -I830DRIDoRefreshArea (ScrnInfoPtr pScrn, int num, BoxPtr pbox, CARD32 dst) +I830DRIDoRefreshArea (ScrnInfoPtr pScrn, int num, BoxPtr pbox, uint32_t dst) { I830Ptr pI830 = I830PTR(pScrn); int i, cmd, br13 = (pScrn->displayWidth * pI830->cpp) | (0xcc << 16); diff --git a/src/i830_driver.c b/src/i830_driver.c index 41362d94..3938e748 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -617,8 +617,8 @@ I830MapMMIO(ScrnInfoPtr pScrn) * time. */ if (IS_I9XX(pI830)) { - CARD32 gttaddr; - + uint32_t gttaddr; + if (IS_I965G(pI830)) { if (IS_IGD_GM(pI830)) { @@ -755,7 +755,7 @@ I830LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); int i,j, index; int p; - CARD16 lut_r[256], lut_g[256], lut_b[256]; + uint16_t lut_r[256], lut_g[256], lut_b[256]; DPRINTF(PFX, "I830LoadPalette: numColors: %d\n", numColors); @@ -1037,7 +1037,7 @@ static void i830SetHotkeyControl(ScrnInfoPtr pScrn, int mode) { I830Ptr pI830 = I830PTR(pScrn); - CARD8 gr18; + uint8_t gr18; gr18 = pI830->readControl(pI830, GRX, 0x18); if (mode == HOTKEY_BIOS_SWITCH) @@ -1225,7 +1225,7 @@ i830_detect_chipset(ScrnInfoPtr pScrn) pci_device_cfg_read_u16 (bridge, &gmch_ctrl, I830_GMCH_CTRL); #else PCITAG bridge; - CARD16 gmch_ctrl; + uint16_t gmch_ctrl; bridge = pciTag(0, 0, 0); /* This is always the host bridge */ gmch_ctrl = pciReadWord(bridge, I830_GMCH_CTRL); @@ -2334,7 +2334,7 @@ void IntelEmitInvarientState(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); - CARD32 ctx_addr; + uint32_t ctx_addr; if (pI830->noAccel) return; @@ -3111,6 +3111,8 @@ I830LeaveVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; I830Ptr pI830 = I830PTR(pScrn); + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + int o; DPRINTF(PFX, "Leave VT\n"); @@ -3138,6 +3140,17 @@ I830LeaveVT(int scrnIndex, int flags) } #endif + for (o = 0; o < config->num_crtc; o++) { + xf86CrtcPtr crtc = config->crtc[o]; + + if (crtc->rotatedPixmap || crtc->rotatedData) { + crtc->funcs->shadow_destroy(crtc, crtc->rotatedPixmap, + crtc->rotatedData); + crtc->rotatedPixmap = NULL; + crtc->rotatedData = NULL; + } + } + xf86_hide_cursors (pScrn); RestoreHWState(pScrn); @@ -3534,7 +3547,7 @@ I830CheckDevicesTimer(OsTimerPtr timer, CARD32 now, pointer arg) { ScrnInfoPtr pScrn = (ScrnInfoPtr) arg; I830Ptr pI830 = I830PTR(pScrn); - CARD8 gr18; + uint8_t gr18; if (!pScrn->vtSema) return 1000; diff --git a/src/i830_dvo.c b/src/i830_dvo.c index 81d56012..c0f76e30 100644 --- a/src/i830_dvo.c +++ b/src/i830_dvo.c @@ -226,7 +226,7 @@ i830_dvo_mode_set(xf86OutputPtr output, DisplayModePtr mode, I830OutputPrivatePtr intel_output = output->driver_private; struct _I830DVODriver *drv = intel_output->i2c_drv; int pipe = intel_crtc->pipe; - CARD32 dvo; + uint32_t dvo; unsigned int dvo_reg = drv->dvo_reg, dvo_srcdim_reg; int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B; @@ -358,7 +358,7 @@ i830_dvo_get_current_mode (xf86OutputPtr output) I830Ptr pI830 = I830PTR(pScrn); struct _I830DVODriver *drv = intel_output->i2c_drv; unsigned int dvo_reg = drv->dvo_reg; - CARD32 dvo = INREG(dvo_reg); + uint32_t dvo = INREG(dvo_reg); DisplayModePtr mode = NULL; /* If the DVO port is active, that'll be the LVDS, so we can pull out diff --git a/src/i830_exa.c b/src/i830_exa.c index 32c55dd0..1f6bf1d9 100644 --- a/src/i830_exa.c +++ b/src/i830_exa.c @@ -376,8 +376,8 @@ i830_upload_to_screen(PixmapPtr pDst, int x, int y, int w, int h, char *src, const int uts_width_max = 16, uts_height_max = 16; int cpp = pDst->drawable.bitsPerPixel / 8; int sub_x, sub_y; - CARD32 br13; - CARD32 offset; + uint32_t br13; + uint32_t offset; if (w > uts_width_max || h > uts_height_max) I830FALLBACK("too large for upload to screen (%d,%d)", w, h); diff --git a/src/i830_i2c.c b/src/i830_i2c.c index 33a75a81..8392d0a5 100644 --- a/src/i830_i2c.c +++ b/src/i830_i2c.c @@ -59,7 +59,7 @@ static void i830_setscl(I2CBusPtr b, int state) { ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; I830Ptr pI830 = I830PTR(pScrn); - CARD32 val; + uint32_t val; OUTREG(b->DriverPrivate.uval, (state ? GPIO_CLOCK_VAL_OUT : 0) | GPIO_CLOCK_DIR_OUT | @@ -71,7 +71,7 @@ static void i830_setsda(I2CBusPtr b, int state) { ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; I830Ptr pI830 = I830PTR(pScrn); - CARD32 val; + uint32_t val; OUTREG(b->DriverPrivate.uval, (state ? GPIO_DATA_VAL_OUT : 0) | GPIO_DATA_DIR_OUT | @@ -83,7 +83,7 @@ static void i830_getscl(I2CBusPtr b, int *state) { ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; I830Ptr pI830 = I830PTR(pScrn); - CARD32 val; + uint32_t val; OUTREG(b->DriverPrivate.uval, GPIO_CLOCK_DIR_IN | GPIO_CLOCK_DIR_MASK); OUTREG(b->DriverPrivate.uval, 0); @@ -95,7 +95,7 @@ static int i830_getsda(I2CBusPtr b) { ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; I830Ptr pI830 = I830PTR(pScrn); - CARD32 val; + uint32_t val; OUTREG(b->DriverPrivate.uval, GPIO_DATA_DIR_IN | GPIO_DATA_DIR_MASK); OUTREG(b->DriverPrivate.uval, 0); @@ -272,7 +272,7 @@ i830I2CGetBits(I2CBusPtr b, int *clock, int *data) { ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; I830Ptr pI830 = I830PTR(pScrn); - CARD32 val; + uint32_t val; val = INREG(b->DriverPrivate.uval); @@ -295,8 +295,8 @@ i830I2CGetBits(I2CBusPtr b, int *clock, int *data) static void i830I2CPutBits(I2CBusPtr b, int clock, int data) { - CARD32 reserved = 0; - CARD32 data_bits, clock_bits; + uint32_t reserved = 0; + uint32_t data_bits, clock_bits; #if I2C_DEBUG int cur_clock, cur_data; diff --git a/src/i830_lvds.c b/src/i830_lvds.c index 8359e39f..a75d7e65 100644 --- a/src/i830_lvds.c +++ b/src/i830_lvds.c @@ -68,6 +68,7 @@ static char *backlight_interfaces[] = { "thinkpad_screen", "acpi_video1", "acpi_video0", + "fujitsu-laptop", NULL, }; @@ -108,7 +109,7 @@ i830_set_lvds_backlight_method(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); - CARD32 blc_pwm_ctl, blc_pwm_ctl2; + uint32_t blc_pwm_ctl, blc_pwm_ctl2; enum backlight_control method = BCM_NATIVE; /* Default to native */ if (i830_kernel_backlight_available(output)) { @@ -134,7 +135,7 @@ i830_lvds_set_backlight_native(xf86OutputPtr output, int level) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); - CARD32 blc_pwm_ctl; + uint32_t blc_pwm_ctl; blc_pwm_ctl = INREG(BLC_PWM_CTL); blc_pwm_ctl &= ~BACKLIGHT_DUTY_CYCLE_MASK; @@ -146,7 +147,7 @@ i830_lvds_get_backlight_native(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); - CARD32 blc_pwm_ctl; + uint32_t blc_pwm_ctl; blc_pwm_ctl = INREG(BLC_PWM_CTL); blc_pwm_ctl &= BACKLIGHT_DUTY_CYCLE_MASK; @@ -158,7 +159,7 @@ i830_lvds_get_backlight_max_native(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); - CARD32 pwm_ctl = INREG(BLC_PWM_CTL); + uint32_t pwm_ctl = INREG(BLC_PWM_CTL); int val; if (IS_I965GM(pI830) || IS_IGD_GM(pI830)) { @@ -194,7 +195,7 @@ i830_lvds_get_backlight_legacy(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); - CARD8 lbb; + uint8_t lbb; #if XSERVER_LIBPCIACCESS pci_device_cfg_read_u8(pI830->PciInfo, &lbb, LEGACY_BACKLIGHT_BRIGHTNESS); @@ -213,8 +214,8 @@ i830_lvds_set_backlight_combo(xf86OutputPtr output, int level) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); - CARD32 blc_pwm_ctl; - CARD8 lbb; + uint32_t blc_pwm_ctl; + uint8_t lbb; #if XSERVER_LIBPCIACCESS pci_device_cfg_read_u8(pI830->PciInfo, &lbb, LEGACY_BACKLIGHT_BRIGHTNESS); @@ -250,7 +251,7 @@ i830_lvds_get_backlight_combo(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); - CARD32 blc_pwm_ctl; + uint32_t blc_pwm_ctl; blc_pwm_ctl = INREG(BLC_PWM_CTL); blc_pwm_ctl &= BACKLIGHT_DUTY_CYCLE_MASK; @@ -369,7 +370,7 @@ i830SetLVDSPanelPower(xf86OutputPtr output, Bool on) struct i830_lvds_priv *dev_priv = intel_output->dev_priv; ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); - CARD32 pp_status; + uint32_t pp_status; if (on) { /* @@ -534,7 +535,7 @@ i830_lvds_mode_set(xf86OutputPtr output, DisplayModePtr mode, ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); I830CrtcPrivatePtr intel_crtc = output->crtc->driver_private; - CARD32 pfit_control; + uint32_t pfit_control; /* The LVDS pin pair will already have been turned on in * i830_crtc_mode_set since it has a large impact on the DPLL settings. @@ -855,8 +856,6 @@ i830_lvds_set_property(xf86OutputPtr output, Atom property, static Bool i830_lvds_get_property(xf86OutputPtr output, Atom property) { - ScrnInfoPtr pScrn = output->scrn; - I830Ptr pI830 = I830PTR(pScrn); I830OutputPrivatePtr intel_output = output->driver_private; struct i830_lvds_priv *dev_priv = intel_output->dev_priv; int ret; @@ -966,7 +965,7 @@ i830_lvds_init(ScrnInfoPtr pScrn) * If so, assume that whatever is currently programmed is the correct mode. */ if (dev_priv->panel_fixed_mode == NULL) { - CARD32 lvds = INREG(LVDS); + uint32_t lvds = INREG(LVDS); int pipe = (lvds & LVDS_PIPEB_SELECT) ? 1 : 0; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcPtr crtc = xf86_config->crtc[pipe]; diff --git a/src/i830_memory.c b/src/i830_memory.c index ce6d7afe..9e23c3ca 100644 --- a/src/i830_memory.c +++ b/src/i830_memory.c @@ -543,7 +543,7 @@ static uint64_t i830_get_gtt_physical(ScrnInfoPtr pScrn, unsigned long offset) { I830Ptr pI830 = I830PTR(pScrn); - CARD32 gttentry; + uint32_t gttentry; /* We don't have GTTBase set up on i830 yet. */ if (pI830->GTTBase == NULL) @@ -730,10 +730,6 @@ i830_allocate_agp_memory(ScrnInfoPtr pScrn, i830_memory *mem, int flags) return FALSE; } - if (!i830_bind_memory(pScrn, mem)) { - return FALSE; - } - return TRUE; } @@ -853,6 +849,11 @@ i830_allocate_memory(ScrnInfoPtr pScrn, const char *name, i830_free_memory(pScrn, mem); return NULL; } + + if (!i830_bind_memory(pScrn, mem)) { + i830_free_memory(pScrn, mem); + return NULL; + } } mem->tiling = TILE_NONE; @@ -1712,8 +1713,8 @@ i830_set_tiling(ScrnInfoPtr pScrn, unsigned int offset, enum tile_format tile_format) { I830Ptr pI830 = I830PTR(pScrn); - CARD32 val; - CARD32 fence_mask = 0; + uint32_t val; + uint32_t fence_mask = 0; unsigned int fence_pitch; unsigned int max_fence; unsigned int fence_nr; diff --git a/src/i830_quirks.c b/src/i830_quirks.c index 67202214..7d0d1429 100644 --- a/src/i830_quirks.c +++ b/src/i830_quirks.c @@ -249,10 +249,14 @@ static i830_quirk i830_quirk_list[] = { /* HP Compaq 6730s has no TV output */ { PCI_CHIP_IGD_GM, 0x103c, 0x30e8, quirk_ignore_tv }, + /* Thinkpad R31 needs pipe A force quirk */ + { PCI_CHIP_I830_M, 0x1014, 0x0505, quirk_pipea_force }, /* Dell Latitude D500 needs pipe A force quirk */ { PCI_CHIP_I855_GM, 0x1028, 0x0152, quirk_pipea_force }, /* Dell Inspiron 510m needs pipe A force quirk */ { PCI_CHIP_I855_GM, 0x1028, 0x0164, quirk_pipea_force }, + /* Toshiba Protege R-205, S-209 needs pipe A force quirk */ + { PCI_CHIP_I915_GM, 0x1179, 0x0001, quirk_pipea_force }, /* ThinkPad X40 needs pipe A force quirk */ { PCI_CHIP_I855_GM, 0x1014, 0x0557, quirk_pipea_force }, diff --git a/src/i830_render.c b/src/i830_render.c index 22e09c84..ccfd670c 100644 --- a/src/i830_render.c +++ b/src/i830_render.c @@ -54,13 +54,13 @@ do { \ struct blendinfo { Bool dst_alpha; Bool src_alpha; - CARD32 src_blend; - CARD32 dst_blend; + uint32_t src_blend; + uint32_t dst_blend; }; struct formatinfo { int fmt; - CARD32 card_fmt; + uint32_t card_fmt; }; #define TB0C_LAST_STAGE (1 << 31) @@ -154,7 +154,7 @@ static struct formatinfo i830_tex_formats[] = { {PICT_a8, MT_8BIT_A8 }, }; -static Bool i830_get_dest_format(PicturePtr pDstPicture, CARD32 *dst_format) +static Bool i830_get_dest_format(PicturePtr pDstPicture, uint32_t *dst_format) { switch (pDstPicture->format) { case PICT_a8r8g8b8: @@ -186,9 +186,10 @@ static Bool i830_get_dest_format(PicturePtr pDstPicture, CARD32 *dst_format) } -static CARD32 i830_get_blend_cntl(int op, PicturePtr pMask, CARD32 dst_format) +static uint32_t i830_get_blend_cntl(int op, PicturePtr pMask, + uint32_t dst_format) { - CARD32 sblend, dblend; + uint32_t sblend, dblend; sblend = i830_blend_op[op].src_blend; dblend = i830_blend_op[op].dst_blend; @@ -260,7 +261,7 @@ static Bool i830_check_composite_texture(PicturePtr pPict, int unit) return TRUE; } -static CARD32 +static uint32_t i8xx_get_card_format(PicturePtr pPict) { int i; @@ -279,8 +280,8 @@ i830_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit) ScrnInfoPtr pScrn = xf86Screens[pPict->pDrawable->pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); - CARD32 format, offset, pitch, filter; - CARD32 wrap_mode = TEXCOORDMODE_CLAMP_BORDER; + uint32_t format, offset, pitch, filter; + uint32_t wrap_mode = TEXCOORDMODE_CLAMP_BORDER; offset = intel_get_pixmap_offset(pPix); pitch = intel_get_pixmap_pitch(pPix); @@ -362,7 +363,7 @@ Bool i830_check_composite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture) { - CARD32 tmp1; + uint32_t tmp1; /* Check for unsupported compositing operations. */ if (op >= sizeof(i830_blend_op) / sizeof(i830_blend_op[0])) @@ -398,12 +399,13 @@ i830_prepare_composite(int op, PicturePtr pSrcPicture, { ScrnInfoPtr pScrn = xf86Screens[pSrcPicture->pDrawable->pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); - CARD32 dst_format, dst_offset, dst_pitch; + uint32_t dst_format, dst_offset, dst_pitch; IntelEmitInvarientState(pScrn); *pI830->last_3d = LAST_3D_RENDER; - i830_get_dest_format(pDstPicture, &dst_format); + if (!i830_get_dest_format(pDstPicture, &dst_format)) + return FALSE; dst_offset = intel_get_pixmap_offset(pDst); dst_pitch = intel_get_pixmap_pitch(pDst); @@ -419,7 +421,7 @@ i830_prepare_composite(int op, PicturePtr pSrcPicture, } { - CARD32 cblend, ablend, blendctl, vf2; + uint32_t cblend, ablend, blendctl, vf2; BEGIN_LP_RING(30); diff --git a/src/i830_ring.h b/src/i830_ring.h new file mode 100644 index 00000000..177b0d52 --- /dev/null +++ b/src/i830_ring.h @@ -0,0 +1,135 @@ +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright © 2002 David Dawes + +All Rights Reserved. + +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, sub license, 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 NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. + +**************************************************************************/ + +#ifndef _INTEL_RING_H +#define _INTEL_RING_H + +#define OUT_RING(n) do { \ + if (I810_DEBUG & DEBUG_VERBOSE_RING) \ + ErrorF("OUT_RING 0x%08x: 0x%08x, (mask %x)\n", \ + pI830->ring_next, (unsigned int)(n), \ + pI830->LpRing->tail_mask); \ + *(volatile uint32_t *)(pI830->LpRing->virtual_start + \ + pI830->ring_next) = n; \ + pI830->ring_used += 4; \ + pI830->ring_next += 4; \ + pI830->ring_next &= pI830->LpRing->tail_mask; \ +} while (0) + +/** Copies a given number of bytes to the ring */ +#define OUT_RING_COPY(n, ptr) do { \ + if (I810_DEBUG & DEBUG_VERBOSE_RING) \ + ErrorF("OUT_RING_DATA %d bytes\n", n); \ + memcpy_volatile(pI830->LpRing->virtual_start + pI830->ring_next, \ + ptr, n); \ + pI830->ring_used += n; \ + pI830->ring_next += n; \ + pI830->ring_next &= pI830->LpRing->tail_mask; \ +} while (0) + +/** Pads the ring with a given number of zero bytes */ +#define OUT_RING_PAD(n) do { \ + if (I810_DEBUG & DEBUG_VERBOSE_RING) \ + ErrorF("OUT_RING_PAD %d bytes\n", n); \ + memset_volatile(pI830->LpRing->virtual_start + pI830->ring_next, \ + 0, n); \ + pI830->ring_used += n; \ + pI830->ring_next += n; \ + pI830->ring_next &= pI830->LpRing->tail_mask; \ +} while (0) + +union intfloat { + float f; + unsigned int ui; +}; + +#define OUT_RING_F(x) do { \ + union intfloat tmp; \ + tmp.f = (float)(x); \ + OUT_RING(tmp.ui); \ +} while(0) + +#define ADVANCE_LP_RING() do { \ + if (pI830->ring_emitting == 0) \ + FatalError("%s: ADVANCE_LP_RING called with no matching " \ + "BEGIN_LP_RING\n", __FUNCTION__); \ + if (pI830->ring_used > pI830->ring_emitting) \ + FatalError("%s: ADVANCE_LP_RING: exceeded allocation %d/%d\n ", \ + __FUNCTION__, pI830->ring_used, \ + pI830->ring_emitting); \ + if (pI830->ring_used < pI830->ring_emitting) \ + FatalError("%s: ADVANCE_LP_RING: under-used allocation %d/%d\n ", \ + __FUNCTION__, pI830->ring_used, \ + pI830->ring_emitting); \ + pI830->LpRing->tail = pI830->ring_next; \ + pI830->LpRing->space -= pI830->ring_used; \ + if (pI830->ring_next & 0x07) \ + FatalError("%s: ADVANCE_LP_RING: " \ + "ring_next (0x%x) isn't on a QWord boundary\n", \ + __FUNCTION__, pI830->ring_next); \ + OUTREG(LP_RING + RING_TAIL, pI830->ring_next); \ + pI830->ring_emitting = 0; \ +} while (0) + +/* + * XXX Note: the head/tail masks are different for 810 and i830. + * If the i810 always sets the higher bits to 0, then this shouldn't be + * a problem. Check this! + */ +#define DO_RING_IDLE() do { \ + int _head; \ + int _tail; \ + do { \ + _head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK; \ + _tail = INREG(LP_RING + RING_TAIL) & I830_TAIL_MASK; \ + DELAY(10); \ + } while (_head != _tail); \ +} while (0) + +#define BEGIN_LP_RING(n) \ +do { \ + if (pI830->ring_emitting != 0) \ + FatalError("%s: BEGIN_LP_RING called without closing " \ + "ADVANCE_LP_RING\n", __FUNCTION__); \ + if ((n) > 2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) \ + DO_RING_IDLE(); \ + pI830->ring_emitting = (n) * 4; \ + if ((n) & 1) \ + pI830->ring_emitting += 4; \ + if (pI830->LpRing->space < pI830->ring_emitting) \ + WaitRingFunc(pScrn, pI830->ring_emitting, 0); \ + pI830->ring_next = pI830->LpRing->tail; \ + if (I810_DEBUG & DEBUG_VERBOSE_RING) \ + ErrorF( "BEGIN_LP_RING %d in %s\n", n, FUNCTION_NAME); \ + pI830->ring_used = 0; \ + if ((n) & 1) \ + OUT_RING(MI_NOOP); \ +} while (0) + +#endif /* _INTEL_RING_H */ diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c index d0c65f28..9a89cc9b 100644 --- a/src/i830_sdvo.c +++ b/src/i830_sdvo.c @@ -59,7 +59,7 @@ struct i830_sdvo_priv { int output_device; /** Active outputs controlled by this SDVO output */ - CARD16 active_outputs; + uint16_t active_outputs; /** * Capabilities of the SDVO device returned by i830_sdvo_get_capabilities() @@ -72,10 +72,10 @@ struct i830_sdvo_priv { /** State for save/restore */ /** @{ */ int save_sdvo_mult; - CARD16 save_active_outputs; + uint16_t save_active_outputs; struct i830_sdvo_dtd save_input_dtd_1, save_input_dtd_2; struct i830_sdvo_dtd save_output_dtd[16]; - CARD32 save_SDVOX; + uint32_t save_SDVOX; /** @} */ }; @@ -84,13 +84,13 @@ struct i830_sdvo_priv { * SDVOB and SDVOC to work around apparent hardware issues (according to * comments in the BIOS). */ -static void i830_sdvo_write_sdvox(xf86OutputPtr output, CARD32 val) +static void i830_sdvo_write_sdvox(xf86OutputPtr output, uint32_t val) { ScrnInfoPtr pScrn = output->scrn; I830OutputPrivatePtr intel_output = output->driver_private; struct i830_sdvo_priv *dev_priv = intel_output->dev_priv; I830Ptr pI830 = I830PTR(pScrn); - CARD32 bval = val, cval = val; + uint32_t bval = val, cval = val; int i; if (dev_priv->output_device == SDVOB) @@ -158,7 +158,7 @@ static Bool i830_sdvo_write_byte(xf86OutputPtr output, #define SDVO_CMD_NAME_ENTRY(cmd) {cmd, #cmd} /** Mapping of command numbers to names, for debug output */ const static struct _sdvo_cmd_name { - CARD8 cmd; + uint8_t cmd; char *name; } sdvo_cmd_names[] = { SDVO_CMD_NAME_ENTRY(SDVO_CMD_RESET), @@ -212,7 +212,8 @@ static I2CSlaveAddr slaveAddr; * Writes out the data given in args (up to 8 bytes), followed by the opcode. */ static void -i830_sdvo_write_cmd(xf86OutputPtr output, CARD8 cmd, void *args, int args_len) +i830_sdvo_write_cmd(xf86OutputPtr output, uint8_t cmd, void *args, + int args_len) { I830Ptr pI830 = I830PTR(output->scrn); I830OutputPrivatePtr intel_output = output->driver_private; @@ -227,7 +228,7 @@ i830_sdvo_write_cmd(xf86OutputPtr output, CARD8 cmd, void *args, int args_len) xf86DrvMsg(intel_output->pI2CBus->scrnIndex, X_INFO, "%s: W: %02X ", SDVO_NAME(dev_priv), cmd); for (i = 0; i < args_len; i++) - LogWrite(1, "%02X ", ((CARD8 *)args)[i]); + LogWrite(1, "%02X ", ((uint8_t *)args)[i]); for (; i < 8; i++) LogWrite(1, " "); for (i = 0; i < sizeof(sdvo_cmd_names) / sizeof(sdvo_cmd_names[0]); @@ -245,7 +246,7 @@ i830_sdvo_write_cmd(xf86OutputPtr output, CARD8 cmd, void *args, int args_len) /* send the output regs */ for (i = 0; i < args_len; i++) { - i830_sdvo_write_byte(output, SDVO_I2C_ARG_0 - i, ((CARD8 *)args)[i]); + i830_sdvo_write_byte(output, SDVO_I2C_ARG_0 - i, ((uint8_t *)args)[i]); } /* blast the command reg */ i830_sdvo_write_byte(output, SDVO_I2C_OPCODE, cmd); @@ -264,20 +265,20 @@ static const char *cmd_status_names[] = { /** * Reads back response_len bytes from the SDVO device, and returns the status. */ -static CARD8 +static uint8_t i830_sdvo_read_response(xf86OutputPtr output, void *response, int response_len) { I830Ptr pI830 = I830PTR(output->scrn); I830OutputPrivatePtr intel_output = output->driver_private; int i; - CARD8 status; - CARD8 retry = 50; + uint8_t status; + uint8_t retry = 50; while (retry--) { /* Read the command response */ for (i = 0; i < response_len; i++) { i830_sdvo_read_byte(output, SDVO_I2C_RETURN_0 + i, - &((CARD8 *)response)[i]); + &((uint8_t *)response)[i]); } /* Read the return status */ @@ -288,7 +289,7 @@ i830_sdvo_read_response(xf86OutputPtr output, void *response, int response_len) xf86DrvMsg(intel_output->pI2CBus->scrnIndex, X_INFO, "%s: R: ", SDVO_NAME(SDVO_PRIV(intel_output))); for (i = 0; i < response_len; i++) - LogWrite(1, "%02X ", ((CARD8 *)response)[i]); + LogWrite(1, "%02X ", ((uint8_t *)response)[i]); for (; i < 8; i++) LogWrite(1, " "); if (status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP) { @@ -324,7 +325,7 @@ i830_sdvo_get_pixel_multiplier(DisplayModePtr pMode) * STOP. PROM access is terminated by accessing an internal register. */ static void -i830_sdvo_set_control_bus_switch(xf86OutputPtr output, CARD8 target) +i830_sdvo_set_control_bus_switch(xf86OutputPtr output, uint8_t target) { i830_sdvo_write_cmd(output, SDVO_CMD_SET_CONTROL_BUS_SWITCH, &target, 1); } @@ -333,7 +334,7 @@ static Bool i830_sdvo_set_target_input(xf86OutputPtr output, Bool target_0, Bool target_1) { struct i830_sdvo_set_target_input_args targets = {0}; - CARD8 status; + uint8_t status; if (target_0 && target_1) return SDVO_CMD_STATUS_NOTSUPP; @@ -359,7 +360,7 @@ static Bool i830_sdvo_get_trained_inputs(xf86OutputPtr output, Bool *input_1, Bool *input_2) { struct i830_sdvo_get_trained_inputs_response response; - CARD8 status; + uint8_t status; i830_sdvo_write_cmd(output, SDVO_CMD_GET_TRAINED_INPUTS, NULL, 0); @@ -375,9 +376,9 @@ i830_sdvo_get_trained_inputs(xf86OutputPtr output, Bool *input_1, Bool *input_2) static Bool i830_sdvo_get_active_outputs(xf86OutputPtr output, - CARD16 *outputs) + uint16_t *outputs) { - CARD8 status; + uint8_t status; i830_sdvo_write_cmd(output, SDVO_CMD_GET_ACTIVE_OUTPUTS, NULL, 0); status = i830_sdvo_read_response(output, outputs, sizeof(*outputs)); @@ -387,9 +388,9 @@ i830_sdvo_get_active_outputs(xf86OutputPtr output, static Bool i830_sdvo_set_active_outputs(xf86OutputPtr output, - CARD16 outputs) + uint16_t outputs) { - CARD8 status; + uint8_t status; i830_sdvo_write_cmd(output, SDVO_CMD_SET_ACTIVE_OUTPUTS, &outputs, sizeof(outputs)); @@ -401,8 +402,8 @@ i830_sdvo_set_active_outputs(xf86OutputPtr output, static Bool i830_sdvo_set_encoder_power_state(xf86OutputPtr output, int mode) { - CARD8 status; - CARD8 state; + uint8_t status; + uint8_t state; switch (mode) { case DPMSModeOn: @@ -434,7 +435,7 @@ i830_sdvo_get_input_pixel_clock_range(xf86OutputPtr output, int *clock_min, int *clock_max) { struct i830_sdvo_pixel_clock_range clocks; - CARD8 status; + uint8_t status; i830_sdvo_write_cmd(output, SDVO_CMD_GET_INPUT_PIXEL_CLOCK_RANGE, NULL, 0); @@ -451,9 +452,9 @@ i830_sdvo_get_input_pixel_clock_range(xf86OutputPtr output, int *clock_min, } static Bool -i830_sdvo_set_target_output(xf86OutputPtr output, CARD16 outputs) +i830_sdvo_set_target_output(xf86OutputPtr output, uint16_t outputs) { - CARD8 status; + uint8_t status; i830_sdvo_write_cmd(output, SDVO_CMD_SET_TARGET_OUTPUT, &outputs, sizeof(outputs)); @@ -465,9 +466,9 @@ i830_sdvo_set_target_output(xf86OutputPtr output, CARD16 outputs) /** Fetches either input or output timings to *dtd, depending on cmd. */ static Bool -i830_sdvo_get_timing(xf86OutputPtr output, CARD8 cmd, struct i830_sdvo_dtd *dtd) +i830_sdvo_get_timing(xf86OutputPtr output, uint8_t cmd, struct i830_sdvo_dtd *dtd) { - CARD8 status; + uint8_t status; i830_sdvo_write_cmd(output, cmd, NULL, 0); @@ -498,9 +499,10 @@ i830_sdvo_get_output_timing(xf86OutputPtr output, struct i830_sdvo_dtd *dtd) /** Sets either input or output timings from *dtd, depending on cmd. */ static Bool -i830_sdvo_set_timing(xf86OutputPtr output, CARD8 cmd, struct i830_sdvo_dtd *dtd) +i830_sdvo_set_timing(xf86OutputPtr output, uint8_t cmd, + struct i830_sdvo_dtd *dtd) { - CARD8 status; + uint8_t status; i830_sdvo_write_cmd(output, cmd, &dtd->part1, sizeof(dtd->part1)); status = i830_sdvo_read_response(output, NULL, 0); @@ -529,8 +531,8 @@ i830_sdvo_set_output_timing(xf86OutputPtr output, struct i830_sdvo_dtd *dtd) #if 0 static Bool -i830_sdvo_create_preferred_input_timing(xf86OutputPtr output, CARD16 clock, - CARD16 width, CARD16 height) +i830_sdvo_create_preferred_input_timing(xf86OutputPtr output, uint16_t clock, + uint16_t width, uint16_t height) { struct i830_sdvo_priv *dev_priv = output->dev_priv; struct i830_sdvo_preferred_input_timing_args args; @@ -577,8 +579,8 @@ i830_sdvo_get_clock_rate_mult(xf86OutputPtr output) { I830OutputPrivatePtr intel_output = output->driver_private; struct i830_sdvo_priv *dev_priv = intel_output->dev_priv; - CARD8 response; - CARD8 status; + uint8_t response; + uint8_t status; i830_sdvo_write_cmd(output, SDVO_CMD_GET_CLOCK_RATE_MULT, NULL, 0); status = i830_sdvo_read_response(output, &response, 1); @@ -602,9 +604,9 @@ i830_sdvo_get_clock_rate_mult(xf86OutputPtr output) * is actually turned on. */ static Bool -i830_sdvo_set_clock_rate_mult(xf86OutputPtr output, CARD8 val) +i830_sdvo_set_clock_rate_mult(xf86OutputPtr output, uint8_t val) { - CARD8 status; + uint8_t status; i830_sdvo_write_cmd(output, SDVO_CMD_SET_CLOCK_RATE_MULT, &val, 1); status = i830_sdvo_read_response(output, NULL, 0); @@ -636,13 +638,13 @@ i830_sdvo_mode_set(xf86OutputPtr output, DisplayModePtr mode, struct i830_sdvo_priv *dev_priv = intel_output->dev_priv; xf86CrtcPtr crtc = output->crtc; I830CrtcPrivatePtr intel_crtc = crtc->driver_private; - CARD32 sdvox; + uint32_t sdvox; int sdvo_pixel_multiply; - CARD16 width, height; - CARD16 h_blank_len, h_sync_len, v_blank_len, v_sync_len; - CARD16 h_sync_offset, v_sync_offset; + uint16_t width, height; + uint16_t h_blank_len, h_sync_len, v_blank_len, v_sync_len; + uint16_t h_sync_offset, v_sync_offset; struct i830_sdvo_dtd output_dtd; - CARD16 no_outputs; + uint16_t no_outputs; no_outputs = 0; @@ -763,7 +765,7 @@ i830_sdvo_dpms(xf86OutputPtr output, int mode) I830OutputPrivatePtr intel_output = output->driver_private; struct i830_sdvo_priv *dev_priv = intel_output->dev_priv; I830Ptr pI830 = I830PTR(pScrn); - CARD32 temp; + uint32_t temp; if (mode != DPMSModeOn) { i830_sdvo_set_active_outputs(output, 0); @@ -779,7 +781,7 @@ i830_sdvo_dpms(xf86OutputPtr output, int mode) } else { Bool input1, input2; int i; - CARD8 status; + uint8_t status; temp = INREG(dev_priv->output_device); if ((temp & SDVO_ENABLE) == 0) @@ -828,7 +830,7 @@ i830_sdvo_save(xf86OutputPtr output) for (o = SDVO_OUTPUT_FIRST; o <= SDVO_OUTPUT_LAST; o++) { - CARD16 this_output = (1 << o); + uint16_t this_output = (1 << o); if (dev_priv->caps.output_flags & this_output) { i830_sdvo_set_target_output(output, this_output); @@ -848,13 +850,13 @@ i830_sdvo_restore(xf86OutputPtr output) int o; int i; Bool input1, input2; - CARD8 status; + uint8_t status; i830_sdvo_set_active_outputs(output, 0); for (o = SDVO_OUTPUT_FIRST; o <= SDVO_OUTPUT_LAST; o++) { - CARD16 this_output = (1 << o); + uint16_t this_output = (1 << o); if (dev_priv->caps.output_flags & this_output) { i830_sdvo_set_target_output(output, this_output); @@ -911,7 +913,7 @@ i830_sdvo_mode_valid(xf86OutputPtr output, DisplayModePtr pMode) static Bool i830_sdvo_get_capabilities(xf86OutputPtr output, struct i830_sdvo_caps *caps) { - CARD8 status; + uint8_t status; i830_sdvo_write_cmd(output, SDVO_CMD_GET_DEVICE_CAPS, NULL, 0); status = i830_sdvo_read_response(output, caps, sizeof(*caps)); @@ -1016,7 +1018,7 @@ i830_sdvo_ddc_i2c_address(I2CDevPtr d, I2CSlaveAddr addr) static void i830_sdvo_dump_cmd(xf86OutputPtr output, int opcode) { - CARD8 response[8]; + uint8_t response[8]; i830_sdvo_write_cmd(output, opcode, NULL, 0); i830_sdvo_read_response(output, response, 8); @@ -1080,8 +1082,8 @@ i830_sdvo_dump(ScrnInfoPtr pScrn) static xf86OutputStatus i830_sdvo_detect(xf86OutputPtr output) { - CARD8 response[2]; - CARD8 status; + uint8_t response[2]; + uint8_t status; i830_sdvo_write_cmd(output, SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0); status = i830_sdvo_read_response(output, &response, 2); diff --git a/src/i830_sdvo_regs.h b/src/i830_sdvo_regs.h index 72e58a00..725460f2 100644 --- a/src/i830_sdvo_regs.h +++ b/src/i830_sdvo_regs.h @@ -47,11 +47,11 @@ #define SDVO_OUTPUT_LAST (14) struct i830_sdvo_caps { - CARD8 vendor_id; - CARD8 device_id; - CARD8 device_rev_id; - CARD8 sdvo_version_major; - CARD8 sdvo_version_minor; + uint8_t vendor_id; + uint8_t device_id; + uint8_t device_rev_id; + uint8_t sdvo_version_major; + uint8_t sdvo_version_minor; unsigned int sdvo_inputs_mask:2; unsigned int smooth_scaling:1; unsigned int sharp_scaling:1; @@ -59,48 +59,48 @@ struct i830_sdvo_caps { unsigned int down_scaling:1; unsigned int stall_support:1; unsigned int pad:1; - CARD16 output_flags; + uint16_t output_flags; } __attribute__((packed)); /** This matches the EDID DTD structure, more or less */ struct i830_sdvo_dtd { struct { - CARD16 clock; /**< pixel clock, in 10kHz units */ - CARD8 h_active; /**< lower 8 bits (pixels) */ - CARD8 h_blank; /**< lower 8 bits (pixels) */ - CARD8 h_high; /**< upper 4 bits each h_active, h_blank */ - CARD8 v_active; /**< lower 8 bits (lines) */ - CARD8 v_blank; /**< lower 8 bits (lines) */ - CARD8 v_high; /**< upper 4 bits each v_active, v_blank */ + uint16_t clock; /**< pixel clock, in 10kHz units */ + uint8_t h_active; /**< lower 8 bits (pixels) */ + uint8_t h_blank; /**< lower 8 bits (pixels) */ + uint8_t h_high; /**< upper 4 bits each h_active, h_blank */ + uint8_t v_active; /**< lower 8 bits (lines) */ + uint8_t v_blank; /**< lower 8 bits (lines) */ + uint8_t v_high; /**< upper 4 bits each v_active, v_blank */ } part1; struct { - CARD8 h_sync_off; /**< lower 8 bits, from hblank start */ - CARD8 h_sync_width; /**< lower 8 bits (pixels) */ + uint8_t h_sync_off; /**< lower 8 bits, from hblank start */ + uint8_t h_sync_width; /**< lower 8 bits (pixels) */ /** lower 4 bits each vsync offset, vsync width */ - CARD8 v_sync_off_width; + uint8_t v_sync_off_width; /** * 2 high bits of hsync offset, 2 high bits of hsync width, * bits 4-5 of vsync offset, and 2 high bits of vsync width. */ - CARD8 sync_off_width_high; - CARD8 dtd_flags; - CARD8 sdvo_flags; + uint8_t sync_off_width_high; + uint8_t dtd_flags; + uint8_t sdvo_flags; /** bits 6-7 of vsync offset at bits 6-7 */ - CARD8 v_sync_off_high; - CARD8 reserved; + uint8_t v_sync_off_high; + uint8_t reserved; } part2; } __attribute__((packed)); struct i830_sdvo_pixel_clock_range { - CARD16 min; /**< pixel clock, in 10kHz units */ - CARD16 max; /**< pixel clock, in 10kHz units */ + uint16_t min; /**< pixel clock, in 10kHz units */ + uint16_t max; /**< pixel clock, in 10kHz units */ } __attribute__((packed)); struct i830_sdvo_preferred_input_timing_args { - CARD16 clock; - CARD16 width; - CARD16 height; + uint16_t clock; + uint16_t width; + uint16_t height; } __attribute__((packed)); /* I2C registers for SDVO */ @@ -205,7 +205,7 @@ struct i830_sdvo_get_trained_inputs_response { #define SDVO_CMD_GET_INTERRUPT_EVENT_SOURCE 0x0f struct i830_sdvo_get_interrupt_event_source_response { - CARD16 interrupt_status; + uint16_t interrupt_status; unsigned int ambient_light_interrupt:1; unsigned int pad:7; } __attribute__((packed)); diff --git a/src/i830_tv.c b/src/i830_tv.c index 9add367a..095f59bd 100644 --- a/src/i830_tv.c +++ b/src/i830_tv.c @@ -57,39 +57,39 @@ struct i830_tv_priv { int type; char *tv_format; int margin[4]; - CARD32 save_TV_H_CTL_1; - CARD32 save_TV_H_CTL_2; - CARD32 save_TV_H_CTL_3; - CARD32 save_TV_V_CTL_1; - CARD32 save_TV_V_CTL_2; - CARD32 save_TV_V_CTL_3; - CARD32 save_TV_V_CTL_4; - CARD32 save_TV_V_CTL_5; - CARD32 save_TV_V_CTL_6; - CARD32 save_TV_V_CTL_7; - CARD32 save_TV_SC_CTL_1, save_TV_SC_CTL_2, save_TV_SC_CTL_3; - - CARD32 save_TV_CSC_Y; - CARD32 save_TV_CSC_Y2; - CARD32 save_TV_CSC_U; - CARD32 save_TV_CSC_U2; - CARD32 save_TV_CSC_V; - CARD32 save_TV_CSC_V2; - CARD32 save_TV_CLR_KNOBS; - CARD32 save_TV_CLR_LEVEL; - CARD32 save_TV_WIN_POS; - CARD32 save_TV_WIN_SIZE; - CARD32 save_TV_FILTER_CTL_1; - CARD32 save_TV_FILTER_CTL_2; - CARD32 save_TV_FILTER_CTL_3; - - CARD32 save_TV_H_LUMA[60]; - CARD32 save_TV_H_CHROMA[60]; - CARD32 save_TV_V_LUMA[43]; - CARD32 save_TV_V_CHROMA[43]; - - CARD32 save_TV_DAC; - CARD32 save_TV_CTL; + uint32_t save_TV_H_CTL_1; + uint32_t save_TV_H_CTL_2; + uint32_t save_TV_H_CTL_3; + uint32_t save_TV_V_CTL_1; + uint32_t save_TV_V_CTL_2; + uint32_t save_TV_V_CTL_3; + uint32_t save_TV_V_CTL_4; + uint32_t save_TV_V_CTL_5; + uint32_t save_TV_V_CTL_6; + uint32_t save_TV_V_CTL_7; + uint32_t save_TV_SC_CTL_1, save_TV_SC_CTL_2, save_TV_SC_CTL_3; + + uint32_t save_TV_CSC_Y; + uint32_t save_TV_CSC_Y2; + uint32_t save_TV_CSC_U; + uint32_t save_TV_CSC_U2; + uint32_t save_TV_CSC_V; + uint32_t save_TV_CSC_V2; + uint32_t save_TV_CLR_KNOBS; + uint32_t save_TV_CLR_LEVEL; + uint32_t save_TV_WIN_POS; + uint32_t save_TV_WIN_SIZE; + uint32_t save_TV_FILTER_CTL_1; + uint32_t save_TV_FILTER_CTL_2; + uint32_t save_TV_FILTER_CTL_3; + + uint32_t save_TV_H_LUMA[60]; + uint32_t save_TV_H_CHROMA[60]; + uint32_t save_TV_V_LUMA[43]; + uint32_t save_TV_V_CHROMA[43]; + + uint32_t save_TV_DAC; + uint32_t save_TV_CTL; }; typedef struct { @@ -102,7 +102,7 @@ typedef struct { float rv, gv, bv, av; } color_conversion_t; -static const CARD32 filter_table[] = { +static const uint32_t filter_table[] = { 0xB1403000, 0x2E203500, 0x35002E20, 0x3000B140, 0x35A0B160, 0x2DC02E80, 0xB1403480, 0xB1603000, 0x2EA03640, 0x34002D80, 0x3000B120, 0x36E0B160, @@ -161,7 +161,7 @@ typedef struct { char *name; int clock; double refresh; - CARD32 oversample; + uint32_t oversample; int hsync_end, hblank_start, hblank_end, htotal; Bool progressive, trilevel_sync, component_only; int vsync_start_f1, vsync_start_f2, vsync_len; @@ -178,14 +178,14 @@ typedef struct { * subcarrier programming */ int dda2_size, dda3_size, dda1_inc, dda2_inc, dda3_inc; - CARD32 sc_reset; + uint32_t sc_reset; Bool pal_burst; /* * blank/black levels */ video_levels_t composite_levels, svideo_levels; color_conversion_t composite_color, svideo_color; - const CARD32 *filter_table; + const uint32_t *filter_table; int max_srcw; } tv_mode_t; @@ -981,13 +981,13 @@ i830_tv_mode_fixup(xf86OutputPtr output, DisplayModePtr mode, return TRUE; } -static CARD32 +static uint32_t i830_float_to_csc (float fin) { - CARD32 exp; - CARD32 mant; - CARD32 ret; - float f = fin; + uint32_t exp; + uint32_t mant; + uint32_t ret; + float f = fin; /* somehow the color conversion knows the signs of all the values */ if (f < 0) f = -f; @@ -1009,10 +1009,10 @@ i830_float_to_csc (float fin) return ret; } -static CARD16 +static uint16_t i830_float_to_luma (float f) { - CARD16 ret; + uint16_t ret; ret = (f * (1 << 9)); return ret; @@ -1029,10 +1029,10 @@ i830_tv_mode_set(xf86OutputPtr output, DisplayModePtr mode, I830CrtcPrivatePtr intel_crtc = crtc->driver_private; struct i830_tv_priv *dev_priv = intel_output->dev_priv; const tv_mode_t *tv_mode = i830_tv_mode_find (output); - CARD32 tv_ctl; - CARD32 hctl1, hctl2, hctl3; - CARD32 vctl1, vctl2, vctl3, vctl4, vctl5, vctl6, vctl7; - CARD32 scctl1, scctl2, scctl3; + uint32_t tv_ctl; + uint32_t hctl1, hctl2, hctl3; + uint32_t vctl1, vctl2, vctl3, vctl4, vctl5, vctl6, vctl7; + uint32_t scctl1, scctl2, scctl3; int i, j; const video_levels_t *video_levels; const color_conversion_t *color_conversion; @@ -1271,8 +1271,8 @@ i830_tv_detect_type (xf86CrtcPtr crtc, ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); I830OutputPrivatePtr intel_output = output->driver_private; - CARD32 tv_ctl, save_tv_ctl; - CARD32 tv_dac, save_tv_dac; + uint32_t tv_ctl, save_tv_ctl; + uint32_t tv_dac, save_tv_dac; int type = TV_TYPE_UNKNOWN; tv_dac = INREG(TV_DAC); @@ -1665,7 +1665,7 @@ i830_tv_init(ScrnInfoPtr pScrn) xf86OutputPtr output; I830OutputPrivatePtr intel_output; struct i830_tv_priv *dev_priv; - CARD32 tv_dac_on, tv_dac_off, save_tv_dac; + uint32_t tv_dac_on, tv_dac_off, save_tv_dac; if (pI830->quirk_flag & QUIRK_IGNORE_TV) return; diff --git a/src/i830_video.c b/src/i830_video.c index 6b685f0c..99723c67 100644 --- a/src/i830_video.c +++ b/src/i830_video.c @@ -100,6 +100,7 @@ static XF86VideoAdaptorPtr I830SetupImageVideoOverlay(ScreenPtr); static XF86VideoAdaptorPtr I830SetupImageVideoTextured(ScreenPtr); static void I830StopVideo(ScrnInfoPtr, pointer, Bool); static int I830SetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int I830SetPortAttributeTextured(ScrnInfoPtr, Atom, INT32, pointer); static int I830GetPortAttribute(ScrnInfoPtr, Atom, INT32 *, pointer); static void I830QueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, unsigned int *, @@ -295,58 +296,58 @@ static XF86ImageRec Images[NUM_IMAGES] = { }; typedef struct { - CARD32 OBUF_0Y; - CARD32 OBUF_1Y; - CARD32 OBUF_0U; - CARD32 OBUF_0V; - CARD32 OBUF_1U; - CARD32 OBUF_1V; - CARD32 OSTRIDE; - CARD32 YRGB_VPH; - CARD32 UV_VPH; - CARD32 HORZ_PH; - CARD32 INIT_PHS; - CARD32 DWINPOS; - CARD32 DWINSZ; - CARD32 SWIDTH; - CARD32 SWIDTHSW; - CARD32 SHEIGHT; - CARD32 YRGBSCALE; - CARD32 UVSCALE; - CARD32 OCLRC0; - CARD32 OCLRC1; - CARD32 DCLRKV; - CARD32 DCLRKM; - CARD32 SCLRKVH; - CARD32 SCLRKVL; - CARD32 SCLRKEN; - CARD32 OCONFIG; - CARD32 OCMD; - CARD32 RESERVED1; /* 0x6C */ - CARD32 OSTART_0Y; /* for i965 */ - CARD32 OSTART_1Y; /* for i965 */ - CARD32 OSTART_0U; - CARD32 OSTART_0V; - CARD32 OSTART_1U; - CARD32 OSTART_1V; - CARD32 OTILEOFF_0Y; - CARD32 OTILEOFF_1Y; - CARD32 OTILEOFF_0U; - CARD32 OTILEOFF_0V; - CARD32 OTILEOFF_1U; - CARD32 OTILEOFF_1V; - CARD32 FASTHSCALE; /* 0xA0 */ - CARD32 UVSCALEV; /* 0xA4 */ - - CARD32 RESERVEDC[(0x200 - 0xA8) / 4]; /* 0xA8 - 0x1FC */ - CARD16 Y_VCOEFS[N_VERT_Y_TAPS * N_PHASES]; /* 0x200 */ - CARD16 RESERVEDD[0x100 / 2 - N_VERT_Y_TAPS * N_PHASES]; - CARD16 Y_HCOEFS[N_HORIZ_Y_TAPS * N_PHASES]; /* 0x300 */ - CARD16 RESERVEDE[0x200 / 2 - N_HORIZ_Y_TAPS * N_PHASES]; - CARD16 UV_VCOEFS[N_VERT_UV_TAPS * N_PHASES]; /* 0x500 */ - CARD16 RESERVEDF[0x100 / 2 - N_VERT_UV_TAPS * N_PHASES]; - CARD16 UV_HCOEFS[N_HORIZ_UV_TAPS * N_PHASES]; /* 0x600 */ - CARD16 RESERVEDG[0x100 / 2 - N_HORIZ_UV_TAPS * N_PHASES]; + uint32_t OBUF_0Y; + uint32_t OBUF_1Y; + uint32_t OBUF_0U; + uint32_t OBUF_0V; + uint32_t OBUF_1U; + uint32_t OBUF_1V; + uint32_t OSTRIDE; + uint32_t YRGB_VPH; + uint32_t UV_VPH; + uint32_t HORZ_PH; + uint32_t INIT_PHS; + uint32_t DWINPOS; + uint32_t DWINSZ; + uint32_t SWIDTH; + uint32_t SWIDTHSW; + uint32_t SHEIGHT; + uint32_t YRGBSCALE; + uint32_t UVSCALE; + uint32_t OCLRC0; + uint32_t OCLRC1; + uint32_t DCLRKV; + uint32_t DCLRKM; + uint32_t SCLRKVH; + uint32_t SCLRKVL; + uint32_t SCLRKEN; + uint32_t OCONFIG; + uint32_t OCMD; + uint32_t RESERVED1; /* 0x6C */ + uint32_t OSTART_0Y; /* for i965 */ + uint32_t OSTART_1Y; /* for i965 */ + uint32_t OSTART_0U; + uint32_t OSTART_0V; + uint32_t OSTART_1U; + uint32_t OSTART_1V; + uint32_t OTILEOFF_0Y; + uint32_t OTILEOFF_1Y; + uint32_t OTILEOFF_0U; + uint32_t OTILEOFF_0V; + uint32_t OTILEOFF_1U; + uint32_t OTILEOFF_1V; + uint32_t FASTHSCALE; /* 0xA0 */ + uint32_t UVSCALEV; /* 0xA4 */ + + uint32_t RESERVEDC[(0x200 - 0xA8) / 4]; /* 0xA8 - 0x1FC */ + uint16_t Y_VCOEFS[N_VERT_Y_TAPS * N_PHASES]; /* 0x200 */ + uint16_t RESERVEDD[0x100 / 2 - N_VERT_Y_TAPS * N_PHASES]; + uint16_t Y_HCOEFS[N_HORIZ_Y_TAPS * N_PHASES]; /* 0x300 */ + uint16_t RESERVEDE[0x200 / 2 - N_HORIZ_Y_TAPS * N_PHASES]; + uint16_t UV_VCOEFS[N_VERT_UV_TAPS * N_PHASES]; /* 0x500 */ + uint16_t RESERVEDF[0x100 / 2 - N_VERT_UV_TAPS * N_PHASES]; + uint16_t UV_HCOEFS[N_HORIZ_UV_TAPS * N_PHASES]; /* 0x600 */ + uint16_t RESERVEDG[0x100 / 2 - N_HORIZ_UV_TAPS * N_PHASES]; } I830OverlayRegRec, *I830OverlayRegPtr; #define I830OVERLAYREG(pI830) ((I830OverlayRegPtr)\ @@ -354,10 +355,10 @@ typedef struct { (pI830)->overlay_regs->offset)) #if VIDEO_DEBUG static void -CompareOverlay(I830Ptr pI830, CARD32 * overlay, int size) +CompareOverlay(I830Ptr pI830, uint32_t * overlay, int size) { int i; - CARD32 val; + uint32_t val; int bad = 0; for (i = 0; i < size; i += 4) { @@ -397,9 +398,9 @@ i830_overlay_switch_to_crtc (ScrnInfoPtr pScrn, xf86CrtcPtr crtc) { int vtotal_reg = intel_crtc->pipe == 0 ? VTOTAL_A : VTOTAL_B; - CARD32 size = intel_crtc->pipe ? INREG(PIPEBSRC) : INREG(PIPEASRC); - CARD32 active; - CARD32 hsize, vsize; + uint32_t size = intel_crtc->pipe ? INREG(PIPEBSRC) : INREG(PIPEASRC); + uint32_t active; + uint32_t hsize, vsize; hsize = (size >> 16) & 0x7FF; vsize = size & 0x7FF; @@ -483,7 +484,7 @@ static void i830_overlay_continue(ScrnInfoPtr pScrn, Bool update_filter) { I830Ptr pI830 = I830PTR(pScrn); - CARD32 flip_addr; + uint32_t flip_addr; I830OverlayRegPtr overlay = I830OVERLAYREG(pI830); if (!*pI830->overlayOn) @@ -495,8 +496,7 @@ i830_overlay_continue(ScrnInfoPtr pScrn, Bool update_filter) flip_addr = pI830->overlay_regs->bus_addr; if (update_filter) flip_addr |= OFC_UPDATE; - OVERLAY_DEBUG ("overlay_continue cmd 0x%08" PRIx32 " -> 0x%08" PRIx32 - " sta 0x%08" PRIx32 "\n", + OVERLAY_DEBUG ("overlay_continue cmd 0x%08x -> 0x%08x sta 0x%08x\n", overlay->OCMD, INREG(OCMD_REGISTER), INREG(DOVSTA)); BEGIN_LP_RING(4); OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE); @@ -536,7 +536,7 @@ i830_overlay_off(ScrnInfoPtr pScrn) */ { overlay->OCMD &= ~OVERLAY_ENABLE; - OVERLAY_DEBUG ("overlay_off cmd 0x%08" PRIx32 " -> 0x%08" PRIx32 " sta 0x%08" PRIx32 "\n", + OVERLAY_DEBUG ("overlay_off cmd 0x%08x -> 0x%08x sta 0x%08x\n", overlay->OCMD, INREG(OCMD_REGISTER), INREG(DOVSTA)); BEGIN_LP_RING(6); OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE); @@ -734,7 +734,7 @@ I830SetOneLineModeRatio(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); I830PortPrivPtr pPriv = pI830->adaptor->pPortPrivates[0].ptr; - CARD32 panelFitControl = INREG(PFIT_CONTROLS); + uint32_t panelFitControl = INREG(PFIT_CONTROLS); int vertScale; pPriv->scaleRatio = 0x10000; @@ -758,7 +758,7 @@ I830SetOneLineModeRatio(ScrnInfoPtr pScrn) pPriv->oneLineMode = FALSE; } -static CARD32 I830BoundGammaElt (CARD32 elt, CARD32 eltPrev) +static uint32_t I830BoundGammaElt (uint32_t elt, uint32_t eltPrev) { elt &= 0xff; eltPrev &= 0xff; @@ -769,7 +769,7 @@ static CARD32 I830BoundGammaElt (CARD32 elt, CARD32 eltPrev) return elt; } -static CARD32 I830BoundGamma (CARD32 gamma, CARD32 gammaPrev) +static uint32_t I830BoundGamma (uint32_t gamma, uint32_t gammaPrev) { return (I830BoundGammaElt (gamma >> 24, gammaPrev >> 24) << 24 | I830BoundGammaElt (gamma >> 16, gammaPrev >> 16) << 16 | @@ -782,12 +782,12 @@ I830UpdateGamma(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); I830PortPrivPtr pPriv = pI830->adaptor->pPortPrivates[0].ptr; - CARD32 gamma0 = pPriv->gamma0; - CARD32 gamma1 = pPriv->gamma1; - CARD32 gamma2 = pPriv->gamma2; - CARD32 gamma3 = pPriv->gamma3; - CARD32 gamma4 = pPriv->gamma4; - CARD32 gamma5 = pPriv->gamma5; + uint32_t gamma0 = pPriv->gamma0; + uint32_t gamma1 = pPriv->gamma1; + uint32_t gamma2 = pPriv->gamma2; + uint32_t gamma3 = pPriv->gamma3; + uint32_t gamma4 = pPriv->gamma4; + uint32_t gamma5 = pPriv->gamma5; #if 0 ErrorF ("Original gamma: 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n", @@ -982,7 +982,7 @@ I830SetupImageVideoTextured(ScreenPtr pScreen) adapt->GetVideo = NULL; adapt->GetStill = NULL; adapt->StopVideo = I830StopVideo; - adapt->SetPortAttribute = I830SetPortAttribute; + adapt->SetPortAttribute = I830SetPortAttributeTextured; adapt->GetPortAttribute = I830GetPortAttribute; adapt->QueryBestSize = I830QueryBestSize; adapt->PutImage = I830PutImage; @@ -1071,6 +1071,27 @@ I830StopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) } static int +I830SetPortAttributeTextured(ScrnInfoPtr pScrn, + Atom attribute, INT32 value, pointer data) +{ + I830PortPrivPtr pPriv = (I830PortPrivPtr) data; + + if (attribute == xvBrightness) { + if ((value < -128) || (value > 127)) + return BadValue; + pPriv->brightness = value; + return Success; + } else if (attribute == xvContrast) { + if ((value < 0) || (value > 255)) + return BadValue; + pPriv->contrast = value; + return Success; + } else { + return BadMatch; + } +} + +static int I830SetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value, pointer data) { @@ -1078,14 +1099,6 @@ I830SetPortAttribute(ScrnInfoPtr pScrn, I830Ptr pI830 = I830PTR(pScrn); I830OverlayRegPtr overlay; - if (pPriv->textured) { - /* XXX: Currently the brightness/saturation attributes aren't hooked up. - * However, apps expect them to be there, and the spec seems to let us - * sneak out of actually implementing them for now. - */ - return Success; - } - overlay = I830OVERLAYREG(pI830); if (attribute == xvBrightness) { @@ -1336,7 +1349,7 @@ I830CopyPlanarToPackedData(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int top, int left, int h, int w, int id) { I830Ptr pI830 = I830PTR(pScrn); - CARD8 *dst1, *srcy, *srcu, *srcv; + uint8_t *dst1, *srcy, *srcu, *srcv; int y; if (pPriv->currentBuf == 0) @@ -1356,10 +1369,10 @@ I830CopyPlanarToPackedData(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, } for (y = 0; y < h; y++) { - CARD32 *dst = (CARD32 *)dst1; - CARD8 *sy = srcy; - CARD8 *su = srcu; - CARD8 *sv = srcv; + uint32_t *dst = (uint32_t *)dst1; + uint8_t *sy = srcy; + uint8_t *su = srcu; + uint8_t *sv = srcv; int i; i = w / 2; @@ -1566,9 +1579,9 @@ I830CopyPlanarData(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, } typedef struct { - CARD8 sign; - CARD16 mantissa; - CARD8 exponent; + uint8_t sign; + uint16_t mantissa; + uint8_t exponent; } coeffRec, *coeffPtr; static Bool @@ -1794,14 +1807,14 @@ i830_display_video(ScrnInfoPtr pScrn, xf86CrtcPtr crtc, unsigned int swidth, swidthy, swidthuv; unsigned int mask, shift, offsety, offsetu; int tmp; - CARD32 OCMD; + uint32_t OCMD; Bool scaleChanged = FALSE; OVERLAY_DEBUG("I830DisplayVideo: %dx%d (pitch %d)\n", width, height, dstPitch); #if VIDEO_DEBUG - CompareOverlay(pI830, (CARD32 *) overlay, 0x100); + CompareOverlay(pI830, (uint32_t *) overlay, 0x100); #endif /* @@ -1956,7 +1969,7 @@ i830_display_video(ScrnInfoPtr pScrn, xf86CrtcPtr crtc, overlay->OBUF_1V = pPriv->VBuf1offset; } - OVERLAY_DEBUG("pos: 0x%" PRIx32 ", size: 0x%" PRIx32 "\n", + OVERLAY_DEBUG("pos: 0x%x, size: 0x%x\n", overlay->DWINPOS, overlay->DWINSZ); OVERLAY_DEBUG("dst: %d x %d, src: %d x %d\n", drw_w, drw_h, src_w, src_h); @@ -1971,7 +1984,7 @@ i830_display_video(ScrnInfoPtr pScrn, xf86CrtcPtr crtc, int yscaleIntUV, yscaleFractUV; /* UV is half the size of Y -- YUV420 */ int uvratio = 2; - CARD32 newval; + uint32_t newval; coeffRec xcoeffY[N_HORIZ_Y_TAPS * N_PHASES]; coeffRec xcoeffUV[N_HORIZ_UV_TAPS * N_PHASES]; int i, j, pos; @@ -2118,7 +2131,7 @@ i830_display_video(ScrnInfoPtr pScrn, xf86CrtcPtr crtc, OCMD |= BUFFER1; overlay->OCMD = OCMD; - OVERLAY_DEBUG("OCMD is 0x%" PRIx32 "\n", OCMD); + OVERLAY_DEBUG("OCMD is 0x%x\n", OCMD); /* make sure the overlay is on */ i830_overlay_on (pScrn); @@ -2171,7 +2184,7 @@ i830_clip_video_helper (ScrnInfoPtr pScrn, } static void -i830_fill_colorkey (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes) +i830_fill_colorkey (ScreenPtr pScreen, uint32_t key, RegionPtr clipboxes) { DrawablePtr root = &WindowTable[pScreen->myNum]->drawable; XID pval[2]; diff --git a/src/i830_video.h b/src/i830_video.h index 17689138..52e6b4f8 100644 --- a/src/i830_video.h +++ b/src/i830_video.h @@ -28,13 +28,13 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xf86_OSproc.h" typedef struct { - CARD32 YBuf0offset; - CARD32 UBuf0offset; - CARD32 VBuf0offset; + uint32_t YBuf0offset; + uint32_t UBuf0offset; + uint32_t VBuf0offset; - CARD32 YBuf1offset; - CARD32 UBuf1offset; - CARD32 VBuf1offset; + uint32_t YBuf1offset; + uint32_t UBuf1offset; + uint32_t VBuf1offset; unsigned char currentBuf; @@ -46,16 +46,16 @@ typedef struct { int doubleBuffer; RegionRec clip; - CARD32 colorKey; + uint32_t colorKey; - CARD32 gamma0; - CARD32 gamma1; - CARD32 gamma2; - CARD32 gamma3; - CARD32 gamma4; - CARD32 gamma5; + uint32_t gamma0; + uint32_t gamma1; + uint32_t gamma2; + uint32_t gamma3; + uint32_t gamma4; + uint32_t gamma5; - CARD32 videoStatus; + uint32_t videoStatus; Time offTime; Time freeTime; i830_memory *buf; /** YUV data buffer */ diff --git a/src/i915_3d.h b/src/i915_3d.h index 10902186..c2efe9ae 100644 --- a/src/i915_3d.h +++ b/src/i915_3d.h @@ -61,6 +61,10 @@ #define FS_C1 ((REG_TYPE_CONST << 8) | 1) #define FS_C2 ((REG_TYPE_CONST << 8) | 2) #define FS_C3 ((REG_TYPE_CONST << 8) | 3) +#define FS_C4 ((REG_TYPE_CONST << 8) | 4) +#define FS_C5 ((REG_TYPE_CONST << 8) | 5) +#define FS_C6 ((REG_TYPE_CONST << 8) | 6) +#define FS_C7 ((REG_TYPE_CONST << 8) | 7) /* Sampler regs */ #define FS_S0 ((REG_TYPE_S << 8) | 0) @@ -84,7 +88,7 @@ #define REG_NR(reg) ((reg) & 0xff) struct i915_fs_op { - CARD32 ui[3]; + uint32_t ui[3]; }; #define X_CHANNEL_VAL 1 @@ -415,7 +419,7 @@ do { \ * a FS_START and FS_END */ #define FS_LOCALS(x) \ - CARD32 _shader_buf[(x) * 3]; \ + uint32_t _shader_buf[(x) * 3]; \ int _max_shader_commands = x; \ int _cur_shader_commands diff --git a/src/i915_render.c b/src/i915_render.c index ca85bf73..7c45c807 100644 --- a/src/i915_render.c +++ b/src/i915_render.c @@ -54,14 +54,14 @@ do { \ struct formatinfo { int fmt; - CARD32 card_fmt; + uint32_t card_fmt; }; struct blendinfo { Bool dst_alpha; Bool src_alpha; - CARD32 src_blend; - CARD32 dst_blend; + uint32_t src_blend; + uint32_t dst_blend; }; static struct blendinfo i915_blend_op[] = { @@ -106,9 +106,10 @@ static struct formatinfo i915_tex_formats[] = { {PICT_a8, MAPSURF_8BIT | MT_8BIT_A8 }, }; -static CARD32 i915_get_blend_cntl(int op, PicturePtr pMask, CARD32 dst_format) +static uint32_t i915_get_blend_cntl(int op, PicturePtr pMask, + uint32_t dst_format) { - CARD32 sblend, dblend; + uint32_t sblend, dblend; sblend = i915_blend_op[op].src_blend; dblend = i915_blend_op[op].dst_blend; @@ -152,7 +153,7 @@ static CARD32 i915_get_blend_cntl(int op, PicturePtr pMask, CARD32 dst_format) (dblend << S6_CBUF_DST_BLEND_FACT_SHIFT); } -static Bool i915_get_dest_format(PicturePtr pDstPicture, CARD32 *dst_format) +static Bool i915_get_dest_format(PicturePtr pDstPicture, uint32_t *dst_format) { switch (pDstPicture->format) { case PICT_a8r8g8b8: @@ -215,7 +216,7 @@ Bool i915_check_composite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture) { - CARD32 tmp1; + uint32_t tmp1; /* Check for unsupported compositing operations. */ if (op >= sizeof(i915_blend_op) / sizeof(i915_blend_op[0])) @@ -249,9 +250,9 @@ i915_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit) { ScrnInfoPtr pScrn = xf86Screens[pPict->pDrawable->pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); - CARD32 format, offset, pitch, filter; + uint32_t format, offset, pitch, filter; int w, h, i; - CARD32 wrap_mode = TEXCOORDMODE_CLAMP_BORDER; + uint32_t wrap_mode = TEXCOORDMODE_CLAMP_BORDER; offset = intel_get_pixmap_offset(pPix); pitch = intel_get_pixmap_pitch(pPix); @@ -315,14 +316,15 @@ i915_prepare_composite(int op, PicturePtr pSrcPicture, { ScrnInfoPtr pScrn = xf86Screens[pSrcPicture->pDrawable->pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); - CARD32 dst_format, dst_offset, dst_pitch; - CARD32 blendctl; + uint32_t dst_format, dst_offset, dst_pitch; + uint32_t blendctl; int out_reg = FS_OC; IntelEmitInvarientState(pScrn); *pI830->last_3d = LAST_3D_RENDER; - i915_get_dest_format(pDstPicture, &dst_format); + if (!i915_get_dest_format(pDstPicture, &dst_format)) + return FALSE; dst_offset = intel_get_pixmap_offset(pDst); dst_pitch = intel_get_pixmap_pitch(pDst); FS_LOCALS(20); @@ -374,7 +376,7 @@ i915_prepare_composite(int op, PicturePtr pSrcPicture, ADVANCE_LP_RING(); } { - CARD32 ss2; + uint32_t ss2; BEGIN_LP_RING(16); OUT_RING(_3DSTATE_BUF_INFO_CMD); diff --git a/src/i915_video.c b/src/i915_video.c index 00494a7b..7416efcd 100644 --- a/src/i915_video.c +++ b/src/i915_video.c @@ -48,7 +48,7 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, PixmapPtr pPixmap) { I830Ptr pI830 = I830PTR(pScrn); - CARD32 format, ms3, s5; + uint32_t format, ms3, s5; BoxPtr pbox; int nbox, dxo, dyo, pix_xoff, pix_yoff; Bool planar; @@ -132,9 +132,17 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, ADVANCE_LP_RING(); if (!planar) { - FS_LOCALS(3); + FS_LOCALS(10); + + BEGIN_LP_RING(16); + OUT_RING(_3DSTATE_PIXEL_SHADER_CONSTANTS | 4); + OUT_RING(0x0000001); /* constant 0 */ + /* constant 0: brightness/contrast */ + OUT_RING_F(pPriv->brightness / 128.0); + OUT_RING_F(pPriv->contrast / 255.0); + OUT_RING_F(0.0); + OUT_RING_F(0.0); - BEGIN_LP_RING(10); OUT_RING(_3DSTATE_SAMPLER_STATE | 3); OUT_RING(0x00000001); OUT_RING(SS2_COLORSPACE_CONVERSION | @@ -162,17 +170,23 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, ms3 |= (width - 1) << MS3_WIDTH_SHIFT; OUT_RING(ms3); OUT_RING(((video_pitch / 4) - 1) << MS4_PITCH_SHIFT); + ADVANCE_LP_RING(); FS_BEGIN(); i915_fs_dcl(FS_S0); i915_fs_dcl(FS_T0); i915_fs_texld(FS_OC, FS_S0, FS_T0); + if (pPriv->brightness != 0) { + i915_fs_add(FS_OC, + i915_fs_operand_reg(FS_OC), + i915_fs_operand(FS_C0, X, X, X, ZERO)); + } FS_END(); } else { FS_LOCALS(16); - BEGIN_LP_RING(18 + 11 + 11); + BEGIN_LP_RING(22 + 11 + 11); /* For the planar formats, we set up three samplers -- one for each plane, * in a Y8 format. Because I couldn't get the special PLANAR_TO_PACKED * shader setup to work, I did the manual pixel shader: @@ -192,8 +206,8 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, * r3 = (v,v,v,v) * OC = (r,g,b,1) */ - OUT_RING(_3DSTATE_PIXEL_SHADER_CONSTANTS | 16); - OUT_RING(0x000000f); /* constants 0-3 */ + OUT_RING(_3DSTATE_PIXEL_SHADER_CONSTANTS | (22 - 2)); + OUT_RING(0x000001f); /* constants 0-4 */ /* constant 0: normalization offsets */ OUT_RING_F(-0.0625); OUT_RING_F(-0.5); @@ -214,6 +228,11 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, OUT_RING_F(2.017); OUT_RING_F(0.0); OUT_RING_F(0.0); + /* constant 4: brightness/contrast */ + OUT_RING_F(pPriv->brightness / 128.0); + OUT_RING_F(pPriv->contrast / 255.0); + OUT_RING_F(0.0); + OUT_RING_F(0.0); OUT_RING(_3DSTATE_SAMPLER_STATE | 9); OUT_RING(0x00000007); @@ -305,6 +324,12 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, * the source. */ i915_fs_mov_masked(FS_OC, MASK_W, i915_fs_operand_one()); + + if (pPriv->brightness != 0) { + i915_fs_add(FS_OC, + i915_fs_operand_reg(FS_OC), + i915_fs_operand(FS_C4, X, X, X, ZERO)); + } FS_END(); } diff --git a/src/i965_render.c b/src/i965_render.c index 4b1d7f3e..172a1dc1 100644 --- a/src/i965_render.c +++ b/src/i965_render.c @@ -59,13 +59,13 @@ do { \ struct blendinfo { Bool dst_alpha; Bool src_alpha; - CARD32 src_blend; - CARD32 dst_blend; + uint32_t src_blend; + uint32_t dst_blend; }; struct formatinfo { int fmt; - CARD32 card_fmt; + uint32_t card_fmt; }; // refer vol2, 3d rasterization 3.8.1 @@ -113,8 +113,8 @@ static struct formatinfo i965_tex_formats[] = { {PICT_a8, BRW_SURFACEFORMAT_A8_UNORM }, }; -static void i965_get_blend_cntl(int op, PicturePtr pMask, CARD32 dst_format, - CARD32 *sblend, CARD32 *dblend) +static void i965_get_blend_cntl(int op, PicturePtr pMask, uint32_t dst_format, + uint32_t *sblend, uint32_t *dblend) { *sblend = i965_blend_op[op].src_blend; @@ -145,7 +145,7 @@ static void i965_get_blend_cntl(int op, PicturePtr pMask, CARD32 dst_format, } -static Bool i965_get_dest_format(PicturePtr pDstPicture, CARD32 *dst_format) +static Bool i965_get_dest_format(PicturePtr pDstPicture, uint32_t *dst_format) { switch (pDstPicture->format) { case PICT_a8r8g8b8: @@ -212,7 +212,7 @@ Bool i965_check_composite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture) { - CARD32 tmp1; + uint32_t tmp1; /* Check for unsupported compositing operations. */ if (op >= sizeof(i965_blend_op) / sizeof(i965_blend_op[0])) @@ -271,7 +271,7 @@ static struct brw_instruction *sf_kernel; static struct brw_instruction *ps_kernel; static struct brw_instruction *sip_kernel; -static CARD32 *binding_table; +static uint32_t *binding_table; static int binding_table_entries; static int dest_surf_offset, src_surf_offset, mask_surf_offset; @@ -287,9 +287,9 @@ static int state_base_offset; static float *vb; static int vb_size = (6 * 4) * 4 ; /* 6 DWORDS per vertex - and mask*/ -static CARD32 src_blend, dst_blend; +static uint32_t src_blend, dst_blend; -static const CARD32 sip_kernel_static[][4] = { +static const uint32_t sip_kernel_static[][4] = { /* wait (1) a0<1>UW a145<0,1,0>UW { align1 + } */ { 0x00000030, 0x20000108, 0x00001220, 0x00000000 }, /* nop (4) g0<1>UD { align1 + } */ @@ -320,15 +320,15 @@ static const CARD32 sip_kernel_static[][4] = { #define SF_KERNEL_NUM_GRF 16 #define SF_MAX_THREADS 1 -static const CARD32 sf_kernel_static[][4] = { +static const uint32_t sf_kernel_static[][4] = { #include "exa_sf_prog.h" }; -static const CARD32 sf_kernel_static_mask[][4] = { +static const uint32_t sf_kernel_static_mask[][4] = { #include "exa_sf_mask_prog.h" }; -static const CARD32 sf_kernel_static_rotation[][4] = { +static const uint32_t sf_kernel_static_rotation[][4] = { #include "exa_sf_rotation_prog.h" }; @@ -336,27 +336,27 @@ static const CARD32 sf_kernel_static_rotation[][4] = { #define PS_KERNEL_NUM_GRF 32 #define PS_MAX_THREADS 32 -static const CARD32 ps_kernel_static_nomask [][4] = { +static const uint32_t ps_kernel_static_nomask [][4] = { #include "exa_wm_nomask_prog.h" }; -static const CARD32 ps_kernel_static_maskca [][4] = { +static const uint32_t ps_kernel_static_maskca [][4] = { #include "exa_wm_maskca_prog.h" }; -static const CARD32 ps_kernel_static_maskca_srcalpha [][4] = { +static const uint32_t ps_kernel_static_maskca_srcalpha [][4] = { #include "exa_wm_maskca_srcalpha_prog.h" }; -static const CARD32 ps_kernel_static_masknoca [][4] = { +static const uint32_t ps_kernel_static_masknoca [][4] = { #include "exa_wm_masknoca_prog.h" }; -static const CARD32 ps_kernel_static_rotation [][4] = { +static const uint32_t ps_kernel_static_rotation [][4] = { #include "exa_wm_rotation_prog.h" }; -static CARD32 +static uint32_t i965_get_card_format(PicturePtr pPict) { int i; @@ -392,10 +392,10 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture, { ScrnInfoPtr pScrn = xf86Screens[pSrcPicture->pDrawable->pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); - CARD32 src_offset, src_pitch, src_tile_format = 0, src_tiled = 0; - CARD32 mask_offset = 0, mask_pitch = 0, mask_tile_format = 0, + uint32_t src_offset, src_pitch, src_tile_format = 0, src_tiled = 0; + uint32_t mask_offset = 0, mask_pitch = 0, mask_tile_format = 0, mask_tiled = 0; - CARD32 dst_format, dst_offset, dst_pitch, dst_tile_format = 0, + uint32_t dst_format, dst_offset, dst_pitch, dst_tile_format = 0, dst_tiled = 0; Bool rotation_program = FALSE; @@ -629,7 +629,8 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture, memset(dest_surf_state, 0, sizeof(*dest_surf_state)); dest_surf_state->ss0.surface_type = BRW_SURFACE_2D; dest_surf_state->ss0.data_return_format = BRW_SURFACERETURNFORMAT_FLOAT32; - i965_get_dest_format(pDstPicture, &dst_format); + if (!i965_get_dest_format(pDstPicture, &dst_format)) + return FALSE; dest_surf_state->ss0.surface_format = dst_format; dest_surf_state->ss0.writedisable_alpha = 0; diff --git a/src/i965_video.c b/src/i965_video.c index 928b52b7..f84c6647 100644 --- a/src/i965_video.c +++ b/src/i965_video.c @@ -45,7 +45,7 @@ #undef NDEBUG #include <assert.h> -static const CARD32 sip_kernel_static[][4] = { +static const uint32_t sip_kernel_static[][4] = { /* wait (1) a0<1>UW a145<0,1,0>UW { align1 + } */ { 0x00000030, 0x20000108, 0x00001220, 0x00000000 }, /* nop (4) g0<1>UD { align1 + } */ @@ -77,7 +77,7 @@ static const CARD32 sip_kernel_static[][4] = { #define SF_KERNEL_NUM_GRF 16 #define SF_MAX_THREADS 1 -static const CARD32 sf_kernel_static[][4] = { +static const uint32_t sf_kernel_static[][4] = { #include "sf_prog.h" }; @@ -93,7 +93,7 @@ static const CARD32 sf_kernel_static[][4] = { #define BRW_GRF_BLOCKS(nreg) ((nreg + 15) / 16 - 1) -static const CARD32 ps_kernel_static[][4] = { +static const uint32_t ps_kernel_static[][4] = { #include "wm_prog.h" }; @@ -102,15 +102,15 @@ static const CARD32 ps_kernel_static[][4] = { #define WM_BINDING_TABLE_ENTRIES 2 -static CARD32 float_to_uint (float f) { - union {CARD32 i; float f;} x; +static uint32_t float_to_uint (float f) { + union {uint32_t i; float f;} x; x.f = f; return x.i; } #if 0 static struct { - CARD32 svg_ctl; + uint32_t svg_ctl; char *name; } svg_ctl_bits[] = { { BRW_SVG_CTL_GS_BA, "General State Base Address" }, @@ -127,7 +127,7 @@ brw_debug (ScrnInfoPtr pScrn, char *when) { I830Ptr pI830 = I830PTR(pScrn); int i; - CARD32 v; + uint32_t v; I830Sync (pScrn); ErrorF("brw_debug: %s\n", when); @@ -173,7 +173,7 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, struct brw_instruction *sip_kernel; float *vb; float src_scale_x, src_scale_y; - CARD32 *binding_table; + uint32_t *binding_table; Bool first_output = TRUE; int dest_surf_offset, src_surf_offset, src_sampler_offset, vs_offset; int sf_offset, wm_offset, cc_offset, vb_offset, cc_viewport_offset; diff --git a/src/ivch/ivch.c b/src/ivch/ivch.c index 820919fb..873afcc9 100644 --- a/src/ivch/ivch.c +++ b/src/ivch/ivch.c @@ -50,26 +50,25 @@ struct ivch_priv { xf86OutputPtr output; Bool quiet; - CARD16 width; - CARD16 height; + uint16_t width, height; - CARD16 save_VR01; - CARD16 save_VR40; + uint16_t save_VR01; + uint16_t save_VR40; }; struct vch_capabilities { struct aimdb_block aimdb_block; - CARD8 panel_type; - CARD8 set_panel_type; - CARD8 slave_address; - CARD8 capabilities; + uint8_t panel_type; + uint8_t set_panel_type; + uint8_t slave_address; + uint8_t capabilities; #define VCH_PANEL_FITTING_SUPPORT (0x3 << 0) #define VCH_PANEL_FITTING_TEXT (1 << 2) #define VCH_PANEL_FITTING_GRAPHICS (1 << 3) #define VCH_PANEL_FITTING_RATIO (1 << 4) #define VCH_DITHERING (1 << 5) - CARD8 backlight_gpio; - CARD8 set_panel_type_us_gpios; + uint8_t backlight_gpio; + uint8_t set_panel_type_us_gpios; } __attribute__ ((packed)); static void @@ -81,7 +80,7 @@ ivch_dump_regs(I2CDevPtr d); * Each of the 256 registers are 16 bits long. */ static Bool -ivch_read(struct ivch_priv *priv, int addr, CARD16 *data) +ivch_read(struct ivch_priv *priv, int addr, uint16_t *data) { I2CBusPtr b = priv->d.pI2CBus; I2CByte *p = (I2CByte *) data; @@ -118,7 +117,7 @@ ivch_read(struct ivch_priv *priv, int addr, CARD16 *data) /** Writes a 16-bit register on the ivch */ static Bool -ivch_write(struct ivch_priv *priv, int addr, CARD16 data) +ivch_write(struct ivch_priv *priv, int addr, uint16_t data) { I2CBusPtr b = priv->d.pI2CBus; @@ -158,7 +157,7 @@ static void * ivch_init(I2CBusPtr b, I2CSlaveAddr addr) { struct ivch_priv *priv; - CARD16 temp; + uint16_t temp; priv = xcalloc(1, sizeof(struct ivch_priv)); if (priv == NULL) @@ -226,7 +225,7 @@ ivch_dpms(I2CDevPtr d, int mode) { struct ivch_priv *priv = d->DriverPrivate.ptr; int i; - CARD16 vr01, vr30, backlight; + uint16_t vr01, vr30, backlight; /* Set the new power state of the panel. */ if (!ivch_read(priv, VR01, &vr01)) @@ -262,8 +261,8 @@ static void ivch_mode_set(I2CDevPtr d, DisplayModePtr mode, DisplayModePtr adjusted_mode) { struct ivch_priv *priv = d->DriverPrivate.ptr; - CARD16 vr40 = 0; - CARD16 vr01; + uint16_t vr40 = 0; + uint16_t vr01; vr01 = 0; vr40 = (VR40_STALL_ENABLE | @@ -273,7 +272,7 @@ ivch_mode_set(I2CDevPtr d, DisplayModePtr mode, DisplayModePtr adjusted_mode) if (mode->HDisplay != adjusted_mode->HDisplay || mode->VDisplay != adjusted_mode->VDisplay) { - CARD16 x_ratio, y_ratio; + uint16_t x_ratio, y_ratio; vr01 |= VR01_PANEL_FIT_ENABLE; vr40 |= VR40_CLOCK_GATING_ENABLE; @@ -299,7 +298,7 @@ static void ivch_dump_regs(I2CDevPtr d) { struct ivch_priv *priv = d->DriverPrivate.ptr; - CARD16 val; + uint16_t val; ivch_read(priv, VR00, &val); xf86DrvMsg(priv->d.pI2CBus->scrnIndex, X_INFO, "VR00: 0x%04x\n", val); diff --git a/src/reg_dumper/reg_dumper.h b/src/reg_dumper/reg_dumper.h index 07ddf6fd..769adb27 100644 --- a/src/reg_dumper/reg_dumper.h +++ b/src/reg_dumper/reg_dumper.h @@ -36,7 +36,6 @@ * use i830_debug.c mostly unmodified. */ -typedef uint32_t CARD32; typedef char Bool; #define FALSE 0 diff --git a/src/sil164/sil164.c b/src/sil164/sil164.c index f7d414a2..410a681f 100644 --- a/src/sil164/sil164.c +++ b/src/sil164/sil164.c @@ -31,6 +31,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "config.h" #endif +#include <stdint.h> + #include "xf86.h" #include "xf86_OSproc.h" #include "xf86Resources.h" @@ -45,8 +47,23 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sil164.h" #include "sil164_reg.h" +typedef struct _Sil164SaveRec { + uint8_t reg8; + uint8_t reg9; + uint8_t regc; +} SIL164SaveRec; + +typedef struct { + I2CDevRec d; + Bool quiet; + SIL164SaveRec SavedReg; + SIL164SaveRec ModeReg; +} SIL164Rec, *SIL164Ptr; + +#define SILPTR(d) ((SIL164Ptr)(d->DriverPrivate.ptr)) + static Bool -sil164ReadByte(SIL164Ptr sil, int addr, CARD8 *ch) +sil164ReadByte(SIL164Ptr sil, int addr, uint8_t *ch) { if (!xf86I2CReadByte(&(sil->d), addr, ch)) { if (!sil->quiet) { @@ -60,7 +77,7 @@ sil164ReadByte(SIL164Ptr sil, int addr, CARD8 *ch) } static Bool -sil164WriteByte(SIL164Ptr sil, int addr, CARD8 ch) +sil164WriteByte(SIL164Ptr sil, int addr, uint8_t ch) { if (!xf86I2CWriteByte(&(sil->d), addr, ch)) { if (!sil->quiet) { @@ -131,7 +148,7 @@ static xf86OutputStatus sil164_detect(I2CDevPtr d) { SIL164Ptr sil = SILPTR(d); - CARD8 reg9; + uint8_t reg9; sil164ReadByte(sil, SIL164_REG9, ®9); @@ -190,7 +207,7 @@ static void sil164_dump_regs(I2CDevPtr d) { SIL164Ptr sil = SILPTR(d); - CARD8 val; + uint8_t val; sil164ReadByte(sil, SIL164_FREQ_LO, &val); xf86DrvMsg(sil->d.pI2CBus->scrnIndex, X_INFO, "SIL164_FREQ_LO: 0x%02x\n", diff --git a/src/sil164/sil164_reg.h b/src/sil164/sil164_reg.h index 734e55dd..151b430f 100644 --- a/src/sil164/sil164_reg.h +++ b/src/sil164/sil164_reg.h @@ -57,19 +57,4 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define SIL164_REGC 0x0c -typedef struct _Sil164SaveRec { - CARD8 reg8; - CARD8 reg9; - CARD8 regc; -} SIL164SaveRec; - -typedef struct { - I2CDevRec d; - Bool quiet; - SIL164SaveRec SavedReg; - SIL164SaveRec ModeReg; -} SIL164Rec, *SIL164Ptr; - -#define SILPTR(d) ((SIL164Ptr)(d->DriverPrivate.ptr)) - #endif diff --git a/src/tfp410/tfp410.c b/src/tfp410/tfp410.c index bb038cdb..c2c4fc3d 100644 --- a/src/tfp410/tfp410.c +++ b/src/tfp410/tfp410.c @@ -30,6 +30,8 @@ #include "config.h" #endif +#include <stdint.h> + #include "xf86.h" #include "xf86_OSproc.h" #include "xf86Resources.h" @@ -44,8 +46,23 @@ #include "tfp410.h" #include "tfp410_reg.h" +typedef struct _TFP410SaveRec { + uint8_t ctl1; + uint8_t ctl2; +} TFP410SaveRec; + +typedef struct { + I2CDevRec d; + Bool quiet; + + TFP410SaveRec SavedReg; + TFP410SaveRec ModeReg; +} TFP410Rec, *TFP410Ptr; + +#define TFPPTR(d) ((TFP410Ptr)(d->DriverPrivate.ptr)) + static Bool -tfp410ReadByte(TFP410Ptr tfp, int addr, CARD8 *ch) +tfp410ReadByte(TFP410Ptr tfp, int addr, uint8_t *ch) { if (!xf86I2CReadByte(&(tfp->d), addr, ch)) { if (!tfp->quiet) { @@ -59,7 +76,7 @@ tfp410ReadByte(TFP410Ptr tfp, int addr, CARD8 *ch) } static Bool -tfp410WriteByte(TFP410Ptr tfp, int addr, CARD8 ch) +tfp410WriteByte(TFP410Ptr tfp, int addr, uint8_t ch) { if (!xf86I2CWriteByte(&(tfp->d), addr, ch)) { if (!tfp->quiet) { @@ -191,7 +208,7 @@ static void tfp410_dump_regs(I2CDevPtr d) { TFP410Ptr tfp = TFPPTR(d); - CARD8 val, val2; + uint8_t val, val2; tfp410ReadByte(tfp, TFP410_REV, &val); xf86DrvMsg(tfp->d.pI2CBus->scrnIndex, X_INFO, diff --git a/src/tfp410/tfp410_reg.h b/src/tfp410/tfp410_reg.h index c555b977..5bfe28b2 100644 --- a/src/tfp410/tfp410_reg.h +++ b/src/tfp410/tfp410_reg.h @@ -88,19 +88,4 @@ #define TFP410_V_RES_LO 0x3C #define TFP410_V_RES_HI 0x3D -typedef struct _TFP410SaveRec { - CARD8 ctl1; - CARD8 ctl2; -} TFP410SaveRec; - -typedef struct { - I2CDevRec d; - Bool quiet; - - TFP410SaveRec SavedReg; - TFP410SaveRec ModeReg; -} TFP410Rec, *TFP410Ptr; - -#define TFPPTR(d) ((TFP410Ptr)(d->DriverPrivate.ptr)) - #endif |