diff options
79 files changed, 757 insertions, 381 deletions
diff --git a/fontconfig/doc/fontconfig-user.sgml b/fontconfig/doc/fontconfig-user.sgml index c6ab856bb..f29cfe09b 100644 --- a/fontconfig/doc/fontconfig-user.sgml +++ b/fontconfig/doc/fontconfig-user.sgml @@ -627,6 +627,29 @@ This is an example of a system-wide configuration file <family>monospace</family> <prefer><family>Andale Mono</family></prefer> </alias> + +<-- + The example of the requirements of OR operator; + If the 'family' contains 'Courier New' OR 'Courier' + add 'monospace' as the alternative +--> +<match target="pattern"> + <test name="family" mode="eq"> + <string>Courier New</string> + </test> + <edit name="family" mode="prepend"> + <string>monospace</string> + </edit> +</match> +<match target="pattern"> + <test name="family" mode="eq"> + <string>Courier</string> + </test> + <edit name="family" mode="prepend"> + <string>monospace</string> + </edit> +</match> + </fontconfig> </programlisting> </refsect2> diff --git a/fontconfig/src/fcxml.c b/fontconfig/src/fcxml.c index f0272705d..d92cbcc66 100644 --- a/fontconfig/src/fcxml.c +++ b/fontconfig/src/fcxml.c @@ -1590,6 +1590,7 @@ FcParseAlias (FcConfigParse *parse) case FcVStackFamily: if (family) { + FcConfigMessage (parse, FcSevereWarning, "Having multiple <family> in <alias> isn't supported and may not works as expected"); new = FcExprCreateOp (parse->config, vstack->u.expr, FcOpComma, family); if (!new) FcConfigMessage (parse, FcSevereError, "out of memory"); @@ -2204,6 +2205,10 @@ FcParseTest (FcConfigParse *parse) FcConfigMessage (parse, FcSevereWarning, "missing test expression"); return; } + if (expr->op == FcOpComma) + { + FcConfigMessage (parse, FcSevereWarning, "Having multiple values in <test> isn't supported and may not works as expected"); + } test = FcTestCreate (parse, kind, qual, name, FC_OP (compare, flags), expr); if (!test) { diff --git a/mesalib/common.py b/mesalib/common.py index f0b1ccc2c..6121a4114 100644 --- a/mesalib/common.py +++ b/mesalib/common.py @@ -89,7 +89,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', 'windows', 'darwin', 'cygwin', 'sunos', 'freebsd8', 'haiku'))) + allowed_values=('cygwin', 'darwin', 'freebsd', 'haiku', 'linux', 'sunos', 'windows'))) opts.Add(BoolOption('embedded', 'embedded build', 'no')) opts.Add('toolchain', 'compiler toolchain', default_toolchain) opts.Add(BoolOption('gles', 'EXPERIMENTAL: enable OpenGL ES support', 'no')) diff --git a/mesalib/configure.ac b/mesalib/configure.ac index 844990a28..5ccf77d65 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -37,7 +37,7 @@ USER_CXXFLAGS="$CXXFLAGS" dnl Versions for external dependencies LIBDRM_REQUIRED=2.4.24 LIBDRM_RADEON_REQUIRED=2.4.31 -LIBDRM_INTEL_REQUIRED=2.4.32 +LIBDRM_INTEL_REQUIRED=2.4.34 LIBDRM_NVVIEUX_REQUIRED=2.4.33 LIBDRM_NOUVEAU_REQUIRED=2.4.33 DRI2PROTO_REQUIRED=2.6 @@ -1830,7 +1830,7 @@ if test "x$enable_gallium_llvm" = xyes; then if test "x$LLVM_CONFIG" != xno; then LLVM_VERSION=`$LLVM_CONFIG --version | sed 's/svn.*//g'` - LLVM_CFLAGS=`$LLVM_CONFIG --cppflags|sed -e 's/-DNDEBUG\>//g' -e 's/-pedantic//g'` + LLVM_CFLAGS=`$LLVM_CONFIG --cppflags|sed -e 's/-DNDEBUG\>//g' -e 's/-pedantic//g' -e 's/-Wcovered-switch-default//g'` if test "x$with_llvm_shared_libs" = xyes; then dnl We can't use $LLVM_VERSION because it has 'svn' stripped out, LLVM_LIBS="-lLLVM-`$LLVM_CONFIG --version`" diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt index 5fc6c69ba..17136de31 100644 --- a/mesalib/docs/GL3.txt +++ b/mesalib/docs/GL3.txt @@ -46,7 +46,7 @@ GLSL 1.40 missing: UBOS, inverse(), highp change Instanced drawing (GL_ARB_draw_instanced) DONE (i965, gallium, swrast) Buffer copying (GL_ARB_copy_buffer) DONE (i965, r300, r600, swrast) -Primitive restart (GL_NV_primitive_restart) DONE (r600) +Primitive restart (GL_NV_primitive_restart) DONE (i965, r600) 16 vertex texture image units DONE Texture buffer objs (GL_ARB_texture_buffer_object) needs GL3.1 enabling (i965) Rectangular textures (GL_ARB_texture_rectangle) DONE (i965, r300, r600, swrast) @@ -73,7 +73,7 @@ GLX_ARB_create_context_profile DONE GL 3.3: GLSL 3.30 not started -GL_ARB_blend_func_extended DONE (r600, softpipe) +GL_ARB_blend_func_extended DONE (i965, r600, softpipe) GL_ARB_explicit_attrib_location DONE (i915, i965, r300, r600, swrast) GL_ARB_occlusion_query2 DONE (r300, r600, swrast) GL_ARB_sampler_objects DONE (i965, r300, r600) diff --git a/mesalib/docs/dispatch.html b/mesalib/docs/dispatch.html index c3a33b90b..620aecd74 100644 --- a/mesalib/docs/dispatch.html +++ b/mesalib/docs/dispatch.html @@ -84,7 +84,7 @@ void glVertex3f(GLfloat x, GLfloat y, GLfloat z) <p>The problem with this simple implementation is the large amount of overhead that it adds to every GL function call.</p> -<p>In a multithreaded environment, a niave implementation of +<p>In a multithreaded environment, a naive implementation of <tt>GET_DISPATCH</tt> involves a call to <tt>pthread_getspecific</tt> or a similar function. Mesa provides a wrapper function called <tt>_glapi_get_dispatch</tt> that is used by default.</p> diff --git a/mesalib/docs/relnotes.html b/mesalib/docs/relnotes.html index 23337cfd3..1bc889a5b 100644 --- a/mesalib/docs/relnotes.html +++ b/mesalib/docs/relnotes.html @@ -13,6 +13,7 @@ The release notes summarize what's new or changed in each Mesa release. </p> <UL> +<LI><A HREF="relnotes-8.0.3.html">8.0.3 release notes</A> <LI><A HREF="relnotes-8.0.2.html">8.0.2 release notes</A> <LI><A HREF="relnotes-8.0.1.html">8.0.1 release notes</A> <LI><A HREF="relnotes-8.0.html">8.0 release notes</A> diff --git a/mesalib/src/SConscript b/mesalib/src/SConscript index 777ad23f2..3d0087887 100644 --- a/mesalib/src/SConscript +++ b/mesalib/src/SConscript @@ -22,7 +22,7 @@ SConscript('mesa/SConscript') SConscript('mapi/vgapi/SConscript') if not env['embedded']: - if env['platform'] not in ['windows', 'darwin', 'haiku']: + if env['platform'] not in ('cygwin', 'darwin', 'freebsd', 'haiku', 'windows'): SConscript('glx/SConscript') if env['platform'] not in ['darwin', 'haiku', 'sunos']: SConscript('egl/main/SConscript') diff --git a/mesalib/src/glsl/Makefile.sources b/mesalib/src/glsl/Makefile.sources index fba03604c..caa8ad590 100644 --- a/mesalib/src/glsl/Makefile.sources +++ b/mesalib/src/glsl/Makefile.sources @@ -46,6 +46,7 @@ LIBGLSL_CXX_FILES := \ linker.cpp \ link_functions.cpp \ link_uniforms.cpp \ + link_uniform_initializers.cpp \ loop_analysis.cpp \ loop_controls.cpp \ loop_unroll.cpp \ diff --git a/mesalib/src/glsl/link_uniform_initializers.cpp b/mesalib/src/glsl/link_uniform_initializers.cpp new file mode 100644 index 000000000..849e08097 --- /dev/null +++ b/mesalib/src/glsl/link_uniform_initializers.cpp @@ -0,0 +1,181 @@ +/* + * Copyright © 2012 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. + */ + +#include "main/core.h" +#include "ir.h" +#include "linker.h" +#include "ir_uniform.h" +#include "glsl_symbol_table.h" +#include "program/hash_table.h" + +/* These functions are put in a "private" namespace instead of being marked + * static so that the unit tests can access them. See + * http://code.google.com/p/googletest/wiki/AdvancedGuide#Testing_Private_Code + */ +namespace linker { + +gl_uniform_storage * +get_storage(gl_uniform_storage *storage, unsigned num_storage, + const char *name) +{ + for (unsigned int i = 0; i < num_storage; i++) { + if (strcmp(name, storage[i].name) == 0) + return &storage[i]; + } + + return NULL; +} + +void +copy_constant_to_storage(union gl_constant_value *storage, + const ir_constant *val, + const enum glsl_base_type base_type, + const unsigned int elements) +{ + for (unsigned int i = 0; i < elements; i++) { + switch (base_type) { + case GLSL_TYPE_UINT: + storage[i].u = val->value.u[i]; + break; + case GLSL_TYPE_INT: + case GLSL_TYPE_SAMPLER: + storage[i].i = val->value.i[i]; + break; + case GLSL_TYPE_FLOAT: + storage[i].f = val->value.f[i]; + break; + case GLSL_TYPE_BOOL: + storage[i].b = int(val->value.b[i]); + break; + default: + /* All other types should have already been filtered by other + * paths in the caller. + */ + assert(!"Should not get here."); + break; + } + } +} + +void +set_uniform_initializer(void *mem_ctx, gl_shader_program *prog, + const char *name, const glsl_type *type, + ir_constant *val) +{ + if (type->is_record()) { + ir_constant *field_constant; + + field_constant = (ir_constant *)val->components.get_head(); + + for (unsigned int i = 0; i < type->length; i++) { + const glsl_type *field_type = type->fields.structure[i].type; + const char *field_name = ralloc_asprintf(mem_ctx, "%s.%s", name, + type->fields.structure[i].name); + set_uniform_initializer(mem_ctx, prog, field_name, + field_type, field_constant); + field_constant = (ir_constant *)field_constant->next; + } + return; + } else if (type->is_array() && type->fields.array->is_record()) { + const glsl_type *const element_type = type->fields.array; + + for (unsigned int i = 0; i < type->length; i++) { + const char *element_name = ralloc_asprintf(mem_ctx, "%s[%d]", name, i); + + set_uniform_initializer(mem_ctx, prog, element_name, + element_type, val->array_elements[i]); + } + return; + } + + struct gl_uniform_storage *const storage = + get_storage(prog->UniformStorage, + prog->NumUserUniformStorage, + name); + if (storage == NULL) { + assert(storage != NULL); + return; + } + + if (val->type->is_array()) { + const enum glsl_base_type base_type = + val->array_elements[0]->type->base_type; + const unsigned int elements = val->array_elements[0]->type->components(); + unsigned int idx = 0; + + assert(val->type->length >= storage->array_elements); + for (unsigned int i = 0; i < storage->array_elements; i++) { + copy_constant_to_storage(& storage->storage[idx], + val->array_elements[i], + base_type, + elements); + + idx += elements; + } + + if (base_type == GLSL_TYPE_SAMPLER) { + for (unsigned int i = 0; i < storage->array_elements; i++) { + prog->SamplerUnits[storage->sampler + i] = storage->storage[i].i; + } + } + } else { + copy_constant_to_storage(storage->storage, + val, + val->type->base_type, + val->type->components()); + + if (storage->type->is_sampler()) + prog->SamplerUnits[storage->sampler] = storage->storage[0].i; + } + + storage->initialized = true; +} +} + +void +link_set_uniform_initializers(struct gl_shader_program *prog) +{ + void *mem_ctx = NULL; + + for (unsigned int i = 0; i < MESA_SHADER_TYPES; i++) { + struct gl_shader *shader = prog->_LinkedShaders[i]; + + if (shader == NULL) + continue; + + foreach_list(node, shader->ir) { + ir_variable *const var = ((ir_instruction *) node)->as_variable(); + + if (!var || var->mode != ir_var_uniform || !var->constant_value) + continue; + + if (!mem_ctx) + mem_ctx = ralloc_context(NULL); + + linker::set_uniform_initializer(mem_ctx, prog, var->name, + var->type, var->constant_value); + } + } + + ralloc_free(mem_ctx); +} diff --git a/mesalib/src/glsl/link_uniforms.cpp b/mesalib/src/glsl/link_uniforms.cpp index 2f1c9f5f7..92e2a1fa5 100644 --- a/mesalib/src/glsl/link_uniforms.cpp +++ b/mesalib/src/glsl/link_uniforms.cpp @@ -329,9 +329,16 @@ link_assign_uniform_locations(struct gl_shader_program *prog) prog->UniformHash = new string_to_uint_map; } - for (unsigned i = 0; i < Elements(prog->SamplerUnits); i++) { - prog->SamplerUnits[i] = i; - } + /* Uniforms that lack an initializer in the shader code have an initial + * value of zero. This includes sampler uniforms. + * + * Page 24 (page 30 of the PDF) of the GLSL 1.20 spec says: + * + * "The link time initial value is either the value of the variable's + * initializer, if present, or 0 if no initializer is present. Sampler + * types cannot have initializers." + */ + memset(prog->SamplerUnits, 0, sizeof(prog->SamplerUnits)); /* First pass: Count the uniform resources used by the user-defined * uniforms. While this happens, each active uniform will have an index @@ -426,5 +433,7 @@ link_assign_uniform_locations(struct gl_shader_program *prog) prog->NumUserUniformStorage = num_user_uniforms; prog->UniformStorage = uniforms; + link_set_uniform_initializers(prog); + return; } diff --git a/mesalib/src/glsl/linker.h b/mesalib/src/glsl/linker.h index 0b4c001f7..d0aaf3e1e 100644 --- a/mesalib/src/glsl/linker.h +++ b/mesalib/src/glsl/linker.h @@ -37,6 +37,9 @@ link_invalidate_variable_locations(gl_shader *sh, enum ir_variable_mode mode, extern void link_assign_uniform_locations(struct gl_shader_program *prog); +extern void +link_set_uniform_initializers(struct gl_shader_program *prog); + /** * Class for processing all of the leaf fields of an uniform * diff --git a/mesalib/src/glsl/opt_constant_propagation.cpp b/mesalib/src/glsl/opt_constant_propagation.cpp index d3812637d..2601b52f6 100644 --- a/mesalib/src/glsl/opt_constant_propagation.cpp +++ b/mesalib/src/glsl/opt_constant_propagation.cpp @@ -241,7 +241,26 @@ ir_constant_propagation_visitor::visit_leave(ir_assignment *ir) if (this->in_assignee) return visit_continue; - kill(ir->lhs->variable_referenced(), ir->write_mask); + unsigned kill_mask = ir->write_mask; + if (ir->lhs->as_dereference_array()) { + /* The LHS of the assignment uses an array indexing operator (e.g. v[i] + * = ...;). Since we only try to constant propagate vectors and + * scalars, this means that either (a) array indexing is being used to + * select a vector component, or (b) the variable in question is neither + * a scalar or a vector, so we don't care about it. In the former case, + * we want to kill the whole vector, since in general we can't predict + * which vector component will be selected by array indexing. In the + * latter case, it doesn't matter what we do, so go ahead and kill the + * whole variable anyway. + * + * Note that if the array index is constant (e.g. v[2] = ...;), we could + * in principle be smarter, but we don't need to, because a future + * optimization pass will convert it to a simple assignment with the + * correct mask. + */ + kill_mask = ~0; + } + kill(ir->lhs->variable_referenced(), kill_mask); add_constant(ir); diff --git a/mesalib/src/glu/sgi/libnurbs/internals/mapdesc.cc b/mesalib/src/glu/sgi/libnurbs/internals/mapdesc.cc index d59f8fd39..0a96c5f45 100644 --- a/mesalib/src/glu/sgi/libnurbs/internals/mapdesc.cc +++ b/mesalib/src/glu/sgi/libnurbs/internals/mapdesc.cc @@ -90,7 +90,7 @@ Mapdesc::setBboxsize( INREAL *mat ) void Mapdesc::identify( REAL dest[MAXCOORDS][MAXCOORDS] ) { - memset( dest, 0, sizeof( dest ) ); + memset( dest, 0, sizeof( REAL ) * MAXCOORDS * MAXCOORDS ); for( int i=0; i != hcoords; i++ ) dest[i][i] = 1.0; } diff --git a/mesalib/src/glu/sgi/libnurbs/internals/nurbstess.cc b/mesalib/src/glu/sgi/libnurbs/internals/nurbstess.cc index 68dfd95f3..e477a8c83 100644 --- a/mesalib/src/glu/sgi/libnurbs/internals/nurbstess.cc +++ b/mesalib/src/glu/sgi/libnurbs/internals/nurbstess.cc @@ -505,7 +505,7 @@ NurbsTessellator::do_pwlcurve( O_pwlcurve *o_pwlcurve ) o_pwlcurve->owner = currentCurve; } - if( (inCurve == 2) ) + if( inCurve == 2 ) endcurve(); } diff --git a/mesalib/src/mesa/main/blend.c b/mesalib/src/mesa/main/blend.c index bc446edca..5bc40a028 100644 --- a/mesalib/src/mesa/main/blend.c +++ b/mesalib/src/mesa/main/blend.c @@ -166,6 +166,24 @@ _mesa_BlendFunc( GLenum sfactor, GLenum dfactor ) _mesa_BlendFuncSeparateEXT(sfactor, dfactor, sfactor, dfactor); } +static GLboolean +blend_factor_is_dual_src(GLenum factor) +{ + return (factor == GL_SRC1_COLOR || + factor == GL_SRC1_ALPHA || + factor == GL_ONE_MINUS_SRC1_COLOR || + factor == GL_ONE_MINUS_SRC1_ALPHA); +} + +static void +update_uses_dual_src(struct gl_context *ctx, int buf) +{ + ctx->Color.Blend[buf]._UsesDualSrc = + (blend_factor_is_dual_src(ctx->Color.Blend[buf].SrcRGB) || + blend_factor_is_dual_src(ctx->Color.Blend[buf].DstRGB) || + blend_factor_is_dual_src(ctx->Color.Blend[buf].SrcA) || + blend_factor_is_dual_src(ctx->Color.Blend[buf].DstA)); +} /** * Set the separate blend source/dest factors for all draw buffers. @@ -220,6 +238,7 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, ctx->Color.Blend[buf].DstRGB = dfactorRGB; ctx->Color.Blend[buf].SrcA = sfactorA; ctx->Color.Blend[buf].DstA = dfactorA; + update_uses_dual_src(ctx, buf); } ctx->Color._BlendFuncPerBuffer = GL_FALSE; @@ -282,6 +301,7 @@ _mesa_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB, ctx->Color.Blend[buf].DstRGB = dfactorRGB; ctx->Color.Blend[buf].SrcA = sfactorA; ctx->Color.Blend[buf].DstA = dfactorA; + update_uses_dual_src(ctx, buf); ctx->Color._BlendFuncPerBuffer = GL_TRUE; if (ctx->Driver.BlendFuncSeparatei) { diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index df0452cd1..3bcedecd9 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -1703,13 +1703,6 @@ _mesa_set_mvp_with_dp4( struct gl_context *ctx, ctx->mvp_with_dp4 = flag; } -static GLboolean -blend_factor_is_dual_src(GLenum factor) -{ - return factor == GL_SRC1_COLOR || factor == GL_SRC1_ALPHA || - factor == GL_ONE_MINUS_SRC1_COLOR || factor == GL_ONE_MINUS_SRC1_ALPHA; -} - /* * ARB_blend_func_extended - ERRORS section * "The error INVALID_OPERATION is generated by Begin or any procedure that @@ -1722,16 +1715,13 @@ static GLboolean _mesa_check_blend_func_error(struct gl_context *ctx) { GLuint i; - for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) { - if (blend_factor_is_dual_src(ctx->Color.Blend[i].SrcRGB) || - blend_factor_is_dual_src(ctx->Color.Blend[i].DstRGB) || - blend_factor_is_dual_src(ctx->Color.Blend[i].SrcA) || - blend_factor_is_dual_src(ctx->Color.Blend[i].DstA)) { - if (i >= ctx->Const.MaxDualSourceDrawBuffers) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "dual source blend on illegal attachment"); - return GL_FALSE; - } + for (i = ctx->Const.MaxDualSourceDrawBuffers; + i < ctx->DrawBuffer->_NumColorDrawBuffers; + i++) { + if (ctx->Color.Blend[i]._UsesDualSrc) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "dual source blend on illegal attachment"); + return GL_FALSE; } } return GL_TRUE; diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index a843a4092..cd76eeb3d 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -228,7 +228,7 @@ static const struct extension extension_table[] = { { "GL_OES_depth32", o(dummy_false), DISABLE, 2005 }, { "GL_OES_depth_texture", o(ARB_depth_texture), ES2, 2006 }, #if FEATURE_OES_draw_texture - { "GL_OES_draw_texture", o(OES_draw_texture), ES1 | ES2, 2004 }, + { "GL_OES_draw_texture", o(OES_draw_texture), ES1, 2004 }, #endif #if FEATURE_OES_EGL_image /* FIXME: Mesa expects GL_OES_EGL_image to be available in OpenGL contexts. */ diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp index 8a42281db..0233f3802 100644 --- a/mesalib/src/mesa/main/ff_fragment_shader.cpp +++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp @@ -1007,6 +1007,15 @@ static void load_texture( struct texenv_fragment_program *p, GLuint unit ) sampler_name, ir_var_uniform); p->top_instructions->push_head(sampler); + + /* Set the texture unit for this sampler. The linker will pick this value + * up and do-the-right-thing. + * + * NOTE: The cast to int is important. Without it, the constant will have + * type uint, and things later on may get confused. + */ + sampler->constant_value = new(p->mem_ctx) ir_constant(int(unit)); + deref = new(p->mem_ctx) ir_dereference_variable(sampler); tex->set_sampler(deref, glsl_type::vec4_type); @@ -1350,38 +1359,6 @@ create_new_program(struct gl_context *ctx, struct state_key *key) _mesa_associate_uniform_storage(ctx, p.shader_program, fp->Parameters); - for (unsigned int i = 0; i < MAX_TEXTURE_UNITS; i++) { - /* Enough space for 'sampler_999\0'. - */ - char name[12]; - - snprintf(name, sizeof(name), "sampler_%d", i); - - int loc = _mesa_get_uniform_location(ctx, p.shader_program, name); - if (loc != -1) { - unsigned base; - unsigned idx; - - /* Avoid using _mesa_uniform() because it flags state - * updates, so if we're generating this shader_program in a - * state update, we end up recursing. Instead, just set the - * value, which is picked up at re-link. - */ - _mesa_uniform_split_location_offset(loc, &base, &idx); - assert(idx == 0); - - struct gl_uniform_storage *const storage = - &p.shader_program->UniformStorage[base]; - - /* Update the storage, the SamplerUnits in the shader program, and - * the SamplerUnits in the assembly shader. - */ - storage->storage[idx].i = i; - fp->SamplerUnits[storage->sampler] = i; - p.shader_program->SamplerUnits[storage->sampler] = i; - _mesa_propagate_uniforms_to_driver_storage(storage, 0, 1); - } - } _mesa_update_shader_textures_used(p.shader_program, fp); (void) ctx->Driver.ProgramStringNotify(ctx, fp->Target, fp); diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index eefe5e7e9..3a8cac9c5 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -755,6 +755,11 @@ struct gl_colorbuffer_attrib GLenum DstA; /**< Alpha blend dest term */ GLenum EquationRGB; /**< GL_ADD, GL_SUBTRACT, etc. */ GLenum EquationA; /**< GL_ADD, GL_SUBTRACT, etc. */ + /** + * Set if any blend factor uses SRC1. Computed at the time blend factors + * get set. + */ + GLboolean _UsesDualSrc; } Blend[MAX_DRAW_BUFFERS]; /** Are the blend func terms currently different for each buffer/target? */ GLboolean _BlendFuncPerBuffer; diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c index be1e1728d..e6604b1a4 100644 --- a/mesalib/src/mesa/main/uniforms.c +++ b/mesalib/src/mesa/main/uniforms.c @@ -65,6 +65,7 @@ _mesa_update_shader_textures_used(struct gl_shader_program *shProg, { GLuint s; + memcpy(prog->SamplerUnits, shProg->SamplerUnits, sizeof(prog->SamplerUnits)); memset(prog->TexturesUsed, 0, sizeof(prog->TexturesUsed)); for (s = 0; s < MAX_SAMPLERS; s++) { diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 840648e04..c021c6956 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -2526,109 +2526,18 @@ _mesa_associate_uniform_storage(struct gl_context *ctx, 4 * sizeof(float), format, ¶ms->ParameterValues[i]); - last_location = location; - } - } -} - -static void -set_uniform_initializer(struct gl_context *ctx, void *mem_ctx, - struct gl_shader_program *shader_program, - const char *name, const glsl_type *type, - ir_constant *val) -{ - if (type->is_record()) { - ir_constant *field_constant; - - field_constant = (ir_constant *)val->components.get_head(); - - for (unsigned int i = 0; i < type->length; i++) { - const glsl_type *field_type = type->fields.structure[i].type; - const char *field_name = ralloc_asprintf(mem_ctx, "%s.%s", name, - type->fields.structure[i].name); - set_uniform_initializer(ctx, mem_ctx, shader_program, field_name, - field_type, field_constant); - field_constant = (ir_constant *)field_constant->next; - } - return; - } - - int loc = _mesa_get_uniform_location(ctx, shader_program, name); - if (loc == -1) { - linker_error(shader_program, - "Couldn't find uniform for initializer %s\n", name); - return; - } - - for (unsigned int i = 0; i < (type->is_array() ? type->length : 1); i++) { - ir_constant *element; - const glsl_type *element_type; - if (type->is_array()) { - element = val->array_elements[i]; - element_type = type->fields.array; - } else { - element = val; - element_type = type; - } - - void *values; - - if (element_type->base_type == GLSL_TYPE_BOOL) { - int *conv = ralloc_array(mem_ctx, int, element_type->components()); - for (unsigned int j = 0; j < element_type->components(); j++) { - conv[j] = element->value.b[j]; - } - values = (void *)conv; - element_type = glsl_type::get_instance(GLSL_TYPE_INT, - element_type->vector_elements, - 1); - } else { - values = &element->value; - } - - if (element_type->is_matrix()) { - _mesa_uniform_matrix(ctx, shader_program, - element_type->matrix_columns, - element_type->vector_elements, - loc, 1, GL_FALSE, (GLfloat *)values); - } else { - _mesa_uniform(ctx, shader_program, loc, element_type->matrix_columns, - values, element_type->gl_type); - } - - loc++; - } -} - -static void -set_uniform_initializers(struct gl_context *ctx, - struct gl_shader_program *shader_program) -{ - void *mem_ctx = NULL; - - for (unsigned int i = 0; i < MESA_SHADER_TYPES; i++) { - struct gl_shader *shader = shader_program->_LinkedShaders[i]; - - if (shader == NULL) - continue; - - foreach_iter(exec_list_iterator, iter, *shader->ir) { - ir_instruction *ir = (ir_instruction *)iter.get(); - ir_variable *var = ir->as_variable(); - - if (!var || var->mode != ir_var_uniform || !var->constant_value) - continue; - - if (!mem_ctx) - mem_ctx = ralloc_context(NULL); + /* After attaching the driver's storage to the uniform, propagate any + * data from the linker's backing store. This will cause values from + * initializers in the source code to be copied over. + */ + _mesa_propagate_uniforms_to_driver_storage(storage, + 0, + MAX2(1, storage->array_elements)); - set_uniform_initializer(ctx, mem_ctx, shader_program, var->name, - var->type, var->constant_value); + last_location = location; } } - - ralloc_free(mem_ctx); } /* @@ -3240,10 +3149,6 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) } } - if (prog->LinkStatus) { - set_uniform_initializers(ctx, prog); - } - if (ctx->Shader.Flags & GLSL_DUMP) { if (!prog->LinkStatus) { printf("GLSL shader program %d failed to link\n", prog->Name); diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c index f9c190a68..b24f9a1ce 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texture.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c @@ -400,6 +400,8 @@ guess_and_alloc_texture(struct st_context *st, ptLayers, bindings); + stObj->lastLevel = lastLevel; + DBG("%s returning %d\n", __FUNCTION__, (stObj->pt != NULL)); return stObj->pt != NULL; diff --git a/pixman/pixman/pixman-mips-dspr2-asm.S b/pixman/pixman/pixman-mips-dspr2-asm.S index 68ad33f7c..87558f032 100644 --- a/pixman/pixman/pixman-mips-dspr2-asm.S +++ b/pixman/pixman/pixman-mips-dspr2-asm.S @@ -317,7 +317,7 @@ LEAF_MIPS_DSPR2(pixman_composite_over_n_8888_8888_ca_asm_mips) * a3 - w */ - SAVE_REGS_ON_STACK 16, s0, s1, s2, s3, s4, s5, s6, s7 + SAVE_REGS_ON_STACK 8, s0, s1, s2, s3, s4, s5 beqz a3, 4f nop li t6, 0xff @@ -337,23 +337,21 @@ LEAF_MIPS_DSPR2(pixman_composite_over_n_8888_8888_ca_asm_mips) beqz t2, 12f /* if (t0 == 0) && (t1 == 0) */ addiu a2, a2, 8 and t3, t0, t1 - move s0, t8 /* s0 = srca */ - move s1, t8 /* s1 = srca */ move t4, a1 /* t4 = src */ move t5, a1 /* t5 = src */ lw t2, 0(a0) /* t2 = dst */ beq t3, t7, 11f /* if (t0 == 0xffffffff) && (t1 == 0xffffffff) */ - lw t3, 4(a0) /* t0 = dst */ + lw t3, 4(a0) /* t3 = dst */ MIPS_2xUN8x4_MUL_2xUN8x4 a1, a1, t0, t1, t4, t5, t9, s0, s1, s2, s3, s4, s5 - MIPS_2xUN8x4_MUL_2xUN8 t0, t1, t8, t8, s0, s1, t9, s2, s3, s4, s5, s6, s7 + MIPS_2xUN8x4_MUL_2xUN8 t0, t1, t8, t8, t0, t1, t9, s0, s1, s2, s3, s4, s5 11: - not s0, s0 - not s1, s1 - MIPS_2xUN8x4_MUL_2xUN8x4 t2, t3, s0, s1, s2, s3, t9, t0, t1, s4, s5, s6, s7 - addu_s.qb t0, t4, s2 - addu_s.qb t1, t5, s3 - sw t0, 0(a0) - sw t1, 4(a0) + not t0, t0 + not t1, t1 + MIPS_2xUN8x4_MUL_2xUN8x4 t2, t3, t0, t1, t2, t3, t9, s0, s1, s2, s3, s4, s5 + addu_s.qb t2, t4, t2 + addu_s.qb t3, t5, t3 + sw t2, 0(a0) + sw t3, 4(a0) 12: addiu a3, a3, -2 addiu t1, a3, -1 @@ -369,20 +367,20 @@ LEAF_MIPS_DSPR2(pixman_composite_over_n_8888_8888_ca_asm_mips) beqz t2, 22f /* if (t0 == 0) & (t1 == 0) */ addiu a2, a2, 8 and t2, t0, t1 - move s0, a1 + move t4, a1 beq t2, t7, 21f /* if (t0 == 0xffffffff) && (t1 == 0xffffffff) */ - move s1, a1 + move t5, a1 lw t2, 0(a0) /* t2 = dst */ lw t3, 4(a0) /* t3 = dst */ MIPS_2xUN8x4_MUL_2xUN8x4 a1, a1, t0, t1, t4, t5, t9, s0, s1, s2, s3, s4, s5 not t0, t0 not t1, t1 - MIPS_2xUN8x4_MUL_2xUN8x4 t2, t3, t0, t1, s0, s1, t9, s2, s3, s4, s5, s6, s7 - addu_s.qb s0, t4, s0 - addu_s.qb s1, t5, s1 + MIPS_2xUN8x4_MUL_2xUN8x4 t2, t3, t0, t1, t2, t3, t9, s0, s1, s2, s3, s4, s5 + addu_s.qb t4, t4, t2 + addu_s.qb t5, t5, t3 21: - sw s0, 0(a0) - sw s1, 4(a0) + sw t4, 0(a0) + sw t5, 4(a0) 22: addiu a3, a3, -2 addiu t1, a3, -1 @@ -395,20 +393,19 @@ LEAF_MIPS_DSPR2(pixman_composite_over_n_8888_8888_ca_asm_mips) lw t1, 0(a2) /* t1 = mask */ beqz t1, 4f nop - move s0, t8 /* s0 = srca */ move t2, a1 /* t2 = src */ beq t1, t7, 31f lw t0, 0(a0) /* t0 = dst */ MIPS_UN8x4_MUL_UN8x4 a1, t1, t2, t9, t3, t4, t5, t6 - MIPS_UN8x4_MUL_UN8 t1, t8, s0, t9, t3, t4, t5 + MIPS_UN8x4_MUL_UN8 t1, t8, t1, t9, t3, t4, t5 31: - not s0, s0 - MIPS_UN8x4_MUL_UN8x4 t0, s0, t3, t9, t4, t5, t6, t1 - addu_s.qb t0, t2, t3 + not t1, t1 + MIPS_UN8x4_MUL_UN8x4 t0, t1, t0, t9, t3, t4, t5, t6 + addu_s.qb t0, t2, t0 sw t0, 0(a0) 4: - RESTORE_REGS_FROM_STACK 16, s0, s1, s2, s3, s4, s5, s6, s7 + RESTORE_REGS_FROM_STACK 8, s0, s1, s2, s3, s4, s5 j ra nop @@ -447,8 +444,8 @@ LEAF_MIPS_DSPR2(pixman_composite_over_n_8888_0565_ca_asm_mips) beqz t2, 12f /* if (t0 == 0) && (t1 == 0) */ addiu a2, a2, 8 and t3, t0, t1 - move t0, t8 - move t1, a1 + move s2, a1 /* s2 = src */ + move s3, a1 /* s3 = src */ lhu t2, 0(a0) /* t2 = dst */ beq t3, s1, 11f /* if (t0 == 0xffffffff) && (t1 == 0xffffffff) */ lhu t3, 2(a0) /* t3 = dst */ @@ -461,7 +458,7 @@ LEAF_MIPS_DSPR2(pixman_composite_over_n_8888_0565_ca_asm_mips) MIPS_2xUN8x4_MUL_2xUN8x4 s4, s5, t0, t1, s4, s5, t9, t4, s6, s7, s8, t0, t1 addu_s.qb s2, s2, s4 addu_s.qb s3, s3, s5 - CONVERT_2x8888_TO_2x0565 s2, s3, t2, t3, t5, t6, t7, s1, s2 + CONVERT_2x8888_TO_2x0565 s2, s3, t2, t3, t5, t6, t7, s4, s5 sh t2, 0(a0) sh t3, 2(a0) 12: @@ -507,17 +504,16 @@ LEAF_MIPS_DSPR2(pixman_composite_over_n_8888_0565_ca_asm_mips) lw t1, 0(a2) /* t1 = mask */ beqz t1, 4f nop - move s0, t8 /* s0 = srca */ move t2, a1 /* t2 = src */ beq t1, t7, 31f lhu t0, 0(a0) /* t0 = dst */ MIPS_UN8x4_MUL_UN8x4 a1, t1, t2, t9, t3, t4, t5, t6 - MIPS_UN8x4_MUL_UN8 t1, t8, s0, t9, t3, t4, t5 + MIPS_UN8x4_MUL_UN8 t1, t8, t1, t9, t3, t4, t5 31: - not s0, s0 + not t1, t1 CONVERT_1x0565_TO_1x8888 t0, s1, s2, s3 - MIPS_UN8x4_MUL_UN8x4 s1, s0, t3, t9, t4, t5, t6, t1 + MIPS_UN8x4_MUL_UN8x4 s1, t1, t3, t9, t4, t5, t6, t7 addu_s.qb t0, t2, t3 CONVERT_1x8888_TO_1x0565 t0, s1, s2, s3 sh s1, 0(a0) @@ -751,3 +747,66 @@ LEAF_MIPS_DSPR2(pixman_composite_over_n_8_0565_asm_mips) nop END(pixman_composite_over_n_8_0565_asm_mips) + +LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_8888_8_8888_OVER_asm_mips) +/* + * a0 - dst (a8r8g8b8) + * a1 - mask (a8) + * a2 - src_top (a8r8g8b8) + * a3 - src_bottom (a8r8g8b8) + * 16(sp) - wt + * 20(sp) - wb + * 24(sp) - vx + * 28(sp) - unit_x + * 32(sp) - w + */ + + SAVE_REGS_ON_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8 + + lw v1, 60(sp) /* v1 = w(sp + 32 + 28 save regs stack offset)*/ + beqz v1, 1f + nop + + lw s0, 44(sp) /* s0 = wt */ + lw s1, 48(sp) /* s1 = wb */ + lw s2, 52(sp) /* s2 = vx */ + lw s3, 56(sp) /* s3 = unit_x */ + li v0, 256 + li s8, 0x00ff00ff +0: + andi t4, s2, 0xffff /* t4 = (short)vx */ + srl t4, t4, 8 /* t4 = vx >> 8 */ + subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */ + + mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */ + mul s5, s0, t4 /* s5 = wt*(vx>>8) */ + mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */ + mul s7, s1, t4 /* s7 = wb*(vx>>8) */ + + sra t9, s2, 16 + sll t9, t9, 2 + addiu t8, t9, 4 + lwx t0, t9(a2) /* t0 = tl */ + lwx t1, t8(a2) /* t1 = tr */ + addiu v1, v1, -1 + lwx t2, t9(a3) /* t2 = bl */ + lwx t3, t8(a3) /* t3 = br */ + + BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, \ + t4, t5, t6, t7, t8, t9, s4, s5, s6, s7 + lbu t1, 0(a1) /* t1 = mask */ + lw t2, 0(a0) /* t2 = dst */ + addiu a1, a1, 1 + OVER_8888_8_8888 t0, t1, t2, t0, s8, t3, t4, t5, t6 + + addu s2, s2, s3 /* vx += unit_x; */ + sw t0, 0(a0) + bnez v1, 0b + addiu a0, a0, 4 + +1: + RESTORE_REGS_FROM_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8 + j ra + nop + +END(pixman_scaled_bilinear_scanline_8888_8_8888_OVER_asm_mips) diff --git a/pixman/pixman/pixman-mips-dspr2-asm.h b/pixman/pixman/pixman-mips-dspr2-asm.h index 838306043..7cf3281ed 100644 --- a/pixman/pixman/pixman-mips-dspr2-asm.h +++ b/pixman/pixman/pixman-mips-dspr2-asm.h @@ -566,4 +566,60 @@ LEAF_MIPS32R2(symbol) \ addu_s.qb \out2_8888, \d2_8888, \scratch2 .endm +.macro BILINEAR_INTERPOLATE_SINGLE_PIXEL tl, tr, bl, br, \ + scratch1, scratch2, \ + alpha, red, green, blue \ + wt1, wt2, wb1, wb2 + andi \scratch1, \tl, 0xff + andi \scratch2, \tr, 0xff + andi \alpha, \bl, 0xff + andi \red, \br, 0xff + + multu $ac0, \wt1, \scratch1 + maddu $ac0, \wt2, \scratch2 + maddu $ac0, \wb1, \alpha + maddu $ac0, \wb2, \red + + ext \scratch1, \tl, 8, 8 + ext \scratch2, \tr, 8, 8 + ext \alpha, \bl, 8, 8 + ext \red, \br, 8, 8 + + multu $ac1, \wt1, \scratch1 + maddu $ac1, \wt2, \scratch2 + maddu $ac1, \wb1, \alpha + maddu $ac1, \wb2, \red + + ext \scratch1, \tl, 16, 8 + ext \scratch2, \tr, 16, 8 + ext \alpha, \bl, 16, 8 + ext \red, \br, 16, 8 + + mflo \blue, $ac0 + + multu $ac2, \wt1, \scratch1 + maddu $ac2, \wt2, \scratch2 + maddu $ac2, \wb1, \alpha + maddu $ac2, \wb2, \red + + ext \scratch1, \tl, 24, 8 + ext \scratch2, \tr, 24, 8 + ext \alpha, \bl, 24, 8 + ext \red, \br, 24, 8 + + mflo \green, $ac1 + + multu $ac3, \wt1, \scratch1 + maddu $ac3, \wt2, \scratch2 + maddu $ac3, \wb1, \alpha + maddu $ac3, \wb2, \red + + mflo \red, $ac2 + mflo \alpha, $ac3 + + precr.qb.ph \alpha, \alpha, \red + precr.qb.ph \scratch1, \green, \blue + precrq.qb.ph \tl, \alpha, \scratch1 +.endm + #endif //PIXMAN_MIPS_DSPR2_ASM_H diff --git a/pixman/pixman/pixman-mips-dspr2.c b/pixman/pixman/pixman-mips-dspr2.c index 7081734c0..06d4335dd 100644 --- a/pixman/pixman/pixman-mips-dspr2.c +++ b/pixman/pixman/pixman-mips-dspr2.c @@ -58,6 +58,9 @@ PIXMAN_MIPS_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, over_n_8_8888, PIXMAN_MIPS_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, over_n_8_0565, uint8_t, 1, uint16_t, 1) +PIXMAN_MIPS_BIND_SCALED_BILINEAR_SRC_A8_DST (SKIP_ZERO_SRC, 8888_8_8888, OVER, + uint32_t, uint32_t) + static pixman_bool_t pixman_fill_mips (uint32_t *bits, int stride, @@ -206,6 +209,9 @@ static const pixman_fast_path_t mips_dspr2_fast_paths[] = PIXMAN_STD_FAST_PATH (OVER, solid, a8, r5g6b5, mips_composite_over_n_8_0565), PIXMAN_STD_FAST_PATH (OVER, solid, a8, b5g6r5, mips_composite_over_n_8_0565), + SIMPLE_BILINEAR_A8_MASK_FAST_PATH (OVER, a8r8g8b8, a8r8g8b8, mips_8888_8_8888), + SIMPLE_BILINEAR_A8_MASK_FAST_PATH (OVER, a8r8g8b8, x8r8g8b8, mips_8888_8_8888), + { PIXMAN_OP_NONE }, }; diff --git a/pixman/pixman/pixman-mips-dspr2.h b/pixman/pixman/pixman-mips-dspr2.h index cc35d02ed..5036938c1 100644 --- a/pixman/pixman/pixman-mips-dspr2.h +++ b/pixman/pixman/pixman-mips-dspr2.h @@ -127,4 +127,56 @@ mips_composite_##name (pixman_implementation_t *imp, \ } \ } +/*****************************************************************************/ + +#define PIXMAN_MIPS_BIND_SCALED_BILINEAR_SRC_A8_DST(flags, name, op, \ + src_type, dst_type) \ +void \ +pixman_scaled_bilinear_scanline_##name##_##op##_asm_mips ( \ + dst_type * dst, \ + const uint8_t * mask, \ + const src_type * top, \ + const src_type * bottom, \ + int wt, \ + int wb, \ + pixman_fixed_t x, \ + pixman_fixed_t ux, \ + int width); \ + \ +static force_inline void \ +scaled_bilinear_scanline_mips_##name##_##op (dst_type * dst, \ + const uint8_t * mask, \ + const src_type * src_top, \ + const src_type * src_bottom, \ + int32_t w, \ + int wt, \ + int wb, \ + pixman_fixed_t vx, \ + pixman_fixed_t unit_x, \ + pixman_fixed_t max_vx, \ + pixman_bool_t zero_src) \ +{ \ + if ((flags & SKIP_ZERO_SRC) && zero_src) \ + return; \ + pixman_scaled_bilinear_scanline_##name##_##op##_asm_mips ( \ + dst, mask, src_top, src_bottom, wt, wb, vx, unit_x, w); \ +} \ + \ +FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_cover_##op, \ + scaled_bilinear_scanline_mips_##name##_##op, \ + src_type, uint8_t, dst_type, COVER, \ + FLAG_HAVE_NON_SOLID_MASK) \ +FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_none_##op, \ + scaled_bilinear_scanline_mips_##name##_##op, \ + src_type, uint8_t, dst_type, NONE, \ + FLAG_HAVE_NON_SOLID_MASK) \ +FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_pad_##op, \ + scaled_bilinear_scanline_mips_##name##_##op, \ + src_type, uint8_t, dst_type, PAD, \ + FLAG_HAVE_NON_SOLID_MASK) \ +FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_normal_##op, \ + scaled_bilinear_scanline_mips_##name##_##op, \ + src_type, uint8_t, dst_type, NORMAL, \ + FLAG_HAVE_NON_SOLID_MASK) + #endif //PIXMAN_MIPS_DSPR2_H diff --git a/xorg-server/config/config-backends.h b/xorg-server/config/config-backends.h index e5622d51e..62abc0a5f 100644 --- a/xorg-server/config/config-backends.h +++ b/xorg-server/config/config-backends.h @@ -33,6 +33,7 @@ void remove_devices(const char *backend, const char *config_info); BOOL device_is_duplicate(const char *config_info); #ifdef CONFIG_UDEV +int config_udev_pre_init(void); int config_udev_init(void); void config_udev_fini(void); #else diff --git a/xorg-server/config/config.c b/xorg-server/config/config.c index 2b96dbb74..24e7ba7a0 100644 --- a/xorg-server/config/config.c +++ b/xorg-server/config/config.c @@ -33,6 +33,15 @@ #include "config-backends.h" void +config_pre_init(void) +{ +#ifdef CONFIG_UDEV + if (!config_udev_pre_init()) + ErrorF("[config] failed to pre-init udev\n"); +#endif +} + +void config_init(void) { #ifdef CONFIG_UDEV diff --git a/xorg-server/config/udev.c b/xorg-server/config/udev.c index 8b3ca0475..1995184f3 100644 --- a/xorg-server/config/udev.c +++ b/xorg-server/config/udev.c @@ -281,15 +281,14 @@ block_handler(pointer data, struct timeval **tv, pointer read_mask) } int -config_udev_init(void) +config_udev_pre_init(void) { struct udev *udev; - struct udev_enumerate *enumerate; - struct udev_list_entry *devices, *device; udev = udev_new(); if (!udev) return 0; + udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); if (!udev_monitor) return 0; @@ -302,12 +301,21 @@ config_udev_init(void) if (SeatId && strcmp(SeatId, "seat0")) udev_monitor_filter_add_match_tag(udev_monitor, SeatId); #endif - if (udev_monitor_enable_receiving(udev_monitor)) { ErrorF("config/udev: failed to bind the udev monitor\n"); return 0; } + return 1; +} +int +config_udev_init(void) +{ + struct udev *udev; + struct udev_enumerate *enumerate; + struct udev_list_entry *devices, *device; + + udev = udev_monitor_get_udev(udev_monitor); enumerate = udev_enumerate_new(udev); if (!enumerate) return 0; diff --git a/xorg-server/exa/exa_glyphs.c b/xorg-server/exa/exa_glyphs.c index 2538bce01..71f750fb6 100644 --- a/xorg-server/exa/exa_glyphs.c +++ b/xorg-server/exa/exa_glyphs.c @@ -365,7 +365,7 @@ exaGlyphCacheUploadGlyph(ScreenPtr pScreen, ExaGlyphCachePtr cache, int x, int y, GlyphPtr pGlyph) { ExaScreenPriv(pScreen); - PicturePtr pGlyphPicture = GlyphPicture(pGlyph)[pScreen->myNum]; + PicturePtr pGlyphPicture = GetGlyphPicture(pGlyph, pScreen); PixmapPtr pGlyphPixmap = (PixmapPtr) pGlyphPicture->pDrawable; ExaPixmapPriv(pGlyphPixmap); @@ -544,7 +544,7 @@ exaBufferGlyph(ScreenPtr pScreen, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst) { ExaScreenPriv(pScreen); - unsigned int format = (GlyphPicture(pGlyph)[pScreen->myNum])->format; + unsigned int format = (GetGlyphPicture(pGlyph, pScreen))->format; int width = pGlyph->info.width; int height = pGlyph->info.height; ExaCompositeRectPtr rect; @@ -586,7 +586,7 @@ exaBufferGlyph(ScreenPtr pScreen, /* Couldn't find the glyph in the cache, use the glyph picture directly */ - mask = GlyphPicture(pGlyph)[pScreen->myNum]; + mask = GetGlyphPicture(pGlyph, pScreen); if (buffer->mask && buffer->mask != mask) return ExaGlyphNeedFlush; diff --git a/xorg-server/glx/glxdri.c b/xorg-server/glx/glxdri.c index 9b8b66f0c..b2209c551 100644 --- a/xorg-server/glx/glxdri.c +++ b/xorg-server/glx/glxdri.c @@ -961,7 +961,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) __GLXDRIscreen *screen; Bool isCapable; size_t buffer_size; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable") || !DRIQueryDirectRenderingCapable(pScreen, &isCapable) || !isCapable) { diff --git a/xorg-server/glx/glxdri2.c b/xorg-server/glx/glxdri2.c index aa38295fa..cceb12697 100644 --- a/xorg-server/glx/glxdri2.c +++ b/xorg-server/glx/glxdri2.c @@ -686,7 +686,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) const char *driverName, *deviceName; __GLXDRIscreen *screen; size_t buffer_size; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); screen = calloc(1, sizeof *screen); if (screen == NULL) diff --git a/xorg-server/hw/xfree86/common/xf86.h b/xorg-server/hw/xfree86/common/xf86.h index fc4c34e92..0eb000d41 100644 --- a/xorg-server/hw/xfree86/common/xf86.h +++ b/xorg-server/hw/xfree86/common/xf86.h @@ -76,8 +76,8 @@ extern _X_EXPORT Bool xf86DRI2Enabled(void); extern _X_EXPORT Bool VTSwitchEnabled; /* kbd driver */ -#define XF86SCRNINFO(p) ((ScrnInfoPtr)dixLookupPrivate(&(p)->devPrivates, \ - xf86ScreenKey)) +#define XF86SCRNINFO(p) xf86ScreenToScrn(p) + #define XF86FLIP_PIXELS() \ do { \ if (xf86GetFlipPixels()) { \ @@ -97,12 +97,12 @@ extern _X_EXPORT Bool VTSwitchEnabled; /* kbd driver */ /* PCI related */ #ifdef XSERVER_LIBPCIACCESS #include <pciaccess.h> -extern _X_EXPORT Bool pciSlotClaimed; +extern _X_EXPORT int pciSlotClaimed; extern _X_EXPORT Bool xf86CheckPciSlot(const struct pci_device *); extern _X_EXPORT int xf86ClaimPciSlot(struct pci_device *, DriverPtr drvp, int chipset, GDevPtr dev, Bool active); -extern _X_EXPORT void xf86UnclaimPciSlot(struct pci_device *); +extern _X_EXPORT void xf86UnclaimPciSlot(struct pci_device *, GDevPtr dev); extern _X_EXPORT Bool xf86ParsePciBusString(const char *busID, int *bus, int *device, int *func); extern _X_EXPORT Bool xf86ComparePciBusString(const char *busID, int bus, @@ -449,6 +449,13 @@ xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen, extern _X_EXPORT Bool VidModeExtensionInit(ScreenPtr pScreen); +/* convert ScreenPtr to ScrnInfoPtr */ +extern _X_EXPORT ScrnInfoPtr xf86ScreenToScrn(ScreenPtr pScreen); +/* convert ScrnInfoPtr to ScreenPtr */ +extern _X_EXPORT ScreenPtr xf86ScrnToScreen(ScrnInfoPtr pScrn); + #endif /* _NO_XF86_PROTOTYPES */ +#define XF86_HAS_SCRN_CONV 1 /* define for drivers to use in api compat */ + #endif /* _XF86_H */ diff --git a/xorg-server/hw/xfree86/common/xf86AutoConfig.c b/xorg-server/hw/xfree86/common/xf86AutoConfig.c index 43c746b7f..d0eb0affb 100644 --- a/xorg-server/hw/xfree86/common/xf86AutoConfig.c +++ b/xorg-server/hw/xfree86/common/xf86AutoConfig.c @@ -270,6 +270,10 @@ listPossibleVideoDrivers(char *matches[], int nmatches) #endif } +#if defined(__linux__) + matches[i++] = xnfstrdup("modesetting"); +#endif + #if !defined(sun) /* Fallback to platform default frame buffer driver */ if (i < (nmatches - 1)) { diff --git a/xorg-server/hw/xfree86/common/xf86Bus.c b/xorg-server/hw/xfree86/common/xf86Bus.c index b176e8cc4..b8764344b 100644 --- a/xorg-server/hw/xfree86/common/xf86Bus.c +++ b/xorg-server/hw/xfree86/common/xf86Bus.c @@ -420,6 +420,26 @@ xf86AddDevToEntity(int entityIndex, GDevPtr dev) dev->claimed = TRUE; } + +void +xf86RemoveDevFromEntity(int entityIndex, GDevPtr dev) +{ + EntityPtr pEnt; + int i, j; + if (entityIndex >= xf86NumEntities) + return; + + pEnt = xf86Entities[entityIndex]; + for (i = 0; i < pEnt->numInstances; i++) { + if (pEnt->devices[i] == dev) { + for (j = i; j < pEnt->numInstances - 1; j++) + pEnt->devices[j] = pEnt->devices[j + 1]; + break; + } + } + pEnt->numInstances--; + dev->claimed = FALSE; +} /* * xf86GetEntityInfo() -- This function hands information from the * EntityRec struct to the drivers. The EntityRec structure itself diff --git a/xorg-server/hw/xfree86/common/xf86Cursor.c b/xorg-server/hw/xfree86/common/xf86Cursor.c index 3716434f0..61cae6aa7 100644 --- a/xorg-server/hw/xfree86/common/xf86Cursor.c +++ b/xorg-server/hw/xfree86/common/xf86Cursor.c @@ -133,7 +133,7 @@ xf86InitViewport(ScrnInfoPtr pScr) void xf86SetViewport(ScreenPtr pScreen, int x, int y) { - ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); + ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen); (*pScr->PointerMoved) (pScreen->myNum, x, y); } @@ -184,7 +184,8 @@ xf86PointerMoved(int scrnIndex, int x, int y) void xf86LockZoom(ScreenPtr pScreen, Bool lock) { - XF86SCRNINFO(pScreen)->zoomLocked = lock; + ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen); + pScr->zoomLocked = lock; } /* @@ -196,7 +197,7 @@ xf86LockZoom(ScreenPtr pScreen, Bool lock) Bool xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) { - ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); + ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen); ScreenPtr pCursorScreen; Bool Switched; int px, py, was_blocked; @@ -316,7 +317,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) void xf86ZoomViewport(ScreenPtr pScreen, int zoom) { - ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); + ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen); DisplayModePtr mode; if (pScr->zoomLocked || !(mode = pScr->currentMode)) diff --git a/xorg-server/hw/xfree86/common/xf86DGA.c b/xorg-server/hw/xfree86/common/xf86DGA.c index 316978cfa..e0314d86e 100644 --- a/xorg-server/hw/xfree86/common/xf86DGA.c +++ b/xorg-server/hw/xfree86/common/xf86DGA.c @@ -100,7 +100,7 @@ typedef struct { Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes, int num) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); DGAScreenPtr pScreenPriv; int i; diff --git a/xorg-server/hw/xfree86/common/xf86DPMS.c b/xorg-server/hw/xfree86/common/xf86DPMS.c index 75f034239..54ad84243 100644 --- a/xorg-server/hw/xfree86/common/xf86DPMS.c +++ b/xorg-server/hw/xfree86/common/xf86DPMS.c @@ -57,7 +57,7 @@ Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags) { #ifdef DPMSExtension - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); DPMSPtr pDPMS; pointer DPMSOpt; MessageType enabled_from; diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c index 8c948cf6f..fb56a0b17 100644 --- a/xorg-server/hw/xfree86/common/xf86Helper.c +++ b/xorg-server/hw/xfree86/common/xf86Helper.c @@ -1577,7 +1577,7 @@ xf86SetBackingStore(ScreenPtr pScreen) { Bool useBS = FALSE; MessageType from = X_DEFAULT; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); OptionInfoPtr options; options = xnfalloc(sizeof(BSOptions)); @@ -1618,7 +1618,7 @@ xf86SetSilkenMouse(ScreenPtr pScreen) { Bool useSM = TRUE; MessageType from = X_DEFAULT; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); OptionInfoPtr options; options = xnfalloc(sizeof(SMOptions)); @@ -1834,3 +1834,17 @@ xf86MotionHistoryAllocate(InputInfoPtr pInfo) { AllocateMotionHistory(pInfo->dev); } + +ScrnInfoPtr +xf86ScreenToScrn(ScreenPtr pScreen) +{ + assert(pScreen->myNum < xf86NumScreens); + return xf86Screens[pScreen->myNum]; +} + +ScreenPtr +xf86ScrnToScreen(ScrnInfoPtr pScrn) +{ + assert(pScrn->scrnIndex < screenInfo.numScreens); + return screenInfo.screens[pScrn->scrnIndex]; +} diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c index f42dd1083..ead47ccba 100644 --- a/xorg-server/hw/xfree86/common/xf86Init.c +++ b/xorg-server/hw/xfree86/common/xf86Init.c @@ -405,6 +405,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) xf86Initialising = TRUE; + config_pre_init(); + if (serverGeneration == 1) { if ((xf86ServerName = strrchr(argv[0], '/')) != 0) xf86ServerName++; diff --git a/xorg-server/hw/xfree86/common/xf86Priv.h b/xorg-server/hw/xfree86/common/xf86Priv.h index 8d9cb5539..6c5efeacc 100644 --- a/xorg-server/hw/xfree86/common/xf86Priv.h +++ b/xorg-server/hw/xfree86/common/xf86Priv.h @@ -116,6 +116,7 @@ extern _X_EXPORT void xf86AccessLeave(void); extern _X_EXPORT void xf86PostProbe(void); extern _X_EXPORT void xf86ClearEntityListForScreen(int scrnIndex); extern _X_EXPORT void xf86AddDevToEntity(int entityIndex, GDevPtr dev); +extern _X_EXPORT void xf86RemoveDevFromEntity(int entityIndex, GDevPtr dev); /* xf86Config.c */ diff --git a/xorg-server/hw/xfree86/common/xf86RandR.c b/xorg-server/hw/xfree86/common/xf86RandR.c index abd894dff..b17f601d1 100644 --- a/xorg-server/hw/xfree86/common/xf86RandR.c +++ b/xorg-server/hw/xfree86/common/xf86RandR.c @@ -66,7 +66,7 @@ static Bool xf86RandRGetInfo(ScreenPtr pScreen, Rotation * rotations) { RRScreenSizePtr pSize; - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); DisplayModePtr mode; int refresh0 = 60; @@ -147,7 +147,7 @@ xf86RandRSetMode(ScreenPtr pScreen, DisplayModePtr mode, Bool useVirtual, int mmWidth, int mmHeight) { - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); int oldWidth = pScreen->width; int oldHeight = pScreen->height; @@ -228,7 +228,7 @@ static Bool xf86RandRSetConfig(ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize) { - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); DisplayModePtr mode; int pos[MAXDEVICES][2]; @@ -344,7 +344,7 @@ xf86RandRCreateScreenResources(ScreenPtr pScreen) XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); #if 0 - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); DisplayModePtr mode; #endif @@ -367,7 +367,7 @@ xf86RandRCreateScreenResources(ScreenPtr pScreen) static Bool xf86RandRCloseScreen(int index, ScreenPtr pScreen) { - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); scrp->virtualX = pScreen->width = randrp->virtualX; @@ -417,8 +417,9 @@ xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen, /* This is only for during server start */ if (resetMode) { + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); return (xf86RandRSetMode(pScreen, - XF86SCRNINFO(pScreen)->currentMode, + pScrn->currentMode, TRUE, pScreen->mmWidth, pScreen->mmHeight)); } @@ -430,7 +431,7 @@ xf86RandRInit(ScreenPtr pScreen) { rrScrPrivPtr rp; XF86RandRInfoPtr randrp; - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); #ifdef PANORAMIX /* XXX disable RandR when using Xinerama */ diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c index 7c9e6ba02..b9b46f6cd 100644 --- a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c +++ b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c @@ -106,7 +106,7 @@ xf86VGAarbiterAllowDRI(ScreenPtr pScreen) { int vga_count; int rsrc_decodes; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (vga_no_arb) return TRUE; @@ -173,7 +173,7 @@ xf86VGAarbiterWrapFunctions(void) for (i = 0; i < xf86NumScreens; i++) { pScreen = xf86Screens[i]->pScreen; ps = GetPictureScreenIfSet(pScreen); - pScrn = xf86Screens[pScreen->myNum]; + pScrn = xf86ScreenToScrn(pScreen); PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); if (!dixRegisterPrivateKey @@ -224,7 +224,7 @@ static Bool VGAarbiterCloseScreen(int i, ScreenPtr pScreen) { Bool val; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, VGAarbiterScreenKey); @@ -298,9 +298,7 @@ VGAarbiterGetImage(DrawablePtr pDrawable, ScreenPtr pScreen = pDrawable->pScreen; SCREEN_PROLOG(GetImage); -// if (xf86Screens[pScreen->myNum]->vtSema) { VGAGet(pScreen); -// } (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine); VGAPut(); SCREEN_EPILOG(GetImage, VGAarbiterGetImage); diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h index 2513ce65d..ebc8854d3 100644 --- a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h +++ b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h @@ -95,7 +95,7 @@ static inline void VGAGet(ScreenPtr pScreen) { - pci_device_vgaarb_set_target(xf86Screens[pScreen->myNum]->vgaDev); + pci_device_vgaarb_set_target(xf86ScreenToScrn(pScreen)->vgaDev); pci_device_vgaarb_lock(); } diff --git a/xorg-server/hw/xfree86/common/xf86cmap.c b/xorg-server/hw/xfree86/common/xf86cmap.c index cdc8459af..460fafde3 100644 --- a/xorg-server/hw/xfree86/common/xf86cmap.c +++ b/xorg-server/hw/xfree86/common/xf86cmap.c @@ -66,7 +66,7 @@ #define LOAD_PALETTE(pmap) \ ((pmap == GetInstalledmiColormap(pmap->pScreen)) && \ ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || \ - xf86Screens[pmap->pScreen->myNum]->vtSema || pScreenPriv->isDGAmode)) + xf86ScreenToScrn(pmap->pScreen)->vtSema || pScreenPriv->isDGAmode)) typedef struct _CMapLink { ColormapPtr cmap; @@ -151,7 +151,7 @@ xf86HandleColormaps(ScreenPtr pScreen, xf86LoadPaletteProc * loadPalette, xf86SetOverscanProc * setOverscan, unsigned int flags) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ColormapPtr pDefMap = NULL; CMapScreenPtr pScreenPriv; LOCO *gamma; @@ -511,7 +511,7 @@ CMapSetDGAMode(int index, int num, DGADevicePtr dev) pScreenPriv->isDGAmode = DGAActive(index); if (!pScreenPriv->isDGAmode && GetInstalledmiColormap(pScreen) - && xf86Screens[pScreen->myNum]->vtSema) + && xf86ScreenToScrn(pScreen)->vtSema) CMapReinstallMap(GetInstalledmiColormap(pScreen)); return ret; @@ -528,7 +528,7 @@ CMapReinstallMap(ColormapPtr pmap) CMapScreenKey); CMapColormapPtr cmapPriv = (CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey); - ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pmap->pScreen); int i = cmapPriv->numColors; int *indices = pScreenPriv->PreAllocIndices; @@ -560,7 +560,7 @@ CMapRefreshColors(ColormapPtr pmap, int defs, int *indices) CMapColormapPtr pColPriv = (CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey); VisualPtr pVisual = pmap->pVisual; - ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pmap->pScreen); int numColors, i; LOCO *gamma, *colors; EntryPtr entry; @@ -692,7 +692,7 @@ CMapSetOverscan(ColormapPtr pmap, int defs, int *indices) CMapScreenKey); CMapColormapPtr pColPriv = (CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey); - ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pmap->pScreen); VisualPtr pVisual = pmap->pVisual; int i; LOCO *colors; @@ -833,7 +833,7 @@ CMapUnwrapScreen(ScreenPtr pScreen) { CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->CreateColormap = pScreenPriv->CreateColormap; @@ -1008,7 +1008,7 @@ xf86ChangeGammaRamp(ScreenPtr pScreen, unsigned short *red, unsigned short *green, unsigned short *blue) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); CMapColormapPtr pColPriv; CMapScreenPtr pScreenPriv; CMapLinkPtr pLink; @@ -1085,7 +1085,7 @@ xf86ChangeGammaRamp(ScreenPtr pScreen, int xf86GetGammaRampSize(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); CMapScreenPtr pScreenPriv; if (xf86_crtc_supports_gamma(pScrn)) { @@ -1112,7 +1112,7 @@ xf86GetGammaRamp(ScreenPtr pScreen, unsigned short *red, unsigned short *green, unsigned short *blue) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); CMapScreenPtr pScreenPriv; LOCO *entry; int shift, sigbits; @@ -1172,7 +1172,7 @@ xf86GetGammaRamp(ScreenPtr pScreen, int xf86ChangeGamma(ScreenPtr pScreen, Gamma gamma) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (pScrn->ChangeGamma) return (*pScrn->ChangeGamma) (pScreen->myNum, gamma); diff --git a/xorg-server/hw/xfree86/common/xf86fbman.c b/xorg-server/hw/xfree86/common/xf86fbman.c index 3c29bf531..e2db1c354 100644 --- a/xorg-server/hw/xfree86/common/xf86fbman.c +++ b/xorg-server/hw/xfree86/common/xf86fbman.c @@ -1186,7 +1186,7 @@ xf86FBCloseScreen(int i, ScreenPtr pScreen) Bool xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); RegionRec ScreenRegion; RegionRec FullRegion; BoxRec ScreenBox; @@ -1223,7 +1223,7 @@ xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox) Bool xf86InitFBManagerArea(ScreenPtr pScreen, int PixelArea, int Verbosity) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xRectangle Rect[3]; RegionPtr pRegion, pScreenRegion; int nRect; diff --git a/xorg-server/hw/xfree86/common/xf86pciBus.c b/xorg-server/hw/xfree86/common/xf86pciBus.c index e52f1da84..d758260b6 100644 --- a/xorg-server/hw/xfree86/common/xf86pciBus.c +++ b/xorg-server/hw/xfree86/common/xf86pciBus.c @@ -52,7 +52,7 @@ #define PCI_VENDOR_GENERIC 0x00FF /* Bus-specific globals */ -Bool pciSlotClaimed = FALSE; +int pciSlotClaimed = 0; #define PCIINFOCLASSES(c) \ ( (((c) & 0x00ff0000) == (PCI_CLASS_PREHISTORIC << 16)) \ @@ -223,7 +223,7 @@ xf86ClaimPciSlot(struct pci_device *d, DriverPtr drvp, p->inUse = FALSE; if (dev) xf86AddDevToEntity(num, dev); - pciSlotClaimed = TRUE; + pciSlotClaimed++; return num; } @@ -235,7 +235,7 @@ xf86ClaimPciSlot(struct pci_device *d, DriverPtr drvp, * Unclaim PCI slot, e.g. if probing failed, so that a different driver can claim. */ void -xf86UnclaimPciSlot(struct pci_device *d) +xf86UnclaimPciSlot(struct pci_device *d, GDevPtr dev) { int i; @@ -244,6 +244,8 @@ xf86UnclaimPciSlot(struct pci_device *d) if ((p->bus.type == BUS_PCI) && (p->bus.id.pci == d)) { /* Probably the slot should be deallocated? */ + xf86RemoveDevFromEntity(i, dev); + pciSlotClaimed--; p->bus.type = BUS_NONE; return; } @@ -537,7 +539,7 @@ xf86PciProbeDev(DriverPtr drvp) foundScreen = TRUE; } else - xf86UnclaimPciSlot(pPci); + xf86UnclaimPciSlot(pPci, devList[i]); } break; diff --git a/xorg-server/hw/xfree86/common/xf86sbusBus.c b/xorg-server/hw/xfree86/common/xf86sbusBus.c index c993b603c..27d24f8e1 100644 --- a/xorg-server/hw/xfree86/common/xf86sbusBus.c +++ b/xorg-server/hw/xfree86/common/xf86sbusBus.c @@ -619,8 +619,9 @@ xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp) pScrn->virtualY = psdp->height; } -static sbusPaletteKeyIndex; -static DevPrivateKey sbusPaletteKey = &sbusPaletteKeyIndex; +static DevPrivateKeyRec sbusPaletteKeyRec; +#define sbusPaletteKey (&sbusPaletteKeyRec) + typedef struct _sbusCmap { sbusDevicePtr psdp; CloseScreenProcPtr CloseScreen; @@ -692,6 +693,9 @@ xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp) struct fbcmap fbcmap; unsigned char data[2]; + if (!dixRegisterPrivateKey(sbusPaletteKey, PRIVATE_SCREEN, 0)) + FatalError("Cannot register sbus private key"); + cmap = xnfcalloc(1, sizeof(sbusCmapRec)); dixSetPrivate(&pScreen->devPrivates, sbusPaletteKey, cmap); cmap->psdp = psdp; diff --git a/xorg-server/hw/xfree86/common/xf86xv.c b/xorg-server/hw/xfree86/common/xf86xv.c index 0e5b0cf0f..b10034852 100644 --- a/xorg-server/hw/xfree86/common/xf86xv.c +++ b/xorg-server/hw/xfree86/common/xf86xv.c @@ -271,7 +271,7 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num) if (!ScreenPriv) return FALSE; - pScrn = xf86Screens[pScreen->myNum]; + pScrn = xf86ScreenToScrn(pScreen); ScreenPriv->DestroyWindow = pScreen->DestroyWindow; ScreenPriv->WindowExposures = pScreen->WindowExposures; @@ -356,7 +356,7 @@ static Bool xf86XVInitAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr * infoPtr, int number) { XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); XF86VideoAdaptorPtr adaptorPtr; XvAdaptorPtr pAdaptor, pa; XvAdaptorRecPrivatePtr adaptorPriv; @@ -1150,7 +1150,7 @@ xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind) pScreen = pLayerWin->drawable.pScreen; ScreenPriv = GET_XF86XV_SCREEN(pScreen); - pScrn = xf86Screens[pScreen->myNum]; + pScrn = xf86ScreenToScrn(pScreen); xf86XVReputOrStopAllPorts(pScrn, TRUE); @@ -1257,7 +1257,7 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy) static Bool xf86XVCloseScreen(int i, ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); XvAdaptorPtr pa; @@ -1899,7 +1899,7 @@ xf86XVFillKeyHelperDrawable(DrawablePtr pDraw, CARD32 key, RegionPtr fillboxes) xRectangle *rects; GCPtr gc; - if (!xf86Screens[pScreen->myNum]->vtSema) + if (!xf86ScreenToScrn(pScreen)->vtSema) return; gc = GetScratchGC(pDraw->depth, pScreen); diff --git a/xorg-server/hw/xfree86/common/xf86xvmc.c b/xorg-server/hw/xfree86/common/xf86xvmc.c index 7321efa43..b7da7589a 100644 --- a/xorg-server/hw/xfree86/common/xf86xvmc.c +++ b/xorg-server/hw/xfree86/common/xf86xvmc.c @@ -64,7 +64,7 @@ xf86XvMCCreateContext(XvPortPtr pPort, XvMCContextPtr pContext, int *num_priv, CARD32 **priv) { xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); - ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen); pContext->port_priv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr); @@ -78,7 +78,7 @@ static void xf86XvMCDestroyContext(XvMCContextPtr pContext) { xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); - ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen); (*pScreenPriv->adaptors[pContext->adapt_num]->DestroyContext) (pScrn, pContext); @@ -89,7 +89,7 @@ xf86XvMCCreateSurface(XvMCSurfacePtr pSurface, int *num_priv, CARD32 **priv) { XvMCContextPtr pContext = pSurface->context; xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); - ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen); return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSurface) (pScrn, pSurface, @@ -102,7 +102,7 @@ xf86XvMCDestroySurface(XvMCSurfacePtr pSurface) { XvMCContextPtr pContext = pSurface->context; xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); - ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen); (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySurface) (pScrn, pSurface); @@ -114,7 +114,7 @@ xf86XvMCCreateSubpicture(XvMCSubpicturePtr pSubpicture, { XvMCContextPtr pContext = pSubpicture->context; xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); - ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen); return (*pScreenPriv->adaptors[pContext->adapt_num]-> CreateSubpicture) (pScrn, pSubpicture, num_priv, priv); @@ -125,7 +125,7 @@ xf86XvMCDestroySubpicture(XvMCSubpicturePtr pSubpicture) { XvMCContextPtr pContext = pSubpicture->context; xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); - ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen); (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySubpicture) (pScrn, pSubpicture); diff --git a/xorg-server/hw/xfree86/doc/ddxDesign.xml b/xorg-server/hw/xfree86/doc/ddxDesign.xml index ca5efc9be..a6b9da2d5 100644 --- a/xorg-server/hw/xfree86/doc/ddxDesign.xml +++ b/xorg-server/hw/xfree86/doc/ddxDesign.xml @@ -665,11 +665,6 @@ Here is what <function>InitOutput()</function> does: </para> <para> - The core server contains a list of mandatory modules. These are loaded - first. Currently the only module on this list is the bitmap font module. - </para> - - <para> The next set of modules loaded are those specified explicitly in the &k.module; section of the config file. </para> @@ -5994,26 +5989,6 @@ typedef struct { </blockquote></para></blockquote> - <blockquote><para> - <programlisting> - void LoadFont(FontModule *font); - </programlisting> - <blockquote><para> - This registers the entry points for the font rasteriser module - identified by <parameter>font</parameter>. The <structname>FontModule</structname> - struct is defined as: - - <programlisting> - typedef struct { - InitFont initFunc; - char * name; - pointer module; -} FontModule; - </programlisting> - </para> - - </blockquote></para></blockquote> - </sect2> </sect1> @@ -9061,7 +9036,7 @@ static Bool ZZZScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { /* Get the ScrnInfoRec */ - pScrn = xf86Screens[pScreen->myNum]; + pScrn = xf86ScreenToScrn(pScreen); /* * If using the vgahw module, its data structures and related diff --git a/xorg-server/hw/xfree86/dri/dri.c b/xorg-server/hw/xfree86/dri/dri.c index 9530eb40e..20eb683ad 100644 --- a/xorg-server/hw/xfree86/dri/dri.c +++ b/xorg-server/hw/xfree86/dri/dri.c @@ -315,7 +315,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) int reserved_count; int i; DRIEntPrivPtr pDRIEntPriv; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); DRIContextFlags flags = 0; DRIContextPrivPtr pDRIContextPriv; @@ -615,7 +615,7 @@ DRIFinishScreenInit(ScreenPtr pScreen) pScreen->ClipNotify = pDRIInfo->wrap.ClipNotify; } if (pDRIInfo->wrap.AdjustFrame) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame; pScrn->AdjustFrame = pDRIInfo->wrap.AdjustFrame; @@ -634,7 +634,7 @@ DRICloseScreen(ScreenPtr pScreen) DRIInfoPtr pDRIInfo; drm_context_t *reserved; int reserved_count; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); DRIEntPrivPtr pDRIEntPriv = DRI_ENT_PRIV(pScrn); Bool closeMaster; @@ -672,7 +672,7 @@ DRICloseScreen(ScreenPtr pScreen) pDRIPriv->wrap.ClipNotify = NULL; } if (pDRIInfo->wrap.AdjustFrame) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame; pDRIPriv->wrap.AdjustFrame = NULL; @@ -2311,7 +2311,7 @@ DRIAdjustFrame(int scrnIndex, int x, int y, int flags) { ScreenPtr pScreen = screenInfo.screens[scrnIndex]; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); int px, py; if (!pDRIPriv || !pDRIPriv->pSAREA) { diff --git a/xorg-server/hw/xfree86/dri2/dri2ext.c b/xorg-server/hw/xfree86/dri2/dri2ext.c index 2579a5c86..61578f3c1 100644 --- a/xorg-server/hw/xfree86/dri2/dri2ext.c +++ b/xorg-server/hw/xfree86/dri2/dri2ext.c @@ -589,12 +589,15 @@ SProcDRI2Connect(ClientPtr client) if (sizeof(*stuff) / 4 != client->req_len) return BadLength; + rep.type = X_Reply; rep.sequenceNumber = client->sequence; swaps(&rep.sequenceNumber); rep.length = 0; rep.driverNameLength = 0; rep.deviceNameLength = 0; + WriteToClient(client, sizeof(xDRI2ConnectReply), &rep); + return Success; } diff --git a/xorg-server/hw/xfree86/exa/examodule.c b/xorg-server/hw/xfree86/exa/examodule.c index 72cf7988d..50924587d 100644 --- a/xorg-server/hw/xfree86/exa/examodule.c +++ b/xorg-server/hw/xfree86/exa/examodule.c @@ -72,7 +72,7 @@ static const OptionInfoRec EXAOptions[] = { static Bool exaXorgCloseScreen(int i, ScreenPtr pScreen) { - ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen); + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr) dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey); @@ -111,8 +111,7 @@ void exaDDXDriverInit(ScreenPtr pScreen) { ExaScreenPriv(pScreen); - /* Do NOT use XF86SCRNINFO macro here!! */ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ExaXorgScreenPrivPtr pScreenPriv; if (!dixRegisterPrivateKey(&exaXorgScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) diff --git a/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c index 2881d7ec2..0444d481c 100644 --- a/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c +++ b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c @@ -866,7 +866,7 @@ fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags) Bool fbdevHWSaveScreen(ScreenPtr pScreen, int mode) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); unsigned long unblank; diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c index fee1ae774..ab6ed5e32 100644 --- a/xorg-server/hw/xfree86/modes/xf86Crtc.c +++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c @@ -182,7 +182,7 @@ xf86CrtcSetScreenSubpixelOrder(ScreenPtr pScreen) { int subpixel_order = SubPixelUnknown; Bool has_none = FALSE; - ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); int c, o; @@ -698,7 +698,7 @@ xf86OutputDestroy(xf86OutputPtr output) static Bool xf86CrtcCreateScreenResources(ScreenPtr screen) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); screen->CreateScreenResources = config->CreateScreenResources; @@ -718,7 +718,7 @@ xf86CrtcCreateScreenResources(ScreenPtr screen) static Bool xf86CrtcCloseScreen(int index, ScreenPtr screen) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int o, c; @@ -751,7 +751,7 @@ Bool #endif xf86CrtcScreenInit(ScreenPtr screen) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int c; @@ -2823,7 +2823,7 @@ xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags) Bool xf86SaveScreen(ScreenPtr pScreen, int mode) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (xf86IsUnblank(mode)) xf86DPMSSet(pScrn, DPMSModeOn, 0); @@ -3151,7 +3151,7 @@ xf86_crtc_notify_proc_ptr xf86_wrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr new) { if (xf86CrtcConfigPrivateIndex != -1) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); xf86_crtc_notify_proc_ptr old; @@ -3166,7 +3166,7 @@ void xf86_unwrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr old) { if (xf86CrtcConfigPrivateIndex != -1) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); config->xf86_crtc_notify = old; @@ -3176,7 +3176,7 @@ xf86_unwrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr old) void xf86_crtc_notify(ScreenPtr screen) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); if (config->xf86_crtc_notify) diff --git a/xorg-server/hw/xfree86/modes/xf86Cursors.c b/xorg-server/hw/xfree86/modes/xf86Cursors.c index 95a78921d..634ee3fe0 100644 --- a/xorg-server/hw/xfree86/modes/xf86Cursors.c +++ b/xorg-server/hw/xfree86/modes/xf86Cursors.c @@ -477,7 +477,7 @@ xf86_load_cursor_image(ScrnInfoPtr scrn, unsigned char *src) static Bool xf86_use_hw_cursor(ScreenPtr screen, CursorPtr cursor) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; @@ -496,7 +496,7 @@ xf86_use_hw_cursor(ScreenPtr screen, CursorPtr cursor) static Bool xf86_use_hw_cursor_argb(ScreenPtr screen, CursorPtr cursor) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; @@ -564,7 +564,7 @@ xf86_load_cursor_argb(ScrnInfoPtr scrn, CursorPtr cursor) Bool xf86_cursors_init(ScreenPtr screen, int max_width, int max_height, int flags) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86CursorInfoPtr cursor_info; @@ -631,7 +631,7 @@ xf86_reload_cursors(ScreenPtr screen) if (!cursor_screen_priv || !cursor_screen_priv->isUp) return; - scrn = xf86Screens[screen->myNum]; + scrn = xf86ScreenToScrn(screen); xf86_config = XF86_CRTC_CONFIG_PTR(scrn); /* make sure the cursor code has been initialized */ @@ -667,7 +667,7 @@ xf86_reload_cursors(ScreenPtr screen) void xf86_cursors_fini(ScreenPtr screen) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); if (xf86_config->cursor_info) { diff --git a/xorg-server/hw/xfree86/modes/xf86DiDGA.c b/xorg-server/hw/xfree86/modes/xf86DiDGA.c index fafd95aed..fdec6cb4b 100644 --- a/xorg-server/hw/xfree86/modes/xf86DiDGA.c +++ b/xorg-server/hw/xfree86/modes/xf86DiDGA.c @@ -41,7 +41,7 @@ static Bool xf86_dga_get_modes(ScreenPtr pScreen) { - ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); DGAModePtr modes, mode; DisplayModePtr display_mode; @@ -175,7 +175,7 @@ xf86DiDGAReInit(ScreenPtr pScreen) Bool _xf86_di_dga_reinit_internal(ScreenPtr pScreen) { - ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); if (!DGAAvailable(pScreen->myNum)) @@ -197,7 +197,7 @@ xf86DiDGAInit(ScreenPtr pScreen, unsigned long dga_address) Bool _xf86_di_dga_init_internal(ScreenPtr pScreen) { - ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86_config->dga_flags = 0; diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.c b/xorg-server/hw/xfree86/modes/xf86RandR12.c index aca0734e0..e6b205223 100644 --- a/xorg-server/hw/xfree86/modes/xf86RandR12.c +++ b/xorg-server/hw/xfree86/modes/xf86RandR12.c @@ -447,7 +447,7 @@ static Bool xf86RandR12GetInfo(ScreenPtr pScreen, Rotation * rotations) { RRScreenSizePtr pSize; - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); DisplayModePtr mode; int refresh0 = 60; @@ -504,7 +504,7 @@ xf86RandR12SetMode(ScreenPtr pScreen, DisplayModePtr mode, Bool useVirtual, int mmWidth, int mmHeight) { - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); int oldWidth = pScreen->width; int oldHeight = pScreen->height; @@ -576,7 +576,7 @@ Bool xf86RandR12SetConfig(ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize) { - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); DisplayModePtr mode; int pos[MAXDEVICES][2]; @@ -671,7 +671,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen, CARD16 height, CARD32 mmWidth, CARD32 mmHeight) { XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); - ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen); + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); WindowPtr pRoot = pScreen->root; PixmapPtr pScrnPix; @@ -743,7 +743,7 @@ xf86RandR12GetRotation(ScreenPtr pScreen) Bool xf86RandR12CreateScreenResources(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config; XF86RandRInfoPtr randrp; int c; @@ -902,7 +902,7 @@ xf86RandR12CloseScreen(ScreenPtr pScreen) randrp = XF86RANDRINFO(pScreen); #if RANDR_12_INTERFACE - xf86Screens[pScreen->myNum]->EnterVT = randrp->orig_EnterVT; + xf86ScreenToScrn(pScreen)->EnterVT = randrp->orig_EnterVT; #endif free(randrp); @@ -914,7 +914,7 @@ xf86RandR12SetRotations(ScreenPtr pScreen, Rotation rotations) XF86RandRInfoPtr randrp; #if RANDR_12_INTERFACE - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); int c; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); #endif @@ -939,7 +939,7 @@ xf86RandR12SetTransformSupport(ScreenPtr pScreen, Bool transforms) XF86RandRInfoPtr randrp; #if RANDR_13_INTERFACE - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); int c; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); #endif @@ -960,7 +960,7 @@ xf86RandR12SetTransformSupport(ScreenPtr pScreen, Bool transforms) void xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y) { - ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); if (xf86RandR12Generation != serverGeneration || XF86RANDRINFO(pScreen)->virtualX == -1) { @@ -1041,7 +1041,7 @@ static Bool xf86RandR12CrtcNotify(RRCrtcPtr randr_crtc) { ScreenPtr pScreen = randr_crtc->pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); RRModePtr randr_mode = NULL; int x; @@ -1136,7 +1136,7 @@ xf86RandR12CrtcSet(ScreenPtr pScreen, int num_randr_outputs, RROutputPtr * randr_outputs) { XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcPtr crtc = randr_crtc->devPrivate; RRTransformPtr transform; @@ -1349,7 +1349,7 @@ static Bool xf86RandR12OutputValidateMode(ScreenPtr pScreen, RROutputPtr randr_output, RRModePtr randr_mode) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86OutputPtr output = randr_output->devPrivate; DisplayModeRec mode; @@ -1434,7 +1434,7 @@ xf86RROutputSetModes(RROutputPtr randr_output, DisplayModePtr modes) static Bool xf86RandR12SetInfo12(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); RROutputPtr *clones; RRCrtcPtr *crtcs; @@ -1510,7 +1510,7 @@ xf86RandR12SetInfo12(ScreenPtr pScreen) static Bool xf86RandR12GetInfo12(ScreenPtr pScreen, Rotation * rotations) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (!pScrn->vtSema) return TRUE; @@ -1522,7 +1522,7 @@ xf86RandR12GetInfo12(ScreenPtr pScreen, Rotation * rotations) static Bool xf86RandR12CreateObjects12(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); int c; int o; @@ -1559,7 +1559,7 @@ static Bool xf86RandR12CreateScreenResources12(ScreenPtr pScreen) { int c; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); if (xf86RandR12Key == NULL) @@ -1581,7 +1581,7 @@ xf86RandR12CreateScreenResources12(ScreenPtr pScreen) void xf86RandR12TellChanged(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); int c; @@ -1751,7 +1751,7 @@ xf86RandR12EnterVT(int screen_index, int flags) static Bool xf86RandR12Init12(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); rrScrPrivPtr rp = rrGetScrPriv(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); int i; diff --git a/xorg-server/hw/xfree86/modes/xf86Rotate.c b/xorg-server/hw/xfree86/modes/xf86Rotate.c index cbc868735..26eefc8c0 100644 --- a/xorg-server/hw/xfree86/modes/xf86Rotate.c +++ b/xorg-server/hw/xfree86/modes/xf86Rotate.c @@ -144,7 +144,7 @@ xf86CrtcDamageShadow(xf86CrtcPtr crtc) ScrnInfoPtr pScrn = crtc->scrn; BoxRec damage_box; RegionRec damage_region; - ScreenPtr pScreen = pScrn->pScreen; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); damage_box.x1 = 0; damage_box.x2 = crtc->mode.HDisplay; @@ -174,7 +174,7 @@ xf86CrtcDamageShadow(xf86CrtcPtr crtc) static void xf86RotatePrepare(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); int c; @@ -204,7 +204,7 @@ xf86RotatePrepare(ScreenPtr pScreen) static Bool xf86RotateRedisplay(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); DamagePtr damage = xf86_config->rotation_damage; RegionPtr region; @@ -270,7 +270,7 @@ void xf86RotateDestroy(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; - ScreenPtr pScreen = pScrn->pScreen; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); int c; @@ -328,7 +328,7 @@ xf86RotateFreeShadow(ScrnInfoPtr pScrn) void xf86RotateCloseScreen(ScreenPtr screen) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); int c; @@ -370,9 +370,7 @@ xf86CrtcRotate(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); - - /* if this is called during ScreenInit() we don't have pScrn->pScreen yet */ - ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); PictTransform crtc_to_fb; struct pict_f_transform f_crtc_to_fb, f_fb_to_crtc; xFixed *new_params = NULL; diff --git a/xorg-server/hw/xfree86/ramdac/xf86Cursor.c b/xorg-server/hw/xfree86/ramdac/xf86Cursor.c index 678d2be5c..7fd70fc34 100644 --- a/xorg-server/hw/xfree86/ramdac/xf86Cursor.c +++ b/xorg-server/hw/xfree86/ramdac/xf86Cursor.c @@ -55,7 +55,7 @@ static Bool xf86CursorSwitchMode(int, DisplayModePtr, int); Bool xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CursorScreenPtr ScreenPriv; miPointerScreenPtr PointPriv; @@ -120,7 +120,7 @@ xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr) static Bool xf86CursorCloseScreen(int i, ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); miPointerScreenPtr PointPriv = (miPointerScreenPtr) dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); diff --git a/xorg-server/hw/xfree86/ramdac/xf86HWCurs.c b/xorg-server/hw/xfree86/ramdac/xf86HWCurs.c index 95721490a..cb62d9b20 100644 --- a/xorg-server/hw/xfree86/ramdac/xf86HWCurs.c +++ b/xorg-server/hw/xfree86/ramdac/xf86HWCurs.c @@ -105,7 +105,7 @@ xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr) infoPtr->RealizeCursor = RealizeCursorInterleave0; } - infoPtr->pScrn = xf86Screens[pScreen->myNum]; + infoPtr->pScrn = xf86ScreenToScrn(pScreen); return TRUE; } diff --git a/xorg-server/hw/xfree86/ramdac/xf86RamDacCmap.c b/xorg-server/hw/xfree86/ramdac/xf86RamDacCmap.c index 7a903d8e4..fa7a86663 100644 --- a/xorg-server/hw/xfree86/ramdac/xf86RamDacCmap.c +++ b/xorg-server/hw/xfree86/ramdac/xf86RamDacCmap.c @@ -59,7 +59,7 @@ Bool RamDacHandleColormaps(ScreenPtr pScreen, int maxColors, int sigRGBbits, unsigned int flags) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); RamDacRecPtr hwp = RAMDACSCRPTR(pScrn); if (hwp->LoadPalette == NULL) diff --git a/xorg-server/hw/xfree86/shadowfb/shadow.c b/xorg-server/hw/xfree86/shadowfb/shadow.c index 714dd141a..5aeee6cbf 100644 --- a/xorg-server/hw/xfree86/shadowfb/shadow.c +++ b/xorg-server/hw/xfree86/shadowfb/shadow.c @@ -136,7 +136,7 @@ ShadowFBInit2(ScreenPtr pScreen, RefreshAreaFuncPtr preRefreshArea, RefreshAreaFuncPtr postRefreshArea) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ShadowScreenPtr pPriv; PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); @@ -229,7 +229,7 @@ ShadowLeaveVT(int index, int flags) static Bool ShadowCloseScreen(int i, ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen); PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); diff --git a/xorg-server/hw/xfree86/utils/man/cvt.man b/xorg-server/hw/xfree86/utils/man/cvt.man index 310e46405..8d70ead1b 100644 --- a/xorg-server/hw/xfree86/utils/man/cvt.man +++ b/xorg-server/hw/xfree86/utils/man/cvt.man @@ -19,8 +19,8 @@ standard is printed. This modeline can be included in Xorg .SH OPTIONS .TP 8 .BR refresh -Provide a vertical refresh rate in kHz. The CVT standard prefers either 50.0, -60.0, 75.0 or 85.0kHz. The default is 60.0kHz. +Provide a vertical refresh rate in Hz. The CVT standard prefers either 50.0, +60.0, 75.0 or 85.0Hz. The default is 60.0Hz. .TP 8 .BR \-v | \-\-verbose Warn verbosely when a given mode does not completely correspond with CVT diff --git a/xorg-server/hw/xfree86/vgahw/vgaCmap.c b/xorg-server/hw/xfree86/vgahw/vgaCmap.c index 0cfabc5d6..a1aa405a8 100644 --- a/xorg-server/hw/xfree86/vgahw/vgaCmap.c +++ b/xorg-server/hw/xfree86/vgahw/vgaCmap.c @@ -81,11 +81,8 @@ xColorItem *pdefs; xColorItem directDefs[256]; Bool new_overscan = FALSE; Bool writeColormap; - - /* This can get called before the ScrnInfoRec is installed so we - can't rely on getting it with XF86SCRNINFO() */ int scrnIndex = pmap->pScreen->myNum; - ScrnInfoPtr scrninfp = xf86Screens[scrnIndex]; + ScrnInfoPtr scrninfp = xf86ScreenToScrn(pmap->pScreen); vgaHWPtr hwp = VGAHWPTR(scrninfp); unsigned char overscan = hwp->ModeReg.Attribute[OVERSCAN]; diff --git a/xorg-server/hw/xfree86/vgahw/vgaHW.c b/xorg-server/hw/xfree86/vgahw/vgaHW.c index e044682c7..a64f4f85d 100644 --- a/xorg-server/hw/xfree86/vgahw/vgaHW.c +++ b/xorg-server/hw/xfree86/vgahw/vgaHW.c @@ -651,7 +651,7 @@ vgaHWSaveScreen(ScreenPtr pScreen, int mode) Bool on; if (pScreen != NULL) - pScrn = xf86Screens[pScreen->myNum]; + pScrn = xf86ScreenToScrn(pScreen); on = xf86IsUnblank(mode); @@ -1873,7 +1873,7 @@ vgaHWSetOverscan(ScrnInfoPtr pScrn, int overscan) Bool vgaHWHandleColormaps(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (pScrn->depth > 1 && pScrn->depth <= 8) { return xf86HandleColormaps(pScreen, 1 << pScrn->depth, diff --git a/xorg-server/hw/xfree86/xaa/xaaInit.c b/xorg-server/hw/xfree86/xaa/xaaInit.c index 661fa90ab..48d0605fa 100644 --- a/xorg-server/hw/xfree86/xaa/xaaInit.c +++ b/xorg-server/hw/xfree86/xaa/xaaInit.c @@ -92,7 +92,7 @@ XAADestroyInfoRec(XAAInfoRecPtr infoRec) return; if (infoRec->ClosePixmapCache) - (*infoRec->ClosePixmapCache) (infoRec->pScrn->pScreen); + (*infoRec->ClosePixmapCache) (xf86ScrnToScreen(infoRec->pScrn)); free(infoRec->PreAllocMem); @@ -104,7 +104,7 @@ XAADestroyInfoRec(XAAInfoRecPtr infoRec) Bool XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); XAAScreenPtr pScreenPriv; int i; PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); @@ -216,7 +216,7 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec) static Bool XAACloseScreen(int i, ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); XAAScreenPtr pScreenPriv = (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); @@ -278,7 +278,7 @@ XAAGetSpans(DrawablePtr pDraw, ScreenPtr pScreen = pDraw->pScreen; XAA_SCREEN_PROLOGUE(pScreen, GetSpans); - if (xf86Screens[pScreen->myNum]->vtSema && + if (xf86ScreenToScrn(pScreen)->vtSema && ((pDraw->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pDraw))) { SYNC_CHECK(pDraw); } @@ -311,7 +311,7 @@ static void XAAInitializeOffscreenDepths(ScreenPtr pScreen) { XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); int d, dep; infoRec->offscreenDepthsInitialized = TRUE; @@ -329,7 +329,7 @@ static PixmapPtr XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint) { XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); XAAPixmapPtr pPriv; PixmapPtr pPix = NULL; int size = w * h; diff --git a/xorg-server/hw/xfree86/xaa/xaaInitAccel.c b/xorg-server/hw/xfree86/xaa/xaaInitAccel.c index 2a85a1996..a36e0b71b 100644 --- a/xorg-server/hw/xfree86/xaa/xaaInitAccel.c +++ b/xorg-server/hw/xfree86/xaa/xaaInitAccel.c @@ -116,7 +116,7 @@ Bool XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) { int index = pScreen->myNum; - ScrnInfoPtr pScrn = xf86Screens[index]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); Bool HaveScreenToScreenCopy = FALSE; Bool HaveColorExpansion = FALSE; Bool HaveScanlineColorExpansion = FALSE; diff --git a/xorg-server/hw/xfree86/xaa/xaaOverlayDF.c b/xorg-server/hw/xfree86/xaa/xaaOverlayDF.c index 5918f65a3..470694cbd 100644 --- a/xorg-server/hw/xfree86/xaa/xaaOverlayDF.c +++ b/xorg-server/hw/xfree86/xaa/xaaOverlayDF.c @@ -171,7 +171,7 @@ static DevPrivateKeyRec XAAOverlayKeyRec; Bool XAAInitDualFramebufferOverlay(ScreenPtr pScreen, DepthChangeFuncPtr callback) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); XAAOverlayPtr pOverPriv; diff --git a/xorg-server/hw/xfree86/xaa/xaaPCache.c b/xorg-server/hw/xfree86/xaa/xaaPCache.c index 02c0cd498..53460b31e 100644 --- a/xorg-server/hw/xfree86/xaa/xaaPCache.c +++ b/xorg-server/hw/xfree86/xaa/xaaPCache.c @@ -652,7 +652,7 @@ ConvertSomePartialsTo8x8(int *NumMono, int *NumColor, int *NumPartial, void XAAInitPixmapCache(ScreenPtr pScreen, RegionPtr areas, pointer data) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); XAAInfoRecPtr infoRec = (XAAInfoRecPtr) data; XAAPixmapCachePrivatePtr pCachePriv; BoxPtr pBox = RegionRects(areas); @@ -2015,7 +2015,7 @@ XAAWriteBitmapToCacheLinear(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, int fg, int bg) { - ScreenPtr pScreen = pScrn->pScreen; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); PixmapPtr pScreenPix, pDstPix; ChangeGCVal gcvals[2]; GCPtr pGC; @@ -2061,7 +2061,7 @@ XAAWritePixmapToCacheLinear(ScrnInfoPtr pScrn, unsigned char *src, int srcwidth, int bpp, int depth) { - ScreenPtr pScreen = pScrn->pScreen; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); PixmapPtr pScreenPix, pDstPix; GCPtr pGC; diff --git a/xorg-server/hw/xfree86/xaa/xaaStateChange.c b/xorg-server/hw/xfree86/xaa/xaaStateChange.c index 0218cb57c..cd2b601c4 100644 --- a/xorg-server/hw/xfree86/xaa/xaaStateChange.c +++ b/xorg-server/hw/xfree86/xaa/xaaStateChange.c @@ -1532,7 +1532,7 @@ XAAStateWrapSetupForCPUToScreenTexture2(ScrnInfoPtr pScrn, int op, Bool XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); XAAStateWrapPtr pStatePriv; int i = 0; diff --git a/xorg-server/include/hotplug.h b/xorg-server/include/hotplug.h index caa3201e7..f3eeea21d 100644 --- a/xorg-server/include/hotplug.h +++ b/xorg-server/include/hotplug.h @@ -26,6 +26,7 @@ #ifndef HOTPLUG_H #define HOTPLUG_H +extern _X_EXPORT void config_pre_init(void); extern _X_EXPORT void config_init(void); extern _X_EXPORT void config_fini(void); diff --git a/xorg-server/render/glyph.c b/xorg-server/render/glyph.c index a143e9eb5..acb573fe6 100644 --- a/xorg-server/render/glyph.c +++ b/xorg-server/render/glyph.c @@ -90,7 +90,6 @@ GlyphUninit(ScreenPtr pScreen) PictureScreenPtr ps = GetPictureScreen(pScreen); GlyphPtr glyph; int fdepth, i; - int scrno = pScreen->myNum; for (fdepth = 0; fdepth < GlyphFormatNum; fdepth++) { if (!globalGlyphs[fdepth].hashSet) @@ -99,9 +98,9 @@ GlyphUninit(ScreenPtr pScreen) for (i = 0; i < globalGlyphs[fdepth].hashSet->size; i++) { glyph = globalGlyphs[fdepth].table[i].glyph; if (glyph && glyph != DeletedGlyph) { - if (GlyphPicture(glyph)[scrno]) { - FreePicture((pointer) GlyphPicture(glyph)[scrno], 0); - GlyphPicture(glyph)[scrno] = NULL; + if (GetGlyphPicture(glyph, pScreen)) { + FreePicture((pointer) GetGlyphPicture(glyph, pScreen), 0); + SetGlyphPicture(glyph, pScreen, NULL); } (*ps->UnrealizeGlyph) (pScreen, glyph); } @@ -239,8 +238,8 @@ FreeGlyphPicture(GlyphPtr glyph) for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; - if (GlyphPicture(glyph)[i]) - FreePicture((pointer) GlyphPicture(glyph)[i], 0); + if (GetGlyphPicture(glyph, pScreen)) + FreePicture((pointer) GetGlyphPicture(glyph, pScreen), 0); ps = GetPictureScreenIfSet(pScreen); if (ps) @@ -363,11 +362,12 @@ AllocateGlyph(xGlyphInfo * gi, int fdepth) dixInitPrivates(glyph, (char *) glyph + head_size, PRIVATE_GLYPH); for (i = 0; i < screenInfo.numScreens; i++) { - GlyphPicture(glyph)[i] = NULL; - ps = GetPictureScreenIfSet(screenInfo.screens[i]); + ScreenPtr pScreen = screenInfo.screens[i]; + SetGlyphPicture(glyph, pScreen, NULL); + ps = GetPictureScreenIfSet(pScreen); if (ps) { - if (!(*ps->RealizeGlyph) (screenInfo.screens[i], glyph)) + if (!(*ps->RealizeGlyph) (pScreen, glyph)) goto bail; } } @@ -638,7 +638,7 @@ miGlyphs(CARD8 op, n = list->len; while (n--) { glyph = *glyphs++; - pPicture = GlyphPicture(glyph)[pScreen->myNum]; + pPicture = GetGlyphPicture(glyph, pScreen); if (pPicture) { if (maskFormat) { @@ -684,3 +684,13 @@ miGlyphs(CARD8 op, (*pScreen->DestroyPixmap) (pMaskPixmap); } } + +PicturePtr GetGlyphPicture(GlyphPtr glyph, ScreenPtr pScreen) +{ + return GlyphPicture(glyph)[pScreen->myNum]; +} + +void SetGlyphPicture(GlyphPtr glyph, ScreenPtr pScreen, PicturePtr picture) +{ + GlyphPicture(glyph)[pScreen->myNum] = picture; +} diff --git a/xorg-server/render/glyphstr.h b/xorg-server/render/glyphstr.h index cbc4751f0..7d178be01 100644 --- a/xorg-server/render/glyphstr.h +++ b/xorg-server/render/glyphstr.h @@ -133,4 +133,10 @@ extern _X_EXPORT GlyphSetPtr AllocateGlyphSet(int fdepth, PictFormatPtr format); extern _X_EXPORT int FreeGlyphSet(pointer value, XID gid); +#define GLYPH_HAS_GLYPH_PICTURE_ACCESSOR 1 /* used for api compat */ +extern _X_EXPORT PicturePtr + GetGlyphPicture(GlyphPtr glyph, ScreenPtr pScreen); +extern _X_EXPORT void + SetGlyphPicture(GlyphPtr glyph, ScreenPtr pScreen, PicturePtr picture); + #endif /* _GLYPHSTR_H_ */ diff --git a/xorg-server/render/render.c b/xorg-server/render/render.c index 344ca75e2..fe7666d35 100644 --- a/xorg-server/render/render.c +++ b/xorg-server/render/render.c @@ -1136,11 +1136,11 @@ ProcRenderAddGlyphs(ClientPtr client) goto bail; } - GlyphPicture(glyph)[screen] = pDst = - CreatePicture(0, &pDstPix->drawable, + pDst = CreatePicture(0, &pDstPix->drawable, glyphSet->format, CPComponentAlpha, &component_alpha, serverClient, &error); + SetGlyphPicture(glyph, pScreen, pDst); /* The picture takes a reference to the pixmap, so we drop ours. */ diff --git a/xorg-server/xkeyboard-config/symbols/es b/xorg-server/xkeyboard-config/symbols/es index f8483bb26..fec506ab7 100644 --- a/xorg-server/xkeyboard-config/symbols/es +++ b/xorg-server/xkeyboard-config/symbols/es @@ -81,8 +81,8 @@ xkb_symbols "dvorak" { key <AE11> {[ apostrophe, question, dead_macron, dead_ogonek ]}; key <AE12> {[ exclamdown, questiondown, dead_breve, dead_abovedot ]}; - key <AD01> {[ period, colon ]}; - key <AD02> {[ comma, semicolon ]}; + key <AD01> {[ period, colon, less ]}; + key <AD02> {[ comma, semicolon, greater ]}; key <AD03> {[ ntilde, Ntilde, lstroke, Lstroke ]}; key <AD04> {[ p, P, paragraph ]}; key <AD05> {[ y, Y, yen ]}; diff --git a/xorg-server/xkeyboard-config/symbols/kr b/xorg-server/xkeyboard-config/symbols/kr index 464566cf3..46251880d 100644 --- a/xorg-server/xkeyboard-config/symbols/kr +++ b/xorg-server/xkeyboard-config/symbols/kr @@ -15,8 +15,8 @@ xkb_symbols "kr104" { partial hidden function_keys xkb_symbols "koreankeys" { - key <K72> { [ Hangul ] }; - key <K71> { [ Hangul_Hanja ] }; + key <K71> { [ Hangul ] }; + key <K72> { [ Hangul_Hanja ] }; }; partial hidden function_keys |