aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-03-10 12:57:09 +0000
committermarha <marha@users.sourceforge.net>2011-03-10 12:57:09 +0000
commitae312a8a8042b4b23ffc652acf3b5cad1b3f07ca (patch)
treef54be422d872ddfcc3fa96dafe8c40288548ef22
parentb5f8cc93800ce69d2c984081471b05e650ba9ddd (diff)
parentf81bb3160c5f39d8f7ad329e99865af88f02b96a (diff)
downloadvcxsrv-ae312a8a8042b4b23ffc652acf3b5cad1b3f07ca.tar.gz
vcxsrv-ae312a8a8042b4b23ffc652acf3b5cad1b3f07ca.tar.bz2
vcxsrv-ae312a8a8042b4b23ffc652acf3b5cad1b3f07ca.zip
svn merge ^/branches/released .
-rw-r--r--include/xcb/xcb_windefs.h2
-rw-r--r--mesalib/common.py2
-rw-r--r--mesalib/docs/GL3.txt2
-rw-r--r--mesalib/src/glsl/ir_validate.cpp33
-rw-r--r--mesalib/src/glsl/link_functions.cpp8
-rw-r--r--mesalib/src/glsl/opt_function_inlining.cpp847
-rw-r--r--mesalib/src/mesa/SConscript1
-rw-r--r--mesalib/src/mesa/main/extensions.c4
-rw-r--r--mesalib/src/mesa/main/formats.c40
-rw-r--r--mesalib/src/mesa/main/formats.h8
-rw-r--r--mesalib/src/mesa/main/glheader.h4
-rw-r--r--mesalib/src/mesa/main/image.c12
-rw-r--r--mesalib/src/mesa/main/mipmap.c9
-rw-r--r--mesalib/src/mesa/main/mtypes.h2
-rw-r--r--mesalib/src/mesa/main/texcompress.c19
-rw-r--r--mesalib/src/mesa/main/texcompress_rgtc.c68
-rw-r--r--mesalib/src/mesa/main/texcompress_rgtc.h137
-rw-r--r--mesalib/src/mesa/main/texfetch.c28
-rw-r--r--mesalib/src/mesa/main/texformat.c29
-rw-r--r--mesalib/src/mesa/main/teximage.c22
-rw-r--r--mesalib/src/mesa/main/texstore.c9
-rw-r--r--mesalib/src/mesa/sources.mak1
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_flush.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_syncobj.c122
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_syncobj.h38
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_draw.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c25
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c54
-rw-r--r--mesalib/src/mesa/state_tracker/st_gen_mipmap.c10
-rw-r--r--mesalib/src/mesa/swrast/s_texfilter.c67
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_array.c13
-rw-r--r--xorg-server/Xext/panoramiX.c10
-rw-r--r--xorg-server/Xext/panoramiXsrv.h12
-rw-r--r--xorg-server/Xext/xvdix.h12
-rw-r--r--xorg-server/Xext/xvmain.c14
-rw-r--r--xorg-server/Xext/xvmc.c6
-rw-r--r--xorg-server/Xi/exglobals.h2
-rw-r--r--xorg-server/Xi/extinit.c2618
-rw-r--r--xorg-server/dix/Makefile.am1
-rw-r--r--xorg-server/dix/deprecated.c165
-rw-r--r--xorg-server/exa/exa.h1686
-rw-r--r--xorg-server/exa/exa_classic.c4
-rw-r--r--xorg-server/exa/exa_driver.c452
-rw-r--r--xorg-server/exa/exa_migration_mixed.c4
-rw-r--r--xorg-server/exa/exa_mixed.c4
-rw-r--r--xorg-server/exa/exa_priv.h6
-rw-r--r--xorg-server/fb/fb.h4
-rw-r--r--xorg-server/fb/fb24_32.c2
-rw-r--r--xorg-server/fb/fbpixmap.c10
-rw-r--r--xorg-server/glx/glapi.c122
-rw-r--r--xorg-server/glx/glthread.c84
-rw-r--r--xorg-server/glx/glthread.h111
-rw-r--r--xorg-server/hw/dmx/dmxpixmap.c5
-rw-r--r--xorg-server/hw/dmx/dmxpixmap.h2
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c4
-rw-r--r--xorg-server/hw/xfree86/common/xf86VGAarbiter.c4
-rw-r--r--xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h2
-rw-r--r--xorg-server/hw/xfree86/vbe/vbe.c2
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaInit.c10
-rw-r--r--xorg-server/hw/xnest/Pixmap.c5
-rw-r--r--xorg-server/hw/xnest/XNPixmap.h2
-rw-r--r--xorg-server/hw/xwin/win.h2930
-rw-r--r--xorg-server/hw/xwin/winpixmap.c7
-rw-r--r--xorg-server/include/dix.h31
-rw-r--r--xorg-server/include/misc.h2
-rw-r--r--xorg-server/include/pixmapstr.h167
-rw-r--r--xorg-server/include/resource.h29
-rw-r--r--xorg-server/include/scrnintstr.h2
-rw-r--r--xorg-server/render/render.c2
70 files changed, 5152 insertions, 5010 deletions
diff --git a/include/xcb/xcb_windefs.h b/include/xcb/xcb_windefs.h
index 6b5217de4..cba0af3f2 100644
--- a/include/xcb/xcb_windefs.h
+++ b/include/xcb/xcb_windefs.h
@@ -43,6 +43,6 @@ typedef unsigned int in_addr_t;
#define HANDLE void *
typedef int pid_t;
-#define STDERR_FILENO stderr
+#define STDERR_FILENO 2
#endif /* xcb_windefs.h */
diff --git a/mesalib/common.py b/mesalib/common.py
index 157873f66..089a4ee02 100644
--- a/mesalib/common.py
+++ b/mesalib/common.py
@@ -83,7 +83,7 @@ def AddOptions(opts):
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
opts.Add(EnumOption('platform', 'target platform', host_platform,
- allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince', 'darwin', 'embedded', 'cygwin', 'sunos5', 'freebsd8')))
+ allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince', 'darwin', 'embedded', 'cygwin', 'sunos', 'freebsd8')))
opts.Add('toolchain', 'compiler toolchain', default_toolchain)
opts.Add(BoolOption('gles', 'EXPERIMENTAL: enable OpenGL ES support', 'no'))
opts.Add(BoolOption('llvm', 'use LLVM', default_llvm))
diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt
index fc3c853d4..7c75a7101 100644
--- a/mesalib/docs/GL3.txt
+++ b/mesalib/docs/GL3.txt
@@ -39,6 +39,8 @@ glGetStringi command DONE
glTexParameterI, glGetTexParameterI commands DONE
glVertexAttribI commands DONE (but converts int
values to floats)
+Depth format cube textures 0% done
+
GL 3.1:
diff --git a/mesalib/src/glsl/ir_validate.cpp b/mesalib/src/glsl/ir_validate.cpp
index 4d9d4562c..fc1a34135 100644
--- a/mesalib/src/glsl/ir_validate.cpp
+++ b/mesalib/src/glsl/ir_validate.cpp
@@ -70,6 +70,7 @@ public:
virtual ir_visitor_status visit_leave(ir_swizzle *ir);
virtual ir_visitor_status visit_enter(ir_assignment *ir);
+ virtual ir_visitor_status visit_enter(ir_call *ir);
static void validate_ir(ir_instruction *ir, void *data);
@@ -173,6 +174,19 @@ ir_validate::visit_enter(ir_function *ir)
this->validate_ir(ir, this->data);
+ /* Verify that all of the things stored in the list of signatures are,
+ * in fact, function signatures.
+ */
+ foreach_list(node, &ir->signatures) {
+ ir_instruction *sig = (ir_instruction *) node;
+
+ if (sig->ir_type != ir_type_function_signature) {
+ printf("Non-signature in signature list of function `%s'\n",
+ ir->name);
+ abort();
+ }
+ }
+
return visit_continue;
}
@@ -198,6 +212,12 @@ ir_validate::visit_enter(ir_function_signature *ir)
abort();
}
+ if (ir->return_type == NULL) {
+ printf("Function signature %p for function %s has NULL return type.\n",
+ ir, ir->function_name());
+ abort();
+ }
+
this->validate_ir(ir, this->data);
return visit_continue;
@@ -488,6 +508,19 @@ ir_validate::visit_enter(ir_assignment *ir)
return visit_continue;
}
+ir_visitor_status
+ir_validate::visit_enter(ir_call *ir)
+{
+ ir_function_signature *const callee = ir->get_callee();
+
+ if (callee->ir_type != ir_type_function_signature) {
+ printf("IR called by ir_call is not ir_function_signature!\n");
+ abort();
+ }
+
+ return visit_continue;
+}
+
void
ir_validate::validate_ir(ir_instruction *ir, void *data)
{
diff --git a/mesalib/src/glsl/link_functions.cpp b/mesalib/src/glsl/link_functions.cpp
index bc8758438..76687b6be 100644
--- a/mesalib/src/glsl/link_functions.cpp
+++ b/mesalib/src/glsl/link_functions.cpp
@@ -99,9 +99,15 @@ public:
* details that may be missing.
*/
ir_function *f = linked->symbols->get_function(name);
- if (f == NULL)
+ if (f == NULL) {
f = new(linked) ir_function(name);
+ /* Add the new function to the linked IR.
+ */
+ linked->symbols->add_function(f);
+ linked->ir->push_head(f);
+ }
+
ir_function_signature *linked_sig =
f->exact_matching_signature(&callee->parameters);
if (linked_sig == NULL) {
diff --git a/mesalib/src/glsl/opt_function_inlining.cpp b/mesalib/src/glsl/opt_function_inlining.cpp
index 2e7831dcb..3cc405b95 100644
--- a/mesalib/src/glsl/opt_function_inlining.cpp
+++ b/mesalib/src/glsl/opt_function_inlining.cpp
@@ -1,425 +1,422 @@
-/*
- * Copyright © 2010 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 opt_function_inlining.cpp
- *
- * Replaces calls to functions with the body of the function.
- */
-
-#include <inttypes.h>
-#include "ir.h"
-#include "ir_visitor.h"
-#include "ir_function_inlining.h"
-#include "ir_expression_flattening.h"
-#include "glsl_types.h"
-#include "program/hash_table.h"
-
-static void
-do_sampler_replacement(exec_list *instructions,
- ir_variable *sampler,
- ir_dereference *deref);
-
-class ir_function_inlining_visitor : public ir_hierarchical_visitor {
-public:
- ir_function_inlining_visitor()
- {
- progress = false;
- }
-
- virtual ~ir_function_inlining_visitor()
- {
- /* empty */
- }
-
- virtual ir_visitor_status visit_enter(ir_expression *);
- virtual ir_visitor_status visit_enter(ir_call *);
- virtual ir_visitor_status visit_enter(ir_assignment *);
- virtual ir_visitor_status visit_enter(ir_return *);
- virtual ir_visitor_status visit_enter(ir_texture *);
- virtual ir_visitor_status visit_enter(ir_swizzle *);
-
- bool progress;
-};
-
-
-bool
-automatic_inlining_predicate(ir_instruction *ir)
-{
- ir_call *call = ir->as_call();
-
- if (call && can_inline(call))
- return true;
-
- return false;
-}
-
-bool
-do_function_inlining(exec_list *instructions)
-{
- ir_function_inlining_visitor v;
-
- do_expression_flattening(instructions, automatic_inlining_predicate);
-
- v.run(instructions);
-
- return v.progress;
-}
-
-static void
-replace_return_with_assignment(ir_instruction *ir, void *data)
-{
- void *ctx = ralloc_parent(ir);
- ir_variable *retval = (ir_variable *)data;
- ir_return *ret = ir->as_return();
-
- if (ret) {
- if (ret->value) {
- ir_rvalue *lhs = new(ctx) ir_dereference_variable(retval);
- ret->replace_with(new(ctx) ir_assignment(lhs, ret->value, NULL));
- } else {
- /* un-valued return has to be the last return, or we shouldn't
- * have reached here. (see can_inline()).
- */
- assert(ret->next->is_tail_sentinel());
- ret->remove();
- }
- }
-}
-
-ir_rvalue *
-ir_call::generate_inline(ir_instruction *next_ir)
-{
- void *ctx = ralloc_parent(this);
- ir_variable **parameters;
- int num_parameters;
- int i;
- ir_variable *retval = NULL;
- struct hash_table *ht;
-
- ht = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare);
-
- num_parameters = 0;
- foreach_iter(exec_list_iterator, iter_sig, this->callee->parameters)
- num_parameters++;
-
- parameters = new ir_variable *[num_parameters];
-
- /* Generate storage for the return value. */
- if (this->callee->return_type) {
- retval = new(ctx) ir_variable(this->callee->return_type, "_ret_val",
- ir_var_auto);
- next_ir->insert_before(retval);
- }
-
- /* Generate the declarations for the parameters to our inlined code,
- * and set up the mapping of real function body variables to ours.
- */
- i = 0;
- exec_list_iterator sig_param_iter = this->callee->parameters.iterator();
- exec_list_iterator param_iter = this->actual_parameters.iterator();
- for (i = 0; i < num_parameters; i++) {
- ir_variable *sig_param = (ir_variable *) sig_param_iter.get();
- ir_rvalue *param = (ir_rvalue *) param_iter.get();
-
- /* Generate a new variable for the parameter. */
- if (sig_param->type->base_type == GLSL_TYPE_SAMPLER) {
- /* For samplers, we want the inlined sampler references
- * referencing the passed in sampler variable, since that
- * will have the location information, which an assignment of
- * a sampler wouldn't. Fix it up below.
- */
- parameters[i] = NULL;
- } else {
- parameters[i] = sig_param->clone(ctx, ht);
- parameters[i]->mode = ir_var_auto;
-
- /* Remove the read-only decoration becuase we're going to write
- * directly to this variable. If the cloned variable is left
- * read-only and the inlined function is inside a loop, the loop
- * analysis code will get confused.
- */
- parameters[i]->read_only = false;
- next_ir->insert_before(parameters[i]);
- }
-
- /* Move the actual param into our param variable if it's an 'in' type. */
- if (parameters[i] && (sig_param->mode == ir_var_in ||
- sig_param->mode == ir_var_const_in ||
- sig_param->mode == ir_var_inout)) {
- ir_assignment *assign;
-
- assign = new(ctx) ir_assignment(new(ctx) ir_dereference_variable(parameters[i]),
- param, NULL);
- next_ir->insert_before(assign);
- }
-
- sig_param_iter.next();
- param_iter.next();
- }
-
- exec_list new_instructions;
-
- /* Generate the inlined body of the function to a new list */
- foreach_iter(exec_list_iterator, iter, callee->body) {
- ir_instruction *ir = (ir_instruction *)iter.get();
- ir_instruction *new_ir = ir->clone(ctx, ht);
-
- new_instructions.push_tail(new_ir);
- visit_tree(new_ir, replace_return_with_assignment, retval);
- }
-
- /* If any samplers were passed in, replace any deref of the sampler
- * with a deref of the sampler argument.
- */
- param_iter = this->actual_parameters.iterator();
- sig_param_iter = this->callee->parameters.iterator();
- for (i = 0; i < num_parameters; i++) {
- ir_instruction *const param = (ir_instruction *) param_iter.get();
- ir_variable *sig_param = (ir_variable *) sig_param_iter.get();
-
- if (sig_param->type->base_type == GLSL_TYPE_SAMPLER) {
- ir_dereference *deref = param->as_dereference();
-
- assert(deref);
- do_sampler_replacement(&new_instructions, sig_param, deref);
- }
- param_iter.next();
- sig_param_iter.next();
- }
-
- /* Now push those new instructions in. */
- foreach_iter(exec_list_iterator, iter, new_instructions) {
- ir_instruction *ir = (ir_instruction *)iter.get();
- next_ir->insert_before(ir);
- }
-
- /* Copy back the value of any 'out' parameters from the function body
- * variables to our own.
- */
- i = 0;
- param_iter = this->actual_parameters.iterator();
- sig_param_iter = this->callee->parameters.iterator();
- for (i = 0; i < num_parameters; i++) {
- ir_instruction *const param = (ir_instruction *) param_iter.get();
- const ir_variable *const sig_param = (ir_variable *) sig_param_iter.get();
-
- /* Move our param variable into the actual param if it's an 'out' type. */
- if (parameters[i] && (sig_param->mode == ir_var_out ||
- sig_param->mode == ir_var_inout)) {
- ir_assignment *assign;
-
- assign = new(ctx) ir_assignment(param->clone(ctx, NULL)->as_rvalue(),
- new(ctx) ir_dereference_variable(parameters[i]),
- NULL);
- next_ir->insert_before(assign);
- }
-
- param_iter.next();
- sig_param_iter.next();
- }
-
- delete [] parameters;
-
- hash_table_dtor(ht);
-
- if (retval)
- return new(ctx) ir_dereference_variable(retval);
- else
- return NULL;
-}
-
-
-ir_visitor_status
-ir_function_inlining_visitor::visit_enter(ir_expression *ir)
-{
- (void) ir;
- return visit_continue_with_parent;
-}
-
-
-ir_visitor_status
-ir_function_inlining_visitor::visit_enter(ir_return *ir)
-{
- (void) ir;
- return visit_continue_with_parent;
-}
-
-
-ir_visitor_status
-ir_function_inlining_visitor::visit_enter(ir_texture *ir)
-{
- (void) ir;
- return visit_continue_with_parent;
-}
-
-
-ir_visitor_status
-ir_function_inlining_visitor::visit_enter(ir_swizzle *ir)
-{
- (void) ir;
- return visit_continue_with_parent;
-}
-
-
-ir_visitor_status
-ir_function_inlining_visitor::visit_enter(ir_call *ir)
-{
- if (can_inline(ir)) {
- /* If the call was part of some tree, then it should have been
- * flattened out or we shouldn't have seen it because of a
- * visit_continue_with_parent in this visitor.
- */
- assert(ir == base_ir);
-
- (void) ir->generate_inline(ir);
- ir->remove();
- this->progress = true;
- }
-
- return visit_continue;
-}
-
-
-ir_visitor_status
-ir_function_inlining_visitor::visit_enter(ir_assignment *ir)
-{
- ir_call *call = ir->rhs->as_call();
- if (!call || !can_inline(call))
- return visit_continue;
-
- /* generates the parameter setup, function body, and returns the return
- * value of the function
- */
- ir_rvalue *rhs = call->generate_inline(ir);
- assert(rhs);
-
- ir->rhs = rhs;
- this->progress = true;
-
- return visit_continue;
-}
-
-/**
- * Replaces references to the "sampler" variable with a clone of "deref."
- *
- * From the spec, samplers can appear in the tree as function
- * (non-out) parameters and as the result of array indexing and
- * structure field selection. In our builtin implementation, they
- * also appear in the sampler field of an ir_tex instruction.
- */
-
-class ir_sampler_replacement_visitor : public ir_hierarchical_visitor {
-public:
- ir_sampler_replacement_visitor(ir_variable *sampler, ir_dereference *deref)
- {
- this->sampler = sampler;
- this->deref = deref;
- }
-
- virtual ~ir_sampler_replacement_visitor()
- {
- }
-
- virtual ir_visitor_status visit_leave(ir_call *);
- virtual ir_visitor_status visit_leave(ir_dereference_array *);
- virtual ir_visitor_status visit_leave(ir_dereference_record *);
- virtual ir_visitor_status visit_leave(ir_texture *);
-
- void replace_deref(ir_dereference **deref);
- void replace_rvalue(ir_rvalue **rvalue);
-
- ir_variable *sampler;
- ir_dereference *deref;
-};
-
-void
-ir_sampler_replacement_visitor::replace_deref(ir_dereference **deref)
-{
- ir_dereference_variable *deref_var = (*deref)->as_dereference_variable();
- if (deref_var && deref_var->var == this->sampler) {
- *deref = this->deref->clone(ralloc_parent(*deref), NULL);
- }
-}
-
-void
-ir_sampler_replacement_visitor::replace_rvalue(ir_rvalue **rvalue)
-{
- if (!*rvalue)
- return;
-
- ir_dereference *deref = (*rvalue)->as_dereference();
-
- if (!deref)
- return;
-
- replace_deref(&deref);
- *rvalue = deref;
-}
-
-ir_visitor_status
-ir_sampler_replacement_visitor::visit_leave(ir_texture *ir)
-{
- replace_deref(&ir->sampler);
-
- return visit_continue;
-}
-
-ir_visitor_status
-ir_sampler_replacement_visitor::visit_leave(ir_dereference_array *ir)
-{
- replace_rvalue(&ir->array);
- return visit_continue;
-}
-
-ir_visitor_status
-ir_sampler_replacement_visitor::visit_leave(ir_dereference_record *ir)
-{
- replace_rvalue(&ir->record);
- return visit_continue;
-}
-
-ir_visitor_status
-ir_sampler_replacement_visitor::visit_leave(ir_call *ir)
-{
- foreach_iter(exec_list_iterator, iter, *ir) {
- ir_rvalue *param = (ir_rvalue *)iter.get();
- ir_rvalue *new_param = param;
- replace_rvalue(&new_param);
-
- if (new_param != param) {
- param->replace_with(new_param);
- }
- }
- return visit_continue;
-}
-
-static void
-do_sampler_replacement(exec_list *instructions,
- ir_variable *sampler,
- ir_dereference *deref)
-{
- ir_sampler_replacement_visitor v(sampler, deref);
-
- visit_list_elements(&v, instructions);
-}
+/*
+ * Copyright © 2010 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 opt_function_inlining.cpp
+ *
+ * Replaces calls to functions with the body of the function.
+ */
+
+#include <inttypes.h>
+#include "ir.h"
+#include "ir_visitor.h"
+#include "ir_function_inlining.h"
+#include "ir_expression_flattening.h"
+#include "glsl_types.h"
+#include "program/hash_table.h"
+
+static void
+do_sampler_replacement(exec_list *instructions,
+ ir_variable *sampler,
+ ir_dereference *deref);
+
+class ir_function_inlining_visitor : public ir_hierarchical_visitor {
+public:
+ ir_function_inlining_visitor()
+ {
+ progress = false;
+ }
+
+ virtual ~ir_function_inlining_visitor()
+ {
+ /* empty */
+ }
+
+ virtual ir_visitor_status visit_enter(ir_expression *);
+ virtual ir_visitor_status visit_enter(ir_call *);
+ virtual ir_visitor_status visit_enter(ir_assignment *);
+ virtual ir_visitor_status visit_enter(ir_return *);
+ virtual ir_visitor_status visit_enter(ir_texture *);
+ virtual ir_visitor_status visit_enter(ir_swizzle *);
+
+ bool progress;
+};
+
+
+bool
+automatic_inlining_predicate(ir_instruction *ir)
+{
+ ir_call *call = ir->as_call();
+
+ if (call && can_inline(call))
+ return true;
+
+ return false;
+}
+
+bool
+do_function_inlining(exec_list *instructions)
+{
+ ir_function_inlining_visitor v;
+
+ do_expression_flattening(instructions, automatic_inlining_predicate);
+
+ v.run(instructions);
+
+ return v.progress;
+}
+
+static void
+replace_return_with_assignment(ir_instruction *ir, void *data)
+{
+ void *ctx = ralloc_parent(ir);
+ ir_variable *retval = (ir_variable *)data;
+ ir_return *ret = ir->as_return();
+
+ if (ret) {
+ if (ret->value) {
+ ir_rvalue *lhs = new(ctx) ir_dereference_variable(retval);
+ ret->replace_with(new(ctx) ir_assignment(lhs, ret->value, NULL));
+ } else {
+ /* un-valued return has to be the last return, or we shouldn't
+ * have reached here. (see can_inline()).
+ */
+ assert(ret->next->is_tail_sentinel());
+ ret->remove();
+ }
+ }
+}
+
+ir_rvalue *
+ir_call::generate_inline(ir_instruction *next_ir)
+{
+ void *ctx = ralloc_parent(this);
+ ir_variable **parameters;
+ int num_parameters;
+ int i;
+ ir_variable *retval = NULL;
+ struct hash_table *ht;
+
+ ht = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare);
+
+ num_parameters = 0;
+ foreach_iter(exec_list_iterator, iter_sig, this->callee->parameters)
+ num_parameters++;
+
+ parameters = new ir_variable *[num_parameters];
+
+ /* Generate storage for the return value. */
+ if (!this->callee->return_type->is_void()) {
+ retval = new(ctx) ir_variable(this->callee->return_type, "_ret_val",
+ ir_var_auto);
+ next_ir->insert_before(retval);
+ }
+
+ /* Generate the declarations for the parameters to our inlined code,
+ * and set up the mapping of real function body variables to ours.
+ */
+ i = 0;
+ exec_list_iterator sig_param_iter = this->callee->parameters.iterator();
+ exec_list_iterator param_iter = this->actual_parameters.iterator();
+ for (i = 0; i < num_parameters; i++) {
+ ir_variable *sig_param = (ir_variable *) sig_param_iter.get();
+ ir_rvalue *param = (ir_rvalue *) param_iter.get();
+
+ /* Generate a new variable for the parameter. */
+ if (sig_param->type->base_type == GLSL_TYPE_SAMPLER) {
+ /* For samplers, we want the inlined sampler references
+ * referencing the passed in sampler variable, since that
+ * will have the location information, which an assignment of
+ * a sampler wouldn't. Fix it up below.
+ */
+ parameters[i] = NULL;
+ } else {
+ parameters[i] = sig_param->clone(ctx, ht);
+ parameters[i]->mode = ir_var_auto;
+
+ /* Remove the read-only decoration becuase we're going to write
+ * directly to this variable. If the cloned variable is left
+ * read-only and the inlined function is inside a loop, the loop
+ * analysis code will get confused.
+ */
+ parameters[i]->read_only = false;
+ next_ir->insert_before(parameters[i]);
+ }
+
+ /* Move the actual param into our param variable if it's an 'in' type. */
+ if (parameters[i] && (sig_param->mode == ir_var_in ||
+ sig_param->mode == ir_var_const_in ||
+ sig_param->mode == ir_var_inout)) {
+ ir_assignment *assign;
+
+ assign = new(ctx) ir_assignment(new(ctx) ir_dereference_variable(parameters[i]),
+ param, NULL);
+ next_ir->insert_before(assign);
+ }
+
+ sig_param_iter.next();
+ param_iter.next();
+ }
+
+ exec_list new_instructions;
+
+ /* Generate the inlined body of the function to a new list */
+ foreach_iter(exec_list_iterator, iter, callee->body) {
+ ir_instruction *ir = (ir_instruction *)iter.get();
+ ir_instruction *new_ir = ir->clone(ctx, ht);
+
+ new_instructions.push_tail(new_ir);
+ visit_tree(new_ir, replace_return_with_assignment, retval);
+ }
+
+ /* If any samplers were passed in, replace any deref of the sampler
+ * with a deref of the sampler argument.
+ */
+ param_iter = this->actual_parameters.iterator();
+ sig_param_iter = this->callee->parameters.iterator();
+ for (i = 0; i < num_parameters; i++) {
+ ir_instruction *const param = (ir_instruction *) param_iter.get();
+ ir_variable *sig_param = (ir_variable *) sig_param_iter.get();
+
+ if (sig_param->type->base_type == GLSL_TYPE_SAMPLER) {
+ ir_dereference *deref = param->as_dereference();
+
+ assert(deref);
+ do_sampler_replacement(&new_instructions, sig_param, deref);
+ }
+ param_iter.next();
+ sig_param_iter.next();
+ }
+
+ /* Now push those new instructions in. */
+ next_ir->insert_before(&new_instructions);
+
+ /* Copy back the value of any 'out' parameters from the function body
+ * variables to our own.
+ */
+ i = 0;
+ param_iter = this->actual_parameters.iterator();
+ sig_param_iter = this->callee->parameters.iterator();
+ for (i = 0; i < num_parameters; i++) {
+ ir_instruction *const param = (ir_instruction *) param_iter.get();
+ const ir_variable *const sig_param = (ir_variable *) sig_param_iter.get();
+
+ /* Move our param variable into the actual param if it's an 'out' type. */
+ if (parameters[i] && (sig_param->mode == ir_var_out ||
+ sig_param->mode == ir_var_inout)) {
+ ir_assignment *assign;
+
+ assign = new(ctx) ir_assignment(param->clone(ctx, NULL)->as_rvalue(),
+ new(ctx) ir_dereference_variable(parameters[i]),
+ NULL);
+ next_ir->insert_before(assign);
+ }
+
+ param_iter.next();
+ sig_param_iter.next();
+ }
+
+ delete [] parameters;
+
+ hash_table_dtor(ht);
+
+ if (retval)
+ return new(ctx) ir_dereference_variable(retval);
+ else
+ return NULL;
+}
+
+
+ir_visitor_status
+ir_function_inlining_visitor::visit_enter(ir_expression *ir)
+{
+ (void) ir;
+ return visit_continue_with_parent;
+}
+
+
+ir_visitor_status
+ir_function_inlining_visitor::visit_enter(ir_return *ir)
+{
+ (void) ir;
+ return visit_continue_with_parent;
+}
+
+
+ir_visitor_status
+ir_function_inlining_visitor::visit_enter(ir_texture *ir)
+{
+ (void) ir;
+ return visit_continue_with_parent;
+}
+
+
+ir_visitor_status
+ir_function_inlining_visitor::visit_enter(ir_swizzle *ir)
+{
+ (void) ir;
+ return visit_continue_with_parent;
+}
+
+
+ir_visitor_status
+ir_function_inlining_visitor::visit_enter(ir_call *ir)
+{
+ if (can_inline(ir)) {
+ /* If the call was part of some tree, then it should have been
+ * flattened out or we shouldn't have seen it because of a
+ * visit_continue_with_parent in this visitor.
+ */
+ assert(ir == base_ir);
+
+ (void) ir->generate_inline(ir);
+ ir->remove();
+ this->progress = true;
+ }
+
+ return visit_continue;
+}
+
+
+ir_visitor_status
+ir_function_inlining_visitor::visit_enter(ir_assignment *ir)
+{
+ ir_call *call = ir->rhs->as_call();
+ if (!call || !can_inline(call))
+ return visit_continue;
+
+ /* generates the parameter setup, function body, and returns the return
+ * value of the function
+ */
+ ir_rvalue *rhs = call->generate_inline(ir);
+ assert(rhs);
+
+ ir->rhs = rhs;
+ this->progress = true;
+
+ return visit_continue;
+}
+
+/**
+ * Replaces references to the "sampler" variable with a clone of "deref."
+ *
+ * From the spec, samplers can appear in the tree as function
+ * (non-out) parameters and as the result of array indexing and
+ * structure field selection. In our builtin implementation, they
+ * also appear in the sampler field of an ir_tex instruction.
+ */
+
+class ir_sampler_replacement_visitor : public ir_hierarchical_visitor {
+public:
+ ir_sampler_replacement_visitor(ir_variable *sampler, ir_dereference *deref)
+ {
+ this->sampler = sampler;
+ this->deref = deref;
+ }
+
+ virtual ~ir_sampler_replacement_visitor()
+ {
+ }
+
+ virtual ir_visitor_status visit_leave(ir_call *);
+ virtual ir_visitor_status visit_leave(ir_dereference_array *);
+ virtual ir_visitor_status visit_leave(ir_dereference_record *);
+ virtual ir_visitor_status visit_leave(ir_texture *);
+
+ void replace_deref(ir_dereference **deref);
+ void replace_rvalue(ir_rvalue **rvalue);
+
+ ir_variable *sampler;
+ ir_dereference *deref;
+};
+
+void
+ir_sampler_replacement_visitor::replace_deref(ir_dereference **deref)
+{
+ ir_dereference_variable *deref_var = (*deref)->as_dereference_variable();
+ if (deref_var && deref_var->var == this->sampler) {
+ *deref = this->deref->clone(ralloc_parent(*deref), NULL);
+ }
+}
+
+void
+ir_sampler_replacement_visitor::replace_rvalue(ir_rvalue **rvalue)
+{
+ if (!*rvalue)
+ return;
+
+ ir_dereference *deref = (*rvalue)->as_dereference();
+
+ if (!deref)
+ return;
+
+ replace_deref(&deref);
+ *rvalue = deref;
+}
+
+ir_visitor_status
+ir_sampler_replacement_visitor::visit_leave(ir_texture *ir)
+{
+ replace_deref(&ir->sampler);
+
+ return visit_continue;
+}
+
+ir_visitor_status
+ir_sampler_replacement_visitor::visit_leave(ir_dereference_array *ir)
+{
+ replace_rvalue(&ir->array);
+ return visit_continue;
+}
+
+ir_visitor_status
+ir_sampler_replacement_visitor::visit_leave(ir_dereference_record *ir)
+{
+ replace_rvalue(&ir->record);
+ return visit_continue;
+}
+
+ir_visitor_status
+ir_sampler_replacement_visitor::visit_leave(ir_call *ir)
+{
+ foreach_iter(exec_list_iterator, iter, *ir) {
+ ir_rvalue *param = (ir_rvalue *)iter.get();
+ ir_rvalue *new_param = param;
+ replace_rvalue(&new_param);
+
+ if (new_param != param) {
+ param->replace_with(new_param);
+ }
+ }
+ return visit_continue;
+}
+
+static void
+do_sampler_replacement(exec_list *instructions,
+ ir_variable *sampler,
+ ir_dereference *deref)
+{
+ ir_sampler_replacement_visitor v(sampler, deref);
+
+ visit_list_elements(&v, instructions);
+}
diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript
index dbd6ebe9d..410eacba7 100644
--- a/mesalib/src/mesa/SConscript
+++ b/mesalib/src/mesa/SConscript
@@ -197,6 +197,7 @@ statetracker_sources = [
'state_tracker/st_cb_queryobj.c',
'state_tracker/st_cb_rasterpos.c',
'state_tracker/st_cb_readpixels.c',
+ 'state_tracker/st_cb_syncobj.c',
'state_tracker/st_cb_strings.c',
'state_tracker/st_cb_texture.c',
'state_tracker/st_cb_viewport.c',
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index a4aa9847a..6de0ca696 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -181,6 +181,7 @@ static const struct extension extension_table[] = {
{ "GL_EXT_texture3D", o(EXT_texture3D), GL },
{ "GL_EXT_texture_array", o(EXT_texture_array), GL },
{ "GL_EXT_texture_compression_dxt1", o(EXT_texture_compression_s3tc), GL | ES1 | ES2 },
+ { "GL_EXT_texture_compression_latc", o(EXT_texture_compression_latc), GL },
{ "GL_EXT_texture_compression_rgtc", o(ARB_texture_compression_rgtc), GL },
{ "GL_EXT_texture_compression_s3tc", o(EXT_texture_compression_s3tc), GL },
{ "GL_EXT_texture_cube_map", o(ARB_texture_cube_map), GL },
@@ -258,6 +259,7 @@ static const struct extension extension_table[] = {
{ "GL_ATI_envmap_bumpmap", o(ATI_envmap_bumpmap), GL },
{ "GL_ATI_fragment_shader", o(ATI_fragment_shader), GL },
{ "GL_ATI_separate_stencil", o(ATI_separate_stencil), GL },
+ { "GL_ATI_texture_compression_3dc", o(ATI_texture_compression_3dc), GL },
{ "GL_ATI_texture_env_combine3", o(ATI_texture_env_combine3), GL },
{ "GL_ATI_texture_mirror_once", o(ATI_texture_mirror_once), GL },
{ "GL_IBM_multimode_draw_arrays", o(IBM_multimode_draw_arrays), GL },
@@ -448,6 +450,7 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
#if FEATURE_ATI_fragment_shader
ctx->Extensions.ATI_fragment_shader = GL_TRUE;
#endif
+ ctx->Extensions.ATI_texture_compression_3dc = GL_TRUE;
ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE;
ctx->Extensions.ATI_texture_mirror_once = GL_TRUE;
ctx->Extensions.ATI_separate_stencil = GL_TRUE;
@@ -483,6 +486,7 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
ctx->Extensions.EXT_stencil_wrap = GL_TRUE;
ctx->Extensions.EXT_stencil_two_side = GL_TRUE;
ctx->Extensions.EXT_texture_array = GL_TRUE;
+ ctx->Extensions.EXT_texture_compression_latc = GL_TRUE;
ctx->Extensions.EXT_texture_env_add = GL_TRUE;
ctx->Extensions.EXT_texture_env_combine = GL_TRUE;
ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c
index 1d7bdad24..e2541bdf6 100644
--- a/mesalib/src/mesa/main/formats.c
+++ b/mesalib/src/mesa/main/formats.c
@@ -927,6 +927,42 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
0, 0, 0, 0, 0,
4, 4, 16 /* 16 bytes per 4x4 block */
},
+ {
+ MESA_FORMAT_L_LATC1,
+ "MESA_FORMAT_L_LATC1",
+ GL_LUMINANCE,
+ GL_UNSIGNED_NORMALIZED,
+ 0, 0, 0, 0,
+ 4, 0, 0, 0, 0,
+ 4, 4, 8 /* 8 bytes per 4x4 block */
+ },
+ {
+ MESA_FORMAT_SIGNED_L_LATC1,
+ "MESA_FORMAT_SIGNED_L_LATC1",
+ GL_LUMINANCE,
+ GL_SIGNED_NORMALIZED,
+ 0, 0, 0, 0,
+ 4, 0, 0, 0, 0,
+ 4, 4, 8 /* 8 bytes per 4x4 block */
+ },
+ {
+ MESA_FORMAT_LA_LATC2,
+ "MESA_FORMAT_LA_LATC2",
+ GL_LUMINANCE_ALPHA,
+ GL_UNSIGNED_NORMALIZED,
+ 0, 0, 0, 4,
+ 4, 0, 0, 0, 0,
+ 4, 4, 16 /* 16 bytes per 4x4 block */
+ },
+ {
+ MESA_FORMAT_SIGNED_LA_LATC2,
+ "MESA_FORMAT_SIGNED_LA_LATC2",
+ GL_LUMINANCE_ALPHA,
+ GL_SIGNED_NORMALIZED,
+ 0, 0, 0, 4,
+ 4, 0, 0, 0, 0,
+ 4, 4, 16 /* 16 bytes per 4x4 block */
+ },
};
@@ -1570,6 +1606,10 @@ _mesa_format_to_type_and_comps(gl_format format,
case MESA_FORMAT_SIGNED_RED_RGTC1:
case MESA_FORMAT_RG_RGTC2:
case MESA_FORMAT_SIGNED_RG_RGTC2:
+ case MESA_FORMAT_L_LATC1:
+ case MESA_FORMAT_SIGNED_L_LATC1:
+ case MESA_FORMAT_LA_LATC2:
+ case MESA_FORMAT_SIGNED_LA_LATC2:
/* XXX generate error instead? */
*datatype = GL_UNSIGNED_BYTE;
*comps = 0;
diff --git a/mesalib/src/mesa/main/formats.h b/mesalib/src/mesa/main/formats.h
index b32829145..81ba76ce0 100644
--- a/mesalib/src/mesa/main/formats.h
+++ b/mesalib/src/mesa/main/formats.h
@@ -185,6 +185,14 @@ typedef enum
MESA_FORMAT_RG_RGTC2,
MESA_FORMAT_SIGNED_RG_RGTC2,
/*@}*/
+
+ /*@{*/
+ MESA_FORMAT_L_LATC1,
+ MESA_FORMAT_SIGNED_L_LATC1,
+ MESA_FORMAT_LA_LATC2,
+ MESA_FORMAT_SIGNED_LA_LATC2,
+ /*@}*/
+
MESA_FORMAT_COUNT
} gl_format;
diff --git a/mesalib/src/mesa/main/glheader.h b/mesalib/src/mesa/main/glheader.h
index 5ca44deb0..dc78ccbf6 100644
--- a/mesalib/src/mesa/main/glheader.h
+++ b/mesalib/src/mesa/main/glheader.h
@@ -121,6 +121,10 @@ typedef void *GLeglImageOES;
#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
#endif
+#ifndef GL_ATI_texture_compression_3dc
+#define GL_ATI_texture_compression_3dc 1
+#define GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI 0x8837
+#endif
/**
diff --git a/mesalib/src/mesa/main/image.c b/mesalib/src/mesa/main/image.c
index 444f21ed5..466fc617a 100644
--- a/mesalib/src/mesa/main/image.c
+++ b/mesalib/src/mesa/main/image.c
@@ -743,6 +743,11 @@ _mesa_is_color_format(GLenum format)
case GL_COMPRESSED_SIGNED_RED_RGTC1:
case GL_COMPRESSED_RG_RGTC2:
case GL_COMPRESSED_SIGNED_RG_RGTC2:
+ case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
+ case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
+ case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
+ case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
+ case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
/* signed, normalized texture formats */
case GL_RGBA_SNORM:
case GL_RGBA8_SNORM:
@@ -1025,6 +1030,13 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format)
case GL_COMPRESSED_RG_RGTC2:
case GL_COMPRESSED_SIGNED_RG_RGTC2:
return ctx->Extensions.ARB_texture_compression_rgtc;
+ case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
+ case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
+ case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
+ case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
+ return ctx->Extensions.EXT_texture_compression_latc;
+ case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
+ return ctx->Extensions.ATI_texture_compression_3dc;
default:
return GL_FALSE;
}
diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c
index 453d7f29b..b12399ee6 100644
--- a/mesalib/src/mesa/main/mipmap.c
+++ b/mesalib/src/mesa/main/mipmap.c
@@ -1764,8 +1764,13 @@ _mesa_generate_mipmap(struct gl_context *ctx, GLenum target,
} else if (srcImage->_BaseFormat == GL_RGBA) {
convertFormat = MESA_FORMAT_RGBA8888;
components = 4;
- }
- else {
+ } else if (srcImage->_BaseFormat == GL_LUMINANCE) {
+ convertFormat = MESA_FORMAT_L8;
+ components = 1;
+ } else if (srcImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
+ convertFormat = MESA_FORMAT_AL88;
+ components = 2;
+ } else {
_mesa_problem(ctx, "bad srcImage->_BaseFormat in _mesa_generate_mipmaps");
return;
}
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 2862f88da..4e530a268 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2802,6 +2802,7 @@ struct gl_extensions
GLboolean EXT_texture_object;
GLboolean EXT_texture3D;
GLboolean EXT_texture_array;
+ GLboolean EXT_texture_compression_latc;
GLboolean EXT_texture_compression_s3tc;
GLboolean EXT_texture_env_add;
GLboolean EXT_texture_env_combine;
@@ -2827,6 +2828,7 @@ struct gl_extensions
GLboolean APPLE_vertex_array_object;
GLboolean APPLE_object_purgeable;
GLboolean ATI_envmap_bumpmap;
+ GLboolean ATI_texture_compression_3dc;
GLboolean ATI_texture_mirror_once;
GLboolean ATI_texture_env_combine3;
GLboolean ATI_fragment_shader;
diff --git a/mesalib/src/mesa/main/texcompress.c b/mesalib/src/mesa/main/texcompress.c
index 9891946df..59603e81e 100644
--- a/mesalib/src/mesa/main/texcompress.c
+++ b/mesalib/src/mesa/main/texcompress.c
@@ -173,6 +173,16 @@ _mesa_glenum_to_compressed_format(GLenum format)
case GL_COMPRESSED_SIGNED_RG_RGTC2:
return MESA_FORMAT_SIGNED_RG_RGTC2;
+ case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
+ return MESA_FORMAT_L_LATC1;
+ case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
+ return MESA_FORMAT_SIGNED_L_LATC1;
+ case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
+ case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
+ return MESA_FORMAT_LA_LATC2;
+ case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
+ return MESA_FORMAT_SIGNED_LA_LATC2;
+
default:
return MESA_FORMAT_NONE;
}
@@ -229,6 +239,15 @@ _mesa_compressed_format_to_glenum(struct gl_context *ctx, GLuint mesaFormat)
case MESA_FORMAT_SIGNED_RG_RGTC2:
return GL_COMPRESSED_SIGNED_RG_RGTC2;
+ case MESA_FORMAT_L_LATC1:
+ return GL_COMPRESSED_LUMINANCE_LATC1_EXT;
+ case MESA_FORMAT_SIGNED_L_LATC1:
+ return GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT;
+ case MESA_FORMAT_LA_LATC2:
+ return GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT;
+ case MESA_FORMAT_SIGNED_LA_LATC2:
+ return GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT;
+
default:
_mesa_problem(ctx, "Unexpected mesa texture format in"
" _mesa_compressed_format_to_glenum()");
diff --git a/mesalib/src/mesa/main/texcompress_rgtc.c b/mesalib/src/mesa/main/texcompress_rgtc.c
index b5dd56dce..60146d09b 100644
--- a/mesalib/src/mesa/main/texcompress_rgtc.c
+++ b/mesalib/src/mesa/main/texcompress_rgtc.c
@@ -98,7 +98,8 @@ _mesa_texstore_red_rgtc1(TEXSTORE_PARAMS)
GLubyte srcpixels[4][4];
GLubyte *blkaddr;
GLint dstRowDiff;
- ASSERT(dstFormat == MESA_FORMAT_RED_RGTC1);
+ ASSERT(dstFormat == MESA_FORMAT_RED_RGTC1 ||
+ dstFormat == MESA_FORMAT_L_LATC1);
ASSERT(dstXoffset % 4 == 0);
ASSERT(dstYoffset % 4 == 0);
ASSERT(dstZoffset % 4 == 0);
@@ -153,7 +154,8 @@ _mesa_texstore_signed_red_rgtc1(TEXSTORE_PARAMS)
GLbyte srcpixels[4][4];
GLbyte *blkaddr;
GLint dstRowDiff;
- ASSERT(dstFormat == MESA_FORMAT_SIGNED_RED_RGTC1);
+ ASSERT(dstFormat == MESA_FORMAT_SIGNED_RED_RGTC1 ||
+ dstFormat == MESA_FORMAT_SIGNED_L_LATC1);
ASSERT(dstXoffset % 4 == 0);
ASSERT(dstYoffset % 4 == 0);
ASSERT(dstZoffset % 4 == 0);
@@ -208,7 +210,8 @@ _mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS)
GLubyte *blkaddr;
GLint dstRowDiff;
- ASSERT(dstFormat == MESA_FORMAT_RG_RGTC2);
+ ASSERT(dstFormat == MESA_FORMAT_RG_RGTC2 ||
+ dstFormat == MESA_FORMAT_LA_LATC2);
ASSERT(dstXoffset % 4 == 0);
ASSERT(dstYoffset % 4 == 0);
ASSERT(dstZoffset % 4 == 0);
@@ -269,7 +272,8 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS)
GLbyte *blkaddr;
GLint dstRowDiff;
- ASSERT(dstFormat == MESA_FORMAT_SIGNED_RG_RGTC2);
+ ASSERT(dstFormat == MESA_FORMAT_SIGNED_RG_RGTC2 ||
+ dstFormat == MESA_FORMAT_SIGNED_LA_LATC2);
ASSERT(dstXoffset % 4 == 0);
ASSERT(dstYoffset % 4 == 0);
ASSERT(dstZoffset % 4 == 0);
@@ -374,6 +378,62 @@ _mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct gl_texture_image *texImage,
texel[ACOMP] = 1.0;
}
+void
+_mesa_fetch_texel_2d_f_l_latc1(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ GLubyte red;
+ unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data),
+ i, j, &red, 1);
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = UBYTE_TO_FLOAT(red);
+ texel[ACOMP] = 1.0;
+}
+
+void
+_mesa_fetch_texel_2d_f_signed_l_latc1(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ GLbyte red;
+ signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data),
+ i, j, &red, 1);
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = BYTE_TO_FLOAT_TEX(red);
+ texel[ACOMP] = 1.0;
+}
+
+void
+_mesa_fetch_texel_2d_f_la_latc2(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ GLubyte red, green;
+ unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data),
+ i, j, &red, 2);
+ unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data) + 8,
+ i, j, &green, 2);
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = UBYTE_TO_FLOAT(red);
+ texel[ACOMP] = UBYTE_TO_FLOAT(green);
+}
+
+void
+_mesa_fetch_texel_2d_f_signed_la_latc2(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ GLbyte red, green;
+ signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data),
+ i, j, &red, 2);
+ signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data) + 8,
+ i, j, &green, 2);
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = BYTE_TO_FLOAT_TEX(red);
+ texel[ACOMP] = BYTE_TO_FLOAT_TEX(green);
+}
+
#define TAG(x) unsigned_##x
#define TYPE GLubyte
diff --git a/mesalib/src/mesa/main/texcompress_rgtc.h b/mesalib/src/mesa/main/texcompress_rgtc.h
index 424edc458..a64ef9968 100644
--- a/mesalib/src/mesa/main/texcompress_rgtc.h
+++ b/mesalib/src/mesa/main/texcompress_rgtc.h
@@ -1,60 +1,77 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-#ifndef TEXCOMPRESS_RGTC_H
-#define TEXCOMPRESS_RGTC_H
-
-#include "glheader.h"
-#include "mfeatures.h"
-#include "texstore.h"
-
-struct gl_texture_image;
-
-extern GLboolean
-_mesa_texstore_red_rgtc1(TEXSTORE_PARAMS);
-
-extern GLboolean
-_mesa_texstore_signed_red_rgtc1(TEXSTORE_PARAMS);
-
-extern GLboolean
-_mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS);
-
-extern GLboolean
-_mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS);
-
-extern void
-_mesa_fetch_texel_2d_f_red_rgtc1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_rg_rgtc2(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-#endif
+/*
+ * Copyright (C) 2011 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.
+ */
+
+#ifndef TEXCOMPRESS_RGTC_H
+#define TEXCOMPRESS_RGTC_H
+
+#include "glheader.h"
+#include "mfeatures.h"
+#include "texstore.h"
+
+struct gl_texture_image;
+
+extern GLboolean
+_mesa_texstore_red_rgtc1(TEXSTORE_PARAMS);
+
+extern GLboolean
+_mesa_texstore_signed_red_rgtc1(TEXSTORE_PARAMS);
+
+extern GLboolean
+_mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS);
+
+extern GLboolean
+_mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS);
+
+extern void
+_mesa_fetch_texel_2d_f_red_rgtc1(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_rg_rgtc2(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_l_latc1(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_signed_l_latc1(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_la_latc2(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_signed_la_latc2(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+#endif
diff --git a/mesalib/src/mesa/main/texfetch.c b/mesalib/src/mesa/main/texfetch.c
index 8666076ab..33f8dbba2 100644
--- a/mesalib/src/mesa/main/texfetch.c
+++ b/mesalib/src/mesa/main/texfetch.c
@@ -786,6 +786,34 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
NULL,
NULL
},
+ {
+ MESA_FORMAT_L_LATC1,
+ NULL,
+ _mesa_fetch_texel_2d_f_l_latc1,
+ NULL,
+ NULL
+ },
+ {
+ MESA_FORMAT_SIGNED_L_LATC1,
+ NULL,
+ _mesa_fetch_texel_2d_f_signed_l_latc1,
+ NULL,
+ NULL
+ },
+ {
+ MESA_FORMAT_LA_LATC2,
+ NULL,
+ _mesa_fetch_texel_2d_f_la_latc2,
+ NULL,
+ NULL
+ },
+ {
+ MESA_FORMAT_SIGNED_LA_LATC2,
+ NULL,
+ _mesa_fetch_texel_2d_f_signed_la_latc2,
+ NULL,
+ NULL
+ },
};
diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c
index 8040fac7d..80518200b 100644
--- a/mesalib/src/mesa/main/texformat.c
+++ b/mesalib/src/mesa/main/texformat.c
@@ -621,6 +621,35 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
}
}
+ if (ctx->Extensions.EXT_texture_compression_latc) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_L_LATC1);
+ break;
+ case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_L_LATC1);
+ break;
+ case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LA_LATC2);
+ break;
+ case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_LA_LATC2);
+ break;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.ATI_texture_compression_3dc) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LA_LATC2);
+ break;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
_mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()");
return MESA_FORMAT_NONE;
}
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 164dcba5f..f4d7a4212 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -509,6 +509,28 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
}
}
+ if (ctx->Extensions.EXT_texture_compression_latc) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
+ case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
+ return GL_LUMINANCE;
+ case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
+ case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
+ return GL_LUMINANCE_ALPHA;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.ATI_texture_compression_3dc) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
+ return GL_LUMINANCE_ALPHA;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
return -1; /* error */
}
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c
index d091311c1..749956a1f 100644
--- a/mesalib/src/mesa/main/texstore.c
+++ b/mesalib/src/mesa/main/texstore.c
@@ -4135,7 +4135,14 @@ texstore_funcs[MESA_FORMAT_COUNT] =
{ MESA_FORMAT_RED_RGTC1, _mesa_texstore_red_rgtc1 },
{ MESA_FORMAT_SIGNED_RED_RGTC1, _mesa_texstore_signed_red_rgtc1 },
{ MESA_FORMAT_RG_RGTC2, _mesa_texstore_rg_rgtc2 },
- { MESA_FORMAT_SIGNED_RG_RGTC2, _mesa_texstore_signed_rg_rgtc2 }
+ { MESA_FORMAT_SIGNED_RG_RGTC2, _mesa_texstore_signed_rg_rgtc2 },
+
+ /* Re-use the R/RG texstore functions.
+ * The code is generic enough to handle LATC too. */
+ { MESA_FORMAT_L_LATC1, _mesa_texstore_red_rgtc1 },
+ { MESA_FORMAT_SIGNED_L_LATC1, _mesa_texstore_signed_red_rgtc1 },
+ { MESA_FORMAT_LA_LATC2, _mesa_texstore_rg_rgtc2 },
+ { MESA_FORMAT_SIGNED_LA_LATC2, _mesa_texstore_signed_rg_rgtc2 }
};
diff --git a/mesalib/src/mesa/sources.mak b/mesalib/src/mesa/sources.mak
index e1598869c..b76f63de4 100644
--- a/mesalib/src/mesa/sources.mak
+++ b/mesalib/src/mesa/sources.mak
@@ -215,6 +215,7 @@ STATETRACKER_SOURCES = \
state_tracker/st_cb_queryobj.c \
state_tracker/st_cb_rasterpos.c \
state_tracker/st_cb_readpixels.c \
+ state_tracker/st_cb_syncobj.c \
state_tracker/st_cb_strings.c \
state_tracker/st_cb_texture.c \
state_tracker/st_cb_viewport.c \
diff --git a/mesalib/src/mesa/state_tracker/st_cb_flush.c b/mesalib/src/mesa/state_tracker/st_cb_flush.c
index 31189f360..01496ed07 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_flush.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_flush.c
@@ -103,7 +103,8 @@ void st_finish( struct st_context *st )
st_flush(st, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
if(fence) {
- st->pipe->screen->fence_finish(st->pipe->screen, fence, 0);
+ st->pipe->screen->fence_finish(st->pipe->screen, fence, 0,
+ PIPE_TIMEOUT_INFINITE);
st->pipe->screen->fence_reference(st->pipe->screen, &fence, NULL);
}
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_syncobj.c b/mesalib/src/mesa/state_tracker/st_cb_syncobj.c
new file mode 100644
index 000000000..85aad08cc
--- /dev/null
+++ b/mesalib/src/mesa/state_tracker/st_cb_syncobj.c
@@ -0,0 +1,122 @@
+/**************************************************************************
+ *
+ * Copyright 2011 Marek Olšák <maraeo@gmail.com>
+ * 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 AUTHORS 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.
+ *
+ **************************************************************************/
+
+ /*
+ * Authors:
+ * Marek Olšák <maraeo@gmail.com>
+ */
+
+#include "main/glheader.h"
+#include "main/macros.h"
+#include "pipe/p_context.h"
+#include "pipe/p_screen.h"
+#include "st_context.h"
+#include "st_cb_syncobj.h"
+
+struct st_sync_object {
+ struct gl_sync_object b;
+
+ struct pipe_fence_handle *fence;
+};
+
+
+static struct gl_sync_object * st_new_sync_object(struct gl_context *ctx,
+ GLenum type)
+{
+ if (type == GL_SYNC_FENCE)
+ return (struct gl_sync_object*)CALLOC_STRUCT(st_sync_object);
+ else
+ return NULL;
+}
+
+static void st_delete_sync_object(struct gl_context *ctx,
+ struct gl_sync_object *obj)
+{
+ struct pipe_screen *screen = st_context(ctx)->pipe->screen;
+ struct st_sync_object *so = (struct st_sync_object*)obj;
+
+ screen->fence_reference(screen, &so->fence, NULL);
+ FREE(so);
+}
+
+static void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj,
+ GLenum condition, GLbitfield flags)
+{
+ struct pipe_context *pipe = st_context(ctx)->pipe;
+ struct st_sync_object *so = (struct st_sync_object*)obj;
+
+ assert(condition == GL_SYNC_GPU_COMMANDS_COMPLETE && flags == 0);
+ assert(so->fence == NULL);
+
+ pipe->flush(pipe, 0, &so->fence);
+}
+
+static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)
+{
+ struct pipe_screen *screen = st_context(ctx)->pipe->screen;
+ struct st_sync_object *so = (struct st_sync_object*)obj;
+
+ if (so->fence && screen->fence_signalled(screen, so->fence, 0) == 0) {
+ screen->fence_reference(screen, &so->fence, NULL);
+ so->b.StatusFlag = GL_TRUE;
+ }
+}
+
+static void st_client_wait_sync(struct gl_context *ctx,
+ struct gl_sync_object *obj,
+ GLbitfield flags, GLuint64 timeout)
+{
+ struct pipe_screen *screen = st_context(ctx)->pipe->screen;
+ struct st_sync_object *so = (struct st_sync_object*)obj;
+
+ /* We don't care about GL_SYNC_FLUSH_COMMANDS_BIT, because flush is
+ * already called when creating a fence. */
+
+ if (so->fence &&
+ screen->fence_finish(screen, so->fence, 0, timeout) == 0) {
+ screen->fence_reference(screen, &so->fence, NULL);
+ so->b.StatusFlag = GL_TRUE;
+ }
+}
+
+static void st_server_wait_sync(struct gl_context *ctx,
+ struct gl_sync_object *obj,
+ GLbitfield flags, GLuint64 timeout)
+{
+ /* NO-OP.
+ * Neither Gallium nor DRM interfaces support blocking on the GPU. */
+}
+
+void st_init_syncobj_functions(struct dd_function_table *functions)
+{
+ functions->NewSyncObject = st_new_sync_object;
+ functions->FenceSync = st_fence_sync;
+ functions->DeleteSyncObject = st_delete_sync_object;
+ functions->CheckSync = st_check_sync;
+ functions->ClientWaitSync = st_client_wait_sync;
+ functions->ServerWaitSync = st_server_wait_sync;
+}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_syncobj.h b/mesalib/src/mesa/state_tracker/st_cb_syncobj.h
new file mode 100644
index 000000000..c25468478
--- /dev/null
+++ b/mesalib/src/mesa/state_tracker/st_cb_syncobj.h
@@ -0,0 +1,38 @@
+/**************************************************************************
+ *
+ * Copyright 2011 Marek Olšák <maraeo@gmail.com>
+ * 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 AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef ST_CB_SYNCOBJ_H
+#define ST_CB_SYNCOBJ_H
+
+
+struct dd_function_table;
+
+extern void
+st_init_syncobj_functions(struct dd_function_table *functions);
+
+
+#endif /* ST_CB_SYNCOBJ_H */
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index 8f3a7415d..c1b4cde77 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -51,6 +51,7 @@
#include "st_cb_texture.h"
#include "st_cb_xformfb.h"
#include "st_cb_flush.h"
+#include "st_cb_syncobj.h"
#include "st_cb_strings.h"
#include "st_cb_viewport.h"
#include "st_atom.h"
@@ -292,6 +293,7 @@ void st_init_driver_functions(struct dd_function_table *functions)
st_init_viewport_functions(functions);
st_init_xformfb_functions(functions);
+ st_init_syncobj_functions(functions);
functions->UpdateState = st_invalidate_state;
}
diff --git a/mesalib/src/mesa/state_tracker/st_draw.c b/mesalib/src/mesa/state_tracker/st_draw.c
index 12142b84e..2f4027bc4 100644
--- a/mesalib/src/mesa/state_tracker/st_draw.c
+++ b/mesalib/src/mesa/state_tracker/st_draw.c
@@ -429,7 +429,7 @@ setup_non_interleaved_attribs(struct gl_context *ctx,
vbuffer[attr].buffer_offset = 0;
/* Track user vertex buffers. */
- pipe_resource_reference(&st->user_vb[attr], vbuffer->buffer);
+ pipe_resource_reference(&st->user_vb[attr], vbuffer[attr].buffer);
st->user_vb_stride[attr] = stride;
st->num_user_vbs = MAX2(st->num_user_vbs, attr+1);
}
@@ -632,10 +632,8 @@ st_draw_vbo(struct gl_context *ctx,
struct pipe_index_buffer ibuffer;
struct pipe_draw_info info;
unsigned i, num_instances = 1;
- GLboolean new_array = GL_TRUE;
- /* Fix this (Bug 34378):
GLboolean new_array =
- st->dirty.st && (st->dirty.mesa & (_NEW_ARRAY | _NEW_PROGRAM)) != 0;*/
+ st->dirty.st && (st->dirty.mesa & (_NEW_ARRAY | _NEW_PROGRAM)) != 0;
/* Mesa core state should have been validated already */
assert(ctx->NewState == 0x0);
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 511a252f0..32cbcaec1 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -432,6 +432,27 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.ARB_texture_compression_rgtc = GL_TRUE;
}
+ if (screen->is_format_supported(screen, PIPE_FORMAT_LATC1_UNORM,
+ PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_SAMPLER_VIEW, 0) &&
+ screen->is_format_supported(screen, PIPE_FORMAT_LATC1_SNORM,
+ PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_SAMPLER_VIEW, 0) &&
+ screen->is_format_supported(screen, PIPE_FORMAT_LATC2_UNORM,
+ PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_SAMPLER_VIEW, 0) &&
+ screen->is_format_supported(screen, PIPE_FORMAT_LATC2_SNORM,
+ PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_SAMPLER_VIEW, 0)) {
+ ctx->Extensions.EXT_texture_compression_latc = GL_TRUE;
+ }
+
+ if (screen->is_format_supported(screen, PIPE_FORMAT_LATC2_UNORM,
+ PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_SAMPLER_VIEW, 0)) {
+ ctx->Extensions.ATI_texture_compression_3dc = GL_TRUE;
+ }
+
/* ycbcr support */
if (screen->is_format_supported(screen, PIPE_FORMAT_UYVY,
PIPE_TEXTURE_2D, 0,
@@ -497,4 +518,8 @@ void st_init_extensions(struct st_context *st)
if (screen->get_param(screen, PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR)) {
ctx->Extensions.ARB_instanced_arrays = GL_TRUE;
}
+
+ if (screen->fence_finish) {
+ ctx->Extensions.ARB_sync = GL_TRUE;
+ }
}
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index 1adfdf72c..5ac4b9f25 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -249,6 +249,16 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat)
return PIPE_FORMAT_RGTC2_UNORM;
case MESA_FORMAT_SIGNED_RG_RGTC2:
return PIPE_FORMAT_RGTC2_SNORM;
+
+ case MESA_FORMAT_L_LATC1:
+ return PIPE_FORMAT_LATC1_UNORM;
+ case MESA_FORMAT_SIGNED_L_LATC1:
+ return PIPE_FORMAT_LATC1_SNORM;
+ case MESA_FORMAT_LA_LATC2:
+ return PIPE_FORMAT_LATC2_UNORM;
+ case MESA_FORMAT_SIGNED_LA_LATC2:
+ return PIPE_FORMAT_LATC2_SNORM;
+
default:
assert(0);
return PIPE_FORMAT_NONE;
@@ -397,6 +407,15 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
case PIPE_FORMAT_RGTC2_SNORM:
return MESA_FORMAT_SIGNED_RG_RGTC2;
+ case PIPE_FORMAT_LATC1_UNORM:
+ return MESA_FORMAT_L_LATC1;
+ case PIPE_FORMAT_LATC1_SNORM:
+ return MESA_FORMAT_SIGNED_L_LATC1;
+ case PIPE_FORMAT_LATC2_UNORM:
+ return MESA_FORMAT_LA_LATC2;
+ case PIPE_FORMAT_LATC2_SNORM:
+ return MESA_FORMAT_SIGNED_LA_LATC2;
+
default:
assert(0);
return MESA_FORMAT_NONE;
@@ -612,7 +631,6 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
case GL_LUMINANCE:
case GL_LUMINANCE4:
case GL_LUMINANCE8:
- case GL_COMPRESSED_LUMINANCE:
if (screen->is_format_supported( screen, PIPE_FORMAT_L8_UNORM, target,
sample_count, bindings, geom_flags ))
return PIPE_FORMAT_L8_UNORM;
@@ -630,7 +648,6 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE6_ALPHA2:
case GL_LUMINANCE8_ALPHA8:
- case GL_COMPRESSED_LUMINANCE_ALPHA:
if (screen->is_format_supported( screen, PIPE_FORMAT_L8A8_UNORM, target,
sample_count, bindings, geom_flags ))
return PIPE_FORMAT_L8A8_UNORM;
@@ -901,6 +918,39 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
return PIPE_FORMAT_RGTC2_SNORM;
return PIPE_FORMAT_NONE;
+ case GL_COMPRESSED_LUMINANCE:
+ case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
+ if (screen->is_format_supported(screen, PIPE_FORMAT_LATC1_UNORM, target,
+ sample_count, bindings, geom_flags))
+ return PIPE_FORMAT_LATC1_UNORM;
+ if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, target,
+ sample_count, bindings, geom_flags))
+ return PIPE_FORMAT_L8_UNORM;
+ return PIPE_FORMAT_NONE;
+
+ case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
+ if (screen->is_format_supported(screen, PIPE_FORMAT_LATC1_SNORM, target,
+ sample_count, bindings, geom_flags))
+ return PIPE_FORMAT_LATC1_SNORM;
+ return PIPE_FORMAT_NONE;
+
+ case GL_COMPRESSED_LUMINANCE_ALPHA:
+ case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
+ case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
+ if (screen->is_format_supported(screen, PIPE_FORMAT_LATC2_UNORM, target,
+ sample_count, bindings, geom_flags))
+ return PIPE_FORMAT_LATC2_UNORM;
+ if (screen->is_format_supported(screen, PIPE_FORMAT_L8A8_UNORM, target,
+ sample_count, bindings, geom_flags))
+ return PIPE_FORMAT_L8A8_UNORM;
+ return PIPE_FORMAT_NONE;
+
+ case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
+ if (screen->is_format_supported(screen, PIPE_FORMAT_LATC2_SNORM, target,
+ sample_count, bindings, geom_flags))
+ return PIPE_FORMAT_LATC2_SNORM;
+ return PIPE_FORMAT_NONE;
+
/* signed/unsigned integer formats.
* XXX Mesa only has formats for RGBA signed/unsigned integer formats.
* If/when new formats are added this code should be updated.
diff --git a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
index 7a61998e2..34a2e9ebd 100644
--- a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
@@ -204,12 +204,10 @@ fallback_generate_mipmap(struct gl_context *ctx, GLenum target,
_mesa_is_format_compressed(texObj->Image[face][baseLevel]->TexFormat);
if (compressed) {
- if (texObj->Image[face][baseLevel]->TexFormat == MESA_FORMAT_SIGNED_RED_RGTC1 ||
- texObj->Image[face][baseLevel]->TexFormat == MESA_FORMAT_SIGNED_RG_RGTC2)
- datatype = GL_FLOAT;
- else
- datatype = GL_UNSIGNED_BYTE;
-
+ GLenum type =
+ _mesa_get_format_datatype(texObj->Image[face][baseLevel]->TexFormat);
+
+ datatype = type == GL_UNSIGNED_NORMALIZED ? GL_UNSIGNED_BYTE : GL_FLOAT;
comps = 4;
}
else {
diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c
index 503f5b732..1d2b635e7 100644
--- a/mesalib/src/mesa/swrast/s_texfilter.c
+++ b/mesalib/src/mesa/swrast/s_texfilter.c
@@ -2918,51 +2918,51 @@ shadow_compare4(GLenum function, GLfloat coord,
switch (function) {
case GL_LEQUAL:
- if (depth00 <= coord) luminance -= d;
- if (depth01 <= coord) luminance -= d;
- if (depth10 <= coord) luminance -= d;
- if (depth11 <= coord) luminance -= d;
+ if (coord > depth00) luminance -= d;
+ if (coord > depth01) luminance -= d;
+ if (coord > depth10) luminance -= d;
+ if (coord > depth11) luminance -= d;
return luminance;
case GL_GEQUAL:
- if (depth00 >= coord) luminance -= d;
- if (depth01 >= coord) luminance -= d;
- if (depth10 >= coord) luminance -= d;
- if (depth11 >= coord) luminance -= d;
+ if (coord < depth00) luminance -= d;
+ if (coord < depth01) luminance -= d;
+ if (coord < depth10) luminance -= d;
+ if (coord < depth11) luminance -= d;
return luminance;
case GL_LESS:
- if (depth00 < coord) luminance -= d;
- if (depth01 < coord) luminance -= d;
- if (depth10 < coord) luminance -= d;
- if (depth11 < coord) luminance -= d;
+ if (coord >= depth00) luminance -= d;
+ if (coord >= depth01) luminance -= d;
+ if (coord >= depth10) luminance -= d;
+ if (coord >= depth11) luminance -= d;
return luminance;
case GL_GREATER:
- if (depth00 > coord) luminance -= d;
- if (depth01 > coord) luminance -= d;
- if (depth10 > coord) luminance -= d;
- if (depth11 > coord) luminance -= d;
+ if (coord <= depth00) luminance -= d;
+ if (coord <= depth01) luminance -= d;
+ if (coord <= depth10) luminance -= d;
+ if (coord <= depth11) luminance -= d;
return luminance;
case GL_EQUAL:
- if (depth00 == coord) luminance -= d;
- if (depth01 == coord) luminance -= d;
- if (depth10 == coord) luminance -= d;
- if (depth11 == coord) luminance -= d;
+ if (coord != depth00) luminance -= d;
+ if (coord != depth01) luminance -= d;
+ if (coord != depth10) luminance -= d;
+ if (coord != depth11) luminance -= d;
return luminance;
case GL_NOTEQUAL:
- if (depth00 != coord) luminance -= d;
- if (depth01 != coord) luminance -= d;
- if (depth10 != coord) luminance -= d;
- if (depth11 != coord) luminance -= d;
+ if (coord == depth00) luminance -= d;
+ if (coord == depth01) luminance -= d;
+ if (coord == depth10) luminance -= d;
+ if (coord == depth11) luminance -= d;
return luminance;
case GL_ALWAYS:
- return 0.0;
+ return 1.0F;
case GL_NEVER:
return ambient;
case GL_NONE:
/* ordinary bilinear filtering */
return lerp_2d(wi, wj, depth00, depth10, depth01, depth11);
default:
- _mesa_problem(NULL, "Bad compare func in sample_depth_texture");
- return 0.0F;
+ _mesa_problem(NULL, "Bad compare func in sample_compare4");
+ return ambient;
}
}
@@ -3030,7 +3030,7 @@ sample_depth_texture( struct gl_context *ctx,
if (tObj->MagFilter == GL_NEAREST) {
GLuint i;
for (i = 0; i < n; i++) {
- GLfloat depthSample;
+ GLfloat depthSample, depthRef;
GLint col, row, slice;
nearest_texcoord(tObj, level, texcoords[i], &col, &row, &slice);
@@ -3043,8 +3043,9 @@ sample_depth_texture( struct gl_context *ctx,
depthSample = tObj->BorderColor.f[0];
}
- result = shadow_compare(function, texcoords[i][compare_coord],
- depthSample, ambient);
+ depthRef = CLAMP(texcoords[i][compare_coord], 0.0F, 1.0F);
+
+ result = shadow_compare(function, depthRef, depthSample, ambient);
switch (tObj->DepthMode) {
case GL_LUMINANCE:
@@ -3068,7 +3069,7 @@ sample_depth_texture( struct gl_context *ctx,
GLuint i;
ASSERT(tObj->MagFilter == GL_LINEAR);
for (i = 0; i < n; i++) {
- GLfloat depth00, depth01, depth10, depth11;
+ GLfloat depth00, depth01, depth10, depth11, depthRef;
GLint i0, i1, j0, j1;
GLint slice;
GLfloat wi, wj;
@@ -3134,7 +3135,9 @@ sample_depth_texture( struct gl_context *ctx,
}
}
- result = shadow_compare4(function, texcoords[i][compare_coord],
+ depthRef = CLAMP(texcoords[i][compare_coord], 0.0F, 1.0F);
+
+ result = shadow_compare4(function, depthRef,
depth00, depth01, depth10, depth11,
ambient, wi, wj);
diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c
index 78aba9039..37656c23a 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_array.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_array.c
@@ -461,6 +461,14 @@ recalculate_input_bindings(struct gl_context *ctx)
inputs[VERT_ATTRIB_GENERIC0 + i] = &vbo->generic_currval[i];
const_inputs |= 1 << (VERT_ATTRIB_GENERIC0 + i);
}
+
+ /* There is no need to make _NEW_ARRAY dirty here for the TnL program,
+ * because it already takes care of invalidating the state necessary
+ * to revalidate vertex arrays. Not marking the state as dirty also
+ * improves performance (quite significantly in some apps).
+ */
+ if (!ctx->VertexProgram._MaintainTnlProgram)
+ ctx->NewState |= _NEW_ARRAY;
break;
case VP_NV:
@@ -486,6 +494,8 @@ recalculate_input_bindings(struct gl_context *ctx)
inputs[i] = &vbo->generic_currval[i - VERT_ATTRIB_GENERIC0];
const_inputs |= 1 << i;
}
+
+ ctx->NewState |= _NEW_ARRAY;
break;
case VP_ARB:
@@ -521,8 +531,9 @@ recalculate_input_bindings(struct gl_context *ctx)
inputs[VERT_ATTRIB_GENERIC0 + i] = &vbo->generic_currval[i];
const_inputs |= 1 << (VERT_ATTRIB_GENERIC0 + i);
}
-
}
+
+ ctx->NewState |= _NEW_ARRAY;
break;
}
diff --git a/xorg-server/Xext/panoramiX.c b/xorg-server/Xext/panoramiX.c
index 489224221..309c09cda 100644
--- a/xorg-server/Xext/panoramiX.c
+++ b/xorg-server/Xext/panoramiX.c
@@ -83,11 +83,11 @@ static DepthPtr PanoramiXDepths;
static int PanoramiXNumVisuals;
static VisualPtr PanoramiXVisuals;
-unsigned long XRC_DRAWABLE;
-unsigned long XRT_WINDOW;
-unsigned long XRT_PIXMAP;
-unsigned long XRT_GC;
-unsigned long XRT_COLORMAP;
+RESTYPE XRC_DRAWABLE;
+RESTYPE XRT_WINDOW;
+RESTYPE XRT_PIXMAP;
+RESTYPE XRT_GC;
+RESTYPE XRT_COLORMAP;
static Bool VisualsEqual(VisualPtr, ScreenPtr, VisualPtr);
XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr = &VisualsEqual;
diff --git a/xorg-server/Xext/panoramiXsrv.h b/xorg-server/Xext/panoramiXsrv.h
index d177df28d..21f1b4cb8 100644
--- a/xorg-server/Xext/panoramiXsrv.h
+++ b/xorg-server/Xext/panoramiXsrv.h
@@ -21,12 +21,12 @@ extern _X_EXPORT int XineramaDeleteResource(pointer, XID);
extern _X_EXPORT void XineramaReinitData(ScreenPtr);
-extern _X_EXPORT unsigned long XRC_DRAWABLE;
-extern _X_EXPORT unsigned long XRT_WINDOW;
-extern _X_EXPORT unsigned long XRT_PIXMAP;
-extern _X_EXPORT unsigned long XRT_GC;
-extern _X_EXPORT unsigned long XRT_COLORMAP;
-extern _X_EXPORT unsigned long XRT_PICTURE;
+extern _X_EXPORT RESTYPE XRC_DRAWABLE;
+extern _X_EXPORT RESTYPE XRT_WINDOW;
+extern _X_EXPORT RESTYPE XRT_PIXMAP;
+extern _X_EXPORT RESTYPE XRT_GC;
+extern _X_EXPORT RESTYPE XRT_COLORMAP;
+extern _X_EXPORT RESTYPE XRT_PICTURE;
/*
* Drivers are allowed to wrap this function. Each wrapper can decide that the
diff --git a/xorg-server/Xext/xvdix.h b/xorg-server/Xext/xvdix.h
index 5104a4def..58069f040 100644
--- a/xorg-server/Xext/xvdix.h
+++ b/xorg-server/Xext/xvdix.h
@@ -64,12 +64,12 @@ extern _X_EXPORT int XvReqCode;
extern _X_EXPORT int XvEventBase;
extern _X_EXPORT int XvErrorBase;
-extern _X_EXPORT unsigned long XvRTPort;
-extern _X_EXPORT unsigned long XvRTEncoding;
-extern _X_EXPORT unsigned long XvRTGrab;
-extern _X_EXPORT unsigned long XvRTVideoNotify;
-extern _X_EXPORT unsigned long XvRTVideoNotifyList;
-extern _X_EXPORT unsigned long XvRTPortNotify;
+extern _X_EXPORT RESTYPE XvRTPort;
+extern _X_EXPORT RESTYPE XvRTEncoding;
+extern _X_EXPORT RESTYPE XvRTGrab;
+extern _X_EXPORT RESTYPE XvRTVideoNotify;
+extern _X_EXPORT RESTYPE XvRTVideoNotifyList;
+extern _X_EXPORT RESTYPE XvRTPortNotify;
#endif
typedef struct {
diff --git a/xorg-server/Xext/xvmain.c b/xorg-server/Xext/xvmain.c
index 7cd900117..bbd2b3c6c 100644
--- a/xorg-server/Xext/xvmain.c
+++ b/xorg-server/Xext/xvmain.c
@@ -115,14 +115,12 @@ int XvReqCode;
int XvEventBase;
int XvErrorBase;
-unsigned long XvRTPort;
-unsigned long XvRTEncoding;
-unsigned long XvRTGrab;
-unsigned long XvRTVideoNotify;
-unsigned long XvRTVideoNotifyList;
-unsigned long XvRTPortNotify;
-
-
+RESTYPE XvRTPort;
+RESTYPE XvRTEncoding;
+RESTYPE XvRTGrab;
+RESTYPE XvRTVideoNotify;
+RESTYPE XvRTVideoNotifyList;
+RESTYPE XvRTPortNotify;
/* EXTERNAL */
diff --git a/xorg-server/Xext/xvmc.c b/xorg-server/Xext/xvmc.c
index 9b9dd0bc2..0a0e9415e 100644
--- a/xorg-server/Xext/xvmc.c
+++ b/xorg-server/Xext/xvmc.c
@@ -42,9 +42,9 @@ unsigned long XvMCGeneration = 0;
int XvMCReqCode;
int XvMCEventBase;
-unsigned long XvMCRTContext;
-unsigned long XvMCRTSurface;
-unsigned long XvMCRTSubpicture;
+static RESTYPE XvMCRTContext;
+static RESTYPE XvMCRTSurface;
+static RESTYPE XvMCRTSubpicture;
typedef struct {
int num_adaptors;
diff --git a/xorg-server/Xi/exglobals.h b/xorg-server/Xi/exglobals.h
index 4f09e6ca3..cba7efed7 100644
--- a/xorg-server/Xi/exglobals.h
+++ b/xorg-server/Xi/exglobals.h
@@ -76,7 +76,7 @@ extern int ChangeDeviceNotify;
extern int DevicePresenceNotify;
extern int DevicePropertyNotify;
-extern int RT_INPUTCLIENT;
+extern RESTYPE RT_INPUTCLIENT;
extern DevPrivateKeyRec XIClientPrivateKeyRec;
#define XIClientPrivateKey (&XIClientPrivateKeyRec)
diff --git a/xorg-server/Xi/extinit.c b/xorg-server/Xi/extinit.c
index 82df7eb02..63f7fca8b 100644
--- a/xorg-server/Xi/extinit.c
+++ b/xorg-server/Xi/extinit.c
@@ -1,1309 +1,1309 @@
-/************************************************************
-
-Copyright 1989, 1998 The Open Group
-
-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.
-
-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
-OPEN GROUP 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 Open Group 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 Open Group.
-
-Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-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 Hewlett-Packard not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-HEWLETT-PACKARD 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.
-
-********************************************************/
-
-/********************************************************************
- *
- * Dispatch routines and initialization routines for the X input extension.
- *
- */
-
-#define NUMTYPES 15
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "inputstr.h"
-#include "gcstruct.h" /* pointer for extnsionst.h */
-#include "extnsionst.h" /* extension entry */
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include <X11/extensions/XI2proto.h>
-#include <X11/extensions/geproto.h>
-#include "geext.h" /* extension interfaces for ge */
-
-#include "dixevents.h"
-#include "exevents.h"
-#include "extinit.h"
-#include "exglobals.h"
-#include "swaprep.h"
-#include "privates.h"
-#include "protocol-versions.h"
-
-/* modules local to Xi */
-#include "allowev.h"
-#include "chgdctl.h"
-#include "chgfctl.h"
-#include "chgkbd.h"
-#include "chgprop.h"
-#include "chgptr.h"
-#include "closedev.h"
-#include "devbell.h"
-#include "getbmap.h"
-#include "getbmap.h"
-#include "getdctl.h"
-#include "getfctl.h"
-#include "getfocus.h"
-#include "getkmap.h"
-#include "getmmap.h"
-#include "getprop.h"
-#include "getselev.h"
-#include "getvers.h"
-#include "getvers.h"
-#include "grabdev.h"
-#include "grabdevb.h"
-#include "grabdevk.h"
-#include "gtmotion.h"
-#include "listdev.h"
-#include "opendev.h"
-#include "queryst.h"
-#include "selectev.h"
-#include "sendexev.h"
-#include "chgkmap.h"
-#include "setbmap.h"
-#include "setdval.h"
-#include "setfocus.h"
-#include "setmmap.h"
-#include "setmode.h"
-#include "ungrdev.h"
-#include "ungrdevb.h"
-#include "ungrdevk.h"
-#include "xiallowev.h"
-#include "xiselectev.h"
-#include "xigrabdev.h"
-#include "xipassivegrab.h"
-#include "xisetdevfocus.h"
-#include "xiproperty.h"
-#include "xichangecursor.h"
-#include "xichangehierarchy.h"
-#include "xigetclientpointer.h"
-#include "xiquerydevice.h"
-#include "xiquerypointer.h"
-#include "xiqueryversion.h"
-#include "xisetclientpointer.h"
-#include "xiwarppointer.h"
-
-
-/* Masks for XI events have to be aligned with core event (partially anyway).
- * If DeviceButtonMotionMask is != ButtonMotionMask, event delivery
- * breaks down. The device needs the dev->button->motionMask. If DBMM is
- * the same as BMM, we can ensure that both core and device events can be
- * delivered, without the need for extra structures in the DeviceIntRec. */
-const Mask DeviceKeyPressMask = KeyPressMask;
-const Mask DeviceKeyReleaseMask = KeyReleaseMask;
-const Mask DeviceButtonPressMask = ButtonPressMask;
-const Mask DeviceButtonReleaseMask = ButtonReleaseMask;
-const Mask DeviceProximityMask = (1L << 4);
-const Mask DeviceStateNotifyMask = (1L << 5);
-const Mask DevicePointerMotionMask = PointerMotionMask;
-const Mask DevicePointerMotionHintMask = PointerMotionHintMask;
-const Mask DeviceButton1MotionMask = Button1MotionMask;
-const Mask DeviceButton2MotionMask = Button2MotionMask;
-const Mask DeviceButton3MotionMask = Button3MotionMask;
-const Mask DeviceButton4MotionMask = Button4MotionMask;
-const Mask DeviceButton5MotionMask = Button5MotionMask;
-const Mask DeviceButtonMotionMask = ButtonMotionMask;
-const Mask DeviceFocusChangeMask = (1L << 14);
-const Mask DeviceMappingNotifyMask = (1L << 15);
-const Mask ChangeDeviceNotifyMask = (1L << 16);
-const Mask DeviceButtonGrabMask = (1L << 17);
-const Mask DeviceOwnerGrabButtonMask = (1L << 17);
-const Mask DevicePresenceNotifyMask = (1L << 18);
-const Mask DeviceEnterWindowMask = (1L << 18);
-const Mask DeviceLeaveWindowMask = (1L << 19);
-const Mask DevicePropertyNotifyMask = (1L << 20);
-const Mask XIAllMasks = (1L << 21) - 1;
-
-int ExtEventIndex;
-Mask ExtExclusiveMasks[EMASKSIZE];
-
-static struct dev_type
-{
- Atom type;
- char *name;
-} dev_type[] = {
- {
- 0, XI_KEYBOARD}, {
- 0, XI_MOUSE}, {
- 0, XI_TABLET}, {
- 0, XI_TOUCHSCREEN}, {
- 0, XI_TOUCHPAD}, {
- 0, XI_BARCODE}, {
- 0, XI_BUTTONBOX}, {
- 0, XI_KNOB_BOX}, {
- 0, XI_ONE_KNOB}, {
- 0, XI_NINE_KNOB}, {
- 0, XI_TRACKBALL}, {
- 0, XI_QUADRATURE}, {
- 0, XI_ID_MODULE}, {
- 0, XI_SPACEBALL}, {
- 0, XI_DATAGLOVE}, {
- 0, XI_EYETRACKER}, {
- 0, XI_CURSORKEYS}, {
-0, XI_FOOTMOUSE}};
-
-CARD8 event_base[numInputClasses];
-XExtEventInfo EventInfo[32];
-
-static DeviceIntRec xi_all_devices;
-static DeviceIntRec xi_all_master_devices;
-
-/**
- * Dispatch vector. Functions defined in here will be called when the matching
- * request arrives.
- */
-static int (*ProcIVector[])(ClientPtr) = {
- NULL, /* 0 */
- ProcXGetExtensionVersion, /* 1 */
- ProcXListInputDevices, /* 2 */
- ProcXOpenDevice, /* 3 */
- ProcXCloseDevice, /* 4 */
- ProcXSetDeviceMode, /* 5 */
- ProcXSelectExtensionEvent, /* 6 */
- ProcXGetSelectedExtensionEvents, /* 7 */
- ProcXChangeDeviceDontPropagateList, /* 8 */
- ProcXGetDeviceDontPropagateList, /* 9 */
- ProcXGetDeviceMotionEvents, /* 10 */
- ProcXChangeKeyboardDevice, /* 11 */
- ProcXChangePointerDevice, /* 12 */
- ProcXGrabDevice, /* 13 */
- ProcXUngrabDevice, /* 14 */
- ProcXGrabDeviceKey, /* 15 */
- ProcXUngrabDeviceKey, /* 16 */
- ProcXGrabDeviceButton, /* 17 */
- ProcXUngrabDeviceButton, /* 18 */
- ProcXAllowDeviceEvents, /* 19 */
- ProcXGetDeviceFocus, /* 20 */
- ProcXSetDeviceFocus, /* 21 */
- ProcXGetFeedbackControl, /* 22 */
- ProcXChangeFeedbackControl, /* 23 */
- ProcXGetDeviceKeyMapping, /* 24 */
- ProcXChangeDeviceKeyMapping, /* 25 */
- ProcXGetDeviceModifierMapping, /* 26 */
- ProcXSetDeviceModifierMapping, /* 27 */
- ProcXGetDeviceButtonMapping, /* 28 */
- ProcXSetDeviceButtonMapping, /* 29 */
- ProcXQueryDeviceState, /* 30 */
- ProcXSendExtensionEvent, /* 31 */
- ProcXDeviceBell, /* 32 */
- ProcXSetDeviceValuators, /* 33 */
- ProcXGetDeviceControl, /* 34 */
- ProcXChangeDeviceControl, /* 35 */
- /* XI 1.5 */
- ProcXListDeviceProperties, /* 36 */
- ProcXChangeDeviceProperty, /* 37 */
- ProcXDeleteDeviceProperty, /* 38 */
- ProcXGetDeviceProperty, /* 39 */
- /* XI 2 */
- ProcXIQueryPointer, /* 40 */
- ProcXIWarpPointer, /* 41 */
- ProcXIChangeCursor, /* 42 */
- ProcXIChangeHierarchy, /* 43 */
- ProcXISetClientPointer, /* 44 */
- ProcXIGetClientPointer, /* 45 */
- ProcXISelectEvents, /* 46 */
- ProcXIQueryVersion, /* 47 */
- ProcXIQueryDevice, /* 48 */
- ProcXISetFocus, /* 49 */
- ProcXIGetFocus, /* 50 */
- ProcXIGrabDevice, /* 51 */
- ProcXIUngrabDevice, /* 52 */
- ProcXIAllowEvents, /* 53 */
- ProcXIPassiveGrabDevice, /* 54 */
- ProcXIPassiveUngrabDevice, /* 55 */
- ProcXIListProperties, /* 56 */
- ProcXIChangeProperty, /* 57 */
- ProcXIDeleteProperty, /* 58 */
- ProcXIGetProperty, /* 59 */
- ProcXIGetSelectedEvents /* 60 */
-};
-
-/* For swapped clients */
-static int (*SProcIVector[])(ClientPtr) = {
- NULL, /* 0 */
- SProcXGetExtensionVersion, /* 1 */
- SProcXListInputDevices, /* 2 */
- SProcXOpenDevice, /* 3 */
- SProcXCloseDevice, /* 4 */
- SProcXSetDeviceMode, /* 5 */
- SProcXSelectExtensionEvent, /* 6 */
- SProcXGetSelectedExtensionEvents, /* 7 */
- SProcXChangeDeviceDontPropagateList, /* 8 */
- SProcXGetDeviceDontPropagateList, /* 9 */
- SProcXGetDeviceMotionEvents, /* 10 */
- SProcXChangeKeyboardDevice, /* 11 */
- SProcXChangePointerDevice, /* 12 */
- SProcXGrabDevice, /* 13 */
- SProcXUngrabDevice, /* 14 */
- SProcXGrabDeviceKey, /* 15 */
- SProcXUngrabDeviceKey, /* 16 */
- SProcXGrabDeviceButton, /* 17 */
- SProcXUngrabDeviceButton, /* 18 */
- SProcXAllowDeviceEvents, /* 19 */
- SProcXGetDeviceFocus, /* 20 */
- SProcXSetDeviceFocus, /* 21 */
- SProcXGetFeedbackControl, /* 22 */
- SProcXChangeFeedbackControl, /* 23 */
- SProcXGetDeviceKeyMapping, /* 24 */
- SProcXChangeDeviceKeyMapping, /* 25 */
- SProcXGetDeviceModifierMapping, /* 26 */
- SProcXSetDeviceModifierMapping, /* 27 */
- SProcXGetDeviceButtonMapping, /* 28 */
- SProcXSetDeviceButtonMapping, /* 29 */
- SProcXQueryDeviceState, /* 30 */
- SProcXSendExtensionEvent, /* 31 */
- SProcXDeviceBell, /* 32 */
- SProcXSetDeviceValuators, /* 33 */
- SProcXGetDeviceControl, /* 34 */
- SProcXChangeDeviceControl, /* 35 */
- SProcXListDeviceProperties, /* 36 */
- SProcXChangeDeviceProperty, /* 37 */
- SProcXDeleteDeviceProperty, /* 38 */
- SProcXGetDeviceProperty, /* 39 */
- SProcXIQueryPointer, /* 40 */
- SProcXIWarpPointer, /* 41 */
- SProcXIChangeCursor, /* 42 */
- SProcXIChangeHierarchy, /* 43 */
- SProcXISetClientPointer, /* 44 */
- SProcXIGetClientPointer, /* 45 */
- SProcXISelectEvents, /* 46 */
- SProcXIQueryVersion, /* 47 */
- SProcXIQueryDevice, /* 48 */
- SProcXISetFocus, /* 49 */
- SProcXIGetFocus, /* 50 */
- SProcXIGrabDevice, /* 51 */
- SProcXIUngrabDevice, /* 52 */
- SProcXIAllowEvents, /* 53 */
- SProcXIPassiveGrabDevice, /* 54 */
- SProcXIPassiveUngrabDevice, /* 55 */
- SProcXIListProperties, /* 56 */
- SProcXIChangeProperty, /* 57 */
- SProcXIDeleteProperty, /* 58 */
- SProcXIGetProperty, /* 59 */
- SProcXIGetSelectedEvents /* 60 */
-};
-
-/*****************************************************************
- *
- * Globals referenced elsewhere in the server.
- *
- */
-
-int IReqCode = 0;
-int IEventBase = 0;
-int BadDevice = 0;
-static int BadEvent = 1;
-int BadMode = 2;
-int DeviceBusy = 3;
-int BadClass = 4;
-
-int DeviceValuator;
-int DeviceKeyPress;
-int DeviceKeyRelease;
-int DeviceButtonPress;
-int DeviceButtonRelease;
-int DeviceMotionNotify;
-int DeviceFocusIn;
-int DeviceFocusOut;
-int ProximityIn;
-int ProximityOut;
-int DeviceStateNotify;
-int DeviceKeyStateNotify;
-int DeviceButtonStateNotify;
-int DeviceMappingNotify;
-int ChangeDeviceNotify;
-int DevicePresenceNotify;
-int DevicePropertyNotify;
-
-int RT_INPUTCLIENT;
-
-/*****************************************************************
- *
- * Externs defined elsewhere in the X server.
- *
- */
-
-extern XExtensionVersion XIVersion;
-
-
-Mask PropagateMask[MAXDEVICES];
-
-/*****************************************************************
- *
- * Versioning support
- *
- */
-
-DevPrivateKeyRec XIClientPrivateKeyRec;
-
-/*****************************************************************
- *
- * Declarations of local routines.
- *
- */
-
-static void
-XIClientCallback(CallbackListPtr *list,
- pointer closure,
- pointer data)
-{
- NewClientInfoRec *clientinfo = (NewClientInfoRec*)data;
- ClientPtr pClient = clientinfo->client;
- XIClientPtr pXIClient;
-
- pXIClient = dixLookupPrivate(&pClient->devPrivates, XIClientPrivateKey);
- pXIClient->major_version = 0;
- pXIClient->minor_version = 0;
-}
-
-/*************************************************************************
- *
- * ProcIDispatch - main dispatch routine for requests to this extension.
- * This routine is used if server and client have the same byte ordering.
- *
- */
-
-static int
-ProcIDispatch(ClientPtr client)
-{
- REQUEST(xReq);
- if (stuff->data > (IREQUESTS + XI2REQUESTS) || !ProcIVector[stuff->data])
- return BadRequest;
-
- return (*ProcIVector[stuff->data])(client);
-}
-
-/*******************************************************************************
- *
- * SProcXDispatch
- *
- * Main swapped dispatch routine for requests to this extension.
- * This routine is used if server and client do not have the same byte ordering.
- *
- */
-
-static int
-SProcIDispatch(ClientPtr client)
-{
- REQUEST(xReq);
- if (stuff->data > IREQUESTS || !SProcIVector[stuff->data])
- return BadRequest;
-
- return (*SProcIVector[stuff->data])(client);
-}
-
-/**********************************************************************
- *
- * SReplyIDispatch
- * Swap any replies defined in this extension.
- *
- */
-
-static void
-SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
- /* All we look at is the type field */
-{ /* This is common to all replies */
- if (rep->RepType == X_GetExtensionVersion)
- SRepXGetExtensionVersion(client, len,
- (xGetExtensionVersionReply *) rep);
- else if (rep->RepType == X_ListInputDevices)
- SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep);
- else if (rep->RepType == X_OpenDevice)
- SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep);
- else if (rep->RepType == X_SetDeviceMode)
- SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep);
- else if (rep->RepType == X_GetSelectedExtensionEvents)
- SRepXGetSelectedExtensionEvents(client, len,
- (xGetSelectedExtensionEventsReply *)
- rep);
- else if (rep->RepType == X_GetDeviceDontPropagateList)
- SRepXGetDeviceDontPropagateList(client, len,
- (xGetDeviceDontPropagateListReply *)
- rep);
- else if (rep->RepType == X_GetDeviceMotionEvents)
- SRepXGetDeviceMotionEvents(client, len,
- (xGetDeviceMotionEventsReply *) rep);
- else if (rep->RepType == X_GrabDevice)
- SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep);
- else if (rep->RepType == X_GetDeviceFocus)
- SRepXGetDeviceFocus(client, len, (xGetDeviceFocusReply *) rep);
- else if (rep->RepType == X_GetFeedbackControl)
- SRepXGetFeedbackControl(client, len, (xGetFeedbackControlReply *) rep);
- else if (rep->RepType == X_GetDeviceKeyMapping)
- SRepXGetDeviceKeyMapping(client, len,
- (xGetDeviceKeyMappingReply *) rep);
- else if (rep->RepType == X_GetDeviceModifierMapping)
- SRepXGetDeviceModifierMapping(client, len,
- (xGetDeviceModifierMappingReply *) rep);
- else if (rep->RepType == X_SetDeviceModifierMapping)
- SRepXSetDeviceModifierMapping(client, len,
- (xSetDeviceModifierMappingReply *) rep);
- else if (rep->RepType == X_GetDeviceButtonMapping)
- SRepXGetDeviceButtonMapping(client, len,
- (xGetDeviceButtonMappingReply *) rep);
- else if (rep->RepType == X_SetDeviceButtonMapping)
- SRepXSetDeviceButtonMapping(client, len,
- (xSetDeviceButtonMappingReply *) rep);
- else if (rep->RepType == X_QueryDeviceState)
- SRepXQueryDeviceState(client, len, (xQueryDeviceStateReply *) rep);
- else if (rep->RepType == X_SetDeviceValuators)
- SRepXSetDeviceValuators(client, len, (xSetDeviceValuatorsReply *) rep);
- else if (rep->RepType == X_GetDeviceControl)
- SRepXGetDeviceControl(client, len, (xGetDeviceControlReply *) rep);
- else if (rep->RepType == X_ChangeDeviceControl)
- SRepXChangeDeviceControl(client, len,
- (xChangeDeviceControlReply *) rep);
- else if (rep->RepType == X_ListDeviceProperties)
- SRepXListDeviceProperties(client, len, (xListDevicePropertiesReply*)rep);
- else if (rep->RepType == X_GetDeviceProperty)
- SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep);
- else if (rep->RepType == X_XIQueryPointer)
- SRepXIQueryPointer(client, len, (xXIQueryPointerReply *) rep);
- else if (rep->RepType == X_XIGetClientPointer)
- SRepXIGetClientPointer(client, len, (xXIGetClientPointerReply*) rep);
- else if (rep->RepType == X_XIQueryVersion)
- SRepXIQueryVersion(client, len, (xXIQueryVersionReply*)rep);
- else if (rep->RepType == X_XIQueryDevice)
- SRepXIQueryDevice(client, len, (xXIQueryDeviceReply*)rep);
- else if (rep->RepType == X_XIGrabDevice)
- SRepXIGrabDevice(client, len, (xXIGrabDeviceReply *) rep);
- else if (rep->RepType == X_XIGrabDevice)
- SRepXIPassiveGrabDevice(client, len, (xXIPassiveGrabDeviceReply *) rep);
- else if (rep->RepType == X_XIListProperties)
- SRepXIListProperties(client, len, (xXIListPropertiesReply *) rep);
- else if (rep->RepType == X_XIGetProperty)
- SRepXIGetProperty(client, len, (xXIGetPropertyReply *) rep);
- else if (rep->RepType == X_XIGetSelectedEvents)
- SRepXIGetSelectedEvents(client, len, (xXIGetSelectedEventsReply *) rep);
- else if (rep->RepType == X_XIGetFocus)
- SRepXIGetFocus(client, len, (xXIGetFocusReply *) rep);
- else {
- FatalError("XINPUT confused sending swapped reply");
- }
-}
-
-/************************************************************************
- *
- * This function swaps the DeviceValuator event.
- *
- */
-
-static void
-SEventDeviceValuator(deviceValuator * from, deviceValuator * to)
-{
- char n;
- int i;
- INT32 *ip B32;
-
- *to = *from;
- swaps(&to->sequenceNumber, n);
- swaps(&to->device_state, n);
- ip = &to->valuator0;
- for (i = 0; i < 6; i++) {
- swapl((ip + i), n); /* macro - braces are required */
- }
-}
-
-static void
-SEventFocus(deviceFocus * from, deviceFocus * to)
-{
- char n;
-
- *to = *from;
- swaps(&to->sequenceNumber, n);
- swapl(&to->time, n);
- swapl(&to->window, n);
-}
-
-static void
-SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to)
-{
- int i;
- char n;
- INT32 *ip B32;
-
- *to = *from;
- swaps(&to->sequenceNumber, n);
- swapl(&to->time, n);
- ip = &to->valuator0;
- for (i = 0; i < 3; i++) {
- swapl((ip + i), n); /* macro - braces are required */
- }
-}
-
-static void
-SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from,
- deviceKeyStateNotify * to)
-{
- char n;
-
- *to = *from;
- swaps(&to->sequenceNumber, n);
-}
-
-static void
-SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from,
- deviceButtonStateNotify * to)
-{
- char n;
-
- *to = *from;
- swaps(&to->sequenceNumber, n);
-}
-
-static void
-SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to)
-{
- char n;
-
- *to = *from;
- swaps(&to->sequenceNumber, n);
- swapl(&to->time, n);
-}
-
-static void
-SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to)
-{
- char n;
-
- *to = *from;
- swaps(&to->sequenceNumber, n);
- swapl(&to->time, n);
-}
-
-static void
-SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to)
-{
- char n;
-
- *to = *from;
- swaps(&to->sequenceNumber,n);
- swapl(&to->time, n);
- swaps(&to->control, n);
-}
-
-static void
-SDevicePropertyNotifyEvent (devicePropertyNotify *from, devicePropertyNotify *to)
-{
- char n;
-
- *to = *from;
- swaps(&to->sequenceNumber,n);
- swapl(&to->time, n);
- swapl(&to->atom, n);
-}
-
-static void
-SDeviceLeaveNotifyEvent (xXILeaveEvent *from, xXILeaveEvent *to)
-{
- char n;
-
- *to = *from;
- swaps(&to->sequenceNumber,n);
- swapl(&to->length, n);
- swaps(&to->evtype, n);
- swaps(&to->deviceid, n);
- swapl(&to->time, n);
- swapl(&to->root, n);
- swapl(&to->event, n);
- swapl(&to->child, n);
- swapl(&to->root_x, n);
- swapl(&to->root_y, n);
- swapl(&to->event_x, n);
- swapl(&to->event_y, n);
- swaps(&to->sourceid, n);
- swaps(&to->buttons_len, n);
- swapl(&to->mods.base_mods, n);
- swapl(&to->mods.latched_mods, n);
- swapl(&to->mods.locked_mods, n);
-}
-
-static void
-SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
-{
- char n;
- int i, j;
- xXIAnyInfo *any;
-
- *to = *from;
- memcpy(&to[1], &from[1], from->length * 4);
-
- any = (xXIAnyInfo*)&to[1];
- for (i = 0; i < to->num_classes; i++)
- {
- int length = any->length;
-
- switch(any->type)
- {
- case KeyClass:
- {
- xXIKeyInfo *ki = (xXIKeyInfo*)any;
- uint32_t *key = (uint32_t*)&ki[1];
- for (j = 0; j < ki->num_keycodes; j++, key++)
- swapl(key, n);
- swaps(&ki->num_keycodes, n);
- }
- break;
- case ButtonClass:
- {
- xXIButtonInfo *bi = (xXIButtonInfo*)any;
- Atom *labels = (Atom*)((char*)bi + sizeof(xXIButtonInfo) +
- pad_to_int32(bits_to_bytes(bi->num_buttons)));
- for (j = 0; j < bi->num_buttons; j++)
- swapl(&labels[j], n);
- swaps(&bi->num_buttons, n);
- }
- break;
- case ValuatorClass:
- {
- xXIValuatorInfo* ai = (xXIValuatorInfo*)any;
- swapl(&ai->label, n);
- swapl(&ai->min.integral, n);
- swapl(&ai->min.frac, n);
- swapl(&ai->max.integral, n);
- swapl(&ai->max.frac, n);
- swapl(&ai->resolution, n);
- swaps(&ai->number, n);
- }
- break;
- }
-
- swaps(&any->type, n);
- swaps(&any->length, n);
- swaps(&any->sourceid, n);
-
- any = (xXIAnyInfo*)((char*)any + length * 4);
- }
-
- swaps(&to->sequenceNumber, n);
- swapl(&to->length, n);
- swaps(&to->evtype, n);
- swaps(&to->deviceid, n);
- swapl(&to->time, n);
- swaps(&to->num_classes, n);
- swaps(&to->sourceid, n);
-
-}
-
-static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
-{
- int i;
- char n;
- char *ptr;
- char *vmask;
-
- memcpy(to, from, sizeof(xEvent) + from->length * 4);
-
- swaps(&to->sequenceNumber, n);
- swapl(&to->length, n);
- swaps(&to->evtype, n);
- swaps(&to->deviceid, n);
- swapl(&to->time, n);
- swapl(&to->detail, n);
- swapl(&to->root, n);
- swapl(&to->event, n);
- swapl(&to->child, n);
- swapl(&to->root_x, n);
- swapl(&to->root_y, n);
- swapl(&to->event_x, n);
- swapl(&to->event_y, n);
- swaps(&to->buttons_len, n);
- swaps(&to->valuators_len, n);
- swaps(&to->sourceid, n);
- swapl(&to->mods.base_mods, n);
- swapl(&to->mods.latched_mods, n);
- swapl(&to->mods.locked_mods, n);
- swapl(&to->mods.effective_mods, n);
- swapl(&to->flags, n);
-
- ptr = (char*)(&to[1]);
- ptr += from->buttons_len * 4;
- vmask = ptr; /* valuator mask */
- ptr += from->valuators_len * 4;
- for (i = 0; i < from->valuators_len * 32; i++)
- {
- if (BitIsOn(vmask, i))
- {
- swapl(((uint32_t*)ptr), n);
- ptr += 4;
- swapl(((uint32_t*)ptr), n);
- ptr += 4;
- }
- }
-}
-
-static void SDeviceHierarchyEvent(xXIHierarchyEvent *from,
- xXIHierarchyEvent *to)
-{
- int i;
- char n;
- xXIHierarchyInfo *info;
-
- *to = *from;
- memcpy(&to[1], &from[1], from->length * 4);
- swaps(&to->sequenceNumber, n);
- swapl(&to->length, n);
- swaps(&to->evtype, n);
- swaps(&to->deviceid, n);
- swapl(&to->time, n);
- swapl(&to->flags, n);
- swaps(&to->num_info, n);
-
- info = (xXIHierarchyInfo*)&to[1];
- for (i = 0; i< from->num_info; i++)
- {
- swaps(&info->deviceid, n);
- swaps(&info->attachment, n);
- info++;
- }
-}
-
-static void SXIPropertyEvent(xXIPropertyEvent *from, xXIPropertyEvent *to)
-{
- char n;
-
- *to = *from;
- swaps(&to->sequenceNumber, n);
- swapl(&to->length, n);
- swaps(&to->evtype, n);
- swaps(&to->deviceid, n);
- swapl(&to->property, n);
-}
-
-static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to)
-{
- char n;
- int i;
- FP3232 *values;
- unsigned char *mask;
-
- memcpy(to, from, sizeof(xEvent) + from->length * 4);
-
- swaps(&to->sequenceNumber, n);
- swapl(&to->length, n);
- swaps(&to->evtype, n);
- swaps(&to->deviceid, n);
- swapl(&to->time, n);
- swapl(&to->detail, n);
-
-
- mask = (unsigned char*)&to[1];
- values = (FP3232*)(mask + from->valuators_len * 4);
-
- for (i = 0; i < from->valuators_len * 4 * 8; i++)
- {
- if (BitIsOn(mask, i))
- {
- /* for each bit set there are two FP3232 values on the wire, in
- * the order abcABC for data and data_raw. Here we swap as if
- * they were in aAbBcC order because it's easier and really
- * doesn't matter.
- */
- swapl(&values->integral, n);
- swapl(&values->frac, n);
- values++;
- swapl(&values->integral, n);
- swapl(&values->frac, n);
- values++;
- }
- }
-
- swaps(&to->valuators_len, n);
-}
-
-
-/** Event swapping function for XI2 events. */
-void
-XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
-{
- switch(from->evtype)
- {
- case XI_Enter:
- case XI_Leave:
- SDeviceLeaveNotifyEvent((xXILeaveEvent*)from, (xXILeaveEvent*)to);
- break;
- case XI_DeviceChanged:
- SDeviceChangedEvent((xXIDeviceChangedEvent*)from,
- (xXIDeviceChangedEvent*)to);
- break;
- case XI_HierarchyChanged:
- SDeviceHierarchyEvent((xXIHierarchyEvent*)from, (xXIHierarchyEvent*)to);
- break;
- case XI_PropertyEvent:
- SXIPropertyEvent((xXIPropertyEvent*)from,
- (xXIPropertyEvent*)to);
- break;
- case XI_Motion:
- case XI_KeyPress:
- case XI_KeyRelease:
- case XI_ButtonPress:
- case XI_ButtonRelease:
- SDeviceEvent((xXIDeviceEvent*)from, (xXIDeviceEvent*)to);
- break;
- case XI_RawMotion:
- case XI_RawKeyPress:
- case XI_RawKeyRelease:
- case XI_RawButtonPress:
- case XI_RawButtonRelease:
- SRawEvent((xXIRawEvent*)from, (xXIRawEvent*)to);
- break;
- default:
- ErrorF("[Xi] Unknown event type to swap. This is a bug.\n");
- break;
- }
-}
-
-/**************************************************************************
- *
- * Allow the specified event to have its propagation suppressed.
- * The default is to not allow suppression of propagation.
- *
- */
-
-static void
-AllowPropagateSuppress(Mask mask)
-{
- int i;
-
- for (i = 0; i < MAXDEVICES; i++)
- PropagateMask[i] |= mask;
-}
-
-/**************************************************************************
- *
- * Record an event mask where there is no unique corresponding event type.
- * We can't call SetMaskForEvent, since that would clobber the existing
- * mask for that event. MotionHint and ButtonMotion are examples.
- *
- * Since extension event types will never be less than 64, we can use
- * 0-63 in the EventInfo array as the "type" to be used to look up this
- * mask. This means that the corresponding macros such as
- * DevicePointerMotionHint must have access to the same constants.
- *
- */
-
-static void
-SetEventInfo(Mask mask, int constant)
-{
- EventInfo[ExtEventIndex].mask = mask;
- EventInfo[ExtEventIndex++].type = constant;
-}
-
-/**************************************************************************
- *
- * Allow the specified event to be restricted to being selected by one
- * client at a time.
- * The default is to allow more than one client to select the event.
- *
- */
-
-static void
-SetExclusiveAccess(Mask mask)
-{
- int i;
-
- for (i = 0; i < MAXDEVICES; i++)
- ExtExclusiveMasks[i] |= mask;
-}
-
-/**************************************************************************
- *
- * Assign the specified mask to the specified event.
- *
- */
-
-static void
-SetMaskForExtEvent(Mask mask, int event)
-{
- int i;
-
- EventInfo[ExtEventIndex].mask = mask;
- EventInfo[ExtEventIndex++].type = event;
-
- if ((event < LASTEvent) || (event >= 128))
- FatalError("MaskForExtensionEvent: bogus event number");
-
- for (i = 0; i < MAXDEVICES; i++)
- SetMaskForEvent(i, mask, event);
-}
-
-/************************************************************************
- *
- * This function sets up extension event types and masks.
- *
- */
-
-static void
-FixExtensionEvents(ExtensionEntry * extEntry)
-{
- DeviceValuator = extEntry->eventBase;
- DeviceKeyPress = DeviceValuator + 1;
- DeviceKeyRelease = DeviceKeyPress + 1;
- DeviceButtonPress = DeviceKeyRelease + 1;
- DeviceButtonRelease = DeviceButtonPress + 1;
- DeviceMotionNotify = DeviceButtonRelease + 1;
- DeviceFocusIn = DeviceMotionNotify + 1;
- DeviceFocusOut = DeviceFocusIn + 1;
- ProximityIn = DeviceFocusOut + 1;
- ProximityOut = ProximityIn + 1;
- DeviceStateNotify = ProximityOut + 1;
- DeviceMappingNotify = DeviceStateNotify + 1;
- ChangeDeviceNotify = DeviceMappingNotify + 1;
- DeviceKeyStateNotify = ChangeDeviceNotify + 1;
- DeviceButtonStateNotify = DeviceKeyStateNotify + 1;
- DevicePresenceNotify = DeviceButtonStateNotify + 1;
- DevicePropertyNotify = DevicePresenceNotify + 1;
-
- event_base[KeyClass] = DeviceKeyPress;
- event_base[ButtonClass] = DeviceButtonPress;
- event_base[ValuatorClass] = DeviceMotionNotify;
- event_base[ProximityClass] = ProximityIn;
- event_base[FocusClass] = DeviceFocusIn;
- event_base[OtherClass] = DeviceStateNotify;
-
- BadDevice += extEntry->errorBase;
- BadEvent += extEntry->errorBase;
- BadMode += extEntry->errorBase;
- DeviceBusy += extEntry->errorBase;
- BadClass += extEntry->errorBase;
-
- SetMaskForExtEvent(DeviceKeyPressMask, DeviceKeyPress);
- AllowPropagateSuppress(DeviceKeyPressMask);
- SetCriticalEvent(DeviceKeyPress);
-
- SetMaskForExtEvent(DeviceKeyReleaseMask, DeviceKeyRelease);
- AllowPropagateSuppress(DeviceKeyReleaseMask);
- SetCriticalEvent(DeviceKeyRelease);
-
- SetMaskForExtEvent(DeviceButtonPressMask, DeviceButtonPress);
- AllowPropagateSuppress(DeviceButtonPressMask);
- SetCriticalEvent(DeviceButtonPress);
-
- SetMaskForExtEvent(DeviceButtonReleaseMask, DeviceButtonRelease);
- AllowPropagateSuppress(DeviceButtonReleaseMask);
- SetCriticalEvent(DeviceButtonRelease);
-
- SetMaskForExtEvent(DeviceProximityMask, ProximityIn);
- SetMaskForExtEvent(DeviceProximityMask, ProximityOut);
-
- SetMaskForExtEvent(DeviceStateNotifyMask, DeviceStateNotify);
-
- SetMaskForExtEvent(DevicePointerMotionMask, DeviceMotionNotify);
- AllowPropagateSuppress(DevicePointerMotionMask);
- SetCriticalEvent(DeviceMotionNotify);
-
- SetEventInfo(DevicePointerMotionHintMask, _devicePointerMotionHint);
- SetEventInfo(DeviceButton1MotionMask, _deviceButton1Motion);
- SetEventInfo(DeviceButton2MotionMask, _deviceButton2Motion);
- SetEventInfo(DeviceButton3MotionMask, _deviceButton3Motion);
- SetEventInfo(DeviceButton4MotionMask, _deviceButton4Motion);
- SetEventInfo(DeviceButton5MotionMask, _deviceButton5Motion);
- SetEventInfo(DeviceButtonMotionMask, _deviceButtonMotion);
-
- SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusIn);
- SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusOut);
-
- SetMaskForExtEvent(DeviceMappingNotifyMask, DeviceMappingNotify);
- SetMaskForExtEvent(ChangeDeviceNotifyMask, ChangeDeviceNotify);
-
- SetEventInfo(DeviceButtonGrabMask, _deviceButtonGrab);
- SetExclusiveAccess(DeviceButtonGrabMask);
-
- SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton);
- SetEventInfo(DevicePresenceNotifyMask, _devicePresence);
- SetMaskForExtEvent(DevicePropertyNotifyMask, DevicePropertyNotify);
-
- SetEventInfo(0, _noExtensionEvent);
-}
-
-/************************************************************************
- *
- * This function restores extension event types and masks to their
- * initial state.
- *
- */
-
-static void
-RestoreExtensionEvents(void)
-{
- int i, j;
-
- IReqCode = 0;
- IEventBase = 0;
-
- for (i = 0; i < ExtEventIndex - 1; i++) {
- if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128))
- {
- for (j = 0; j < MAXDEVICES; j++)
- SetMaskForEvent(j, 0, EventInfo[i].type);
- }
- EventInfo[i].mask = 0;
- EventInfo[i].type = 0;
- }
- ExtEventIndex = 0;
- DeviceValuator = 0;
- DeviceKeyPress = 1;
- DeviceKeyRelease = 2;
- DeviceButtonPress = 3;
- DeviceButtonRelease = 4;
- DeviceMotionNotify = 5;
- DeviceFocusIn = 6;
- DeviceFocusOut = 7;
- ProximityIn = 8;
- ProximityOut = 9;
- DeviceStateNotify = 10;
- DeviceMappingNotify = 11;
- ChangeDeviceNotify = 12;
- DeviceKeyStateNotify = 13;
- DeviceButtonStateNotify = 13;
- DevicePresenceNotify = 14;
- DevicePropertyNotify = 15;
-
- BadDevice = 0;
- BadEvent = 1;
- BadMode = 2;
- DeviceBusy = 3;
- BadClass = 4;
-
-}
-
-/***********************************************************************
- *
- * IResetProc.
- * Remove reply-swapping routine.
- * Remove event-swapping routine.
- *
- */
-
-static void
-IResetProc(ExtensionEntry * unused)
-{
- ReplySwapVector[IReqCode] = ReplyNotSwappd;
- EventSwapVector[DeviceValuator] = NotImplemented;
- EventSwapVector[DeviceKeyPress] = NotImplemented;
- EventSwapVector[DeviceKeyRelease] = NotImplemented;
- EventSwapVector[DeviceButtonPress] = NotImplemented;
- EventSwapVector[DeviceButtonRelease] = NotImplemented;
- EventSwapVector[DeviceMotionNotify] = NotImplemented;
- EventSwapVector[DeviceFocusIn] = NotImplemented;
- EventSwapVector[DeviceFocusOut] = NotImplemented;
- EventSwapVector[ProximityIn] = NotImplemented;
- EventSwapVector[ProximityOut] = NotImplemented;
- EventSwapVector[DeviceStateNotify] = NotImplemented;
- EventSwapVector[DeviceKeyStateNotify] = NotImplemented;
- EventSwapVector[DeviceButtonStateNotify] = NotImplemented;
- EventSwapVector[DeviceMappingNotify] = NotImplemented;
- EventSwapVector[ChangeDeviceNotify] = NotImplemented;
- EventSwapVector[DevicePresenceNotify] = NotImplemented;
- EventSwapVector[DevicePropertyNotify] = NotImplemented;
- RestoreExtensionEvents();
-}
-
-
-/***********************************************************************
- *
- * Assign an id and type to an input device.
- *
- */
-
-void
-AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name)
-{
- dev->xinput_type = type;
- dev->name = strdup(name);
-}
-
-/***********************************************************************
- *
- * Make device type atoms.
- *
- */
-
-static void
-MakeDeviceTypeAtoms(void)
-{
- int i;
-
- for (i = 0; i < NUMTYPES; i++)
- dev_type[i].type =
- MakeAtom(dev_type[i].name, strlen(dev_type[i].name), 1);
-}
-
-/*****************************************************************************
- *
- * SEventIDispatch
- *
- * Swap any events defined in this extension.
- */
-#define DO_SWAP(func,type) func ((type *)from, (type *)to)
-
-static void
-SEventIDispatch(xEvent * from, xEvent * to)
-{
- int type = from->u.u.type & 0177;
-
- if (type == DeviceValuator)
- DO_SWAP(SEventDeviceValuator, deviceValuator);
- else if (type == DeviceKeyPress) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceKeyRelease) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceButtonPress) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceButtonRelease) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceMotionNotify) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceFocusIn)
- DO_SWAP(SEventFocus, deviceFocus);
- else if (type == DeviceFocusOut)
- DO_SWAP(SEventFocus, deviceFocus);
- else if (type == ProximityIn) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == ProximityOut) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceStateNotify)
- DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
- else if (type == DeviceKeyStateNotify)
- DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
- else if (type == DeviceButtonStateNotify)
- DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify);
- else if (type == DeviceMappingNotify)
- DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
- else if (type == ChangeDeviceNotify)
- DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
- else if (type == DevicePresenceNotify)
- DO_SWAP(SDevicePresenceNotifyEvent, devicePresenceNotify);
- else if (type == DevicePropertyNotify)
- DO_SWAP(SDevicePropertyNotifyEvent, devicePropertyNotify);
- else {
- FatalError("XInputExtension: Impossible event!\n");
- }
-}
-
-/**********************************************************************
- *
- * IExtensionInit - initialize the input extension.
- *
- * Called from InitExtensions in main() or from QueryExtension() if the
- * extension is dynamically loaded.
- *
- * This extension has several events and errors.
- *
- * XI is mandatory nowadays, so if we fail to init XI, we die.
- */
-
-void
-XInputExtensionInit(void)
-{
- ExtensionEntry *extEntry;
- XExtensionVersion thisversion = { XI_Present,
- SERVER_XI_MAJOR_VERSION,
- SERVER_XI_MINOR_VERSION,
- };
-
- if (!dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec)))
- FatalError("Cannot request private for XI.\n");
-
- if (!AddCallback(&ClientStateCallback, XIClientCallback, 0))
- FatalError("Failed to add callback to XI.\n");
-
- extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
- SProcIDispatch, IResetProc, StandardMinorOpcode);
- if (extEntry) {
- IReqCode = extEntry->base;
- IEventBase = extEntry->eventBase;
- XIVersion = thisversion;
- MakeDeviceTypeAtoms();
- RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone,
- "INPUTCLIENT");
- if (!RT_INPUTCLIENT)
- FatalError("Failed to add resource type for XI.\n");
- FixExtensionEvents(extEntry);
- ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch;
- EventSwapVector[DeviceValuator] = SEventIDispatch;
- EventSwapVector[DeviceKeyPress] = SEventIDispatch;
- EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
- EventSwapVector[DeviceButtonPress] = SEventIDispatch;
- EventSwapVector[DeviceButtonRelease] = SEventIDispatch;
- EventSwapVector[DeviceMotionNotify] = SEventIDispatch;
- EventSwapVector[DeviceFocusIn] = SEventIDispatch;
- EventSwapVector[DeviceFocusOut] = SEventIDispatch;
- EventSwapVector[ProximityIn] = SEventIDispatch;
- EventSwapVector[ProximityOut] = SEventIDispatch;
- EventSwapVector[DeviceStateNotify] = SEventIDispatch;
- EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch;
- EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch;
- EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
- EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
- EventSwapVector[DevicePresenceNotify] = SEventIDispatch;
-
- GERegisterExtension(IReqCode, XI2EventSwap);
-
-
- memset(&xi_all_devices, 0, sizeof(xi_all_devices));
- memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices));
- xi_all_devices.id = XIAllDevices;
- xi_all_devices.name = "XIAllDevices";
- xi_all_master_devices.id = XIAllMasterDevices;
- xi_all_master_devices.name = "XIAllMasterDevices";
-
- inputInfo.all_devices = &xi_all_devices;
- inputInfo.all_master_devices = &xi_all_master_devices;
-
- XIResetProperties();
- } else {
- FatalError("IExtensionInit: AddExtensions failed\n");
- }
-}
-
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+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.
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/********************************************************************
+ *
+ * Dispatch routines and initialization routines for the X input extension.
+ *
+ */
+
+#define NUMTYPES 15
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "inputstr.h"
+#include "gcstruct.h" /* pointer for extnsionst.h */
+#include "extnsionst.h" /* extension entry */
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/extensions/geproto.h>
+#include "geext.h" /* extension interfaces for ge */
+
+#include "dixevents.h"
+#include "exevents.h"
+#include "extinit.h"
+#include "exglobals.h"
+#include "swaprep.h"
+#include "privates.h"
+#include "protocol-versions.h"
+
+/* modules local to Xi */
+#include "allowev.h"
+#include "chgdctl.h"
+#include "chgfctl.h"
+#include "chgkbd.h"
+#include "chgprop.h"
+#include "chgptr.h"
+#include "closedev.h"
+#include "devbell.h"
+#include "getbmap.h"
+#include "getbmap.h"
+#include "getdctl.h"
+#include "getfctl.h"
+#include "getfocus.h"
+#include "getkmap.h"
+#include "getmmap.h"
+#include "getprop.h"
+#include "getselev.h"
+#include "getvers.h"
+#include "getvers.h"
+#include "grabdev.h"
+#include "grabdevb.h"
+#include "grabdevk.h"
+#include "gtmotion.h"
+#include "listdev.h"
+#include "opendev.h"
+#include "queryst.h"
+#include "selectev.h"
+#include "sendexev.h"
+#include "chgkmap.h"
+#include "setbmap.h"
+#include "setdval.h"
+#include "setfocus.h"
+#include "setmmap.h"
+#include "setmode.h"
+#include "ungrdev.h"
+#include "ungrdevb.h"
+#include "ungrdevk.h"
+#include "xiallowev.h"
+#include "xiselectev.h"
+#include "xigrabdev.h"
+#include "xipassivegrab.h"
+#include "xisetdevfocus.h"
+#include "xiproperty.h"
+#include "xichangecursor.h"
+#include "xichangehierarchy.h"
+#include "xigetclientpointer.h"
+#include "xiquerydevice.h"
+#include "xiquerypointer.h"
+#include "xiqueryversion.h"
+#include "xisetclientpointer.h"
+#include "xiwarppointer.h"
+
+
+/* Masks for XI events have to be aligned with core event (partially anyway).
+ * If DeviceButtonMotionMask is != ButtonMotionMask, event delivery
+ * breaks down. The device needs the dev->button->motionMask. If DBMM is
+ * the same as BMM, we can ensure that both core and device events can be
+ * delivered, without the need for extra structures in the DeviceIntRec. */
+const Mask DeviceKeyPressMask = KeyPressMask;
+const Mask DeviceKeyReleaseMask = KeyReleaseMask;
+const Mask DeviceButtonPressMask = ButtonPressMask;
+const Mask DeviceButtonReleaseMask = ButtonReleaseMask;
+const Mask DeviceProximityMask = (1L << 4);
+const Mask DeviceStateNotifyMask = (1L << 5);
+const Mask DevicePointerMotionMask = PointerMotionMask;
+const Mask DevicePointerMotionHintMask = PointerMotionHintMask;
+const Mask DeviceButton1MotionMask = Button1MotionMask;
+const Mask DeviceButton2MotionMask = Button2MotionMask;
+const Mask DeviceButton3MotionMask = Button3MotionMask;
+const Mask DeviceButton4MotionMask = Button4MotionMask;
+const Mask DeviceButton5MotionMask = Button5MotionMask;
+const Mask DeviceButtonMotionMask = ButtonMotionMask;
+const Mask DeviceFocusChangeMask = (1L << 14);
+const Mask DeviceMappingNotifyMask = (1L << 15);
+const Mask ChangeDeviceNotifyMask = (1L << 16);
+const Mask DeviceButtonGrabMask = (1L << 17);
+const Mask DeviceOwnerGrabButtonMask = (1L << 17);
+const Mask DevicePresenceNotifyMask = (1L << 18);
+const Mask DeviceEnterWindowMask = (1L << 18);
+const Mask DeviceLeaveWindowMask = (1L << 19);
+const Mask DevicePropertyNotifyMask = (1L << 20);
+const Mask XIAllMasks = (1L << 21) - 1;
+
+int ExtEventIndex;
+Mask ExtExclusiveMasks[EMASKSIZE];
+
+static struct dev_type
+{
+ Atom type;
+ char *name;
+} dev_type[] = {
+ {
+ 0, XI_KEYBOARD}, {
+ 0, XI_MOUSE}, {
+ 0, XI_TABLET}, {
+ 0, XI_TOUCHSCREEN}, {
+ 0, XI_TOUCHPAD}, {
+ 0, XI_BARCODE}, {
+ 0, XI_BUTTONBOX}, {
+ 0, XI_KNOB_BOX}, {
+ 0, XI_ONE_KNOB}, {
+ 0, XI_NINE_KNOB}, {
+ 0, XI_TRACKBALL}, {
+ 0, XI_QUADRATURE}, {
+ 0, XI_ID_MODULE}, {
+ 0, XI_SPACEBALL}, {
+ 0, XI_DATAGLOVE}, {
+ 0, XI_EYETRACKER}, {
+ 0, XI_CURSORKEYS}, {
+0, XI_FOOTMOUSE}};
+
+CARD8 event_base[numInputClasses];
+XExtEventInfo EventInfo[32];
+
+static DeviceIntRec xi_all_devices;
+static DeviceIntRec xi_all_master_devices;
+
+/**
+ * Dispatch vector. Functions defined in here will be called when the matching
+ * request arrives.
+ */
+static int (*ProcIVector[])(ClientPtr) = {
+ NULL, /* 0 */
+ ProcXGetExtensionVersion, /* 1 */
+ ProcXListInputDevices, /* 2 */
+ ProcXOpenDevice, /* 3 */
+ ProcXCloseDevice, /* 4 */
+ ProcXSetDeviceMode, /* 5 */
+ ProcXSelectExtensionEvent, /* 6 */
+ ProcXGetSelectedExtensionEvents, /* 7 */
+ ProcXChangeDeviceDontPropagateList, /* 8 */
+ ProcXGetDeviceDontPropagateList, /* 9 */
+ ProcXGetDeviceMotionEvents, /* 10 */
+ ProcXChangeKeyboardDevice, /* 11 */
+ ProcXChangePointerDevice, /* 12 */
+ ProcXGrabDevice, /* 13 */
+ ProcXUngrabDevice, /* 14 */
+ ProcXGrabDeviceKey, /* 15 */
+ ProcXUngrabDeviceKey, /* 16 */
+ ProcXGrabDeviceButton, /* 17 */
+ ProcXUngrabDeviceButton, /* 18 */
+ ProcXAllowDeviceEvents, /* 19 */
+ ProcXGetDeviceFocus, /* 20 */
+ ProcXSetDeviceFocus, /* 21 */
+ ProcXGetFeedbackControl, /* 22 */
+ ProcXChangeFeedbackControl, /* 23 */
+ ProcXGetDeviceKeyMapping, /* 24 */
+ ProcXChangeDeviceKeyMapping, /* 25 */
+ ProcXGetDeviceModifierMapping, /* 26 */
+ ProcXSetDeviceModifierMapping, /* 27 */
+ ProcXGetDeviceButtonMapping, /* 28 */
+ ProcXSetDeviceButtonMapping, /* 29 */
+ ProcXQueryDeviceState, /* 30 */
+ ProcXSendExtensionEvent, /* 31 */
+ ProcXDeviceBell, /* 32 */
+ ProcXSetDeviceValuators, /* 33 */
+ ProcXGetDeviceControl, /* 34 */
+ ProcXChangeDeviceControl, /* 35 */
+ /* XI 1.5 */
+ ProcXListDeviceProperties, /* 36 */
+ ProcXChangeDeviceProperty, /* 37 */
+ ProcXDeleteDeviceProperty, /* 38 */
+ ProcXGetDeviceProperty, /* 39 */
+ /* XI 2 */
+ ProcXIQueryPointer, /* 40 */
+ ProcXIWarpPointer, /* 41 */
+ ProcXIChangeCursor, /* 42 */
+ ProcXIChangeHierarchy, /* 43 */
+ ProcXISetClientPointer, /* 44 */
+ ProcXIGetClientPointer, /* 45 */
+ ProcXISelectEvents, /* 46 */
+ ProcXIQueryVersion, /* 47 */
+ ProcXIQueryDevice, /* 48 */
+ ProcXISetFocus, /* 49 */
+ ProcXIGetFocus, /* 50 */
+ ProcXIGrabDevice, /* 51 */
+ ProcXIUngrabDevice, /* 52 */
+ ProcXIAllowEvents, /* 53 */
+ ProcXIPassiveGrabDevice, /* 54 */
+ ProcXIPassiveUngrabDevice, /* 55 */
+ ProcXIListProperties, /* 56 */
+ ProcXIChangeProperty, /* 57 */
+ ProcXIDeleteProperty, /* 58 */
+ ProcXIGetProperty, /* 59 */
+ ProcXIGetSelectedEvents /* 60 */
+};
+
+/* For swapped clients */
+static int (*SProcIVector[])(ClientPtr) = {
+ NULL, /* 0 */
+ SProcXGetExtensionVersion, /* 1 */
+ SProcXListInputDevices, /* 2 */
+ SProcXOpenDevice, /* 3 */
+ SProcXCloseDevice, /* 4 */
+ SProcXSetDeviceMode, /* 5 */
+ SProcXSelectExtensionEvent, /* 6 */
+ SProcXGetSelectedExtensionEvents, /* 7 */
+ SProcXChangeDeviceDontPropagateList, /* 8 */
+ SProcXGetDeviceDontPropagateList, /* 9 */
+ SProcXGetDeviceMotionEvents, /* 10 */
+ SProcXChangeKeyboardDevice, /* 11 */
+ SProcXChangePointerDevice, /* 12 */
+ SProcXGrabDevice, /* 13 */
+ SProcXUngrabDevice, /* 14 */
+ SProcXGrabDeviceKey, /* 15 */
+ SProcXUngrabDeviceKey, /* 16 */
+ SProcXGrabDeviceButton, /* 17 */
+ SProcXUngrabDeviceButton, /* 18 */
+ SProcXAllowDeviceEvents, /* 19 */
+ SProcXGetDeviceFocus, /* 20 */
+ SProcXSetDeviceFocus, /* 21 */
+ SProcXGetFeedbackControl, /* 22 */
+ SProcXChangeFeedbackControl, /* 23 */
+ SProcXGetDeviceKeyMapping, /* 24 */
+ SProcXChangeDeviceKeyMapping, /* 25 */
+ SProcXGetDeviceModifierMapping, /* 26 */
+ SProcXSetDeviceModifierMapping, /* 27 */
+ SProcXGetDeviceButtonMapping, /* 28 */
+ SProcXSetDeviceButtonMapping, /* 29 */
+ SProcXQueryDeviceState, /* 30 */
+ SProcXSendExtensionEvent, /* 31 */
+ SProcXDeviceBell, /* 32 */
+ SProcXSetDeviceValuators, /* 33 */
+ SProcXGetDeviceControl, /* 34 */
+ SProcXChangeDeviceControl, /* 35 */
+ SProcXListDeviceProperties, /* 36 */
+ SProcXChangeDeviceProperty, /* 37 */
+ SProcXDeleteDeviceProperty, /* 38 */
+ SProcXGetDeviceProperty, /* 39 */
+ SProcXIQueryPointer, /* 40 */
+ SProcXIWarpPointer, /* 41 */
+ SProcXIChangeCursor, /* 42 */
+ SProcXIChangeHierarchy, /* 43 */
+ SProcXISetClientPointer, /* 44 */
+ SProcXIGetClientPointer, /* 45 */
+ SProcXISelectEvents, /* 46 */
+ SProcXIQueryVersion, /* 47 */
+ SProcXIQueryDevice, /* 48 */
+ SProcXISetFocus, /* 49 */
+ SProcXIGetFocus, /* 50 */
+ SProcXIGrabDevice, /* 51 */
+ SProcXIUngrabDevice, /* 52 */
+ SProcXIAllowEvents, /* 53 */
+ SProcXIPassiveGrabDevice, /* 54 */
+ SProcXIPassiveUngrabDevice, /* 55 */
+ SProcXIListProperties, /* 56 */
+ SProcXIChangeProperty, /* 57 */
+ SProcXIDeleteProperty, /* 58 */
+ SProcXIGetProperty, /* 59 */
+ SProcXIGetSelectedEvents /* 60 */
+};
+
+/*****************************************************************
+ *
+ * Globals referenced elsewhere in the server.
+ *
+ */
+
+int IReqCode = 0;
+int IEventBase = 0;
+int BadDevice = 0;
+static int BadEvent = 1;
+int BadMode = 2;
+int DeviceBusy = 3;
+int BadClass = 4;
+
+int DeviceValuator;
+int DeviceKeyPress;
+int DeviceKeyRelease;
+int DeviceButtonPress;
+int DeviceButtonRelease;
+int DeviceMotionNotify;
+int DeviceFocusIn;
+int DeviceFocusOut;
+int ProximityIn;
+int ProximityOut;
+int DeviceStateNotify;
+int DeviceKeyStateNotify;
+int DeviceButtonStateNotify;
+int DeviceMappingNotify;
+int ChangeDeviceNotify;
+int DevicePresenceNotify;
+int DevicePropertyNotify;
+
+RESTYPE RT_INPUTCLIENT;
+
+/*****************************************************************
+ *
+ * Externs defined elsewhere in the X server.
+ *
+ */
+
+extern XExtensionVersion XIVersion;
+
+
+Mask PropagateMask[MAXDEVICES];
+
+/*****************************************************************
+ *
+ * Versioning support
+ *
+ */
+
+DevPrivateKeyRec XIClientPrivateKeyRec;
+
+/*****************************************************************
+ *
+ * Declarations of local routines.
+ *
+ */
+
+static void
+XIClientCallback(CallbackListPtr *list,
+ pointer closure,
+ pointer data)
+{
+ NewClientInfoRec *clientinfo = (NewClientInfoRec*)data;
+ ClientPtr pClient = clientinfo->client;
+ XIClientPtr pXIClient;
+
+ pXIClient = dixLookupPrivate(&pClient->devPrivates, XIClientPrivateKey);
+ pXIClient->major_version = 0;
+ pXIClient->minor_version = 0;
+}
+
+/*************************************************************************
+ *
+ * ProcIDispatch - main dispatch routine for requests to this extension.
+ * This routine is used if server and client have the same byte ordering.
+ *
+ */
+
+static int
+ProcIDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+ if (stuff->data > (IREQUESTS + XI2REQUESTS) || !ProcIVector[stuff->data])
+ return BadRequest;
+
+ return (*ProcIVector[stuff->data])(client);
+}
+
+/*******************************************************************************
+ *
+ * SProcXDispatch
+ *
+ * Main swapped dispatch routine for requests to this extension.
+ * This routine is used if server and client do not have the same byte ordering.
+ *
+ */
+
+static int
+SProcIDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+ if (stuff->data > IREQUESTS || !SProcIVector[stuff->data])
+ return BadRequest;
+
+ return (*SProcIVector[stuff->data])(client);
+}
+
+/**********************************************************************
+ *
+ * SReplyIDispatch
+ * Swap any replies defined in this extension.
+ *
+ */
+
+static void
+SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
+ /* All we look at is the type field */
+{ /* This is common to all replies */
+ if (rep->RepType == X_GetExtensionVersion)
+ SRepXGetExtensionVersion(client, len,
+ (xGetExtensionVersionReply *) rep);
+ else if (rep->RepType == X_ListInputDevices)
+ SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep);
+ else if (rep->RepType == X_OpenDevice)
+ SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep);
+ else if (rep->RepType == X_SetDeviceMode)
+ SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep);
+ else if (rep->RepType == X_GetSelectedExtensionEvents)
+ SRepXGetSelectedExtensionEvents(client, len,
+ (xGetSelectedExtensionEventsReply *)
+ rep);
+ else if (rep->RepType == X_GetDeviceDontPropagateList)
+ SRepXGetDeviceDontPropagateList(client, len,
+ (xGetDeviceDontPropagateListReply *)
+ rep);
+ else if (rep->RepType == X_GetDeviceMotionEvents)
+ SRepXGetDeviceMotionEvents(client, len,
+ (xGetDeviceMotionEventsReply *) rep);
+ else if (rep->RepType == X_GrabDevice)
+ SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep);
+ else if (rep->RepType == X_GetDeviceFocus)
+ SRepXGetDeviceFocus(client, len, (xGetDeviceFocusReply *) rep);
+ else if (rep->RepType == X_GetFeedbackControl)
+ SRepXGetFeedbackControl(client, len, (xGetFeedbackControlReply *) rep);
+ else if (rep->RepType == X_GetDeviceKeyMapping)
+ SRepXGetDeviceKeyMapping(client, len,
+ (xGetDeviceKeyMappingReply *) rep);
+ else if (rep->RepType == X_GetDeviceModifierMapping)
+ SRepXGetDeviceModifierMapping(client, len,
+ (xGetDeviceModifierMappingReply *) rep);
+ else if (rep->RepType == X_SetDeviceModifierMapping)
+ SRepXSetDeviceModifierMapping(client, len,
+ (xSetDeviceModifierMappingReply *) rep);
+ else if (rep->RepType == X_GetDeviceButtonMapping)
+ SRepXGetDeviceButtonMapping(client, len,
+ (xGetDeviceButtonMappingReply *) rep);
+ else if (rep->RepType == X_SetDeviceButtonMapping)
+ SRepXSetDeviceButtonMapping(client, len,
+ (xSetDeviceButtonMappingReply *) rep);
+ else if (rep->RepType == X_QueryDeviceState)
+ SRepXQueryDeviceState(client, len, (xQueryDeviceStateReply *) rep);
+ else if (rep->RepType == X_SetDeviceValuators)
+ SRepXSetDeviceValuators(client, len, (xSetDeviceValuatorsReply *) rep);
+ else if (rep->RepType == X_GetDeviceControl)
+ SRepXGetDeviceControl(client, len, (xGetDeviceControlReply *) rep);
+ else if (rep->RepType == X_ChangeDeviceControl)
+ SRepXChangeDeviceControl(client, len,
+ (xChangeDeviceControlReply *) rep);
+ else if (rep->RepType == X_ListDeviceProperties)
+ SRepXListDeviceProperties(client, len, (xListDevicePropertiesReply*)rep);
+ else if (rep->RepType == X_GetDeviceProperty)
+ SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep);
+ else if (rep->RepType == X_XIQueryPointer)
+ SRepXIQueryPointer(client, len, (xXIQueryPointerReply *) rep);
+ else if (rep->RepType == X_XIGetClientPointer)
+ SRepXIGetClientPointer(client, len, (xXIGetClientPointerReply*) rep);
+ else if (rep->RepType == X_XIQueryVersion)
+ SRepXIQueryVersion(client, len, (xXIQueryVersionReply*)rep);
+ else if (rep->RepType == X_XIQueryDevice)
+ SRepXIQueryDevice(client, len, (xXIQueryDeviceReply*)rep);
+ else if (rep->RepType == X_XIGrabDevice)
+ SRepXIGrabDevice(client, len, (xXIGrabDeviceReply *) rep);
+ else if (rep->RepType == X_XIGrabDevice)
+ SRepXIPassiveGrabDevice(client, len, (xXIPassiveGrabDeviceReply *) rep);
+ else if (rep->RepType == X_XIListProperties)
+ SRepXIListProperties(client, len, (xXIListPropertiesReply *) rep);
+ else if (rep->RepType == X_XIGetProperty)
+ SRepXIGetProperty(client, len, (xXIGetPropertyReply *) rep);
+ else if (rep->RepType == X_XIGetSelectedEvents)
+ SRepXIGetSelectedEvents(client, len, (xXIGetSelectedEventsReply *) rep);
+ else if (rep->RepType == X_XIGetFocus)
+ SRepXIGetFocus(client, len, (xXIGetFocusReply *) rep);
+ else {
+ FatalError("XINPUT confused sending swapped reply");
+ }
+}
+
+/************************************************************************
+ *
+ * This function swaps the DeviceValuator event.
+ *
+ */
+
+static void
+SEventDeviceValuator(deviceValuator * from, deviceValuator * to)
+{
+ char n;
+ int i;
+ INT32 *ip B32;
+
+ *to = *from;
+ swaps(&to->sequenceNumber, n);
+ swaps(&to->device_state, n);
+ ip = &to->valuator0;
+ for (i = 0; i < 6; i++) {
+ swapl((ip + i), n); /* macro - braces are required */
+ }
+}
+
+static void
+SEventFocus(deviceFocus * from, deviceFocus * to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->time, n);
+ swapl(&to->window, n);
+}
+
+static void
+SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to)
+{
+ int i;
+ char n;
+ INT32 *ip B32;
+
+ *to = *from;
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->time, n);
+ ip = &to->valuator0;
+ for (i = 0; i < 3; i++) {
+ swapl((ip + i), n); /* macro - braces are required */
+ }
+}
+
+static void
+SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from,
+ deviceKeyStateNotify * to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber, n);
+}
+
+static void
+SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from,
+ deviceButtonStateNotify * to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber, n);
+}
+
+static void
+SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->time, n);
+}
+
+static void
+SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->time, n);
+}
+
+static void
+SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber,n);
+ swapl(&to->time, n);
+ swaps(&to->control, n);
+}
+
+static void
+SDevicePropertyNotifyEvent (devicePropertyNotify *from, devicePropertyNotify *to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber,n);
+ swapl(&to->time, n);
+ swapl(&to->atom, n);
+}
+
+static void
+SDeviceLeaveNotifyEvent (xXILeaveEvent *from, xXILeaveEvent *to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber,n);
+ swapl(&to->length, n);
+ swaps(&to->evtype, n);
+ swaps(&to->deviceid, n);
+ swapl(&to->time, n);
+ swapl(&to->root, n);
+ swapl(&to->event, n);
+ swapl(&to->child, n);
+ swapl(&to->root_x, n);
+ swapl(&to->root_y, n);
+ swapl(&to->event_x, n);
+ swapl(&to->event_y, n);
+ swaps(&to->sourceid, n);
+ swaps(&to->buttons_len, n);
+ swapl(&to->mods.base_mods, n);
+ swapl(&to->mods.latched_mods, n);
+ swapl(&to->mods.locked_mods, n);
+}
+
+static void
+SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
+{
+ char n;
+ int i, j;
+ xXIAnyInfo *any;
+
+ *to = *from;
+ memcpy(&to[1], &from[1], from->length * 4);
+
+ any = (xXIAnyInfo*)&to[1];
+ for (i = 0; i < to->num_classes; i++)
+ {
+ int length = any->length;
+
+ switch(any->type)
+ {
+ case KeyClass:
+ {
+ xXIKeyInfo *ki = (xXIKeyInfo*)any;
+ uint32_t *key = (uint32_t*)&ki[1];
+ for (j = 0; j < ki->num_keycodes; j++, key++)
+ swapl(key, n);
+ swaps(&ki->num_keycodes, n);
+ }
+ break;
+ case ButtonClass:
+ {
+ xXIButtonInfo *bi = (xXIButtonInfo*)any;
+ Atom *labels = (Atom*)((char*)bi + sizeof(xXIButtonInfo) +
+ pad_to_int32(bits_to_bytes(bi->num_buttons)));
+ for (j = 0; j < bi->num_buttons; j++)
+ swapl(&labels[j], n);
+ swaps(&bi->num_buttons, n);
+ }
+ break;
+ case ValuatorClass:
+ {
+ xXIValuatorInfo* ai = (xXIValuatorInfo*)any;
+ swapl(&ai->label, n);
+ swapl(&ai->min.integral, n);
+ swapl(&ai->min.frac, n);
+ swapl(&ai->max.integral, n);
+ swapl(&ai->max.frac, n);
+ swapl(&ai->resolution, n);
+ swaps(&ai->number, n);
+ }
+ break;
+ }
+
+ swaps(&any->type, n);
+ swaps(&any->length, n);
+ swaps(&any->sourceid, n);
+
+ any = (xXIAnyInfo*)((char*)any + length * 4);
+ }
+
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->length, n);
+ swaps(&to->evtype, n);
+ swaps(&to->deviceid, n);
+ swapl(&to->time, n);
+ swaps(&to->num_classes, n);
+ swaps(&to->sourceid, n);
+
+}
+
+static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
+{
+ int i;
+ char n;
+ char *ptr;
+ char *vmask;
+
+ memcpy(to, from, sizeof(xEvent) + from->length * 4);
+
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->length, n);
+ swaps(&to->evtype, n);
+ swaps(&to->deviceid, n);
+ swapl(&to->time, n);
+ swapl(&to->detail, n);
+ swapl(&to->root, n);
+ swapl(&to->event, n);
+ swapl(&to->child, n);
+ swapl(&to->root_x, n);
+ swapl(&to->root_y, n);
+ swapl(&to->event_x, n);
+ swapl(&to->event_y, n);
+ swaps(&to->buttons_len, n);
+ swaps(&to->valuators_len, n);
+ swaps(&to->sourceid, n);
+ swapl(&to->mods.base_mods, n);
+ swapl(&to->mods.latched_mods, n);
+ swapl(&to->mods.locked_mods, n);
+ swapl(&to->mods.effective_mods, n);
+ swapl(&to->flags, n);
+
+ ptr = (char*)(&to[1]);
+ ptr += from->buttons_len * 4;
+ vmask = ptr; /* valuator mask */
+ ptr += from->valuators_len * 4;
+ for (i = 0; i < from->valuators_len * 32; i++)
+ {
+ if (BitIsOn(vmask, i))
+ {
+ swapl(((uint32_t*)ptr), n);
+ ptr += 4;
+ swapl(((uint32_t*)ptr), n);
+ ptr += 4;
+ }
+ }
+}
+
+static void SDeviceHierarchyEvent(xXIHierarchyEvent *from,
+ xXIHierarchyEvent *to)
+{
+ int i;
+ char n;
+ xXIHierarchyInfo *info;
+
+ *to = *from;
+ memcpy(&to[1], &from[1], from->length * 4);
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->length, n);
+ swaps(&to->evtype, n);
+ swaps(&to->deviceid, n);
+ swapl(&to->time, n);
+ swapl(&to->flags, n);
+ swaps(&to->num_info, n);
+
+ info = (xXIHierarchyInfo*)&to[1];
+ for (i = 0; i< from->num_info; i++)
+ {
+ swaps(&info->deviceid, n);
+ swaps(&info->attachment, n);
+ info++;
+ }
+}
+
+static void SXIPropertyEvent(xXIPropertyEvent *from, xXIPropertyEvent *to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->length, n);
+ swaps(&to->evtype, n);
+ swaps(&to->deviceid, n);
+ swapl(&to->property, n);
+}
+
+static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to)
+{
+ char n;
+ int i;
+ FP3232 *values;
+ unsigned char *mask;
+
+ memcpy(to, from, sizeof(xEvent) + from->length * 4);
+
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->length, n);
+ swaps(&to->evtype, n);
+ swaps(&to->deviceid, n);
+ swapl(&to->time, n);
+ swapl(&to->detail, n);
+
+
+ mask = (unsigned char*)&to[1];
+ values = (FP3232*)(mask + from->valuators_len * 4);
+
+ for (i = 0; i < from->valuators_len * 4 * 8; i++)
+ {
+ if (BitIsOn(mask, i))
+ {
+ /* for each bit set there are two FP3232 values on the wire, in
+ * the order abcABC for data and data_raw. Here we swap as if
+ * they were in aAbBcC order because it's easier and really
+ * doesn't matter.
+ */
+ swapl(&values->integral, n);
+ swapl(&values->frac, n);
+ values++;
+ swapl(&values->integral, n);
+ swapl(&values->frac, n);
+ values++;
+ }
+ }
+
+ swaps(&to->valuators_len, n);
+}
+
+
+/** Event swapping function for XI2 events. */
+void
+XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
+{
+ switch(from->evtype)
+ {
+ case XI_Enter:
+ case XI_Leave:
+ SDeviceLeaveNotifyEvent((xXILeaveEvent*)from, (xXILeaveEvent*)to);
+ break;
+ case XI_DeviceChanged:
+ SDeviceChangedEvent((xXIDeviceChangedEvent*)from,
+ (xXIDeviceChangedEvent*)to);
+ break;
+ case XI_HierarchyChanged:
+ SDeviceHierarchyEvent((xXIHierarchyEvent*)from, (xXIHierarchyEvent*)to);
+ break;
+ case XI_PropertyEvent:
+ SXIPropertyEvent((xXIPropertyEvent*)from,
+ (xXIPropertyEvent*)to);
+ break;
+ case XI_Motion:
+ case XI_KeyPress:
+ case XI_KeyRelease:
+ case XI_ButtonPress:
+ case XI_ButtonRelease:
+ SDeviceEvent((xXIDeviceEvent*)from, (xXIDeviceEvent*)to);
+ break;
+ case XI_RawMotion:
+ case XI_RawKeyPress:
+ case XI_RawKeyRelease:
+ case XI_RawButtonPress:
+ case XI_RawButtonRelease:
+ SRawEvent((xXIRawEvent*)from, (xXIRawEvent*)to);
+ break;
+ default:
+ ErrorF("[Xi] Unknown event type to swap. This is a bug.\n");
+ break;
+ }
+}
+
+/**************************************************************************
+ *
+ * Allow the specified event to have its propagation suppressed.
+ * The default is to not allow suppression of propagation.
+ *
+ */
+
+static void
+AllowPropagateSuppress(Mask mask)
+{
+ int i;
+
+ for (i = 0; i < MAXDEVICES; i++)
+ PropagateMask[i] |= mask;
+}
+
+/**************************************************************************
+ *
+ * Record an event mask where there is no unique corresponding event type.
+ * We can't call SetMaskForEvent, since that would clobber the existing
+ * mask for that event. MotionHint and ButtonMotion are examples.
+ *
+ * Since extension event types will never be less than 64, we can use
+ * 0-63 in the EventInfo array as the "type" to be used to look up this
+ * mask. This means that the corresponding macros such as
+ * DevicePointerMotionHint must have access to the same constants.
+ *
+ */
+
+static void
+SetEventInfo(Mask mask, int constant)
+{
+ EventInfo[ExtEventIndex].mask = mask;
+ EventInfo[ExtEventIndex++].type = constant;
+}
+
+/**************************************************************************
+ *
+ * Allow the specified event to be restricted to being selected by one
+ * client at a time.
+ * The default is to allow more than one client to select the event.
+ *
+ */
+
+static void
+SetExclusiveAccess(Mask mask)
+{
+ int i;
+
+ for (i = 0; i < MAXDEVICES; i++)
+ ExtExclusiveMasks[i] |= mask;
+}
+
+/**************************************************************************
+ *
+ * Assign the specified mask to the specified event.
+ *
+ */
+
+static void
+SetMaskForExtEvent(Mask mask, int event)
+{
+ int i;
+
+ EventInfo[ExtEventIndex].mask = mask;
+ EventInfo[ExtEventIndex++].type = event;
+
+ if ((event < LASTEvent) || (event >= 128))
+ FatalError("MaskForExtensionEvent: bogus event number");
+
+ for (i = 0; i < MAXDEVICES; i++)
+ SetMaskForEvent(i, mask, event);
+}
+
+/************************************************************************
+ *
+ * This function sets up extension event types and masks.
+ *
+ */
+
+static void
+FixExtensionEvents(ExtensionEntry * extEntry)
+{
+ DeviceValuator = extEntry->eventBase;
+ DeviceKeyPress = DeviceValuator + 1;
+ DeviceKeyRelease = DeviceKeyPress + 1;
+ DeviceButtonPress = DeviceKeyRelease + 1;
+ DeviceButtonRelease = DeviceButtonPress + 1;
+ DeviceMotionNotify = DeviceButtonRelease + 1;
+ DeviceFocusIn = DeviceMotionNotify + 1;
+ DeviceFocusOut = DeviceFocusIn + 1;
+ ProximityIn = DeviceFocusOut + 1;
+ ProximityOut = ProximityIn + 1;
+ DeviceStateNotify = ProximityOut + 1;
+ DeviceMappingNotify = DeviceStateNotify + 1;
+ ChangeDeviceNotify = DeviceMappingNotify + 1;
+ DeviceKeyStateNotify = ChangeDeviceNotify + 1;
+ DeviceButtonStateNotify = DeviceKeyStateNotify + 1;
+ DevicePresenceNotify = DeviceButtonStateNotify + 1;
+ DevicePropertyNotify = DevicePresenceNotify + 1;
+
+ event_base[KeyClass] = DeviceKeyPress;
+ event_base[ButtonClass] = DeviceButtonPress;
+ event_base[ValuatorClass] = DeviceMotionNotify;
+ event_base[ProximityClass] = ProximityIn;
+ event_base[FocusClass] = DeviceFocusIn;
+ event_base[OtherClass] = DeviceStateNotify;
+
+ BadDevice += extEntry->errorBase;
+ BadEvent += extEntry->errorBase;
+ BadMode += extEntry->errorBase;
+ DeviceBusy += extEntry->errorBase;
+ BadClass += extEntry->errorBase;
+
+ SetMaskForExtEvent(DeviceKeyPressMask, DeviceKeyPress);
+ AllowPropagateSuppress(DeviceKeyPressMask);
+ SetCriticalEvent(DeviceKeyPress);
+
+ SetMaskForExtEvent(DeviceKeyReleaseMask, DeviceKeyRelease);
+ AllowPropagateSuppress(DeviceKeyReleaseMask);
+ SetCriticalEvent(DeviceKeyRelease);
+
+ SetMaskForExtEvent(DeviceButtonPressMask, DeviceButtonPress);
+ AllowPropagateSuppress(DeviceButtonPressMask);
+ SetCriticalEvent(DeviceButtonPress);
+
+ SetMaskForExtEvent(DeviceButtonReleaseMask, DeviceButtonRelease);
+ AllowPropagateSuppress(DeviceButtonReleaseMask);
+ SetCriticalEvent(DeviceButtonRelease);
+
+ SetMaskForExtEvent(DeviceProximityMask, ProximityIn);
+ SetMaskForExtEvent(DeviceProximityMask, ProximityOut);
+
+ SetMaskForExtEvent(DeviceStateNotifyMask, DeviceStateNotify);
+
+ SetMaskForExtEvent(DevicePointerMotionMask, DeviceMotionNotify);
+ AllowPropagateSuppress(DevicePointerMotionMask);
+ SetCriticalEvent(DeviceMotionNotify);
+
+ SetEventInfo(DevicePointerMotionHintMask, _devicePointerMotionHint);
+ SetEventInfo(DeviceButton1MotionMask, _deviceButton1Motion);
+ SetEventInfo(DeviceButton2MotionMask, _deviceButton2Motion);
+ SetEventInfo(DeviceButton3MotionMask, _deviceButton3Motion);
+ SetEventInfo(DeviceButton4MotionMask, _deviceButton4Motion);
+ SetEventInfo(DeviceButton5MotionMask, _deviceButton5Motion);
+ SetEventInfo(DeviceButtonMotionMask, _deviceButtonMotion);
+
+ SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusIn);
+ SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusOut);
+
+ SetMaskForExtEvent(DeviceMappingNotifyMask, DeviceMappingNotify);
+ SetMaskForExtEvent(ChangeDeviceNotifyMask, ChangeDeviceNotify);
+
+ SetEventInfo(DeviceButtonGrabMask, _deviceButtonGrab);
+ SetExclusiveAccess(DeviceButtonGrabMask);
+
+ SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton);
+ SetEventInfo(DevicePresenceNotifyMask, _devicePresence);
+ SetMaskForExtEvent(DevicePropertyNotifyMask, DevicePropertyNotify);
+
+ SetEventInfo(0, _noExtensionEvent);
+}
+
+/************************************************************************
+ *
+ * This function restores extension event types and masks to their
+ * initial state.
+ *
+ */
+
+static void
+RestoreExtensionEvents(void)
+{
+ int i, j;
+
+ IReqCode = 0;
+ IEventBase = 0;
+
+ for (i = 0; i < ExtEventIndex - 1; i++) {
+ if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128))
+ {
+ for (j = 0; j < MAXDEVICES; j++)
+ SetMaskForEvent(j, 0, EventInfo[i].type);
+ }
+ EventInfo[i].mask = 0;
+ EventInfo[i].type = 0;
+ }
+ ExtEventIndex = 0;
+ DeviceValuator = 0;
+ DeviceKeyPress = 1;
+ DeviceKeyRelease = 2;
+ DeviceButtonPress = 3;
+ DeviceButtonRelease = 4;
+ DeviceMotionNotify = 5;
+ DeviceFocusIn = 6;
+ DeviceFocusOut = 7;
+ ProximityIn = 8;
+ ProximityOut = 9;
+ DeviceStateNotify = 10;
+ DeviceMappingNotify = 11;
+ ChangeDeviceNotify = 12;
+ DeviceKeyStateNotify = 13;
+ DeviceButtonStateNotify = 13;
+ DevicePresenceNotify = 14;
+ DevicePropertyNotify = 15;
+
+ BadDevice = 0;
+ BadEvent = 1;
+ BadMode = 2;
+ DeviceBusy = 3;
+ BadClass = 4;
+
+}
+
+/***********************************************************************
+ *
+ * IResetProc.
+ * Remove reply-swapping routine.
+ * Remove event-swapping routine.
+ *
+ */
+
+static void
+IResetProc(ExtensionEntry * unused)
+{
+ ReplySwapVector[IReqCode] = ReplyNotSwappd;
+ EventSwapVector[DeviceValuator] = NotImplemented;
+ EventSwapVector[DeviceKeyPress] = NotImplemented;
+ EventSwapVector[DeviceKeyRelease] = NotImplemented;
+ EventSwapVector[DeviceButtonPress] = NotImplemented;
+ EventSwapVector[DeviceButtonRelease] = NotImplemented;
+ EventSwapVector[DeviceMotionNotify] = NotImplemented;
+ EventSwapVector[DeviceFocusIn] = NotImplemented;
+ EventSwapVector[DeviceFocusOut] = NotImplemented;
+ EventSwapVector[ProximityIn] = NotImplemented;
+ EventSwapVector[ProximityOut] = NotImplemented;
+ EventSwapVector[DeviceStateNotify] = NotImplemented;
+ EventSwapVector[DeviceKeyStateNotify] = NotImplemented;
+ EventSwapVector[DeviceButtonStateNotify] = NotImplemented;
+ EventSwapVector[DeviceMappingNotify] = NotImplemented;
+ EventSwapVector[ChangeDeviceNotify] = NotImplemented;
+ EventSwapVector[DevicePresenceNotify] = NotImplemented;
+ EventSwapVector[DevicePropertyNotify] = NotImplemented;
+ RestoreExtensionEvents();
+}
+
+
+/***********************************************************************
+ *
+ * Assign an id and type to an input device.
+ *
+ */
+
+void
+AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name)
+{
+ dev->xinput_type = type;
+ dev->name = strdup(name);
+}
+
+/***********************************************************************
+ *
+ * Make device type atoms.
+ *
+ */
+
+static void
+MakeDeviceTypeAtoms(void)
+{
+ int i;
+
+ for (i = 0; i < NUMTYPES; i++)
+ dev_type[i].type =
+ MakeAtom(dev_type[i].name, strlen(dev_type[i].name), 1);
+}
+
+/*****************************************************************************
+ *
+ * SEventIDispatch
+ *
+ * Swap any events defined in this extension.
+ */
+#define DO_SWAP(func,type) func ((type *)from, (type *)to)
+
+static void
+SEventIDispatch(xEvent * from, xEvent * to)
+{
+ int type = from->u.u.type & 0177;
+
+ if (type == DeviceValuator)
+ DO_SWAP(SEventDeviceValuator, deviceValuator);
+ else if (type == DeviceKeyPress) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == DeviceKeyRelease) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == DeviceButtonPress) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == DeviceButtonRelease) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == DeviceMotionNotify) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == DeviceFocusIn)
+ DO_SWAP(SEventFocus, deviceFocus);
+ else if (type == DeviceFocusOut)
+ DO_SWAP(SEventFocus, deviceFocus);
+ else if (type == ProximityIn) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == ProximityOut) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == DeviceStateNotify)
+ DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
+ else if (type == DeviceKeyStateNotify)
+ DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
+ else if (type == DeviceButtonStateNotify)
+ DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify);
+ else if (type == DeviceMappingNotify)
+ DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
+ else if (type == ChangeDeviceNotify)
+ DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
+ else if (type == DevicePresenceNotify)
+ DO_SWAP(SDevicePresenceNotifyEvent, devicePresenceNotify);
+ else if (type == DevicePropertyNotify)
+ DO_SWAP(SDevicePropertyNotifyEvent, devicePropertyNotify);
+ else {
+ FatalError("XInputExtension: Impossible event!\n");
+ }
+}
+
+/**********************************************************************
+ *
+ * IExtensionInit - initialize the input extension.
+ *
+ * Called from InitExtensions in main() or from QueryExtension() if the
+ * extension is dynamically loaded.
+ *
+ * This extension has several events and errors.
+ *
+ * XI is mandatory nowadays, so if we fail to init XI, we die.
+ */
+
+void
+XInputExtensionInit(void)
+{
+ ExtensionEntry *extEntry;
+ XExtensionVersion thisversion = { XI_Present,
+ SERVER_XI_MAJOR_VERSION,
+ SERVER_XI_MINOR_VERSION,
+ };
+
+ if (!dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec)))
+ FatalError("Cannot request private for XI.\n");
+
+ if (!AddCallback(&ClientStateCallback, XIClientCallback, 0))
+ FatalError("Failed to add callback to XI.\n");
+
+ extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
+ SProcIDispatch, IResetProc, StandardMinorOpcode);
+ if (extEntry) {
+ IReqCode = extEntry->base;
+ IEventBase = extEntry->eventBase;
+ XIVersion = thisversion;
+ MakeDeviceTypeAtoms();
+ RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone,
+ "INPUTCLIENT");
+ if (!RT_INPUTCLIENT)
+ FatalError("Failed to add resource type for XI.\n");
+ FixExtensionEvents(extEntry);
+ ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch;
+ EventSwapVector[DeviceValuator] = SEventIDispatch;
+ EventSwapVector[DeviceKeyPress] = SEventIDispatch;
+ EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
+ EventSwapVector[DeviceButtonPress] = SEventIDispatch;
+ EventSwapVector[DeviceButtonRelease] = SEventIDispatch;
+ EventSwapVector[DeviceMotionNotify] = SEventIDispatch;
+ EventSwapVector[DeviceFocusIn] = SEventIDispatch;
+ EventSwapVector[DeviceFocusOut] = SEventIDispatch;
+ EventSwapVector[ProximityIn] = SEventIDispatch;
+ EventSwapVector[ProximityOut] = SEventIDispatch;
+ EventSwapVector[DeviceStateNotify] = SEventIDispatch;
+ EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch;
+ EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch;
+ EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
+ EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
+ EventSwapVector[DevicePresenceNotify] = SEventIDispatch;
+
+ GERegisterExtension(IReqCode, XI2EventSwap);
+
+
+ memset(&xi_all_devices, 0, sizeof(xi_all_devices));
+ memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices));
+ xi_all_devices.id = XIAllDevices;
+ xi_all_devices.name = "XIAllDevices";
+ xi_all_master_devices.id = XIAllMasterDevices;
+ xi_all_master_devices.name = "XIAllMasterDevices";
+
+ inputInfo.all_devices = &xi_all_devices;
+ inputInfo.all_master_devices = &xi_all_master_devices;
+
+ XIResetProperties();
+ } else {
+ FatalError("IExtensionInit: AddExtensions failed\n");
+ }
+}
+
diff --git a/xorg-server/dix/Makefile.am b/xorg-server/dix/Makefile.am
index 5ff75c0ba..c48c71e98 100644
--- a/xorg-server/dix/Makefile.am
+++ b/xorg-server/dix/Makefile.am
@@ -10,7 +10,6 @@ libdix_la_SOURCES = \
atom.c \
colormap.c \
cursor.c \
- deprecated.c \
devices.c \
dispatch.c \
dispatch.h \
diff --git a/xorg-server/dix/deprecated.c b/xorg-server/dix/deprecated.c
deleted file mode 100644
index b1f4d6c5c..000000000
--- a/xorg-server/dix/deprecated.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-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.
-
-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
-OPEN GROUP 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 Open Group 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 Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-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 Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL 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_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "dix.h"
-#include "misc.h"
-#include "dixstruct.h"
-
-/*
- * These are deprecated compatibility functions and will be marked as such
- * and removed soon!
- *
- * Please use the noted replacements instead.
- */
-
-/* replaced by dixLookupWindow */
-WindowPtr
-SecurityLookupWindow(XID id, ClientPtr client, Mask access_mode)
-{
- WindowPtr pWin;
- static int warn = 1;
- dixLookupWindow(&pWin, id, client, access_mode);
- if (warn > 0 && warn--)
- ErrorF("Warning: LookupWindow()/SecurityLookupWindow() "
- "are deprecated. Please convert your driver/module "
- "to use dixLookupWindow().\n");
- return pWin;
-}
-
-/* replaced by dixLookupWindow */
-WindowPtr
-LookupWindow(XID id, ClientPtr client)
-{
- return SecurityLookupWindow(id, client, DixUnknownAccess);
-}
-
-/* replaced by dixLookupDrawable */
-pointer
-SecurityLookupDrawable(XID id, ClientPtr client, Mask access_mode)
-{
- DrawablePtr pDraw;
- static int warn = 1;
- dixLookupDrawable(&pDraw, id, client, M_DRAWABLE, access_mode);
- if (warn > 0 && warn--)
- ErrorF("Warning: LookupDrawable()/SecurityLookupDrawable() "
- "are deprecated. Please convert your driver/module "
- "to use dixLookupDrawable().\n");
- return pDraw;
-}
-
-/* replaced by dixLookupDrawable */
-pointer
-LookupDrawable(XID id, ClientPtr client)
-{
- return SecurityLookupDrawable(id, client, DixUnknownAccess);
-}
-
-/* replaced by dixLookupClient */
-ClientPtr
-LookupClient(XID id, ClientPtr client)
-{
- ClientPtr pClient;
- static int warn = 1;
- dixLookupClient(&pClient, id, client, DixUnknownAccess);
- if (warn > 0 && warn--)
- ErrorF("Warning: LookupClient() is deprecated. Please convert your "
- "driver/module to use dixLookupClient().\n");
- return pClient;
-}
-
-/* replaced by dixLookupResourceByType */
-pointer
-SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype,
- Mask access_mode)
-{
- pointer retval;
- static int warn = 1;
- dixLookupResourceByType(&retval, id, rtype, client, access_mode);
- if (warn > 0 && warn--)
- ErrorF("Warning: LookupIDByType()/SecurityLookupIDByType() "
- "are deprecated. Please convert your driver/module "
- "to use dixLookupResourceByType().\n");
- return retval;
-}
-
-pointer
-SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes,
- Mask access_mode)
-{
- pointer retval;
- static int warn = 1;
- dixLookupResourceByClass(&retval, id, classes, client, access_mode);
- if (warn > 0 && warn--)
- ErrorF("Warning: LookupIDByClass()/SecurityLookupIDByClass() "
- "are deprecated. Please convert your driver/module "
- "to use dixLookupResourceByClass().\n");
- return retval;
-}
-
-/* replaced by dixLookupResourceByType */
-pointer
-LookupIDByType(XID id, RESTYPE rtype)
-{
- pointer val;
- dixLookupResourceByType(&val, id, rtype, NullClient, DixUnknownAccess);
- return val;
-}
-
-/* replaced by dixLookupResourceByClass */
-pointer
-LookupIDByClass(XID id, RESTYPE classes)
-{
- pointer val;
- dixLookupResourceByClass(&val, id, classes, NullClient, DixUnknownAccess);
- return val;
-}
-
-/* end deprecated functions */
diff --git a/xorg-server/exa/exa.h b/xorg-server/exa/exa.h
index 8c93d156f..b65118883 100644
--- a/xorg-server/exa/exa.h
+++ b/xorg-server/exa/exa.h
@@ -1,843 +1,843 @@
-/*
- *
- * Copyright (C) 2000 Keith Packard
- * 2004 Eric Anholt
- * 2005 Zack Rusin
- *
- * 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 copyright holders not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Copyright holders make no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS 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.
- */
-
-/** @file
- * This is the header containing the public API of EXA for exa drivers.
- */
-
-#ifndef EXA_H
-#define EXA_H
-
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "gcstruct.h"
-#include "picturestr.h"
-#include "fb.h"
-
-#define EXA_VERSION_MAJOR 2
-#define EXA_VERSION_MINOR 5
-#define EXA_VERSION_RELEASE 0
-
-typedef struct _ExaOffscreenArea ExaOffscreenArea;
-
-typedef void (*ExaOffscreenSaveProc) (ScreenPtr pScreen, ExaOffscreenArea *area);
-
-typedef enum _ExaOffscreenState {
- ExaOffscreenAvail,
- ExaOffscreenRemovable,
- ExaOffscreenLocked
-} ExaOffscreenState;
-
-struct _ExaOffscreenArea {
- int base_offset; /* allocation base */
- int offset; /* aligned offset */
- int size; /* total allocation size */
- unsigned last_use;
- pointer privData;
-
- ExaOffscreenSaveProc save;
-
- ExaOffscreenState state;
-
- ExaOffscreenArea *next;
-
- unsigned eviction_cost;
-
- ExaOffscreenArea *prev; /* Double-linked list for defragmentation */
- int align; /* required alignment */
-};
-
-/**
- * The ExaDriver structure is allocated through exaDriverAlloc(), and then
- * fllled in by drivers.
- */
-typedef struct _ExaDriver {
- /**
- * exa_major and exa_minor should be set by the driver to the version of
- * EXA which the driver was compiled for (or configures itself at runtime
- * to support). This allows EXA to extend the structure for new features
- * without breaking ABI for drivers compiled against older versions.
- */
- int exa_major, exa_minor;
-
- /**
- * memoryBase is the address of the beginning of framebuffer memory.
- * The visible screen should be within memoryBase to memoryBase +
- * memorySize.
- */
- CARD8 *memoryBase;
-
- /**
- * offScreenBase is the offset from memoryBase of the beginning of the area
- * to be managed by EXA's linear offscreen memory manager.
- *
- * In XFree86 DDX drivers, this is probably:
- * (pScrn->displayWidth * cpp * pScrn->virtualY)
- */
- unsigned long offScreenBase;
-
- /**
- * memorySize is the length (in bytes) of framebuffer memory beginning
- * from memoryBase.
- *
- * The offscreen memory manager will manage the area beginning at
- * (memoryBase + offScreenBase), with a length of (memorySize -
- * offScreenBase)
- *
- * In XFree86 DDX drivers, this is probably (pScrn->videoRam * 1024)
- */
- unsigned long memorySize;
-
- /**
- * pixmapOffsetAlign is the byte alignment necessary for pixmap offsets
- * within framebuffer.
- *
- * Hardware typically has a required alignment of offsets, which may or may
- * not be a power of two. EXA will ensure that pixmaps managed by the
- * offscreen memory manager meet this alignment requirement.
- */
- int pixmapOffsetAlign;
-
- /**
- * pixmapPitchAlign is the byte alignment necessary for pixmap pitches
- * within the framebuffer.
- *
- * Hardware typically has a required alignment of pitches for acceleration.
- * For 3D hardware, Composite acceleration often requires that source and
- * mask pixmaps (textures) have a power-of-two pitch, which can be demanded
- * using EXA_OFFSCREEN_ALIGN_POT. These pitch requirements only apply to
- * pixmaps managed by the offscreen memory manager. Thus, it is up to the
- * driver to ensure that the visible screen has an appropriate pitch for
- * acceleration.
- */
- int pixmapPitchAlign;
-
- /**
- * The flags field is bitfield of boolean values controlling EXA's behavior.
- *
- * The flags in clude EXA_OFFSCREEN_PIXMAPS, EXA_OFFSCREEN_ALIGN_POT, and
- * EXA_TWO_BITBLT_DIRECTIONS.
- */
- int flags;
-
- /** @{ */
- /**
- * maxX controls the X coordinate limitation for rendering from the card.
- * The driver should never receive a request for rendering beyond maxX
- * in the X direction from the origin of a pixmap.
- */
- int maxX;
-
- /**
- * maxY controls the Y coordinate limitation for rendering from the card.
- * The driver should never receive a request for rendering beyond maxY
- * in the Y direction from the origin of a pixmap.
- */
- int maxY;
- /** @} */
-
- /* private */
- ExaOffscreenArea *offScreenAreas;
- Bool needsSync;
- int lastMarker;
-
- /** @name Solid
- * @{
- */
- /**
- * PrepareSolid() sets up the driver for doing a solid fill.
- * @param pPixmap Destination pixmap
- * @param alu raster operation
- * @param planemask write mask for the fill
- * @param fg "foreground" color for the fill
- *
- * This call should set up the driver for doing a series of solid fills
- * through the Solid() call. The alu raster op is one of the GX*
- * graphics functions listed in X.h, and typically maps to a similar
- * single-byte "ROP" setting in all hardware. The planemask controls
- * which bits of the destination should be affected, and will only represent
- * the bits up to the depth of pPixmap. The fg is the pixel value of the
- * foreground color referred to in ROP descriptions.
- *
- * Note that many drivers will need to store some of the data in the driver
- * private record, for sending to the hardware with each drawing command.
- *
- * The PrepareSolid() call is required of all drivers, but it may fail for any
- * reason. Failure results in a fallback to software rendering.
- */
- Bool (*PrepareSolid) (PixmapPtr pPixmap,
- int alu,
- Pixel planemask,
- Pixel fg);
-
- /**
- * Solid() performs a solid fill set up in the last PrepareSolid() call.
- *
- * @param pPixmap destination pixmap
- * @param x1 left coordinate
- * @param y1 top coordinate
- * @param x2 right coordinate
- * @param y2 bottom coordinate
- *
- * Performs the fill set up by the last PrepareSolid() call, covering the
- * area from (x1,y1) to (x2,y2) in pPixmap. Note that the coordinates are
- * in the coordinate space of the destination pixmap, so the driver will
- * need to set up the hardware's offset and pitch for the destination
- * coordinates according to the pixmap's offset and pitch within
- * framebuffer. This likely means using exaGetPixmapOffset() and
- * exaGetPixmapPitch().
- *
- * This call is required if PrepareSolid() ever succeeds.
- */
- void (*Solid) (PixmapPtr pPixmap, int x1, int y1, int x2, int y2);
-
- /**
- * DoneSolid() finishes a set of solid fills.
- *
- * @param pPixmap destination pixmap.
- *
- * The DoneSolid() call is called at the end of a series of consecutive
- * Solid() calls following a successful PrepareSolid(). This allows drivers
- * to finish up emitting drawing commands that were buffered, or clean up
- * state from PrepareSolid().
- *
- * This call is required if PrepareSolid() ever succeeds.
- */
- void (*DoneSolid) (PixmapPtr pPixmap);
- /** @} */
-
- /** @name Copy
- * @{
- */
- /**
- * PrepareCopy() sets up the driver for doing a copy within video
- * memory.
- *
- * @param pSrcPixmap source pixmap
- * @param pDstPixmap destination pixmap
- * @param dx X copy direction
- * @param dy Y copy direction
- * @param alu raster operation
- * @param planemask write mask for the fill
- *
- * This call should set up the driver for doing a series of copies from the
- * the pSrcPixmap to the pDstPixmap. The dx flag will be positive if the
- * hardware should do the copy from the left to the right, and dy will be
- * positive if the copy should be done from the top to the bottom. This
- * is to deal with self-overlapping copies when pSrcPixmap == pDstPixmap.
- * If your hardware can only support blits that are (left to right, top to
- * bottom) or (right to left, bottom to top), then you should set
- * #EXA_TWO_BITBLT_DIRECTIONS, and EXA will break down Copy operations to
- * ones that meet those requirements. The alu raster op is one of the GX*
- * graphics functions listed in X.h, and typically maps to a similar
- * single-byte "ROP" setting in all hardware. The planemask controls which
- * bits of the destination should be affected, and will only represent the
- * bits up to the depth of pPixmap.
- *
- * Note that many drivers will need to store some of the data in the driver
- * private record, for sending to the hardware with each drawing command.
- *
- * The PrepareCopy() call is required of all drivers, but it may fail for any
- * reason. Failure results in a fallback to software rendering.
- */
- Bool (*PrepareCopy) (PixmapPtr pSrcPixmap,
- PixmapPtr pDstPixmap,
- int dx,
- int dy,
- int alu,
- Pixel planemask);
-
- /**
- * Copy() performs a copy set up in the last PrepareCopy call.
- *
- * @param pDstPixmap destination pixmap
- * @param srcX source X coordinate
- * @param srcY source Y coordinate
- * @param dstX destination X coordinate
- * @param dstY destination Y coordinate
- * @param width width of the rectangle to be copied
- * @param height height of the rectangle to be copied.
- *
- * Performs the copy set up by the last PrepareCopy() call, copying the
- * rectangle from (srcX, srcY) to (srcX + width, srcY + width) in the source
- * pixmap to the same-sized rectangle at (dstX, dstY) in the destination
- * pixmap. Those rectangles may overlap in memory, if
- * pSrcPixmap == pDstPixmap. Note that this call does not receive the
- * pSrcPixmap as an argument -- if it's needed in this function, it should
- * be stored in the driver private during PrepareCopy(). As with Solid(),
- * the coordinates are in the coordinate space of each pixmap, so the driver
- * will need to set up source and destination pitches and offsets from those
- * pixmaps, probably using exaGetPixmapOffset() and exaGetPixmapPitch().
- *
- * This call is required if PrepareCopy ever succeeds.
- */
- void (*Copy) (PixmapPtr pDstPixmap,
- int srcX,
- int srcY,
- int dstX,
- int dstY,
- int width,
- int height);
-
- /**
- * DoneCopy() finishes a set of copies.
- *
- * @param pPixmap destination pixmap.
- *
- * The DoneCopy() call is called at the end of a series of consecutive
- * Copy() calls following a successful PrepareCopy(). This allows drivers
- * to finish up emitting drawing commands that were buffered, or clean up
- * state from PrepareCopy().
- *
- * This call is required if PrepareCopy() ever succeeds.
- */
- void (*DoneCopy) (PixmapPtr pDstPixmap);
- /** @} */
-
- /** @name Composite
- * @{
- */
- /**
- * CheckComposite() checks to see if a composite operation could be
- * accelerated.
- *
- * @param op Render operation
- * @param pSrcPicture source Picture
- * @param pMaskPicture mask picture
- * @param pDstPicture destination Picture
- *
- * The CheckComposite() call checks if the driver could handle acceleration
- * of op with the given source, mask, and destination pictures. This allows
- * drivers to check source and destination formats, supported operations,
- * transformations, and component alpha state, and send operations it can't
- * support to software rendering early on. This avoids costly pixmap
- * migration to the wrong places when the driver can't accelerate
- * operations. Note that because migration hasn't happened, the driver
- * can't know during CheckComposite() what the offsets and pitches of the
- * pixmaps are going to be.
- *
- * See PrepareComposite() for more details on likely issues that drivers
- * will have in accelerating Composite operations.
- *
- * The CheckComposite() call is recommended if PrepareComposite() is
- * implemented, but is not required.
- */
- Bool (*CheckComposite) (int op,
- PicturePtr pSrcPicture,
- PicturePtr pMaskPicture,
- PicturePtr pDstPicture);
-
- /**
- * PrepareComposite() sets up the driver for doing a Composite operation
- * described in the Render extension protocol spec.
- *
- * @param op Render operation
- * @param pSrcPicture source Picture
- * @param pMaskPicture mask picture
- * @param pDstPicture destination Picture
- * @param pSrc source pixmap
- * @param pMask mask pixmap
- * @param pDst destination pixmap
- *
- * This call should set up the driver for doing a series of Composite
- * operations, as described in the Render protocol spec, with the given
- * pSrcPicture, pMaskPicture, and pDstPicture. The pSrc, pMask, and
- * pDst are the pixmaps containing the pixel data, and should be used for
- * setting the offset and pitch used for the coordinate spaces for each of
- * the Pictures.
- *
- * Notes on interpreting Picture structures:
- * - The Picture structures will always have a valid pDrawable.
- * - The Picture structures will never have alphaMap set.
- * - The mask Picture (and therefore pMask) may be NULL, in which case the
- * operation is simply src OP dst instead of src IN mask OP dst, and
- * mask coordinates should be ignored.
- * - pMarkPicture may have componentAlpha set, which greatly changes
- * the behavior of the Composite operation. componentAlpha has no effect
- * when set on pSrcPicture or pDstPicture.
- * - The source and mask Pictures may have a transformation set
- * (Picture->transform != NULL), which means that the source coordinates
- * should be transformed by that transformation, resulting in scaling,
- * rotation, etc. The PictureTransformPoint() call can transform
- * coordinates for you. Transforms have no effect on Pictures when used
- * as a destination.
- * - The source and mask pictures may have a filter set. PictFilterNearest
- * and PictFilterBilinear are defined in the Render protocol, but others
- * may be encountered, and must be handled correctly (usually by
- * PrepareComposite failing, and falling back to software). Filters have
- * no effect on Pictures when used as a destination.
- * - The source and mask Pictures may have repeating set, which must be
- * respected. Many chipsets will be unable to support repeating on
- * pixmaps that have a width or height that is not a power of two.
- *
- * If your hardware can't support source pictures (textures) with
- * non-power-of-two pitches, you should set #EXA_OFFSCREEN_ALIGN_POT.
- *
- * Note that many drivers will need to store some of the data in the driver
- * private record, for sending to the hardware with each drawing command.
- *
- * The PrepareComposite() call is not required. However, it is highly
- * recommended for performance of antialiased font rendering and performance
- * of cairo applications. Failure results in a fallback to software
- * rendering.
- */
- Bool (*PrepareComposite) (int op,
- PicturePtr pSrcPicture,
- PicturePtr pMaskPicture,
- PicturePtr pDstPicture,
- PixmapPtr pSrc,
- PixmapPtr pMask,
- PixmapPtr pDst);
-
- /**
- * Composite() performs a Composite operation set up in the last
- * PrepareComposite() call.
- *
- * @param pDstPixmap destination pixmap
- * @param srcX source X coordinate
- * @param srcY source Y coordinate
- * @param maskX source X coordinate
- * @param maskY source Y coordinate
- * @param dstX destination X coordinate
- * @param dstY destination Y coordinate
- * @param width destination rectangle width
- * @param height destination rectangle height
- *
- * Performs the Composite operation set up by the last PrepareComposite()
- * call, to the rectangle from (dstX, dstY) to (dstX + width, dstY + height)
- * in the destination Pixmap. Note that if a transformation was set on
- * the source or mask Pictures, the source rectangles may not be the same
- * size as the destination rectangles and filtering. Getting the coordinate
- * transformation right at the subpixel level can be tricky, and rendercheck
- * can test this for you.
- *
- * This call is required if PrepareComposite() ever succeeds.
- */
- void (*Composite) (PixmapPtr pDst,
- int srcX,
- int srcY,
- int maskX,
- int maskY,
- int dstX,
- int dstY,
- int width,
- int height);
-
- /**
- * DoneComposite() finishes a set of Composite operations.
- *
- * @param pPixmap destination pixmap.
- *
- * The DoneComposite() call is called at the end of a series of consecutive
- * Composite() calls following a successful PrepareComposite(). This allows
- * drivers to finish up emitting drawing commands that were buffered, or
- * clean up state from PrepareComposite().
- *
- * This call is required if PrepareComposite() ever succeeds.
- */
- void (*DoneComposite) (PixmapPtr pDst);
- /** @} */
-
- /**
- * UploadToScreen() loads a rectangle of data from src into pDst.
- *
- * @param pDst destination pixmap
- * @param x destination X coordinate.
- * @param y destination Y coordinate
- * @param width width of the rectangle to be copied
- * @param height height of the rectangle to be copied
- * @param src pointer to the beginning of the source data
- * @param src_pitch pitch (in bytes) of the lines of source data.
- *
- * UploadToScreen() copies data in system memory beginning at src (with
- * pitch src_pitch) into the destination pixmap from (x, y) to
- * (x + width, y + height). This is typically done with hostdata uploads,
- * where the CPU sets up a blit command on the hardware with instructions
- * that the blit data will be fed through some sort of aperture on the card.
- *
- * If UploadToScreen() is performed asynchronously, it is up to the driver
- * to call exaMarkSync(). This is in contrast to most other acceleration
- * calls in EXA.
- *
- * UploadToScreen() can aid in pixmap migration, but is most important for
- * the performance of exaGlyphs() (antialiased font drawing) by allowing
- * pipelining of data uploads, avoiding a sync of the card after each glyph.
- *
- * @return TRUE if the driver successfully uploaded the data. FALSE
- * indicates that EXA should fall back to doing the upload in software.
- *
- * UploadToScreen() is not required, but is recommended if Composite
- * acceleration is supported.
- */
- Bool (*UploadToScreen) (PixmapPtr pDst,
- int x,
- int y,
- int w,
- int h,
- char *src,
- int src_pitch);
-
- /**
- * UploadToScratch() is no longer used and will be removed next time the EXA
- * major version needs to be bumped.
- */
- Bool (*UploadToScratch) (PixmapPtr pSrc,
- PixmapPtr pDst);
-
- /**
- * DownloadFromScreen() loads a rectangle of data from pSrc into dst
- *
- * @param pSrc source pixmap
- * @param x source X coordinate.
- * @param y source Y coordinate
- * @param width width of the rectangle to be copied
- * @param height height of the rectangle to be copied
- * @param dst pointer to the beginning of the destination data
- * @param dst_pitch pitch (in bytes) of the lines of destination data.
- *
- * DownloadFromScreen() copies data from offscreen memory in pSrc from
- * (x, y) to (x + width, y + height), to system memory starting at
- * dst (with pitch dst_pitch). This would usually be done
- * using scatter-gather DMA, supported by a DRM call, or by blitting to AGP
- * and then synchronously reading from AGP. Because the implementation
- * might be synchronous, EXA leaves it up to the driver to call
- * exaMarkSync() if DownloadFromScreen() was asynchronous. This is in
- * contrast to most other acceleration calls in EXA.
- *
- * DownloadFromScreen() can aid in the largest bottleneck in pixmap
- * migration, which is the read from framebuffer when evicting pixmaps from
- * framebuffer memory. Thus, it is highly recommended, even though
- * implementations are typically complicated.
- *
- * @return TRUE if the driver successfully downloaded the data. FALSE
- * indicates that EXA should fall back to doing the download in software.
- *
- * DownloadFromScreen() is not required, but is highly recommended.
- */
- Bool (*DownloadFromScreen)(PixmapPtr pSrc,
- int x, int y,
- int w, int h,
- char *dst, int dst_pitch);
-
- /**
- * MarkSync() requests that the driver mark a synchronization point,
- * returning an driver-defined integer marker which could be requested for
- * synchronization to later in WaitMarker(). This might be used in the
- * future to avoid waiting for full hardware stalls before accessing pixmap
- * data with the CPU, but is not important in the current incarnation of
- * EXA.
- *
- * Note that drivers should call exaMarkSync() when they have done some
- * acceleration, rather than their own MarkSync() handler, as otherwise EXA
- * will be unaware of the driver's acceleration and not sync to it during
- * fallbacks.
- *
- * MarkSync() is optional.
- */
- int (*MarkSync) (ScreenPtr pScreen);
-
- /**
- * WaitMarker() waits for all rendering before the given marker to have
- * completed. If the driver does not implement MarkSync(), marker is
- * meaningless, and all rendering by the hardware should be completed before
- * WaitMarker() returns.
- *
- * Note that drivers should call exaWaitSync() to wait for all acceleration
- * to finish, as otherwise EXA will be unaware of the driver having
- * synchronized, resulting in excessive WaitMarker() calls.
- *
- * WaitMarker() is required of all drivers.
- */
- void (*WaitMarker) (ScreenPtr pScreen, int marker);
-
- /** @{ */
- /**
- * PrepareAccess() is called before CPU access to an offscreen pixmap.
- *
- * @param pPix the pixmap being accessed
- * @param index the index of the pixmap being accessed.
- *
- * PrepareAccess() will be called before CPU access to an offscreen pixmap.
- * This can be used to set up hardware surfaces for byteswapping or
- * untiling, or to adjust the pixmap's devPrivate.ptr for the purpose of
- * making CPU access use a different aperture.
- *
- * The index is one of #EXA_PREPARE_DEST, #EXA_PREPARE_SRC,
- * #EXA_PREPARE_MASK, #EXA_PREPARE_AUX_DEST, #EXA_PREPARE_AUX_SRC, or
- * #EXA_PREPARE_AUX_MASK. Since only up to #EXA_NUM_PREPARE_INDICES pixmaps
- * will have PrepareAccess() called on them per operation, drivers can have
- * a small, statically-allocated space to maintain state for PrepareAccess()
- * and FinishAccess() in. Note that PrepareAccess() is only called once per
- * pixmap and operation, regardless of whether the pixmap is used as a
- * destination and/or source, and the index may not reflect the usage.
- *
- * PrepareAccess() may fail. An example might be the case of hardware that
- * can set up 1 or 2 surfaces for CPU access, but not 3. If PrepareAccess()
- * fails, EXA will migrate the pixmap to system memory.
- * DownloadFromScreen() must be implemented and must not fail if a driver
- * wishes to fail in PrepareAccess(). PrepareAccess() must not fail when
- * pPix is the visible screen, because the visible screen can not be
- * migrated.
- *
- * @return TRUE if PrepareAccess() successfully prepared the pixmap for CPU
- * drawing.
- * @return FALSE if PrepareAccess() is unsuccessful and EXA should use
- * DownloadFromScreen() to migate the pixmap out.
- */
- Bool (*PrepareAccess)(PixmapPtr pPix, int index);
-
- /**
- * FinishAccess() is called after CPU access to an offscreen pixmap.
- *
- * @param pPix the pixmap being accessed
- * @param index the index of the pixmap being accessed.
- *
- * FinishAccess() will be called after finishing CPU access of an offscreen
- * pixmap set up by PrepareAccess(). Note that the FinishAccess() will not be
- * called if PrepareAccess() failed and the pixmap was migrated out.
- */
- void (*FinishAccess)(PixmapPtr pPix, int index);
-
- /**
- * PixmapIsOffscreen() is an optional driver replacement to
- * exaPixmapHasGpuCopy(). Set to NULL if you want the standard behaviour
- * of exaPixmapHasGpuCopy().
- *
- * @param pPix the pixmap
- * @return TRUE if the given drawable is in framebuffer memory.
- *
- * exaPixmapHasGpuCopy() is used to determine if a pixmap is in offscreen
- * memory, meaning that acceleration could probably be done to it, and that it
- * will need to be wrapped by PrepareAccess()/FinishAccess() when accessing it
- * with the CPU.
- *
- *
- */
- Bool (*PixmapIsOffscreen)(PixmapPtr pPix);
-
- /** @name PrepareAccess() and FinishAccess() indices
- * @{
- */
- /**
- * EXA_PREPARE_DEST is the index for a pixmap that may be drawn to or
- * read from.
- */
- #define EXA_PREPARE_DEST 0
- /**
- * EXA_PREPARE_SRC is the index for a pixmap that may be read from
- */
- #define EXA_PREPARE_SRC 1
- /**
- * EXA_PREPARE_SRC is the index for a second pixmap that may be read
- * from.
- */
- #define EXA_PREPARE_MASK 2
- /**
- * EXA_PREPARE_AUX* are additional indices for other purposes, e.g.
- * separate alpha maps with Composite operations.
- */
- #define EXA_PREPARE_AUX_DEST 3
- #define EXA_PREPARE_AUX_SRC 4
- #define EXA_PREPARE_AUX_MASK 5
- #define EXA_NUM_PREPARE_INDICES 6
- /** @} */
-
- /**
- * maxPitchPixels controls the pitch limitation for rendering from
- * the card.
- * The driver should never receive a request for rendering a pixmap
- * that has a pitch (in pixels) beyond maxPitchPixels.
- *
- * Setting this field is optional -- if your hardware doesn't have
- * a pitch limitation in pixels, don't set this. If neither this value
- * nor maxPitchBytes is set, then maxPitchPixels is set to maxX.
- * If set, it must not be smaller than maxX.
- *
- * @sa maxPitchBytes
- */
- int maxPitchPixels;
-
- /**
- * maxPitchBytes controls the pitch limitation for rendering from
- * the card.
- * The driver should never receive a request for rendering a pixmap
- * that has a pitch (in bytes) beyond maxPitchBytes.
- *
- * Setting this field is optional -- if your hardware doesn't have
- * a pitch limitation in bytes, don't set this.
- * If set, it must not be smaller than maxX * 4.
- * There's no default value for maxPitchBytes.
- *
- * @sa maxPitchPixels
- */
- int maxPitchBytes;
-
- /* Hooks to allow driver to its own pixmap memory management */
- void *(*CreatePixmap)(ScreenPtr pScreen, int size, int align);
- void (*DestroyPixmap)(ScreenPtr pScreen, void *driverPriv);
- /**
- * Returning a pixmap with non-NULL devPrivate.ptr implies a pixmap which is
- * not offscreen, which will never be accelerated and Prepare/FinishAccess won't
- * be called.
- */
- Bool (*ModifyPixmapHeader)(PixmapPtr pPixmap, int width, int height,
- int depth, int bitsPerPixel, int devKind,
- pointer pPixData);
-
- /* hooks for drivers with tiling support:
- * driver MUST fill out new_fb_pitch with valid pitch of pixmap
- */
- void *(*CreatePixmap2)(ScreenPtr pScreen, int width, int height,
- int depth, int usage_hint, int bitsPerPixel,
- int *new_fb_pitch);
- /** @} */
-} ExaDriverRec, *ExaDriverPtr;
-
-/** @name EXA driver flags
- * @{
- */
-/**
- * EXA_OFFSCREEN_PIXMAPS indicates to EXA that the driver can support
- * offscreen pixmaps.
- */
-#define EXA_OFFSCREEN_PIXMAPS (1 << 0)
-
-/**
- * EXA_OFFSCREEN_ALIGN_POT indicates to EXA that the driver needs pixmaps
- * to have a power-of-two pitch.
- */
-#define EXA_OFFSCREEN_ALIGN_POT (1 << 1)
-
-/**
- * EXA_TWO_BITBLT_DIRECTIONS indicates to EXA that the driver can only
- * support copies that are (left-to-right, top-to-bottom) or
- * (right-to-left, bottom-to-top).
- */
-#define EXA_TWO_BITBLT_DIRECTIONS (1 << 2)
-
-/**
- * EXA_HANDLES_PIXMAPS indicates to EXA that the driver can handle
- * all pixmap addressing and migration.
- */
-#define EXA_HANDLES_PIXMAPS (1 << 3)
-
-/**
- * EXA_SUPPORTS_PREPARE_AUX indicates to EXA that the driver can handle the
- * EXA_PREPARE_AUX* indices in the Prepare/FinishAccess hooks. If there are no
- * such hooks, this flag has no effect.
- */
-#define EXA_SUPPORTS_PREPARE_AUX (1 << 4)
-
-/**
- * EXA_SUPPORTS_OFFSCREEN_OVERLAPS indicates to EXA that the driver Copy hooks
- * can handle the source and destination occupying overlapping offscreen memory
- * areas. This allows the offscreen memory defragmentation code to defragment
- * areas where the defragmented position overlaps the fragmented position.
- *
- * Typically this is supported by traditional 2D engines but not by 3D engines.
- */
-#define EXA_SUPPORTS_OFFSCREEN_OVERLAPS (1 << 5)
-
-/**
- * EXA_MIXED_PIXMAPS will hide unacceleratable pixmaps from drivers and manage the
- * problem known software fallbacks like trapezoids. This only migrates pixmaps one way
- * into a driver pixmap and then pins it.
- */
-#define EXA_MIXED_PIXMAPS (1 << 6)
-
-/** @} */
-
-/* in exa.c */
-extern _X_EXPORT ExaDriverPtr
-exaDriverAlloc(void);
-
-extern _X_EXPORT Bool
-exaDriverInit(ScreenPtr pScreen,
- ExaDriverPtr pScreenInfo);
-
-extern _X_EXPORT void
-exaDriverFini(ScreenPtr pScreen);
-
-extern _X_EXPORT void
-exaMarkSync(ScreenPtr pScreen);
-extern _X_EXPORT void
-exaWaitSync(ScreenPtr pScreen);
-
-extern _X_EXPORT unsigned long
-exaGetPixmapOffset(PixmapPtr pPix);
-
-extern _X_EXPORT unsigned long
-exaGetPixmapPitch(PixmapPtr pPix);
-
-extern _X_EXPORT unsigned long
-exaGetPixmapSize(PixmapPtr pPix);
-
-extern _X_EXPORT void *
-exaGetPixmapDriverPrivate(PixmapPtr p);
-
-
-/* in exa_offscreen.c */
-extern _X_EXPORT ExaOffscreenArea *
-exaOffscreenAlloc(ScreenPtr pScreen, int size, int align,
- Bool locked,
- ExaOffscreenSaveProc save,
- pointer privData);
-
-extern _X_EXPORT ExaOffscreenArea *
-exaOffscreenFree(ScreenPtr pScreen, ExaOffscreenArea *area);
-
-extern _X_EXPORT void
-ExaOffscreenMarkUsed (PixmapPtr pPixmap);
-
-extern _X_EXPORT void
-exaEnableDisableFBAccess (int index, Bool enable);
-
-extern _X_EXPORT Bool
-exaDrawableIsOffscreen (DrawablePtr pDrawable);
-
-/* in exa.c */
-extern _X_EXPORT void
-exaMoveInPixmap (PixmapPtr pPixmap);
-
-extern _X_EXPORT void
-exaMoveOutPixmap (PixmapPtr pPixmap);
-
-
-/* in exa_unaccel.c */
-extern _X_EXPORT CARD32
-exaGetPixmapFirstPixel (PixmapPtr pPixmap);
-
-
-/**
- * Returns TRUE if the given planemask covers all the significant bits in the
- * pixel values for pDrawable.
- */
-#define EXA_PM_IS_SOLID(_pDrawable, _pm) \
- (((_pm) & FbFullMask((_pDrawable)->depth)) == \
- FbFullMask((_pDrawable)->depth))
-
-#endif /* EXA_H */
+/*
+ *
+ * Copyright (C) 2000 Keith Packard
+ * 2004 Eric Anholt
+ * 2005 Zack Rusin
+ *
+ * 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 copyright holders not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Copyright holders make no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+/** @file
+ * This is the header containing the public API of EXA for exa drivers.
+ */
+
+#ifndef EXA_H
+#define EXA_H
+
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "gcstruct.h"
+#include "picturestr.h"
+#include "fb.h"
+
+#define EXA_VERSION_MAJOR 2
+#define EXA_VERSION_MINOR 5
+#define EXA_VERSION_RELEASE 0
+
+typedef struct _ExaOffscreenArea ExaOffscreenArea;
+
+typedef void (*ExaOffscreenSaveProc) (ScreenPtr pScreen, ExaOffscreenArea *area);
+
+typedef enum _ExaOffscreenState {
+ ExaOffscreenAvail,
+ ExaOffscreenRemovable,
+ ExaOffscreenLocked
+} ExaOffscreenState;
+
+struct _ExaOffscreenArea {
+ int base_offset; /* allocation base */
+ int offset; /* aligned offset */
+ int size; /* total allocation size */
+ unsigned last_use;
+ pointer privData;
+
+ ExaOffscreenSaveProc save;
+
+ ExaOffscreenState state;
+
+ ExaOffscreenArea *next;
+
+ unsigned eviction_cost;
+
+ ExaOffscreenArea *prev; /* Double-linked list for defragmentation */
+ int align; /* required alignment */
+};
+
+/**
+ * The ExaDriver structure is allocated through exaDriverAlloc(), and then
+ * fllled in by drivers.
+ */
+typedef struct _ExaDriver {
+ /**
+ * exa_major and exa_minor should be set by the driver to the version of
+ * EXA which the driver was compiled for (or configures itself at runtime
+ * to support). This allows EXA to extend the structure for new features
+ * without breaking ABI for drivers compiled against older versions.
+ */
+ int exa_major, exa_minor;
+
+ /**
+ * memoryBase is the address of the beginning of framebuffer memory.
+ * The visible screen should be within memoryBase to memoryBase +
+ * memorySize.
+ */
+ CARD8 *memoryBase;
+
+ /**
+ * offScreenBase is the offset from memoryBase of the beginning of the area
+ * to be managed by EXA's linear offscreen memory manager.
+ *
+ * In XFree86 DDX drivers, this is probably:
+ * (pScrn->displayWidth * cpp * pScrn->virtualY)
+ */
+ unsigned long offScreenBase;
+
+ /**
+ * memorySize is the length (in bytes) of framebuffer memory beginning
+ * from memoryBase.
+ *
+ * The offscreen memory manager will manage the area beginning at
+ * (memoryBase + offScreenBase), with a length of (memorySize -
+ * offScreenBase)
+ *
+ * In XFree86 DDX drivers, this is probably (pScrn->videoRam * 1024)
+ */
+ unsigned long memorySize;
+
+ /**
+ * pixmapOffsetAlign is the byte alignment necessary for pixmap offsets
+ * within framebuffer.
+ *
+ * Hardware typically has a required alignment of offsets, which may or may
+ * not be a power of two. EXA will ensure that pixmaps managed by the
+ * offscreen memory manager meet this alignment requirement.
+ */
+ int pixmapOffsetAlign;
+
+ /**
+ * pixmapPitchAlign is the byte alignment necessary for pixmap pitches
+ * within the framebuffer.
+ *
+ * Hardware typically has a required alignment of pitches for acceleration.
+ * For 3D hardware, Composite acceleration often requires that source and
+ * mask pixmaps (textures) have a power-of-two pitch, which can be demanded
+ * using EXA_OFFSCREEN_ALIGN_POT. These pitch requirements only apply to
+ * pixmaps managed by the offscreen memory manager. Thus, it is up to the
+ * driver to ensure that the visible screen has an appropriate pitch for
+ * acceleration.
+ */
+ int pixmapPitchAlign;
+
+ /**
+ * The flags field is bitfield of boolean values controlling EXA's behavior.
+ *
+ * The flags in clude EXA_OFFSCREEN_PIXMAPS, EXA_OFFSCREEN_ALIGN_POT, and
+ * EXA_TWO_BITBLT_DIRECTIONS.
+ */
+ int flags;
+
+ /** @{ */
+ /**
+ * maxX controls the X coordinate limitation for rendering from the card.
+ * The driver should never receive a request for rendering beyond maxX
+ * in the X direction from the origin of a pixmap.
+ */
+ int maxX;
+
+ /**
+ * maxY controls the Y coordinate limitation for rendering from the card.
+ * The driver should never receive a request for rendering beyond maxY
+ * in the Y direction from the origin of a pixmap.
+ */
+ int maxY;
+ /** @} */
+
+ /* private */
+ ExaOffscreenArea *offScreenAreas;
+ Bool needsSync;
+ int lastMarker;
+
+ /** @name Solid
+ * @{
+ */
+ /**
+ * PrepareSolid() sets up the driver for doing a solid fill.
+ * @param pPixmap Destination pixmap
+ * @param alu raster operation
+ * @param planemask write mask for the fill
+ * @param fg "foreground" color for the fill
+ *
+ * This call should set up the driver for doing a series of solid fills
+ * through the Solid() call. The alu raster op is one of the GX*
+ * graphics functions listed in X.h, and typically maps to a similar
+ * single-byte "ROP" setting in all hardware. The planemask controls
+ * which bits of the destination should be affected, and will only represent
+ * the bits up to the depth of pPixmap. The fg is the pixel value of the
+ * foreground color referred to in ROP descriptions.
+ *
+ * Note that many drivers will need to store some of the data in the driver
+ * private record, for sending to the hardware with each drawing command.
+ *
+ * The PrepareSolid() call is required of all drivers, but it may fail for any
+ * reason. Failure results in a fallback to software rendering.
+ */
+ Bool (*PrepareSolid) (PixmapPtr pPixmap,
+ int alu,
+ Pixel planemask,
+ Pixel fg);
+
+ /**
+ * Solid() performs a solid fill set up in the last PrepareSolid() call.
+ *
+ * @param pPixmap destination pixmap
+ * @param x1 left coordinate
+ * @param y1 top coordinate
+ * @param x2 right coordinate
+ * @param y2 bottom coordinate
+ *
+ * Performs the fill set up by the last PrepareSolid() call, covering the
+ * area from (x1,y1) to (x2,y2) in pPixmap. Note that the coordinates are
+ * in the coordinate space of the destination pixmap, so the driver will
+ * need to set up the hardware's offset and pitch for the destination
+ * coordinates according to the pixmap's offset and pitch within
+ * framebuffer. This likely means using exaGetPixmapOffset() and
+ * exaGetPixmapPitch().
+ *
+ * This call is required if PrepareSolid() ever succeeds.
+ */
+ void (*Solid) (PixmapPtr pPixmap, int x1, int y1, int x2, int y2);
+
+ /**
+ * DoneSolid() finishes a set of solid fills.
+ *
+ * @param pPixmap destination pixmap.
+ *
+ * The DoneSolid() call is called at the end of a series of consecutive
+ * Solid() calls following a successful PrepareSolid(). This allows drivers
+ * to finish up emitting drawing commands that were buffered, or clean up
+ * state from PrepareSolid().
+ *
+ * This call is required if PrepareSolid() ever succeeds.
+ */
+ void (*DoneSolid) (PixmapPtr pPixmap);
+ /** @} */
+
+ /** @name Copy
+ * @{
+ */
+ /**
+ * PrepareCopy() sets up the driver for doing a copy within video
+ * memory.
+ *
+ * @param pSrcPixmap source pixmap
+ * @param pDstPixmap destination pixmap
+ * @param dx X copy direction
+ * @param dy Y copy direction
+ * @param alu raster operation
+ * @param planemask write mask for the fill
+ *
+ * This call should set up the driver for doing a series of copies from the
+ * the pSrcPixmap to the pDstPixmap. The dx flag will be positive if the
+ * hardware should do the copy from the left to the right, and dy will be
+ * positive if the copy should be done from the top to the bottom. This
+ * is to deal with self-overlapping copies when pSrcPixmap == pDstPixmap.
+ * If your hardware can only support blits that are (left to right, top to
+ * bottom) or (right to left, bottom to top), then you should set
+ * #EXA_TWO_BITBLT_DIRECTIONS, and EXA will break down Copy operations to
+ * ones that meet those requirements. The alu raster op is one of the GX*
+ * graphics functions listed in X.h, and typically maps to a similar
+ * single-byte "ROP" setting in all hardware. The planemask controls which
+ * bits of the destination should be affected, and will only represent the
+ * bits up to the depth of pPixmap.
+ *
+ * Note that many drivers will need to store some of the data in the driver
+ * private record, for sending to the hardware with each drawing command.
+ *
+ * The PrepareCopy() call is required of all drivers, but it may fail for any
+ * reason. Failure results in a fallback to software rendering.
+ */
+ Bool (*PrepareCopy) (PixmapPtr pSrcPixmap,
+ PixmapPtr pDstPixmap,
+ int dx,
+ int dy,
+ int alu,
+ Pixel planemask);
+
+ /**
+ * Copy() performs a copy set up in the last PrepareCopy call.
+ *
+ * @param pDstPixmap destination pixmap
+ * @param srcX source X coordinate
+ * @param srcY source Y coordinate
+ * @param dstX destination X coordinate
+ * @param dstY destination Y coordinate
+ * @param width width of the rectangle to be copied
+ * @param height height of the rectangle to be copied.
+ *
+ * Performs the copy set up by the last PrepareCopy() call, copying the
+ * rectangle from (srcX, srcY) to (srcX + width, srcY + width) in the source
+ * pixmap to the same-sized rectangle at (dstX, dstY) in the destination
+ * pixmap. Those rectangles may overlap in memory, if
+ * pSrcPixmap == pDstPixmap. Note that this call does not receive the
+ * pSrcPixmap as an argument -- if it's needed in this function, it should
+ * be stored in the driver private during PrepareCopy(). As with Solid(),
+ * the coordinates are in the coordinate space of each pixmap, so the driver
+ * will need to set up source and destination pitches and offsets from those
+ * pixmaps, probably using exaGetPixmapOffset() and exaGetPixmapPitch().
+ *
+ * This call is required if PrepareCopy ever succeeds.
+ */
+ void (*Copy) (PixmapPtr pDstPixmap,
+ int srcX,
+ int srcY,
+ int dstX,
+ int dstY,
+ int width,
+ int height);
+
+ /**
+ * DoneCopy() finishes a set of copies.
+ *
+ * @param pPixmap destination pixmap.
+ *
+ * The DoneCopy() call is called at the end of a series of consecutive
+ * Copy() calls following a successful PrepareCopy(). This allows drivers
+ * to finish up emitting drawing commands that were buffered, or clean up
+ * state from PrepareCopy().
+ *
+ * This call is required if PrepareCopy() ever succeeds.
+ */
+ void (*DoneCopy) (PixmapPtr pDstPixmap);
+ /** @} */
+
+ /** @name Composite
+ * @{
+ */
+ /**
+ * CheckComposite() checks to see if a composite operation could be
+ * accelerated.
+ *
+ * @param op Render operation
+ * @param pSrcPicture source Picture
+ * @param pMaskPicture mask picture
+ * @param pDstPicture destination Picture
+ *
+ * The CheckComposite() call checks if the driver could handle acceleration
+ * of op with the given source, mask, and destination pictures. This allows
+ * drivers to check source and destination formats, supported operations,
+ * transformations, and component alpha state, and send operations it can't
+ * support to software rendering early on. This avoids costly pixmap
+ * migration to the wrong places when the driver can't accelerate
+ * operations. Note that because migration hasn't happened, the driver
+ * can't know during CheckComposite() what the offsets and pitches of the
+ * pixmaps are going to be.
+ *
+ * See PrepareComposite() for more details on likely issues that drivers
+ * will have in accelerating Composite operations.
+ *
+ * The CheckComposite() call is recommended if PrepareComposite() is
+ * implemented, but is not required.
+ */
+ Bool (*CheckComposite) (int op,
+ PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture,
+ PicturePtr pDstPicture);
+
+ /**
+ * PrepareComposite() sets up the driver for doing a Composite operation
+ * described in the Render extension protocol spec.
+ *
+ * @param op Render operation
+ * @param pSrcPicture source Picture
+ * @param pMaskPicture mask picture
+ * @param pDstPicture destination Picture
+ * @param pSrc source pixmap
+ * @param pMask mask pixmap
+ * @param pDst destination pixmap
+ *
+ * This call should set up the driver for doing a series of Composite
+ * operations, as described in the Render protocol spec, with the given
+ * pSrcPicture, pMaskPicture, and pDstPicture. The pSrc, pMask, and
+ * pDst are the pixmaps containing the pixel data, and should be used for
+ * setting the offset and pitch used for the coordinate spaces for each of
+ * the Pictures.
+ *
+ * Notes on interpreting Picture structures:
+ * - The Picture structures will always have a valid pDrawable.
+ * - The Picture structures will never have alphaMap set.
+ * - The mask Picture (and therefore pMask) may be NULL, in which case the
+ * operation is simply src OP dst instead of src IN mask OP dst, and
+ * mask coordinates should be ignored.
+ * - pMarkPicture may have componentAlpha set, which greatly changes
+ * the behavior of the Composite operation. componentAlpha has no effect
+ * when set on pSrcPicture or pDstPicture.
+ * - The source and mask Pictures may have a transformation set
+ * (Picture->transform != NULL), which means that the source coordinates
+ * should be transformed by that transformation, resulting in scaling,
+ * rotation, etc. The PictureTransformPoint() call can transform
+ * coordinates for you. Transforms have no effect on Pictures when used
+ * as a destination.
+ * - The source and mask pictures may have a filter set. PictFilterNearest
+ * and PictFilterBilinear are defined in the Render protocol, but others
+ * may be encountered, and must be handled correctly (usually by
+ * PrepareComposite failing, and falling back to software). Filters have
+ * no effect on Pictures when used as a destination.
+ * - The source and mask Pictures may have repeating set, which must be
+ * respected. Many chipsets will be unable to support repeating on
+ * pixmaps that have a width or height that is not a power of two.
+ *
+ * If your hardware can't support source pictures (textures) with
+ * non-power-of-two pitches, you should set #EXA_OFFSCREEN_ALIGN_POT.
+ *
+ * Note that many drivers will need to store some of the data in the driver
+ * private record, for sending to the hardware with each drawing command.
+ *
+ * The PrepareComposite() call is not required. However, it is highly
+ * recommended for performance of antialiased font rendering and performance
+ * of cairo applications. Failure results in a fallback to software
+ * rendering.
+ */
+ Bool (*PrepareComposite) (int op,
+ PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture,
+ PicturePtr pDstPicture,
+ PixmapPtr pSrc,
+ PixmapPtr pMask,
+ PixmapPtr pDst);
+
+ /**
+ * Composite() performs a Composite operation set up in the last
+ * PrepareComposite() call.
+ *
+ * @param pDstPixmap destination pixmap
+ * @param srcX source X coordinate
+ * @param srcY source Y coordinate
+ * @param maskX source X coordinate
+ * @param maskY source Y coordinate
+ * @param dstX destination X coordinate
+ * @param dstY destination Y coordinate
+ * @param width destination rectangle width
+ * @param height destination rectangle height
+ *
+ * Performs the Composite operation set up by the last PrepareComposite()
+ * call, to the rectangle from (dstX, dstY) to (dstX + width, dstY + height)
+ * in the destination Pixmap. Note that if a transformation was set on
+ * the source or mask Pictures, the source rectangles may not be the same
+ * size as the destination rectangles and filtering. Getting the coordinate
+ * transformation right at the subpixel level can be tricky, and rendercheck
+ * can test this for you.
+ *
+ * This call is required if PrepareComposite() ever succeeds.
+ */
+ void (*Composite) (PixmapPtr pDst,
+ int srcX,
+ int srcY,
+ int maskX,
+ int maskY,
+ int dstX,
+ int dstY,
+ int width,
+ int height);
+
+ /**
+ * DoneComposite() finishes a set of Composite operations.
+ *
+ * @param pPixmap destination pixmap.
+ *
+ * The DoneComposite() call is called at the end of a series of consecutive
+ * Composite() calls following a successful PrepareComposite(). This allows
+ * drivers to finish up emitting drawing commands that were buffered, or
+ * clean up state from PrepareComposite().
+ *
+ * This call is required if PrepareComposite() ever succeeds.
+ */
+ void (*DoneComposite) (PixmapPtr pDst);
+ /** @} */
+
+ /**
+ * UploadToScreen() loads a rectangle of data from src into pDst.
+ *
+ * @param pDst destination pixmap
+ * @param x destination X coordinate.
+ * @param y destination Y coordinate
+ * @param width width of the rectangle to be copied
+ * @param height height of the rectangle to be copied
+ * @param src pointer to the beginning of the source data
+ * @param src_pitch pitch (in bytes) of the lines of source data.
+ *
+ * UploadToScreen() copies data in system memory beginning at src (with
+ * pitch src_pitch) into the destination pixmap from (x, y) to
+ * (x + width, y + height). This is typically done with hostdata uploads,
+ * where the CPU sets up a blit command on the hardware with instructions
+ * that the blit data will be fed through some sort of aperture on the card.
+ *
+ * If UploadToScreen() is performed asynchronously, it is up to the driver
+ * to call exaMarkSync(). This is in contrast to most other acceleration
+ * calls in EXA.
+ *
+ * UploadToScreen() can aid in pixmap migration, but is most important for
+ * the performance of exaGlyphs() (antialiased font drawing) by allowing
+ * pipelining of data uploads, avoiding a sync of the card after each glyph.
+ *
+ * @return TRUE if the driver successfully uploaded the data. FALSE
+ * indicates that EXA should fall back to doing the upload in software.
+ *
+ * UploadToScreen() is not required, but is recommended if Composite
+ * acceleration is supported.
+ */
+ Bool (*UploadToScreen) (PixmapPtr pDst,
+ int x,
+ int y,
+ int w,
+ int h,
+ char *src,
+ int src_pitch);
+
+ /**
+ * UploadToScratch() is no longer used and will be removed next time the EXA
+ * major version needs to be bumped.
+ */
+ Bool (*UploadToScratch) (PixmapPtr pSrc,
+ PixmapPtr pDst);
+
+ /**
+ * DownloadFromScreen() loads a rectangle of data from pSrc into dst
+ *
+ * @param pSrc source pixmap
+ * @param x source X coordinate.
+ * @param y source Y coordinate
+ * @param width width of the rectangle to be copied
+ * @param height height of the rectangle to be copied
+ * @param dst pointer to the beginning of the destination data
+ * @param dst_pitch pitch (in bytes) of the lines of destination data.
+ *
+ * DownloadFromScreen() copies data from offscreen memory in pSrc from
+ * (x, y) to (x + width, y + height), to system memory starting at
+ * dst (with pitch dst_pitch). This would usually be done
+ * using scatter-gather DMA, supported by a DRM call, or by blitting to AGP
+ * and then synchronously reading from AGP. Because the implementation
+ * might be synchronous, EXA leaves it up to the driver to call
+ * exaMarkSync() if DownloadFromScreen() was asynchronous. This is in
+ * contrast to most other acceleration calls in EXA.
+ *
+ * DownloadFromScreen() can aid in the largest bottleneck in pixmap
+ * migration, which is the read from framebuffer when evicting pixmaps from
+ * framebuffer memory. Thus, it is highly recommended, even though
+ * implementations are typically complicated.
+ *
+ * @return TRUE if the driver successfully downloaded the data. FALSE
+ * indicates that EXA should fall back to doing the download in software.
+ *
+ * DownloadFromScreen() is not required, but is highly recommended.
+ */
+ Bool (*DownloadFromScreen)(PixmapPtr pSrc,
+ int x, int y,
+ int w, int h,
+ char *dst, int dst_pitch);
+
+ /**
+ * MarkSync() requests that the driver mark a synchronization point,
+ * returning an driver-defined integer marker which could be requested for
+ * synchronization to later in WaitMarker(). This might be used in the
+ * future to avoid waiting for full hardware stalls before accessing pixmap
+ * data with the CPU, but is not important in the current incarnation of
+ * EXA.
+ *
+ * Note that drivers should call exaMarkSync() when they have done some
+ * acceleration, rather than their own MarkSync() handler, as otherwise EXA
+ * will be unaware of the driver's acceleration and not sync to it during
+ * fallbacks.
+ *
+ * MarkSync() is optional.
+ */
+ int (*MarkSync) (ScreenPtr pScreen);
+
+ /**
+ * WaitMarker() waits for all rendering before the given marker to have
+ * completed. If the driver does not implement MarkSync(), marker is
+ * meaningless, and all rendering by the hardware should be completed before
+ * WaitMarker() returns.
+ *
+ * Note that drivers should call exaWaitSync() to wait for all acceleration
+ * to finish, as otherwise EXA will be unaware of the driver having
+ * synchronized, resulting in excessive WaitMarker() calls.
+ *
+ * WaitMarker() is required of all drivers.
+ */
+ void (*WaitMarker) (ScreenPtr pScreen, int marker);
+
+ /** @{ */
+ /**
+ * PrepareAccess() is called before CPU access to an offscreen pixmap.
+ *
+ * @param pPix the pixmap being accessed
+ * @param index the index of the pixmap being accessed.
+ *
+ * PrepareAccess() will be called before CPU access to an offscreen pixmap.
+ * This can be used to set up hardware surfaces for byteswapping or
+ * untiling, or to adjust the pixmap's devPrivate.ptr for the purpose of
+ * making CPU access use a different aperture.
+ *
+ * The index is one of #EXA_PREPARE_DEST, #EXA_PREPARE_SRC,
+ * #EXA_PREPARE_MASK, #EXA_PREPARE_AUX_DEST, #EXA_PREPARE_AUX_SRC, or
+ * #EXA_PREPARE_AUX_MASK. Since only up to #EXA_NUM_PREPARE_INDICES pixmaps
+ * will have PrepareAccess() called on them per operation, drivers can have
+ * a small, statically-allocated space to maintain state for PrepareAccess()
+ * and FinishAccess() in. Note that PrepareAccess() is only called once per
+ * pixmap and operation, regardless of whether the pixmap is used as a
+ * destination and/or source, and the index may not reflect the usage.
+ *
+ * PrepareAccess() may fail. An example might be the case of hardware that
+ * can set up 1 or 2 surfaces for CPU access, but not 3. If PrepareAccess()
+ * fails, EXA will migrate the pixmap to system memory.
+ * DownloadFromScreen() must be implemented and must not fail if a driver
+ * wishes to fail in PrepareAccess(). PrepareAccess() must not fail when
+ * pPix is the visible screen, because the visible screen can not be
+ * migrated.
+ *
+ * @return TRUE if PrepareAccess() successfully prepared the pixmap for CPU
+ * drawing.
+ * @return FALSE if PrepareAccess() is unsuccessful and EXA should use
+ * DownloadFromScreen() to migate the pixmap out.
+ */
+ Bool (*PrepareAccess)(PixmapPtr pPix, int index);
+
+ /**
+ * FinishAccess() is called after CPU access to an offscreen pixmap.
+ *
+ * @param pPix the pixmap being accessed
+ * @param index the index of the pixmap being accessed.
+ *
+ * FinishAccess() will be called after finishing CPU access of an offscreen
+ * pixmap set up by PrepareAccess(). Note that the FinishAccess() will not be
+ * called if PrepareAccess() failed and the pixmap was migrated out.
+ */
+ void (*FinishAccess)(PixmapPtr pPix, int index);
+
+ /**
+ * PixmapIsOffscreen() is an optional driver replacement to
+ * exaPixmapHasGpuCopy(). Set to NULL if you want the standard behaviour
+ * of exaPixmapHasGpuCopy().
+ *
+ * @param pPix the pixmap
+ * @return TRUE if the given drawable is in framebuffer memory.
+ *
+ * exaPixmapHasGpuCopy() is used to determine if a pixmap is in offscreen
+ * memory, meaning that acceleration could probably be done to it, and that it
+ * will need to be wrapped by PrepareAccess()/FinishAccess() when accessing it
+ * with the CPU.
+ *
+ *
+ */
+ Bool (*PixmapIsOffscreen)(PixmapPtr pPix);
+
+ /** @name PrepareAccess() and FinishAccess() indices
+ * @{
+ */
+ /**
+ * EXA_PREPARE_DEST is the index for a pixmap that may be drawn to or
+ * read from.
+ */
+ #define EXA_PREPARE_DEST 0
+ /**
+ * EXA_PREPARE_SRC is the index for a pixmap that may be read from
+ */
+ #define EXA_PREPARE_SRC 1
+ /**
+ * EXA_PREPARE_SRC is the index for a second pixmap that may be read
+ * from.
+ */
+ #define EXA_PREPARE_MASK 2
+ /**
+ * EXA_PREPARE_AUX* are additional indices for other purposes, e.g.
+ * separate alpha maps with Composite operations.
+ */
+ #define EXA_PREPARE_AUX_DEST 3
+ #define EXA_PREPARE_AUX_SRC 4
+ #define EXA_PREPARE_AUX_MASK 5
+ #define EXA_NUM_PREPARE_INDICES 6
+ /** @} */
+
+ /**
+ * maxPitchPixels controls the pitch limitation for rendering from
+ * the card.
+ * The driver should never receive a request for rendering a pixmap
+ * that has a pitch (in pixels) beyond maxPitchPixels.
+ *
+ * Setting this field is optional -- if your hardware doesn't have
+ * a pitch limitation in pixels, don't set this. If neither this value
+ * nor maxPitchBytes is set, then maxPitchPixels is set to maxX.
+ * If set, it must not be smaller than maxX.
+ *
+ * @sa maxPitchBytes
+ */
+ int maxPitchPixels;
+
+ /**
+ * maxPitchBytes controls the pitch limitation for rendering from
+ * the card.
+ * The driver should never receive a request for rendering a pixmap
+ * that has a pitch (in bytes) beyond maxPitchBytes.
+ *
+ * Setting this field is optional -- if your hardware doesn't have
+ * a pitch limitation in bytes, don't set this.
+ * If set, it must not be smaller than maxX * 4.
+ * There's no default value for maxPitchBytes.
+ *
+ * @sa maxPitchPixels
+ */
+ int maxPitchBytes;
+
+ /* Hooks to allow driver to its own pixmap memory management */
+ void *(*CreatePixmap)(ScreenPtr pScreen, int size, int align);
+ void (*DestroyPixmap)(ScreenPtr pScreen, void *driverPriv);
+ /**
+ * Returning a pixmap with non-NULL devPrivate.ptr implies a pixmap which is
+ * not offscreen, which will never be accelerated and Prepare/FinishAccess won't
+ * be called.
+ */
+ Bool (*ModifyPixmapHeader)(PixmapPtr pPixmap, int width, int height,
+ int depth, int bitsPerPixel, int devKind,
+ pointer pPixData);
+
+ /* hooks for drivers with tiling support:
+ * driver MUST fill out new_fb_pitch with valid pitch of pixmap
+ */
+ void *(*CreatePixmap2)(ScreenPtr pScreen, int width, int height,
+ int depth, int class, int bitsPerPixel,
+ int *new_fb_pitch);
+ /** @} */
+} ExaDriverRec, *ExaDriverPtr;
+
+/** @name EXA driver flags
+ * @{
+ */
+/**
+ * EXA_OFFSCREEN_PIXMAPS indicates to EXA that the driver can support
+ * offscreen pixmaps.
+ */
+#define EXA_OFFSCREEN_PIXMAPS (1 << 0)
+
+/**
+ * EXA_OFFSCREEN_ALIGN_POT indicates to EXA that the driver needs pixmaps
+ * to have a power-of-two pitch.
+ */
+#define EXA_OFFSCREEN_ALIGN_POT (1 << 1)
+
+/**
+ * EXA_TWO_BITBLT_DIRECTIONS indicates to EXA that the driver can only
+ * support copies that are (left-to-right, top-to-bottom) or
+ * (right-to-left, bottom-to-top).
+ */
+#define EXA_TWO_BITBLT_DIRECTIONS (1 << 2)
+
+/**
+ * EXA_HANDLES_PIXMAPS indicates to EXA that the driver can handle
+ * all pixmap addressing and migration.
+ */
+#define EXA_HANDLES_PIXMAPS (1 << 3)
+
+/**
+ * EXA_SUPPORTS_PREPARE_AUX indicates to EXA that the driver can handle the
+ * EXA_PREPARE_AUX* indices in the Prepare/FinishAccess hooks. If there are no
+ * such hooks, this flag has no effect.
+ */
+#define EXA_SUPPORTS_PREPARE_AUX (1 << 4)
+
+/**
+ * EXA_SUPPORTS_OFFSCREEN_OVERLAPS indicates to EXA that the driver Copy hooks
+ * can handle the source and destination occupying overlapping offscreen memory
+ * areas. This allows the offscreen memory defragmentation code to defragment
+ * areas where the defragmented position overlaps the fragmented position.
+ *
+ * Typically this is supported by traditional 2D engines but not by 3D engines.
+ */
+#define EXA_SUPPORTS_OFFSCREEN_OVERLAPS (1 << 5)
+
+/**
+ * EXA_MIXED_PIXMAPS will hide unacceleratable pixmaps from drivers and manage the
+ * problem known software fallbacks like trapezoids. This only migrates pixmaps one way
+ * into a driver pixmap and then pins it.
+ */
+#define EXA_MIXED_PIXMAPS (1 << 6)
+
+/** @} */
+
+/* in exa.c */
+extern _X_EXPORT ExaDriverPtr
+exaDriverAlloc(void);
+
+extern _X_EXPORT Bool
+exaDriverInit(ScreenPtr pScreen,
+ ExaDriverPtr pScreenInfo);
+
+extern _X_EXPORT void
+exaDriverFini(ScreenPtr pScreen);
+
+extern _X_EXPORT void
+exaMarkSync(ScreenPtr pScreen);
+extern _X_EXPORT void
+exaWaitSync(ScreenPtr pScreen);
+
+extern _X_EXPORT unsigned long
+exaGetPixmapOffset(PixmapPtr pPix);
+
+extern _X_EXPORT unsigned long
+exaGetPixmapPitch(PixmapPtr pPix);
+
+extern _X_EXPORT unsigned long
+exaGetPixmapSize(PixmapPtr pPix);
+
+extern _X_EXPORT void *
+exaGetPixmapDriverPrivate(PixmapPtr p);
+
+
+/* in exa_offscreen.c */
+extern _X_EXPORT ExaOffscreenArea *
+exaOffscreenAlloc(ScreenPtr pScreen, int size, int align,
+ Bool locked,
+ ExaOffscreenSaveProc save,
+ pointer privData);
+
+extern _X_EXPORT ExaOffscreenArea *
+exaOffscreenFree(ScreenPtr pScreen, ExaOffscreenArea *area);
+
+extern _X_EXPORT void
+ExaOffscreenMarkUsed (PixmapPtr pPixmap);
+
+extern _X_EXPORT void
+exaEnableDisableFBAccess (int index, Bool enable);
+
+extern _X_EXPORT Bool
+exaDrawableIsOffscreen (DrawablePtr pDrawable);
+
+/* in exa.c */
+extern _X_EXPORT void
+exaMoveInPixmap (PixmapPtr pPixmap);
+
+extern _X_EXPORT void
+exaMoveOutPixmap (PixmapPtr pPixmap);
+
+
+/* in exa_unaccel.c */
+extern _X_EXPORT CARD32
+exaGetPixmapFirstPixel (PixmapPtr pPixmap);
+
+
+/**
+ * Returns TRUE if the given planemask covers all the significant bits in the
+ * pixel values for pDrawable.
+ */
+#define EXA_PM_IS_SOLID(_pDrawable, _pm) \
+ (((_pm) & FbFullMask((_pDrawable)->depth)) == \
+ FbFullMask((_pDrawable)->depth))
+
+#endif /* EXA_H */
diff --git a/xorg-server/exa/exa_classic.c b/xorg-server/exa/exa_classic.c
index 1a1467848..809b3f660 100644
--- a/xorg-server/exa/exa_classic.c
+++ b/xorg-server/exa/exa_classic.c
@@ -54,7 +54,7 @@ ExaGetPixmapAddress(PixmapPtr p)
*/
PixmapPtr
exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint)
+ unsigned class)
{
PixmapPtr pPixmap;
ExaPixmapPrivPtr pExaPixmap;
@@ -66,7 +66,7 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
return NullPixmap;
swap(pExaScr, pScreen, CreatePixmap);
- pPixmap = pScreen->CreatePixmap (pScreen, w, h, depth, usage_hint);
+ pPixmap = pScreen->CreatePixmap (pScreen, w, h, depth, class);
swap(pExaScr, pScreen, CreatePixmap);
if (!pPixmap)
diff --git a/xorg-server/exa/exa_driver.c b/xorg-server/exa/exa_driver.c
index b9903d1bc..8893452a8 100644
--- a/xorg-server/exa/exa_driver.c
+++ b/xorg-server/exa/exa_driver.c
@@ -1,226 +1,226 @@
-/*
- * Copyright © 2009 Maarten Maathuis
- *
- * 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_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-
-#include "exa_priv.h"
-#include "exa.h"
-
-/* This file holds the driver allocated pixmaps specific implementation. */
-
-static _X_INLINE void*
-ExaGetPixmapAddress(PixmapPtr p)
-{
- ExaPixmapPriv(p);
-
- return pExaPixmap->sys_ptr;
-}
-
-/**
- * exaCreatePixmap() creates a new pixmap.
- *
- * Pixmaps are always marked as pinned, because exa has no control over them.
- */
-PixmapPtr
-exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint)
-{
- PixmapPtr pPixmap;
- ExaPixmapPrivPtr pExaPixmap;
- int bpp;
- size_t paddedWidth, datasize;
- ExaScreenPriv(pScreen);
-
- if (w > 32767 || h > 32767)
- return NullPixmap;
-
- swap(pExaScr, pScreen, CreatePixmap);
- pPixmap = pScreen->CreatePixmap(pScreen, 0, 0, depth, usage_hint);
- swap(pExaScr, pScreen, CreatePixmap);
-
- if (!pPixmap)
- return NULL;
-
- pExaPixmap = ExaGetPixmapPriv(pPixmap);
- pExaPixmap->driverPriv = NULL;
-
- bpp = pPixmap->drawable.bitsPerPixel;
-
- /* Set this before driver hooks, to allow for driver pixmaps without gpu
- * memory to back it. These pixmaps have a valid pointer at all times.
- */
- pPixmap->devPrivate.ptr = NULL;
-
- if (pExaScr->info->CreatePixmap2) {
- int new_pitch = 0;
- pExaPixmap->driverPriv = pExaScr->info->CreatePixmap2(pScreen, w, h, depth, usage_hint, bpp, &new_pitch);
- paddedWidth = pExaPixmap->fb_pitch = new_pitch;
- }
- else {
- paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
- if (paddedWidth / 4 > 32767 || h > 32767)
- return NullPixmap;
-
- exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
-
- if (paddedWidth < pExaPixmap->fb_pitch)
- paddedWidth = pExaPixmap->fb_pitch;
- datasize = h * paddedWidth;
- pExaPixmap->driverPriv = pExaScr->info->CreatePixmap(pScreen, datasize, 0);
- }
-
- if (!pExaPixmap->driverPriv) {
- swap(pExaScr, pScreen, DestroyPixmap);
- pScreen->DestroyPixmap (pPixmap);
- swap(pExaScr, pScreen, DestroyPixmap);
- return NULL;
- }
-
- /* Allow ModifyPixmapHeader to set sys_ptr appropriately. */
- pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
- pExaPixmap->fb_ptr = NULL;
- pExaPixmap->pDamage = NULL;
- pExaPixmap->sys_ptr = NULL;
-
- (*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0,
- paddedWidth, NULL);
-
- pExaPixmap->area = NULL;
-
- exaSetAccelBlock(pExaScr, pExaPixmap,
- w, h, bpp);
-
- pExaPixmap->use_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
-
- /* During a fallback we must prepare access. */
- if (pExaScr->fallback_counter)
- exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_AUX_DEST);
-
- return pPixmap;
-}
-
-Bool
-exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth,
- int bitsPerPixel, int devKind, pointer pPixData)
-{
- ScreenPtr pScreen;
- ExaScreenPrivPtr pExaScr;
- ExaPixmapPrivPtr pExaPixmap;
- Bool ret;
-
- if (!pPixmap)
- return FALSE;
-
- pScreen = pPixmap->drawable.pScreen;
- pExaScr = ExaGetScreenPriv(pScreen);
- pExaPixmap = ExaGetPixmapPriv(pPixmap);
-
- if (pExaPixmap) {
- if (pPixData)
- pExaPixmap->sys_ptr = pPixData;
-
- if (devKind > 0)
- pExaPixmap->sys_pitch = devKind;
-
- if (width > 0 && height > 0 && bitsPerPixel > 0) {
- exaSetFbPitch(pExaScr, pExaPixmap,
- width, height, bitsPerPixel);
-
- exaSetAccelBlock(pExaScr, pExaPixmap,
- width, height, bitsPerPixel);
- }
- }
-
- if (pExaScr->info->ModifyPixmapHeader) {
- ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth,
- bitsPerPixel, devKind, pPixData);
- /* For EXA_HANDLES_PIXMAPS, we set pPixData to NULL.
- * If pPixmap->devPrivate.ptr is non-NULL, then we've got a
- * !has_gpu_copy pixmap. We need to store the pointer,
- * because PrepareAccess won't be called.
- */
- if (!pPixData && pPixmap->devPrivate.ptr && pPixmap->devKind) {
- pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr;
- pExaPixmap->sys_pitch = pPixmap->devKind;
- }
- if (ret == TRUE)
- goto out;
- }
-
- swap(pExaScr, pScreen, ModifyPixmapHeader);
- ret = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth,
- bitsPerPixel, devKind, pPixData);
- swap(pExaScr, pScreen, ModifyPixmapHeader);
-
-out:
- /* Always NULL this, we don't want lingering pointers. */
- pPixmap->devPrivate.ptr = NULL;
-
- return ret;
-}
-
-Bool
-exaDestroyPixmap_driver (PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- ExaScreenPriv(pScreen);
- Bool ret;
-
- if (pPixmap->refcnt == 1)
- {
- ExaPixmapPriv (pPixmap);
-
- exaDestroyPixmap(pPixmap);
-
- if (pExaPixmap->driverPriv)
- pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
- pExaPixmap->driverPriv = NULL;
- }
-
- swap(pExaScr, pScreen, DestroyPixmap);
- ret = pScreen->DestroyPixmap (pPixmap);
- swap(pExaScr, pScreen, DestroyPixmap);
-
- return ret;
-}
-
-Bool
-exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- ExaScreenPriv(pScreen);
- pointer saved_ptr;
- Bool ret;
-
- saved_ptr = pPixmap->devPrivate.ptr;
- pPixmap->devPrivate.ptr = ExaGetPixmapAddress(pPixmap);
- ret = pExaScr->info->PixmapIsOffscreen(pPixmap);
- pPixmap->devPrivate.ptr = saved_ptr;
-
- return ret;
-}
+/*
+ * Copyright © 2009 Maarten Maathuis
+ *
+ * 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_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <string.h>
+
+#include "exa_priv.h"
+#include "exa.h"
+
+/* This file holds the driver allocated pixmaps specific implementation. */
+
+static _X_INLINE void*
+ExaGetPixmapAddress(PixmapPtr p)
+{
+ ExaPixmapPriv(p);
+
+ return pExaPixmap->sys_ptr;
+}
+
+/**
+ * exaCreatePixmap() creates a new pixmap.
+ *
+ * Pixmaps are always marked as pinned, because exa has no control over them.
+ */
+PixmapPtr
+exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
+ unsigned class)
+{
+ PixmapPtr pPixmap;
+ ExaPixmapPrivPtr pExaPixmap;
+ int bpp;
+ size_t paddedWidth, datasize;
+ ExaScreenPriv(pScreen);
+
+ if (w > 32767 || h > 32767)
+ return NullPixmap;
+
+ swap(pExaScr, pScreen, CreatePixmap);
+ pPixmap = pScreen->CreatePixmap(pScreen, 0, 0, depth, class);
+ swap(pExaScr, pScreen, CreatePixmap);
+
+ if (!pPixmap)
+ return NULL;
+
+ pExaPixmap = ExaGetPixmapPriv(pPixmap);
+ pExaPixmap->driverPriv = NULL;
+
+ bpp = pPixmap->drawable.bitsPerPixel;
+
+ /* Set this before driver hooks, to allow for driver pixmaps without gpu
+ * memory to back it. These pixmaps have a valid pointer at all times.
+ */
+ pPixmap->devPrivate.ptr = NULL;
+
+ if (pExaScr->info->CreatePixmap2) {
+ int new_pitch = 0;
+ pExaPixmap->driverPriv = pExaScr->info->CreatePixmap2(pScreen, w, h, depth, class, bpp, &new_pitch);
+ paddedWidth = pExaPixmap->fb_pitch = new_pitch;
+ }
+ else {
+ paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
+ if (paddedWidth / 4 > 32767 || h > 32767)
+ return NullPixmap;
+
+ exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
+
+ if (paddedWidth < pExaPixmap->fb_pitch)
+ paddedWidth = pExaPixmap->fb_pitch;
+ datasize = h * paddedWidth;
+ pExaPixmap->driverPriv = pExaScr->info->CreatePixmap(pScreen, datasize, 0);
+ }
+
+ if (!pExaPixmap->driverPriv) {
+ swap(pExaScr, pScreen, DestroyPixmap);
+ pScreen->DestroyPixmap (pPixmap);
+ swap(pExaScr, pScreen, DestroyPixmap);
+ return NULL;
+ }
+
+ /* Allow ModifyPixmapHeader to set sys_ptr appropriately. */
+ pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
+ pExaPixmap->fb_ptr = NULL;
+ pExaPixmap->pDamage = NULL;
+ pExaPixmap->sys_ptr = NULL;
+
+ (*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0,
+ paddedWidth, NULL);
+
+ pExaPixmap->area = NULL;
+
+ exaSetAccelBlock(pExaScr, pExaPixmap,
+ w, h, bpp);
+
+ pExaPixmap->use_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
+
+ /* During a fallback we must prepare access. */
+ if (pExaScr->fallback_counter)
+ exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_AUX_DEST);
+
+ return pPixmap;
+}
+
+Bool
+exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth,
+ int bitsPerPixel, int devKind, pointer pPixData)
+{
+ ScreenPtr pScreen;
+ ExaScreenPrivPtr pExaScr;
+ ExaPixmapPrivPtr pExaPixmap;
+ Bool ret;
+
+ if (!pPixmap)
+ return FALSE;
+
+ pScreen = pPixmap->drawable.pScreen;
+ pExaScr = ExaGetScreenPriv(pScreen);
+ pExaPixmap = ExaGetPixmapPriv(pPixmap);
+
+ if (pExaPixmap) {
+ if (pPixData)
+ pExaPixmap->sys_ptr = pPixData;
+
+ if (devKind > 0)
+ pExaPixmap->sys_pitch = devKind;
+
+ if (width > 0 && height > 0 && bitsPerPixel > 0) {
+ exaSetFbPitch(pExaScr, pExaPixmap,
+ width, height, bitsPerPixel);
+
+ exaSetAccelBlock(pExaScr, pExaPixmap,
+ width, height, bitsPerPixel);
+ }
+ }
+
+ if (pExaScr->info->ModifyPixmapHeader) {
+ ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth,
+ bitsPerPixel, devKind, pPixData);
+ /* For EXA_HANDLES_PIXMAPS, we set pPixData to NULL.
+ * If pPixmap->devPrivate.ptr is non-NULL, then we've got a
+ * !has_gpu_copy pixmap. We need to store the pointer,
+ * because PrepareAccess won't be called.
+ */
+ if (!pPixData && pPixmap->devPrivate.ptr && pPixmap->devKind) {
+ pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr;
+ pExaPixmap->sys_pitch = pPixmap->devKind;
+ }
+ if (ret == TRUE)
+ goto out;
+ }
+
+ swap(pExaScr, pScreen, ModifyPixmapHeader);
+ ret = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth,
+ bitsPerPixel, devKind, pPixData);
+ swap(pExaScr, pScreen, ModifyPixmapHeader);
+
+out:
+ /* Always NULL this, we don't want lingering pointers. */
+ pPixmap->devPrivate.ptr = NULL;
+
+ return ret;
+}
+
+Bool
+exaDestroyPixmap_driver (PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ExaScreenPriv(pScreen);
+ Bool ret;
+
+ if (pPixmap->refcnt == 1)
+ {
+ ExaPixmapPriv (pPixmap);
+
+ exaDestroyPixmap(pPixmap);
+
+ if (pExaPixmap->driverPriv)
+ pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
+ pExaPixmap->driverPriv = NULL;
+ }
+
+ swap(pExaScr, pScreen, DestroyPixmap);
+ ret = pScreen->DestroyPixmap (pPixmap);
+ swap(pExaScr, pScreen, DestroyPixmap);
+
+ return ret;
+}
+
+Bool
+exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ExaScreenPriv(pScreen);
+ pointer saved_ptr;
+ Bool ret;
+
+ saved_ptr = pPixmap->devPrivate.ptr;
+ pPixmap->devPrivate.ptr = ExaGetPixmapAddress(pPixmap);
+ ret = pExaScr->info->PixmapIsOffscreen(pPixmap);
+ pPixmap->devPrivate.ptr = saved_ptr;
+
+ return ret;
+}
diff --git a/xorg-server/exa/exa_migration_mixed.c b/xorg-server/exa/exa_migration_mixed.c
index 9489b2927..00227e3c4 100644
--- a/xorg-server/exa/exa_migration_mixed.c
+++ b/xorg-server/exa/exa_migration_mixed.c
@@ -39,7 +39,7 @@ exaCreateDriverPixmap_mixed(PixmapPtr pPixmap)
ExaPixmapPriv(pPixmap);
int w = pPixmap->drawable.width, h = pPixmap->drawable.height;
int depth = pPixmap->drawable.depth, bpp = pPixmap->drawable.bitsPerPixel;
- int usage_hint = pPixmap->usage_hint;
+ int class = pPixmap->drawable.class;
int paddedWidth = pExaPixmap->sys_pitch;
/* Already done. */
@@ -55,7 +55,7 @@ exaCreateDriverPixmap_mixed(PixmapPtr pPixmap)
if (pExaScr->info->CreatePixmap2) {
int new_pitch = 0;
- pExaPixmap->driverPriv = pExaScr->info->CreatePixmap2(pScreen, w, h, depth, usage_hint, bpp, &new_pitch);
+ pExaPixmap->driverPriv = pExaScr->info->CreatePixmap2(pScreen, w, h, depth, class, bpp, &new_pitch);
paddedWidth = pExaPixmap->fb_pitch = new_pitch;
} else {
if (paddedWidth < pExaPixmap->fb_pitch)
diff --git a/xorg-server/exa/exa_mixed.c b/xorg-server/exa/exa_mixed.c
index 188a7e0a6..38700e900 100644
--- a/xorg-server/exa/exa_mixed.c
+++ b/xorg-server/exa/exa_mixed.c
@@ -47,7 +47,7 @@ ExaGetPixmapAddress(PixmapPtr p)
*/
PixmapPtr
exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint)
+ unsigned class)
{
PixmapPtr pPixmap;
ExaPixmapPrivPtr pExaPixmap;
@@ -59,7 +59,7 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
return NullPixmap;
swap(pExaScr, pScreen, CreatePixmap);
- pPixmap = pScreen->CreatePixmap(pScreen, 0, 0, depth, usage_hint);
+ pPixmap = pScreen->CreatePixmap(pScreen, 0, 0, depth, class);
swap(pExaScr, pScreen, CreatePixmap);
if (!pPixmap)
diff --git a/xorg-server/exa/exa_priv.h b/xorg-server/exa/exa_priv.h
index 1b8cf294a..546a3e6e8 100644
--- a/xorg-server/exa/exa_priv.h
+++ b/xorg-server/exa/exa_priv.h
@@ -588,7 +588,7 @@ extern const GCFuncs exaGCFuncs;
/* exa_classic.c */
PixmapPtr
exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint);
+ unsigned class);
Bool
exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int depth,
@@ -603,7 +603,7 @@ exaPixmapHasGpuCopy_classic(PixmapPtr pPixmap);
/* exa_driver.c */
PixmapPtr
exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint);
+ unsigned class);
Bool
exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth,
@@ -618,7 +618,7 @@ exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap);
/* exa_mixed.c */
PixmapPtr
exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint);
+ unsigned class);
Bool
exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
diff --git a/xorg-server/fb/fb.h b/xorg-server/fb/fb.h
index 29eecadb3..a33cc40ce 100644
--- a/xorg-server/fb/fb.h
+++ b/xorg-server/fb/fb.h
@@ -1598,11 +1598,11 @@ fbPictureInit (ScreenPtr pScreen,
extern _X_EXPORT PixmapPtr
fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
- unsigned usage_hint);
+ unsigned class);
extern _X_EXPORT PixmapPtr
fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint);
+ unsigned class);
extern _X_EXPORT Bool
fbDestroyPixmap (PixmapPtr pPixmap);
diff --git a/xorg-server/fb/fb24_32.c b/xorg-server/fb/fb24_32.c
index 748a0ec04..b402a2357 100644
--- a/xorg-server/fb/fb24_32.c
+++ b/xorg-server/fb/fb24_32.c
@@ -546,7 +546,7 @@ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel)
pNewTile = pScreen->CreatePixmap(pScreen, pOldTile->drawable.width,
pOldTile->drawable.height,
pOldTile->drawable.depth,
- pOldTile->usage_hint);
+ pOldTile->drawable.class);
if (!pNewTile)
return 0;
fbGetDrawable (&pOldTile->drawable,
diff --git a/xorg-server/fb/fbpixmap.c b/xorg-server/fb/fbpixmap.c
index 80d3252d2..e73a2f02d 100644
--- a/xorg-server/fb/fbpixmap.c
+++ b/xorg-server/fb/fbpixmap.c
@@ -30,7 +30,7 @@
PixmapPtr
fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
- unsigned usage_hint)
+ unsigned class)
{
PixmapPtr pPixmap;
size_t datasize;
@@ -54,7 +54,7 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
if (!pPixmap)
return NullPixmap;
pPixmap->drawable.type = DRAWABLE_PIXMAP;
- pPixmap->drawable.class = 0;
+ pPixmap->drawable.class = class;
pPixmap->drawable.pScreen = pScreen;
pPixmap->drawable.depth = depth;
pPixmap->drawable.bitsPerPixel = bpp;
@@ -78,14 +78,12 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
pPixmap->screen_y = 0;
#endif
- pPixmap->usage_hint = usage_hint;
-
return pPixmap;
}
PixmapPtr
fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint)
+ unsigned class)
{
int bpp;
bpp = BitsPerPixel (depth);
@@ -93,7 +91,7 @@ fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth,
if (bpp == 32 && depth <= 24)
bpp = fbGetScreenPrivate(pScreen)->pix32bpp;
#endif
- return fbCreatePixmapBpp (pScreen, width, height, depth, bpp, usage_hint);
+ return fbCreatePixmapBpp (pScreen, width, height, depth, bpp, class);
}
Bool
diff --git a/xorg-server/glx/glapi.c b/xorg-server/glx/glapi.c
index 09b7149dc..7c75d2d5a 100644
--- a/xorg-server/glx/glapi.c
+++ b/xorg-server/glx/glapi.c
@@ -220,8 +220,6 @@ PUBLIC const void *_glapi_Context = NULL;
#if defined(THREADS)
-static GLboolean ThreadSafe = GL_FALSE; /**< In thread-safe mode? */
-
_glthread_TSD _gl_DispatchTSD; /**< Per-thread dispatch pointer */
static _glthread_TSD ContextTSD; /**< Per-thread context pointer */
@@ -268,31 +266,11 @@ _glthread_DECLARE_STATIC_MUTEX(ThreadCheckMutex);
#define CHECK_MULTITHREAD_UNLOCK() _glthread_UNLOCK_MUTEX(ThreadCheckMutex)
#endif
/**
- * We should call this periodically from a function such as glXMakeCurrent
- * in order to test if multiple threads are being used.
+ * xserver's gl is not multithreaded, we promise.
*/
PUBLIC void
_glapi_check_multithread(void)
{
- static unsigned long knownID;
- static GLboolean firstCall = GL_TRUE;
-
- if (ThreadSafe)
- return;
-
- CHECK_MULTITHREAD_LOCK();
- if (firstCall) {
- _glapi_init_multithread();
-
- knownID = _glthread_GetID();
- firstCall = GL_FALSE;
- }
- else if (knownID != _glthread_GetID()) {
- ThreadSafe = GL_TRUE;
- _glapi_set_dispatch(NULL);
- _glapi_set_context(NULL);
- }
- CHECK_MULTITHREAD_UNLOCK();
}
#else
@@ -321,7 +299,7 @@ _glapi_set_context(void *context)
_glapi_tls_Context = context;
#elif defined(THREADS)
_glthread_SetTSD(&ContextTSD, context);
- _glapi_Context = (ThreadSafe) ? NULL : context;
+ _glapi_Context = context;
#else
_glapi_Context = context;
#endif
@@ -339,8 +317,6 @@ _glapi_get_context(void)
{
#if defined(GLX_USE_TLS)
return _glapi_tls_Context;
-#elif defined(THREADS)
- return (ThreadSafe) ? _glthread_GetTSD(&ContextTSD) : _glapi_Context;
#else
return _glapi_Context;
#endif
@@ -362,18 +338,9 @@ _glapi_set_dispatch(struct _glapi_table *dispatch)
/* use the no-op functions */
dispatch = (struct _glapi_table *) __glapi_noop_table;
}
-#ifdef DEBUG
- else {
- _glapi_check_table_not_null(dispatch);
- _glapi_check_table(dispatch);
- }
-#endif
#if defined(GLX_USE_TLS)
_glapi_tls_Dispatch = dispatch;
-#elif defined(THREADS)
- _glthread_SetTSD(&_gl_DispatchTSD, (void *) dispatch);
- _glapi_Dispatch = (ThreadSafe) ? NULL : dispatch;
#else
_glapi_Dispatch = dispatch;
#endif
@@ -389,10 +356,6 @@ _glapi_get_dispatch(void)
{
#if defined(GLX_USE_TLS)
return _glapi_tls_Dispatch;
-#elif defined(THREADS)
- return (ThreadSafe)
- ? (struct _glapi_table *) _glthread_GetTSD(&_gl_DispatchTSD)
- : _glapi_Dispatch;
#else
return _glapi_Dispatch;
#endif
@@ -1128,84 +1091,3 @@ _glapi_get_dispatch_table_size(void)
return FIRST_DYNAMIC_OFFSET + MAX_EXTENSION_FUNCS;
}
-
-/**
- * Make sure there are no NULL pointers in the given dispatch table.
- * Intended for debugging purposes.
- */
-void
-_glapi_check_table_not_null(const struct _glapi_table *table)
-{
-#ifdef EXTRA_DEBUG /* set to DEBUG for extra DEBUG */
- const GLuint entries = _glapi_get_dispatch_table_size();
- const void **tab = (const void **) table;
- GLuint i;
- for (i = 1; i < entries; i++) {
- assert(tab[i]);
- }
-#else
- (void) table;
-#endif
-}
-
-
-/**
- * Do some spot checks to be sure that the dispatch table
- * slots are assigned correctly. For debugging only.
- */
-void
-_glapi_check_table(const struct _glapi_table *table)
-{
-#ifdef EXTRA_DEBUG /* set to DEBUG for extra DEBUG */
- {
- GLuint BeginOffset = _glapi_get_proc_offset("glBegin");
- char *BeginFunc = (char*) &table->Begin;
- GLuint offset = (BeginFunc - (char *) table) / sizeof(void *);
- assert(BeginOffset == offset);
- }
- {
- GLuint viewportOffset = _glapi_get_proc_offset("glViewport");
- char *viewportFunc = (char*) &table->Viewport;
- GLuint offset = (viewportFunc - (char *) table) / sizeof(void *);
- assert(viewportOffset == offset);
- }
- {
- GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer");
- char *VertexPointerFunc = (char*) &table->VertexPointer;
- GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *);
- assert(VertexPointerOffset == offset);
- }
- {
- GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax");
- char *ResetMinMaxFunc = (char*) &table->ResetMinmax;
- GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *);
- assert(ResetMinMaxOffset == offset);
- }
- {
- GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor");
- char *blendColorFunc = (char*) &table->BlendColor;
- GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *);
- assert(blendColorOffset == offset);
- }
- {
- GLuint secondaryColor3fOffset = _glapi_get_proc_offset("glSecondaryColor3fEXT");
- char *secondaryColor3fFunc = (char*) &table->SecondaryColor3fEXT;
- GLuint offset = (secondaryColor3fFunc - (char *) table) / sizeof(void *);
- assert(secondaryColor3fOffset == offset);
- }
- {
- GLuint pointParameterivOffset = _glapi_get_proc_offset("glPointParameterivNV");
- char *pointParameterivFunc = (char*) &table->PointParameterivNV;
- GLuint offset = (pointParameterivFunc - (char *) table) / sizeof(void *);
- assert(pointParameterivOffset == offset);
- }
- {
- GLuint setFenceOffset = _glapi_get_proc_offset("glSetFenceNV");
- char *setFenceFunc = (char*) &table->SetFenceNV;
- GLuint offset = (setFenceFunc - (char *) table) / sizeof(void *);
- assert(setFenceOffset == offset);
- }
-#else
- (void) table;
-#endif
-}
diff --git a/xorg-server/glx/glthread.c b/xorg-server/glx/glthread.c
index c466e9bf0..5da7e433c 100644
--- a/xorg-server/glx/glthread.c
+++ b/xorg-server/glx/glthread.c
@@ -25,15 +25,13 @@
/*
* XXX There's probably some work to do in order to make this file
- * truly reusable outside of Mesa. First, the glheader.h include must go.
+ * truly reusable outside of Mesa.
*/
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/Xfuncproto.h>
-#ifndef PUBLIC
-#define PUBLIC
-#endif
#endif
#include <stdlib.h>
@@ -74,7 +72,7 @@
*/
#ifdef PTHREADS
-PUBLIC unsigned long
+_X_EXPORT unsigned long
_glthread_GetID(void)
{
return (unsigned long) pthread_self();
@@ -116,8 +114,6 @@ _glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
#endif /* PTHREADS */
-
-
/*
* Win32 Threads. The only available option for Windows 95/NT.
* Be sure that you compile using the Multithreaded runtime, otherwise
@@ -125,12 +121,20 @@ _glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
*/
#ifdef WIN32_THREADS
-static void InsteadOf_exit(int nCode)
+void FreeTSD(_glthread_TSD *p)
{
- DWORD dwErr = GetLastError();
+ if (p->initMagic==INIT_MAGIC) {
+ TlsFree(p->key);
+ p->initMagic=0;
+ }
}
-PUBLIC unsigned long
+void InsteadOf_exit(int nCode)
+{
+ DWORD dwErr=GetLastError();
+}
+
+unsigned long
_glthread_GetID(void)
{
return GetCurrentThreadId();
@@ -142,24 +146,13 @@ _glthread_InitTSD(_glthread_TSD *tsd)
{
tsd->key = TlsAlloc();
if (tsd->key == TLS_OUT_OF_INDEXES) {
- perror(INIT_TSD_ERROR);
+ perror("Mesa:_glthread_InitTSD");
InsteadOf_exit(-1);
}
tsd->initMagic = INIT_MAGIC;
}
-void
-_glthread_DestroyTSD(_glthread_TSD *tsd)
-{
- if (tsd->initMagic != INIT_MAGIC) {
- return;
- }
- TlsFree(tsd->key);
- tsd->initMagic = 0x0;
-}
-
-
void *
_glthread_GetTSD(_glthread_TSD *tsd)
{
@@ -179,61 +172,20 @@ _glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
_glthread_InitTSD(tsd);
}
if (TlsSetValue(tsd->key, ptr) == 0) {
- perror(SET_TSD_ERROR);
- InsteadOf_exit(-1);
+ perror("Mesa:_glthread_SetTSD");
+ InsteadOf_exit(-1);
}
}
#endif /* WIN32_THREADS */
-/*
- * BeOS threads
- */
-#ifdef BEOS_THREADS
-
-PUBLIC unsigned long
-_glthread_GetID(void)
-{
- return (unsigned long) find_thread(NULL);
-}
-
-void
-_glthread_InitTSD(_glthread_TSD *tsd)
-{
- tsd->key = tls_allocate();
- tsd->initMagic = INIT_MAGIC;
-}
-
-void *
-_glthread_GetTSD(_glthread_TSD *tsd)
-{
- if (tsd->initMagic != (int) INIT_MAGIC) {
- _glthread_InitTSD(tsd);
- }
- return tls_get(tsd->key);
-}
-
-void
-_glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
-{
- if (tsd->initMagic != (int) INIT_MAGIC) {
- _glthread_InitTSD(tsd);
- }
- tls_set(tsd->key, ptr);
-}
-
-#endif /* BEOS_THREADS */
-
-
-
#else /* THREADS */
-
/*
* no-op functions
*/
-PUBLIC unsigned long
+_X_EXPORT unsigned long
_glthread_GetID(void)
{
return 0;
diff --git a/xorg-server/glx/glthread.h b/xorg-server/glx/glthread.h
index 4fe99284a..28793fcc7 100644
--- a/xorg-server/glx/glthread.h
+++ b/xorg-server/glx/glthread.h
@@ -64,12 +64,18 @@
#define GLTHREAD_H
-#if defined(PTHREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)
-#ifndef THREADS
-#define THREADS
+#if defined(USE_MGL_NAMESPACE)
+#define _glapi_Dispatch _mglapi_Dispatch
#endif
+
+#if (defined(PTHREADS) || defined(WIN32_THREADS)) \
+ && !defined(THREADS)
+# define THREADS
#endif
+#ifdef VMS
+#include <GL/vms_x_fix.h>
+#endif
/*
* POSIX threads. This should be your choice in the Unix world
@@ -110,6 +116,18 @@ typedef pthread_mutex_t _glthread_Mutex;
#endif /* PTHREADS */
+
+
+/*
+ * Solaris threads. Use only up to Solaris 2.4.
+ * Solaris 2.5 and higher provide POSIX threads.
+ * Be sure to compile with -mt on the Solaris compilers, or
+ * use -D_REENTRANT if using gcc.
+ */
+
+
+
+
/*
* Windows threads. Should work with Windows NT and 95.
* IMPORTANT: Link with multithreaded runtime library when THREADS are
@@ -127,44 +145,22 @@ typedef HANDLE _glthread_Thread;
typedef CRITICAL_SECTION _glthread_Mutex;
-#define _glthread_DECLARE_STATIC_MUTEX(name) \
- /* static */ _glthread_Mutex name = { 0, 0, 0, 0, 0, 0 }
-
-#define _glthread_INIT_MUTEX(name) \
- InitializeCriticalSection(&name)
-
-#define _glthread_DESTROY_MUTEX(name) \
- DeleteCriticalSection(&name)
-
-#define _glthread_LOCK_MUTEX(name) \
- EnterCriticalSection(&name)
-
-#define _glthread_UNLOCK_MUTEX(name) \
- LeaveCriticalSection(&name)
+#define _glthread_DECLARE_STATIC_MUTEX(name) /*static*/ _glthread_Mutex name = {0,0,0,0,0,0}
+#define _glthread_INIT_MUTEX(name) InitializeCriticalSection(&name)
+#define _glthread_DESTROY_MUTEX(name) DeleteCriticalSection(&name)
+#define _glthread_LOCK_MUTEX(name) EnterCriticalSection(&name)
+#define _glthread_UNLOCK_MUTEX(name) LeaveCriticalSection(&name)
#endif /* WIN32_THREADS */
-
/*
* BeOS threads. R5.x required.
*/
#ifdef BEOS_THREADS
-/* Problem with OS.h and this file on haiku */
-#ifndef __HAIKU__
#include <kernel/OS.h>
-#endif
-
#include <support/TLS.h>
-/* The only two typedefs required here
- * this is cause of the OS.h problem
- */
-#ifdef __HAIKU__
-typedef int32 thread_id;
-typedef int32 sem_id;
-#endif
-
typedef struct {
int32 key;
int initMagic;
@@ -179,40 +175,28 @@ typedef struct {
} benaphore;
typedef benaphore _glthread_Mutex;
-#define _glthread_DECLARE_STATIC_MUTEX(name) \
- static _glthread_Mutex name = { 0, 0 }
+#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = { 0, 0 }
+#define _glthread_INIT_MUTEX(name) name.sem = create_sem(0, #name"_benaphore"), name.lock = 0
+#define _glthread_DESTROY_MUTEX(name) delete_sem(name.sem), name.lock = 0
+#define _glthread_LOCK_MUTEX(name) if (name.sem == 0) _glthread_INIT_MUTEX(name); \
+ if (atomic_add(&(name.lock), 1) >= 1) acquire_sem(name.sem)
+#define _glthread_UNLOCK_MUTEX(name) if (atomic_add(&(name.lock), -1) > 1) release_sem(name.sem)
-#define _glthread_INIT_MUTEX(name) \
- name.sem = create_sem(0, #name"_benaphore"), \
- name.lock = 0
-
-#define _glthread_DESTROY_MUTEX(name) \
- delete_sem(name.sem), \
- name.lock = 0
-
-#define _glthread_LOCK_MUTEX(name) \
- if (name.sem == 0) \
- _glthread_INIT_MUTEX(name); \
- if (atomic_add(&(name.lock), 1) >= 1) \
- acquire_sem(name.sem)
+#endif /* BEOS_THREADS */
-#define _glthread_UNLOCK_MUTEX(name) \
- if (atomic_add(&(name.lock), -1) > 1) \
- release_sem(name.sem)
-#endif /* BEOS_THREADS */
+#ifndef THREADS
/*
* THREADS not defined
*/
-#ifndef THREADS
-typedef unsigned _glthread_TSD;
+typedef int _glthread_TSD;
-typedef unsigned _glthread_Thread;
+typedef int _glthread_Thread;
-typedef unsigned _glthread_Mutex;
+typedef int _glthread_Mutex;
#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0
@@ -240,10 +224,6 @@ extern void
_glthread_InitTSD(_glthread_TSD *);
-extern void
-_glthread_DestroyTSD(_glthread_TSD *); /* WIN32 only */
-
-
extern void *
_glthread_GetTSD(_glthread_TSD *);
@@ -251,5 +231,22 @@ _glthread_GetTSD(_glthread_TSD *);
extern void
_glthread_SetTSD(_glthread_TSD *, void *);
+#if defined(GLX_USE_TLS)
+
+extern __thread struct _glapi_table * _glapi_tls_Dispatch
+ __attribute__((tls_model("initial-exec")));
+
+#define GET_DISPATCH() _glapi_tls_Dispatch
+
+#elif !defined(GL_CALL)
+# if defined(THREADS)
+# define GET_DISPATCH() \
+ ((__builtin_expect( _glapi_Dispatch != NULL, 1 )) \
+ ? _glapi_Dispatch : _glapi_get_dispatch())
+# else
+# define GET_DISPATCH() _glapi_Dispatch
+# endif /* defined(THREADS) */
+#endif /* ndef GL_CALL */
+
#endif /* THREADS_H */
diff --git a/xorg-server/hw/dmx/dmxpixmap.c b/xorg-server/hw/dmx/dmxpixmap.c
index 119dd1134..9a098777d 100644
--- a/xorg-server/hw/dmx/dmxpixmap.c
+++ b/xorg-server/hw/dmx/dmxpixmap.c
@@ -82,7 +82,7 @@ void dmxBECreatePixmap(PixmapPtr pPixmap)
/** Create a pixmap for \a pScreen with the specified \a width, \a
* height, and \a depth. */
PixmapPtr dmxCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint)
+ unsigned class)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
PixmapPtr pPixmap;
@@ -104,7 +104,7 @@ PixmapPtr dmxCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
return NullPixmap;
pPixmap->drawable.type = DRAWABLE_PIXMAP;
- pPixmap->drawable.class = 0;
+ pPixmap->drawable.class = class;
pPixmap->drawable.pScreen = pScreen;
pPixmap->drawable.depth = depth;
pPixmap->drawable.bitsPerPixel = bpp;
@@ -116,7 +116,6 @@ PixmapPtr dmxCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
pPixmap->drawable.height = height;
pPixmap->devKind = PixmapBytePad(width, bpp);
pPixmap->refcnt = 1;
- pPixmap->usage_hint = usage_hint;
pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
pPixPriv->pixmap = (Pixmap)0;
diff --git a/xorg-server/hw/dmx/dmxpixmap.h b/xorg-server/hw/dmx/dmxpixmap.h
index a41918ce4..70aa5075c 100644
--- a/xorg-server/hw/dmx/dmxpixmap.h
+++ b/xorg-server/hw/dmx/dmxpixmap.h
@@ -50,7 +50,7 @@ extern Bool dmxInitPixmap(ScreenPtr pScreen);
extern PixmapPtr dmxCreatePixmap(ScreenPtr pScreen,
int width, int height, int depth,
- unsigned usage_hint);
+ unsigned class);
extern Bool dmxDestroyPixmap(PixmapPtr pPixmap);
extern RegionPtr dmxBitmapToRegion(PixmapPtr pPixmap);
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
index 1dea47feb..bd90e6ca3 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.c
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -1787,9 +1787,11 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
XF86ConfDisplayPtr dispptr;
XF86ConfAdaptorLinkPtr conf_adaptor;
Bool defaultMonitor = FALSE;
+ XF86ConfScreenRec local_conf_screen;
if (!conf_screen) {
- conf_screen = xnfcalloc(1, sizeof(XF86ConfScreenRec));
+ memset(&local_conf_screen, 0, sizeof(local_conf_screen));
+ conf_screen = &local_conf_screen;
conf_screen->scrn_identifier = "Default Screen Section";
xf86Msg(X_DEFAULT, "No screen section available. Using defaults.\n");
}
diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
index 0aa6f2cf4..a6266e725 100644
--- a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
+++ b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
@@ -369,13 +369,13 @@ VGAarbiterClearToBackground (
}
static PixmapPtr
-VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
+VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned class)
{
PixmapPtr pPix;
SCREEN_PROLOG ( CreatePixmap);
VGAGet(pScreen);
- pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint);
+ pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, class);
VGAPut();
SCREEN_EPILOG (CreatePixmap, VGAarbiterCreatePixmap);
diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
index 13fde5e79..0f8416b71 100644
--- a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -155,7 +155,7 @@ static void VGAarbiterCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
static void VGAarbiterClearToBackground (WindowPtr pWin, int x, int y, int w,
int h, Bool generateExposures);
static PixmapPtr VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h,
- int depth, unsigned int usage_hint);
+ int depth, unsigned int class);
static Bool VGAarbiterCreateGC(GCPtr pGC);
static Bool VGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank);
static void VGAarbiterStoreColors (ColormapPtr pmap, int ndef, xColorItem
diff --git a/xorg-server/hw/xfree86/vbe/vbe.c b/xorg-server/hw/xfree86/vbe/vbe.c
index 5120b3199..082cfae4f 100644
--- a/xorg-server/hw/xfree86/vbe/vbe.c
+++ b/xorg-server/hw/xfree86/vbe/vbe.c
@@ -395,7 +395,7 @@ VBEGetVBEInfo(vbeInfoPtr pVbe)
i = 0;
while (modes[i] != 0xffff)
i++;
- block->VideoModePtr = malloc(sizeof(CARD16) * i + 1);
+ block->VideoModePtr = malloc(sizeof(CARD16) * (i + 1));
memcpy(block->VideoModePtr, modes, sizeof(CARD16) * i);
block->VideoModePtr[i] = 0xffff;
diff --git a/xorg-server/hw/xfree86/xaa/xaaInit.c b/xorg-server/hw/xfree86/xaa/xaaInit.c
index ff1dd3d8b..c0617149a 100644
--- a/xorg-server/hw/xfree86/xaa/xaaInit.c
+++ b/xorg-server/hw/xfree86/xaa/xaaInit.c
@@ -34,7 +34,7 @@ static void XAAGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
static void XAAGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
int *pwidth, int nspans, char *pdstStart);
static PixmapPtr XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint);
+ unsigned class);
static Bool XAADestroyPixmap(PixmapPtr pPixmap);
static Bool XAAEnterVT (int index, int flags);
static void XAALeaveVT (int index, int flags);
@@ -331,7 +331,7 @@ XAAInitializeOffscreenDepths (ScreenPtr pScreen)
}
static PixmapPtr
-XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
+XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned class)
{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
@@ -346,7 +346,7 @@ XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
XAAInitializeOffscreenDepths (pScreen);
if(pScrn->vtSema &&
- (usage_hint != CREATE_PIXMAP_USAGE_GLYPH_PICTURE) &&
+ (class != CREATE_PIXMAP_USAGE_GLYPH_PICTURE) &&
(infoRec->offscreenDepths & (1 << (depth - 1))) &&
(size >= MIN_OFFPIX_SIZE) && !SwitchedOut &&
(!infoRec->maxOffPixWidth || (w <= infoRec->maxOffPixWidth)) &&
@@ -379,7 +379,7 @@ XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
}
XAA_SCREEN_PROLOGUE (pScreen, CreatePixmap);
- pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, usage_hint);
+ pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, class);
XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap);
if (!pPix) {
@@ -411,7 +411,7 @@ XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
}
BAILOUT:
XAA_SCREEN_PROLOGUE (pScreen, CreatePixmap);
- pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint);
+ pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, class);
XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap);
if(pPix) {
diff --git a/xorg-server/hw/xnest/Pixmap.c b/xorg-server/hw/xnest/Pixmap.c
index da81a1d06..efb2774d3 100644
--- a/xorg-server/hw/xnest/Pixmap.c
+++ b/xorg-server/hw/xnest/Pixmap.c
@@ -37,7 +37,7 @@ DevPrivateKeyRec xnestPixmapPrivateKeyRec;
PixmapPtr
xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint)
+ unsigned class)
{
PixmapPtr pPixmap;
@@ -45,7 +45,7 @@ xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
if (!pPixmap)
return NullPixmap;
pPixmap->drawable.type = DRAWABLE_PIXMAP;
- pPixmap->drawable.class = 0;
+ pPixmap->drawable.class = class;
pPixmap->drawable.depth = depth;
pPixmap->drawable.bitsPerPixel = depth;
pPixmap->drawable.id = 0;
@@ -57,7 +57,6 @@ xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pPixmap->refcnt = 1;
pPixmap->devKind = PixmapBytePad(width, depth);
- pPixmap->usage_hint = usage_hint;
if (width && height)
xnestPixmapPriv(pPixmap)->pixmap =
XCreatePixmap(xnestDisplay,
diff --git a/xorg-server/hw/xnest/XNPixmap.h b/xorg-server/hw/xnest/XNPixmap.h
index 0d7c6b61e..c9223e5ce 100644
--- a/xorg-server/hw/xnest/XNPixmap.h
+++ b/xorg-server/hw/xnest/XNPixmap.h
@@ -30,7 +30,7 @@ typedef struct {
#define xnestSharePixmap(pPixmap) ((pPixmap)->refcnt++)
PixmapPtr xnestCreatePixmap(ScreenPtr pScreen, int width, int height,
- int depth, unsigned usage_hint);
+ int depth, unsigned class);
Bool xnestDestroyPixmap(PixmapPtr pPixmap);
RegionPtr xnestPixmapToRegion(PixmapPtr pPixmap);
diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h
index df939b494..e01955cb1 100644
--- a/xorg-server/hw/xwin/win.h
+++ b/xorg-server/hw/xwin/win.h
@@ -1,1465 +1,1465 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project
- *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 XFree86 Project.
- *
- * Authors: Dakshinamurthy Karra
- * Suhaib M Siddiqi
- * Peter Busch
- * Harold L Hunt II
- * Kensuke Matsuzaki
- */
-
-#ifndef _WIN_H_
-#define _WIN_H_
-
-#ifndef NO
-#define NO 0
-#endif
-#ifndef YES
-#define YES 1
-#endif
-
-/* WM_XBUTTON Messages. They should go into w32api. */
-#ifndef WM_XBUTTONDOWN
-# define WM_XBUTTONDOWN 523
-#endif
-#ifndef WM_XBUTTONUP
-# define WM_XBUTTONUP 524
-#endif
-#ifndef WM_XBUTTONDBLCLK
-# define WM_XBUTTONDBLCLK 525
-#endif
-
-
-#define WIN_DEFAULT_BPP 0
-#define WIN_DEFAULT_WHITEPIXEL 255
-#define WIN_DEFAULT_BLACKPIXEL 0
-#define WIN_DEFAULT_LINEBIAS 0
-#define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */
-#define WIN_DEFAULT_DPI 75
-#define WIN_DEFAULT_REFRESH 0
-#define WIN_DEFAULT_WIN_KILL TRUE
-#define WIN_DEFAULT_UNIX_KILL FALSE
-#define WIN_DEFAULT_CLIP_UPDATES_NBOXES 0
-#ifdef XWIN_EMULATEPSEUDO
-#define WIN_DEFAULT_EMULATE_PSEUDO FALSE
-#endif
-#define WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH FALSE
-
-/*
- * Windows only supports 256 color palettes
- */
-#define WIN_NUM_PALETTE_ENTRIES 256
-
-/*
- * Number of times to call Restore in an attempt to restore the primary surface
- */
-#define WIN_REGAIN_SURFACE_RETRIES 1
-
-/*
- * Build a supported display depths mask by shifting one to the left
- * by the number of bits in the supported depth.
- */
-#define WIN_SUPPORTED_BPPS ( (1 << (32 - 1)) | (1 << (24 - 1)) \
- | (1 << (16 - 1)) | (1 << (15 - 1)) \
- | (1 << ( 8 - 1)))
-#define WIN_CHECK_DEPTH YES
-
-/*
- * Timer IDs for WM_TIMER
- */
-#define WIN_E3B_TIMER_ID 1
-#define WIN_POLLING_MOUSE_TIMER_ID 2
-
-#define MOUSE_POLLING_INTERVAL 50
-
-#define WIN_E3B_OFF -1
-#define WIN_FD_INVALID -1
-
-#define WIN_SERVER_NONE 0x0L /* 0 */
-#define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */
-#define WIN_SERVER_SHADOW_DD 0x2L /* 2 */
-#define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */
-#ifdef XWIN_PRIMARYFB
-#define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */
-#endif
-#ifdef XWIN_NATIVEGDI
-# define WIN_SERVER_NATIVE_GDI 0x10L /* 16 */
-#endif
-
-#define AltMapIndex Mod1MapIndex
-#define NumLockMapIndex Mod2MapIndex
-#define AltLangMapIndex Mod3MapIndex
-#define KanaMapIndex Mod4MapIndex
-#define ScrollLockMapIndex Mod5MapIndex
-
-#define WIN_MOD_LALT 0x00000001
-#define WIN_MOD_RALT 0x00000002
-#define WIN_MOD_LCONTROL 0x00000004
-#define WIN_MOD_RCONTROL 0x00000008
-
-#define WIN_24BPP_MASK_RED 0x00FF0000
-#define WIN_24BPP_MASK_GREEN 0x0000FF00
-#define WIN_24BPP_MASK_BLUE 0x000000FF
-
-#define WIN_MAX_KEYS_PER_KEY 4
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-
-#include <errno.h>
-#if defined(XWIN_MULTIWINDOWEXTWM) || defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
-#define HANDLE void *
-#ifdef _MSC_VER
-typedef int pid_t;
-#endif
-#include <pthread.h>
-#undef HANDLE
-#endif
-
-#ifdef HAS_MMAP
-#include <sys/mman.h>
-#ifndef MAP_FILE
-#define MAP_FILE 0
-#endif /* MAP_FILE */
-#endif /* HAS_MMAP */
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xos.h>
-#include <X11/Xprotostr.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "pixmap.h"
-#include "region.h"
-#include "gcstruct.h"
-#include "colormap.h"
-#include "colormapst.h"
-#include "miscstruct.h"
-#include "servermd.h"
-#include "windowstr.h"
-#include "mi.h"
-#include "micmap.h"
-#include "mifillarc.h"
-#include "mifpoly.h"
-#include "mibstore.h"
-#include "input.h"
-#include "mipointer.h"
-#include "X11/keysym.h"
-#include "mibstore.h"
-#include "micoord.h"
-#include "dix.h"
-#include "miline.h"
-#include "shadow.h"
-#include "fb.h"
-#include "rootless.h"
-
-#include "mipict.h"
-#include "picturestr.h"
-
-#ifdef RANDR
-#include "randrstr.h"
-#endif
-
-/*
- * Windows headers
- */
-#include "winms.h"
-#include "winresource.h"
-
-
-/*
- * Define Windows constants
- */
-
-#define WM_TRAYICON (WM_USER + 1000)
-#define WM_INIT_SYS_MENU (WM_USER + 1001)
-#define WM_GIVEUP (WM_USER + 1002)
-
-
-/* Local includes */
-#include "winwindow.h"
-#include "winmsg.h"
-
-#define PROFILEPOINT(point,thresh)\
-{\
-static unsigned int PROFPT##point = 0;\
-if (++PROFPT##point % thresh == 0)\
-ErrorF (#point ": PROFILEPOINT hit %u times\n", PROFPT##point);\
-}
-
-
-/* We use xor this macro for detecting toggle key state changes */
-#define WIN_XOR(a,b) ((!(a) && (b)) || ((a) && !(b)))
-
-#define DEFINE_ATOM_HELPER(func,atom_name) \
-static Atom func (void) { \
- static int generation; \
- static Atom atom; \
- if (generation != serverGeneration) { \
- generation = serverGeneration; \
- atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \
- } \
- return atom; \
-}
-
-/*
- * Typedefs for engine dependent function pointers
- */
-
-typedef Bool (*winAllocateFBProcPtr)(ScreenPtr);
-
-typedef void (*winFreeFBProcPtr)(ScreenPtr);
-
-typedef void (*winShadowUpdateProcPtr)(ScreenPtr, shadowBufPtr);
-
-typedef Bool (*winInitScreenProcPtr)(ScreenPtr);
-
-typedef Bool (*winCloseScreenProcPtr)(int, ScreenPtr);
-
-typedef Bool (*winInitVisualsProcPtr)(ScreenPtr);
-
-typedef Bool (*winAdjustVideoModeProcPtr)(ScreenPtr);
-
-typedef Bool (*winCreateBoundingWindowProcPtr)(ScreenPtr);
-
-typedef Bool (*winFinishScreenInitProcPtr)(int, ScreenPtr, int, char **);
-
-typedef Bool (*winBltExposedRegionsProcPtr)(ScreenPtr);
-
-typedef Bool (*winActivateAppProcPtr)(ScreenPtr);
-
-typedef Bool (*winRedrawScreenProcPtr)(ScreenPtr pScreen);
-
-typedef Bool (*winRealizeInstalledPaletteProcPtr)(ScreenPtr pScreen);
-
-typedef Bool (*winInstallColormapProcPtr)(ColormapPtr pColormap);
-
-typedef Bool (*winStoreColorsProcPtr)(ColormapPtr pmap,
- int ndef, xColorItem *pdefs);
-
-typedef Bool (*winCreateColormapProcPtr)(ColormapPtr pColormap);
-
-typedef Bool (*winDestroyColormapProcPtr)(ColormapPtr pColormap);
-
-typedef Bool (*winHotKeyAltTabProcPtr)(ScreenPtr);
-
-typedef Bool (*winCreatePrimarySurfaceProcPtr)(ScreenPtr);
-
-typedef Bool (*winReleasePrimarySurfaceProcPtr)(ScreenPtr);
-
-typedef Bool (*winFinishCreateWindowsWindowProcPtr)(WindowPtr pWin);
-
-typedef Bool (*winCreateScreenResourcesProc)(ScreenPtr);
-
-#ifdef XWIN_NATIVEGDI
-/* Typedefs for native GDI wrappers */
-typedef Bool (*RealizeFontPtr) (ScreenPtr pScreen, FontPtr pFont);
-typedef Bool (*UnrealizeFontPtr)(ScreenPtr pScreen, FontPtr pFont);
-#endif
-
-
-/*
- * GC (graphics context) privates
- */
-
-typedef struct
-{
- HDC hdc;
- HDC hdcMem;
-} winPrivGCRec, *winPrivGCPtr;
-
-
-/*
- * Pixmap privates
- */
-
-typedef struct
-{
- HDC hdcSelected;
- HBITMAP hBitmap;
- BYTE *pbBits;
- DWORD dwScanlineBytes;
- BITMAPINFOHEADER *pbmih;
-} winPrivPixmapRec, *winPrivPixmapPtr;
-
-
-/*
- * Colormap privates
- */
-
-typedef struct
-{
- HPALETTE hPalette;
- LPDIRECTDRAWPALETTE lpDDPalette;
- RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES];
- PALETTEENTRY peColors[WIN_NUM_PALETTE_ENTRIES];
-} winPrivCmapRec, *winPrivCmapPtr;
-
-/*
- * Windows Cursor handling.
- */
-
-typedef struct {
- /* from GetSystemMetrics */
- int sm_cx;
- int sm_cy;
-
- BOOL visible;
- HCURSOR handle;
- QueryBestSizeProcPtr QueryBestSize;
- miPointerSpriteFuncPtr spriteFuncs;
-} winCursorRec;
-
-/*
- * Resize modes
- */
-typedef enum {
- notAllowed,
- resizeWithScrollbars,
- resizeWithRandr
-} winResizeMode;
-
-/*
- * Screen information structure that we need before privates are available
- * in the server startup sequence.
- */
-
-typedef struct
-{
- ScreenPtr pScreen;
-
- /* Did the user specify a height and width? */
- Bool fUserGaveHeightAndWidth;
-
- DWORD dwScreen;
-
- int iMonitor;
- DWORD dwUserWidth;
- DWORD dwUserHeight;
- DWORD dwWidth;
- DWORD dwHeight;
- DWORD dwPaddedWidth;
-
- /* Did the user specify a screen position? */
- Bool fUserGavePosition;
- DWORD dwInitialX;
- DWORD dwInitialY;
-
- /*
- * dwStride is the number of whole pixels that occupy a scanline,
- * including those pixels that are not displayed. This is basically
- * a rounding up of the width.
- */
- DWORD dwStride;
-
- /* Offset of the screen in the window when using scrollbars */
- DWORD dwXOffset;
- DWORD dwYOffset;
-
- DWORD dwBPP;
- DWORD dwDepth;
- DWORD dwRefreshRate;
- char *pfb;
- DWORD dwEngine;
- DWORD dwEnginePreferred;
- DWORD dwClipUpdatesNBoxes;
-#ifdef XWIN_EMULATEPSEUDO
- Bool fEmulatePseudo;
-#endif
- Bool fFullScreen;
- Bool fDecoration;
-#ifdef XWIN_MULTIWINDOWEXTWM
- Bool fMWExtWM;
- Bool fAnotherWMRunning;
-#endif
-#ifdef XWIN_MULTIWINDOWINTWM
- Bool fInternalWM;
-#endif
- Bool fRootless;
-#ifdef XWIN_MULTIWINDOW
- Bool fMultiWindow;
-#endif
-#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- Bool fMultiMonitorOverride;
-#endif
- Bool fMultipleMonitors;
- Bool fLessPointer;
- winResizeMode iResizeMode;
- Bool fNoTrayIcon;
- int iE3BTimeout;
- /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */
- Bool fUseWinKillKey;
- Bool fUseUnixKillKey;
- Bool fIgnoreInput;
-
- /* Did the user explicitly set this screen? */
- Bool fExplicitScreen;
-} winScreenInfo, *winScreenInfoPtr;
-
-
-/*
- * Screen privates
- */
-
-typedef struct _winPrivScreenRec
-{
- winScreenInfoPtr pScreenInfo;
-
- Bool fEnabled;
- Bool fClosed;
- Bool fActive;
- Bool fBadDepth;
-
- int iDeltaZ;
-
- int iConnectedClients;
-
- CloseScreenProcPtr CloseScreen;
-
- DWORD dwRedMask;
- DWORD dwGreenMask;
- DWORD dwBlueMask;
- DWORD dwBitsPerRGB;
-
- DWORD dwModeKeyStates;
-
- /* Handle to icons that must be freed */
- HICON hiconNotifyIcon;
-
- /* Palette management */
- ColormapPtr pcmapInstalled;
-
- /* Pointer to the root visual so we only have to look it up once */
- VisualPtr pRootVisual;
-
- /* 3 button emulation variables */
- int iE3BCachedPress;
- Bool fE3BFakeButton2Sent;
-
- /* Privates used by shadow fb GDI server */
- HBITMAP hbmpShadow;
- HDC hdcScreen;
- HDC hdcShadow;
- HWND hwndScreen;
- BITMAPINFOHEADER *pbmih;
-
- /* Privates used by shadow fb and primary fb DirectDraw servers */
- LPDIRECTDRAW pdd;
- LPDIRECTDRAWSURFACE pddsPrimary;
- LPDIRECTDRAW2 pdd2;
-
- /* Privates used by shadow fb DirectDraw server */
- LPDIRECTDRAWSURFACE pddsShadow;
- LPDDSURFACEDESC pddsdShadow;
-
-#ifdef XWIN_PRIMARYFB
- /* Privates used by primary fb DirectDraw server */
- LPDIRECTDRAWSURFACE pddsOffscreen;
- LPDDSURFACEDESC pddsdOffscreen;
- LPDDSURFACEDESC pddsdPrimary;
-#endif
-
- /* Privates used by shadow fb DirectDraw Nonlocking server */
- LPDIRECTDRAW4 pdd4;
- LPDIRECTDRAWSURFACE4 pddsShadow4;
- LPDIRECTDRAWSURFACE4 pddsPrimary4;
- BOOL fRetryCreateSurface;
-
- /* Privates used by both shadow fb DirectDraw servers */
- LPDIRECTDRAWCLIPPER pddcPrimary;
-
-#ifdef XWIN_MULTIWINDOWEXTWM
- /* Privates used by multi-window external window manager */
- RootlessFrameID widTop;
- Bool fRestacking;
-#endif
-
-#ifdef XWIN_MULTIWINDOW
- /* Privates used by multi-window */
- pthread_t ptWMProc;
- pthread_t ptXMsgProc;
- void *pWMInfo;
-#endif
-
-#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- /* Privates used by both multi-window and rootless */
- Bool fRootWindowShown;
-#endif
-
-#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- /* Privates used for any module running in a seperate thread */
- pthread_mutex_t pmServerStarted;
- Bool fServerStarted;
-#endif
-
- /* Engine specific functions */
- winAllocateFBProcPtr pwinAllocateFB;
- winFreeFBProcPtr pwinFreeFB;
- winShadowUpdateProcPtr pwinShadowUpdate;
- winInitScreenProcPtr pwinInitScreen;
- winCloseScreenProcPtr pwinCloseScreen;
- winInitVisualsProcPtr pwinInitVisuals;
- winAdjustVideoModeProcPtr pwinAdjustVideoMode;
- winCreateBoundingWindowProcPtr pwinCreateBoundingWindow;
- winFinishScreenInitProcPtr pwinFinishScreenInit;
- winBltExposedRegionsProcPtr pwinBltExposedRegions;
- winActivateAppProcPtr pwinActivateApp;
- winRedrawScreenProcPtr pwinRedrawScreen;
- winRealizeInstalledPaletteProcPtr pwinRealizeInstalledPalette;
- winInstallColormapProcPtr pwinInstallColormap;
- winStoreColorsProcPtr pwinStoreColors;
- winCreateColormapProcPtr pwinCreateColormap;
- winDestroyColormapProcPtr pwinDestroyColormap;
- winHotKeyAltTabProcPtr pwinHotKeyAltTab;
- winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface;
- winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface;
-
- winCreateScreenResourcesProc pwinCreateScreenResources;
-
-#ifdef XWIN_MULTIWINDOW
- /* Window Procedures for MultiWindow mode */
- winFinishCreateWindowsWindowProcPtr pwinFinishCreateWindowsWindow;
-#endif
-
- /* Window Procedures for Rootless mode */
- CreateWindowProcPtr CreateWindow;
- DestroyWindowProcPtr DestroyWindow;
- PositionWindowProcPtr PositionWindow;
- ChangeWindowAttributesProcPtr ChangeWindowAttributes;
- RealizeWindowProcPtr RealizeWindow;
- UnrealizeWindowProcPtr UnrealizeWindow;
- ValidateTreeProcPtr ValidateTree;
- PostValidateTreeProcPtr PostValidateTree;
- WindowExposuresProcPtr WindowExposures;
- CopyWindowProcPtr CopyWindow;
- ClearToBackgroundProcPtr ClearToBackground;
- ClipNotifyProcPtr ClipNotify;
- RestackWindowProcPtr RestackWindow;
- ReparentWindowProcPtr ReparentWindow;
- ResizeWindowProcPtr ResizeWindow;
- MoveWindowProcPtr MoveWindow;
- SetShapeProcPtr SetShape;
-
- winCursorRec cursor;
-
-#ifdef XWIN_NATIVEGDI
- RealizeFontPtr RealizeFont;
- UnrealizeFontPtr UnrealizeFont;
-#endif
-
-} winPrivScreenRec;
-
-
-#ifdef XWIN_MULTIWINDOWEXTWM
-typedef struct {
- RootlessWindowPtr pFrame;
- HWND hWnd;
- int dwWidthBytes;
- BITMAPINFOHEADER *pbmihShadow;
- HBITMAP hbmpShadow;
- HDC hdcShadow;
- HDC hdcScreen;
- BOOL fResized;
- BOOL fRestackingNow;
- BOOL fClose;
- BOOL fMovingOrSizing;
- BOOL fDestroyed;//for debug
- char *pfb;
-} win32RootlessWindowRec, *win32RootlessWindowPtr;
-#endif
-
-
-typedef struct {
- pointer value;
- XID id;
-} WindowIDPairRec, *WindowIDPairPtr;
-
-
-/*
- * Extern declares for general global variables
- */
-
-#include "winglobals.h"
-
-extern winScreenInfo * g_ScreenInfo;
-extern miPointerScreenFuncRec g_winPointerCursorFuncs;
-extern DWORD g_dwEvents;
-#ifdef HAS_DEVWINDOWS
-extern int g_fdMessageQueue;
-#endif
-extern DevPrivateKeyRec g_iScreenPrivateKeyRec;
-#define g_iScreenPrivateKey (&g_iScreenPrivateKeyRec)
-extern DevPrivateKeyRec g_iCmapPrivateKeyRec;
-#define g_iCmapPrivateKey (&g_iCmapPrivateKeyRec)
-extern DevPrivateKeyRec g_iGCPrivateKeyRec;
-#define g_iGCPrivateKey (&g_iGCPrivateKeyRec)
-extern DevPrivateKeyRec g_iPixmapPrivateKeyRec;
-#define g_iPixmapPrivateKey (&g_iPixmapPrivateKeyRec)
-extern DevPrivateKeyRec g_iWindowPrivateKeyRec;
-#define g_iWindowPrivateKey (&g_iWindowPrivateKeyRec)
-
-extern unsigned long g_ulServerGeneration;
-extern DWORD g_dwEnginesSupported;
-extern HINSTANCE g_hInstance;
-extern int g_copyROP[];
-extern int g_patternROP[];
-extern const char * g_pszQueryHost;
-extern DeviceIntPtr g_pwinPointer;
-extern DeviceIntPtr g_pwinKeyboard;
-
-/*
- * Extern declares for dynamically loaded library function pointers
- */
-
-extern FARPROC g_fpDirectDrawCreate;
-extern FARPROC g_fpDirectDrawCreateClipper;
-extern FARPROC g_fpTrackMouseEvent;
-
-
-/*
- * Screen privates macros
- */
-
-#define winGetScreenPriv(pScreen) ((winPrivScreenPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey))
-
-#define winSetScreenPriv(pScreen,v) \
- dixSetPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey, v)
-
-#define winScreenPriv(pScreen) \
- winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen)
-
-
-/*
- * Colormap privates macros
- */
-
-#define winGetCmapPriv(pCmap) ((winPrivCmapPtr) \
- dixLookupPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey))
-
-#define winSetCmapPriv(pCmap,v) \
- dixSetPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey, v)
-
-#define winCmapPriv(pCmap) \
- winPrivCmapPtr pCmapPriv = winGetCmapPriv(pCmap)
-
-
-/*
- * GC privates macros
- */
-
-#define winGetGCPriv(pGC) ((winPrivGCPtr) \
- dixLookupPrivate(&(pGC)->devPrivates, g_iGCPrivateKey))
-
-#define winSetGCPriv(pGC,v) \
- dixSetPrivate(&(pGC)->devPrivates, g_iGCPrivateKey, v)
-
-#define winGCPriv(pGC) \
- winPrivGCPtr pGCPriv = winGetGCPriv(pGC)
-
-
-/*
- * Pixmap privates macros
- */
-
-#define winGetPixmapPriv(pPixmap) ((winPrivPixmapPtr) \
- dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey))
-
-#define winSetPixmapPriv(pPixmap,v) \
- dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey, v)
-
-#define winPixmapPriv(pPixmap) \
- winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap)
-
-
-/*
- * Window privates macros
- */
-
-#define winGetWindowPriv(pWin) ((winPrivWinPtr) \
- dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey))
-
-#define winSetWindowPriv(pWin,v) \
- dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey, v)
-
-#define winWindowPriv(pWin) \
- winPrivWinPtr pWinPriv = winGetWindowPriv(pWin)
-
-/*
- * wrapper macros
- */
-#define _WIN_WRAP(priv, real, mem, func) {\
- priv->mem = real->mem; \
- real->mem = func; \
-}
-
-#define _WIN_UNWRAP(priv, real, mem) {\
- real->mem = priv->mem; \
-}
-
-#define WIN_WRAP(mem, func) _WIN_WRAP(pScreenPriv, pScreen, mem, func)
-
-#define WIN_UNWRAP(mem) _WIN_UNWRAP(pScreenPriv, pScreen, mem)
-
-/*
- * BEGIN DDX and DIX Function Prototypes
- */
-
-
-/*
- * winallpriv.c
- */
-
-Bool
-winAllocatePrivates (ScreenPtr pScreen);
-
-Bool
-winInitCmapPrivates (ColormapPtr pCmap, int index);
-
-Bool
-winAllocateCmapPrivates (ColormapPtr pCmap);
-
-
-/*
- * winauth.c
- */
-
-#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
-Bool
-winGenerateAuthorization (void);
-void winSetAuthorization(void);
-#endif
-
-
-/*
- * winblock.c
- */
-
-void
-winBlockHandler (int nScreen,
- pointer pBlockData,
- pointer pTimeout,
- pointer pReadMask);
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winclip.c
- */
-
-RegionPtr
-winPixmapToRegionNativeGDI (PixmapPtr pPix);
-#endif
-
-
-#ifdef XWIN_CLIPBOARD
-/*
- * winclipboardinit.c
- */
-
-Bool
-winInitClipboard (void);
-
-void
-winFixClipboardChain (int Removed);
-#endif
-
-
-/*
- * wincmap.c
- */
-
-void
-winSetColormapFunctions (ScreenPtr pScreen);
-
-Bool
-winCreateDefColormap (ScreenPtr pScreen);
-
-
-/*
- * wincreatewnd.c
- */
-
-Bool
-winCreateBoundingWindowFullScreen (ScreenPtr pScreen);
-
-Bool
-winCreateBoundingWindowWindowed (ScreenPtr pScreen);
-
-
-/*
- * windialogs.c
- */
-
-int
-GetLiveClients (winPrivScreenPtr pScreenPriv);
-
-void
-winDisplayExitDialog (winPrivScreenPtr pScreenPriv);
-
-void
-winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv);
-
-void
-winDisplayAboutDialog (winPrivScreenPtr pScreenPriv);
-
-
-/*
- * winengine.c
- */
-
-void
-winDetectSupportedEngines (void);
-
-Bool
-winSetEngine (ScreenPtr pScreen);
-
-Bool
-winGetDDProcAddresses (void);
-
-void
-winReleaseDDProcAddresses(void);
-
-
-/*
- * winerror.c
- */
-
-#ifdef DDXOSVERRORF
-void
-OSVenderVErrorF (const char *pszFormat, va_list va_args);
-#endif
-
-void
-winMessageBoxF (const char *pszError, UINT uType, ...);
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winfillsp.c
- */
-
-void
-winFillSpansNativeGDI (DrawablePtr pDrawable,
- GCPtr pGC,
- int nSpans,
- DDXPointPtr pPoints,
- int *pWidths,
- int fSorted);
-#endif
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winfont.c
- */
-
-Bool
-winRealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont);
-
-Bool
-winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont);
-#endif
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * wingc.c
- */
-
-Bool
-winCreateGCNativeGDI (GCPtr pGC);
-#endif
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * wingetsp.c
- */
-
-void
-winGetSpansNativeGDI (DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr pPoints,
- int *pWidths,
- int nSpans,
- char *pDst);
-#endif
-
-
-/*
- * winglobals.c
- */
-
-void
-winInitializeGlobals (void);
-
-
-/*
- * winkeybd.c
- */
-
-void
-winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode);
-
-int
-winKeybdProc (DeviceIntPtr pDeviceInt, int iState);
-
-void
-winInitializeModeKeyStates (void);
-
-void
-winRestoreModeKeyStates (void);
-
-Bool
-winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam);
-
-void
-winKeybdReleaseKeys (void);
-
-void
-winSendKeyEvent (DWORD dwKey, Bool fDown);
-
-BOOL
-winCheckKeyPressed(WPARAM wParam, LPARAM lParam);
-
-void
-winFixShiftKeys (int iScanCode);
-
-/*
- * winkeyhook.c
- */
-
-Bool
-winInstallKeyboardHookLL (void);
-
-void
-winRemoveKeyboardHookLL (void);
-
-
-/*
- * winmisc.c
- */
-
-#ifdef XWIN_NATIVEGDI
-void
-winQueryBestSizeNativeGDI (int class, unsigned short *pWidth,
- unsigned short *pHeight, ScreenPtr pScreen);
-#endif
-
-CARD8
-winCountBits (DWORD dw);
-
-Bool
-winUpdateFBPointer (ScreenPtr pScreen, void *pbits);
-
-#ifdef XWIN_NATIVEGDI
-BOOL
-winPaintBackground (HWND hwnd, COLORREF colorref);
-#endif
-
-
-/*
- * winmouse.c
- */
-
-int
-winMouseProc (DeviceIntPtr pDeviceInt, int iState);
-
-int
-winMouseWheel (ScreenPtr pScreen, int iDeltaZ);
-
-void
-winMouseButtonsSendEvent (int iEventType, int iButton);
-
-int
-winMouseButtonsHandle (ScreenPtr pScreen,
- int iEventType, int iButton,
- WPARAM wParam);
-
-void
-winEnqueueMotion(int x, int y);
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winnativegdi.c
- */
-
-HBITMAP
-winCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth,
- BYTE **ppbBits, BITMAPINFO **ppbmi);
-
-Bool
-winSetEngineFunctionsNativeGDI (ScreenPtr pScreen);
-#endif
-
-
-#ifdef XWIN_PRIMARYFB
-/*
- * winpfbddd.c
- */
-
-Bool
-winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen);
-#endif
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winpixmap.c
- */
-
-PixmapPtr
-winCreatePixmapNativeGDI (ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint);
-
-Bool
-winDestroyPixmapNativeGDI (PixmapPtr pPixmap);
-
-Bool
-winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap,
- int iWidth, int iHeight,
- int iDepth,
- int iBitsPerPixel,
- int devKind,
- pointer pPixData);
-#endif
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winpolyline.c
- */
-
-void
-winPolyLineNativeGDI (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt);
-#endif
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winpushpxl.c
- */
-
-void
-winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
- int dx, int dy, int xOrg, int yOrg);
-#endif
-
-
-/*
- * winscrinit.c
- */
-
-Bool
-winScreenInit (int index,
- ScreenPtr pScreen,
- int argc, char **argv);
-
-Bool
-winFinishScreenInitFB (int index,
- ScreenPtr pScreen,
- int argc, char **argv);
-
-#if defined(XWIN_NATIVEGDI)
-Bool
-winFinishScreenInitNativeGDI (int index,
- ScreenPtr pScreen,
- int argc, char **argv);
-#endif
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winsetsp.c
- */
-
-void
-winSetSpansNativeGDI (DrawablePtr pDrawable,
- GCPtr pGC,
- char *pSrc,
- DDXPointPtr pPoints,
- int *pWidth,
- int nSpans,
- int fSorted);
-#endif
-
-
-/*
- * winshaddd.c
- */
-
-Bool
-winSetEngineFunctionsShadowDD (ScreenPtr pScreen);
-
-
-/*
- * winshadddnl.c
- */
-
-Bool
-winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen);
-
-
-/*
- * winshadgdi.c
- */
-
-Bool
-winSetEngineFunctionsShadowGDI (ScreenPtr pScreen);
-
-
-/*
- * winwakeup.c
- */
-
-void
-winWakeupHandler (int nScreen,
- pointer pWakeupData,
- unsigned long ulResult,
- pointer pReadmask);
-
-
-/*
- * winwindow.c
- */
-
-#ifdef XWIN_NATIVEGDI
-Bool
-winCreateWindowNativeGDI (WindowPtr pWin);
-
-Bool
-winDestroyWindowNativeGDI (WindowPtr pWin);
-
-Bool
-winPositionWindowNativeGDI (WindowPtr pWin, int x, int y);
-
-void
-winCopyWindowNativeGDI (WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc);
-
-Bool
-winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask);
-
-Bool
-winUnmapWindowNativeGDI (WindowPtr pWindow);
-
-Bool
-winMapWindowNativeGDI (WindowPtr pWindow);
-#endif
-
-Bool
-winCreateWindowRootless (WindowPtr pWindow);
-
-Bool
-winDestroyWindowRootless (WindowPtr pWindow);
-
-Bool
-winPositionWindowRootless (WindowPtr pWindow, int x, int y);
-
-Bool
-winChangeWindowAttributesRootless (WindowPtr pWindow, unsigned long mask);
-
-Bool
-winUnmapWindowRootless (WindowPtr pWindow);
-
-Bool
-winMapWindowRootless (WindowPtr pWindow);
-
-void
-winSetShapeRootless (WindowPtr pWindow, int kind);
-
-
-/*
- * winmultiwindowicons.c - Used by both multi-window and Win32Rootless
- */
-
-HICON
-winXIconToHICON (WindowPtr pWin, int iconSize);
-
-void
-winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon);
-
-#ifdef XWIN_MULTIWINDOW
-/*
- * winmultiwindowshape.c
- */
-
-void
-winReshapeMultiWindow (WindowPtr pWin);
-
-void
-winSetShapeMultiWindow (WindowPtr pWindow, int kind);
-
-void
-winUpdateRgnMultiWindow (WindowPtr pWindow);
-#endif
-
-
-#ifdef XWIN_MULTIWINDOW
-/*
- * winmultiwindowwindow.c
- */
-
-Bool
-winCreateWindowMultiWindow (WindowPtr pWindow);
-
-Bool
-winDestroyWindowMultiWindow (WindowPtr pWindow);
-
-Bool
-winPositionWindowMultiWindow (WindowPtr pWindow, int x, int y);
-
-Bool
-winChangeWindowAttributesMultiWindow (WindowPtr pWindow, unsigned long mask);
-
-Bool
-winUnmapWindowMultiWindow (WindowPtr pWindow);
-
-Bool
-winMapWindowMultiWindow (WindowPtr pWindow);
-
-void
-winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent);
-
-void
-winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib);
-
-void
-winReorderWindowsMultiWindow (void);
-
-void
-winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w,
- unsigned int h, WindowPtr pSib);
-void
-winMoveWindowMultiWindow (WindowPtr pWin, int x, int y,
- WindowPtr pSib, VTKind kind);
-
-void
-winCopyWindowMultiWindow (WindowPtr pWin, DDXPointRec oldpt,
- RegionPtr oldRegion);
-
-XID
-winGetWindowID (WindowPtr pWin);
-
-int
-winAdjustXWindow (WindowPtr pWin, HWND hwnd);
-#endif
-
-
-#ifdef XWIN_MULTIWINDOW
-/*
- * winmultiwindowwndproc.c
- */
-
-LRESULT CALLBACK
-winTopLevelWindowProc (HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam);
-#endif
-
-
-/*
- * wintrayicon.c
- */
-
-void
-winInitNotifyIcon (winPrivScreenPtr pScreenPriv, Bool Modify);
-
-void
-winDeleteNotifyIcon (winPrivScreenPtr pScreenPriv);
-
-LRESULT
-winHandleIconMessage (HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam,
- winPrivScreenPtr pScreenPriv);
-
-
-/*
- * winwndproc.c
- */
-
-LRESULT CALLBACK
-winWindowProc (HWND hWnd, UINT message,
- WPARAM wParam, LPARAM lParam);
-
-
-#ifdef XWIN_MULTIWINDOWEXTWM
-/*
- * winwin32rootless.c
- */
-
-Bool
-winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen,
- int newX, int newY, RegionPtr pShape);
-
-void
-winMWExtWMDestroyFrame (RootlessFrameID wid);
-
-void
-winMWExtWMMoveFrame (RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
-
-void
-winMWExtWMResizeFrame (RootlessFrameID wid, ScreenPtr pScreen,
- int newX, int newY, unsigned int newW, unsigned int newH,
- unsigned int gravity);
-
-void
-winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid);
-
-void
-winMWExtWMReshapeFrame (RootlessFrameID wid, RegionPtr pShape);
-
-void
-winMWExtWMUnmapFrame (RootlessFrameID wid);
-
-void
-winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow);
-
-void
-winMWExtWMStopDrawing (RootlessFrameID wid, Bool flush);
-
-void
-winMWExtWMUpdateRegion (RootlessFrameID wid, RegionPtr pDamage);
-
-void
-winMWExtWMDamageRects (RootlessFrameID wid, int count, const BoxRec *rects,
- int shift_x, int shift_y);
-
-void
-winMWExtWMRootlessSwitchWindow (RootlessWindowPtr pFrame, WindowPtr oldWin);
-
-void
-winMWExtWMCopyBytes (unsigned int width, unsigned int height,
- const void *src, unsigned int srcRowBytes,
- void *dst, unsigned int dstRowBytes);
-
-void
-winMWExtWMCopyWindow (RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
- int dx, int dy);
-#endif
-
-
-#ifdef XWIN_MULTIWINDOWEXTWM
-/*
- * winwin32rootlesswindow.c
- */
-
-void
-winMWExtWMReorderWindows (ScreenPtr pScreen);
-
-void
-winMWExtWMMoveXWindow (WindowPtr pWin, int x, int y);
-
-void
-winMWExtWMResizeXWindow (WindowPtr pWin, int w, int h);
-
-void
-winMWExtWMMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h);
-
-void
-winMWExtWMUpdateIcon (Window id);
-
-void
-winMWExtWMUpdateWindowDecoration (win32RootlessWindowPtr pRLWinPriv,
- winScreenInfoPtr pScreenInfo);
-
-wBOOL CALLBACK
-winMWExtWMDecorateWindow (HWND hwnd, LPARAM lParam);
-
-void
-winMWExtWMRestackWindows (ScreenPtr pScreen);
-#endif
-#ifdef XWIN_MULTIWINDOWINTWM
-Bool
-winIsInternalWMRunning (winScreenInfoPtr pScreenInfo);
-#endif
-
-#ifdef XWIN_MULTIWINDOWEXTWM
-/*
- * winwin32rootlesswndproc.c
- */
-
-LRESULT CALLBACK
-winMWExtWMWindowProc (HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam);
-#endif
-
-
-/*
- * winwindowswm.c
- */
-
-void
-winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg,
- Window window, int x, int y, int w, int h);
-
-void
-winWindowsWMExtensionInit (void);
-
-/*
- * wincursor.c
- */
-
-Bool
-winInitCursor (ScreenPtr pScreen);
-
-/*
- * winprocarg.c
- */
-void
-winInitializeScreens(int maxscreens);
-
-/*
- * windisplay.c
- */
-
-void
-winGetDisplayName(char *szDisplay, unsigned int screen);
-
-/*
- * winrandr.c
- */
-Bool
-winRandRInit (ScreenPtr pScreen);
-void
-winDoRandRScreenSetSize (ScreenPtr pScreen,
- CARD16 width,
- CARD16 height,
- CARD32 mmWidth,
- CARD32 mmHeight);
-
-/*
- * END DDX and DIX Function Prototypes
- */
-
-#endif /* _WIN_H_ */
-
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project
+ *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 XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ * Kensuke Matsuzaki
+ */
+
+#ifndef _WIN_H_
+#define _WIN_H_
+
+#ifndef NO
+#define NO 0
+#endif
+#ifndef YES
+#define YES 1
+#endif
+
+/* WM_XBUTTON Messages. They should go into w32api. */
+#ifndef WM_XBUTTONDOWN
+# define WM_XBUTTONDOWN 523
+#endif
+#ifndef WM_XBUTTONUP
+# define WM_XBUTTONUP 524
+#endif
+#ifndef WM_XBUTTONDBLCLK
+# define WM_XBUTTONDBLCLK 525
+#endif
+
+
+#define WIN_DEFAULT_BPP 0
+#define WIN_DEFAULT_WHITEPIXEL 255
+#define WIN_DEFAULT_BLACKPIXEL 0
+#define WIN_DEFAULT_LINEBIAS 0
+#define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */
+#define WIN_DEFAULT_DPI 75
+#define WIN_DEFAULT_REFRESH 0
+#define WIN_DEFAULT_WIN_KILL TRUE
+#define WIN_DEFAULT_UNIX_KILL FALSE
+#define WIN_DEFAULT_CLIP_UPDATES_NBOXES 0
+#ifdef XWIN_EMULATEPSEUDO
+#define WIN_DEFAULT_EMULATE_PSEUDO FALSE
+#endif
+#define WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH FALSE
+
+/*
+ * Windows only supports 256 color palettes
+ */
+#define WIN_NUM_PALETTE_ENTRIES 256
+
+/*
+ * Number of times to call Restore in an attempt to restore the primary surface
+ */
+#define WIN_REGAIN_SURFACE_RETRIES 1
+
+/*
+ * Build a supported display depths mask by shifting one to the left
+ * by the number of bits in the supported depth.
+ */
+#define WIN_SUPPORTED_BPPS ( (1 << (32 - 1)) | (1 << (24 - 1)) \
+ | (1 << (16 - 1)) | (1 << (15 - 1)) \
+ | (1 << ( 8 - 1)))
+#define WIN_CHECK_DEPTH YES
+
+/*
+ * Timer IDs for WM_TIMER
+ */
+#define WIN_E3B_TIMER_ID 1
+#define WIN_POLLING_MOUSE_TIMER_ID 2
+
+#define MOUSE_POLLING_INTERVAL 50
+
+#define WIN_E3B_OFF -1
+#define WIN_FD_INVALID -1
+
+#define WIN_SERVER_NONE 0x0L /* 0 */
+#define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */
+#define WIN_SERVER_SHADOW_DD 0x2L /* 2 */
+#define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */
+#ifdef XWIN_PRIMARYFB
+#define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */
+#endif
+#ifdef XWIN_NATIVEGDI
+# define WIN_SERVER_NATIVE_GDI 0x10L /* 16 */
+#endif
+
+#define AltMapIndex Mod1MapIndex
+#define NumLockMapIndex Mod2MapIndex
+#define AltLangMapIndex Mod3MapIndex
+#define KanaMapIndex Mod4MapIndex
+#define ScrollLockMapIndex Mod5MapIndex
+
+#define WIN_MOD_LALT 0x00000001
+#define WIN_MOD_RALT 0x00000002
+#define WIN_MOD_LCONTROL 0x00000004
+#define WIN_MOD_RCONTROL 0x00000008
+
+#define WIN_24BPP_MASK_RED 0x00FF0000
+#define WIN_24BPP_MASK_GREEN 0x0000FF00
+#define WIN_24BPP_MASK_BLUE 0x000000FF
+
+#define WIN_MAX_KEYS_PER_KEY 4
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+
+#include <errno.h>
+#if defined(XWIN_MULTIWINDOWEXTWM) || defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+#define HANDLE void *
+#ifdef _MSC_VER
+typedef int pid_t;
+#endif
+#include <pthread.h>
+#undef HANDLE
+#endif
+
+#ifdef HAS_MMAP
+#include <sys/mman.h>
+#ifndef MAP_FILE
+#define MAP_FILE 0
+#endif /* MAP_FILE */
+#endif /* HAS_MMAP */
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/Xos.h>
+#include <X11/Xprotostr.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "pixmap.h"
+#include "region.h"
+#include "gcstruct.h"
+#include "colormap.h"
+#include "colormapst.h"
+#include "miscstruct.h"
+#include "servermd.h"
+#include "windowstr.h"
+#include "mi.h"
+#include "micmap.h"
+#include "mifillarc.h"
+#include "mifpoly.h"
+#include "mibstore.h"
+#include "input.h"
+#include "mipointer.h"
+#include "X11/keysym.h"
+#include "mibstore.h"
+#include "micoord.h"
+#include "dix.h"
+#include "miline.h"
+#include "shadow.h"
+#include "fb.h"
+#include "rootless.h"
+
+#include "mipict.h"
+#include "picturestr.h"
+
+#ifdef RANDR
+#include "randrstr.h"
+#endif
+
+/*
+ * Windows headers
+ */
+#include "winms.h"
+#include "winresource.h"
+
+
+/*
+ * Define Windows constants
+ */
+
+#define WM_TRAYICON (WM_USER + 1000)
+#define WM_INIT_SYS_MENU (WM_USER + 1001)
+#define WM_GIVEUP (WM_USER + 1002)
+
+
+/* Local includes */
+#include "winwindow.h"
+#include "winmsg.h"
+
+#define PROFILEPOINT(point,thresh)\
+{\
+static unsigned int PROFPT##point = 0;\
+if (++PROFPT##point % thresh == 0)\
+ErrorF (#point ": PROFILEPOINT hit %u times\n", PROFPT##point);\
+}
+
+
+/* We use xor this macro for detecting toggle key state changes */
+#define WIN_XOR(a,b) ((!(a) && (b)) || ((a) && !(b)))
+
+#define DEFINE_ATOM_HELPER(func,atom_name) \
+static Atom func (void) { \
+ static int generation; \
+ static Atom atom; \
+ if (generation != serverGeneration) { \
+ generation = serverGeneration; \
+ atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \
+ } \
+ return atom; \
+}
+
+/*
+ * Typedefs for engine dependent function pointers
+ */
+
+typedef Bool (*winAllocateFBProcPtr)(ScreenPtr);
+
+typedef void (*winFreeFBProcPtr)(ScreenPtr);
+
+typedef void (*winShadowUpdateProcPtr)(ScreenPtr, shadowBufPtr);
+
+typedef Bool (*winInitScreenProcPtr)(ScreenPtr);
+
+typedef Bool (*winCloseScreenProcPtr)(int, ScreenPtr);
+
+typedef Bool (*winInitVisualsProcPtr)(ScreenPtr);
+
+typedef Bool (*winAdjustVideoModeProcPtr)(ScreenPtr);
+
+typedef Bool (*winCreateBoundingWindowProcPtr)(ScreenPtr);
+
+typedef Bool (*winFinishScreenInitProcPtr)(int, ScreenPtr, int, char **);
+
+typedef Bool (*winBltExposedRegionsProcPtr)(ScreenPtr);
+
+typedef Bool (*winActivateAppProcPtr)(ScreenPtr);
+
+typedef Bool (*winRedrawScreenProcPtr)(ScreenPtr pScreen);
+
+typedef Bool (*winRealizeInstalledPaletteProcPtr)(ScreenPtr pScreen);
+
+typedef Bool (*winInstallColormapProcPtr)(ColormapPtr pColormap);
+
+typedef Bool (*winStoreColorsProcPtr)(ColormapPtr pmap,
+ int ndef, xColorItem *pdefs);
+
+typedef Bool (*winCreateColormapProcPtr)(ColormapPtr pColormap);
+
+typedef Bool (*winDestroyColormapProcPtr)(ColormapPtr pColormap);
+
+typedef Bool (*winHotKeyAltTabProcPtr)(ScreenPtr);
+
+typedef Bool (*winCreatePrimarySurfaceProcPtr)(ScreenPtr);
+
+typedef Bool (*winReleasePrimarySurfaceProcPtr)(ScreenPtr);
+
+typedef Bool (*winFinishCreateWindowsWindowProcPtr)(WindowPtr pWin);
+
+typedef Bool (*winCreateScreenResourcesProc)(ScreenPtr);
+
+#ifdef XWIN_NATIVEGDI
+/* Typedefs for native GDI wrappers */
+typedef Bool (*RealizeFontPtr) (ScreenPtr pScreen, FontPtr pFont);
+typedef Bool (*UnrealizeFontPtr)(ScreenPtr pScreen, FontPtr pFont);
+#endif
+
+
+/*
+ * GC (graphics context) privates
+ */
+
+typedef struct
+{
+ HDC hdc;
+ HDC hdcMem;
+} winPrivGCRec, *winPrivGCPtr;
+
+
+/*
+ * Pixmap privates
+ */
+
+typedef struct
+{
+ HDC hdcSelected;
+ HBITMAP hBitmap;
+ BYTE *pbBits;
+ DWORD dwScanlineBytes;
+ BITMAPINFOHEADER *pbmih;
+} winPrivPixmapRec, *winPrivPixmapPtr;
+
+
+/*
+ * Colormap privates
+ */
+
+typedef struct
+{
+ HPALETTE hPalette;
+ LPDIRECTDRAWPALETTE lpDDPalette;
+ RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES];
+ PALETTEENTRY peColors[WIN_NUM_PALETTE_ENTRIES];
+} winPrivCmapRec, *winPrivCmapPtr;
+
+/*
+ * Windows Cursor handling.
+ */
+
+typedef struct {
+ /* from GetSystemMetrics */
+ int sm_cx;
+ int sm_cy;
+
+ BOOL visible;
+ HCURSOR handle;
+ QueryBestSizeProcPtr QueryBestSize;
+ miPointerSpriteFuncPtr spriteFuncs;
+} winCursorRec;
+
+/*
+ * Resize modes
+ */
+typedef enum {
+ notAllowed,
+ resizeWithScrollbars,
+ resizeWithRandr
+} winResizeMode;
+
+/*
+ * Screen information structure that we need before privates are available
+ * in the server startup sequence.
+ */
+
+typedef struct
+{
+ ScreenPtr pScreen;
+
+ /* Did the user specify a height and width? */
+ Bool fUserGaveHeightAndWidth;
+
+ DWORD dwScreen;
+
+ int iMonitor;
+ DWORD dwUserWidth;
+ DWORD dwUserHeight;
+ DWORD dwWidth;
+ DWORD dwHeight;
+ DWORD dwPaddedWidth;
+
+ /* Did the user specify a screen position? */
+ Bool fUserGavePosition;
+ DWORD dwInitialX;
+ DWORD dwInitialY;
+
+ /*
+ * dwStride is the number of whole pixels that occupy a scanline,
+ * including those pixels that are not displayed. This is basically
+ * a rounding up of the width.
+ */
+ DWORD dwStride;
+
+ /* Offset of the screen in the window when using scrollbars */
+ DWORD dwXOffset;
+ DWORD dwYOffset;
+
+ DWORD dwBPP;
+ DWORD dwDepth;
+ DWORD dwRefreshRate;
+ char *pfb;
+ DWORD dwEngine;
+ DWORD dwEnginePreferred;
+ DWORD dwClipUpdatesNBoxes;
+#ifdef XWIN_EMULATEPSEUDO
+ Bool fEmulatePseudo;
+#endif
+ Bool fFullScreen;
+ Bool fDecoration;
+#ifdef XWIN_MULTIWINDOWEXTWM
+ Bool fMWExtWM;
+ Bool fAnotherWMRunning;
+#endif
+#ifdef XWIN_MULTIWINDOWINTWM
+ Bool fInternalWM;
+#endif
+ Bool fRootless;
+#ifdef XWIN_MULTIWINDOW
+ Bool fMultiWindow;
+#endif
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ Bool fMultiMonitorOverride;
+#endif
+ Bool fMultipleMonitors;
+ Bool fLessPointer;
+ winResizeMode iResizeMode;
+ Bool fNoTrayIcon;
+ int iE3BTimeout;
+ /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */
+ Bool fUseWinKillKey;
+ Bool fUseUnixKillKey;
+ Bool fIgnoreInput;
+
+ /* Did the user explicitly set this screen? */
+ Bool fExplicitScreen;
+} winScreenInfo, *winScreenInfoPtr;
+
+
+/*
+ * Screen privates
+ */
+
+typedef struct _winPrivScreenRec
+{
+ winScreenInfoPtr pScreenInfo;
+
+ Bool fEnabled;
+ Bool fClosed;
+ Bool fActive;
+ Bool fBadDepth;
+
+ int iDeltaZ;
+
+ int iConnectedClients;
+
+ CloseScreenProcPtr CloseScreen;
+
+ DWORD dwRedMask;
+ DWORD dwGreenMask;
+ DWORD dwBlueMask;
+ DWORD dwBitsPerRGB;
+
+ DWORD dwModeKeyStates;
+
+ /* Handle to icons that must be freed */
+ HICON hiconNotifyIcon;
+
+ /* Palette management */
+ ColormapPtr pcmapInstalled;
+
+ /* Pointer to the root visual so we only have to look it up once */
+ VisualPtr pRootVisual;
+
+ /* 3 button emulation variables */
+ int iE3BCachedPress;
+ Bool fE3BFakeButton2Sent;
+
+ /* Privates used by shadow fb GDI server */
+ HBITMAP hbmpShadow;
+ HDC hdcScreen;
+ HDC hdcShadow;
+ HWND hwndScreen;
+ BITMAPINFOHEADER *pbmih;
+
+ /* Privates used by shadow fb and primary fb DirectDraw servers */
+ LPDIRECTDRAW pdd;
+ LPDIRECTDRAWSURFACE pddsPrimary;
+ LPDIRECTDRAW2 pdd2;
+
+ /* Privates used by shadow fb DirectDraw server */
+ LPDIRECTDRAWSURFACE pddsShadow;
+ LPDDSURFACEDESC pddsdShadow;
+
+#ifdef XWIN_PRIMARYFB
+ /* Privates used by primary fb DirectDraw server */
+ LPDIRECTDRAWSURFACE pddsOffscreen;
+ LPDDSURFACEDESC pddsdOffscreen;
+ LPDDSURFACEDESC pddsdPrimary;
+#endif
+
+ /* Privates used by shadow fb DirectDraw Nonlocking server */
+ LPDIRECTDRAW4 pdd4;
+ LPDIRECTDRAWSURFACE4 pddsShadow4;
+ LPDIRECTDRAWSURFACE4 pddsPrimary4;
+ BOOL fRetryCreateSurface;
+
+ /* Privates used by both shadow fb DirectDraw servers */
+ LPDIRECTDRAWCLIPPER pddcPrimary;
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+ /* Privates used by multi-window external window manager */
+ RootlessFrameID widTop;
+ Bool fRestacking;
+#endif
+
+#ifdef XWIN_MULTIWINDOW
+ /* Privates used by multi-window */
+ pthread_t ptWMProc;
+ pthread_t ptXMsgProc;
+ void *pWMInfo;
+#endif
+
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ /* Privates used by both multi-window and rootless */
+ Bool fRootWindowShown;
+#endif
+
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+ /* Privates used for any module running in a seperate thread */
+ pthread_mutex_t pmServerStarted;
+ Bool fServerStarted;
+#endif
+
+ /* Engine specific functions */
+ winAllocateFBProcPtr pwinAllocateFB;
+ winFreeFBProcPtr pwinFreeFB;
+ winShadowUpdateProcPtr pwinShadowUpdate;
+ winInitScreenProcPtr pwinInitScreen;
+ winCloseScreenProcPtr pwinCloseScreen;
+ winInitVisualsProcPtr pwinInitVisuals;
+ winAdjustVideoModeProcPtr pwinAdjustVideoMode;
+ winCreateBoundingWindowProcPtr pwinCreateBoundingWindow;
+ winFinishScreenInitProcPtr pwinFinishScreenInit;
+ winBltExposedRegionsProcPtr pwinBltExposedRegions;
+ winActivateAppProcPtr pwinActivateApp;
+ winRedrawScreenProcPtr pwinRedrawScreen;
+ winRealizeInstalledPaletteProcPtr pwinRealizeInstalledPalette;
+ winInstallColormapProcPtr pwinInstallColormap;
+ winStoreColorsProcPtr pwinStoreColors;
+ winCreateColormapProcPtr pwinCreateColormap;
+ winDestroyColormapProcPtr pwinDestroyColormap;
+ winHotKeyAltTabProcPtr pwinHotKeyAltTab;
+ winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface;
+ winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface;
+
+ winCreateScreenResourcesProc pwinCreateScreenResources;
+
+#ifdef XWIN_MULTIWINDOW
+ /* Window Procedures for MultiWindow mode */
+ winFinishCreateWindowsWindowProcPtr pwinFinishCreateWindowsWindow;
+#endif
+
+ /* Window Procedures for Rootless mode */
+ CreateWindowProcPtr CreateWindow;
+ DestroyWindowProcPtr DestroyWindow;
+ PositionWindowProcPtr PositionWindow;
+ ChangeWindowAttributesProcPtr ChangeWindowAttributes;
+ RealizeWindowProcPtr RealizeWindow;
+ UnrealizeWindowProcPtr UnrealizeWindow;
+ ValidateTreeProcPtr ValidateTree;
+ PostValidateTreeProcPtr PostValidateTree;
+ WindowExposuresProcPtr WindowExposures;
+ CopyWindowProcPtr CopyWindow;
+ ClearToBackgroundProcPtr ClearToBackground;
+ ClipNotifyProcPtr ClipNotify;
+ RestackWindowProcPtr RestackWindow;
+ ReparentWindowProcPtr ReparentWindow;
+ ResizeWindowProcPtr ResizeWindow;
+ MoveWindowProcPtr MoveWindow;
+ SetShapeProcPtr SetShape;
+
+ winCursorRec cursor;
+
+#ifdef XWIN_NATIVEGDI
+ RealizeFontPtr RealizeFont;
+ UnrealizeFontPtr UnrealizeFont;
+#endif
+
+} winPrivScreenRec;
+
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+typedef struct {
+ RootlessWindowPtr pFrame;
+ HWND hWnd;
+ int dwWidthBytes;
+ BITMAPINFOHEADER *pbmihShadow;
+ HBITMAP hbmpShadow;
+ HDC hdcShadow;
+ HDC hdcScreen;
+ BOOL fResized;
+ BOOL fRestackingNow;
+ BOOL fClose;
+ BOOL fMovingOrSizing;
+ BOOL fDestroyed;//for debug
+ char *pfb;
+} win32RootlessWindowRec, *win32RootlessWindowPtr;
+#endif
+
+
+typedef struct {
+ pointer value;
+ XID id;
+} WindowIDPairRec, *WindowIDPairPtr;
+
+
+/*
+ * Extern declares for general global variables
+ */
+
+#include "winglobals.h"
+
+extern winScreenInfo * g_ScreenInfo;
+extern miPointerScreenFuncRec g_winPointerCursorFuncs;
+extern DWORD g_dwEvents;
+#ifdef HAS_DEVWINDOWS
+extern int g_fdMessageQueue;
+#endif
+extern DevPrivateKeyRec g_iScreenPrivateKeyRec;
+#define g_iScreenPrivateKey (&g_iScreenPrivateKeyRec)
+extern DevPrivateKeyRec g_iCmapPrivateKeyRec;
+#define g_iCmapPrivateKey (&g_iCmapPrivateKeyRec)
+extern DevPrivateKeyRec g_iGCPrivateKeyRec;
+#define g_iGCPrivateKey (&g_iGCPrivateKeyRec)
+extern DevPrivateKeyRec g_iPixmapPrivateKeyRec;
+#define g_iPixmapPrivateKey (&g_iPixmapPrivateKeyRec)
+extern DevPrivateKeyRec g_iWindowPrivateKeyRec;
+#define g_iWindowPrivateKey (&g_iWindowPrivateKeyRec)
+
+extern unsigned long g_ulServerGeneration;
+extern DWORD g_dwEnginesSupported;
+extern HINSTANCE g_hInstance;
+extern int g_copyROP[];
+extern int g_patternROP[];
+extern const char * g_pszQueryHost;
+extern DeviceIntPtr g_pwinPointer;
+extern DeviceIntPtr g_pwinKeyboard;
+
+/*
+ * Extern declares for dynamically loaded library function pointers
+ */
+
+extern FARPROC g_fpDirectDrawCreate;
+extern FARPROC g_fpDirectDrawCreateClipper;
+extern FARPROC g_fpTrackMouseEvent;
+
+
+/*
+ * Screen privates macros
+ */
+
+#define winGetScreenPriv(pScreen) ((winPrivScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey))
+
+#define winSetScreenPriv(pScreen,v) \
+ dixSetPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey, v)
+
+#define winScreenPriv(pScreen) \
+ winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen)
+
+
+/*
+ * Colormap privates macros
+ */
+
+#define winGetCmapPriv(pCmap) ((winPrivCmapPtr) \
+ dixLookupPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey))
+
+#define winSetCmapPriv(pCmap,v) \
+ dixSetPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey, v)
+
+#define winCmapPriv(pCmap) \
+ winPrivCmapPtr pCmapPriv = winGetCmapPriv(pCmap)
+
+
+/*
+ * GC privates macros
+ */
+
+#define winGetGCPriv(pGC) ((winPrivGCPtr) \
+ dixLookupPrivate(&(pGC)->devPrivates, g_iGCPrivateKey))
+
+#define winSetGCPriv(pGC,v) \
+ dixSetPrivate(&(pGC)->devPrivates, g_iGCPrivateKey, v)
+
+#define winGCPriv(pGC) \
+ winPrivGCPtr pGCPriv = winGetGCPriv(pGC)
+
+
+/*
+ * Pixmap privates macros
+ */
+
+#define winGetPixmapPriv(pPixmap) ((winPrivPixmapPtr) \
+ dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey))
+
+#define winSetPixmapPriv(pPixmap,v) \
+ dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey, v)
+
+#define winPixmapPriv(pPixmap) \
+ winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap)
+
+
+/*
+ * Window privates macros
+ */
+
+#define winGetWindowPriv(pWin) ((winPrivWinPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey))
+
+#define winSetWindowPriv(pWin,v) \
+ dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey, v)
+
+#define winWindowPriv(pWin) \
+ winPrivWinPtr pWinPriv = winGetWindowPriv(pWin)
+
+/*
+ * wrapper macros
+ */
+#define _WIN_WRAP(priv, real, mem, func) {\
+ priv->mem = real->mem; \
+ real->mem = func; \
+}
+
+#define _WIN_UNWRAP(priv, real, mem) {\
+ real->mem = priv->mem; \
+}
+
+#define WIN_WRAP(mem, func) _WIN_WRAP(pScreenPriv, pScreen, mem, func)
+
+#define WIN_UNWRAP(mem) _WIN_UNWRAP(pScreenPriv, pScreen, mem)
+
+/*
+ * BEGIN DDX and DIX Function Prototypes
+ */
+
+
+/*
+ * winallpriv.c
+ */
+
+Bool
+winAllocatePrivates (ScreenPtr pScreen);
+
+Bool
+winInitCmapPrivates (ColormapPtr pCmap, int index);
+
+Bool
+winAllocateCmapPrivates (ColormapPtr pCmap);
+
+
+/*
+ * winauth.c
+ */
+
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+Bool
+winGenerateAuthorization (void);
+void winSetAuthorization(void);
+#endif
+
+
+/*
+ * winblock.c
+ */
+
+void
+winBlockHandler (int nScreen,
+ pointer pBlockData,
+ pointer pTimeout,
+ pointer pReadMask);
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winclip.c
+ */
+
+RegionPtr
+winPixmapToRegionNativeGDI (PixmapPtr pPix);
+#endif
+
+
+#ifdef XWIN_CLIPBOARD
+/*
+ * winclipboardinit.c
+ */
+
+Bool
+winInitClipboard (void);
+
+void
+winFixClipboardChain (int Removed);
+#endif
+
+
+/*
+ * wincmap.c
+ */
+
+void
+winSetColormapFunctions (ScreenPtr pScreen);
+
+Bool
+winCreateDefColormap (ScreenPtr pScreen);
+
+
+/*
+ * wincreatewnd.c
+ */
+
+Bool
+winCreateBoundingWindowFullScreen (ScreenPtr pScreen);
+
+Bool
+winCreateBoundingWindowWindowed (ScreenPtr pScreen);
+
+
+/*
+ * windialogs.c
+ */
+
+int
+GetLiveClients (winPrivScreenPtr pScreenPriv);
+
+void
+winDisplayExitDialog (winPrivScreenPtr pScreenPriv);
+
+void
+winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv);
+
+void
+winDisplayAboutDialog (winPrivScreenPtr pScreenPriv);
+
+
+/*
+ * winengine.c
+ */
+
+void
+winDetectSupportedEngines (void);
+
+Bool
+winSetEngine (ScreenPtr pScreen);
+
+Bool
+winGetDDProcAddresses (void);
+
+void
+winReleaseDDProcAddresses(void);
+
+
+/*
+ * winerror.c
+ */
+
+#ifdef DDXOSVERRORF
+void
+OSVenderVErrorF (const char *pszFormat, va_list va_args);
+#endif
+
+void
+winMessageBoxF (const char *pszError, UINT uType, ...);
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winfillsp.c
+ */
+
+void
+winFillSpansNativeGDI (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSpans,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int fSorted);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winfont.c
+ */
+
+Bool
+winRealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont);
+
+Bool
+winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * wingc.c
+ */
+
+Bool
+winCreateGCNativeGDI (GCPtr pGC);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * wingetsp.c
+ */
+
+void
+winGetSpansNativeGDI (DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int nSpans,
+ char *pDst);
+#endif
+
+
+/*
+ * winglobals.c
+ */
+
+void
+winInitializeGlobals (void);
+
+
+/*
+ * winkeybd.c
+ */
+
+void
+winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode);
+
+int
+winKeybdProc (DeviceIntPtr pDeviceInt, int iState);
+
+void
+winInitializeModeKeyStates (void);
+
+void
+winRestoreModeKeyStates (void);
+
+Bool
+winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam);
+
+void
+winKeybdReleaseKeys (void);
+
+void
+winSendKeyEvent (DWORD dwKey, Bool fDown);
+
+BOOL
+winCheckKeyPressed(WPARAM wParam, LPARAM lParam);
+
+void
+winFixShiftKeys (int iScanCode);
+
+/*
+ * winkeyhook.c
+ */
+
+Bool
+winInstallKeyboardHookLL (void);
+
+void
+winRemoveKeyboardHookLL (void);
+
+
+/*
+ * winmisc.c
+ */
+
+#ifdef XWIN_NATIVEGDI
+void
+winQueryBestSizeNativeGDI (int class, unsigned short *pWidth,
+ unsigned short *pHeight, ScreenPtr pScreen);
+#endif
+
+CARD8
+winCountBits (DWORD dw);
+
+Bool
+winUpdateFBPointer (ScreenPtr pScreen, void *pbits);
+
+#ifdef XWIN_NATIVEGDI
+BOOL
+winPaintBackground (HWND hwnd, COLORREF colorref);
+#endif
+
+
+/*
+ * winmouse.c
+ */
+
+int
+winMouseProc (DeviceIntPtr pDeviceInt, int iState);
+
+int
+winMouseWheel (ScreenPtr pScreen, int iDeltaZ);
+
+void
+winMouseButtonsSendEvent (int iEventType, int iButton);
+
+int
+winMouseButtonsHandle (ScreenPtr pScreen,
+ int iEventType, int iButton,
+ WPARAM wParam);
+
+void
+winEnqueueMotion(int x, int y);
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winnativegdi.c
+ */
+
+HBITMAP
+winCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth,
+ BYTE **ppbBits, BITMAPINFO **ppbmi);
+
+Bool
+winSetEngineFunctionsNativeGDI (ScreenPtr pScreen);
+#endif
+
+
+#ifdef XWIN_PRIMARYFB
+/*
+ * winpfbddd.c
+ */
+
+Bool
+winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winpixmap.c
+ */
+
+PixmapPtr
+winCreatePixmapNativeGDI (ScreenPtr pScreen, int width, int height, int depth,
+ unsigned class);
+
+Bool
+winDestroyPixmapNativeGDI (PixmapPtr pPixmap);
+
+Bool
+winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap,
+ int iWidth, int iHeight,
+ int iDepth,
+ int iBitsPerPixel,
+ int devKind,
+ pointer pPixData);
+#endif
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winpolyline.c
+ */
+
+void
+winPolyLineNativeGDI (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr ppt);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winpushpxl.c
+ */
+
+void
+winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
+ int dx, int dy, int xOrg, int yOrg);
+#endif
+
+
+/*
+ * winscrinit.c
+ */
+
+Bool
+winScreenInit (int index,
+ ScreenPtr pScreen,
+ int argc, char **argv);
+
+Bool
+winFinishScreenInitFB (int index,
+ ScreenPtr pScreen,
+ int argc, char **argv);
+
+#if defined(XWIN_NATIVEGDI)
+Bool
+winFinishScreenInitNativeGDI (int index,
+ ScreenPtr pScreen,
+ int argc, char **argv);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winsetsp.c
+ */
+
+void
+winSetSpansNativeGDI (DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pSrc,
+ DDXPointPtr pPoints,
+ int *pWidth,
+ int nSpans,
+ int fSorted);
+#endif
+
+
+/*
+ * winshaddd.c
+ */
+
+Bool
+winSetEngineFunctionsShadowDD (ScreenPtr pScreen);
+
+
+/*
+ * winshadddnl.c
+ */
+
+Bool
+winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen);
+
+
+/*
+ * winshadgdi.c
+ */
+
+Bool
+winSetEngineFunctionsShadowGDI (ScreenPtr pScreen);
+
+
+/*
+ * winwakeup.c
+ */
+
+void
+winWakeupHandler (int nScreen,
+ pointer pWakeupData,
+ unsigned long ulResult,
+ pointer pReadmask);
+
+
+/*
+ * winwindow.c
+ */
+
+#ifdef XWIN_NATIVEGDI
+Bool
+winCreateWindowNativeGDI (WindowPtr pWin);
+
+Bool
+winDestroyWindowNativeGDI (WindowPtr pWin);
+
+Bool
+winPositionWindowNativeGDI (WindowPtr pWin, int x, int y);
+
+void
+winCopyWindowNativeGDI (WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+
+Bool
+winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask);
+
+Bool
+winUnmapWindowNativeGDI (WindowPtr pWindow);
+
+Bool
+winMapWindowNativeGDI (WindowPtr pWindow);
+#endif
+
+Bool
+winCreateWindowRootless (WindowPtr pWindow);
+
+Bool
+winDestroyWindowRootless (WindowPtr pWindow);
+
+Bool
+winPositionWindowRootless (WindowPtr pWindow, int x, int y);
+
+Bool
+winChangeWindowAttributesRootless (WindowPtr pWindow, unsigned long mask);
+
+Bool
+winUnmapWindowRootless (WindowPtr pWindow);
+
+Bool
+winMapWindowRootless (WindowPtr pWindow);
+
+void
+winSetShapeRootless (WindowPtr pWindow, int kind);
+
+
+/*
+ * winmultiwindowicons.c - Used by both multi-window and Win32Rootless
+ */
+
+HICON
+winXIconToHICON (WindowPtr pWin, int iconSize);
+
+void
+winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon);
+
+#ifdef XWIN_MULTIWINDOW
+/*
+ * winmultiwindowshape.c
+ */
+
+void
+winReshapeMultiWindow (WindowPtr pWin);
+
+void
+winSetShapeMultiWindow (WindowPtr pWindow, int kind);
+
+void
+winUpdateRgnMultiWindow (WindowPtr pWindow);
+#endif
+
+
+#ifdef XWIN_MULTIWINDOW
+/*
+ * winmultiwindowwindow.c
+ */
+
+Bool
+winCreateWindowMultiWindow (WindowPtr pWindow);
+
+Bool
+winDestroyWindowMultiWindow (WindowPtr pWindow);
+
+Bool
+winPositionWindowMultiWindow (WindowPtr pWindow, int x, int y);
+
+Bool
+winChangeWindowAttributesMultiWindow (WindowPtr pWindow, unsigned long mask);
+
+Bool
+winUnmapWindowMultiWindow (WindowPtr pWindow);
+
+Bool
+winMapWindowMultiWindow (WindowPtr pWindow);
+
+void
+winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent);
+
+void
+winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib);
+
+void
+winReorderWindowsMultiWindow (void);
+
+void
+winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w,
+ unsigned int h, WindowPtr pSib);
+void
+winMoveWindowMultiWindow (WindowPtr pWin, int x, int y,
+ WindowPtr pSib, VTKind kind);
+
+void
+winCopyWindowMultiWindow (WindowPtr pWin, DDXPointRec oldpt,
+ RegionPtr oldRegion);
+
+XID
+winGetWindowID (WindowPtr pWin);
+
+int
+winAdjustXWindow (WindowPtr pWin, HWND hwnd);
+#endif
+
+
+#ifdef XWIN_MULTIWINDOW
+/*
+ * winmultiwindowwndproc.c
+ */
+
+LRESULT CALLBACK
+winTopLevelWindowProc (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+#endif
+
+
+/*
+ * wintrayicon.c
+ */
+
+void
+winInitNotifyIcon (winPrivScreenPtr pScreenPriv, Bool Modify);
+
+void
+winDeleteNotifyIcon (winPrivScreenPtr pScreenPriv);
+
+LRESULT
+winHandleIconMessage (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam,
+ winPrivScreenPtr pScreenPriv);
+
+
+/*
+ * winwndproc.c
+ */
+
+LRESULT CALLBACK
+winWindowProc (HWND hWnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+/*
+ * winwin32rootless.c
+ */
+
+Bool
+winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen,
+ int newX, int newY, RegionPtr pShape);
+
+void
+winMWExtWMDestroyFrame (RootlessFrameID wid);
+
+void
+winMWExtWMMoveFrame (RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
+
+void
+winMWExtWMResizeFrame (RootlessFrameID wid, ScreenPtr pScreen,
+ int newX, int newY, unsigned int newW, unsigned int newH,
+ unsigned int gravity);
+
+void
+winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid);
+
+void
+winMWExtWMReshapeFrame (RootlessFrameID wid, RegionPtr pShape);
+
+void
+winMWExtWMUnmapFrame (RootlessFrameID wid);
+
+void
+winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow);
+
+void
+winMWExtWMStopDrawing (RootlessFrameID wid, Bool flush);
+
+void
+winMWExtWMUpdateRegion (RootlessFrameID wid, RegionPtr pDamage);
+
+void
+winMWExtWMDamageRects (RootlessFrameID wid, int count, const BoxRec *rects,
+ int shift_x, int shift_y);
+
+void
+winMWExtWMRootlessSwitchWindow (RootlessWindowPtr pFrame, WindowPtr oldWin);
+
+void
+winMWExtWMCopyBytes (unsigned int width, unsigned int height,
+ const void *src, unsigned int srcRowBytes,
+ void *dst, unsigned int dstRowBytes);
+
+void
+winMWExtWMCopyWindow (RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
+ int dx, int dy);
+#endif
+
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+/*
+ * winwin32rootlesswindow.c
+ */
+
+void
+winMWExtWMReorderWindows (ScreenPtr pScreen);
+
+void
+winMWExtWMMoveXWindow (WindowPtr pWin, int x, int y);
+
+void
+winMWExtWMResizeXWindow (WindowPtr pWin, int w, int h);
+
+void
+winMWExtWMMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h);
+
+void
+winMWExtWMUpdateIcon (Window id);
+
+void
+winMWExtWMUpdateWindowDecoration (win32RootlessWindowPtr pRLWinPriv,
+ winScreenInfoPtr pScreenInfo);
+
+wBOOL CALLBACK
+winMWExtWMDecorateWindow (HWND hwnd, LPARAM lParam);
+
+void
+winMWExtWMRestackWindows (ScreenPtr pScreen);
+#endif
+#ifdef XWIN_MULTIWINDOWINTWM
+Bool
+winIsInternalWMRunning (winScreenInfoPtr pScreenInfo);
+#endif
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+/*
+ * winwin32rootlesswndproc.c
+ */
+
+LRESULT CALLBACK
+winMWExtWMWindowProc (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+#endif
+
+
+/*
+ * winwindowswm.c
+ */
+
+void
+winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg,
+ Window window, int x, int y, int w, int h);
+
+void
+winWindowsWMExtensionInit (void);
+
+/*
+ * wincursor.c
+ */
+
+Bool
+winInitCursor (ScreenPtr pScreen);
+
+/*
+ * winprocarg.c
+ */
+void
+winInitializeScreens(int maxscreens);
+
+/*
+ * windisplay.c
+ */
+
+void
+winGetDisplayName(char *szDisplay, unsigned int screen);
+
+/*
+ * winrandr.c
+ */
+Bool
+winRandRInit (ScreenPtr pScreen);
+void
+winDoRandRScreenSetSize (ScreenPtr pScreen,
+ CARD16 width,
+ CARD16 height,
+ CARD32 mmWidth,
+ CARD32 mmHeight);
+
+/*
+ * END DDX and DIX Function Prototypes
+ */
+
+#endif /* _WIN_H_ */
+
diff --git a/xorg-server/hw/xwin/winpixmap.c b/xorg-server/hw/xwin/winpixmap.c
index 2af95f225..d174d70d3 100644
--- a/xorg-server/hw/xwin/winpixmap.c
+++ b/xorg-server/hw/xwin/winpixmap.c
@@ -57,7 +57,7 @@ winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix,
PixmapPtr
winCreatePixmapNativeGDI (ScreenPtr pScreen,
int iWidth, int iHeight,
- int iDepth, unsigned usage_hint)
+ int iDepth, unsigned class)
{
winPrivPixmapPtr pPixmapPriv = NULL;
PixmapPtr pPixmap = NULL;
@@ -71,12 +71,12 @@ winCreatePixmapNativeGDI (ScreenPtr pScreen,
}
winDebug ("winCreatePixmap () - w %d h %d d %d uh %d bw %d\n",
- iWidth, iHeight, iDepth, usage_hint,
+ iWidth, iHeight, iDepth, class,
PixmapBytePad (iWidth, iDepth));
/* Setup pixmap values */
pPixmap->drawable.type = DRAWABLE_PIXMAP;
- pPixmap->drawable.class = 0;
+ pPixmap->drawable.class = class;
pPixmap->drawable.pScreen = pScreen;
pPixmap->drawable.depth = iDepth;
pPixmap->drawable.bitsPerPixel = BitsPerPixel (iDepth);
@@ -89,7 +89,6 @@ winCreatePixmapNativeGDI (ScreenPtr pScreen,
pPixmap->devKind = 0;
pPixmap->refcnt = 1;
pPixmap->devPrivate.ptr = NULL;
- pPixmap->usage_hint = usage_hint;
/* Pixmap privates are allocated by AllocatePixmap */
pPixmapPriv = winGetPixmapPriv (pPixmap);
diff --git a/xorg-server/include/dix.h b/xorg-server/include/dix.h
index 6bba40aef..de78b7e24 100644
--- a/xorg-server/include/dix.h
+++ b/xorg-server/include/dix.h
@@ -576,35 +576,4 @@ extern _X_HIDDEN void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what);
extern _X_HIDDEN int CoreKeyboardProc(DeviceIntPtr dev, int what);
-
-/*
- * These are deprecated compatibility functions and will be removed soon!
- * Please use the noted replacements instead.
- */
-/* replaced by dixLookupWindow */
-extern _X_EXPORT WindowPtr SecurityLookupWindow(
- XID id,
- ClientPtr client,
- Mask access_mode);
-/* replaced by dixLookupWindow */
-extern _X_EXPORT WindowPtr LookupWindow(
- XID id,
- ClientPtr client);
-
-/* replaced by dixLookupDrawable */
-extern _X_EXPORT pointer SecurityLookupDrawable(
- XID id,
- ClientPtr client,
- Mask access_mode);
-
-/* replaced by dixLookupDrawable */
-extern _X_EXPORT pointer LookupDrawable(
- XID id,
- ClientPtr client);
-
-/* replaced by dixLookupClient */
-extern _X_EXPORT ClientPtr LookupClient(
- XID id,
- ClientPtr client);
-
#endif /* DIX_H */
diff --git a/xorg-server/include/misc.h b/xorg-server/include/misc.h
index 4c474464f..044a5740b 100644
--- a/xorg-server/include/misc.h
+++ b/xorg-server/include/misc.h
@@ -96,10 +96,8 @@ OF THIS SOFTWARE.
#define EXTENSION_EVENT_BASE 64
#define EXTENSION_BASE 128
-typedef unsigned long PIXEL;
typedef unsigned long ATOM;
-
#ifndef TRUE
#define TRUE 1
#define FALSE 0
diff --git a/xorg-server/include/pixmapstr.h b/xorg-server/include/pixmapstr.h
index 8002b170a..47dce91e1 100644
--- a/xorg-server/include/pixmapstr.h
+++ b/xorg-server/include/pixmapstr.h
@@ -1,84 +1,83 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-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.
-
-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
-OPEN GROUP 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 Open Group 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 Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-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 Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL 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.
-
-******************************************************************/
-
-#ifndef PIXMAPSTRUCT_H
-#define PIXMAPSTRUCT_H
-#include "pixmap.h"
-#include "screenint.h"
-#include "regionstr.h"
-#include "privates.h"
-
-typedef struct _Drawable {
- unsigned char type; /* DRAWABLE_<type> */
- unsigned char class; /* specific to type */
- unsigned char depth;
- unsigned char bitsPerPixel;
- XID id; /* resource id */
- short x; /* window: screen absolute, pixmap: 0 */
- short y; /* window: screen absolute, pixmap: 0 */
- unsigned short width;
- unsigned short height;
- ScreenPtr pScreen;
- unsigned long serialNumber;
-} DrawableRec;
-
-/*
- * PIXMAP -- device dependent
- */
-
-typedef struct _Pixmap {
- DrawableRec drawable;
- PrivateRec *devPrivates;
- int refcnt;
- int devKind; /* This is the pitch of the pixmap, typically width*bpp/8. */
- DevUnion devPrivate; /* When !NULL, devPrivate.ptr points to the raw pixel data. */
- short screen_x;
- short screen_y;
- unsigned usage_hint; /* see CREATE_PIXMAP_USAGE_* */
-} PixmapRec;
-
-#endif /* PIXMAPSTRUCT_H */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+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.
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL 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.
+
+******************************************************************/
+
+#ifndef PIXMAPSTRUCT_H
+#define PIXMAPSTRUCT_H
+#include "pixmap.h"
+#include "screenint.h"
+#include "regionstr.h"
+#include "privates.h"
+
+typedef struct _Drawable {
+ unsigned char type; /* DRAWABLE_<type> */
+ unsigned char class; /* specific to type */
+ unsigned char depth;
+ unsigned char bitsPerPixel;
+ XID id; /* resource id */
+ short x; /* window: screen absolute, pixmap: 0 */
+ short y; /* window: screen absolute, pixmap: 0 */
+ unsigned short width;
+ unsigned short height;
+ ScreenPtr pScreen;
+ unsigned long serialNumber;
+} DrawableRec;
+
+/*
+ * PIXMAP -- device dependent
+ */
+
+typedef struct _Pixmap {
+ DrawableRec drawable;
+ PrivateRec *devPrivates;
+ int refcnt;
+ int devKind; /* This is the pitch of the pixmap, typically width*bpp/8. */
+ DevUnion devPrivate; /* When !NULL, devPrivate.ptr points to the raw pixel data. */
+ short screen_x;
+ short screen_y;
+} PixmapRec;
+
+#endif /* PIXMAPSTRUCT_H */
diff --git a/xorg-server/include/resource.h b/xorg-server/include/resource.h
index 82068fe0e..95e34a9b8 100644
--- a/xorg-server/include/resource.h
+++ b/xorg-server/include/resource.h
@@ -251,34 +251,5 @@ extern _X_EXPORT unsigned int GetXIDList(
extern _X_EXPORT RESTYPE lastResourceType;
extern _X_EXPORT RESTYPE TypeMask;
-/*
- * These are deprecated compatibility functions and will be removed soon!
- * Please use the noted replacements instead.
- */
-
-/* replaced by dixLookupResourceByType */
-extern _X_EXPORT pointer SecurityLookupIDByType(
- ClientPtr client,
- XID id,
- RESTYPE rtype,
- Mask access_mode) _X_DEPRECATED;
-
-/* replaced by dixLookupResourceByClass */
-extern _X_EXPORT pointer SecurityLookupIDByClass(
- ClientPtr client,
- XID id,
- RESTYPE classes,
- Mask access_mode) _X_DEPRECATED;
-
-/* replaced by dixLookupResourceByType */
-extern _X_EXPORT pointer LookupIDByType(
- XID id,
- RESTYPE rtype) _X_DEPRECATED;
-
-/* replaced by dixLookupResourceByClass */
-extern _X_EXPORT pointer LookupIDByClass(
- XID id,
- RESTYPE classes) _X_DEPRECATED;
-
#endif /* RESOURCE_H */
diff --git a/xorg-server/include/scrnintstr.h b/xorg-server/include/scrnintstr.h
index a373acd27..28dd2c011 100644
--- a/xorg-server/include/scrnintstr.h
+++ b/xorg-server/include/scrnintstr.h
@@ -208,7 +208,7 @@ typedef PixmapPtr (* CreatePixmapProcPtr)(
int /*width*/,
int /*height*/,
int /*depth*/,
- unsigned /*usage_hint*/);
+ unsigned /*class*/);
typedef Bool (* DestroyPixmapProcPtr)(
PixmapPtr /*pPixmap*/);
diff --git a/xorg-server/render/render.c b/xorg-server/render/render.c
index 9f1b4701f..04ae0e122 100644
--- a/xorg-server/render/render.c
+++ b/xorg-server/render/render.c
@@ -239,7 +239,7 @@ RenderClientCallback (CallbackListPtr *list,
}
#ifdef PANORAMIX
-unsigned long XRT_PICTURE;
+RESTYPE XRT_PICTURE;
#endif
void