aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-09-21 18:11:28 +0200
committermarha <marha@users.sourceforge.net>2014-09-21 18:11:28 +0200
commit438af0c7d4bf60b408b259c88205ff2193195466 (patch)
tree46fd6465cb7431f64a3cb475a40587a261983af4
parentd0f70707dde032e662dbd5bc70df6ac915403abe (diff)
downloadvcxsrv-438af0c7d4bf60b408b259c88205ff2193195466.tar.gz
vcxsrv-438af0c7d4bf60b408b259c88205ff2193195466.tar.bz2
vcxsrv-438af0c7d4bf60b408b259c88205ff2193195466.zip
libxtrans xkeyboard-config xserver mesa plink glproto git update 21 Sep 2014
plink revision 10233 xserver commit 28337cb14e4347e1dd7936c5393a22e042866687 xkeyboard-config commit 48e1c0b351b6711edc0f167cbb81e4424b75291a glproto commit bd3d751e1eb17efb39f65093271bb4ac071aa9e0 libxtrans commit fb7f198c88e97d22c8c89e76e9cd06b2b2720a96 mesa commit 4eb2bbefd2bf0359aff7ebbb8e931a1c7833606f
-rw-r--r--X11/xtrans/Xtrans.c25
-rw-r--r--X11/xtrans/Xtrans.h4
-rw-r--r--gl/glxproto.h2
-rw-r--r--mesalib/configure.ac84
-rw-r--r--mesalib/docs/GL3.txt4
-rw-r--r--mesalib/docs/index.html11
-rw-r--r--mesalib/docs/relnotes.html2
-rw-r--r--mesalib/docs/relnotes/10.2.8.html130
-rw-r--r--mesalib/docs/relnotes/10.3.html252
-rw-r--r--mesalib/docs/relnotes/10.4.html62
-rw-r--r--mesalib/scons/gallium.py6
-rw-r--r--mesalib/src/gallium/Makefile.am4
-rw-r--r--mesalib/src/gallium/auxiliary/Makefile.am4
-rw-r--r--mesalib/src/gallium/auxiliary/Makefile.sources2
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_cpu_detect.c2
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format.c17
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format.csv80
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format.h2
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format_latc.c72
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format_parse.py9
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format_rgtc.c92
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_math.h1
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_sampler.c1
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_vbuf.c3
-rw-r--r--mesalib/src/glsl/Makefile.sources1
-rw-r--r--mesalib/src/glsl/ast_to_hir.cpp77
-rw-r--r--mesalib/src/glsl/ir_optimization.h2
-rw-r--r--mesalib/src/glsl/linker.cpp25
-rw-r--r--mesalib/src/glsl/linker.h3
-rw-r--r--mesalib/src/glsl/loop_analysis.h9
-rw-r--r--mesalib/src/glsl/lower_vertex_id.cpp144
-rw-r--r--mesalib/src/glsl/opt_constant_folding.cpp5
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlconfig.c4
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast.c3
-rw-r--r--mesalib/src/mesa/main/api_validate.c66
-rw-r--r--mesalib/src/mesa/main/arrayobj.c46
-rw-r--r--mesalib/src/mesa/main/arrayobj.h4
-rw-r--r--mesalib/src/mesa/main/attrib.c1
-rw-r--r--mesalib/src/mesa/main/buffers.c1
-rw-r--r--mesalib/src/mesa/main/clear.c1
-rw-r--r--mesalib/src/mesa/main/context.c12
-rw-r--r--mesalib/src/mesa/main/convolve.c5
-rw-r--r--mesalib/src/mesa/main/eval.c1
-rw-r--r--mesalib/src/mesa/main/feedback.c1
-rw-r--r--mesalib/src/mesa/main/fog.c1
-rw-r--r--mesalib/src/mesa/main/format_pack.c99
-rw-r--r--mesalib/src/mesa/main/format_unpack.c77
-rw-r--r--mesalib/src/mesa/main/format_utils.c1102
-rw-r--r--mesalib/src/mesa/main/formats.c26
-rw-r--r--mesalib/src/mesa/main/formats.csv5
-rw-r--r--mesalib/src/mesa/main/formats.h5
-rw-r--r--mesalib/src/mesa/main/histogram.c4
-rw-r--r--mesalib/src/mesa/main/macros.h8
-rw-r--r--mesalib/src/mesa/main/mtypes.h101
-rw-r--r--mesalib/src/mesa/main/pipelineobj.c4
-rw-r--r--mesalib/src/mesa/main/shader_query.cpp18
-rw-r--r--mesalib/src/mesa/main/state.c5
-rw-r--r--mesalib/src/mesa/main/texcompress_rgtc.c79
-rw-r--r--mesalib/src/mesa/main/texformat.c13
-rw-r--r--mesalib/src/mesa/main/uniform_query.cpp16
-rw-r--r--mesalib/src/mesa/main/varray.c9
-rw-r--r--mesalib/src/mesa/main/varray.h33
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp7
-rw-r--r--mesalib/src/mesa/program/prog_optimize.c9
-rw-r--r--mesalib/src/mesa/program/register_allocate.c1
-rw-r--r--mesalib/src/mesa/program/register_allocate.h5
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_texture.c30
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c10
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c62
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c82
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c1
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c121
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp3
-rw-r--r--mesalib/src/mesa/state_tracker/st_texture.c15
-rw-r--r--mesalib/src/mesa/swrast/s_texfetch.c5
-rw-r--r--mesalib/src/mesa/swrast/s_texfetch_tmp.h54
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_array.c26
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_draw.c2
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_draw.c1
-rw-r--r--mesalib/src/mesa/vbo/vbo_split_copy.c1
-rw-r--r--mesalib/src/util/Makefile.sources3
-rw-r--r--mesalib/src/util/rgtc.c61
-rw-r--r--mesalib/src/util/rgtc.h39
-rw-r--r--mesalib/src/util/texcompress_rgtc_tmp.h (renamed from mesalib/src/mesa/main/texcompress_rgtc_tmp.h)14
-rw-r--r--tools/plink/cmdline.c15
-rw-r--r--tools/plink/misc.c148
-rw-r--r--tools/plink/misc.h3
-rw-r--r--tools/plink/putty.h6
-rw-r--r--tools/plink/settings.c31
-rw-r--r--tools/plink/ssh.c166
-rw-r--r--tools/plink/sshpubk.c48
-rw-r--r--tools/plink/sshshare.c5
-rw-r--r--tools/plink/winhelp.h1
-rw-r--r--tools/plink/winplink.c8
-rw-r--r--tools/plink/winstore.c9
-rw-r--r--xorg-server/COPYING24
-rw-r--r--xorg-server/configure.ac41
-rw-r--r--xorg-server/dix/extension.c2
-rw-r--r--xorg-server/dix/main.c2
-rw-r--r--xorg-server/dix/pixmap.c18
-rw-r--r--xorg-server/dix/registry.c94
-rw-r--r--xorg-server/dix/resource.c2
-rw-r--r--xorg-server/glamor/glamor.c12
-rw-r--r--xorg-server/glamor/glamor_glyphs.c86
-rw-r--r--xorg-server/glamor/glamor_largepixmap.c96
-rw-r--r--xorg-server/glamor/glamor_pixmap.c2
-rw-r--r--xorg-server/glamor/glamor_priv.h50
-rw-r--r--xorg-server/glamor/glamor_trapezoid.c1708
-rw-r--r--xorg-server/glx/glxcmds.c7
-rw-r--r--xorg-server/glx/glxdriswrast.c2
-rw-r--r--xorg-server/hw/kdrive/ephyr/Makefile.am1
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr.h2
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrcursor.c262
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrinit.c67
-rw-r--r--xorg-server/hw/kdrive/ephyr/hostx.c39
-rw-r--r--xorg-server/hw/kdrive/ephyr/hostx.h4
-rw-r--r--xorg-server/hw/xfree86/Makefile.am2
-rw-r--r--xorg-server/hw/xfree86/doc/README.DRIcomp3
-rw-r--r--xorg-server/hw/xfree86/doc/Registry1
-rw-r--r--xorg-server/hw/xfree86/drivers/Makefile.am5
-rw-r--r--xorg-server/hw/xfree86/drivers/modesetting/Makefile.am61
-rw-r--r--xorg-server/hw/xfree86/drivers/modesetting/driver.c1113
-rw-r--r--xorg-server/hw/xfree86/drivers/modesetting/driver.h81
-rw-r--r--xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.c1616
-rw-r--r--xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.h136
-rw-r--r--xorg-server/hw/xfree86/drivers/modesetting/modesetting.man54
-rw-r--r--xorg-server/hw/xfree86/int10/generic.c16
-rw-r--r--xorg-server/hw/xfree86/loader/loadmod.c46
-rw-r--r--xorg-server/hw/xfree86/man/xorg.conf.man6
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/Makefile.am4
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/alpha_video.c434
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/arm_video.c284
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_axp.c71
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/i386_video.c562
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/ppc_video.c56
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c40
-rw-r--r--xorg-server/hw/xfree86/os-support/hurd/Makefile.am2
-rw-r--r--xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c94
-rw-r--r--xorg-server/hw/xfree86/os-support/hurd/hurd_video.c65
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/Makefile.am10
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/int10/linux.c19
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_axp.c103
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_init.c6
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_video.c676
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/bios_mmap.c135
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/vidmem.c205
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/xf86Axp.c60
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/xf86Axp.h33
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_vid.c140
-rw-r--r--xorg-server/hw/xfree86/os-support/stub/Makefile.am1
-rw-r--r--xorg-server/hw/xfree86/os-support/stub/stub_bios.c12
-rw-r--r--xorg-server/hw/xfree86/os-support/xf86OSpriv.h11
-rw-r--r--xorg-server/hw/xfree86/os-support/xf86_OSproc.h26
-rw-r--r--xorg-server/hw/xwayland/Makefile.am4
-rw-r--r--xorg-server/hw/xwayland/xwayland-input.c9
-rw-r--r--xorg-server/hw/xwayland/xwayland.c48
-rw-r--r--xorg-server/hw/xwayland/xwayland.h1
-rw-r--r--xorg-server/hw/xwin/Makefile.am33
-rw-r--r--xorg-server/hw/xwin/glx/.gitignore5
-rw-r--r--xorg-server/hw/xwin/glx/gen_gl_wrappers.py13
-rw-r--r--xorg-server/hw/xwin/glx/glwindows.h5
-rw-r--r--xorg-server/hw/xwin/glx/indirect.c19
-rw-r--r--xorg-server/hw/xwin/glx/winpriv.c2
-rw-r--r--xorg-server/hw/xwin/winclipboardthread.c3
-rw-r--r--xorg-server/hw/xwin/windisplay.c64
-rw-r--r--xorg-server/hw/xwin/windisplay.h34
-rw-r--r--xorg-server/hw/xwin/winmsg.h2
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwm.c7
-rw-r--r--xorg-server/hw/xwin/winprefs.c8
-rw-r--r--xorg-server/hw/xwin/winshadddnl.c4
-rw-r--r--xorg-server/include/dix-config.h.in3
-rw-r--r--xorg-server/include/pixmap.h6
-rw-r--r--xorg-server/include/pixmapstr.h1
-rw-r--r--xorg-server/include/registry.h40
-rw-r--r--xorg-server/include/xorg-config.h.in6
-rw-r--r--xorg-server/os/log.c10
-rw-r--r--xorg-server/os/utils.c6
-rw-r--r--xorg-server/present/present.c12
-rw-r--r--xorg-server/present/present.h1
-rw-r--r--xorg-server/present/present_event.c2
-rw-r--r--xorg-server/test/Makefile.am5
-rw-r--r--xorg-server/test/list.c24
-rw-r--r--xorg-server/test/signal-logging.c7
-rw-r--r--xorg-server/xkeyboard-config/rules/base.extras.xml.in292
-rw-r--r--xorg-server/xkeyboard-config/rules/base.xml.in269
-rw-r--r--xorg-server/xkeyboard-config/symbols/altwin4
-rw-r--r--xorg-server/xkeyboard-config/symbols/am2
-rw-r--r--xorg-server/xkeyboard-config/symbols/apl27
-rw-r--r--xorg-server/xkeyboard-config/symbols/ara3
-rw-r--r--xorg-server/xkeyboard-config/symbols/bg2
-rw-r--r--xorg-server/xkeyboard-config/symbols/br1
-rw-r--r--xorg-server/xkeyboard-config/symbols/brai2
-rw-r--r--xorg-server/xkeyboard-config/symbols/capslock24
-rw-r--r--xorg-server/xkeyboard-config/symbols/epo3
-rw-r--r--xorg-server/xkeyboard-config/symbols/fi2
-rw-r--r--xorg-server/xkeyboard-config/symbols/group2
-rw-r--r--xorg-server/xkeyboard-config/symbols/inet18
-rw-r--r--xorg-server/xkeyboard-config/symbols/ir67
-rw-r--r--xorg-server/xkeyboard-config/symbols/jp2
-rw-r--r--xorg-server/xkeyboard-config/symbols/keypad10
-rw-r--r--xorg-server/xkeyboard-config/symbols/kr4
-rw-r--r--xorg-server/xkeyboard-config/symbols/kz2
-rw-r--r--xorg-server/xkeyboard-config/symbols/level32
-rw-r--r--xorg-server/xkeyboard-config/symbols/pc2
-rw-r--r--xorg-server/xkeyboard-config/symbols/rs12
-rw-r--r--xorg-server/xkeyboard-config/symbols/ru2
206 files changed, 6969 insertions, 6758 deletions
diff --git a/X11/xtrans/Xtrans.c b/X11/xtrans/Xtrans.c
index 28808030c..bfba1ad79 100644
--- a/X11/xtrans/Xtrans.c
+++ b/X11/xtrans/Xtrans.c
@@ -804,6 +804,31 @@ TRANS(NoListen) (const char * protocol)
}
int
+TRANS(Listen) (const char * protocol)
+{
+ Xtransport *trans;
+ int i = 0, ret = 0;
+
+ if ((trans = TRANS(SelectTransport)(protocol)) == NULL)
+ {
+ prmsg (1,"TransListen: unable to find transport: %s\n",
+ protocol);
+
+ return -1;
+ }
+ if (trans->flags & TRANS_ALIAS) {
+ if (trans->nolisten)
+ while (trans->nolisten[i]) {
+ ret |= TRANS(Listen)(trans->nolisten[i]);
+ i++;
+ }
+ }
+
+ trans->flags &= ~TRANS_NOLISTEN;
+ return ret;
+}
+
+int
TRANS(IsListening) (const char * protocol)
{
Xtransport *trans;
diff --git a/X11/xtrans/Xtrans.h b/X11/xtrans/Xtrans.h
index 6decc6b3a..026fbd73f 100644
--- a/X11/xtrans/Xtrans.h
+++ b/X11/xtrans/Xtrans.h
@@ -311,6 +311,10 @@ int TRANS(NoListen) (
const char* /* protocol*/
);
+int TRANS(Listen) (
+ const char* /* protocol*/
+);
+
int TRANS(IsListening) (
const char* /* protocol*/
);
diff --git a/gl/glxproto.h b/gl/glxproto.h
index b50adc2c8..b4629c78c 100644
--- a/gl/glxproto.h
+++ b/gl/glxproto.h
@@ -2157,7 +2157,7 @@ typedef struct {
#define X_GLXCreateWindow 31
#define X_GLXDestroyWindow 32
#define X_GLXSetClientInfoARB 33
-#define X_GLXCreateContextAtrribsARB 34
+#define X_GLXCreateContextAttribsARB 34
#define X_GLXSetConfigInfo2ARB 35
/* Opcodes for single commands (part of GLX command space) */
diff --git a/mesalib/configure.ac b/mesalib/configure.ac
index be85fd51b..12f914e0f 100644
--- a/mesalib/configure.ac
+++ b/mesalib/configure.ac
@@ -823,6 +823,11 @@ fi
AM_CONDITIONAL(HAVE_SHARED_GLAPI, test "x$enable_shared_glapi" = xyes)
+# Build the pipe-drivers as separate libraries/modules.
+# Do not touch this unless you know what you are doing.
+# XXX: Expose via configure option ?
+enable_shared_pipe_drivers=no
+
dnl
dnl Driver specific build directories
dnl
@@ -843,7 +848,7 @@ esac
if test "x$enable_dri" = xyes; then
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/dri"
GALLIUM_STATE_TRACKERS_DIRS="dri $GALLIUM_STATE_TRACKERS_DIRS"
- enable_gallium_loader=yes
+ enable_gallium_loader="$enable_shared_pipe_drivers"
fi
if test "x$enable_gallium_osmesa" = xyes; then
@@ -1318,7 +1323,8 @@ if test "x$enable_gallium_egl" = xyes; then
GALLIUM_STATE_TRACKERS_DIRS="egl $GALLIUM_STATE_TRACKERS_DIRS"
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl-static"
-# enable_gallium_loader=yes
+# XXX: Uncomment once converted to use static/shared pipe-drivers
+# enable_gallium_loader=$enable_shared_pipe_drivers
fi
AM_CONDITIONAL(HAVE_GALLIUM_EGL, test "x$enable_gallium_egl" = xyes)
@@ -1347,7 +1353,7 @@ if test "x$enable_gallium_gbm" = xyes; then
GALLIUM_STATE_TRACKERS_DIRS="gbm $GALLIUM_STATE_TRACKERS_DIRS"
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS gbm"
- enable_gallium_loader=yes
+ enable_gallium_loader=$enable_shared_pipe_drivers
fi
AM_CONDITIONAL(HAVE_GALLIUM_GBM, test "x$enable_gallium_gbm" = xyes)
@@ -1364,7 +1370,7 @@ if test "x$enable_xa" = xyes; then
Example: ./configure --enable-xa --with-gallium-drivers=svga...])
fi
GALLIUM_STATE_TRACKERS_DIRS="xa $GALLIUM_STATE_TRACKERS_DIRS"
- enable_gallium_loader=yes
+ enable_gallium_loader=$enable_shared_pipe_drivers
fi
AM_CONDITIONAL(HAVE_ST_XA, test "x$enable_xa" = xyes)
@@ -1412,7 +1418,7 @@ fi
if test "x$enable_xvmc" = xyes; then
PKG_CHECK_MODULES([XVMC], [xvmc >= $XVMC_REQUIRED x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED])
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xvmc"
- enable_gallium_loader=yes
+ enable_gallium_loader=$enable_shared_pipe_drivers
fi
AM_CONDITIONAL(HAVE_ST_XVMC, test "x$enable_xvmc" = xyes)
@@ -1420,14 +1426,14 @@ if test "x$enable_vdpau" = xyes; then
PKG_CHECK_MODULES([VDPAU], [vdpau >= $VDPAU_REQUIRED x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED],
[VDPAU_LIBS="`$PKG_CONFIG --libs x11-xcb xcb xcb-dri2`"])
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vdpau"
- enable_gallium_loader=yes
+ enable_gallium_loader=$enable_shared_pipe_drivers
fi
AM_CONDITIONAL(HAVE_ST_VDPAU, test "x$enable_vdpau" = xyes)
if test "x$enable_omx" = xyes; then
PKG_CHECK_MODULES([OMX], [libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED])
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS omx"
- enable_gallium_loader=yes
+ enable_gallium_loader=$enable_shared_pipe_drivers
fi
AM_CONDITIONAL(HAVE_ST_OMX, test "x$enable_omx" = xyes)
@@ -1479,6 +1485,7 @@ if test "x$enable_opencl" = xyes; then
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS clover"
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS opencl"
+ # XXX: Use $enable_shared_pipe_drivers once converted to use static/shared pipe-drivers
enable_gallium_loader=yes
if test "x$enable_opencl_icd" = xyes; then
@@ -1653,6 +1660,7 @@ strip_unwanted_llvm_flags() {
# Use \> (marks the end of the word)
echo `$1` | sed \
-e 's/-DNDEBUG\>//g' \
+ -e 's/-D_GNU_SOURCE\>//g' \
-e 's/-pedantic\>//g' \
-e 's/-Wcovered-switch-default\>//g' \
-e 's/-O.\>//g' \
@@ -1687,7 +1695,7 @@ if test "x$enable_gallium_llvm" = xyes; then
fi
if test "x$LLVM_CONFIG" != xno; then
- LLVM_VERSION=`$LLVM_CONFIG --version | sed 's/svn.*//g'`
+ LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
LLVM_BINDIR=`$LLVM_CONFIG --bindir`
LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
@@ -1779,6 +1787,7 @@ dnl
dnl Gallium Tests
dnl
if test "x$enable_gallium_tests" = xyes; then
+ # XXX: Use $enable_shared_pipe_drivers once converted to use static/shared pipe-drivers
enable_gallium_loader=yes
fi
AM_CONDITIONAL(HAVE_GALLIUM_TESTS, test "x$enable_gallium_tests" = xyes)
@@ -1786,7 +1795,6 @@ AM_CONDITIONAL(HAVE_GALLIUM_TESTS, test "x$enable_gallium_tests" = xyes)
if test "x$enable_gallium_loader" = xyes; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS pipe-loader"
fi
-AM_CONDITIONAL(NEED_GALLIUM_LOADER, test "x$enable_gallium_loader" = xyes)
dnl Directory for VDPAU libs
AC_ARG_WITH([vdpau-libdir],
@@ -1820,27 +1828,26 @@ dnl
dnl Gallium helper functions
dnl
gallium_check_st() {
- if test "x$NEED_NONNULL_WINSYS" = xyes; then
- if test "x$have_libdrm" != xyes; then
- AC_MSG_ERROR([DRI or Xorg DDX requires libdrm >= $LIBDRM_REQUIRED])
- fi
- GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
- fi
- if test "x$enable_dri" = xyes && test -n "$2"; then
- GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
+ if test "x$have_libdrm" != xyes; then
+ AC_MSG_ERROR([$1 requires libdrm >= $LIBDRM_REQUIRED])
fi
- if test "x$enable_xa" = xyes && test -n "$3"; then
+ GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $2"
+
+ if test "x$enable_dri" = xyes && test -n "$3"; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
fi
- if test "x$enable_xvmc" = xyes && test -n "$4"; then
+ if test "x$enable_xa" = xyes && test -n "$4"; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $4"
fi
- if test "x$enable_vdpau" = xyes && test -n "$5"; then
+ if test "x$enable_xvmc" = xyes && test -n "$5"; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $5"
fi
- if test "x$enable_omx" = xyes && test "x$6" != x; then
+ if test "x$enable_vdpau" = xyes && test -n "$6"; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $6"
fi
+ if test "x$enable_omx" = xyes && test "x$7" != x; then
+ GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $7"
+ fi
}
gallium_require_llvm() {
@@ -1898,13 +1905,6 @@ radeon_llvm_check() {
[AC_MSG_ERROR([$1 requires libelf when using LLVM])])
}
-dnl Gallium drivers
-if test "x$enable_dri" = xyes -o "x$enable_xa" = xyes -o \
- "x$enable_xvmc" = xyes -o "x$enable_vdpau" = xyes; then
- NEED_NONNULL_WINSYS=yes
-fi
-AM_CONDITIONAL(NEED_NONNULL_WINSYS, test "x$NEED_NONNULL_WINSYS" = xyes)
-
dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block
if test -n "$with_gallium_drivers"; then
gallium_drivers=`IFS=', '; echo $with_gallium_drivers`
@@ -1914,21 +1914,21 @@ if test -n "$with_gallium_drivers"; then
HAVE_GALLIUM_SVGA=yes
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga softpipe"
gallium_require_drm_loader
- gallium_check_st "svga/drm" "dri/vmwgfx" "xa/vmwgfx"
+ gallium_check_st "svga" "svga/drm" "dri/vmwgfx" "xa/vmwgfx"
;;
xi915)
HAVE_GALLIUM_I915=yes
PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
gallium_require_drm_loader
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
- gallium_check_st "i915/drm" "dri/i915" "xa/i915"
+ gallium_check_st "Gallium i915" "i915/drm" "dri/i915" "xa/i915"
;;
xilo)
HAVE_GALLIUM_ILO=yes
PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
gallium_require_drm_loader
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS ilo"
- gallium_check_st "intel/drm" "dri/ilo" "xa/ilo"
+ gallium_check_st "Gallium i965/ilo" "intel/drm" "dri/ilo" "xa/ilo"
;;
xr300)
HAVE_GALLIUM_R300=yes
@@ -1936,7 +1936,7 @@ if test -n "$with_gallium_drivers"; then
gallium_require_drm_loader
gallium_require_llvm "Gallium R300"
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
- gallium_check_st "radeon/drm" "dri/r300"
+ gallium_check_st "Gallium R300" "radeon/drm" "dri/r300"
;;
xr600)
HAVE_GALLIUM_R600=yes
@@ -1953,7 +1953,7 @@ if test -n "$with_gallium_drivers"; then
if test "x$enable_opencl" = xyes; then
LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
fi
- gallium_check_st "radeon/drm" "dri/r600" "" "xvmc/r600" "vdpau/r600" "omx/r600"
+ gallium_check_st "Gallium R600" "radeon/drm" "dri/r600" "" "xvmc/r600" "vdpau/r600" "omx/r600"
;;
xradeonsi)
HAVE_GALLIUM_RADEONSI=yes
@@ -1962,21 +1962,21 @@ if test -n "$with_gallium_drivers"; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS radeonsi"
radeon_llvm_check "radeonsi"
require_egl_drm "radeonsi"
- gallium_check_st "radeon/drm" "dri/radeonsi" "" "" "vdpau/radeonsi" "omx/radeonsi"
+ gallium_check_st "radeonsi" "radeon/drm" "dri/radeonsi" "" "" "vdpau/radeonsi" "omx/radeonsi"
;;
xnouveau)
HAVE_GALLIUM_NOUVEAU=yes
PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
gallium_require_drm_loader
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau"
- gallium_check_st "nouveau/drm" "dri/nouveau" "xa/nouveau" "xvmc/nouveau" "vdpau/nouveau" "omx/nouveau"
+ gallium_check_st "nouveau" "nouveau/drm" "dri/nouveau" "xa/nouveau" "xvmc/nouveau" "vdpau/nouveau" "omx/nouveau"
;;
xfreedreno)
HAVE_GALLIUM_FREEDRENO=yes
PKG_CHECK_MODULES([FREEDRENO], [libdrm_freedreno >= $LIBDRM_FREEDRENO_REQUIRED])
gallium_require_drm_loader
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS freedreno"
- gallium_check_st "freedreno/drm" "dri/freedreno" "xa/freedreno" "" ""
+ gallium_check_st "freedreno" "freedreno/drm" "dri/freedreno" "xa/freedreno" "" ""
;;
xswrast)
HAVE_GALLIUM_SOFTPIPE=yes
@@ -1991,6 +1991,7 @@ if test -n "$with_gallium_drivers"; then
fi
if test "x$have_libdrm" = xyes; then
+ GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/kms-dri"
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri/kms-swrast"
fi
;;
@@ -1998,7 +1999,7 @@ if test -n "$with_gallium_drivers"; then
HAVE_GALLIUM_VC4=yes
gallium_require_drm_loader
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS vc4"
- gallium_check_st "vc4/drm" "dri-vc4" "" "" ""
+ gallium_check_st "vc4" "vc4/drm" "dri-vc4" "" "" ""
case "$host_cpu" in
i?86 | x86_64 | amd64)
@@ -2074,9 +2075,7 @@ AM_CONDITIONAL(NEED_GALLIUM_SOFTPIPE_DRIVER, test "x$HAVE_GALLIUM_SVGA" = xyes -
AM_CONDITIONAL(NEED_GALLIUM_LLVMPIPE_DRIVER, test "x$HAVE_GALLIUM_SOFTPIPE" = xyes \
&& test "x$MESA_LLVM" = x1)
-# Enable static gallium targets for now.
-# Do not touch this unless you know what you are doing.
-AM_CONDITIONAL(HAVE_GALLIUM_STATIC_TARGETS, test "xyes" = xyes)
+AM_CONDITIONAL(HAVE_GALLIUM_STATIC_TARGETS, test "x$enable_shared_pipe_drivers" = xno)
# NOTE: anything using xcb or other client side libs ends up in separate
# _CLIENT variables. The pipe loader is built in two variants,
@@ -2120,12 +2119,9 @@ AM_CONDITIONAL(HAVE_R200_DRI, test x$HAVE_R200_DRI = xyes)
AM_CONDITIONAL(HAVE_RADEON_DRI, test x$HAVE_RADEON_DRI = xyes)
AM_CONDITIONAL(HAVE_SWRAST_DRI, test x$HAVE_SWRAST_DRI = xyes)
-AM_CONDITIONAL(NEED_RADEON_DRM_WINSYS, test "x$NEED_NONNULL_WINSYS" = xyes -a \
- "x$HAVE_GALLIUM_R300" = xyes -o \
+AM_CONDITIONAL(NEED_RADEON_DRM_WINSYS, test "x$HAVE_GALLIUM_R300" = xyes -o \
"x$HAVE_GALLIUM_R600" = xyes -o \
"x$HAVE_GALLIUM_RADEONSI" = xyes)
-AM_CONDITIONAL(NEED_WINSYS_WRAPPER, test "x$HAVE_GALLIUM_I915" = xyes -o \
- "x$HAVE_GALLIUM_SVGA" = xyes)
AM_CONDITIONAL(NEED_WINSYS_XLIB, test "x$NEED_WINSYS_XLIB" = xyes)
AM_CONDITIONAL(NEED_RADEON_LLVM, test x$NEED_RADEON_LLVM = xyes)
AM_CONDITIONAL(USE_R600_LLVM_COMPILER, test x$USE_R600_LLVM_COMPILER = xyes)
diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt
index f5d5e72c9..5adc7598c 100644
--- a/mesalib/docs/GL3.txt
+++ b/mesalib/docs/GL3.txt
@@ -138,7 +138,7 @@ GL 4.2, GLSL 4.20:
GL_ARB_shader_atomic_counters DONE (i965)
GL_ARB_texture_storage DONE (all drivers)
GL_ARB_transform_feedback_instanced DONE (i965, nv50, nvc0, r600, radeonsi)
- GL_ARB_base_instance DONE (i965, nv50, nvc0, r600, radeonsi)
+ GL_ARB_base_instance DONE (i965, nv50, nvc0, r600, radeonsi, llvmpipe, softpipe)
GL_ARB_shader_image_load_store in progress (curro)
GL_ARB_conservative_depth DONE (all drivers that support GLSL 1.30)
GL_ARB_shading_language_420pack DONE (all drivers that support GLSL 1.30)
@@ -168,7 +168,7 @@ GL 4.3, GLSL 4.30:
GL_ARB_texture_buffer_range DONE (nv50, nvc0, i965, r600, radeonsi, llvmpipe)
GL_ARB_texture_query_levels DONE (all drivers that support GLSL 1.30)
GL_ARB_texture_storage_multisample DONE (all drivers that support GL_ARB_texture_multisample)
- GL_ARB_texture_view DONE (i965)
+ GL_ARB_texture_view DONE (i965, nv50, nvc0)
GL_ARB_vertex_attrib_binding DONE (all drivers)
diff --git a/mesalib/docs/index.html b/mesalib/docs/index.html
index 5d18dd25c..98162bbe9 100644
--- a/mesalib/docs/index.html
+++ b/mesalib/docs/index.html
@@ -16,6 +16,17 @@
<h1>News</h1>
+<h2>September 19, 2014</h2>
+<p>
+<a href="relnotes/10.3.html">Mesa 10.3</a> is released. This is a new
+development release. See the release notes for more information about
+the release.
+</p>
+<p>
+Also, <a href="relnotes/10.2.8.html">Mesa 10.2.8</a> is released.
+This is a bug fix release from the 10.2 branch.
+</p>
+
<h2>September 6, 2014</h2>
<p>
<a href="relnotes/10.2.7.html">Mesa 10.2.7</a> is released.
diff --git a/mesalib/docs/relnotes.html b/mesalib/docs/relnotes.html
index 36bcd139b..0a4c3de1d 100644
--- a/mesalib/docs/relnotes.html
+++ b/mesalib/docs/relnotes.html
@@ -21,6 +21,8 @@ The release notes summarize what's new or changed in each Mesa release.
</p>
<ul>
+<li><a href="relnotes/10.3.html">10.3 release notes</a>
+<li><a href="relnotes/10.2.8.html">10.2.8 release notes</a>
<li><a href="relnotes/10.2.7.html">10.2.7 release notes</a>
<li><a href="relnotes/10.2.6.html">10.2.6 release notes</a>
<li><a href="relnotes/10.2.5.html">10.2.5 release notes</a>
diff --git a/mesalib/docs/relnotes/10.2.8.html b/mesalib/docs/relnotes/10.2.8.html
new file mode 100644
index 000000000..307cc4304
--- /dev/null
+++ b/mesalib/docs/relnotes/10.2.8.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ <title>Mesa Release Notes</title>
+ <link rel="stylesheet" type="text/css" href="../mesa.css">
+</head>
+<body>
+
+<div class="header">
+ <h1>The Mesa 3D Graphics Library</h1>
+</div>
+
+<iframe src="../contents.html"></iframe>
+<div class="content">
+
+<h1>Mesa 10.2.8 Release Notes / September 19, 2014</h1>
+
+<p>
+Mesa 10.2.8 is a bug fix release which fixes bugs found since the 10.2.7 release.
+</p>
+<p>
+Mesa 10.2.8 implements the OpenGL 3.3 API, but the version reported by
+glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) /
+glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 3.3. OpenGL
+3.3 is <strong>only</strong> available if requested at context creation
+because compatibility contexts are not supported.
+</p>
+
+<h2>SHA256 checksums</h2>
+<pre>
+4c5a25ccaf1a9734bbd10d62a1420cc8fd35a1060ce679f2fc846769a25fbeec MesaLib-10.2.8.tar.gz
+1ef9ad3f241788d454f2ff8c9d65b6849dfc31c8fe91f70fd2930b81c8af1398 MesaLib-10.2.8.tar.bz2
+d26218da3b44734b1d555267b4c63c48803c4c8b14d2bc53071be57014da37fa MesaLib-10.2.8.zip
+</pre>
+
+<h2>New features</h2>
+<p>None</p>
+
+<h2>Bug fixes</h2>
+
+<p>This list is likely incomplete.</p>
+
+<ul>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=77493">Bug 77493</a> - lp_test_arit fails with llvm &gt;= llvm-3.5svn r206094</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82539">Bug 82539</a> - vmw_screen_dri.lo In file included from vmw_screen_dri.c:41: vmwgfx_drm.h:32:17: error: drm.h: No such file or directory</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82882">Bug 82882</a> - [swrast] piglit glsl-fs-uniform-bool-1 regression</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83432">Bug 83432</a> - r600_query.c:269:r600_emit_query_end: Assertion `ctx-&gt;num_pipelinestat_queries &gt; 0' failed [Gallium HUD]</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83567">Bug 83567</a> - Mesa 10.2.6 does not compile with llvm 3.5</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83735">Bug 83735</a> - [mesa-10.2.x] broken with llvm-3.5 and old CPUs</li>
+
+</ul>
+
+<h2>Changes</h2>
+<p>Aaron Watry (1):</p>
+<ul>
+ <li>gallivm: Fix build after LLVM commit 211259</li>
+</ul>
+
+<p>Christoph Bumiller (2):</p>
+<ul>
+ <li>nv50/ir/util: fix BitSet issues</li>
+ <li>nvc0/ir: clarify recursion fix to finding first tex uses</li>
+</ul>
+
+<p>Emil Velikov (3):</p>
+<ul>
+ <li>docs: Add sha256 sums for the 10.2.7 release</li>
+ <li>configure: bail out if building svga without libdrm</li>
+ <li>Update VERSION to 10.2.8</li>
+</ul>
+
+<p>Ilia Mirkin (4):</p>
+<ul>
+ <li>nv50/ir: avoid array overrun when checking for supported mods</li>
+ <li>nouveau: only enable the depth test if there actually is a depth buffer</li>
+ <li>nouveau: only enable stencil func if the visual has stencil bits</li>
+ <li>nouveau: change internal variables to avoid conflicts with macro args</li>
+</ul>
+
+<p>Jonathan Gray (1):</p>
+<ul>
+ <li>configure.ac: strip _GNU_SOURCE from llvm-config output</li>
+</ul>
+
+<p>José Fonseca (1):</p>
+<ul>
+ <li>gallivm: Disable workaround for PR12833 on LLVM 3.2+.</li>
+</ul>
+
+<p>Maarten Lankhorst (4):</p>
+<ul>
+ <li>nouveau: re-allocate bo's on overflow</li>
+ <li>nouveau: fix MPEG4 hw decoding</li>
+ <li>nouveau: rework reference frame handling</li>
+ <li>nouveau: remove unneeded assert</li>
+</ul>
+
+<p>Marek Olšák (3):</p>
+<ul>
+ <li>r600g,radeonsi: make sure there's enough CS space before resuming queries</li>
+ <li>mesa: set UniformBooleanTrue = 1.0f by default</li>
+ <li>st/mesa: use 1.0f as boolean true on drivers without integer support</li>
+</ul>
+
+<p>Richard Sandiford (1):</p>
+<ul>
+ <li>gallivm: Fix uses of 2^24</li>
+</ul>
+
+<p>Roland Scheidegger (1):</p>
+<ul>
+ <li>gallivm: set mcpu when initializing llvm execution engine</li>
+</ul>
+
+<p>Thomas Hellstrom (1):</p>
+<ul>
+ <li>winsys/svga: Fix incorrect type usage in IOCTL v2</li>
+</ul>
+
+</div>
+</body>
+</html>
diff --git a/mesalib/docs/relnotes/10.3.html b/mesalib/docs/relnotes/10.3.html
index fa4ea234f..53cd62d3d 100644
--- a/mesalib/docs/relnotes/10.3.html
+++ b/mesalib/docs/relnotes/10.3.html
@@ -14,7 +14,7 @@
<iframe src="../contents.html"></iframe>
<div class="content">
-<h1>Mesa 10.3 Release Notes / TBD</h1>
+<h1>Mesa 10.3 Release Notes / September 19, 2014</h1>
<p>
Mesa 10.3 is a new development release.
@@ -31,9 +31,11 @@ because compatibility contexts are not supported.
</p>
-<h2>MD5 checksums</h2>
+<h2>SHA256 checksums</h2>
<pre>
-TBD.
+9a1bf52040fc3dda81e83a35f944f1c3f532847dbe9fdf57161265cf71ea1bae MesaLib-10.3.0.tar.gz
+0283bfe710fa449ed82e465cfa09612a269e19abb7e0382082608062ce7960b5 MesaLib-10.3.0.tar.bz2
+221420763c2c3a244836a736e735612c4a6a0377b4e5223fca1e612f49906789 MesaLib-10.3.0.zip
</pre>
@@ -75,7 +77,249 @@ DRM drivers that don't have a full-fledged GEM (such as qxl or simpledrm)</li>
<h2>Bug fixes</h2>
-TBD.
+<ul>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=50754">Bug 50754</a> - Building 32 bit mesa on 64 bit OS fails since change for automake</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=53617">Bug 53617</a> - [llvmpipe] piglit fbo-depthtex regression</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=54372">Bug 54372</a> - GLX_INTEL_swap_event crashes driver when swapping window buffers</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=56127">Bug 56127</a> - [ILK bisected]unigine-sanctruary performance reduced by 98%</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=66184">Bug 66184</a> - src/mesa/state_tracker/st_glsl_to_tgsi.cpp:3216:simplify_cmp: Assertion `inst-&gt;dst.index &lt; 4096' failed.</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=66452">Bug 66452</a> - JUNIPER UVD accelerated playback of WMV3 streams does not work</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=68365">Bug 68365</a> - [SNB Bisected]Piglit spec_ARB_framebuffer_object_fbo-blit-stretch fail</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=70441">Bug 70441</a> - [Gen4-5 clip] Piglit spec_OpenGL_1.1_polygon-offset hits (execsize &gt;= width) assertion</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=73846">Bug 73846</a> - [llvmpipe] lp_test_format fails with llvm-3.5svn &gt;= r199602</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=74005">Bug 74005</a> - [i965 Bisected]Piglit/glx_glx-make-glxdrawable-current fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=74863">Bug 74863</a> - [r600g] HyperZ broken on RV770 and CYPRESS (Left 4 Dead 2 trees corruption) bisected!</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=75010">Bug 75010</a> - clang: error: unknown argument: '-fstack-protector-strong'</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=75478">Bug 75478</a> - [BDW]Some Piglit and Ogles2conform cases cause GPU hang</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=75664">Bug 75664</a> - Unigine Valley &amp; Heaven &quot;error: syntax error, unexpected EXTENSION, expecting $end&quot; IVB HD4000</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=75878">Bug 75878</a> - [BDW] GPU hang running Raytracer WebGL demo</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=76188">Bug 76188</a> - EGL_EXT_image_dma_buf_import fd ownership is incorrect</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=76223">Bug 76223</a> - [radeonsi] luxmark segfault</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=76939">Bug 76939</a> - [BDW] GPU hang when running “Metro:Last Light “ /“Crusader Kings II”</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=77245">Bug 77245</a> - Bogus GL_ARB_explicit_attrib_location layout identifier warnings</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=77493">Bug 77493</a> - lp_test_arit fails with llvm &gt;= llvm-3.5svn r206094</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=77703">Bug 77703</a> - [ILK Bisected]Piglit glean_texCombine4 fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=77704">Bug 77704</a> - [IVB/HSW Bisected]Ogles3conform GL3Tests_shadow_shadow_execution_frag.test fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=77705">Bug 77705</a> - [SNB/IVB/HSW/BYT/BDW Bisected]Ogles3conform GL3Tests/packed_pixels/packed_pixels_pixelstore.test segfault</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=77707">Bug 77707</a> - [ILK Bisected]Ogles2conform GL_sin_sin_float_frag_xvary.test fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=77740">Bug 77740</a> - i965: Relax accumulator dependency scheduling on Gen &lt; 6</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=77852">Bug 77852</a> - [BDW]Piglit spec_ARB_framebuffer_object_fbo-drawbuffers-none_glBlitFramebuffer fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=77856">Bug 77856</a> - [BDW]Piglit spec_OpenGL_3.0_clearbuffer-mixed-format fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=77865">Bug 77865</a> - [BDW] Many Ogles3conform framebuffer_blit cases fail</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78225">Bug 78225</a> - Compile error due to undefined reference to `gbm_dri_backend', fix attached</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78258">Bug 78258</a> - make check link_varyings.gl_ClipDistance failure</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78403">Bug 78403</a> - query_renderer_implementation_unittest.cpp:144:4: error: expected primary-expression before ‘.’ token</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78468">Bug 78468</a> - Compiling of shader gets stuck in infinite loop</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78537">Bug 78537</a> - no anisotropic filtering in a native Half-Life 2</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78546">Bug 78546</a> - [swrast] piglit copyteximage-border regression</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78581">Bug 78581</a> - OpenCL: clBuildProgram prints error messages directly rather than storing them</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78648">Bug 78648</a> - Texture artifacts in Kerbal Space Program</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78665">Bug 78665</a> - macros in builtin_functions.cpp make invalid assumptions about M_PI definitions</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78679">Bug 78679</a> - Gen4-5 code lost: runtime_check_aads_emit</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78691">Bug 78691</a> - [G45 - Tesseract] Mesa 10.1.2 implementation error: Unsupported opcode 169872468 in FS</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78692">Bug 78692</a> - Football Manager 2014, gameplay rendered black &amp; white</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78716">Bug 78716</a> - Fix Mesa bugs for running Unreal Engine 4.1 Cave effects demo compiled for Linux</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78803">Bug 78803</a> - gallivm/lp_bld_debug.cpp:42:28: fatal error: llvm/IR/Module.h: No such file or directory</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78842">Bug 78842</a> - [swrast] piglit fcc-read-after-clear copy rb regression</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78843">Bug 78843</a> - [swrast] piglit copyteximage 1D regression</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78872">Bug 78872</a> - [ILK Bisected]Piglit spec_ARB_depth_buffer_float_fbo-depthstencil-GL_DEPTH32F_STENCIL8-blit Aborted</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78875">Bug 78875</a> - [ILK Bisected]Webglc conformance/uniforms/uniform-default-values.html fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78888">Bug 78888</a> - test_eu_compact.c:54:3: error: implicit declaration of function ‘brw_disasm’ [-Werror=implicit-function-declaration]</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79029">Bug 79029</a> - INTEL_DEBUG=shader_time is full of lies</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79095">Bug 79095</a> - x86/common_x86.c:348:14: error: use of undeclared identifier 'bit_SSE4_1'</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79115">Bug 79115</a> - glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0) doesn't unbind stencil buffer</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79263">Bug 79263</a> - Linking error in egl_gallium.la when compiling 32 bit on multiarch</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79294">Bug 79294</a> - Xlib-based build broken on non x86/x86-64 architectures</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79373">Bug 79373</a> - Non-const initializers for matrix and vector constructors</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79382">Bug 79382</a> - build error: multiple definition of `loader_get_pci_id_for_fd'</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79421">Bug 79421</a> - [llvmpipe] SIGSEGV src/gallium/drivers/llvmpipe/lp_rast_priv.h:218</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79440">Bug 79440</a> - prog_hash_table.c:146: undefined reference to `_mesa_error_no_memory'</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79469">Bug 79469</a> - Commit e3cc0d90e14e62a0a787b6c07a6df0f5c84039be breaks unigine heaven</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79534">Bug 79534</a> - gen&lt;7 renders garbage</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79616">Bug 79616</a> - L4D2 crash on startup</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79724">Bug 79724</a> - switch statement type check</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79729">Bug 79729</a> - [i965] glClear on a multisample texture doesn't work</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79809">Bug 79809</a> - radeonsi: mouse cursor corruption using weston on AMD Kaveri</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79823">Bug 79823</a> - [NV30/gallium] Mozilla apps freeze on startup with nouveau-dri-10.2.1 libs on dual-screen</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79885">Bug 79885</a> - commit b52a530 (gallium/egl: st_profiles are build time decision, treat them as such) broke egl</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79903">Bug 79903</a> - [HSW Bisected]Some Piglit and Ogles2conform cases fail</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79907">Bug 79907</a> - Mesa 10.2.1 --enable-vdpau default=auto broken</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79948">Bug 79948</a> - [i965] Incorrect pixels when using discard and uniform loads</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80015">Bug 80015</a> - Transparency glitches in native Civilization 5 (Civ5) port</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80115">Bug 80115</a> - MESA_META_DRAW_BUFFERS induced GL_INVALID_VALUE errors</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80211">Bug 80211</a> - [ILK/SNB Bisected]Piglit shaders_glsl-fs-copy-propagation-texcoords-1 fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80247">Bug 80247</a> - Khronos conformance test ES3-CTS.gtf.GL3Tests.transform_feedback.transform_feedback_vertex_id fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80254">Bug 80254</a> - pipe_loader_sw.c:90: undefined reference to `dri_create_sw_winsys'</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80541">Bug 80541</a> - [softpipe] piglit levelclamp regression</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80561">Bug 80561</a> - Incorrect implementation of some VDPAU APIs.</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80614">Bug 80614</a> - [regression] Error in `omxregister-bellagio': munmap_chunk(): invalid pointer: 0x00007f5f76626dab</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80778">Bug 80778</a> - [bisected regression] piglit spec/glsl-1.50/compiler/incorrect-in-layout-qualifier-repeated-prim.geom</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80827">Bug 80827</a> - [radeonsi,R9 270X] Corruptions in window menus in KDE</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80880">Bug 80880</a> - Unreal Engine 4 demos fail GLSL compiler assertion</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80991">Bug 80991</a> - [BDW]Piglit spec_ARB_sample_shading_builtin-gl-sample-mask_2 fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=81020">Bug 81020</a> - [radeonsi][regresssion] Wireframe of background rendered through objects in Half-Life 2: Episode 2 with MSAA enabled</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=81150">Bug 81150</a> - [SNB]Piglit spec_arb_shading_language_packing_execution_built-in-functions_fs-packSnorm4x8 fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=81157">Bug 81157</a> - [BDW]Piglit some spec_glsl-1.50_execution_built-in-functions* cases fail</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=81450">Bug 81450</a> - [BDW]Piglit spec_glsl-1.30_execution_tex-miplevel-selection_textureGrad_1DArray cases intel_do_flush_locked failed</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=81828">Bug 81828</a> - [BDW Bisected]Ogles3conform GL3Tests_packed_pixels_packed_pixels_pbo.test fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=81834">Bug 81834</a> - TGSI constant buffer overrun causes assertion failure</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=81857">Bug 81857</a> - [SNB+]Piglit spec_glsl-1.30_execution_switch_fs-default_last sporadically fail</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=81967">Bug 81967</a> - [regression] Selections in Blender renders wrong</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82139">Bug 82139</a> - [r600g, bisected] multiple ubo piglit regressions</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82159">Bug 82159</a> - No rule to make target `../../../../src/mesa/libmesa.la', needed by `collision'.</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82255">Bug 82255</a> - [VP2] Chroma planes are vertically stretched during VDPAU playback</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82268">Bug 82268</a> - Add support for the OpenRISC architecture (or1k)</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82428">Bug 82428</a> - [radeonsi,R9 270X] System lockup when using mplayer/mpv with VDPAU</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82472">Bug 82472</a> - piglit 16385-consecutive-chars regression</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82483">Bug 82483</a> - format_srgb.h:145: undefined reference to `util_format_srgb_to_linear_8unorm_table'</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82517">Bug 82517</a> - [RADEONSI,VDPAU] SIGSEGV in map_msg_fb_buf called from ruvd_destroy, when closing a Tab with accelerated video player</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82534">Bug 82534</a> - src\egl\main\eglapi.h : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2E02</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82536">Bug 82536</a> - u_current.h:72: undefined reference to `__imp__glapi_Dispatch'</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82538">Bug 82538</a> - Super Maryo Chronicles fails with st/mesa assertion failure</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82539">Bug 82539</a> - vmw_screen_dri.lo In file included from vmw_screen_dri.c:41: vmwgfx_drm.h:32:17: error: drm.h: No such file or directory</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82546">Bug 82546</a> - [regression] libOSMesa build failure</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82574">Bug 82574</a> - GLSL: opt_vectorize goes wrong on texture lookups</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82628">Bug 82628</a> - bisected: GALLIUM_HUD hangs radeon 7970M (PRIME)</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82671">Bug 82671</a> - [r600g-evergreen][compute]Empty kernel execution causes crash</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82709">Bug 82709</a> - OpenCL not working on radeon hainan</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82796">Bug 82796</a> - [IVB/BYT-M/HSW/BDW Bisected]Synmark2_v6.0_OglTerrainFlyInst/OglTerrainPanInst cannot run as image validation failed</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82804">Bug 82804</a> - unreal engine 4 rendering errors</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82814">Bug 82814</a> - glDrawBuffers(0, NULL) segfaults in _mesa_drawbuffers</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82828">Bug 82828</a> - Regression: Crash in 3Dmark2001</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82846">Bug 82846</a> - [BDW Bisected] Gpu hang when running Lightsmark v2008/Warsow v1.0/Xonotic v0.7/unigine-demos</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82881">Bug 82881</a> - test_vec4_register_coalesce regression</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82882">Bug 82882</a> - [swrast] piglit glsl-fs-uniform-bool-1 regression</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82929">Bug 82929</a> - [BDW Bisected]glxgears causes X hang</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82932">Bug 82932</a> - [SNB+ Bisected]Ogles3conform ES3-CTS.shaders.indexing.vector_subscript.vec3_static_loop_subscript_write_direct_read_vertex fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83046">Bug 83046</a> - [BDW bisected]] Warsow v1.0/Xonotic v0.7/Gputest v0.5_triangle_fullscreen/synmark2_v6/GLBenchmark v2.5.0/GLBenchmark v2.7.0/Ungine-demos performance reduced 30%~60%</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83079">Bug 83079</a> - [NVC0] Dota 2 (Linux native and Wine) crash with Nouveau Drivers</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83081">Bug 83081</a> - [BDW Bisected]Piglit spec_ARB_sample_shading_builtin-gl-sample-mask_2 is core dumped</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83127">Bug 83127</a> - [ILK Bisected]Piglit glean_texCombine fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83355">Bug 83355</a> - FTBFS: src/mesa/program/program_lexer.l:122:64: error: unknown type name 'YYSTYPE'</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83432">Bug 83432</a> - r600_query.c:269:r600_emit_query_end: Assertion `ctx-&gt;num_pipelinestat_queries &gt; 0' failed [Gallium HUD]</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83468">Bug 83468</a> - [UBO] Using bool from UBO as if-statement condition asserts</li>
+
+</ul>
<h2>Changes</h2>
diff --git a/mesalib/docs/relnotes/10.4.html b/mesalib/docs/relnotes/10.4.html
new file mode 100644
index 000000000..e6813d3d1
--- /dev/null
+++ b/mesalib/docs/relnotes/10.4.html
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ <title>Mesa Release Notes</title>
+ <link rel="stylesheet" type="text/css" href="../mesa.css">
+</head>
+<body>
+
+<div class="header">
+ <h1>The Mesa 3D Graphics Library</h1>
+</div>
+
+<iframe src="../contents.html"></iframe>
+<div class="content">
+
+<h1>Mesa 10.4 Release Notes / TBD</h1>
+
+<p>
+Mesa 10.4 is a new development release.
+People who are concerned with stability and reliability should stick
+with a previous release or wait for Mesa 10.4.1.
+</p>
+<p>
+Mesa 10.4 implements the OpenGL 3.3 API, but the version reported by
+glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) /
+glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 3.3. OpenGL
+3.3 is <strong>only</strong> available if requested at context creation
+because compatibility contexts are not supported.
+</p>
+
+
+<h2>MD5 checksums</h2>
+<pre>
+TBD.
+</pre>
+
+
+<h2>New features</h2>
+
+<p>
+Note: some of the new features are only available with certain drivers.
+</p>
+
+<ul>
+<li>GL_ARB_texture_view on nv50, nvc0</li>
+</ul>
+
+
+<h2>Bug fixes</h2>
+
+TBD.
+
+<h2>Changes</h2>
+
+<ul>
+</ul>
+
+</div>
+</body>
+</html>
diff --git a/mesalib/scons/gallium.py b/mesalib/scons/gallium.py
index e91531971..1dcfa6b24 100644
--- a/mesalib/scons/gallium.py
+++ b/mesalib/scons/gallium.py
@@ -529,6 +529,10 @@ def generate(env):
else:
env['_LIBFLAGS'] = '-Wl,--start-group ' + env['_LIBFLAGS'] + ' -Wl,--end-group'
if env['platform'] == 'windows':
+ linkflags += [
+ '-Wl,--nxcompat', # DEP
+ '-Wl,--dynamicbase', # ASLR
+ ]
# Avoid depending on gcc runtime DLLs
linkflags += ['-static-libgcc']
if 'w64' in env['CC'].split('-'):
@@ -547,6 +551,8 @@ def generate(env):
linkflags += [
'/fixed:no',
'/incremental:no',
+ '/dynamicbase', # ASLR
+ '/nxcompat', # DEP
]
env.Append(LINKFLAGS = linkflags)
env.Append(SHLINKFLAGS = shlinkflags)
diff --git a/mesalib/src/gallium/Makefile.am b/mesalib/src/gallium/Makefile.am
index 32a5dc709..6018e9f72 100644
--- a/mesalib/src/gallium/Makefile.am
+++ b/mesalib/src/gallium/Makefile.am
@@ -105,9 +105,7 @@ if HAVE_EGL_PLATFORM_WAYLAND
SUBDIRS += winsys/sw/wayland
endif
-if NEED_WINSYS_WRAPPER
SUBDIRS += winsys/sw/wrapper
-endif
##
## Don't forget to bundle the remaining (non autotools) winsys'
@@ -123,7 +121,7 @@ EXTRA_DIST = \
## Gallium state trackers and their users (targets)
##
-if NEED_GALLIUM_LOADER
+if HAVE_LOADER_GALLIUM
SUBDIRS += targets/pipe-loader
endif
diff --git a/mesalib/src/gallium/auxiliary/Makefile.am b/mesalib/src/gallium/auxiliary/Makefile.am
index 493d306f6..4d8ba89cc 100644
--- a/mesalib/src/gallium/auxiliary/Makefile.am
+++ b/mesalib/src/gallium/auxiliary/Makefile.am
@@ -1,5 +1,9 @@
AUTOMAKE_OPTIONS = subdir-objects
+if HAVE_LOADER_GALLIUM
+SUBDIRS := pipe-loader
+endif
+
include Makefile.sources
include $(top_srcdir)/src/gallium/Automake.inc
diff --git a/mesalib/src/gallium/auxiliary/Makefile.sources b/mesalib/src/gallium/auxiliary/Makefile.sources
index 9bfaa0eab..58d8af71f 100644
--- a/mesalib/src/gallium/auxiliary/Makefile.sources
+++ b/mesalib/src/gallium/auxiliary/Makefile.sources
@@ -1,5 +1,3 @@
-SUBDIRS := pipe-loader
-
C_SOURCES := \
cso_cache/cso_cache.c \
cso_cache/cso_context.c \
diff --git a/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c b/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c
index d2d1313f8..5d9db59d1 100644
--- a/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c
+++ b/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c
@@ -369,7 +369,7 @@ util_cpu_detect(void)
util_cpu_caps.has_avx = ((regs2[2] >> 28) & 1) && // AVX
((regs2[2] >> 27) & 1) && // OSXSAVE
((xgetbv() & 6) == 6); // XMM & YMM
- util_cpu_caps.has_f16c = (regs2[2] >> 29) & 1;
+ util_cpu_caps.has_f16c = ((regs2[2] >> 29) & 1) && util_cpu_caps.has_avx;
util_cpu_caps.has_mmx2 = util_cpu_caps.has_sse; /* SSE cpus supports mmxext too */
#if defined(PIPE_ARCH_X86_64)
util_cpu_caps.has_daz = 1;
diff --git a/mesalib/src/gallium/auxiliary/util/u_format.c b/mesalib/src/gallium/auxiliary/util/u_format.c
index d53dd7884..c1ce40811 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format.c
+++ b/mesalib/src/gallium/auxiliary/util/u_format.c
@@ -92,6 +92,23 @@ util_format_is_luminance(enum pipe_format format)
}
boolean
+util_format_is_alpha(enum pipe_format format)
+{
+ const struct util_format_description *desc =
+ util_format_description(format);
+
+ if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
+ desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
+ desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_0 &&
+ desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0 &&
+ desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0 &&
+ desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_X) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+boolean
util_format_is_pure_integer(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
diff --git a/mesalib/src/gallium/auxiliary/util/u_format.csv b/mesalib/src/gallium/auxiliary/util/u_format.csv
index 17034049d..a71aaf15d 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format.csv
+++ b/mesalib/src/gallium/auxiliary/util/u_format.csv
@@ -46,6 +46,8 @@
# - number of bits
# - channel swizzle
# - color space: rgb, yub, sz
+# - (optional) channel encoding for big-endian targets
+# - (optional) channel swizzle for big-endian targets
#
# See also:
# - http://msdn.microsoft.com/en-us/library/bb172558.aspx (D3D9)
@@ -70,20 +72,20 @@ PIPE_FORMAT_A8B8G8R8_UNORM , plain, 1, 1, un8 , un8 , un8 , un8 , wzyx, r
PIPE_FORMAT_X8B8G8R8_UNORM , plain, 1, 1, x8 , un8 , un8 , un8 , wzy1, rgb
# PIPE_FORMAT_R8G8B8A8_UNORM is below
PIPE_FORMAT_R8G8B8X8_UNORM , plain, 1, 1, un8 , un8 , un8 , x8 , xyz1, rgb
-PIPE_FORMAT_B5G5R5X1_UNORM , plain, 1, 1, un5 , un5 , un5 , x1 , zyx1, rgb
-PIPE_FORMAT_B5G5R5A1_UNORM , plain, 1, 1, un5 , un5 , un5 , un1 , zyxw, rgb
-PIPE_FORMAT_B4G4R4A4_UNORM , plain, 1, 1, un4 , un4 , un4 , un4 , zyxw, rgb
-PIPE_FORMAT_B4G4R4X4_UNORM , plain, 1, 1, un4 , un4 , un4 , x4 , zyx1, rgb
-PIPE_FORMAT_B5G6R5_UNORM , plain, 1, 1, un5 , un6 , un5 , , zyx1, rgb
-PIPE_FORMAT_R10G10B10A2_UNORM , plain, 1, 1, un10, un10, un10, un2 , xyzw, rgb
-PIPE_FORMAT_B10G10R10A2_UNORM , plain, 1, 1, un10, un10, un10, un2 , zyxw, rgb
-PIPE_FORMAT_B2G3R3_UNORM , plain, 1, 1, un2 , un3 , un3 , , zyx1, rgb
+PIPE_FORMAT_B5G5R5X1_UNORM , plain, 1, 1, un5 , un5 , un5 , x1 , zyx1, rgb, x1 , un5 , un5 , un5 , yzw1
+PIPE_FORMAT_B5G5R5A1_UNORM , plain, 1, 1, un5 , un5 , un5 , un1 , zyxw, rgb, un1 , un5 , un5 , un5 , yzwx
+PIPE_FORMAT_B4G4R4A4_UNORM , plain, 1, 1, un4 , un4 , un4 , un4 , zyxw, rgb, un4 , un4 , un4 , un4 , yzwx
+PIPE_FORMAT_B4G4R4X4_UNORM , plain, 1, 1, un4 , un4 , un4 , x4 , zyx1, rgb, x4 , un4 , un4 , un4 , yzw1
+PIPE_FORMAT_B5G6R5_UNORM , plain, 1, 1, un5 , un6 , un5 , , zyx1, rgb, un5 , un6 , un5 , , xyz1
+PIPE_FORMAT_R10G10B10A2_UNORM , plain, 1, 1, un10, un10, un10, un2 , xyzw, rgb, un2 , un10, un10, un10, wzyx
+PIPE_FORMAT_B10G10R10A2_UNORM , plain, 1, 1, un10, un10, un10, un2 , zyxw, rgb, un2 , un10, un10, un10, yzwx
+PIPE_FORMAT_B2G3R3_UNORM , plain, 1, 1, un2 , un3 , un3 , , zyx1, rgb, un3 , un3 , un2 , , xyz1
# Luminance/Intensity/Alpha formats
PIPE_FORMAT_L8_UNORM , plain, 1, 1, un8 , , , , xxx1, rgb
PIPE_FORMAT_A8_UNORM , plain, 1, 1, un8 , , , , 000x, rgb
PIPE_FORMAT_I8_UNORM , plain, 1, 1, un8 , , , , xxxx, rgb
-PIPE_FORMAT_L4A4_UNORM , plain, 1, 1, un4 , un4 , , , xxxy, rgb
+PIPE_FORMAT_L4A4_UNORM , plain, 1, 1, un4 , un4 , , , xxxy, rgb, un4 , un4 , , , yyyx
PIPE_FORMAT_L8A8_UNORM , plain, 1, 1, un8 , un8 , , , xxxy, rgb
PIPE_FORMAT_L16_UNORM , plain, 1, 1, un16, , , , xxx1, rgb
PIPE_FORMAT_A16_UNORM , plain, 1, 1, un16, , , , 000x, rgb
@@ -120,22 +122,22 @@ PIPE_FORMAT_X8R8G8B8_SRGB , plain, 1, 1, x8 , un8 , un8 , un8 , yzw1, s
# Mixed-sign formats (typically used for bump map textures)
PIPE_FORMAT_R8SG8SB8UX8U_NORM , plain, 1, 1, sn8 , sn8 , un8 , x8 , xyz1, rgb
-PIPE_FORMAT_R10SG10SB10SA2U_NORM , plain, 1, 1, sn10, sn10, sn10, un2 , xyzw, rgb
-PIPE_FORMAT_R5SG5SB6U_NORM , plain, 1, 1, sn5 , sn5 , un6 , , xyz1, rgb
+PIPE_FORMAT_R10SG10SB10SA2U_NORM , plain, 1, 1, sn10, sn10, sn10, un2 , xyzw, rgb, un2 , sn10, sn10, sn10, wzyx
+PIPE_FORMAT_R5SG5SB6U_NORM , plain, 1, 1, sn5 , sn5 , un6 , , xyz1, rgb, un6 , sn5 , sn5 , , zyx1
# Depth-stencil formats
PIPE_FORMAT_S8_UINT , plain, 1, 1, up8 , , , , _x__, zs
PIPE_FORMAT_Z16_UNORM , plain, 1, 1, un16, , , , x___, zs
PIPE_FORMAT_Z32_UNORM , plain, 1, 1, un32, , , , x___, zs
PIPE_FORMAT_Z32_FLOAT , plain, 1, 1, f32 , , , , x___, zs
-PIPE_FORMAT_Z24_UNORM_S8_UINT , plain, 1, 1, un24, up8 , , , xy__, zs
-PIPE_FORMAT_S8_UINT_Z24_UNORM , plain, 1, 1, up8 , un24, , , yx__, zs
-PIPE_FORMAT_X24S8_UINT , plain, 1, 1, x24 , up8 , , , _y__, zs
-PIPE_FORMAT_S8X24_UINT , plain, 1, 1, up8 , x24 , , , _x__, zs
-PIPE_FORMAT_Z24X8_UNORM , plain, 1, 1, un24, x8 , , , x___, zs
-PIPE_FORMAT_X8Z24_UNORM , plain, 1, 1, x8 , un24, , , y___, zs
-PIPE_FORMAT_Z32_FLOAT_S8X24_UINT , plain, 1, 1, f32 , up8 , x24, , xy__, zs
-PIPE_FORMAT_X32_S8X24_UINT , plain, 1, 1, x32 , up8 , x24, , _y__, zs
+PIPE_FORMAT_Z24_UNORM_S8_UINT , plain, 1, 1, un24, up8 , , , xy__, zs, up8 , un24, , , yx__
+PIPE_FORMAT_S8_UINT_Z24_UNORM , plain, 1, 1, up8 , un24, , , yx__, zs, un24, up8 , , , xy__
+PIPE_FORMAT_X24S8_UINT , plain, 1, 1, x24 , up8 , , , _y__, zs, up8 , x24 , , , _x__
+PIPE_FORMAT_S8X24_UINT , plain, 1, 1, up8 , x24 , , , _x__, zs, x24 , up8 , , , _y__
+PIPE_FORMAT_Z24X8_UNORM , plain, 1, 1, un24, x8 , , , x___, zs, x8 , un24, , , y___
+PIPE_FORMAT_X8Z24_UNORM , plain, 1, 1, x8 , un24, , , y___, zs, un24, x8 , , , x___
+PIPE_FORMAT_Z32_FLOAT_S8X24_UINT , plain, 1, 1, f32 , up8 , x24, , xy__, zs, f32 , x24 , up8, , xz__
+PIPE_FORMAT_X32_S8X24_UINT , plain, 1, 1, x32 , up8 , x24, , _y__, zs, x32 , x24 , up8, , _z__
# YUV formats
# http://www.fourcc.org/yuv.php#UYVY
@@ -267,9 +269,9 @@ PIPE_FORMAT_R32G32B32A32_FIXED , plain, 1, 1, h32 , h32 , h32 , h32 , xyzw, r
# See also:
# - http://msdn.microsoft.com/en-us/library/bb172533.aspx
# A.k.a. D3DDECLTYPE_UDEC3
-PIPE_FORMAT_R10G10B10X2_USCALED , plain, 1, 1, u10 , u10 , u10 , x2 , xyz1, rgb
+PIPE_FORMAT_R10G10B10X2_USCALED , plain, 1, 1, u10 , u10 , u10 , x2 , xyz1, rgb, x2 , u10 , u10 , u10 , wzy1
# A.k.a. D3DDECLTYPE_DEC3N
-PIPE_FORMAT_R10G10B10X2_SNORM , plain, 1, 1, sn10, sn10, sn10 , x2 , xyz1, rgb
+PIPE_FORMAT_R10G10B10X2_SNORM , plain, 1, 1, sn10, sn10, sn10 , x2 , xyz1, rgb, x2 , sn10, sn10, sn10, wzy1
PIPE_FORMAT_YV12 , other, 1, 1, x8 , x8 , x8 , x8 , xyzw, yuv
PIPE_FORMAT_YV16 , other, 1, 1, x8 , x8 , x8 , x8 , xyzw, yuv
@@ -278,18 +280,18 @@ PIPE_FORMAT_NV12 , other, 1, 1, x8 , x8 , x8 , x8 , xyzw, y
PIPE_FORMAT_NV21 , other, 1, 1, x8 , x8 , x8 , x8 , xyzw, yuv
# Usually used to implement IA44 and AI44 formats in video decoding
-PIPE_FORMAT_A4R4_UNORM , plain, 1, 1, un4 , un4 , , , y00x, rgb
-PIPE_FORMAT_R4A4_UNORM , plain, 1, 1, un4 , un4 , , , x00y, rgb
+PIPE_FORMAT_A4R4_UNORM , plain, 1, 1, un4 , un4 , , , y00x, rgb, un4, un4 , , , x00y
+PIPE_FORMAT_R4A4_UNORM , plain, 1, 1, un4 , un4 , , , x00y, rgb, un4, un4 , , , y00x
PIPE_FORMAT_R8A8_UNORM , plain, 1, 1, un8 , un8 , , , x00y, rgb
PIPE_FORMAT_A8R8_UNORM , plain, 1, 1, un8 , un8 , , , y00x, rgb
# ARB_vertex_type_10_10_10_2_REV
-PIPE_FORMAT_R10G10B10A2_USCALED , plain, 1, 1, u10, u10, u10, u2, xyzw, rgb
-PIPE_FORMAT_R10G10B10A2_SSCALED , plain, 1, 1, s10, s10, s10, s2, xyzw, rgb
-PIPE_FORMAT_R10G10B10A2_SNORM , plain, 1, 1, sn10, sn10, sn10, sn2, xyzw, rgb
-PIPE_FORMAT_B10G10R10A2_USCALED , plain, 1, 1, u10, u10, u10, u2, zyxw, rgb
-PIPE_FORMAT_B10G10R10A2_SSCALED , plain, 1, 1, s10, s10, s10, s2, zyxw, rgb
-PIPE_FORMAT_B10G10R10A2_SNORM , plain, 1, 1, sn10, sn10, sn10, sn2, zyxw, rgb
+PIPE_FORMAT_R10G10B10A2_USCALED , plain, 1, 1, u10 , u10 , u10 , u2 , xyzw, rgb, u2 , u10 , u10 , u10 , wzyx
+PIPE_FORMAT_R10G10B10A2_SSCALED , plain, 1, 1, s10 , s10 , s10 , s2 , xyzw, rgb, s2 , s10 , s10 , s10 , wzyx
+PIPE_FORMAT_R10G10B10A2_SNORM , plain, 1, 1, sn10, sn10, sn10, sn2 , xyzw, rgb, sn2 , sn10, sn10, sn10, wzyx
+PIPE_FORMAT_B10G10R10A2_USCALED , plain, 1, 1, u10 , u10 , u10 , u2 , zyxw, rgb, u2 , u10 , u10 , u10 , yzwx
+PIPE_FORMAT_B10G10R10A2_SSCALED , plain, 1, 1, s10 , s10 , s10 , s2 , zyxw, rgb, s2 , s10 , s10 , s10 , yzwx
+PIPE_FORMAT_B10G10R10A2_SNORM , plain, 1, 1, sn10, sn10, sn10, sn2 , zyxw, rgb, sn2 , sn10, sn10, sn10, yzwx
PIPE_FORMAT_R8_UINT , plain, 1, 1, up8, , , , x001, rgb
PIPE_FORMAT_R8G8_UINT , plain, 1, 1, up8, up8, , , xy01, rgb
@@ -351,13 +353,13 @@ PIPE_FORMAT_I32_SINT , plain, 1, 1, sp32, , , , xxxx, rgb
PIPE_FORMAT_L32_SINT , plain, 1, 1, sp32, , , , xxx1, rgb
PIPE_FORMAT_L32A32_SINT , plain, 1, 1, sp32, sp32, , , xxxy, rgb
-PIPE_FORMAT_B10G10R10A2_UINT , plain, 1, 1, up10, up10, up10, up2, zyxw, rgb
+PIPE_FORMAT_B10G10R10A2_UINT , plain, 1, 1, up10, up10, up10, up2, zyxw, rgb, up2 , up10, up10, up10, yzwx
PIPE_FORMAT_R8G8B8X8_SNORM , plain, 1, 1, sn8, sn8, sn8, x8, xyz1, rgb
PIPE_FORMAT_R8G8B8X8_SRGB , plain, 1, 1, un8, un8, un8, x8, xyz1, srgb
PIPE_FORMAT_R8G8B8X8_UINT , plain, 1, 1, up8, up8, up8, x8, xyz1, rgb
PIPE_FORMAT_R8G8B8X8_SINT , plain, 1, 1, sp8, sp8, sp8, x8, xyz1, rgb
-PIPE_FORMAT_B10G10R10X2_UNORM , plain, 1, 1, un10, un10, un10, x2, zyx1, rgb
+PIPE_FORMAT_B10G10R10X2_UNORM , plain, 1, 1, un10, un10, un10, x2, zyx1, rgb, x2 , un10, un10, un10, yzw1
PIPE_FORMAT_R16G16B16X16_UNORM , plain, 1, 1, un16, un16, un16, x16, xyz1, rgb
PIPE_FORMAT_R16G16B16X16_SNORM , plain, 1, 1, sn16, sn16, sn16, x16, xyz1, rgb
PIPE_FORMAT_R16G16B16X16_FLOAT , plain, 1, 1, f16, f16, f16, x16, xyz1, rgb
@@ -378,7 +380,19 @@ PIPE_FORMAT_R16A16_UINT , plain, 1, 1, up16 , up16 , , , x00
PIPE_FORMAT_R16A16_SINT , plain, 1, 1, sp16 , sp16 , , , x00y, rgb
PIPE_FORMAT_R32A32_UINT , plain, 1, 1, up32 , up32 , , , x00y, rgb
PIPE_FORMAT_R32A32_SINT , plain, 1, 1, sp32 , sp32 , , , x00y, rgb
-PIPE_FORMAT_R10G10B10A2_UINT , plain, 1, 1, up10 , up10 , up10, up2 , xyzw, rgb
+PIPE_FORMAT_R10G10B10A2_UINT , plain, 1, 1, up10 , up10 , up10, up2 , xyzw, rgb, up2 , up10, up10, up10, wzyx
-PIPE_FORMAT_B5G6R5_SRGB , plain, 1, 1, un5 , un6 , un5 , , zyx1, srgb
+PIPE_FORMAT_B5G6R5_SRGB , plain, 1, 1, un5 , un6 , un5 , , zyx1, srgb, un5 , un6 , un5 , , xyz1
+PIPE_FORMAT_A8L8_UNORM , plain, 1, 1, un8 , un8 , , , yyyx, rgb
+PIPE_FORMAT_A8L8_SNORM , plain, 1, 1, sn8 , sn8 , , , yyyx, rgb
+PIPE_FORMAT_A8L8_SRGB , plain, 1, 1, un8 , un8 , , , yyyx, srgb
+PIPE_FORMAT_A16L16_UNORM , plain, 1, 1, un16, un16, , , yyyx, rgb
+
+PIPE_FORMAT_G8R8_UNORM , plain, 1, 1, un8 , un8 , , , yx01, rgb
+PIPE_FORMAT_G8R8_SNORM , plain, 1, 1, sn8 , sn8 , , , yx01, rgb
+PIPE_FORMAT_G16R16_UNORM , plain, 1, 1, un16, un16, , , yx01, rgb
+PIPE_FORMAT_G16R16_SNORM , plain, 1, 1, sn16, sn16, , , yx01, rgb
+
+PIPE_FORMAT_A8B8G8R8_SNORM , plain, 1, 1, sn8 , sn8 , sn8 , sn8 , wzyx, rgb
+PIPE_FORMAT_X8B8G8R8_SNORM , plain, 1, 1, x8, sn8, sn8, sn8, wzy1, rgb
diff --git a/mesalib/src/gallium/auxiliary/util/u_format.h b/mesalib/src/gallium/auxiliary/util/u_format.h
index df31400af..621574c96 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format.h
+++ b/mesalib/src/gallium/auxiliary/util/u_format.h
@@ -661,6 +661,8 @@ util_format_has_alpha(enum pipe_format format);
boolean
util_format_is_luminance(enum pipe_format format);
+boolean
+util_format_is_alpha(enum pipe_format format);
boolean
util_format_is_luminance_alpha(enum pipe_format format);
diff --git a/mesalib/src/gallium/auxiliary/util/u_format_latc.c b/mesalib/src/gallium/auxiliary/util/u_format_latc.c
index caab7e87a..31d72b5a0 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format_latc.c
+++ b/mesalib/src/gallium/auxiliary/util/u_format_latc.c
@@ -27,27 +27,16 @@
#include "u_format.h"
#include "u_format_rgtc.h"
#include "u_format_latc.h"
-
-static void u_format_unsigned_encode_rgtc_ubyte(uint8_t *blkaddr, uint8_t srccolors[4][4],
- int numxpixels, int numypixels);
-
-static void u_format_unsigned_fetch_texel_rgtc(unsigned srcRowStride, const uint8_t *pixdata,
- unsigned i, unsigned j, uint8_t *value, unsigned comps);
-
-static void u_format_signed_encode_rgtc_ubyte(int8_t *blkaddr, int8_t srccolors[4][4],
- int numxpixels, int numypixels);
-
-static void u_format_signed_fetch_texel_rgtc(unsigned srcRowStride, const int8_t *pixdata,
- unsigned i, unsigned j, int8_t *value, unsigned comps);
+#include "util/rgtc.h"
void
util_format_latc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
{
/* Fix warnings here: */
- (void) u_format_unsigned_encode_rgtc_ubyte;
- (void) u_format_signed_encode_rgtc_ubyte;
+ (void) util_format_unsigned_encode_rgtc_ubyte;
+ (void) util_format_signed_encode_rgtc_ubyte;
- u_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1);
+ util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1);
dst[1] = dst[0];
dst[2] = dst[0];
dst[3] = 255;
@@ -79,7 +68,7 @@ util_format_latc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
for(i = 0; i < 4; ++i) {
float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
uint8_t tmp_r;
- u_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
+ util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
dst[0] =
dst[1] =
dst[2] = ubyte_to_float(tmp_r);
@@ -103,7 +92,7 @@ util_format_latc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigne
{
uint8_t tmp_r;
- u_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
+ util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
dst[0] =
dst[1] =
dst[2] = ubyte_to_float(tmp_r);
@@ -147,7 +136,7 @@ util_format_latc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
for(i = 0; i < 4; ++i) {
float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
int8_t tmp_r;
- u_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
+ util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
dst[0] =
dst[1] =
dst[2] = byte_to_float_tex(tmp_r);
@@ -165,7 +154,7 @@ util_format_latc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigne
{
int8_t tmp_r;
- u_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 1);
+ util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 1);
dst[0] =
dst[1] =
dst[2] = byte_to_float_tex(tmp_r);
@@ -176,10 +165,10 @@ util_format_latc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigne
void
util_format_latc2_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
{
- u_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2);
+ util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2);
dst[1] = dst[0];
dst[2] = dst[0];
- u_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 3, 2);
+ util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 3, 2);
}
void
@@ -213,8 +202,8 @@ util_format_latc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
for(i = 0; i < 4; ++i) {
float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
uint8_t tmp_r, tmp_g;
- u_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
- u_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
+ util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
+ util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
dst[0] =
dst[1] =
dst[2] = ubyte_to_float(tmp_r);
@@ -232,8 +221,8 @@ util_format_latc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigne
{
uint8_t tmp_r, tmp_g;
- u_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
- u_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
+ util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
+ util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
dst[0] =
dst[1] =
dst[2] = ubyte_to_float(tmp_r);
@@ -272,8 +261,8 @@ util_format_latc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
for(i = 0; i < 4; ++i) {
float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
int8_t tmp_r, tmp_g;
- u_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
- u_format_signed_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
+ util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
+ util_format_signed_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
dst[0] =
dst[1] =
dst[2] = byte_to_float_tex(tmp_r);
@@ -297,36 +286,11 @@ util_format_latc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigne
{
int8_t tmp_r, tmp_g;
- u_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 2);
- u_format_signed_fetch_texel_rgtc(0, (int8_t *)src + 8, i, j, &tmp_g, 2);
+ util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 2);
+ util_format_signed_fetch_texel_rgtc(0, (int8_t *)src + 8, i, j, &tmp_g, 2);
dst[0] =
dst[1] =
dst[2] = byte_to_float_tex(tmp_r);
dst[3] = byte_to_float_tex(tmp_g);
}
-
-#define TAG(x) u_format_unsigned_##x
-#define TYPE uint8_t
-#define T_MIN 0
-#define T_MAX 255
-
-#include "../../../mesa/main/texcompress_rgtc_tmp.h"
-
-#undef TYPE
-#undef TAG
-#undef T_MIN
-#undef T_MAX
-
-
-#define TAG(x) u_format_signed_##x
-#define TYPE int8_t
-#define T_MIN (int8_t)-128
-#define T_MAX (int8_t)127
-
-#include "../../../mesa/main/texcompress_rgtc_tmp.h"
-
-#undef TYPE
-#undef TAG
-#undef T_MIN
-#undef T_MAX
diff --git a/mesalib/src/gallium/auxiliary/util/u_format_parse.py b/mesalib/src/gallium/auxiliary/util/u_format_parse.py
index 15cc6d4fe..929017a44 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format_parse.py
+++ b/mesalib/src/gallium/auxiliary/util/u_format_parse.py
@@ -330,6 +330,9 @@ def parse(filename):
continue
fields = [field.strip() for field in line.split(',')]
+ if len (fields) == 10:
+ fields += fields[4:9]
+ assert len (fields) == 15
name = fields[0]
layout = fields[1]
@@ -339,8 +342,8 @@ def parse(filename):
le_swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[8]]
le_channels = _parse_channels(fields[4:8], layout, colorspace, le_swizzles)
- be_swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[8]]
- be_channels = _parse_channels(fields[4:8], layout, colorspace, be_swizzles)
+ be_swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[14]]
+ be_channels = _parse_channels(fields[10:14], layout, colorspace, be_swizzles)
le_shift = 0
for channel in le_channels:
@@ -353,6 +356,8 @@ def parse(filename):
be_shift += channel.size
assert le_shift == be_shift
+ for i in range(4):
+ assert (le_swizzles[i] != SWIZZLE_NONE) == (be_swizzles[i] != SWIZZLE_NONE)
format = Format(name, layout, block_width, block_height, le_channels, le_swizzles, be_channels, be_swizzles, colorspace)
formats.append(format)
diff --git a/mesalib/src/gallium/auxiliary/util/u_format_rgtc.c b/mesalib/src/gallium/auxiliary/util/u_format_rgtc.c
index 758e33774..159691743 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format_rgtc.c
+++ b/mesalib/src/gallium/auxiliary/util/u_format_rgtc.c
@@ -26,23 +26,12 @@
#include "u_math.h"
#include "u_format.h"
#include "u_format_rgtc.h"
-
-static void u_format_unsigned_encode_rgtc_ubyte(uint8_t *blkaddr, uint8_t srccolors[4][4],
- int numxpixels, int numypixels);
-
-static void u_format_unsigned_fetch_texel_rgtc(unsigned srcRowStride, const uint8_t *pixdata,
- unsigned i, unsigned j, uint8_t *value, unsigned comps);
-
-static void u_format_signed_encode_rgtc_ubyte(int8_t *blkaddr, int8_t srccolors[4][4],
- int numxpixels, int numypixels);
-
-static void u_format_signed_fetch_texel_rgtc(unsigned srcRowStride, const int8_t *pixdata,
- unsigned i, unsigned j, int8_t *value, unsigned comps);
+#include "util/rgtc.h"
void
util_format_rgtc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
{
- u_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1);
+ util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1);
dst[1] = 0;
dst[2] = 0;
dst[3] = 255;
@@ -61,7 +50,7 @@ util_format_rgtc1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride
for(j = 0; j < bh; ++j) {
for(i = 0; i < bw; ++i) {
uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps;
- u_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1);
+ util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1);
dst[1] = 0;
dst[2] = 0;
dst[3] = 255;
@@ -89,7 +78,7 @@ util_format_rgtc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
tmp[j][i] = src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4];
}
}
- u_format_unsigned_encode_rgtc_ubyte(dst, tmp, 4, 4);
+ util_format_unsigned_encode_rgtc_ubyte(dst, tmp, 4, 4);
dst += bytes_per_block;
}
dst_row += dst_stride / sizeof(*dst_row);
@@ -108,7 +97,7 @@ util_format_rgtc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
for(i = 0; i < 4; ++i) {
float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
uint8_t tmp_r;
- u_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
+ util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
dst[0] = ubyte_to_float(tmp_r);
dst[1] = 0.0;
dst[2] = 0.0;
@@ -136,7 +125,7 @@ util_format_rgtc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
tmp[j][i] = float_to_ubyte(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
}
}
- u_format_unsigned_encode_rgtc_ubyte(dst, tmp, 4, 4);
+ util_format_unsigned_encode_rgtc_ubyte(dst, tmp, 4, 4);
dst += bytes_per_block;
}
dst_row += dst_stride / sizeof(*dst_row);
@@ -147,7 +136,7 @@ void
util_format_rgtc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
{
uint8_t tmp_r;
- u_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
+ util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
dst[0] = ubyte_to_float(tmp_r);
dst[1] = 0.0;
dst[2] = 0.0;
@@ -187,7 +176,7 @@ util_format_rgtc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
tmp[j][i] = float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
}
}
- u_format_signed_encode_rgtc_ubyte(dst, tmp, 4, 4);
+ util_format_signed_encode_rgtc_ubyte(dst, tmp, 4, 4);
dst += bytes_per_block;
}
dst_row += dst_stride / sizeof(*dst_row);
@@ -206,7 +195,7 @@ util_format_rgtc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
for(i = 0; i < 4; ++i) {
float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
int8_t tmp_r;
- u_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
+ util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
dst[0] = byte_to_float_tex(tmp_r);
dst[1] = 0.0;
dst[2] = 0.0;
@@ -223,7 +212,7 @@ void
util_format_rgtc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
{
int8_t tmp_r;
- u_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 1);
+ util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 1);
dst[0] = byte_to_float_tex(tmp_r);
dst[1] = 0.0;
dst[2] = 0.0;
@@ -234,8 +223,8 @@ util_format_rgtc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigne
void
util_format_rgtc2_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
{
- u_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2);
- u_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 1, 2);
+ util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2);
+ util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 1, 2);
dst[2] = 0;
dst[3] = 255;
}
@@ -253,8 +242,8 @@ util_format_rgtc2_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride
for(j = 0; j < bh; ++j) {
for(i = 0; i < bw; ++i) {
uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps;
- u_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2);
- u_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 1, 2);
+ util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2);
+ util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 1, 2);
dst[2] = 0;
dst[3] = 255;
}
@@ -282,8 +271,8 @@ util_format_rgtc2_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
tmp_g[j][i] = src_row[((y + j)*src_stride/sizeof(*src_row) + (x + i)*4) + 1];
}
}
- u_format_unsigned_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
- u_format_unsigned_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
+ util_format_unsigned_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
+ util_format_unsigned_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
dst += bytes_per_block;
}
dst_row += dst_stride / sizeof(*dst_row);
@@ -307,8 +296,8 @@ util_format_rxtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
tmp_g[j][i] = float_to_ubyte(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4 + chan2off]);
}
}
- u_format_unsigned_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
- u_format_unsigned_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
+ util_format_unsigned_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
+ util_format_unsigned_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
dst += bytes_per_block;
}
dst_row += dst_stride / sizeof(*dst_row);
@@ -333,8 +322,8 @@ util_format_rgtc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
for(i = 0; i < 4; ++i) {
float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
uint8_t tmp_r, tmp_g;
- u_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
- u_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
+ util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
+ util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
dst[0] = ubyte_to_float(tmp_r);
dst[1] = ubyte_to_float(tmp_g);
dst[2] = 0.0;
@@ -351,8 +340,8 @@ void
util_format_rgtc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
{
uint8_t tmp_r, tmp_g;
- u_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
- u_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
+ util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
+ util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
dst[0] = ubyte_to_float(tmp_r);
dst[1] = ubyte_to_float(tmp_g);
dst[2] = 0.0;
@@ -390,8 +379,8 @@ util_format_rgtc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
for(i = 0; i < 4; ++i) {
float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
int8_t tmp_r, tmp_g;
- u_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
- u_format_signed_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
+ util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
+ util_format_signed_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
dst[0] = byte_to_float_tex(tmp_r);
dst[1] = byte_to_float_tex(tmp_g);
dst[2] = 0.0;
@@ -421,8 +410,8 @@ util_format_rxtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
tmp_g[j][i] = float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4 + chan2off]);
}
}
- u_format_signed_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
- u_format_signed_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
+ util_format_signed_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
+ util_format_signed_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
dst += bytes_per_block;
}
dst_row += dst_stride / sizeof(*dst_row);
@@ -439,36 +428,11 @@ void
util_format_rgtc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
{
int8_t tmp_r, tmp_g;
- u_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 2);
- u_format_signed_fetch_texel_rgtc(0, (int8_t *)src + 8, i, j, &tmp_g, 2);
+ util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 2);
+ util_format_signed_fetch_texel_rgtc(0, (int8_t *)src + 8, i, j, &tmp_g, 2);
dst[0] = byte_to_float_tex(tmp_r);
dst[1] = byte_to_float_tex(tmp_g);
dst[2] = 0.0;
dst[3] = 1.0;
}
-
-#define TAG(x) u_format_unsigned_##x
-#define TYPE uint8_t
-#define T_MIN 0
-#define T_MAX 255
-
-#include "../../../mesa/main/texcompress_rgtc_tmp.h"
-
-#undef TYPE
-#undef TAG
-#undef T_MIN
-#undef T_MAX
-
-
-#define TAG(x) u_format_signed_##x
-#define TYPE int8_t
-#define T_MIN (int8_t)-128
-#define T_MAX (int8_t)127
-
-#include "../../../mesa/main/texcompress_rgtc_tmp.h"
-
-#undef TYPE
-#undef TAG
-#undef T_MIN
-#undef T_MAX
diff --git a/mesalib/src/gallium/auxiliary/util/u_math.h b/mesalib/src/gallium/auxiliary/util/u_math.h
index 25bcfb57d..39bd40fa1 100644
--- a/mesalib/src/gallium/auxiliary/util/u_math.h
+++ b/mesalib/src/gallium/auxiliary/util/u_math.h
@@ -40,6 +40,7 @@
#include "pipe/p_compiler.h"
+#include "util/u_debug.h"
#ifdef __cplusplus
diff --git a/mesalib/src/gallium/auxiliary/util/u_sampler.c b/mesalib/src/gallium/auxiliary/util/u_sampler.c
index 227641bda..86799fdd5 100644
--- a/mesalib/src/gallium/auxiliary/util/u_sampler.c
+++ b/mesalib/src/gallium/auxiliary/util/u_sampler.c
@@ -45,6 +45,7 @@ default_template(struct pipe_sampler_view *view,
/* XXX: Check if format is compatible with texture->format.
*/
+ view->target = texture->target;
view->format = format;
view->u.tex.first_level = 0;
view->u.tex.last_level = texture->last_level;
diff --git a/mesalib/src/gallium/auxiliary/util/u_vbuf.c b/mesalib/src/gallium/auxiliary/util/u_vbuf.c
index 650df9f6a..b1b89bf1b 100644
--- a/mesalib/src/gallium/auxiliary/util/u_vbuf.c
+++ b/mesalib/src/gallium/auxiliary/util/u_vbuf.c
@@ -357,7 +357,8 @@ u_vbuf_set_vertex_elements_internal(struct u_vbuf *mgr, unsigned count,
assert(ve);
if (ve != mgr->ve)
- pipe->bind_vertex_elements_state(pipe, ve->driver_cso);
+ pipe->bind_vertex_elements_state(pipe, ve->driver_cso);
+
return ve;
}
diff --git a/mesalib/src/glsl/Makefile.sources b/mesalib/src/glsl/Makefile.sources
index 2131ddafb..cb8d5a6f7 100644
--- a/mesalib/src/glsl/Makefile.sources
+++ b/mesalib/src/glsl/Makefile.sources
@@ -76,6 +76,7 @@ LIBGLSL_FILES = \
$(GLSL_SRCDIR)/lower_vec_index_to_swizzle.cpp \
$(GLSL_SRCDIR)/lower_vector.cpp \
$(GLSL_SRCDIR)/lower_vector_insert.cpp \
+ $(GLSL_SRCDIR)/lower_vertex_id.cpp \
$(GLSL_SRCDIR)/lower_output_reads.cpp \
$(GLSL_SRCDIR)/lower_ubo_reference.cpp \
$(GLSL_SRCDIR)/opt_algebraic.cpp \
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp
index 897505c60..5ec1614be 100644
--- a/mesalib/src/glsl/ast_to_hir.cpp
+++ b/mesalib/src/glsl/ast_to_hir.cpp
@@ -3202,6 +3202,41 @@ validate_identifier(const char *identifier, YYLTYPE loc,
}
}
+static bool
+precision_qualifier_allowed(const glsl_type *type)
+{
+ /* Precision qualifiers apply to floating point, integer and sampler
+ * types.
+ *
+ * Section 4.5.2 (Precision Qualifiers) of the GLSL 1.30 spec says:
+ * "Any floating point or any integer declaration can have the type
+ * preceded by one of these precision qualifiers [...] Literal
+ * constants do not have precision qualifiers. Neither do Boolean
+ * variables.
+ *
+ * Section 4.5 (Precision and Precision Qualifiers) of the GLSL 1.30
+ * spec also says:
+ *
+ * "Precision qualifiers are added for code portability with OpenGL
+ * ES, not for functionality. They have the same syntax as in OpenGL
+ * ES."
+ *
+ * Section 8 (Built-In Functions) of the GLSL ES 1.00 spec says:
+ *
+ * "uniform lowp sampler2D sampler;
+ * highp vec2 coord;
+ * ...
+ * lowp vec4 col = texture2D (sampler, coord);
+ * // texture2D returns lowp"
+ *
+ * From this, we infer that GLSL 1.30 (and later) should allow precision
+ * qualifiers on sampler types just like float and integer types.
+ */
+ return type->is_float()
+ || type->is_integer()
+ || type->is_record()
+ || type->is_sampler();
+}
ir_rvalue *
ast_declarator_list::hir(exec_list *instructions,
@@ -3689,41 +3724,13 @@ ast_declarator_list::hir(exec_list *instructions,
}
- /* Precision qualifiers apply to floating point, integer and sampler
- * types.
- *
- * Section 4.5.2 (Precision Qualifiers) of the GLSL 1.30 spec says:
- * "Any floating point or any integer declaration can have the type
- * preceded by one of these precision qualifiers [...] Literal
- * constants do not have precision qualifiers. Neither do Boolean
- * variables.
- *
- * Section 4.5 (Precision and Precision Qualifiers) of the GLSL 1.30
- * spec also says:
- *
- * "Precision qualifiers are added for code portability with OpenGL
- * ES, not for functionality. They have the same syntax as in OpenGL
- * ES."
- *
- * Section 8 (Built-In Functions) of the GLSL ES 1.00 spec says:
- *
- * "uniform lowp sampler2D sampler;
- * highp vec2 coord;
- * ...
- * lowp vec4 col = texture2D (sampler, coord);
- * // texture2D returns lowp"
- *
- * From this, we infer that GLSL 1.30 (and later) should allow precision
- * qualifiers on sampler types just like float and integer types.
+ /* If a precision qualifier is allowed on a type, it is allowed on
+ * an array of that type.
*/
- if (this->type->qualifier.precision != ast_precision_none
- && !var->type->is_float()
- && !var->type->is_integer()
- && !var->type->is_record()
- && !var->type->is_sampler()
- && !(var->type->is_array()
- && (var->type->fields.array->is_float()
- || var->type->fields.array->is_integer()))) {
+ if (!(this->type->qualifier.precision == ast_precision_none
+ || precision_qualifier_allowed(var->type)
+ || (var->type->is_array()
+ && precision_qualifier_allowed(var->type->fields.array)))) {
_mesa_glsl_error(&loc, state,
"precision qualifiers apply only to floating point"
@@ -5455,7 +5462,7 @@ ast_interface_block::hir(exec_list *instructions,
}
if (this->instance_name != NULL) {
_mesa_glsl_error(&loc, state,
- "gl_PerVertex input may not be redeclared with "
+ "gl_PerVertex output may not be redeclared with "
"an instance name");
}
break;
diff --git a/mesalib/src/glsl/ir_optimization.h b/mesalib/src/glsl/ir_optimization.h
index 1c6f72b54..369dcd15b 100644
--- a/mesalib/src/glsl/ir_optimization.h
+++ b/mesalib/src/glsl/ir_optimization.h
@@ -126,6 +126,8 @@ bool optimize_redundant_jumps(exec_list *instructions);
bool optimize_split_arrays(exec_list *instructions, bool linked);
bool lower_offset_arrays(exec_list *instructions);
+bool lower_vertex_id(gl_shader *shader);
+
ir_rvalue *
compare_index_block(exec_list *instructions, ir_variable *index,
unsigned base, unsigned components, void *mem_ctx);
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp
index 57be4931d..7689198b0 100644
--- a/mesalib/src/glsl/linker.cpp
+++ b/mesalib/src/glsl/linker.cpp
@@ -559,14 +559,21 @@ validate_vertex_shader_executable(struct gl_shader_program *prog,
* vertex processing has occurred. Its value is undefined if
* the vertex shader executable does not write gl_Position."
*
- * GLSL ES 3.00 is similar to GLSL 1.40--failing to write to gl_Position is
- * not an error.
+ * All GLSL ES Versions are similar to GLSL 1.40--failing to write to
+ * gl_Position is not an error.
*/
if (prog->Version < (prog->IsES ? 300 : 140)) {
find_assignment_visitor find("gl_Position");
find.run(shader->ir);
if (!find.variable_found()) {
- linker_error(prog, "vertex shader does not write to `gl_Position'\n");
+ if (prog->IsES) {
+ linker_warning(prog,
+ "vertex shader does not write to `gl_Position'."
+ "It's value is undefined. \n");
+ } else {
+ linker_error(prog,
+ "vertex shader does not write to `gl_Position'. \n");
+ }
return;
}
}
@@ -1115,8 +1122,8 @@ move_non_declarations(exec_list *instructions, exec_node *last,
/**
* Get the function signature for main from a shader
*/
-static ir_function_signature *
-get_main_function_signature(gl_shader *sh)
+ir_function_signature *
+link_get_main_function_signature(gl_shader *sh)
{
ir_function *const f = sh->symbols->get_function("main");
if (f != NULL) {
@@ -1644,7 +1651,7 @@ link_intrastage_shaders(void *mem_ctx,
*/
gl_shader *main = NULL;
for (unsigned i = 0; i < num_shaders; i++) {
- if (get_main_function_signature(shader_list[i]) != NULL) {
+ if (link_get_main_function_signature(shader_list[i]) != NULL) {
main = shader_list[i];
break;
}
@@ -1673,7 +1680,8 @@ link_intrastage_shaders(void *mem_ctx,
/* The a pointer to the main function in the final linked shader (i.e., the
* copy of the original shader that contained the main function).
*/
- ir_function_signature *const main_sig = get_main_function_signature(linked);
+ ir_function_signature *const main_sig =
+ link_get_main_function_signature(linked);
/* Move any instructions other than variable declarations or function
* declarations into main.
@@ -1736,6 +1744,9 @@ link_intrastage_shaders(void *mem_ctx,
}
}
+ if (ctx->Const.VertexID_is_zero_based)
+ lower_vertex_id(linked);
+
/* Make a pass over all variable declarations to ensure that arrays with
* unspecified sizes have a size specified. The size is inferred from the
* max_array_access field.
diff --git a/mesalib/src/glsl/linker.h b/mesalib/src/glsl/linker.h
index beb9bb216..9440794e2 100644
--- a/mesalib/src/glsl/linker.h
+++ b/mesalib/src/glsl/linker.h
@@ -26,6 +26,9 @@
#ifndef GLSL_LINKER_H
#define GLSL_LINKER_H
+ir_function_signature *
+link_get_main_function_signature(gl_shader *sh);
+
extern bool
link_function_calls(gl_shader_program *prog, gl_shader *main,
gl_shader **shader_list, unsigned num_shaders);
diff --git a/mesalib/src/glsl/loop_analysis.h b/mesalib/src/glsl/loop_analysis.h
index 295dc797c..31be4f3cf 100644
--- a/mesalib/src/glsl/loop_analysis.h
+++ b/mesalib/src/glsl/loop_analysis.h
@@ -205,10 +205,10 @@ public:
inline bool is_loop_constant() const
{
const bool is_const = (this->num_assignments == 0)
- || ((this->num_assignments == 1)
+ || (((this->num_assignments == 1)
&& !this->conditional_or_nested_assignment
&& !this->read_before_write
- && this->rhs_clean);
+ && this->rhs_clean) || this->var->data.read_only);
/* If the RHS of *the* assignment is clean, then there must be exactly
* one assignment of the variable.
@@ -216,11 +216,6 @@ public:
assert((this->rhs_clean && (this->num_assignments == 1))
|| !this->rhs_clean);
- /* Variables that are marked read-only *MUST* be loop constant.
- */
- assert(!this->var->data.read_only
- || (this->var->data.read_only && is_const));
-
return is_const;
}
diff --git a/mesalib/src/glsl/lower_vertex_id.cpp b/mesalib/src/glsl/lower_vertex_id.cpp
new file mode 100644
index 000000000..fc90bc8e6
--- /dev/null
+++ b/mesalib/src/glsl/lower_vertex_id.cpp
@@ -0,0 +1,144 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file lower_vertex_id.cpp
+ *
+ * There exists hardware, such as i965, that does not implement the OpenGL
+ * semantic for gl_VertexID. Instead, that hardware does not include the
+ * value of basevertex in the gl_VertexID value. To implement the OpenGL
+ * semantic, we'll have to convert gl_Vertex_ID to
+ * gl_VertexIDMESA+gl_BaseVertexMESA.
+ */
+
+#include "glsl_symbol_table.h"
+#include "ir_hierarchical_visitor.h"
+#include "ir.h"
+#include "ir_builder.h"
+#include "linker.h"
+#include "program/prog_statevars.h"
+
+namespace {
+
+class lower_vertex_id_visitor : public ir_hierarchical_visitor {
+public:
+ explicit lower_vertex_id_visitor(ir_function_signature *main_sig,
+ exec_list *ir_list)
+ : progress(false), VertexID(NULL), gl_VertexID(NULL),
+ gl_BaseVertex(NULL), main_sig(main_sig), ir_list(ir_list)
+ {
+ foreach_in_list(ir_instruction, ir, ir_list) {
+ ir_variable *const var = ir->as_variable();
+
+ if (var != NULL && var->data.mode == ir_var_system_value &&
+ var->data.location == SYSTEM_VALUE_BASE_VERTEX) {
+ gl_BaseVertex = var;
+ break;
+ }
+ }
+ }
+
+ virtual ir_visitor_status visit(ir_dereference_variable *);
+
+ bool progress;
+
+private:
+ ir_variable *VertexID;
+ ir_variable *gl_VertexID;
+ ir_variable *gl_BaseVertex;
+
+ ir_function_signature *main_sig;
+ exec_list *ir_list;
+};
+
+} /* anonymous namespace */
+
+ir_visitor_status
+lower_vertex_id_visitor::visit(ir_dereference_variable *ir)
+{
+ if (ir->var->data.mode != ir_var_system_value ||
+ ir->var->data.location != SYSTEM_VALUE_VERTEX_ID)
+ return visit_continue;
+
+ if (VertexID == NULL) {
+ const glsl_type *const int_t = glsl_type::int_type;
+ void *const mem_ctx = ralloc_parent(ir);
+
+ VertexID = new(mem_ctx) ir_variable(int_t, "__VertexID",
+ ir_var_temporary);
+ ir_list->push_head(VertexID);
+
+ gl_VertexID = new(mem_ctx) ir_variable(int_t, "gl_VertexIDMESA",
+ ir_var_system_value);
+ gl_VertexID->data.how_declared = ir_var_declared_implicitly;
+ gl_VertexID->data.read_only = true;
+ gl_VertexID->data.location = SYSTEM_VALUE_VERTEX_ID_ZERO_BASE;
+ gl_VertexID->data.explicit_location = true;
+ gl_VertexID->data.explicit_index = 0;
+ ir_list->push_head(gl_VertexID);
+
+ if (gl_BaseVertex == NULL) {
+ gl_BaseVertex = new(mem_ctx) ir_variable(int_t, "gl_BaseVertex",
+ ir_var_system_value);
+ gl_BaseVertex->data.how_declared = ir_var_declared_implicitly;
+ gl_BaseVertex->data.read_only = true;
+ gl_BaseVertex->data.location = SYSTEM_VALUE_BASE_VERTEX;
+ gl_BaseVertex->data.explicit_location = true;
+ gl_BaseVertex->data.explicit_index = 0;
+ ir_list->push_head(gl_BaseVertex);
+ }
+
+ ir_instruction *const inst =
+ ir_builder::assign(VertexID,
+ ir_builder::add(gl_VertexID, gl_BaseVertex));
+
+ main_sig->body.push_head(inst);
+ }
+
+ ir->var = VertexID;
+ progress = true;
+
+ return visit_continue;
+}
+
+bool
+lower_vertex_id(gl_shader *shader)
+{
+ /* gl_VertexID only exists in the vertex shader.
+ */
+ if (shader->Stage != MESA_SHADER_VERTEX)
+ return false;
+
+ ir_function_signature *const main_sig =
+ link_get_main_function_signature(shader);
+ if (main_sig == NULL) {
+ assert(main_sig != NULL);
+ return false;
+ }
+
+ lower_vertex_id_visitor v(main_sig, shader->ir);
+
+ v.run(shader->ir);
+
+ return v.progress;
+}
diff --git a/mesalib/src/glsl/opt_constant_folding.cpp b/mesalib/src/glsl/opt_constant_folding.cpp
index d0e575460..74b855e5e 100644
--- a/mesalib/src/glsl/opt_constant_folding.cpp
+++ b/mesalib/src/glsl/opt_constant_folding.cpp
@@ -79,6 +79,11 @@ ir_constant_folding_visitor::handle_rvalue(ir_rvalue **rvalue)
}
}
+ /* Ditto for swizzles. */
+ ir_swizzle *swiz = (*rvalue)->as_swizzle();
+ if (swiz && !swiz->val->as_constant())
+ return;
+
ir_constant *constant = (*rvalue)->constant_expression_value();
if (constant) {
*rvalue = constant;
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
index ce376475c..8e48522e2 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
+++ b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
@@ -429,8 +429,10 @@ static void
__driUtilMessage(const char *f, ...)
{
va_list args;
+ const char *libgl_debug;
- if (getenv("LIBGL_DEBUG")) {
+ libgl_debug=getenv("LIBGL_DEBUG");
+ if (libgl_debug && !strstr(libgl_debug, "quiet")) {
fprintf(stderr, "libGL: ");
va_start(args, f);
vfprintf(stderr, f, args);
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index e28991b0c..e8a2c12d7 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -772,9 +772,6 @@ dri_create_context(gl_api api,
driContextSetFlags(mesaCtx, flags);
- /* do bounds checking to prevent segfaults and server crashes! */
- mesaCtx->Const.CheckArrayBounds = GL_TRUE;
-
/* create module contexts */
_swrast_CreateContext( mesaCtx );
_vbo_CreateContext( mesaCtx );
diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c
index 8f0b1998d..51a3d1f01 100644
--- a/mesalib/src/mesa/main/api_validate.c
+++ b/mesalib/src/mesa/main/api_validate.c
@@ -160,47 +160,6 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
/**
- * Do bounds checking on array element indexes. Check that the vertices
- * pointed to by the indices don't lie outside buffer object bounds.
- * \return GL_TRUE if OK, GL_FALSE if any indexed vertex goes is out of bounds
- */
-static GLboolean
-check_index_bounds(struct gl_context *ctx, GLsizei count, GLenum type,
- const GLvoid *indices, GLint basevertex)
-{
- struct _mesa_prim prim;
- struct _mesa_index_buffer ib;
- GLuint min, max;
-
- /* Only the X Server needs to do this -- otherwise, accessing outside
- * array/BO bounds allows application termination.
- */
- if (!ctx->Const.CheckArrayBounds)
- return GL_TRUE;
-
- memset(&prim, 0, sizeof(prim));
- prim.count = count;
-
- memset(&ib, 0, sizeof(ib));
- ib.type = type;
- ib.ptr = indices;
- ib.obj = ctx->Array.VAO->IndexBufferObj;
-
- vbo_get_minmax_indices(ctx, &prim, &ib, &min, &max, 1);
-
- if ((int)(min + basevertex) < 0 ||
- max + basevertex >= ctx->Array.VAO->_MaxElement) {
- /* the max element is out of bounds of one or more enabled arrays */
- _mesa_warning(ctx, "glDrawElements() index=%u is out of bounds (max=%u)",
- max, ctx->Array.VAO->_MaxElement);
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-
-/**
* Is 'mode' a valid value for glBegin(), glDrawArrays(), glDrawElements(),
* etc? The set of legal values depends on whether geometry shaders/programs
* are supported.
@@ -453,9 +412,6 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
return GL_FALSE;
}
- if (!check_index_bounds(ctx, count, type, indices, basevertex))
- return GL_FALSE;
-
if (count == 0)
return GL_FALSE;
@@ -517,12 +473,6 @@ _mesa_validate_MultiDrawElements(struct gl_context *ctx,
}
}
- for (i = 0; i < primcount; i++) {
- if (!check_index_bounds(ctx, count[i], type, indices[i],
- basevertex ? basevertex[i] : 0))
- return GL_FALSE;
- }
-
return GL_TRUE;
}
@@ -588,9 +538,6 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode,
return GL_FALSE;
}
- if (!check_index_bounds(ctx, count, type, indices, basevertex))
- return GL_FALSE;
-
if (count == 0)
return GL_FALSE;
@@ -623,11 +570,6 @@ _mesa_validate_DrawArrays(struct gl_context *ctx,
if (!check_valid_to_render(ctx, "glDrawArrays"))
return GL_FALSE;
- if (ctx->Const.CheckArrayBounds) {
- if (start + count > (GLint) ctx->Array.VAO->_MaxElement)
- return GL_FALSE;
- }
-
/* From the GLES3 specification, section 2.14.2 (Transform Feedback
* Primitive Capture):
*
@@ -692,11 +634,6 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi
if (!check_valid_to_render(ctx, "glDrawArraysInstanced(invalid to render)"))
return GL_FALSE;
- if (ctx->Const.CheckArrayBounds) {
- if (first + count > (GLint) ctx->Array.VAO->_MaxElement)
- return GL_FALSE;
- }
-
/* From the GLES3 specification, section 2.14.2 (Transform Feedback
* Primitive Capture):
*
@@ -791,9 +728,6 @@ _mesa_validate_DrawElementsInstanced(struct gl_context *ctx,
if (count == 0)
return GL_FALSE;
- if (!check_index_bounds(ctx, count, type, indices, basevertex))
- return GL_FALSE;
-
return GL_TRUE;
}
diff --git a/mesalib/src/mesa/main/arrayobj.c b/mesalib/src/mesa/main/arrayobj.c
index 1ea319a74..0d77b112b 100644
--- a/mesalib/src/mesa/main/arrayobj.c
+++ b/mesalib/src/mesa/main/arrayobj.c
@@ -291,52 +291,6 @@ remove_array_object( struct gl_context *ctx, struct gl_vertex_array_object *obj
}
-
-/**
- * Helper for _mesa_update_vao_max_element().
- * \return min(vao->_VertexAttrib[*]._MaxElement).
- */
-static GLuint
-compute_max_element(struct gl_vertex_array_object *vao, GLbitfield64 enabled)
-{
- GLuint min = ~((GLuint)0);
-
- while (enabled) {
- struct gl_client_array *client_array;
- GLint attrib = ffsll(enabled) - 1;
- enabled ^= BITFIELD64_BIT(attrib);
-
- client_array = &vao->_VertexAttrib[attrib];
- assert(client_array->Enabled);
- _mesa_update_array_max_element(client_array);
- min = MIN2(min, client_array->_MaxElement);
- }
-
- return min;
-}
-
-
-/**
- * Examine vertex arrays to update the gl_vertex_array_object::_MaxElement field.
- */
-void
-_mesa_update_vao_max_element(struct gl_context *ctx,
- struct gl_vertex_array_object *vao)
-{
- GLbitfield64 enabled;
-
- if (!ctx->VertexProgram._Current ||
- ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) {
- enabled = _mesa_array_object_get_enabled_ff(vao);
- } else {
- enabled = _mesa_array_object_get_enabled_arb(vao);
- }
-
- /* _MaxElement is one past the last legal array element */
- vao->_MaxElement = compute_max_element(vao, enabled);
-}
-
-
/**
* Updates the derived gl_client_arrays when a gl_vertex_attrib_array
* or a gl_vertex_buffer_binding has changed.
diff --git a/mesalib/src/mesa/main/arrayobj.h b/mesalib/src/mesa/main/arrayobj.h
index d72761db1..1819cd12a 100644
--- a/mesalib/src/mesa/main/arrayobj.h
+++ b/mesalib/src/mesa/main/arrayobj.h
@@ -75,10 +75,6 @@ _mesa_initialize_vao(struct gl_context *ctx,
extern void
-_mesa_update_vao_max_element(struct gl_context *ctx,
- struct gl_vertex_array_object *vao);
-
-extern void
_mesa_update_vao_client_arrays(struct gl_context *ctx,
struct gl_vertex_array_object *vao);
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index 2e289b6f1..ef98ba7fd 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -1458,7 +1458,6 @@ copy_array_object(struct gl_context *ctx,
/* _Enabled must be the same than on push */
dest->_Enabled = src->_Enabled;
dest->NewArrays = src->NewArrays;
- dest->_MaxElement = src->_MaxElement;
}
/**
diff --git a/mesalib/src/mesa/main/buffers.c b/mesalib/src/mesa/main/buffers.c
index 8a0852c42..1ee20098d 100644
--- a/mesalib/src/mesa/main/buffers.c
+++ b/mesalib/src/mesa/main/buffers.c
@@ -32,7 +32,6 @@
#include "glheader.h"
#include "buffers.h"
-#include "colormac.h"
#include "context.h"
#include "enums.h"
#include "fbobject.h"
diff --git a/mesalib/src/mesa/main/clear.c b/mesalib/src/mesa/main/clear.c
index cf93418d1..f7f15cf59 100644
--- a/mesalib/src/mesa/main/clear.c
+++ b/mesalib/src/mesa/main/clear.c
@@ -33,7 +33,6 @@
#include "glheader.h"
#include "clear.h"
#include "context.h"
-#include "colormac.h"
#include "enums.h"
#include "macros.h"
#include "mtypes.h"
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 8b5693e37..682b9c797 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -622,8 +622,11 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api)
consts->MaxProgramMatrices = MAX_PROGRAM_MATRICES;
consts->MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH;
- /* CheckArrayBounds is overriden by drivers/x11 for X server */
- consts->CheckArrayBounds = GL_FALSE;
+ /* Assume that if GLSL 1.30+ (or GLSL ES 3.00+) is supported that
+ * gl_VertexID is implemented using a native hardware register with OpenGL
+ * semantics.
+ */
+ consts->VertexID_is_zero_based = false;
/* GL_ARB_draw_buffers */
consts->MaxDrawBuffers = MAX_DRAW_BUFFERS;
@@ -1501,7 +1504,10 @@ handle_first_current(struct gl_context *ctx)
GLenum buffer;
GLint bufferIndex;
- assert(ctx->Version > 0);
+ if (ctx->Version == 0) {
+ /* probably in the process of tearing down the context */
+ return;
+ }
ctx->Extensions.String = _mesa_make_extension_string(ctx);
diff --git a/mesalib/src/mesa/main/convolve.c b/mesalib/src/mesa/main/convolve.c
index b13b89535..83d590f4a 100644
--- a/mesalib/src/mesa/main/convolve.c
+++ b/mesalib/src/mesa/main/convolve.c
@@ -32,11 +32,8 @@
#include "glheader.h"
-#include "bufferobj.h"
-#include "colormac.h"
+#include "context.h"
#include "convolve.h"
-#include "macros.h"
-#include "mtypes.h"
#include "main/dispatch.h"
diff --git a/mesalib/src/mesa/main/eval.c b/mesalib/src/mesa/main/eval.c
index 42793ff4c..84cd7563b 100644
--- a/mesalib/src/mesa/main/eval.c
+++ b/mesalib/src/mesa/main/eval.c
@@ -39,7 +39,6 @@
#include "glheader.h"
#include "imports.h"
-#include "colormac.h"
#include "context.h"
#include "eval.h"
#include "macros.h"
diff --git a/mesalib/src/mesa/main/feedback.c b/mesalib/src/mesa/main/feedback.c
index e751a3c1e..9ea0b92f3 100644
--- a/mesalib/src/mesa/main/feedback.c
+++ b/mesalib/src/mesa/main/feedback.c
@@ -30,7 +30,6 @@
#include "glheader.h"
-#include "colormac.h"
#include "context.h"
#include "enums.h"
#include "feedback.h"
diff --git a/mesalib/src/mesa/main/fog.c b/mesalib/src/mesa/main/fog.c
index 89153912e..3bce289e7 100644
--- a/mesalib/src/mesa/main/fog.c
+++ b/mesalib/src/mesa/main/fog.c
@@ -24,7 +24,6 @@
#include "glheader.h"
-#include "colormac.h"
#include "context.h"
#include "fog.h"
#include "macros.h"
diff --git a/mesalib/src/mesa/main/format_pack.c b/mesalib/src/mesa/main/format_pack.c
index 6cbf8593b..31c9f7767 100644
--- a/mesalib/src/mesa/main/format_pack.c
+++ b/mesalib/src/mesa/main/format_pack.c
@@ -1076,6 +1076,31 @@ pack_float_B8G8R8A8_SRGB(const GLfloat src[4], void *dst)
}
+/* MESA_FORMAT_A8R8G8B8_SRGB */
+
+static void
+pack_ubyte_A8R8G8B8_SRGB(const GLubyte src[4], void *dst)
+{
+ GLuint *d = ((GLuint *) dst);
+ GLubyte r = util_format_linear_to_srgb_8unorm(src[RCOMP]);
+ GLubyte g = util_format_linear_to_srgb_8unorm(src[GCOMP]);
+ GLubyte b = util_format_linear_to_srgb_8unorm(src[BCOMP]);
+ *d = PACK_COLOR_8888(b, g, r, src[ACOMP]);
+}
+
+static void
+pack_float_A8R8G8B8_SRGB(const GLfloat src[4], void *dst)
+{
+ GLuint *d = ((GLuint *) dst);
+ GLubyte r, g, b, a;
+ r = util_format_linear_float_to_srgb_8unorm(src[RCOMP]);
+ g = util_format_linear_float_to_srgb_8unorm(src[GCOMP]);
+ b = util_format_linear_float_to_srgb_8unorm(src[BCOMP]);
+ UNCLAMPED_FLOAT_TO_UBYTE(a, src[ACOMP]);
+ *d = PACK_COLOR_8888(b, g, r, a);
+}
+
+
/* MESA_FORMAT_R8G8B8A8_SRGB */
static void
@@ -1129,6 +1154,16 @@ pack_ubyte_L8A8_SRGB(const GLubyte src[4], void *dst)
*d = PACK_COLOR_88(src[ACOMP], l);
}
+/* MESA_FORMAT_A8L8_SRGB */
+
+static void
+pack_ubyte_A8L8_SRGB(const GLubyte src[4], void *dst)
+{
+ GLushort *d = ((GLushort *) dst);
+ GLubyte l = util_format_linear_to_srgb_8unorm(src[RCOMP]);
+ *d = PACK_COLOR_88(l, src[ACOMP]);
+}
+
static void
pack_float_L8A8_SRGB(const GLfloat src[4], void *dst)
{
@@ -1138,6 +1173,15 @@ pack_float_L8A8_SRGB(const GLfloat src[4], void *dst)
*d = PACK_COLOR_88(a, l);
}
+static void
+pack_float_A8L8_SRGB(const GLfloat src[4], void *dst)
+{
+ GLushort *d = ((GLushort *) dst);
+ GLubyte a, l = util_format_linear_float_to_srgb_8unorm(src[RCOMP]);
+ CLAMPED_FLOAT_TO_UBYTE(a, src[ACOMP]);
+ *d = PACK_COLOR_88(l, a);
+}
+
/* MESA_FORMAT_RGBA_FLOAT32 */
@@ -1563,6 +1607,20 @@ pack_float_L8A8_SNORM(const GLfloat src[4], void *dst)
/*
+ * MESA_FORMAT_A8L8_SNORM
+ */
+
+static void
+pack_float_A8L8_SNORM(const GLfloat src[4], void *dst)
+{
+ GLushort *d = (GLushort *) dst;
+ GLbyte l = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f));
+ GLbyte a = FLOAT_TO_BYTE(CLAMP(src[ACOMP], -1.0f, 1.0f));
+ *d = (l << 8) | a;
+}
+
+
+/*
* MESA_FORMAT_A_SNORM16
*/
@@ -1713,7 +1771,22 @@ pack_float_R8G8B8X8_SRGB(const GLfloat src[4], void *dst)
GLubyte r = util_format_linear_float_to_srgb_8unorm(src[RCOMP]);
GLubyte g = util_format_linear_float_to_srgb_8unorm(src[GCOMP]);
GLubyte b = util_format_linear_float_to_srgb_8unorm(src[BCOMP]);
- *d = PACK_COLOR_8888(127, b, g, r);
+ *d = PACK_COLOR_8888(255, b, g, r);
+}
+
+
+/*
+ * MESA_FORMAT_X8B8G8R8_SRGB
+ */
+
+static void
+pack_float_X8B8G8R8_SRGB(const GLfloat src[4], void *dst)
+{
+ GLuint *d = (GLuint *) dst;
+ GLubyte r = util_format_linear_float_to_srgb_8unorm(src[RCOMP]);
+ GLubyte g = util_format_linear_float_to_srgb_8unorm(src[GCOMP]);
+ GLubyte b = util_format_linear_float_to_srgb_8unorm(src[BCOMP]);
+ *d = PACK_COLOR_8888(r, g, b, 255);
}
@@ -1866,6 +1939,20 @@ pack_float_B8G8R8X8_SRGB(const GLfloat src[4], void *dst)
*d = PACK_COLOR_8888(127, r, g, b);
}
+/*
+ * MESA_FORMAT_X8R8G8B8_SRGB
+ */
+
+static void
+pack_float_X8R8G8B8_SRGB(const GLfloat src[4], void *dst)
+{
+ GLuint *d = (GLuint *) dst;
+ GLubyte r = util_format_linear_float_to_srgb_8unorm(src[RCOMP]);
+ GLubyte g = util_format_linear_float_to_srgb_8unorm(src[GCOMP]);
+ GLubyte b = util_format_linear_float_to_srgb_8unorm(src[BCOMP]);
+ *d = PACK_COLOR_8888(b, g, r, 255);
+}
+
/**
* Return a function that can pack a GLubyte rgba[4] color.
*/
@@ -1933,9 +2020,11 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format)
table[MESA_FORMAT_BGR_SRGB8] = pack_ubyte_BGR_SRGB8;
table[MESA_FORMAT_A8B8G8R8_SRGB] = pack_ubyte_A8B8G8R8_SRGB;
table[MESA_FORMAT_B8G8R8A8_SRGB] = pack_ubyte_B8G8R8A8_SRGB;
+ table[MESA_FORMAT_A8R8G8B8_SRGB] = pack_ubyte_A8R8G8B8_SRGB;
table[MESA_FORMAT_R8G8B8A8_SRGB] = pack_ubyte_R8G8B8A8_SRGB;
table[MESA_FORMAT_L_SRGB8] = pack_ubyte_L_SRGB8;
table[MESA_FORMAT_L8A8_SRGB] = pack_ubyte_L8A8_SRGB;
+ table[MESA_FORMAT_A8L8_SRGB] = pack_ubyte_A8L8_SRGB;
/* n/a */
table[MESA_FORMAT_SRGB_DXT1] = NULL; /* pack_ubyte_SRGB_DXT1; */
table[MESA_FORMAT_SRGBA_DXT1] = NULL; /* pack_ubyte_SRGBA_DXT1; */
@@ -1989,6 +2078,7 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format)
table[MESA_FORMAT_A_SNORM8] = NULL;
table[MESA_FORMAT_L_SNORM8] = NULL;
table[MESA_FORMAT_L8A8_SNORM] = NULL;
+ table[MESA_FORMAT_A8L8_SNORM] = NULL;
table[MESA_FORMAT_I_SNORM8] = NULL;
table[MESA_FORMAT_A_SNORM16] = NULL;
table[MESA_FORMAT_L_SNORM16] = NULL;
@@ -2005,6 +2095,7 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format)
table[MESA_FORMAT_B5G5R5X1_UNORM] = pack_ubyte_XRGB1555_UNORM;
table[MESA_FORMAT_R8G8B8X8_SNORM] = NULL;
table[MESA_FORMAT_R8G8B8X8_SRGB] = NULL;
+ table[MESA_FORMAT_X8B8G8R8_SRGB] = NULL;
table[MESA_FORMAT_RGBX_UINT8] = NULL;
table[MESA_FORMAT_RGBX_SINT8] = NULL;
table[MESA_FORMAT_B10G10R10X2_UNORM] = pack_ubyte_B10G10R10X2_UNORM;
@@ -2020,6 +2111,7 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format)
table[MESA_FORMAT_R10G10B10A2_UNORM] = pack_ubyte_R10G10B10A2_UNORM;
table[MESA_FORMAT_B8G8R8X8_SRGB] = NULL;
+ table[MESA_FORMAT_X8R8G8B8_SRGB] = NULL;
initialized = GL_TRUE;
}
@@ -2096,9 +2188,11 @@ _mesa_get_pack_float_rgba_function(mesa_format format)
table[MESA_FORMAT_BGR_SRGB8] = pack_float_BGR_SRGB8;
table[MESA_FORMAT_A8B8G8R8_SRGB] = pack_float_A8B8G8R8_SRGB;
table[MESA_FORMAT_B8G8R8A8_SRGB] = pack_float_B8G8R8A8_SRGB;
+ table[MESA_FORMAT_A8R8G8B8_SRGB] = pack_float_A8R8G8B8_SRGB;
table[MESA_FORMAT_R8G8B8A8_SRGB] = pack_float_R8G8B8A8_SRGB;
table[MESA_FORMAT_L_SRGB8] = pack_float_L_SRGB8;
table[MESA_FORMAT_L8A8_SRGB] = pack_float_L8A8_SRGB;
+ table[MESA_FORMAT_A8L8_SRGB] = pack_float_A8L8_SRGB;
/* n/a */
table[MESA_FORMAT_SRGB_DXT1] = NULL;
@@ -2153,6 +2247,7 @@ _mesa_get_pack_float_rgba_function(mesa_format format)
table[MESA_FORMAT_A_SNORM8] = pack_float_A_SNORM8;
table[MESA_FORMAT_L_SNORM8] = pack_float_L_SNORM8;
table[MESA_FORMAT_L8A8_SNORM] = pack_float_L8A8_SNORM;
+ table[MESA_FORMAT_A8L8_SNORM] = pack_float_A8L8_SNORM;
table[MESA_FORMAT_I_SNORM8] = pack_float_L_SNORM8; /* reused */
table[MESA_FORMAT_A_SNORM16] = pack_float_A_SNORM16;
table[MESA_FORMAT_L_SNORM16] = pack_float_L_SNORM16;
@@ -2166,6 +2261,7 @@ _mesa_get_pack_float_rgba_function(mesa_format format)
table[MESA_FORMAT_B5G5R5X1_UNORM] = pack_float_XRGB1555_UNORM;
table[MESA_FORMAT_R8G8B8X8_SNORM] = pack_float_XBGR8888_SNORM;
table[MESA_FORMAT_R8G8B8X8_SRGB] = pack_float_R8G8B8X8_SRGB;
+ table[MESA_FORMAT_X8B8G8R8_SRGB] = pack_float_X8B8G8R8_SRGB;
table[MESA_FORMAT_RGBX_UINT8] = NULL;
table[MESA_FORMAT_RGBX_SINT8] = NULL;
table[MESA_FORMAT_B10G10R10X2_UNORM] = pack_float_B10G10R10X2_UNORM;
@@ -2184,6 +2280,7 @@ _mesa_get_pack_float_rgba_function(mesa_format format)
table[MESA_FORMAT_G16R16_SNORM] = pack_float_G16R16_SNORM;
table[MESA_FORMAT_B8G8R8X8_SRGB] = pack_float_B8G8R8X8_SRGB;
+ table[MESA_FORMAT_X8R8G8B8_SRGB] = pack_float_X8R8G8B8_SRGB;
initialized = GL_TRUE;
}
diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c
index b84ed0248..d5628a9e7 100644
--- a/mesalib/src/mesa/main/format_unpack.c
+++ b/mesalib/src/mesa/main/format_unpack.c
@@ -770,6 +770,19 @@ unpack_B8G8R8A8_SRGB(const void *src, GLfloat dst[][4], GLuint n)
}
static void
+unpack_A8R8G8B8_SRGB(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = util_format_srgb_8unorm_to_linear_float( (s[i] >> 8) & 0xff );
+ dst[i][GCOMP] = util_format_srgb_8unorm_to_linear_float( (s[i] >> 16) & 0xff );
+ dst[i][BCOMP] = util_format_srgb_8unorm_to_linear_float( (s[i] >> 24) );
+ dst[i][ACOMP] = UBYTE_TO_FLOAT( s[i] & 0xff ); /* linear! */
+ }
+}
+
+static void
unpack_R8G8B8A8_SRGB(const void *src, GLfloat dst[][4], GLuint n)
{
const GLuint *s = ((const GLuint *) src);
@@ -809,6 +822,19 @@ unpack_L8A8_SRGB(const void *src, GLfloat dst[][4], GLuint n)
}
static void
+unpack_A8L8_SRGB(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLushort *s = (const GLushort *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = util_format_srgb_8unorm_to_linear_float(s[i] >> 8);
+ dst[i][ACOMP] = UBYTE_TO_FLOAT(s[i] & 0xff); /* linear! */
+ }
+}
+
+static void
unpack_SRGB_DXT1(const void *src, GLfloat dst[][4], GLuint n)
{
}
@@ -1965,6 +1991,20 @@ unpack_L8A8_SNORM(const void *src, GLfloat dst[][4], GLuint n)
}
}
+
+static void
+unpack_A8L8_SNORM(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLshort *s = ((const GLshort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
+ dst[i][ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] & 0xff) );
+ }
+}
+
static void
unpack_I_SNORM8(const void *src, GLfloat dst[][4], GLuint n)
{
@@ -2079,7 +2119,7 @@ unpack_XRGB1555_UNORM(const void *src, GLfloat dst[][4], GLuint n)
}
static void
-unpack_XBGR8888_SNORM(const void *src, GLfloat dst[][4], GLuint n)
+unpack_R8G8B8X8_SNORM(const void *src, GLfloat dst[][4], GLuint n)
{
const GLuint *s = ((const GLuint *) src);
GLuint i;
@@ -2100,7 +2140,20 @@ unpack_R8G8B8X8_SRGB(const void *src, GLfloat dst[][4], GLuint n)
dst[i][RCOMP] = util_format_srgb_8unorm_to_linear_float( (s[i] ) & 0xff );
dst[i][GCOMP] = util_format_srgb_8unorm_to_linear_float( (s[i] >> 8) & 0xff );
dst[i][BCOMP] = util_format_srgb_8unorm_to_linear_float( (s[i] >> 16) & 0xff );
- dst[i][ACOMP] = UBYTE_TO_FLOAT( s[i] >> 24 ); /* linear! */
+ dst[i][ACOMP] = 1.0f;
+ }
+}
+
+static void
+unpack_X8B8G8R8_SRGB(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = util_format_srgb_8unorm_to_linear_float( (s[i] >> 24) );
+ dst[i][GCOMP] = util_format_srgb_8unorm_to_linear_float( (s[i] >> 16) & 0xff );
+ dst[i][BCOMP] = util_format_srgb_8unorm_to_linear_float( (s[i] >> 8) & 0xff );
+ dst[i][ACOMP] = 1.0f;
}
}
@@ -2299,6 +2352,19 @@ unpack_B8G8R8X8_SRGB(const void *src, GLfloat dst[][4], GLuint n)
}
}
+static void
+unpack_X8R8G8B8_SRGB(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = util_format_srgb_8unorm_to_linear_float( (s[i] >> 8) & 0xff );
+ dst[i][GCOMP] = util_format_srgb_8unorm_to_linear_float( (s[i] >> 16) & 0xff );
+ dst[i][BCOMP] = util_format_srgb_8unorm_to_linear_float( (s[i] >> 24) );
+ dst[i][ACOMP] = 1.0F;
+ }
+}
+
/**
* Return the unpacker function for the given format.
*/
@@ -2361,9 +2427,11 @@ get_unpack_rgba_function(mesa_format format)
table[MESA_FORMAT_BGR_SRGB8] = unpack_BGR_SRGB8;
table[MESA_FORMAT_A8B8G8R8_SRGB] = unpack_A8B8G8R8_SRGB;
table[MESA_FORMAT_B8G8R8A8_SRGB] = unpack_B8G8R8A8_SRGB;
+ table[MESA_FORMAT_A8R8G8B8_SRGB] = unpack_A8R8G8B8_SRGB;
table[MESA_FORMAT_R8G8B8A8_SRGB] = unpack_R8G8B8A8_SRGB;
table[MESA_FORMAT_L_SRGB8] = unpack_L_SRGB8;
table[MESA_FORMAT_L8A8_SRGB] = unpack_L8A8_SRGB;
+ table[MESA_FORMAT_A8L8_SRGB] = unpack_A8L8_SRGB;
table[MESA_FORMAT_SRGB_DXT1] = unpack_SRGB_DXT1;
table[MESA_FORMAT_SRGBA_DXT1] = unpack_SRGBA_DXT1;
table[MESA_FORMAT_SRGBA_DXT3] = unpack_SRGBA_DXT3;
@@ -2483,6 +2551,7 @@ get_unpack_rgba_function(mesa_format format)
table[MESA_FORMAT_A_SNORM8] = unpack_A_SNORM8;
table[MESA_FORMAT_L_SNORM8] = unpack_L_SNORM8;
table[MESA_FORMAT_L8A8_SNORM] = unpack_L8A8_SNORM;
+ table[MESA_FORMAT_A8L8_SNORM] = unpack_A8L8_SNORM;
table[MESA_FORMAT_I_SNORM8] = unpack_I_SNORM8;
table[MESA_FORMAT_A_SNORM16] = unpack_A_SNORM16;
table[MESA_FORMAT_L_SNORM16] = unpack_L_SNORM16;
@@ -2497,8 +2566,9 @@ get_unpack_rgba_function(mesa_format format)
table[MESA_FORMAT_B4G4R4X4_UNORM] = unpack_XRGB4444_UNORM;
table[MESA_FORMAT_B5G5R5X1_UNORM] = unpack_XRGB1555_UNORM;
- table[MESA_FORMAT_R8G8B8X8_SNORM] = unpack_XBGR8888_SNORM;
+ table[MESA_FORMAT_R8G8B8X8_SNORM] = unpack_R8G8B8X8_SNORM;
table[MESA_FORMAT_R8G8B8X8_SRGB] = unpack_R8G8B8X8_SRGB;
+ table[MESA_FORMAT_X8B8G8R8_SRGB] = unpack_X8B8G8R8_SRGB;
table[MESA_FORMAT_RGBX_UINT8] = unpack_XBGR8888_UINT;
table[MESA_FORMAT_RGBX_SINT8] = unpack_XBGR8888_SINT;
table[MESA_FORMAT_B10G10R10X2_UNORM] = unpack_B10G10R10X2_UNORM;
@@ -2517,6 +2587,7 @@ get_unpack_rgba_function(mesa_format format)
table[MESA_FORMAT_G16R16_SNORM] = unpack_G16R16_SNORM;
table[MESA_FORMAT_B8G8R8X8_SRGB] = unpack_B8G8R8X8_SRGB;
+ table[MESA_FORMAT_X8R8G8B8_SRGB] = unpack_X8R8G8B8_SRGB;
initialized = GL_TRUE;
}
diff --git a/mesalib/src/mesa/main/format_utils.c b/mesalib/src/mesa/main/format_utils.c
index 240e3bc0c..93a0ceac0 100644
--- a/mesalib/src/mesa/main/format_utils.c
+++ b/mesalib/src/mesa/main/format_utils.c
@@ -312,25 +312,28 @@ swizzle_convert_try_memcpy(void *dst, GLenum dst_type, int num_dst_channels,
* format
*/
#define SWIZZLE_CONVERT_LOOP(DST_TYPE, DST_CHANS, SRC_TYPE, SRC_CHANS, CONV) \
- for (s = 0; s < count; ++s) { \
- for (j = 0; j < SRC_CHANS; ++j) { \
- SRC_TYPE src = typed_src[j]; \
- tmp[j] = CONV; \
- } \
- \
- typed_dst[0] = tmp[swizzle_x]; \
- if (DST_CHANS > 1) { \
- typed_dst[1] = tmp[swizzle_y]; \
- if (DST_CHANS > 2) { \
- typed_dst[2] = tmp[swizzle_z]; \
- if (DST_CHANS > 3) { \
- typed_dst[3] = tmp[swizzle_w]; \
- } \
- } \
- } \
- typed_src += SRC_CHANS; \
- typed_dst += DST_CHANS; \
- } \
+ do { \
+ int s, j; \
+ for (s = 0; s < count; ++s) { \
+ for (j = 0; j < SRC_CHANS; ++j) { \
+ SRC_TYPE src = typed_src[j]; \
+ tmp[j] = CONV; \
+ } \
+ \
+ typed_dst[0] = tmp[swizzle_x]; \
+ if (DST_CHANS > 1) { \
+ typed_dst[1] = tmp[swizzle_y]; \
+ if (DST_CHANS > 2) { \
+ typed_dst[2] = tmp[swizzle_z]; \
+ if (DST_CHANS > 3) { \
+ typed_dst[3] = tmp[swizzle_w]; \
+ } \
+ } \
+ } \
+ typed_src += SRC_CHANS; \
+ typed_dst += DST_CHANS; \
+ } \
+ } while (0)
/**
* Represents a single swizzle-and-convert operation
@@ -352,6 +355,10 @@ swizzle_convert_try_memcpy(void *dst, GLenum dst_type, int num_dst_channels,
*/
#define SWIZZLE_CONVERT(DST_TYPE, SRC_TYPE, CONV) \
do { \
+ const uint8_t swizzle_x = swizzle[0]; \
+ const uint8_t swizzle_y = swizzle[1]; \
+ const uint8_t swizzle_z = swizzle[2]; \
+ const uint8_t swizzle_w = swizzle[3]; \
const SRC_TYPE *typed_src = void_src; \
DST_TYPE *typed_dst = void_dst; \
DST_TYPE tmp[7]; \
@@ -361,69 +368,589 @@ swizzle_convert_try_memcpy(void *dst, GLenum dst_type, int num_dst_channels,
case 1: \
switch (num_src_channels) { \
case 1: \
- SWIZZLE_CONVERT_LOOP(DST_TYPE, 1, SRC_TYPE, 1, CONV) \
+ SWIZZLE_CONVERT_LOOP(DST_TYPE, 1, SRC_TYPE, 1, CONV); \
break; \
case 2: \
- SWIZZLE_CONVERT_LOOP(DST_TYPE, 1, SRC_TYPE, 2, CONV) \
+ SWIZZLE_CONVERT_LOOP(DST_TYPE, 1, SRC_TYPE, 2, CONV); \
break; \
case 3: \
- SWIZZLE_CONVERT_LOOP(DST_TYPE, 1, SRC_TYPE, 3, CONV) \
+ SWIZZLE_CONVERT_LOOP(DST_TYPE, 1, SRC_TYPE, 3, CONV); \
break; \
case 4: \
- SWIZZLE_CONVERT_LOOP(DST_TYPE, 1, SRC_TYPE, 4, CONV) \
+ SWIZZLE_CONVERT_LOOP(DST_TYPE, 1, SRC_TYPE, 4, CONV); \
break; \
} \
break; \
case 2: \
switch (num_src_channels) { \
case 1: \
- SWIZZLE_CONVERT_LOOP(DST_TYPE, 2, SRC_TYPE, 1, CONV) \
+ SWIZZLE_CONVERT_LOOP(DST_TYPE, 2, SRC_TYPE, 1, CONV); \
break; \
case 2: \
- SWIZZLE_CONVERT_LOOP(DST_TYPE, 2, SRC_TYPE, 2, CONV) \
+ SWIZZLE_CONVERT_LOOP(DST_TYPE, 2, SRC_TYPE, 2, CONV); \
break; \
case 3: \
- SWIZZLE_CONVERT_LOOP(DST_TYPE, 2, SRC_TYPE, 3, CONV) \
+ SWIZZLE_CONVERT_LOOP(DST_TYPE, 2, SRC_TYPE, 3, CONV); \
break; \
case 4: \
- SWIZZLE_CONVERT_LOOP(DST_TYPE, 2, SRC_TYPE, 4, CONV) \
+ SWIZZLE_CONVERT_LOOP(DST_TYPE, 2, SRC_TYPE, 4, CONV); \
break; \
} \
break; \
case 3: \
switch (num_src_channels) { \
case 1: \
- SWIZZLE_CONVERT_LOOP(DST_TYPE, 3, SRC_TYPE, 1, CONV) \
+ SWIZZLE_CONVERT_LOOP(DST_TYPE, 3, SRC_TYPE, 1, CONV); \
break; \
case 2: \
- SWIZZLE_CONVERT_LOOP(DST_TYPE, 3, SRC_TYPE, 2, CONV) \
+ SWIZZLE_CONVERT_LOOP(DST_TYPE, 3, SRC_TYPE, 2, CONV); \
break; \
case 3: \
- SWIZZLE_CONVERT_LOOP(DST_TYPE, 3, SRC_TYPE, 3, CONV) \
+ SWIZZLE_CONVERT_LOOP(DST_TYPE, 3, SRC_TYPE, 3, CONV); \
break; \
case 4: \
- SWIZZLE_CONVERT_LOOP(DST_TYPE, 3, SRC_TYPE, 4, CONV) \
+ SWIZZLE_CONVERT_LOOP(DST_TYPE, 3, SRC_TYPE, 4, CONV); \
break; \
} \
break; \
case 4: \
switch (num_src_channels) { \
case 1: \
- SWIZZLE_CONVERT_LOOP(DST_TYPE, 4, SRC_TYPE, 1, CONV) \
+ SWIZZLE_CONVERT_LOOP(DST_TYPE, 4, SRC_TYPE, 1, CONV); \
break; \
case 2: \
- SWIZZLE_CONVERT_LOOP(DST_TYPE, 4, SRC_TYPE, 2, CONV) \
+ SWIZZLE_CONVERT_LOOP(DST_TYPE, 4, SRC_TYPE, 2, CONV); \
break; \
case 3: \
- SWIZZLE_CONVERT_LOOP(DST_TYPE, 4, SRC_TYPE, 3, CONV) \
+ SWIZZLE_CONVERT_LOOP(DST_TYPE, 4, SRC_TYPE, 3, CONV); \
break; \
case 4: \
- SWIZZLE_CONVERT_LOOP(DST_TYPE, 4, SRC_TYPE, 4, CONV) \
+ SWIZZLE_CONVERT_LOOP(DST_TYPE, 4, SRC_TYPE, 4, CONV); \
break; \
} \
break; \
} \
- } while (0);
+ } while (0)
+
+
+static void
+convert_float(void *void_dst, int num_dst_channels,
+ const void *void_src, GLenum src_type, int num_src_channels,
+ const uint8_t swizzle[4], bool normalized, int count)
+{
+ const float one = 1.0f;
+
+ switch (src_type) {
+ case GL_FLOAT:
+ SWIZZLE_CONVERT(float, float, src);
+ break;
+ case GL_HALF_FLOAT:
+ SWIZZLE_CONVERT(float, uint16_t, _mesa_half_to_float(src));
+ break;
+ case GL_UNSIGNED_BYTE:
+ if (normalized) {
+ SWIZZLE_CONVERT(float, uint8_t, unorm_to_float(src, 8));
+ } else {
+ SWIZZLE_CONVERT(float, uint8_t, src);
+ }
+ break;
+ case GL_BYTE:
+ if (normalized) {
+ SWIZZLE_CONVERT(float, int8_t, snorm_to_float(src, 8));
+ } else {
+ SWIZZLE_CONVERT(float, int8_t, src);
+ }
+ break;
+ case GL_UNSIGNED_SHORT:
+ if (normalized) {
+ SWIZZLE_CONVERT(float, uint16_t, unorm_to_float(src, 16));
+ } else {
+ SWIZZLE_CONVERT(float, uint16_t, src);
+ }
+ break;
+ case GL_SHORT:
+ if (normalized) {
+ SWIZZLE_CONVERT(float, int16_t, snorm_to_float(src, 16));
+ } else {
+ SWIZZLE_CONVERT(float, int16_t, src);
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ if (normalized) {
+ SWIZZLE_CONVERT(float, uint32_t, unorm_to_float(src, 32));
+ } else {
+ SWIZZLE_CONVERT(float, uint32_t, src);
+ }
+ break;
+ case GL_INT:
+ if (normalized) {
+ SWIZZLE_CONVERT(float, int32_t, snorm_to_float(src, 32));
+ } else {
+ SWIZZLE_CONVERT(float, int32_t, src);
+ }
+ break;
+ default:
+ assert(!"Invalid channel type combination");
+ }
+}
+
+
+static void
+convert_half_float(void *void_dst, int num_dst_channels,
+ const void *void_src, GLenum src_type, int num_src_channels,
+ const uint8_t swizzle[4], bool normalized, int count)
+{
+ const uint16_t one = _mesa_float_to_half(1.0f);
+
+ switch (src_type) {
+ case GL_FLOAT:
+ SWIZZLE_CONVERT(uint16_t, float, _mesa_float_to_half(src));
+ break;
+ case GL_HALF_FLOAT:
+ SWIZZLE_CONVERT(uint16_t, uint16_t, src);
+ break;
+ case GL_UNSIGNED_BYTE:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint16_t, uint8_t, unorm_to_half(src, 8));
+ } else {
+ SWIZZLE_CONVERT(uint16_t, uint8_t, _mesa_float_to_half(src));
+ }
+ break;
+ case GL_BYTE:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint16_t, int8_t, snorm_to_half(src, 8));
+ } else {
+ SWIZZLE_CONVERT(uint16_t, int8_t, _mesa_float_to_half(src));
+ }
+ break;
+ case GL_UNSIGNED_SHORT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint16_t, uint16_t, unorm_to_half(src, 16));
+ } else {
+ SWIZZLE_CONVERT(uint16_t, uint16_t, _mesa_float_to_half(src));
+ }
+ break;
+ case GL_SHORT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint16_t, int16_t, snorm_to_half(src, 16));
+ } else {
+ SWIZZLE_CONVERT(uint16_t, int16_t, _mesa_float_to_half(src));
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint16_t, uint32_t, unorm_to_half(src, 32));
+ } else {
+ SWIZZLE_CONVERT(uint16_t, uint32_t, _mesa_float_to_half(src));
+ }
+ break;
+ case GL_INT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint16_t, int32_t, snorm_to_half(src, 32));
+ } else {
+ SWIZZLE_CONVERT(uint16_t, int32_t, _mesa_float_to_half(src));
+ }
+ break;
+ default:
+ assert(!"Invalid channel type combination");
+ }
+}
+
+
+static void
+convert_ubyte(void *void_dst, int num_dst_channels,
+ const void *void_src, GLenum src_type, int num_src_channels,
+ const uint8_t swizzle[4], bool normalized, int count)
+{
+ const uint8_t one = normalized ? UINT8_MAX : 1;
+
+ switch (src_type) {
+ case GL_FLOAT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint8_t, float, float_to_unorm(src, 8));
+ } else {
+ SWIZZLE_CONVERT(uint8_t, float, (src < 0) ? 0 : src);
+ }
+ break;
+ case GL_HALF_FLOAT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint8_t, uint16_t, half_to_unorm(src, 8));
+ } else {
+ SWIZZLE_CONVERT(uint8_t, uint16_t, half_to_uint(src));
+ }
+ break;
+ case GL_UNSIGNED_BYTE:
+ SWIZZLE_CONVERT(uint8_t, uint8_t, src);
+ break;
+ case GL_BYTE:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint8_t, int8_t, snorm_to_unorm(src, 8, 8));
+ } else {
+ SWIZZLE_CONVERT(uint8_t, int8_t, (src < 0) ? 0 : src);
+ }
+ break;
+ case GL_UNSIGNED_SHORT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint8_t, uint16_t, unorm_to_unorm(src, 16, 8));
+ } else {
+ SWIZZLE_CONVERT(uint8_t, uint16_t, src);
+ }
+ break;
+ case GL_SHORT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint8_t, int16_t, snorm_to_unorm(src, 16, 8));
+ } else {
+ SWIZZLE_CONVERT(uint8_t, int16_t, (src < 0) ? 0 : src);
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint8_t, uint32_t, unorm_to_unorm(src, 32, 8));
+ } else {
+ SWIZZLE_CONVERT(uint8_t, uint32_t, src);
+ }
+ break;
+ case GL_INT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint8_t, int32_t, snorm_to_unorm(src, 32, 8));
+ } else {
+ SWIZZLE_CONVERT(uint8_t, int32_t, (src < 0) ? 0 : src);
+ }
+ break;
+ default:
+ assert(!"Invalid channel type combination");
+ }
+}
+
+
+static void
+convert_byte(void *void_dst, int num_dst_channels,
+ const void *void_src, GLenum src_type, int num_src_channels,
+ const uint8_t swizzle[4], bool normalized, int count)
+{
+ const int8_t one = normalized ? INT8_MAX : 1;
+
+ switch (src_type) {
+ case GL_FLOAT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint8_t, float, float_to_snorm(src, 8));
+ } else {
+ SWIZZLE_CONVERT(uint8_t, float, src);
+ }
+ break;
+ case GL_HALF_FLOAT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint8_t, uint16_t, half_to_snorm(src, 8));
+ } else {
+ SWIZZLE_CONVERT(uint8_t, uint16_t, _mesa_half_to_float(src));
+ }
+ break;
+ case GL_UNSIGNED_BYTE:
+ if (normalized) {
+ SWIZZLE_CONVERT(int8_t, uint8_t, unorm_to_snorm(src, 8, 8));
+ } else {
+ SWIZZLE_CONVERT(int8_t, uint8_t, src);
+ }
+ break;
+ case GL_BYTE:
+ SWIZZLE_CONVERT(int8_t, int8_t, src);
+ break;
+ case GL_UNSIGNED_SHORT:
+ if (normalized) {
+ SWIZZLE_CONVERT(int8_t, uint16_t, unorm_to_snorm(src, 16, 8));
+ } else {
+ SWIZZLE_CONVERT(int8_t, uint16_t, src);
+ }
+ break;
+ case GL_SHORT:
+ if (normalized) {
+ SWIZZLE_CONVERT(int8_t, int16_t, snorm_to_snorm(src, 16, 8));
+ } else {
+ SWIZZLE_CONVERT(int8_t, int16_t, src);
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ if (normalized) {
+ SWIZZLE_CONVERT(int8_t, uint32_t, unorm_to_snorm(src, 32, 8));
+ } else {
+ SWIZZLE_CONVERT(int8_t, uint32_t, src);
+ }
+ break;
+ case GL_INT:
+ if (normalized) {
+ SWIZZLE_CONVERT(int8_t, int32_t, snorm_to_snorm(src, 32, 8));
+ } else {
+ SWIZZLE_CONVERT(int8_t, int32_t, src);
+ }
+ break;
+ default:
+ assert(!"Invalid channel type combination");
+ }
+}
+
+
+static void
+convert_ushort(void *void_dst, int num_dst_channels,
+ const void *void_src, GLenum src_type, int num_src_channels,
+ const uint8_t swizzle[4], bool normalized, int count)
+{
+ const uint16_t one = normalized ? UINT16_MAX : 1;
+
+ switch (src_type) {
+ case GL_FLOAT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint16_t, float, float_to_unorm(src, 16));
+ } else {
+ SWIZZLE_CONVERT(uint16_t, float, (src < 0) ? 0 : src);
+ }
+ break;
+ case GL_HALF_FLOAT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint16_t, uint16_t, half_to_unorm(src, 16));
+ } else {
+ SWIZZLE_CONVERT(uint16_t, uint16_t, half_to_uint(src));
+ }
+ break;
+ case GL_UNSIGNED_BYTE:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint16_t, uint8_t, unorm_to_unorm(src, 8, 16));
+ } else {
+ SWIZZLE_CONVERT(uint16_t, uint8_t, src);
+ }
+ break;
+ case GL_BYTE:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint16_t, int8_t, snorm_to_unorm(src, 8, 16));
+ } else {
+ SWIZZLE_CONVERT(uint16_t, int8_t, (src < 0) ? 0 : src);
+ }
+ break;
+ case GL_UNSIGNED_SHORT:
+ SWIZZLE_CONVERT(uint16_t, uint16_t, src);
+ break;
+ case GL_SHORT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint16_t, int16_t, snorm_to_unorm(src, 16, 16));
+ } else {
+ SWIZZLE_CONVERT(uint16_t, int16_t, (src < 0) ? 0 : src);
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint16_t, uint32_t, unorm_to_unorm(src, 32, 16));
+ } else {
+ SWIZZLE_CONVERT(uint16_t, uint32_t, src);
+ }
+ break;
+ case GL_INT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint16_t, int32_t, snorm_to_unorm(src, 32, 16));
+ } else {
+ SWIZZLE_CONVERT(uint16_t, int32_t, (src < 0) ? 0 : src);
+ }
+ break;
+ default:
+ assert(!"Invalid channel type combination");
+ }
+}
+
+
+static void
+convert_short(void *void_dst, int num_dst_channels,
+ const void *void_src, GLenum src_type, int num_src_channels,
+ const uint8_t swizzle[4], bool normalized, int count)
+{
+ const int16_t one = normalized ? INT16_MAX : 1;
+
+ switch (src_type) {
+ case GL_FLOAT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint16_t, float, float_to_snorm(src, 16));
+ } else {
+ SWIZZLE_CONVERT(uint16_t, float, src);
+ }
+ break;
+ case GL_HALF_FLOAT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint16_t, uint16_t, half_to_snorm(src, 16));
+ } else {
+ SWIZZLE_CONVERT(uint16_t, uint16_t, _mesa_half_to_float(src));
+ }
+ break;
+ case GL_UNSIGNED_BYTE:
+ if (normalized) {
+ SWIZZLE_CONVERT(int16_t, uint8_t, unorm_to_snorm(src, 8, 16));
+ } else {
+ SWIZZLE_CONVERT(int16_t, uint8_t, src);
+ }
+ break;
+ case GL_BYTE:
+ if (normalized) {
+ SWIZZLE_CONVERT(int16_t, int8_t, snorm_to_snorm(src, 8, 16));
+ } else {
+ SWIZZLE_CONVERT(int16_t, int8_t, src);
+ }
+ break;
+ case GL_UNSIGNED_SHORT:
+ if (normalized) {
+ SWIZZLE_CONVERT(int16_t, uint16_t, unorm_to_snorm(src, 16, 16));
+ } else {
+ SWIZZLE_CONVERT(int16_t, uint16_t, src);
+ }
+ break;
+ case GL_SHORT:
+ SWIZZLE_CONVERT(int16_t, int16_t, src);
+ break;
+ case GL_UNSIGNED_INT:
+ if (normalized) {
+ SWIZZLE_CONVERT(int16_t, uint32_t, unorm_to_snorm(src, 32, 16));
+ } else {
+ SWIZZLE_CONVERT(int16_t, uint32_t, src);
+ }
+ break;
+ case GL_INT:
+ if (normalized) {
+ SWIZZLE_CONVERT(int16_t, int32_t, snorm_to_snorm(src, 32, 16));
+ } else {
+ SWIZZLE_CONVERT(int16_t, int32_t, src);
+ }
+ break;
+ default:
+ assert(!"Invalid channel type combination");
+ }
+}
+
+static void
+convert_uint(void *void_dst, int num_dst_channels,
+ const void *void_src, GLenum src_type, int num_src_channels,
+ const uint8_t swizzle[4], bool normalized, int count)
+{
+ const uint32_t one = normalized ? UINT32_MAX : 1;
+
+ switch (src_type) {
+ case GL_FLOAT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint32_t, float, float_to_unorm(src, 32));
+ } else {
+ SWIZZLE_CONVERT(uint32_t, float, (src < 0) ? 0 : src);
+ }
+ break;
+ case GL_HALF_FLOAT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint32_t, uint16_t, half_to_unorm(src, 32));
+ } else {
+ SWIZZLE_CONVERT(uint32_t, uint16_t, half_to_uint(src));
+ }
+ break;
+ case GL_UNSIGNED_BYTE:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint32_t, uint8_t, unorm_to_unorm(src, 8, 32));
+ } else {
+ SWIZZLE_CONVERT(uint32_t, uint8_t, src);
+ }
+ break;
+ case GL_BYTE:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint32_t, int8_t, snorm_to_unorm(src, 8, 32));
+ } else {
+ SWIZZLE_CONVERT(uint32_t, int8_t, (src < 0) ? 0 : src);
+ }
+ break;
+ case GL_UNSIGNED_SHORT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint32_t, uint16_t, unorm_to_unorm(src, 16, 32));
+ } else {
+ SWIZZLE_CONVERT(uint32_t, uint16_t, src);
+ }
+ break;
+ case GL_SHORT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint32_t, int16_t, snorm_to_unorm(src, 16, 32));
+ } else {
+ SWIZZLE_CONVERT(uint32_t, int16_t, (src < 0) ? 0 : src);
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ SWIZZLE_CONVERT(uint32_t, uint32_t, src);
+ break;
+ case GL_INT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint32_t, int32_t, snorm_to_unorm(src, 32, 32));
+ } else {
+ SWIZZLE_CONVERT(uint32_t, int32_t, (src < 0) ? 0 : src);
+ }
+ break;
+ default:
+ assert(!"Invalid channel type combination");
+ }
+}
+
+
+static void
+convert_int(void *void_dst, int num_dst_channels,
+ const void *void_src, GLenum src_type, int num_src_channels,
+ const uint8_t swizzle[4], bool normalized, int count)
+{
+ const int32_t one = normalized ? INT32_MAX : 12;
+
+ switch (src_type) {
+ case GL_FLOAT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint32_t, float, float_to_snorm(src, 32));
+ } else {
+ SWIZZLE_CONVERT(uint32_t, float, src);
+ }
+ break;
+ case GL_HALF_FLOAT:
+ if (normalized) {
+ SWIZZLE_CONVERT(uint32_t, uint16_t, half_to_snorm(src, 32));
+ } else {
+ SWIZZLE_CONVERT(uint32_t, uint16_t, _mesa_half_to_float(src));
+ }
+ break;
+ case GL_UNSIGNED_BYTE:
+ if (normalized) {
+ SWIZZLE_CONVERT(int32_t, uint8_t, unorm_to_snorm(src, 8, 32));
+ } else {
+ SWIZZLE_CONVERT(int32_t, uint8_t, src);
+ }
+ break;
+ case GL_BYTE:
+ if (normalized) {
+ SWIZZLE_CONVERT(int32_t, int8_t, snorm_to_snorm(src, 8, 32));
+ } else {
+ SWIZZLE_CONVERT(int32_t, int8_t, src);
+ }
+ break;
+ case GL_UNSIGNED_SHORT:
+ if (normalized) {
+ SWIZZLE_CONVERT(int32_t, uint16_t, unorm_to_snorm(src, 16, 32));
+ } else {
+ SWIZZLE_CONVERT(int32_t, uint16_t, src);
+ }
+ break;
+ case GL_SHORT:
+ if (normalized) {
+ SWIZZLE_CONVERT(int32_t, int16_t, snorm_to_snorm(src, 16, 32));
+ } else {
+ SWIZZLE_CONVERT(int32_t, int16_t, src);
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ if (normalized) {
+ SWIZZLE_CONVERT(int32_t, uint32_t, unorm_to_snorm(src, 32, 32));
+ } else {
+ SWIZZLE_CONVERT(int32_t, uint32_t, src);
+ }
+ break;
+ case GL_INT:
+ SWIZZLE_CONVERT(int32_t, int32_t, src);
+ break;
+ default:
+ assert(!"Invalid channel type combination");
+ }
+}
+
/**
* Convert between array-based color formats.
@@ -478,499 +1005,44 @@ _mesa_swizzle_and_convert(void *void_dst, GLenum dst_type, int num_dst_channels,
const void *void_src, GLenum src_type, int num_src_channels,
const uint8_t swizzle[4], bool normalized, int count)
{
- int s, j;
- register uint8_t swizzle_x, swizzle_y, swizzle_z, swizzle_w;
-
if (swizzle_convert_try_memcpy(void_dst, dst_type, num_dst_channels,
void_src, src_type, num_src_channels,
swizzle, normalized, count))
return;
- swizzle_x = swizzle[0];
- swizzle_y = swizzle[1];
- swizzle_z = swizzle[2];
- swizzle_w = swizzle[3];
-
switch (dst_type) {
case GL_FLOAT:
- {
- const float one = 1.0f;
- switch (src_type) {
- case GL_FLOAT:
- SWIZZLE_CONVERT(float, float, src)
- break;
- case GL_HALF_FLOAT:
- SWIZZLE_CONVERT(float, uint16_t, _mesa_half_to_float(src))
- break;
- case GL_UNSIGNED_BYTE:
- if (normalized) {
- SWIZZLE_CONVERT(float, uint8_t, unorm_to_float(src, 8))
- } else {
- SWIZZLE_CONVERT(float, uint8_t, src)
- }
- break;
- case GL_BYTE:
- if (normalized) {
- SWIZZLE_CONVERT(float, int8_t, snorm_to_float(src, 8))
- } else {
- SWIZZLE_CONVERT(float, int8_t, src)
- }
- break;
- case GL_UNSIGNED_SHORT:
- if (normalized) {
- SWIZZLE_CONVERT(float, uint16_t, unorm_to_float(src, 16))
- } else {
- SWIZZLE_CONVERT(float, uint16_t, src)
- }
- break;
- case GL_SHORT:
- if (normalized) {
- SWIZZLE_CONVERT(float, int16_t, snorm_to_float(src, 16))
- } else {
- SWIZZLE_CONVERT(float, int16_t, src)
- }
- break;
- case GL_UNSIGNED_INT:
- if (normalized) {
- SWIZZLE_CONVERT(float, uint32_t, unorm_to_float(src, 32))
- } else {
- SWIZZLE_CONVERT(float, uint32_t, src)
- }
- break;
- case GL_INT:
- if (normalized) {
- SWIZZLE_CONVERT(float, int32_t, snorm_to_float(src, 32))
- } else {
- SWIZZLE_CONVERT(float, int32_t, src)
- }
- break;
- default:
- assert(!"Invalid channel type combination");
- }
- }
- break;
+ convert_float(void_dst, num_dst_channels, void_src, src_type,
+ num_src_channels, swizzle, normalized, count);
+ break;
case GL_HALF_FLOAT:
- {
- const uint16_t one = _mesa_float_to_half(1.0f);
- switch (src_type) {
- case GL_FLOAT:
- SWIZZLE_CONVERT(uint16_t, float, _mesa_float_to_half(src))
- break;
- case GL_HALF_FLOAT:
- SWIZZLE_CONVERT(uint16_t, uint16_t, src)
- break;
- case GL_UNSIGNED_BYTE:
- if (normalized) {
- SWIZZLE_CONVERT(uint16_t, uint8_t, unorm_to_half(src, 8))
- } else {
- SWIZZLE_CONVERT(uint16_t, uint8_t, _mesa_float_to_half(src))
- }
- break;
- case GL_BYTE:
- if (normalized) {
- SWIZZLE_CONVERT(uint16_t, int8_t, snorm_to_half(src, 8))
- } else {
- SWIZZLE_CONVERT(uint16_t, int8_t, _mesa_float_to_half(src))
- }
- break;
- case GL_UNSIGNED_SHORT:
- if (normalized) {
- SWIZZLE_CONVERT(uint16_t, uint16_t, unorm_to_half(src, 16))
- } else {
- SWIZZLE_CONVERT(uint16_t, uint16_t, _mesa_float_to_half(src))
- }
- break;
- case GL_SHORT:
- if (normalized) {
- SWIZZLE_CONVERT(uint16_t, int16_t, snorm_to_half(src, 16))
- } else {
- SWIZZLE_CONVERT(uint16_t, int16_t, _mesa_float_to_half(src))
- }
- break;
- case GL_UNSIGNED_INT:
- if (normalized) {
- SWIZZLE_CONVERT(uint16_t, uint32_t, unorm_to_half(src, 32))
- } else {
- SWIZZLE_CONVERT(uint16_t, uint32_t, _mesa_float_to_half(src))
- }
- break;
- case GL_INT:
- if (normalized) {
- SWIZZLE_CONVERT(uint16_t, int32_t, snorm_to_half(src, 32))
- } else {
- SWIZZLE_CONVERT(uint16_t, int32_t, _mesa_float_to_half(src))
- }
- break;
- default:
- assert(!"Invalid channel type combination");
- }
- }
- break;
+ convert_half_float(void_dst, num_dst_channels, void_src, src_type,
+ num_src_channels, swizzle, normalized, count);
+ break;
case GL_UNSIGNED_BYTE:
- {
- const uint8_t one = normalized ? UINT8_MAX : 1;
- switch (src_type) {
- case GL_FLOAT:
- if (normalized) {
- SWIZZLE_CONVERT(uint8_t, float, float_to_unorm(src, 8))
- } else {
- SWIZZLE_CONVERT(uint8_t, float, (src < 0) ? 0 : src)
- }
- break;
- case GL_HALF_FLOAT:
- if (normalized) {
- SWIZZLE_CONVERT(uint8_t, uint16_t, half_to_unorm(src, 8))
- } else {
- SWIZZLE_CONVERT(uint8_t, uint16_t, half_to_uint(src))
- }
- break;
- case GL_UNSIGNED_BYTE:
- SWIZZLE_CONVERT(uint8_t, uint8_t, src)
- break;
- case GL_BYTE:
- if (normalized) {
- SWIZZLE_CONVERT(uint8_t, int8_t, snorm_to_unorm(src, 8, 8))
- } else {
- SWIZZLE_CONVERT(uint8_t, int8_t, (src < 0) ? 0 : src)
- }
- break;
- case GL_UNSIGNED_SHORT:
- if (normalized) {
- SWIZZLE_CONVERT(uint8_t, uint16_t, unorm_to_unorm(src, 16, 8))
- } else {
- SWIZZLE_CONVERT(uint8_t, uint16_t, src)
- }
- break;
- case GL_SHORT:
- if (normalized) {
- SWIZZLE_CONVERT(uint8_t, int16_t, snorm_to_unorm(src, 16, 8))
- } else {
- SWIZZLE_CONVERT(uint8_t, int16_t, (src < 0) ? 0 : src)
- }
- break;
- case GL_UNSIGNED_INT:
- if (normalized) {
- SWIZZLE_CONVERT(uint8_t, uint32_t, unorm_to_unorm(src, 32, 8))
- } else {
- SWIZZLE_CONVERT(uint8_t, uint32_t, src)
- }
- break;
- case GL_INT:
- if (normalized) {
- SWIZZLE_CONVERT(uint8_t, int32_t, snorm_to_unorm(src, 32, 8))
- } else {
- SWIZZLE_CONVERT(uint8_t, int32_t, (src < 0) ? 0 : src)
- }
- break;
- default:
- assert(!"Invalid channel type combination");
- }
- }
- break;
+ convert_ubyte(void_dst, num_dst_channels, void_src, src_type,
+ num_src_channels, swizzle, normalized, count);
+ break;
case GL_BYTE:
- {
- const int8_t one = normalized ? INT8_MAX : 1;
- switch (src_type) {
- case GL_FLOAT:
- if (normalized) {
- SWIZZLE_CONVERT(uint8_t, float, float_to_snorm(src, 8))
- } else {
- SWIZZLE_CONVERT(uint8_t, float, src)
- }
- break;
- case GL_HALF_FLOAT:
- if (normalized) {
- SWIZZLE_CONVERT(uint8_t, uint16_t, half_to_snorm(src, 8))
- } else {
- SWIZZLE_CONVERT(uint8_t, uint16_t, _mesa_half_to_float(src))
- }
- break;
- case GL_UNSIGNED_BYTE:
- if (normalized) {
- SWIZZLE_CONVERT(int8_t, uint8_t, unorm_to_snorm(src, 8, 8))
- } else {
- SWIZZLE_CONVERT(int8_t, uint8_t, src)
- }
- break;
- case GL_BYTE:
- SWIZZLE_CONVERT(int8_t, int8_t, src)
- break;
- case GL_UNSIGNED_SHORT:
- if (normalized) {
- SWIZZLE_CONVERT(int8_t, uint16_t, unorm_to_snorm(src, 16, 8))
- } else {
- SWIZZLE_CONVERT(int8_t, uint16_t, src)
- }
- break;
- case GL_SHORT:
- if (normalized) {
- SWIZZLE_CONVERT(int8_t, int16_t, snorm_to_snorm(src, 16, 8))
- } else {
- SWIZZLE_CONVERT(int8_t, int16_t, src)
- }
- break;
- case GL_UNSIGNED_INT:
- if (normalized) {
- SWIZZLE_CONVERT(int8_t, uint32_t, unorm_to_snorm(src, 32, 8))
- } else {
- SWIZZLE_CONVERT(int8_t, uint32_t, src)
- }
- break;
- case GL_INT:
- if (normalized) {
- SWIZZLE_CONVERT(int8_t, int32_t, snorm_to_snorm(src, 32, 8))
- } else {
- SWIZZLE_CONVERT(int8_t, int32_t, src)
- }
- break;
- default:
- assert(!"Invalid channel type combination");
- }
- }
- break;
+ convert_byte(void_dst, num_dst_channels, void_src, src_type,
+ num_src_channels, swizzle, normalized, count);
+ break;
case GL_UNSIGNED_SHORT:
- {
- const uint16_t one = normalized ? UINT16_MAX : 1;
- switch (src_type) {
- case GL_FLOAT:
- if (normalized) {
- SWIZZLE_CONVERT(uint16_t, float, float_to_unorm(src, 16))
- } else {
- SWIZZLE_CONVERT(uint16_t, float, (src < 0) ? 0 : src)
- }
- break;
- case GL_HALF_FLOAT:
- if (normalized) {
- SWIZZLE_CONVERT(uint16_t, uint16_t, half_to_unorm(src, 16))
- } else {
- SWIZZLE_CONVERT(uint16_t, uint16_t, half_to_uint(src))
- }
- break;
- case GL_UNSIGNED_BYTE:
- if (normalized) {
- SWIZZLE_CONVERT(uint16_t, uint8_t, unorm_to_unorm(src, 8, 16))
- } else {
- SWIZZLE_CONVERT(uint16_t, uint8_t, src)
- }
- break;
- case GL_BYTE:
- if (normalized) {
- SWIZZLE_CONVERT(uint16_t, int8_t, snorm_to_unorm(src, 8, 16))
- } else {
- SWIZZLE_CONVERT(uint16_t, int8_t, (src < 0) ? 0 : src)
- }
- break;
- case GL_UNSIGNED_SHORT:
- SWIZZLE_CONVERT(uint16_t, uint16_t, src)
- break;
- case GL_SHORT:
- if (normalized) {
- SWIZZLE_CONVERT(uint16_t, int16_t, snorm_to_unorm(src, 16, 16))
- } else {
- SWIZZLE_CONVERT(uint16_t, int16_t, (src < 0) ? 0 : src)
- }
- break;
- case GL_UNSIGNED_INT:
- if (normalized) {
- SWIZZLE_CONVERT(uint16_t, uint32_t, unorm_to_unorm(src, 32, 16))
- } else {
- SWIZZLE_CONVERT(uint16_t, uint32_t, src)
- }
- break;
- case GL_INT:
- if (normalized) {
- SWIZZLE_CONVERT(uint16_t, int32_t, snorm_to_unorm(src, 32, 16))
- } else {
- SWIZZLE_CONVERT(uint16_t, int32_t, (src < 0) ? 0 : src)
- }
- break;
- default:
- assert(!"Invalid channel type combination");
- }
- }
- break;
+ convert_ushort(void_dst, num_dst_channels, void_src, src_type,
+ num_src_channels, swizzle, normalized, count);
+ break;
case GL_SHORT:
- {
- const int16_t one = normalized ? INT16_MAX : 1;
- switch (src_type) {
- case GL_FLOAT:
- if (normalized) {
- SWIZZLE_CONVERT(uint16_t, float, float_to_snorm(src, 16))
- } else {
- SWIZZLE_CONVERT(uint16_t, float, src)
- }
- break;
- case GL_HALF_FLOAT:
- if (normalized) {
- SWIZZLE_CONVERT(uint16_t, uint16_t, half_to_snorm(src, 16))
- } else {
- SWIZZLE_CONVERT(uint16_t, uint16_t, _mesa_half_to_float(src))
- }
- break;
- case GL_UNSIGNED_BYTE:
- if (normalized) {
- SWIZZLE_CONVERT(int16_t, uint8_t, unorm_to_snorm(src, 8, 16))
- } else {
- SWIZZLE_CONVERT(int16_t, uint8_t, src)
- }
- break;
- case GL_BYTE:
- if (normalized) {
- SWIZZLE_CONVERT(int16_t, int8_t, snorm_to_snorm(src, 8, 16))
- } else {
- SWIZZLE_CONVERT(int16_t, int8_t, src)
- }
- break;
- case GL_UNSIGNED_SHORT:
- if (normalized) {
- SWIZZLE_CONVERT(int16_t, uint16_t, unorm_to_snorm(src, 16, 16))
- } else {
- SWIZZLE_CONVERT(int16_t, uint16_t, src)
- }
- break;
- case GL_SHORT:
- SWIZZLE_CONVERT(int16_t, int16_t, src)
- break;
- case GL_UNSIGNED_INT:
- if (normalized) {
- SWIZZLE_CONVERT(int16_t, uint32_t, unorm_to_snorm(src, 32, 16))
- } else {
- SWIZZLE_CONVERT(int16_t, uint32_t, src)
- }
- break;
- case GL_INT:
- if (normalized) {
- SWIZZLE_CONVERT(int16_t, int32_t, snorm_to_snorm(src, 32, 16))
- } else {
- SWIZZLE_CONVERT(int16_t, int32_t, src)
- }
- break;
- default:
- assert(!"Invalid channel type combination");
- }
- }
- break;
+ convert_short(void_dst, num_dst_channels, void_src, src_type,
+ num_src_channels, swizzle, normalized, count);
+ break;
case GL_UNSIGNED_INT:
- {
- const uint32_t one = normalized ? UINT32_MAX : 1;
- switch (src_type) { case GL_FLOAT:
- if (normalized) {
- SWIZZLE_CONVERT(uint32_t, float, float_to_unorm(src, 32))
- } else {
- SWIZZLE_CONVERT(uint32_t, float, (src < 0) ? 0 : src)
- }
- break;
- case GL_HALF_FLOAT:
- if (normalized) {
- SWIZZLE_CONVERT(uint32_t, uint16_t, half_to_unorm(src, 32))
- } else {
- SWIZZLE_CONVERT(uint32_t, uint16_t, half_to_uint(src))
- }
- break;
- case GL_UNSIGNED_BYTE:
- if (normalized) {
- SWIZZLE_CONVERT(uint32_t, uint8_t, unorm_to_unorm(src, 8, 32))
- } else {
- SWIZZLE_CONVERT(uint32_t, uint8_t, src)
- }
- break;
- case GL_BYTE:
- if (normalized) {
- SWIZZLE_CONVERT(uint32_t, int8_t, snorm_to_unorm(src, 8, 32))
- } else {
- SWIZZLE_CONVERT(uint32_t, int8_t, (src < 0) ? 0 : src)
- }
- break;
- case GL_UNSIGNED_SHORT:
- if (normalized) {
- SWIZZLE_CONVERT(uint32_t, uint16_t, unorm_to_unorm(src, 16, 32))
- } else {
- SWIZZLE_CONVERT(uint32_t, uint16_t, src)
- }
- break;
- case GL_SHORT:
- if (normalized) {
- SWIZZLE_CONVERT(uint32_t, int16_t, snorm_to_unorm(src, 16, 32))
- } else {
- SWIZZLE_CONVERT(uint32_t, int16_t, (src < 0) ? 0 : src)
- }
- break;
- case GL_UNSIGNED_INT:
- SWIZZLE_CONVERT(uint32_t, uint32_t, src)
- break;
- case GL_INT:
- if (normalized) {
- SWIZZLE_CONVERT(uint32_t, int32_t, snorm_to_unorm(src, 32, 32))
- } else {
- SWIZZLE_CONVERT(uint32_t, int32_t, (src < 0) ? 0 : src)
- }
- break;
- default:
- assert(!"Invalid channel type combination");
- }
- }
- break;
+ convert_uint(void_dst, num_dst_channels, void_src, src_type,
+ num_src_channels, swizzle, normalized, count);
+ break;
case GL_INT:
- {
- const int32_t one = normalized ? INT32_MAX : 1;
- switch (src_type) {
- case GL_FLOAT:
- if (normalized) {
- SWIZZLE_CONVERT(uint32_t, float, float_to_snorm(src, 32))
- } else {
- SWIZZLE_CONVERT(uint32_t, float, src)
- }
- break;
- case GL_HALF_FLOAT:
- if (normalized) {
- SWIZZLE_CONVERT(uint32_t, uint16_t, half_to_snorm(src, 32))
- } else {
- SWIZZLE_CONVERT(uint32_t, uint16_t, _mesa_half_to_float(src))
- }
- break;
- case GL_UNSIGNED_BYTE:
- if (normalized) {
- SWIZZLE_CONVERT(int32_t, uint8_t, unorm_to_snorm(src, 8, 32))
- } else {
- SWIZZLE_CONVERT(int32_t, uint8_t, src)
- }
- break;
- case GL_BYTE:
- if (normalized) {
- SWIZZLE_CONVERT(int32_t, int8_t, snorm_to_snorm(src, 8, 32))
- } else {
- SWIZZLE_CONVERT(int32_t, int8_t, src)
- }
- break;
- case GL_UNSIGNED_SHORT:
- if (normalized) {
- SWIZZLE_CONVERT(int32_t, uint16_t, unorm_to_snorm(src, 16, 32))
- } else {
- SWIZZLE_CONVERT(int32_t, uint16_t, src)
- }
- break;
- case GL_SHORT:
- if (normalized) {
- SWIZZLE_CONVERT(int32_t, int16_t, snorm_to_snorm(src, 16, 32))
- } else {
- SWIZZLE_CONVERT(int32_t, int16_t, src)
- }
- break;
- case GL_UNSIGNED_INT:
- if (normalized) {
- SWIZZLE_CONVERT(int32_t, uint32_t, unorm_to_snorm(src, 32, 32))
- } else {
- SWIZZLE_CONVERT(int32_t, uint32_t, src)
- }
- break;
- case GL_INT:
- SWIZZLE_CONVERT(int32_t, int32_t, src)
- break;
- default:
- assert(!"Invalid channel type combination");
- }
- }
- break;
+ convert_int(void_dst, num_dst_channels, void_src, src_type,
+ num_src_channels, swizzle, normalized, count);
+ break;
default:
assert(!"Invalid channel type");
}
diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c
index db22a45c4..58c32e23b 100644
--- a/mesalib/src/mesa/main/formats.c
+++ b/mesalib/src/mesa/main/formats.c
@@ -357,9 +357,11 @@ _mesa_get_format_color_encoding(mesa_format format)
case MESA_FORMAT_BGR_SRGB8:
case MESA_FORMAT_A8B8G8R8_SRGB:
case MESA_FORMAT_B8G8R8A8_SRGB:
+ case MESA_FORMAT_A8R8G8B8_SRGB:
case MESA_FORMAT_R8G8B8A8_SRGB:
case MESA_FORMAT_L_SRGB8:
case MESA_FORMAT_L8A8_SRGB:
+ case MESA_FORMAT_A8L8_SRGB:
case MESA_FORMAT_SRGB_DXT1:
case MESA_FORMAT_SRGBA_DXT1:
case MESA_FORMAT_SRGBA_DXT3:
@@ -419,6 +421,9 @@ _mesa_get_srgb_format_linear(mesa_format format)
case MESA_FORMAT_B8G8R8A8_SRGB:
format = MESA_FORMAT_B8G8R8A8_UNORM;
break;
+ case MESA_FORMAT_A8R8G8B8_SRGB:
+ format = MESA_FORMAT_A8R8G8B8_UNORM;
+ break;
case MESA_FORMAT_R8G8B8A8_SRGB:
format = MESA_FORMAT_R8G8B8A8_UNORM;
break;
@@ -428,6 +433,9 @@ _mesa_get_srgb_format_linear(mesa_format format)
case MESA_FORMAT_L8A8_SRGB:
format = MESA_FORMAT_L8A8_UNORM;
break;
+ case MESA_FORMAT_A8L8_SRGB:
+ format = MESA_FORMAT_A8L8_UNORM;
+ break;
case MESA_FORMAT_SRGB_DXT1:
format = MESA_FORMAT_RGB_DXT1;
break;
@@ -443,6 +451,9 @@ _mesa_get_srgb_format_linear(mesa_format format)
case MESA_FORMAT_R8G8B8X8_SRGB:
format = MESA_FORMAT_R8G8B8X8_UNORM;
break;
+ case MESA_FORMAT_X8B8G8R8_SRGB:
+ format = MESA_FORMAT_X8B8G8R8_UNORM;
+ break;
case MESA_FORMAT_ETC2_SRGB8:
format = MESA_FORMAT_ETC2_RGB8;
break;
@@ -458,6 +469,9 @@ _mesa_get_srgb_format_linear(mesa_format format)
case MESA_FORMAT_B8G8R8X8_SRGB:
format = MESA_FORMAT_B8G8R8X8_UNORM;
break;
+ case MESA_FORMAT_X8R8G8B8_SRGB:
+ format = MESA_FORMAT_X8R8G8B8_UNORM;
+ break;
default:
break;
}
@@ -919,6 +933,7 @@ _mesa_format_to_type_and_comps(mesa_format format,
return;
case MESA_FORMAT_R8G8_SNORM:
case MESA_FORMAT_L8A8_SNORM:
+ case MESA_FORMAT_A8L8_SNORM:
*datatype = GL_BYTE;
*comps = 2;
return;
@@ -961,6 +976,7 @@ _mesa_format_to_type_and_comps(mesa_format format,
return;
case MESA_FORMAT_A8B8G8R8_SRGB:
case MESA_FORMAT_B8G8R8A8_SRGB:
+ case MESA_FORMAT_A8R8G8B8_SRGB:
case MESA_FORMAT_R8G8B8A8_SRGB:
*datatype = GL_UNSIGNED_BYTE;
*comps = 4;
@@ -970,6 +986,7 @@ _mesa_format_to_type_and_comps(mesa_format format,
*comps = 1;
return;
case MESA_FORMAT_L8A8_SRGB:
+ case MESA_FORMAT_A8L8_SRGB:
*datatype = GL_UNSIGNED_BYTE;
*comps = 2;
return;
@@ -1235,6 +1252,7 @@ _mesa_format_to_type_and_comps(mesa_format format,
return;
case MESA_FORMAT_R8G8B8X8_SRGB:
+ case MESA_FORMAT_X8B8G8R8_SRGB:
case MESA_FORMAT_RGBX_UINT8:
*datatype = GL_UNSIGNED_BYTE;
*comps = 4;
@@ -1299,6 +1317,7 @@ _mesa_format_to_type_and_comps(mesa_format format,
return;
case MESA_FORMAT_B8G8R8X8_SRGB:
+ case MESA_FORMAT_X8R8G8B8_SRGB:
*datatype = GL_UNSIGNED_BYTE;
*comps = 4;
return;
@@ -1414,6 +1433,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
return GL_FALSE;
case MESA_FORMAT_A8R8G8B8_UNORM:
+ case MESA_FORMAT_A8R8G8B8_SRGB:
if (format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8 && !swapBytes)
return GL_TRUE;
@@ -1475,6 +1495,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
case MESA_FORMAT_L8A8_SRGB:
return format == GL_LUMINANCE_ALPHA && type == GL_UNSIGNED_BYTE && littleEndian;
case MESA_FORMAT_A8L8_UNORM:
+ case MESA_FORMAT_A8L8_SRGB:
return GL_FALSE;
case MESA_FORMAT_L16A16_UNORM:
@@ -1797,6 +1818,9 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
case MESA_FORMAT_L8A8_SNORM:
return format == GL_LUMINANCE_ALPHA && type == GL_BYTE &&
littleEndian && !swapBytes;
+ case MESA_FORMAT_A8L8_SNORM:
+ return format == GL_LUMINANCE_ALPHA && type == GL_BYTE &&
+ !littleEndian && !swapBytes;
case MESA_FORMAT_I_SNORM8:
return format == GL_RED && type == GL_BYTE;
case MESA_FORMAT_A_SNORM16:
@@ -1839,6 +1863,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
case MESA_FORMAT_B5G5R5X1_UNORM:
case MESA_FORMAT_R8G8B8X8_SNORM:
case MESA_FORMAT_R8G8B8X8_SRGB:
+ case MESA_FORMAT_X8B8G8R8_SRGB:
case MESA_FORMAT_RGBX_UINT8:
case MESA_FORMAT_RGBX_SINT8:
case MESA_FORMAT_B10G10R10X2_UNORM:
@@ -1865,6 +1890,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
!swapBytes;
case MESA_FORMAT_B8G8R8X8_SRGB:
+ case MESA_FORMAT_X8R8G8B8_SRGB:
return GL_FALSE;
}
diff --git a/mesalib/src/mesa/main/formats.csv b/mesalib/src/mesa/main/formats.csv
index 4d542b7c6..39bcdbdd2 100644
--- a/mesalib/src/mesa/main/formats.csv
+++ b/mesalib/src/mesa/main/formats.csv
@@ -119,6 +119,7 @@ MESA_FORMAT_G16R16_SNORM , packed, 1, 1, sn16, sn16, ,
MESA_FORMAT_R8G8_SNORM , packed, 1, 1, sn8 , sn8 , , , xy01, rgb
MESA_FORMAT_G8R8_SNORM , packed, 1, 1, sn8 , sn8 , , , yx01, rgb
MESA_FORMAT_L8A8_SNORM , packed, 1, 1, sn8 , sn8 , , , xxxy, rgb
+MESA_FORMAT_A8L8_SNORM , packed, 1, 1, sn8 , sn8 , , , yyyx, rgb
# Array signed/normalized formats
MESA_FORMAT_A_SNORM8 , array , 1, 1, sn8 , , , , 000x, rgb
@@ -137,10 +138,14 @@ MESA_FORMAT_RGBX_SNORM16 , array , 1, 1, sn16, sn16, sn16, x16
# Packed sRGB formats
MESA_FORMAT_A8B8G8R8_SRGB , packed, 1, 1, un8 , un8 , un8 , un8 , wzyx, srgb
MESA_FORMAT_B8G8R8A8_SRGB , packed, 1, 1, un8 , un8 , un8 , un8 , zyxw, srgb
+MESA_FORMAT_A8R8G8B8_SRGB , packed, 1, 1, un8 , un8 , un8 , un8 , yzwx, srgb
MESA_FORMAT_B8G8R8X8_SRGB , packed, 1, 1, un8 , un8 , un8 , x8 , zyx1, srgb
+MESA_FORMAT_X8R8G8B8_SRGB , packed, 1, 1, x8 , un8 , un8 , un8 , yzw1, srgb
MESA_FORMAT_R8G8B8A8_SRGB , packed, 1, 1, un8 , un8 , un8 , un8 , xyzw, srgb
MESA_FORMAT_R8G8B8X8_SRGB , packed, 1, 1, un8 , un8 , un8 , x8 , xyz1, srgb
+MESA_FORMAT_X8B8G8R8_SRGB , packed, 1, 1, x8 , un8 , un8 , un8 , wzy1, srgb
MESA_FORMAT_L8A8_SRGB , packed, 1, 1, un8 , un8 , , , xxxy, srgb
+MESA_FORMAT_A8L8_SRGB , packed, 1, 1, un8 , un8 , , , yyyx, srgb
# Array sRGB formats
MESA_FORMAT_L_SRGB8 , array , 1, 1, un8 , , , , xxx1, srgb
diff --git a/mesalib/src/mesa/main/formats.h b/mesalib/src/mesa/main/formats.h
index d6253bf86..213ab563d 100644
--- a/mesalib/src/mesa/main/formats.h
+++ b/mesalib/src/mesa/main/formats.h
@@ -265,6 +265,7 @@ typedef enum
MESA_FORMAT_R8G8_SNORM, /* GGGG GGGG RRRR RRRR */
MESA_FORMAT_G8R8_SNORM, /* RRRR RRRR GGGG GGGG */
MESA_FORMAT_L8A8_SNORM, /* AAAA AAAA LLLL LLLL */
+ MESA_FORMAT_A8L8_SNORM, /* LLLL LLLL AAAA AAAA */
/* Array signed/normalized formats */
MESA_FORMAT_A_SNORM8, /* byte[i] = A */
@@ -283,10 +284,14 @@ typedef enum
/* Packed sRGB formats */
MESA_FORMAT_A8B8G8R8_SRGB, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
MESA_FORMAT_B8G8R8A8_SRGB, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
+ MESA_FORMAT_A8R8G8B8_SRGB, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
MESA_FORMAT_B8G8R8X8_SRGB, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
+ MESA_FORMAT_X8R8G8B8_SRGB, /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
MESA_FORMAT_R8G8B8A8_SRGB, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
MESA_FORMAT_R8G8B8X8_SRGB, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
+ MESA_FORMAT_X8B8G8R8_SRGB, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
MESA_FORMAT_L8A8_SRGB, /* AAAA AAAA LLLL LLLL */
+ MESA_FORMAT_A8L8_SRGB, /* LLLL LLLL AAAA AAAA */
/* Array sRGB formats */
MESA_FORMAT_L_SRGB8, /* ubyte[i] = L */
diff --git a/mesalib/src/mesa/main/histogram.c b/mesalib/src/mesa/main/histogram.c
index e6e6a6fd1..5759763d4 100644
--- a/mesalib/src/mesa/main/histogram.c
+++ b/mesalib/src/mesa/main/histogram.c
@@ -24,10 +24,8 @@
#include "glheader.h"
-#include "bufferobj.h"
-#include "colormac.h"
+#include "context.h"
#include "histogram.h"
-#include "macros.h"
#include "main/dispatch.h"
diff --git a/mesalib/src/mesa/main/macros.h b/mesalib/src/mesa/main/macros.h
index 7b6148d09..712699f75 100644
--- a/mesalib/src/mesa/main/macros.h
+++ b/mesalib/src/mesa/main/macros.h
@@ -144,10 +144,10 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
/* This function/macro is sensitive to precision. Test very carefully
* if you change it!
*/
-#define UNCLAMPED_FLOAT_TO_UBYTE(UB, F) \
+#define UNCLAMPED_FLOAT_TO_UBYTE(UB, FLT) \
do { \
fi_type __tmp; \
- __tmp.f = (F); \
+ __tmp.f = (FLT); \
if (__tmp.i < 0) \
UB = (GLubyte) 0; \
else if (__tmp.i >= IEEE_ONE) \
@@ -157,10 +157,10 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
UB = (GLubyte) __tmp.i; \
} \
} while (0)
-#define CLAMPED_FLOAT_TO_UBYTE(UB, F) \
+#define CLAMPED_FLOAT_TO_UBYTE(UB, FLT) \
do { \
fi_type __tmp; \
- __tmp.f = (F) * (255.0F/256.0F) + 32768.0F; \
+ __tmp.f = (FLT) * (255.0F/256.0F) + 32768.0F; \
UB = (GLubyte) __tmp.i; \
} while (0)
#else
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 4fb30ffba..553a21667 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1526,7 +1526,6 @@ struct gl_client_array
GLuint _ElementSize; /**< size of each element in bytes */
struct gl_buffer_object *BufferObj;/**< GL_ARB_vertex_buffer_object */
- GLuint _MaxElement; /**< max element index into array buffer + 1 */
};
@@ -1629,12 +1628,6 @@ struct gl_vertex_array_object
/** Mask of VERT_BIT_* values indicating changed/dirty arrays */
GLbitfield64 NewArrays;
- /**
- * Min of all enabled arrays' _MaxElement. When arrays reside inside VBOs
- * we can determine the max legal (in bounds) glDrawElements array index.
- */
- GLuint _MaxElement;
-
/** The index buffer (also known as the element array buffer in OpenGL). */
struct gl_buffer_object *IndexBufferObj;
};
@@ -2055,8 +2048,90 @@ typedef enum
* \name Vertex shader system values
*/
/*@{*/
+ /**
+ * OpenGL-style vertex ID.
+ *
+ * Section 2.11.7 (Shader Execution), subsection Shader Inputs, of the
+ * OpenGL 3.3 core profile spec says:
+ *
+ * "gl_VertexID holds the integer index i implicitly passed by
+ * DrawArrays or one of the other drawing commands defined in section
+ * 2.8.3."
+ *
+ * Section 2.8.3 (Drawing Commands) of the same spec says:
+ *
+ * "The commands....are equivalent to the commands with the same base
+ * name (without the BaseVertex suffix), except that the ith element
+ * transferred by the corresponding draw call will be taken from
+ * element indices[i] + basevertex of each enabled array."
+ *
+ * Additionally, the overview in the GL_ARB_shader_draw_parameters spec
+ * says:
+ *
+ * "In unextended GL, vertex shaders have inputs named gl_VertexID and
+ * gl_InstanceID, which contain, respectively the index of the vertex
+ * and instance. The value of gl_VertexID is the implicitly passed
+ * index of the vertex being processed, which includes the value of
+ * baseVertex, for those commands that accept it."
+ *
+ * gl_VertexID gets basevertex added in. This differs from DirectX where
+ * SV_VertexID does \b not get basevertex added in.
+ *
+ * \note
+ * If all system values are available, \c SYSTEM_VALUE_VERTEX_ID will be
+ * equal to \c SYSTEM_VALUE_VERTEX_ID_ZERO_BASE plus
+ * \c SYSTEM_VALUE_BASE_VERTEX.
+ *
+ * \sa SYSTEM_VALUE_VERTEX_ID_ZERO_BASE, SYSTEM_VALUE_BASE_VERTEX
+ */
SYSTEM_VALUE_VERTEX_ID,
+
+ /**
+ * Instanced ID as supplied to gl_InstanceID
+ *
+ * Values assigned to gl_InstanceID always begin with zero, regardless of
+ * the value of baseinstance.
+ *
+ * Section 11.1.3.9 (Shader Inputs) of the OpenGL 4.4 core profile spec
+ * says:
+ *
+ * "gl_InstanceID holds the integer instance number of the current
+ * primitive in an instanced draw call (see section 10.5)."
+ *
+ * Through a big chain of pseudocode, section 10.5 describes that
+ * baseinstance is not counted by gl_InstanceID. In that section, notice
+ *
+ * "If an enabled vertex attribute array is instanced (it has a
+ * non-zero divisor as specified by VertexAttribDivisor), the element
+ * index that is transferred to the GL, for all vertices, is given by
+ *
+ * floor(instance/divisor) + baseinstance
+ *
+ * If an array corresponding to an attribute required by a vertex
+ * shader is not enabled, then the corresponding element is taken from
+ * the current attribute state (see section 10.2)."
+ *
+ * Note that baseinstance is \b not included in the value of instance.
+ */
SYSTEM_VALUE_INSTANCE_ID,
+
+ /**
+ * DirectX-style vertex ID.
+ *
+ * Unlike \c SYSTEM_VALUE_VERTEX_ID, this system value does \b not include
+ * the value of basevertex.
+ *
+ * \sa SYSTEM_VALUE_VERTEX_ID, SYSTEM_VALUE_BASE_VERTEX
+ */
+ SYSTEM_VALUE_VERTEX_ID_ZERO_BASE,
+
+ /**
+ * Value of \c basevertex passed to \c glDrawElementsBaseVertex and similar
+ * functions.
+ *
+ * \sa SYSTEM_VALUE_VERTEX_ID, SYSTEM_VALUE_VERTEX_ID_ZERO_BASE
+ */
+ SYSTEM_VALUE_BASE_VERTEX,
/*@}*/
/**
@@ -3350,9 +3425,6 @@ struct gl_constants
GLuint PrimitivesWritten;
} QueryCounterBits;
- /** vertex array / buffer object bounds checking */
- GLboolean CheckArrayBounds;
-
GLuint MaxDrawBuffers; /**< GL_ARB_draw_buffers */
GLuint MaxColorAttachments; /**< GL_EXT_framebuffer_object */
@@ -3406,6 +3478,15 @@ struct gl_constants
GLboolean NativeIntegers;
/**
+ * Does VertexID count from zero or from base vertex?
+ *
+ * \note
+ * If desktop GLSL 1.30 or GLSL ES 3.00 are not supported, this field is
+ * ignored and need not be set.
+ */
+ bool VertexID_is_zero_based;
+
+ /**
* If the driver supports real 32-bit integers, what integer value should be
* used for boolean true in uniform uploads? (Usually 1 or ~0.)
*/
diff --git a/mesalib/src/mesa/main/pipelineobj.c b/mesalib/src/mesa/main/pipelineobj.c
index 017d4257e..b713d956f 100644
--- a/mesalib/src/mesa/main/pipelineobj.c
+++ b/mesalib/src/mesa/main/pipelineobj.c
@@ -120,12 +120,12 @@ delete_pipelineobj_cb(GLuint id, void *data, void *userData)
void
_mesa_free_pipeline_data(struct gl_context *ctx)
{
+ _mesa_reference_pipeline_object(ctx, &ctx->_Shader, NULL);
+
_mesa_HashDeleteAll(ctx->Pipeline.Objects, delete_pipelineobj_cb, ctx);
_mesa_DeleteHashTable(ctx->Pipeline.Objects);
- _mesa_reference_pipeline_object(ctx, &ctx->_Shader, NULL);
_mesa_delete_pipeline_object(ctx, ctx->Pipeline.Default);
-
}
/**
diff --git a/mesalib/src/mesa/main/shader_query.cpp b/mesalib/src/mesa/main/shader_query.cpp
index 426774316..766ad2965 100644
--- a/mesalib/src/mesa/main/shader_query.cpp
+++ b/mesalib/src/mesa/main/shader_query.cpp
@@ -92,8 +92,9 @@ is_active_attrib(const ir_variable *var)
* are enumerated, including the special built-in inputs gl_VertexID
* and gl_InstanceID."
*/
- return !strcmp(var->name, "gl_VertexID") ||
- !strcmp(var->name, "gl_InstanceID");
+ return var->data.location == SYSTEM_VALUE_VERTEX_ID ||
+ var->data.location == SYSTEM_VALUE_VERTEX_ID_ZERO_BASE ||
+ var->data.location == SYSTEM_VALUE_INSTANCE_ID;
default:
return false;
@@ -133,7 +134,18 @@ _mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index,
continue;
if (current_index == desired_index) {
- _mesa_copy_string(name, maxLength, length, var->name);
+ const char *var_name = var->name;
+
+ /* Since gl_VertexID may be lowered to gl_VertexIDMESA, we need to
+ * consider gl_VertexIDMESA as gl_VertexID for purposes of checking
+ * active attributes.
+ */
+ if (var->data.mode == ir_var_system_value &&
+ var->data.location == SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) {
+ var_name = "gl_VertexID";
+ }
+
+ _mesa_copy_string(name, maxLength, length, var_name);
if (size)
*size = (var->type->is_array()) ? var->type->length : 1;
diff --git a/mesalib/src/mesa/main/state.c b/mesalib/src/mesa/main/state.c
index c122c16aa..80287c470 100644
--- a/mesalib/src/mesa/main/state.c
+++ b/mesalib/src/mesa/main/state.c
@@ -419,11 +419,6 @@ _mesa_update_state_locked( struct gl_context *ctx )
if (new_state & _NEW_ARRAY)
_mesa_update_vao_client_arrays(ctx, ctx->Array.VAO);
- if (ctx->Const.CheckArrayBounds &&
- new_state & (_NEW_ARRAY | _NEW_PROGRAM | _NEW_BUFFER_OBJECT)) {
- _mesa_update_vao_max_element(ctx, ctx->Array.VAO);
- }
-
out:
new_prog_state |= update_program_constants(ctx);
diff --git a/mesalib/src/mesa/main/texcompress_rgtc.c b/mesalib/src/mesa/main/texcompress_rgtc.c
index 1012699f5..f7ee24d47 100644
--- a/mesalib/src/mesa/main/texcompress_rgtc.c
+++ b/mesalib/src/mesa/main/texcompress_rgtc.c
@@ -40,23 +40,10 @@
#include "macros.h"
#include "mipmap.h"
#include "texcompress.h"
+#include "util/rgtc.h"
#include "texcompress_rgtc.h"
#include "texstore.h"
-
-#define RGTC_DEBUG 0
-
-static void unsigned_encode_rgtc_ubyte(GLubyte *blkaddr, GLubyte srccolors[4][4],
- GLint numxpixels, GLint numypixels);
-static void signed_encode_rgtc_ubyte(GLbyte *blkaddr, GLbyte srccolors[4][4],
- GLint numxpixels, GLint numypixels);
-
-static void unsigned_fetch_texel_rgtc(unsigned srcRowStride, const GLubyte *pixdata,
- unsigned i, unsigned j, GLubyte *value, unsigned comps);
-
-static void signed_fetch_texel_rgtc(unsigned srcRowStride, const GLbyte *pixdata,
- unsigned i, unsigned j, GLbyte *value, unsigned comps);
-
static void extractsrc_u( GLubyte srcpixels[4][4], const GLubyte *srcaddr,
GLint srcRowStride, GLint numxpixels, GLint numypixels, GLint comps)
{
@@ -121,7 +108,7 @@ _mesa_texstore_red_rgtc1(TEXSTORE_PARAMS)
if (srcWidth > i + 3) numxpixels = 4;
else numxpixels = srcWidth - i;
extractsrc_u(srcpixels, srcaddr, srcWidth, numxpixels, numypixels, 1);
- unsigned_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
+ util_format_unsigned_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
srcaddr += numxpixels;
blkaddr += 8;
}
@@ -168,7 +155,7 @@ _mesa_texstore_signed_red_rgtc1(TEXSTORE_PARAMS)
if (srcWidth > i + 3) numxpixels = 4;
else numxpixels = srcWidth - i;
extractsrc_s(srcpixels, srcaddr, srcWidth, numxpixels, numypixels, 1);
- signed_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
+ util_format_signed_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
srcaddr += numxpixels;
blkaddr += 8;
}
@@ -216,11 +203,11 @@ _mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS)
if (srcWidth > i + 3) numxpixels = 4;
else numxpixels = srcWidth - i;
extractsrc_u(srcpixels, srcaddr, srcWidth, numxpixels, numypixels, 2);
- unsigned_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
+ util_format_unsigned_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
blkaddr += 8;
extractsrc_u(srcpixels, (GLubyte *)srcaddr + 1, srcWidth, numxpixels, numypixels, 2);
- unsigned_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
+ util_format_unsigned_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
blkaddr += 8;
@@ -271,11 +258,11 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS)
else numxpixels = srcWidth - i;
extractsrc_s(srcpixels, srcaddr, srcWidth, numxpixels, numypixels, 2);
- signed_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
+ util_format_signed_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
blkaddr += 8;
extractsrc_s(srcpixels, srcaddr + 1, srcWidth, numxpixels, numypixels, 2);
- signed_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
+ util_format_signed_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
blkaddr += 8;
srcaddr += numxpixels * 2;
@@ -289,40 +276,12 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS)
return GL_TRUE;
}
-
-#define TAG(x) unsigned_##x
-
-#define TYPE GLubyte
-#define T_MIN 0
-#define T_MAX 0xff
-
-#include "texcompress_rgtc_tmp.h"
-
-#undef TAG
-#undef TYPE
-#undef T_MIN
-#undef T_MAX
-
-#define TAG(x) signed_##x
-#define TYPE GLbyte
-#define T_MIN (GLbyte)-128
-#define T_MAX (GLbyte)127
-
-#include "texcompress_rgtc_tmp.h"
-
-#undef TAG
-#undef TYPE
-#undef T_MIN
-#undef T_MAX
-
-
-
static void
fetch_red_rgtc1(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLubyte red;
- unsigned_fetch_texel_rgtc(rowStride, map, i, j, &red, 1);
+ util_format_unsigned_fetch_texel_rgtc(rowStride, map, i, j, &red, 1);
texel[RCOMP] = UBYTE_TO_FLOAT(red);
texel[GCOMP] = 0.0;
texel[BCOMP] = 0.0;
@@ -334,7 +293,7 @@ fetch_l_latc1(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLubyte red;
- unsigned_fetch_texel_rgtc(rowStride, map, i, j, &red, 1);
+ util_format_unsigned_fetch_texel_rgtc(rowStride, map, i, j, &red, 1);
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = UBYTE_TO_FLOAT(red);
@@ -346,7 +305,7 @@ fetch_signed_red_rgtc1(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLbyte red;
- signed_fetch_texel_rgtc(rowStride, (const GLbyte *) map,
+ util_format_signed_fetch_texel_rgtc(rowStride, (const GLbyte *) map,
i, j, &red, 1);
texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
texel[GCOMP] = 0.0;
@@ -359,7 +318,7 @@ fetch_signed_l_latc1(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLbyte red;
- signed_fetch_texel_rgtc(rowStride, (GLbyte *) map,
+ util_format_signed_fetch_texel_rgtc(rowStride, (GLbyte *) map,
i, j, &red, 1);
texel[RCOMP] =
texel[GCOMP] =
@@ -372,10 +331,10 @@ fetch_rg_rgtc2(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLubyte red, green;
- unsigned_fetch_texel_rgtc(rowStride,
+ util_format_unsigned_fetch_texel_rgtc(rowStride,
map,
i, j, &red, 2);
- unsigned_fetch_texel_rgtc(rowStride,
+ util_format_unsigned_fetch_texel_rgtc(rowStride,
map + 8,
i, j, &green, 2);
texel[RCOMP] = UBYTE_TO_FLOAT(red);
@@ -389,10 +348,10 @@ fetch_la_latc2(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLubyte red, green;
- unsigned_fetch_texel_rgtc(rowStride,
+ util_format_unsigned_fetch_texel_rgtc(rowStride,
map,
i, j, &red, 2);
- unsigned_fetch_texel_rgtc(rowStride,
+ util_format_unsigned_fetch_texel_rgtc(rowStride,
map + 8,
i, j, &green, 2);
texel[RCOMP] =
@@ -407,10 +366,10 @@ fetch_signed_rg_rgtc2(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLbyte red, green;
- signed_fetch_texel_rgtc(rowStride,
+ util_format_signed_fetch_texel_rgtc(rowStride,
(GLbyte *) map,
i, j, &red, 2);
- signed_fetch_texel_rgtc(rowStride,
+ util_format_signed_fetch_texel_rgtc(rowStride,
(GLbyte *) map + 8,
i, j, &green, 2);
texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
@@ -425,10 +384,10 @@ fetch_signed_la_latc2(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLbyte red, green;
- signed_fetch_texel_rgtc(rowStride,
+ util_format_signed_fetch_texel_rgtc(rowStride,
(GLbyte *) map,
i, j, &red, 2);
- signed_fetch_texel_rgtc(rowStride,
+ util_format_signed_fetch_texel_rgtc(rowStride,
(GLbyte *) map + 8,
i, j, &green, 2);
texel[RCOMP] =
diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c
index 6d3b80556..832e66128 100644
--- a/mesalib/src/mesa/main/texformat.c
+++ b/mesalib/src/mesa/main/texformat.c
@@ -485,6 +485,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
case GL_LUMINANCE_ALPHA_SNORM:
case GL_LUMINANCE8_ALPHA8_SNORM:
RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_SNORM);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8L8_SNORM);
RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SNORM);
RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM);
break;
@@ -539,6 +540,9 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_SRGB8);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
+
+ RETURN_IF_SUPPORTED(MESA_FORMAT_X8B8G8R8_SRGB);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
break;
case GL_SRGB_ALPHA_EXT:
case GL_SRGB8_ALPHA8_EXT:
@@ -546,36 +550,45 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SRGB);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
break;
case GL_SLUMINANCE_EXT:
case GL_SLUMINANCE8_EXT:
RETURN_IF_SUPPORTED(MESA_FORMAT_L_SRGB8);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
break;
case GL_SLUMINANCE_ALPHA_EXT:
case GL_SLUMINANCE8_ALPHA8_EXT:
RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_SRGB);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8L8_SRGB);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
break;
case GL_COMPRESSED_SLUMINANCE_EXT:
RETURN_IF_SUPPORTED(MESA_FORMAT_L_SRGB8);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
break;
case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_SRGB);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8L8_SRGB);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
break;
case GL_COMPRESSED_SRGB_EXT:
if (ctx->Mesa_DXTn)
RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1);
RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_SRGB8);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
break;
case GL_COMPRESSED_SRGB_ALPHA_EXT:
if (ctx->Mesa_DXTn)
RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3); /* Not srgba_dxt1, see spec */
RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SRGB);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
break;
case GL_ALPHA8UI_EXT:
diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp
index 4cd2bca01..1592c9bfd 100644
--- a/mesalib/src/mesa/main/uniform_query.cpp
+++ b/mesalib/src/mesa/main/uniform_query.cpp
@@ -226,6 +226,13 @@ validate_uniform_parameters(struct gl_context *ctx,
return NULL;
}
+ /* Check that the given location is in bounds of uniform remap table. */
+ if (location >= (GLint) shProg->NumUniformRemapTable) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)",
+ caller, location);
+ return NULL;
+ }
+
/* Page 82 (page 96 of the PDF) of the OpenGL 2.1 spec says:
*
* "If any of the following conditions occur, an INVALID_OPERATION
@@ -239,19 +246,12 @@ validate_uniform_parameters(struct gl_context *ctx,
* - if count is greater than one, and the uniform declared in the
* shader is not an array variable,
*/
- if (location < -1) {
+ if (location < -1 || !shProg->UniformRemapTable[location]) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)",
caller, location);
return NULL;
}
- /* Check that the given location is in bounds of uniform remap table. */
- if (location >= (GLint) shProg->NumUniformRemapTable) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)",
- caller, location);
- return NULL;
- }
-
/* If the driver storage pointer in remap table is -1, we ignore silently.
*
* GL_ARB_explicit_uniform_location spec says:
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c
index 7d169f9d4..ead78649d 100644
--- a/mesalib/src/mesa/main/varray.c
+++ b/mesalib/src/mesa/main/varray.c
@@ -1867,7 +1867,6 @@ _mesa_copy_client_array(struct gl_context *ctx,
dst->InstanceDivisor = src->InstanceDivisor;
dst->_ElementSize = src->_ElementSize;
_mesa_reference_buffer_object(ctx, &dst->BufferObj, src->BufferObj);
- dst->_MaxElement = src->_MaxElement;
}
void
@@ -1911,11 +1910,10 @@ print_array(const char *name, GLint index, const struct gl_client_array *array)
printf(" %s[%d]: ", name, index);
else
printf(" %s: ", name);
- printf("Ptr=%p, Type=0x%x, Size=%d, ElemSize=%u, Stride=%d, Buffer=%u(Size %lu), MaxElem=%u\n",
+ printf("Ptr=%p, Type=0x%x, Size=%d, ElemSize=%u, Stride=%d, Buffer=%u(Size %lu)\n",
array->Ptr, array->Type, array->Size,
array->_ElementSize, array->StrideB,
- array->BufferObj->Name, (unsigned long) array->BufferObj->Size,
- array->_MaxElement);
+ array->BufferObj->Name, (unsigned long) array->BufferObj->Size);
}
@@ -1928,8 +1926,6 @@ _mesa_print_arrays(struct gl_context *ctx)
struct gl_vertex_array_object *vao = ctx->Array.VAO;
GLuint i;
- _mesa_update_vao_max_element(ctx, vao);
-
printf("Array Object %u\n", vao->Name);
if (vao->_VertexAttrib[VERT_ATTRIB_POS].Enabled)
print_array("Vertex", -1, &vao->_VertexAttrib[VERT_ATTRIB_POS]);
@@ -1943,7 +1939,6 @@ _mesa_print_arrays(struct gl_context *ctx)
for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++)
if (vao->_VertexAttrib[VERT_ATTRIB_GENERIC(i)].Enabled)
print_array("Attrib", i, &vao->_VertexAttrib[VERT_ATTRIB_GENERIC(i)]);
- printf(" _MaxElement = %u\n", vao->_MaxElement);
}
diff --git a/mesalib/src/mesa/main/varray.h b/mesalib/src/mesa/main/varray.h
index d5d8b363d..4e4bd5f80 100644
--- a/mesalib/src/mesa/main/varray.h
+++ b/mesalib/src/mesa/main/varray.h
@@ -34,39 +34,6 @@
struct gl_client_array;
struct gl_context;
-
-/**
- * Compute the index of the last array element that can be safely accessed in
- * a vertex array. We can really only do this when the array lives in a VBO.
- * The array->_MaxElement field will be updated.
- * Later in glDrawArrays/Elements/etc we can do some bounds checking.
- */
-static inline void
-_mesa_update_array_max_element(struct gl_client_array *array)
-{
- assert(array->Enabled);
-
- if (array->BufferObj->Name) {
- GLsizeiptrARB offset = (GLsizeiptrARB) array->Ptr;
- GLsizeiptrARB bufSize = (GLsizeiptrARB) array->BufferObj->Size;
-
- if (offset < bufSize) {
- const GLuint stride = array->StrideB ?
- array->StrideB : array->_ElementSize;
- array->_MaxElement = (bufSize - offset + stride
- - array->_ElementSize) / stride;
- }
- else {
- array->_MaxElement = 0;
- }
- }
- else {
- /* user-space array, no idea how big it is */
- array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */
- }
-}
-
-
/**
* Returns a pointer to the vertex attribute data in a client array,
* or the offset into the vertex buffer for an array that resides in
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index 49e4a7a40..293fe34b9 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -2505,12 +2505,7 @@ _mesa_associate_uniform_storage(struct gl_context *ctx,
columns = storage->type->matrix_columns;
break;
case GLSL_TYPE_BOOL:
- if (ctx->Const.NativeIntegers) {
- format = (ctx->Const.UniformBooleanTrue == 1)
- ? uniform_bool_int_0_1 : uniform_bool_int_0_not0;
- } else {
- format = uniform_bool_float;
- }
+ format = uniform_native;
columns = 1;
break;
case GLSL_TYPE_SAMPLER:
diff --git a/mesalib/src/mesa/program/prog_optimize.c b/mesalib/src/mesa/program/prog_optimize.c
index 08c1c3046..60530ebf0 100644
--- a/mesalib/src/mesa/program/prog_optimize.c
+++ b/mesalib/src/mesa/program/prog_optimize.c
@@ -114,7 +114,6 @@ get_src_arg_mask(const struct prog_instruction *inst,
read_mask = 0x0;
for (comp = 0; comp < 4; ++comp) {
const GLuint coord = GET_SWZ(inst->SrcReg[arg].Swizzle, comp);
- ASSERT(coord < 4);
if (channel_mask & (1 << comp) && coord <= SWIZZLE_W)
read_mask |= 1 << coord;
}
@@ -284,11 +283,11 @@ _mesa_remove_dead_code_global(struct gl_program *prog)
for (comp = 0; comp < 4; comp++) {
const GLuint swz = GET_SWZ(inst->SrcReg[j].Swizzle, comp);
- ASSERT(swz < 4);
- if ((read_mask & (1 << swz)) == 0)
- continue;
- if (swz <= SWIZZLE_W)
+ if (swz <= SWIZZLE_W) {
+ if ((read_mask & (1 << swz)) == 0)
+ continue;
tempRead[index][swz] = GL_TRUE;
+ }
}
}
}
diff --git a/mesalib/src/mesa/program/register_allocate.c b/mesalib/src/mesa/program/register_allocate.c
index db2be5dfa..7faf67215 100644
--- a/mesalib/src/mesa/program/register_allocate.c
+++ b/mesalib/src/mesa/program/register_allocate.c
@@ -434,6 +434,7 @@ decrement_q(struct ra_graph *g, unsigned int n)
unsigned int n2_class = g->nodes[n2].class;
if (n != n2 && !g->nodes[n2].in_stack) {
+ assert(g->nodes[n2].q_total >= g->regs->classes[n2_class]->q[n_class]);
g->nodes[n2].q_total -= g->regs->classes[n2_class]->q[n_class];
}
}
diff --git a/mesalib/src/mesa/program/register_allocate.h b/mesalib/src/mesa/program/register_allocate.h
index bfc9190dc..dc6874495 100644
--- a/mesalib/src/mesa/program/register_allocate.h
+++ b/mesalib/src/mesa/program/register_allocate.h
@@ -56,7 +56,10 @@ void ra_set_finalize(struct ra_regs *regs, unsigned int **conflicts);
* Each interference graph node is a virtual variable in the IL. It
* is up to the user to ra_set_node_class() for the virtual variable,
* and compute live ranges and ra_node_interfere() between conflicting
- * live ranges.
+ * live ranges. Note that an interference *must not* be added between
+ * two nodes if their classes haven't been assigned yet. The user
+ * should set the class of each node before building the interference
+ * graph.
*/
struct ra_graph *ra_alloc_interference_graph(struct ra_regs *regs,
unsigned int count);
diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c
index 03d05932a..ed9a44429 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c
@@ -192,9 +192,9 @@ get_texture_format_swizzle(const struct st_texture_object *stObj)
return swizzle_swizzle(stObj->base._Swizzle, tex_swizzle);
}
-
+
/**
- * Return TRUE if the texture's sampler view swizzle is equal to
+ * Return TRUE if the texture's sampler view swizzle is not equal to
* the texture's swizzle.
*
* \param stObj the st texture object,
@@ -214,9 +214,20 @@ check_sampler_swizzle(const struct st_texture_object *stObj,
static unsigned last_level(struct st_texture_object *stObj)
{
- return MIN2(stObj->base._MaxLevel, stObj->pt->last_level);
+ unsigned ret = MIN2(stObj->base.MinLevel + stObj->base._MaxLevel,
+ stObj->pt->last_level);
+ if (stObj->base.Immutable)
+ ret = MIN2(ret, stObj->base.MinLevel + stObj->base.NumLevels - 1);
+ return ret;
}
+static unsigned last_layer(struct st_texture_object *stObj)
+{
+ if (stObj->base.Immutable)
+ return MIN2(stObj->base.MinLayer + stObj->base.NumLayers - 1,
+ stObj->pt->array_size - 1);
+ return stObj->pt->array_size - 1;
+}
static struct pipe_sampler_view *
st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe,
@@ -249,9 +260,13 @@ st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe,
templ.u.buf.first_element = f;
templ.u.buf.last_element = f + (n - 1);
} else {
- templ.u.tex.first_level = stObj->base.BaseLevel;
+ templ.u.tex.first_level = stObj->base.MinLevel + stObj->base.BaseLevel;
templ.u.tex.last_level = last_level(stObj);
assert(templ.u.tex.first_level <= templ.u.tex.last_level);
+ templ.u.tex.first_layer = stObj->base.MinLayer;
+ templ.u.tex.last_layer = last_layer(stObj);
+ assert(templ.u.tex.first_layer <= templ.u.tex.last_layer);
+ templ.target = gl_target_to_pipe(stObj->base.Target);
}
if (swizzle != SWIZZLE_NOOP) {
@@ -287,8 +302,11 @@ st_get_texture_sampler_view_from_stobj(struct st_context *st,
if (*sv) {
if (check_sampler_swizzle(stObj, *sv) ||
(format != (*sv)->format) ||
- stObj->base.BaseLevel != (*sv)->u.tex.first_level ||
- last_level(stObj) != (*sv)->u.tex.last_level) {
+ gl_target_to_pipe(stObj->base.Target) != (*sv)->target ||
+ stObj->base.MinLevel + stObj->base.BaseLevel != (*sv)->u.tex.first_level ||
+ last_level(stObj) != (*sv)->u.tex.last_level ||
+ stObj->base.MinLayer != (*sv)->u.tex.first_layer ||
+ last_layer(stObj) != (*sv)->u.tex.last_layer) {
pipe_sampler_view_reference(sv, NULL);
}
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index 7cfd3dade..470ab278b 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -450,6 +450,16 @@ st_update_renderbuffer_surface(struct st_context *st,
last_layer = strb->rtt_face + strb->rtt_slice;
}
+ /* Adjust for texture views */
+ if (strb->is_rtt) {
+ struct gl_texture_object *tex = strb->Base.TexImage->TexObject;
+ first_layer += tex->MinLayer;
+ if (!strb->rtt_layered)
+ last_layer += tex->MinLayer;
+ else
+ last_layer = MIN2(first_layer + tex->NumLayers - 1, last_layer);
+ }
+
if (!strb->surface ||
strb->surface->texture->nr_samples != strb->Base.NumSamples ||
strb->surface->format != format ||
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index ad14bd939..dfa188a3f 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -829,12 +829,12 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims,
blit.src.level = 0;
blit.src.format = src_format;
blit.dst.resource = dst;
- blit.dst.level = stObj->pt != stImage->pt ? 0 : texImage->Level;
+ blit.dst.level = stObj->pt != stImage->pt ? 0 : texImage->TexObject->MinLevel + texImage->Level;
blit.dst.format = dst_format;
blit.src.box.x = blit.src.box.y = blit.src.box.z = 0;
blit.dst.box.x = xoffset;
blit.dst.box.y = yoffset;
- blit.dst.box.z = zoffset + texImage->Face;
+ blit.dst.box.z = zoffset + texImage->Face + texImage->TexObject->MinLayer;
blit.src.box.width = blit.dst.box.width = width;
blit.src.box.height = blit.dst.box.height = height;
blit.src.box.depth = blit.dst.box.depth = depth;
@@ -916,7 +916,8 @@ st_GetTexImage(struct gl_context * ctx,
GLuint height = texImage->Height;
GLuint depth = texImage->Depth;
struct st_texture_image *stImage = st_texture_image(texImage);
- struct pipe_resource *src = st_texture_object(texImage->TexObject)->pt;
+ struct st_texture_object *stObj = st_texture_object(texImage->TexObject);
+ struct pipe_resource *src = stObj->pt;
struct pipe_resource *dst = NULL;
struct pipe_resource dst_templ;
enum pipe_format dst_format, src_format;
@@ -970,7 +971,10 @@ st_GetTexImage(struct gl_context * ctx,
* - Luminance alpha must be returned as (L,0,0,A).
* - Intensity must be returned as (I,0,0,1)
*/
- src_format = util_format_linear(src->format);
+ if (stObj->surface_based)
+ src_format = util_format_linear(stObj->surface_format);
+ else
+ src_format = util_format_linear(src->format);
src_format = util_format_luminance_to_red(src_format);
src_format = util_format_intensity_to_red(src_format);
@@ -1069,14 +1073,14 @@ st_GetTexImage(struct gl_context * ctx,
memset(&blit, 0, sizeof(blit));
blit.src.resource = src;
- blit.src.level = texImage->Level;
+ blit.src.level = texImage->Level + texImage->TexObject->MinLevel;
blit.src.format = src_format;
blit.dst.resource = dst;
blit.dst.level = 0;
blit.dst.format = dst->format;
blit.src.box.x = blit.dst.box.x = 0;
blit.src.box.y = blit.dst.box.y = 0;
- blit.src.box.z = texImage->Face;
+ blit.src.box.z = texImage->Face + texImage->TexObject->MinLayer;
blit.dst.box.z = 0;
blit.src.box.width = blit.dst.box.width = width;
blit.src.box.height = blit.dst.box.height = height;
@@ -1441,10 +1445,10 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
blit.src.box.depth = 1;
blit.dst.resource = stImage->pt;
blit.dst.format = dst_format;
- blit.dst.level = stObj->pt != stImage->pt ? 0 : texImage->Level;
+ blit.dst.level = stObj->pt != stImage->pt ? 0 : texImage->Level + texImage->TexObject->MinLevel;
blit.dst.box.x = destX;
blit.dst.box.y = destY;
- blit.dst.box.z = stImage->base.Face + slice;
+ blit.dst.box.z = stImage->base.Face + slice + texImage->TexObject->MinLayer;
blit.dst.box.width = width;
blit.dst.box.height = height;
blit.dst.box.depth = 1;
@@ -1545,6 +1549,9 @@ st_finalize_texture(struct gl_context *ctx,
enum pipe_format firstImageFormat;
GLuint ptWidth, ptHeight, ptDepth, ptLayers, ptNumSamples;
+ if (tObj->Immutable)
+ return GL_TRUE;
+
if (_mesa_is_texture_complete(tObj, &tObj->Sampler)) {
/* The texture is complete and we know exactly how many mipmap levels
* are present/needed. This is conditional because we may be called
@@ -1824,6 +1831,44 @@ st_TestProxyTexImage(struct gl_context *ctx, GLenum target,
}
}
+static GLboolean
+st_TextureView(struct gl_context *ctx,
+ struct gl_texture_object *texObj,
+ struct gl_texture_object *origTexObj)
+{
+ struct st_texture_object *orig = st_texture_object(origTexObj);
+ struct st_texture_object *tex = st_texture_object(texObj);
+ struct gl_texture_image *image = texObj->Image[0][0];
+
+ const int numFaces = _mesa_num_tex_faces(texObj->Target);
+ const int numLevels = texObj->NumLevels;
+
+ int face;
+ int level;
+
+ pipe_resource_reference(&tex->pt, orig->pt);
+
+ /* Set image resource pointers */
+ for (level = 0; level < numLevels; level++) {
+ for (face = 0; face < numFaces; face++) {
+ struct st_texture_image *stImage =
+ st_texture_image(texObj->Image[face][level]);
+ pipe_resource_reference(&stImage->pt, tex->pt);
+ }
+ }
+
+ tex->surface_based = GL_TRUE;
+ tex->surface_format =
+ st_mesa_format_to_pipe_format(st_context(ctx), image->TexFormat);
+
+ tex->width0 = image->Width;
+ tex->height0 = image->Height;
+ tex->depth0 = image->Depth;
+ tex->lastLevel = numLevels - 1;
+
+ return GL_TRUE;
+}
+
void
st_init_texture_functions(struct dd_function_table *functions)
@@ -1855,4 +1900,5 @@ st_init_texture_functions(struct dd_function_table *functions)
functions->TestProxyTexImage = st_TestProxyTexImage;
functions->AllocTextureStorage = st_AllocTextureStorage;
+ functions->TextureView = st_TextureView;
}
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index 09b615465..768a66790 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -104,6 +104,42 @@ void st_invalidate_state(struct gl_context * ctx, GLuint new_state)
_vbo_InvalidateState(ctx, new_state);
}
+
+static void
+st_destroy_context_priv(struct st_context *st)
+{
+ uint shader, i;
+
+ st_destroy_atoms( st );
+ st_destroy_draw( st );
+ st_destroy_clear(st);
+ st_destroy_bitmap(st);
+ st_destroy_drawpix(st);
+ st_destroy_drawtex(st);
+
+ for (shader = 0; shader < Elements(st->state.sampler_views); shader++) {
+ for (i = 0; i < Elements(st->state.sampler_views[0]); i++) {
+ pipe_sampler_view_release(st->pipe,
+ &st->state.sampler_views[shader][i]);
+ }
+ }
+
+ if (st->default_texture) {
+ st->ctx->Driver.DeleteTexture(st->ctx, st->default_texture);
+ st->default_texture = NULL;
+ }
+
+ u_upload_destroy(st->uploader);
+ if (st->indexbuf_uploader) {
+ u_upload_destroy(st->indexbuf_uploader);
+ }
+ if (st->constbuf_uploader) {
+ u_upload_destroy(st->constbuf_uploader);
+ }
+ free( st );
+}
+
+
static struct st_context *
st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
const struct st_config_options *options)
@@ -238,6 +274,14 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
_mesa_compute_version(ctx);
+ if (ctx->Version == 0) {
+ /* This can happen when a core profile was requested, but the driver
+ * does not support some features of GL 3.1 or later.
+ */
+ st_destroy_context_priv(st);
+ return NULL;
+ }
+
_mesa_initialize_dispatch_tables(ctx);
_mesa_initialize_vbo_vtxfmt(ctx);
@@ -259,6 +303,7 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
struct gl_context *ctx;
struct gl_context *shareCtx = share ? share->ctx : NULL;
struct dd_function_table funcs;
+ struct st_context *st;
memset(&funcs, 0, sizeof(funcs));
st_init_driver_functions(&funcs);
@@ -276,41 +321,12 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
if (debug_get_option_mesa_mvp_dp4())
ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS = GL_TRUE;
- return st_create_context_priv(ctx, pipe, options);
-}
-
-
-static void st_destroy_context_priv( struct st_context *st )
-{
- uint shader, i;
-
- st_destroy_atoms( st );
- st_destroy_draw( st );
- st_destroy_clear(st);
- st_destroy_bitmap(st);
- st_destroy_drawpix(st);
- st_destroy_drawtex(st);
-
- for (shader = 0; shader < Elements(st->state.sampler_views); shader++) {
- for (i = 0; i < Elements(st->state.sampler_views[0]); i++) {
- pipe_sampler_view_release(st->pipe,
- &st->state.sampler_views[shader][i]);
- }
+ st = st_create_context_priv(ctx, pipe, options);
+ if (!st) {
+ _mesa_destroy_context(ctx);
}
- if (st->default_texture) {
- st->ctx->Driver.DeleteTexture(st->ctx, st->default_texture);
- st->default_texture = NULL;
- }
-
- u_upload_destroy(st->uploader);
- if (st->indexbuf_uploader) {
- u_upload_destroy(st->indexbuf_uploader);
- }
- if (st->constbuf_uploader) {
- u_upload_destroy(st->constbuf_uploader);
- }
- free( st );
+ return st;
}
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 07bd12567..c7bc0ca50 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -463,6 +463,7 @@ void st_init_extensions(struct pipe_screen *screen,
{ o(ARB_draw_indirect), PIPE_CAP_DRAW_INDIRECT },
{ o(ARB_derivative_control), PIPE_CAP_TGSI_FS_FINE_DERIVATIVE },
{ o(ARB_conditional_render_inverted), PIPE_CAP_CONDITIONAL_RENDER_INVERTED },
+ { o(ARB_texture_view), PIPE_CAP_SAMPLER_VIEW_TARGET },
};
/* Required: render target and sampler support */
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index b5e03b0f8..6c53567fc 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -88,9 +88,13 @@ st_mesa_format_to_pipe_format(struct st_context *st, mesa_format mesaFormat)
case MESA_FORMAT_L4A4_UNORM:
return PIPE_FORMAT_L4A4_UNORM;
case MESA_FORMAT_L8A8_UNORM:
- return PIPE_FORMAT_L8A8_UNORM;
+ return PIPE_FORMAT_LA88_UNORM;
+ case MESA_FORMAT_A8L8_UNORM:
+ return PIPE_FORMAT_AL88_UNORM;
case MESA_FORMAT_L16A16_UNORM:
- return PIPE_FORMAT_L16A16_UNORM;
+ return PIPE_FORMAT_LA1616_UNORM;
+ case MESA_FORMAT_A16L16_UNORM:
+ return PIPE_FORMAT_AL1616_UNORM;
case MESA_FORMAT_A_UNORM8:
return PIPE_FORMAT_A8_UNORM;
case MESA_FORMAT_A_UNORM16:
@@ -142,17 +146,21 @@ st_mesa_format_to_pipe_format(struct st_context *st, mesa_format mesaFormat)
case MESA_FORMAT_SRGBA_DXT5:
return PIPE_FORMAT_DXT5_SRGBA;
case MESA_FORMAT_L8A8_SRGB:
- return PIPE_FORMAT_L8A8_SRGB;
+ return PIPE_FORMAT_LA88_SRGB;
+ case MESA_FORMAT_A8L8_SRGB:
+ return PIPE_FORMAT_AL88_SRGB;
case MESA_FORMAT_L_SRGB8:
return PIPE_FORMAT_L8_SRGB;
case MESA_FORMAT_BGR_SRGB8:
return PIPE_FORMAT_R8G8B8_SRGB;
case MESA_FORMAT_A8B8G8R8_SRGB:
- return PIPE_FORMAT_A8B8G8R8_SRGB;
- case MESA_FORMAT_B8G8R8A8_SRGB:
- return PIPE_FORMAT_B8G8R8A8_SRGB;
+ return PIPE_FORMAT_ABGR8888_SRGB;
case MESA_FORMAT_R8G8B8A8_SRGB:
- return PIPE_FORMAT_R8G8B8A8_SRGB;
+ return PIPE_FORMAT_RGBA8888_SRGB;
+ case MESA_FORMAT_B8G8R8A8_SRGB:
+ return PIPE_FORMAT_BGRA8888_SRGB;
+ case MESA_FORMAT_A8R8G8B8_SRGB:
+ return PIPE_FORMAT_ARGB8888_SRGB;
case MESA_FORMAT_RGBA_FLOAT32:
return PIPE_FORMAT_R32G32B32A32_FLOAT;
case MESA_FORMAT_RGBA_FLOAT16:
@@ -191,9 +199,13 @@ st_mesa_format_to_pipe_format(struct st_context *st, mesa_format mesaFormat)
case MESA_FORMAT_R_UNORM16:
return PIPE_FORMAT_R16_UNORM;
case MESA_FORMAT_R8G8_UNORM:
- return PIPE_FORMAT_R8G8_UNORM;
+ return PIPE_FORMAT_RG88_UNORM;
+ case MESA_FORMAT_G8R8_UNORM:
+ return PIPE_FORMAT_GR88_UNORM;
case MESA_FORMAT_R16G16_UNORM:
- return PIPE_FORMAT_R16G16_UNORM;
+ return PIPE_FORMAT_RG1616_UNORM;
+ case MESA_FORMAT_G16R16_UNORM:
+ return PIPE_FORMAT_GR1616_UNORM;
case MESA_FORMAT_RGBA_UNORM16:
return PIPE_FORMAT_R16G16B16A16_UNORM;
@@ -341,23 +353,31 @@ st_mesa_format_to_pipe_format(struct st_context *st, mesa_format mesaFormat)
case MESA_FORMAT_R_SNORM8:
return PIPE_FORMAT_R8_SNORM;
case MESA_FORMAT_R8G8_SNORM:
- return PIPE_FORMAT_R8G8_SNORM;
+ return PIPE_FORMAT_RG88_SNORM;
+ case MESA_FORMAT_G8R8_SNORM:
+ return PIPE_FORMAT_GR88_SNORM;
case MESA_FORMAT_R8G8B8A8_SNORM:
- return PIPE_FORMAT_R8G8B8A8_SNORM;
+ return PIPE_FORMAT_RGBA8888_SNORM;
+ case MESA_FORMAT_A8B8G8R8_SNORM:
+ return PIPE_FORMAT_ABGR8888_SNORM;
case MESA_FORMAT_A_SNORM8:
return PIPE_FORMAT_A8_SNORM;
case MESA_FORMAT_L_SNORM8:
return PIPE_FORMAT_L8_SNORM;
case MESA_FORMAT_L8A8_SNORM:
- return PIPE_FORMAT_L8A8_SNORM;
+ return PIPE_FORMAT_LA88_SNORM;
+ case MESA_FORMAT_A8L8_SNORM:
+ return PIPE_FORMAT_AL88_SNORM;
case MESA_FORMAT_I_SNORM8:
return PIPE_FORMAT_I8_SNORM;
case MESA_FORMAT_R_SNORM16:
return PIPE_FORMAT_R16_SNORM;
case MESA_FORMAT_R16G16_SNORM:
- return PIPE_FORMAT_R16G16_SNORM;
+ return PIPE_FORMAT_RG1616_SNORM;
+ case MESA_FORMAT_G16R16_SNORM:
+ return PIPE_FORMAT_GR1616_SNORM;
case MESA_FORMAT_RGBA_SNORM16:
return PIPE_FORMAT_R16G16B16A16_SNORM;
@@ -384,9 +404,13 @@ st_mesa_format_to_pipe_format(struct st_context *st, mesa_format mesaFormat)
case MESA_FORMAT_B5G5R5X1_UNORM:
return PIPE_FORMAT_B5G5R5X1_UNORM;
case MESA_FORMAT_R8G8B8X8_SNORM:
- return PIPE_FORMAT_R8G8B8X8_SNORM;
+ return PIPE_FORMAT_RGBX8888_SNORM;
+ case MESA_FORMAT_X8B8G8R8_SNORM:
+ return PIPE_FORMAT_XBGR8888_SNORM;
case MESA_FORMAT_R8G8B8X8_SRGB:
- return PIPE_FORMAT_R8G8B8X8_SRGB;
+ return PIPE_FORMAT_RGBX8888_SRGB;
+ case MESA_FORMAT_X8B8G8R8_SRGB:
+ return PIPE_FORMAT_XBGR8888_SRGB;
case MESA_FORMAT_RGBX_UINT8:
return PIPE_FORMAT_R8G8B8X8_UINT;
case MESA_FORMAT_RGBX_SINT8:
@@ -411,7 +435,9 @@ st_mesa_format_to_pipe_format(struct st_context *st, mesa_format mesaFormat)
return PIPE_FORMAT_R32G32B32X32_SINT;
case MESA_FORMAT_B8G8R8X8_SRGB:
- return PIPE_FORMAT_B8G8R8X8_SRGB;
+ return PIPE_FORMAT_BGRX8888_SRGB;
+ case MESA_FORMAT_X8R8G8B8_SRGB:
+ return PIPE_FORMAT_XRGB8888_SRGB;
/* ETC2 formats are emulated as uncompressed ones.
* The destination formats mustn't be changed, because they are also
@@ -476,10 +502,14 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
return MESA_FORMAT_R10G10B10A2_UNORM;
case PIPE_FORMAT_L4A4_UNORM:
return MESA_FORMAT_L4A4_UNORM;
- case PIPE_FORMAT_L8A8_UNORM:
+ case PIPE_FORMAT_LA88_UNORM:
return MESA_FORMAT_L8A8_UNORM;
- case PIPE_FORMAT_L16A16_UNORM:
+ case PIPE_FORMAT_AL88_UNORM:
+ return MESA_FORMAT_A8L8_UNORM;
+ case PIPE_FORMAT_LA1616_UNORM:
return MESA_FORMAT_L16A16_UNORM;
+ case PIPE_FORMAT_AL1616_UNORM:
+ return MESA_FORMAT_A16L16_UNORM;
case PIPE_FORMAT_A8_UNORM:
return MESA_FORMAT_A_UNORM8;
case PIPE_FORMAT_A16_UNORM:
@@ -536,16 +566,22 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
return MESA_FORMAT_SRGBA_DXT3;
case PIPE_FORMAT_DXT5_SRGBA:
return MESA_FORMAT_SRGBA_DXT5;
- case PIPE_FORMAT_L8A8_SRGB:
+ case PIPE_FORMAT_LA88_SRGB:
return MESA_FORMAT_L8A8_SRGB;
+ case PIPE_FORMAT_AL88_SRGB:
+ return MESA_FORMAT_A8L8_SRGB;
case PIPE_FORMAT_L8_SRGB:
return MESA_FORMAT_L_SRGB8;
case PIPE_FORMAT_R8G8B8_SRGB:
return MESA_FORMAT_BGR_SRGB8;
- case PIPE_FORMAT_A8B8G8R8_SRGB:
+ case PIPE_FORMAT_ABGR8888_SRGB:
return MESA_FORMAT_A8B8G8R8_SRGB;
- case PIPE_FORMAT_B8G8R8A8_SRGB:
+ case PIPE_FORMAT_RGBA8888_SRGB:
+ return MESA_FORMAT_R8G8B8A8_SRGB;
+ case PIPE_FORMAT_BGRA8888_SRGB:
return MESA_FORMAT_B8G8R8A8_SRGB;
+ case PIPE_FORMAT_ARGB8888_SRGB:
+ return MESA_FORMAT_A8R8G8B8_SRGB;
case PIPE_FORMAT_R32G32B32A32_FLOAT:
return MESA_FORMAT_RGBA_FLOAT32;
case PIPE_FORMAT_R16G16B16A16_FLOAT:
@@ -583,10 +619,14 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
return MESA_FORMAT_R_UNORM8;
case PIPE_FORMAT_R16_UNORM:
return MESA_FORMAT_R_UNORM16;
- case PIPE_FORMAT_R8G8_UNORM:
+ case PIPE_FORMAT_RG88_UNORM:
return MESA_FORMAT_R8G8_UNORM;
- case PIPE_FORMAT_R16G16_UNORM:
+ case PIPE_FORMAT_GR88_UNORM:
+ return MESA_FORMAT_G8R8_UNORM;
+ case PIPE_FORMAT_RG1616_UNORM:
return MESA_FORMAT_R16G16_UNORM;
+ case PIPE_FORMAT_GR1616_UNORM:
+ return MESA_FORMAT_G16R16_UNORM;
case PIPE_FORMAT_A8_UINT:
return MESA_FORMAT_A_UINT8;
@@ -728,24 +768,32 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
/* signed normalized formats */
case PIPE_FORMAT_R8_SNORM:
return MESA_FORMAT_R_SNORM8;
- case PIPE_FORMAT_R8G8_SNORM:
+ case PIPE_FORMAT_RG88_SNORM:
return MESA_FORMAT_R8G8_SNORM;
- case PIPE_FORMAT_R8G8B8A8_SNORM:
+ case PIPE_FORMAT_GR88_SNORM:
+ return MESA_FORMAT_G8R8_SNORM;
+ case PIPE_FORMAT_RGBA8888_SNORM:
return MESA_FORMAT_R8G8B8A8_SNORM;
+ case PIPE_FORMAT_ABGR8888_SNORM:
+ return MESA_FORMAT_A8B8G8R8_SNORM;
case PIPE_FORMAT_A8_SNORM:
return MESA_FORMAT_A_SNORM8;
case PIPE_FORMAT_L8_SNORM:
return MESA_FORMAT_L_SNORM8;
- case PIPE_FORMAT_L8A8_SNORM:
+ case PIPE_FORMAT_LA88_SNORM:
return MESA_FORMAT_L8A8_SNORM;
+ case PIPE_FORMAT_AL88_SNORM:
+ return MESA_FORMAT_A8L8_SNORM;
case PIPE_FORMAT_I8_SNORM:
return MESA_FORMAT_I_SNORM8;
case PIPE_FORMAT_R16_SNORM:
return MESA_FORMAT_R_SNORM16;
- case PIPE_FORMAT_R16G16_SNORM:
+ case PIPE_FORMAT_RG1616_SNORM:
return MESA_FORMAT_R16G16_SNORM;
+ case PIPE_FORMAT_GR1616_SNORM:
+ return MESA_FORMAT_G16R16_SNORM;
case PIPE_FORMAT_R16G16B16A16_SNORM:
return MESA_FORMAT_RGBA_SNORM16;
@@ -772,10 +820,14 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
return MESA_FORMAT_B4G4R4X4_UNORM;
case PIPE_FORMAT_B5G5R5X1_UNORM:
return MESA_FORMAT_B5G5R5X1_UNORM;
- case PIPE_FORMAT_R8G8B8X8_SNORM:
+ case PIPE_FORMAT_RGBX8888_SNORM:
return MESA_FORMAT_R8G8B8X8_SNORM;
- case PIPE_FORMAT_R8G8B8X8_SRGB:
+ case PIPE_FORMAT_XBGR8888_SNORM:
+ return MESA_FORMAT_X8B8G8R8_SNORM;
+ case PIPE_FORMAT_RGBX8888_SRGB:
return MESA_FORMAT_R8G8B8X8_SRGB;
+ case PIPE_FORMAT_XBGR8888_SRGB:
+ return MESA_FORMAT_X8B8G8R8_SRGB;
case PIPE_FORMAT_R8G8B8X8_UINT:
return MESA_FORMAT_RGBX_UINT8;
case PIPE_FORMAT_R8G8B8X8_SINT:
@@ -799,10 +851,10 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
case PIPE_FORMAT_R32G32B32X32_SINT:
return MESA_FORMAT_RGBX_SINT32;
- case PIPE_FORMAT_B8G8R8X8_SRGB:
+ case PIPE_FORMAT_BGRX8888_SRGB:
return MESA_FORMAT_B8G8R8X8_SRGB;
- case PIPE_FORMAT_R8G8B8A8_SRGB:
- return MESA_FORMAT_R8G8B8A8_SRGB;
+ case PIPE_FORMAT_XRGB8888_SRGB:
+ return MESA_FORMAT_X8R8G8B8_SRGB;
default:
return MESA_FORMAT_NONE;
@@ -879,6 +931,7 @@ struct format_mapping
#define DEFAULT_SRGBA_FORMATS \
PIPE_FORMAT_B8G8R8A8_SRGB, \
+ PIPE_FORMAT_R8G8B8A8_SRGB, \
PIPE_FORMAT_A8R8G8B8_SRGB, \
PIPE_FORMAT_A8B8G8R8_SRGB, \
0
@@ -919,11 +972,11 @@ static const struct format_mapping format_map[] = {
},
{
{ 4, GL_RGBA, GL_RGBA8, 0 },
- { PIPE_FORMAT_R8G8B8A8_UNORM, DEFAULT_RGBA_FORMATS }
+ { DEFAULT_RGBA_FORMATS }
},
{
{ GL_BGRA, 0 },
- { PIPE_FORMAT_B8G8R8A8_UNORM, DEFAULT_RGBA_FORMATS }
+ { DEFAULT_RGBA_FORMATS }
},
{
{ 3, GL_RGB, GL_RGB8, 0 },
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 62e4101d1..b338a9836 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -3172,6 +3172,7 @@ glsl_to_tgsi_visitor::glsl_to_tgsi_visitor()
shader_program = NULL;
shader = NULL;
options = NULL;
+ have_sqrt = false;
}
glsl_to_tgsi_visitor::~glsl_to_tgsi_visitor()
@@ -4167,6 +4168,8 @@ const unsigned _mesa_sysval_to_semantic[SYSTEM_VALUE_MAX] = {
*/
TGSI_SEMANTIC_VERTEXID,
TGSI_SEMANTIC_INSTANCEID,
+ 0,
+ 0,
/* Geometry shader
*/
diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c
index af9b7675f..c84aa4566 100644
--- a/mesalib/src/mesa/state_tracker/st_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_texture.c
@@ -260,6 +260,12 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
else
level = stImage->base.Level;
+ if (stObj->base.Immutable) {
+ level += stObj->base.MinLevel;
+ z += stObj->base.MinLayer;
+ d = MIN2(d, stObj->base.NumLayers);
+ }
+
z += stImage->base.Face;
map = pipe_transfer_map_3d(st->pipe, stImage->pt, level, usage,
@@ -289,8 +295,13 @@ st_texture_image_unmap(struct st_context *st,
struct st_texture_image *stImage, unsigned slice)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_transfer **transfer =
- &stImage->transfer[slice + stImage->base.Face].transfer;
+ struct st_texture_object *stObj =
+ st_texture_object(stImage->base.TexObject);
+ struct pipe_transfer **transfer;
+
+ if (stObj->base.Immutable)
+ slice += stObj->base.MinLayer;
+ transfer = &stImage->transfer[slice + stImage->base.Face].transfer;
DBG("%s\n", __FUNCTION__);
diff --git a/mesalib/src/mesa/swrast/s_texfetch.c b/mesalib/src/mesa/swrast/s_texfetch.c
index 38d71caa3..0f6da919d 100644
--- a/mesalib/src/mesa/swrast/s_texfetch.c
+++ b/mesalib/src/mesa/swrast/s_texfetch.c
@@ -210,6 +210,7 @@ texfetch_funcs[] =
FETCH_FUNCS(R8G8_SNORM),
FETCH_NULL(G8R8_SNORM),
FETCH_FUNCS(L8A8_SNORM),
+ FETCH_FUNCS(A8L8_SNORM),
/* Array signed/normalized formats */
FETCH_FUNCS(A_SNORM8),
@@ -228,10 +229,14 @@ texfetch_funcs[] =
/* Packed sRGB formats */
FETCH_FUNCS(A8B8G8R8_SRGB),
FETCH_FUNCS(B8G8R8A8_SRGB),
+ FETCH_FUNCS(A8R8G8B8_SRGB),
FETCH_NULL(B8G8R8X8_SRGB),
+ FETCH_NULL(X8R8G8B8_SRGB),
FETCH_FUNCS(R8G8B8A8_SRGB),
FETCH_FUNCS(R8G8B8X8_SRGB),
+ FETCH_FUNCS(X8B8G8R8_SRGB),
FETCH_FUNCS(L8A8_SRGB),
+ FETCH_FUNCS(A8L8_SRGB),
/* Array sRGB formats */
FETCH_FUNCS(L_SRGB8),
diff --git a/mesalib/src/mesa/swrast/s_texfetch_tmp.h b/mesalib/src/mesa/swrast/s_texfetch_tmp.h
index 72037ec00..7ff30f6b4 100644
--- a/mesalib/src/mesa/swrast/s_texfetch_tmp.h
+++ b/mesalib/src/mesa/swrast/s_texfetch_tmp.h
@@ -769,6 +769,18 @@ FETCH(B8G8R8A8_SRGB)(const struct swrast_texture_image *texImage,
static void
+FETCH(A8R8G8B8_SRGB)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ texel[RCOMP] = util_format_srgb_8unorm_to_linear_float( (s >> 8) & 0xff );
+ texel[GCOMP] = util_format_srgb_8unorm_to_linear_float( (s >> 16) & 0xff );
+ texel[BCOMP] = util_format_srgb_8unorm_to_linear_float( (s >> 24) );
+ texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xff ); /* linear! */
+}
+
+
+static void
FETCH(R8G8B8A8_SRGB)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
@@ -793,6 +805,18 @@ FETCH(R8G8B8X8_SRGB)(const struct swrast_texture_image *texImage,
static void
+FETCH(X8B8G8R8_SRGB)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ texel[RCOMP] = util_format_srgb_8unorm_to_linear_float( (s >> 24) );
+ texel[GCOMP] = util_format_srgb_8unorm_to_linear_float( (s >> 16) & 0xff );
+ texel[BCOMP] = util_format_srgb_8unorm_to_linear_float( (s >> 8) & 0xff );
+ texel[ACOMP] = 1.0f;
+}
+
+
+static void
FETCH(L_SRGB8)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
@@ -808,11 +832,23 @@ static void
FETCH(L8A8_SRGB)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
- const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 2);
+ const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
texel[RCOMP] =
texel[GCOMP] =
- texel[BCOMP] = util_format_srgb_8unorm_to_linear_float(src[0]);
- texel[ACOMP] = UBYTE_TO_FLOAT(src[1]); /* linear */
+ texel[BCOMP] = util_format_srgb_8unorm_to_linear_float(s & 0xff);
+ texel[ACOMP] = UBYTE_TO_FLOAT(s >> 8); /* linear */
+}
+
+
+static void
+FETCH(A8L8_SRGB)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 2);
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = util_format_srgb_8unorm_to_linear_float(s >> 8);
+ texel[ACOMP] = UBYTE_TO_FLOAT(s & 0xff); /* linear */
}
@@ -961,6 +997,18 @@ FETCH(L8A8_SNORM)(const struct swrast_texture_image *texImage,
static void
+FETCH(A8L8_SNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ const GLushort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 8) );
+ texel[ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s & 0xff) );
+}
+
+
+static void
FETCH(X8B8G8R8_SNORM)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c
index 22557e168..111321bd7 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_array.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_array.c
@@ -1032,7 +1032,12 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
{
static GLuint warnCount = 0;
GLboolean index_bounds_valid = GL_TRUE;
- GLuint max_element;
+
+ /* This is only useful to catch invalid values in the "end" parameter
+ * like ~0.
+ */
+ GLuint max_element = 2 * 1000 * 1000 * 1000; /* just a big number */
+
GET_CURRENT_CONTEXT(ctx);
if (MESA_VERBOSE & VERBOSE_DRAW)
@@ -1045,25 +1050,6 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
type, indices, basevertex ))
return;
- if (ctx->Const.CheckArrayBounds) {
- /* _MaxElement was computed, so we can use it.
- * This path is used for drivers which need strict bounds checking.
- */
- max_element = ctx->Array.VAO->_MaxElement;
- }
- else {
- /* Generally, hardware drivers don't need to know the buffer bounds
- * if all vertex attributes are in VBOs.
- * However, if none of vertex attributes are in VBOs, _MaxElement
- * is always set to some random big number anyway, so bounds checking
- * is mostly useless.
- *
- * This is only useful to catch invalid values in the "end" parameter
- * like ~0.
- */
- max_element = 2 * 1000 * 1000 * 1000; /* just a big number */
- }
-
if ((int) end + basevertex < 0 ||
start + basevertex >= max_element) {
/* The application requested we draw using a range of indices that's
diff --git a/mesalib/src/mesa/vbo/vbo_exec_draw.c b/mesalib/src/mesa/vbo/vbo_exec_draw.c
index c454c6943..362cc1040 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_draw.c
@@ -159,7 +159,6 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_exec_context *exec = &vbo->exec;
struct gl_client_array *arrays = exec->vtx.arrays;
- const GLuint count = exec->vtx.vert_count;
const GLuint *map;
GLuint attr;
GLbitfield64 varying_inputs = 0x0;
@@ -241,7 +240,6 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
_mesa_reference_buffer_object(ctx,
&arrays[attr].BufferObj,
exec->vtx.bufferobj);
- arrays[attr]._MaxElement = count; /* ??? */
varying_inputs |= VERT_BIT(attr);
}
diff --git a/mesalib/src/mesa/vbo/vbo_save_draw.c b/mesalib/src/mesa/vbo/vbo_save_draw.c
index 89fd30e0f..d0521d794 100644
--- a/mesalib/src/mesa/vbo/vbo_save_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_save_draw.c
@@ -203,7 +203,6 @@ static void vbo_bind_vertex_list(struct gl_context *ctx,
_mesa_reference_buffer_object(ctx,
&arrays[attr].BufferObj,
node->vertex_store->bufferobj);
- arrays[attr]._MaxElement = node->count; /* ??? */
assert(arrays[attr].BufferObj->Name);
diff --git a/mesalib/src/mesa/vbo/vbo_split_copy.c b/mesalib/src/mesa/vbo/vbo_split_copy.c
index 719ad651a..ca752e810 100644
--- a/mesalib/src/mesa/vbo/vbo_split_copy.c
+++ b/mesalib/src/mesa/vbo/vbo_split_copy.c
@@ -533,7 +533,6 @@ replay_init( struct copy_context *copy )
dst->Integer = src->Integer;
dst->BufferObj = ctx->Shared->NullBufferObj;
dst->_ElementSize = src->_ElementSize;
- dst->_MaxElement = copy->dstbuf_size; /* may be less! */
offset += copy->varying[i].size;
}
diff --git a/mesalib/src/util/Makefile.sources b/mesalib/src/util/Makefile.sources
index b99aa25e8..c34475a84 100644
--- a/mesalib/src/util/Makefile.sources
+++ b/mesalib/src/util/Makefile.sources
@@ -1,6 +1,7 @@
MESA_UTIL_FILES := \
hash_table.c \
- ralloc.c
+ ralloc.c \
+ rgtc.c
MESA_UTIL_GENERATED_FILES = \
format_srgb.c
diff --git a/mesalib/src/util/rgtc.c b/mesalib/src/util/rgtc.c
new file mode 100644
index 000000000..6886ac071
--- /dev/null
+++ b/mesalib/src/util/rgtc.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2011 Red Hat Inc.
+ *
+ * block compression parts are:
+ * Copyright (C) 2004 Roland Scheidegger 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, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Author:
+ * Dave Airlie
+ */
+
+#include <inttypes.h>
+#include "macros.h"
+
+#include "rgtc.h"
+
+#define RGTC_DEBUG 0
+
+#define TAG(x) util_format_unsigned_##x
+
+#define TYPE unsigned char
+#define T_MIN 0
+#define T_MAX 0xff
+
+#include "texcompress_rgtc_tmp.h"
+
+#undef TAG
+#undef TYPE
+#undef T_MIN
+#undef T_MAX
+
+#define TAG(x) util_format_signed_##x
+#define TYPE signed char
+#define T_MIN (signed char)-128
+#define T_MAX (signed char)127
+
+#include "texcompress_rgtc_tmp.h"
+
+#undef TAG
+#undef TYPE
+#undef T_MIN
+#undef T_MAX
+
diff --git a/mesalib/src/util/rgtc.h b/mesalib/src/util/rgtc.h
new file mode 100644
index 000000000..6bba9f2ec
--- /dev/null
+++ b/mesalib/src/util/rgtc.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright © 2014 Red Hat
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#ifndef _RGTC_H
+#define _RGTC_H
+
+void util_format_unsigned_fetch_texel_rgtc(unsigned srcRowStride, const unsigned char *pixdata,
+ unsigned i, unsigned j, unsigned char *value, unsigned comps);
+
+void util_format_signed_fetch_texel_rgtc(unsigned srcRowStride, const signed char *pixdata,
+ unsigned i, unsigned j, signed char *value, unsigned comps);
+
+void util_format_unsigned_encode_rgtc_ubyte(unsigned char *blkaddr, unsigned char srccolors[4][4],
+ int numxpixels, int numypixels);
+
+void util_format_signed_encode_rgtc_ubyte(signed char *blkaddr, signed char srccolors[4][4],
+ int numxpixels, int numypixels);
+#endif /* _RGTC_H */
diff --git a/mesalib/src/mesa/main/texcompress_rgtc_tmp.h b/mesalib/src/util/texcompress_rgtc_tmp.h
index 5fa9de630..6bbae5ead 100644
--- a/mesalib/src/mesa/main/texcompress_rgtc_tmp.h
+++ b/mesalib/src/util/texcompress_rgtc_tmp.h
@@ -29,8 +29,8 @@
/* included by texcompress_rgtc to define byte/ubyte compressors */
-static void TAG(fetch_texel_rgtc)(unsigned srcRowStride, const TYPE *pixdata,
- unsigned i, unsigned j, TYPE *value, unsigned comps)
+void TAG(fetch_texel_rgtc)(unsigned srcRowStride, const TYPE *pixdata,
+ unsigned i, unsigned j, TYPE *value, unsigned comps)
{
TYPE decode;
const TYPE *blksrc = (pixdata + ((srcRowStride + 3) / 4 * (j / 4) + (i / 4)) * 8 * comps);
@@ -59,9 +59,9 @@ static void TAG(fetch_texel_rgtc)(unsigned srcRowStride, const TYPE *pixdata,
}
static void TAG(write_rgtc_encoded_channel)(TYPE *blkaddr,
- TYPE alphabase1,
- TYPE alphabase2,
- TYPE alphaenc[16])
+ TYPE alphabase1,
+ TYPE alphabase2,
+ TYPE alphaenc[16])
{
*blkaddr++ = alphabase1;
*blkaddr++ = alphabase2;
@@ -73,8 +73,8 @@ static void TAG(write_rgtc_encoded_channel)(TYPE *blkaddr,
*blkaddr++ = (alphaenc[13] >> 1) | (alphaenc[14] << 2) | (alphaenc[15] << 5);
}
-static void TAG(encode_rgtc_ubyte)(TYPE *blkaddr, TYPE srccolors[4][4],
- int numxpixels, int numypixels)
+void TAG(encode_rgtc_ubyte)(TYPE *blkaddr, TYPE srccolors[4][4],
+ int numxpixels, int numypixels)
{
TYPE alphabase[2], alphause[2];
short alphatest[2] = { 0 };
diff --git a/tools/plink/cmdline.c b/tools/plink/cmdline.c
index 0c7ef4c91..327a585a4 100644
--- a/tools/plink/cmdline.c
+++ b/tools/plink/cmdline.c
@@ -236,6 +236,21 @@ int cmdline_process_param(char *p, char *value, int need_save, Conf *conf)
SAVEABLE(0);
conf_set_str(conf, CONF_loghost, value);
}
+ if (!strcmp(p, "-hostkey")) {
+ char *dup;
+ RETURN(2);
+ UNAVAILABLE_IN(TOOLTYPE_NONNETWORK);
+ SAVEABLE(0);
+ dup = dupstr(value);
+ if (!validate_manual_hostkey(dup)) {
+ cmdline_error("'%s' is not a valid format for a manual host "
+ "key specification", value);
+ sfree(dup);
+ return ret;
+ }
+ conf_set_str_str(conf, CONF_ssh_manual_hostkeys, dup, "");
+ sfree(dup);
+ }
if ((!strcmp(p, "-L") || !strcmp(p, "-R") || !strcmp(p, "-D"))) {
char type, *q, *qq, *key, *val;
RETURN(2);
diff --git a/tools/plink/misc.c b/tools/plink/misc.c
index d7c32c49d..24e42ebac 100644
--- a/tools/plink/misc.c
+++ b/tools/plink/misc.c
@@ -473,8 +473,7 @@ char *fgetline(FILE *fp)
}
/* ----------------------------------------------------------------------
- * Base64 encoding routine. This is required in public-key writing
- * but also in HTTP proxy handling, so it's centralised here.
+ * Core base64 encoding and decoding routines.
*/
void base64_encode_atom(unsigned char *data, int n, char *out)
@@ -501,6 +500,54 @@ void base64_encode_atom(unsigned char *data, int n, char *out)
out[3] = '=';
}
+int base64_decode_atom(char *atom, unsigned char *out)
+{
+ int vals[4];
+ int i, v, len;
+ unsigned word;
+ char c;
+
+ for (i = 0; i < 4; i++) {
+ c = atom[i];
+ if (c >= 'A' && c <= 'Z')
+ v = c - 'A';
+ else if (c >= 'a' && c <= 'z')
+ v = c - 'a' + 26;
+ else if (c >= '0' && c <= '9')
+ v = c - '0' + 52;
+ else if (c == '+')
+ v = 62;
+ else if (c == '/')
+ v = 63;
+ else if (c == '=')
+ v = -1;
+ else
+ return 0; /* invalid atom */
+ vals[i] = v;
+ }
+
+ if (vals[0] == -1 || vals[1] == -1)
+ return 0;
+ if (vals[2] == -1 && vals[3] != -1)
+ return 0;
+
+ if (vals[3] != -1)
+ len = 3;
+ else if (vals[2] != -1)
+ len = 2;
+ else
+ len = 1;
+
+ word = ((vals[0] << 18) |
+ (vals[1] << 12) | ((vals[2] & 0x3F) << 6) | (vals[3] & 0x3F));
+ out[0] = (word >> 16) & 0xFF;
+ if (len > 1)
+ out[1] = (word >> 8) & 0xFF;
+ if (len > 2)
+ out[2] = word & 0xFF;
+ return len;
+}
+
/* ----------------------------------------------------------------------
* Generic routines to deal with send buffers: a linked list of
* smallish blocks, with the operations
@@ -875,3 +922,100 @@ void smemclr(void *b, size_t n) {
}
}
#endif
+
+/*
+ * Validate a manual host key specification (either entered in the
+ * GUI, or via -hostkey). If valid, we return TRUE, and update 'key'
+ * to contain a canonicalised version of the key string in 'key'
+ * (which is guaranteed to take up at most as much space as the
+ * original version), suitable for putting into the Conf. If not
+ * valid, we return FALSE.
+ */
+int validate_manual_hostkey(char *key)
+{
+ char *p, *q, *r, *s;
+
+ /*
+ * Step through the string word by word, looking for a word that's
+ * in one of the formats we like.
+ */
+ p = key;
+ while ((p += strspn(p, " \t"))[0]) {
+ q = p;
+ p += strcspn(p, " \t");
+ if (p) *p++ = '\0';
+
+ /*
+ * Now q is our word.
+ */
+
+ if (strlen(q) == 16*3 - 1 &&
+ q[strspn(q, "0123456789abcdefABCDEF:")] == 0) {
+ /*
+ * Might be a key fingerprint. Check the colons are in the
+ * right places, and if so, return the same fingerprint
+ * canonicalised into lowercase.
+ */
+ int i;
+ for (i = 0; i < 16; i++)
+ if (q[3*i] == ':' || q[3*i+1] == ':')
+ goto not_fingerprint; /* sorry */
+ for (i = 0; i < 15; i++)
+ if (q[3*i+2] != ':')
+ goto not_fingerprint; /* sorry */
+ for (i = 0; i < 16*3 - 1; i++)
+ key[i] = tolower(q[i]);
+ key[16*3 - 1] = '\0';
+ return TRUE;
+ }
+ not_fingerprint:;
+
+ /*
+ * Before we check for a public-key blob, trim newlines out of
+ * the middle of the word, in case someone's managed to paste
+ * in a public-key blob _with_ them.
+ */
+ for (r = s = q; *r; r++)
+ if (*r != '\n' && *r != '\r')
+ *s++ = *r;
+ *s = '\0';
+
+ if (strlen(q) % 4 == 0 && strlen(q) > 2*4 &&
+ q[strspn(q, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz+/=")] == 0) {
+ /*
+ * Might be a base64-encoded SSH-2 public key blob. Check
+ * that it starts with a sensible algorithm string. No
+ * canonicalisation is necessary for this string type.
+ *
+ * The algorithm string must be at most 64 characters long
+ * (RFC 4251 section 6).
+ */
+ unsigned char decoded[6];
+ unsigned alglen;
+ int minlen;
+ int len = 0;
+
+ len += base64_decode_atom(q, decoded+len);
+ if (len < 3)
+ goto not_ssh2_blob; /* sorry */
+ len += base64_decode_atom(q+4, decoded+len);
+ if (len < 4)
+ goto not_ssh2_blob; /* sorry */
+
+ alglen = GET_32BIT_MSB_FIRST(decoded);
+ if (alglen > 64)
+ goto not_ssh2_blob; /* sorry */
+
+ minlen = ((alglen + 4) + 2) / 3;
+ if (strlen(q) < minlen)
+ goto not_ssh2_blob; /* sorry */
+
+ strcpy(key, q);
+ return TRUE;
+ }
+ not_ssh2_blob:;
+ }
+
+ return FALSE;
+}
diff --git a/tools/plink/misc.h b/tools/plink/misc.h
index d6a80bf0e..a361d706b 100644
--- a/tools/plink/misc.h
+++ b/tools/plink/misc.h
@@ -44,6 +44,7 @@ int toint(unsigned);
char *fgetline(FILE *fp);
void base64_encode_atom(unsigned char *data, int n, char *out);
+int base64_decode_atom(char *atom, unsigned char *out);
struct bufchain_granule;
typedef struct bufchain_tag {
@@ -59,6 +60,8 @@ void bufchain_prefix(bufchain *ch, void **data, int *len);
void bufchain_consume(bufchain *ch, int len);
void bufchain_fetch(bufchain *ch, void *data, int len);
+int validate_manual_hostkey(char *key);
+
struct tm ltime(void);
void smemclr(void *b, size_t len);
diff --git a/tools/plink/putty.h b/tools/plink/putty.h
index a6578ae0c..ff0f3156a 100644
--- a/tools/plink/putty.h
+++ b/tools/plink/putty.h
@@ -848,6 +848,12 @@ void cleanup_exit(int);
X(INT, NONE, ssh_connection_sharing) \
X(INT, NONE, ssh_connection_sharing_upstream) \
X(INT, NONE, ssh_connection_sharing_downstream) \
+ /*
+ * ssh_manual_hostkeys is conceptually a set rather than a
+ * dictionary: the string subkeys are the important thing, and the
+ * actual values to which those subkeys map are all "".
+ */ \
+ X(STR, STR, ssh_manual_hostkeys) \
/* Options for pterm. Should split out into platform-dependent part. */ \
X(INT, NONE, stamp_utmp) \
X(INT, NONE, login_shell) \
diff --git a/tools/plink/settings.c b/tools/plink/settings.c
index e949df95f..898c0dabc 100644
--- a/tools/plink/settings.c
+++ b/tools/plink/settings.c
@@ -138,7 +138,8 @@ static void gppi(void *handle, char *name, int def, Conf *conf, int primary)
* Read a set of name-value pairs in the format we occasionally use:
* NAME\tVALUE\0NAME\tVALUE\0\0 in memory
* NAME=VALUE,NAME=VALUE, in storage
- * `def' is in the storage format.
+ * If there's no "=VALUE" (e.g. just NAME,NAME,NAME) then those keys
+ * are mapped to the empty string.
*/
static int gppmap(void *handle, char *name, Conf *conf, int primary)
{
@@ -204,9 +205,11 @@ static int gppmap(void *handle, char *name, Conf *conf, int primary)
}
/*
- * Write a set of name/value pairs in the above format.
+ * Write a set of name/value pairs in the above format, or just the
+ * names if include_values is FALSE.
*/
-static void wmap(void *handle, char const *outkey, Conf *conf, int primary)
+static void wmap(void *handle, char const *outkey, Conf *conf, int primary,
+ int include_values)
{
char *buf, *p, *q, *key, *realkey, *val;
int len;
@@ -251,12 +254,14 @@ static void wmap(void *handle, char const *outkey, Conf *conf, int primary)
*p++ = '\\';
*p++ = *q;
}
- *p++ = '=';
- for (q = val; *q; q++) {
- if (*q == '=' || *q == ',' || *q == '\\')
- *p++ = '\\';
- *p++ = *q;
- }
+ if (include_values) {
+ *p++ = '=';
+ for (q = val; *q; q++) {
+ if (*q == '=' || *q == ',' || *q == '\\')
+ *p++ = '\\';
+ *p++ = *q;
+ }
+ }
if (realkey) {
free(key);
@@ -456,7 +461,7 @@ void save_open_settings(void *sesskey, Conf *conf)
write_setting_i(sesskey, "TCPKeepalives", conf_get_int(conf, CONF_tcp_keepalives));
write_setting_s(sesskey, "TerminalType", conf_get_str(conf, CONF_termtype));
write_setting_s(sesskey, "TerminalSpeed", conf_get_str(conf, CONF_termspeed));
- wmap(sesskey, "TerminalModes", conf, CONF_ttymodes);
+ wmap(sesskey, "TerminalModes", conf, CONF_ttymodes, TRUE);
/* Address family selection */
write_setting_i(sesskey, "AddressFamily", conf_get_int(conf, CONF_addressfamily));
@@ -471,7 +476,7 @@ void save_open_settings(void *sesskey, Conf *conf)
write_setting_s(sesskey, "ProxyUsername", conf_get_str(conf, CONF_proxy_username));
write_setting_s(sesskey, "ProxyPassword", conf_get_str(conf, CONF_proxy_password));
write_setting_s(sesskey, "ProxyTelnetCommand", conf_get_str(conf, CONF_proxy_telnet_command));
- wmap(sesskey, "Environment", conf, CONF_environmt);
+ wmap(sesskey, "Environment", conf, CONF_environmt, TRUE);
write_setting_s(sesskey, "UserName", conf_get_str(conf, CONF_username));
write_setting_i(sesskey, "UserNameFromEnvironment", conf_get_int(conf, CONF_username_from_env));
write_setting_s(sesskey, "LocalUserName", conf_get_str(conf, CONF_localusername));
@@ -614,7 +619,7 @@ void save_open_settings(void *sesskey, Conf *conf)
write_setting_filename(sesskey, "X11AuthFile", conf_get_filename(conf, CONF_xauthfile));
write_setting_i(sesskey, "LocalPortAcceptAll", conf_get_int(conf, CONF_lport_acceptall));
write_setting_i(sesskey, "RemotePortAcceptAll", conf_get_int(conf, CONF_rport_acceptall));
- wmap(sesskey, "PortForwardings", conf, CONF_portfwd);
+ wmap(sesskey, "PortForwardings", conf, CONF_portfwd, TRUE);
write_setting_i(sesskey, "BugIgnore1", 2-conf_get_int(conf, CONF_sshbug_ignore1));
write_setting_i(sesskey, "BugPlainPW1", 2-conf_get_int(conf, CONF_sshbug_plainpw1));
write_setting_i(sesskey, "BugRSA1", 2-conf_get_int(conf, CONF_sshbug_rsa1));
@@ -645,6 +650,7 @@ void save_open_settings(void *sesskey, Conf *conf)
write_setting_i(sesskey, "ConnectionSharing", conf_get_int(conf, CONF_ssh_connection_sharing));
write_setting_i(sesskey, "ConnectionSharingUpstream", conf_get_int(conf, CONF_ssh_connection_sharing_upstream));
write_setting_i(sesskey, "ConnectionSharingDownstream", conf_get_int(conf, CONF_ssh_connection_sharing_downstream));
+ wmap(sesskey, "SSHManualHostKeys", conf, CONF_ssh_manual_hostkeys, FALSE);
}
void load_settings(char *section, Conf *conf)
@@ -991,6 +997,7 @@ void load_open_settings(void *sesskey, Conf *conf)
gppi(sesskey, "ConnectionSharing", 0, conf, CONF_ssh_connection_sharing);
gppi(sesskey, "ConnectionSharingUpstream", 1, conf, CONF_ssh_connection_sharing_upstream);
gppi(sesskey, "ConnectionSharingDownstream", 1, conf, CONF_ssh_connection_sharing_downstream);
+ gppmap(sesskey, "SSHManualHostKeys", conf, CONF_ssh_manual_hostkeys);
}
void do_defaults(char *session, Conf *conf)
diff --git a/tools/plink/ssh.c b/tools/plink/ssh.c
index 893321e2b..d395d7b5c 100644
--- a/tools/plink/ssh.c
+++ b/tools/plink/ssh.c
@@ -3677,6 +3677,59 @@ static void ssh_disconnect(Ssh ssh, char *client_reason, char *wire_reason,
sfree(error);
}
+int verify_ssh_manual_host_key(Ssh ssh, const char *fingerprint,
+ const struct ssh_signkey *ssh2keytype,
+ void *ssh2keydata)
+{
+ if (!conf_get_str_nthstrkey(ssh->conf, CONF_ssh_manual_hostkeys, 0)) {
+ return -1; /* no manual keys configured */
+ }
+
+ if (fingerprint) {
+ /*
+ * The fingerprint string we've been given will have things
+ * like 'ssh-rsa 2048' at the front of it. Strip those off and
+ * narrow down to just the colon-separated hex block at the
+ * end of the string.
+ */
+ const char *p = strrchr(fingerprint, ' ');
+ fingerprint = p ? p+1 : fingerprint;
+ /* Quick sanity checks, including making sure it's in lowercase */
+ assert(strlen(fingerprint) == 16*3 - 1);
+ assert(fingerprint[2] == ':');
+ assert(fingerprint[strspn(fingerprint, "0123456789abcdef:")] == 0);
+
+ if (conf_get_str_str_opt(ssh->conf, CONF_ssh_manual_hostkeys,
+ fingerprint))
+ return 1; /* success */
+ }
+
+ if (ssh2keydata) {
+ /*
+ * Construct the base64-encoded public key blob and see if
+ * that's listed.
+ */
+ unsigned char *binblob;
+ char *base64blob;
+ int binlen, atoms, i;
+ binblob = ssh2keytype->public_blob(ssh2keydata, &binlen);
+ atoms = (binlen + 2) / 3;
+ base64blob = snewn(atoms * 4 + 1, char);
+ for (i = 0; i < atoms; i++)
+ base64_encode_atom(binblob + 3*i, binlen - 3*i, base64blob + 4*i);
+ base64blob[atoms * 4] = '\0';
+ sfree(binblob);
+ if (conf_get_str_str_opt(ssh->conf, CONF_ssh_manual_hostkeys,
+ base64blob)) {
+ sfree(base64blob);
+ return 1; /* success */
+ }
+ sfree(base64blob);
+ }
+
+ return 0;
+}
+
/*
* Handle the key exchange and user authentication phases.
*/
@@ -3800,29 +3853,36 @@ static int do_ssh1_login(Ssh ssh, unsigned char *in, int inlen,
rsastr_fmt(keystr, &s->hostkey);
rsa_fingerprint(fingerprint, sizeof(fingerprint), &s->hostkey);
- ssh_set_frozen(ssh, 1);
- s->dlgret = verify_ssh_host_key(ssh->frontend,
- ssh->savedhost, ssh->savedport,
- "rsa", keystr, fingerprint,
- ssh_dialog_callback, ssh);
- sfree(keystr);
- if (s->dlgret < 0) {
- do {
- crReturn(0);
- if (pktin) {
- bombout(("Unexpected data from server while waiting"
- " for user host key response"));
- crStop(0);
- }
- } while (pktin || inlen > 0);
- s->dlgret = ssh->user_response;
- }
- ssh_set_frozen(ssh, 0);
+ /* First check against manually configured host keys. */
+ s->dlgret = verify_ssh_manual_host_key(ssh, fingerprint, NULL, NULL);
+ if (s->dlgret == 0) { /* did not match */
+ bombout(("Host key did not appear in manually configured list"));
+ crStop(0);
+ } else if (s->dlgret < 0) { /* none configured; use standard handling */
+ ssh_set_frozen(ssh, 1);
+ s->dlgret = verify_ssh_host_key(ssh->frontend,
+ ssh->savedhost, ssh->savedport,
+ "rsa", keystr, fingerprint,
+ ssh_dialog_callback, ssh);
+ sfree(keystr);
+ if (s->dlgret < 0) {
+ do {
+ crReturn(0);
+ if (pktin) {
+ bombout(("Unexpected data from server while waiting"
+ " for user host key response"));
+ crStop(0);
+ }
+ } while (pktin || inlen > 0);
+ s->dlgret = ssh->user_response;
+ }
+ ssh_set_frozen(ssh, 0);
- if (s->dlgret == 0) {
- ssh_disconnect(ssh, "User aborted at host key verification",
- NULL, 0, TRUE);
- crStop(0);
+ if (s->dlgret == 0) {
+ ssh_disconnect(ssh, "User aborted at host key verification",
+ NULL, 0, TRUE);
+ crStop(0);
+ }
}
}
@@ -6721,31 +6781,39 @@ static void do_ssh2_transport(Ssh ssh, void *vin, int inlen,
* checked the signature of the exchange hash.)
*/
s->fingerprint = ssh->hostkey->fingerprint(s->hkey);
- ssh_set_frozen(ssh, 1);
- s->dlgret = verify_ssh_host_key(ssh->frontend,
- ssh->savedhost, ssh->savedport,
- ssh->hostkey->keytype, s->keystr,
- s->fingerprint,
- ssh_dialog_callback, ssh);
- if (s->dlgret < 0) {
- do {
- crReturnV;
- if (pktin) {
- bombout(("Unexpected data from server while waiting"
- " for user host key response"));
- crStopV;
- }
- } while (pktin || inlen > 0);
- s->dlgret = ssh->user_response;
- }
- ssh_set_frozen(ssh, 0);
- if (s->dlgret == 0) {
- ssh_disconnect(ssh, "User aborted at host key verification", NULL,
- 0, TRUE);
- crStopV;
- }
logevent("Host key fingerprint is:");
logevent(s->fingerprint);
+ /* First check against manually configured host keys. */
+ s->dlgret = verify_ssh_manual_host_key(ssh, s->fingerprint,
+ ssh->hostkey, s->hkey);
+ if (s->dlgret == 0) { /* did not match */
+ bombout(("Host key did not appear in manually configured list"));
+ crStopV;
+ } else if (s->dlgret < 0) { /* none configured; use standard handling */
+ ssh_set_frozen(ssh, 1);
+ s->dlgret = verify_ssh_host_key(ssh->frontend,
+ ssh->savedhost, ssh->savedport,
+ ssh->hostkey->keytype, s->keystr,
+ s->fingerprint,
+ ssh_dialog_callback, ssh);
+ if (s->dlgret < 0) {
+ do {
+ crReturnV;
+ if (pktin) {
+ bombout(("Unexpected data from server while waiting"
+ " for user host key response"));
+ crStopV;
+ }
+ } while (pktin || inlen > 0);
+ s->dlgret = ssh->user_response;
+ }
+ ssh_set_frozen(ssh, 0);
+ if (s->dlgret == 0) {
+ ssh_disconnect(ssh, "Aborted at host key verification", NULL,
+ 0, TRUE);
+ crStopV;
+ }
+ }
sfree(s->fingerprint);
/*
* Save this host key, to check against the one presented in
@@ -10557,11 +10625,13 @@ static const char *ssh_init(void *frontend_handle, void **backend_handle,
ssh->gsslibs = NULL;
#endif
+ random_ref(); /* do this now - may be needed by sharing setup code */
+
p = connect_to_host(ssh, host, port, realhost, nodelay, keepalive);
- if (p != NULL)
+ if (p != NULL) {
+ random_unref();
return p;
-
- random_ref();
+ }
return NULL;
}
diff --git a/tools/plink/sshpubk.c b/tools/plink/sshpubk.c
index ac9e0fa7e..cf9e44b36 100644
--- a/tools/plink/sshpubk.c
+++ b/tools/plink/sshpubk.c
@@ -513,54 +513,6 @@ static char *read_body(FILE * fp)
}
}
-int base64_decode_atom(char *atom, unsigned char *out)
-{
- int vals[4];
- int i, v, len;
- unsigned word;
- char c;
-
- for (i = 0; i < 4; i++) {
- c = atom[i];
- if (c >= 'A' && c <= 'Z')
- v = c - 'A';
- else if (c >= 'a' && c <= 'z')
- v = c - 'a' + 26;
- else if (c >= '0' && c <= '9')
- v = c - '0' + 52;
- else if (c == '+')
- v = 62;
- else if (c == '/')
- v = 63;
- else if (c == '=')
- v = -1;
- else
- return 0; /* invalid atom */
- vals[i] = v;
- }
-
- if (vals[0] == -1 || vals[1] == -1)
- return 0;
- if (vals[2] == -1 && vals[3] != -1)
- return 0;
-
- if (vals[3] != -1)
- len = 3;
- else if (vals[2] != -1)
- len = 2;
- else
- len = 1;
-
- word = ((vals[0] << 18) |
- (vals[1] << 12) | ((vals[2] & 0x3F) << 6) | (vals[3] & 0x3F));
- out[0] = (word >> 16) & 0xFF;
- if (len > 1)
- out[1] = (word >> 8) & 0xFF;
- if (len > 2)
- out[2] = word & 0xFF;
- return len;
-}
-
static unsigned char *read_blob(FILE * fp, int nlines, int *bloblen)
{
unsigned char *blob;
diff --git a/tools/plink/sshshare.c b/tools/plink/sshshare.c
index bf2a64c29..5b88eb8ed 100644
--- a/tools/plink/sshshare.c
+++ b/tools/plink/sshshare.c
@@ -517,6 +517,10 @@ void sharestate_free(void *v)
share_connstate_free(cs);
}
freetree234(sharestate->connections);
+ if (sharestate->listensock) {
+ sk_close(sharestate->listensock);
+ sharestate->listensock = NULL;
+ }
sfree(sharestate->server_verstring);
sfree(sharestate->sockname);
sfree(sharestate);
@@ -1843,6 +1847,7 @@ static int share_listen_closing(Plug plug, const char *error_msg,
ssh_sharing_logf(sharestate->ssh, 0,
"listening socket: %s", error_msg);
sk_close(sharestate->listensock);
+ sharestate->listensock = NULL;
return 1;
}
diff --git a/tools/plink/winhelp.h b/tools/plink/winhelp.h
index dabd8b825..fc10a8f4d 100644
--- a/tools/plink/winhelp.h
+++ b/tools/plink/winhelp.h
@@ -102,6 +102,7 @@
#define WINHELP_CTX_ssh_share "ssh.sharing:config-ssh-sharing"
#define WINHELP_CTX_ssh_kexlist "ssh.kex.order:config-ssh-kex-order"
#define WINHELP_CTX_ssh_kex_repeat "ssh.kex.repeat:config-ssh-kex-rekey"
+#define WINHELP_CTX_ssh_kex_manual_hostkeys "ssh.kex.manualhostkeys:config-ssh-kex-manual-hostkeys"
#define WINHELP_CTX_ssh_auth_bypass "ssh.auth.bypass:config-ssh-noauth"
#define WINHELP_CTX_ssh_auth_banner "ssh.auth.banner:config-ssh-banner"
#define WINHELP_CTX_ssh_auth_privkey "ssh.auth.privkey:config-ssh-privkey"
diff --git a/tools/plink/winplink.c b/tools/plink/winplink.c
index 451eff3b8..1c4f3307c 100644
--- a/tools/plink/winplink.c
+++ b/tools/plink/winplink.c
@@ -186,6 +186,8 @@ static void usage(void)
printf(" -P port connect to specified port\n");
printf(" -l user connect with specified username\n");
printf(" -batch disable all interactive prompts\n");
+ printf(" -sercfg configuration-string (e.g. 19200,8,n,1,X)\n");
+ printf(" Specify the serial configuration (serial only)\n");
printf("The following options only apply to SSH connections:\n");
printf(" -pw passw login with specified password\n");
printf(" -D [listen-IP:]listen-port\n");
@@ -200,16 +202,16 @@ static void usage(void)
printf(" -1 -2 force use of particular protocol version\n");
printf(" -4 -6 force use of IPv4 or IPv6\n");
printf(" -C enable compression\n");
- printf(" -i key private key file for authentication\n");
+ printf(" -i key private key file for user authentication\n");
printf(" -noagent disable use of Pageant\n");
printf(" -agent enable use of Pageant\n");
+ printf(" -hostkey aa:bb:cc:...\n");
+ printf(" manually specify a host key (may be repeated)\n");
printf(" -m file read remote command(s) from file\n");
printf(" -s remote command is an SSH subsystem (SSH-2 only)\n");
printf(" -N don't start a shell/command (SSH-2 only)\n");
printf(" -nc host:port\n");
printf(" open tunnel in place of session (SSH-2 only)\n");
- printf(" -sercfg configuration-string (e.g. 19200,8,n,1,X)\n");
- printf(" Specify the serial configuration (serial only)\n");
exit(1);
}
diff --git a/tools/plink/winstore.c b/tools/plink/winstore.c
index ce5dae61d..b1058832e 100644
--- a/tools/plink/winstore.c
+++ b/tools/plink/winstore.c
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
+#include <assert.h>
#include "putty.h"
#include "storage.h"
@@ -152,7 +153,7 @@ void *open_settings_r(const char *sessionname)
char *read_setting_s(void *handle, const char *key)
{
- DWORD type, size;
+ DWORD type, allocsize, size;
char *ret;
if (!handle)
@@ -164,13 +165,17 @@ char *read_setting_s(void *handle, const char *key)
type != REG_SZ)
return NULL;
- ret = snewn(size+1, char);
+ allocsize = size+1; /* allow for an extra NUL if needed */
+ ret = snewn(allocsize, char);
if (RegQueryValueEx((HKEY) handle, key, 0,
&type, ret, &size) != ERROR_SUCCESS ||
type != REG_SZ) {
sfree(ret);
return NULL;
}
+ assert(size < allocsize);
+ ret[size] = '\0'; /* add an extra NUL in case RegQueryValueEx
+ * didn't supply one */
return ret;
}
diff --git a/xorg-server/COPYING b/xorg-server/COPYING
index cc52a3282..abf13c2e3 100644
--- a/xorg-server/COPYING
+++ b/xorg-server/COPYING
@@ -8,6 +8,7 @@ possible, and insert their name to this list. Please sort by surname
for people, and by the full name for other entities (e.g. Juliusz
Chroboczek sorts before Intel Corporation sorts before Daniel Stone).
+Copyright © 2011 Dave Airlie
Copyright © 2000-2001 Juliusz Chroboczek
Copyright © 1998 Egbert Eich
Copyright © 2006-2007 Intel Corporation
@@ -145,6 +146,29 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
+Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+
+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 TUNGSTEN GRAPHICS 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.
+
+
Copyright © 1999-2000 SuSE, Inc.
Copyright © 2007 Red Hat, Inc.
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index cba7d24ea..be8bff629 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -235,29 +235,6 @@ dnl fbdev header
AC_CHECK_HEADERS([linux/fb.h], FBDEV=yes)
AM_CONDITIONAL(FBDEVHW, [test "x$FBDEV" = xyes])
-dnl MTRR header
-AC_CHECK_HEADERS([asm/mtrr.h], ac_cv_asm_mtrr_h=yes)
-if test "x$ac_cv_asm_mtrr_h" = xyes; then
- HAVE_MTRR=yes
-fi
-
-dnl BSD MTRR header
-AC_CHECK_HEADERS([sys/memrange.h], ac_cv_memrange_h=yes)
-if test "x$ac_cv_memrange_h" = xyes; then
- HAVE_MTRR=yes
-fi
-
-if test "x$HAVE_MTRR" = xyes; then
- AC_DEFINE(HAS_MTRR_SUPPORT, 1, [MTRR support available])
-fi
-
-dnl A NetBSD MTRR header
-AC_CHECK_HEADERS([machine/mtrr.h], ac_cv_machine_mtrr_h=yes)
-if test "x$ac_cv_machine_mtrr_h" = xyes; then
- AC_DEFINE(HAS_MTRR_BUILTIN, 1, [Define to 1 if NetBSD built-in MTRR
- support is available])
-fi
-
dnl FreeBSD kldload support (sys/linker.h)
AC_CHECK_HEADERS([sys/linker.h],
[ac_cv_sys_linker_h=yes],
@@ -587,7 +564,6 @@ AC_ARG_WITH(khronos-spec-dir, AS_HELP_STRING([--with-khronos-spec-dir=PATH], [Pa
[KHRONOS_SPEC_DIR=auto])
dnl Extensions.
-AC_ARG_ENABLE(registry, AS_HELP_STRING([--disable-registry], [Build string registry module (default: enabled)]), [XREGISTRY=$enableval], [XREGISTRY=yes])
AC_ARG_ENABLE(composite, AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
AC_ARG_ENABLE(mitshm, AS_HELP_STRING([--disable-mitshm], [Build SHM extension (default: auto)]), [MITSHM=$enableval], [MITSHM=auto])
AC_ARG_ENABLE(xres, AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
@@ -863,6 +839,7 @@ fi
PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
if test "x$CONFIG_UDEV" = xauto; then
CONFIG_UDEV="$HAVE_LIBUDEV"
+ AC_DEFINE(HAVE_LIBUDEV, 1, [Define to 1 if libudev is available.])
fi
AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes])
if test "x$CONFIG_UDEV" = xyes; then
@@ -1038,11 +1015,6 @@ if test "x$XVMC" = xyes; then
AC_DEFINE(XvMCExtension, 1, [Build XvMC extension])
fi
-AM_CONDITIONAL(XREGISTRY, [test "x$XREGISTRY" = xyes])
-if test "x$XREGISTRY" = xyes; then
- AC_DEFINE(XREGISTRY, 1, [Build registry module])
-fi
-
AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
if test "x$COMPOSITE" = xyes; then
AC_DEFINE(COMPOSITE, 1, [Support Composite Extension])
@@ -2039,6 +2011,12 @@ if test "x$XORG" = xyes; then
XORG_SYS_LIBS="$XORG_SYS_LIBS $XORG_MODULES_LIBS"
fi
+ if test "x$DRM" = xyes; then
+ dnl 2.4.46 is required for cursor hotspot support.
+ PKG_CHECK_EXISTS(libdrm >= 2.4.46)
+ XORG_DRIVER_MODESETTING=yes
+ fi
+
AC_SUBST([XORG_LIBS])
AC_SUBST([XORG_SYS_LIBS])
AC_SUBST([XORG_INCS])
@@ -2109,6 +2087,7 @@ AM_CONDITIONAL([SOLARIS_VT], [test "x$solaris_vt" = xyes])
AM_CONDITIONAL([DGA], [test "x$DGA" = xyes])
AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes])
AM_CONDITIONAL([XORG_BUS_PLATFORM], [test "x$CONFIG_UDEV_KMS" = xyes])
+AM_CONDITIONAL([XORG_DRIVER_MODESETTING], [test "x$XORG_DRIVER_MODESETTING" = xyes])
dnl glamor
AM_CONDITIONAL([GLAMOR], [test "x$GLAMOR" = xyes])
@@ -2364,7 +2343,7 @@ if test "$KDRIVE" = yes; then
AC_DEFINE(KDRIVE_MOUSE, 1, [Enable KDrive mouse driver])
fi
- XEPHYR_REQUIRED_LIBS="xau xdmcp xcb xcb-shape xcb-aux xcb-image xcb-icccm xcb-shm xcb-keysyms xcb-randr"
+ XEPHYR_REQUIRED_LIBS="xau xdmcp xcb xcb-shape xcb-render xcb-renderutil xcb-aux xcb-image xcb-icccm xcb-shm xcb-keysyms xcb-randr"
if test "x$XV" = xyes; then
XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xcb-xv"
fi
@@ -2554,6 +2533,8 @@ hw/xfree86/dixmods/Makefile
hw/xfree86/doc/Makefile
hw/xfree86/dri/Makefile
hw/xfree86/dri2/Makefile
+hw/xfree86/drivers/Makefile
+hw/xfree86/drivers/modesetting/Makefile
hw/xfree86/exa/Makefile
hw/xfree86/exa/man/Makefile
hw/xfree86/fbdevhw/Makefile
diff --git a/xorg-server/dix/extension.c b/xorg-server/dix/extension.c
index ede4bf5bd..e43291eec 100644
--- a/xorg-server/dix/extension.c
+++ b/xorg-server/dix/extension.c
@@ -139,7 +139,9 @@ AddExtension(const char *name, int NumEvents, int NumErrors,
ext->errorLast = 0;
}
+#ifdef X_REGISTRY_REQUEST
RegisterExtensionNames(ext);
+#endif
return ext;
}
diff --git a/xorg-server/dix/main.c b/xorg-server/dix/main.c
index 7427e08ca..930a85fb7 100644
--- a/xorg-server/dix/main.c
+++ b/xorg-server/dix/main.c
@@ -269,6 +269,8 @@ dix_main(int argc, char *argv[], char *envp[])
dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
+ dixCloseRegistry();
+
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
if (!PanoramiXCreateConnectionBlock()) {
diff --git a/xorg-server/dix/pixmap.c b/xorg-server/dix/pixmap.c
index 4b880af58..00e298f5c 100644
--- a/xorg-server/dix/pixmap.c
+++ b/xorg-server/dix/pixmap.c
@@ -164,9 +164,9 @@ PixmapPtr PixmapShareToSlave(PixmapPtr pixmap, ScreenPtr slave)
}
Bool
-PixmapStartDirtyTracking(PixmapPtr src,
- PixmapPtr slave_dst,
- int x, int y)
+PixmapStartDirtyTracking2(PixmapPtr src,
+ PixmapPtr slave_dst,
+ int x, int y, int dst_x, int dst_y)
{
ScreenPtr screen = src->drawable.pScreen;
PixmapDirtyUpdatePtr dirty_update;
@@ -179,6 +179,8 @@ PixmapStartDirtyTracking(PixmapPtr src,
dirty_update->slave_dst = slave_dst;
dirty_update->x = x;
dirty_update->y = y;
+ dirty_update->dst_x = dst_x;
+ dirty_update->dst_y = dst_y;
dirty_update->damage = DamageCreate(NULL, NULL,
DamageReportNone,
@@ -195,6 +197,14 @@ PixmapStartDirtyTracking(PixmapPtr src,
}
Bool
+PixmapStartDirtyTracking(PixmapPtr src,
+ PixmapPtr slave_dst,
+ int x, int y)
+{
+ return PixmapStartDirtyTracking2(src, slave_dst, x, y, 0, 0);
+}
+
+Bool
PixmapStopDirtyTracking(PixmapPtr src, PixmapPtr slave_dst)
{
ScreenPtr screen = src->drawable.pScreen;
@@ -261,7 +271,7 @@ Bool PixmapSyncDirtyHelper(PixmapDirtyUpdatePtr dirty, RegionPtr dirty_region)
h = dst_box.y2 - dst_box.y1;
pGC->ops->CopyArea(&dirty->src->drawable, &dst->drawable, pGC,
- dirty->x + dst_box.x1, dirty->y + dst_box.y1, w, h, dst_box.x1, dst_box.y1);
+ dirty->x + dst_box.x1, dirty->y + dst_box.y1, w, h, dirty->dst_x + dst_box.x1, dirty->dst_y + dst_box.y1);
b++;
}
FreeScratchGC(pGC);
diff --git a/xorg-server/dix/registry.c b/xorg-server/dix/registry.c
index 82a3340e1..84d48b4e3 100644
--- a/xorg-server/dix/registry.c
+++ b/xorg-server/dix/registry.c
@@ -21,8 +21,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <dix-config.h>
#endif
-#ifdef XREGISTRY
-
#include <stdlib.h>
#include <string.h>
#include <X11/X.h>
@@ -31,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "registry.h"
#define BASE_SIZE 16
+
+#ifdef X_REGISTRY_REQUEST
#define CORE "X11"
#define FILENAME SERVER_MISC_CONFIG_PATH "/protocol.txt"
@@ -42,9 +42,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
static FILE *fh;
static char ***requests, **events, **errors;
+static unsigned nmajor, *nminor, nevent, nerror;
+#endif
+
+#ifdef X_REGISTRY_RESOURCE
static const char **resources;
-static unsigned nmajor, *nminor, nevent, nerror, nresource;
+static unsigned nresource;
+#endif
+#if defined(X_REGISTRY_RESOURCE) || defined(X_REGISTRY_REQUEST)
/*
* File parsing routines
*/
@@ -72,7 +78,12 @@ double_size(void *p, unsigned n, unsigned size)
memset(*ptr + s, 0, f - s);
return TRUE;
}
+#endif
+#ifdef X_REGISTRY_REQUEST
+/*
+ * Request/event/error registry functions
+ */
static void
RegisterRequestName(unsigned major, unsigned minor, char *name)
{
@@ -197,28 +208,6 @@ RegisterExtensionNames(ExtensionEntry * extEntry)
}
}
-/*
- * Registration functions
- */
-
-void
-RegisterResourceName(RESTYPE resource, const char *name)
-{
- resource &= TypeMask;
-
- while (resource >= nresource) {
- if (!double_size(&resources, nresource, sizeof(char *)))
- return;
- nresource = nresource ? nresource * 2 : BASE_SIZE;
- }
-
- resources[resource] = name;
-}
-
-/*
- * Lookup functions
- */
-
const char *
LookupRequestName(int major, int minor)
{
@@ -269,6 +258,26 @@ LookupErrorName(int error)
return errors[error] ? errors[error] : XREGISTRY_UNKNOWN;
}
+#endif /* X_REGISTRY_REQUEST */
+
+#ifdef X_REGISTRY_RESOURCE
+/*
+ * Resource registry functions
+ */
+
+void
+RegisterResourceName(RESTYPE resource, const char *name)
+{
+ resource &= TypeMask;
+
+ while (resource >= nresource) {
+ if (!double_size(&resources, nresource, sizeof(char *)))
+ return;
+ nresource = nresource ? nresource * 2 : BASE_SIZE;
+ }
+
+ resources[resource] = name;
+}
const char *
LookupResourceName(RESTYPE resource)
@@ -279,10 +288,12 @@ LookupResourceName(RESTYPE resource)
return resources[resource] ? resources[resource] : XREGISTRY_UNKNOWN;
}
+#endif /* X_REGISTRY_RESOURCE */
void
dixFreeRegistry(void)
{
+#ifdef X_REGISTRY_REQUEST
/* Free all memory */
while (nmajor--) {
while (nminor[nmajor])
@@ -299,21 +310,30 @@ dixFreeRegistry(void)
while (nerror--)
free(errors[nerror]);
free(errors);
-
- free(resources);
-
requests = NULL;
nminor = NULL;
events = NULL;
errors = NULL;
- resources = NULL;
+ nmajor = nevent = nerror = 0;
+#endif
+
+#ifdef X_REGISTRY_RESOURCE
+ free(resources);
- nmajor = nevent = nerror = nresource = 0;
+ resources = NULL;
+ nresource = 0;
+#endif
+}
+void
+dixCloseRegistry(void)
+{
+#ifdef X_REGISTRY_REQUEST
if (fh) {
fclose(fh);
fh = NULL;
}
+#endif
}
/*
@@ -322,16 +342,24 @@ dixFreeRegistry(void)
void
dixResetRegistry(void)
{
+#ifdef X_REGISTRY_REQUEST
ExtensionEntry extEntry = { .name = CORE };
+#endif
dixFreeRegistry();
+#ifdef X_REGISTRY_REQUEST
/* Open the protocol file */
fh = fopen(FILENAME, "r");
if (!fh)
LogMessage(X_WARNING,
"Failed to open protocol names file " FILENAME "\n");
+ /* Add the core protocol */
+ RegisterExtensionNames(&extEntry);
+#endif
+
+#ifdef X_REGISTRY_RESOURCE
/* Add built-in resources */
RegisterResourceName(RT_NONE, "NONE");
RegisterResourceName(RT_WINDOW, "WINDOW");
@@ -343,9 +371,5 @@ dixResetRegistry(void)
RegisterResourceName(RT_CMAPENTRY, "COLORMAP ENTRY");
RegisterResourceName(RT_OTHERCLIENT, "OTHER CLIENT");
RegisterResourceName(RT_PASSIVEGRAB, "PASSIVE GRAB");
-
- /* Add the core protocol */
- RegisterExtensionNames(&extEntry);
+#endif
}
-
-#endif /* XREGISTRY */
diff --git a/xorg-server/dix/resource.c b/xorg-server/dix/resource.c
index 623d862d6..c254244a3 100644
--- a/xorg-server/dix/resource.c
+++ b/xorg-server/dix/resource.c
@@ -524,8 +524,10 @@ CreateNewResourceType(DeleteType deleteFunc, const char *name)
resourceTypes[next].findSubResFunc = DefaultFindSubRes;
resourceTypes[next].errorValue = BadValue;
+#if X_REGISTRY_RESOURCE
/* Called even if name is NULL, to remove any previous entry */
RegisterResourceName(next, name);
+#endif
return next;
}
diff --git a/xorg-server/glamor/glamor.c b/xorg-server/glamor/glamor.c
index 521bc25c8..fc24b1bdd 100644
--- a/xorg-server/glamor/glamor.c
+++ b/xorg-server/glamor/glamor.c
@@ -296,6 +296,11 @@ glamor_create_screen_resources(ScreenPtr screen)
ret = screen->CreateScreenResources(screen);
screen->CreateScreenResources = glamor_create_screen_resources;
+ if (!glamor_glyphs_init(screen)) {
+ ErrorF("Failed to initialize glyphs\n");
+ ret = FALSE;
+ }
+
if (!glamor_realize_glyph_caches(screen)) {
ErrorF("Failed to initialize glyph cache\n");
ret = FALSE;
@@ -510,15 +515,11 @@ glamor_init(ScreenPtr screen, unsigned int flags)
glamor_init_vbo(screen);
glamor_init_pixmap_fbo(screen);
-#ifdef GLAMOR_TRAPEZOID_SHADER
- glamor_init_trapezoid_shader(screen);
-#endif
glamor_init_finish_access_shaders(screen);
#ifdef GLAMOR_GRADIENT_SHADER
glamor_init_gradient_shader(screen);
#endif
glamor_pixmap_init(screen);
- glamor_glyphs_init(screen);
glamor_sync_init(screen);
glamor_priv->screen = screen;
@@ -542,9 +543,6 @@ glamor_release_screen_priv(ScreenPtr screen)
#endif
glamor_fini_vbo(screen);
glamor_fini_pixmap_fbo(screen);
-#ifdef GLAMOR_TRAPEZOID_SHADER
- glamor_fini_trapezoid_shader(screen);
-#endif
glamor_fini_finish_access_shaders(screen);
#ifdef GLAMOR_GRADIENT_SHADER
glamor_fini_gradient_shader(screen);
diff --git a/xorg-server/glamor/glamor_glyphs.c b/xorg-server/glamor/glamor_glyphs.c
index f570d7519..1f1362487 100644
--- a/xorg-server/glamor/glamor_glyphs.c
+++ b/xorg-server/glamor/glamor_glyphs.c
@@ -62,14 +62,6 @@
*/
#define GLYPH_BUFFER_SIZE 1024
-#define CACHE_PICTURE_SIZE 1024
-#define GLYPH_MIN_SIZE 8
-#define GLYPH_MAX_SIZE 64
-#define GLYPH_CACHE_SIZE ((CACHE_PICTURE_SIZE) * CACHE_PICTURE_SIZE / (GLYPH_MIN_SIZE * GLYPH_MIN_SIZE))
-#define MASK_CACHE_MAX_SIZE 32
-#define MASK_CACHE_WIDTH (CACHE_PICTURE_SIZE / MASK_CACHE_MAX_SIZE)
-#define MASK_CACHE_MASK ((1LL << (MASK_CACHE_WIDTH)) - 1)
-
typedef struct {
PicturePtr source;
glamor_composite_rect_t rects[GLYPH_BUFFER_SIZE + 4];
@@ -96,9 +88,11 @@ typedef enum {
static DevPrivateKeyRec glamor_glyph_key;
static inline struct glamor_glyph *
-glamor_glyph_get_private(GlyphPtr glyph)
+glamor_glyph_get_private(ScreenPtr screen, GlyphPtr glyph)
{
- return (struct glamor_glyph *) glyph->devPrivates;
+ struct glamor_glyph *privates = (struct glamor_glyph*)glyph->devPrivates;
+
+ return &privates[screen->myNum];
}
/*
@@ -121,24 +115,8 @@ glamor_glyph_get_private(GlyphPtr glyph)
* gain.
*/
-struct glamor_glyph_mask_cache_entry {
- int idx;
- int width;
- int height;
- int x;
- int y;
-};
-
-static struct glamor_glyph_mask_cache {
- PixmapPtr pixmap;
- struct glamor_glyph_mask_cache_entry mcache[MASK_CACHE_WIDTH];
- unsigned int free_bitmap;
- unsigned int cleared_bitmap;
-} *mask_cache[GLAMOR_NUM_GLYPH_CACHE_FORMATS] = {
-NULL};
-
static void
-clear_mask_cache_bitmap(struct glamor_glyph_mask_cache *maskcache,
+clear_mask_cache_bitmap(glamor_glyph_mask_cache_t *maskcache,
unsigned int clear_mask_bits)
{
unsigned int i = 0;
@@ -160,7 +138,7 @@ clear_mask_cache_bitmap(struct glamor_glyph_mask_cache *maskcache,
}
static void
-clear_mask_cache(struct glamor_glyph_mask_cache *maskcache)
+clear_mask_cache(glamor_glyph_mask_cache_t *maskcache)
{
int x = 0;
int cnt = MASK_CACHE_WIDTH;
@@ -222,7 +200,7 @@ find_continuous_bits(unsigned int bits, int bits_cnt, unsigned int *pbits_mask)
}
static struct glamor_glyph_mask_cache_entry *
-get_mask_cache(struct glamor_glyph_mask_cache *maskcache, int blocks)
+get_mask_cache(glamor_glyph_mask_cache_t *maskcache, int blocks)
{
int free_cleared_bit, idx = -1;
int retry_cnt = 0;
@@ -255,7 +233,7 @@ get_mask_cache(struct glamor_glyph_mask_cache *maskcache, int blocks)
}
static void
-put_mask_cache_bitmap(struct glamor_glyph_mask_cache *maskcache,
+put_mask_cache_bitmap(glamor_glyph_mask_cache_t *maskcache,
unsigned int bitmap)
{
maskcache->free_bitmap |= bitmap;
@@ -269,7 +247,7 @@ glamor_unrealize_glyph_caches(ScreenPtr pScreen)
glamor_screen_private *glamor = glamor_get_screen_private(pScreen);
int i;
- if (!glamor->glyph_cache_initialized)
+ if (!glamor->glyph_caches_realized)
return;
for (i = 0; i < GLAMOR_NUM_GLYPH_CACHE_FORMATS; i++) {
@@ -281,10 +259,10 @@ glamor_unrealize_glyph_caches(ScreenPtr pScreen)
if (cache->glyphs)
free(cache->glyphs);
- if (mask_cache[i])
- free(mask_cache[i]);
+ if (glamor->mask_cache[i])
+ free(glamor->mask_cache[i]);
}
- glamor->glyph_cache_initialized = FALSE;
+ glamor->glyph_caches_realized = FALSE;
}
void
@@ -314,6 +292,9 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
};
int i;
+ if (glamor->glyph_caches_realized)
+ return TRUE;
+
memset(glamor->glyphCaches, 0, sizeof(glamor->glyphCaches));
for (i = 0; i < sizeof(formats) / sizeof(formats[0]); i++) {
@@ -353,12 +334,13 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
goto bail;
cache->evict = rand() % GLYPH_CACHE_SIZE;
- mask_cache[i] = calloc(1, sizeof(*mask_cache[i]));
- mask_cache[i]->pixmap = pixmap;
- clear_mask_cache(mask_cache[i]);
+ glamor->mask_cache[i] = calloc(1, sizeof(*glamor->mask_cache[i]));
+ glamor->mask_cache[i]->pixmap = pixmap;
+ clear_mask_cache(glamor->mask_cache[i]);
}
assert(i == GLAMOR_NUM_GLYPH_CACHE_FORMATS);
+ glamor->glyph_caches_realized = TRUE;
return TRUE;
bail:
@@ -375,17 +357,11 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
Bool
glamor_glyphs_init(ScreenPtr pScreen)
{
- glamor_screen_private *glamor = glamor_get_screen_private(pScreen);
-
- if (glamor->glyph_cache_initialized)
- return TRUE;
-
if (!dixRegisterPrivateKey(&glamor_glyph_key,
- PRIVATE_GLYPH, sizeof(struct glamor_glyph)))
+ PRIVATE_GLYPH,
+ screenInfo.numScreens * sizeof(struct glamor_glyph)))
return FALSE;
- glamor->glyph_cache_initialized = TRUE;
-
return TRUE;
}
@@ -463,7 +439,7 @@ glamor_glyph_unrealize(ScreenPtr screen, GlyphPtr glyph)
struct glamor_glyph *priv;
/* Use Lookup in case we have not attached to this glyph. */
- priv = glamor_glyph_get_private(glyph);
+ priv = glamor_glyph_get_private(screen, glyph);
if (priv->cached)
priv->cache->glyphs[priv->pos] = NULL;
@@ -794,7 +770,7 @@ glamor_glyphs_intersect(int nlist, GlyphListPtr list, GlyphPtr *glyphs,
if (y1 < MINSHORT)
y1 = MINSHORT;
if (check_fake_overlap)
- priv = glamor_glyph_get_private(glyph);
+ priv = glamor_glyph_get_private(screen, glyph);
x2 = x1 + glyph->info.width;
y2 = y1 + glyph->info.height;
@@ -1082,7 +1058,7 @@ glamor_glyph_cache(glamor_screen_private *glamor, GlyphPtr glyph, int *out_x,
mask = glamor_glyph_count_to_mask(s);
pos = (cache->count + s - 1) & mask;
- priv = glamor_glyph_get_private(glyph);
+ priv = glamor_glyph_get_private(screen, glyph);
if (pos < GLYPH_CACHE_SIZE) {
cache->count = pos + s;
}
@@ -1094,7 +1070,7 @@ glamor_glyph_cache(glamor_screen_private *glamor, GlyphPtr glyph, int *out_x,
if (evicted == NULL)
continue;
- evicted_priv = glamor_glyph_get_private(evicted);
+ evicted_priv = glamor_glyph_get_private(screen, evicted);
assert(evicted_priv->pos == i);
if (evicted_priv->size >= s) {
cache->glyphs[i] = NULL;
@@ -1115,7 +1091,7 @@ glamor_glyph_cache(glamor_screen_private *glamor, GlyphPtr glyph, int *out_x,
if (evicted != NULL) {
- evicted_priv = glamor_glyph_get_private(evicted);
+ evicted_priv = glamor_glyph_get_private(screen, evicted);
assert(evicted_priv->pos == pos + s);
evicted_priv->cached = FALSE;
@@ -1182,7 +1158,7 @@ unsigned long long dst_glyphs_cnt = 0;
struct glyphs_flush_mask_arg {
PicturePtr mask;
glamor_glyph_buffer_t *buffer;
- struct glamor_glyph_mask_cache *maskcache;
+ glamor_glyph_mask_cache_t *maskcache;
unsigned int used_bitmap;
};
@@ -1242,7 +1218,7 @@ glamor_buffer_glyph(glamor_screen_private *glamor_priv,
glamor_glyph_cache_t *cache;
if (glyphs_dst_mode != GLYPHS_DST_MODE_MASK_TO_DST)
- priv = glamor_glyph_get_private(glyph);
+ priv = glamor_glyph_get_private(screen, glyph);
if (PICT_FORMAT_BPP(format) == 1)
format = PICT_a8;
@@ -1300,7 +1276,7 @@ glamor_buffer_glyph(glamor_screen_private *glamor_priv,
rect->x_src = 0 + dx;
rect->y_src = 0 + dy;
}
- priv = glamor_glyph_get_private(glyph);
+ priv = glamor_glyph_get_private(screen, glyph);
}
rect->x_dst = x_glyph;
@@ -1398,7 +1374,7 @@ glamor_glyphs_via_mask(CARD8 op,
glamor_glyph_buffer_t *pmask_buffer;
struct glyphs_flush_mask_arg *pmask_arg;
struct glamor_glyph_mask_cache_entry *mce = NULL;
- struct glamor_glyph_mask_cache *maskcache;
+ glamor_glyph_mask_cache_t *maskcache;
glamor_glyph_cache_t *cache;
int glyphs_dst_mode;
@@ -1419,7 +1395,7 @@ glamor_glyphs_via_mask(CARD8 op,
cache = &glamor_priv->glyphCaches
[PICT_FORMAT_RGB(mask_format->format) != 0];
- maskcache = mask_cache[PICT_FORMAT_RGB(mask_format->format) != 0];
+ maskcache = glamor_priv->mask_cache[PICT_FORMAT_RGB(mask_format->format) != 0];
x = -extents.x1;
y = -extents.y1;
diff --git a/xorg-server/glamor/glamor_largepixmap.c b/xorg-server/glamor/glamor_largepixmap.c
index 5a4bec571..9b2458453 100644
--- a/xorg-server/glamor/glamor_largepixmap.c
+++ b/xorg-server/glamor/glamor_largepixmap.c
@@ -2,6 +2,12 @@
#include "glamor_priv.h"
+static inline glamor_pixmap_private_large_t *
+__glamor_large(glamor_pixmap_private *pixmap_priv) {
+ assert(pixmap_priv->type == GLAMOR_TEXTURE_LARGE);
+ return &pixmap_priv->large;
+}
+
/**
* Clip the boxes regards to each pixmap's block array.
*
@@ -154,9 +160,9 @@ glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
*result_regions;
int i, j, x, y, k, inner_n_regions;
int width, height;
- glamor_pixmap_private_large_t *priv;
-
- priv = &pixmap_priv->large;
+ BoxPtr box_array;
+ BoxRec small_box;
+ int block_w, block_h;
DEBUGF("ext called \n");
@@ -170,14 +176,16 @@ glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
clipped_regions[0].block_idx = 0;
RegionCopy(clipped_regions[0].region, region);
*n_region = 1;
- priv->block_w = priv->base.pixmap->drawable.width;
- priv->block_h = priv->base.pixmap->drawable.height;
- priv->box_array = &priv->box;
- priv->box.x1 = priv->box.y1 = 0;
- priv->box.x2 = priv->block_w;
- priv->box.y2 = priv->block_h;
+ block_w = pixmap_priv->base.pixmap->drawable.width;
+ block_h = pixmap_priv->base.pixmap->drawable.height;
+ box_array = &small_box;
+ small_box.x1 = small_box.y1 = 0;
+ small_box.x2 = block_w;
+ small_box.y2 = block_h;
}
else {
+ glamor_pixmap_private_large_t *priv = __glamor_large(pixmap_priv);
+
clipped_regions = __glamor_compute_clipped_regions(priv->block_w,
priv->block_h,
priv->block_wcnt,
@@ -193,20 +201,23 @@ glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
*n_region = 0;
return NULL;
}
+ block_w = priv->block_w;
+ block_h = priv->block_h;
+ box_array = priv->box_array;
}
- if (inner_block_w >= priv->block_w && inner_block_h >= priv->block_h)
+ if (inner_block_w >= block_w && inner_block_h >= block_h)
return clipped_regions;
result_regions = calloc(*n_region
- * ((priv->block_w + inner_block_w - 1) /
+ * ((block_w + inner_block_w - 1) /
inner_block_w)
- * ((priv->block_h + inner_block_h - 1) /
+ * ((block_h + inner_block_h - 1) /
inner_block_h), sizeof(*result_regions));
k = 0;
for (i = 0; i < *n_region; i++) {
- x = priv->box_array[clipped_regions[i].block_idx].x1;
- y = priv->box_array[clipped_regions[i].block_idx].y1;
- width = priv->box_array[clipped_regions[i].block_idx].x2 - x;
- height = priv->box_array[clipped_regions[i].block_idx].y2 - y;
+ x = box_array[clipped_regions[i].block_idx].x1;
+ y = box_array[clipped_regions[i].block_idx].y1;
+ width = box_array[clipped_regions[i].block_idx].x2 - x;
+ height = box_array[clipped_regions[i].block_idx].y2 - y;
inner_regions = __glamor_compute_clipped_regions(inner_block_w,
inner_block_h,
0, x, y,
@@ -343,8 +354,6 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
int x_center_shift = 0, y_center_shift = 0;
glamor_pixmap_private_large_t *priv;
- priv = &pixmap_priv->large;
-
DEBUGRegionPrint(region);
if (pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
clipped_regions = calloc(1, sizeof(*clipped_regions));
@@ -355,6 +364,8 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
return clipped_regions;
}
+ priv = __glamor_large(pixmap_priv);
+
pixmap_width = priv->base.pixmap->drawable.width;
pixmap_height = priv->base.pixmap->drawable.height;
if (repeat_type == 0 || repeat_type == RepeatPad) {
@@ -751,7 +762,7 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
int pixmap_width, pixmap_height;
glamor_pixmap_private_large_t *priv;
- priv = &pixmap_priv->large;
+ priv = __glamor_large(pixmap_priv);
pixmap_width = priv->base.pixmap->drawable.width;
pixmap_height = priv->base.pixmap->drawable.height;
@@ -970,7 +981,7 @@ _glamor_process_transformed_clipped_region(glamor_pixmap_private *priv,
need_clean_fbo);
}
else {
- SET_PIXMAP_FBO_CURRENT(priv, clipped_regions[0].block_idx);
+ glamor_set_pixmap_fbo_current(priv, clipped_regions[0].block_idx);
if (repeat_type == RepeatReflect || repeat_type == RepeatNormal) {
/* The required source areas are in one region,
* we need to shift the corresponding box's coords to proper position,
@@ -985,15 +996,15 @@ _glamor_process_transformed_clipped_region(glamor_pixmap_private *priv,
shift_y = (temp_box->y1 - rem) / priv->base.pixmap->drawable.height;
if (shift_x != 0) {
- priv->large.box.x1 +=
+ __glamor_large(priv)->box.x1 +=
shift_x * priv->base.pixmap->drawable.width;
- priv->large.box.x2 +=
+ __glamor_large(priv)->box.x2 +=
shift_x * priv->base.pixmap->drawable.width;
}
if (shift_y != 0) {
- priv->large.box.y1 +=
+ __glamor_large(priv)->box.y1 +=
shift_y * priv->base.pixmap->drawable.height;
- priv->large.box.y2 +=
+ __glamor_large(priv)->box.y2 +=
shift_y * priv->base.pixmap->drawable.height;
}
}
@@ -1028,6 +1039,7 @@ glamor_composite_largepixmap_region(CARD8 op,
int is_normal_source_fbo = 0;
int is_normal_mask_fbo = 0;
int fixed_block_width, fixed_block_height;
+ int dest_block_width, dest_block_height;
int null_source, null_mask;
glamor_pixmap_private *need_free_source_pixmap_priv = NULL;
glamor_pixmap_private *need_free_mask_pixmap_priv = NULL;
@@ -1044,8 +1056,16 @@ glamor_composite_largepixmap_region(CARD8 op,
else
mask_repeat_type = RepeatNone;
- fixed_block_width = dest_pixmap_priv->large.block_w;
- fixed_block_height = dest_pixmap_priv->large.block_h;
+ if (dest_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+ dest_block_width = __glamor_large(dest_pixmap_priv)->block_w;
+ dest_block_height = __glamor_large(dest_pixmap_priv)->block_h;
+ } else {
+ dest_block_width = dest_pixmap_priv->base.pixmap->drawable.width;
+ dest_block_height = dest_pixmap_priv->base.pixmap->drawable.height;
+ }
+ fixed_block_width = dest_block_width;
+ fixed_block_height = dest_block_height;
+
/* If we got an totally out-of-box region for a source or mask
* region without repeat, we need to set it as null_source and
* give it a solid color (0,0,0,0). */
@@ -1071,8 +1091,8 @@ glamor_composite_largepixmap_region(CARD8 op,
int source_transformed_block_width, source_transformed_block_height;
if (!glamor_get_transform_block_size(source->transform,
- source_pixmap_priv->large.block_w,
- source_pixmap_priv->large.block_h,
+ __glamor_large(source_pixmap_priv)->block_w,
+ __glamor_large(source_pixmap_priv)->block_h,
&source_transformed_block_width,
&source_transformed_block_height))
{
@@ -1093,8 +1113,8 @@ glamor_composite_largepixmap_region(CARD8 op,
int mask_transformed_block_width, mask_transformed_block_height;
if (!glamor_get_transform_block_size(mask->transform,
- mask_pixmap_priv->large.block_w,
- mask_pixmap_priv->large.block_h,
+ __glamor_large(mask_pixmap_priv)->block_w,
+ __glamor_large(mask_pixmap_priv)->block_h,
&mask_transformed_block_width,
&mask_transformed_block_height)) {
DEBUGF("mask block size less than 1, fallback.\n");
@@ -1111,8 +1131,8 @@ glamor_composite_largepixmap_region(CARD8 op,
/*compute the correct block width and height whose transformed source/mask
*region can fit into one texture.*/
- if (force_clip || fixed_block_width < dest_pixmap_priv->large.block_w
- || fixed_block_height < dest_pixmap_priv->large.block_h)
+ if (force_clip || fixed_block_width < dest_block_width
+ || fixed_block_height < dest_block_height)
clipped_dest_regions =
glamor_compute_clipped_regions_ext(dest_pixmap_priv, region,
&n_dest_regions,
@@ -1140,7 +1160,7 @@ glamor_composite_largepixmap_region(CARD8 op,
DEBUGF("dest region %d idx %d\n", i,
clipped_dest_regions[i].block_idx);
DEBUGRegionPrint(clipped_dest_regions[i].region);
- SET_PIXMAP_FBO_CURRENT(dest_pixmap_priv,
+ glamor_set_pixmap_fbo_current(dest_pixmap_priv,
clipped_dest_regions[i].block_idx);
if (source_pixmap_priv &&
source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
@@ -1180,7 +1200,7 @@ glamor_composite_largepixmap_region(CARD8 op,
DEBUGF("source clipped result %d region: \n", n_source_regions);
for (j = 0; j < n_source_regions; j++) {
if (is_normal_source_fbo)
- SET_PIXMAP_FBO_CURRENT(source_pixmap_priv,
+ glamor_set_pixmap_fbo_current(source_pixmap_priv,
clipped_source_regions[j].block_idx);
if (mask_pixmap_priv &&
@@ -1267,12 +1287,12 @@ glamor_composite_largepixmap_region(CARD8 op,
clipped_mask_regions[k].block_idx);
DEBUGRegionPrint(clipped_mask_regions[k].region);
if (is_normal_mask_fbo) {
- SET_PIXMAP_FBO_CURRENT(mask_pixmap_priv,
+ glamor_set_pixmap_fbo_current(mask_pixmap_priv,
clipped_mask_regions[k].
block_idx);
DEBUGF("mask fbo off %d %d \n",
- mask_pixmap_priv->large.box.x1,
- mask_pixmap_priv->large.box.y1);
+ __glamor_large(mask_pixmap_priv)->box.x1,
+ __glamor_large(mask_pixmap_priv)->box.y1);
DEBUGF("start composite mask hasn't transform.\n");
RegionTranslate(clipped_mask_regions[k].region,
x_dest - x_mask +
@@ -1378,7 +1398,7 @@ glamor_composite_largepixmap_region(CARD8 op,
clipped_mask_regions[k].block_idx);
DEBUGRegionPrint(clipped_mask_regions[k].region);
if (is_normal_mask_fbo) {
- SET_PIXMAP_FBO_CURRENT(mask_pixmap_priv,
+ glamor_set_pixmap_fbo_current(mask_pixmap_priv,
clipped_mask_regions[k].
block_idx);
RegionTranslate(clipped_mask_regions[k].region,
diff --git a/xorg-server/glamor/glamor_pixmap.c b/xorg-server/glamor/glamor_pixmap.c
index ccb49f3c6..11e9ebb00 100644
--- a/xorg-server/glamor/glamor_pixmap.c
+++ b/xorg-server/glamor/glamor_pixmap.c
@@ -985,7 +985,7 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
assert(pbo == 0);
- SET_PIXMAP_FBO_CURRENT(pixmap_priv, clipped_regions[i].block_idx);
+ glamor_set_pixmap_fbo_current(pixmap_priv, clipped_regions[i].block_idx);
boxes = RegionRects(clipped_regions[i].region);
nbox = RegionNumRects(clipped_regions[i].region);
diff --git a/xorg-server/glamor/glamor_priv.h b/xorg-server/glamor/glamor_priv.h
index 385c0279d..c089db895 100644
--- a/xorg-server/glamor/glamor_priv.h
+++ b/xorg-server/glamor/glamor_priv.h
@@ -167,6 +167,30 @@ typedef struct {
uint16_t evict;
} glamor_glyph_cache_t;
+#define CACHE_PICTURE_SIZE 1024
+#define GLYPH_MIN_SIZE 8
+#define GLYPH_MAX_SIZE 64
+#define GLYPH_CACHE_SIZE ((CACHE_PICTURE_SIZE) * CACHE_PICTURE_SIZE / (GLYPH_MIN_SIZE * GLYPH_MIN_SIZE))
+
+#define MASK_CACHE_MAX_SIZE 32
+#define MASK_CACHE_WIDTH (CACHE_PICTURE_SIZE / MASK_CACHE_MAX_SIZE)
+#define MASK_CACHE_MASK ((1LL << (MASK_CACHE_WIDTH)) - 1)
+
+struct glamor_glyph_mask_cache_entry {
+ int idx;
+ int width;
+ int height;
+ int x;
+ int y;
+};
+
+typedef struct {
+ PixmapPtr pixmap;
+ struct glamor_glyph_mask_cache_entry mcache[MASK_CACHE_WIDTH];
+ unsigned int free_bitmap;
+ unsigned int cleared_bitmap;
+} glamor_glyph_mask_cache_t;
+
struct glamor_saved_procs {
CloseScreenProcPtr close_screen;
CreateScreenResourcesProcPtr create_screen_resources;
@@ -268,7 +292,8 @@ typedef struct glamor_screen_private {
[SHADER_MASK_COUNT]
[SHADER_IN_COUNT];
glamor_glyph_cache_t glyphCaches[GLAMOR_NUM_GLYPH_CACHE_FORMATS];
- Bool glyph_cache_initialized;
+ glamor_glyph_mask_cache_t *mask_cache[GLAMOR_NUM_GLYPH_CACHE_FORMATS];
+ Bool glyph_caches_realized;
/* shaders to restore a texture to another texture. */
GLint finish_access_prog[2];
@@ -281,9 +306,6 @@ typedef struct glamor_screen_private {
int linear_max_nstops;
int radial_max_nstops;
- /* glamor trapezoid shader. */
- GLint trapezoid_prog;
-
PixmapPtr *back_pixmap;
int screen_fbo;
struct glamor_saved_procs saved_procs;
@@ -413,14 +435,6 @@ typedef struct glamor_pixmap_clipped_regions {
RegionPtr region;
} glamor_pixmap_clipped_regions;
-#define SET_PIXMAP_FBO_CURRENT(priv, idx) \
- do { \
- if (priv->type == GLAMOR_TEXTURE_LARGE) { \
- (priv)->large.base.fbo = priv->large.fbo_array[idx]; \
- (priv)->large.box = priv->large.box_array[idx]; \
- } \
- } while(0)
-
typedef struct glamor_pixmap_private_base {
glamor_pixmap_type_t type;
enum glamor_fbo_state gl_fbo;
@@ -493,6 +507,15 @@ typedef struct glamor_pixmap_private {
};
} glamor_pixmap_private;
+static inline void
+glamor_set_pixmap_fbo_current(glamor_pixmap_private *priv, int idx)
+{
+ if (priv->type == GLAMOR_TEXTURE_LARGE) {
+ priv->large.base.fbo = priv->large.fbo_array[idx];
+ priv->large.box = priv->large.box_array[idx];
+ }
+}
+
static inline glamor_pixmap_fbo *
glamor_pixmap_fbo_at(glamor_pixmap_private *priv, int x, int y)
{
@@ -719,8 +742,6 @@ void glamor_composite_glyph_rects(CARD8 op,
void glamor_composite_rects(CARD8 op,
PicturePtr pDst,
xRenderColor *color, int nRect, xRectangle *rects);
-void glamor_init_trapezoid_shader(ScreenPtr screen);
-void glamor_fini_trapezoid_shader(ScreenPtr screen);
PicturePtr glamor_convert_gradient_picture(ScreenPtr screen,
PicturePtr source,
int x_source,
@@ -1063,7 +1084,6 @@ void glamor_xv_render(glamor_port_private *port_priv);
#define GLAMOR_PIXMAP_DYNAMIC_UPLOAD
#define GLAMOR_GRADIENT_SHADER
-#define GLAMOR_TRAPEZOID_SHADER
#define GLAMOR_TEXTURED_LARGE_PIXMAP 1
#define WALKAROUND_LARGE_TEXTURE_MAP
#if 0
diff --git a/xorg-server/glamor/glamor_trapezoid.c b/xorg-server/glamor/glamor_trapezoid.c
index d61d11f79..f8bf6c97f 100644
--- a/xorg-server/glamor/glamor_trapezoid.c
+++ b/xorg-server/glamor/glamor_trapezoid.c
@@ -36,1522 +36,6 @@
#include "mipict.h"
#include "fbpict.h"
-static xFixed
-_glamor_linefixedX(xLineFixed *l, xFixed y, Bool ceil)
-{
- xFixed dx = l->p2.x - l->p1.x;
- xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx;
- xFixed dy = l->p2.y - l->p1.y;
-
- if (ceil)
- ex += (dy - 1);
- return l->p1.x + (xFixed) (ex / dy);
-}
-
-static xFixed
-_glamor_linefixedY(xLineFixed *l, xFixed x, Bool ceil)
-{
- xFixed dy = l->p2.y - l->p1.y;
- xFixed_32_32 ey = (xFixed_32_32) (x - l->p1.x) * dy;
- xFixed dx = l->p2.x - l->p1.x;
-
- if (ceil)
- ey += (dx - 1);
- return l->p1.y + (xFixed) (ey / dx);
-}
-
-#ifdef GLAMOR_TRAPEZOID_SHADER
-
-#define GLAMOR_VERTEX_TOP_BOTTOM (GLAMOR_VERTEX_SOURCE + 1)
-#define GLAMOR_VERTEX_LEFT_PARAM (GLAMOR_VERTEX_SOURCE + 2)
-#define GLAMOR_VERTEX_RIGHT_PARAM (GLAMOR_VERTEX_SOURCE + 3)
-
-#define DEBUG_CLIP_VTX 0
-
-#define POINT_INSIDE_CLIP_RECT(point, rect) \
- (point[0] >= IntToxFixed(rect->x1) \
- && point[0] <= IntToxFixed(rect->x2) \
- && point[1] >= IntToxFixed(rect->y1) \
- && point[1] <= IntToxFixed(rect->y2))
-
-static xFixed
-_glamor_lines_crossfixedY(xLineFixed *l, xLineFixed *r)
-{
- xFixed dx1 = l->p2.x - l->p1.x;
- xFixed dx2 = r->p2.x - r->p1.x;
- xFixed dy1 = l->p2.y - l->p1.y;
- xFixed dy2 = r->p2.y - r->p1.y;
- xFixed_32_32 tmp = (xFixed_32_32) dy2 * dy1;
- xFixed_32_32 dividend1 = (tmp >> 32) * (l->p1.x - r->p1.x);
- xFixed_32_32 dividend2;
- xFixed_32_32 dividend3;
- xFixed_32_32 divisor;
-
- tmp = (xFixed_32_32) dx1 *dy2;
-
- dividend2 = (tmp >> 32) * l->p1.y;
- tmp = (xFixed_32_32) dy1 *dx2;
-
- dividend3 = (tmp >> 32) * r->p1.y;
- divisor = ((xFixed_32_32) dx1 * (xFixed_32_32) dy2
- - (xFixed_32_32) dy1 * (xFixed_32_32) dx2) >> 32;
-
- if (divisor)
- return (xFixed) ((dividend2 - dividend1 - dividend3) / divisor);
-
- return 0xFFFFFFFF;
-}
-
-static Bool
-point_inside_trapezoid(int point[2], xTrapezoid *trap, xFixed cut_y)
-{
- int ret = TRUE;
- int tmp;
-
- if (point[1] > trap->bottom) {
- ret = FALSE;
- if (DEBUG_CLIP_VTX) {
- ErrorF("Out of Trap bottom, point[1] = %d(0x%x)), "
- "bottom = %d(0x%x)\n",
- (unsigned int) xFixedToInt(point[1]), point[1],
- (unsigned int) xFixedToInt(trap->bottom),
- (unsigned int) trap->bottom);
- }
-
- return ret;
- }
-
- if (point[1] < trap->top) {
- ret = FALSE;
- if (DEBUG_CLIP_VTX) {
- ErrorF("Out of Trap top, point[1] = %d(0x%x)), "
- "top = %d(0x%x)\n",
- (unsigned int) xFixedToInt(point[1]), point[1],
- (unsigned int) xFixedToInt(trap->top),
- (unsigned int) trap->top);
- }
-
- return ret;
- }
-
- tmp = _glamor_linefixedX(&trap->left, point[1], FALSE);
- if (point[0] < tmp) {
- ret = FALSE;
-
- if (abs(cut_y - trap->top) < pixman_fixed_1_minus_e &&
- abs(point[1] - trap->top) < pixman_fixed_1_minus_e &&
- tmp - point[0] < pixman_fixed_1_minus_e) {
- ret = TRUE;
- }
- else if (abs(cut_y - trap->bottom) < pixman_fixed_1_minus_e &&
- point[1] - trap->bottom < pixman_fixed_1_minus_e &&
- tmp - point[0] < pixman_fixed_1_minus_e) {
- ret = TRUE;
- }
-
- if (DEBUG_CLIP_VTX && !ret) {
- ErrorF("Out of Trap left, point[0] = %d(0x%x)), "
- "left = %d(0x%x)\n",
- (unsigned int) xFixedToInt(point[0]), point[0],
- (unsigned int) xFixedToInt(tmp), (unsigned int) tmp);
- }
-
- if (!ret)
- return ret;
- }
-
- tmp = _glamor_linefixedX(&trap->right, point[1], TRUE);
- if (point[0] > tmp) {
- ret = FALSE;
-
- if (abs(cut_y - trap->top) < pixman_fixed_1_minus_e &&
- abs(point[1] - trap->top) < pixman_fixed_1_minus_e &&
- point[0] - tmp < pixman_fixed_1_minus_e) {
- ret = TRUE;
- }
- else if (abs(cut_y - trap->bottom) < pixman_fixed_1_minus_e &&
- abs(point[1] - trap->bottom) < pixman_fixed_1_minus_e &&
- point[0] - tmp < pixman_fixed_1_minus_e) {
- ret = TRUE;
- }
-
- if (DEBUG_CLIP_VTX && !ret) {
- ErrorF("Out of Trap right, point[0] = %d(0x%x)), "
- "right = %d(0x%x)\n",
- (unsigned int) xFixedToInt(point[0]), point[0],
- (unsigned int) xFixedToInt(tmp), (unsigned int) tmp);
- }
-
- if (!ret)
- return ret;
- }
-
- return ret;
-}
-
-static void
-glamor_emit_composite_vert(ScreenPtr screen,
- float *vb,
- const float *src_coords,
- const float *mask_coords,
- const float *dst_coords, int i)
-{
- glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- int j = 0;
-
- vb += i * glamor_priv->vb_stride / sizeof(float);
-
- vb[j++] = dst_coords[i * 2 + 0];
- vb[j++] = dst_coords[i * 2 + 1];
- if (glamor_priv->has_source_coords) {
- vb[j++] = src_coords[i * 2 + 0];
- vb[j++] = src_coords[i * 2 + 1];
- }
- if (glamor_priv->has_mask_coords) {
- vb[j++] = mask_coords[i * 2 + 0];
- vb[j++] = mask_coords[i * 2 + 1];
- }
-
- glamor_priv->render_nr_verts++;
-}
-
-static void
-glamor_emit_composite_triangle(ScreenPtr screen,
- float *vb,
- const float *src_coords,
- const float *mask_coords,
- const float *dst_coords)
-{
- glamor_emit_composite_vert(screen, vb,
- src_coords, mask_coords, dst_coords, 0);
- glamor_emit_composite_vert(screen, vb,
- src_coords, mask_coords, dst_coords, 1);
- glamor_emit_composite_vert(screen, vb,
- src_coords, mask_coords, dst_coords, 2);
-}
-
-static void
-glamor_flush_composite_triangles(ScreenPtr screen)
-{
- glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
-
- glamor_make_current(glamor_priv);
- glamor_put_vbo_space(screen);
-
- if (!glamor_priv->render_nr_verts)
- return;
-
- glDrawArrays(GL_TRIANGLES, 0, glamor_priv->render_nr_verts);
-}
-
-static Bool
-_glamor_clip_trapezoid_vertex(xTrapezoid *trap, BoxPtr pbox,
- int vertex[6], int *num)
-{
- xFixed edge_cross_y = 0xFFFFFFFF;
- int tl[2];
- int bl[2];
- int tr[2];
- int br[2];
- int left_cut_top[2];
- int left_cut_left[2];
- int left_cut_right[2];
- int left_cut_bottom[2];
- int right_cut_top[2];
- int right_cut_left[2];
- int right_cut_right[2];
- int right_cut_bottom[2];
- int tmp[2];
- int tmp_vtx[20 * 2];
- float tmp_vtx_slope[20];
- BoxRec trap_bound;
- int i = 0;
- int vertex_num = 0;
-
- if (DEBUG_CLIP_VTX) {
- ErrorF
- ("The parameter of xTrapezoid is:\ntop: %d 0x%x\tbottom: %d 0x%x\n"
- "left: p1 (%d 0x%x, %d 0x%x)\tp2 (%d 0x%x, %d 0x%x)\n"
- "right: p1 (%d 0x%x, %d 0x%x)\tp2 (%d 0x%x, %d 0x%x)\n",
- xFixedToInt(trap->top), (unsigned int) trap->top,
- xFixedToInt(trap->bottom), (unsigned int) trap->bottom,
- xFixedToInt(trap->left.p1.x), (unsigned int) trap->left.p1.x,
- xFixedToInt(trap->left.p1.y), (unsigned int) trap->left.p1.y,
- xFixedToInt(trap->left.p2.x), (unsigned int) trap->left.p2.x,
- xFixedToInt(trap->left.p2.y), (unsigned int) trap->left.p2.y,
- xFixedToInt(trap->right.p1.x), (unsigned int) trap->right.p1.x,
- xFixedToInt(trap->right.p1.y), (unsigned int) trap->right.p1.y,
- xFixedToInt(trap->right.p2.x), (unsigned int) trap->right.p2.x,
- xFixedToInt(trap->right.p2.y), (unsigned int) trap->right.p2.y);
- }
-
- miTrapezoidBounds(1, trap, &trap_bound);
- if (DEBUG_CLIP_VTX)
- ErrorF("The bounds for this traps is: bounds.x1 = %d, bounds.x2 = %d, "
- "bounds.y1 = %d, bounds.y2 = %d\n", trap_bound.x1, trap_bound.x2,
- trap_bound.y1, trap_bound.y2);
-
- if (trap_bound.x1 > pbox->x2 || trap_bound.x2 < pbox->x1)
- return FALSE;
- if (trap_bound.y1 > pbox->y2 || trap_bound.y2 < pbox->y1)
- return FALSE;
-
-#define IS_TRAP_EDGE_VERTICAL(edge) \
- (edge->p1.x == edge->p2.x)
-
-#define CACULATE_CUT_VERTEX(vtx, cal_x, ceil, vh_edge, edge) \
- do { \
- if(cal_x) { \
- vtx[1] = (vh_edge); \
- vtx[0] = (_glamor_linefixedX( \
- edge, vh_edge, ceil)); \
- if(DEBUG_CLIP_VTX) \
- ErrorF("The intersection point of line y=%d and " \
- "line of p1:(%d,%d) -- p2 (%d,%d) " \
- "is (%d, %d)\n", \
- xFixedToInt(vh_edge), \
- xFixedToInt(edge->p1.x), \
- xFixedToInt(edge->p1.y), \
- xFixedToInt(edge->p2.x), \
- xFixedToInt(edge->p2.y), \
- xFixedToInt(vtx[0]), \
- xFixedToInt(vtx[1])); \
- } else { \
- vtx[0] = (vh_edge); \
- vtx[1] = (_glamor_linefixedY( \
- edge, vh_edge, ceil)); \
- if(DEBUG_CLIP_VTX) \
- ErrorF("The intersection point of line x=%d and " \
- "line of p1:(%d,%d) -- p2 (%d,%d) " \
- "is (%d, %d)\n", \
- xFixedToInt(vh_edge), \
- xFixedToInt(edge->p1.x), \
- xFixedToInt(edge->p1.y), \
- xFixedToInt(edge->p2.x), \
- xFixedToInt(edge->p2.y), \
- xFixedToInt(vtx[0]), \
- xFixedToInt(vtx[1])); \
- } \
- } while(0)
-
-#define ADD_VERTEX_IF_INSIDE(vtx) \
- if(POINT_INSIDE_CLIP_RECT(vtx, pbox) \
- && point_inside_trapezoid(vtx, trap, edge_cross_y)){ \
- tmp_vtx[vertex_num] = xFixedToInt(vtx[0]); \
- tmp_vtx[vertex_num + 1] = xFixedToInt(vtx[1]); \
- vertex_num += 2; \
- if(DEBUG_CLIP_VTX) \
- ErrorF("@ Point: (%d, %d) is inside " \
- "the Rect and Trapezoid\n", \
- xFixedToInt(vtx[0]), \
- xFixedToInt(vtx[1])); \
- } else if(DEBUG_CLIP_VTX){ \
- ErrorF("X Point: (%d, %d) is outside " \
- "the Rect and Trapezoid\t", \
- xFixedToInt(vtx[0]), \
- xFixedToInt(vtx[1])); \
- if(POINT_INSIDE_CLIP_RECT(vtx, pbox)) \
- ErrorF("The Point is outside " \
- "the Trapezoid\n"); \
- else \
- ErrorF("The Point is outside " \
- "the Rect\n"); \
- }
-
- /*Trap's right edge cut right edge. */
- if ((!IS_TRAP_EDGE_VERTICAL((&trap->left))) ||
- (!IS_TRAP_EDGE_VERTICAL((&trap->right)))) {
- edge_cross_y = _glamor_lines_crossfixedY((&trap->left), (&trap->right));
- if (DEBUG_CLIP_VTX) {
- ErrorF("Trap's left edge cut right edge at %d(0x%x), "
- "trap_top = %x, trap_bottom = %x\n",
- xFixedToInt(edge_cross_y), edge_cross_y,
- (unsigned int) trap->top, (unsigned int) trap->bottom);
- }
- }
-
- /*Trap's TopLeft, BottomLeft, TopRight and BottomRight. */
- CACULATE_CUT_VERTEX(tl, 1, FALSE, trap->top, (&trap->left));
- CACULATE_CUT_VERTEX(bl, 1, FALSE, trap->bottom, (&trap->left));
- CACULATE_CUT_VERTEX(tr, 1, TRUE, trap->top, (&trap->right));
- CACULATE_CUT_VERTEX(br, 1, TRUE, trap->bottom, (&trap->right));
-
- if (DEBUG_CLIP_VTX)
- ErrorF("Trap's TopLeft, BottomLeft, TopRight and BottomRight\n");
- if (DEBUG_CLIP_VTX)
- ErrorF("Caculate the vertex of trapezoid:\n"
- " (%3d, %3d)-------------------------(%3d, %3d)\n"
- " / \\ \n"
- " / \\ \n"
- " / \\ \n"
- " (%3d, %3d)---------------------------------(%3d, %3d)\n"
- "Clip with rect:\n"
- " (%3d, %3d)------------------------(%3d, %3d) \n"
- " | | \n"
- " | | \n"
- " | | \n"
- " (%3d, %3d)------------------------(%3d, %3d) \n",
- xFixedToInt(tl[0]), xFixedToInt(tl[1]), xFixedToInt(tr[0]),
- xFixedToInt(tr[1]), xFixedToInt(bl[0]), xFixedToInt(bl[1]),
- xFixedToInt(br[0]), xFixedToInt(br[1]),
- pbox->x1, pbox->y1, pbox->x2, pbox->y1, pbox->x1, pbox->y2,
- pbox->x2, pbox->y2);
-
- ADD_VERTEX_IF_INSIDE(tl);
- ADD_VERTEX_IF_INSIDE(bl);
- ADD_VERTEX_IF_INSIDE(tr);
- ADD_VERTEX_IF_INSIDE(br);
-
- /*Trap's left edge cut Rect. */
- if (DEBUG_CLIP_VTX)
- ErrorF("Trap's left edge cut Rect\n");
- CACULATE_CUT_VERTEX(left_cut_top, 1, FALSE, IntToxFixed(pbox->y1),
- (&trap->left));
- ADD_VERTEX_IF_INSIDE(left_cut_top);
- if (!IS_TRAP_EDGE_VERTICAL((&trap->left))) {
- CACULATE_CUT_VERTEX(left_cut_left, 0, FALSE, IntToxFixed(pbox->x1),
- (&trap->left));
- ADD_VERTEX_IF_INSIDE(left_cut_left);
- }
- CACULATE_CUT_VERTEX(left_cut_bottom, 1, FALSE, IntToxFixed(pbox->y2),
- (&trap->left));
- ADD_VERTEX_IF_INSIDE(left_cut_bottom);
- if (!IS_TRAP_EDGE_VERTICAL((&trap->left))) {
- CACULATE_CUT_VERTEX(left_cut_right, 0, FALSE, IntToxFixed(pbox->x2),
- (&trap->left));
- ADD_VERTEX_IF_INSIDE(left_cut_right);
- }
-
- /*Trap's right edge cut Rect. */
- if (DEBUG_CLIP_VTX)
- ErrorF("Trap's right edge cut Rect\n");
- CACULATE_CUT_VERTEX(right_cut_top, 1, TRUE, IntToxFixed(pbox->y1),
- (&trap->right));
- ADD_VERTEX_IF_INSIDE(right_cut_top);
- if (!IS_TRAP_EDGE_VERTICAL((&trap->right))) {
- CACULATE_CUT_VERTEX(right_cut_left, 0, TRUE, IntToxFixed(pbox->x1),
- (&trap->right));
- ADD_VERTEX_IF_INSIDE(right_cut_left);
- }
- CACULATE_CUT_VERTEX(right_cut_bottom, 1, TRUE, IntToxFixed(pbox->y2),
- (&trap->right));
- ADD_VERTEX_IF_INSIDE(right_cut_bottom);
- if (!IS_TRAP_EDGE_VERTICAL((&trap->right))) {
- CACULATE_CUT_VERTEX(right_cut_right, 0, TRUE, IntToxFixed(pbox->x2),
- (&trap->right));
- ADD_VERTEX_IF_INSIDE(right_cut_right);
- }
-
- /* Trap's top cut Left and Right of rect. */
- if (DEBUG_CLIP_VTX)
- ErrorF("Trap's top cut Left and Right of rect\n");
- tmp[0] = IntToxFixed(pbox->x1);
- tmp[1] = trap->top;
- ADD_VERTEX_IF_INSIDE(tmp);
- tmp[0] = IntToxFixed(pbox->x2);
- tmp[1] = trap->top;
- ADD_VERTEX_IF_INSIDE(tmp);
-
- /* Trap's bottom cut Left and Right of rect. */
- if (DEBUG_CLIP_VTX)
- ErrorF("Trap's bottom cut Left and Right of rect\n");
- tmp[0] = IntToxFixed(pbox->x1);
- tmp[1] = trap->bottom;
- ADD_VERTEX_IF_INSIDE(tmp);
- tmp[0] = IntToxFixed(pbox->x2);
- tmp[1] = trap->bottom;
- ADD_VERTEX_IF_INSIDE(tmp);
-
- /* The orginal 4 vertex of rect. */
- if (DEBUG_CLIP_VTX)
- ErrorF("The orginal 4 vertex of rect\n");
- tmp[0] = IntToxFixed(pbox->x1);
- tmp[1] = IntToxFixed(pbox->y1);
- ADD_VERTEX_IF_INSIDE(tmp);
- tmp[0] = IntToxFixed(pbox->x1);
- tmp[1] = IntToxFixed(pbox->y2);
- ADD_VERTEX_IF_INSIDE(tmp);
- tmp[0] = IntToxFixed(pbox->x2);
- tmp[1] = IntToxFixed(pbox->y2);
- ADD_VERTEX_IF_INSIDE(tmp);
- tmp[0] = IntToxFixed(pbox->x2);
- tmp[1] = IntToxFixed(pbox->y1);
- ADD_VERTEX_IF_INSIDE(tmp);
-
- if (DEBUG_CLIP_VTX) {
- ErrorF("\nThe candidate vertex number is %d\n", vertex_num / 2);
- for (i = 0; i < vertex_num / 2; i++) {
- ErrorF("(%d, %d) ", tmp_vtx[2 * i], tmp_vtx[2 * i + 1]);
- }
- ErrorF("\n");
- }
-
- /* Sort the vertex by X and then Y. */
- for (i = 0; i < vertex_num / 2; i++) {
- int j;
-
- for (j = 0; j < vertex_num / 2 - i - 1; j++) {
- if (tmp_vtx[2 * j] > tmp_vtx[2 * (j + 1)]
- || (tmp_vtx[2 * j] == tmp_vtx[2 * (j + 1)]
- && tmp_vtx[2 * j + 1] > tmp_vtx[2 * (j + 1) + 1])) {
- tmp[0] = tmp_vtx[2 * j];
- tmp[1] = tmp_vtx[2 * j + 1];
- tmp_vtx[2 * j] = tmp_vtx[2 * (j + 1)];
- tmp_vtx[2 * j + 1] = tmp_vtx[2 * (j + 1) + 1];
- tmp_vtx[2 * (j + 1)] = tmp[0];
- tmp_vtx[2 * (j + 1) + 1] = tmp[1];
- }
- }
-
- }
-
- if (DEBUG_CLIP_VTX) {
- ErrorF("\nAfter sort vertex number is:\n");
- for (i = 0; i < vertex_num / 2; i++) {
- ErrorF("(%d, %d) ", tmp_vtx[2 * i], tmp_vtx[2 * i + 1]);
- }
- ErrorF("\n");
- }
-
- memset(vertex, -1, 2 * 6);
- *num = 0;
-
- for (i = 0; i < vertex_num / 2; i++) {
- if (*num > 0 && vertex[2 * (*num - 1)] == tmp_vtx[2 * i]
- && vertex[2 * (*num - 1) + 1] == tmp_vtx[2 * i + 1]) {
- /*same vertex. */
- if (DEBUG_CLIP_VTX)
- ErrorF("X Point:(%d, %d) discard\n",
- tmp_vtx[2 * i], tmp_vtx[2 * i + 1]);
- continue;
- }
-
- (*num)++;
- if (*num > 6) {
- if (DEBUG_CLIP_VTX)
- FatalError("Trapezoid clip with Rect can never have vtx"
- "number bigger than 6\n");
- else {
- ErrorF("Trapezoid clip with Rect can never have vtx"
- "number bigger than 6\n");
- *num = 6;
- break;
- }
- }
-
- vertex[2 * (*num - 1)] = tmp_vtx[2 * i];
- vertex[2 * (*num - 1) + 1] = tmp_vtx[2 * i + 1];
- if (DEBUG_CLIP_VTX)
- ErrorF("@ Point:(%d, %d) select, num now is %d\n",
- tmp_vtx[2 * i], tmp_vtx[2 * i + 1], *num);
- }
-
- /* Now we need to arrange the vtx in the polygon's counter-clockwise
- order. We first select the left and top point as the start point and
- sort every vtx by the slope from vtx to the start vtx. */
- for (i = 1; i < *num; i++) {
- tmp_vtx_slope[i] = (vertex[2 * i] != vertex[0] ?
- (float) (vertex[2 * i + 1] -
- vertex[1]) / (float) (vertex[2 * i] -
- vertex[0])
- : (float) INT_MAX);
- }
-
- if (DEBUG_CLIP_VTX) {
- ErrorF("\nvtx number: %d, VTX and slope:\n", *num);
- for (i = 0; i < *num; i++) {
- ErrorF("(%d, %d):%f ",
- vertex[2 * i], vertex[2 * i + 1], tmp_vtx_slope[i]);
- }
- ErrorF("\n");
- }
-
- /* Sort the vertex by slope. */
- for (i = 0; i < *num - 1; i++) {
- int j;
- float tmp_slope;
-
- for (j = 1; j < *num - i - 1; j++) {
- if (tmp_vtx_slope[j] < tmp_vtx_slope[j + 1]) {
- tmp_slope = tmp_vtx_slope[j];
- tmp_vtx_slope[j] = tmp_vtx_slope[j + 1];
- tmp_vtx_slope[j + 1] = tmp_slope;
- tmp[0] = vertex[2 * j];
- tmp[1] = vertex[2 * j + 1];
- vertex[2 * j] = vertex[2 * (j + 1)];
- vertex[2 * j + 1] = vertex[2 * (j + 1) + 1];
- vertex[2 * (j + 1)] = tmp[0];
- vertex[2 * (j + 1) + 1] = tmp[1];
- }
- }
- }
-
- if (DEBUG_CLIP_VTX) {
- ErrorF("\nBefore return, vtx number: %d, VTX and slope:\n", *num);
- for (i = 0; i < *num; i++) {
- ErrorF("(%d, %d):%f ",
- vertex[2 * i], vertex[2 * i + 1], tmp_vtx_slope[i]);
- }
- ErrorF("\n");
- }
-
- return TRUE;
-}
-
-static void *
-glamor_setup_composite_vbo_for_trapezoid(ScreenPtr screen, int n_verts)
-{
- glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- int stride;
- int vert_size;
- char *vbo_offset;
- void *vb;
-
- glamor_priv->render_nr_verts = 0;
-
- /* For GLAMOR_VERTEX_POS */
- glamor_priv->vb_stride = 2 * sizeof(float);
-
- /* For GLAMOR_GLAMOR_VERTEX_SOURCE */
- glamor_priv->vb_stride += 2 * sizeof(float);
-
- /* For GLAMOR_VERTEX_TOP_BOTTOM */
- glamor_priv->vb_stride += 2 * sizeof(float);
-
- /* For GLAMOR_VERTEX_LEFT_PARAM */
- glamor_priv->vb_stride += 4 * sizeof(float);
-
- /* For GLAMOR_VERTEX_RIGHT_PARAM */
- glamor_priv->vb_stride += 4 * sizeof(float);
-
- vert_size = n_verts * glamor_priv->vb_stride;
-
- glamor_make_current(glamor_priv);
-
- glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
- glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glDisableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM);
- glDisableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM);
- glDisableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM);
-
- vb = glamor_get_vbo_space(screen, vert_size, &vbo_offset);
-
- /* Set the vertex pointer. */
- glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
- GL_FALSE, glamor_priv->vb_stride,
- vbo_offset);
- glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
- stride = 2;
-
- glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT,
- GL_FALSE, glamor_priv->vb_stride,
- vbo_offset + stride * sizeof(float));
- glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- stride += 2;
-
- glVertexAttribPointer(GLAMOR_VERTEX_TOP_BOTTOM, 2, GL_FLOAT,
- GL_FALSE, glamor_priv->vb_stride,
- vbo_offset + stride * sizeof(float));
- glEnableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM);
- stride += 2;
-
- glVertexAttribPointer(GLAMOR_VERTEX_LEFT_PARAM, 4, GL_FLOAT,
- GL_FALSE, glamor_priv->vb_stride,
- vbo_offset + stride * sizeof(float));
- glEnableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM);
- stride += 4;
-
- glVertexAttribPointer(GLAMOR_VERTEX_RIGHT_PARAM, 4, GL_FLOAT,
- GL_FALSE, glamor_priv->vb_stride,
- vbo_offset + stride * sizeof(float));
- glEnableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM);
-
- return vb;
-}
-
-static Bool
-_glamor_trapezoids_with_shader(CARD8 op,
- PicturePtr src, PicturePtr dst,
- PictFormatPtr mask_format, INT16 x_src,
- INT16 y_src, int ntrap, xTrapezoid * traps)
-{
- ScreenPtr screen = dst->pDrawable->pScreen;
- glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- struct shader_key key;
- glamor_composite_shader *shader = NULL;
- struct blendinfo op_info;
- PictFormatShort saved_source_format = 0;
- PixmapPtr source_pixmap = NULL;
- PixmapPtr dest_pixmap = NULL;
- glamor_pixmap_private *source_pixmap_priv = NULL;
- glamor_pixmap_private *dest_pixmap_priv = NULL;
- glamor_pixmap_private *temp_src_priv = NULL;
- int x_temp_src, y_temp_src;
- int src_width, src_height;
- int source_x_off, source_y_off;
- GLfloat src_xscale = 1, src_yscale = 1;
- int x_dst, y_dst;
- int dest_x_off, dest_y_off;
- GLfloat dst_xscale, dst_yscale;
- BoxRec bounds;
- PicturePtr temp_src = src;
- int vert_stride = 3;
- int ntriangle_per_loop;
- int nclip_rect;
- int mclip_rect;
- int clip_processed;
- int clipped_vtx[6 * 2];
- RegionRec region;
- BoxPtr box = NULL;
- BoxPtr pbox = NULL;
- int traps_count = 0;
- int traps_not_completed = 0;
- xTrapezoid *ptrap = NULL;
- int nbox;
- float src_matrix[9];
- Bool ret = FALSE;
-
- /* If a mask format wasn't provided, we get to choose, but behavior should
- * be as if there was no temporary mask the traps were accumulated into.
- */
- if (!mask_format) {
- if (dst->polyEdge == PolyEdgeSharp)
- mask_format = PictureMatchFormat(screen, 1, PICT_a1);
- else
- mask_format = PictureMatchFormat(screen, 8, PICT_a8);
- for (; ntrap; ntrap--, traps++)
- glamor_trapezoids(op, src, dst, mask_format, x_src,
- y_src, 1, traps);
- return TRUE;
- }
-
- miTrapezoidBounds(ntrap, traps, &bounds);
- DEBUGF("The bounds for all traps is: bounds.x1 = %d, bounds.x2 = %d, "
- "bounds.y1 = %d, bounds.y2 = %d\n", bounds.x1, bounds.x2,
- bounds.y1, bounds.y2);
-
- /* No area need to render. */
- if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
- return TRUE;
-
- dest_pixmap = glamor_get_drawable_pixmap(dst->pDrawable);
- dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
-
- if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)
- || dest_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
- /* Currently. Always fallback to cpu if destination is in CPU memory. */
- ret = FALSE;
- DEBUGF("dst pixmap has no FBO.\n");
- goto TRAPEZOID_OUT;
- }
-
- if (src->pDrawable) {
- source_pixmap = glamor_get_drawable_pixmap(src->pDrawable);
- source_pixmap_priv = glamor_get_pixmap_private(source_pixmap);
- temp_src_priv = source_pixmap_priv;
- if (source_pixmap_priv
- && (source_pixmap_priv->type == GLAMOR_DRM_ONLY
- || source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE)) {
- ret = FALSE;
- goto TRAPEZOID_OUT;
- }
- }
-
- x_dst = bounds.x1;
- y_dst = bounds.y1;
-
- src_width = bounds.x2 - bounds.x1;
- src_height = bounds.y2 - bounds.y1;
-
- x_temp_src = x_src + bounds.x1 - (traps[0].left.p1.x >> 16);
- y_temp_src = y_src + bounds.y1 - (traps[0].left.p1.y >> 16);
-
- if ((!src->pDrawable && (src->pSourcePict->type != SourcePictTypeSolidFill)) //1. The Gradient case.
- /* 2. Has no fbo but can upload. */
- || (src->pDrawable && !GLAMOR_PIXMAP_PRIV_HAS_FBO(source_pixmap_priv)
- && ((src_width * src_height * 4 <
- source_pixmap->drawable.width * source_pixmap->drawable.height)
- || !glamor_check_fbo_size(glamor_priv,
- source_pixmap->drawable.width,
- source_pixmap->drawable.height)))) {
-
- if (!glamor_check_fbo_size(glamor_priv, src_width, src_height)) {
- ret = FALSE;
- goto TRAPEZOID_OUT;
- }
- temp_src = glamor_convert_gradient_picture(screen, src,
- x_src, y_src,
- src_width, src_height);
- if (!temp_src) {
- temp_src = src;
- ret = FALSE;
- DEBUGF("Convert gradient picture failed\n");
- goto TRAPEZOID_OUT;
- }
- temp_src_priv =
- glamor_get_pixmap_private((PixmapPtr) temp_src->pDrawable);
- x_temp_src = y_temp_src = 0;
- }
-
- x_dst += dst->pDrawable->x;
- y_dst += dst->pDrawable->y;
- if (temp_src->pDrawable) {
- x_temp_src += temp_src->pDrawable->x;
- y_temp_src += temp_src->pDrawable->y;
- }
-
- if (!miComputeCompositeRegion(&region,
- temp_src, NULL, dst,
- x_temp_src, y_temp_src,
- 0, 0, x_dst, y_dst, src_width, src_height)) {
- DEBUGF("All the regions are clipped out, do nothing\n");
- goto TRAPEZOID_OUT;
- }
-
- glamor_make_current(glamor_priv);
-
- box = REGION_RECTS(&region);
- nbox = REGION_NUM_RECTS(&region);
- pbox = box;
-
- ret = glamor_composite_choose_shader(op, temp_src, NULL, dst,
- temp_src_priv, NULL, dest_pixmap_priv,
- &key, &shader, &op_info,
- &saved_source_format);
- if (ret == FALSE) {
- DEBUGF("can not set the shader program for composite\n");
- goto TRAPEZOID_RESET_GL;
- }
- glamor_set_destination_pixmap_priv_nc(dest_pixmap_priv);
- glamor_composite_set_shader_blend(dest_pixmap_priv, &key, shader, &op_info);
- glamor_priv->has_source_coords = key.source != SHADER_SOURCE_SOLID;
- glamor_priv->has_mask_coords = (key.mask != SHADER_MASK_NONE &&
- key.mask != SHADER_MASK_SOLID);
-
- glamor_get_drawable_deltas(dst->pDrawable, dest_pixmap,
- &dest_x_off, &dest_y_off);
-
- pixmap_priv_get_dest_scale(dest_pixmap_priv, &dst_xscale, &dst_yscale);
-
- if (glamor_priv->has_source_coords) {
- source_pixmap = glamor_get_drawable_pixmap(temp_src->pDrawable);
- source_pixmap_priv = glamor_get_pixmap_private(source_pixmap);
- glamor_get_drawable_deltas(temp_src->pDrawable,
- source_pixmap, &source_x_off, &source_y_off);
- pixmap_priv_get_scale(source_pixmap_priv, &src_xscale, &src_yscale);
- glamor_picture_get_matrixf(temp_src, src_matrix);
- vert_stride += 3;
- }
-
- if (glamor_priv->has_mask_coords) {
- DEBUGF("Should never have mask coords here!\n");
- ret = FALSE;
- goto TRAPEZOID_RESET_GL;
- }
-
- /* A trapezoid clip with a rectangle will at most generate a hexagon,
- which can be devided into 4 triangles to render. */
- ntriangle_per_loop =
- (vert_stride * nbox * ntrap * 4) >
- GLAMOR_COMPOSITE_VBO_VERT_CNT ? (GLAMOR_COMPOSITE_VBO_VERT_CNT /
- vert_stride) : nbox * ntrap * 4;
- ntriangle_per_loop = (ntriangle_per_loop / 4) * 4;
-
- nclip_rect = nbox;
- while (nclip_rect) {
- float *vb;
-
- mclip_rect = (nclip_rect * ntrap * 4) > ntriangle_per_loop ?
- (ntriangle_per_loop / (4 * ntrap)) : nclip_rect;
-
- if (!mclip_rect) { /* Maybe too many traps. */
- mclip_rect = 1;
- ptrap = traps;
- traps_count = ntriangle_per_loop / 4;
- traps_not_completed = ntrap - traps_count;
- }
- else {
- traps_count = ntrap;
- ptrap = traps;
- traps_not_completed = 0;
- }
-
- NTRAPS_LOOP_AGAIN:
-
- vb = glamor_setup_composite_vbo(screen,
- (mclip_rect * traps_count *
- 4 * vert_stride));
- clip_processed = mclip_rect;
-
- while (mclip_rect--) {
- while (traps_count--) {
- int vtx_num;
- int i;
- float vertices[3 * 2], source_texcoords[3 * 2];
-
- DEBUGF
- ("In loop of render trapezoid, nclip_rect = %d, mclip_rect = %d, "
- "clip_processed = %d, traps_count = %d, traps_not_completed = %d\n",
- nclip_rect, mclip_rect, clip_processed, traps_count,
- traps_not_completed);
-
- if (_glamor_clip_trapezoid_vertex
- (ptrap, pbox, clipped_vtx, &vtx_num)) {
- for (i = 0; i < vtx_num - 2; i++) {
- int clipped_vtx_tmp[3 * 2];
-
- clipped_vtx_tmp[0] = clipped_vtx[0];
- clipped_vtx_tmp[1] = clipped_vtx[1];
- clipped_vtx_tmp[2] = clipped_vtx[(i + 1) * 2];
- clipped_vtx_tmp[3] = clipped_vtx[(i + 1) * 2 + 1];
- clipped_vtx_tmp[4] = clipped_vtx[(i + 2) * 2];
- clipped_vtx_tmp[5] = clipped_vtx[(i + 2) * 2 + 1];
- glamor_set_normalize_tri_vcoords(dst_xscale, dst_yscale,
- clipped_vtx_tmp,
- vertices);
- DEBUGF("vertices of triangle: (%f X %f), (%f X %f), "
- "(%f X %f)\n", vertices[0], vertices[1],
- vertices[2], vertices[3], vertices[4],
- vertices[5]);
-
- if (key.source != SHADER_SOURCE_SOLID) {
- if (src->transform) {
- glamor_set_transformed_normalize_tri_tcoords
- (source_pixmap_priv, src_matrix, src_xscale,
- src_yscale, clipped_vtx_tmp,
- source_texcoords);
- }
- else {
- glamor_set_normalize_tri_tcoords(src_xscale,
- src_yscale,
- clipped_vtx_tmp,
- source_texcoords);
- }
-
- DEBUGF("source_texcoords of triangle: (%f X %f), "
- "(%f X %f), (%f X %f)\n",
- source_texcoords[0], source_texcoords[1],
- source_texcoords[2], source_texcoords[3],
- source_texcoords[4], source_texcoords[5]);
- }
-
- glamor_emit_composite_triangle(screen, vb,
- source_texcoords,
- NULL, vertices);
- vb += 3 * glamor_priv->vb_stride / sizeof(float);
- }
- }
-
- ptrap++;
- }
-
- if (traps_not_completed) { /* one loop of ntraps not completed */
- mclip_rect = 1;
- traps_count = traps_not_completed > (ntriangle_per_loop / 4) ?
- (ntriangle_per_loop / 4) : traps_not_completed;
- traps_not_completed -= traps_count;
- glamor_flush_composite_triangles(screen);
- goto NTRAPS_LOOP_AGAIN;
- }
- else {
- ptrap = traps;
- traps_count = ntrap;
- }
-
- pbox++;
- }
-
- glamor_flush_composite_triangles(screen);
-
- nclip_rect -= clip_processed;
- }
-
- ret = TRUE;
-
- TRAPEZOID_RESET_GL:
- glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
- glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);
- glDisable(GL_BLEND);
-
- TRAPEZOID_OUT:
- if (box) {
- REGION_UNINIT(dst->pDrawable->pScreen, &region);
- }
-
- if (temp_src != src) {
- FreePicture(temp_src, 0);
- }
- else {
- if (saved_source_format) {
- src->format = saved_source_format;
- }
- }
-
- return ret;
-}
-
-void
-glamor_init_trapezoid_shader(ScreenPtr screen)
-{
- glamor_screen_private *glamor_priv;
- GLint fs_prog, vs_prog;
-
- const char *trapezoid_vs =
- GLAMOR_DEFAULT_PRECISION
- "attribute vec4 v_position;\n"
- "attribute vec2 v_texcoord;\n"
- /* v_top_bottom, v_left_param and v_right_param contain the
- constant value for all the vertex of one rect. Using uniform
- is more suitable but we need to reset the uniform variables
- for every rect rendering and can not use the vbo, which causes
- performance loss. So we set these attributes to same value
- for every vertex of one rect and so it is also a constant in FS */
- "attribute vec2 v_top_bottom;\n"
- "attribute vec4 v_left_param;\n"
- "attribute vec4 v_right_param;\n"
- "\n"
- "varying vec2 source_texture;\n"
- "varying float trap_top;\n"
- "varying float trap_bottom;\n"
- "varying float trap_left_x;\n"
- "varying float trap_left_y;\n"
- "varying float trap_left_slope;\n"
- "varying float trap_left_vertical_f;\n"
- "varying float trap_right_x;\n"
- "varying float trap_right_y;\n"
- "varying float trap_right_slope;\n"
- "varying float trap_right_vertical_f;\n"
- "\n"
- "void main()\n"
- "{\n"
- " gl_Position = v_position;\n"
- " source_texture = v_texcoord.xy;\n"
- " trap_top = v_top_bottom.x;\n"
- " trap_bottom = v_top_bottom.y;\n"
- " \n"
- " trap_left_x = v_left_param.x;\n"
- " trap_left_y = v_left_param.y;\n"
- " trap_left_slope = v_left_param.z;\n"
- " trap_left_vertical_f = v_left_param.w;\n"
- " \n"
- " trap_right_x = v_right_param.x;\n"
- " trap_right_y = v_right_param.y;\n"
- " trap_right_slope = v_right_param.z;\n"
- " trap_right_vertical_f = v_right_param.w;\n"
- "}\n";
-
- /*
- * Because some GL fill function do not support the MultSample
- * anti-alias, we need to do the MSAA here. This manner like
- * pixman, will caculate the value of area in trapezoid dividing
- * the totol area for each pixel, as follow:
- |
- ----+------------------------------------------------------>
- |
- | -------------
- | / \
- | / \
- | / \
- | / +----------------+
- | / |.....\ |
- | / |......\ |
- | / |.......\ |
- | / |........\ |
- | /-------------------+---------\ |
- | | |
- | | |
- | +----------------+
- |
- \|/
-
- */
- const char *trapezoid_fs =
- GLAMOR_DEFAULT_PRECISION
- "varying vec2 source_texture; \n"
- "varying float trap_top; \n"
- "varying float trap_bottom; \n"
- "varying float trap_left_x; \n"
- "varying float trap_left_y; \n"
- "varying float trap_left_slope; \n"
- "varying float trap_left_vertical_f; \n"
- "varying float trap_right_x; \n"
- "varying float trap_right_y; \n"
- "varying float trap_right_slope; \n"
- "varying float trap_right_vertical_f; \n"
- "float x_per_pix = 1.0;"
- "float y_per_pix = 1.0;"
- "\n"
- "float get_alpha_val() \n"
- "{ \n"
- " float x_up_cut_left; \n"
- " float x_bottom_cut_left; \n"
- " float x_up_cut_right; \n"
- " float x_bottom_cut_right; \n"
- " bool trap_left_vertical;\n"
- " bool trap_right_vertical;\n"
- " if (abs(trap_left_vertical_f - 1.0) <= 0.0001)\n"
- " trap_left_vertical = true;\n"
- " else\n"
- " trap_left_vertical = false;\n"
- " if (abs(trap_right_vertical_f - 1.0) <= 0.0001)\n"
- " trap_right_vertical = true;\n"
- " else\n"
- " trap_right_vertical = false;\n"
- " \n"
- " if(trap_left_vertical == true) { \n"
- " x_up_cut_left = trap_left_x; \n"
- " x_bottom_cut_left = trap_left_x; \n"
- " } else { \n"
- " x_up_cut_left = trap_left_x \n"
- " + (source_texture.y - y_per_pix/2.0 - trap_left_y) \n"
- " / trap_left_slope; \n"
- " x_bottom_cut_left = trap_left_x \n"
- " + (source_texture.y + y_per_pix/2.0 - trap_left_y) \n"
- " / trap_left_slope; \n"
- " } \n"
- " \n"
- " if(trap_right_vertical == true) { \n"
- " x_up_cut_right = trap_right_x; \n"
- " x_bottom_cut_right = trap_right_x; \n"
- " } else { \n"
- " x_up_cut_right = trap_right_x \n"
- " + (source_texture.y - y_per_pix/2.0 - trap_right_y) \n"
- " / trap_right_slope; \n"
- " x_bottom_cut_right = trap_right_x \n"
- " + (source_texture.y + y_per_pix/2.0 - trap_right_y) \n"
- " / trap_right_slope; \n"
- " } \n"
- " \n"
- " if((x_up_cut_left <= source_texture.x - x_per_pix/2.0) && \n"
- " (x_bottom_cut_left <= source_texture.x - x_per_pix/2.0) && \n"
- " (x_up_cut_right >= source_texture.x + x_per_pix/2.0) && \n"
- " (x_bottom_cut_right >= source_texture.x + x_per_pix/2.0) && \n"
- " (trap_top <= source_texture.y - y_per_pix/2.0) && \n"
- " (trap_bottom >= source_texture.y + y_per_pix/2.0)) { \n"
- // The complete inside case.
- " return 1.0; \n"
- " } else if((trap_top > source_texture.y + y_per_pix/2.0) || \n"
- " (trap_bottom < source_texture.y - y_per_pix/2.0)) { \n"
- // The complete outside. Above the top or Below the bottom.
- " return 0.0; \n"
- " } else { \n"
- " if((x_up_cut_right < source_texture.x - x_per_pix/2.0 && \n"
- " x_bottom_cut_right < source_texture.x - x_per_pix/2.0) \n"
- " || (x_up_cut_left > source_texture.x + x_per_pix/2.0 && \n"
- " x_bottom_cut_left > source_texture.x + x_per_pix/2.0)) { \n"
- // The complete outside. At Left or Right of the trapezoide.
- " return 0.0; \n"
- " } \n"
- " } \n"
- // Get here, the pix is partly inside the trapezoid.
- " { \n"
- " float percent = 0.0; \n"
- " float up = (source_texture.y - y_per_pix/2.0) >= trap_top ? \n"
- " (source_texture.y - y_per_pix/2.0) : trap_top; \n"
- " float bottom = (source_texture.y + y_per_pix/2.0) <= trap_bottom ? \n"
- " (source_texture.y + y_per_pix/2.0) : trap_bottom; \n"
- " float left = source_texture.x - x_per_pix/2.0; \n"
- " float right = source_texture.x + x_per_pix/2.0; \n"
- " \n"
- " percent = (bottom - up) / y_per_pix; \n"
- " \n"
- " if(trap_left_vertical == true) { \n"
- " if(trap_left_x > source_texture.x - x_per_pix/2.0 && \n"
- " trap_left_x < source_texture.x + x_per_pix/2.0) \n"
- " left = trap_left_x; \n"
- " } \n"
- " if(trap_right_vertical == true) { \n"
- " if(trap_right_x > source_texture.x - x_per_pix/2.0 && \n"
- " trap_right_x < source_texture.x + x_per_pix/2.0) \n"
- " right = trap_right_x; \n"
- " } \n"
- " if((up >= bottom) || (left >= right)) \n"
- " return 0.0; \n"
- " \n"
- " percent = percent * ((right - left)/x_per_pix); \n"
- " if(trap_left_vertical == true && trap_right_vertical == true) \n"
- " return percent; \n"
- " \n"
- " if(trap_left_vertical != true) { \n"
- " float area; \n"
- // the slope should never be 0.0 here
- " float up_x = trap_left_x + (up - trap_left_y)/trap_left_slope; \n"
- " float bottom_x = trap_left_x + (bottom - trap_left_y)/trap_left_slope; \n"
- " if(trap_left_slope < 0.0 && up_x > left) { \n"
- /* case 1
- |
- ----+------------------------------------->
- | /
- | /
- | +---/--------+
- | | /.........|
- | | /..........|
- | |/...........|
- | /............|
- | /|............|
- | +------------+
- |
- \|/
- */
- " float left_y = trap_left_y + trap_left_slope*(left - trap_left_x); \n"
- " if((up_x > left) && (left_y > up)) { \n"
- " area = 0.5 * (up_x - left) * (left_y - up); \n"
- " if(up_x > right) { \n"
- " float right_y = trap_left_y \n"
- " + trap_left_slope*(right - trap_left_x); \n"
- " area = area - 0.5 * (up_x - right) * (right_y - up); \n"
- " } \n"
- " if(left_y > bottom) { \n"
- " area = area - 0.5 * (bottom_x - left) * (left_y - bottom); \n"
- " } \n"
- " } else { \n"
- " area = 0.0; \n"
- " } \n"
- " percent = percent * (1.0 - (area/((right-left)*(bottom-up)))); \n"
- " } else if(trap_left_slope > 0.0 && bottom_x > left) { \n"
- /* case 2
- |
- ----+------------------------------------->
- | \
- | \
- | +\-----------+
- | | \..........|
- | | \.........|
- | | \........|
- | | \.......|
- | | \......|
- | +------\-----+
- | \
- | \
- \|/
- */
- " float right_y = trap_left_y + trap_left_slope*(right - trap_left_x); \n"
- " if((up_x < right) && (right_y > up)) { \n"
- " area = 0.5 * (right - up_x) * (right_y - up); \n"
- " if(up_x < left) { \n"
- " float left_y = trap_left_y \n"
- " + trap_left_slope*(left - trap_left_x); \n"
- " area = area - 0.5 * (left - up_x) * (left_y - up); \n"
- " } \n"
- " if(right_y > bottom) { \n"
- " area = area - 0.5 * (right - bottom_x) * (right_y - bottom); \n"
- " } \n"
- " } else { \n"
- " area = 0.0; \n"
- " } \n"
- " percent = percent * (area/((right-left)*(bottom-up))); \n"
- " } \n"
- " } \n"
- " \n"
- " if(trap_right_vertical != true) { \n"
- " float area; \n"
- // the slope should never be 0.0 here
- " float up_x = trap_right_x + (up - trap_right_y)/trap_right_slope; \n"
- " float bottom_x = trap_right_x + (bottom - trap_right_y)/trap_right_slope; \n"
- " if(trap_right_slope < 0.0 && bottom_x < right) { \n"
- /* case 3
- |
- ----+------------------------------------->
- | /
- | +--------/---+
- | |......./ |
- | |....../ |
- | |...../ |
- | |..../ |
- | |.../ |
- | +--/---------+
- | /
- |
- \|/
- */
- " float left_y = trap_right_y + trap_right_slope*(left - trap_right_x); \n"
- " if((up_x > left) && (left_y > up)) { \n"
- " area = 0.5 * (up_x - left) * (left_y - up); \n"
- " if(up_x > right) { \n"
- " float right_y = trap_right_y \n"
- " + trap_right_slope*(right - trap_right_x); \n"
- " area = area - 0.5 * (up_x - right) * (right_y - up); \n"
- " } \n"
- " if(left_y > bottom) { \n"
- " area = area - 0.5 * (bottom_x - left) * (left_y - bottom); \n"
- " } \n"
- " } else { \n"
- " area = 0.0; \n"
- " } \n"
- " percent = percent * (area/((right-left)*(bottom-up))); \n"
- " } else if(trap_right_slope > 0.0 && up_x < right) { \n"
- /* case 4
- |
- ----+------------------------------------->
- | \
- | +--------\---+
- | |.........\ |
- | |..........\ |
- | |...........\|
- | |............\
- | |............|\
- | +------------+ \
- | \
- |
- \|/
- */
- " float right_y = trap_right_y + trap_right_slope*(right - trap_right_x); \n"
- " if((up_x < right) && (right_y > up)) { \n"
- " area = 0.5 * (right - up_x) * (right_y - up); \n"
- " if(up_x < left) { \n"
- " float left_y = trap_right_y \n"
- " + trap_right_slope*(left - trap_right_x); \n"
- " area = area - 0.5 * (left - up_x) * (left_y - up); \n"
- " } \n"
- " if(right_y > bottom) { \n"
- " area = area - 0.5 * (right - bottom_x) * (right_y - bottom); \n"
- " } \n"
- " } else { \n"
- " area = 0.0; \n"
- " } \n"
- " percent = percent * (1.0 - (area/((right-left)*(bottom-up)))); \n"
- " } \n"
- " } \n"
- " \n"
- " return percent; \n"
- " } \n"
- "} \n"
- "\n"
- "void main() \n"
- "{ \n"
- " float alpha_val = get_alpha_val(); \n"
- " gl_FragColor = vec4(0.0, 0.0, 0.0, alpha_val); \n"
- "}\n";
-
- glamor_priv = glamor_get_screen_private(screen);
- glamor_make_current(glamor_priv);
-
- glamor_priv->trapezoid_prog = glCreateProgram();
-
- vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, trapezoid_vs);
- fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, trapezoid_fs);
-
- glAttachShader(glamor_priv->trapezoid_prog, vs_prog);
- glAttachShader(glamor_priv->trapezoid_prog, fs_prog);
-
- glBindAttribLocation(glamor_priv->trapezoid_prog,
- GLAMOR_VERTEX_POS, "v_positionsition");
- glBindAttribLocation(glamor_priv->trapezoid_prog,
- GLAMOR_VERTEX_SOURCE, "v_texcoord");
- glBindAttribLocation(glamor_priv->trapezoid_prog,
- GLAMOR_VERTEX_TOP_BOTTOM, "v_top_bottom");
- glBindAttribLocation(glamor_priv->trapezoid_prog,
- GLAMOR_VERTEX_LEFT_PARAM, "v_left_param");
- glBindAttribLocation(glamor_priv->trapezoid_prog,
- GLAMOR_VERTEX_RIGHT_PARAM, "v_right_param");
-
- glamor_link_glsl_prog(screen, glamor_priv->trapezoid_prog, "trapezoid");
-}
-
-void
-glamor_fini_trapezoid_shader(ScreenPtr screen)
-{
- glamor_screen_private *glamor_priv;
-
- glamor_priv = glamor_get_screen_private(screen);
- glamor_make_current(glamor_priv);
- glDeleteProgram(glamor_priv->trapezoid_prog);
-}
-
-static Bool
-_glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture,
- xTrapezoid *traps, int ntrap,
- BoxRec *bounds)
-{
- glamor_screen_private *glamor_priv;
- glamor_pixmap_private *pixmap_priv;
- PixmapPtr pixmap = NULL;
- GLint trapezoid_prog;
- GLfloat xscale, yscale;
- float left_slope, right_slope;
- xTrapezoid *ptrap;
- BoxRec one_trap_bound;
- int nrect_max;
- int i, j;
- float params[4];
-
- glamor_priv = glamor_get_screen_private(screen);
- trapezoid_prog = glamor_priv->trapezoid_prog;
-
- pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
- pixmap_priv = glamor_get_pixmap_private(pixmap);
-
- if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)
- || pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { /* should always have here. */
- DEBUGF("GLAMOR_PIXMAP_PRIV_HAS_FBO check failed, fallback\n");
- return FALSE;
- }
-
- /* First, clear all to zero */
- glamor_solid(pixmap, 0, 0, pixmap_priv->base.pixmap->drawable.width,
- pixmap_priv->base.pixmap->drawable.height, 0);
-
- glamor_make_current(glamor_priv);
-
- glamor_set_destination_pixmap_priv_nc(pixmap_priv);
-
- pixmap_priv_get_dest_scale(pixmap_priv, (&xscale), (&yscale));
-
- /* Now draw the Trapezoid mask. */
- glUseProgram(trapezoid_prog);
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE, GL_ONE);
-
- nrect_max = GLAMOR_COMPOSITE_VBO_VERT_CNT / (4 * GLAMOR_VERTEX_RIGHT_PARAM);
-
- for (i = 0; i < ntrap;) {
- float *vertices;
- int mrect;
- int stride;
-
- mrect = (ntrap - i) > nrect_max ? nrect_max : (ntrap - i);
- vertices = glamor_setup_composite_vbo_for_trapezoid(screen, 4 * mrect);
- stride = glamor_priv->vb_stride / sizeof(float);
-
- for (j = 0; j < mrect; j++) {
- ptrap = traps + i + j;
-
- DEBUGF
- ("--- The parameter of xTrapezoid is:\ntop: %d 0x%x\tbottom: %d 0x%x\n"
- "left: p1 (%d 0x%x, %d 0x%x)\tp2 (%d 0x%x, %d 0x%x)\n"
- "right: p1 (%d 0x%x, %d 0x%x)\tp2 (%d 0x%x, %d 0x%x)\n",
- xFixedToInt(ptrap->top), ptrap->top,
- xFixedToInt(ptrap->bottom), ptrap->bottom,
- xFixedToInt(ptrap->left.p1.x), ptrap->left.p1.x,
- xFixedToInt(ptrap->left.p1.y), ptrap->left.p1.y,
- xFixedToInt(ptrap->left.p2.x), ptrap->left.p2.x,
- xFixedToInt(ptrap->left.p2.y), ptrap->left.p2.y,
- xFixedToInt(ptrap->right.p1.x), ptrap->right.p1.x,
- xFixedToInt(ptrap->right.p1.y), ptrap->right.p1.y,
- xFixedToInt(ptrap->right.p2.x), ptrap->right.p2.x,
- xFixedToInt(ptrap->right.p2.y), ptrap->right.p2.y);
-
- miTrapezoidBounds(1, ptrap, &one_trap_bound);
-
- vertices += 2;
- glamor_set_tcoords_ext((one_trap_bound.x1), (one_trap_bound.y1),
- (one_trap_bound.x2), (one_trap_bound.y2),
- vertices, stride);
- DEBUGF("tex_vertices --> leftup : %f X %f, rightup: %f X %f,"
- "rightbottom: %f X %f, leftbottom : %f X %f\n", vertices[0],
- vertices[1], vertices[1 * stride], vertices[1 * stride + 1],
- vertices[2 * stride], vertices[2 * stride + 1],
- vertices[3 * stride], vertices[3 * stride + 1]);
-
- /* Need to rebase. */
- one_trap_bound.x1 -= bounds->x1;
- one_trap_bound.x2 -= bounds->x1;
- one_trap_bound.y1 -= bounds->y1;
- one_trap_bound.y2 -= bounds->y1;
-
- vertices -= 2;
-
- glamor_set_normalize_vcoords_ext(pixmap_priv, xscale, yscale,
- one_trap_bound.x1,
- one_trap_bound.y1,
- one_trap_bound.x2,
- one_trap_bound.y2,
- vertices, stride);
- DEBUGF("vertices --> leftup : %f X %f, rightup: %f X %f,"
- "rightbottom: %f X %f, leftbottom : %f X %f\n", vertices[0],
- vertices[1], vertices[1 * stride], vertices[1 * stride + 1],
- vertices[2 * stride], vertices[2 * stride + 1],
- vertices[3 * stride], vertices[3 * stride + 1]);
- vertices += 4;
-
- /* Set the top and bottom. */
- params[0] = ((float) ptrap->top) / 65536;
- params[1] = ((float) ptrap->bottom) / 65536;
- glamor_set_const_ext(params, 2, vertices, 4, stride);
- vertices += 2;
-
- /* Set the left params. */
- params[0] = ((float) ptrap->left.p1.x) / 65536;
- params[1] = ((float) ptrap->left.p1.y) / 65536;
-
- if (ptrap->left.p1.x == ptrap->left.p2.x) {
- left_slope = 0.0;
- params[3] = 1.0;
- }
- else {
- left_slope = ((float) (ptrap->left.p1.y - ptrap->left.p2.y))
- / ((float) (ptrap->left.p1.x - ptrap->left.p2.x));
- params[3] = 0.0;
- }
- params[2] = left_slope;
- glamor_set_const_ext(params, 4, vertices, 4, stride);
- vertices += 4;
-
- /* Set the left params. */
- params[0] = ((float) ptrap->right.p1.x) / 65536;
- params[1] = ((float) ptrap->right.p1.y) / 65536;
-
- if (ptrap->right.p1.x == ptrap->right.p2.x) {
- right_slope = 0.0;
- params[3] = 1.0;
- }
- else {
- right_slope = ((float) (ptrap->right.p1.y - ptrap->right.p2.y))
- / ((float) (ptrap->right.p1.x - ptrap->right.p2.x));
- params[3] = 0.0;
- }
- params[2] = right_slope;
- glamor_set_const_ext(params, 4, vertices, 4, stride);
- vertices += 4;
-
- DEBUGF("trap_top = %f, trap_bottom = %f, "
- "trap_left_x = %f, trap_left_y = %f, left_slope = %f, "
- "trap_right_x = %f, trap_right_y = %f, right_slope = %f\n",
- ((float) ptrap->top) / 65536,
- ((float) ptrap->bottom) / 65536,
- ((float) ptrap->left.p1.x) / 65536,
- ((float) ptrap->left.p1.y) / 65536, left_slope,
- ((float) ptrap->right.p1.x) / 65536,
- ((float) ptrap->right.p1.y) / 65536, right_slope);
-
- glamor_priv->render_nr_verts += 4;
- vertices += 3 * stride;
- }
-
- i += mrect;
-
- glamor_put_vbo_space(screen);
-
- /* Now rendering. */
- if (!glamor_priv->render_nr_verts)
- continue;
-
- if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
- glDrawRangeElements(GL_TRIANGLES, 0,
- glamor_priv->render_nr_verts,
- (glamor_priv->render_nr_verts * 3) / 2,
- GL_UNSIGNED_SHORT, NULL);
- } else {
- glDrawElements(GL_TRIANGLES,
- (glamor_priv->render_nr_verts * 3) / 2,
- GL_UNSIGNED_SHORT, NULL);
- }
- }
-
- glBlendFunc(GL_ONE, GL_ZERO);
- glDisable(GL_BLEND);
- glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
- glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glDisableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM);
- glDisableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM);
- glDisableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM);
- return TRUE;
-}
-
-#endif /*GLAMOR_TRAPEZOID_SHADER */
-
/**
* Creates an appropriate picture for temp mask use.
*/
@@ -1559,7 +43,7 @@ static PicturePtr
glamor_create_mask_picture(ScreenPtr screen,
PicturePtr dst,
PictFormatPtr pict_format,
- CARD16 width, CARD16 height, int gpu)
+ CARD16 width, CARD16 height)
{
PixmapPtr pixmap;
PicturePtr picture;
@@ -1574,15 +58,9 @@ glamor_create_mask_picture(ScreenPtr screen,
return 0;
}
- if (gpu) {
- pixmap = glamor_create_pixmap(screen, width, height,
- pict_format->depth, 0);
- }
- else {
- pixmap = glamor_create_pixmap(screen, 0, 0,
- pict_format->depth,
- GLAMOR_CREATE_PIXMAP_CPU);
- }
+ pixmap = glamor_create_pixmap(screen, 0, 0,
+ pict_format->depth,
+ GLAMOR_CREATE_PIXMAP_CPU);
if (!pixmap)
return 0;
@@ -1592,61 +70,15 @@ glamor_create_mask_picture(ScreenPtr screen,
return picture;
}
-static int
-_glamor_trapezoid_bounds(int ntrap, xTrapezoid *traps, BoxPtr box)
-{
- int has_large_trapezoid = 0;
-
- box->y1 = MAXSHORT;
- box->y2 = MINSHORT;
- box->x1 = MAXSHORT;
- box->x2 = MINSHORT;
-
- for (; ntrap; ntrap--, traps++) {
- INT16 x1, y1, x2, y2;
-
- if (!xTrapezoidValid(traps))
- continue;
- y1 = xFixedToInt(traps->top);
- if (y1 < box->y1)
- box->y1 = y1;
-
- y2 = xFixedToInt(xFixedCeil(traps->bottom));
- if (y2 > box->y2)
- box->y2 = y2;
-
- x1 = xFixedToInt(min
- (_glamor_linefixedX(&traps->left, traps->top, FALSE),
- _glamor_linefixedX(&traps->left, traps->bottom,
- FALSE)));
- if (x1 < box->x1)
- box->x1 = x1;
-
- x2 = xFixedToInt(xFixedCeil
- (max
- (_glamor_linefixedX(&traps->right, traps->top, TRUE),
- _glamor_linefixedX(&traps->right, traps->bottom,
- TRUE))));
- if (x2 > box->x2)
- box->x2 = x2;
-
- if (!has_large_trapezoid && (x2 - x1) > 256 && (y2 - y1) > 32)
- has_large_trapezoid = 1;
- }
-
- return has_large_trapezoid;
-}
-
/**
- * glamor_trapezoids will first try to create a trapezoid mask using shader,
- * if failed, miTrapezoids will generate trapezoid mask accumulating in
+ * glamor_trapezoids will generate trapezoid mask accumulating in
* system memory.
*/
-static Bool
-_glamor_trapezoids(CARD8 op,
- PicturePtr src, PicturePtr dst,
- PictFormatPtr mask_format, INT16 x_src, INT16 y_src,
- int ntrap, xTrapezoid *traps, Bool fallback)
+void
+glamor_trapezoids(CARD8 op,
+ PicturePtr src, PicturePtr dst,
+ PictFormatPtr mask_format, INT16 x_src, INT16 y_src,
+ int ntrap, xTrapezoid *traps)
{
ScreenPtr screen = dst->pDrawable->pScreen;
BoxRec bounds;
@@ -1656,8 +88,6 @@ _glamor_trapezoids(CARD8 op,
int width, height, stride;
PixmapPtr pixmap;
pixman_image_t *image = NULL;
- int ret = 0;
- int has_large_trapezoid;
/* If a mask format wasn't provided, we get to choose, but behavior should
* be as if there was no temporary mask the traps were accumulated into.
@@ -1670,16 +100,13 @@ _glamor_trapezoids(CARD8 op,
for (; ntrap; ntrap--, traps++)
glamor_trapezoids(op, src, dst, mask_format, x_src,
y_src, 1, traps);
- return TRUE;
+ return;
}
- has_large_trapezoid = _glamor_trapezoid_bounds(ntrap, traps, &bounds);
- DEBUGF("The bounds for all traps is: bounds.x1 = %d, bounds.x2 = %d, "
- "bounds.y1 = %d, bounds.y2 = %d, ---- ntrap = %d\n", bounds.x1,
- bounds.x2, bounds.y1, bounds.y2, ntrap);
+ miTrapezoidBounds(ntrap, traps, &bounds);
if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
- return TRUE;
+ return;
x_dst = traps[0].left.p1.x >> 16;
y_dst = traps[0].left.p1.y >> 16;
@@ -1688,85 +115,34 @@ _glamor_trapezoids(CARD8 op,
height = bounds.y2 - bounds.y1;
stride = PixmapBytePad(width, mask_format->depth);
-#ifdef GLAMOR_TRAPEZOID_SHADER
- /* We seperate the render to two paths.
- Some GL implemetation do not implement the Anti-Alias for triangles
- and polygen's filling. So when the edge is not vertical or horizontal,
- sawtooth will be obvious. The trapezoid is widely used to render wide
- lines and circles. In these case, the line or circle will be divided
- into a large number of small trapezoids to approximate it, so the sawtooth
- at the edge will cause the result not be acceptable.
- When the depth of the mask is 1, there is no Anti-Alias needed, so we
- use the clip logic to generate the result directly(fast path).
- When the depth is not 1, AA is needed and we use a shader to generate
- a temp mask pixmap.
- */
- if (mask_format->depth == 1) {
- ret = _glamor_trapezoids_with_shader(op, src, dst, mask_format,
- x_src, y_src, ntrap, traps);
- if (ret)
- return TRUE;
- }
- else {
- if (has_large_trapezoid || ntrap > 256) {
- /* The shader speed is relative slower than pixman when generating big chunk
- trapezoid mask. We fallback to pixman to improve the performance. */
- ;
- }
- else if (dst->polyMode == PolyModeImprecise) {
- /* The precise mode is that we sample the trapezoid on the centre points of
- an (2*n+1)x(2*n-1) subpixel grid. It is computationally expensive in shader
- and we use inside area ratio to replace it if the polymode == Imprecise. */
- picture = glamor_create_mask_picture(screen, dst, mask_format,
- width, height, 1);
- if (!picture)
- return TRUE;
-
- ret =
- _glamor_generate_trapezoid_with_shader(screen, picture, traps,
- ntrap, &bounds);
+ picture = glamor_create_mask_picture(screen, dst, mask_format,
+ width, height);
+ if (!picture)
+ return;
- if (!ret)
- FreePicture(picture, 0);
- }
+ image = pixman_image_create_bits(picture->format,
+ width, height, NULL, stride);
+ if (!image) {
+ FreePicture(picture, 0);
+ return;
}
-#endif
- if (!ret) {
- DEBUGF("Fallback to sw rasterize of trapezoid\n");
+ for (; ntrap; ntrap--, traps++)
+ pixman_rasterize_trapezoid(image,
+ (pixman_trapezoid_t *) traps,
+ -bounds.x1, -bounds.y1);
- picture = glamor_create_mask_picture(screen, dst, mask_format,
- width, height, 0);
- if (!picture)
- return TRUE;
-
- image = pixman_image_create_bits(picture->format,
- width, height, NULL, stride);
- if (!image) {
- FreePicture(picture, 0);
- return TRUE;
- }
-
- for (; ntrap; ntrap--, traps++)
- pixman_rasterize_trapezoid(image,
- (pixman_trapezoid_t *) traps,
- -bounds.x1, -bounds.y1);
+ pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
- pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
-
- screen->ModifyPixmapHeader(pixmap, width, height,
- mask_format->depth,
- BitsPerPixel(mask_format->depth),
- PixmapBytePad(width,
- mask_format->depth),
- pixman_image_get_data(image));
- }
+ screen->ModifyPixmapHeader(pixmap, width, height,
+ mask_format->depth,
+ BitsPerPixel(mask_format->depth),
+ PixmapBytePad(width,
+ mask_format->depth),
+ pixman_image_get_data(image));
x_rel = bounds.x1 + x_src - x_dst;
y_rel = bounds.y1 + y_src - y_dst;
- DEBUGF("x_src = %d, y_src = %d, x_dst = %d, y_dst = %d, "
- "x_rel = %d, y_rel = %d\n", x_src, y_src, x_dst,
- y_dst, x_rel, y_rel);
CompositePicture(op, src, picture, dst,
x_rel, y_rel,
@@ -1778,19 +154,6 @@ _glamor_trapezoids(CARD8 op,
pixman_image_unref(image);
FreePicture(picture, 0);
- return TRUE;
-}
-
-void
-glamor_trapezoids(CARD8 op,
- PicturePtr src, PicturePtr dst,
- PictFormatPtr mask_format, INT16 x_src, INT16 y_src,
- int ntrap, xTrapezoid *traps)
-{
- DEBUGF("x_src = %d, y_src = %d, ntrap = %d\n", x_src, y_src, ntrap);
-
- _glamor_trapezoids(op, src, dst, mask_format, x_src,
- y_src, ntrap, traps, TRUE);
}
Bool
@@ -1801,8 +164,9 @@ glamor_trapezoids_nf(CARD8 op,
{
DEBUGF("x_src = %d, y_src = %d, ntrap = %d\n", x_src, y_src, ntrap);
- return _glamor_trapezoids(op, src, dst, mask_format, x_src,
- y_src, ntrap, traps, FALSE);
+ glamor_trapezoids(op, src, dst, mask_format, x_src,
+ y_src, ntrap, traps);
+ return TRUE;
}
#endif /* RENDER */
diff --git a/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c
index 2fc3f4cc8..d11c66798 100644
--- a/xorg-server/glx/glxcmds.c
+++ b/xorg-server/glx/glxcmds.c
@@ -2508,13 +2508,16 @@ __glXsendSwapEvent(__GLXdrawable *drawable, int type, CARD64 ust,
#if PRESENT
static void
-__glXpresentCompleteNotify(WindowPtr window, CARD8 present_mode, CARD32 serial,
- uint64_t ust, uint64_t msc)
+__glXpresentCompleteNotify(WindowPtr window, CARD8 present_kind, CARD8 present_mode,
+ CARD32 serial, uint64_t ust, uint64_t msc)
{
__GLXdrawable *drawable;
int glx_type;
int rc;
+ if (present_kind != PresentCompleteKindPixmap)
+ return;
+
rc = dixLookupResourceByType((void **) &drawable, window->drawable.id,
__glXDrawableRes, serverClient, DixGetAttrAccess);
diff --git a/xorg-server/glx/glxdriswrast.c b/xorg-server/glx/glxdriswrast.c
index c30ce9aed..5d9aa0437 100644
--- a/xorg-server/glx/glxdriswrast.c
+++ b/xorg-server/glx/glxdriswrast.c
@@ -325,7 +325,7 @@ swrastGetDrawableInfo(__DRIdrawable * draw,
DrawablePtr pDraw = drawable->base.pDraw;
*x = pDraw->x;
- *y = pDraw->x;
+ *y = pDraw->y;
*w = pDraw->width;
*h = pDraw->height;
}
diff --git a/xorg-server/hw/kdrive/ephyr/Makefile.am b/xorg-server/hw/kdrive/ephyr/Makefile.am
index 10c59174f..155e11eb3 100644
--- a/xorg-server/hw/kdrive/ephyr/Makefile.am
+++ b/xorg-server/hw/kdrive/ephyr/Makefile.am
@@ -68,6 +68,7 @@ Xephyr_SOURCES = \
ephyr_draw.c \
os.c \
ephyrinit.c \
+ ephyrcursor.c \
hostx.c \
hostx.h \
$(XV_SRCS) \
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.h b/xorg-server/hw/kdrive/ephyr/ephyr.h
index 4e753f158..f3a3c8e7d 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyr.h
+++ b/xorg-server/hw/kdrive/ephyr/ephyr.h
@@ -197,8 +197,6 @@ extern KdOsFuncs EphyrOsFuncs;
extern Bool ephyrCursorInit(ScreenPtr pScreen);
-extern void ephyrCursorEnable(ScreenPtr pScreen);
-
extern int ephyrBufferHeight(KdScreenInfo * screen);
/* ephyr_draw.c */
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrcursor.c b/xorg-server/hw/kdrive/ephyr/ephyrcursor.c
new file mode 100644
index 000000000..852be33e0
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrcursor.c
@@ -0,0 +1,262 @@
+/*
+ * Copyright © 2014 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Author:
+ * Adam Jackson <ajax@redhat.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "ephyr.h"
+#include "ephyrlog.h"
+#include "hostx.h"
+#include "cursorstr.h"
+#include <xcb/render.h>
+#include <xcb/xcb_renderutil.h>
+
+static DevPrivateKeyRec ephyrCursorPrivateKey;
+
+typedef struct _ephyrCursor {
+ xcb_cursor_t cursor;
+} ephyrCursorRec, *ephyrCursorPtr;
+
+static ephyrCursorPtr
+ephyrGetCursor(CursorPtr cursor)
+{
+ return dixGetPrivateAddr(&cursor->devPrivates, &ephyrCursorPrivateKey);
+}
+
+static void
+ephyrRealizeCoreCursor(EphyrScrPriv *scr, CursorPtr cursor)
+{
+ ephyrCursorPtr hw = ephyrGetCursor(cursor);
+ xcb_connection_t *conn = hostx_get_xcbconn();
+ xcb_pixmap_t source, mask;
+ xcb_image_t *image;
+ xcb_gcontext_t gc;
+ int w = cursor->bits->width, h = cursor->bits->height;
+ uint32_t gcmask = XCB_GC_FUNCTION |
+ XCB_GC_PLANE_MASK |
+ XCB_GC_FOREGROUND |
+ XCB_GC_BACKGROUND |
+ XCB_GC_CLIP_MASK;
+ uint32_t val[] = {
+ XCB_GX_COPY, /* function */
+ ~0, /* planemask */
+ 1L, /* foreground */
+ 0L, /* background */
+ None, /* clipmask */
+ };
+
+ source = xcb_generate_id(conn);
+ mask = xcb_generate_id(conn);
+ xcb_create_pixmap(conn, 1, source, scr->win, w, h);
+ xcb_create_pixmap(conn, 1, mask, scr->win, w, h);
+
+ gc = xcb_generate_id(conn);
+ xcb_create_gc(conn, gc, source, gcmask, val);
+
+ image = xcb_image_create_native(conn, w, h, XCB_IMAGE_FORMAT_XY_BITMAP,
+ 1, NULL, ~0, NULL);
+ image->data = cursor->bits->source;
+ xcb_image_put(conn, source, gc, image, 0, 0, 0);
+ xcb_image_destroy(image);
+
+ image = xcb_image_create_native(conn, w, h, XCB_IMAGE_FORMAT_XY_BITMAP,
+ 1, NULL, ~0, NULL);
+ image->data = cursor->bits->mask;
+ xcb_image_put(conn, mask, gc, image, 0, 0, 0);
+ xcb_image_destroy(image);
+
+ xcb_free_gc(conn, gc);
+
+ hw->cursor = xcb_generate_id(conn);
+ xcb_create_cursor(conn, hw->cursor, source, mask,
+ cursor->foreRed, cursor->foreGreen, cursor->foreBlue,
+ cursor->backRed, cursor->backGreen, cursor->backBlue,
+ cursor->bits->xhot, cursor->bits->yhot);
+
+ xcb_free_pixmap(conn, source);
+ xcb_free_pixmap(conn, mask);
+}
+
+#ifdef ARGB_CURSOR
+static xcb_render_pictformat_t
+get_argb_format(void)
+{
+ static xcb_render_pictformat_t format;
+ if (format == None) {
+ xcb_connection_t *conn = hostx_get_xcbconn();
+ xcb_render_query_pict_formats_cookie_t cookie;
+ xcb_render_query_pict_formats_reply_t *formats;
+
+ cookie = xcb_render_query_pict_formats(conn);
+ formats =
+ xcb_render_query_pict_formats_reply(conn, cookie, NULL);
+
+ format =
+ xcb_render_util_find_standard_format(formats,
+ XCB_PICT_STANDARD_ARGB_32)->id;
+
+ free(formats);
+ }
+
+ return format;
+}
+
+static void
+ephyrRealizeARGBCursor(EphyrScrPriv *scr, CursorPtr cursor)
+{
+ ephyrCursorPtr hw = ephyrGetCursor(cursor);
+ xcb_connection_t *conn = hostx_get_xcbconn();
+ xcb_gcontext_t gc;
+ xcb_pixmap_t source;
+ xcb_render_picture_t picture;
+ xcb_image_t *image;
+ int w = cursor->bits->width, h = cursor->bits->height;
+
+ /* dix' storage is PICT_a8r8g8b8 */
+ source = xcb_generate_id(conn);
+ xcb_create_pixmap(conn, 32, source, scr->win, w, h);
+
+ gc = xcb_generate_id(conn);
+ xcb_create_gc(conn, gc, source, 0, NULL);
+ image = xcb_image_create_native(conn, w, h, XCB_IMAGE_FORMAT_Z_PIXMAP,
+ 32, NULL, ~0, NULL);
+ image->data = (void *)cursor->bits->argb;
+ xcb_image_put(conn, source, gc, image, 0, 0, 0);
+ xcb_free_gc(conn, gc);
+ xcb_image_destroy(image);
+
+ picture = xcb_generate_id(conn);
+ xcb_render_create_picture(conn, picture, source, get_argb_format(),
+ 0, NULL);
+ xcb_free_pixmap(conn, source);
+
+ hw->cursor = xcb_generate_id(conn);
+ xcb_render_create_cursor(conn, hw->cursor, picture,
+ cursor->bits->xhot, cursor->bits->yhot);
+
+ xcb_render_free_picture(conn, picture);
+}
+
+static Bool
+can_argb_cursor(void)
+{
+ static const xcb_render_query_version_reply_t *v;
+
+ if (!v)
+ v = xcb_render_util_query_version(hostx_get_xcbconn());
+
+ return v->major_version == 0 && v->minor_version >= 5;
+}
+#endif
+
+static Bool
+ephyrRealizeCursor(DeviceIntPtr dev, ScreenPtr screen, CursorPtr cursor)
+{
+ KdScreenPriv(screen);
+ KdScreenInfo *kscr = pScreenPriv->screen;
+ EphyrScrPriv *scr = kscr->driver;
+
+#ifdef ARGB_CURSOR
+ if (cursor->bits->argb && can_argb_cursor())
+ ephyrRealizeARGBCursor(scr, cursor);
+ else
+#endif
+ {
+ ephyrRealizeCoreCursor(scr, cursor);
+ }
+ return TRUE;
+}
+
+static Bool
+ephyrUnrealizeCursor(DeviceIntPtr dev, ScreenPtr screen, CursorPtr cursor)
+{
+ ephyrCursorPtr hw = ephyrGetCursor(cursor);
+
+ if (hw->cursor) {
+ xcb_free_cursor(hostx_get_xcbconn(), hw->cursor);
+ hw->cursor = None;
+ }
+
+ return TRUE;
+}
+
+static void
+ephyrSetCursor(DeviceIntPtr dev, ScreenPtr screen, CursorPtr cursor, int x,
+ int y)
+{
+ KdScreenPriv(screen);
+ KdScreenInfo *kscr = pScreenPriv->screen;
+ EphyrScrPriv *scr = kscr->driver;
+ uint32_t attr = None;
+
+ if (cursor)
+ attr = ephyrGetCursor(cursor)->cursor;
+ else
+ attr = hostx_get_empty_cursor();
+
+ xcb_change_window_attributes(hostx_get_xcbconn(), scr->win,
+ XCB_CW_CURSOR, &attr);
+ xcb_flush(hostx_get_xcbconn());
+}
+
+static void
+ephyrMoveCursor(DeviceIntPtr dev, ScreenPtr screen, int x, int y)
+{
+}
+
+static Bool
+ephyrDeviceCursorInitialize(DeviceIntPtr dev, ScreenPtr screen)
+{
+ return TRUE;
+}
+
+static void
+ephyrDeviceCursorCleanup(DeviceIntPtr dev, ScreenPtr screen)
+{
+}
+
+miPointerSpriteFuncRec EphyrPointerSpriteFuncs = {
+ ephyrRealizeCursor,
+ ephyrUnrealizeCursor,
+ ephyrSetCursor,
+ ephyrMoveCursor,
+ ephyrDeviceCursorInitialize,
+ ephyrDeviceCursorCleanup
+};
+
+Bool
+ephyrCursorInit(ScreenPtr screen)
+{
+ if (!dixRegisterPrivateKey(&ephyrCursorPrivateKey, PRIVATE_CURSOR_BITS,
+ sizeof(ephyrCursorRec)))
+ return FALSE;
+
+ miPointerInitialize(screen,
+ &EphyrPointerSpriteFuncs,
+ &ephyrPointerScreenFuncs, FALSE);
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrinit.c b/xorg-server/hw/kdrive/ephyr/ephyrinit.c
index 38acc52a6..36935318a 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrinit.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrinit.c
@@ -369,77 +369,12 @@ OsVendorInit(void)
{
EPHYR_DBG("mark");
- if (hostx_want_host_cursor()) {
+ if (hostx_want_host_cursor())
ephyrFuncs.initCursor = &ephyrCursorInit;
- ephyrFuncs.enableCursor = &ephyrCursorEnable;
- }
KdOsInit(&EphyrOsFuncs);
}
-/* 'Fake' cursor stuff, could be improved */
-
-static Bool
-ephyrRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
-{
- return TRUE;
-}
-
-static Bool
-ephyrUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
-{
- return TRUE;
-}
-
-static void
-ephyrSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x,
- int y)
-{
- ;
-}
-
-static void
-ephyrMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
-{
- ;
-}
-
-static Bool
-ephyrDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
-{
- return TRUE;
-}
-
-static void
-ephyrDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
-{
-}
-
-miPointerSpriteFuncRec EphyrPointerSpriteFuncs = {
- ephyrRealizeCursor,
- ephyrUnrealizeCursor,
- ephyrSetCursor,
- ephyrMoveCursor,
- ephyrDeviceCursorInitialize,
- ephyrDeviceCursorCleanup
-};
-
-Bool
-ephyrCursorInit(ScreenPtr pScreen)
-{
- miPointerInitialize(pScreen,
- &EphyrPointerSpriteFuncs,
- &ephyrPointerScreenFuncs, FALSE);
-
- return TRUE;
-}
-
-void
-ephyrCursorEnable(ScreenPtr pScreen)
-{
- ;
-}
-
KdCardFuncs ephyrFuncs = {
ephyrCardInit, /* cardinit */
ephyrScreenInitialize, /* scrinit */
diff --git a/xorg-server/hw/kdrive/ephyr/hostx.c b/xorg-server/hw/kdrive/ephyr/hostx.c
index 2161ad550..056262523 100644
--- a/xorg-server/hw/kdrive/ephyr/hostx.c
+++ b/xorg-server/hw/kdrive/ephyr/hostx.c
@@ -71,6 +71,8 @@ struct EphyrHostXVars {
xcb_visualtype_t *visual;
Window winroot;
xcb_gcontext_t gc;
+ xcb_render_pictformat_t argb_format;
+ xcb_cursor_t empty_cursor;
int depth;
Bool use_sw_cursor;
Bool use_fullscreen;
@@ -202,6 +204,12 @@ hostx_use_sw_cursor(void)
HostX.use_sw_cursor = TRUE;
}
+xcb_cursor_t
+hostx_get_empty_cursor(void)
+{
+ return HostX.empty_cursor;
+}
+
int
hostx_want_preexisting_window(KdScreenInfo *screen)
{
@@ -408,8 +416,8 @@ hostx_init(void)
{
uint32_t attrs[2];
uint32_t attr_mask = 0;
- xcb_cursor_t empty_cursor;
xcb_pixmap_t cursor_pxm;
+ xcb_gcontext_t cursor_gc;
uint16_t red, green, blue;
uint32_t pixel;
int index;
@@ -418,6 +426,7 @@ hostx_init(void)
size_t class_len;
const xcb_query_extension_reply_t *shm_rep;
xcb_screen_t *xscreen;
+ xcb_rectangle_t rect = { 0, 0, 1, 1 };
attrs[0] =
XCB_EVENT_MASK_BUTTON_PRESS
@@ -594,18 +603,25 @@ hostx_init(void)
xcb_change_gc(HostX.conn, HostX.gc, XCB_GC_FOREGROUND, &pixel);
+ cursor_pxm = xcb_generate_id(HostX.conn);
+ xcb_create_pixmap(HostX.conn, 1, cursor_pxm, HostX.winroot, 1, 1);
+ cursor_gc = xcb_generate_id(HostX.conn);
+ pixel = 0;
+ xcb_create_gc(HostX.conn, cursor_gc, cursor_pxm,
+ XCB_GC_FOREGROUND, &pixel);
+ xcb_poly_fill_rectangle(HostX.conn, cursor_pxm, cursor_gc, 1, &rect);
+ xcb_free_gc(HostX.conn, cursor_gc);
+ HostX.empty_cursor = xcb_generate_id(HostX.conn);
+ xcb_create_cursor(HostX.conn,
+ HostX.empty_cursor,
+ cursor_pxm, cursor_pxm,
+ 0,0,0,
+ 0,0,0,
+ 1,1);
+ xcb_free_pixmap(HostX.conn, cursor_pxm);
if (!hostx_want_host_cursor ()) {
CursorVisible = TRUE;
/* Ditch the cursor, we provide our 'own' */
- cursor_pxm = xcb_generate_id(HostX.conn);
- xcb_create_pixmap(HostX.conn, 1, cursor_pxm, HostX.winroot, 1, 1);
- empty_cursor = xcb_generate_id(HostX.conn);
- xcb_create_cursor(HostX.conn,
- empty_cursor,
- cursor_pxm, cursor_pxm,
- 0,0,0,
- 0,0,0,
- 1,1);
for (index = 0; index < HostX.n_screens; index++) {
KdScreenInfo *screen = HostX.screens[index];
EphyrScrPriv *scrpriv = screen->driver;
@@ -613,9 +629,8 @@ hostx_init(void)
xcb_change_window_attributes(HostX.conn,
scrpriv->win,
XCB_CW_CURSOR,
- &empty_cursor);
+ &HostX.empty_cursor);
}
- xcb_free_pixmap(HostX.conn, cursor_pxm);
}
/* Try to get share memory ximages for a little bit more speed */
diff --git a/xorg-server/hw/kdrive/ephyr/hostx.h b/xorg-server/hw/kdrive/ephyr/hostx.h
index 80894c8c0..229961e50 100644
--- a/xorg-server/hw/kdrive/ephyr/hostx.h
+++ b/xorg-server/hw/kdrive/ephyr/hostx.h
@@ -29,6 +29,7 @@
#include <X11/X.h>
#include <X11/Xmd.h>
#include <xcb/xcb.h>
+#include <xcb/render.h>
#include "ephyr.h"
#define EPHYR_WANT_DEBUG 0
@@ -82,6 +83,9 @@ int
void
hostx_use_sw_cursor(void);
+xcb_cursor_t
+ hostx_get_empty_cursor(void);
+
void
hostx_get_output_geometry(const char *output,
int *x, int *y,
diff --git a/xorg-server/hw/xfree86/Makefile.am b/xorg-server/hw/xfree86/Makefile.am
index c5992c372..30f7c8ffd 100644
--- a/xorg-server/hw/xfree86/Makefile.am
+++ b/xorg-server/hw/xfree86/Makefile.am
@@ -38,7 +38,7 @@ SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \
ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) \
$(DRI2_SUBDIR) . $(VBE_SUBDIR) i2c dixmods \
fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man \
- $(GLAMOR_EGL_SUBDIR)
+ $(GLAMOR_EGL_SUBDIR) drivers
DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \
parser ramdac shadowfb vbe vgahw \
diff --git a/xorg-server/hw/xfree86/doc/README.DRIcomp b/xorg-server/hw/xfree86/doc/README.DRIcomp
index 2d3ebf148..73886504f 100644
--- a/xorg-server/hw/xfree86/doc/README.DRIcomp
+++ b/xorg-server/hw/xfree86/doc/README.DRIcomp
@@ -142,9 +142,6 @@ Here are the basic steps for kernel setup.
o Enable all chipsets' support for AGP
- o It's recommended that you turn on MTRRs under Processor type and
- Features, but not required.
-
o Configure the rest of the kernel as required for your system (i.e. Eth-
ernet, SCSI, etc)
diff --git a/xorg-server/hw/xfree86/doc/Registry b/xorg-server/hw/xfree86/doc/Registry
index 48e24a2f4..ad5b9bffb 100644
--- a/xorg-server/hw/xfree86/doc/Registry
+++ b/xorg-server/hw/xfree86/doc/Registry
@@ -231,7 +231,6 @@ DDC B C Enable/disable DDC
DDC1 B C Enable/disable DDC1
DDC2 B C Enable/disable DDC2
DPMS O C Enable DPMS
-MTRR B C Enable/disable setting MTRRs
BaudRate I I Serial port baud rate
ButtonNumber I I Button number (for touch screen?)
diff --git a/xorg-server/hw/xfree86/drivers/Makefile.am b/xorg-server/hw/xfree86/drivers/Makefile.am
new file mode 100644
index 000000000..04d787f52
--- /dev/null
+++ b/xorg-server/hw/xfree86/drivers/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS =
+
+if XORG_DRIVER_MODESETTING
+SUBDIRS += modesetting
+endif
diff --git a/xorg-server/hw/xfree86/drivers/modesetting/Makefile.am b/xorg-server/hw/xfree86/drivers/modesetting/Makefile.am
new file mode 100644
index 000000000..ca3279e23
--- /dev/null
+++ b/xorg-server/hw/xfree86/drivers/modesetting/Makefile.am
@@ -0,0 +1,61 @@
+# Copyright 2005 Adam Jackson.
+#
+# 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
+# on 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
+# ADAM JACKSON 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.
+
+# this is obnoxious:
+# -module lets us name the module exactly how we want
+# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
+# _ladir passes a dummy rpath to libtool so the thing will actually link
+# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(LIBDRM_CFLAGS) $(UDEV_CFLAGS) $(CWARNFLAGS)
+
+AM_CPPFLAGS = \
+ $(XORG_INCS) \
+ -I$(srcdir)/../../ddc \
+ -I$(srcdir)/../../i2c \
+ -I$(srcdir)/../../modes \
+ -I$(srcdir)/../../parser \
+ -I$(srcdir)/../../ramdac \
+ $(NULL)
+
+modesetting_drv_la_LTLIBRARIES = modesetting_drv.la
+modesetting_drv_la_LDFLAGS = -module -avoid-version
+modesetting_drv_la_LIBADD = $(UDEV_LIBS) $(DRM_LIBS)
+modesetting_drv_ladir = @moduledir@/drivers
+
+modesetting_drv_la_SOURCES = \
+ driver.c \
+ driver.h \
+ drmmode_display.c \
+ drmmode_display.h
+
+drivermandir = $(DRIVER_MAN_DIR)
+driverman_PRE = modesetting.man
+driverman_DATA = $(driverman_PRE:man=@DRIVER_MAN_SUFFIX@)
+
+EXTRA_DIST = modesetting.man
+
+CLEANFILES = $(driverman_DATA)
+
+# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
+
+.man.$(DRIVER_MAN_SUFFIX):
+ $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/xorg-server/hw/xfree86/drivers/modesetting/driver.c b/xorg-server/hw/xfree86/drivers/modesetting/driver.c
new file mode 100644
index 000000000..adfb69c9f
--- /dev/null
+++ b/xorg-server/hw/xfree86/drivers/modesetting/driver.c
@@ -0,0 +1,1113 @@
+/*
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2011 Dave Airlie
+ * 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 TUNGSTEN GRAPHICS 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.
+ *
+ *
+ * Original Author: Alan Hourihane <alanh@tungstengraphics.com>
+ * Rewrite: Dave Airlie <airlied@redhat.com>
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include "dix-config.h"
+#endif
+
+#include <unistd.h>
+#include <fcntl.h>
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "compiler.h"
+#include "xf86Pci.h"
+#include "mipointer.h"
+#include "micmap.h"
+#include <X11/extensions/randr.h>
+#include "fb.h"
+#include "edid.h"
+#include "xf86i2c.h"
+#include "xf86Crtc.h"
+#include "miscstruct.h"
+#include "dixstruct.h"
+#include "shadow.h"
+#include "xf86xv.h"
+#include <X11/extensions/Xv.h>
+#include <xorg-config.h>
+#ifdef XSERVER_PLATFORM_BUS
+#include "xf86platformBus.h"
+#endif
+#if XSERVER_LIBPCIACCESS
+#include <pciaccess.h>
+#endif
+
+#include "driver.h"
+
+static void AdjustFrame(ScrnInfoPtr pScrn, int x, int y);
+static Bool CloseScreen(ScreenPtr pScreen);
+static Bool EnterVT(ScrnInfoPtr pScrn);
+static void Identify(int flags);
+static const OptionInfoRec *AvailableOptions(int chipid, int busid);
+static ModeStatus ValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose,
+ int flags);
+static void FreeScreen(ScrnInfoPtr pScrn);
+static void LeaveVT(ScrnInfoPtr pScrn);
+static Bool SwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
+static Bool ScreenInit(ScreenPtr pScreen, int argc, char **argv);
+static Bool PreInit(ScrnInfoPtr pScrn, int flags);
+
+static Bool Probe(DriverPtr drv, int flags);
+static Bool ms_pci_probe(DriverPtr driver,
+ int entity_num, struct pci_device *device,
+ intptr_t match_data);
+static Bool ms_driver_func(ScrnInfoPtr scrn, xorgDriverFuncOp op,
+ void *data);
+
+#ifdef XSERVER_LIBPCIACCESS
+static const struct pci_id_match ms_device_match[] = {
+ {
+ PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
+ 0x00030000, 0x00ff0000, 0
+ },
+
+ { 0, 0, 0 },
+};
+#endif
+
+#ifdef XSERVER_PLATFORM_BUS
+static Bool ms_platform_probe(DriverPtr driver,
+ int entity_num, int flags, struct xf86_platform_device *device,
+ intptr_t match_data);
+#endif
+
+_X_EXPORT DriverRec modesetting = {
+ 1,
+ "modesetting",
+ Identify,
+ Probe,
+ AvailableOptions,
+ NULL,
+ 0,
+ ms_driver_func,
+ ms_device_match,
+ ms_pci_probe,
+#ifdef XSERVER_PLATFORM_BUS
+ ms_platform_probe,
+#endif
+};
+
+static SymTabRec Chipsets[] = {
+ {0, "kms" },
+ {-1, NULL}
+};
+
+typedef enum
+{
+ OPTION_SW_CURSOR,
+ OPTION_DEVICE_PATH,
+ OPTION_SHADOW_FB,
+} modesettingOpts;
+
+static const OptionInfoRec Options[] = {
+ {OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_DEVICE_PATH, "kmsdev", OPTV_STRING, {0}, FALSE },
+ {OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
+ {-1, NULL, OPTV_NONE, {0}, FALSE}
+};
+
+int modesettingEntityIndex = -1;
+
+static MODULESETUPPROTO(Setup);
+
+static XF86ModuleVersionInfo VersRec = {
+ "modesetting",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ XORG_VERSION_MAJOR,
+ XORG_VERSION_MINOR,
+ XORG_VERSION_PATCH,
+ ABI_CLASS_VIDEODRV,
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_VIDEODRV,
+ {0, 0, 0, 0}
+};
+
+_X_EXPORT XF86ModuleData modesettingModuleData = { &VersRec, Setup, NULL };
+
+static void *
+Setup(void * module, void * opts, int *errmaj, int *errmin)
+{
+ static Bool setupDone = 0;
+
+ /* This module should be loaded only once, but check to be sure.
+ */
+ if (!setupDone) {
+ setupDone = 1;
+ xf86AddDriver(&modesetting, module, HaveDriverFuncs);
+
+ /*
+ * The return value must be non-NULL on success even though there
+ * is no TearDownProc.
+ */
+ return (void *) 1;
+ } else {
+ if (errmaj)
+ *errmaj = LDR_ONCEONLY;
+ return NULL;
+ }
+}
+
+static void
+Identify(int flags)
+{
+ xf86PrintChipsets("modesetting", "Driver for Modesetting Kernel Drivers",
+ Chipsets);
+}
+
+static int open_hw(const char *dev)
+{
+ int fd;
+ if (dev)
+ fd = open(dev, O_RDWR, 0);
+ else {
+ dev = getenv("KMSDEVICE");
+ if ((NULL == dev) || ((fd = open(dev, O_RDWR, 0)) == -1)) {
+ dev = "/dev/dri/card0";
+ fd = open(dev,O_RDWR, 0);
+ }
+ }
+ if (fd == -1)
+ xf86DrvMsg(-1, X_ERROR,"open %s: %s\n", dev, strerror(errno));
+
+ return fd;
+}
+
+static int check_outputs(int fd)
+{
+ drmModeResPtr res = drmModeGetResources(fd);
+ int ret;
+
+ if (!res)
+ return FALSE;
+ ret = res->count_connectors > 0;
+ drmModeFreeResources(res);
+ return ret;
+}
+
+static Bool probe_hw(const char *dev, struct xf86_platform_device *platform_dev)
+{
+ int fd;
+
+#if XF86_PDEV_SERVER_FD
+ if (platform_dev && (platform_dev->flags & XF86_PDEV_SERVER_FD)) {
+ fd = xf86_platform_device_odev_attributes(platform_dev)->fd;
+ if (fd == -1)
+ return FALSE;
+ return check_outputs(fd);
+ }
+#endif
+
+ fd = open_hw(dev);
+ if (fd != -1) {
+ int ret = check_outputs(fd);
+ close(fd);
+ return ret;
+ }
+ return FALSE;
+}
+
+static char *
+ms_DRICreatePCIBusID(const struct pci_device *dev)
+{
+ char *busID;
+
+ if (asprintf(&busID, "pci:%04x:%02x:%02x.%d",
+ dev->domain, dev->bus, dev->dev, dev->func) == -1)
+ return NULL;
+
+ return busID;
+}
+
+
+static Bool probe_hw_pci(const char *dev, struct pci_device *pdev)
+{
+ int ret = FALSE, fd = open_hw(dev);
+ char *id, *devid;
+ drmSetVersion sv;
+
+ if (fd == -1)
+ return FALSE;
+
+ sv.drm_di_major = 1;
+ sv.drm_di_minor = 4;
+ sv.drm_dd_major = -1;
+ sv.drm_dd_minor = -1;
+ if (drmSetInterfaceVersion(fd, &sv)) {
+ close(fd);
+ return FALSE;
+ }
+
+
+ id = drmGetBusid(fd);
+ devid = ms_DRICreatePCIBusID(pdev);
+
+ if (id && devid && !strcmp(id, devid))
+ ret = check_outputs(fd);
+
+ close(fd);
+ free(id);
+ free(devid);
+ return ret;
+}
+static const OptionInfoRec *
+AvailableOptions(int chipid, int busid)
+{
+ return Options;
+}
+
+static Bool
+ms_driver_func(ScrnInfoPtr scrn, xorgDriverFuncOp op, void *data)
+{
+ xorgHWFlags *flag;
+
+ switch (op) {
+ case GET_REQUIRED_HW_INTERFACES:
+ flag = (CARD32 *)data;
+ (*flag) = 0;
+ return TRUE;
+ case SUPPORTS_SERVER_FDS:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+#if XSERVER_LIBPCIACCESS
+static Bool
+ms_pci_probe(DriverPtr driver,
+ int entity_num, struct pci_device *dev, intptr_t match_data)
+{
+ ScrnInfoPtr scrn = NULL;
+
+ scrn = xf86ConfigPciEntity(scrn, 0, entity_num, NULL,
+ NULL, NULL, NULL, NULL, NULL);
+ if (scrn) {
+ const char *devpath;
+ GDevPtr devSection = xf86GetDevFromEntity(scrn->entityList[0],
+ scrn->entityInstanceList[0]);
+
+ devpath = xf86FindOptionValue(devSection->options, "kmsdev");
+ if (probe_hw_pci(devpath, dev)) {
+ scrn->driverVersion = 1;
+ scrn->driverName = "modesetting";
+ scrn->name = "modeset";
+ scrn->Probe = NULL;
+ scrn->PreInit = PreInit;
+ scrn->ScreenInit = ScreenInit;
+ scrn->SwitchMode = SwitchMode;
+ scrn->AdjustFrame = AdjustFrame;
+ scrn->EnterVT = EnterVT;
+ scrn->LeaveVT = LeaveVT;
+ scrn->FreeScreen = FreeScreen;
+ scrn->ValidMode = ValidMode;
+
+ xf86DrvMsg(scrn->scrnIndex, X_CONFIG,
+ "claimed PCI slot %d@%d:%d:%d\n",
+ dev->bus, dev->domain, dev->dev, dev->func);
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "using %s\n", devpath ? devpath : "default device");
+ } else
+ scrn = NULL;
+ }
+ return scrn != NULL;
+}
+#endif
+
+#ifdef XSERVER_PLATFORM_BUS
+static Bool
+ms_platform_probe(DriverPtr driver,
+ int entity_num, int flags, struct xf86_platform_device *dev, intptr_t match_data)
+{
+ ScrnInfoPtr scrn = NULL;
+ const char *path = xf86_platform_device_odev_attributes(dev)->path;
+ int scr_flags = 0;
+
+ if (flags & PLATFORM_PROBE_GPU_SCREEN)
+ scr_flags = XF86_ALLOCATE_GPU_SCREEN;
+
+ if (probe_hw(path, dev)) {
+ scrn = xf86AllocateScreen(driver, scr_flags);
+ xf86AddEntityToScreen(scrn, entity_num);
+
+ scrn->driverName = "modesetting";
+ scrn->name = "modesetting";
+ scrn->PreInit = PreInit;
+ scrn->ScreenInit = ScreenInit;
+ scrn->SwitchMode = SwitchMode;
+ scrn->AdjustFrame = AdjustFrame;
+ scrn->EnterVT = EnterVT;
+ scrn->LeaveVT = LeaveVT;
+ scrn->FreeScreen = FreeScreen;
+ scrn->ValidMode = ValidMode;
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "using drv %s\n", path ? path : "default device");
+ }
+
+ return scrn != NULL;
+}
+#endif
+
+static Bool
+Probe(DriverPtr drv, int flags)
+{
+ int i, numDevSections;
+ GDevPtr *devSections;
+ Bool foundScreen = FALSE;
+ const char *dev;
+ ScrnInfoPtr scrn = NULL;
+
+ /* For now, just bail out for PROBE_DETECT. */
+ if (flags & PROBE_DETECT)
+ return FALSE;
+
+ /*
+ * Find the config file Device sections that match this
+ * driver, and return if there are none.
+ */
+ if ((numDevSections = xf86MatchDevice("modesetting", &devSections)) <= 0) {
+ return FALSE;
+ }
+
+ for (i = 0; i < numDevSections; i++) {
+
+ dev = xf86FindOptionValue(devSections[i]->options,"kmsdev");
+ if (probe_hw(dev, NULL)) {
+ int entity;
+ entity = xf86ClaimFbSlot(drv, 0, devSections[i], TRUE);
+ scrn = xf86ConfigFbEntity(scrn, 0, entity,
+ NULL, NULL, NULL, NULL);
+ }
+
+ if (scrn) {
+ foundScreen = TRUE;
+ scrn->driverVersion = 1;
+ scrn->driverName = "modesetting";
+ scrn->name = "modesetting";
+ scrn->Probe = Probe;
+ scrn->PreInit = PreInit;
+ scrn->ScreenInit = ScreenInit;
+ scrn->SwitchMode = SwitchMode;
+ scrn->AdjustFrame = AdjustFrame;
+ scrn->EnterVT = EnterVT;
+ scrn->LeaveVT = LeaveVT;
+ scrn->FreeScreen = FreeScreen;
+ scrn->ValidMode = ValidMode;
+
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "using %s\n", dev ? dev : "default device");
+ }
+ }
+
+ free(devSections);
+
+ return foundScreen;
+}
+
+static Bool
+GetRec(ScrnInfoPtr pScrn)
+{
+ if (pScrn->driverPrivate)
+ return TRUE;
+
+ pScrn->driverPrivate = xnfcalloc(sizeof(modesettingRec), 1);
+
+ return TRUE;
+}
+
+static int dispatch_dirty_region(ScrnInfoPtr scrn,
+ PixmapPtr pixmap,
+ DamagePtr damage,
+ int fb_id)
+{
+ modesettingPtr ms = modesettingPTR(scrn);
+ RegionPtr dirty = DamageRegion(damage);
+ unsigned num_cliprects = REGION_NUM_RECTS(dirty);
+
+ if (num_cliprects) {
+ drmModeClip *clip = malloc(num_cliprects * sizeof(drmModeClip));
+ BoxPtr rect = REGION_RECTS(dirty);
+ int i, ret;
+
+ if (!clip)
+ return -ENOMEM;
+
+ /* XXX no need for copy? */
+ for (i = 0; i < num_cliprects; i++, rect++) {
+ clip[i].x1 = rect->x1;
+ clip[i].y1 = rect->y1;
+ clip[i].x2 = rect->x2;
+ clip[i].y2 = rect->y2;
+ }
+
+ /* TODO query connector property to see if this is needed */
+ ret = drmModeDirtyFB(ms->fd, fb_id, clip, num_cliprects);
+ free(clip);
+ DamageEmpty(damage);
+ if (ret) {
+ if (ret == -EINVAL)
+ return ret;
+ }
+ }
+ return 0;
+}
+
+static void dispatch_dirty(ScreenPtr pScreen)
+{
+ ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
+ modesettingPtr ms = modesettingPTR(scrn);
+ PixmapPtr pixmap = pScreen->GetScreenPixmap(pScreen);
+ int fb_id = ms->drmmode.fb_id;
+ int ret;
+
+ ret = dispatch_dirty_region(scrn, pixmap, ms->damage, fb_id);
+ if (ret == -EINVAL || ret == -ENOSYS) {
+ ms->dirty_enabled = FALSE;
+ DamageUnregister(ms->damage);
+ DamageDestroy(ms->damage);
+ ms->damage = NULL;
+ xf86DrvMsg(scrn->scrnIndex, X_INFO, "Disabling kernel dirty updates, not required.\n");
+ return;
+ }
+}
+
+static void dispatch_dirty_crtc(ScrnInfoPtr scrn, xf86CrtcPtr crtc)
+{
+ modesettingPtr ms = modesettingPTR(scrn);
+ PixmapPtr pixmap = crtc->randr_crtc->scanout_pixmap;
+ msPixmapPrivPtr ppriv = msGetPixmapPriv(&ms->drmmode, pixmap);
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ DamagePtr damage = drmmode_crtc->slave_damage;
+ int fb_id = ppriv->fb_id;
+ int ret;
+
+ ret = dispatch_dirty_region(scrn, pixmap, damage, fb_id);
+ if (ret) {
+
+ }
+}
+
+static void dispatch_slave_dirty(ScreenPtr pScreen)
+{
+ ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (!crtc->randr_crtc)
+ continue;
+ if (!crtc->randr_crtc->scanout_pixmap)
+ continue;
+
+ dispatch_dirty_crtc(scrn, crtc);
+ }
+}
+
+static void msBlockHandler(ScreenPtr pScreen, void *pTimeout, void *pReadmask)
+{
+ modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(pScreen));
+
+ pScreen->BlockHandler = ms->BlockHandler;
+ pScreen->BlockHandler(pScreen, pTimeout, pReadmask);
+ pScreen->BlockHandler = msBlockHandler;
+ if (pScreen->isGPU)
+ dispatch_slave_dirty(pScreen);
+ else if (ms->dirty_enabled)
+ dispatch_dirty(pScreen);
+}
+
+static void
+FreeRec(ScrnInfoPtr pScrn)
+{
+ modesettingPtr ms;
+
+ if (!pScrn)
+ return;
+
+ ms = modesettingPTR(pScrn);
+ if (!ms)
+ return;
+ pScrn->driverPrivate = NULL;
+
+ if (ms->fd > 0) {
+ int ret;
+
+ if (ms->pEnt->location.type == BUS_PCI)
+ ret = drmClose(ms->fd);
+ else
+#ifdef XF86_PDEV_SERVER_FD
+ if (!(ms->pEnt->location.type == BUS_PLATFORM &&
+ (ms->pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD)))
+#endif
+ ret = close(ms->fd);
+ (void) ret;
+ }
+ free(ms->Options);
+ free(ms);
+
+}
+
+#ifndef DRM_CAP_CURSOR_WIDTH
+#define DRM_CAP_CURSOR_WIDTH 0x8
+#endif
+
+#ifndef DRM_CAP_CURSOR_HEIGHT
+#define DRM_CAP_CURSOR_HEIGHT 0x9
+#endif
+
+static Bool
+PreInit(ScrnInfoPtr pScrn, int flags)
+{
+ modesettingPtr ms;
+ rgb defaultWeight = { 0, 0, 0 };
+ EntityInfoPtr pEnt;
+ EntPtr msEnt = NULL;
+ char *BusID = NULL;
+ const char *devicename;
+ Bool prefer_shadow = TRUE;
+ uint64_t value = 0;
+ int ret;
+ int bppflags;
+ int defaultdepth, defaultbpp;
+
+ if (pScrn->numEntities != 1)
+ return FALSE;
+
+ pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
+
+ if (flags & PROBE_DETECT) {
+ return FALSE;
+ }
+
+ /* Allocate driverPrivate */
+ if (!GetRec(pScrn))
+ return FALSE;
+
+ ms = modesettingPTR(pScrn);
+ ms->SaveGeneration = -1;
+ ms->pEnt = pEnt;
+
+ pScrn->displayWidth = 640; /* default it */
+
+ /* Allocate an entity private if necessary */
+ if (xf86IsEntityShared(pScrn->entityList[0])) {
+ msEnt = xf86GetEntityPrivate(pScrn->entityList[0],
+ modesettingEntityIndex)->ptr;
+ ms->entityPrivate = msEnt;
+ } else
+ ms->entityPrivate = NULL;
+
+ if (xf86IsEntityShared(pScrn->entityList[0])) {
+ if (xf86IsPrimInitDone(pScrn->entityList[0])) {
+ /* do something */
+ } else {
+ xf86SetPrimInitDone(pScrn->entityList[0]);
+ }
+ }
+
+ pScrn->monitor = pScrn->confScreen->monitor;
+ pScrn->progClock = TRUE;
+ pScrn->rgbBits = 8;
+
+#if XSERVER_PLATFORM_BUS
+ if (pEnt->location.type == BUS_PLATFORM) {
+#ifdef XF86_PDEV_SERVER_FD
+ if (pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD)
+ ms->fd = xf86_platform_device_odev_attributes(pEnt->location.id.plat)->fd;
+ else
+#endif
+ {
+ char *path = xf86_platform_device_odev_attributes(pEnt->location.id.plat)->path;
+ ms->fd = open_hw(path);
+ }
+ }
+ else
+#endif
+ if (pEnt->location.type == BUS_PCI) {
+ ms->PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index);
+ if (ms->PciInfo) {
+ BusID = malloc(64);
+ sprintf(BusID, "PCI:%d:%d:%d",
+#if XSERVER_LIBPCIACCESS
+ ((ms->PciInfo->domain << 8) | ms->PciInfo->bus),
+ ms->PciInfo->dev, ms->PciInfo->func
+#else
+ ((pciConfigPtr) ms->PciInfo->thisCard)->busnum,
+ ((pciConfigPtr) ms->PciInfo->thisCard)->devnum,
+ ((pciConfigPtr) ms->PciInfo->thisCard)->funcnum
+#endif
+ );
+ }
+ ms->fd = drmOpen(NULL, BusID);
+ } else {
+ devicename = xf86FindOptionValue(ms->pEnt->device->options, "kmsdev");
+ ms->fd = open_hw(devicename);
+ }
+ if (ms->fd < 0)
+ return FALSE;
+
+ ms->drmmode.fd = ms->fd;
+
+ pScrn->capabilities = 0;
+#ifdef DRM_CAP_PRIME
+ ret = drmGetCap(ms->fd, DRM_CAP_PRIME, &value);
+ if (ret == 0) {
+ if (value & DRM_PRIME_CAP_IMPORT)
+ pScrn->capabilities |= RR_Capability_SinkOutput;
+ }
+#endif
+ drmmode_get_default_bpp(pScrn, &ms->drmmode, &defaultdepth, &defaultbpp);
+ if (defaultdepth == 24 && defaultbpp == 24)
+ bppflags = SupportConvert32to24 | Support24bppFb;
+ else
+ bppflags = PreferConvert24to32 | SupportConvert24to32 | Support32bppFb;
+
+ if (!xf86SetDepthBpp
+ (pScrn, defaultdepth, defaultdepth, defaultbpp, bppflags))
+ return FALSE;
+
+ switch (pScrn->depth) {
+ case 15:
+ case 16:
+ case 24:
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Given depth (%d) is not supported by the driver\n",
+ pScrn->depth);
+ return FALSE;
+ }
+ xf86PrintDepthBpp(pScrn);
+
+ /* Process the options */
+ xf86CollectOptions(pScrn, NULL);
+ if (!(ms->Options = malloc(sizeof(Options))))
+ return FALSE;
+ memcpy(ms->Options, Options, sizeof(Options));
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ms->Options);
+
+ if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight))
+ return FALSE;
+ if (!xf86SetDefaultVisual(pScrn, -1))
+ return FALSE;
+
+ if (xf86ReturnOptValBool(ms->Options, OPTION_SW_CURSOR, FALSE)) {
+ ms->drmmode.sw_cursor = TRUE;
+ }
+
+ ret = drmGetCap(ms->fd, DRM_CAP_DUMB_PREFER_SHADOW, &value);
+ if (!ret) {
+ prefer_shadow = !!value;
+ }
+
+ ms->cursor_width = 64;
+ ms->cursor_height = 64;
+ ret = drmGetCap(ms->fd, DRM_CAP_CURSOR_WIDTH, &value);
+ if (!ret) {
+ ms->cursor_width = value;
+ }
+ ret = drmGetCap(ms->fd, DRM_CAP_CURSOR_HEIGHT, &value);
+ if (!ret) {
+ ms->cursor_height = value;
+ }
+
+ ms->drmmode.shadow_enable = xf86ReturnOptValBool(ms->Options, OPTION_SHADOW_FB, prefer_shadow);
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ShadowFB: preferred %s, enabled %s\n", prefer_shadow ? "YES" : "NO", ms->drmmode.shadow_enable ? "YES" : "NO");
+ if (drmmode_pre_init(pScrn, &ms->drmmode, pScrn->bitsPerPixel / 8) == FALSE) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "KMS setup failed\n");
+ goto fail;
+ }
+
+ /*
+ * If the driver can do gamma correction, it should call xf86SetGamma() here.
+ */
+ {
+ Gamma zeros = { 0.0, 0.0, 0.0 };
+
+ if (!xf86SetGamma(pScrn, zeros)) {
+ return FALSE;
+ }
+ }
+
+ if (pScrn->modes == NULL) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n");
+ return FALSE;
+ }
+
+ pScrn->currentMode = pScrn->modes;
+
+ /* Set display resolution */
+ xf86SetDpi(pScrn, 0, 0);
+
+ /* Load the required sub modules */
+ if (!xf86LoadSubModule(pScrn, "fb")) {
+ return FALSE;
+ }
+
+ if (ms->drmmode.shadow_enable) {
+ if (!xf86LoadSubModule(pScrn, "shadow")) {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+ fail:
+ return FALSE;
+}
+
+static void *
+msShadowWindow(ScreenPtr screen, CARD32 row, CARD32 offset, int mode,
+ CARD32 *size, void *closure)
+{
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(screen);
+ modesettingPtr ms = modesettingPTR(pScrn);
+ int stride;
+
+ stride = (pScrn->displayWidth * pScrn->bitsPerPixel) / 8;
+ *size = stride;
+
+ return ((uint8_t *)ms->drmmode.front_bo->ptr + row * stride + offset);
+}
+
+static void
+msUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+ shadowUpdatePacked(pScreen, pBuf);
+}
+
+static Bool
+CreateScreenResources(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ modesettingPtr ms = modesettingPTR(pScrn);
+ PixmapPtr rootPixmap;
+ Bool ret;
+ void *pixels;
+ pScreen->CreateScreenResources = ms->createScreenResources;
+ ret = pScreen->CreateScreenResources(pScreen);
+ pScreen->CreateScreenResources = CreateScreenResources;
+
+ if (!drmmode_set_desired_modes(pScrn, &ms->drmmode))
+ return FALSE;
+
+ drmmode_uevent_init(pScrn, &ms->drmmode);
+
+ if (!ms->drmmode.sw_cursor)
+ drmmode_map_cursor_bos(pScrn, &ms->drmmode);
+ pixels = drmmode_map_front_bo(&ms->drmmode);
+ if (!pixels)
+ return FALSE;
+
+ rootPixmap = pScreen->GetScreenPixmap(pScreen);
+
+ if (ms->drmmode.shadow_enable)
+ pixels = ms->drmmode.shadow_fb;
+
+ if (!pScreen->ModifyPixmapHeader(rootPixmap, -1, -1, -1, -1, -1, pixels))
+ FatalError("Couldn't adjust screen pixmap\n");
+
+ if (ms->drmmode.shadow_enable) {
+ if (!shadowAdd(pScreen, rootPixmap, msUpdatePacked,
+ msShadowWindow, 0, 0))
+ return FALSE;
+ }
+
+ ms->damage = DamageCreate(NULL, NULL, DamageReportNone, TRUE,
+ pScreen, rootPixmap);
+
+ if (ms->damage) {
+ DamageRegister(&rootPixmap->drawable, ms->damage);
+ ms->dirty_enabled = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Damage tracking initialized\n");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to create screen damage record\n");
+ return FALSE;
+ }
+ return ret;
+}
+
+static Bool
+msShadowInit(ScreenPtr pScreen)
+{
+ if (!shadowSetup(pScreen)) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static Bool
+msSetSharedPixmapBacking(PixmapPtr ppix, void *fd_handle)
+{
+ ScreenPtr screen = ppix->drawable.pScreen;
+ ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ modesettingPtr ms = modesettingPTR(scrn);
+ Bool ret;
+ int size = ppix->devKind * ppix->drawable.height;
+ int ihandle = (int)(long)fd_handle;
+
+ ret = drmmode_SetSlaveBO(ppix, &ms->drmmode, ihandle, ppix->devKind, size);
+ if (ret == FALSE)
+ return ret;
+
+ return TRUE;
+}
+
+static Bool
+SetMaster(ScrnInfoPtr pScrn)
+{
+ modesettingPtr ms = modesettingPTR(pScrn);
+ int ret;
+
+#ifdef XF86_PDEV_SERVER_FD
+ if (ms->pEnt->location.type == BUS_PLATFORM &&
+ (ms->pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD))
+ return TRUE;
+#endif
+
+ ret = drmSetMaster(ms->fd);
+ if (ret)
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "drmSetMaster failed: %s\n",
+ strerror(errno));
+
+ return ret == 0;
+}
+
+static Bool
+ScreenInit(ScreenPtr pScreen, int argc, char **argv)
+{
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ modesettingPtr ms = modesettingPTR(pScrn);
+ VisualPtr visual;
+
+ pScrn->pScreen = pScreen;
+
+ if (!SetMaster(pScrn))
+ return FALSE;
+
+ /* HW dependent - FIXME */
+ pScrn->displayWidth = pScrn->virtualX;
+ if (!drmmode_create_initial_bos(pScrn, &ms->drmmode))
+ return FALSE;
+
+ if (ms->drmmode.shadow_enable) {
+ ms->drmmode.shadow_fb = calloc(1, pScrn->displayWidth * pScrn->virtualY *
+ ((pScrn->bitsPerPixel + 7) >> 3));
+ if (!ms->drmmode.shadow_fb)
+ ms->drmmode.shadow_enable = FALSE;
+ }
+
+ miClearVisualTypes();
+
+ if (!miSetVisualTypes(pScrn->depth,
+ miGetDefaultVisualMask(pScrn->depth),
+ pScrn->rgbBits, pScrn->defaultVisual))
+ return FALSE;
+
+ if (!miSetPixmapDepths())
+ return FALSE;
+
+ if (!dixRegisterScreenSpecificPrivateKey(pScreen, &ms->drmmode.pixmapPrivateKeyRec,
+ PRIVATE_PIXMAP, sizeof(msPixmapPrivRec))) {
+ return FALSE;
+ }
+
+ pScrn->memPhysBase = 0;
+ pScrn->fbOffset = 0;
+
+ if (!fbScreenInit(pScreen, NULL,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth, pScrn->bitsPerPixel))
+ return FALSE;
+
+ if (pScrn->bitsPerPixel > 8) {
+ /* Fixup RGB ordering */
+ visual = pScreen->visuals + pScreen->numVisuals;
+ while (--visual >= pScreen->visuals) {
+ if ((visual->class | DynamicClass) == DirectColor) {
+ visual->offsetRed = pScrn->offset.red;
+ visual->offsetGreen = pScrn->offset.green;
+ visual->offsetBlue = pScrn->offset.blue;
+ visual->redMask = pScrn->mask.red;
+ visual->greenMask = pScrn->mask.green;
+ visual->blueMask = pScrn->mask.blue;
+ }
+ }
+ }
+
+ fbPictureInit(pScreen, NULL, 0);
+
+ if (ms->drmmode.shadow_enable && !msShadowInit(pScreen)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "shadow fb init failed\n");
+ return FALSE;
+ }
+
+ ms->createScreenResources = pScreen->CreateScreenResources;
+ pScreen->CreateScreenResources = CreateScreenResources;
+
+ xf86SetBlackWhitePixels(pScreen);
+
+ xf86SetBackingStore(pScreen);
+ xf86SetSilkenMouse(pScreen);
+ miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+
+ /* Need to extend HWcursor support to handle mask interleave */
+ if (!ms->drmmode.sw_cursor)
+ xf86_cursors_init(pScreen, ms->cursor_width, ms->cursor_height,
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 |
+ HARDWARE_CURSOR_ARGB);
+
+ /* Must force it before EnterVT, so we are in control of VT and
+ * later memory should be bound when allocating, e.g rotate_mem */
+ pScrn->vtSema = TRUE;
+
+ pScreen->SaveScreen = xf86SaveScreen;
+ ms->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = CloseScreen;
+
+ ms->BlockHandler = pScreen->BlockHandler;
+ pScreen->BlockHandler = msBlockHandler;
+
+ pScreen->SetSharedPixmapBacking = msSetSharedPixmapBacking;
+
+ if (!xf86CrtcScreenInit(pScreen))
+ return FALSE;
+
+ if (!miCreateDefColormap(pScreen))
+ return FALSE;
+
+ xf86DPMSInit(pScreen, xf86DPMSSet, 0);
+
+ if (serverGeneration == 1)
+ xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
+
+ return EnterVT(pScrn);
+}
+
+static void
+AdjustFrame(ScrnInfoPtr pScrn, int x, int y)
+{
+ modesettingPtr ms = modesettingPTR(pScrn);
+
+ drmmode_adjust_frame(pScrn, &ms->drmmode, x, y);
+}
+
+static void
+FreeScreen(ScrnInfoPtr pScrn)
+{
+ FreeRec(pScrn);
+}
+
+static void
+LeaveVT(ScrnInfoPtr pScrn)
+{
+ modesettingPtr ms = modesettingPTR(pScrn);
+ xf86_hide_cursors(pScrn);
+
+ pScrn->vtSema = FALSE;
+
+#ifdef XF86_PDEV_SERVER_FD
+ if (ms->pEnt->location.type == BUS_PLATFORM &&
+ (ms->pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD))
+ return;
+#endif
+
+ drmDropMaster(ms->fd);
+}
+
+/*
+ * This gets called when gaining control of the VT, and from ScreenInit().
+ */
+static Bool
+EnterVT(ScrnInfoPtr pScrn)
+{
+ modesettingPtr ms = modesettingPTR(pScrn);
+
+ pScrn->vtSema = TRUE;
+
+ SetMaster(pScrn);
+
+ if (!drmmode_set_desired_modes(pScrn, &ms->drmmode))
+ return FALSE;
+
+ return TRUE;
+}
+
+static Bool
+SwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
+{
+ return xf86SetSingleMode(pScrn, mode, RR_Rotate_0);
+}
+
+static Bool
+CloseScreen(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ modesettingPtr ms = modesettingPTR(pScrn);
+
+ if (ms->damage) {
+ DamageUnregister(ms->damage);
+ DamageDestroy(ms->damage);
+ ms->damage = NULL;
+ }
+
+ if (ms->drmmode.shadow_enable) {
+ shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen));
+ free(ms->drmmode.shadow_fb);
+ ms->drmmode.shadow_fb = NULL;
+ }
+ drmmode_uevent_fini(pScrn, &ms->drmmode);
+
+ drmmode_free_bos(pScrn, &ms->drmmode);
+
+ if (pScrn->vtSema) {
+ LeaveVT(pScrn);
+ }
+
+ pScreen->CreateScreenResources = ms->createScreenResources;
+ pScreen->BlockHandler = ms->BlockHandler;
+
+ pScrn->vtSema = FALSE;
+ pScreen->CloseScreen = ms->CloseScreen;
+ return (*pScreen->CloseScreen) (pScreen);
+}
+
+static ModeStatus
+ValidMode(ScrnInfoPtr arg, DisplayModePtr mode, Bool verbose, int flags)
+{
+ return MODE_OK;
+}
diff --git a/xorg-server/hw/xfree86/drivers/modesetting/driver.h b/xorg-server/hw/xfree86/drivers/modesetting/driver.h
new file mode 100644
index 000000000..450b29c2b
--- /dev/null
+++ b/xorg-server/hw/xfree86/drivers/modesetting/driver.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * 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 TUNGSTEN GRAPHICS 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.
+ *
+ *
+ * Author: Alan Hourihane <alanh@tungstengraphics.com>
+ *
+ */
+
+#include <errno.h>
+#include <drm.h>
+#include <xf86drm.h>
+#include <damage.h>
+
+#include "drmmode_display.h"
+#define DRV_ERROR(msg) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, msg);
+
+typedef struct
+{
+ int lastInstance;
+ int refCount;
+ ScrnInfoPtr pScrn_1;
+ ScrnInfoPtr pScrn_2;
+} EntRec, *EntPtr;
+
+typedef struct _modesettingRec
+{
+ int fd;
+
+ EntPtr entityPrivate;
+
+ int Chipset;
+ EntityInfoPtr pEnt;
+#if XSERVER_LIBPCIACCESS
+ struct pci_device *PciInfo;
+#else
+ pciVideoPtr PciInfo;
+ PCITAG PciTag;
+#endif
+
+ Bool noAccel;
+ CloseScreenProcPtr CloseScreen;
+
+ /* Broken-out options. */
+ OptionInfoPtr Options;
+
+ unsigned int SaveGeneration;
+
+ CreateScreenResourcesProcPtr createScreenResources;
+ ScreenBlockHandlerProcPtr BlockHandler;
+ void *driver;
+
+ drmmode_rec drmmode;
+
+ DamagePtr damage;
+ Bool dirty_enabled;
+
+ uint32_t cursor_width, cursor_height;
+} modesettingRec, *modesettingPtr;
+
+#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))
diff --git a/xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.c b/xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.c
new file mode 100644
index 000000000..9723ccd0e
--- /dev/null
+++ b/xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -0,0 +1,1616 @@
+/*
+ * Copyright © 2007 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ * Dave Airlie <airlied@redhat.com>
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include "dix-config.h"
+#endif
+
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include "xf86str.h"
+#include "X11/Xatom.h"
+#include "micmap.h"
+#include "xf86cmap.h"
+#include "xf86DDC.h"
+
+#include <xf86drm.h>
+#include "xf86Crtc.h"
+#include "drmmode_display.h"
+
+#include <cursorstr.h>
+
+#include <X11/extensions/dpmsconst.h>
+
+#include "driver.h"
+
+static struct dumb_bo *dumb_bo_create(int fd,
+ const unsigned width, const unsigned height,
+ const unsigned bpp)
+{
+ struct drm_mode_create_dumb arg;
+ struct dumb_bo *bo;
+ int ret;
+
+ bo = calloc(1, sizeof(*bo));
+ if (!bo)
+ return NULL;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.width = width;
+ arg.height = height;
+ arg.bpp = bpp;
+
+ ret = drmIoctl(fd, DRM_IOCTL_MODE_CREATE_DUMB, &arg);
+ if (ret)
+ goto err_free;
+
+ bo->handle = arg.handle;
+ bo->size = arg.size;
+ bo->pitch = arg.pitch;
+
+ return bo;
+ err_free:
+ free(bo);
+ return NULL;
+}
+
+static int dumb_bo_map(int fd, struct dumb_bo *bo)
+{
+ struct drm_mode_map_dumb arg;
+ int ret;
+ void *map;
+
+ if (bo->ptr) {
+ bo->map_count++;
+ return 0;
+ }
+
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = bo->handle;
+
+ ret = drmIoctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &arg);
+ if (ret)
+ return ret;
+
+ map = mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
+ fd, arg.offset);
+ if (map == MAP_FAILED)
+ return -errno;
+
+ bo->ptr = map;
+ return 0;
+}
+
+#if 0
+static int dumb_bo_unmap(int fd, struct dumb_bo *bo)
+{
+ bo->map_count--;
+ return 0;
+}
+#endif
+
+static int dumb_bo_destroy(int fd, struct dumb_bo *bo)
+{
+ struct drm_mode_destroy_dumb arg;
+ int ret;
+
+ if (bo->ptr) {
+ munmap(bo->ptr, bo->size);
+ bo->ptr = NULL;
+ }
+
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = bo->handle;
+ ret = drmIoctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg);
+ if (ret)
+ return -errno;
+
+ free(bo);
+ return 0;
+}
+
+static struct dumb_bo *dumb_get_bo_from_handle(int fd, int handle, int pitch, int size)
+{
+ struct dumb_bo *bo;
+ int ret;
+
+ bo = calloc(1, sizeof(*bo));
+ if (!bo)
+ return NULL;
+
+ ret = drmPrimeFDToHandle(fd, handle, &bo->handle);
+ if (ret) {
+ free(bo);
+ return NULL;
+ }
+ bo->pitch = pitch;
+ bo->size = size;
+ return bo;
+}
+
+Bool drmmode_SetSlaveBO(PixmapPtr ppix,
+ drmmode_ptr drmmode,
+ int fd_handle, int pitch, int size)
+{
+ msPixmapPrivPtr ppriv = msGetPixmapPriv(drmmode, ppix);
+
+ ppriv->backing_bo = dumb_get_bo_from_handle(drmmode->fd, fd_handle, pitch, size);
+ if (!ppriv->backing_bo)
+ return FALSE;
+
+ close(fd_handle);
+ return TRUE;
+}
+
+static void
+drmmode_ConvertFromKMode(ScrnInfoPtr scrn,
+ drmModeModeInfo *kmode,
+ DisplayModePtr mode)
+{
+ memset(mode, 0, sizeof(DisplayModeRec));
+ mode->status = MODE_OK;
+
+ mode->Clock = kmode->clock;
+
+ mode->HDisplay = kmode->hdisplay;
+ mode->HSyncStart = kmode->hsync_start;
+ mode->HSyncEnd = kmode->hsync_end;
+ mode->HTotal = kmode->htotal;
+ mode->HSkew = kmode->hskew;
+
+ mode->VDisplay = kmode->vdisplay;
+ mode->VSyncStart = kmode->vsync_start;
+ mode->VSyncEnd = kmode->vsync_end;
+ mode->VTotal = kmode->vtotal;
+ mode->VScan = kmode->vscan;
+
+ mode->Flags = kmode->flags; //& FLAG_BITS;
+ mode->name = strdup(kmode->name);
+
+ if (kmode->type & DRM_MODE_TYPE_DRIVER)
+ mode->type = M_T_DRIVER;
+ if (kmode->type & DRM_MODE_TYPE_PREFERRED)
+ mode->type |= M_T_PREFERRED;
+ xf86SetModeCrtc (mode, scrn->adjustFlags);
+}
+
+static void
+drmmode_ConvertToKMode(ScrnInfoPtr scrn,
+ drmModeModeInfo *kmode,
+ DisplayModePtr mode)
+{
+ memset(kmode, 0, sizeof(*kmode));
+
+ kmode->clock = mode->Clock;
+ kmode->hdisplay = mode->HDisplay;
+ kmode->hsync_start = mode->HSyncStart;
+ kmode->hsync_end = mode->HSyncEnd;
+ kmode->htotal = mode->HTotal;
+ kmode->hskew = mode->HSkew;
+
+ kmode->vdisplay = mode->VDisplay;
+ kmode->vsync_start = mode->VSyncStart;
+ kmode->vsync_end = mode->VSyncEnd;
+ kmode->vtotal = mode->VTotal;
+ kmode->vscan = mode->VScan;
+
+ kmode->flags = mode->Flags; //& FLAG_BITS;
+ if (mode->name)
+ strncpy(kmode->name, mode->name, DRM_DISPLAY_MODE_LEN);
+ kmode->name[DRM_DISPLAY_MODE_LEN-1] = 0;
+
+}
+
+static void
+drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
+{
+#if 0
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+// drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+// drmmode_ptr drmmode = drmmode_crtc->drmmode;
+
+ /* bonghits in the randr 1.2 - uses dpms to disable crtc - bad buzz */
+ if (mode == DPMSModeOff) {
+// drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
+// 0, 0, 0, NULL, 0, NULL);
+ }
+#endif
+}
+
+#if 0
+static PixmapPtr
+create_pixmap_for_fbcon(drmmode_ptr drmmode,
+ ScrnInfoPtr pScrn, int crtc_id)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ drmmode_crtc_private_ptr drmmode_crtc;
+ ScreenPtr pScreen = pScrn->pScreen;
+ PixmapPtr pixmap;
+ struct radeon_bo *bo;
+ drmModeFBPtr fbcon;
+ struct drm_gem_flink flink;
+
+ drmmode_crtc = xf86_config->crtc[crtc_id]->driver_private;
+
+ fbcon = drmModeGetFB(drmmode->fd, drmmode_crtc->mode_crtc->buffer_id);
+ if (fbcon == NULL)
+ return NULL;
+
+ flink.handle = fbcon->handle;
+ if (ioctl(drmmode->fd, DRM_IOCTL_GEM_FLINK, &flink) < 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Couldn't flink fbcon handle\n");
+ return NULL;
+ }
+
+ bo = radeon_bo_open(drmmode->bufmgr, flink.name, 0, 0, 0, 0);
+ if (bo == NULL) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Couldn't allocate bo for fbcon handle\n");
+ return NULL;
+ }
+
+ pixmap = drmmode_create_bo_pixmap(pScreen, fbcon->width, fbcon->height,
+ fbcon->depth, fbcon->bpp,
+ fbcon->pitch, bo);
+ if (!pixmap)
+ return NULL;
+
+ radeon_bo_unref(bo);
+ drmModeFreeFB(fbcon);
+ return pixmap;
+}
+
+#endif
+
+static Bool
+drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
+ Rotation rotation, int x, int y)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
+ int saved_x, saved_y;
+ Rotation saved_rotation;
+ DisplayModeRec saved_mode;
+ uint32_t *output_ids;
+ int output_count = 0;
+ Bool ret = TRUE;
+ int i;
+ uint32_t fb_id;
+ drmModeModeInfo kmode;
+ int height;
+
+ height = pScrn->virtualY;
+
+ if (drmmode->fb_id == 0) {
+ ret = drmModeAddFB(drmmode->fd,
+ pScrn->virtualX, height,
+ pScrn->depth, pScrn->bitsPerPixel,
+ drmmode->front_bo->pitch,
+ drmmode->front_bo->handle,
+ &drmmode->fb_id);
+ if (ret < 0) {
+ ErrorF("failed to add fb %d\n", ret);
+ return FALSE;
+ }
+ }
+
+ saved_mode = crtc->mode;
+ saved_x = crtc->x;
+ saved_y = crtc->y;
+ saved_rotation = crtc->rotation;
+
+ if (mode) {
+ crtc->mode = *mode;
+ crtc->x = x;
+ crtc->y = y;
+ crtc->rotation = rotation;
+ crtc->transformPresent = FALSE;
+ }
+
+ output_ids = calloc(sizeof(uint32_t), xf86_config->num_output);
+ if (!output_ids) {
+ ret = FALSE;
+ goto done;
+ }
+
+ if (mode) {
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+ drmmode_output_private_ptr drmmode_output;
+
+ if (output->crtc != crtc)
+ continue;
+
+ drmmode_output = output->driver_private;
+ output_ids[output_count] = drmmode_output->mode_output->connector_id;
+ output_count++;
+ }
+
+ if (!xf86CrtcRotate(crtc)) {
+ goto done;
+ }
+ crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
+ crtc->gamma_blue, crtc->gamma_size);
+
+ drmmode_ConvertToKMode(crtc->scrn, &kmode, mode);
+
+ fb_id = drmmode->fb_id;
+ if (crtc->randr_crtc->scanout_pixmap) {
+ msPixmapPrivPtr ppriv = msGetPixmapPriv(drmmode, crtc->randr_crtc->scanout_pixmap);
+ fb_id = ppriv->fb_id;
+ x = y = 0;
+ } else if (drmmode_crtc->rotate_fb_id) {
+ fb_id = drmmode_crtc->rotate_fb_id;
+ x = y = 0;
+ }
+ ret = drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
+ fb_id, x, y, output_ids, output_count, &kmode);
+ if (ret)
+ xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
+ "failed to set mode: %s", strerror(-ret));
+ else
+ ret = TRUE;
+
+ if (crtc->scrn->pScreen)
+ xf86CrtcSetScreenSubpixelOrder(crtc->scrn->pScreen);
+ /* go through all the outputs and force DPMS them back on? */
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+
+ if (output->crtc != crtc)
+ continue;
+
+ output->funcs->dpms(output, DPMSModeOn);
+ }
+ }
+
+#if 0
+ if (pScrn->pScreen &&
+ !xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE))
+ xf86_reload_cursors(pScrn->pScreen);
+#endif
+done:
+ if (!ret) {
+ crtc->x = saved_x;
+ crtc->y = saved_y;
+ crtc->rotation = saved_rotation;
+ crtc->mode = saved_mode;
+ }
+#if defined(XF86_CRTC_VERSION) && XF86_CRTC_VERSION >= 3
+ else
+ crtc->active = TRUE;
+#endif
+
+ return ret;
+}
+
+static void
+drmmode_set_cursor_colors (xf86CrtcPtr crtc, int bg, int fg)
+{
+
+}
+
+static void
+drmmode_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
+{
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
+
+ drmModeMoveCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, x, y);
+}
+
+static void
+drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image)
+{
+ modesettingPtr ms = modesettingPTR(crtc->scrn);
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ int i;
+ uint32_t *ptr;
+ uint32_t handle = drmmode_crtc->cursor_bo->handle;
+ int ret;
+ /* cursor should be mapped already */
+ ptr = (uint32_t *)(drmmode_crtc->cursor_bo->ptr);
+
+ for (i = 0; i < ms->cursor_width * ms->cursor_height; i++)
+ ptr[i] = image[i];// cpu_to_le32(image[i]);
+
+ ret = drmModeSetCursor(drmmode_crtc->drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle,
+ ms->cursor_width, ms->cursor_height);
+ if (ret) {
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+
+ cursor_info->MaxWidth = cursor_info->MaxHeight = 0;
+ drmmode_crtc->drmmode->sw_cursor = TRUE;
+ /* fallback to swcursor */
+ }
+}
+
+
+static void
+drmmode_hide_cursor (xf86CrtcPtr crtc)
+{
+ modesettingPtr ms = modesettingPTR(crtc->scrn);
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
+
+ drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, 0,
+ ms->cursor_width, ms->cursor_height);
+
+}
+
+static void
+drmmode_show_cursor (xf86CrtcPtr crtc)
+{
+ modesettingPtr ms = modesettingPTR(crtc->scrn);
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
+ uint32_t handle = drmmode_crtc->cursor_bo->handle;
+ static Bool use_set_cursor2 = TRUE;
+
+ if (use_set_cursor2) {
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+ CursorPtr cursor = xf86_config->cursor;
+ int ret;
+ ret = drmModeSetCursor2(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle, ms->cursor_width, ms->cursor_height, cursor->bits->xhot, cursor->bits->yhot);
+ if (ret == -EINVAL)
+ use_set_cursor2 = FALSE;
+ else
+ return;
+ }
+
+ drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle,
+ ms->cursor_width, ms->cursor_height);
+}
+
+static void
+drmmode_crtc_gamma_set(xf86CrtcPtr crtc, uint16_t *red, uint16_t *green,
+ uint16_t *blue, int size)
+{
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
+
+ drmModeCrtcSetGamma(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
+ size, red, green, blue);
+}
+
+static Bool
+drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
+{
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
+ msPixmapPrivPtr ppriv;
+ void *ptr;
+
+ if (!ppix) {
+ if (crtc->randr_crtc->scanout_pixmap) {
+ ppriv = msGetPixmapPriv(drmmode, crtc->randr_crtc->scanout_pixmap);
+ drmModeRmFB(drmmode->fd, ppriv->fb_id);
+ }
+ if (drmmode_crtc->slave_damage) {
+ DamageUnregister(drmmode_crtc->slave_damage);
+ drmmode_crtc->slave_damage = NULL;
+ }
+ return TRUE;
+ }
+
+ ppriv = msGetPixmapPriv(drmmode, ppix);
+ if (!drmmode_crtc->slave_damage) {
+ drmmode_crtc->slave_damage = DamageCreate(NULL, NULL,
+ DamageReportNone,
+ TRUE,
+ crtc->randr_crtc->pScreen,
+ NULL);
+ }
+ ptr = drmmode_map_slave_bo(drmmode, ppriv);
+ ppix->devPrivate.ptr = ptr;
+ DamageRegister(&ppix->drawable, drmmode_crtc->slave_damage);
+
+ if (ppriv->fb_id == 0) {
+ drmModeAddFB(drmmode->fd, ppix->drawable.width,
+ ppix->drawable.height,
+ ppix->drawable.depth,
+ ppix->drawable.bitsPerPixel,
+ ppix->devKind,
+ ppriv->backing_bo->handle,
+ &ppriv->fb_id);
+ }
+ return TRUE;
+}
+
+static void *drmmode_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
+{
+ return NULL;
+}
+
+static PixmapPtr drmmode_shadow_create(xf86CrtcPtr crtc, void *data, int width,
+ int height)
+{
+ return NULL;
+}
+
+static const xf86CrtcFuncsRec drmmode_crtc_funcs = {
+ .dpms = drmmode_crtc_dpms,
+ .set_mode_major = drmmode_set_mode_major,
+ .set_cursor_colors = drmmode_set_cursor_colors,
+ .set_cursor_position = drmmode_set_cursor_position,
+ .show_cursor = drmmode_show_cursor,
+ .hide_cursor = drmmode_hide_cursor,
+ .load_cursor_argb = drmmode_load_cursor_argb,
+
+ .gamma_set = drmmode_crtc_gamma_set,
+ .destroy = NULL, /* XXX */
+ .set_scanout_pixmap = drmmode_set_scanout_pixmap,
+ .shadow_allocate = drmmode_shadow_allocate,
+ .shadow_create = drmmode_shadow_create,
+};
+
+static void
+drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
+{
+ xf86CrtcPtr crtc;
+ drmmode_crtc_private_ptr drmmode_crtc;
+
+ crtc = xf86CrtcCreate(pScrn, &drmmode_crtc_funcs);
+ if (crtc == NULL)
+ return;
+
+ drmmode_crtc = xnfcalloc(sizeof(drmmode_crtc_private_rec), 1);
+ drmmode_crtc->mode_crtc = drmModeGetCrtc(drmmode->fd, drmmode->mode_res->crtcs[num]);
+ drmmode_crtc->drmmode = drmmode;
+ crtc->driver_private = drmmode_crtc;
+}
+
+static xf86OutputStatus
+drmmode_output_detect(xf86OutputPtr output)
+{
+ /* go to the hw and retrieve a new output struct */
+ drmmode_output_private_ptr drmmode_output = output->driver_private;
+ drmmode_ptr drmmode = drmmode_output->drmmode;
+ xf86OutputStatus status;
+ drmModeFreeConnector(drmmode_output->mode_output);
+
+ drmmode_output->mode_output = drmModeGetConnector(drmmode->fd, drmmode_output->output_id);
+ if (!drmmode_output->mode_output)
+ return XF86OutputStatusDisconnected;
+
+ switch (drmmode_output->mode_output->connection) {
+ case DRM_MODE_CONNECTED:
+ status = XF86OutputStatusConnected;
+ break;
+ case DRM_MODE_DISCONNECTED:
+ status = XF86OutputStatusDisconnected;
+ break;
+ default:
+ case DRM_MODE_UNKNOWNCONNECTION:
+ status = XF86OutputStatusUnknown;
+ break;
+ }
+ return status;
+}
+
+static Bool
+drmmode_output_mode_valid(xf86OutputPtr output, DisplayModePtr pModes)
+{
+ return MODE_OK;
+}
+
+static Bool
+has_panel_fitter(xf86OutputPtr output)
+{
+ drmmode_output_private_ptr drmmode_output = output->driver_private;
+ drmModeConnectorPtr koutput = drmmode_output->mode_output;
+ drmmode_ptr drmmode = drmmode_output->drmmode;
+ int i;
+
+ /* Presume that if the output supports scaling, then we have a
+ * panel fitter capable of adjust any mode to suit.
+ */
+ for (i = 0; i < koutput->count_props; i++) {
+ drmModePropertyPtr props;
+ Bool found = FALSE;
+
+ props = drmModeGetProperty(drmmode->fd, koutput->props[i]);
+ if (props) {
+ found = strcmp(props->name, "scaling mode") == 0;
+ drmModeFreeProperty(props);
+ }
+
+ if (found)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static DisplayModePtr
+drmmode_output_add_gtf_modes(xf86OutputPtr output,
+ DisplayModePtr Modes)
+{
+ xf86MonPtr mon = output->MonInfo;
+ DisplayModePtr i, m, preferred = NULL;
+ int max_x = 0, max_y = 0;
+ float max_vrefresh = 0.0;
+
+ if (mon && GTF_SUPPORTED(mon->features.msc))
+ return Modes;
+
+ if (!has_panel_fitter(output))
+ return Modes;
+
+ for (m = Modes; m; m = m->next) {
+ if (m->type & M_T_PREFERRED)
+ preferred = m;
+ max_x = max(max_x, m->HDisplay);
+ max_y = max(max_y, m->VDisplay);
+ max_vrefresh = max(max_vrefresh, xf86ModeVRefresh(m));
+ }
+
+ max_vrefresh = max(max_vrefresh, 60.0);
+ max_vrefresh *= (1 + SYNC_TOLERANCE);
+
+ m = xf86GetDefaultModes();
+ xf86ValidateModesSize(output->scrn, m, max_x, max_y, 0);
+
+ for (i = m; i; i = i->next) {
+ if (xf86ModeVRefresh(i) > max_vrefresh)
+ i->status = MODE_VSYNC;
+ if (preferred &&
+ i->HDisplay >= preferred->HDisplay &&
+ i->VDisplay >= preferred->VDisplay &&
+ xf86ModeVRefresh(i) >= xf86ModeVRefresh(preferred))
+ i->status = MODE_VSYNC;
+ }
+
+ xf86PruneInvalidModes(output->scrn, &m, FALSE);
+
+ return xf86ModesAdd(Modes, m);
+}
+
+static DisplayModePtr
+drmmode_output_get_modes(xf86OutputPtr output)
+{
+ drmmode_output_private_ptr drmmode_output = output->driver_private;
+ drmModeConnectorPtr koutput = drmmode_output->mode_output;
+ drmmode_ptr drmmode = drmmode_output->drmmode;
+ int i;
+ DisplayModePtr Modes = NULL, Mode;
+ drmModePropertyPtr props;
+ xf86MonPtr mon = NULL;
+
+ if (!koutput)
+ return NULL;
+
+ /* look for an EDID property */
+ for (i = 0; i < koutput->count_props; i++) {
+ props = drmModeGetProperty(drmmode->fd, koutput->props[i]);
+ if (props && (props->flags & DRM_MODE_PROP_BLOB)) {
+ if (!strcmp(props->name, "EDID")) {
+ if (drmmode_output->edid_blob)
+ drmModeFreePropertyBlob(drmmode_output->edid_blob);
+ drmmode_output->edid_blob = drmModeGetPropertyBlob(drmmode->fd, koutput->prop_values[i]);
+ }
+ drmModeFreeProperty(props);
+ }
+ }
+
+ if (drmmode_output->edid_blob) {
+ mon = xf86InterpretEDID(output->scrn->scrnIndex,
+ drmmode_output->edid_blob->data);
+ if (mon && drmmode_output->edid_blob->length > 128)
+ mon->flags |= MONITOR_EDID_COMPLETE_RAWDATA;
+ }
+ xf86OutputSetEDID(output, mon);
+
+ /* modes should already be available */
+ for (i = 0; i < koutput->count_modes; i++) {
+ Mode = xnfalloc(sizeof(DisplayModeRec));
+
+ drmmode_ConvertFromKMode(output->scrn, &koutput->modes[i], Mode);
+ Modes = xf86ModesAdd(Modes, Mode);
+
+ }
+
+ return drmmode_output_add_gtf_modes(output, Modes);
+}
+
+static void
+drmmode_output_destroy(xf86OutputPtr output)
+{
+ drmmode_output_private_ptr drmmode_output = output->driver_private;
+ int i;
+
+ if (drmmode_output->edid_blob)
+ drmModeFreePropertyBlob(drmmode_output->edid_blob);
+ for (i = 0; i < drmmode_output->num_props; i++) {
+ drmModeFreeProperty(drmmode_output->props[i].mode_prop);
+ free(drmmode_output->props[i].atoms);
+ }
+ free(drmmode_output->props);
+ for (i = 0; i < drmmode_output->mode_output->count_encoders; i++) {
+ drmModeFreeEncoder(drmmode_output->mode_encoders[i]);
+ }
+ free(drmmode_output->mode_encoders);
+ drmModeFreeConnector(drmmode_output->mode_output);
+ free(drmmode_output);
+ output->driver_private = NULL;
+}
+
+static void
+drmmode_output_dpms(xf86OutputPtr output, int mode)
+{
+ drmmode_output_private_ptr drmmode_output = output->driver_private;
+ drmModeConnectorPtr koutput = drmmode_output->mode_output;
+ drmmode_ptr drmmode = drmmode_output->drmmode;
+
+ if (!koutput)
+ return;
+
+ drmModeConnectorSetProperty(drmmode->fd, koutput->connector_id,
+ drmmode_output->dpms_enum_id, mode);
+ return;
+}
+
+
+static Bool
+drmmode_property_ignore(drmModePropertyPtr prop)
+{
+ if (!prop)
+ return TRUE;
+ /* ignore blob prop */
+ if (prop->flags & DRM_MODE_PROP_BLOB)
+ return TRUE;
+ /* ignore standard property */
+ if (!strcmp(prop->name, "EDID") ||
+ !strcmp(prop->name, "DPMS"))
+ return TRUE;
+
+ return FALSE;
+}
+
+static void
+drmmode_output_create_resources(xf86OutputPtr output)
+{
+ drmmode_output_private_ptr drmmode_output = output->driver_private;
+ drmModeConnectorPtr mode_output = drmmode_output->mode_output;
+ drmmode_ptr drmmode = drmmode_output->drmmode;
+ drmModePropertyPtr drmmode_prop;
+ int i, j, err;
+
+ drmmode_output->props = calloc(mode_output->count_props, sizeof(drmmode_prop_rec));
+ if (!drmmode_output->props)
+ return;
+
+ drmmode_output->num_props = 0;
+ for (i = 0, j = 0; i < mode_output->count_props; i++) {
+ drmmode_prop = drmModeGetProperty(drmmode->fd, mode_output->props[i]);
+ if (drmmode_property_ignore(drmmode_prop)) {
+ drmModeFreeProperty(drmmode_prop);
+ continue;
+ }
+ drmmode_output->props[j].mode_prop = drmmode_prop;
+ drmmode_output->props[j].value = mode_output->prop_values[i];
+ drmmode_output->num_props++;
+ j++;
+ }
+
+ for (i = 0; i < drmmode_output->num_props; i++) {
+ drmmode_prop_ptr p = &drmmode_output->props[i];
+ drmmode_prop = p->mode_prop;
+
+ if (drmmode_prop->flags & DRM_MODE_PROP_RANGE) {
+ INT32 prop_range[2];
+ INT32 value = p->value;
+
+ p->num_atoms = 1;
+ p->atoms = calloc(p->num_atoms, sizeof(Atom));
+ if (!p->atoms)
+ continue;
+ p->atoms[0] = MakeAtom(drmmode_prop->name, strlen(drmmode_prop->name), TRUE);
+ prop_range[0] = drmmode_prop->values[0];
+ prop_range[1] = drmmode_prop->values[1];
+ err = RRConfigureOutputProperty(output->randr_output, p->atoms[0],
+ FALSE, TRUE,
+ drmmode_prop->flags & DRM_MODE_PROP_IMMUTABLE ? TRUE : FALSE,
+ 2, prop_range);
+ if (err != 0) {
+ xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+ "RRConfigureOutputProperty error, %d\n", err);
+ }
+ err = RRChangeOutputProperty(output->randr_output, p->atoms[0],
+ XA_INTEGER, 32, PropModeReplace, 1, &value, FALSE, TRUE);
+ if (err != 0) {
+ xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+ "RRChangeOutputProperty error, %d\n", err);
+ }
+ } else if (drmmode_prop->flags & DRM_MODE_PROP_ENUM) {
+ p->num_atoms = drmmode_prop->count_enums + 1;
+ p->atoms = calloc(p->num_atoms, sizeof(Atom));
+ if (!p->atoms)
+ continue;
+ p->atoms[0] = MakeAtom(drmmode_prop->name, strlen(drmmode_prop->name), TRUE);
+ for (j = 1; j <= drmmode_prop->count_enums; j++) {
+ struct drm_mode_property_enum *e = &drmmode_prop->enums[j-1];
+ p->atoms[j] = MakeAtom(e->name, strlen(e->name), TRUE);
+ }
+ err = RRConfigureOutputProperty(output->randr_output, p->atoms[0],
+ FALSE, FALSE,
+ drmmode_prop->flags & DRM_MODE_PROP_IMMUTABLE ? TRUE : FALSE,
+ p->num_atoms - 1, (INT32 *)&p->atoms[1]);
+ if (err != 0) {
+ xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+ "RRConfigureOutputProperty error, %d\n", err);
+ }
+ for (j = 0; j < drmmode_prop->count_enums; j++)
+ if (drmmode_prop->enums[j].value == p->value)
+ break;
+ /* there's always a matching value */
+ err = RRChangeOutputProperty(output->randr_output, p->atoms[0],
+ XA_ATOM, 32, PropModeReplace, 1, &p->atoms[j+1], FALSE, TRUE);
+ if (err != 0) {
+ xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+ "RRChangeOutputProperty error, %d\n", err);
+ }
+ }
+ }
+}
+
+static Bool
+drmmode_output_set_property(xf86OutputPtr output, Atom property,
+ RRPropertyValuePtr value)
+{
+ drmmode_output_private_ptr drmmode_output = output->driver_private;
+ drmmode_ptr drmmode = drmmode_output->drmmode;
+ int i;
+
+ for (i = 0; i < drmmode_output->num_props; i++) {
+ drmmode_prop_ptr p = &drmmode_output->props[i];
+
+ if (p->atoms[0] != property)
+ continue;
+
+ if (p->mode_prop->flags & DRM_MODE_PROP_RANGE) {
+ uint32_t val;
+
+ if (value->type != XA_INTEGER || value->format != 32 ||
+ value->size != 1)
+ return FALSE;
+ val = *(uint32_t *)value->data;
+
+ drmModeConnectorSetProperty(drmmode->fd, drmmode_output->output_id,
+ p->mode_prop->prop_id, (uint64_t)val);
+ return TRUE;
+ } else if (p->mode_prop->flags & DRM_MODE_PROP_ENUM) {
+ Atom atom;
+ const char *name;
+ int j;
+
+ if (value->type != XA_ATOM || value->format != 32 || value->size != 1)
+ return FALSE;
+ memcpy(&atom, value->data, 4);
+ name = NameForAtom(atom);
+
+ /* search for matching name string, then set its value down */
+ for (j = 0; j < p->mode_prop->count_enums; j++) {
+ if (!strcmp(p->mode_prop->enums[j].name, name)) {
+ drmModeConnectorSetProperty(drmmode->fd, drmmode_output->output_id,
+ p->mode_prop->prop_id, p->mode_prop->enums[j].value);
+ return TRUE;
+ }
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+static Bool
+drmmode_output_get_property(xf86OutputPtr output, Atom property)
+{
+ return TRUE;
+}
+
+static const xf86OutputFuncsRec drmmode_output_funcs = {
+ .dpms = drmmode_output_dpms,
+ .create_resources = drmmode_output_create_resources,
+ .set_property = drmmode_output_set_property,
+ .get_property = drmmode_output_get_property,
+ .detect = drmmode_output_detect,
+ .mode_valid = drmmode_output_mode_valid,
+
+ .get_modes = drmmode_output_get_modes,
+ .destroy = drmmode_output_destroy
+};
+
+static int subpixel_conv_table[7] = { 0, SubPixelUnknown,
+ SubPixelHorizontalRGB,
+ SubPixelHorizontalBGR,
+ SubPixelVerticalRGB,
+ SubPixelVerticalBGR,
+ SubPixelNone };
+
+static const char * const output_names[] = { "None",
+ "VGA",
+ "DVI",
+ "DVI",
+ "DVI",
+ "Composite",
+ "S-video",
+ "LVDS",
+ "CTV",
+ "DIN",
+ "DisplayPort",
+ "HDMI",
+ "HDMI",
+ "TV",
+ "eDP",
+ "Virtual",
+ "DSI",
+};
+
+static void
+drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num, int *num_dvi, int *num_hdmi)
+{
+ xf86OutputPtr output;
+ drmModeConnectorPtr koutput;
+ drmModeEncoderPtr *kencoders = NULL;
+ drmmode_output_private_ptr drmmode_output;
+ drmModePropertyPtr props;
+ char name[32];
+ int i;
+
+ koutput = drmModeGetConnector(drmmode->fd, drmmode->mode_res->connectors[num]);
+ if (!koutput)
+ return;
+
+ kencoders = calloc(sizeof(drmModeEncoderPtr), koutput->count_encoders);
+ if (!kencoders) {
+ goto out_free_encoders;
+ }
+
+ for (i = 0; i < koutput->count_encoders; i++) {
+ kencoders[i] = drmModeGetEncoder(drmmode->fd, koutput->encoders[i]);
+ if (!kencoders[i]) {
+ goto out_free_encoders;
+ }
+ }
+
+ /* need to do smart conversion here for compat with non-kms ATI driver */
+ if (koutput->connector_type >= MS_ARRAY_SIZE(output_names))
+ snprintf(name, 32, "Unknown-%d", koutput->connector_type_id - 1);
+ else if (pScrn->is_gpu)
+ snprintf(name, 32, "%s-%d-%d", output_names[koutput->connector_type], pScrn->scrnIndex - GPU_SCREEN_OFFSET + 1, koutput->connector_type_id - 1);
+ else
+ snprintf(name, 32, "%s-%d", output_names[koutput->connector_type], koutput->connector_type_id - 1);
+
+ output = xf86OutputCreate (pScrn, &drmmode_output_funcs, name);
+ if (!output) {
+ goto out_free_encoders;
+ }
+
+ drmmode_output = calloc(sizeof(drmmode_output_private_rec), 1);
+ if (!drmmode_output) {
+ xf86OutputDestroy(output);
+ goto out_free_encoders;
+ }
+
+ drmmode_output->output_id = drmmode->mode_res->connectors[num];
+ drmmode_output->mode_output = koutput;
+ drmmode_output->mode_encoders = kencoders;
+ drmmode_output->drmmode = drmmode;
+ output->mm_width = koutput->mmWidth;
+ output->mm_height = koutput->mmHeight;
+
+ output->subpixel_order = subpixel_conv_table[koutput->subpixel];
+ output->interlaceAllowed = TRUE;
+ output->doubleScanAllowed = TRUE;
+ output->driver_private = drmmode_output;
+
+ output->possible_crtcs = 0x7f;
+ for (i = 0; i < koutput->count_encoders; i++) {
+ output->possible_crtcs &= kencoders[i]->possible_crtcs;
+ }
+ /* work out the possible clones later */
+ output->possible_clones = 0;
+
+ for (i = 0; i < koutput->count_props; i++) {
+ props = drmModeGetProperty(drmmode->fd, koutput->props[i]);
+ if (props && (props->flags & DRM_MODE_PROP_ENUM)) {
+ if (!strcmp(props->name, "DPMS")) {
+ drmmode_output->dpms_enum_id = koutput->props[i];
+ drmModeFreeProperty(props);
+ break;
+ }
+ drmModeFreeProperty(props);
+ }
+ }
+
+ return;
+out_free_encoders:
+ if (kencoders){
+ for (i = 0; i < koutput->count_encoders; i++)
+ drmModeFreeEncoder(kencoders[i]);
+ free(kencoders);
+ }
+ drmModeFreeConnector(koutput);
+
+}
+
+static uint32_t find_clones(ScrnInfoPtr scrn, xf86OutputPtr output)
+{
+ drmmode_output_private_ptr drmmode_output = output->driver_private, clone_drmout;
+ int i;
+ xf86OutputPtr clone_output;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int index_mask = 0;
+
+ if (drmmode_output->enc_clone_mask == 0)
+ return index_mask;
+
+ for (i = 0; i < xf86_config->num_output; i++) {
+ clone_output = xf86_config->output[i];
+ clone_drmout = clone_output->driver_private;
+ if (output == clone_output)
+ continue;
+
+ if (clone_drmout->enc_mask == 0)
+ continue;
+ if (drmmode_output->enc_clone_mask == clone_drmout->enc_mask)
+ index_mask |= (1 << i);
+ }
+ return index_mask;
+}
+
+
+static void
+drmmode_clones_init(ScrnInfoPtr scrn, drmmode_ptr drmmode)
+{
+ int i, j;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+ drmmode_output_private_ptr drmmode_output;
+
+ drmmode_output = output->driver_private;
+ drmmode_output->enc_clone_mask = 0xff;
+ /* and all the possible encoder clones for this output together */
+ for (j = 0; j < drmmode_output->mode_output->count_encoders; j++)
+ {
+ int k;
+ for (k = 0; k < drmmode->mode_res->count_encoders; k++) {
+ if (drmmode->mode_res->encoders[k] == drmmode_output->mode_encoders[j]->encoder_id)
+ drmmode_output->enc_mask |= (1 << k);
+ }
+
+ drmmode_output->enc_clone_mask &= drmmode_output->mode_encoders[j]->possible_clones;
+ }
+ }
+
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+ output->possible_clones = find_clones(scrn, output);
+ }
+}
+
+static Bool
+drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ drmmode_crtc_private_ptr
+ drmmode_crtc = xf86_config->crtc[0]->driver_private;
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
+ struct dumb_bo *old_front = NULL;
+ Bool ret;
+ ScreenPtr screen = xf86ScrnToScreen(scrn);
+ uint32_t old_fb_id;
+ int i, pitch, old_width, old_height, old_pitch;
+ int cpp = (scrn->bitsPerPixel + 7) / 8;
+ PixmapPtr ppix = screen->GetScreenPixmap(screen);
+ void *new_pixels;
+
+ if (scrn->virtualX == width && scrn->virtualY == height)
+ return TRUE;
+
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "Allocate new frame buffer %dx%d stride\n",
+ width, height);
+
+ old_width = scrn->virtualX;
+ old_height = scrn->virtualY;
+ old_pitch = drmmode->front_bo->pitch;
+ old_fb_id = drmmode->fb_id;
+ old_front = drmmode->front_bo;
+
+ drmmode->front_bo = dumb_bo_create(drmmode->fd, width, height, scrn->bitsPerPixel);
+ if (!drmmode->front_bo)
+ goto fail;
+
+ pitch = drmmode->front_bo->pitch;
+
+ scrn->virtualX = width;
+ scrn->virtualY = height;
+ scrn->displayWidth = pitch / cpp;
+
+ ret = drmModeAddFB(drmmode->fd, width, height, scrn->depth,
+ scrn->bitsPerPixel, pitch,
+ drmmode->front_bo->handle,
+ &drmmode->fb_id);
+ if (ret)
+ goto fail;
+
+ new_pixels = drmmode_map_front_bo(drmmode);
+ if (!new_pixels)
+ goto fail;
+
+ if (!drmmode->shadow_enable)
+ screen->ModifyPixmapHeader(ppix, width, height, -1, -1,
+ pitch, new_pixels);
+ else {
+ void *new_shadow;
+ uint32_t size = scrn->displayWidth * scrn->virtualY *
+ ((scrn->bitsPerPixel + 7) >> 3);
+ new_shadow = calloc(1, size);
+ if (new_shadow == NULL)
+ goto fail;
+ free(drmmode->shadow_fb);
+ drmmode->shadow_fb = new_shadow;
+ screen->ModifyPixmapHeader(ppix, width, height, -1, -1,
+ pitch, drmmode->shadow_fb);
+ }
+
+ for (i = 0; i < xf86_config->num_crtc; i++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[i];
+
+ if (!crtc->enabled)
+ continue;
+
+ drmmode_set_mode_major(crtc, &crtc->mode,
+ crtc->rotation, crtc->x, crtc->y);
+ }
+
+ if (old_fb_id) {
+ drmModeRmFB(drmmode->fd, old_fb_id);
+ dumb_bo_destroy(drmmode->fd, old_front);
+ }
+
+ return TRUE;
+
+ fail:
+ if (drmmode->front_bo)
+ dumb_bo_destroy(drmmode->fd, drmmode->front_bo);
+ drmmode->front_bo = old_front;
+ scrn->virtualX = old_width;
+ scrn->virtualY = old_height;
+ scrn->displayWidth = old_pitch / cpp;
+ drmmode->fb_id = old_fb_id;
+
+ return FALSE;
+}
+
+static const xf86CrtcConfigFuncsRec drmmode_xf86crtc_config_funcs = {
+ drmmode_xf86crtc_resize
+};
+
+Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
+{
+ int i, num_dvi = 0, num_hdmi = 0;
+ int ret;
+ uint64_t value = 0;
+
+ /* check for dumb capability */
+ ret = drmGetCap(drmmode->fd, DRM_CAP_DUMB_BUFFER, &value);
+ if (ret > 0 || value != 1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "KMS doesn't support dumb interface\n");
+ return FALSE;
+ }
+
+ xf86CrtcConfigInit(pScrn, &drmmode_xf86crtc_config_funcs);
+
+ drmmode->scrn = pScrn;
+ drmmode->cpp = cpp;
+ drmmode->mode_res = drmModeGetResources(drmmode->fd);
+ if (!drmmode->mode_res)
+ return FALSE;
+
+ xf86CrtcSetSizeRange(pScrn, 320, 200, drmmode->mode_res->max_width, drmmode->mode_res->max_height);
+ for (i = 0; i < drmmode->mode_res->count_crtcs; i++)
+ if (!xf86IsEntityShared(pScrn->entityList[0]) || pScrn->confScreen->device->screen == i)
+ drmmode_crtc_init(pScrn, drmmode, i);
+
+ for (i = 0; i < drmmode->mode_res->count_connectors; i++)
+ drmmode_output_init(pScrn, drmmode, i, &num_dvi, &num_hdmi);
+
+ /* workout clones */
+ drmmode_clones_init(pScrn, drmmode);
+
+#if XF86_CRTC_VERSION >= 5
+ xf86ProviderSetup(pScrn, NULL, "modesetting");
+#endif
+
+ xf86InitialConfiguration(pScrn, TRUE);
+
+ return TRUE;
+}
+
+void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86OutputPtr output = config->output[config->compat_output];
+ xf86CrtcPtr crtc = output->crtc;
+
+ if (crtc && crtc->enabled) {
+ drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation,
+ x, y);
+ }
+}
+
+Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
+
+ for (c = 0; c < config->num_crtc; c++) {
+ xf86CrtcPtr crtc = config->crtc[c];
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ xf86OutputPtr output = NULL;
+ int o;
+
+ /* Skip disabled CRTCs */
+ if (!crtc->enabled) {
+ drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
+ 0, 0, 0, NULL, 0, NULL);
+ continue;
+ }
+
+ if (config->output[config->compat_output]->crtc == crtc)
+ output = config->output[config->compat_output];
+ else
+ {
+ for (o = 0; o < config->num_output; o++)
+ if (config->output[o]->crtc == crtc)
+ {
+ output = config->output[o];
+ break;
+ }
+ }
+ /* paranoia */
+ if (!output)
+ continue;
+
+ /* Mark that we'll need to re-set the mode for sure */
+ memset(&crtc->mode, 0, sizeof(crtc->mode));
+ if (!crtc->desiredMode.CrtcHDisplay)
+ {
+ DisplayModePtr mode = xf86OutputFindClosestMode (output, pScrn->currentMode);
+
+ if (!mode)
+ return FALSE;
+ crtc->desiredMode = *mode;
+ crtc->desiredRotation = RR_Rotate_0;
+ crtc->desiredX = 0;
+ crtc->desiredY = 0;
+ }
+
+ if (!crtc->funcs->set_mode_major(crtc, &crtc->desiredMode, crtc->desiredRotation,
+ crtc->desiredX, crtc->desiredY))
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static void drmmode_load_palette(ScrnInfoPtr pScrn, int numColors,
+ int *indices, LOCO *colors, VisualPtr pVisual)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ uint16_t lut_r[256], lut_g[256], lut_b[256];
+ int index, j, i;
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+ for (i = 0 ; i < 256; i++) {
+ lut_r[i] = drmmode_crtc->lut_r[i] << 6;
+ lut_g[i] = drmmode_crtc->lut_g[i] << 6;
+ lut_b[i] = drmmode_crtc->lut_b[i] << 6;
+ }
+
+ switch(pScrn->depth) {
+ case 15:
+ for (i = 0; i < numColors; i++) {
+ index = indices[i];
+ for (j = 0; j < 8; j++) {
+ lut_r[index * 8 + j] = colors[index].red << 6;
+ lut_g[index * 8 + j] = colors[index].green << 6;
+ lut_b[index * 8 + j] = colors[index].blue << 6;
+ }
+ }
+ break;
+ case 16:
+ for (i = 0; i < numColors; i++) {
+ index = indices[i];
+
+ if (i <= 31) {
+ for (j = 0; j < 8; j++) {
+ lut_r[index * 8 + j] = colors[index].red << 6;
+ lut_b[index * 8 + j] = colors[index].blue << 6;
+ }
+ }
+
+ for (j = 0; j < 4; j++) {
+ lut_g[index * 4 + j] = colors[index].green << 6;
+ }
+ }
+ break;
+ default:
+ for (i = 0; i < numColors; i++) {
+ index = indices[i];
+ lut_r[index] = colors[index].red << 6;
+ lut_g[index] = colors[index].green << 6;
+ lut_b[index] = colors[index].blue << 6;
+ }
+ break;
+ }
+
+ /* Make the change through RandR */
+ if (crtc->randr_crtc)
+ RRCrtcGammaSet(crtc->randr_crtc, lut_r, lut_g, lut_b);
+ else
+ crtc->funcs->gamma_set(crtc, lut_r, lut_g, lut_b, 256);
+ }
+}
+
+Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)
+{
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
+ "Initializing kms color map\n");
+ if (!miCreateDefColormap(pScreen))
+ return FALSE;
+ /* all radeons support 10 bit CLUTs */
+ if (!xf86HandleColormaps(pScreen, 256, 10,
+ drmmode_load_palette, NULL,
+ CMAP_PALETTED_TRUECOLOR
+#if 0 /* This option messes up text mode! (eich@suse.de) */
+ | CMAP_LOAD_EVEN_IF_OFFSCREEN
+#endif
+ | CMAP_RELOAD_ON_MODE_SWITCH))
+ return FALSE;
+ return TRUE;
+}
+
+#ifdef HAVE_UDEV
+static void
+drmmode_handle_uevents(int fd, void *closure)
+{
+ drmmode_ptr drmmode = closure;
+ ScrnInfoPtr scrn = drmmode->scrn;
+ struct udev_device *dev;
+ dev = udev_monitor_receive_device(drmmode->uevent_monitor);
+ if (!dev)
+ return;
+
+ RRGetInfo(xf86ScrnToScreen(scrn), TRUE);
+ udev_device_unref(dev);
+}
+#endif
+
+void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode)
+{
+#ifdef HAVE_UDEV
+ struct udev *u;
+ struct udev_monitor *mon;
+
+ u = udev_new();
+ if (!u)
+ return;
+ mon = udev_monitor_new_from_netlink(u, "udev");
+ if (!mon) {
+ udev_unref(u);
+ return;
+ }
+
+ if (udev_monitor_filter_add_match_subsystem_devtype(mon,
+ "drm",
+ "drm_minor") < 0 ||
+ udev_monitor_enable_receiving(mon) < 0) {
+ udev_monitor_unref(mon);
+ udev_unref(u);
+ return;
+ }
+
+ drmmode->uevent_handler =
+ xf86AddGeneralHandler(udev_monitor_get_fd(mon),
+ drmmode_handle_uevents,
+ drmmode);
+
+ drmmode->uevent_monitor = mon;
+#endif
+}
+
+void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode)
+{
+#ifdef HAVE_UDEV
+ if (drmmode->uevent_handler) {
+ struct udev *u = udev_monitor_get_udev(drmmode->uevent_monitor);
+ xf86RemoveGeneralHandler(drmmode->uevent_handler);
+
+ udev_monitor_unref(drmmode->uevent_monitor);
+ udev_unref(u);
+ }
+#endif
+}
+
+/* create front and cursor BOs */
+Bool drmmode_create_initial_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
+{
+ modesettingPtr ms = modesettingPTR(pScrn);
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int width;
+ int height;
+ int bpp = pScrn->bitsPerPixel;
+ int i;
+ int cpp = (bpp + 7) / 8;
+
+ width = pScrn->virtualX;
+ height = pScrn->virtualY;
+
+ drmmode->front_bo = dumb_bo_create(drmmode->fd, width, height, bpp);
+ if (!drmmode->front_bo)
+ return FALSE;
+ pScrn->displayWidth = drmmode->front_bo->pitch / cpp;
+
+ width = ms->cursor_width;
+ height = ms->cursor_height;
+ bpp = 32;
+ for (i = 0; i < xf86_config->num_crtc; i++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[i];
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ drmmode_crtc->cursor_bo = dumb_bo_create(drmmode->fd, width, height, bpp);
+ }
+ return TRUE;
+}
+
+void *drmmode_map_front_bo(drmmode_ptr drmmode)
+{
+ int ret;
+
+ if (drmmode->front_bo->ptr)
+ return drmmode->front_bo->ptr;
+
+ ret = dumb_bo_map(drmmode->fd, drmmode->front_bo);
+ if (ret)
+ return NULL;
+
+ return drmmode->front_bo->ptr;
+
+}
+
+void *drmmode_map_slave_bo(drmmode_ptr drmmode, msPixmapPrivPtr ppriv)
+{
+ int ret;
+
+ if (ppriv->backing_bo->ptr)
+ return ppriv->backing_bo->ptr;
+
+ ret = dumb_bo_map(drmmode->fd, ppriv->backing_bo);
+ if (ret)
+ return NULL;
+
+ return ppriv->backing_bo->ptr;
+}
+
+Bool drmmode_map_cursor_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int i, ret;
+ for (i = 0; i < xf86_config->num_crtc; i++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[i];
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ ret = dumb_bo_map(drmmode->fd, drmmode_crtc->cursor_bo);
+ if (ret)
+ return FALSE;
+ }
+ return TRUE;
+}
+
+void drmmode_free_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int i;
+
+ if (drmmode->fb_id) {
+ drmModeRmFB(drmmode->fd, drmmode->fb_id);
+ drmmode->fb_id = 0;
+ }
+
+ dumb_bo_destroy(drmmode->fd, drmmode->front_bo);
+ drmmode->front_bo = NULL;
+
+ for (i = 0; i < xf86_config->num_crtc; i++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[i];
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ dumb_bo_destroy(drmmode->fd, drmmode_crtc->cursor_bo);
+ }
+}
+
+/* ugly workaround to see if we can create 32bpp */
+void drmmode_get_default_bpp(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int *depth, int *bpp)
+{
+ drmModeResPtr mode_res;
+ uint64_t value;
+ struct dumb_bo *bo;
+ uint32_t fb_id;
+ int ret;
+
+ /* 16 is fine */
+ ret = drmGetCap(drmmode->fd, DRM_CAP_DUMB_PREFERRED_DEPTH, &value);
+ if (!ret && (value == 16 || value == 8)) {
+ *depth = value;
+ *bpp = value;
+ return;
+ }
+
+ *depth = 24;
+ mode_res = drmModeGetResources(drmmode->fd);
+ if (!mode_res)
+ return;
+
+ if (mode_res->min_width == 0)
+ mode_res->min_width = 1;
+ if (mode_res->min_height == 0)
+ mode_res->min_height = 1;
+ /*create a bo */
+ bo = dumb_bo_create(drmmode->fd, mode_res->min_width, mode_res->min_height, 32);
+ if (!bo) {
+ *bpp = 24;
+ goto out;
+ }
+
+ ret = drmModeAddFB(drmmode->fd, mode_res->min_width, mode_res->min_height,
+ 24, 32, bo->pitch, bo->handle, &fb_id);
+
+ if (ret) {
+ *bpp = 24;
+ dumb_bo_destroy(drmmode->fd, bo);
+ goto out;
+ }
+
+ drmModeRmFB(drmmode->fd, fb_id);
+ *bpp = 32;
+
+ dumb_bo_destroy(drmmode->fd, bo);
+out:
+ drmModeFreeResources(mode_res);
+ return;
+}
diff --git a/xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.h b/xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.h
new file mode 100644
index 000000000..7bfe885f5
--- /dev/null
+++ b/xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.h
@@ -0,0 +1,136 @@
+/*
+ * Copyright © 2007 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ * Dave Airlie <airlied@redhat.com>
+ *
+ */
+#ifndef DRMMODE_DISPLAY_H
+#define DRMMODE_DISPLAY_H
+
+#include "xf86drmMode.h"
+#ifdef HAVE_UDEV
+#include "libudev.h"
+#endif
+
+struct dumb_bo {
+ uint32_t handle;
+ uint32_t size;
+ void *ptr;
+ int map_count;
+ uint32_t pitch;
+};
+
+typedef struct {
+ int fd;
+ unsigned fb_id;
+ drmModeResPtr mode_res;
+ drmModeFBPtr mode_fb;
+ int cpp;
+ ScrnInfoPtr scrn;
+#ifdef HAVE_UDEV
+ struct udev_monitor *uevent_monitor;
+ InputHandlerProc uevent_handler;
+#endif
+ drmEventContext event_context;
+ struct dumb_bo *front_bo;
+ Bool sw_cursor;
+
+ Bool shadow_enable;
+ void *shadow_fb;
+
+ DevPrivateKeyRec pixmapPrivateKeyRec;
+} drmmode_rec, *drmmode_ptr;
+
+typedef struct {
+ drmmode_ptr drmmode;
+ drmModeCrtcPtr mode_crtc;
+ int hw_id;
+ struct dumb_bo *cursor_bo;
+ unsigned rotate_fb_id;
+ uint16_t lut_r[256], lut_g[256], lut_b[256];
+ DamagePtr slave_damage;
+} drmmode_crtc_private_rec, *drmmode_crtc_private_ptr;
+
+typedef struct {
+ drmModePropertyPtr mode_prop;
+ uint64_t value;
+ int num_atoms; /* if range prop, num_atoms == 1; if enum prop, num_atoms == num_enums + 1 */
+ Atom *atoms;
+} drmmode_prop_rec, *drmmode_prop_ptr;
+
+
+typedef struct {
+ drmmode_ptr drmmode;
+ int output_id;
+ drmModeConnectorPtr mode_output;
+ drmModeEncoderPtr *mode_encoders;
+ drmModePropertyBlobPtr edid_blob;
+ int dpms_enum_id;
+ int num_props;
+ drmmode_prop_ptr props;
+ int enc_mask;
+ int enc_clone_mask;
+} drmmode_output_private_rec, *drmmode_output_private_ptr;
+
+typedef struct _msPixmapPriv {
+ uint32_t fb_id;
+ struct dumb_bo *backing_bo; /* if this pixmap is backed by a dumb bo */
+} msPixmapPrivRec, *msPixmapPrivPtr;
+
+
+extern DevPrivateKeyRec msPixmapPrivateKeyRec;
+#define msPixmapPrivateKey (&msPixmapPrivateKeyRec)
+
+#define msGetPixmapPriv(drmmode, p) ((msPixmapPrivPtr)dixGetPrivateAddr(&(p)->devPrivates, &(drmmode)->pixmapPrivateKeyRec))
+
+void *drmmode_map_slave_bo(drmmode_ptr drmmode, msPixmapPrivPtr ppriv);
+Bool drmmode_SetSlaveBO(PixmapPtr ppix,
+ drmmode_ptr drmmode,
+ int fd_handle, int pitch, int size);
+
+extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp);
+void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y);
+extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
+extern Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);
+
+extern void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode);
+extern void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode);
+
+Bool drmmode_create_initial_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
+void *drmmode_map_front_bo(drmmode_ptr drmmode);
+Bool drmmode_map_cursor_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
+void drmmode_free_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
+void drmmode_get_default_bpp(ScrnInfoPtr pScrn, drmmode_ptr drmmmode, int *depth, int *bpp);
+
+
+#ifndef DRM_CAP_DUMB_PREFERRED_DEPTH
+#define DRM_CAP_DUMB_PREFERRED_DEPTH 3
+#endif
+#ifndef DRM_CAP_DUMB_PREFER_SHADOW
+#define DRM_CAP_DUMB_PREFER_SHADOW 4
+#endif
+
+#define MS_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
+
+
+#endif
diff --git a/xorg-server/hw/xfree86/drivers/modesetting/modesetting.man b/xorg-server/hw/xfree86/drivers/modesetting/modesetting.man
new file mode 100644
index 000000000..34baa9c53
--- /dev/null
+++ b/xorg-server/hw/xfree86/drivers/modesetting/modesetting.man
@@ -0,0 +1,54 @@
+.\" shorthand for double quote that works everywhere.
+.ds q \N'34'
+.TH MODESETTING __drivermansuffix__ __vendorversion__
+.SH NAME
+modesetting \- video driver for framebuffer device
+.SH SYNOPSIS
+.nf
+.B "Section \*qDevice\*q"
+.BI " Identifier \*q" devname \*q
+.B " Driver \*qmodesetting\*q"
+.BI " BusID \*qpci:" bus : dev : func \*q
+\ \ ...
+.B EndSection
+.fi
+.SH DESCRIPTION
+.B modesetting
+is an __xservername__ driver for KMS devices. This is a non-accelerated
+driver, the following framebuffer depths are supported: 8, 15, 16, 24.
+All visual types are supported for depth 8, and TrueColor visual is
+supported for the other depths. RandR 1.2 is supported.
+.SH SUPPORTED HARDWARE
+The
+.B modesetting
+driver supports all hardware where a KMS driver is available.
+modesetting uses the Linux DRM KMS ioctls and dumb object create/map.
+.SH CONFIGURATION DETAILS
+Please refer to __xconfigfile__(__filemansuffix__) for general configuration
+details. This section only covers configuration details specific to
+this driver.
+.PP
+For this driver it is not required to specify modes in the screen
+section of the config file. The
+.B modesetting
+driver can pick up the currently used video mode from the kernel
+driver and will use it if there are no video modes configured.
+.PP
+For PCI boards you might have to add a BusID line to the Device
+section. See above for a sample line.
+.PP
+The following driver
+.B Options
+are supported:
+.TP
+.BI "Option \*qkmsdev\*q \*q" string \*q
+The framebuffer device to use. Default: /dev/dri/card0.
+.TP
+.BI "Option \*qShadowFB\*q \*q" boolean \*q
+Enable or disable use of the shadow framebuffer layer. Default: on.
+.TP
+.SH "SEE ALSO"
+__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__),
+X(__miscmansuffix__)
+.SH AUTHORS
+Authors include: Dave Airlie
diff --git a/xorg-server/hw/xfree86/int10/generic.c b/xorg-server/hw/xfree86/int10/generic.c
index 73a1e5e49..012d1941a 100644
--- a/xorg-server/hw/xfree86/int10/generic.c
+++ b/xorg-server/hw/xfree86/int10/generic.c
@@ -99,6 +99,20 @@ static void UnmapVRam(xf86Int10InfoPtr pInt);
static void *sysMem = NULL;
+static Bool
+readIntVec(struct pci_device *dev, unsigned char *buf, int len)
+{
+ void *map;
+
+ if (!pci_device_map_legacy(dev, 0, len, 0, &map))
+ return FALSE;
+
+ memcpy(buf, map, len);
+ pci_device_unmap_legacy(dev, map, len);
+
+ return TRUE;
+}
+
xf86Int10InfoPtr
xf86ExtendedInitInt10(int entityIndex, int Flags)
{
@@ -144,7 +158,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
PCI_DEV_MAP_FLAG_WRITABLE, &sysMem);
INTPriv(pInt)->sysMem = sysMem;
- if (xf86ReadBIOS(0, 0, base, LOW_PAGE_SIZE) < 0) {
+ if (!readIntVec(pInt->dev, base, LOW_PAGE_SIZE)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot read int vect\n");
goto error1;
}
diff --git a/xorg-server/hw/xfree86/loader/loadmod.c b/xorg-server/hw/xfree86/loader/loadmod.c
index f1f7c224f..21ccb1bf9 100644
--- a/xorg-server/hw/xfree86/loader/loadmod.c
+++ b/xorg-server/hw/xfree86/loader/loadmod.c
@@ -584,7 +584,6 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data,
const XF86ModReqInfo * req)
{
int vercode[4];
- char verstr[4];
long ver = data->xf86version;
MessageType errtype;
@@ -592,42 +591,15 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data,
data->modname ? data->modname : "UNKNOWN!",
data->vendor ? data->vendor : "UNKNOWN!");
- /* Check for the different scheme used in XFree86 4.0.x releases:
- * ((((((((major << 7) | minor) << 7) | subminor) << 5) | beta) << 5) | alpha)
- * Since it wasn't used in 4.1.0 or later, limit to versions in the 4.0.x
- * range, which limits the overlap with the new version scheme to conflicts
- * with 6.71.8.764 through 6.72.39.934.
- */
- if ((ver > (4 << 24)) && (ver < ((4 << 24) + (1 << 17)))) {
- /* 4.0.x and earlier */
- verstr[1] = verstr[3] = 0;
- verstr[2] = (ver & 0x1f) ? (ver & 0x1f) + 'a' - 1 : 0;
- ver >>= 5;
- verstr[0] = (ver & 0x1f) ? (ver & 0x1f) + 'A' - 1 : 0;
- ver >>= 5;
- vercode[2] = ver & 0x7f;
- ver >>= 7;
- vercode[1] = ver & 0x7f;
- ver >>= 7;
- vercode[0] = ver;
- xf86ErrorF("\tcompiled for %d.%d", vercode[0], vercode[1]);
- if (vercode[2] != 0)
- xf86ErrorF(".%d", vercode[2]);
- xf86ErrorF("%s%s, module version = %d.%d.%d\n", verstr, verstr + 2,
- data->majorversion, data->minorversion, data->patchlevel);
- }
- else {
- vercode[0] = ver / 10000000;
- vercode[1] = (ver / 100000) % 100;
- vercode[2] = (ver / 1000) % 100;
- vercode[3] = ver % 1000;
- xf86ErrorF("\tcompiled for %d.%d.%d", vercode[0], vercode[1],
- vercode[2]);
- if (vercode[3] != 0)
- xf86ErrorF(".%d", vercode[3]);
- xf86ErrorF(", module version = %d.%d.%d\n", data->majorversion,
- data->minorversion, data->patchlevel);
- }
+ vercode[0] = ver / 10000000;
+ vercode[1] = (ver / 100000) % 100;
+ vercode[2] = (ver / 1000) % 100;
+ vercode[3] = ver % 1000;
+ xf86ErrorF("\tcompiled for %d.%d.%d", vercode[0], vercode[1], vercode[2]);
+ if (vercode[3] != 0)
+ xf86ErrorF(".%d", vercode[3]);
+ xf86ErrorF(", module version = %d.%d.%d\n", data->majorversion,
+ data->minorversion, data->patchlevel);
if (data->moduleclass)
xf86ErrorFVerb(2, "\tModule class: %s\n", data->moduleclass);
diff --git a/xorg-server/hw/xfree86/man/xorg.conf.man b/xorg-server/hw/xfree86/man/xorg.conf.man
index 16312124d..378f26b59 100644
--- a/xorg-server/hw/xfree86/man/xorg.conf.man
+++ b/xorg-server/hw/xfree86/man/xorg.conf.man
@@ -2023,12 +2023,6 @@ Default: false.
Disables the Int10 module, a module that uses the int10 call to the BIOS
of the graphics card to initialize it.
Default: false.
-.TP 7
-.BI "Option \*qNoMTRR\*q"
-Disables MTRR (Memory Type Range Register) support, a feature of modern
-processors which can improve video performance by a factor of up to 2.5.
-Some hardware has buggy MTRR support, and some video drivers have been
-known to exhibit problems when MTRR's are used.
.PP
Each
.B Screen
diff --git a/xorg-server/hw/xfree86/os-support/bsd/Makefile.am b/xorg-server/hw/xfree86/os-support/bsd/Makefile.am
index 7133c0f21..b01ea5bca 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/Makefile.am
+++ b/xorg-server/hw/xfree86/os-support/bsd/Makefile.am
@@ -27,9 +27,7 @@ if ALPHA_VIDEO
# Cheat here and piggyback other alpha bits on ALPHA_VIDEO.
ARCH_SOURCES = \
alpha_video.c \
- bsd_ev56.c \
- bsd_axp.c \
- $(srcdir)/../shared/xf86Axp.c
+ bsd_ev56.c
endif
if ARM_VIDEO
diff --git a/xorg-server/hw/xfree86/os-support/bsd/alpha_video.c b/xorg-server/hw/xfree86/os-support/bsd/alpha_video.c
index f656f5595..236def6ff 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/alpha_video.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/alpha_video.c
@@ -35,11 +35,6 @@
#ifndef __NetBSD__
#include <sys/sysctl.h>
#endif
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
-#include <machine/sysarch.h>
-#endif
-
-#include "xf86Axp.h"
#include "xf86_OSlib.h"
#include "xf86OSpriv.h"
@@ -50,69 +45,9 @@
#define MAP_FLAGS (MAP_FILE | MAP_SHARED)
#endif
-axpDevice bsdGetAXP(void);
-
#ifndef __NetBSD__
extern unsigned long dense_base(void);
-
-static int axpSystem = -1;
-static unsigned long hae_thresh;
-static unsigned long hae_mask;
-
-static unsigned long
-memory_base(void)
-{
- static unsigned long base = 0;
-
- if (base == 0) {
- size_t len = sizeof(base);
- int error;
-
-#ifdef __OpenBSD__
- int mib[3];
-
- mib[0] = CTL_MACHDEP;
- mib[1] = CPU_CHIPSET;
- mib[2] = CPU_CHIPSET_MEM;
-
- if ((error = sysctl(mib, 3, &base, &len, NULL, 0)) < 0)
-#else
- if ((error = sysctlbyname("hw.chipset.memory", &base, &len, 0, 0)) < 0)
-#endif
- FatalError("xf86MapVidMem: can't find memory\n");
- }
-
- return base;
-}
-
-static int
-has_bwx(void)
-{
- static int bwx = 0;
- size_t len = sizeof(bwx);
- int error;
-
-#ifdef __OpenBSD__
- int mib[3];
-
- mib[0] = CTL_MACHDEP;
- mib[1] = CPU_CHIPSET;
- mib[2] = CPU_CHIPSET_BWX;
-
- if ((error = sysctl(mib, 3, &bwx, &len, NULL, 0)) < 0)
- return FALSE;
- else
- return bwx;
-#else
- if ((error = sysctlbyname("hw.chipset.bwx", &bwx, &len, 0, 0)) < 0)
- return FALSE;
- else
- return bwx;
-#endif
-}
#else /* __NetBSD__ */
-static unsigned long hae_thresh = (1UL << 24);
-static unsigned long hae_mask = 0xf8000000UL; /* XXX - should use xf86AXP.c */
static struct alpha_bus_window *abw;
static int abw_count = -1;
@@ -126,16 +61,6 @@ init_abw(void)
}
}
-static int
-has_bwx(void)
-{
- if (abw_count < 0)
- init_abw();
-
- xf86Msg(X_INFO, "has_bwx = %d\n", abw[0].abw_abst.abst_flags & ABST_BWX ? 1 : 0); /* XXXX */
- return abw[0].abw_abst.abst_flags & ABST_BWX;
-}
-
static unsigned long
dense_base(void)
{
@@ -147,30 +72,9 @@ dense_base(void)
return abw[0].abw_abst.abst_sys_start;
}
-static unsigned long
-memory_base(void)
-{
- if (abw_count < 0)
- init_abw();
-
- if (abw_count > 1) {
- xf86Msg(X_INFO, "memory base = %#lx\n", abw[1].abw_abst.abst_sys_start); /* XXXX */
- return abw[1].abw_abst.abst_sys_start;
- }
- else if (abw_count == 1) {
- /* assume memory_base == dense_base */
- xf86Msg(X_INFO, "memory base = %#lx\n", abw[0].abw_abst.abst_sys_start); /* XXXX */
- return abw[0].abw_abst.abst_sys_start;
- }
- else {
- xf86Msg(X_INFO, "no memory base\n"); /* XXXX */
- return 0;
- }
-}
#endif /* __NetBSD__ */
#define BUS_BASE dense_base()
-#define BUS_BASE_BWX memory_base()
/***************************************************************************/
/* Video Memory Mapping section */
@@ -182,18 +86,12 @@ memory_base(void)
"\trefer to xf86(4) for details"
#endif
-static Bool useDevMem = FALSE;
static int devMemFd = -1;
#ifdef HAS_APERTURE_DRV
#define DEV_APERTURE "/dev/xf86"
#endif
-static void *mapVidMem(int, unsigned long, unsigned long, int);
-static void unmapVidMem(int, void *, unsigned long);
-static void *mapVidMemSparse(int, unsigned long, unsigned long, int);
-static void unmapVidMemSparse(int, void *, unsigned long);
-
/*
* Check if /dev/mem can be mmap'd. If it can't print a warning when
* "warn" is TRUE.
@@ -219,7 +117,6 @@ checkDevMem(Bool warn)
if (base != MAP_FAILED) {
munmap((caddr_t) base, 4096);
devMemFd = fd;
- useDevMem = TRUE;
xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n",
DEV_APERTURE);
return;
@@ -240,7 +137,6 @@ checkDevMem(Bool warn)
if (base != MAP_FAILED) {
munmap((caddr_t) base, 4096);
devMemFd = fd;
- useDevMem = TRUE;
return;
}
else {
@@ -266,7 +162,6 @@ checkDevMem(Bool warn)
#endif
xf86ErrorF("\tlinear framebuffer access unavailable\n");
}
- useDevMem = FALSE;
return;
}
@@ -274,117 +169,10 @@ void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
checkDevMem(TRUE);
- pVidMem->linearSupported = useDevMem;
- if (has_bwx()) {
- xf86Msg(X_PROBED, "Machine type has 8/16 bit access\n");
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
- }
- else {
- xf86Msg(X_PROBED, "Machine needs sparse mapping\n");
- pVidMem->mapMem = mapVidMemSparse;
- pVidMem->unmapMem = unmapVidMemSparse;
-#ifndef __NetBSD__
- if (axpSystem == -1)
- axpSystem = bsdGetAXP();
- hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
- hae_mask = xf86AXPParams[axpSystem].hae_mask;
-#endif /* __NetBSD__ */
- }
pVidMem->initialised = TRUE;
}
-static void *
-mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- void *base;
-
- checkDevMem(FALSE);
- Base = Base & ((1L << 32) - 1);
-
- if (useDevMem) {
- if (devMemFd < 0) {
- FatalError("xf86MapVidMem: failed to open %s (%s)\n",
- DEV_MEM, strerror(errno));
- }
- base = mmap((caddr_t) 0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, devMemFd, (off_t) Base + BUS_BASE_BWX);
- if (base == MAP_FAILED) {
- FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)\n",
- "xf86MapVidMem", DEV_MEM, Size, Base, strerror(errno));
- }
- return base;
- }
-
- /* else, mmap /dev/vga */
- if ((unsigned long) Base < 0xA0000 || (unsigned long) Base >= 0xC0000) {
- FatalError("%s: Address 0x%lx outside allowable range\n",
- "xf86MapVidMem", Base);
- }
- base = mmap(0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, xf86Info.consoleFd, (unsigned long) Base + BUS_BASE);
- if (base == MAP_FAILED) {
- FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n",
- strerror(errno));
- }
- return base;
-}
-
-static void
-unmapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- munmap((caddr_t) Base, Size);
-}
-
-/*
- * Read BIOS via mmap()ing DEV_MEM
- */
-
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- unsigned char *ptr;
- int psize;
- int mlen;
-
- checkDevMem(TRUE);
- if (devMemFd == -1) {
- return -1;
- }
-
- psize = getpagesize();
- Offset += Base & (psize - 1);
- Base &= ~(psize - 1);
- mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- ptr = (unsigned char *) mmap((caddr_t) 0, mlen, PROT_READ,
- MAP_SHARED, devMemFd, (off_t) Base + BUS_BASE);
- if ((long) ptr == -1) {
- xf86Msg(X_WARNING,
- "xf86ReadBIOS: %s mmap[s=%x,a=%lx,o=%lx] failed (%s)\n",
- DEV_MEM, Len, Base, Offset, strerror(errno));
- return -1;
- }
-#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3,
- "xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", Base,
- ptr[0] | (ptr[1] << 8));
-#endif
- (void) memcpy(Buf, (void *) (ptr + Offset), Len);
- (void) munmap((caddr_t) ptr, mlen);
-#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)"
- "-> %02x %02x %02x %02x...\n",
- Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]);
-#endif
- return Len;
-}
-
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
extern int ioperm(unsigned long from, unsigned long num, int on);
@@ -422,11 +210,6 @@ xf86DisableIO()
#endif /* USE_ALPHA_PIO */
-#define vuip volatile unsigned int *
-
-static void *memSBase = 0;
-static void *memBase = 0;
-
extern int readDense8(void *Base, register unsigned long Offset);
extern int readDense16(void *Base, register unsigned long Offset);
extern int readDense32(void *Base, register unsigned long Offset);
@@ -437,223 +220,6 @@ extern void
extern void
writeDense32(int Value, void *Base, register unsigned long Offset);
-static int readSparse8(void *Base, register unsigned long Offset);
-static int readSparse16(void *Base, register unsigned long Offset);
-static int readSparse32(void *Base, register unsigned long Offset);
-static void
- writeSparseNB8(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparseNB16(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparseNB32(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparse8(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparse16(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparse32(int Value, void *Base, register unsigned long Offset);
-
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-extern int sysarch(int, void *);
-
-struct parms {
- u_int64_t hae;
-};
-
-static void
-sethae(u_int64_t hae)
-{
-#ifndef ALPHA_SETHAE
-#define ALPHA_SETHAE 0
-#endif
- static struct parms p;
-
- if (p.hae != hae) {
- p.hae = hae;
- sysarch(ALPHA_SETHAE, (char *) &p);
- }
-}
-#endif
-
-static void *
-mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size,
- int flags)
-{
- static Bool was_here = FALSE;
-
- if (!was_here) {
- was_here = TRUE;
-
- checkDevMem(FALSE);
-
- xf86WriteMmio8 = writeSparse8;
- xf86WriteMmio16 = writeSparse16;
- xf86WriteMmio32 = writeSparse32;
- xf86WriteMmioNB8 = writeSparseNB8;
- xf86WriteMmioNB16 = writeSparseNB16;
- xf86WriteMmioNB32 = writeSparseNB32;
- xf86ReadMmio8 = readSparse8;
- xf86ReadMmio16 = readSparse16;
- xf86ReadMmio32 = readSparse32;
-
- memBase = mmap((caddr_t) 0, 0x100000000,
- PROT_READ | PROT_WRITE,
- MAP_SHARED, devMemFd, (off_t) BUS_BASE);
- memSBase = mmap((caddr_t) 0, 0x100000000,
- PROT_READ | PROT_WRITE,
- MAP_SHARED, devMemFd, (off_t) BUS_BASE_BWX);
-
- if (memSBase == MAP_FAILED || memBase == MAP_FAILED) {
- FatalError("xf86MapVidMem: Could not mmap framebuffer (%s)\n",
- strerror(errno));
- }
- }
- return (void *) ((unsigned long) memBase + Base);
-}
-
-static void
-unmapVidMemSparse(int ScreenNum, void *Base, unsigned long Size)
-{
-}
-
-static int
-readSparse8(void *Base, register unsigned long Offset)
-{
- register unsigned long result, shift;
- register unsigned long msb;
-
- mem_barrier();
- Offset += (unsigned long) Base - (unsigned long) memBase;
- shift = (Offset & 0x3) << 3;
- if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask;
- Offset -= msb;
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- sethae(msb);
-#endif
- }
- result = *(vuip) ((unsigned long) memSBase + (Offset << 5));
- result >>= shift;
- return 0xffUL & result;
-}
-
-static int
-readSparse16(void *Base, register unsigned long Offset)
-{
- register unsigned long result, shift;
- register unsigned long msb;
-
- mem_barrier();
- Offset += (unsigned long) Base - (unsigned long) memBase;
- shift = (Offset & 0x2) << 3;
- if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask;
- Offset -= msb;
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- sethae(msb);
-#endif
- }
- result =
- *(vuip) ((unsigned long) memSBase + (Offset << 5) + (1 << (5 - 2)));
- result >>= shift;
- return 0xffffUL & result;
-}
-
-static int
-readSparse32(void *Base, register unsigned long Offset)
-{
- mem_barrier();
- return *(vuip) ((unsigned long) Base + (Offset));
-}
-
-static void
-writeSparse8(int Value, void *Base, register unsigned long Offset)
-{
- register unsigned long msb;
- register unsigned int b = Value & 0xffU;
-
- write_mem_barrier();
- Offset += (unsigned long) Base - (unsigned long) memBase;
- if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask;
- Offset -= msb;
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- sethae(msb);
-#endif
- }
- *(vuip) ((unsigned long) memSBase + (Offset << 5)) = b * 0x01010101;
-}
-
-static void
-writeSparse16(int Value, void *Base, register unsigned long Offset)
-{
- register unsigned long msb;
- register unsigned int w = Value & 0xffffU;
-
- write_mem_barrier();
- Offset += (unsigned long) Base - (unsigned long) memBase;
- if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask;
- Offset -= msb;
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- sethae(msb);
-#endif
- }
- *(vuip) ((unsigned long) memSBase + (Offset << 5) + (1 << (5 - 2))) =
- w * 0x00010001;
-
-}
-
-static void
-writeSparse32(int Value, void *Base, register unsigned long Offset)
-{
- write_mem_barrier();
- *(vuip) ((unsigned long) Base + (Offset)) = Value;
- return;
-}
-
-static void
-writeSparseNB8(int Value, void *Base, register unsigned long Offset)
-{
- register unsigned long msb;
- register unsigned int b = Value & 0xffU;
-
- Offset += (unsigned long) Base - (unsigned long) memBase;
- if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask;
- Offset -= msb;
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- sethae(msb);
-#endif
- }
- *(vuip) ((unsigned long) memSBase + (Offset << 5)) = b * 0x01010101;
-}
-
-static void
-writeSparseNB16(int Value, void *Base, register unsigned long Offset)
-{
- register unsigned long msb;
- register unsigned int w = Value & 0xffffU;
-
- Offset += (unsigned long) Base - (unsigned long) memBase;
- if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask;
- Offset -= msb;
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- sethae(msb);
-#endif
- }
- *(vuip) ((unsigned long) memSBase + (Offset << 5) + (1 << (5 - 2))) =
- w * 0x00010001;
-}
-
-static void
-writeSparseNB32(int Value, void *Base, register unsigned long Offset)
-{
- *(vuip) ((unsigned long) Base + (Offset)) = Value;
- return;
-}
-
void (*xf86WriteMmio8) (int Value, void *Base, unsigned long Offset)
= writeDense8;
void (*xf86WriteMmio16) (int Value, void *Base, unsigned long Offset)
diff --git a/xorg-server/hw/xfree86/os-support/bsd/arm_video.c b/xorg-server/hw/xfree86/os-support/bsd/arm_video.c
index e295c9244..3a639b8c6 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/arm_video.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/arm_video.c
@@ -66,35 +66,6 @@
#include "xf86_OSlib.h"
#include "xf86OSpriv.h"
-#ifdef __arm32__
-#include "machine/devmap.h"
-struct memAccess {
- int ioctl;
- struct map_info memInfo;
- void *regionVirtBase;
- Bool Checked;
- Bool OK;
-};
-
-static void *xf86MapInfoMap();
-static void xf86MapInfoUnmap();
-static struct memAccess *checkMapInfo();
-extern int vgaPhysLinearBase;
-
-/* A memAccess structure is needed for each possible region */
-struct memAccess vgaMemInfo = { CONSOLE_GET_MEM_INFO, NULL, NULL,
- FALSE, FALSE
-};
-
-struct memAccess linearMemInfo = { CONSOLE_GET_LINEAR_INFO, NULL, NULL,
- FALSE, FALSE
-};
-
-struct memAccess ioMemInfo = { CONSOLE_GET_IO_INFO, NULL, NULL,
- FALSE, FALSE
-};
-#endif /* __arm32__ */
-
#if defined(__NetBSD__) && !defined(MAP_FILE)
#define MAP_FLAGS MAP_SHARED
#else
@@ -108,12 +79,8 @@ struct memAccess ioMemInfo = { CONSOLE_GET_IO_INFO, NULL, NULL,
/* Video Memory Mapping section */
/***************************************************************************/
-static Bool useDevMem = FALSE;
static int devMemFd = -1;
-static void *mapVidMem(int, unsigned long, unsigned long, int);
-static void unmapVidMem(int, void *, unsigned long);
-
/*
* Check if /dev/mem can be mmap'd. If it can't print a warning when
* "warn" is TRUE.
@@ -137,7 +104,6 @@ checkDevMem(Bool warn)
if (base != MAP_FAILED) {
munmap((caddr_t) base, 4096);
devMemFd = fd;
- useDevMem = TRUE;
return;
}
else {
@@ -146,7 +112,6 @@ checkDevMem(Bool warn)
xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
DEV_MEM, strerror(errno));
}
- useDevMem = FALSE;
return;
}
}
@@ -154,266 +119,17 @@ checkDevMem(Bool warn)
xf86Msg(X_WARNING, "checkDevMem: failed to open %s (%s)\n",
DEV_MEM, strerror(errno));
}
- useDevMem = FALSE;
return;
}
void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
-
checkDevMem(TRUE);
- pVidMem->linearSupported = useDevMem;
- pVidMem->mapMem = armMapVidMem;
- pVidMem->unmapVidMem = armUnmapVidMem;
pVidMem->initialised = TRUE;
}
-static void *
-mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- void *base;
-
- checkDevMem(FALSE);
-
- if (useDevMem) {
- if (devMemFd < 0) {
- FatalError("xf86MapVidMem: failed to open %s (%s)\n",
- DEV_MEM, strerror(errno));
- }
- base = mmap((caddr_t) 0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, devMemFd, (off_t) Base + BUS_BASE_BWX);
- if (base == MAP_FAILED) {
- FatalError("%s: could not mmap %s [s=%x,a=%x] (%s)\n",
- "xf86MapVidMem", DEV_MEM, Size, Base, strerror(errno));
- }
- return base;
- }
-
- /* else, mmap /dev/vga */
- if ((unsigned long) Base < 0xA0000 || (unsigned long) Base >= 0xC0000) {
- FatalError("%s: Address 0x%x outside allowable range\n",
- "xf86MapVidMem", Base);
- }
- base = mmap(0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, xf86Info.consoleFd, (unsigned long) Base - 0xA0000);
- if (base == MAP_FAILED) {
- FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n",
- strerror(errno));
- }
- return base;
-}
-
-static void
-unmapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- munmap((caddr_t) Base, Size);
-}
-
-/*
- * Read BIOS via mmap()ing DEV_MEM
- */
-
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- unsigned char *ptr;
- int psize;
- int mlen;
-
- checkDevMem(TRUE);
- if (devMemFd == -1) {
- return -1;
- }
-
- psize = getpagesize();
- Offset += Base & (psize - 1);
- Base &= ~(psize - 1);
- mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- ptr = (unsigned char *) mmap((caddr_t) 0, mlen, PROT_READ,
- MAP_SHARED, devMemFd, (off_t) Base + BUS_BASE);
- if ((long) ptr == -1) {
- xf86Msg(X_WARNING,
- "xf86ReadBIOS: %s mmap[s=%x,a=%x,o=%x] failed (%s)\n",
- DEV_MEM, Len, Base, Offset, strerror(errno));
- return -1;
- }
-#ifdef DEBUG
- ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
- Base, ptr[0] | (ptr[1] << 8));
-#endif
- (void) memcpy(Buf, (void *) (ptr + Offset), Len);
- (void) munmap((caddr_t) ptr, mlen);
-#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)"
- "-> %02x %02x %02x %02x...\n",
- Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]);
-#endif
- return Len;
-}
-
-/* XXX This needs to be updated for the ND */
-
-/*
-** Find out whether the console driver provides memory mapping information
-** for the specified region and return the map_info pointer. Print a warning if required.
-*/
-static struct memAccess *
-checkMapInfo(Bool warn, int Region)
-{
- struct memAccess *memAccP;
-
- switch (Region) {
- case VGA_REGION:
- memAccP = &vgaMemInfo;
- break;
-
- case LINEAR_REGION:
- memAccP = &linearMemInfo;
- break;
-
- case MMIO_REGION:
- memAccP = &ioMemInfo;
- break;
-
- default:
- return NULL;
- break;
- }
-
- if (!memAccP->Checked) {
- if (ioctl(xf86Info.consoleFd, memAccP->ioctl, &(memAccP->memInfo)) ==
- -1) {
- if (warn) {
- xf86Msg(X_WARNING,
- "checkMapInfo: failed to get map info for region %d\n\t(%s)\n",
- Region, strerror(errno));
- }
- }
- else {
- if (memAccP->memInfo.u.map_info_mmap.map_offset != MAP_INFO_UNKNOWN)
- memAccP->OK = TRUE;
- }
- memAccP->Checked = TRUE;
- }
- if (memAccP->OK) {
- return memAccP;
- }
- else {
- return NULL;
- }
-}
-
-static void *
-xf86MapInfoMap(struct memAccess *memInfoP, void *Base, unsigned long Size)
-{
- struct map_info *mapInfoP = &(memInfoP->memInfo);
-
- if (mapInfoP->u.map_info_mmap.map_size == MAP_INFO_UNKNOWN) {
- Size = (unsigned long) Base + Size;
- }
- else {
- Size = mapInfoP->u.map_info_mmap.map_size;
- }
-
- switch (mapInfoP->method) {
- case MAP_MMAP:
- /* Need to remap if size is unknown because we may not have
- mapped the whole region initially */
- if (memInfoP->regionVirtBase == NULL ||
- mapInfoP->u.map_info_mmap.map_size == MAP_INFO_UNKNOWN) {
- if ((memInfoP->regionVirtBase =
- mmap((caddr_t) 0,
- Size,
- PROT_READ | PROT_WRITE,
- MAP_SHARED,
- xf86Info.consoleFd,
- (unsigned long) mapInfoP->u.map_info_mmap.map_offset))
- == (void *) -1) {
- FatalError
- ("xf86MapInfoMap: Failed to map memory at 0x%x\n\t%s\n",
- mapInfoP->u.map_info_mmap.map_offset, strerror(errno));
- }
- if (mapInfoP->u.map_info_mmap.internal_offset > 0)
- memInfoP->regionVirtBase +=
- mapInfoP->u.map_info_mmap.internal_offset;
- }
- break;
-
- default:
- FatalError("xf86MapInfoMap: Unsuported mapping method\n");
- break;
- }
-
- return (void *) ((int) memInfoP->regionVirtBase + (int) Base);
-}
-
-static void
-xf86MapInfoUnmap(struct memAccess *memInfoP, unsigned long Size)
-{
- struct map_info *mapInfoP = &(memInfoP->memInfo);
-
- switch (mapInfoP->method) {
- case MAP_MMAP:
- if (memInfoP->regionVirtBase != NULL) {
- if (mapInfoP->u.map_info_mmap.map_size != MAP_INFO_UNKNOWN)
- Size = mapInfoP->u.map_info_mmap.map_size;
- munmap((caddr_t) memInfoP->regionVirtBase, Size);
- memInfoP->regionVirtBase = NULL;
- }
- break;
- default:
- FatalError("xf86MapInfoMap: Unsuported mapping method\n");
- break;
- }
-}
-
-static void *
-armMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- struct memAccess *memInfoP;
-
- if ((memInfoP = checkMapInfo(FALSE, Region)) != NULL) {
- /*
- ** xf86 passes in a physical address offset from the start
- ** of physical memory, but xf86MapInfoMap expects an
- ** offset from the start of the specified region - it gets
- ** the physical address of the region from the display driver.
- */
- switch (Region) {
- case LINEAR_REGION:
- if (vgaPhysLinearBase) {
- Base -= vgaPhysLinearBase;
- }
- break;
- case VGA_REGION:
- Base -= 0xA0000;
- break;
- }
-
- base = xf86MapInfoMap(memInfoP, Base, Size);
- return base;
- }
- return mapVidMem(ScreenNum, Base, Size, flags);
-}
-
-static void
-armUnmapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- struct memAccess *memInfoP;
-
- if ((memInfoP = checkMapInfo(FALSE, Region)) != NULL) {
- xf86MapInfoUnmap(memInfoP, Base, Size);
- }
- unmapVidMem(ScreenNum, Base, Size);
-}
-
#ifdef USE_DEV_IO
static int IoFd = -1;
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_axp.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_axp.c
deleted file mode 100644
index e7a36f8bf..000000000
--- a/xorg-server/hw/xfree86/os-support/bsd/bsd_axp.c
+++ /dev/null
@@ -1,71 +0,0 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include "os.h"
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "shared/xf86Axp.h"
-#include <sys/param.h>
-#include "xf86_OSlib.h"
-#include <stdio.h>
-#include <sys/sysctl.h>
-
-axpDevice bsdGetAXP(void);
-
-/*
- * BSD does a very nice job providing system information to
- * user space programs. Unfortunately it doesn't provide all
- * the information required. Therefore we just obtain the
- * system type and look up the rest from a list we maintain
- * ourselves.
- */
-
-typedef struct {
- char *name;
- int type;
-} _AXP;
-
-static _AXP axpList[] = {
- {"apecs", APECS},
- {"pyxis", PYXIS},
- {"cia", CIA},
- {"irongate", IRONGATE},
- {"lca", LCA},
- {"t2", T2},
- {"tsunami", TSUNAMI},
- {NULL, SYS_NONE}
-};
-
-axpDevice
-bsdGetAXP(void)
-{
- int i;
- char sysname[64];
- size_t len = sizeof(sysname);
-
-#ifdef __OpenBSD__
- int mib[3];
- int error;
-
- mib[0] = CTL_MACHDEP;
- mib[1] = CPU_CHIPSET;
- mib[2] = CPU_CHIPSET_TYPE;
-
- if ((error = sysctl(mib, 3, &sysname, &len, NULL, 0)) < 0)
-#else
- if ((sysctlbyname("hw.chipset.type", &sysname, &len, 0, 0)) < 0)
-#endif
- FatalError("bsdGetAXP: can't find machine type\n");
-#ifdef DEBUG
- xf86Msg(X_INFO, "AXP is a: %s\n", sysname);
-#endif
- for (i = 0;; i++) {
- if (axpList[i].name == NULL)
- return SYS_NONE;
- if (!strcmp(sysname, axpList[i].name))
- return axpList[i].type;
- }
-}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/i386_video.c b/xorg-server/hw/xfree86/os-support/bsd/i386_video.c
index 745319054..6c3bbcb48 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/i386_video.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/i386_video.c
@@ -34,27 +34,6 @@
#include <errno.h>
#include <sys/mman.h>
-#ifdef HAS_MTRR_SUPPORT
-#ifndef __NetBSD__
-#include <sys/types.h>
-#include <sys/memrange.h>
-#else
-#include "memrange.h"
-#endif
-#define X_MTRR_ID "XFree86"
-#endif
-
-#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__)
-#include <machine/mtrr.h>
-#include <machine/sysarch.h>
-#include <sys/queue.h>
-#ifdef __x86_64__
-#define i386_set_mtrr x86_64_set_mtrr
-#define i386_get_mtrr x86_64_get_mtrr
-#define i386_iopl x86_64_iopl
-#endif
-#endif
-
#include "xf86_OSlib.h"
#include "xf86OSpriv.h"
@@ -85,20 +64,6 @@ static int devMemFd = -1;
#define DEV_APERTURE "/dev/xf86"
#endif
-static void *mapVidMem(int, unsigned long, unsigned long, int);
-static void unmapVidMem(int, void *, unsigned long);
-
-#ifdef HAS_MTRR_SUPPORT
-static void *setWC(int, unsigned long, unsigned long, Bool, MessageType);
-static void undoWC(int, void *);
-static Bool cleanMTRR(void);
-#endif
-#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__)
-static void *NetBSDsetWC(int, unsigned long, unsigned long, Bool,
- MessageType);
-static void NetBSDundoWC(int, void *);
-#endif
-
/*
* Check if /dev/mem can be mmap'd. If it can't print a warning when
* "warn" is TRUE.
@@ -188,119 +153,10 @@ void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
checkDevMem(TRUE);
- pVidMem->linearSupported = useDevMem;
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
-
- if (useDevMem)
- pci_system_init_dev_mem(devMemFd);
-
-#ifdef HAS_MTRR_SUPPORT
- if (useDevMem) {
- if (cleanMTRR()) {
- pVidMem->setWC = setWC;
- pVidMem->undoWC = undoWC;
- }
- }
-#endif
-#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__)
- pVidMem->setWC = NetBSDsetWC;
- pVidMem->undoWC = NetBSDundoWC;
-#endif
- pVidMem->initialised = TRUE;
-}
-static void *
-mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- void *base;
+ pci_system_init_dev_mem(devMemFd);
- checkDevMem(FALSE);
-
- if (useDevMem) {
- if (devMemFd < 0) {
- FatalError("xf86MapVidMem: failed to open %s (%s)",
- DEV_MEM, strerror(errno));
- }
- base = mmap((caddr_t) 0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, devMemFd, (off_t) Base);
- if (base == MAP_FAILED) {
- FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)",
- "xf86MapVidMem", DEV_MEM, Size, Base, strerror(errno));
- }
- return base;
- }
-
- /* else, mmap /dev/vga */
- if ((unsigned long) Base < 0xA0000 || (unsigned long) Base >= 0xC0000) {
- FatalError("%s: Address 0x%lx outside allowable range",
- "xf86MapVidMem", Base);
- }
- base = mmap(0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, xf86Info.consoleFd, (unsigned long) Base - 0xA0000);
- if (base == MAP_FAILED) {
- FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)",
- strerror(errno));
- }
- return base;
-}
-
-static void
-unmapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- munmap((caddr_t) Base, Size);
-}
-
-/*
- * Read BIOS via mmap()ing DEV_MEM
- */
-
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- unsigned char *ptr;
- int psize;
- int mlen;
-
- checkDevMem(TRUE);
- if (devMemFd == -1) {
- return -1;
- }
-
- psize = getpagesize();
- Offset += Base & (psize - 1);
- Base &= ~(psize - 1);
- mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- ptr = (unsigned char *) mmap((caddr_t) 0, mlen, PROT_READ,
- MAP_SHARED, devMemFd, (off_t) Base);
- if ((long) ptr == -1) {
- xf86Msg(X_WARNING,
- "xf86ReadBIOS: %s mmap[s=%x,a=%lx,o=%lx] failed (%s)\n",
- DEV_MEM, Len, Base, Offset, strerror(errno));
-#ifdef __OpenBSD__
- if (Base < 0xa0000) {
- xf86Msg(X_WARNING, SYSCTL_MSG2);
- }
-#endif
- return -1;
- }
-#ifdef DEBUG
- ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
- Base, ptr[0] | (ptr[1] << 8));
-#endif
- (void) memcpy(Buf, (void *) (ptr + Offset), Len);
- (void) munmap((caddr_t) ptr, mlen);
-#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)"
- "-> %02x %02x %02x %02x...\n",
- Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]);
-#endif
- return Len;
+ pVidMem->initialised = TRUE;
}
#ifdef USE_I386_IOPL
@@ -470,417 +326,3 @@ xf86SetRGBOut()
return;
}
#endif
-
-#ifdef HAS_MTRR_SUPPORT
-/* memory range (MTRR) support for FreeBSD */
-
-/*
- * This code is experimental. Some parts may be overkill, and other parts
- * may be incomplete.
- */
-
-/*
- * getAllRanges returns the full list of memory ranges with attributes set.
- */
-
-static struct mem_range_desc *
-getAllRanges(int *nmr)
-{
- struct mem_range_desc *mrd;
- struct mem_range_op mro;
-
- /*
- * Find how many ranges there are. If this fails, then the kernel
- * probably doesn't have MTRR support.
- */
- mro.mo_arg[0] = 0;
- if (ioctl(devMemFd, MEMRANGE_GET, &mro))
- return NULL;
- *nmr = mro.mo_arg[0];
- mrd = xnfalloc(*nmr * sizeof(struct mem_range_desc));
- mro.mo_arg[0] = *nmr;
- mro.mo_desc = mrd;
- if (ioctl(devMemFd, MEMRANGE_GET, &mro)) {
- free(mrd);
- return NULL;
- }
- return mrd;
-}
-
-/*
- * cleanMTRR removes any memory attribute that may be left by a previous
- * X server. Normally there won't be any, but this takes care of the
- * case where a server crashed without being able finish cleaning up.
- */
-
-static Bool
-cleanMTRR()
-{
- struct mem_range_desc *mrd;
- struct mem_range_op mro;
- int nmr, i;
-
- /* This shouldn't happen */
- if (devMemFd < 0)
- return FALSE;
-
- if (!(mrd = getAllRanges(&nmr)))
- return FALSE;
-
- for (i = 0; i < nmr; i++) {
- if (strcmp(mrd[i].mr_owner, X_MTRR_ID) == 0 &&
- (mrd[i].mr_flags & MDF_ACTIVE)) {
-#ifdef DEBUG
- ErrorF("Clean for (0x%lx,0x%lx)\n",
- (unsigned long) mrd[i].mr_base,
- (unsigned long) mrd[i].mr_len);
-#endif
- if (mrd[i].mr_flags & MDF_FIXACTIVE) {
- mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
- mrd[i].mr_flags = MDF_UNCACHEABLE;
- }
- else {
- mro.mo_arg[0] = MEMRANGE_SET_REMOVE;
- }
- mro.mo_desc = mrd + i;
- ioctl(devMemFd, MEMRANGE_SET, &mro);
- }
- }
-#ifdef DEBUG
- sleep(10);
-#endif
- free(mrd);
- return TRUE;
-}
-
-typedef struct x_RangeRec {
- struct mem_range_desc mrd;
- Bool wasWC;
- struct x_RangeRec *next;
-} RangeRec, *RangePtr;
-
-static void
-freeRangeList(RangePtr range)
-{
- RangePtr rp;
-
- while (range) {
- rp = range;
- range = rp->next;
- free(rp);
- }
-}
-
-static RangePtr
-dupRangeList(RangePtr list)
-{
- RangePtr new = NULL, rp, p;
-
- rp = list;
- while (rp) {
- p = xnfalloc(sizeof(RangeRec));
- *p = *rp;
- p->next = new;
- new = p;
- rp = rp->next;
- }
- return new;
-}
-
-static RangePtr
-sortRangeList(RangePtr list)
-{
- RangePtr rp1, rp2, copy, sorted = NULL, minp, prev, minprev;
- unsigned long minBase;
-
- /* Sort by base address */
- rp1 = copy = dupRangeList(list);
- while (rp1) {
- minBase = rp1->mrd.mr_base;
- minp = rp1;
- minprev = NULL;
- prev = rp1;
- rp2 = rp1->next;
- while (rp2) {
- if (rp2->mrd.mr_base < minBase) {
- minBase = rp2->mrd.mr_base;
- minp = rp2;
- minprev = prev;
- }
- prev = rp2;
- rp2 = rp2->next;
- }
- if (minprev) {
- minprev->next = minp->next;
- rp1 = copy;
- }
- else {
- rp1 = minp->next;
- }
- minp->next = sorted;
- sorted = minp;
- }
- return sorted;
-}
-
-/*
- * findRanges returns a list of ranges that overlap the specified range.
- */
-
-static void
-findRanges(unsigned long base, unsigned long size, RangePtr * ucp,
- RangePtr * wcp)
-{
- struct mem_range_desc *mrd;
- int nmr, i;
- RangePtr rp, *p;
-
- if (!(mrd = getAllRanges(&nmr)))
- return;
-
- for (i = 0; i < nmr; i++) {
- if ((mrd[i].mr_flags & MDF_ACTIVE) &&
- mrd[i].mr_base < base + size &&
- mrd[i].mr_base + mrd[i].mr_len > base) {
- if (mrd[i].mr_flags & MDF_WRITECOMBINE)
- p = wcp;
- else if (mrd[i].mr_flags & MDF_UNCACHEABLE)
- p = ucp;
- else
- continue;
- rp = xnfalloc(sizeof(RangeRec));
- rp->mrd = mrd[i];
- rp->next = *p;
- *p = rp;
- }
- }
- free(mrd);
-}
-
-/*
- * This checks if the existing overlapping ranges fully cover the requested
- * range. Is this overkill?
- */
-
-static Bool
-fullCoverage(unsigned long base, unsigned long size, RangePtr overlap)
-{
- RangePtr rp1, sorted = NULL;
- unsigned long end;
-
- sorted = sortRangeList(overlap);
- /* Look for gaps */
- rp1 = sorted;
- end = base + size;
- while (rp1) {
- if (rp1->mrd.mr_base > base) {
- freeRangeList(sorted);
- return FALSE;
- }
- else {
- base = rp1->mrd.mr_base + rp1->mrd.mr_len;
- }
- if (base >= end) {
- freeRangeList(sorted);
- return TRUE;
- }
- rp1 = rp1->next;
- }
- freeRangeList(sorted);
- return FALSE;
-}
-
-static void *
-addWC(int screenNum, unsigned long base, unsigned long size, MessageType from)
-{
- RangePtr uc = NULL, wc = NULL, retlist = NULL;
- struct mem_range_desc mrd;
- struct mem_range_op mro;
-
- findRanges(base, size, &uc, &wc);
-
- /* See of the full range is already WC */
- if (!uc && fullCoverage(base, size, wc)) {
- xf86DrvMsg(screenNum, from,
- "Write-combining range (0x%lx,0x%lx) was already set\n",
- base, size);
- return NULL;
- }
-
- /* Otherwise, try to add the new range */
- mrd.mr_base = base;
- mrd.mr_len = size;
- strcpy(mrd.mr_owner, X_MTRR_ID);
- mrd.mr_flags = MDF_WRITECOMBINE;
- mro.mo_desc = &mrd;
- mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
- if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
- xf86DrvMsg(screenNum, X_WARNING,
- "Failed to set write-combining range "
- "(0x%lx,0x%lx)\n", base, size);
- return NULL;
- }
- else {
- xf86DrvMsg(screenNum, from,
- "Write-combining range (0x%lx,0x%lx)\n", base, size);
- retlist = xnfalloc(sizeof(RangeRec));
- retlist->mrd = mrd;
- retlist->wasWC = FALSE;
- retlist->next = NULL;
- return retlist;
- }
-}
-
-static void *
-delWC(int screenNum, unsigned long base, unsigned long size, MessageType from)
-{
- RangePtr uc = NULL, wc = NULL, retlist = NULL;
- struct mem_range_desc mrd;
- struct mem_range_op mro;
-
- findRanges(base, size, &uc, &wc);
-
- /*
- * See of the full range is already not WC, or if there is full
- * coverage from UC ranges.
- */
- if (!wc || fullCoverage(base, size, uc)) {
- xf86DrvMsg(screenNum, from,
- "Write-combining range (0x%lx,0x%lx) was already clear\n",
- base, size);
- return NULL;
- }
-
- /* Otherwise, try to add the new range */
- mrd.mr_base = base;
- mrd.mr_len = size;
- strcpy(mrd.mr_owner, X_MTRR_ID);
- mrd.mr_flags = MDF_UNCACHEABLE;
- mro.mo_desc = &mrd;
- mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
- if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
- xf86DrvMsg(screenNum, X_WARNING,
- "Failed to remove write-combining range "
- "(0x%lx,0x%lx)\n", base, size);
- /* XXX Should then remove all of the overlapping WC ranges */
- return NULL;
- }
- else {
- xf86DrvMsg(screenNum, from,
- "Removed Write-combining range (0x%lx,0x%lx)\n", base, size);
- retlist = xnfalloc(sizeof(RangeRec));
- retlist->mrd = mrd;
- retlist->wasWC = TRUE;
- retlist->next = NULL;
- return retlist;
- }
-}
-
-static void *
-setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
- MessageType from)
-{
- if (enable)
- return addWC(screenNum, base, size, from);
- else
- return delWC(screenNum, base, size, from);
-}
-
-static void
-undoWC(int screenNum, void *list)
-{
- RangePtr rp;
- struct mem_range_op mro;
- Bool failed;
-
- rp = list;
- while (rp) {
-#ifdef DEBUG
- ErrorF("Undo for (0x%lx,0x%lx), %d\n",
- (unsigned long) rp->mrd.mr_base,
- (unsigned long) rp->mrd.mr_len, rp->wasWC);
-#endif
- failed = FALSE;
- if (rp->wasWC) {
- mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
- rp->mrd.mr_flags = MDF_WRITECOMBINE;
- strcpy(rp->mrd.mr_owner, "unknown");
- }
- else {
- mro.mo_arg[0] = MEMRANGE_SET_REMOVE;
- }
- mro.mo_desc = &rp->mrd;
-
- if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
- if (!rp->wasWC) {
- mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
- rp->mrd.mr_flags = MDF_UNCACHEABLE;
- strcpy(rp->mrd.mr_owner, "unknown");
- if (ioctl(devMemFd, MEMRANGE_SET, &mro))
- failed = TRUE;
- }
- else
- failed = TRUE;
- }
- if (failed) {
- xf86DrvMsg(screenNum, X_WARNING,
- "Failed to restore MTRR range (0x%lx,0x%lx)\n",
- (unsigned long) rp->mrd.mr_base,
- (unsigned long) rp->mrd.mr_len);
- }
- rp = rp->next;
- }
-}
-
-#endif /* HAS_MTRR_SUPPORT */
-
-#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__)
-static void *
-NetBSDsetWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
- MessageType from)
-{
- struct mtrr *mtrrp;
- int n;
-
- xf86DrvMsg(screenNum, X_WARNING,
- "%s MTRR %lx - %lx\n", enable ? "set" : "remove",
- base, (base + size));
-
- mtrrp = xnfalloc(sizeof(struct mtrr));
- mtrrp->base = base;
- mtrrp->len = size;
- mtrrp->type = MTRR_TYPE_WC;
-
- /*
- * MTRR_PRIVATE will make this MTRR get reset automatically
- * if this process exits, so we have no need for an explicit
- * cleanup operation when starting a new server.
- */
-
- if (enable)
- mtrrp->flags = MTRR_VALID | MTRR_PRIVATE;
- else
- mtrrp->flags = 0;
- n = 1;
-
- if (i386_set_mtrr(mtrrp, &n) < 0) {
- free(mtrrp);
- return NULL;
- }
- return mtrrp;
-}
-
-static void
-NetBSDundoWC(int screenNum, void *list)
-{
- struct mtrr *mtrrp = (struct mtrr *) list;
- int n;
-
- if (mtrrp == NULL)
- return;
- n = 1;
- mtrrp->flags &= ~MTRR_VALID;
- i386_set_mtrr(mtrrp, &n);
- free(mtrrp);
-}
-#endif
diff --git a/xorg-server/hw/xfree86/os-support/bsd/ppc_video.c b/xorg-server/hw/xfree86/os-support/bsd/ppc_video.c
index 3fd28c3b5..b1cf7eb1b 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/ppc_video.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/ppc_video.c
@@ -44,74 +44,18 @@
#define DEV_MEM "/dev/xf86"
#endif
-static void *ppcMapVidMem(int, unsigned long, unsigned long, int flags);
-static void ppcUnmapVidMem(int, void *, unsigned long);
-
Bool xf86EnableIO(void);
void xf86DisableIO(void);
void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- pVidMem->linearSupported = TRUE;
- pVidMem->mapMem = ppcMapVidMem;
- pVidMem->unmapMem = ppcUnmapVidMem;
pVidMem->initialised = TRUE;
xf86EnableIO();
}
volatile unsigned char *ioBase = MAP_FAILED;
-static void *
-ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- int fd = xf86Info.consoleFd;
- void *base;
-
-#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", Base, Size, fd);
-#endif
-
- base = mmap(0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE), MAP_SHARED, fd, Base);
- if (base == MAP_FAILED)
- FatalError("%s: could not mmap screen [s=%lx,a=%lx] (%s)",
- "xf86MapVidMem", Size, Base, strerror(errno));
-
- return base;
-}
-
-static void
-ppcUnmapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- munmap(Base, Size);
-}
-
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- int rv;
- static int kmem = -1;
-
- if (kmem == -1) {
- kmem = open(DEV_MEM, 2);
- if (kmem == -1) {
- FatalError("xf86ReadBIOS: open %s", DEV_MEM);
- }
- }
-
-#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS() %lx %lx, %x\n", Base, Offset, Len);
-#endif
-
- lseek(kmem, Base + Offset, 0);
- rv = read(kmem, Buf, Len);
-
- return rv;
-}
-
Bool
xf86EnableIO()
{
diff --git a/xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c b/xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c
index 02951d602..5bed01790 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c
@@ -38,48 +38,8 @@
/* Video Memory Mapping section */
/***************************************************************************/
-static void *sparc64MapVidMem(int, unsigned long, unsigned long, int);
-static void sparc64UnmapVidMem(int, void *, unsigned long);
-
void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- pVidMem->linearSupported = TRUE;
- pVidMem->mapMem = sparc64MapVidMem;
- pVidMem->unmapMem = sparc64UnmapVidMem;
pVidMem->initialised = TRUE;
}
-
-static void *
-sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size,
- int flags)
-{
- int fd = xf86Info.consoleFd;
- void *base;
-
-#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", Base, Size, fd);
-#endif
-
- base = mmap(0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE), MAP_SHARED, fd, Base);
- if (base == MAP_FAILED)
- FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)",
- "xf86MapVidMem", Size, Base, strerror(errno));
- return base;
-}
-
-static void
-sparc64UnmapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- munmap(Base, Size);
-}
-
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
-
- return 0;
-}
diff --git a/xorg-server/hw/xfree86/os-support/hurd/Makefile.am b/xorg-server/hw/xfree86/os-support/hurd/Makefile.am
index f228c1ce4..38660544a 100644
--- a/xorg-server/hw/xfree86/os-support/hurd/Makefile.am
+++ b/xorg-server/hw/xfree86/os-support/hurd/Makefile.am
@@ -1,6 +1,6 @@
noinst_LTLIBRARIES = libhurd.la
-libhurd_la_SOURCES = hurd_bell.c hurd_init.c hurd_mmap.c \
+libhurd_la_SOURCES = hurd_bell.c hurd_init.c \
hurd_video.c \
$(srcdir)/../shared/VTsw_noop.c \
$(srcdir)/../shared/posix_tty.c \
diff --git a/xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c b/xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c
deleted file mode 100644
index 8e089cadb..000000000
--- a/xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 1997 by UCHIYAMA Yasushi
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of UCHIYAMA Yasushi not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. UCHIYAMA Yasushi makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include<mach.h>
-#include<device/device.h>
-#include<mach/machine/mach_i386.h>
-#include <hurd.h>
-
-#include <X11/X.h>
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#define BIOS_SIZE 0x20000
-
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- mach_port_t device, mem_dev;
- memory_object_t mem_obj;
- vm_address_t addr = (vm_address_t) 0; /* serach starting address */
- kern_return_t err;
-
- err = get_privileged_ports(NULL, &device);
- if (err) {
- errno = err;
- FatalError("xf86ReadBIOS() can't get_privileged_ports. (%s)\n",
- strerror(errno));
- }
- err = device_open(device, D_READ | D_WRITE, "mem", &mem_dev);
- mach_port_deallocate(mach_task_self(), device);
- if (err) {
- errno = err;
- FatalError("xf86ReadBIOS() can't device_open. (%s)\n", strerror(errno));
- }
- err =
- device_map(mem_dev, VM_PROT_READ | VM_PROT_WRITE, Base, BIOS_SIZE,
- &mem_obj, 0);
- if (err) {
- errno = err;
- FatalError("xf86ReadBIOS() can't device_map. (%s)\n", strerror(errno));
- }
- err = vm_map(mach_task_self(),
- &addr,
- BIOS_SIZE,
- 0,
- TRUE,
- mem_obj,
- Base,
- FALSE,
- VM_PROT_READ | VM_PROT_WRITE,
- VM_PROT_READ | VM_PROT_WRITE, VM_INHERIT_SHARE);
- mach_port_deallocate(mach_task_self(), mem_obj);
- if (err) {
- errno = err;
- FatalError("xf86ReadBIOS() can't vm_map. (%s)\n", strerror(errno));
- }
-
- memcpy(Buf, (void *) ((int) addr + Offset), Len);
-
- err = vm_deallocate(mach_task_self(), addr, BIOS_SIZE);
- if (err) {
- errno = err;
- FatalError("xf86ReadBIOS() can't vm_deallocate. (%s)\n",
- strerror(errno));
- }
-
- return Len;
-}
diff --git a/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c b/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c
index dc1a8e670..2a96393b0 100644
--- a/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c
+++ b/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c
@@ -42,68 +42,6 @@
/**************************************************************************
* Video Memory Mapping section
***************************************************************************/
-static void *
-mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int Flags)
-{
- mach_port_t device, mem_dev;
- memory_object_t mem_obj;
- kern_return_t err;
- vm_address_t addr = (vm_address_t) 0;
-
- err = get_privileged_ports(NULL, &device);
- if (err) {
- errno = err;
- FatalError("xf86MapVidMem() can't get_privileged_ports. (%s)\n",
- strerror(errno));
- }
- err = device_open(device, D_READ | D_WRITE, "mem", &mem_dev);
- mach_port_deallocate(mach_task_self(), device);
- if (err) {
- errno = err;
- FatalError("xf86MapVidMem() can't device_open. (%s)\n",
- strerror(errno));
- }
-
- err =
- device_map(mem_dev, VM_PROT_READ | VM_PROT_WRITE, Base, Size, &mem_obj,
- 0);
- if (err) {
- errno = err;
- FatalError("xf86MapVidMem() can't device_map. (%s)\n", strerror(errno));
- }
- err = vm_map(mach_task_self(), &addr, Size, 0, /* mask */
- TRUE, /* anywhere */
- mem_obj, (vm_offset_t) Base, FALSE, /* copy on write */
- VM_PROT_READ | VM_PROT_WRITE,
- VM_PROT_READ | VM_PROT_WRITE, VM_INHERIT_SHARE);
- mach_port_deallocate(mach_task_self(), mem_obj);
- if (err) {
- errno = err;
- FatalError("xf86MapVidMem() can't vm_map.(mem_obj) (%s)\n",
- strerror(errno));
- }
- mach_port_deallocate(mach_task_self(), mem_dev);
- if (err) {
- errno = err;
- FatalError
- ("xf86MapVidMem() can't mach_port_deallocate.(mem_dev) (%s)\n",
- strerror(errno));
- }
- return (void *) addr;
-}
-
-static void
-unmapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- kern_return_t err = vm_deallocate(mach_task_self(), (int) Base, Size);
-
- if (err) {
- errno = err;
- ErrorF("xf86UnMapVidMem: can't dealloc framebuffer space (%s)\n",
- strerror(errno));
- }
- return;
-}
/**************************************************************************
* I/O Permissions section
@@ -146,8 +84,5 @@ xf86DisableIO()
void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- pVidMem->linearSupported = TRUE;
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
pVidMem->initialised = TRUE;
}
diff --git a/xorg-server/hw/xfree86/os-support/linux/Makefile.am b/xorg-server/hw/xfree86/os-support/linux/Makefile.am
index 1686dc2c1..50fcd1f28 100644
--- a/xorg-server/hw/xfree86/os-support/linux/Makefile.am
+++ b/xorg-server/hw/xfree86/os-support/linux/Makefile.am
@@ -2,9 +2,6 @@ noinst_LTLIBRARIES = liblinux.la
if LINUX_ALPHA
noinst_LTLIBRARIES += liblinuxev56.la
-PLATFORM_PCI_SUPPORT = \
- $(srcdir)/lnx_axp.c \
- $(srcdir)/../shared/xf86Axp.c
liblinuxev56_la_CFLAGS = $(AM_CFLAGS) -mcpu=ev56
@@ -28,23 +25,18 @@ endif
liblinux_la_SOURCES = lnx_init.c lnx_video.c \
lnx_agp.c lnx_kmod.c lnx_bell.c lnx_platform.c \
- $(srcdir)/../shared/bios_mmap.c \
$(srcdir)/../shared/VTsw_usl.c \
$(srcdir)/../shared/posix_tty.c \
$(srcdir)/../shared/vidmem.c \
$(srcdir)/../shared/sigio.c \
$(ACPI_SRCS) \
$(APM_SRCS) \
- $(LOGIND_SRCS) \
- $(PLATFORM_PCI_SUPPORT)
+ $(LOGIND_SRCS)
AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(DIX_CFLAGS) $(XORG_CFLAGS) $(PLATFORM_DEFINES)
AM_CPPFLAGS = $(XORG_INCS) $(PLATFORM_INCLUDES) $(LIBDRM_CFLAGS)
-EXTRA_DIST = \
- $(srcdir)/../shared/xf86Axp.h
-
if LINUX_ALPHA
liblinux_la_LIBADD = liblinuxev56.la
endif
diff --git a/xorg-server/hw/xfree86/os-support/linux/int10/linux.c b/xorg-server/hw/xfree86/os-support/linux/int10/linux.c
index 6181eb9c5..79b9a8858 100644
--- a/xorg-server/hw/xfree86/os-support/linux/int10/linux.c
+++ b/xorg-server/hw/xfree86/os-support/linux/int10/linux.c
@@ -70,6 +70,20 @@ static Int10LinuxSubModuleState int10LinuxLoadSubModule(ScrnInfoPtr pScrn);
#endif /* DoSubModules */
+static Bool
+readLegacy(struct pci_device *dev, unsigned char *buf, int base, int len)
+{
+ void *map;
+
+ if (!pci_device_map_legacy(dev, base, len, 0, &map))
+ return FALSE;
+
+ memcpy(buf, map, len);
+ pci_device_unmap_legacy(dev, man, len);
+
+ return TRUE;
+}
+
xf86Int10InfoPtr
xf86ExtendedInitInt10(int entityIndex, int Flags)
{
@@ -222,7 +236,8 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
Int10Current = pInt;
DebugF("Mapping int area\n");
- if (xf86ReadBIOS(0, 0, (unsigned char *) 0, LOW_PAGE_SIZE) < 0) {
+ /* note: yes, we really are writing the 0 page here */
+ if (!readLegacy(pInt->dev, (unsigned char *) 0, 0, LOW_PAGE_SIZE)) {
xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n");
goto error3;
}
@@ -236,7 +251,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
memset((void *) V_BIOS, 0, SYS_BIOS - V_BIOS);
DebugF("Reading BIOS\n");
for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE)
- if (xf86ReadBIOS(cs, 0, (void *) cs, V_BIOS_SIZE) < V_BIOS_SIZE)
+ if (!readLegacy(pInt->dev, (void *)cs, cs, V_BIOS_SIZE))
xf86DrvMsg(screen, X_WARNING,
"Unable to retrieve all of segment 0x%06lX.\n",
(long) cs);
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_axp.c b/xorg-server/hw/xfree86/os-support/linux/lnx_axp.c
deleted file mode 100644
index d65a3a487..000000000
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_axp.c
+++ /dev/null
@@ -1,103 +0,0 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdio.h>
-#include "xf86.h"
-#include "shared/xf86Axp.h"
-
-axpDevice lnxGetAXP(void);
-
-typedef struct {
- char *sysName;
- char *sysVari;
- char *cpu;
- axpDevice sys;
-} AXP;
-
-static AXP axpList[] = {
- {"Tsunami", NULL, NULL, TSUNAMI},
- {"Eiger", NULL, NULL, TSUNAMI},
- {"Noname", NULL, NULL, LCA},
- {"AlphaBook1", NULL, NULL, LCA},
- {"EB66", NULL, NULL, LCA},
- {"EB64+", NULL, NULL, APECS},
- {"Noritake", NULL, "EV5", CIA},
- {"Noritake", NULL, "EV56", CIA},
- {"Noritake", NULL, NULL, APECS},
- {"XL", NULL, NULL, APECS},
- {"Avanti", NULL, NULL, APECS},
- {"Mikasa", NULL, "EV5", CIA},
- {"Mikasa", NULL, "EV56", CIA},
- {"Mikasa", NULL, NULL, APECS},
- {"EB164", "EB164", NULL, CIA},
- {"EB164", "PC164", NULL, CIA},
- {"EB164", "LX164", NULL, PYXIS},
- {"EB164", "SX164", NULL, PYXIS},
- {"EB164", "RX164", NULL, POLARIS},
- {"Alcor", NULL, NULL, CIA},
- {"Takara", NULL, NULL, CIA},
- {"Sable", NULL, "EV5", T2_GAMMA},
- {"Sable", NULL, "EV56", T2_GAMMA},
- {"Sable", NULL, NULL, T2},
- {"Rawhide", NULL, NULL, MCPCIA},
- {"Jensen", NULL, NULL, JENSEN},
- {"Miata", NULL, NULL, PYXIS_CIA},
- {"Ruffian", NULL, NULL, PYXIS_CIA},
- {"Nautilus", NULL, NULL, IRONGATE},
- {NULL, NULL, NULL, SYS_NONE}
-};
-
-axpDevice
-lnxGetAXP(void)
-{
- FILE *file;
- int count = 0;
- char res[256];
- char cpu[255];
- char systype[255];
- char sysvari[255];
-
- if (!(file = fopen("/proc/cpuinfo", "r")))
- return SYS_NONE;
- do {
- if (!fgets(res, 0xff, file))
- return SYS_NONE;
- switch (count) {
- case 1:
- sscanf(res, "cpu model : %s", cpu);
- DebugF("CPU %s\n", cpu);
- break;
- case 5:
- sscanf(res, "system type : %s", systype);
- DebugF("system type : %s\n", systype);
- break;
- case 6:
- sscanf(res, "system variation : %s", sysvari);
- DebugF("system variation: %s\n", sysvari);
- break;
- }
- count++;
- } while (count < 8);
-
- fclose(file);
-
- count = 0;
-
- do {
- if (!axpList[count].sysName || !strcmp(axpList[count].sysName, systype)) {
- if (axpList[count].sysVari &&
- strcmp(axpList[count].sysVari, sysvari)) {
- count++;
- continue;
- };
- if (axpList[count].cpu && strcmp(axpList[count].cpu, cpu)) {
- count++;
- continue;
- }
- return axpList[count].sys;
- }
- count++;
- } while (1);
-}
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
index 85709c629..94853070d 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
@@ -76,6 +76,9 @@ switch_to(int vt, const char *from)
FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+
void
xf86OpenConsole(void)
{
@@ -166,7 +169,6 @@ xf86OpenConsole(void)
i = 0;
while (vcs[i] != NULL) {
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
snprintf(vtname, sizeof(vtname), vcs[i], xf86Info.vtno); /* /dev/tty1-64 */
if ((xf86Info.consoleFd = open(vtname, O_RDWR | O_NDELAY, 0)) >= 0)
break;
@@ -272,6 +274,8 @@ xf86OpenConsole(void)
}
}
+#pragma GCC diagnostic pop
+
void
xf86CloseConsole(void)
{
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_video.c b/xorg-server/hw/xfree86/os-support/linux/lnx_video.c
index ffffc81c5..c09d71947 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_video.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_video.c
@@ -38,13 +38,6 @@
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "xf86OSpriv.h"
-#ifdef __alpha__
-#include "shared/xf86Axp.h"
-#endif
-
-#ifdef HAS_MTRR_SUPPORT
-#include <asm/mtrr.h>
-#endif
static Bool ExtendedEnabled = FALSE;
@@ -72,405 +65,16 @@ extern int iopl(int __level);
#endif
-#ifdef __alpha__
-#define BUS_BASE bus_base
-#else
-#define BUS_BASE (0)
-#endif /* __alpha__ */
-
/***************************************************************************/
/* Video Memory Mapping section */
/***************************************************************************/
-static void *mapVidMem(int, unsigned long, unsigned long, int);
-static void unmapVidMem(int, void *, unsigned long);
-
-#if defined (__alpha__)
-extern void sethae(unsigned long hae);
-extern unsigned long _bus_base __P((void)) __attribute__ ((const));
-extern unsigned long _bus_base_sparse __P((void)) __attribute__ ((const));
-
-static void *mapVidMemSparse(int, unsigned long, unsigned long, int);
-extern axpDevice lnxGetAXP(void);
-static void unmapVidMemSparse(int, void *, unsigned long);
-static axpDevice axpSystem = -1;
-static Bool needSparse;
-static unsigned long hae_thresh;
-static unsigned long hae_mask;
-static unsigned long bus_base;
-#endif
-
-#ifdef HAS_MTRR_SUPPORT
-
-#define SPLIT_WC_REGIONS 1
-
-static void *setWC(int, unsigned long, unsigned long, Bool, MessageType);
-static void undoWC(int, void *);
-
-/* The file desc for /proc/mtrr. Once opened, left opened, and the mtrr
- driver will clean up when we exit. */
-#define MTRR_FD_UNOPENED (-1) /* We have yet to open /proc/mtrr */
-#define MTRR_FD_PROBLEM (-2) /* We tried to open /proc/mtrr, but had
- a problem. */
-static int mtrr_fd = MTRR_FD_UNOPENED;
-
-/* Open /proc/mtrr. FALSE on failure. Will always fail on Linux 2.0,
- and will fail on Linux 2.2 with MTRR support configured out,
- so verbosity should be chosen appropriately. */
-static Bool
-mtrr_open(int verbosity)
-{
- /* Only report absence of /proc/mtrr once. */
- static Bool warned = FALSE;
-
- if (mtrr_fd == MTRR_FD_UNOPENED) {
- mtrr_fd = open("/proc/mtrr", O_WRONLY);
-
- if (mtrr_fd < 0)
- mtrr_fd = MTRR_FD_PROBLEM;
- }
-
- if (mtrr_fd == MTRR_FD_PROBLEM) {
- /* To make sure we only ever warn once, need to check
- verbosity outside xf86MsgVerb */
- if (!warned && verbosity <= xf86GetVerbosity()) {
- xf86MsgVerb(X_WARNING, verbosity,
- "System lacks support for changing MTRRs\n");
- warned = TRUE;
- }
-
- return FALSE;
- }
- else
- return TRUE;
-}
-
-/*
- * We maintain a list of WC regions for each physical mapping so they can
- * be undone when unmapping.
- */
-
-struct mtrr_wc_region {
- struct mtrr_sentry sentry;
- Bool added; /* added WC or removed it */
- struct mtrr_wc_region *next;
-};
-
-static struct mtrr_wc_region *
-mtrr_cull_wc_region(int screenNum, unsigned long base, unsigned long size,
- MessageType from)
-{
- /* Some BIOS writers thought that setting wc over the mmio
- region of a graphics devices was a good idea. Try to fix
- it. */
-
- struct mtrr_gentry gent;
- struct mtrr_wc_region *wcreturn = NULL, *wcr;
- int count, ret = 0;
-
- /* Linux 2.0 users should not get a warning without -verbose */
- if (!mtrr_open(2))
- return NULL;
-
- for (gent.regnum = 0;
- ioctl(mtrr_fd, MTRRIOC_GET_ENTRY, &gent) >= 0; gent.regnum++) {
- if (gent.type != MTRR_TYPE_WRCOMB
- || gent.base + gent.size <= base || base + size <= gent.base)
- continue;
-
- /* Found an overlapping region. Delete it. */
-
- wcr = malloc(sizeof(*wcr));
- if (!wcr)
- return NULL;
- wcr->sentry.base = gent.base;
- wcr->sentry.size = gent.size;
- wcr->sentry.type = MTRR_TYPE_WRCOMB;
- wcr->added = FALSE;
-
- count = 3;
- while (count-- &&
- (ret = ioctl(mtrr_fd, MTRRIOC_KILL_ENTRY, &(wcr->sentry))) < 0);
-
- if (ret >= 0) {
- xf86DrvMsg(screenNum, from,
- "Removed MMIO write-combining range "
- "(0x%lx,0x%lx)\n",
- (unsigned long) gent.base, (unsigned long) gent.size);
- wcr->next = wcreturn;
- wcreturn = wcr;
- gent.regnum--;
- }
- else {
- free(wcr);
- xf86DrvMsgVerb(screenNum, X_WARNING, 0,
- "Failed to remove MMIO "
- "write-combining range (0x%lx,0x%lx)\n",
- (unsigned long)gent.base, (unsigned long) gent.size);
- }
- }
- return wcreturn;
-}
-
-static struct mtrr_wc_region *
-mtrr_remove_offending(int screenNum, unsigned long base, unsigned long size,
- MessageType from)
-{
- struct mtrr_gentry gent;
- struct mtrr_wc_region *wcreturn = NULL, **wcr;
-
- if (!mtrr_open(2))
- return NULL;
-
- wcr = &wcreturn;
- for (gent.regnum = 0;
- ioctl(mtrr_fd, MTRRIOC_GET_ENTRY, &gent) >= 0; gent.regnum++) {
- if (gent.type == MTRR_TYPE_WRCOMB
- && ((gent.base >= base && gent.base + gent.size < base + size) ||
- (gent.base > base && gent.base + gent.size <= base + size))) {
- *wcr = mtrr_cull_wc_region(screenNum, gent.base, gent.size, from);
- if (*wcr)
- gent.regnum--;
- while (*wcr) {
- wcr = &((*wcr)->next);
- }
- }
- }
- return wcreturn;
-}
-
-static struct mtrr_wc_region *
-mtrr_add_wc_region(int screenNum, unsigned long base, unsigned long size,
- MessageType from)
-{
- struct mtrr_wc_region **wcr, *wcreturn, *curwcr;
-
- /*
- * There can be only one....
- */
-
- wcreturn = mtrr_remove_offending(screenNum, base, size, from);
- wcr = &wcreturn;
- while (*wcr) {
- wcr = &((*wcr)->next);
- }
-
- /* Linux 2.0 should not warn, unless the user explicitly asks for
- WC. */
-
- if (!mtrr_open(from == X_CONFIG ? 0 : 2))
- return wcreturn;
-
- *wcr = curwcr = malloc(sizeof(**wcr));
- if (!curwcr)
- return wcreturn;
-
- curwcr->sentry.base = base;
- curwcr->sentry.size = size;
- curwcr->sentry.type = MTRR_TYPE_WRCOMB;
- curwcr->added = TRUE;
- curwcr->next = NULL;
-
-#if SPLIT_WC_REGIONS
- /*
- * Splits up the write-combining region if it is not aligned on a
- * size boundary.
- */
-
- {
- unsigned long lbase, d_size = 1;
- unsigned long n_size = size;
- unsigned long n_base = base;
-
- for (lbase = n_base, d_size = 1; !(lbase & 1);
- lbase = lbase >> 1, d_size <<= 1);
- while (d_size > n_size)
- d_size = d_size >> 1;
- DebugF("WC_BASE: 0x%lx WC_END: 0x%lx\n", base, base + d_size - 1);
- n_base += d_size;
- n_size -= d_size;
- if (n_size) {
- xf86DrvMsgVerb(screenNum, X_INFO, 3, "Splitting WC range: "
- "base: 0x%lx, size: 0x%lx\n", base, size);
- curwcr->next = mtrr_add_wc_region(screenNum, n_base, n_size, from);
- }
- curwcr->sentry.size = d_size;
- }
-
- /*****************************************************************/
-#endif /* SPLIT_WC_REGIONS */
-
- if (ioctl(mtrr_fd, MTRRIOC_ADD_ENTRY, &curwcr->sentry) >= 0) {
- /* Avoid printing on every VT switch */
- if (xf86ServerIsInitialising()) {
- xf86DrvMsg(screenNum, from,
- "Write-combining range (0x%lx,0x%lx)\n", base, size);
- }
- return wcreturn;
- }
- else {
- *wcr = curwcr->next;
- free(curwcr);
-
- /* Don't complain about the VGA region: MTRR fixed
- regions aren't currently supported, but might be in
- the future. */
- if ((unsigned long) base >= 0x100000) {
- xf86DrvMsgVerb(screenNum, X_WARNING, 0,
- "Failed to set up write-combining range "
- "(0x%lx,0x%lx)\n", base, size);
- }
- return wcreturn;
- }
-}
-
-static void
-mtrr_undo_wc_region(int screenNum, struct mtrr_wc_region *wcr)
-{
- struct mtrr_wc_region *p, *prev;
-
- if (mtrr_fd >= 0) {
- p = wcr;
- while (p) {
- if (p->added)
- ioctl(mtrr_fd, MTRRIOC_DEL_ENTRY, &p->sentry);
- prev = p;
- p = p->next;
- free(prev);
- }
- }
-}
-
-static void *
-setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
- MessageType from)
-{
- if (enable)
- return mtrr_add_wc_region(screenNum, base, size, from);
- else
- return mtrr_cull_wc_region(screenNum, base, size, from);
-}
-
-static void
-undoWC(int screenNum, void *regioninfo)
-{
- mtrr_undo_wc_region(screenNum, regioninfo);
-}
-
-#endif /* HAS_MTRR_SUPPORT */
-
void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- pVidMem->linearSupported = TRUE;
-#ifdef __alpha__
- if (axpSystem == -1) {
- axpSystem = lnxGetAXP();
- if ((needSparse = (_bus_base_sparse() > 0))) {
- hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
- hae_mask = xf86AXPParams[axpSystem].hae_mask;
- }
- bus_base = _bus_base();
- }
- if (needSparse) {
- xf86Msg(X_INFO, "Machine needs sparse mapping\n");
- pVidMem->mapMem = mapVidMemSparse;
- pVidMem->unmapMem = unmapVidMemSparse;
- }
- else {
- xf86Msg(X_INFO, "Machine type has 8/16 bit access\n");
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
- }
-#else
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
-#endif /* __alpha__ */
-
-#ifdef HAS_MTRR_SUPPORT
- pVidMem->setWC = setWC;
- pVidMem->undoWC = undoWC;
-#endif
pVidMem->initialised = TRUE;
}
-#ifdef __sparc__
-/* Basically, you simply cannot do this on Sparc. You have to do something portable
- * like use /dev/fb* or mmap() on /proc/bus/pci/X/Y nodes. -DaveM
- */
-static void *
-mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- return NULL;
-}
-#else
-static void *
-mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- void *base;
- int fd;
- int mapflags = MAP_SHARED;
- int prot;
- memType realBase, alignOff;
-
- realBase = Base & ~(getpagesize() - 1);
- alignOff = Base - realBase;
- DebugF("base: %lx, realBase: %lx, alignOff: %lx \n",
- Base, realBase, alignOff);
-
-#if defined(__ia64__) || defined(__arm__) || defined(__s390__)
-#ifndef MAP_WRITECOMBINED
-#define MAP_WRITECOMBINED 0x00010000
-#endif
-#ifndef MAP_NONCACHED
-#define MAP_NONCACHED 0x00020000
-#endif
- if (flags & VIDMEM_FRAMEBUFFER)
- mapflags |= MAP_WRITECOMBINED;
- else
- mapflags |= MAP_NONCACHED;
-#endif
-
-#if 0
- /* this will disappear when people upgrade their kernels */
- fd = open(DEV_MEM,
- ((flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR) | O_SYNC);
-#else
- fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
-#endif
- if (fd < 0) {
- FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
- strerror(errno));
- }
-
- if (flags & VIDMEM_READONLY)
- prot = PROT_READ;
- else
- prot = PROT_READ | PROT_WRITE;
-
- /* This requires linux-0.99.pl10 or above */
- base = mmap((caddr_t) 0, Size + alignOff, prot, mapflags, fd,
- (off_t) realBase + BUS_BASE);
- close(fd);
- if (base == MAP_FAILED) {
- FatalError("xf86MapVidMem: Could not mmap framebuffer"
- " (0x%08lx,0x%lx) (%s)\n", Base, Size, strerror(errno));
- }
- DebugF("base: %lx aligned base: %lx\n", base, (char *) base + alignOff);
- return (char *) base + alignOff;
-}
-#endif /* !(__sparc__) */
-
-static void
-unmapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- uintptr_t alignOff = (uintptr_t) Base
- - ((uintptr_t) Base & ~(getpagesize() - 1));
-
- DebugF("alignment offset: %lx\n", (unsigned long) alignOff);
- munmap((void *) ((uintptr_t) Base - alignOff), (Size + alignOff));
-}
-
/***************************************************************************/
/* I/O Permissions section */
/***************************************************************************/
@@ -565,8 +169,6 @@ xf86DisableIO(void)
#if defined (__alpha__)
-#define vuip volatile unsigned int *
-
extern int readDense8(void *Base, register unsigned long Offset);
extern int readDense16(void *Base, register unsigned long Offset);
extern int readDense32(void *Base, register unsigned long Offset);
@@ -577,284 +179,6 @@ extern void
extern void
writeDense32(int Value, void *Base, register unsigned long Offset);
-static int readSparse8(void *Base, register unsigned long Offset);
-static int readSparse16(void *Base, register unsigned long Offset);
-static int readSparse32(void *Base, register unsigned long Offset);
-static void
- writeSparseNB8(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparseNB16(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparseNB32(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparse8(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparse16(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparse32(int Value, void *Base, register unsigned long Offset);
-
-#define DENSE_BASE 0x2ff00000000UL
-#define SPARSE_BASE 0x30000000000UL
-
-static unsigned long msb_set = 0;
-
-static void *
-mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size,
- int flags)
-{
- int fd, prot;
- unsigned long ret, rets = 0;
-
- static Bool was_here = FALSE;
-
- if (!was_here) {
- was_here = TRUE;
-
- xf86WriteMmio8 = writeSparse8;
- xf86WriteMmio16 = writeSparse16;
- xf86WriteMmio32 = writeSparse32;
- xf86WriteMmioNB8 = writeSparseNB8;
- xf86WriteMmioNB16 = writeSparseNB16;
- xf86WriteMmioNB32 = writeSparseNB32;
- xf86ReadMmio8 = readSparse8;
- xf86ReadMmio16 = readSparse16;
- xf86ReadMmio32 = readSparse32;
- }
-
- fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
- if (fd < 0) {
- FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
- strerror(errno));
- }
-
-#if 0
- xf86Msg(X_INFO, "mapVidMemSparse: try Base 0x%lx size 0x%lx flags 0x%x\n",
- Base, Size, flags);
-#endif
-
- if (flags & VIDMEM_READONLY)
- prot = PROT_READ;
- else
- prot = PROT_READ | PROT_WRITE;
-
- /* This requirers linux-0.99.pl10 or above */
-
- /*
- * Always do DENSE mmap, since read32/write32 currently require it.
- */
- ret = (unsigned long) mmap((caddr_t) (DENSE_BASE + Base), Size,
- prot, MAP_SHARED, fd, (off_t) (bus_base + Base));
-
- /*
- * Do SPARSE mmap only when MMIO and not MMIO_32BIT, or FRAMEBUFFER
- * and SPARSE (which should require the use of read/write macros).
- *
- * By not SPARSE mmapping an 8MB framebuffer, we can save approx. 256K
- * bytes worth of pagetable (32 pages).
- */
- if (((flags & VIDMEM_MMIO) && !(flags & VIDMEM_MMIO_32BIT)) ||
- ((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE))) {
- rets = (unsigned long) mmap((caddr_t) (SPARSE_BASE + (Base << 5)),
- Size << 5, prot, MAP_SHARED, fd,
- (off_t) _bus_base_sparse() + (Base << 5));
- }
-
- close(fd);
-
- if (ret == (unsigned long) MAP_FAILED) {
- FatalError("xf86MapVidMemSparse: Could not (dense) mmap fb (%s)\n",
- strerror(errno));
- }
-
- if (((flags & VIDMEM_MMIO) && !(flags & VIDMEM_MMIO_32BIT)) ||
- ((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE))) {
- if (rets == (unsigned long) MAP_FAILED ||
- rets != (SPARSE_BASE + (Base << 5))) {
- FatalError("mapVidMemSparse: Could not (sparse) mmap fb (%s)\n",
- strerror(errno));
- }
- }
-
-#if 1
- if (rets)
- xf86Msg(X_INFO, "mapVidMemSparse: mapped Base 0x%lx size 0x%lx"
- " to DENSE at 0x%lx and SPARSE at 0x%lx\n",
- Base, Size, ret, rets);
- else
- xf86Msg(X_INFO, "mapVidMemSparse: mapped Base 0x%lx size 0x%lx"
- " to DENSE only at 0x%lx\n", Base, Size, ret);
-
-#endif
- return (void *) ret;
-}
-
-static void
-unmapVidMemSparse(int ScreenNum, void *Base, unsigned long Size)
-{
- unsigned long Offset = (unsigned long) Base - DENSE_BASE;
-
-#if 1
- xf86Msg(X_INFO, "unmapVidMemSparse: unmapping Base 0x%lx Size 0x%lx\n",
- Base, Size);
-#endif
- /* Unmap DENSE always. */
- munmap((caddr_t) Base, Size);
-
- /* Unmap SPARSE always, and ignore error in case we did not map it. */
- munmap((caddr_t) (SPARSE_BASE + (Offset << 5)), Size << 5);
-}
-
-static int
-readSparse8(void *Base, register unsigned long Offset)
-{
- register unsigned long result, shift;
- register unsigned long msb;
-
- mem_barrier();
- Offset += (unsigned long) Base - DENSE_BASE;
- shift = (Offset & 0x3) << 3;
- if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
- }
-
- mem_barrier();
- result = *(vuip) (SPARSE_BASE + (Offset << 5));
- result >>= shift;
- return 0xffUL & result;
-}
-
-static int
-readSparse16(void *Base, register unsigned long Offset)
-{
- register unsigned long result, shift;
- register unsigned long msb;
-
- mem_barrier();
- Offset += (unsigned long) Base - DENSE_BASE;
- shift = (Offset & 0x2) << 3;
- if (Offset >= hae_thresh) {
- msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
- }
-
- mem_barrier();
- result = *(vuip) (SPARSE_BASE + (Offset << 5) + (1 << (5 - 2)));
- result >>= shift;
- return 0xffffUL & result;
-}
-
-static int
-readSparse32(void *Base, register unsigned long Offset)
-{
- /* NOTE: this is really using DENSE. */
- mem_barrier();
- return *(vuip) ((unsigned long) Base + (Offset));
-}
-
-static void
-writeSparse8(int Value, void *Base, register unsigned long Offset)
-{
- register unsigned long msb;
- register unsigned int b = Value & 0xffU;
-
- write_mem_barrier();
- Offset += (unsigned long) Base - DENSE_BASE;
- if (Offset >= hae_thresh) {
- msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
- }
-
- write_mem_barrier();
- *(vuip) (SPARSE_BASE + (Offset << 5)) = b * 0x01010101;
-}
-
-static void
-writeSparse16(int Value, void *Base, register unsigned long Offset)
-{
- register unsigned long msb;
- register unsigned int w = Value & 0xffffU;
-
- write_mem_barrier();
- Offset += (unsigned long) Base - DENSE_BASE;
- if (Offset >= hae_thresh) {
- msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
- }
-
- write_mem_barrier();
- *(vuip) (SPARSE_BASE + (Offset << 5) + (1 << (5 - 2))) = w * 0x00010001;
-}
-
-static void
-writeSparse32(int Value, void *Base, register unsigned long Offset)
-{
- /* NOTE: this is really using DENSE. */
- write_mem_barrier();
- *(vuip) ((unsigned long) Base + (Offset)) = Value;
- return;
-}
-
-static void
-writeSparseNB8(int Value, void *Base, register unsigned long Offset)
-{
- register unsigned long msb;
- register unsigned int b = Value & 0xffU;
-
- Offset += (unsigned long) Base - DENSE_BASE;
- if (Offset >= hae_thresh) {
- msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
- }
- *(vuip) (SPARSE_BASE + (Offset << 5)) = b * 0x01010101;
-}
-
-static void
-writeSparseNB16(int Value, void *Base, register unsigned long Offset)
-{
- register unsigned long msb;
- register unsigned int w = Value & 0xffffU;
-
- Offset += (unsigned long) Base - DENSE_BASE;
- if (Offset >= hae_thresh) {
- msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
- }
- *(vuip) (SPARSE_BASE + (Offset << 5) + (1 << (5 - 2))) = w * 0x00010001;
-}
-
-static void
-writeSparseNB32(int Value, void *Base, register unsigned long Offset)
-{
- /* NOTE: this is really using DENSE. */
- *(vuip) ((unsigned long) Base + (Offset)) = Value;
- return;
-}
-
void (*xf86WriteMmio8) (int Value, void *Base, unsigned long Offset)
= writeDense8;
void (*xf86WriteMmio16) (int Value, void *Base, unsigned long Offset)
diff --git a/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c b/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c
deleted file mode 100644
index e000dc9c8..000000000
--- a/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright 1993 by David Wexelblat <dwex@goblin.org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of David Wexelblat not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. David Wexelblat makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-/*
- * Read BIOS via mmap()ing DEV_MEM
- */
-
-#ifndef __alpha__
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- int fd;
- unsigned char *ptr;
- int psize;
- int mlen;
-
- if ((fd = open(DEV_MEM, O_RDONLY)) < 0) {
- xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n",
- DEV_MEM, strerror(errno));
- return -1;
- }
- psize = getpagesize();
- Offset += Base & (psize - 1);
- Base &= ~(psize - 1);
- mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- ptr = (unsigned char *) mmap((caddr_t) 0, mlen, PROT_READ,
- MAP_SHARED, fd, (off_t) Base);
- if (ptr == MAP_FAILED) {
- xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed (%s)\n",
- DEV_MEM, strerror(errno));
- close(fd);
- return -1;
- }
- DebugF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
- Base, ptr[0] | (ptr[1] << 8));
- (void) memcpy(Buf, (void *) (ptr + Offset), Len);
- (void) munmap((caddr_t) ptr, mlen);
- (void) close(fd);
- return Len;
-}
-
-#else /* __alpha__ */
-
- /*
- * We trick "mmap" into mapping BUS memory for us via BUS_BASE,
- * which is the KSEG address of the start of the DENSE memory
- * area.
- */
-
- /*
- * NOTE: there prolly ought to be more validity checks and all
- * re: boundaries and sizes and such...
- */
-
-#ifdef linux
-
-extern unsigned long _bus_base(void);
-
-#define BUS_BASE _bus_base()
-
-#else
-
-extern u_int64_t dense_base(void);
-
-#define BUS_BASE dense_base()
-
-#endif
-
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- caddr_t base;
- int fd;
- int psize;
- int mlen;
-
- if ((fd = open(DEV_MEM, O_RDONLY)) < 0) {
- xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n",
- DEV_MEM, strerror(errno));
- return -1;
- }
-
- psize = getpagesize();
- Offset += Base & (psize - 1);
- Base &= ~(psize - 1);
- mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- base = mmap((caddr_t) 0, mlen, PROT_READ,
- MAP_SHARED, fd, (off_t) (Base + BUS_BASE));
-
- if (base == MAP_FAILED) {
- xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to mmap %s (%s)\n",
- DEV_MEM, strerror(errno));
- return -1;
- }
-
- xf86SlowBCopyFromBus((unsigned char *) (base + Offset), Buf, Len);
-
- munmap((caddr_t) base, mlen);
- close(fd);
- return Len;
-}
-
-#endif /* __alpha__ */
diff --git a/xorg-server/hw/xfree86/os-support/shared/vidmem.c b/xorg-server/hw/xfree86/os-support/shared/vidmem.c
index f473293c7..a6bf677f5 100644
--- a/xorg-server/hw/xfree86/os-support/shared/vidmem.c
+++ b/xorg-server/hw/xfree86/os-support/shared/vidmem.c
@@ -42,119 +42,7 @@
* This file contains the common part of the video memory mapping functions
*/
-/*
- * Get a piece of the ScrnInfoRec. At the moment, this is only used to hold
- * the MTRR option information, but it is likely to be expanded if we do
- * auto unmapping of memory at VT switch.
- *
- */
-
-typedef struct {
- unsigned long size;
- void *virtBase;
- void *mtrrInfo;
-} MappingRec, *MappingPtr;
-
-typedef struct {
- int numMappings;
- MappingPtr *mappings;
- Bool mtrrEnabled;
- MessageType mtrrFrom;
- Bool mtrrOptChecked;
- ScrnInfoPtr pScrn;
-} VidMapRec, *VidMapPtr;
-
-static int vidMapIndex = -1;
-
-#define VIDMAPPTR(p) ((VidMapPtr)((p)->privates[vidMapIndex].ptr))
-
static VidMemInfo vidMemInfo = { FALSE, };
-static VidMapRec vidMapRec = { 0, NULL, TRUE, X_DEFAULT, FALSE, NULL };
-
-static VidMapPtr
-getVidMapRec(int scrnIndex)
-{
- VidMapPtr vp;
- ScrnInfoPtr pScrn;
-
- if ((scrnIndex < 0) || !(pScrn = xf86Screens[scrnIndex]))
- return &vidMapRec;
-
- if (vidMapIndex < 0)
- vidMapIndex = xf86AllocateScrnInfoPrivateIndex();
-
- if (VIDMAPPTR(pScrn) != NULL)
- return VIDMAPPTR(pScrn);
-
- vp = pScrn->privates[vidMapIndex].ptr = xnfcalloc(sizeof(VidMapRec), 1);
- vp->mtrrEnabled = TRUE; /* default to enabled */
- vp->mtrrFrom = X_DEFAULT;
- vp->mtrrOptChecked = FALSE;
- vp->pScrn = pScrn;
- return vp;
-}
-
-static MappingPtr
-newMapping(VidMapPtr vp)
-{
- vp->mappings = xnfrealloc(vp->mappings, sizeof(MappingPtr) *
- (vp->numMappings + 1));
- vp->mappings[vp->numMappings] = xnfcalloc(sizeof(MappingRec), 1);
- return vp->mappings[vp->numMappings++];
-}
-
-static MappingPtr
-findMapping(VidMapPtr vp, void *vbase, unsigned long size)
-{
- int i;
-
- for (i = 0; i < vp->numMappings; i++) {
- if (vp->mappings[i]->virtBase == vbase && vp->mappings[i]->size == size)
- return vp->mappings[i];
- }
- return NULL;
-}
-
-static void
-removeMapping(VidMapPtr vp, MappingPtr mp)
-{
- int i, found = 0;
-
- for (i = 0; i < vp->numMappings; i++) {
- if (vp->mappings[i] == mp) {
- found = 1;
- free(vp->mappings[i]);
- }
- else if (found) {
- vp->mappings[i - 1] = vp->mappings[i];
- }
- }
- vp->numMappings--;
- vp->mappings[vp->numMappings] = NULL;
-}
-
-enum { OPTION_MTRR };
-
-static const OptionInfoRec opts[] = {
- {OPTION_MTRR, "mtrr", OPTV_BOOLEAN, {0}, FALSE},
- {-1, NULL, OPTV_NONE, {0}, FALSE}
-};
-
-static void
-checkMtrrOption(VidMapPtr vp)
-{
- if (!vp->mtrrOptChecked && vp->pScrn && vp->pScrn->options != NULL) {
- OptionInfoPtr options;
-
- options = xnfalloc(sizeof(opts));
- (void) memcpy(options, opts, sizeof(opts));
- xf86ProcessOptions(vp->pScrn->scrnIndex, vp->pScrn->options, options);
- if (xf86GetOptValBool(options, OPTION_MTRR, &vp->mtrrEnabled))
- vp->mtrrFrom = X_CONFIG;
- free(options);
- vp->mtrrOptChecked = TRUE;
- }
-}
void
xf86InitVidMem(void)
@@ -164,96 +52,3 @@ xf86InitVidMem(void)
xf86OSInitVidMem(&vidMemInfo);
}
}
-
-void *
-xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size)
-{
- void *vbase = NULL;
- VidMapPtr vp;
- MappingPtr mp;
-
- if (((Flags & VIDMEM_FRAMEBUFFER) &&
- (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT))))
- FatalError("Mapping memory with more than one type\n");
-
- xf86InitVidMem();
- if (!vidMemInfo.initialised || !vidMemInfo.mapMem)
- return NULL;
-
- vbase = vidMemInfo.mapMem(ScreenNum, Base, Size, Flags);
-
- if (!vbase || vbase == (void *) -1)
- return NULL;
-
- vp = getVidMapRec(ScreenNum);
- mp = newMapping(vp);
- mp->size = Size;
- mp->virtBase = vbase;
-
- /*
- * Check the "mtrr" option even when MTRR isn't supported to avoid
- * warnings about unrecognised options.
- */
- checkMtrrOption(vp);
-
- if (vp->mtrrEnabled && vidMemInfo.setWC) {
- if (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT))
- mp->mtrrInfo =
- vidMemInfo.setWC(ScreenNum, Base, Size, FALSE, vp->mtrrFrom);
- else if (Flags & VIDMEM_FRAMEBUFFER)
- mp->mtrrInfo =
- vidMemInfo.setWC(ScreenNum, Base, Size, TRUE, vp->mtrrFrom);
- }
- return vbase;
-}
-
-void
-xf86UnMapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- VidMapPtr vp;
- MappingPtr mp;
-
- if (!vidMemInfo.initialised || !vidMemInfo.unmapMem) {
- xf86DrvMsg(ScreenNum, X_WARNING,
- "xf86UnMapVidMem() called before xf86MapVidMem()\n");
- return;
- }
-
- vp = getVidMapRec(ScreenNum);
- mp = findMapping(vp, Base, Size);
- if (!mp) {
- xf86DrvMsg(ScreenNum, X_WARNING,
- "xf86UnMapVidMem: cannot find region for [%p,0x%lx]\n",
- Base, Size);
- return;
- }
- if (vp->mtrrEnabled && vidMemInfo.undoWC && mp)
- vidMemInfo.undoWC(ScreenNum, mp->mtrrInfo);
-
- vidMemInfo.unmapMem(ScreenNum, Base, Size);
- removeMapping(vp, mp);
-}
-
-Bool
-xf86CheckMTRR(int ScreenNum)
-{
- VidMapPtr vp = getVidMapRec(ScreenNum);
-
- /*
- * Check the "mtrr" option even when MTRR isn't supported to avoid
- * warnings about unrecognised options.
- */
- checkMtrrOption(vp);
-
- if (vp->mtrrEnabled && vidMemInfo.setWC)
- return TRUE;
-
- return FALSE;
-}
-
-Bool
-xf86LinearVidMem(void)
-{
- xf86InitVidMem();
- return vidMemInfo.linearSupported;
-}
diff --git a/xorg-server/hw/xfree86/os-support/shared/xf86Axp.c b/xorg-server/hw/xfree86/os-support/shared/xf86Axp.c
deleted file mode 100644
index 5f2f3985e..000000000
--- a/xorg-server/hw/xfree86/os-support/shared/xf86Axp.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2000 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Axp.h"
-
-axpParams xf86AXPParams[] = {
- {SYS_NONE, 0, 0, 0}
- ,
- {TSUNAMI, 0, 0, 0}
- ,
- {LCA, 1 << 24, 0xf8000000, 1UL << 32}
- ,
- {APECS, 1 << 24, 0xf8000000, 1UL << 32}
- ,
- {T2, 0, 0xFC000000, 1UL << 31}
- ,
- {T2_GAMMA, 0, 0xFC000000, 1UL << 31}
- ,
- {CIA, 0, 0xE0000000, 1UL << 34}
- ,
- {MCPCIA, 0, 0xf8000000, 1UL << 31}
- ,
- {JENSEN, 0, 0xE000000, 1UL << 32}
- ,
- {POLARIS, 0, 0, 0}
- ,
- {PYXIS, 0, 0, 0}
- ,
- {PYXIS_CIA, 0, 0xE0000000, 1UL << 34}
- ,
- {IRONGATE, 0, 0, 0}
-};
diff --git a/xorg-server/hw/xfree86/os-support/shared/xf86Axp.h b/xorg-server/hw/xfree86/os-support/shared/xf86Axp.h
deleted file mode 100644
index fded9d8c9..000000000
--- a/xorg-server/hw/xfree86/os-support/shared/xf86Axp.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifndef _XF86_AXP_H_
-#define _XF86_AXP_H_
-
-typedef enum {
- SYS_NONE,
- TSUNAMI,
- LCA,
- APECS,
- T2,
- T2_GAMMA,
- CIA,
- MCPCIA,
- JENSEN,
- POLARIS,
- PYXIS,
- PYXIS_CIA,
- IRONGATE
-} axpDevice;
-
-typedef struct {
- axpDevice id;
- unsigned long hae_thresh;
- unsigned long hae_mask;
- unsigned long size;
-} axpParams;
-
-extern axpParams xf86AXPParams[];
-
-#endif
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c b/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c
index fc464871d..25f76181c 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c
@@ -63,152 +63,12 @@
/* Video Memory Mapping section */
/***************************************************************************/
-static char *apertureDevName = NULL;
-static int apertureDevFD_ro = -1;
-static int apertureDevFD_rw = -1;
-
-static Bool
-solOpenAperture(void)
-{
- if (apertureDevName == NULL) {
- apertureDevName = "/dev/xsvc";
- if ((apertureDevFD_rw = open(apertureDevName, O_RDWR)) < 0) {
- xf86MsgVerb(X_WARNING, 0,
- "solOpenAperture: failed to open %s (%s)\n",
- apertureDevName, strerror(errno));
- apertureDevName = "/dev/fbs/aperture";
- apertureDevFD_rw = open(apertureDevName, O_RDWR);
- }
- apertureDevFD_ro = open(apertureDevName, O_RDONLY);
-
- if ((apertureDevFD_rw < 0) || (apertureDevFD_ro < 0)) {
- xf86MsgVerb(X_WARNING, 0,
- "solOpenAperture: failed to open %s (%s)\n",
- apertureDevName, strerror(errno));
- xf86MsgVerb(X_WARNING, 0,
- "solOpenAperture: either /dev/fbs/aperture"
- " or /dev/xsvc required\n");
-
- apertureDevName = NULL;
-
- if (apertureDevFD_rw >= 0) {
- close(apertureDevFD_rw);
- }
- apertureDevFD_rw = -1;
-
- if (apertureDevFD_ro >= 0) {
- close(apertureDevFD_ro);
- }
- apertureDevFD_ro = -1;
-
- return FALSE;
- }
- }
- return TRUE;
-}
-
-static void *
-solMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int Flags)
-{
- void *base;
- int fd;
- int prot;
-
- if (Flags & VIDMEM_READONLY) {
- fd = apertureDevFD_ro;
- prot = PROT_READ;
- }
- else {
- fd = apertureDevFD_rw;
- prot = PROT_READ | PROT_WRITE;
- }
-
- if (fd < 0) {
- xf86DrvMsg(ScreenNum, X_ERROR,
- "solMapVidMem: failed to open %s (%s)\n",
- apertureDevName, strerror(errno));
- return NULL;
- }
-
- base = mmap(NULL, Size, prot, MAP_SHARED, fd, (off_t) Base);
-
- if (base == MAP_FAILED) {
- xf86DrvMsg(ScreenNum, X_ERROR,
- "solMapVidMem: failed to mmap %s (0x%08lx,0x%lx) (%s)\n",
- apertureDevName, Base, Size, strerror(errno));
- return NULL;
- }
-
- return base;
-}
-
-/* ARGSUSED */
-static void
-solUnMapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- if (munmap(Base, Size) != 0) {
- xf86DrvMsgVerb(ScreenNum, X_WARNING, 0,
- "solUnMapVidMem: failed to unmap %s"
- " (0x%p,0x%lx) (%s)\n",
- apertureDevName, Base, Size, strerror(errno));
- }
-}
-
_X_HIDDEN void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- pVidMem->linearSupported = solOpenAperture();
- if (pVidMem->linearSupported) {
- pVidMem->mapMem = solMapVidMem;
- pVidMem->unmapMem = solUnMapVidMem;
- }
- else {
- xf86MsgVerb(X_WARNING, 0,
- "xf86OSInitVidMem: linear memory access disabled\n");
- }
pVidMem->initialised = TRUE;
}
-/*
- * Read BIOS via mmap()ing physical memory.
- */
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- unsigned char *ptr;
- int psize;
- int mlen;
-
- psize = getpagesize();
- Offset += Base & (psize - 1);
- Base &= ~(psize - 1);
- mlen = (Offset + Len + psize - 1) & ~(psize - 1);
-
- if (solOpenAperture() == FALSE) {
- xf86Msg(X_WARNING,
- "xf86ReadBIOS: Failed to open aperture to read BIOS\n");
- return -1;
- }
-
- ptr = (unsigned char *) mmap(NULL, mlen, PROT_READ,
- MAP_SHARED, apertureDevFD_ro, (off_t) Base);
- if (ptr == MAP_FAILED) {
- xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed [0x%08lx, 0x%04x]\n",
- apertureDevName, Base, mlen);
- return -1;
- }
-
- (void) memcpy(Buf, (void *) (ptr + Offset), Len);
- if (munmap((caddr_t) ptr, mlen) != 0) {
- xf86MsgVerb(X_WARNING, 0,
- "xf86ReadBIOS: failed to unmap %s (0x%p,0x%x) (%s)\n",
- apertureDevName, ptr, mlen, strerror(errno));
- }
-
- return Len;
-}
-
/***************************************************************************/
/* I/O Permissions section */
/***************************************************************************/
diff --git a/xorg-server/hw/xfree86/os-support/stub/Makefile.am b/xorg-server/hw/xfree86/os-support/stub/Makefile.am
index a39e17d55..19468c6de 100644
--- a/xorg-server/hw/xfree86/os-support/stub/Makefile.am
+++ b/xorg-server/hw/xfree86/os-support/stub/Makefile.am
@@ -14,6 +14,5 @@ libstub_la_SOURCES = \
$(srcdir)/../shared/posix_tty.c \
$(srcdir)/../shared/sigio.c \
stub_bell.c \
- stub_bios.c \
stub_init.c \
stub_video.c
diff --git a/xorg-server/hw/xfree86/os-support/stub/stub_bios.c b/xorg-server/hw/xfree86/os-support/stub/stub_bios.c
deleted file mode 100644
index dbc92fcdb..000000000
--- a/xorg-server/hw/xfree86/os-support/stub/stub_bios.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86_OSlib.h"
-
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- return -1;
-}
diff --git a/xorg-server/hw/xfree86/os-support/xf86OSpriv.h b/xorg-server/hw/xfree86/os-support/xf86OSpriv.h
index b56f45a3e..ce1ec33a1 100644
--- a/xorg-server/hw/xfree86/os-support/xf86OSpriv.h
+++ b/xorg-server/hw/xfree86/os-support/xf86OSpriv.h
@@ -32,19 +32,8 @@
#ifndef _XF86OSPRIV_H
#define _XF86OSPRIV_H
-typedef void *(*MapMemProcPtr) (int, unsigned long, unsigned long, int);
-typedef void (*UnmapMemProcPtr) (int, void *, unsigned long);
-typedef void *(*SetWCProcPtr) (int, unsigned long, unsigned long, Bool,
- MessageType);
-typedef void (*UndoWCProcPtr) (int, void *);
-
typedef struct {
Bool initialised;
- MapMemProcPtr mapMem;
- UnmapMemProcPtr unmapMem;
- SetWCProcPtr setWC;
- UndoWCProcPtr undoWC;
- Bool linearSupported;
} VidMemInfo, *VidMemInfoPtr;
void xf86OSInitVidMem(VidMemInfoPtr);
diff --git a/xorg-server/hw/xfree86/os-support/xf86_OSproc.h b/xorg-server/hw/xfree86/os-support/xf86_OSproc.h
index 8d27e8b7b..822bab2ca 100644
--- a/xorg-server/hw/xfree86/os-support/xf86_OSproc.h
+++ b/xorg-server/hw/xfree86/os-support/xf86_OSproc.h
@@ -74,24 +74,6 @@
*/
/*
- * Flags for xf86MapVidMem(). Multiple flags can be or'd together. The
- * flags may be used as hints. For example it would be permissible to
- * enable write combining for memory marked only for framebuffer use.
- */
-
-#define VIDMEM_FRAMEBUFFER 0x01 /* memory for framebuffer use */
-#define VIDMEM_MMIO 0x02 /* memory for I/O use */
-#define VIDMEM_MMIO_32BIT 0x04 /* memory accesses >= 32bit */
-#define VIDMEM_READSIDEEFFECT 0x08 /* reads can have side-effects */
-#define VIDMEM_SPARSE 0x10 /* sparse mapping required
- * assumed when VIDMEM_MMIO is
- * set. May be used with
- * VIDMEM_FRAMEBUFFER) */
-#define VIDMEM_READONLY 0x20 /* read-only mapping
- * used when reading BIOS images
- * through xf86MapVidMem() */
-
-/*
* OS-independent modem state flags for xf86SetSerialModemState() and
* xf86GetSerialModemState().
*/
@@ -130,14 +112,6 @@
_XFUNCPROTOBEGIN
/* public functions */
-extern _X_EXPORT Bool xf86LinearVidMem(void);
-extern _X_EXPORT _X_DEPRECATED Bool xf86CheckMTRR(int);
-extern _X_EXPORT _X_DEPRECATED void *xf86MapVidMem(int, int, unsigned long,
- unsigned long);
-extern _X_EXPORT _X_DEPRECATED void xf86UnMapVidMem(int, void *,
- unsigned long);
-extern _X_EXPORT int xf86ReadBIOS(unsigned long, unsigned long, unsigned char *,
- int);
extern _X_EXPORT Bool xf86EnableIO(void);
extern _X_EXPORT void xf86DisableIO(void);
diff --git a/xorg-server/hw/xwayland/Makefile.am b/xorg-server/hw/xwayland/Makefile.am
index dc16b8bbe..4e0e1bb00 100644
--- a/xorg-server/hw/xwayland/Makefile.am
+++ b/xorg-server/hw/xwayland/Makefile.am
@@ -39,8 +39,6 @@ nodist_Xwayland_SOURCES = \
CLEANFILES = $(nodist_Xwayland_SOURCES)
-EXTRA_DIST = drm.xml
-
xwayland-glamor.c : $(nodist_Xwayland_SOURCES)
glamor_lib = $(top_builddir)/glamor/libglamor.la
@@ -48,6 +46,8 @@ glamor_lib = $(top_builddir)/glamor/libglamor.la
Xwayland_LDADD += $(GLAMOR_LIBS) $(GBM_LIBS) -lEGL -lGL
endif
+EXTRA_DIST = drm.xml
+
relink:
$(AM_V_at)rm -f Xwayland$(EXEEXT) && $(MAKE) Xwayland$(EXEEXT)
diff --git a/xorg-server/hw/xwayland/xwayland-input.c b/xorg-server/hw/xwayland/xwayland-input.c
index cc5f7df05..b8c543ce4 100644
--- a/xorg-server/hw/xwayland/xwayland-input.c
+++ b/xorg-server/hw/xwayland/xwayland-input.c
@@ -152,6 +152,15 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer,
ScreenPtr pScreen = xwl_seat->xwl_screen->screen;
ValuatorMask mask;
+ /* There's a race here where if we create and then immediately
+ * destroy a surface, we might end up in a state where the Wayland
+ * compositor sends us an event for a surface that doesn't exist.
+ *
+ * Don't process enter events in this case.
+ */
+ if (surface == NULL)
+ return;
+
xwl_seat->xwl_screen->serial = serial;
xwl_seat->pointer_enter_serial = serial;
diff --git a/xorg-server/hw/xwayland/xwayland.c b/xorg-server/hw/xwayland/xwayland.c
index 17b7bf7fd..913296947 100644
--- a/xorg-server/hw/xwayland/xwayland.c
+++ b/xorg-server/hw/xwayland/xwayland.c
@@ -308,6 +308,9 @@ xwl_unrealize_window(WindowPtr window)
xorg_list_del(&xwl_window->link_damage);
DamageUnregister(xwl_window->damage);
DamageDestroy(xwl_window->damage);
+ if (xwl_window->frame_callback)
+ wl_callback_destroy(xwl_window->frame_callback);
+
free(xwl_window);
dixSetPrivate(&window->devPrivates, &xwl_window_private_key, NULL);
@@ -321,20 +324,35 @@ xwl_save_screen(ScreenPtr pScreen, int on)
}
static void
+frame_callback(void *data,
+ struct wl_callback *callback,
+ uint32_t time)
+{
+ struct xwl_window *xwl_window = data;
+ xwl_window->frame_callback = NULL;
+}
+
+static const struct wl_callback_listener frame_listener = {
+ frame_callback
+};
+
+static void
xwl_screen_post_damage(struct xwl_screen *xwl_screen)
{
- struct xwl_window *xwl_window;
+ struct xwl_window *xwl_window, *next_xwl_window;
RegionPtr region;
BoxPtr box;
- int count, i;
struct wl_buffer *buffer;
PixmapPtr pixmap;
- xorg_list_for_each_entry(xwl_window, &xwl_screen->damage_window_list,
- link_damage) {
- region = DamageRegion(xwl_window->damage);
- count = RegionNumRects(region);
+ xorg_list_for_each_entry_safe(xwl_window, next_xwl_window,
+ &xwl_screen->damage_window_list, link_damage) {
+ /* If we're waiting on a frame callback from the server,
+ * don't attach a new buffer. */
+ if (xwl_window->frame_callback)
+ continue;
+ region = DamageRegion(xwl_window->damage);
pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window);
#if GLAMOR_HAS_GBM
@@ -345,17 +363,19 @@ xwl_screen_post_damage(struct xwl_screen *xwl_screen)
buffer = xwl_shm_pixmap_get_wl_buffer(pixmap);
wl_surface_attach(xwl_window->surface, buffer, 0, 0);
- for (i = 0; i < count; i++) {
- box = &RegionRects(region)[i];
- wl_surface_damage(xwl_window->surface,
- box->x1, box->y1,
- box->x2 - box->x1, box->y2 - box->y1);
- }
+
+ box = RegionExtents(region);
+ wl_surface_damage(xwl_window->surface, box->x1, box->y1,
+ box->x2 - box->x1, box->y2 - box->y1);
+
+ xwl_window->frame_callback = wl_surface_frame(xwl_window->surface);
+ wl_callback_add_listener(xwl_window->frame_callback, &frame_listener, xwl_window);
+
wl_surface_commit(xwl_window->surface);
DamageEmpty(xwl_window->damage);
- }
- xorg_list_init(&xwl_screen->damage_window_list);
+ xorg_list_del(&xwl_window->link_damage);
+ }
}
static void
diff --git a/xorg-server/hw/xwayland/xwayland.h b/xorg-server/hw/xwayland/xwayland.h
index 60b0c2964..bfffa712f 100644
--- a/xorg-server/hw/xwayland/xwayland.h
+++ b/xorg-server/hw/xwayland/xwayland.h
@@ -102,6 +102,7 @@ struct xwl_window {
WindowPtr window;
DamagePtr damage;
struct xorg_list link_damage;
+ struct wl_callback *frame_callback;
};
#define MODIFIER_META 0x01
diff --git a/xorg-server/hw/xwin/Makefile.am b/xorg-server/hw/xwin/Makefile.am
index 4ee963227..326ffa03d 100644
--- a/xorg-server/hw/xwin/Makefile.am
+++ b/xorg-server/hw/xwin/Makefile.am
@@ -15,7 +15,7 @@ if XWIN_GLX_WINDOWS
GLX_DIR = glx
DEFS_GLX_WINDOWS = -DXWIN_GLX_WINDOWS
XWIN_GLX_LIBS = $(top_builddir)/hw/xwin/glx/libXwinGLX.la
-XWIN_GLX_LINK_FLAGS = -lopengl32
+XWIN_GLX_SYS_LIBS = -lopengl32
endif
if XWIN_MULTIWINDOW
@@ -27,7 +27,7 @@ SRCS_MULTIWINDOW = \
propertystore.h \
winSetAppUserModelID.c
DEFS_MULTIWINDOW = -DXWIN_MULTIWINDOW
-MULTIWINDOW_LIBS = -lshlwapi -lole32
+MULTIWINDOW_SYS_LIBS = -lshlwapi -lole32
endif
if XWIN_MULTIWINDOWEXTWM
@@ -126,6 +126,8 @@ SRCS = InitInput.c \
winprefs.h \
winresource.h \
winwindow.h \
+ windisplay.c \
+ windisplay.h \
XWin.rc \
$(top_srcdir)/mi/miinitext.c \
$(SRCS_CLIPBOARD) \
@@ -150,11 +152,28 @@ XWin_SOURCES = $(SRCS)
AM_CPPFLAGS = -I$(top_srcdir)/miext/rootless
XWIN_SYS_LIBS += -ldxguid
-XWIN_LIBS += $(top_builddir)/pseudoramiX/libPseudoramiX.la \
- $(top_builddir)/Xext/libXextdpmsstubs.la \
- $(top_builddir)/Xi/libXistubs.la
-XWin_DEPENDENCIES = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_LIBS) $(XSERVER_LIBS)
-XWin_LDADD = $(MULTIWINDOW_LIBS) $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_GLX_LINK_FLAGS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS)
+
+XWIN_LIBS += \
+ $(top_builddir)/pseudoramiX/libPseudoramiX.la \
+ $(top_builddir)/Xext/libXextdpmsstubs.la \
+ $(top_builddir)/Xi/libXistubs.la
+
+XWin_DEPENDENCIES = \
+ $(MULTIWINDOWEXTWM_LIBS) \
+ $(XWIN_GLX_LIBS) \
+ $(XWIN_LIBS) \
+ $(XSERVER_LIBS)
+
+XWin_LDADD = \
+ $(MULTIWINDOWEXTWM_LIBS) \
+ $(XWIN_GLX_LIBS) \
+ $(XWIN_LIBS) \
+ $(XSERVER_LIBS) \
+ $(XWIN_GLX_SYS_LIBS) \
+ $(XSERVER_SYS_LIBS) \
+ $(XWIN_SYS_LIBS) \
+ $(MULTIWINDOW_SYS_LIBS)
+
XWin_LDFLAGS = -mwindows -Wl,--disable-stdcall-fixup $(LD_EXPORT_SYMBOLS_FLAG)
diff --git a/xorg-server/hw/xwin/glx/.gitignore b/xorg-server/hw/xwin/glx/.gitignore
index 062fd8573..9684410ac 100644
--- a/xorg-server/hw/xwin/glx/.gitignore
+++ b/xorg-server/hw/xwin/glx/.gitignore
@@ -1,3 +1,6 @@
# ignore generated files
-generated_gl_wrappers.c
+diag.txt
+generated_gl_shim.c
+generated_gl_thunks.c
+generated_gl_thunks.def
generated_wgl_wrappers.c
diff --git a/xorg-server/hw/xwin/glx/gen_gl_wrappers.py b/xorg-server/hw/xwin/glx/gen_gl_wrappers.py
index cdbba638a..69ab1efa9 100644
--- a/xorg-server/hw/xwin/glx/gen_gl_wrappers.py
+++ b/xorg-server/hw/xwin/glx/gen_gl_wrappers.py
@@ -100,13 +100,16 @@ reg = Registry()
tree = etree.parse(regFilename)
reg.loadElementTree(tree)
-allVersions = '.*'
+if shim:
+ versions = '1\.[012]'
+else:
+ versions = '.*'
genOpts = CGeneratorOptions(
apiname = prefix,
profile = 'compatibility',
- versions = allVersions,
- emitversions = allVersions,
+ versions = versions,
+ emitversions = versions,
defaultExtensions = prefix, # Default extensions for GL
protectFile = protect,
protectFeature = protect,
@@ -257,7 +260,7 @@ class ThunkOutputGenerator(OutputGenerator):
pass
def beginFeature(self, interface, emit):
OutputGenerator.beginFeature(self, interface, emit)
- self.OldVersion = self.featureName.startswith('GL_VERSION_1_0') or self.featureName.startswith('GL_VERSION_1_1')
+ self.OldVersion = (self.featureName in ['GL_VERSION_1_0', 'GL_VERSION_1_1'])
def endFeature(self):
OutputGenerator.endFeature(self)
def genType(self, typeinfo, name):
@@ -355,7 +358,7 @@ class ShimOutputGenerator(OutputGenerator):
pass
def beginFeature(self, interface, emit):
OutputGenerator.beginFeature(self, interface, emit)
- self.OldVersion = self.featureName.startswith('GL_VERSION_1_0') or self.featureName.startswith('GL_VERSION_1_1') or self.featureName.startswith('GL_VERSION_1_2') or self.featureName.startswith('GL_ARB_imaging') or self.featureName.startswith('GL_ARB_multitexture') or self.featureName.startswith('GL_ARB_texture_compression')
+ self.OldVersion = (self.featureName in ['GL_VERSION_1_0', 'GL_VERSION_1_1', 'GL_VERSION_1_2', 'GL_ARB_imaging', 'GL_ARB_multitexture', 'GL_ARB_texture_compression'])
def endFeature(self):
OutputGenerator.endFeature(self)
def genType(self, typeinfo, name):
diff --git a/xorg-server/hw/xwin/glx/glwindows.h b/xorg-server/hw/xwin/glx/glwindows.h
index 4f859b498..34ff24c24 100644
--- a/xorg-server/hw/xwin/glx/glwindows.h
+++ b/xorg-server/hw/xwin/glx/glwindows.h
@@ -28,6 +28,9 @@
* DEALINGS IN THE SOFTWARE.
*/
+#ifndef GLWINDOWS_H
+#define GLWINDOWS_H
+
#include <GL/gl.h>
typedef struct {
@@ -53,3 +56,5 @@ int glWinSelectImplementation(int native);
#define GLWIN_TRACE_MSG(a, ...)
#define GLWIN_DEBUG_MSG(a, ...)
#endif
+
+#endif
diff --git a/xorg-server/hw/xwin/glx/indirect.c b/xorg-server/hw/xwin/glx/indirect.c
index 9bfaac03d..93cdb29d6 100644
--- a/xorg-server/hw/xwin/glx/indirect.c
+++ b/xorg-server/hw/xwin/glx/indirect.c
@@ -738,9 +738,6 @@ glxWinScreenProbe(ScreenPtr pScreen)
__glXScreenInit(&screen->base, pScreen);
- // Override the GL extensions string set by __glXScreenInit()
- screen->base.GLextensions = strdup(gl_extensions);
-
// Generate the GLX extensions string (overrides that set by __glXScreenInit())
{
unsigned int buffer_size =
@@ -893,13 +890,6 @@ glxWinDrawableSwapBuffers(ClientPtr client, __GLXdrawable * base)
("glxWinSwapBuffers on drawable %p, last context %p (native ctx %p)",
base, draw->drawContext, draw->drawContext->ctx);
- /*
- draw->drawContext->base.drawPriv will not be set if the context is not current anymore,
- but if it is, it should point to this drawable....
- */
- assert((draw->drawContext->base.drawPriv == NULL) ||
- (draw->drawContext->base.drawPriv == base));
-
dc = glxWinMakeDC(draw->drawContext, draw, &dc, &hwnd);
if (dc == NULL)
return GL_FALSE;
@@ -1123,7 +1113,6 @@ glxWinSetPixelFormat(__GLXWinContext * gc, HDC hdc, int bppOverride,
fbConfigToPixelFormatIndex(hdc, gc->base.config,
drawableTypeOverride, winScreen);
if (pixelFormat == 0) {
- ErrorF("wglChoosePixelFormat error: %s\n", glxWinErrorMessage());
return FALSE;
}
@@ -1306,7 +1295,7 @@ glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw)
glxWinScreen *winScreen;
int pixelFormat;
- // XXX: which DC are supposed to use???
+ // XXX: which DC are we supposed to use???
HDC screenDC = GetDC(NULL);
if (!(gc->base.config->drawableType & GLX_PBUFFER_BIT)) {
@@ -1319,10 +1308,8 @@ glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw)
pixelFormat =
fbConfigToPixelFormatIndex(screenDC, gc->base.config,
- GLX_DRAWABLE_PBUFFER, winScreen);
+ GLX_PBUFFER_BIT, winScreen);
if (pixelFormat == 0) {
- ErrorF("wglChoosePixelFormat error: %s\n",
- glxWinErrorMessage());
return;
}
@@ -1761,7 +1748,7 @@ fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig * mode,
SET_ATTR_VALUE(WGL_SWAP_METHOD_ARB, WGL_SWAP_EXCHANGE_ARB);
if (mode->swapMethod == GLX_SWAP_COPY_OML)
- SET_ATTR_VALUE(WGL_SWAP_COPY_ARB, TRUE);
+ SET_ATTR_VALUE(WGL_SWAP_METHOD_ARB, WGL_SWAP_COPY_ARB);
// XXX: this should probably be the other way around, but that messes up drawableTypeOverride
if (mode->visualRating == GLX_SLOW_VISUAL_EXT)
diff --git a/xorg-server/hw/xwin/glx/winpriv.c b/xorg-server/hw/xwin/glx/winpriv.c
index 4f6e4ffd5..9b4baf381 100644
--- a/xorg-server/hw/xwin/glx/winpriv.c
+++ b/xorg-server/hw/xwin/glx/winpriv.c
@@ -51,7 +51,7 @@ winGetWindowInfo(WindowPtr pWin)
if (pWinPriv->hWnd == NULL) {
winCreateWindowsWindow(pWin);
- ErrorF("winGetWindowInfo: forcing window to exist...\n");
+ winDebug("winGetWindowInfo: forcing window to exist\n");
}
if (pWinPriv->hWnd != NULL) {
diff --git a/xorg-server/hw/xwin/winclipboardthread.c b/xorg-server/hw/xwin/winclipboardthread.c
index 33595be7f..e70896081 100644
--- a/xorg-server/hw/xwin/winclipboardthread.c
+++ b/xorg-server/hw/xwin/winclipboardthread.c
@@ -38,6 +38,7 @@
#include <sys/types.h>
#include <signal.h>
#include "winclipboard.h"
+#include "windisplay.h"
#ifdef __CYGWIN__
#include <errno.h>
#endif
@@ -157,7 +158,7 @@ winClipboardProc(void *pvNotUsed)
* for all screens on the display. That is why there is only
* one clipboard client thread.
*/
- snprintf(szDisplay, 512, "127.0.0.1:%s.0", display);
+ winGetDisplayName(szDisplay, 0);
/* Print the display connection string */
ErrorF("winClipboardProc - DISPLAY=%s\n", szDisplay);
diff --git a/xorg-server/hw/xwin/windisplay.c b/xorg-server/hw/xwin/windisplay.c
new file mode 100644
index 000000000..17f0c7789
--- /dev/null
+++ b/xorg-server/hw/xwin/windisplay.c
@@ -0,0 +1,64 @@
+/*
+ * File: windisplay.c
+ * Purpose: Retrieve server display name
+ *
+ * Copyright (C) Jon TURNEY 2009
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+
+#include <opaque.h> // for display
+#include "windisplay.h"
+#include "winmsg.h"
+
+#define XSERV_t
+#define TRANS_SERVER
+#include <X11/Xtrans/Xtrans.h>
+
+/*
+ Generate a display name string referring to the display of this server,
+ using a transport we know is enabled
+*/
+
+void
+winGetDisplayName(char *szDisplay, unsigned int screen)
+{
+ if (_XSERVTransIsListening("local")) {
+ snprintf(szDisplay, 512, ":%s.%d", display, screen);
+ }
+ else if (_XSERVTransIsListening("inet")) {
+ snprintf(szDisplay, 512, "127.0.0.1:%s.%d", display, screen);
+ }
+ else if (_XSERVTransIsListening("inet6")) {
+ snprintf(szDisplay, 512, "::1:%s.%d", display, screen);
+ }
+ else {
+ // this can't happen!
+ ErrorF("winGetDisplay: Don't know what to use for DISPLAY\n");
+ snprintf(szDisplay, 512, "localhost:%s.%d", display, screen);
+ }
+
+ winDebug("winGetDisplay: DISPLAY=%s\n", szDisplay);
+}
diff --git a/xorg-server/hw/xwin/windisplay.h b/xorg-server/hw/xwin/windisplay.h
new file mode 100644
index 000000000..d1d4549bf
--- /dev/null
+++ b/xorg-server/hw/xwin/windisplay.h
@@ -0,0 +1,34 @@
+/*
+ * File: windisplay.h
+ * Purpose: Interface to retrieve server display name
+ *
+ * Copyright (C) Jon TURNEY 2009
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef WINDISPLAY_H
+#define WINDISPLAY_H
+
+void
+winGetDisplayName(char *szDisplay, unsigned int screen);
+
+#endif /* !WINDISPLAY_H */
diff --git a/xorg-server/hw/xwin/winmsg.h b/xorg-server/hw/xwin/winmsg.h
index b638f2cb3..6c96c4070 100644
--- a/xorg-server/hw/xwin/winmsg.h
+++ b/xorg-server/hw/xwin/winmsg.h
@@ -30,6 +30,8 @@
* Authors: Alexander Gottwald
*/
+#include <X11/Xwindows.h>
+
/*
* Function prototypes
*/
diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c
index 618e38121..e17a9502d 100644
--- a/xorg-server/hw/xwin/winmultiwindowwm.c
+++ b/xorg-server/hw/xwin/winmultiwindowwm.c
@@ -61,6 +61,7 @@
#include "pixmapstr.h"
#include "windowstr.h"
#include "winglobals.h"
+#include "windisplay.h"
#ifdef XWIN_MULTIWINDOWEXTWM
#include <X11/extensions/windowswmstr.h>
@@ -1053,8 +1054,7 @@ winMultiWindowXMsgProc(void *pArg)
}
/* Setup the display connection string x */
- snprintf(pszDisplay,
- 512, "127.0.0.1:%s.%d", display, (int) pProcArg->dwScreen);
+ winGetDisplayName(pszDisplay, (int) pProcArg->dwScreen);
/* Print the display connection string */
ErrorF("winMultiWindowXMsgProc - DISPLAY=%s\n", pszDisplay);
@@ -1446,8 +1446,7 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
}
/* Setup the display connection string x */
- snprintf(pszDisplay,
- 512, "127.0.0.1:%s.%d", display, (int) pProcArg->dwScreen);
+ winGetDisplayName(pszDisplay, (int) pProcArg->dwScreen);
/* Print the display connection string */
ErrorF("winInitMultiWindowWM - DISPLAY=%s\n", pszDisplay);
diff --git a/xorg-server/hw/xwin/winprefs.c b/xorg-server/hw/xwin/winprefs.c
index f386facdd..53abc163f 100644
--- a/xorg-server/hw/xwin/winprefs.c
+++ b/xorg-server/hw/xwin/winprefs.c
@@ -44,6 +44,7 @@
#include <shellapi.h>
#include "winprefs.h"
+#include "windisplay.h"
#include "winmultiwindowclass.h"
/* Where will the custom menu commands start counting from? */
@@ -712,15 +713,14 @@ LoadPreferences(void)
/* Setup a DISPLAY environment variable, need to allocate on heap */
/* because putenv doesn't copy the argument... */
- snprintf(szDisplay, 512, "DISPLAY=127.0.0.1:%s.0", display);
- szEnvDisplay = (char *) (malloc(strlen(szDisplay) + 1));
+ winGetDisplayName(szDisplay, 0);
+ szEnvDisplay = (char *) (malloc(strlen(szDisplay) + strlen("DISPLAY=") + 1));
if (szEnvDisplay) {
- strcpy(szEnvDisplay, szDisplay);
+ snprintf(szEnvDisplay, 512, "DISPLAY=%s", szDisplay);
putenv(szEnvDisplay);
}
/* Replace any "%display%" in menu commands with display string */
- snprintf(szDisplay, 512, "127.0.0.1:%s.0", display);
for (i = 0; i < pref.menuItems; i++) {
for (j = 0; j < pref.menu[i].menuItems; j++) {
if (pref.menu[i].menuItem[j].cmd == CMD_EXEC) {
diff --git a/xorg-server/hw/xwin/winshadddnl.c b/xorg-server/hw/xwin/winshadddnl.c
index 55af5c383..cb326dc81 100644
--- a/xorg-server/hw/xwin/winshadddnl.c
+++ b/xorg-server/hw/xwin/winshadddnl.c
@@ -986,6 +986,10 @@ winRedrawScreenShadowDDNL(ScreenPtr pScreen)
RECT rcSrc, rcDest;
POINT ptOrigin;
+ /* Return immediately if we didn't get needed surfaces */
+ if (!pScreenPriv->pddsPrimary4 || !pScreenPriv->pddsShadow4)
+ return;
+
/* Get the origin of the window in the screen coords */
ptOrigin.x = pScreenInfo->dwXOffset;
ptOrigin.y = pScreenInfo->dwYOffset;
diff --git a/xorg-server/include/dix-config.h.in b/xorg-server/include/dix-config.h.in
index 2203f82b4..4268b8f2e 100644
--- a/xorg-server/include/dix-config.h.in
+++ b/xorg-server/include/dix-config.h.in
@@ -57,9 +57,6 @@
/* Support SHM */
#undef HAS_SHM
-/* Define to 1 if you have the <asm/mtrr.h> header file. */
-#undef HAVE_ASM_MTRR_H
-
/* Has backtrace support */
#undef HAVE_BACKTRACE
diff --git a/xorg-server/include/pixmap.h b/xorg-server/include/pixmap.h
index f3c2c60c0..4b8fc244d 100644
--- a/xorg-server/include/pixmap.h
+++ b/xorg-server/include/pixmap.h
@@ -120,6 +120,12 @@ PixmapStartDirtyTracking(PixmapPtr src,
PixmapPtr slave_dst,
int x, int y);
+#define HAS_DIRTYTRACKING2 1
+extern _X_EXPORT Bool
+PixmapStartDirtyTracking2(PixmapPtr src,
+ PixmapPtr slave_dst,
+ int x, int y, int dst_x, int dst_y);
+
extern _X_EXPORT Bool
PixmapStopDirtyTracking(PixmapPtr src, PixmapPtr slave_dst);
diff --git a/xorg-server/include/pixmapstr.h b/xorg-server/include/pixmapstr.h
index 2a1ef9b85..2bdff98d9 100644
--- a/xorg-server/include/pixmapstr.h
+++ b/xorg-server/include/pixmapstr.h
@@ -90,6 +90,7 @@ typedef struct _PixmapDirtyUpdate {
int x, y;
DamagePtr damage;
struct xorg_list ent;
+ int dst_x, dst_y;
} PixmapDirtyUpdateRec;
static inline void
diff --git a/xorg-server/include/registry.h b/xorg-server/include/registry.h
index 96be87aad..43c3db339 100644
--- a/xorg-server/include/registry.h
+++ b/xorg-server/include/registry.h
@@ -17,18 +17,26 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#define XREGISTRY_UNKNOWN "<unknown>"
-#ifdef XREGISTRY
-
#include "resource.h"
#include "extnsionst.h"
+#if defined(XSELINUX) || defined(RES)
+#define X_REGISTRY_RESOURCE 1
+#endif
+
+#if defined(XSELINUX) || defined(XCSECURITY)
+#define X_REGISTRY_REQUEST 1
+#endif
+
/* Internal string registry - for auditing, debugging, security, etc. */
-/*
- * Registration functions. The name string is not copied, so it must
- * not be a stack variable.
- */
+#ifdef X_REGISTRY_RESOURCE
+/* Functions used by the X-Resource extension */
extern _X_EXPORT void RegisterResourceName(RESTYPE type, const char *name);
+extern _X_EXPORT const char *LookupResourceName(RESTYPE rtype);
+#endif
+
+#ifdef X_REGISTRY_REQUEST
extern _X_EXPORT void RegisterExtensionNames(ExtensionEntry * ext);
/*
@@ -38,29 +46,13 @@ extern _X_EXPORT const char *LookupMajorName(int major);
extern _X_EXPORT const char *LookupRequestName(int major, int minor);
extern _X_EXPORT const char *LookupEventName(int event);
extern _X_EXPORT const char *LookupErrorName(int error);
-extern _X_EXPORT const char *LookupResourceName(RESTYPE rtype);
+#endif
/*
* Setup and teardown
*/
extern _X_EXPORT void dixResetRegistry(void);
extern _X_EXPORT void dixFreeRegistry(void);
+extern _X_EXPORT void dixCloseRegistry(void);
-#else /* XREGISTRY */
-
-/* Define calls away when the registry is not being built. */
-
-#define RegisterResourceName(a, b) { ; }
-#define RegisterExtensionNames(a) { ; }
-
-#define LookupMajorName(a) XREGISTRY_UNKNOWN
-#define LookupRequestName(a, b) XREGISTRY_UNKNOWN
-#define LookupEventName(a) XREGISTRY_UNKNOWN
-#define LookupErrorName(a) XREGISTRY_UNKNOWN
-#define LookupResourceName(a) XREGISTRY_UNKNOWN
-
-#define dixResetRegistry() { ; }
-#define dixFreeRegistry() { ; }
-
-#endif /* XREGISTRY */
#endif /* DIX_REGISTRY_H */
diff --git a/xorg-server/include/xorg-config.h.in b/xorg-server/include/xorg-config.h.in
index 629ae4057..7c03126e1 100644
--- a/xorg-server/include/xorg-config.h.in
+++ b/xorg-server/include/xorg-config.h.in
@@ -82,12 +82,6 @@
/* Building vgahw module */
#undef WITH_VGAHW
-/* Define to 1 if NetBSD built-in MTRR support is available */
-#undef HAS_MTRR_BUILTIN
-
-/* Define to 1 if BSD MTRR support is available */
-#undef HAS_MTRR_SUPPORT
-
/* NetBSD PIO alpha IO */
#undef USE_ALPHA_PIO
diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c
index 2a721b948..7348ad4a2 100644
--- a/xorg-server/os/log.c
+++ b/xorg-server/os/log.c
@@ -189,15 +189,15 @@ strlen_sigsafe(const char *s)
* string.
*/
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+
const char *
LogInit(const char *fname, const char *backup)
{
char *logFileName = NULL;
if (fname && *fname) {
-#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 2
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
-#endif
if (asprintf(&logFileName, fname, display) == -1)
FatalError("Cannot allocate space for the log file name\n");
@@ -208,9 +208,6 @@ LogInit(const char *fname, const char *backup)
char *suffix;
char *oldLog;
-#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 2
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
-#endif
if ((asprintf(&suffix, backup, display) == -1) ||
(asprintf(&oldLog, "%s%s", logFileName, suffix) == -1))
FatalError("Cannot allocate space for the log file name\n");
@@ -254,6 +251,7 @@ LogInit(const char *fname, const char *backup)
return logFileName;
}
+#pragma GCC diagnostic pop
void
LogClose(enum ExitCode error)
diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c
index f3197430a..2d02f92ed 100644
--- a/xorg-server/os/utils.c
+++ b/xorg-server/os/utils.c
@@ -194,7 +194,7 @@ Bool noGEExtension = FALSE;
Bool CoreDump;
-Bool enableIndirectGLX = TRUE;
+Bool enableIndirectGLX = FALSE;
#ifdef PANORAMIX
Bool PanoramiXExtensionDisabledHack = FALSE;
@@ -541,8 +541,8 @@ UseMsg(void)
ErrorF("-fn string default font name\n");
ErrorF("-fp string default font path\n");
ErrorF("-help prints message with these options\n");
- ErrorF("+iglx Allow creating indirect GLX contexts (default)\n");
- ErrorF("-iglx Prohibit creating indirect GLX contexts\n");
+ ErrorF("+iglx Allow creating indirect GLX contexts\n");
+ ErrorF("-iglx Prohibit creating indirect GLX contexts (default)\n");
ErrorF("-I ignore all remaining arguments\n");
#ifdef RLIMIT_DATA
ErrorF("-ld int limit data space to N Kb\n");
diff --git a/xorg-server/present/present.c b/xorg-server/present/present.c
index f488e21cc..e838da792 100644
--- a/xorg-server/present/present.c
+++ b/xorg-server/present/present.c
@@ -837,7 +837,10 @@ present_pixmap(WindowPtr window,
if (!screen_priv->info || !(screen_priv->info->capabilities & PresentCapabilityAsync))
vblank->sync_flip = TRUE;
- if (pixmap && present_check_flip (target_crtc, window, pixmap, vblank->sync_flip, valid, x_off, y_off)) {
+ if (!(options & PresentOptionCopy) &&
+ pixmap != NULL &&
+ present_check_flip (target_crtc, window, pixmap, vblank->sync_flip, valid, x_off, y_off))
+ {
vblank->flip = TRUE;
if (vblank->sync_flip)
target_msc--;
@@ -935,11 +938,12 @@ present_flip_destroy(ScreenPtr screen)
{
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
- /* XXX this needs to be synchronous for server reset */
-
- /* Do the actual cleanup once the flip has been performed by the hardware */
+ /* Reset window pixmaps back to the screen pixmap */
if (screen_priv->flip_pending)
present_set_abort_flip(screen);
+
+ /* Drop reference to any pending flip or unflip pixmaps. */
+ present_flip_idle(screen);
}
void
diff --git a/xorg-server/present/present.h b/xorg-server/present/present.h
index 0e3bdc08e..aab2e168a 100644
--- a/xorg-server/present/present.h
+++ b/xorg-server/present/present.h
@@ -116,6 +116,7 @@ extern _X_EXPORT Bool
present_screen_init(ScreenPtr screen, present_screen_info_ptr info);
typedef void (*present_complete_notify_proc)(WindowPtr window,
+ CARD8 kind,
CARD8 mode,
CARD32 serial,
uint64_t ust,
diff --git a/xorg-server/present/present_event.c b/xorg-server/present/present_event.c
index ff57eba41..d3a59ea25 100644
--- a/xorg-server/present/present_event.c
+++ b/xorg-server/present/present_event.c
@@ -174,7 +174,7 @@ present_send_complete_notify(WindowPtr window, CARD8 kind, CARD8 mode, CARD32 se
}
}
if (complete_notify)
- (*complete_notify)(window, mode, serial, ust, msc);
+ (*complete_notify)(window, kind, mode, serial, ust, msc);
}
void
diff --git a/xorg-server/test/Makefile.am b/xorg-server/test/Makefile.am
index 32edc7a3b..83442767a 100644
--- a/xorg-server/test/Makefile.am
+++ b/xorg-server/test/Makefile.am
@@ -5,7 +5,10 @@ if XORG
# Tests that require at least some DDX functions in order to fully link
# For now, requires xf86 ddx, could be adjusted to use another
SUBDIRS += xi2
-noinst_PROGRAMS += xkb input xtest misc fixes xfree86 hashtabletest os signal-logging touch
+noinst_PROGRAMS += xkb input xtest misc fixes xfree86 os signal-logging touch
+if RES
+noinst_PROGRAMS += hashtabletest
+endif
endif
check_LTLIBRARIES = libxservertest.la
diff --git a/xorg-server/test/list.c b/xorg-server/test/list.c
index f9f54ee4e..28d9609ef 100644
--- a/xorg-server/test/list.c
+++ b/xorg-server/test/list.c
@@ -249,15 +249,15 @@ test_nt_list_append(void)
/* Test using nt_list_next */
for (item = foo, i = 1; i <= 10; i++, item = nt_list_next(item, next)) {
- assert(item->a = i);
- assert(item->b = i * 2);
+ assert(item->a == i);
+ assert(item->b == i * 2);
}
/* Test using nt_list_for_each_entry */
i = 1;
nt_list_for_each_entry(item, foo, next) {
- assert(item->a = i);
- assert(item->b = i * 2);
+ assert(item->a == i);
+ assert(item->b == i * 2);
i++;
}
assert(i == 11);
@@ -270,11 +270,11 @@ test_nt_list_insert(void)
struct foo *foo = calloc(10, sizeof(struct foo));
struct foo *item;
- foo->a = 10;
- foo->b = 20;
+ foo->a = 1;
+ foo->b = 2;
nt_list_init(foo, next);
- for (item = &foo[1], i = 9; i > 0; i--, item++) {
+ for (item = &foo[1], i = 10; i > 1; i--, item++) {
item->a = i;
item->b = i * 2;
nt_list_init(item, next);
@@ -282,16 +282,16 @@ test_nt_list_insert(void)
}
/* Test using nt_list_next */
- for (item = foo, i = 10; i > 0; i--, item = nt_list_next(item, next)) {
- assert(item->a = i);
- assert(item->b = i * 2);
+ for (item = foo, i = 1; i <= 10; i++, item = nt_list_next(item, next)) {
+ assert(item->a == i);
+ assert(item->b == i * 2);
}
/* Test using nt_list_for_each_entry */
i = 1;
nt_list_for_each_entry(item, foo, next) {
- assert(item->a = i);
- assert(item->b = i * 2);
+ assert(item->a == i);
+ assert(item->b == i * 2);
i++;
}
assert(i == 11);
diff --git a/xorg-server/test/signal-logging.c b/xorg-server/test/signal-logging.c
index 432012195..3d2d04801 100644
--- a/xorg-server/test/signal-logging.c
+++ b/xorg-server/test/signal-logging.c
@@ -113,12 +113,13 @@ double float_tests[] = { 0, 5, 0.1, 0.01, 5.2342, 10.2301,
-1, -2.00, -0.6023, -1203.30
};
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Woverflow"
+
static void
number_formatting(void)
{
int i;
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Woverflow"
long unsigned int unsigned_tests[] = { 0,/* Zero */
5, /* Single digit number */
12, /* Two digit decimal number */
@@ -141,7 +142,6 @@ number_formatting(void)
-0x15D027BF211B37A, /* Large > 32 bit number */
-0x7FFFFFFFFFFFFFFF, /* Maximum 64-bit signed number */
} ;
-#pragma GCC diagnostic pop
for (i = 0; i < sizeof(unsigned_tests) / sizeof(unsigned_tests[0]); i++)
assert(check_number_format_test(unsigned_tests[i]));
@@ -152,6 +152,7 @@ number_formatting(void)
for (i = 0; i < sizeof(float_tests) / sizeof(float_tests[0]); i++)
assert(check_float_format_test(float_tests[i]));
}
+#pragma GCC diagnostic pop
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-security"
diff --git a/xorg-server/xkeyboard-config/rules/base.extras.xml.in b/xorg-server/xkeyboard-config/rules/base.extras.xml.in
index 2bda88ba7..2e1e89d6b 100644
--- a/xorg-server/xkeyboard-config/rules/base.extras.xml.in
+++ b/xorg-server/xkeyboard-config/rules/base.extras.xml.in
@@ -8,7 +8,9 @@
<name>apl</name>
<_shortDescription>apl</_shortDescription>
<_description>APL keyboard symbols</_description>
- <languageList><iso639Id>eng</iso639Id></languageList>
+ <languageList>
+ <iso639Id>eng</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -60,7 +62,9 @@
<name>ca</name>
<_shortDescription>fr</_shortDescription>
<_description>French (Canada)</_description>
- <languageList><iso639Id>fra</iso639Id></languageList>
+ <languageList>
+ <iso639Id>fra</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -133,14 +137,18 @@
<name>ir</name>
<_shortDescription>fa</_shortDescription>
<_description>Persian</_description>
- <languageList><iso639Id>per</iso639Id></languageList>
+ <languageList>
+ <iso639Id>per</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
<configItem>
<name>ave</name>
<_description>Avestan</_description>
- <languageList><iso639Id>ave</iso639Id></languageList>
+ <languageList>
+ <iso639Id>ave</iso639Id>
+ </languageList>
</configItem>
</variant>
</variantList>
@@ -150,7 +158,9 @@
<name>lt</name>
<_shortDescription>lt</_shortDescription>
<_description>Lithuanian</_description>
- <languageList><iso639Id>lit</iso639Id></languageList>
+ <languageList>
+ <iso639Id>lit</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -210,7 +220,7 @@
<variant>
<configItem>
<name>minuskeydvorakprogr</name>
- <_description>Latvian (programmer US Dvorak, minus variant)</_description>
+ <_description>Latvian (programmer US Dvorak, minus variant)</_description>
</configItem>
</variant>
<variant>
@@ -238,7 +248,9 @@
<name>us</name>
<_shortDescription>en</_shortDescription>
<_description>English (US)</_description>
- <languageList><iso639Id>eng</iso639Id></languageList>
+ <languageList>
+ <iso639Id>eng</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -264,17 +276,21 @@
<configItem>
<name>crd</name>
<_description>Coeur d'Alene Salish</_description>
- <languageList><iso639Id>crd</iso639Id></languageList>
+ <languageList>
+ <iso639Id>crd</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
<configItem>
<name>cz_sk_de</name>
<_description>Czech Slovak and German (US)</_description>
- <languageList><iso639Id>eng</iso639Id>
- <iso639Id>cze</iso639Id>
- <iso639Id>slo</iso639Id>
- <iso639Id>ger</iso639Id> </languageList>
+ <languageList>
+ <iso639Id>eng</iso639Id>
+ <iso639Id>cze</iso639Id>
+ <iso639Id>slo</iso639Id>
+ <iso639Id>ger</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -296,7 +312,9 @@
<name>pl</name>
<_shortDescription>pl</_shortDescription>
<_description>Polish</_description>
- <languageList><iso639Id>pol</iso639Id></languageList>
+ <languageList>
+ <iso639Id>pol</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -324,7 +342,9 @@
<name>ro</name>
<_shortDescription>ro</_shortDescription>
<_description>Romanian</_description>
- <languageList><iso639Id>rum</iso639Id></languageList>
+ <languageList>
+ <iso639Id>rum</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -356,7 +376,9 @@
<name>rs</name>
<_shortDescription>sr</_shortDescription>
<_description>Serbian</_description>
- <languageList><iso639Id>srp</iso639Id></languageList>
+ <languageList>
+ <iso639Id>srp</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -378,7 +400,9 @@
<configItem>
<name>chu</name>
<_description>Church Slavonic</_description>
- <languageList><iso639Id>chu</iso639Id></languageList>
+ <languageList>
+ <iso639Id>chu</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -386,9 +410,11 @@
<name>ruu</name>
<_shortDescription>ru</_shortDescription>
<_description>Russian (with Ukrainian-Belorussian layout)</_description>
- <languageList><iso639Id>rus</iso639Id>
- <iso639Id>ukr</iso639Id>
- <iso639Id>bel</iso639Id></languageList>
+ <languageList>
+ <iso639Id>rus</iso639Id>
+ <iso639Id>ukr</iso639Id>
+ <iso639Id>bel</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -417,19 +443,23 @@
</variant>
</variantList>
</layout>
- <layout>
+ <layout>
<configItem>
<name>il</name>
<_shortDescription>he</_shortDescription>
<_description>Hebrew</_description>
- <languageList><iso639Id>heb</iso639Id></languageList>
+ <languageList>
+ <iso639Id>heb</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
<configItem>
<name>biblicalSIL</name>
<_description>Hebrew (Biblical, SIL phonetic)</_description>
- <languageList><iso639Id>heb</iso639Id></languageList>
+ <languageList>
+ <iso639Id>heb</iso639Id>
+ </languageList>
</configItem>
</variant>
</variantList>
@@ -439,173 +469,173 @@
<name>ara</name>
<_shortDescription>ar</_shortDescription>
<_description>Arabic</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Arabic (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>be</name>
<_shortDescription>be</_shortDescription>
<_description>Belgian</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Belgian (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>br</name>
<_shortDescription>pt</_shortDescription>
<_description>Portuguese (Brazil)</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Portuguese (Brazil, Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>cz</name>
<_shortDescription>cs</_shortDescription>
<_description>Czech</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Czech (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>dk</name>
<_shortDescription>da</_shortDescription>
<_description>Danish</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Danish (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>nl</name>
<_shortDescription>nl</_shortDescription>
<_description>Dutch</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Dutch (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>ee</name>
<_shortDescription>et</_shortDescription>
<_description>Estonian</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Estonian (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>fi</name>
<_shortDescription>fi</_shortDescription>
<_description>Finnish</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Finnish (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>fr</name>
<_shortDescription>fr</_shortDescription>
<_description>French</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>French (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>gr</name>
<_shortDescription>gr</_shortDescription>
<_description>Greek</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Greek (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>it</name>
<_shortDescription>it</_shortDescription>
<_description>Italian</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Italian (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>jp</name>
<_shortDescription>ja</_shortDescription>
<_description>Japanese</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
@@ -624,68 +654,68 @@
<_description>Japanese (Sun Type 7 - sun compatible)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>no</name>
<_shortDescription>no</_shortDescription>
<_description>Norwegian</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Norwegian (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>pt</name>
<_shortDescription>pt</_shortDescription>
<_description>Portuguese</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Portuguese (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>sk</name>
<_shortDescription>sk</_shortDescription>
<_description>Slovak</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Slovak (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>es</name>
<_shortDescription>es</_shortDescription>
<_description>Spanish</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Spanish (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>se</name>
@@ -712,8 +742,8 @@
<name>ch</name>
<_shortDescription>de</_shortDescription>
<_description>German (Switzerland)</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6_de</name>
@@ -726,93 +756,93 @@
<_description>French (Switzerland, Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>tr</name>
<_shortDescription>tr</_shortDescription>
<_description>Turkish</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Turkish (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>ua</name>
<_shortDescription>uk</_shortDescription>
<_description>Ukrainian</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Ukrainian (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>gb</name>
<_shortDescription>en</_shortDescription>
<_description>English (UK)</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>English (UK, Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>kr</name>
<_shortDescription>ko</_shortDescription>
<_description>Korean</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Korean (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>eu</name>
- <!-- Keyboard indicator for European layouts -->
- <_shortDescription>eu</_shortDescription>
- <_description>EurKEY (US based layout with european letters)</_description>
- <languageList>
- <iso639Id>cat</iso639Id>
- <iso639Id>dan</iso639Id>
- <iso639Id>eng</iso639Id>
- <iso639Id>est</iso639Id>
- <iso639Id>fao</iso639Id>
- <iso639Id>fin</iso639Id>
- <iso639Id>ger</iso639Id>
- <iso639Id>gre</iso639Id>
- <iso639Id>gsw</iso639Id>
- <iso639Id>ita</iso639Id>
- <iso639Id>lav</iso639Id>
- <iso639Id>lit</iso639Id>
- <iso639Id>nld</iso639Id>
- <iso639Id>nor</iso639Id>
- <iso639Id>por</iso639Id>
- <iso639Id>spa</iso639Id>
- <iso639Id>swe</iso639Id>
- </languageList>
+ </variantList>
+ </layout>
+ <layout>
+ <configItem>
+ <name>eu</name>
+ <!-- Keyboard indicator for European layouts -->
+ <_shortDescription>eu</_shortDescription>
+ <_description>EurKEY (US based layout with european letters)</_description>
+ <languageList>
+ <iso639Id>cat</iso639Id>
+ <iso639Id>dan</iso639Id>
+ <iso639Id>eng</iso639Id>
+ <iso639Id>est</iso639Id>
+ <iso639Id>fao</iso639Id>
+ <iso639Id>fin</iso639Id>
+ <iso639Id>ger</iso639Id>
+ <iso639Id>gre</iso639Id>
+ <iso639Id>gsw</iso639Id>
+ <iso639Id>ita</iso639Id>
+ <iso639Id>lav</iso639Id>
+ <iso639Id>lit</iso639Id>
+ <iso639Id>nld</iso639Id>
+ <iso639Id>nor</iso639Id>
+ <iso639Id>por</iso639Id>
+ <iso639Id>spa</iso639Id>
+ <iso639Id>swe</iso639Id>
+ </languageList>
</configItem>
</layout>
<layout>
diff --git a/xorg-server/xkeyboard-config/rules/base.xml.in b/xorg-server/xkeyboard-config/rules/base.xml.in
index a7aa5de29..3fd0ce427 100644
--- a/xorg-server/xkeyboard-config/rules/base.xml.in
+++ b/xorg-server/xkeyboard-config/rules/base.xml.in
@@ -856,21 +856,21 @@
</model>
<model>
<configItem>
- <name>microsoftmult</name>
+ <name>microsoftmult</name>
<_description>Microsoft Wireless Multimedia Keyboard 1.0A</_description>
<vendor>Microsoft Inc.</vendor>
</configItem>
</model>
<model>
<configItem>
- <name>microsoftelite</name>
+ <name>microsoftelite</name>
<_description>Microsoft Natural Keyboard Elite</_description>
<vendor>Microsoft Inc.</vendor>
</configItem>
</model>
<model>
<configItem>
- <name>microsoftccurve2k</name>
+ <name>microsoftccurve2k</name>
<_description>Microsoft Comfort Curve Keyboard 2000</_description>
<vendor>Microsoft Inc.</vendor>
</configItem>
@@ -1406,9 +1406,11 @@
<configItem>
<name>altgr-intl</name>
<_description>English (international AltGr dead keys)</_description>
- <languageList><iso639Id>eng</iso639Id>
- <iso639Id>fra</iso639Id>
- <iso639Id>ger</iso639Id></languageList>
+ <languageList>
+ <iso639Id>eng</iso639Id>
+ <iso639Id>fra</iso639Id>
+ <iso639Id>ger</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -1421,11 +1423,13 @@
<configItem>
<name>hbs</name>
<_description>Serbo-Croatian (US)</_description>
- <languageList><iso639Id>eng</iso639Id>
- <iso639Id>bos</iso639Id>
- <iso639Id>hbs</iso639Id>
- <iso639Id>hrv</iso639Id>
- <iso639Id>srp</iso639Id> </languageList>
+ <languageList>
+ <iso639Id>eng</iso639Id>
+ <iso639Id>bos</iso639Id>
+ <iso639Id>hbs</iso639Id>
+ <iso639Id>hrv</iso639Id>
+ <iso639Id>srp</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -1717,9 +1721,11 @@
<!-- Keyboard indicator for Belgian layouts -->
<_shortDescription>be</_shortDescription>
<_description>Belgian</_description>
- <languageList><iso639Id>ger</iso639Id>
- <iso639Id>nld</iso639Id>
- <iso639Id>fra</iso639Id></languageList>
+ <languageList>
+ <iso639Id>ger</iso639Id>
+ <iso639Id>nld</iso639Id>
+ <iso639Id>fra</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -1819,35 +1825,45 @@
<configItem>
<name>ben_baishakhi</name>
<_description>Bangla (India, Baishakhi)</_description>
- <languageList><iso639Id>ben</iso639Id></languageList>
+ <languageList>
+ <iso639Id>ben</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
<configItem>
<name>ben_bornona</name>
<_description>Bangla (India, Bornona)</_description>
- <languageList><iso639Id>ben</iso639Id></languageList>
- </configItem>
+ <languageList>
+ <iso639Id>ben</iso639Id>
+ </languageList>
+ </configItem>
</variant>
<variant>
<configItem>
<name>ben_gitanjali</name>
<_description>Bangla (India, Uni Gitanjali)</_description>
- <languageList><iso639Id>ben</iso639Id></languageList>
+ <languageList>
+ <iso639Id>ben</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
<configItem>
<name>ben_inscript</name>
<_description>Bangla (India, Baishakhi Inscript)</_description>
- <languageList><iso639Id>ben</iso639Id></languageList>
+ <languageList>
+ <iso639Id>ben</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
<configItem>
<name>eeyek</name>
<_description>Manipuri (Eeyek)</_description>
- <languageList><iso639Id>mni</iso639Id></languageList>
+ <languageList>
+ <iso639Id>mni</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -1933,7 +1949,9 @@
<!-- Keyboard indicator for Malayalam layouts -->
<_shortDescription>ml</_shortDescription>
<_description>Malayalam (enhanced Inscript, with rupee sign)</_description>
- <languageList><iso639Id>mal</iso639Id></languageList>
+ <languageList>
+ <iso639Id>mal</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -2326,14 +2344,18 @@
<!-- Keyboard indicator for Cameroon layouts -->
<_shortDescription>cm</_shortDescription>
<_description>English (Cameroon)</_description>
- <languageList><iso639Id>eng</iso639Id></languageList>
+ <languageList>
+ <iso639Id>eng</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
<configItem>
<name>french</name>
<_description>French (Cameroon)</_description>
- <languageList><iso639Id>fra</iso639Id></languageList>
+ <languageList>
+ <iso639Id>fra</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -2817,8 +2839,10 @@
<!-- Keyboard indicator for Iraqi layouts -->
<_shortDescription>ar</_shortDescription>
<_description>Iraqi</_description>
- <languageList><iso639Id>ara</iso639Id>
- <iso639Id>kur</iso639Id></languageList>
+ <languageList>
+ <iso639Id>ara</iso639Id>
+ <iso639Id>kur</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -2919,7 +2943,9 @@
<configItem>
<name>smi</name>
<_description>Northern Saami (Finland)</_description>
- <languageList><iso639Id>sme</iso639Id></languageList>
+ <languageList>
+ <iso639Id>sme</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -3232,14 +3258,18 @@
<configItem>
<name>ro</name>
<_description>Romanian (Germany)</_description>
- <languageList><iso639Id>rum</iso639Id></languageList>
+ <languageList>
+ <iso639Id>rum</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
<configItem>
<name>ro_nodeadkeys</name>
<_description>Romanian (Germany, eliminate dead keys)</_description>
- <languageList><iso639Id>rum</iso639Id></languageList>
+ <languageList>
+ <iso639Id>rum</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -3705,16 +3735,20 @@
<!-- Keyboard indicator for Russian layouts -->
<_shortDescription>ru</_shortDescription>
<_description>Russian (Kazakhstan, with Kazakh)</_description>
- <languageList><iso639Id>kaz</iso639Id>
- <iso639Id>rus</iso639Id></languageList>
+ <languageList>
+ <iso639Id>kaz</iso639Id>
+ <iso639Id>rus</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
<configItem>
<name>kazrus</name>
<_description>Kazakh (with Russian)</_description>
- <languageList><iso639Id>kaz</iso639Id>
- <iso639Id>rus</iso639Id></languageList>
+ <languageList>
+ <iso639Id>kaz</iso639Id>
+ <iso639Id>rus</iso639Id>
+ </languageList>
</configItem>
</variant>
</variantList>
@@ -3734,7 +3768,8 @@
<configItem>
<name>stea</name>
<_description>Lao (STEA proposed standard layout)</_description>
- <languageList><iso639Id>lao</iso639Id>
+ <languageList>
+ <iso639Id>lao</iso639Id>
</languageList>
</configItem>
</variant>
@@ -4064,7 +4099,7 @@
<_description>Norwegian (Macintosh, eliminate dead keys)</_description>
</configItem>
</variant>
- <variant>
+ <variant>
<configItem>
<name>colemak</name>
<_description>Norwegian (Colemak)</_description>
@@ -4126,7 +4161,9 @@
<configItem>
<name>szl</name>
<_description>Silesian</_description>
- <languageList><iso639Id>szl</iso639Id></languageList>
+ <languageList>
+ <iso639Id>szl</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -4387,8 +4424,10 @@
<configItem>
<name>srp</name>
<_description>Serbian (Russia)</_description>
- <languageList><iso639Id>rus</iso639Id>
- <iso639Id>srp</iso639Id></languageList>
+ <languageList>
+ <iso639Id>rus</iso639Id>
+ <iso639Id>srp</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -4668,7 +4707,9 @@
<configItem>
<name>swl</name>
<_description>Swedish Sign Language</_description>
- <languageList><iso639Id>swl</iso639Id></languageList>
+ <languageList>
+ <iso639Id>swl</iso639Id>
+ </languageList>
</configItem>
</variant>
</variantList>
@@ -4679,8 +4720,10 @@
<!-- Keyboard indicator for German layouts -->
<_shortDescription>de</_shortDescription>
<_description>German (Switzerland)</_description>
- <languageList><iso639Id>ger</iso639Id>
- <iso639Id>gsw</iso639Id></languageList>
+ <languageList>
+ <iso639Id>ger</iso639Id>
+ <iso639Id>gsw</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -5578,33 +5621,37 @@
<!-- Keyboard indicator for Filipino layouts -->
<_shortDescription>ph</_shortDescription>
<_description>Filipino</_description>
- <languageList><iso639Id>eng</iso639Id>
- <iso639Id>bik</iso639Id>
- <iso639Id>ceb</iso639Id>
- <iso639Id>fil</iso639Id>
- <iso639Id>hil</iso639Id>
- <iso639Id>ilo</iso639Id>
- <iso639Id>pam</iso639Id>
- <iso639Id>pag</iso639Id>
- <iso639Id>phi</iso639Id>
- <iso639Id>tgl</iso639Id>
- <iso639Id>war</iso639Id></languageList>
+ <languageList>
+ <iso639Id>eng</iso639Id>
+ <iso639Id>bik</iso639Id>
+ <iso639Id>ceb</iso639Id>
+ <iso639Id>fil</iso639Id>
+ <iso639Id>hil</iso639Id>
+ <iso639Id>ilo</iso639Id>
+ <iso639Id>pam</iso639Id>
+ <iso639Id>pag</iso639Id>
+ <iso639Id>phi</iso639Id>
+ <iso639Id>tgl</iso639Id>
+ <iso639Id>war</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
<configItem>
<name>qwerty-bay</name>
<_description>Filipino (QWERTY Baybayin)</_description>
- <languageList><iso639Id>bik</iso639Id>
- <iso639Id>ceb</iso639Id>
- <iso639Id>fil</iso639Id>
- <iso639Id>hil</iso639Id>
- <iso639Id>ilo</iso639Id>
- <iso639Id>pam</iso639Id>
- <iso639Id>pag</iso639Id>
- <iso639Id>phi</iso639Id>
- <iso639Id>tgl</iso639Id>
- <iso639Id>war</iso639Id></languageList>
+ <languageList>
+ <iso639Id>bik</iso639Id>
+ <iso639Id>ceb</iso639Id>
+ <iso639Id>fil</iso639Id>
+ <iso639Id>hil</iso639Id>
+ <iso639Id>ilo</iso639Id>
+ <iso639Id>pam</iso639Id>
+ <iso639Id>pag</iso639Id>
+ <iso639Id>phi</iso639Id>
+ <iso639Id>tgl</iso639Id>
+ <iso639Id>war</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -5617,16 +5664,18 @@
<configItem>
<name>capewell-dvorak-bay</name>
<_description>Filipino (Capewell-Dvorak Baybayin)</_description>
- <languageList><iso639Id>bik</iso639Id>
- <iso639Id>ceb</iso639Id>
- <iso639Id>fil</iso639Id>
- <iso639Id>hil</iso639Id>
- <iso639Id>ilo</iso639Id>
- <iso639Id>pam</iso639Id>
- <iso639Id>pag</iso639Id>
- <iso639Id>phi</iso639Id>
- <iso639Id>tgl</iso639Id>
- <iso639Id>war</iso639Id></languageList>
+ <languageList>
+ <iso639Id>bik</iso639Id>
+ <iso639Id>ceb</iso639Id>
+ <iso639Id>fil</iso639Id>
+ <iso639Id>hil</iso639Id>
+ <iso639Id>ilo</iso639Id>
+ <iso639Id>pam</iso639Id>
+ <iso639Id>pag</iso639Id>
+ <iso639Id>phi</iso639Id>
+ <iso639Id>tgl</iso639Id>
+ <iso639Id>war</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -5639,16 +5688,18 @@
<configItem>
<name>capewell-qwerf2k6-bay</name>
<_description>Filipino (Capewell-QWERF 2006 Baybayin)</_description>
- <languageList><iso639Id>bik</iso639Id>
- <iso639Id>ceb</iso639Id>
- <iso639Id>fil</iso639Id>
- <iso639Id>hil</iso639Id>
- <iso639Id>ilo</iso639Id>
- <iso639Id>pam</iso639Id>
- <iso639Id>pag</iso639Id>
- <iso639Id>phi</iso639Id>
- <iso639Id>tgl</iso639Id>
- <iso639Id>war</iso639Id></languageList>
+ <languageList>
+ <iso639Id>bik</iso639Id>
+ <iso639Id>ceb</iso639Id>
+ <iso639Id>fil</iso639Id>
+ <iso639Id>hil</iso639Id>
+ <iso639Id>ilo</iso639Id>
+ <iso639Id>pam</iso639Id>
+ <iso639Id>pag</iso639Id>
+ <iso639Id>phi</iso639Id>
+ <iso639Id>tgl</iso639Id>
+ <iso639Id>war</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -5661,16 +5712,18 @@
<configItem>
<name>colemak-bay</name>
<_description>Filipino (Colemak Baybayin)</_description>
- <languageList><iso639Id>bik</iso639Id>
- <iso639Id>ceb</iso639Id>
- <iso639Id>fil</iso639Id>
- <iso639Id>hil</iso639Id>
- <iso639Id>ilo</iso639Id>
- <iso639Id>pam</iso639Id>
- <iso639Id>pag</iso639Id>
- <iso639Id>phi</iso639Id>
- <iso639Id>tgl</iso639Id>
- <iso639Id>war</iso639Id></languageList>
+ <languageList>
+ <iso639Id>bik</iso639Id>
+ <iso639Id>ceb</iso639Id>
+ <iso639Id>fil</iso639Id>
+ <iso639Id>hil</iso639Id>
+ <iso639Id>ilo</iso639Id>
+ <iso639Id>pam</iso639Id>
+ <iso639Id>pag</iso639Id>
+ <iso639Id>phi</iso639Id>
+ <iso639Id>tgl</iso639Id>
+ <iso639Id>war</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -5683,16 +5736,18 @@
<configItem>
<name>dvorak-bay</name>
<_description>Filipino (Dvorak Baybayin)</_description>
- <languageList><iso639Id>bik</iso639Id>
- <iso639Id>ceb</iso639Id>
- <iso639Id>fil</iso639Id>
- <iso639Id>hil</iso639Id>
- <iso639Id>ilo</iso639Id>
- <iso639Id>pam</iso639Id>
- <iso639Id>pag</iso639Id>
- <iso639Id>phi</iso639Id>
- <iso639Id>tgl</iso639Id>
- <iso639Id>war</iso639Id></languageList>
+ <languageList>
+ <iso639Id>bik</iso639Id>
+ <iso639Id>ceb</iso639Id>
+ <iso639Id>fil</iso639Id>
+ <iso639Id>hil</iso639Id>
+ <iso639Id>ilo</iso639Id>
+ <iso639Id>pam</iso639Id>
+ <iso639Id>pag</iso639Id>
+ <iso639Id>phi</iso639Id>
+ <iso639Id>tgl</iso639Id>
+ <iso639Id>war</iso639Id>
+ </languageList>
</configItem>
</variant>
</variantList>
@@ -5702,7 +5757,9 @@
<name>md</name>
<_shortDescription>md</_shortDescription>
<_description>Moldavian</_description>
- <languageList><iso639Id>rum</iso639Id></languageList>
+ <languageList>
+ <iso639Id>rum</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -5710,7 +5767,9 @@
<name>gag</name>
<_shortDescription>gag</_shortDescription>
<_description>Moldavian (Gagauz)</_description>
- <languageList><iso639Id>gag</iso639Id></languageList>
+ <languageList>
+ <iso639Id>gag</iso639Id>
+ </languageList>
</configItem>
</variant>
</variantList>
@@ -5848,7 +5907,7 @@
<name>grp:rctrl_rshift_toggle</name>
<_description>Right Ctrl+Right Shift</_description>
</configItem>
- </option>
+ </option>
<option>
<configItem>
<name>grp:ctrl_alt_toggle</name>
@@ -6263,7 +6322,7 @@
</option>
</group>
<group allowMultipleSelection="false">
- <!-- Caps Lock tweaks.
+ <!-- Caps Lock tweaks.
"Internal" capitalization means capitalization using some internal tables.
Otherwise "as Shift" - means using next group. -->
<configItem>
diff --git a/xorg-server/xkeyboard-config/symbols/altwin b/xorg-server/xkeyboard-config/symbols/altwin
index 239d4878c..76a289ad1 100644
--- a/xorg-server/xkeyboard-config/symbols/altwin
+++ b/xorg-server/xkeyboard-config/symbols/altwin
@@ -93,7 +93,7 @@ xkb_symbols "swap_alt_win" {
};
// Swap the left Alt and Win keys.
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "swap_lalt_lwin" {
key <LALT> { type[Group1] = "ONE_LEVEL",
symbols[Group1] = [ Super_L ] };
@@ -101,7 +101,7 @@ xkb_symbols "swap_lalt_lwin" {
};
// Swap the right Alt and Win keys.
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "swap_ralt_rwin" {
key <RALT> { type[Group1] = "ONE_LEVEL",
symbols[Group1] = [ Super_R ] };
diff --git a/xorg-server/xkeyboard-config/symbols/am b/xorg-server/xkeyboard-config/symbols/am
index dbe6e96d8..21ff1e872 100644
--- a/xorg-server/xkeyboard-config/symbols/am
+++ b/xorg-server/xkeyboard-config/symbols/am
@@ -63,8 +63,6 @@ xkb_symbols "basic" {
partial alphanumeric_keys
xkb_symbols "olpc" {
include "am(basic)"
- name[Group1]= "Armenian";
-
include "group(olpc)"
};
diff --git a/xorg-server/xkeyboard-config/symbols/apl b/xorg-server/xkeyboard-config/symbols/apl
index c60f11723..4d81ac295 100644
--- a/xorg-server/xkeyboard-config/symbols/apl
+++ b/xorg-server/xkeyboard-config/symbols/apl
@@ -62,9 +62,9 @@ xkb_symbols "basic" {
// ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃
// ┗━━━━━━━┻━━━━━━━┻━━━━━━━┹───────────────────────────────────┺━━━━━━━┻━━━━━━━┻━━━━━━━┛
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "common" {
- name[Group1]= "APL";
+ name[Group1]= "APL keyboard symbols";
key <AB01> { [ U2282 ] }; // Z: ⊂ -- Subset Of
key <AB02> { [ U2283 ] }; // X: ⊃ -- Superset Of
@@ -129,7 +129,7 @@ xkb_symbols "common" {
partial alphanumeric_keys
xkb_symbols "unified" {
- name[Group1]= "APL Keyboard Symbols: Unified Layout";
+ name[Group1]= "APL keyboard symbols (unified)";
include "apl(common)"
@@ -162,7 +162,7 @@ xkb_symbols "unified" {
partial alphanumeric_keys
xkb_symbols "sax" {
- name[Group1]= "APL Keyboard Symbols";
+ name[Group1]= "APL keyboard symbols (sax)";
include "apl(unified)"
@@ -224,7 +224,7 @@ xkb_symbols "sax" {
partial alphanumeric_keys
xkb_symbols "apl2" {
- name[Group1]= "APL Keyboard Symbols: IBM APL2";
+ name[Group1]= "APL keyboard symbols (IBM APL2)";
include "apl(common)"
@@ -284,7 +284,7 @@ xkb_symbols "apl2" {
partial alphanumeric_keys
xkb_symbols "aplplusII" {
- name[Group1]= "APL Keyboard Symbols: Manugistics APL*PLUS II";
+ name[Group1]= "APL keyboard symbols (Manugistics APL*PLUS II)";
// AFS - short for APL Functional Symbol
include "apl(apl2)"
@@ -321,7 +321,7 @@ xkb_symbols "aplplusII" {
partial alphanumeric_keys
xkb_symbols "aplx" {
- name[Group1]= "APL Keyboard Symbols: APLX Unified APL Layout";
+ name[Group1]= "APL keyboard symbols (APLX unified)";
include "apl(unified)"
@@ -372,9 +372,8 @@ xkb_symbols "aplx" {
// the alphabet and similar. If this keyboard is placed as the 2nd layout then it can
// be reached with a latching shift to increase group by one.
-partial alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "dyalog_base" {
- name[Group1]="APL";
// ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┲━━━━━━━━━┓
@@ -445,9 +444,8 @@ xkb_symbols "dyalog_base" {
key <TLDE> { [ U22c4, currency] }; // diamond
};
-partial keypad_keys
+hidden partial keypad_keys
xkb_symbols "dyalog_box" {
- name[Group1]="Dyalog box";
// ┌───┬───┬───┬───┐
// │ │ │ │ │
@@ -473,10 +471,9 @@ xkb_symbols "dyalog_box" {
key <KP9> { [ U2510 ] }; // box drawing light down and left
key <KPDL> { [ U2502 ] }; // box drawing light vertical
-};
+};
-xkb_symbols "dyalog_codes" {
- name[Group1]="Dyalog Codes";
+hidden xkb_symbols "dyalog_codes" {
// Layout of private use area for this. In the style of the Unicode book
//
@@ -613,6 +610,6 @@ xkb_symbols "dyalog" {
include "apl(dyalog_base)"
include "apl(dyalog_box)"
include "apl(dyalog_codes)"
- name[Group1] = "Dyalog APL complete";
+ name[Group1] = "APL keyboard symbols (Dyalog)";
};
diff --git a/xorg-server/xkeyboard-config/symbols/ara b/xorg-server/xkeyboard-config/symbols/ara
index d048b0090..9c1d57e09 100644
--- a/xorg-server/xkeyboard-config/symbols/ara
+++ b/xorg-server/xkeyboard-config/symbols/ara
@@ -96,7 +96,6 @@ xkb_symbols "azerty" {
partial hidden alphanumeric_keys
xkb_symbols "digits_KP" {
- name[Group1]= "Arabic (digits_KP)";
// Use Arabic-script digits on the keypad.
@@ -120,7 +119,7 @@ xkb_symbols "digits" {
include "ara(basic)"
name[Group1]= "Arabic (digits)";
- // Use Arabic-script digits on the numberic row.
+ // Use Arabic-script digits on the numeric row.
key <AE01> { [ 0x1000661, exclam ] };
key <AE02> { [ 0x1000662, at ] };
diff --git a/xorg-server/xkeyboard-config/symbols/bg b/xorg-server/xkeyboard-config/symbols/bg
index f44b5c60d..1de6c3065 100644
--- a/xorg-server/xkeyboard-config/symbols/bg
+++ b/xorg-server/xkeyboard-config/symbols/bg
@@ -190,7 +190,7 @@ xkb_symbols "bas_phonetic" {
// This is an extended variant of the standard Latin QWERTY layout with
// additional symbols in levels 3 and 4.
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "latin" {
key <TLDE> {[ grave, asciitilde, U2248, U2245 ]};
diff --git a/xorg-server/xkeyboard-config/symbols/br b/xorg-server/xkeyboard-config/symbols/br
index 85f5f5522..f65d13aa1 100644
--- a/xorg-server/xkeyboard-config/symbols/br
+++ b/xorg-server/xkeyboard-config/symbols/br
@@ -64,7 +64,6 @@ partial alphanumeric_keys
xkb_symbols "thinkpad" {
include "br(abnt2)"
- name[Group1]="Portuguese (Brazil)";
key <RCTL> { [ slash, question, degree, questiondown ] };
};
diff --git a/xorg-server/xkeyboard-config/symbols/brai b/xorg-server/xkeyboard-config/symbols/brai
index 66364e60e..46bc2c6b6 100644
--- a/xorg-server/xkeyboard-config/symbols/brai
+++ b/xorg-server/xkeyboard-config/symbols/brai
@@ -48,7 +48,7 @@ xkb_symbols "right_hand" {
};
// 6-dot patterns on the keypad
-partial hidden keypad_keys
+hidden partial keypad_keys
xkb_symbols "keypad" {
key <KP4> { [ braille_dot_1 ] };
key <KP1> { [ braille_dot_2 ] };
diff --git a/xorg-server/xkeyboard-config/symbols/capslock b/xorg-server/xkeyboard-config/symbols/capslock
index 928d79a3e..3f4a0cd70 100644
--- a/xorg-server/xkeyboard-config/symbols/capslock
+++ b/xorg-server/xkeyboard-config/symbols/capslock
@@ -1,27 +1,27 @@
-default partial hidden modifier_keys
+default hidden partial modifier_keys
xkb_symbols "capslock" {
replace key <CAPS> { [ Caps_Lock ] };
modifier_map Lock { Caps_Lock };
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "shiftlock" {
replace key <CAPS> { [ Shift_Lock ] };
modifier_map Shift { Shift_Lock };
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "grouplock" {
replace key <CAPS> { [ ISO_Next_Group, Caps_Lock ] };
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "swapescape" {
key <CAPS> { [ Escape ] };
key <ESC> { [ Caps_Lock ] };
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "groupshift" {
key <CAPS> {
type[Group1] = "PC_ALT_LEVEL2",
@@ -29,41 +29,41 @@ xkb_symbols "groupshift" {
};
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "escape" {
key <CAPS> { [ Escape ] };
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "backspace" {
key <CAPS> { [ BackSpace ] };
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "super" {
key <CAPS> { [ Super_L ] };
modifier_map Mod4 { <CAPS> };
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "hyper" {
key <CAPS> { [ Hyper_L ] };
modifier_map Mod4 { <CAPS> };
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "none" {
key <CAPS> { [ VoidSymbol ] };
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "numlock" {
key <CAPS> { [ Num_Lock ] };
};
// This changes the <CAPS> key to become a Control modifier,
// but it will still produce the Caps_Lock keysym.
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "ctrl_modifier" {
replace key <CAPS> {
type[Group1] = "ONE_LEVEL",
diff --git a/xorg-server/xkeyboard-config/symbols/epo b/xorg-server/xkeyboard-config/symbols/epo
index 1f7f3fc7c..1d4000948 100644
--- a/xorg-server/xkeyboard-config/symbols/epo
+++ b/xorg-server/xkeyboard-config/symbols/epo
@@ -10,9 +10,8 @@
default partial alphanumeric_keys
xkb_symbols "basic" {
- name[Group1]= "Esperanto";
-
include "us(basic)"
+ name[Group1]= "Esperanto";
key.type[Group1] = "FOUR_LEVEL_ALPHABETIC";
diff --git a/xorg-server/xkeyboard-config/symbols/fi b/xorg-server/xkeyboard-config/symbols/fi
index 1bf9ff074..6afed2106 100644
--- a/xorg-server/xkeyboard-config/symbols/fi
+++ b/xorg-server/xkeyboard-config/symbols/fi
@@ -98,7 +98,7 @@ xkb_symbols "classic" {
name[Group1]="Finnish (classic)";
};
-partial alphanumeric_keys hidden
+hidden partial alphanumeric_keys
xkb_symbols "fi" {
// Classic Finnish keyboard layout with dead keys
diff --git a/xorg-server/xkeyboard-config/symbols/group b/xorg-server/xkeyboard-config/symbols/group
index 91be4863f..8b00dff6e 100644
--- a/xorg-server/xkeyboard-config/symbols/group
+++ b/xorg-server/xkeyboard-config/symbols/group
@@ -410,7 +410,7 @@ xkb_symbols "alt_caps_toggle" {
};
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "olpc" {
key <I219> { [ ISO_Next_Group, ISO_Prev_Group ] };
};
diff --git a/xorg-server/xkeyboard-config/symbols/inet b/xorg-server/xkeyboard-config/symbols/inet
index 613488f05..33b058397 100644
--- a/xorg-server/xkeyboard-config/symbols/inet
+++ b/xorg-server/xkeyboard-config/symbols/inet
@@ -14,7 +14,7 @@
// setxkbmap 'my_kb_layout' -variant 'my_kb_variant' -model 'my_eak_type'
// Very common set of media keys.
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "media_common" {
key <I01> { [ XF86AudioMedia ] };
key <I10> { [ XF86AudioPrev ] };
@@ -29,7 +29,7 @@ xkb_symbols "media_common" {
};
// Popular web navigation keys.
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "nav_common" {
key <I21> { [ XF86Calculator ] };
key <I32> { [ XF86WWW ] };
@@ -45,7 +45,7 @@ xkb_symbols "nav_common" {
};
// ACPI Standard
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "acpi_common" {
key <I5E> { [ XF86PowerOff ] };
key <I5F> { [ XF86Standby ] };
@@ -56,26 +56,26 @@ xkb_symbols "acpi_common" {
};
// Combined sections, for simplicity.
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "media_nav_common" {
include "inet(media_common)"
include "inet(nav_common)"
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "media_nav_acpi_common" {
include "inet(media_common)"
include "inet(nav_common)"
include "inet(acpi_common)"
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "nav_acpi_common" {
include "inet(nav_common)"
include "inet(acpi_common)"
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "media_acpi_common" {
include "inet(media_common)"
include "inet(acpi_common)"
@@ -1001,7 +1001,7 @@ xkb_symbols "ibm_spacesaver" {
// Logitech
// Logitech common definitions
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "logitech_base" {
include "inet(media_nav_acpi_common)"
key <I02> { [ XF86HomePage ] };
@@ -1017,7 +1017,7 @@ xkb_symbols "logitech_base" {
};
// Logitech second set of common keys
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "logitech_set3" {
key <I17> { [ XF86AudioStop ] };
key <I1E> { [ XF86AudioRaiseVolume ] };
diff --git a/xorg-server/xkeyboard-config/symbols/ir b/xorg-server/xkeyboard-config/symbols/ir
index 1be5e7a22..2305049a8 100644
--- a/xorg-server/xkeyboard-config/symbols/ir
+++ b/xorg-server/xkeyboard-config/symbols/ir
@@ -29,13 +29,14 @@ xkb_symbols "pes_keypad" {
name[Group1]= "Persian (with Persian keypad)";
include "ir(pes_part_basic)"
+ include "ir(pes_part_ext)"
include "ir(pes_part_keypad)"
include "nbsp(zwnj2nb3nnb4)"
include "level3(ralt_switch)"
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "pes_part_basic" {
// Persian digits
@@ -93,23 +94,23 @@ xkb_symbols "pes_part_basic" {
key <BKSL> { [ backslash, bar, 0x1002010 ] };
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "pes_part_ext" {
// Persian and ASCII digits
- key <AE01> { [ 0x10006f1, exclam, grave, 1 ] };
- key <AE02> { [ 0x10006f2, 0x100066c, at, 2 ] };
- key <AE03> { [ 0x10006f3, 0x100066b, numbersign, 3 ] };
- key <AE04> { [ 0x10006f4, 0x100fdfc, dollar, 4 ] };
- key <AE05> { [ 0x10006f5, 0x100066a, percent, 5 ] };
- key <AE06> { [ 0x10006f6, multiply, asciicircum, 6 ] };
- key <AE07> { [ 0x10006f7, Arabic_comma, ampersand, 7 ] };
- key <AE08> { [ 0x10006f8, asterisk, enfilledcircbullet, 8 ] };
- key <AE09> { [ 0x10006f9, parenright, 0x100200e, 9 ] };
- key <AE10> { [ 0x10006f0, parenleft, 0x100200f, 0 ] };
+ key <AE01> { [ Farsi_1, exclam, grave, 1 ] };
+ key <AE02> { [ Farsi_2, 0x100066c, at, 2 ] };
+ key <AE03> { [ Farsi_3, 0x100066b, numbersign, 3 ] };
+ key <AE04> { [ Farsi_4, 0x100fdfc, dollar, 4 ] };
+ key <AE05> { [ Farsi_5, 0x100066a, percent, 5 ] };
+ key <AE06> { [ Farsi_6, multiply, asciicircum, 6 ] };
+ key <AE07> { [ Farsi_7, Arabic_comma, ampersand, 7 ] };
+ key <AE08> { [ Farsi_8, asterisk, enfilledcircbullet, 8 ] };
+ key <AE09> { [ Farsi_9, parenright, 0x100200e, 9 ] };
+ key <AE10> { [ Farsi_0, parenleft, 0x100200f, 0 ] };
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "pes_part_keypad" {
// Persian digits and Mathematical operators
@@ -121,19 +122,19 @@ xkb_symbols "pes_part_keypad" {
key <KPEN> { [ KP_Enter ] };
key <KPEQ> { [ equal ] };
- key <KP7> { [ KP_Home, 0x10006f7 ] };
- key <KP8> { [ KP_Up, 0x10006f8 ] };
- key <KP9> { [ KP_Prior, 0x10006f9 ] };
+ key <KP7> { [ KP_Home, Farsi_7 ] };
+ key <KP8> { [ KP_Up, Farsi_8 ] };
+ key <KP9> { [ KP_Prior, Farsi_9 ] };
- key <KP4> { [ KP_Left, 0x10006f4 ] };
- key <KP5> { [ KP_Begin, 0x10006f5 ] };
- key <KP6> { [ KP_Right, 0x10006f6 ] };
+ key <KP4> { [ KP_Left, Farsi_4 ] };
+ key <KP5> { [ KP_Begin, Farsi_5 ] };
+ key <KP6> { [ KP_Right, Farsi_6 ] };
- key <KP1> { [ KP_End, 0x10006f1 ] };
- key <KP2> { [ KP_Down, 0x10006f2 ] };
- key <KP3> { [ KP_Next, 0x10006f3 ] };
+ key <KP1> { [ KP_End, Farsi_1 ] };
+ key <KP2> { [ KP_Down, Farsi_2 ] };
+ key <KP3> { [ KP_Next, Farsi_3 ] };
- key <KP0> { [ KP_Insert, 0x10006f0 ] };
+ key <KP0> { [ KP_Insert, Farsi_0 ] };
key <KPDL> { [ KP_Delete, 0x100066b ] };
};
@@ -184,16 +185,16 @@ xkb_symbols "ku_ara" {
key <BKSL> { [ backslash, bar, ccedilla, Ccedilla ] };
// Digits
- key <AE01> { [ 1, exclam, 0x10006f1, grave ] };
- key <AE02> { [ 2, at, 0x10006f2, at ] };
- key <AE03> { [ 3, numbersign, 0x10006f3, 0x100066b ] };
- key <AE04> { [ 4, dollar, 0x10006f4, 0x100fdfc ] };
- key <AE05> { [ 5, percent, 0x10006f5, 0x100066a ] };
- key <AE06> { [ 6, asciicircum, 0x10006f6, multiply ] };
- key <AE07> { [ 7, ampersand, 0x10006f7, Arabic_comma ] };
- key <AE08> { [ 8, asterisk, 0x10006f8, enfilledcircbullet ] };
- key <AE09> { [ 9, parenright, 0x10006f9, 0x100200e ] };
- key <AE10> { [ 0, parenleft, 0x10006f0, 0x100200f ] };
+ key <AE01> { [ 1, exclam, Farsi_1, grave ] };
+ key <AE02> { [ 2, at, Farsi_2, at ] };
+ key <AE03> { [ 3, numbersign, Farsi_3, 0x100066b ] };
+ key <AE04> { [ 4, dollar, Farsi_4, 0x100fdfc ] };
+ key <AE05> { [ 5, percent, Farsi_5, 0x100066a ] };
+ key <AE06> { [ 6, asciicircum, Farsi_6, multiply ] };
+ key <AE07> { [ 7, ampersand, Farsi_7, Arabic_comma ] };
+ key <AE08> { [ 8, asterisk, Farsi_8, enfilledcircbullet ] };
+ key <AE09> { [ 9, parenright, Farsi_9, 0x100200e ] };
+ key <AE10> { [ 0, parenleft, Farsi_0, 0x100200f ] };
key <AE11> { [ minus, Arabic_tatweel, underscore ] };
key <AE12> { [ equal, plus, 0x1002212 ] };
diff --git a/xorg-server/xkeyboard-config/symbols/jp b/xorg-server/xkeyboard-config/symbols/jp
index 26dfdf9bd..3d2d03bff 100644
--- a/xorg-server/xkeyboard-config/symbols/jp
+++ b/xorg-server/xkeyboard-config/symbols/jp
@@ -10,7 +10,7 @@ xkb_symbols "106" {
key <AE13> { [ backslash, bar ] };
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "common" {
// "Common" keys for jp 106/109A layouts.
diff --git a/xorg-server/xkeyboard-config/symbols/keypad b/xorg-server/xkeyboard-config/symbols/keypad
index 0187ecbeb..1efc02b48 100644
--- a/xorg-server/xkeyboard-config/symbols/keypad
+++ b/xorg-server/xkeyboard-config/symbols/keypad
@@ -1,9 +1,9 @@
-partial hidden keypad_keys
+hidden partial keypad_keys
xkb_symbols "overlay" {
include "keypad(overlay1)"
};
-partial hidden keypad_keys
+hidden partial keypad_keys
xkb_symbols "overlay1" {
key <KP7> { [ KP_Home ], overlay1=<KO7> };
@@ -37,7 +37,7 @@ xkb_symbols "overlay1" {
key <KODL> { [ KP_Decimal ] };
};
-partial hidden keypad_keys
+hidden partial keypad_keys
xkb_symbols "overlay2" {
key <KP7> { [ KP_Home ], overlay2=<KO7> };
@@ -71,7 +71,7 @@ xkb_symbols "overlay2" {
key <KODL> { [ KP_Decimal ] };
};
-partial hidden keypad_keys
+hidden partial keypad_keys
xkb_symbols "operators" {
// Puts some commands to control the X server on
// the fifth level of the keypad's operator keys.
@@ -93,7 +93,7 @@ xkb_symbols "operators" {
};
};
-default partial hidden keypad_keys
+default hidden partial keypad_keys
xkb_symbols "x11" {
include "keypad(operators)"
diff --git a/xorg-server/xkeyboard-config/symbols/kr b/xorg-server/xkeyboard-config/symbols/kr
index 84c0effca..1ee560bf8 100644
--- a/xorg-server/xkeyboard-config/symbols/kr
+++ b/xorg-server/xkeyboard-config/symbols/kr
@@ -13,13 +13,13 @@ xkb_symbols "kr104" {
include "kr(koreankeys_raltctl)"
};
-partial hidden function_keys
+hidden partial function_keys
xkb_symbols "koreankeys" {
key <K71> { [ Hangul ] };
key <K72> { [ Hangul_Hanja ] };
};
-partial hidden function_keys
+hidden partial function_keys
xkb_symbols "koreankeys_raltctl" {
key <RALT> { [ Hangul ] };
key <RCTL> { [ Hangul_Hanja ] };
diff --git a/xorg-server/xkeyboard-config/symbols/kz b/xorg-server/xkeyboard-config/symbols/kz
index 4f807d182..db118a0d2 100644
--- a/xorg-server/xkeyboard-config/symbols/kz
+++ b/xorg-server/xkeyboard-config/symbols/kz
@@ -204,8 +204,6 @@ xkb_symbols "olpc" {
include "kz(basic)"
- name[Group1] = "Kazakh";
-
key <TLDE> { [ parenleft, parenright ] };
key <BKSL> { [ Cyrillic_io, Cyrillic_IO ] };
diff --git a/xorg-server/xkeyboard-config/symbols/level3 b/xorg-server/xkeyboard-config/symbols/level3
index b15e24d53..1aef97056 100644
--- a/xorg-server/xkeyboard-config/symbols/level3
+++ b/xorg-server/xkeyboard-config/symbols/level3
@@ -53,7 +53,7 @@ xkb_symbols "ralt_switch_multikey" {
};
// A special case of the right-Alt switch -- for use with grp:alts_toggle.
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "ralt_switch_for_alts_toggle" {
virtual_modifiers LAlt, AltGr;
key <LALT> {
diff --git a/xorg-server/xkeyboard-config/symbols/pc b/xorg-server/xkeyboard-config/symbols/pc
index 996324d2c..019971323 100644
--- a/xorg-server/xkeyboard-config/symbols/pc
+++ b/xorg-server/xkeyboard-config/symbols/pc
@@ -62,7 +62,7 @@ xkb_symbols "pc105" {
key <KIUP> { [ XF86KbdBrightnessUp ] };
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "editing" {
key <PRSC> {
type= "PC_ALT_LEVEL2",
diff --git a/xorg-server/xkeyboard-config/symbols/rs b/xorg-server/xkeyboard-config/symbols/rs
index c39f4ed49..e164f2eee 100644
--- a/xorg-server/xkeyboard-config/symbols/rs
+++ b/xorg-server/xkeyboard-config/symbols/rs
@@ -45,7 +45,7 @@ xkb_symbols "yz" {
key <AB01> { [ Cyrillic_ze, Cyrillic_ZE, any, any ] }; // z
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "common" {
// "Common" keys: keys that are the same
// for both latin and cyrillic keyboards.
@@ -73,7 +73,7 @@ xkb_symbols "common" {
include "kpdl(comma)"
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "cyralpha" {
key.type[Group1] = "FOUR_LEVEL_ALPHABETIC";
@@ -114,7 +114,7 @@ xkb_symbols "cyralpha" {
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "latalpha" {
key.type[Group1] = "FOUR_LEVEL_ALPHABETIC";
@@ -127,7 +127,7 @@ xkb_symbols "latalpha" {
key <BKSL> { [ zcaron, Zcaron, any, any ] }; // \ |
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "twoletter" {
// Letters which are written in latin transcription with two characters.
@@ -142,7 +142,7 @@ xkb_symbols "twoletter" {
key <AB01> { [ zcaron, Zcaron, any, any ] }; // z
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "latlevel3" {
key <TLDE> { [ any, any, notsign, notsign ] }; // ` ~
key <AE01> { [ any, any, dead_tilde, asciitilde ] }; // 1 !
@@ -196,7 +196,7 @@ xkb_symbols "latlevel3" {
key <AB10> { [ any, any, emdash, endash ] }; // / ?
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "cyrlevel3" {
key <TLDE> { [ any, any, degree, notsign ] }; // ` ~
key <AE03> { [ any, any, dead_circumflex, NoSymbol ] }; // 3 #
diff --git a/xorg-server/xkeyboard-config/symbols/ru b/xorg-server/xkeyboard-config/symbols/ru
index 64c862b26..c4f48186f 100644
--- a/xorg-server/xkeyboard-config/symbols/ru
+++ b/xorg-server/xkeyboard-config/symbols/ru
@@ -21,7 +21,7 @@ xkb_symbols "winkeys" {
key <BKSL> { [ backslash, slash ] };
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "common" {
key <AE01> { [ 1, exclam ] };