diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-09-17 22:27:45 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-09-18 12:49:41 +0100 |
commit | dcf9b5ae1889926007cf8a0efd127e9df3c909de (patch) | |
tree | a2788c2cff723b3dcb6587dc022596809c5038b0 /src | |
parent | 97b443f589fb62ba060f09a371be273549f524d0 (diff) |
intel: Compile fixes for base install of SLED11.sp3
Highlights of that distribution include xorg-xserver-1.6.5, kernel
3.0.76 and gcc-4.3.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
44 files changed, 396 insertions, 110 deletions
diff --git a/src/intel_device.c b/src/intel_device.c index b3926df9..92472c54 100644 --- a/src/intel_device.c +++ b/src/intel_device.c @@ -40,6 +40,8 @@ #include <sys/ioctl.h> #include <pciaccess.h> + +#include <xorg-server.h> #include <xf86.h> #include <xf86drm.h> #include <xf86drmMode.h> diff --git a/src/intel_module.c b/src/intel_module.c index f61b6886..ca8eacd7 100644 --- a/src/intel_module.c +++ b/src/intel_module.c @@ -28,9 +28,11 @@ #include "config.h" #endif +#include <xorg-server.h> +#include <xorgVersion.h> + #include <xf86.h> #include <xf86Parser.h> -#include <xorgVersion.h> #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,6,99,0,0) #include <xf86Resources.h> diff --git a/src/legacy/i810/i810_accel.c b/src/legacy/i810/i810_accel.c index aa2c4df3..caf68d93 100644 --- a/src/legacy/i810/i810_accel.c +++ b/src/legacy/i810/i810_accel.c @@ -36,6 +36,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ +#include "xorg-server.h" #include "xf86.h" #include "xaarop.h" #include "i810.h" diff --git a/src/legacy/i810/i810_cursor.c b/src/legacy/i810/i810_cursor.c index 580fe4b0..2ac03e9b 100644 --- a/src/legacy/i810/i810_cursor.c +++ b/src/legacy/i810/i810_cursor.c @@ -39,6 +39,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ +#include "xorg-server.h" #include "xf86.h" #include "xf86_OSproc.h" #include "compiler.h" diff --git a/src/legacy/i810/i810_dga.c b/src/legacy/i810/i810_dga.c index 81e17672..bbdf7b37 100644 --- a/src/legacy/i810/i810_dga.c +++ b/src/legacy/i810/i810_dga.c @@ -26,6 +26,7 @@ #include "config.h" #endif +#include "xorg-server.h" #include "xf86.h" #include "xf86_OSproc.h" #include "xf86Pci.h" diff --git a/src/legacy/i810/i810_dri.c b/src/legacy/i810/i810_dri.c index 26ad8559..cca35d66 100644 --- a/src/legacy/i810/i810_dri.c +++ b/src/legacy/i810/i810_dri.c @@ -7,6 +7,7 @@ #include <string.h> #include <assert.h> +#include "xorg-server.h" #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/legacy/i810/i810_driver.c b/src/legacy/i810/i810_driver.c index 9f684d25..d647cb31 100644 --- a/src/legacy/i810/i810_driver.c +++ b/src/legacy/i810/i810_driver.c @@ -53,6 +53,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* * These are X and server generic header files. */ +#include "xorg-server.h" #include "xf86.h" #include "xf86_OSproc.h" #include "xf86cmap.h" diff --git a/src/legacy/i810/i810_hwmc.c b/src/legacy/i810/i810_hwmc.c index 4d3bd1a4..7cb9c1ab 100644 --- a/src/legacy/i810/i810_hwmc.c +++ b/src/legacy/i810/i810_hwmc.c @@ -39,6 +39,7 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <string.h> +#include "xorg-server.h" #include "xf86.h" #include "xf86_OSproc.h" #include "compiler.h" diff --git a/src/legacy/i810/i810_memory.c b/src/legacy/i810/i810_memory.c index f57ddbe2..bd7c8db1 100644 --- a/src/legacy/i810/i810_memory.c +++ b/src/legacy/i810/i810_memory.c @@ -35,6 +35,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ +#include "xorg-server.h" #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/legacy/i810/i810_video.c b/src/legacy/i810/i810_video.c index bbaa3ce8..be49b91d 100644 --- a/src/legacy/i810/i810_video.c +++ b/src/legacy/i810/i810_video.c @@ -39,6 +39,7 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <string.h> +#include "xorg-server.h" #include "xf86.h" #include "xf86_OSproc.h" #include "compiler.h" diff --git a/src/legacy/i810/i810_wmark.c b/src/legacy/i810/i810_wmark.c index 71b2a825..de4365b0 100644 --- a/src/legacy/i810/i810_wmark.c +++ b/src/legacy/i810/i810_wmark.c @@ -34,6 +34,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "config.h" #endif +#include "xorg-server.h" #include "xf86.h" #include "i810.h" diff --git a/src/legacy/i810/i810_xaa.c b/src/legacy/i810/i810_xaa.c index 13f0dc2a..ea03441b 100644 --- a/src/legacy/i810/i810_xaa.c +++ b/src/legacy/i810/i810_xaa.c @@ -36,6 +36,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ +#include "xorg-server.h" #include "xf86.h" #include "xaarop.h" #include "i810.h" diff --git a/src/sna/fb/fbpict.h b/src/sna/fb/fbpict.h index 56013853..932032f9 100644 --- a/src/sna/fb/fbpict.h +++ b/src/sna/fb/fbpict.h @@ -28,6 +28,7 @@ #include "config.h" #endif +#include <xorg-server.h> #include <picturestr.h> #include "sfb.h" diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c index c7f95124..63dd5cc1 100644 --- a/src/sna/gen3_render.c +++ b/src/sna/gen3_render.c @@ -108,8 +108,10 @@ static const struct formatinfo { {PICT_x8r8g8b8, 0, MAPSURF_32BIT | MT_32BIT_XRGB8888, false}, {PICT_a8b8g8r8, 0, MAPSURF_32BIT | MT_32BIT_ABGR8888, false}, {PICT_x8b8g8r8, 0, MAPSURF_32BIT | MT_32BIT_XBGR8888, false}, +#ifdef PICT_a2r10g10b10 {PICT_a2r10g10b10, PICT_x2r10g10b10, MAPSURF_32BIT | MT_32BIT_ARGB2101010, false}, {PICT_a2b10g10r10, PICT_x2b10g10r10, MAPSURF_32BIT | MT_32BIT_ABGR2101010, false}, +#endif {PICT_r5g6b5, 0, MAPSURF_16BIT | MT_16BIT_RGB565, false}, {PICT_b5g6r5, 0, MAPSURF_16BIT | MT_16BIT_RGB565, true}, {PICT_a1r5g5b5, PICT_x1r5g5b5, MAPSURF_16BIT | MT_16BIT_ARGB1555, false}, @@ -206,10 +208,12 @@ static bool gen3_check_dst_format(uint32_t format) case PICT_x1r5g5b5: case PICT_a1b5g5r5: case PICT_x1b5g5r5: +#ifdef PICT_a2r10g10b10 case PICT_a2r10g10b10: case PICT_x2r10g10b10: case PICT_a2b10g10r10: case PICT_x2b10g10r10: +#endif case PICT_a8: case PICT_a4r4g4b4: case PICT_x4r4g4b4: @@ -229,8 +233,10 @@ static bool gen3_dst_rb_reversed(uint32_t format) case PICT_r5g6b5: case PICT_a1r5g5b5: case PICT_x1r5g5b5: +#ifdef PICT_a2r10g10b10 case PICT_a2r10g10b10: case PICT_x2r10g10b10: +#endif case PICT_a8: case PICT_a4r4g4b4: case PICT_x4r4g4b4: @@ -261,11 +267,13 @@ static uint32_t gen3_get_dst_format(uint32_t format) case PICT_a1b5g5r5: case PICT_x1b5g5r5: return BIAS | COLR_BUF_ARGB1555; +#ifdef PICT_a2r10g10b10 case PICT_a2r10g10b10: case PICT_x2r10g10b10: case PICT_a2b10g10r10: case PICT_x2b10g10r10: return BIAS | COLR_BUF_ARGB2AAA; +#endif case PICT_a8: return BIAS | COLR_BUF_8BIT; case PICT_a4r4g4b4: @@ -285,8 +293,10 @@ static bool gen3_check_format(PicturePtr p) case PICT_x8r8g8b8: case PICT_a8b8g8r8: case PICT_x8b8g8r8: +#ifdef PICT_a2r10g10b10 case PICT_a2r10g10b10: case PICT_a2b10g10r10: +#endif case PICT_r5g6b5: case PICT_b5g6r5: case PICT_a1r5g5b5: @@ -312,10 +322,12 @@ static bool gen3_check_xformat(PicturePtr p) case PICT_x1r5g5b5: case PICT_a1b5g5r5: case PICT_x1b5g5r5: +#ifdef PICT_a2r10g10b10 case PICT_a2r10g10b10: case PICT_x2r10g10b10: case PICT_a2b10g10r10: case PICT_x2b10g10r10: +#endif case PICT_a8: case PICT_a4r4g4b4: case PICT_x4r4g4b4: diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c index 3158b585..973d6061 100644 --- a/src/sna/gen4_render.c +++ b/src/sna/gen4_render.c @@ -293,10 +293,12 @@ static uint32_t gen4_get_card_format(PictFormat format) return GEN4_SURFACEFORMAT_R8G8B8A8_UNORM; case PICT_x8b8g8r8: return GEN4_SURFACEFORMAT_R8G8B8X8_UNORM; +#ifdef PICT_a2r10g10b10 case PICT_a2r10g10b10: return GEN4_SURFACEFORMAT_B10G10R10A2_UNORM; case PICT_x2r10g10b10: return GEN4_SURFACEFORMAT_B10G10R10X2_UNORM; +#endif case PICT_r8g8b8: return GEN4_SURFACEFORMAT_R8G8B8_UNORM; case PICT_r5g6b5: @@ -321,9 +323,11 @@ static uint32_t gen4_get_dest_format(PictFormat format) case PICT_a8b8g8r8: case PICT_x8b8g8r8: return GEN4_SURFACEFORMAT_R8G8B8A8_UNORM; +#ifdef PICT_a2r10g10b10 case PICT_a2r10g10b10: case PICT_x2r10g10b10: return GEN4_SURFACEFORMAT_B10G10R10A2_UNORM; +#endif case PICT_r5g6b5: return GEN4_SURFACEFORMAT_B5G6R5_UNORM; case PICT_x1r5g5b5: diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c index 9b469f39..7e336f0b 100644 --- a/src/sna/gen5_render.c +++ b/src/sna/gen5_render.c @@ -282,10 +282,12 @@ static uint32_t gen5_get_card_format(PictFormat format) return GEN5_SURFACEFORMAT_R8G8B8A8_UNORM; case PICT_x8b8g8r8: return GEN5_SURFACEFORMAT_R8G8B8X8_UNORM; +#ifdef PICT_a2r10g10b10 case PICT_a2r10g10b10: return GEN5_SURFACEFORMAT_B10G10R10A2_UNORM; case PICT_x2r10g10b10: return GEN5_SURFACEFORMAT_B10G10R10X2_UNORM; +#endif case PICT_r8g8b8: return GEN5_SURFACEFORMAT_R8G8B8_UNORM; case PICT_r5g6b5: @@ -310,9 +312,11 @@ static uint32_t gen5_get_dest_format(PictFormat format) case PICT_a8b8g8r8: case PICT_x8b8g8r8: return GEN5_SURFACEFORMAT_R8G8B8A8_UNORM; +#ifdef PICT_a2r10g10b10 case PICT_a2r10g10b10: case PICT_x2r10g10b10: return GEN5_SURFACEFORMAT_B10G10R10A2_UNORM; +#endif case PICT_r5g6b5: return GEN5_SURFACEFORMAT_B5G6R5_UNORM; case PICT_x1r5g5b5: diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c index 70821f72..1f15091f 100644 --- a/src/sna/gen6_render.c +++ b/src/sna/gen6_render.c @@ -258,10 +258,12 @@ static uint32_t gen6_get_card_format(PictFormat format) return GEN6_SURFACEFORMAT_R8G8B8A8_UNORM; case PICT_x8b8g8r8: return GEN6_SURFACEFORMAT_R8G8B8X8_UNORM; +#ifdef PICT_a2r10g10b10 case PICT_a2r10g10b10: return GEN6_SURFACEFORMAT_B10G10R10A2_UNORM; case PICT_x2r10g10b10: return GEN6_SURFACEFORMAT_B10G10R10X2_UNORM; +#endif case PICT_r8g8b8: return GEN6_SURFACEFORMAT_R8G8B8_UNORM; case PICT_r5g6b5: @@ -286,9 +288,11 @@ static uint32_t gen6_get_dest_format(PictFormat format) case PICT_a8b8g8r8: case PICT_x8b8g8r8: return GEN6_SURFACEFORMAT_R8G8B8A8_UNORM; +#ifdef PICT_a2r10g10b10 case PICT_a2r10g10b10: case PICT_x2r10g10b10: return GEN6_SURFACEFORMAT_B10G10R10A2_UNORM; +#endif case PICT_r5g6b5: return GEN6_SURFACEFORMAT_B5G6R5_UNORM; case PICT_x1r5g5b5: diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index 53d3688d..6f2e3abd 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -347,10 +347,12 @@ static uint32_t gen7_get_card_format(PictFormat format) return GEN7_SURFACEFORMAT_R8G8B8A8_UNORM; case PICT_x8b8g8r8: return GEN7_SURFACEFORMAT_R8G8B8X8_UNORM; +#ifdef PICT_a2r10g10b10 case PICT_a2r10g10b10: return GEN7_SURFACEFORMAT_B10G10R10A2_UNORM; case PICT_x2r10g10b10: return GEN7_SURFACEFORMAT_B10G10R10X2_UNORM; +#endif case PICT_r8g8b8: return GEN7_SURFACEFORMAT_R8G8B8_UNORM; case PICT_r5g6b5: @@ -375,9 +377,11 @@ static uint32_t gen7_get_dest_format(PictFormat format) case PICT_a8b8g8r8: case PICT_x8b8g8r8: return GEN7_SURFACEFORMAT_R8G8B8A8_UNORM; +#ifdef PICT_a2r10g10b10 case PICT_a2r10g10b10: case PICT_x2r10g10b10: return GEN7_SURFACEFORMAT_B10G10R10A2_UNORM; +#endif case PICT_r5g6b5: return GEN7_SURFACEFORMAT_B5G6R5_UNORM; case PICT_x1r5g5b5: diff --git a/src/sna/sna.h b/src/sna/sna.h index 32d9ef37..d29ee1dc 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -37,22 +37,16 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef _SNA_H_ #define _SNA_H_ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdint.h> -#include "compiler.h" - #include <xorg-server.h> +#include <xf86str.h> #include <xf86Crtc.h> #if XF86_CRTC_VERSION >= 5 #define HAS_PIXMAP_SHARING 1 #endif -#include <xf86str.h> #include <windowstr.h> #include <glyphstr.h> #include <picturestr.h> @@ -75,6 +69,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <libudev.h> #endif +#include "compiler.h" + #if HAS_DEBUG_FULL #define DBG(x) ErrorF x #else diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 713f98da..bf7cb9c7 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -29,12 +29,13 @@ #include "config.h" #endif -#include "intel_options.h" #include "sna.h" #include "sna_reg.h" #include "sna_video.h" #include "rop.h" +#include "intel_options.h" + #include <X11/fonts/font.h> #include <X11/fonts/fontstruct.h> diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c index 94d84589..1f173daf 100644 --- a/src/sna/sna_blt.c +++ b/src/sna/sna_blt.c @@ -44,6 +44,10 @@ #define NO_BLT_FILL 0 #define NO_BLT_FILL_BOXES 0 +#ifndef PICT_TYPE_BGRA +#define PICT_TYPE_BGRA 8 +#endif + static const uint8_t copy_ROP[] = { ROP_0, /* GXclear */ ROP_DSa, /* GXand */ diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 7b1684f8..bfb95a07 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -39,21 +39,37 @@ #include <poll.h> #include <ctype.h> -#include <xorgVersion.h> +#include "sna.h" +#include "sna_reg.h" +#include "fb/fbpict.h" + +#include <xf86Crtc.h> + +#if XF86_CRTC_VERSION >= 3 +#define HAS_GAMMA 1 +#else +#define HAS_GAMMA 0 +#endif + #include <X11/Xatom.h> +#if defined(HAVE_X11_EXTENSIONS_DPMSCONST_H) #include <X11/extensions/dpmsconst.h> +#else +#define DPMSModeOn 0 +#define DPMSModeOff 3 +#endif #include <xf86drm.h> #include <xf86DDC.h> /* for xf86InterpretEDID */ #include <xf86Opt.h> /* for xf86OptionPtr */ -#include "sna.h" -#include "sna_reg.h" -#include "fb/fbpict.h" - #include "intel_options.h" #define KNOWN_MODE_FLAGS ((1<<14)-1) +#ifndef MONITOR_EDID_COMPLETE_RAWDATA +#define MONITOR_EDID_COMPLETE_RAWDATA 1 +#endif + #ifndef DEFAULT_DPI #define DEFAULT_DPI 96 #endif @@ -1426,11 +1442,13 @@ sna_crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, assert(mode->HDisplay <= sna->mode.kmode->max_width && mode->VDisplay <= sna->mode.kmode->max_height); +#if HAS_GAMMA drmModeCrtcSetGamma(sna->kgem.fd, sna_crtc->id, crtc->gamma_size, crtc->gamma_red, crtc->gamma_green, crtc->gamma_blue); +#endif saved_kmode = sna_crtc->kmode; saved_bo = sna_crtc->bo; @@ -1634,7 +1652,9 @@ sna_crtc_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr pixmap) #endif static const xf86CrtcFuncsRec sna_crtc_funcs = { +#if XF86_CRTC_VERSION >= 1 .dpms = sna_crtc_dpms, +#endif .set_mode_major = sna_crtc_set_mode_major, .set_cursor_colors = sna_crtc_set_cursor_colors, .set_cursor_position = sna_crtc_set_cursor_position, @@ -1945,6 +1965,16 @@ done: } static DisplayModePtr +default_modes(void) +{ +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0) + return xf86GetDefaultModes(); +#else + return xf86GetDefaultModes(0, 0); +#endif +} + +static DisplayModePtr sna_output_panel_edid(xf86OutputPtr output, DisplayModePtr modes) { xf86MonPtr mon = output->MonInfo; @@ -1966,7 +1996,7 @@ sna_output_panel_edid(xf86OutputPtr output, DisplayModePtr modes) max_vrefresh = max(max_vrefresh, 60.0); max_vrefresh *= (1 + SYNC_TOLERANCE); - m = xf86GetDefaultModes(); + m = default_modes(); xf86ValidateModesSize(output->scrn, m, max_x, max_y, 0); for (i = m; i; i = i->next) { @@ -2945,6 +2975,7 @@ enum { /* XXX copied from hw/xfree86/modes/xf86Crtc.c */ OPTION_DEFAULT_MODES, }; +#if HAS_GAMMA static void set_gamma(uint16_t *curve, int size, double value) { int i; @@ -2954,7 +2985,7 @@ static void set_gamma(uint16_t *curve, int size, double value) curve[i] = 256*(size-1)*pow(i/(double)(size-1), value); } -static void set_initial_gamma(xf86OutputPtr output, xf86CrtcPtr crtc) +static void output_set_gamma(xf86OutputPtr output, xf86CrtcPtr crtc) { XF86ConfMonitorPtr mon = output->conf_monitor; @@ -2983,6 +3014,60 @@ static void set_initial_gamma(xf86OutputPtr output, xf86CrtcPtr crtc) mon->mon_gamma_blue); } +static void crtc_init_gamma(xf86CrtcPtr crtc) +{ + uint16_t *gamma; + + /* Initialize the gamma ramps */ + gamma = NULL; + if (crtc->gamma_size == 256) + gamma = crtc->gamma_red; + if (gamma == NULL) + gamma = malloc(3 * 256 * sizeof(uint16_t)); + if (gamma) { + struct sna *sna = to_sna(crtc->scrn); + struct sna_crtc *sna_crtc = to_sna_crtc(crtc); + struct drm_mode_crtc_lut lut; + bool gamma_set = false; + + lut.crtc_id = sna_crtc->id; + lut.gamma_size = 256; + lut.red = (uintptr_t)(gamma); + lut.green = (uintptr_t)(gamma + 256); + lut.blue = (uintptr_t)(gamma + 2 * 256); + if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETGAMMA, &lut) == 0) { + gamma_set = + gamma[256 - 1] && + gamma[2*256 - 1] && + gamma[3*256 - 1]; + } + + DBG(("%s: CRTC:%d, pipe=%d: gamma set?=%d\n", + __FUNCTION__, sna_crtc->id, sna_crtc->pipe, + gamma_set)); + if (!gamma_set) { + int i; + + for (i = 0; i < 256; i++) { + gamma[i] = i << 8; + gamma[256 + i] = i << 8; + gamma[2*256 + i] = i << 8; + } + } + + if (gamma != crtc->gamma_red) { + free(crtc->gamma_red); + crtc->gamma_red = gamma; + crtc->gamma_green = gamma + 256; + crtc->gamma_blue = gamma + 2*256; + } + } +} +#else +static void output_set_gamma(xf86OutputPtr output, xf86CrtcPtr crtc) { } +static void crtc_init_gamma(xf86CrtcPtr crtc) { } +#endif + static bool sna_probe_initial_configuration(struct sna *sna) { ScrnInfoPtr scrn = sna->scrn; @@ -3036,7 +3121,6 @@ static bool sna_probe_initial_configuration(struct sna *sna) xf86CrtcPtr crtc = config->crtc[i]; struct sna_crtc *sna_crtc = to_sna_crtc(crtc); struct drm_mode_crtc mode; - uint16_t *gamma; if (sna_crtc == NULL) continue; @@ -3044,46 +3128,7 @@ static bool sna_probe_initial_configuration(struct sna *sna) crtc->enabled = FALSE; crtc->desiredMode.status = MODE_NOMODE; - /* Initialize the gamma ramps */ - gamma = NULL; - if (crtc->gamma_size == 256) - gamma = crtc->gamma_red; - if (gamma == NULL) - gamma = malloc(3 * 256 * sizeof(uint16_t)); - if (gamma) { - struct drm_mode_crtc_lut lut; - bool gamma_set = false; - - lut.crtc_id = sna_crtc->id; - lut.gamma_size = 256; - lut.red = (uintptr_t)(gamma); - lut.green = (uintptr_t)(gamma + 256); - lut.blue = (uintptr_t)(gamma + 2 * 256); - if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETGAMMA, &lut) == 0) { - gamma_set = - gamma[256 - 1] && - gamma[2*256 - 1] && - gamma[3*256 - 1]; - } - - DBG(("%s: CRTC:%d, pipe=%d: gamma set?=%d\n", - __FUNCTION__, sna_crtc->id, sna_crtc->pipe, - gamma_set)); - if (!gamma_set) { - for (j = 0; j < 256; j++) { - gamma[j] = j << 8; - gamma[256 + j] = j << 8; - gamma[2*256 + j] = j << 8; - } - } - - if (gamma != crtc->gamma_red) { - free(crtc->gamma_red); - crtc->gamma_red = gamma; - crtc->gamma_green = gamma + 256; - crtc->gamma_blue = gamma + 2*256; - } - } + crtc_init_gamma(crtc); /* Retrieve the current mode */ VG_CLEAR(mode); @@ -3145,7 +3190,7 @@ static bool sna_probe_initial_configuration(struct sna *sna) output->mm_width = (crtc->desiredMode.HDisplay * 254) / (10*DEFAULT_DPI); } - set_initial_gamma(output, crtc); + output_set_gamma(output, crtc); M = calloc(1, sizeof(DisplayModeRec)); if (M) { @@ -3700,7 +3745,9 @@ void sna_mode_update(struct sna *sna) if (sna_crtc == NULL) continue; +#if XF86_CRTC_VERSION >= 3 assert(sna_crtc->bo == NULL || crtc->active); +#endif expected = sna_crtc->bo ? fb_id(sna_crtc->bo) : 0; VG_CLEAR(mode); diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c index 4c5476e4..6584e668 100644 --- a/src/sna/sna_dri.c +++ b/src/sna/sna_dri.c @@ -48,9 +48,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include <xf86drm.h> #include <i915_drm.h> #include <dri2.h> +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,12,99,901,0) #include <compositeext.h> +#endif -#if DRI2INFOREC_VERSION <= 2 +#if DRI2INFOREC_VERSION < 2 #error DRI2 version supported by the Xserver is too old #endif @@ -70,34 +72,6 @@ enum frame_event_type { DRI2_FLIP_THROTTLE, }; -struct sna_dri_frame_event { - DrawablePtr draw; - ClientPtr client; - enum frame_event_type type; - int pipe; - int count; - - /* for swaps & flips only */ - DRI2SwapEventPtr event_complete; - void *event_data; - DRI2BufferPtr front; - DRI2BufferPtr back; - struct kgem_bo *bo; - - struct sna_dri_frame_event *chain; - - unsigned int fe_frame; - unsigned int fe_tv_sec; - unsigned int fe_tv_usec; - - struct dri_bo { - struct kgem_bo *bo; - uint32_t name; - } scanout[2], cache; - - int mode; -}; - struct sna_dri_private { PixmapPtr pixmap; struct kgem_bo *bo; @@ -106,16 +80,10 @@ struct sna_dri_private { int refcnt; }; -static inline struct sna_dri_frame_event * -to_frame_event(uintptr_t data) -{ - return (struct sna_dri_frame_event *)(data & ~1); -} - static inline struct sna_dri_private * -get_private(DRI2Buffer2Ptr buffer) +get_private(void *buffer) { - return (struct sna_dri_private *)(buffer+1); + return (struct sna_dri_private *)((DRI2Buffer2Ptr)buffer+1); } static inline struct kgem_bo *ref(struct kgem_bo *bo) @@ -208,7 +176,7 @@ static inline void sna_pixmap_set_buffer(PixmapPtr pixmap, void *ptr) void sna_dri_pixmap_update_bo(struct sna *sna, PixmapPtr pixmap) { - DRI2Buffer2Ptr buffer; + DRI2BufferPtr buffer; struct sna_dri_private *private; struct kgem_bo *bo; @@ -481,7 +449,7 @@ static void sna_dri_destroy_buffer(DrawablePtr draw, DRI2Buffer2Ptr buffer) _sna_dri_destroy_buffer(to_sna_from_drawable(draw), buffer); } -static void sna_dri_reference_buffer(DRI2Buffer2Ptr buffer) +static void sna_dri_reference_buffer(DRI2BufferPtr buffer) { get_private(buffer)->refcnt++; } @@ -647,7 +615,7 @@ sna_dri_copy_fallback(struct sna *sna, int bpp, static struct kgem_bo * __sna_dri_copy_region(struct sna *sna, DrawablePtr draw, RegionPtr region, - DRI2Buffer2Ptr src, DRI2Buffer2Ptr dst, + DRI2BufferPtr src, DRI2BufferPtr dst, bool sync) { PixmapPtr pixmap = get_drawable_pixmap(draw); @@ -886,6 +854,41 @@ static inline int sna_wait_vblank(struct sna *sna, drmVBlank *vbl) #if DRI2INFOREC_VERSION >= 4 +struct sna_dri_frame_event { + DrawablePtr draw; + ClientPtr client; + enum frame_event_type type; + int pipe; + int count; + + /* for swaps & flips only */ + DRI2SwapEventPtr event_complete; + void *event_data; + DRI2BufferPtr front; + DRI2BufferPtr back; + struct kgem_bo *bo; + + struct sna_dri_frame_event *chain; + + unsigned int fe_frame; + unsigned int fe_tv_sec; + unsigned int fe_tv_usec; + + struct dri_bo { + struct kgem_bo *bo; + uint32_t name; + } scanout[2], cache; + + int mode; +}; + + +static inline struct sna_dri_frame_event * +to_frame_event(uintptr_t data) +{ + return (struct sna_dri_frame_event *)(data & ~1); +} + static int sna_dri_get_pipe(DrawablePtr draw) { @@ -2253,6 +2256,8 @@ out_complete: DRI2WaitMSCComplete(client, draw, target_msc, 0, 0); return TRUE; } +#else +void sna_dri_destroy_window(WindowPtr win) { } #endif static bool has_i830_dri(void) @@ -2260,12 +2265,79 @@ static bool has_i830_dri(void) return access(DRI_DRIVER_PATH "/i830_dri.so", R_OK) == 0; } +static int +namecmp(const char *s1, const char *s2) +{ + char c1, c2; + + if (!s1 || *s1 == 0) { + if (!s2 || *s2 == 0) + return 0; + else + return 1; + } + + while (*s1 == '_' || *s1 == ' ' || *s1 == '\t') + s1++; + + while (*s2 == '_' || *s2 == ' ' || *s2 == '\t') + s2++; + + c1 = isupper(*s1) ? tolower(*s1) : *s1; + c2 = isupper(*s2) ? tolower(*s2) : *s2; + while (c1 == c2) { + if (c1 == '\0') + return 0; + + s1++; + while (*s1 == '_' || *s1 == ' ' || *s1 == '\t') + s1++; + + s2++; + while (*s2 == '_' || *s2 == ' ' || *s2 == '\t') + s2++; + + c1 = isupper(*s1) ? tolower(*s1) : *s1; + c2 = isupper(*s2) ? tolower(*s2) : *s2; + } + + return c1 - c2; +} + +static bool is_bool(const char *str) +{ + if (str == NULL) + return true; + + if (*str == '\0') + return true; + + if (namecmp(str, "1") == 0) + return true; + if (namecmp(str, "on") == 0) + return true; + if (namecmp(str, "true") == 0) + return true; + if (namecmp(str, "yes") == 0) + return true; + + if (namecmp(str, "0") == 0) + return true; + if (namecmp(str, "off") == 0) + return true; + if (namecmp(str, "false") == 0) + return true; + if (namecmp(str, "no") == 0) + return true; + + return false; +} + static const char *dri_driver_name(struct sna *sna) { const char *s = xf86GetOptValString(sna->Options, OPTION_DRI); - Bool dummy; - if (s == NULL || xf86getBoolValue(&dummy, s)) { + if (is_bool(s)) { if (sna->kgem.gen < 030) return has_i830_dri() ? "i830" : "i915"; else if (sna->kgem.gen < 040) @@ -2309,7 +2381,14 @@ bool sna_dri_open(struct sna *sna, ScreenPtr screen) DBG(("%s: loading dri driver '%s' [gen=%d] for device '%s'\n", __FUNCTION__, info.driverName, sna->kgem.gen, info.deviceName)); +#if DRI2INFOREC_VERSION == 2 + /* The ABI between 2 and 3 was broken so we could get rid of + * the multi-buffer alloc functions. Make sure we indicate the + * right version so DRI2 can reject us if it's version 3 or above. */ + info.version = 2; +#else info.version = 3; +#endif info.CreateBuffer = sna_dri_create_buffer; info.DestroyBuffer = sna_dri_destroy_buffer; diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c index da5740a7..dcfcd673 100644 --- a/src/sna/sna_driver.c +++ b/src/sna/sna_driver.c @@ -45,6 +45,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include <stdio.h> #include <errno.h> +#include "sna.h" +#include "sna_module.h" +#include "sna_video.h" + +#include "intel_driver.h" +#include "intel_options.h" + #include <xf86cmap.h> #include <xf86drm.h> #include <xf86RandR12.h> @@ -52,13 +59,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include <micmap.h> #include <mipict.h> -#include "compiler.h" -#include "sna.h" -#include "sna_module.h" -#include "sna_video.h" - -#include "intel_driver.h" -#include "intel_options.h" #include <sys/ioctl.h> #include <sys/fcntl.h> @@ -338,9 +338,73 @@ static void sna_setup_capabilities(ScrnInfoPtr scrn, int fd) #endif } +static int +namecmp(const char *s1, const char *s2) +{ + char c1, c2; + + if (!s1 || *s1 == 0) { + if (!s2 || *s2 == 0) + return 0; + else + return 1; + } + + while (*s1 == '_' || *s1 == ' ' || *s1 == '\t') + s1++; + + while (*s2 == '_' || *s2 == ' ' || *s2 == '\t') + s2++; + + c1 = isupper(*s1) ? tolower(*s1) : *s1; + c2 = isupper(*s2) ? tolower(*s2) : *s2; + while (c1 == c2) { + if (c1 == '\0') + return 0; + + s1++; + while (*s1 == '_' || *s1 == ' ' || *s1 == '\t') + s1++; + + s2++; + while (*s2 == '_' || *s2 == ' ' || *s2 == '\t') + s2++; + + c1 = isupper(*s1) ? tolower(*s1) : *s1; + c2 = isupper(*s2) ? tolower(*s2) : *s2; + } + + return c1 - c2; +} + static Bool sna_option_cast_to_bool(struct sna *sna, int id, Bool val) { - xf86getBoolValue(&val, xf86GetOptValString(sna->Options, id)); + const char *str = xf86GetOptValString(sna->Options, id); + + if (str == NULL) + return val; + + if (*str == '\0') + return TRUE; + + if (namecmp(str, "1") == 0) + return TRUE; + if (namecmp(str, "on") == 0) + return TRUE; + if (namecmp(str, "true") == 0) + return TRUE; + if (namecmp(str, "yes") == 0) + return TRUE; + + if (namecmp(str, "0") == 0) + return FALSE; + if (namecmp(str, "off") == 0) + return FALSE; + if (namecmp(str, "false") == 0) + return FALSE; + if (namecmp(str, "no") == 0) + return FALSE; + return val; } diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c index 6b883ddf..738cca40 100644 --- a/src/sna/sna_render.c +++ b/src/sna/sna_render.c @@ -25,6 +25,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "sna.h" #include "sna_render.h" #include "sna_render_inline.h" @@ -56,7 +60,9 @@ sna_format_for_depth(int depth) case 16: return PICT_r5g6b5; default: assert(0); case 24: return PICT_x8r8g8b8; +#ifdef PICT_x2r10g10b10 case 30: return PICT_x2r10g10b10; +#endif case 32: return PICT_a8r8g8b8; } } diff --git a/src/sna/sna_stream.c b/src/sna/sna_stream.c index 1a0a86b9..378825e4 100644 --- a/src/sna/sna_stream.c +++ b/src/sna/sna_stream.c @@ -25,6 +25,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "sna.h" #include "sna_render.h" #include "brw/brw.h" diff --git a/src/sna/sna_threads.c b/src/sna/sna_threads.c index 21fd94cc..b771bda8 100644 --- a/src/sna/sna_threads.c +++ b/src/sna/sna_threads.c @@ -25,6 +25,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "sna.h" #include <unistd.h> diff --git a/src/sna/sna_vertex.c b/src/sna/sna_vertex.c index 6755d9aa..86ad2c50 100644 --- a/src/sna/sna_vertex.c +++ b/src/sna/sna_vertex.c @@ -25,6 +25,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "sna.h" #include <unistd.h> diff --git a/src/uxa/i830_3d.c b/src/uxa/i830_3d.c index 10432011..e03aaa05 100644 --- a/src/uxa/i830_3d.c +++ b/src/uxa/i830_3d.c @@ -29,6 +29,7 @@ #include "config.h" #endif +#include "xorg-server.h" #include "xf86.h" #include "intel.h" diff --git a/src/uxa/i830_render.c b/src/uxa/i830_render.c index e169cc11..ee68ec30 100644 --- a/src/uxa/i830_render.c +++ b/src/uxa/i830_render.c @@ -30,6 +30,7 @@ #include "config.h" #endif +#include "xorg-server.h" #include "xf86.h" #include "intel.h" #include "i830_reg.h" diff --git a/src/uxa/i915_3d.c b/src/uxa/i915_3d.c index 77db5685..24f60814 100644 --- a/src/uxa/i915_3d.c +++ b/src/uxa/i915_3d.c @@ -29,6 +29,7 @@ #include "config.h" #endif +#include "xorg-server.h" #include "xf86.h" #include "intel.h" diff --git a/src/uxa/i915_render.c b/src/uxa/i915_render.c index 6d3400e7..577abac2 100644 --- a/src/uxa/i915_render.c +++ b/src/uxa/i915_render.c @@ -30,6 +30,7 @@ #include "config.h" #endif +#include "xorg-server.h" #include "xf86.h" #include "intel.h" #include "i915_reg.h" diff --git a/src/uxa/i915_video.c b/src/uxa/i915_video.c index ae2e6bb5..f6a1c6e1 100644 --- a/src/uxa/i915_video.c +++ b/src/uxa/i915_video.c @@ -29,6 +29,7 @@ #include "config.h" #endif +#include "xorg-server.h" #include "xf86.h" #include "xf86_OSproc.h" #include "xf86xv.h" diff --git a/src/uxa/i965_render.c b/src/uxa/i965_render.c index 39698b0d..35869677 100644 --- a/src/uxa/i965_render.c +++ b/src/uxa/i965_render.c @@ -34,6 +34,7 @@ #endif #include <assert.h> +#include "xorg-server.h" #include "xf86.h" #include "intel.h" #include "i830_reg.h" diff --git a/src/uxa/i965_video.c b/src/uxa/i965_video.c index 5706b201..54f5fa7f 100644 --- a/src/uxa/i965_video.c +++ b/src/uxa/i965_video.c @@ -30,6 +30,7 @@ #include "config.h" #endif +#include "xorg-server.h" #include "xf86.h" #include "xf86_OSproc.h" #include "xf86xv.h" diff --git a/src/uxa/intel.h b/src/uxa/intel.h index 9b696cd8..131f18ca 100644 --- a/src/uxa/intel.h +++ b/src/uxa/intel.h @@ -51,6 +51,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef _I830_H_ #define _I830_H_ +#include "xorg-server.h" #include "xf86_OSproc.h" #include "compiler.h" #include "xf86Pci.h" @@ -63,6 +64,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <pciaccess.h> #define _XF86DRI_SERVER_ +#include "drm.h" #include "dri2.h" #include "intel_bufmgr.h" #include "i915_drm.h" diff --git a/src/uxa/intel_batchbuffer.c b/src/uxa/intel_batchbuffer.c index a44a1563..579a63af 100644 --- a/src/uxa/intel_batchbuffer.c +++ b/src/uxa/intel_batchbuffer.c @@ -34,6 +34,7 @@ #include <stdlib.h> #include <errno.h> +#include "xorg-server.h" #include "xf86.h" #include "intel.h" #include "i830_reg.h" diff --git a/src/uxa/intel_display.c b/src/uxa/intel_display.c index b4f7e87a..7dc0f68e 100644 --- a/src/uxa/intel_display.c +++ b/src/uxa/intel_display.c @@ -38,6 +38,7 @@ #include <poll.h> #include <sys/ioctl.h> +#include "xorg-server.h" #include "xorgVersion.h" #include "intel.h" @@ -46,7 +47,12 @@ #include "xf86drm.h" #include "xf86drmMode.h" #include "X11/Xatom.h" -#include "X11/extensions/dpmsconst.h" +#if defined(HAVE_X11_EXTENSIONS_DPMSCONST_H) +#include <X11/extensions/dpmsconst.h> +#else +#define DPMSModeOn 0 +#define DPMSModeOff 3 +#endif #include "xf86DDC.h" #include "fb.h" #include "uxa.h" diff --git a/src/uxa/intel_dri.c b/src/uxa/intel_dri.c index 03700343..acedd0b7 100644 --- a/src/uxa/intel_dri.c +++ b/src/uxa/intel_dri.c @@ -48,6 +48,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include <time.h> #include <errno.h> +#include "xorg-server.h" #include "xf86.h" #include "xf86_OSproc.h" @@ -1530,6 +1531,7 @@ static int has_i830_dri(void) static const char *dri_driver_name(intel_screen_private *intel) { +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,7,99,901,0) const char *s = xf86GetOptValString(intel->Options, OPTION_DRI); Bool dummy; @@ -1543,6 +1545,14 @@ static const char *dri_driver_name(intel_screen_private *intel) } return s; +#else + if (INTEL_INFO(intel)->gen < 030) + return has_i830_dri() ? "i830" : "i915"; + else if (INTEL_INFO(intel)->gen < 040) + return "i915"; + else + return "i965"; +#endif } Bool I830DRI2ScreenInit(ScreenPtr screen) diff --git a/src/uxa/intel_driver.c b/src/uxa/intel_driver.c index 675408da..7d716ebf 100644 --- a/src/uxa/intel_driver.c +++ b/src/uxa/intel_driver.c @@ -45,6 +45,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include <stdio.h> #include <errno.h> +#include "xorg-server.h" #include "xf86.h" #include "xf86_OSproc.h" #include "xf86cmap.h" @@ -54,7 +55,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "micmap.h" #include "shadowfb.h" #include <X11/extensions/randr.h> -#include <X11/extensions/dpmsconst.h> #include "fb.h" #include "miscstruct.h" #include "dixstruct.h" @@ -225,8 +225,12 @@ static Bool I830GetEarlyOptions(ScrnInfoPtr scrn) static Bool intel_option_cast_string_to_bool(intel_screen_private *intel, int id, Bool val) { +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,7,99,901,0) xf86getBoolValue(&val, xf86GetOptValString(intel->Options, id)); return val; +#else + return val; +#endif } static void intel_check_dri_option(ScrnInfoPtr scrn) diff --git a/src/uxa/intel_glamor.c b/src/uxa/intel_glamor.c index 0c4e3a77..fa603001 100644 --- a/src/uxa/intel_glamor.c +++ b/src/uxa/intel_glamor.c @@ -31,6 +31,7 @@ #include "config.h" #endif +#include "xorg-server.h" #include <xf86.h> #define GLAMOR_FOR_XORG 1 #include <glamor.h> diff --git a/src/uxa/intel_memory.c b/src/uxa/intel_memory.c index e51fa33a..7db1a040 100644 --- a/src/uxa/intel_memory.c +++ b/src/uxa/intel_memory.c @@ -80,6 +80,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <sys/types.h> #include <sys/ioctl.h> +#include "xorg-server.h" #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/uxa/intel_uxa.c b/src/uxa/intel_uxa.c index 2f141735..0b6591af 100644 --- a/src/uxa/intel_uxa.c +++ b/src/uxa/intel_uxa.c @@ -31,6 +31,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "config.h" #endif +#include "xorg-server.h" #include <xf86.h> #include <xf86drm.h> #include <xaarop.h> diff --git a/src/uxa/intel_video.c b/src/uxa/intel_video.c index d6906bf4..238cd471 100644 --- a/src/uxa/intel_video.c +++ b/src/uxa/intel_video.c @@ -55,6 +55,7 @@ #include <assert.h> #include <errno.h> +#include "xorg-server.h" #include "xf86.h" #include "xf86_OSproc.h" #include "compiler.h" |