From bonefish at mail.berlios.de Sun Jun 1 04:25:03 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 1 Jun 2008 04:25:03 +0200 Subject: [Haiku-commits] r25744 - in haiku/trunk: headers/private/kernel src/system/kernel/debug Message-ID: <200806010225.m512P3di025474@sheep.berlios.de> Author: bonefish Date: 2008-06-01 04:25:00 +0200 (Sun, 01 Jun 2008) New Revision: 25744 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25744&view=rev Added: haiku/trunk/src/system/kernel/debug/debug_builtin_commands.cpp haiku/trunk/src/system/kernel/debug/debug_builtin_commands.h haiku/trunk/src/system/kernel/debug/debug_output_filter.h Modified: haiku/trunk/headers/private/kernel/debug.h haiku/trunk/src/system/kernel/debug/Jamfile haiku/trunk/src/system/kernel/debug/blue_screen.cpp haiku/trunk/src/system/kernel/debug/debug.cpp haiku/trunk/src/system/kernel/debug/debug_commands.cpp haiku/trunk/src/system/kernel/debug/debug_commands.h haiku/trunk/src/system/kernel/debug/debug_parser.cpp Log: * Introduced pipes in the kernel debugger. The syntax is similar to pipes in the shell, though the semantics is a little different: The second command is invoked whenever the first command has written a complete line. The line is passed as last argument to the second command. The new command flag B_KDEBUG_PIPE_FINAL_RERUN causes the second command to be invoked again (with NULL argument) after the first command is done. * Added kprintf_unfiltered() and kputs_unfiltered() which bypass the pipe mechanism and directly print to the bluescreen/serial output. * Moved most commands from debug.cpp to the new debug_builtin_commands.cpp. * B_KDEBUG_DONT_PARSE_ARGUMENTS commands don't get an argument anymore, if it would consist of white space only. * Added new debugger command return value B_KDEBUG_ERROR, which indicates that executing the command failed. This return code will abort a complete pipe. * Since debugger commands can nest (i.e. one command can invoke another one) the setjmp()/longjmp() mechanism to restore the stack after a page fault in a command needs more than one jump buffer. * Added abort_debugger_command(), which longjmp()s out of the currently executed command. This will also abort the current pipe. * When pagination is enabled pressing "a" will abort the running command (as opposed to "q" which only disables the blue screen output, but lets the command continue). * Added debugger commands: - "grep" which can be used to filter output by pattern. Removed the "filter" command and the underlying mechanism that did that before. - "head" which prints only the first lines of output of another command. - "wc" counts lines, words, and characters of another command's output. Modified: haiku/trunk/headers/private/kernel/debug.h =================================================================== --- haiku/trunk/headers/private/kernel/debug.h 2008-05-31 21:01:05 UTC (rev 25743) +++ haiku/trunk/headers/private/kernel/debug.h 2008-06-01 02:25:00 UTC (rev 25744) @@ -42,7 +42,12 @@ # define ASSERT_PRINT(x, format...) do { } while(0) #endif +// command return value +#define B_KDEBUG_ERROR 4 + +// command flags #define B_KDEBUG_DONT_PARSE_ARGUMENTS (0x01) +#define B_KDEBUG_PIPE_FINAL_RERUN (0x02) struct debugger_module_info { module_info info; @@ -74,6 +79,9 @@ extern void debug_stop_screen_debug_output(void); extern void kputs(const char *string); +extern void kputs_unfiltered(const char *string); +extern void kprintf_unfiltered(const char *format, ...) + __attribute__ ((format (__printf__, 1, 2))); extern void dprintf_no_syslog(const char *format, ...) __attribute__ ((format (__printf__, 1, 2))); Modified: haiku/trunk/src/system/kernel/debug/Jamfile =================================================================== --- haiku/trunk/src/system/kernel/debug/Jamfile 2008-05-31 21:01:05 UTC (rev 25743) +++ haiku/trunk/src/system/kernel/debug/Jamfile 2008-06-01 02:25:00 UTC (rev 25744) @@ -6,6 +6,7 @@ KernelMergeObject kernel_debug.o : blue_screen.cpp debug.cpp + debug_builtin_commands.cpp debug_commands.cpp debug_paranoia.cpp debug_parser.cpp Modified: haiku/trunk/src/system/kernel/debug/blue_screen.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/blue_screen.cpp 2008-05-31 21:01:05 UTC (rev 25743) +++ haiku/trunk/src/system/kernel/debug/blue_screen.cpp 2008-06-01 02:25:00 UTC (rev 25744) @@ -121,7 +121,7 @@ // Use the paging mechanism: either, we're in the debugger, and a // command is being executed, or we're currently showing boot debug // output - const char *text = "Press key to continue, Q to quit"; + const char *text = "Press key to continue, Q to quit, A to abort"; int32 length = strlen(text); if (sScreen.x + length > sScreen.columns) { // make sure we don't overwrite too much @@ -136,8 +136,13 @@ } char c = blue_screen_getchar(); - if (c == 'q') + if (c == 'q') { sScreen.ignore_output = true; + } else if (c == 'a') { + abort_debugger_command(); + // should not return + sScreen.ignore_output = true; + } // remove on screen text again sModule->fill_glyph(sScreen.columns - length, sScreen.y, length, Modified: haiku/trunk/src/system/kernel/debug/debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug.cpp 2008-05-31 21:01:05 UTC (rev 25743) +++ haiku/trunk/src/system/kernel/debug/debug.cpp 2008-06-01 02:25:00 UTC (rev 25744) @@ -9,7 +9,6 @@ /*! This file contains the debugger and debug output facilities */ #include "blue_screen.h" -#include "gdb.h" #include #include @@ -35,7 +34,9 @@ #include #include +#include "debug_builtin_commands.h" #include "debug_commands.h" +#include "debug_output_filter.h" #include "debug_variables.h" @@ -67,6 +68,8 @@ #define OUTPUT_BUFFER_SIZE 1024 static char sOutputBuffer[OUTPUT_BUFFER_SIZE]; static char sLastOutputBuffer[OUTPUT_BUFFER_SIZE]; +static DebugOutputFilter* sDebugOutputFilter = NULL; +DefaultDebugOutputFilter gDefaultDebugOutputFilter; static void flush_pending_repeats(void); static void check_pending_repeats(void *data, int iter); @@ -84,22 +87,80 @@ static char sLineBuffer[HISTORY_SIZE][LINE_BUFFER_SIZE] = { "", }; static char sParseLine[LINE_BUFFER_SIZE]; -static char sFilter[64]; static int32 sCurrentLine = 0; #define distance(a, b) ((a) < (b) ? (b) - (a) : (a) - (b)) +// #pragma mark - DebugOutputFilter + + +DebugOutputFilter::DebugOutputFilter() +{ +} + + +DebugOutputFilter::~DebugOutputFilter() +{ +} + + +void +DebugOutputFilter::PrintString(const char* string) +{ +} + + +void +DebugOutputFilter::Print(const char* format, va_list args) +{ +} + + +void +DefaultDebugOutputFilter::PrintString(const char* string) +{ + if (sSerialDebugEnabled) + arch_debug_serial_puts(string); + if (sBlueScreenEnabled || sDebugScreenEnabled) + blue_screen_puts(string); + + for (uint32 i = 0; sSerialDebugEnabled && i < kMaxDebuggerModules; i++) { + if (sDebuggerModules[i] && sDebuggerModules[i]->debugger_puts) + sDebuggerModules[i]->debugger_puts(string, strlen(string)); + } +} + + +void +DefaultDebugOutputFilter::Print(const char* format, va_list args) +{ + vsnprintf(sOutputBuffer, OUTPUT_BUFFER_SIZE, format, args); + flush_pending_repeats(); + PrintString(sOutputBuffer); +} + + +// #pragma mark - + + +DebugOutputFilter* +set_debug_output_filter(DebugOutputFilter* filter) +{ + DebugOutputFilter* oldFilter = sDebugOutputFilter; + sDebugOutputFilter = filter; + return oldFilter; +} + + static void kputchar(char c) { - uint32 i; - if (sSerialDebugEnabled) arch_debug_serial_putchar(c); if (sBlueScreenEnabled || sDebugScreenEnabled) blue_screen_putchar(c); - for (i = 0; sSerialDebugEnabled && i < kMaxDebuggerModules; i++) + for (uint32 i = 0; sSerialDebugEnabled && i < kMaxDebuggerModules; i++) if (sDebuggerModules[i] && sDebuggerModules[i]->debugger_puts) sDebuggerModules[i]->debugger_puts(&c, sizeof(c)); } @@ -108,15 +169,15 @@ void kputs(const char *s) { - uint32 i; + if (sDebugOutputFilter != NULL) + sDebugOutputFilter->PrintString(s); +} - if (sSerialDebugEnabled) - arch_debug_serial_puts(s); - if (sBlueScreenEnabled || sDebugScreenEnabled) - blue_screen_puts(s); - for (i = 0; sSerialDebugEnabled && i < kMaxDebuggerModules; i++) - if (sDebuggerModules[i] && sDebuggerModules[i]->debugger_puts) - sDebuggerModules[i]->debugger_puts(s, strlen(s)); + +void +kputs_unfiltered(const char *s) +{ + gDefaultDebugOutputFilter.PrintString(s); } @@ -631,124 +692,17 @@ static int -cmd_reboot(int argc, char **argv) -{ - arch_cpu_shutdown(true); - return 0; - // I'll be really suprised if this line ever runs! ;-) -} - - -static int -cmd_shutdown(int argc, char **argv) -{ - arch_cpu_shutdown(false); - return 0; -} - - -static int -cmd_help(int argc, char **argv) -{ - debugger_command *command, *specified = NULL; - const char *start = NULL; - int32 startLength = 0; - bool ambiguous; - - if (argc > 1) { - specified = find_debugger_command(argv[1], false, ambiguous); - if (specified == NULL) { - start = argv[1]; - startLength = strlen(start); - } - } - - if (specified != NULL) { - // only print out the help of the specified command (and all of its aliases) - kprintf("debugger command for \"%s\" and aliases:\n", specified->name); - } else if (start != NULL) - kprintf("debugger commands starting with \"%s\":\n", start); - else - kprintf("debugger commands:\n"); - - for (command = get_debugger_commands(); command != NULL; - command = command->next) { - if (specified && command->func != specified->func) - continue; - if (start != NULL && strncmp(start, command->name, startLength)) - continue; - - kprintf(" %-20s\t\t%s\n", command->name, command->description ? command->description : "-"); - } - - return 0; -} - - -static int -cmd_continue(int argc, char **argv) -{ - return B_KDEBUG_QUIT; -} - - -static int cmd_dump_kdl_message(int argc, char **argv) { if (sCurrentKernelDebuggerMessage) { kputs(sCurrentKernelDebuggerMessage); - kputchar('\n'); + kputs("\n"); } return 0; } -static int -cmd_expr(int argc, char **argv) -{ - if (argc != 2) { - print_debugger_command_usage(argv[0]); - return 0; - } - uint64 result; - if (evaluate_debug_expression(argv[1], &result, false)) { - kprintf("%llu (0x%llx)\n", result, result); - set_debug_variable("_", result); - } - - return 0; -} - - -static int -cmd_filter(int argc, char **argv) -{ - if (argc != 2) { - sFilter[0] = '\0'; - return 0; - } - - strlcpy(sFilter, argv[1], sizeof(sFilter)); - return 0; -} - - -static int -cmd_error(int argc, char **argv) -{ - if (argc != 2) { - print_debugger_command_usage(argv[0]); - return 0; - } - - int32 error = parse_expression(argv[1]); - kprintf("error 0x%lx: %s\n", error, strerror(error)); - - return 0; -} - - static status_t syslog_sender(void *data) { @@ -1000,6 +954,8 @@ status_t debug_init(kernel_args *args) { + new(&gDefaultDebugOutputFilter) DefaultDebugOutputFilter; + debug_paranoia_init(); return arch_debug_console_init(args); } @@ -1008,44 +964,13 @@ status_t debug_init_post_vm(kernel_args *args) { - add_debugger_command_etc("help", &cmd_help, "List all debugger commands", - "[name]\n" - "Lists all debugger commands or those starting with \"name\".\n", 0); - add_debugger_command_etc("reboot", &cmd_reboot, "Reboot the system", - "\n" - "Reboots the system.\n", 0); - add_debugger_command_etc("shutdown", &cmd_shutdown, "Shut down the system", - "\n" - "Shuts down the system.\n", 0); - add_debugger_command_etc("gdb", &cmd_gdb, "Connect to remote gdb", - "\n" - "Connects to a remote gdb connected to the serial port.\n", 0); - add_debugger_command_etc("continue", &cmd_continue, "Leave kernel debugger", - "\n" - "Leaves kernel debugger.\n", 0); - add_debugger_command_alias("exit", "continue", "Same as \"continue\""); - add_debugger_command_alias("es", "continue", "Same as \"continue\""); add_debugger_command_etc("message", &cmd_dump_kdl_message, "Reprint the message printed when entering KDL", "\n" "Reprints the message printed when entering KDL.\n", 0); - add_debugger_command_etc("expr", &cmd_expr, - "Evaluates the given expression and prints the result", - "\n" - "Evaluates the given expression and prints the result.\n", - B_KDEBUG_DONT_PARSE_ARGUMENTS); - add_debugger_command_etc("filter", &cmd_filter, - "Filters output of all debugger commands", - "\n" - "Filters out all debug output of commands that does not match the\n" - "specified pattern. If no pattern is given, it is removed\n", 0); - add_debugger_command_etc("error", &cmd_error, - "Prints a human-readable description for an error code", - "\n" - "Prints a human-readable description for the given numeric error\n" - "code.\n" - " - The numeric error code.\n", 0); + debug_builtin_commands_init(); + debug_variables_init(); frame_buffer_console_init(args); arch_debug_console_init_settings(args); @@ -1181,6 +1106,8 @@ sBlueScreenEnabled = true; } + sDebugOutputFilter = &gDefaultDebugOutputFilter; + if (message) kprintf("PANIC: %s\n", message); @@ -1196,6 +1123,8 @@ call_modules_hook(false); set_dprintf_enabled(dprintfState); + sDebugOutputFilter = NULL; + sBlueScreenEnabled = false; atomic_add(&inDebugger, -1); restore_interrupts(state); @@ -1354,21 +1283,22 @@ void kprintf(const char *format, ...) { - va_list args; + if (sDebugOutputFilter != NULL) { + va_list args; + va_start(args, format); + sDebugOutputFilter->Print(format, args); + va_end(args); + } +} - // ToDo: don't print anything if the debugger is not running! +void +kprintf_unfiltered(const char *format, ...) +{ + va_list args; va_start(args, format); - vsnprintf(sOutputBuffer, OUTPUT_BUFFER_SIZE, format, args); + gDefaultDebugOutputFilter.Print(format, args); va_end(args); - - if (in_command_invocation() && sFilter[0]) { - if (strstr(sOutputBuffer, sFilter) == NULL) - return; - } - - flush_pending_repeats(); - kputs(sOutputBuffer); } Added: haiku/trunk/src/system/kernel/debug/debug_builtin_commands.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug_builtin_commands.cpp 2008-05-31 21:01:05 UTC (rev 25743) +++ haiku/trunk/src/system/kernel/debug/debug_builtin_commands.cpp 2008-06-01 02:25:00 UTC (rev 25744) @@ -0,0 +1,318 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de + * Copyright 2002-2008, Axel D?rfler, axeld at pinc-software.de + * Distributed under the terms of the MIT License. + * + * Copyright 2001, Travis Geiselbrecht. All rights reserved. + * Distributed under the terms of the NewOS License. + */ + +#include "debug_builtin_commands.h" + +#include +#include +#include + +#include "debug_commands.h" +#include "gdb.h" + + +static int +cmd_reboot(int argc, char **argv) +{ + arch_cpu_shutdown(true); + return 0; + // I'll be really suprised if this line ever runs! ;-) +} + + +static int +cmd_shutdown(int argc, char **argv) +{ + arch_cpu_shutdown(false); + return 0; +} + + +static int +cmd_help(int argc, char **argv) +{ + debugger_command *command, *specified = NULL; + const char *start = NULL; + int32 startLength = 0; + bool ambiguous; + + if (argc > 1) { + specified = find_debugger_command(argv[1], false, ambiguous); + if (specified == NULL) { + start = argv[1]; + startLength = strlen(start); + } + } + + if (specified != NULL) { + // only print out the help of the specified command (and all of its aliases) + kprintf("debugger command for \"%s\" and aliases:\n", specified->name); + } else if (start != NULL) + kprintf("debugger commands starting with \"%s\":\n", start); + else + kprintf("debugger commands:\n"); + + for (command = get_debugger_commands(); command != NULL; + command = command->next) { + if (specified && command->func != specified->func) + continue; + if (start != NULL && strncmp(start, command->name, startLength)) + continue; + + kprintf(" %-20s\t\t%s\n", command->name, command->description ? command->description : "-"); + } + + return 0; +} + + +static int +cmd_continue(int argc, char **argv) +{ + return B_KDEBUG_QUIT; +} + + +static int +cmd_expr(int argc, char **argv) +{ + if (argc != 2) { + print_debugger_command_usage(argv[0]); + return 0; + } + + uint64 result; + if (evaluate_debug_expression(argv[1], &result, false)) { + kprintf("%llu (0x%llx)\n", result, result); + set_debug_variable("_", result); + } + + return 0; +} + + +static int +cmd_error(int argc, char **argv) +{ + if (argc != 2) { + print_debugger_command_usage(argv[0]); + return 0; + } + + int32 error = parse_expression(argv[1]); + kprintf("error 0x%lx: %s\n", error, strerror(error)); + + return 0; +} + + +static int +cmd_head(int argc, char** argv) +{ + debugger_command_pipe_segment* segment + = get_current_debugger_command_pipe_segment(); + if (segment == NULL) { + kprintf_unfiltered("%s can only be run as part of a pipe!\n", argv[0]); + return B_KDEBUG_ERROR; + } + + struct user_data { + uint64 max_lines; + uint64 lines; + }; + user_data* userData = (user_data*)segment->user_data; + + if (segment->invocations == 0) { + if (argc != 3) { + print_debugger_command_usage(argv[0]); + return B_KDEBUG_ERROR; + } + + if (!evaluate_debug_expression(argv[1], &userData->max_lines, false)) + return B_KDEBUG_ERROR; + userData->lines = 0; + } + + if (++userData->lines <= userData->max_lines) { + kputs(argv[2]); + kputs("\n"); + } + + return 0; +} + + +static int +cmd_grep(int argc, char** argv) +{ + bool caseSensitive = true; + bool inverseMatch = false; + + int argi = 1; + for (; argi < argc; argi++) { + const char* arg = argv[argi]; + if (arg[0] != '-') + break; + + for (int32 i = 1; arg[i] != '\0'; i++) { + if (arg[i] == 'i') { + caseSensitive = false; + } else if (arg[i] == 'v') { + inverseMatch = true; + } else { + print_debugger_command_usage(argv[0]); + return B_KDEBUG_ERROR; + } + } + } + + if (argc - argi != 2) { + print_debugger_command_usage(argv[0]); + return B_KDEBUG_ERROR; + } + + const char* pattern = argv[argi++]; + const char* line = argv[argi++]; + + bool match; + if (caseSensitive) { + match = strstr(line, pattern) != NULL; + } else { + match = false; + int32 lineLen = strlen(line); + int32 patternLen = strlen(pattern); + for (int32 i = 0; i <= lineLen - patternLen; i++) { + // This is rather slow, but should be OK for our purposes. + if (strncasecmp(line + i, pattern, patternLen) == 0) { + match = true; + break; + } + } + } + + if (match != inverseMatch) { + kputs(line); + kputs("\n"); + } + + return 0; +} + + +static int +cmd_wc(int argc, char** argv) +{ + debugger_command_pipe_segment* segment + = get_current_debugger_command_pipe_segment(); + if (segment == NULL) { + kprintf_unfiltered("%s can only be run as part of a pipe!\n", argv[0]); + return B_KDEBUG_ERROR; + } + + struct user_data { + uint64 lines; + uint64 words; + uint64 chars; + }; + user_data* userData = (user_data*)segment->user_data; + + if (segment->invocations == 0) { + if (argc != 2) { + print_debugger_command_usage(argv[0]); + return B_KDEBUG_ERROR; + } + + userData->lines = 0; + userData->words = 0; + userData->chars = 0; + } + + const char* line = argv[1]; + if (line == NULL) { + // last run -- print results + kprintf("%10lld %10lld %10lld\n", userData->lines, userData->words, + userData->chars); + return 0; + } + + userData->lines++; + userData->chars++; + // newline + + // count words and chars in this line + bool inWord = false; + for (; *line != '\0'; line++) { + userData->chars++; + if ((isspace(*line) != 0) == inWord) { + inWord = !inWord; + if (inWord) + userData->words++; + } + } + + return 0; +} + + +// #pragma mark - + + +void +debug_builtin_commands_init() +{ + add_debugger_command_etc("help", &cmd_help, "List all debugger commands", + "[name]\n" + "Lists all debugger commands or those starting with \"name\".\n", 0); + add_debugger_command_etc("reboot", &cmd_reboot, "Reboot the system", + "\n" + "Reboots the system.\n", 0); + add_debugger_command_etc("shutdown", &cmd_shutdown, "Shut down the system", + "\n" + "Shuts down the system.\n", 0); + add_debugger_command_etc("gdb", &cmd_gdb, "Connect to remote gdb", + "\n" + "Connects to a remote gdb connected to the serial port.\n", 0); + add_debugger_command_etc("continue", &cmd_continue, "Leave kernel debugger", + "\n" + "Leaves kernel debugger.\n", 0); + add_debugger_command_alias("exit", "continue", "Same as \"continue\""); + add_debugger_command_alias("es", "continue", "Same as \"continue\""); + add_debugger_command_etc("expr", &cmd_expr, + "Evaluates the given expression and prints the result", + "\n" + "Evaluates the given expression and prints the result.\n", + B_KDEBUG_DONT_PARSE_ARGUMENTS); + add_debugger_command_etc("error", &cmd_error, + "Prints a human-readable description for an error code", + "\n" + "Prints a human-readable description for the given numeric error\n" + "code.\n" + " - The numeric error code.\n", 0); + add_debugger_command_etc("head", &cmd_head, + "Prints only the first lines of output from another command", + "\n" + "Should be used in a command pipe. It prints only the first\n" + " lines of output from the previous command in the pipe and\n" + "silently discards the rest of the output.\n", 0); + add_debugger_command_etc("grep", &cmd_grep, + "Filters output from another command", + "[ -i ] [ -v ] \n" + "Should be used in a command pipe. It filters all output from the\n" + "previous command in the pipe according to the given pattern.\n" + "When \"-v\" is specified, only those lines are printed that don't\n" + "match the given pattern, otherwise only those that do match. When\n" + "\"-i\" is specified, the pattern is matched case insensitive,\n" + "otherwise case sensitive.\n", 0); + add_debugger_command_etc("wc", &cmd_wc, + "Counts the lines, words, and characters of another command's output", + "\n" + "Should be used in a command pipe. It prints how many lines, words,\n" + "and characters the output of the previous command consists of.\n", + B_KDEBUG_PIPE_FINAL_RERUN); +} Added: haiku/trunk/src/system/kernel/debug/debug_builtin_commands.h =================================================================== --- haiku/trunk/src/system/kernel/debug/debug_builtin_commands.h 2008-05-31 21:01:05 UTC (rev 25743) +++ haiku/trunk/src/system/kernel/debug/debug_builtin_commands.h 2008-06-01 02:25:00 UTC (rev 25744) @@ -0,0 +1,20 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de + * Distributed under the terms of the MIT License. + */ +#ifndef _KERNEL_DEBUG_BUILTIN_COMMANDS_H +#define _KERNEL_DEBUG_BUILTIN_COMMANDS_H + + +#ifdef __cplusplus +extern "C" { +#endif + +void debug_builtin_commands_init(); + +#ifdef __cplusplus +} // extern "C" +#endif + + +#endif // _KERNEL_DEBUG_BUILTIN_COMMANDS_H Modified: haiku/trunk/src/system/kernel/debug/debug_commands.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug_commands.cpp 2008-05-31 21:01:05 UTC (rev 25743) +++ haiku/trunk/src/system/kernel/debug/debug_commands.cpp 2008-06-01 02:25:00 UTC (rev 25744) @@ -10,6 +10,7 @@ #include "debug_commands.h" #include +#include #include #include @@ -19,18 +20,174 @@ #include #include +#include "debug_output_filter.h" #include "debug_variables.h" +#define INVOKE_COMMAND_FAULT 1 +#define INVOKE_COMMAND_ERROR 2 + +static const int32 kMaxInvokeCommandDepth = 5; +static const int32 kOutputBufferSize = 1024; + static spinlock sSpinlock = 0; static struct debugger_command *sCommands; -static jmp_buf sInvokeCommandEnv; +static jmp_buf sInvokeCommandEnv[kMaxInvokeCommandDepth]; +static int32 sInvokeCommandLevel = 0; static bool sInvokeCommandDirectly = false; static bool sInCommand = false; +static char sOutputBuffers[MAX_DEBUGGER_COMMAND_PIPE_LENGTH][kOutputBufferSize]; +static debugger_command_pipe* sCurrentPipe; +static int32 sCurrentPipeSegment; +static int invoke_pipe_segment(debugger_command_pipe* pipe, int32 index, + char* argument); + + +class PipeDebugOutputFilter : public DebugOutputFilter { +public: + PipeDebugOutputFilter() + { + } + + PipeDebugOutputFilter(debugger_command_pipe* pipe, int32 segment, + char* buffer, size_t bufferSize) + : + fPipe(pipe), + fSegment(segment), + fBuffer(buffer), + fBufferCapacity(bufferSize - 1), + fBufferSize(0) + { + } + + virtual void PrintString(const char* string) + { + if (fPipe->broken) + return; + + size_t size = strlen(string); + while (const char* newLine = strchr(string, '\n')) { + size_t length = newLine - string; + _Append(string, length); + + // invoke command + fBuffer[fBufferSize] = '\0'; + invoke_pipe_segment(fPipe, fSegment + 1, fBuffer); + + fBufferSize = 0; + + string = newLine + 1; + size -= length + 1; + } + + _Append(string, size); + + if (fBufferSize == fBufferCapacity) { + // buffer is full, but contains no newline -- execute anyway + invoke_pipe_segment(fPipe, fSegment + 1, fBuffer); + fBufferSize = 0; + } + } + + virtual void Print(const char* format, va_list args) + { + if (fPipe->broken) + return; + + // print directly into the buffer + fBufferSize += vsnprintf(fBuffer + fBufferSize, + fBufferCapacity - fBufferSize, format, args); + + // execute every complete line + fBuffer[fBufferSize] = '\0'; + char* line = fBuffer; + + while (char* newLine = strchr(line, '\n')) { + // invoke command + *newLine = '\0'; + invoke_pipe_segment(fPipe, fSegment + 1, line); + + line = newLine + 1; + } + + size_t left = fBuffer + fBufferSize - line; + + if (left == fBufferCapacity) { + // buffer is full, but contains no newline -- execute anyway + invoke_pipe_segment(fPipe, fSegment + 1, fBuffer); + left = 0; + } + + if (left > 0) + memmove(fBuffer, line, left); + + fBufferSize = left; + } + +private: + void _Append(const char* string, size_t length) + { + size_t toAppend = min_c(length, fBufferCapacity - fBufferSize); + memcpy(fBuffer + fBufferSize, string, toAppend); + fBufferSize += length; + } + +private: + debugger_command_pipe* fPipe; + int32 fSegment; + char* fBuffer; + size_t fBufferCapacity; + size_t fBufferSize; +}; + + +static PipeDebugOutputFilter sPipeOutputFilters[ + MAX_DEBUGGER_COMMAND_PIPE_LENGTH - 1]; + + +static int +invoke_pipe_segment(debugger_command_pipe* pipe, int32 index, char* argument) +{ + // set debug output + DebugOutputFilter* oldFilter = set_debug_output_filter( + index == pipe->segment_count - 1 + ? &gDefaultDebugOutputFilter : &sPipeOutputFilters[index]); + + // set last command argument + debugger_command_pipe_segment& segment = pipe->segments[index]; + if (index > 0) + segment.argv[segment.argc - 1] = argument; + + // invoke command + int32 oldIndex = sCurrentPipeSegment; + sCurrentPipeSegment = index; + + int result = invoke_debugger_command(segment.command, segment.argc, + segment.argv); + segment.invocations++; + + sCurrentPipeSegment = oldIndex; + + // reset debug output + set_debug_output_filter(oldFilter); + + if (result == B_KDEBUG_ERROR) { + pipe->broken = true; + + // Abort the previous pipe segment execution. The complete pipe is + // aborted iteratively this way. + if (index > 0) + abort_debugger_command(); + } + + return result; +} + + debugger_command* next_debugger_command(debugger_command* command, const char* prefix, int prefixLen) { @@ -98,9 +255,10 @@ // intercept invocations with "--help" and directly print the usage text // If we know the command's usage text, intercept "--help" invocations // and print it directly. - if (argc == 2 && strcmp(argv[1], "--help") == 0 && command->usage != NULL) { - kprintf("usage: %s ", command->name); - kputs(command->usage); + if (argc == 2 && argv[1] != NULL && strcmp(argv[1], "--help") == 0 + && command->usage != NULL) { + kprintf_unfiltered("usage: %s ", command->name); + kputs_unfiltered(command->usage); return 0; } @@ -117,33 +275,99 @@ sInCommand = true; [... truncated: 458 lines follow ...] From anevilyak at mail.berlios.de Sun Jun 1 04:36:47 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sun, 1 Jun 2008 04:36:47 +0200 Subject: [Haiku-commits] r25745 - haiku/trunk/src/system/kernel/debug Message-ID: <200806010236.m512alRV026108@sheep.berlios.de> Author: anevilyak Date: 2008-06-01 04:36:47 +0200 (Sun, 01 Jun 2008) New Revision: 25745 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25745&view=rev Modified: haiku/trunk/src/system/kernel/debug/debug_commands.cpp Log: gcc4 build fix. Modified: haiku/trunk/src/system/kernel/debug/debug_commands.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug_commands.cpp 2008-06-01 02:25:00 UTC (rev 25744) +++ haiku/trunk/src/system/kernel/debug/debug_commands.cpp 2008-06-01 02:36:47 UTC (rev 25745) @@ -155,7 +155,7 @@ // set debug output DebugOutputFilter* oldFilter = set_debug_output_filter( index == pipe->segment_count - 1 - ? &gDefaultDebugOutputFilter : &sPipeOutputFilters[index]); + ? &gDefaultDebugOutputFilter : (DebugOutputFilter*)&sPipeOutputFilters[index]); // set last command argument debugger_command_pipe_segment& segment = pipe->segments[index]; From bonefish at mail.berlios.de Sun Jun 1 04:40:08 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 1 Jun 2008 04:40:08 +0200 Subject: [Haiku-commits] r25746 - haiku/trunk/src/system/kernel/debug Message-ID: <200806010240.m512e8vK026321@sheep.berlios.de> Author: bonefish Date: 2008-06-01 04:40:08 +0200 (Sun, 01 Jun 2008) New Revision: 25746 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25746&view=rev Modified: haiku/trunk/src/system/kernel/debug/debug_commands.cpp Log: Enforce 80 columns maximum line length. Modified: haiku/trunk/src/system/kernel/debug/debug_commands.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug_commands.cpp 2008-06-01 02:36:47 UTC (rev 25745) +++ haiku/trunk/src/system/kernel/debug/debug_commands.cpp 2008-06-01 02:40:08 UTC (rev 25746) @@ -155,7 +155,8 @@ // set debug output DebugOutputFilter* oldFilter = set_debug_output_filter( index == pipe->segment_count - 1 - ? &gDefaultDebugOutputFilter : (DebugOutputFilter*)&sPipeOutputFilters[index]); + ? &gDefaultDebugOutputFilter + : (DebugOutputFilter*)&sPipeOutputFilters[index]); // set last command argument debugger_command_pipe_segment& segment = pipe->segments[index]; @@ -189,7 +190,8 @@ debugger_command* -next_debugger_command(debugger_command* command, const char* prefix, int prefixLen) +next_debugger_command(debugger_command* command, const char* prefix, + int prefixLen) { if (command == NULL) command = sCommands; @@ -279,8 +281,8 @@ case 0: int result; thread->fault_handler = (addr_t)&&error; - // Fake goto to trick the compiler not to optimize the code at the label - // away. + // Fake goto to trick the compiler not to optimize the code at the + // label away. if (!thread) goto error; From anevilyak at gmail.com Sun Jun 1 04:43:13 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sat, 31 May 2008 21:43:13 -0500 Subject: [Haiku-commits] r25746 - haiku/trunk/src/system/kernel/debug In-Reply-To: <200806010240.m512e8vK026321@sheep.berlios.de> References: <200806010240.m512e8vK026321@sheep.berlios.de> Message-ID: On Sat, May 31, 2008 at 9:40 PM, bonefish at BerliOS wrote: > Author: bonefish > Date: 2008-06-01 04:40:08 +0200 (Sun, 01 Jun 2008) > New Revision: 25746 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25746&view=rev > > Modified: > haiku/trunk/src/system/kernel/debug/debug_commands.cpp > Log: > Enforce 80 columns maximum line length. > > Whoops, forgot about that sorry. Regards, Rene From axeld at mail.berlios.de Sun Jun 1 12:53:11 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 1 Jun 2008 12:53:11 +0200 Subject: [Haiku-commits] r25747 - haiku/trunk/src/system/kernel/vm Message-ID: <200806011053.m51ArBcA015477@sheep.berlios.de> Author: axeld Date: 2008-06-01 12:53:10 +0200 (Sun, 01 Jun 2008) New Revision: 25747 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25747&view=rev Modified: haiku/trunk/src/system/kernel/vm/vm_page.cpp Log: * vm_cache::virtual_size is not always a multiple of B_PAGE_SIZE for files. In these cases, the last partial page would have never been written back. * This fixes bug #2282, and eventually others. Modified: haiku/trunk/src/system/kernel/vm/vm_page.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_page.cpp 2008-06-01 02:40:08 UTC (rev 25746) +++ haiku/trunk/src/system/kernel/vm/vm_page.cpp 2008-06-01 10:53:10 UTC (rev 25747) @@ -1398,7 +1398,7 @@ vm_page_write_modified_pages(vm_cache *cache, bool fsReenter) { return vm_page_write_modified_page_range(cache, 0, - cache->virtual_size >> PAGE_SHIFT, fsReenter); + (cache->virtual_size + B_PAGE_SIZE - 1) >> PAGE_SHIFT, fsReenter); } From korli at mail.berlios.de Sun Jun 1 17:27:01 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 1 Jun 2008 17:27:01 +0200 Subject: [Haiku-commits] r25748 - haiku/trunk/src/system/kernel/device_manager Message-ID: <200806011527.m51FR0h8026142@sheep.berlios.de> Author: korli Date: 2008-06-01 17:27:00 +0200 (Sun, 01 Jun 2008) New Revision: 25748 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25748&view=rev Modified: haiku/trunk/src/system/kernel/device_manager/io_resources.cpp Log: when acquiring results in an error, the resource should be reset to avoid a crash on delete Modified: haiku/trunk/src/system/kernel/device_manager/io_resources.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/io_resources.cpp 2008-06-01 10:53:10 UTC (rev 25747) +++ haiku/trunk/src/system/kernel/device_manager/io_resources.cpp 2008-06-01 15:27:00 UTC (rev 25748) @@ -89,6 +89,7 @@ // This range is already covered by someone else // TODO: we might want to ignore resources that belong to // a node that isn't used. + _Init(); return B_RESOURCE_UNAVAILABLE; } } From anevilyak at mail.berlios.de Sun Jun 1 18:16:10 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sun, 1 Jun 2008 18:16:10 +0200 Subject: [Haiku-commits] r25749 - haiku/trunk/src/add-ons/accelerants/common Message-ID: <200806011616.m51GGAh0030019@sheep.berlios.de> Author: anevilyak Date: 2008-06-01 18:16:10 +0200 (Sun, 01 Jun 2008) New Revision: 25749 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25749&view=rev Modified: haiku/trunk/src/add-ons/accelerants/common/i2c.c Log: Fix I2C tracing, style cleanups. Modified: haiku/trunk/src/add-ons/accelerants/common/i2c.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/common/i2c.c 2008-06-01 15:27:00 UTC (rev 25748) +++ haiku/trunk/src/add-ons/accelerants/common/i2c.c 2008-06-01 16:16:10 UTC (rev 25749) @@ -12,11 +12,14 @@ #include #include +#include - //#define TRACE_I2C #ifdef TRACE_I2C -extern "C" void _sPrintf(const char *format, ...); +#ifdef __cplusplus +extern "C" +#endif +void _sPrintf(const char *format, ...); # define TRACE(x...) _sPrintf("I2C: " x) #else # define TRACE(x...) ; @@ -25,45 +28,45 @@ //! Timining for 100kHz bus (fractional parts are rounded up) const static i2c_timing kTiming100k = { - buf : 5, - hd_sta : 4, - low : 5, - high : 4, - su_sta : 5, - hd_dat : 0, - su_dat : 1, - r : 1, - f : 1, - su_sto : 4, + .buf = 5, + .hd_sta = 4, + .low = 5, + .high = 4, + .su_sta = 5, + .hd_dat = 0, + .su_dat = 1, + .r = 1, + .f = 1, + .su_sto = 4, // as these are unspecified, we use half a clock cycle as a safe guess - start_timeout : 5, - byte_timeout : 5, - bit_timeout : 5, - ack_start_timeout : 5, - ack_timeout : 5 + .start_timeout = 5, + .byte_timeout = 5, + .bit_timeout = 5, + .ack_start_timeout = 5, + .ack_timeout = 5 }; // timing for 400 kHz bus // (argh! heavy up-rounding here) const static i2c_timing kTiming400k = { - buf : 2, - hd_sta : 1, - low : 2, - high : 1, - su_sta : 1, - hd_dat : 0, - su_dat : 1, - r : 1, - f : 1, - su_sto : 1, + .buf = 2, + .hd_sta = 1, + .low = 2, + .high = 1, + .su_sta = 1, + .hd_dat = 0, + .su_dat = 1, + .r = 1, + .f = 1, + .su_sto = 1, // see kTiming100k - start_timeout : 2, - byte_timeout : 2, - bit_timeout : 2, - ack_start_timeout : 2, - ack_timeout : 2 + .start_timeout = 2, + .byte_timeout = 2, + .bit_timeout = 2, + .ack_start_timeout = 2, + .ack_timeout = 2 }; @@ -215,7 +218,8 @@ break; if (system_time() - startTime > bus->timing.ack_timeout) { - TRACE("send_acknowledge(): Slave didn't acknowledge byte\n"); + TRACE("send_acknowledge(): Slave didn't acknowledge byte within ack_timeout: %ld\n", + bus->timing.ack_timeout); return B_TIMEOUT; } @@ -372,7 +376,7 @@ static status_t receive_bytes(const i2c_bus *bus, uint8 *readBuffer, ssize_t readLength) { - TRACE("receive_bytes(length = %ld)\n", writeLength); + TRACE("receive_bytes(length = %ld)\n", readLength); for (; readLength > 0; --readLength, ++readBuffer) { status_t status = receive_byte(bus, readBuffer, readLength > 1); @@ -428,12 +432,12 @@ void i2c_get100k_timing(i2c_timing *timing) { - *timing = kTiming100k; + memcpy(timing, &kTiming100k, sizeof(i2c_timing)); } void i2c_get400k_timing(i2c_timing *timing) { - *timing = kTiming400k; + memcpy(timing, &kTiming400k, sizeof(i2c_timing)); } From axeld at mail.berlios.de Sun Jun 1 20:47:20 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 1 Jun 2008 20:47:20 +0200 Subject: [Haiku-commits] r25750 - haiku/trunk/src/system/kernel/fs Message-ID: <200806011847.m51IlJ1h004034@sheep.berlios.de> Author: axeld Date: 2008-06-01 20:47:18 +0200 (Sun, 01 Jun 2008) New Revision: 25750 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25750&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: * Fixed an endless loop when using vfs_get_vnode_name() or the "wrong" get_vnode_name() variant. Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-06-01 16:16:10 UTC (rev 25749) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-06-01 18:47:18 UTC (rev 25750) @@ -2256,7 +2256,7 @@ char buffer[sizeof(struct dirent) + B_FILE_NAME_LENGTH]; struct dirent *dirent = (struct dirent *)buffer; - status_t status = get_vnode_name(vnode, parent, buffer, sizeof(buffer), + status_t status = get_vnode_name(vnode, parent, dirent, sizeof(buffer), get_current_io_context(kernel)); if (status != B_OK) return status; From stippi at mail.berlios.de Sun Jun 1 23:18:08 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 1 Jun 2008 23:18:08 +0200 Subject: [Haiku-commits] r25751 - haiku/trunk/build/jam Message-ID: <200806012118.m51LI8rc014485@sheep.berlios.de> Author: stippi Date: 2008-06-01 23:18:08 +0200 (Sun, 01 Jun 2008) New Revision: 25751 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25751&view=rev Modified: haiku/trunk/build/jam/OptionalPackages Log: Fix the link target for Beam. Note that the R5 version cannot retrieve mails either, it just hangs there trying ot connect and eventually times out. Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2008-06-01 18:47:18 UTC (rev 25750) +++ haiku/trunk/build/jam/OptionalPackages 2008-06-01 21:18:08 UTC (rev 25751) @@ -79,7 +79,8 @@ : apps ; AddSymlinkToHaikuImage home config be Applications - : /boot/apps/beam-1-1-bone-with-libs/Beam ; +# : /boot/apps/beam-1-1-2-bone-with-libs/Beam ; + : /boot/apps/beam-1-1-2-r5-with-libs/Beam ; } } From superstippi at gmx.de Sun Jun 1 23:28:17 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 01 Jun 2008 23:28:17 +0200 Subject: [Haiku-commits] r25704 - in haiku/trunk: headers/private/kernel src/system/kernel In-Reply-To: <200805291428.m4TESWbm013921@sheep.berlios.de> References: <200805291428.m4TESWbm013921@sheep.berlios.de> Message-ID: <20080601232817.3675.1@stippis2.1212350472.fake> bonefish at BerliOS wrote: > Author: bonefish > Date: 2008-05-29 16:28:31 +0200 (Thu, 29 May 2008) New Revision: 25704 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25704&view=rev > > Modified: > haiku/trunk/headers/private/kernel/thread_types.h > haiku/trunk/src/system/kernel/scheduler.cpp > haiku/trunk/src/system/kernel/thread.cpp > Log: > Added new kernel thread "undertaker" which gets rid of dead thread > remains. This replaces the previous mechanism of switching the thread to > a dedicated death stack. We might consider moving more cleanup work to > the undertaker, but that seems a little more involved. This change seems ot exhibit some problems. Crashed or killed teams remain in the kernel for much longer, it appears. I have one crashed app which just sits there: I have just booted Haiku r25750 and saw the "black interface in some apps" bug again with LaunchBox. Eventually I killed it, but the pad window stayed on the screen. The LaunchBox team was gone. Just when I examined this with ProcessController, the window suddenly disappeared. Later I started Beam to check out whether the R5 version can download mails, but unfortunately not. When I closed it, it crashed in some liblayout stuff with corrupt memory (an allocator assert was triggered). But after I quit the gdb, the Jobs window remained on screen. "Beam" is still part of the kernel team now even after several minutes. Hope this info is somehow useful. Best regards, -Stephan From bonefish at mail.berlios.de Mon Jun 2 04:04:18 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 2 Jun 2008 04:04:18 +0200 Subject: [Haiku-commits] r25752 - in haiku/trunk: headers/os/drivers headers/private/kernel headers/private/system src/add-ons/kernel/bus_managers/ide src/add-ons/kernel/bus_managers/pci/arch/x86 src/add-ons/kernel/bus_managers/ps2 src/add-ons/kernel/bus_managers/scsi src/add-ons/kernel/busses/scsi/ahci src/add-ons/kernel/busses/usb src/add-ons/kernel/drivers/audio/ac97/auich src/add-ons/kernel/drivers/audio/ac97/auvia src/add-ons/kernel/drivers/audio/emuxki src/add-ons/kernel/drivers/graphics/radeon src/add-ons/kernel/drivers/network/rtl8169 src/add-ons/kernel/generic/dpc src/add-ons/kernel/generic/mpu401 src/libs/compat/freebsd_network src/system/kernel src/system/kernel/arch/m68k src/system/kernel/arch/x86 src/system/kernel/debug Message-ID: <200806020204.m5224IeL027525@sheep.berlios.de> Author: bonefish Date: 2008-06-02 04:04:12 +0200 (Mon, 02 Jun 2008) New Revision: 25752 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25752&view=rev Added: haiku/trunk/headers/private/system/spinlock_contention.h Modified: haiku/trunk/headers/os/drivers/KernelExport.h haiku/trunk/headers/private/kernel/smp.h haiku/trunk/src/add-ons/kernel/bus_managers/ide/ide_sim.c haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_controller.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/packet_buffer.cpp haiku/trunk/src/add-ons/kernel/bus_managers/scsi/scsi_lock.h haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/util.c haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/util.c haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/util.c haiku/trunk/src/add-ons/kernel/drivers/graphics/radeon/irq.c haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/device.c haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/timer.c haiku/trunk/src/add-ons/kernel/generic/dpc/dpc.c haiku/trunk/src/add-ons/kernel/generic/mpu401/mpu401.c haiku/trunk/src/libs/compat/freebsd_network/taskqueue.c haiku/trunk/src/system/kernel/arch/m68k/arch_vm_translation_map_impl.cpp haiku/trunk/src/system/kernel/arch/x86/arch_debug_console.c haiku/trunk/src/system/kernel/arch/x86/arch_vm_translation_map.cpp haiku/trunk/src/system/kernel/debug/debug.cpp haiku/trunk/src/system/kernel/debug/debug_commands.cpp haiku/trunk/src/system/kernel/debug/user_debugger.cpp haiku/trunk/src/system/kernel/int.c haiku/trunk/src/system/kernel/main.cpp haiku/trunk/src/system/kernel/port.cpp haiku/trunk/src/system/kernel/sem.cpp haiku/trunk/src/system/kernel/smp.c haiku/trunk/src/system/kernel/team.cpp haiku/trunk/src/system/kernel/thread.cpp Log: * Added optional spinlock contention measurement feature. Enabled when B_DEBUG_SPINLOCK_CONTENTION is defined to 1. It typedefs spinlock to a structure (thus breaking BeOS binary compatibility), containing a counter which is incremented whenever a thread has to wait for the spinlock. * Added macros for spinlock initialization and access and changed code using spinlocks accordingly. This breaks compilation for BeOS -- the macros should be defined in the respective compatibility wrappers. * Added generic syscall to get the spinlock counters for the thread and the team spinlocks. Modified: haiku/trunk/headers/os/drivers/KernelExport.h =================================================================== --- haiku/trunk/headers/os/drivers/KernelExport.h 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/headers/os/drivers/KernelExport.h 2008-06-02 02:04:12 UTC (rev 25752) @@ -13,8 +13,33 @@ /* interrupts and spinlocks */ typedef ulong cpu_status; -typedef vint32 spinlock; +// WARNING: For Haiku debugging only! This changes the spinlock type in a +// binary incompatible way! +//#define B_DEBUG_SPINLOCK_CONTENTION 1 + +#if B_DEBUG_SPINLOCK_CONTENTION + typedef struct { + vint32 lock; + vint32 count_low; + vint32 count_high; + } spinlock; + +# define B_SPINLOCK_INITIALIZER { 0, 0, 0 } +# define B_INITIALIZE_SPINLOCK(spinlock) do { \ + (spinlock)->lock = 0; \ + (spinlock)->count_low = 0; \ + (spinlock)->count_high = 0; \ + } while (false) +# define B_SPINLOCK_IS_LOCKED(spinlock) ((spinlock)->lock > 0) +#else + typedef vint32 spinlock; + +# define B_SPINLOCK_INITIALIZER 0 +# define B_INITIALIZE_SPINLOCK(lock) do { *(lock) = 0; } while (false) +# define B_SPINLOCK_IS_LOCKED(lock) (*(lock) > 0) +#endif + /* interrupt handling support for device drivers */ typedef int32 (*interrupt_handler)(void *data); Modified: haiku/trunk/headers/private/kernel/smp.h =================================================================== --- haiku/trunk/headers/private/kernel/smp.h 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/headers/private/kernel/smp.h 2008-06-02 02:04:12 UTC (rev 25752) @@ -40,6 +40,7 @@ status_t smp_init(struct kernel_args *args); status_t smp_per_cpu_init(struct kernel_args *args, int32 cpu); +status_t smp_init_post_generic_syscalls(void); bool smp_trap_non_boot_cpus(int32 cpu); void smp_wake_up_non_boot_cpus(void); void smp_cpu_rendezvous(volatile uint32 *var, int current_cpu); Added: haiku/trunk/headers/private/system/spinlock_contention.h =================================================================== --- haiku/trunk/headers/private/system/spinlock_contention.h 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/headers/private/system/spinlock_contention.h 2008-06-02 02:04:12 UTC (rev 25752) @@ -0,0 +1,21 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef _SYSTEM_SPINLOCK_CONTENTION_H +#define _SYSTEM_SPINLOCK_CONTENTION_H + +#include + + +#define SPINLOCK_CONTENTION "spinlock contention" +#define GET_SPINLOCK_CONTENTION_INFO 0x01 + + +typedef struct spinlock_contention_info { + uint64 thread_spinlock_counter; + uint64 team_spinlock_counter; +} spinlock_contention_info; + + +#endif /* _SYSTEM_SPINLOCK_CONTENTION_H */ Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ide/ide_sim.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ide/ide_sim.c 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ide/ide_sim.c 2008-06-02 02:04:12 UTC (rev 25752) @@ -521,7 +521,7 @@ memset(bus, 0, sizeof(*bus)); bus->node = node; - bus->lock = 0; + B_INITIALIZE_SPINLOCK(&bus->lock); bus->num_running_reqs = 0; bus->active_qrequest = NULL; bus->disconnected = false; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_controller.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_controller.c 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_controller.c 2008-06-02 02:04:12 UTC (rev 25752) @@ -32,7 +32,7 @@ restore_interrupts(cpu_status); \ } -spinlock sConfigLock = 0; +spinlock sConfigLock = B_SPINLOCK_INITIALIZER; static status_t pci_mech1_read_config(void *cookie, uint8 bus, uint8 device, uint8 function, Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/packet_buffer.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/packet_buffer.cpp 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/packet_buffer.cpp 2008-06-02 02:04:12 UTC (rev 25752) @@ -40,7 +40,7 @@ free(buffer); return NULL; } - buffer->lock = 0; + B_INITIALIZE_SPINLOCK(&buffer->lock); return buffer; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/scsi/scsi_lock.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/scsi/scsi_lock.h 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/add-ons/kernel/bus_managers/scsi/scsi_lock.h 2008-06-02 02:04:12 UTC (rev 25752) @@ -29,7 +29,7 @@ static inline void spinlock_irq_init(spinlock_irq *lock) { - lock->lock = 0; + B_INITIALIZE_SPINLOCK(&lock->lock); } static inline void Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp 2008-06-02 02:04:12 UTC (rev 25752) @@ -30,7 +30,6 @@ , fIndex(index) , fRegs(&controller->fRegs->port[index]) , fArea(-1) - , fSpinlock(0) , fCommandsActive(0) , fRequestSem(-1) , fResponseSem(-1) @@ -42,6 +41,7 @@ , fResetPort(false) , fError(false) { + B_INITIALIZE_SPINLOCK(&fSpinlock); fRequestSem = create_sem(1, "ahci request"); fResponseSem = create_sem(0, "ahci response"); } Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2008-06-02 02:04:12 UTC (rev 25752) @@ -782,7 +782,7 @@ int32 EHCI::Interrupt() { - static spinlock lock = 0; + static spinlock lock = B_SPINLOCK_INITIALIZER; acquire_spinlock(&lock); // check if any interrupt was generated Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp 2008-06-02 02:04:12 UTC (rev 25752) @@ -694,7 +694,7 @@ int32 OHCI::_Interrupt() { - static spinlock lock = 0; + static spinlock lock = B_SPINLOCK_INITIALIZER; acquire_spinlock(&lock); uint32 status = 0; Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2008-06-02 02:04:12 UTC (rev 25752) @@ -1531,7 +1531,7 @@ int32 UHCI::Interrupt() { - static spinlock lock = 0; + static spinlock lock = B_SPINLOCK_INITIALIZER; acquire_spinlock(&lock); // Check if we really had an interrupt Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/util.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/util.c 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/util.c 2008-06-02 02:04:12 UTC (rev 25752) @@ -34,7 +34,7 @@ #include "debug.h" #include "util.h" -spinlock slock = 0; +spinlock slock = B_SPINLOCK_INITIALIZER; uint32 round_to_pagesize(uint32 size); Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/util.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/util.c 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/util.c 2008-06-02 02:04:12 UTC (rev 25752) @@ -34,7 +34,7 @@ #include "debug.h" #include "util.h" -spinlock slock = 0; +spinlock slock = B_SPINLOCK_INITIALIZER; uint32 round_to_pagesize(uint32 size); Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/util.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/util.c 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/util.c 2008-06-02 02:04:12 UTC (rev 25752) @@ -34,7 +34,7 @@ #include "debug.h" #include "util.h" -spinlock slock = 0; +spinlock slock = B_SPINLOCK_INITIALIZER; uint32 round_to_pagesize(uint32 size); Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/radeon/irq.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/radeon/irq.c 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/radeon/irq.c 2008-06-02 02:04:12 UTC (rev 25752) @@ -237,7 +237,7 @@ goto err3; } - di->cap_spinlock = 0; + B_INITIALIZE_SPINLOCK(&di->cap_spinlock); sprintf(buffer, "%04X_%04X_%02X%02X%02X DMA I", di->pcii.vendor_id, di->pcii.device_id, Modified: haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/device.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/device.c 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/device.c 2008-06-02 02:04:12 UTC (rev 25752) @@ -467,7 +467,7 @@ read_settings(device); device->rxBuf = (void **)malloc(sizeof(void *) * device->rxBufferCount); - device->rxSpinlock = 0; + B_INITIALIZE_SPINLOCK(&device->rxSpinlock); device->rxNextIndex = 0; device->rxIntIndex = 0; device->rxFree = device->rxBufferCount; @@ -475,7 +475,7 @@ set_sem_owner(device->rxReadySem, B_SYSTEM_TEAM); device->txBuf = (void **)malloc(sizeof(void *) * device->txBufferCount); - device->txSpinlock = 0; + B_INITIALIZE_SPINLOCK(&device->txSpinlock); device->txNextIndex = 0; device->txIntIndex = 0; device->txUsed = 0; Modified: haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/timer.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/timer.c 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/timer.c 2008-06-02 02:04:12 UTC (rev 25752) @@ -187,7 +187,7 @@ { sTimerCount = 0; sTimerNextId = 1; - sTimerSpinlock = 0; + B_INITIALIZE_SPINLOCK(&sTimerSpinlock); sTimerThread = spawn_kernel_thread(timer_thread, "rtl8169 timer", 80, 0); sTimerSem = create_sem(0, "rtl8169 timer"); Modified: haiku/trunk/src/add-ons/kernel/generic/dpc/dpc.c =================================================================== --- haiku/trunk/src/add-ons/kernel/generic/dpc/dpc.c 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/add-ons/kernel/generic/dpc/dpc.c 2008-06-02 02:04:12 UTC (rev 25752) @@ -91,7 +91,7 @@ queue->head = queue->tail = 0; queue->size = DPC_QUEUE_SIZE; queue->count = 0; - queue->lock = 0; // Init the spinlock + B_INITIALIZE_SPINLOCK(&queue->lock); // Init the spinlock #ifdef __HAIKU__ snprintf(str, sizeof(str), "%.*s_wakeup_sem", Modified: haiku/trunk/src/add-ons/kernel/generic/mpu401/mpu401.c =================================================================== --- haiku/trunk/src/add-ons/kernel/generic/mpu401/mpu401.c 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/add-ons/kernel/generic/mpu401/mpu401.c 2008-06-02 02:04:12 UTC (rev 25752) @@ -480,7 +480,7 @@ NULL }; -spinlock locked = 0; +spinlock locked = B_SPINLOCK_INITIALIZER; cpu_status lock(void) { Modified: haiku/trunk/src/libs/compat/freebsd_network/taskqueue.c =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/taskqueue.c 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/libs/compat/freebsd_network/taskqueue.c 2008-06-02 02:04:12 UTC (rev 25752) @@ -20,7 +20,7 @@ taskqueue_enqueue_fn tq_enqueue; void *tq_arg; int tq_fast; - int32 tq_spinlock; + spinlock tq_spinlock; sem_id tq_sem; thread_id *tq_threads; thread_id tq_thread_storage; @@ -43,7 +43,7 @@ tq->tq_fast = fast; if (fast) { - tq->tq_spinlock = 0; + B_INITIALIZE_SPINLOCK(&tq->tq_spinlock); } else { mutex_init_etc(&tq->tq_mutex, name, MUTEX_FLAG_CLONE_NAME); } Modified: haiku/trunk/src/system/kernel/arch/m68k/arch_vm_translation_map_impl.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/m68k/arch_vm_translation_map_impl.cpp 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/system/kernel/arch/m68k/arch_vm_translation_map_impl.cpp 2008-06-02 02:04:12 UTC (rev 25752) @@ -1180,7 +1180,7 @@ sQueryDesc.type = DT_INVALID; - tmap_list_lock = 0; + B_INITIALIZE_SPINLOCK(&tmap_list_lock); tmap_list = NULL; // allocate some space to hold physical page mapping info Modified: haiku/trunk/src/system/kernel/arch/x86/arch_debug_console.c =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_debug_console.c 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/system/kernel/arch/x86/arch_debug_console.c 2008-06-02 02:04:12 UTC (rev 25752) @@ -99,7 +99,7 @@ static bool sBochsOutput = false; #endif -static spinlock sSerialOutputSpinlock = 0; +static spinlock sSerialOutputSpinlock = B_SPINLOCK_INITIALIZER; static void Modified: haiku/trunk/src/system/kernel/arch/x86/arch_vm_translation_map.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_vm_translation_map.cpp 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/system/kernel/arch/x86/arch_vm_translation_map.cpp 2008-06-02 02:04:12 UTC (rev 25752) @@ -852,7 +852,7 @@ sKernelPhysicalPageDirectory = (page_directory_entry *)args->arch_args.phys_pgdir; sKernelVirtualPageDirectory = (page_directory_entry *)args->arch_args.vir_pgdir; - tmap_list_lock = 0; + B_INITIALIZE_SPINLOCK(&tmap_list_lock); tmap_list = NULL; // allocate some space to hold physical page mapping info Modified: haiku/trunk/src/system/kernel/debug/debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug.cpp 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/system/kernel/debug/debug.cpp 2008-06-02 02:04:12 UTC (rev 25752) @@ -54,7 +54,7 @@ // must always be false on startup static bool sDebugScreenEnabled = false; static bool sBlueScreenOutput = true; -static spinlock sSpinlock = 0; +static spinlock sSpinlock = B_SPINLOCK_INITIALIZER; static int32 sDebuggerOnCPU = -1; static sem_id sSyslogNotify = -1; Modified: haiku/trunk/src/system/kernel/debug/debug_commands.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug_commands.cpp 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/system/kernel/debug/debug_commands.cpp 2008-06-02 02:04:12 UTC (rev 25752) @@ -30,7 +30,7 @@ static const int32 kMaxInvokeCommandDepth = 5; static const int32 kOutputBufferSize = 1024; -static spinlock sSpinlock = 0; +static spinlock sSpinlock = B_SPINLOCK_INITIALIZER; static struct debugger_command *sCommands; Modified: haiku/trunk/src/system/kernel/debug/user_debugger.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/user_debugger.cpp 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/system/kernel/debug/user_debugger.cpp 2008-06-02 02:04:12 UTC (rev 25752) @@ -219,7 +219,7 @@ info->debugger_write_lock = -1; if (initLock) - info->lock = 0; + B_INITIALIZE_SPINLOCK(&info->lock); } } Modified: haiku/trunk/src/system/kernel/int.c =================================================================== --- haiku/trunk/src/system/kernel/int.c 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/system/kernel/int.c 2008-06-02 02:04:12 UTC (rev 25752) @@ -62,7 +62,7 @@ for (i = 0; i < NUM_IO_VECTORS; i++) { struct io_handler *io; - if (sVectors[i].vector_lock == 0 + if (!B_SPINLOCK_IS_LOCKED(&sVectors[i].vector_lock) && sVectors[i].enable_count == 0 && sVectors[i].handled_count == 0 && sVectors[i].unhandled_count == 0 @@ -72,7 +72,7 @@ kprintf("int %3d, enabled %ld, handled %8lld, unhandled %8lld%s%s\n", i, sVectors[i].enable_count, sVectors[i].handled_count, sVectors[i].unhandled_count, - sVectors[i].vector_lock != 0 ? ", ACTIVE" : "", + B_SPINLOCK_IS_LOCKED(&sVectors[i].vector_lock) ? ", ACTIVE" : "", sVectors[i].handler_list.next == &sVectors[i].handler_list ? ", no handler" : ""); @@ -114,7 +114,7 @@ /* initialize the vector list */ for (i = 0; i < NUM_IO_VECTORS; i++) { - sVectors[i].vector_lock = 0; /* initialize spinlock */ + B_INITIALIZE_SPINLOCK(&sVectors[i].vector_lock); sVectors[i].enable_count = 0; sVectors[i].no_lock_vector = false; #ifdef DEBUG_INT Modified: haiku/trunk/src/system/kernel/main.cpp =================================================================== --- haiku/trunk/src/system/kernel/main.cpp 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/system/kernel/main.cpp 2008-06-02 02:04:12 UTC (rev 25752) @@ -160,6 +160,7 @@ driver_settings_init_post_sem(&sKernelArgs); TRACE("init generic syscall\n"); generic_syscall_init(); + smp_init_post_generic_syscalls(); TRACE("init cbuf\n"); cbuf_init(); TRACE("init teams\n"); Modified: haiku/trunk/src/system/kernel/port.cpp =================================================================== --- haiku/trunk/src/system/kernel/port.cpp 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/system/kernel/port.cpp 2008-06-02 02:04:12 UTC (rev 25752) @@ -72,7 +72,7 @@ static port_id sNextPort = 1; static int32 sFirstFreeSlot = 1; -static spinlock sPortSpinlock = 0; +static spinlock sPortSpinlock = B_SPINLOCK_INITIALIZER; #define GRAB_PORT_LIST_LOCK() acquire_spinlock(&sPortSpinlock) #define RELEASE_PORT_LIST_LOCK() release_spinlock(&sPortSpinlock) Modified: haiku/trunk/src/system/kernel/sem.cpp =================================================================== --- haiku/trunk/src/system/kernel/sem.cpp 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/system/kernel/sem.cpp 2008-06-02 02:04:12 UTC (rev 25752) @@ -108,7 +108,7 @@ static struct sem_entry *sFreeSemsHead = NULL; static struct sem_entry *sFreeSemsTail = NULL; -static spinlock sem_spinlock = 0; +static spinlock sem_spinlock = B_SPINLOCK_INITIALIZER; #define GRAB_SEM_LIST_LOCK() acquire_spinlock(&sem_spinlock) #define RELEASE_SEM_LIST_LOCK() release_spinlock(&sem_spinlock) #define GRAB_SEM_LOCK(s) acquire_spinlock(&(s).lock) Modified: haiku/trunk/src/system/kernel/smp.c =================================================================== --- haiku/trunk/src/system/kernel/smp.c 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/system/kernel/smp.c 2008-06-02 02:04:12 UTC (rev 25752) @@ -8,18 +8,22 @@ /* Functionality for symetrical multi-processors */ -#include -#include #include -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + #define DEBUG_SPINLOCKS 1 //#define TRACE_SMP @@ -53,17 +57,17 @@ #define MAILBOX_LOCAL 1 #define MAILBOX_BCAST 2 -static spinlock boot_cpu_spin[SMP_MAX_CPUS] = { 0, }; +static spinlock boot_cpu_spin[SMP_MAX_CPUS] = { }; static struct smp_msg *free_msgs = NULL; static volatile int free_msg_count = 0; -static spinlock free_msg_spinlock = 0; +static spinlock free_msg_spinlock = B_SPINLOCK_INITIALIZER; static struct smp_msg *smp_msgs[SMP_MAX_CPUS] = { NULL, }; -static spinlock cpu_msg_spinlock[SMP_MAX_CPUS] = { 0, }; +static spinlock cpu_msg_spinlock[SMP_MAX_CPUS]; static struct smp_msg *smp_broadcast_msgs = NULL; -static spinlock broadcast_msg_spinlock = 0; +static spinlock broadcast_msg_spinlock = B_SPINLOCK_INITIALIZER; static bool sICIEnabled = false; static int32 sNumCPUs = 1; @@ -115,6 +119,10 @@ int currentCPU = smp_get_current_cpu(); if (are_interrupts_enabled()) panic("acquire_spinlock: attempt to acquire lock %p with interrupts enabled\n", lock); +#if B_DEBUG_SPINLOCK_CONTENTION + while (atomic_add(&lock->lock, 1) != 0) + process_pending_ici(currentCPU); +#else while (1) { while (*lock != 0) { process_pending_ici(currentCPU); @@ -123,6 +131,7 @@ if (atomic_set((int32 *)lock, 1) == 0) break; } +#endif } else { #if DEBUG_SPINLOCKS int32 oldValue; @@ -148,12 +157,17 @@ if (are_interrupts_enabled()) panic("acquire_spinlock_nocheck: attempt to acquire lock %p with interrupts enabled\n", lock); #endif +#if B_DEBUG_SPINLOCK_CONTENTION + while (atomic_add(&lock->lock, 1) != 0) { + } +#else while (1) { while(*lock != 0) PAUSE(); if (atomic_set((int32 *)lock, 1) == 0) break; } +#endif } else { #if DEBUG_SPINLOCKS if (are_interrupts_enabled()) @@ -171,8 +185,23 @@ if (sNumCPUs > 1) { if (are_interrupts_enabled()) panic("release_spinlock: attempt to release lock %p with interrupts enabled\n", lock); +#if B_DEBUG_SPINLOCK_CONTENTION + { + int32 count = atomic_set(&lock->lock, 0) - 1; + if (count < 0) { + panic("release_spinlock: lock %p was already released\n", lock); + } else { + // add to the total count -- deal with carry manually + if ((uint32)atomic_add(&lock->count_low, count) + count + < (uint32)count) { + atomic_add(&lock->count_high, 1); + } + } + } +#else if (atomic_set((int32 *)lock, 0) != 1) panic("release_spinlock: lock %p was already released\n", lock); +#endif } else { #if DEBUG_SPINLOCKS if (are_interrupts_enabled()) @@ -405,6 +434,48 @@ } +#if B_DEBUG_SPINLOCK_CONTENTION + +static uint64 +get_spinlock_counter(spinlock* lock) +{ + uint32 high; + uint32 low; + do { + high = (uint32)atomic_get(&lock->count_high); + low = (uint32)atomic_get(&lock->count_low); + } while (high != atomic_get(&lock->count_high)); + + return ((uint64)high << 32) | low; +} + + +static status_t +spinlock_contention_syscall(const char* subsystem, uint32 function, + void* buffer, size_t bufferSize) +{ + spinlock_contention_info info; + + if (function != GET_SPINLOCK_CONTENTION_INFO) + return B_BAD_VALUE; + + if (bufferSize < sizeof(spinlock_contention_info)) + return B_BAD_VALUE; + + info.thread_spinlock_counter = get_spinlock_counter(&thread_spinlock); + info.team_spinlock_counter = get_spinlock_counter(&team_spinlock); + + if (!IS_USER_ADDRESS(buffer) + || user_memcpy(buffer, &info, sizeof(info)) != B_OK) { + return B_BAD_ADDRESS; + } + + return B_OK; +} + +#endif // B_DEBUG_SPINLOCK_CONTENTION + + // #pragma mark - @@ -553,7 +624,11 @@ smp_trap_non_boot_cpus(int32 cpu) { if (cpu > 0) { +#if B_DEBUG_SPINLOCK_CONTENTION + boot_cpu_spin[cpu].lock = 1; +#else boot_cpu_spin[cpu] = 1; +#endif acquire_spinlock_nocheck(&boot_cpu_spin[cpu]); return false; } @@ -624,6 +699,18 @@ } +status_t +smp_init_post_generic_syscalls(void) +{ +#if B_DEBUG_SPINLOCK_CONTENTION + return register_generic_syscall(SPINLOCK_CONTENTION, + &spinlock_contention_syscall, 0, 0); +#else + return B_OK; +#endif +} + + void smp_set_num_cpus(int32 numCPUs) { Modified: haiku/trunk/src/system/kernel/team.cpp =================================================================== --- haiku/trunk/src/system/kernel/team.cpp 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/system/kernel/team.cpp 2008-06-02 02:04:12 UTC (rev 25752) @@ -89,7 +89,7 @@ static int32 sMaxTeams = 2048; static int32 sUsedTeams = 1; -spinlock team_spinlock = 0; +spinlock team_spinlock = B_SPINLOCK_INITIALIZER; // #pragma mark - Tracing Modified: haiku/trunk/src/system/kernel/thread.cpp =================================================================== --- haiku/trunk/src/system/kernel/thread.cpp 2008-06-01 21:18:08 UTC (rev 25751) +++ haiku/trunk/src/system/kernel/thread.cpp 2008-06-02 02:04:12 UTC (rev 25752) @@ -60,7 +60,7 @@ }; // global -spinlock thread_spinlock = 0; +spinlock thread_spinlock = B_SPINLOCK_INITIALIZER; // thread list static struct thread sIdleThreads[B_MAX_CPU_COUNT]; From bonefish at mail.berlios.de Mon Jun 2 04:07:27 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 2 Jun 2008 04:07:27 +0200 Subject: [Haiku-commits] r25753 - haiku/trunk/src/tests/system/kernel Message-ID: <200806020207.m5227Rhe027740@sheep.berlios.de> Author: bonefish Date: 2008-06-02 04:07:26 +0200 (Mon, 02 Jun 2008) New Revision: 25753 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25753&view=rev Added: haiku/trunk/src/tests/system/kernel/spinlock_contention.cpp Modified: haiku/trunk/src/tests/system/kernel/Jamfile Log: Added test that runs another program and analyzes the contention of the thread and team spinlocks during that time. Modified: haiku/trunk/src/tests/system/kernel/Jamfile =================================================================== --- haiku/trunk/src/tests/system/kernel/Jamfile 2008-06-02 02:04:12 UTC (rev 25752) +++ haiku/trunk/src/tests/system/kernel/Jamfile 2008-06-02 02:07:26 UTC (rev 25753) @@ -1,7 +1,6 @@ SubDir HAIKU_TOP src tests system kernel ; -UsePrivateHeaders kernel ; -UseHeaders $(TARGET_PRIVATE_KERNEL_HEADERS) : true ; +UsePrivateKernelHeaders ; SimpleTest advisory_locking_test : advisory_locking_test.cpp ; @@ -36,6 +35,8 @@ SimpleTest sem_acquire_test1 : sem_acquire_test1.cpp : be ; +SimpleTest spinlock_contention : spinlock_contention.cpp ; + SimpleTest syscall_restart_test : syscall_restart_test.cpp : network ; SetSupportedPlatformsForTarget syscall_time Added: haiku/trunk/src/tests/system/kernel/spinlock_contention.cpp =================================================================== --- haiku/trunk/src/tests/system/kernel/spinlock_contention.cpp 2008-06-02 02:04:12 UTC (rev 25752) +++ haiku/trunk/src/tests/system/kernel/spinlock_contention.cpp 2008-06-02 02:07:26 UTC (rev 25753) @@ -0,0 +1,267 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + + +#define panic printf + + +struct dummy_spinlock { + vint32 lock; + vint32 count_low; + vint32 count_high; +}; + + +struct dummy_smp_msg { + dummy_smp_msg* next; +}; + + +static int sNumCPUs = 2; +static bool sICIEnabled = true; +static dummy_spinlock cpu_msg_spinlock[B_MAX_CPU_COUNT]; +static dummy_smp_msg* smp_msgs[B_MAX_CPU_COUNT]; +static dummy_spinlock broadcast_msg_spinlock; +static dummy_smp_msg* smp_broadcast_msgs; + + +bool +dummy_are_interrupts_enabled() +{ + return false; +} + + +void +dummy_acquire_spinlock_nocheck(dummy_spinlock* lock) +{ + if (sNumCPUs > 1) { + if (dummy_are_interrupts_enabled()) + panic("acquire_spinlock_nocheck: attempt to acquire lock %p with interrupts enabled\n", lock); + + while (atomic_add(&lock->lock, 1) != 0) { + } + } else { + if (dummy_are_interrupts_enabled()) + panic("acquire_spinlock_nocheck: attempt to acquire lock %p with interrupts enabled\n", lock); + if (atomic_set((int32 *)lock, 1) != 0) + panic("acquire_spinlock_nocheck: attempt to acquire lock %p twice on non-SMP system\n", lock); + } +} + + +void +dummy_release_spinlock(dummy_spinlock* lock) +{ + if (sNumCPUs > 1) { + if (dummy_are_interrupts_enabled()) + panic("release_spinlock: attempt to release lock %p with interrupts enabled\n", lock); + + { + int32 count = atomic_set(&lock->lock, 0) - 1; + if (count < 0) { + panic("release_spinlock: lock %p was already released\n", lock); + } else { + // add to the total count -- deal with carry manually + if ((uint32)atomic_add(&lock->count_low, count) + count + < (uint32)count) { + atomic_add(&lock->count_high, 1); + } + } + } + } else { + if (dummy_are_interrupts_enabled()) + panic("release_spinlock: attempt to release lock %p with interrupts enabled\n", lock); + if (atomic_set((int32 *)lock, 0) != 1) + panic("release_spinlock: lock %p was already released\n", lock); + } +} + + +struct dummy_smp_msg * +dummy_check_for_message(int currentCPU, int *source_mailbox) +{ + struct dummy_smp_msg *msg; + + if (!sICIEnabled) + return NULL; + + dummy_acquire_spinlock_nocheck(&cpu_msg_spinlock[currentCPU]); + msg = smp_msgs[currentCPU]; + if (msg != NULL) { + printf("yeah\n"); + dummy_release_spinlock(&cpu_msg_spinlock[currentCPU]); + *source_mailbox = 1; + } else { + // try getting one from the broadcast mailbox + + dummy_release_spinlock(&cpu_msg_spinlock[currentCPU]); + dummy_acquire_spinlock_nocheck(&broadcast_msg_spinlock); + + msg = smp_broadcast_msgs; + while (msg != NULL) { + printf("yeah\n"); + msg = msg->next; + } + dummy_release_spinlock(&broadcast_msg_spinlock); + } + return msg; +} + + +int32 +dummy_process_pending_ici(int32 currentCPU) +{ + int retval = 42; + int sourceMailbox = 0; + + dummy_smp_msg* msg = dummy_check_for_message(currentCPU, &sourceMailbox); + if (msg == NULL) + return retval; + + switch ((addr_t)msg) { + case 0: + printf("foo\n"); + break; + case 1: + printf("foo\n"); + break; + case 2: + printf("foo\n"); + break; + } + + return 9; +} + + +static void +test_spinlock(dummy_spinlock* lock) +{ + while (atomic_add(&lock->lock, -1) != 0) + dummy_process_pending_ici(0); +} + + +static double +estimate_spinlock_tick_time() +{ + // time the spinlock + int32 count = (INT_MAX >> 16) + 1; + while (true) { + bigtime_t startTime = system_time(); + + dummy_spinlock lock; + lock.lock = count; + test_spinlock(&lock); + + bigtime_t totalTime = system_time() - startTime; + double tickTime = (double)totalTime / count; + + if (totalTime > 1000000 || INT_MAX >> 2 < count) + return tickTime; + + count <<= 1; + } +} + + +static const char* +time_string(double timeInUsecs, char* buffer) +{ + static const char* const kUnits[] = { "us", "ms", "s ", NULL }; + + double time = timeInUsecs; + + int32 i = 0; + while (time > 1000 && kUnits[i + 1] != NULL) { + time /= 1000; + i++; + } + + sprintf(buffer, "%.3f %s", time, kUnits[i]); + + return buffer; +} + + +int +main(int argc, char** argv) +{ + // get the initial contention info + spinlock_contention_info startInfo; + status_t error = _kern_generic_syscall(SPINLOCK_CONTENTION, + GET_SPINLOCK_CONTENTION_INFO, &startInfo, sizeof(startInfo)); + if (error != B_OK) { + fprintf(stderr, "Error: Failed to get spinlock contention info: %s\n", + strerror(error)); + exit(1); + } + bigtime_t startTime = system_time(); + + pid_t child = fork(); + if (child < 0) { + fprintf(stderr, "Error: fork() failed: %s\n", strerror(errno)); + exit(1); + } + + if (child == 0) { + execvp(argv[1], argv + 1); + fprintf(stderr, "Error: exec() failed: %s\n", strerror(errno)); + exit(1); + } else { + int status; + wait(&status); + } + + // get the final contention info + spinlock_contention_info endInfo; + error = _kern_generic_syscall(SPINLOCK_CONTENTION, + GET_SPINLOCK_CONTENTION_INFO, &endInfo, sizeof(endInfo)); + if (error != B_OK) { + fprintf(stderr, "Error: Failed to get spinlock contention info: %s\n", + strerror(error)); + exit(1); + } + bigtime_t totalTime = system_time() - startTime; + + char buffer[128]; + printf("\ntotal run time: %s\n", time_string(totalTime, buffer)); + + // estimate spinlock tick time + printf("estimating time per spinlock tick...\n"); + double tickTime = estimate_spinlock_tick_time(); + printf("time per spinlock tick: %s\n", + time_string(tickTime, buffer)); + + // print results + static const char* const kLockNames[] = { "thread", "team", NULL }; + uint64 lockCounts[] = { + endInfo.thread_spinlock_counter - startInfo.thread_spinlock_counter, + endInfo.team_spinlock_counter - startInfo.team_spinlock_counter + }; + + printf("\nlock counter time wasted %% CPU\n"); + printf("-------------------------------------------------------\n"); + for (int32 i = 0; kLockNames[i] != NULL; i++) { + double wastedUsecs = lockCounts[i] * tickTime; + printf("%-10s %12llu %14s %12.4f\n", kLockNames[i], lockCounts[i], + time_string(wastedUsecs, buffer), wastedUsecs / totalTime * 100); + } + + return 0; +} From bonefish at mail.berlios.de Mon Jun 2 06:34:15 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 2 Jun 2008 06:34:15 +0200 Subject: [Haiku-commits] r25754 - haiku/trunk/src/system/kernel Message-ID: <200806020434.m524YFGg007153@sheep.berlios.de> Author: bonefish Date: 2008-06-02 06:34:09 +0200 (Mon, 02 Jun 2008) New Revision: 25754 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25754&view=rev Modified: haiku/trunk/src/system/kernel/thread.cpp Log: Before starting to wait the undertaker does now check whether there's already a dead thread available. Fixes a race condition. Modified: haiku/trunk/src/system/kernel/thread.cpp =================================================================== --- haiku/trunk/src/system/kernel/thread.cpp 2008-06-02 02:07:26 UTC (rev 25753) +++ haiku/trunk/src/system/kernel/thread.cpp 2008-06-02 04:34:09 UTC (rev 25754) @@ -540,21 +540,21 @@ { while (true) { // wait for a thread to bury - ConditionVariableEntry conditionEntry; - InterruptsSpinLocker locker(thread_spinlock); - sUndertakerCondition.Add(&conditionEntry); - locker.Unlock(); - conditionEntry.Wait(); + while (sUndertakerEntries.IsEmpty()) { + ConditionVariableEntry conditionEntry; + sUndertakerCondition.Add(&conditionEntry); + locker.Unlock(); - locker.Lock(); + conditionEntry.Wait(); + + locker.Lock(); + } + UndertakerEntry* _entry = sUndertakerEntries.RemoveHead(); locker.Unlock(); - if (_entry == NULL) - continue; - UndertakerEntry entry = *_entry; // we need a copy, since the original entry is on the thread's stack From axeld at mail.berlios.de Mon Jun 2 12:38:01 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 2 Jun 2008 12:38:01 +0200 Subject: [Haiku-commits] r25755 - in haiku/trunk: build/jam src/add-ons/kernel/busses/ide/generic_ide_pci src/add-ons/kernel/busses/ide/ide_isa Message-ID: <200806021038.m52Ac1MM008059@sheep.berlios.de> Author: axeld Date: 2008-06-02 12:37:58 +0200 (Mon, 02 Jun 2008) New Revision: 25755 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25755&view=rev Removed: haiku/trunk/src/add-ons/kernel/busses/ide/generic_ide_pci/wrapper.h haiku/trunk/src/add-ons/kernel/busses/ide/ide_isa/wrapper.h Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/src/add-ons/kernel/busses/ide/generic_ide_pci/generic_ide_pci.c haiku/trunk/src/add-ons/kernel/busses/ide/ide_isa/ide_isa.c Log: * Ported ide_isa module to the new driver architecture. * Minor cleanup of ide_isa, and generic_ide_pci (removed wrapper.h). * Added ide_isa back to the image. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-06-02 04:34:09 UTC (rev 25754) +++ haiku/trunk/build/jam/HaikuImage 2008-06-02 10:37:58 UTC (rev 25755) @@ -145,7 +145,7 @@ AddFilesToHaikuImage beos system add-ons kernel busses agp_gart : $(X86_ONLY)intel ; AddFilesToHaikuImage beos system add-ons kernel busses ide - : generic_ide_pci silicon_image_3112 legacy_sata ; #$(X86_ONLY)ide_isa ; + : generic_ide_pci silicon_image_3112 legacy_sata $(X86_ONLY)ide_isa ; AddFilesToHaikuImage beos system add-ons kernel busses scsi : ahci ; AddFilesToHaikuImage beos system add-ons kernel busses usb @@ -359,7 +359,7 @@ pci $(X86_ONLY)isa config_manager ide scsi $(PPC_ONLY)openpic block_io ide_adapter locked_pool scsi_periph - generic_ide_pci ahci legacy_sata silicon_image_3112 # $(X86_ONLY)ide_isa + generic_ide_pci ahci legacy_sata silicon_image_3112 $(X86_ONLY)ide_isa scsi_cd scsi_disk intel bfs Modified: haiku/trunk/src/add-ons/kernel/busses/ide/generic_ide_pci/generic_ide_pci.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ide/generic_ide_pci/generic_ide_pci.c 2008-06-02 04:34:09 UTC (rev 25754) +++ haiku/trunk/src/add-ons/kernel/busses/ide/generic_ide_pci/generic_ide_pci.c 2008-06-02 10:37:58 UTC (rev 25755) @@ -3,26 +3,14 @@ * Distributed under the terms of the MIT License. */ -/* - Generic IDE PCI controller driver +/*! Generic PCI bus mastering IDE driver. */ - Generic PCI bus mastering IDE driver. -*/ - #include #include #include #include -#define debug_level_flow 0 -#define debug_level_error 3 -#define debug_level_info 3 - -#define DEBUG_MSG_PREFIX "GENERIC IDE PCI -- " - -#include "wrapper.h" - #define GENERIC_IDE_PCI_CONTROLLER_MODULE_NAME "busses/ide/generic_ide_pci/driver_v1" #define GENERIC_IDE_PCI_CHANNEL_MODULE_NAME "busses/ide/generic_ide_pci/channel/v1" @@ -186,20 +174,6 @@ } -static status_t -module_std_ops(int32 op, ...) -{ - switch (op) { - case B_MODULE_INIT: - case B_MODULE_UNINIT: - return B_OK; - - default: - return B_ERROR; - } -} - - module_dependency module_dependencies[] = { { IDE_FOR_CONTROLLER_MODULE_NAME, (module_info **)&ide }, { B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&pnp }, @@ -214,12 +188,12 @@ { GENERIC_IDE_PCI_CHANNEL_MODULE_NAME, 0, - module_std_ops + NULL }, NULL, // supports device NULL, // register device - (status_t (*)(device_node *, void **))init_channel, + init_channel, uninit_channel, NULL, // register child devices NULL, // rescan @@ -247,7 +221,7 @@ { GENERIC_IDE_PCI_CONTROLLER_MODULE_NAME, 0, - module_std_ops + NULL }, supports_device, Deleted: haiku/trunk/src/add-ons/kernel/busses/ide/generic_ide_pci/wrapper.h Modified: haiku/trunk/src/add-ons/kernel/busses/ide/ide_isa/ide_isa.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ide/ide_isa/ide_isa.c 2008-06-02 04:34:09 UTC (rev 25754) +++ haiku/trunk/src/add-ons/kernel/busses/ide/ide_isa/ide_isa.c 2008-06-02 10:37:58 UTC (rev 25755) @@ -22,18 +22,17 @@ #include #include -#define debug_level_flow 0 -#define debug_level_error 1 -#define debug_level_info 2 -#define DEBUG_MSG_PREFIX "IDE ISA -- " -#define TRACE dprintf +//#define TRACE_IDE_ISA +#ifdef TRACE_IDE_ISA +# define TRACE(x...) dprintf("ide_isa: " x) +#else +# define TRACE(x...) ; +#endif -#include "wrapper.h" +#define IDE_ISA_MODULE_NAME "busses/ide/ide_isa/driver_v1" -#define IDE_ISA_MODULE_NAME "busses/ide/ide_isa/device_v1" - // private node item: // io address of command block #define IDE_ISA_COMMAND_BLOCK_BASE "ide_isa/command_block_base" @@ -42,7 +41,7 @@ // interrupt number #define IDE_ISA_INTNUM "ide_isa/irq" -//isa2_module_info *isa; + ide_for_controller_interface *ide; device_manager_info *pnp; @@ -52,44 +51,97 @@ isa2_module_info *isa; uint16 command_block_base; // io address command block uint16 control_block_base; // io address control block - int intnum; // interrupt number - + int intnum; // interrupt number + uint32 lost; // != 0 if device got removed, i.e. if it must not // be accessed anymore - + ide_channel ide_channel; - device_node_handle node; + device_node *node; } channel_info; +/*! publish node of an ide channel */ static status_t -write_command_block_regs(void *channel_cookie, ide_task_file *tf, ide_reg_mask mask) +publish_channel(device_node *parent, uint16 command_block_base, + uint16 control_block_base, uint8 intnum, const char *name) { + device_attr attrs[] = { + { B_DEVICE_FIXED_CHILD, B_STRING_TYPE, { string: IDE_FOR_CONTROLLER_MODULE_NAME }}, + + // properties of this controller for ide bus manager + { IDE_CONTROLLER_MAX_DEVICES_ITEM, B_UINT8_TYPE, { ui8: 2 }}, + { IDE_CONTROLLER_CAN_DMA_ITEM, B_UINT8_TYPE, { ui8: 0 }}, + { IDE_CONTROLLER_CAN_CQ_ITEM, B_UINT8_TYPE, { ui8: 1 }}, + { IDE_CONTROLLER_CONTROLLER_NAME_ITEM, B_STRING_TYPE, { string: name }}, + + // DMA properties; the 16 bit alignment is not necessary as + // the ide bus manager handles that very efficiently, but why + // not use the block device manager for doing that? + { B_BLOCK_DEVICE_DMA_ALIGNMENT, B_UINT32_TYPE, { ui32: 1 }}, + + // private data to identify device + { IDE_ISA_COMMAND_BLOCK_BASE, B_UINT16_TYPE, { ui16: command_block_base }}, + { IDE_ISA_CONTROL_BLOCK_BASE, B_UINT16_TYPE, { ui16: control_block_base }}, + { IDE_ISA_INTNUM, B_UINT8_TYPE, { ui8: intnum }}, + { NULL } + }; + io_resource resources[3] = { + { B_IO_PORT, command_block_base, 8 }, + { B_IO_PORT, control_block_base, 1 }, + {} + }; + + TRACE("publishing %s, resources %#x %#x %d\n", + name, command_block_base, control_block_base, intnum); + + return pnp->register_node(parent, IDE_ISA_MODULE_NAME, attrs, resources, + NULL); +} + + +// #pragma mark - + + +static void +set_channel(void *cookie, ide_channel ideChannel) +{ + channel_info *channel = cookie; + channel->ide_channel = ideChannel; +} + + +static status_t +write_command_block_regs(void *channel_cookie, ide_task_file *tf, + ide_reg_mask mask) +{ channel_info *channel = channel_cookie; uint16 ioaddr = channel->command_block_base; int i; - + if (channel->lost) return B_ERROR; for (i = 0; i < 7; i++) { if (((1 << (i-7)) & mask) != 0) { - SHOW_FLOW(3, "%x->HI(%x)", tf->raw.r[i + 7], i); + TRACE("write_command_block_regs(): %x->HI(%x)\n", + tf->raw.r[i + 7], i); channel->isa->write_io_8(ioaddr + 1 + i, tf->raw.r[i + 7]); } if (((1 << i) & mask) != 0 ) { - SHOW_FLOW(3, "%x->LO(%x)", tf->raw.r[i], i); + TRACE("write_comamnd_block_regs(): %x->LO(%x)\n", tf->raw.r[i], i); channel->isa->write_io_8(ioaddr + 1 + i, tf->raw.r[i]); } } - + return B_OK; } static status_t -read_command_block_regs(void *channel_cookie, ide_task_file *tf, ide_reg_mask mask) +read_command_block_regs(void *channel_cookie, ide_task_file *tf, + ide_reg_mask mask) { channel_info *channel = channel_cookie; uint16 ioaddr = channel->command_block_base; @@ -101,10 +153,10 @@ for (i = 0; i < 7; i++) { if (((1 << i) & mask) != 0) { tf->raw.r[i] = channel->isa->read_io_8(ioaddr + 1 + i); - SHOW_FLOW(3, "%x: %x", i, (int)tf->raw.r[i]); + TRACE("read_command_block_regs(%x): %x\n", i, (int)tf->raw.r[i]); } } - + return B_OK; } @@ -128,7 +180,7 @@ channel_info *channel = channel_cookie; uint16 device_control_addr = channel->control_block_base; - SHOW_FLOW(3, "%x", (int)val); + TRACE("write_device_control(%x)\n", (int)val); if (channel->lost) return B_ERROR; @@ -148,7 +200,7 @@ if (channel->lost) return B_ERROR; - // Bochs doesn't support 32 bit accesses; + // Bochs doesn't support 32 bit accesses; // no real performance impact as this driver is for Bochs only anyway force_16bit = true; @@ -197,7 +249,7 @@ channel_info *channel = (channel_info *)arg; uint8 status; - SHOW_FLOW0(3, ""); + TRACE("interrupt handler()\n"); if (channel->lost) return B_UNHANDLED_INTERRUPT; @@ -210,9 +262,8 @@ static status_t -prepare_dma(void *channel_cookie, - const physical_entry *sg_list, size_t sg_list_count, - bool write) +prepare_dma(void *channel_cookie, const physical_entry *sg_list, + size_t sg_list_count, bool write) { return B_NOT_ALLOWED; } @@ -232,53 +283,54 @@ } +// #pragma mark - + + static float -supports_device(device_node_handle parent, bool *_noConnection) +supports_device(device_node *parent) { - char *bus; + const char *bus; // make sure parent is really the ISA bus manager - if (pnp->get_attr_string(parent, B_DRIVER_BUS, &bus, false)) + if (pnp->get_attr_string(parent, B_DEVICE_BUS, &bus, false)) return B_ERROR; - if (strcmp(bus, "isa")) { - free(bus); + if (strcmp(bus, "isa")) return 0.0; - } - // ToDo: check I/O resources for availability? + // we assume that every modern PC has an IDE controller, so no + // further testing is done (well - I don't really know how to detect the + // controller, but who cares ;) - free(bus); return 0.6; } static status_t -init_channel(device_node_handle node, ide_channel ide_channel, channel_info **cookie) +init_channel(device_node *node, void **_cookie) { channel_info *channel; + device_node *parent; isa2_module_info *isa; - void *dummy; uint16 command_block_base, control_block_base; uint8 irq; status_t res; TRACE("ISA-IDE: channel init\n"); - // get device data + // get device data if (pnp->get_attr_uint16(node, IDE_ISA_COMMAND_BLOCK_BASE, &command_block_base, false) != B_OK || pnp->get_attr_uint16(node, IDE_ISA_CONTROL_BLOCK_BASE, &control_block_base, false) != B_OK || pnp->get_attr_uint8(node, IDE_ISA_INTNUM, &irq, false) != B_OK) return B_ERROR; - if (pnp->init_driver(pnp->get_parent(node), NULL, (driver_module_info **)&isa, &dummy) != B_OK) - return B_ERROR; + parent = pnp->get_parent_node(node); + pnp->get_driver(parent, (driver_module_info **)&isa, NULL); + pnp->put_node(parent); channel = (channel_info *)malloc(sizeof(channel_info)); - if (channel == NULL) { - res = B_NO_MEMORY; - goto err0; - } + if (channel == NULL) + return B_NO_MEMORY; TRACE("ISA-IDE: channel init, resources %#x %#x %d\n", command_block_base, control_block_base, irq); @@ -289,9 +341,9 @@ channel->command_block_base = command_block_base; channel->control_block_base = control_block_base; channel->intnum = irq; - channel->ide_channel = ide_channel; + channel->ide_channel = NULL; - res = install_io_interrupt_handler(channel->intnum, + res = install_io_interrupt_handler(channel->intnum, inthand, channel, 0); if (res < 0) { @@ -302,20 +354,16 @@ // enable interrupts so the channel is ready to run write_device_control(channel, ide_devctrl_bit3); - *cookie = channel; - + *_cookie = channel; return B_OK; err: free(channel); - -err0: - pnp->uninit_driver(pnp->get_parent(node)); return res; } -static status_t +static void uninit_channel(void *channel_cookie) { channel_info *channel = channel_cookie; @@ -329,142 +377,45 @@ // (some controllers generate an IRQ when you _disable_ interrupts, // they are delayed by less then 40 ?s, so 1 ms is safe) snooze(1000); - + remove_io_interrupt_handler(channel->intnum, inthand, channel); - pnp->uninit_driver(pnp->get_parent(channel->node)); - free(channel); - - return B_OK; } -/** publish node of an ide channel */ - static status_t -publish_channel(device_node_handle parent, io_resource_handle *resources, - uint16 command_block_base, uint16 control_block_base, uint8 intnum, - const char *name) +register_device(device_node *parent) { - device_attr attrs[] = { - // info about ourself and our consumer - { B_DRIVER_MODULE, B_STRING_TYPE, { string: IDE_ISA_MODULE_NAME }}, - { B_DRIVER_FIXED_CHILD, B_STRING_TYPE, { string: IDE_FOR_CONTROLLER_MODULE_NAME }}, - { PNP_DRIVER_CONNECTION, B_STRING_TYPE, { string: name }}, + status_t primaryStatus; + status_t secondaryStatus; + TRACE("register_device()\n"); - // properties of this controller for ide bus manager - { IDE_CONTROLLER_MAX_DEVICES_ITEM, B_UINT8_TYPE, { ui8: 2 }}, - { IDE_CONTROLLER_CAN_DMA_ITEM, B_UINT8_TYPE, { ui8: 0 }}, - { IDE_CONTROLLER_CAN_CQ_ITEM, B_UINT8_TYPE, { ui8: 1 }}, - { IDE_CONTROLLER_CONTROLLER_NAME_ITEM, B_STRING_TYPE, { string: name }}, - - // DMA properties; the 16 bit alignment is not necessary as - // the ide bus manager handles that very efficiently, but why - // not use the block device manager for doing that? - { B_BLOCK_DEVICE_DMA_ALIGNMENT, B_UINT32_TYPE, { ui32: 1 }}, - - // private data to identify device - { IDE_ISA_COMMAND_BLOCK_BASE, B_UINT16_TYPE, { ui16: command_block_base }}, - { IDE_ISA_CONTROL_BLOCK_BASE, B_UINT16_TYPE, { ui16: control_block_base }}, - { IDE_ISA_INTNUM, B_UINT8_TYPE, { ui8: intnum }}, - { NULL } - }; - device_node_handle node; - - SHOW_FLOW0(2, ""); - - TRACE("ISA-IDE: publishing %s, resources %#x %#x %d\n", - name, command_block_base, control_block_base, intnum); - - return pnp->register_device(parent, attrs, resources, &node); -} - - -// detect IDE channel -static status_t -probe_channel(device_node_handle parent, - uint16 command_block_base, uint16 control_block_base, - int intnum, const char *name) -{ - io_resource resources[3] = { - { IO_PORT, command_block_base, 8 }, - { IO_PORT, control_block_base, 1 }, - {} - }; - io_resource_handle resource_handles[3]; - - SHOW_FLOW(3, "name = \"%s\"", name); - - // we aren't upset if io-ports are in use already - only - // the PCI IDE driver can own them, and if it does, we exit silently - if (pnp->acquire_io_resources(resources, resource_handles) != B_OK) { - TRACE("ISA-IDE: can't acquire resources %#x and %#x\n", - command_block_base, control_block_base); - return B_OK; - } - - // we assume that every modern PC has an IDE controller, so no - // further testing is done (well - I don't really know how to detect the - // controller, but who cares ;) - return publish_channel(parent, resource_handles, command_block_base, - control_block_base, intnum, name); -} - - -static status_t -register_device(device_node_handle node) -{ - SHOW_FLOW0(3, ""); - // our parent device is the isa bus and all device drivers are Universal, // so the pnp_manager tries each ISA driver in turn - probe_channel(node, 0x1f0, 0x3f6, 14, "primary IDE channel"); - probe_channel(node, 0x170, 0x376, 15, "secondary IDE channel"); + primaryStatus = publish_channel(parent, 0x1f0, 0x3f6, 14, + "primary IDE channel"); + secondaryStatus = publish_channel(parent, 0x170, 0x376, 15, + "secondary IDE channel"); - return B_OK; -} + if (primaryStatus == B_OK || secondaryStatus == B_OK) + return B_OK; - -static void -channel_removed(device_node_handle node, void *channel_cookie) -{ - channel_info *channel = channel_cookie; - SHOW_FLOW0(3, ""); - - if (channel != NULL) - // disable access instantly - atomic_or(&channel->lost, 1); - - return; + return primaryStatus; } static void -get_paths(const char ***_bus, const char ***_device) +channel_removed(void *cookie) { - static const char *kBus[] = {"isa", NULL}; - static const char *kDevice[] = {"drivers/dev/disk/ide", NULL}; + channel_info *channel = cookie; + TRACE("channel_removed()\n"); - *_bus = kBus; - *_device = kDevice; + // disable access instantly + atomic_or(&channel->lost, 1); } -static status_t -std_ops(int32 op, ...) -{ - switch (op) { - case B_MODULE_INIT: - case B_MODULE_UNINIT: - return B_OK; - - default: - return B_ERROR; - } -} - - module_dependency module_dependencies[] = { { IDE_FOR_CONTROLLER_MODULE_NAME, (module_info **)&ide }, { B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&pnp }, @@ -472,23 +423,25 @@ }; // exported interface -ide_controller_interface isa_controller_interface = { +static ide_controller_interface sISAControllerInterface = { { { IDE_ISA_MODULE_NAME, 0, - std_ops + NULL }, supports_device, register_device, - (status_t (*)(device_node_handle, void *, void **)) init_channel, + init_channel, uninit_channel, + NULL, // register child devices + NULL, // rescan channel_removed, - NULL, // cleanup - get_paths }, + &set_channel, + &write_command_block_regs, &read_command_block_regs, @@ -504,6 +457,6 @@ }; module_info *modules[] = { - (module_info *)&isa_controller_interface, + (module_info *)&sISAControllerInterface, NULL }; Deleted: haiku/trunk/src/add-ons/kernel/busses/ide/ide_isa/wrapper.h From axeld at mail.berlios.de Mon Jun 2 13:01:46 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 2 Jun 2008 13:01:46 +0200 Subject: [Haiku-commits] r25756 - haiku/trunk/src/libs/compat/freebsd_network/compat/sys Message-ID: <200806021101.m52B1kOc006047@sheep.berlios.de> Author: axeld Date: 2008-06-02 13:01:44 +0200 (Mon, 02 Jun 2008) New Revision: 25756 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25756&view=rev Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/sys/param.h Log: Patch by Vasilis Kaoutsis: * Removed duplicate PAGE_SIZE definition (now defined in limits.h). Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/sys/param.h =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/compat/sys/param.h 2008-06-02 10:37:58 UTC (rev 25755) +++ haiku/trunk/src/libs/compat/freebsd_network/compat/sys/param.h 2008-06-02 11:01:44 UTC (rev 25756) @@ -16,7 +16,6 @@ #define MAXBSIZE 0x10000 #define PAGE_SHIFT 12 -#define PAGE_SIZE B_PAGE_SIZE #define PAGE_MASK (PAGE_SIZE - 1) From axeld at mail.berlios.de Mon Jun 2 13:04:48 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 2 Jun 2008 13:04:48 +0200 Subject: [Haiku-commits] r25757 - haiku/trunk/src/build/libbe/storage Message-ID: <200806021104.m52B4mZP009081@sheep.berlios.de> Author: axeld Date: 2008-06-02 13:04:46 +0200 (Mon, 02 Jun 2008) New Revision: 25757 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25757&view=rev Modified: haiku/trunk/src/build/libbe/storage/Volume.cpp Log: Patch by Vasilis Kaoutsis: * Update license and author information. * Simplified operator==(). * Removed obsolete OpenBeOS namespace. * Some style cleanup. Modified: haiku/trunk/src/build/libbe/storage/Volume.cpp =================================================================== --- haiku/trunk/src/build/libbe/storage/Volume.cpp 2008-06-02 11:01:44 UTC (rev 25756) +++ haiku/trunk/src/build/libbe/storage/Volume.cpp 2008-06-02 11:04:46 UTC (rev 25757) @@ -1,16 +1,21 @@ -// ---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -// -// File Name: Volume.cpp -// -// Description: BVolume class -// ---------------------------------------------------------------------- +/* + * Copyright 2002-2008, Haiku Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Tyler Dauwalder, tyler at dauwalder.net + * Erik Jakowatz + * shadow303 + * Ingo Weinhold, ingo_weinhold at gmx.de + */ + /*! \file Volume.h BVolume implementation. */ +#include + #include #include @@ -18,14 +23,10 @@ #include #include #include -#include #include #include -#ifdef USE_OPENBEOS_NAMESPACE -namespace OpenBeOS { -#endif /*! \class BVolume @@ -51,18 +52,19 @@ \brief The object's initialization status. */ -// constructor + /*! \brief Creates an uninitialized BVolume. InitCheck() will return \c B_NO_INIT. */ BVolume::BVolume() - : fDevice((dev_t)-1), - fCStatus(B_NO_INIT) + : + fDevice((dev_t)-1), + fCStatus(B_NO_INIT) { } -// constructor + /*! \brief Creates a BVolume and initializes it to the volume specified by the supplied device ID. @@ -72,13 +74,14 @@ \param device The device ID of the volume. */ BVolume::BVolume(dev_t device) - : fDevice((dev_t)-1), - fCStatus(B_NO_INIT) + : + fDevice((dev_t)-1), + fCStatus(B_NO_INIT) { SetTo(device); } -// copy constructor + /*! \brief Creates a BVolume and makes it a clone of the supplied one. Afterwards the object refers to the same device the supplied object @@ -88,12 +91,13 @@ \param volume The volume object to be cloned. */ BVolume::BVolume(const BVolume &volume) - : fDevice(volume.fDevice), - fCStatus(volume.fCStatus) + : + fDevice(volume.fDevice), + fCStatus(volume.fCStatus) { } -// destructor + /*! \brief Frees all resources associated with the object. Does nothing. @@ -102,7 +106,7 @@ { } -// InitCheck + /*! \brief Returns the result of the last initialization. \return - \c B_OK: The object is properly initialized. @@ -114,7 +118,7 @@ return fCStatus; } -// SetTo + /*! \brief Re-initializes the object to refer to the volume specified by the supplied device ID. \param device The device ID of the volume. @@ -142,7 +146,7 @@ return fCStatus; } -// Unset + /*! \brief Uninitialized the BVolume. */ void @@ -152,7 +156,7 @@ fCStatus = B_NO_INIT; } -// Device + /*! \brief Returns the device ID of the volume the object refers to. \return Returns the device ID of the volume the object refers to or -1, if the object is not properly initialized. @@ -163,7 +167,7 @@ return fDevice; } -// == + /*! \brief Returns whether two BVolume objects are equal. Two volume objects are said to be equal, if they either are both @@ -176,11 +180,10 @@ bool BVolume::operator==(const BVolume &volume) const { - return (InitCheck() != B_OK && volume.InitCheck() != B_OK - || fDevice == volume.fDevice); + return fDevice == volume.fDevice; } -// != + /*! \brief Returns whether two BVolume objects are unequal. Two volume objects are said to be equal, if they either are both @@ -196,7 +199,7 @@ return !(*this == volume); } -// = + /*! \brief Assigns another BVolume object to this one. This object is made an exact clone of the supplied one. @@ -215,7 +218,6 @@ } -// FBC void BVolume::_TurnUpTheVolume1() {} void BVolume::_TurnUpTheVolume2() {} void BVolume::_TurnUpTheVolume3() {} @@ -224,7 +226,3 @@ void BVolume::_TurnUpTheVolume6() {} void BVolume::_TurnUpTheVolume7() {} void BVolume::_TurnUpTheVolume8() {} - -#ifdef USE_OPENBEOS_NAMESPACE -} -#endif From axeld at mail.berlios.de Mon Jun 2 13:10:36 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 2 Jun 2008 13:10:36 +0200 Subject: [Haiku-commits] r25758 - haiku/trunk/src/add-ons/kernel/network/protocols/ipv4 Message-ID: <200806021110.m52BAaNl015762@sheep.berlios.de> Author: axeld Date: 2008-06-02 13:10:35 +0200 (Mon, 02 Jun 2008) New Revision: 25758 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25758&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp Log: Patch by Vasilis Kaoutsis: * FragmentPacket::Reassemble() would return NULL instead of an error when the packet was not yet complete. * This didn't have any actual consequences, though, as Reassemble() was only called for a complete fragment set. Modified: haiku/trunk/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp 2008-06-02 11:04:46 UTC (rev 25757) +++ haiku/trunk/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp 2008-06-02 11:10:35 UTC (rev 25758) @@ -368,15 +368,14 @@ } -/*! - Reassembles the fragments to the specified buffer \a to. +/*! Reassembles the fragments to the specified buffer \a to. This buffer must have been added via AddFragment() before. */ status_t FragmentPacket::Reassemble(net_buffer *to) { if (!IsComplete()) - return NULL; + return B_ERROR; net_buffer *buffer = NULL; From axeld at mail.berlios.de Mon Jun 2 13:24:13 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 2 Jun 2008 13:24:13 +0200 Subject: [Haiku-commits] r25759 - haiku/trunk/src/build/libbe/interface Message-ID: <200806021124.m52BODbr001217@sheep.berlios.de> Author: axeld Date: 2008-06-02 13:24:11 +0200 (Mon, 02 Jun 2008) New Revision: 25759 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25759&view=rev Modified: haiku/trunk/src/build/libbe/interface/Bitmap.cpp Log: * Patch by Vasilis Kaoutsis to fix a warning in PaletteConverter::IndexForRGB16(). * Further cleanup by myself. Modified: haiku/trunk/src/build/libbe/interface/Bitmap.cpp =================================================================== --- haiku/trunk/src/build/libbe/interface/Bitmap.cpp 2008-06-02 11:10:35 UTC (rev 25758) +++ haiku/trunk/src/build/libbe/interface/Bitmap.cpp 2008-06-02 11:24:11 UTC (rev 25759) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2005, Haiku Inc. + * Copyright 2001-2008, Haiku Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -8,9 +8,7 @@ * Stephan A?mus */ -/** BBitmap objects represent off-screen windows that - * contain bitmap data. - */ +/*! BBitmap objects represent off-screen windows that contain bitmap data. */ #include #include @@ -24,99 +22,149 @@ #include +// structures defining the pixel layout + +struct rgb32_pixel { + uint8 blue; + uint8 green; + uint8 red; + uint8 alpha; +}; + +struct rgb32_big_pixel { + uint8 red; + uint8 green; + uint8 blue; + uint8 alpha; +}; + +struct rgb24_pixel { + uint8 blue; + uint8 green; + uint8 red; +}; + +struct rgb24_big_pixel { + uint8 red; + uint8 green; + uint8 blue; +}; + +struct rgb16_pixel { + uint8 gb; // G[2:0],B[4:0] + uint8 rg; // 16: R[4:0],G[5:3] + // 15: -[0],R[4:0],G[4:3] +}; + +struct rgb16_big_pixel { + uint8 rg; // 16: R[4:0],G[5:3] + // 15: -[0],R[4:0],G[4:3] + uint8 gb; // G[2:0],B[4:0] +}; + +// types defining what is needed to store a color value + +struct rgb_color_value { + uint8 red; + uint8 green; + uint8 blue; + uint8 alpha; +}; + +typedef uint8 gray_color_value; + // TODO: system palette -- hard-coded for now, when the app server is ready // we should use system_colors() or BScreen::ColorMap(). const rgb_color kSystemPalette[] = { - { 0, 0, 0, 255 }, { 8, 8, 8, 255 }, { 16, 16, 16, 255 }, - { 24, 24, 24, 255 }, { 32, 32, 32, 255 }, { 40, 40, 40, 255 }, - { 48, 48, 48, 255 }, { 56, 56, 56, 255 }, { 64, 64, 64, 255 }, - { 72, 72, 72, 255 }, { 80, 80, 80, 255 }, { 88, 88, 88, 255 }, - { 96, 96, 96, 255 }, { 104, 104, 104, 255 }, { 112, 112, 112, 255 }, - { 120, 120, 120, 255 }, { 128, 128, 128, 255 }, { 136, 136, 136, 255 }, - { 144, 144, 144, 255 }, { 152, 152, 152, 255 }, { 160, 160, 160, 255 }, - { 168, 168, 168, 255 }, { 176, 176, 176, 255 }, { 184, 184, 184, 255 }, - { 192, 192, 192, 255 }, { 200, 200, 200, 255 }, { 208, 208, 208, 255 }, - { 216, 216, 216, 255 }, { 224, 224, 224, 255 }, { 232, 232, 232, 255 }, - { 240, 240, 240, 255 }, { 248, 248, 248, 255 }, { 0, 0, 255, 255 }, - { 0, 0, 229, 255 }, { 0, 0, 204, 255 }, { 0, 0, 179, 255 }, - { 0, 0, 154, 255 }, { 0, 0, 129, 255 }, { 0, 0, 105, 255 }, - { 0, 0, 80, 255 }, { 0, 0, 55, 255 }, { 0, 0, 30, 255 }, - { 255, 0, 0, 255 }, { 228, 0, 0, 255 }, { 203, 0, 0, 255 }, - { 178, 0, 0, 255 }, { 153, 0, 0, 255 }, { 128, 0, 0, 255 }, - { 105, 0, 0, 255 }, { 80, 0, 0, 255 }, { 55, 0, 0, 255 }, - { 30, 0, 0, 255 }, { 0, 255, 0, 255 }, { 0, 228, 0, 255 }, - { 0, 203, 0, 255 }, { 0, 178, 0, 255 }, { 0, 153, 0, 255 }, - { 0, 128, 0, 255 }, { 0, 105, 0, 255 }, { 0, 80, 0, 255 }, - { 0, 55, 0, 255 }, { 0, 30, 0, 255 }, { 0, 152, 51, 255 }, - { 255, 255, 255, 255 }, { 203, 255, 255, 255 }, { 203, 255, 203, 255 }, - { 203, 255, 152, 255 }, { 203, 255, 102, 255 }, { 203, 255, 51, 255 }, - { 203, 255, 0, 255 }, { 152, 255, 255, 255 }, { 152, 255, 203, 255 }, - { 152, 255, 152, 255 }, { 152, 255, 102, 255 }, { 152, 255, 51, 255 }, - { 152, 255, 0, 255 }, { 102, 255, 255, 255 }, { 102, 255, 203, 255 }, - { 102, 255, 152, 255 }, { 102, 255, 102, 255 }, { 102, 255, 51, 255 }, - { 102, 255, 0, 255 }, { 51, 255, 255, 255 }, { 51, 255, 203, 255 }, - { 51, 255, 152, 255 }, { 51, 255, 102, 255 }, { 51, 255, 51, 255 }, - { 51, 255, 0, 255 }, { 255, 152, 255, 255 }, { 255, 152, 203, 255 }, - { 255, 152, 152, 255 }, { 255, 152, 102, 255 }, { 255, 152, 51, 255 }, - { 255, 152, 0, 255 }, { 0, 102, 255, 255 }, { 0, 102, 203, 255 }, - { 203, 203, 255, 255 }, { 203, 203, 203, 255 }, { 203, 203, 152, 255 }, - { 203, 203, 102, 255 }, { 203, 203, 51, 255 }, { 203, 203, 0, 255 }, - { 152, 203, 255, 255 }, { 152, 203, 203, 255 }, { 152, 203, 152, 255 }, - { 152, 203, 102, 255 }, { 152, 203, 51, 255 }, { 152, 203, 0, 255 }, - { 102, 203, 255, 255 }, { 102, 203, 203, 255 }, { 102, 203, 152, 255 }, - { 102, 203, 102, 255 }, { 102, 203, 51, 255 }, { 102, 203, 0, 255 }, - { 51, 203, 255, 255 }, { 51, 203, 203, 255 }, { 51, 203, 152, 255 }, - { 51, 203, 102, 255 }, { 51, 203, 51, 255 }, { 51, 203, 0, 255 }, - { 255, 102, 255, 255 }, { 255, 102, 203, 255 }, { 255, 102, 152, 255 }, - { 255, 102, 102, 255 }, { 255, 102, 51, 255 }, { 255, 102, 0, 255 }, - { 0, 102, 152, 255 }, { 0, 102, 102, 255 }, { 203, 152, 255, 255 }, - { 203, 152, 203, 255 }, { 203, 152, 152, 255 }, { 203, 152, 102, 255 }, - { 203, 152, 51, 255 }, { 203, 152, 0, 255 }, { 152, 152, 255, 255 }, - { 152, 152, 203, 255 }, { 152, 152, 152, 255 }, { 152, 152, 102, 255 }, - { 152, 152, 51, 255 }, { 152, 152, 0, 255 }, { 102, 152, 255, 255 }, - { 102, 152, 203, 255 }, { 102, 152, 152, 255 }, { 102, 152, 102, 255 }, - { 102, 152, 51, 255 }, { 102, 152, 0, 255 }, { 51, 152, 255, 255 }, - { 51, 152, 203, 255 }, { 51, 152, 152, 255 }, { 51, 152, 102, 255 }, - { 51, 152, 51, 255 }, { 51, 152, 0, 255 }, { 230, 134, 0, 255 }, - { 255, 51, 203, 255 }, { 255, 51, 152, 255 }, { 255, 51, 102, 255 }, - { 255, 51, 51, 255 }, { 255, 51, 0, 255 }, { 0, 102, 51, 255 }, - { 0, 102, 0, 255 }, { 203, 102, 255, 255 }, { 203, 102, 203, 255 }, - { 203, 102, 152, 255 }, { 203, 102, 102, 255 }, { 203, 102, 51, 255 }, - { 203, 102, 0, 255 }, { 152, 102, 255, 255 }, { 152, 102, 203, 255 }, - { 152, 102, 152, 255 }, { 152, 102, 102, 255 }, { 152, 102, 51, 255 }, - { 152, 102, 0, 255 }, { 102, 102, 255, 255 }, { 102, 102, 203, 255 }, - { 102, 102, 152, 255 }, { 102, 102, 102, 255 }, { 102, 102, 51, 255 }, - { 102, 102, 0, 255 }, { 51, 102, 255, 255 }, { 51, 102, 203, 255 }, - { 51, 102, 152, 255 }, { 51, 102, 102, 255 }, { 51, 102, 51, 255 }, - { 51, 102, 0, 255 }, { 255, 0, 255, 255 }, { 255, 0, 203, 255 }, - { 255, 0, 152, 255 }, { 255, 0, 102, 255 }, { 255, 0, 51, 255 }, - { 255, 175, 19, 255 }, { 0, 51, 255, 255 }, { 0, 51, 203, 255 }, - { 203, 51, 255, 255 }, { 203, 51, 203, 255 }, { 203, 51, 152, 255 }, - { 203, 51, 102, 255 }, { 203, 51, 51, 255 }, { 203, 51, 0, 255 }, - { 152, 51, 255, 255 }, { 152, 51, 203, 255 }, { 152, 51, 152, 255 }, - { 152, 51, 102, 255 }, { 152, 51, 51, 255 }, { 152, 51, 0, 255 }, - { 102, 51, 255, 255 }, { 102, 51, 203, 255 }, { 102, 51, 152, 255 }, - { 102, 51, 102, 255 }, { 102, 51, 51, 255 }, { 102, 51, 0, 255 }, - { 51, 51, 255, 255 }, { 51, 51, 203, 255 }, { 51, 51, 152, 255 }, - { 51, 51, 102, 255 }, { 51, 51, 51, 255 }, { 51, 51, 0, 255 }, - { 255, 203, 102, 255 }, { 255, 203, 152, 255 }, { 255, 203, 203, 255 }, - { 255, 203, 255, 255 }, { 0, 51, 152, 255 }, { 0, 51, 102, 255 }, - { 0, 51, 51, 255 }, { 0, 51, 0, 255 }, { 203, 0, 255, 255 }, - { 203, 0, 203, 255 }, { 203, 0, 152, 255 }, { 203, 0, 102, 255 }, - { 203, 0, 51, 255 }, { 255, 227, 70, 255 }, { 152, 0, 255, 255 }, - { 152, 0, 203, 255 }, { 152, 0, 152, 255 }, { 152, 0, 102, 255 }, - { 152, 0, 51, 255 }, { 152, 0, 0, 255 }, { 102, 0, 255, 255 }, - { 102, 0, 203, 255 }, { 102, 0, 152, 255 }, { 102, 0, 102, 255 }, - { 102, 0, 51, 255 }, { 102, 0, 0, 255 }, { 51, 0, 255, 255 }, - { 51, 0, 203, 255 }, { 51, 0, 152, 255 }, { 51, 0, 102, 255 }, - { 51, 0, 51, 255 }, { 51, 0, 0, 255 }, { 255, 203, 51, 255 }, - { 255, 203, 0, 255 }, { 255, 255, 0, 255 }, { 255, 255, 51, 255 }, - { 255, 255, 102, 255 }, { 255, 255, 152, 255 }, { 255, 255, 203, 255 }, - { 255, 255, 255, 0 } // B_TRANSPARENT_MAGIC_CMAP8 + { 0, 0, 0, 255 }, { 8, 8, 8, 255 }, { 16, 16, 16, 255 }, + { 24, 24, 24, 255 }, { 32, 32, 32, 255 }, { 40, 40, 40, 255 }, + { 48, 48, 48, 255 }, { 56, 56, 56, 255 }, { 64, 64, 64, 255 }, + { 72, 72, 72, 255 }, { 80, 80, 80, 255 }, { 88, 88, 88, 255 }, + { 96, 96, 96, 255 }, { 104, 104, 104, 255 }, { 112, 112, 112, 255 }, + { 120, 120, 120, 255 }, { 128, 128, 128, 255 }, { 136, 136, 136, 255 }, + { 144, 144, 144, 255 }, { 152, 152, 152, 255 }, { 160, 160, 160, 255 }, + { 168, 168, 168, 255 }, { 176, 176, 176, 255 }, { 184, 184, 184, 255 }, + { 192, 192, 192, 255 }, { 200, 200, 200, 255 }, { 208, 208, 208, 255 }, + { 216, 216, 216, 255 }, { 224, 224, 224, 255 }, { 232, 232, 232, 255 }, + { 240, 240, 240, 255 }, { 248, 248, 248, 255 }, { 0, 0, 255, 255 }, + { 0, 0, 229, 255 }, { 0, 0, 204, 255 }, { 0, 0, 179, 255 }, + { 0, 0, 154, 255 }, { 0, 0, 129, 255 }, { 0, 0, 105, 255 }, + { 0, 0, 80, 255 }, { 0, 0, 55, 255 }, { 0, 0, 30, 255 }, + { 255, 0, 0, 255 }, { 228, 0, 0, 255 }, { 203, 0, 0, 255 }, + { 178, 0, 0, 255 }, { 153, 0, 0, 255 }, { 128, 0, 0, 255 }, + { 105, 0, 0, 255 }, { 80, 0, 0, 255 }, { 55, 0, 0, 255 }, + { 30, 0, 0, 255 }, { 0, 255, 0, 255 }, { 0, 228, 0, 255 }, + { 0, 203, 0, 255 }, { 0, 178, 0, 255 }, { 0, 153, 0, 255 }, + { 0, 128, 0, 255 }, { 0, 105, 0, 255 }, { 0, 80, 0, 255 }, + { 0, 55, 0, 255 }, { 0, 30, 0, 255 }, { 0, 152, 51, 255 }, + { 255, 255, 255, 255 }, { 203, 255, 255, 255 }, { 203, 255, 203, 255 }, + { 203, 255, 152, 255 }, { 203, 255, 102, 255 }, { 203, 255, 51, 255 }, + { 203, 255, 0, 255 }, { 152, 255, 255, 255 }, { 152, 255, 203, 255 }, + { 152, 255, 152, 255 }, { 152, 255, 102, 255 }, { 152, 255, 51, 255 }, + { 152, 255, 0, 255 }, { 102, 255, 255, 255 }, { 102, 255, 203, 255 }, + { 102, 255, 152, 255 }, { 102, 255, 102, 255 }, { 102, 255, 51, 255 }, + { 102, 255, 0, 255 }, { 51, 255, 255, 255 }, { 51, 255, 203, 255 }, + { 51, 255, 152, 255 }, { 51, 255, 102, 255 }, { 51, 255, 51, 255 }, + { 51, 255, 0, 255 }, { 255, 152, 255, 255 }, { 255, 152, 203, 255 }, + { 255, 152, 152, 255 }, { 255, 152, 102, 255 }, { 255, 152, 51, 255 }, + { 255, 152, 0, 255 }, { 0, 102, 255, 255 }, { 0, 102, 203, 255 }, + { 203, 203, 255, 255 }, { 203, 203, 203, 255 }, { 203, 203, 152, 255 }, + { 203, 203, 102, 255 }, { 203, 203, 51, 255 }, { 203, 203, 0, 255 }, + { 152, 203, 255, 255 }, { 152, 203, 203, 255 }, { 152, 203, 152, 255 }, + { 152, 203, 102, 255 }, { 152, 203, 51, 255 }, { 152, 203, 0, 255 }, + { 102, 203, 255, 255 }, { 102, 203, 203, 255 }, { 102, 203, 152, 255 }, + { 102, 203, 102, 255 }, { 102, 203, 51, 255 }, { 102, 203, 0, 255 }, + { 51, 203, 255, 255 }, { 51, 203, 203, 255 }, { 51, 203, 152, 255 }, + { 51, 203, 102, 255 }, { 51, 203, 51, 255 }, { 51, 203, 0, 255 }, + { 255, 102, 255, 255 }, { 255, 102, 203, 255 }, { 255, 102, 152, 255 }, + { 255, 102, 102, 255 }, { 255, 102, 51, 255 }, { 255, 102, 0, 255 }, + { 0, 102, 152, 255 }, { 0, 102, 102, 255 }, { 203, 152, 255, 255 }, + { 203, 152, 203, 255 }, { 203, 152, 152, 255 }, { 203, 152, 102, 255 }, + { 203, 152, 51, 255 }, { 203, 152, 0, 255 }, { 152, 152, 255, 255 }, + { 152, 152, 203, 255 }, { 152, 152, 152, 255 }, { 152, 152, 102, 255 }, + { 152, 152, 51, 255 }, { 152, 152, 0, 255 }, { 102, 152, 255, 255 }, + { 102, 152, 203, 255 }, { 102, 152, 152, 255 }, { 102, 152, 102, 255 }, + { 102, 152, 51, 255 }, { 102, 152, 0, 255 }, { 51, 152, 255, 255 }, + { 51, 152, 203, 255 }, { 51, 152, 152, 255 }, { 51, 152, 102, 255 }, + { 51, 152, 51, 255 }, { 51, 152, 0, 255 }, { 230, 134, 0, 255 }, + { 255, 51, 203, 255 }, { 255, 51, 152, 255 }, { 255, 51, 102, 255 }, + { 255, 51, 51, 255 }, { 255, 51, 0, 255 }, { 0, 102, 51, 255 }, + { 0, 102, 0, 255 }, { 203, 102, 255, 255 }, { 203, 102, 203, 255 }, + { 203, 102, 152, 255 }, { 203, 102, 102, 255 }, { 203, 102, 51, 255 }, + { 203, 102, 0, 255 }, { 152, 102, 255, 255 }, { 152, 102, 203, 255 }, + { 152, 102, 152, 255 }, { 152, 102, 102, 255 }, { 152, 102, 51, 255 }, + { 152, 102, 0, 255 }, { 102, 102, 255, 255 }, { 102, 102, 203, 255 }, + { 102, 102, 152, 255 }, { 102, 102, 102, 255 }, { 102, 102, 51, 255 }, + { 102, 102, 0, 255 }, { 51, 102, 255, 255 }, { 51, 102, 203, 255 }, + { 51, 102, 152, 255 }, { 51, 102, 102, 255 }, { 51, 102, 51, 255 }, + { 51, 102, 0, 255 }, { 255, 0, 255, 255 }, { 255, 0, 203, 255 }, + { 255, 0, 152, 255 }, { 255, 0, 102, 255 }, { 255, 0, 51, 255 }, + { 255, 175, 19, 255 }, { 0, 51, 255, 255 }, { 0, 51, 203, 255 }, + { 203, 51, 255, 255 }, { 203, 51, 203, 255 }, { 203, 51, 152, 255 }, + { 203, 51, 102, 255 }, { 203, 51, 51, 255 }, { 203, 51, 0, 255 }, + { 152, 51, 255, 255 }, { 152, 51, 203, 255 }, { 152, 51, 152, 255 }, + { 152, 51, 102, 255 }, { 152, 51, 51, 255 }, { 152, 51, 0, 255 }, + { 102, 51, 255, 255 }, { 102, 51, 203, 255 }, { 102, 51, 152, 255 }, + { 102, 51, 102, 255 }, { 102, 51, 51, 255 }, { 102, 51, 0, 255 }, + { 51, 51, 255, 255 }, { 51, 51, 203, 255 }, { 51, 51, 152, 255 }, + { 51, 51, 102, 255 }, { 51, 51, 51, 255 }, { 51, 51, 0, 255 }, + { 255, 203, 102, 255 }, { 255, 203, 152, 255 }, { 255, 203, 203, 255 }, + { 255, 203, 255, 255 }, { 0, 51, 152, 255 }, { 0, 51, 102, 255 }, + { 0, 51, 51, 255 }, { 0, 51, 0, 255 }, { 203, 0, 255, 255 }, + { 203, 0, 203, 255 }, { 203, 0, 152, 255 }, { 203, 0, 102, 255 }, + { 203, 0, 51, 255 }, { 255, 227, 70, 255 }, { 152, 0, 255, 255 }, + { 152, 0, 203, 255 }, { 152, 0, 152, 255 }, { 152, 0, 102, 255 }, + { 152, 0, 51, 255 }, { 152, 0, 0, 255 }, { 102, 0, 255, 255 }, + { 102, 0, 203, 255 }, { 102, 0, 152, 255 }, { 102, 0, 102, 255 }, + { 102, 0, 51, 255 }, { 102, 0, 0, 255 }, { 51, 0, 255, 255 }, + { 51, 0, 203, 255 }, { 51, 0, 152, 255 }, { 51, 0, 102, 255 }, + { 51, 0, 51, 255 }, { 51, 0, 0, 255 }, { 255, 203, 51, 255 }, + { 255, 203, 0, 255 }, { 255, 255, 0, 255 }, { 255, 255, 51, 255 }, + { 255, 255, 102, 255 }, { 255, 255, 152, 255 }, { 255, 255, 203, 255 }, + { 255, 255, 255, 0 } // B_TRANSPARENT_MAGIC_CMAP8 }; -// get_raw_bytes_per_row /*! \brief Returns the number of bytes per row needed to store the actual bitmap data (not including any padding) given a color space and a row width. @@ -125,8 +173,7 @@ \return The number of bytes per row needed to store data for a row, or 0, if the color space is not supported. */ -static inline -int32 +static inline int32 get_raw_bytes_per_row(color_space colorSpace, int32 width) { int32 bpr = 0; @@ -177,7 +224,7 @@ return bpr; } -// get_bytes_per_row + /*! \brief Returns the number of bytes per row needed to store the bitmap data (including any padding) given a color space and a row width. \param colorSpace The color space. @@ -185,8 +232,7 @@ \return The number of bytes per row needed to store data for a row, or 0, if the color space is not supported. */ -static inline -int32 +static inline int32 get_bytes_per_row(color_space colorSpace, int32 width) { int32 bpr = get_raw_bytes_per_row(colorSpace, width); @@ -195,7 +241,7 @@ return bpr; } -// brightness_for + /*! \brief Returns the brightness of an RGB 24 color. \param red Value of the red component. \param green Value of the green component. @@ -203,8 +249,7 @@ \return The brightness for the supplied RGB color as a value between 0 and 255. */ -static inline -uint8 +static inline uint8 brightness_for(uint8 red, uint8 green, uint8 blue) { // brightness = 0.301 * red + 0.586 * green + 0.113 * blue @@ -213,7 +258,7 @@ return uint8((308 * red + 600 * green + 116 * blue) / 1024); } -// color_distance + /*! \brief Returns the "distance" between two RGB colors. This functions defines an metric on the RGB color space. The distance @@ -227,10 +272,9 @@ \param blue2 Blue component of the second color. \return The distance between the given colors. */ -static inline -unsigned -color_distance(uint8 red1, uint8 green1, uint8 blue1, - uint8 red2, uint8 green2, uint8 blue2) +static inline unsigned +color_distance(uint8 red1, uint8 green1, uint8 blue1, uint8 red2, uint8 green2, + uint8 blue2) { // euklidian distance (its square actually) int rd = (int)red1 - (int)red2; @@ -240,20 +284,28 @@ // distance according to psycho-visual tests int rmean = ((int)red1 + (int)red2) / 2; - return (((512 + rmean) * rd * rd) >> 8) - + 4 * gd * gd - + (((767 - rmean) * bd * bd) >> 8); + return (((512 + rmean) * rd * rd) >> 8) + 4 * gd * gd + + (((767 - rmean) * bd * bd) >> 8); } -// bit_mask, inverse_bit_mask -static inline int32 bit_mask(int32 bit) { return (1 << bit); } -static inline int32 inverse_bit_mask(int32 bit) { return ~bit_mask(bit); } +static inline int32 +bit_mask(int32 bit) +{ + return 1 << bit; +} -////////////////////// -// PaletteConverter // -////////////////////// +static inline int32 +inverse_bit_mask(int32 bit) +{ + return ~bit_mask(bit); +} + + +// #pragma mark - PaletteConverter + + namespace BPrivate { /*! \brief Helper class for conversion between RGB and palette colors. @@ -282,7 +334,7 @@ inline uint16 RGB16ColorForIndex(uint8 index) const; inline uint32 RGB24ColorForIndex(uint8 index) const; inline void RGB24ColorForIndex(uint8 index, uint8 &red, uint8 &green, - uint8 &blue, uint8 &alpha) const; + uint8 &blue, uint8 &alpha) const; inline uint8 GrayColorForIndex(uint8 index) const; private: @@ -296,7 +348,7 @@ using BPrivate::PaletteConverter; using namespace std; -// constructor + /*! \brief Creates an uninitialized PaletteConverter. */ PaletteConverter::PaletteConverter() @@ -306,7 +358,7 @@ { } -// constructor + /*! \brief Creates a PaletteConverter and initializes it to the supplied palette. \param palette The palette being a 256 entry rgb_color array. @@ -319,7 +371,7 @@ SetTo(palette); } -// constructor + /*! \brief Creates a PaletteConverter and initializes it to the supplied color map. \param colorMap The completely initialized color map. @@ -332,7 +384,7 @@ SetTo(colorMap); } -// destructor + /*! \brief Frees all resources associated with this object. */ PaletteConverter::~PaletteConverter() @@ -340,7 +392,7 @@ delete fOwnColorMap; } -// SetTo + /*! \brief Initializes the converter to the supplied palette. \param palette The palette being a 256 entry rgb_color array. \return \c B_OK, if everything went fine, an error code otherwise. @@ -391,7 +443,7 @@ return error; } -// SetTo + /*! \brief Initializes the converter to the supplied color map. \param colorMap The completely initialized color map. \return \c B_OK, if everything went fine, an error code otherwise. @@ -406,11 +458,11 @@ } // set fColorMap = colorMap; - fCStatus = (fColorMap ? B_OK : B_BAD_VALUE); + fCStatus = fColorMap ? B_OK : B_BAD_VALUE; return fCStatus; } -// InitCheck + /*! \brief Returns the result of the last initialization via constructor or SetTo(). \return \c B_OK, if the converter is properly initialized, an error code @@ -422,7 +474,7 @@ return fCStatus; } -// IndexForRGB15 + /*! \brief Returns the palette color index closest to a given RGB 15 color. The object must be properly initialized. @@ -430,14 +482,13 @@ \param rgb The RGB 15 color value (R[14:10]G[9:5]B[4:0]). \return The palette color index for the supplied color. */ -inline -uint8 +inline uint8 PaletteConverter::IndexForRGB15(uint16 rgb) const { return fColorMap->index_map[rgb]; } -// IndexForRGB15 + /*! \brief Returns the palette color index closest to a given RGB 15 color. The object must be properly initialized. @@ -447,15 +498,14 @@ \param blue Blue component of the color (B[4:0]). \return The palette color index for the supplied color. */ -inline -uint8 +inline uint8 PaletteConverter::IndexForRGB15(uint8 red, uint8 green, uint8 blue) const { // the 5 least significant bits are used return fColorMap->index_map[(red << 10) | (green << 5) | blue]; } -// IndexForRGB16 + /*! \brief Returns the palette color index closest to a given RGB 16 color. The object must be properly initialized. @@ -463,14 +513,13 @@ \param rgb The RGB 16 color value (R[15:11]G[10:5]B[4:0]). \return The palette color index for the supplied color. */ -inline -uint8 +inline uint8 PaletteConverter::IndexForRGB16(uint16 rgb) const { - return fColorMap->index_map[(rgb >> 1) & 0x7fe0 | rgb & 0x1f]; + return fColorMap->index_map[((rgb >> 1) & 0x7fe0) | (rgb & 0x1f)]; } -// IndexForRGB16 + /*! \brief Returns the palette color index closest to a given RGB 16 color. The object must be properly initialized. @@ -480,15 +529,14 @@ \param blue Blue component of the color (B[4:0]). \return The palette color index for the supplied color. */ -inline -uint8 +inline uint8 PaletteConverter::IndexForRGB16(uint8 red, uint8 green, uint8 blue) const { // the 5 (for red, blue) / 6 (for green) least significant bits are used return fColorMap->index_map[(red << 10) | ((green & 0x3e) << 4) | blue]; } -// IndexForRGB24 + /*! \brief Returns the palette color index closest to a given RGB 32 color. The object must be properly initialized. @@ -496,16 +544,14 @@ \param rgb The RGB 32 color value (R[31:24]G[23:16]B[15:8]). \return The palette color index for the supplied color. */ -inline -uint8 +inline uint8 PaletteConverter::IndexForRGB24(uint32 rgb) const { return fColorMap->index_map[((rgb & 0xf8000000) >> 17) - | ((rgb & 0xf80000) >> 14) - | ((rgb & 0xf800) >> 11)]; + | ((rgb & 0xf80000) >> 14) | ((rgb & 0xf800) >> 11)]; } -// IndexForRGB24 + /*! \brief Returns the palette color index closest to a given RGB 24 color. The object must be properly initialized. @@ -515,16 +561,14 @@ \param blue Blue component of the color. \return The palette color index for the supplied color. */ -inline -uint8 +inline uint8 PaletteConverter::IndexForRGB24(uint8 red, uint8 green, uint8 blue) const { - return fColorMap->index_map[((red & 0xf8) << 7) - | ((green & 0xf8) << 2) - | (blue >> 3)]; + return fColorMap->index_map[((red & 0xf8) << 7) | ((green & 0xf8) << 2) + | (blue >> 3)]; } -// IndexForGray + /*! \brief Returns the palette color index closest to a given Gray 8 color. The object must be properly initialized. @@ -532,14 +576,13 @@ \param gray The Gray 8 color value. \return The palette color index for the supplied color. */ -inline -uint8 +inline uint8 PaletteConverter::IndexForGray(uint8 gray) const { return IndexForRGB24(gray, gray, gray); } -// RGBColorForIndex + /*! \brief Returns the RGB color for a given palette color index. The object must be properly initialized. @@ -547,14 +590,13 @@ \param index The palette color index. \return The color for the supplied palette color index. */ -inline -const rgb_color & +inline const rgb_color & PaletteConverter::RGBColorForIndex(uint8 index) const { return fColorMap->color_list[index]; } -// RGB15ColorForIndex + /*! \brief Returns the RGB 15 color for a given palette color index. The object must be properly initialized. @@ -563,17 +605,15 @@ \return The color for the supplied palette color index (R[14:10]G[9:5]B[4:0]). */ -inline -uint16 +inline uint16 PaletteConverter::RGB15ColorForIndex(uint8 index) const { const rgb_color &color = fColorMap->color_list[index]; - return ((color.red & 0xf8) << 7) - | ((color.green & 0xf8) << 2) - | (color.blue >> 3); + return ((color.red & 0xf8) << 7) | ((color.green & 0xf8) << 2) + | (color.blue >> 3); } -// RGB16ColorForIndex + /*! \brief Returns the RGB 16 color for a given palette color index. The object must be properly initialized. @@ -582,17 +622,15 @@ \return The color for the supplied palette color index (R[15:11]G[10:5]B[4:0]). */ -inline -uint16 +inline uint16 PaletteConverter::RGB16ColorForIndex(uint8 index) const { const rgb_color &color = fColorMap->color_list[index]; - return ((color.red & 0xf8) << 8) - | ((color.green & 0xfc) << 3) - | (color.blue >> 3); + return ((color.red & 0xf8) << 8) | ((color.green & 0xfc) << 3) + | (color.blue >> 3); } -// RGB24ColorForIndex + /*! \brief Returns the RGB 24 color for a given palette color index. The object must be properly initialized. @@ -601,15 +639,15 @@ \return The color for the supplied palette color index (R[31:24]G[23:16]B[15:8]). */ -inline -uint32 +inline uint32 PaletteConverter::RGB24ColorForIndex(uint8 index) const { const rgb_color &color = fColorMap->color_list[index]; - return (color.blue << 24) | (color.red << 8) | (color.green << 16) | color.alpha; + return (color.blue << 24) | (color.red << 8) | (color.green << 16) + | color.alpha; } -// RGB24ColorForIndex + /*! \brief Returns the RGB 24 color for a given palette color index. The object must be properly initialized. @@ -622,10 +660,9 @@ \param blue Reference to the variable the blue component shall be stored into. */ -inline -void +inline void PaletteConverter::RGB24ColorForIndex(uint8 index, uint8 &red, uint8 &green, - uint8 &blue, uint8 &alpha) const + uint8 &blue, uint8 &alpha) const { const rgb_color &color = fColorMap->color_list[index]; red = color.red; @@ -634,7 +671,7 @@ alpha = color.alpha; } -// GrayColorForIndex + /*! \brief Returns the Gray 8 color for a given palette color index. The object must be properly initialized. @@ -642,8 +679,7 @@ \param index The palette color index. \return The color for the supplied palette color index. */ -inline -uint8 +inline uint8 PaletteConverter::GrayColorForIndex(uint8 index) const { const rgb_color &color = fColorMap->color_list[index]; @@ -651,15 +687,14 @@ } // TODO: Remove these and palette_converter() when BScreen is available. -static BLocker gPaletteConverterLock; +static BLocker gPaletteConverterLock; static PaletteConverter gPaletteConverter; -// palette_converter + /*! \brief Returns a PaletteConverter using the system color palette. \return A PaletteConverter. */ -static -const PaletteConverter* +static const PaletteConverter* palette_converter() { if (gPaletteConverterLock.Lock()) { @@ -671,370 +706,9 @@ } -///////////// -// BBitmap // -///////////// +// #pragma mark - Reader classes -// constructor -/*! \brief Creates and initializes a BBitmap. - \param bounds The bitmap dimensions. - \param flags Creation flags. - \param colorSpace The bitmap's color space. - \param bytesPerRow The number of bytes per row the bitmap should use. - \c B_ANY_BYTES_PER_ROW to let the constructor choose an appropriate - value. - \param screenID ??? -*/ -BBitmap::BBitmap(BRect bounds, uint32 flags, color_space colorSpace, - int32 bytesPerRow, screen_id screenID) - : fBasePtr(NULL), - fSize(0), - fColorSpace(B_NO_COLOR_SPACE), - fBounds(0, 0, -1, -1), - fBytesPerRow(0), - fServerToken(-1), - fToken(-1), - fArea(-1), - fOrigArea(-1), - fFlags(0), - fInitError(B_NO_INIT) -{ - InitObject(bounds, colorSpace, flags, bytesPerRow, screenID); -} -// constructor -/*! \brief Creates and initializes a BBitmap. - \param bounds The bitmap dimensions. - \param colorSpace The bitmap's color space. - \param acceptsViews \c true, if the bitmap shall accept BViews, i.e. if - it shall be possible to attach BView to the bitmap and draw into - it. - \param needsContiguous If \c true a physically contiguous chunk of memory - will be allocated. -*/ -BBitmap::BBitmap(BRect bounds, color_space colorSpace, bool acceptsViews, - bool needsContiguous) - : fBasePtr(NULL), - fSize(0), - fColorSpace(B_NO_COLOR_SPACE), - fBounds(0, 0, -1, -1), - fBytesPerRow(0), - fServerToken(-1), - fToken(-1), - fArea(-1), - fOrigArea(-1), - fFlags(0), - fInitError(B_NO_INIT) -{ - int32 flags = (acceptsViews ? B_BITMAP_ACCEPTS_VIEWS : 0) - | (needsContiguous ? B_BITMAP_IS_CONTIGUOUS : 0); - InitObject(bounds, colorSpace, flags, B_ANY_BYTES_PER_ROW, - B_MAIN_SCREEN_ID); - -} - -// constructor -/*! \brief Creates a BBitmap as a clone of another bitmap. - \param source The source bitmap. - \param acceptsViews \c true, if the bitmap shall accept BViews, i.e. if - it shall be possible to attach BView to the bitmap and draw into - it. - \param needsContiguous If \c true a physically contiguous chunk of memory - will be allocated. -*/ -BBitmap::BBitmap(const BBitmap *source, bool acceptsViews, - bool needsContiguous) - : fBasePtr(NULL), - fSize(0), - fColorSpace(B_NO_COLOR_SPACE), - fBounds(0, 0, -1, -1), - fBytesPerRow(0), - fServerToken(-1), - fToken(-1), - fArea(-1), - fOrigArea(-1), - fFlags(0), - fInitError(B_NO_INIT) -{ - if (source && source->IsValid()) { - int32 flags = (acceptsViews ? B_BITMAP_ACCEPTS_VIEWS : 0) - | (needsContiguous ? B_BITMAP_IS_CONTIGUOUS : 0); - InitObject(source->Bounds(), source->ColorSpace(), flags, - source->BytesPerRow(), B_MAIN_SCREEN_ID); - if (InitCheck() == B_OK) - memcpy(Bits(), source->Bits(), BytesPerRow()); - } -} - -// destructor -/*! \brief Frees all resources associated with this object. -*/ -BBitmap::~BBitmap() -{ - CleanUp(); -} - -// unarchiving constructor -/*! \brief Unarchives a bitmap from a BMessage. - \param data The archive. -*/ -BBitmap::BBitmap(BMessage *data) - : BArchivable(data), - fBasePtr(NULL), - fSize(0), - fColorSpace(B_NO_COLOR_SPACE), - fBounds(0, 0, -1, -1), - fBytesPerRow(0), - fServerToken(-1), - fToken(-1), - fArea(-1), - fOrigArea(-1), - fFlags(0), - fInitError(B_NO_INIT) -{ - BRect bounds; - data->FindRect("_frame", &bounds); - - color_space cspace; - data->FindInt32("_cspace", (int32 *)&cspace); - - int32 flags = 0; - data->FindInt32("_bmflags", &flags); - - int32 rowbytes = 0; - data->FindInt32("_rowbytes", &rowbytes); - -flags |= B_BITMAP_NO_SERVER_LINK; -flags &= ~B_BITMAP_ACCEPTS_VIEWS; - InitObject(bounds, cspace, flags, rowbytes, B_MAIN_SCREEN_ID); - - if (data->HasData("_data", B_RAW_TYPE) && InitCheck() == B_OK) { - ssize_t size = 0; - const void *buffer; - if (data->FindData("_data", B_RAW_TYPE, &buffer, &size) == B_OK) - memcpy(fBasePtr, buffer, size); - } - - if (fFlags & B_BITMAP_ACCEPTS_VIEWS) { -// BArchivable *obj; -// BMessage message; -// int i = 0; -// -// while (data->FindMessage("_view", i++, &message) == B_OK) { -// obj = instantiate_object(&message); -// BView *view = dynamic_cast(obj); -// -// if (view) -// AddChild(view); -// } - } -} - -// Instantiate -/*! \brief Instantiates a BBitmap from an archive. - \param data The archive. - \return A bitmap reconstructed from the archive or \c NULL, if an error - occured. -*/ -BArchivable * -BBitmap::Instantiate(BMessage *data) -{ - if (validate_instantiation(data, "BBitmap")) - return new BBitmap(data); - - return NULL; -} - -// Archive -/*! \brief Archives the BBitmap object. - \param data The archive. - \param deep \c true, if child object shall be archived as well, \c false - otherwise. - \return \c B_OK, if everything went fine, an error code otherwise. -*/ -status_t -BBitmap::Archive(BMessage *data, bool deep) const -{ - BArchivable::Archive(data, deep); - - data->AddRect("_frame", fBounds); - data->AddInt32("_cspace", (int32)fColorSpace); - data->AddInt32("_bmflags", fFlags); - data->AddInt32("_rowbytes", fBytesPerRow); - - if (deep) { - if (fFlags & B_BITMAP_ACCEPTS_VIEWS) { -// BMessage views; -// for (int32 i = 0; i < CountChildren(); i++) { -// if (ChildAt(i)->Archive(&views, deep)) -// data->AddMessage("_views", &views); -// } - } - // Note: R5 does not archive the data if B_BITMAP_IS_CONTIGNUOUS is - // true and it does save all formats as B_RAW_TYPE and it does save - // the data even if B_BITMAP_ACCEPTS_VIEWS is set (as opposed to - // the BeBook) - - data->AddData("_data", B_RAW_TYPE, fBasePtr, fSize); - } - - return B_OK; -} - -// InitCheck -/*! \brief Returns the result from the construction. - \return \c B_OK, if the object is properly initialized, an error code - otherwise. -*/ -status_t -BBitmap::InitCheck() const -{ - return fInitError; -} - -// IsValid -/*! \brief Returns whether or not the BBitmap object is valid. - \return \c true, if the object is properly initialized, \c false otherwise. -*/ -bool -BBitmap::IsValid() const -{ - return (InitCheck() == B_OK); -} - -// LockBits -/*! \brief ??? -*/ -status_t -BBitmap::LockBits(uint32 *state) -{ - return B_ERROR; -} - -// UnlockBits -/*! \brief ??? -*/ -void -BBitmap::UnlockBits() -{ -} - -// Area -/*! \brief Returns the ID of the area the bitmap data reside in. - \return The ID of the area the bitmap data reside in. -*/ -area_id -BBitmap::Area() const -{ - return fArea; -} - -// Bits -/*! \brief Returns the pointer to the bitmap data. - \return The pointer to the bitmap data. -*/ -void * -BBitmap::Bits() const -{ - return fBasePtr; -} - -// BitsLength -/*! \brief Returns the size of the bitmap data. - \return The size of the bitmap data. -*/ -int32 -BBitmap::BitsLength() const -{ - return fSize; -} - -// BytesPerRow -/*! \brief Returns the number of bytes used to store a row of bitmap data. [... truncated: 555 lines follow ...] From axeld at mail.berlios.de Mon Jun 2 17:45:23 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 2 Jun 2008 17:45:23 +0200 Subject: [Haiku-commits] r25760 - haiku/trunk/docs/develop/kernel Message-ID: <200806021545.m52FjNC9018181@sheep.berlios.de> Author: axeld Date: 2008-06-02 17:45:22 +0200 (Mon, 02 Jun 2008) New Revision: 25760 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25760&view=rev Added: haiku/trunk/docs/develop/kernel/device_manager_introduction.html Log: An early version of an introduction to the new device manager. Will be expanded more over the following days, and published on the website. Comments welcome! Added: haiku/trunk/docs/develop/kernel/device_manager_introduction.html =================================================================== --- haiku/trunk/docs/develop/kernel/device_manager_introduction.html 2008-06-02 11:24:11 UTC (rev 25759) +++ haiku/trunk/docs/develop/kernel/device_manager_introduction.html 2008-06-02 15:45:22 UTC (rev 25760) @@ -0,0 +1,249 @@ + + + +

Introduction to Haiku's Device Driver Architecture

+ +

This document tries to give you a short introduction into the new device +manager, and how to write drivers for it. Haiku still supports the legacy +device driver architecture introduced with BeOS.

+ +

The new device driver architecture of Haiku is still a moving target, +although most of its details are already specificed.

+ + +

1. The Basics

+ +

The device manager functionality builds upon device_node objects. +Every driver in the system publishes one or more of such nodes, building a +tree of device nodes. This tree is in theory a dynamic representation of the +current hardware devices in the system, but in practice will also contain +implementation specific details; since every node comes with an API specific +to that node, you'll find device nodes that only come with a number of support +functions for a certain class of drivers.

+ +

Structurally, a device_node is a set of a module, attributes, +and resources, as well as a parent and children. At a minimum, a node must +have a module, all other components are optional.

+ +TODO: picture of the device node tree + +

When the system starts, there is only a root node registered. Only primary +hardware busses register with the root node, such as PCI, and ISA on x86. +Since the PCI bus is an intelligent bus, it knows what hardware is installed, +and registers a child node for each device on the bus.

+ +

Every driver can also publish a device in /dev for communication with +userland applications. All drivers and devices are kernel modules.

+ + +

2. Exploring the Device Tree

+ +

So how does it all work? When building the initial device tree, the system only +explores a minimum of device drivers only, resulting in a tree that basically +only shows the hardware found in the computer.

+ +

Now, if the system requires disk access, it will scan the device file system +for a driver that provides such functionality, in this case, it will look for +drivers under "/dev/disk/". The device manager has a set of built-in rules for +how to translate a device path into a device node, and vice versa: every node +representing a device of an intelligent bus (such as PCI) will also contain +device type information following the PCI definitions. In this case, the "disk" +sub-path will translate into the PCI_mass_storage type, and hence, the +device manager will then completely explore all device nodes of that type.

+ +

It will also use that path information to only ask drivers that actually +are in a matching module directory. In the above example of a disk driver, this +would be either in "busses/scsi", "busses/ide", "drivers/disk", ...

+ +TODO: untyped/generic busses are not yet supported! + + +

3. Writing a Driver

+ +

The device manager assumes the following API from a driver module:

+
    +
  • supports_device()
    + Determines wether or not the driver supports a given parent device node, + that is the hardware device it represents (if any), and the API the node + exports.
  • +
  • register_device()
    + The driver should register its device node here. The parent driver is + always initialized at this point. When registering the node, the driver + can also attach certain I/O resources (like I/O ports, or memory ranges) + to the node -- the device manager will make sure that only one node can + claim these resources.
  • +
  • init_driver()
    + Any initialization necessary to get the driver going. For most drivers, + this will be reduced to the creation of a private data structure that is + going to be used for all of the following functions.
  • +
  • uninit_driver()
    + Uninitializes resources acquired by init_driver().
  • +
  • register_child_devices()
    + If the driver wants to register any child device nodes or to publish + any devices, it should do so here. This function is called only during + the initial registration process of the device node.
  • +
  • rescan_child_devices()
    + Is called whenever a manual rescan is triggered.
  • +
  • device_removed()
    + Is called when the device node is about to be unregistered when its + device is gone, for example when a USB device is unplugged.
  • +
  • suspend()
    + Enters different sleep modes.
  • +
  • resume()
    + Resumes a device from a previous sleep mode.
  • +
+

To ensure that a module exports this API, it must end its module name +with "driver_v1" to denote the version of the API it supports. Note that +suspend() and resume() are currently never called, as Haiku has +no power management implemented yet.

+ +

If your driver can give the device it is attached to a nice name that can be +presented to the user, it should add the B_DEVICE_PRETTY_NAME attribute +to the device node. +

The B_DEVICE_UNIQUE_ID should be used in case the device has a unique +ID that can be used to identify it, and also differentiate it from other devices +of the same model and vendor. This information will be added to the file system +attributes of all devices published by your driver, so that user applications +can identify, say, a USB printer no matter what USB slot it is attached to, and +assign it additional data, like paper configuration, or recognize it as the +default printer.

+

If your driver implements an API that is used by a support or bus module, you +will usually use the B_DEVICE_FIXED_CHILD attribute to specify exactly +which child device node you will be talking to. If you support several child +nodes, you may want to have a closer look at the section explaining +how to write a bus driver.

+ + +

4. Publishing a Device

+ +To publish a device entry in the device file system under /dev, all your +driver has to do is to call the +
+	publish_device(device_node *node, const char *path,
+		const char *deviceModuleName);
+
+function the device manager module exports. The path is the path +component that follows "/dev", for example "net/ipro1000/0". The +deviceModuleName is the module exporting the device functionality. +It should end with "device_v1" to show the device manager which protocol it +supports. If the device node your device belongs to is removed, your device +is removed automatically with it. On the other hand, you are allowed to +unpublish the device at any point using the unpublish_device() function +the device manager delivers for this.

+ +

A device module must export the following API:

+
    +
  • init_device()
    + This is called when the open() is called on this device for the first + time. You may want to create a private data structure that is passed on + to all subsequent calls of the open() function that your device + exports.
  • +
  • uninit_device()
    + Is called when the last file descriptor to the device had been closed.
  • +
  • device_removed()
    + When the device node your device belongs to is going to be removed, + you're notified about this in this function.
  • +
  • open()
    + Called whenever your device is opened.
  • +
  • close()
    +
  • +
  • free()
    + Free the private data structure you allocated in open().
  • +
  • read()
    +
  • +
  • write()
    +
  • +
  • io()
    + This is a replacement for the read(), and write() calls, + and allows, among other things, for asynchronous I/O. This functionality + has not yet been implemented, though (see below).
  • +
  • control()
    +
  • +
  • select()
    +
  • +
  • deselect()
    +
  • +
+ + +

5. Writing a Bus Driver

+ +

A bus driver is a driver that represents a bus where one or more arbitrary +devices can be attached to.

+ +

There are two basic types of busses: intelligent busses like PCI or USB that +know a lot about the devices attached to it, like a generic device type, as +well as device and vendor ID information, and simple untyped/generic busses that +either have not all the information (like device type) or don't even know what +and if any devices are attached. The device manager has been written in such a +way that device exploration makes use of additional information the bus can +provide in order to find a responsible device driver faster, and with less +overhead.

+ +

5.1. Writing an Intelligent Bus Driver

+ +

If your bus knows what type of device is attached to, and also has vendor and +device ID information about that device, it is considered to be an intelligent +bus. The bus driver is supposed to have one parent node representing the bus, +and to create a child node for each device attached to the bus.

+ +

The additional information you have about the devices are attached to the +device node in the following attributes:

+
    +
  • B_DEVICE_VENDOR_ID
    + The vendor ID - this ID has only to be valid in the namespace of your + bus.
  • +
  • B_DEVICE_ID
    + The device ID.
  • +
  • B_DEVICE_TYPE
    + The device type as defined by the PCI class base information.
  • +
  • B_DEVICE_SUB_TYPE
    + The device sub type as defined by the PCI sub class information.
  • +
  • B_DEVICE_INTERFACE
    + The device interface type as defined by the PCI class API information.
  • +
+ +

You can use the B_DEVICE_FLAGS attribute to define how the device +manager finds the children of the devices you exported. For this kind of bus +drivers, you will usually only want to specify B_FIND_CHILD_ON_DEMAND +here, which causes the driver only to be searched when the system asks for it. +

+ +

5.2. Writing a Simple Bus Driver

+ +TODO: support for these drivers is still missing! + + +

6. Open Issues

+ +While most of the new device manager is fledged out, there are some areas that +could use improvements or are problematic under certain requirements. Also, some +parts just haven't been written yet. + +

6.1. generic/simple busses

+ +

6.2. Unpublishing

+ +

6.3. listdev functionality

+ +The "listdev" command has been removed from the image, and it is currently not +functional anymore. + +

6.4. Versioning

+ +

The way the device manager works, it makes versioning of modules (which are +supposed to be one of the strong points of the module system) much harder or +even impossible. While the device manager could introduce a new API and could +translate between a "driver_v1", and a "driver_v2" API on the fly, it's not +yet possible for a PCI sub module to do the same thing.

+ +

Proposed Solution: Add attribute B_DEVICE_ALTERNATE_VERSION +that specifies alternate versions of the module API this device node supports. +We would then need a request_version() or set_version() function +(to be called from supports_device()) that allows to specify the version +of the parent node this device node wants to talk to.

+ +

6.5. Unregistering Nodes

+ + + From aldeck at mail.berlios.de Mon Jun 2 19:08:44 2008 From: aldeck at mail.berlios.de (aldeck at BerliOS) Date: Mon, 2 Jun 2008 19:08:44 +0200 Subject: [Haiku-commits] r25761 - haiku/trunk/src/preferences/screensaver Message-ID: <200806021708.m52H8ipP019364@sheep.berlios.de> Author: aldeck Date: 2008-06-02 19:08:42 +0200 (Mon, 02 Jun 2008) New Revision: 25761 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25761&view=rev Modified: haiku/trunk/src/preferences/screensaver/ScreenSaverWindow.cpp Log: - Decouple ModulesView::SaveState() from ModulesView::_CloseSaver() and thus ModulesView::DetachedFromWindow(). When called by BWindow destructor, the needed derived member fSettings was already destroyed by the derived ScreenSaverWindow destructor. See backtrace in #2287 Fixes #2287 Modified: haiku/trunk/src/preferences/screensaver/ScreenSaverWindow.cpp =================================================================== --- haiku/trunk/src/preferences/screensaver/ScreenSaverWindow.cpp 2008-06-02 15:45:22 UTC (rev 25760) +++ haiku/trunk/src/preferences/screensaver/ScreenSaverWindow.cpp 2008-06-02 17:08:42 UTC (rev 25761) @@ -351,6 +351,7 @@ else fSettings.SetModuleName(item->Text()); + SaveState(); _CloseSaver(); _OpenSaver(); break; @@ -469,9 +470,7 @@ fSaverRunner->Quit(); if (saver != NULL) saver->StopConfig(); - - SaveState(); - + delete view; delete fSettingsView; delete fSaverRunner; From stippi at mail.berlios.de Mon Jun 2 20:18:56 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Mon, 2 Jun 2008 20:18:56 +0200 Subject: [Haiku-commits] r25762 - haiku/trunk/src/kits/interface Message-ID: <200806021818.m52IIuoZ028545@sheep.berlios.de> Author: stippi Date: 2008-06-02 20:18:56 +0200 (Mon, 02 Jun 2008) New Revision: 25762 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25762&view=rev Modified: haiku/trunk/src/kits/interface/GraphicsDefs.cpp Log: Resolved TODO and set the flags for the kind of additional bitmap support (bitmaps support child views or BViews can draw them) Modified: haiku/trunk/src/kits/interface/GraphicsDefs.cpp =================================================================== --- haiku/trunk/src/kits/interface/GraphicsDefs.cpp 2008-06-02 17:08:42 UTC (rev 25761) +++ haiku/trunk/src/kits/interface/GraphicsDefs.cpp 2008-06-02 18:18:56 UTC (rev 25762) @@ -144,17 +144,21 @@ bool bitmaps_support_space(color_space space, uint32 *supportFlags) { - // TODO: fill supportFlags with the supported flags: - // - B_VIEWS_SUPPORT_DRAW_BITMAP - // - B_BITMAPS_SUPPORT_ATTACHED_VIEWS - bool result = false; + bool result = true; switch (space) { - // supported + // supported, also for drawing and for attaching BViews case B_RGB32: case B_RGBA32: case B_RGB24: case B_RGB32_BIG: case B_RGBA32_BIG: case B_RGB24_BIG: case B_RGB16: case B_RGB15: case B_RGBA15: case B_RGB16_BIG: case B_RGB15_BIG: case B_RGBA15_BIG: case B_CMAP8: case B_GRAY8: case B_GRAY1: + if (supportFlags) { + *supportFlags = 0; + *supportFlags |= B_VIEWS_SUPPORT_DRAW_BITMAP; + *supportFlags |= B_BITMAPS_SUPPORT_ATTACHED_VIEWS; + } + break; + // supported, but cannot draw case B_YCbCr422: case B_YCbCr411: case B_YCbCr444: case B_YCbCr420: case B_YUV422: case B_YUV411: case B_YUV444: case B_YUV420: case B_UVL24: case B_UVL32: case B_UVLA32: @@ -163,11 +167,11 @@ case B_HSV24: case B_HSV32: case B_HSVA32: case B_HLS24: case B_HLS32: case B_HLSA32: case B_CMY24: case B_CMY32: case B_CMYA32: case B_CMYK32: - result = true; break; // unsupported case B_NO_COLOR_SPACE: case B_YUV9: case B_YUV12: + result = false; break; } return result; From stippi at mail.berlios.de Mon Jun 2 20:21:55 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Mon, 2 Jun 2008 20:21:55 +0200 Subject: [Haiku-commits] r25763 - in haiku/trunk/src/apps/mediaplayer/media_node_framework: . audio Message-ID: <200806021821.m52ILt9N028952@sheep.berlios.de> Author: stippi Date: 2008-06-02 20:21:55 +0200 (Mon, 02 Jun 2008) New Revision: 25763 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25763&view=rev Modified: haiku/trunk/src/apps/mediaplayer/media_node_framework/PlaybackManager.cpp haiku/trunk/src/apps/mediaplayer/media_node_framework/audio/AudioProducer.cpp Log: Small code cleanups. Modified: haiku/trunk/src/apps/mediaplayer/media_node_framework/PlaybackManager.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/media_node_framework/PlaybackManager.cpp 2008-06-02 18:18:56 UTC (rev 25762) +++ haiku/trunk/src/apps/mediaplayer/media_node_framework/PlaybackManager.cpp 2008-06-02 18:21:55 UTC (rev 25763) @@ -713,10 +713,12 @@ int64 xEndFrame; int32 playingDirection; GetPlaylistFrameInterval(startFrame, endFrame, xStartFrame, xEndFrame, - playingDirection); + playingDirection); // Calculate the performance time interval end/length. - endTime = min(endTime, TimeForFrame(endFrame)); + bigtime_t endTimeForFrame = TimeForFrame(endFrame); + endTime = min(endTime, endTimeForFrame); bigtime_t intervalLength = endTime - startTime; + // Finally determine the time bounds for the Playlist interval (depending // on the playing direction). switch (playingDirection) { @@ -780,8 +782,8 @@ return 0; } int64 frame = (int64)(((double)time - info->activation_time) - * (double)fFrameRate * info->speed / 1000000.0) - + info->activation_frame; + * (double)fFrameRate * info->speed / 1000000.0) + + info->activation_frame; if (TimeForFrame(frame) > time) frame--; else if (TimeForFrame(frame + 1) <= time) Modified: haiku/trunk/src/apps/mediaplayer/media_node_framework/audio/AudioProducer.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/media_node_framework/audio/AudioProducer.cpp 2008-06-02 18:18:56 UTC (rev 25762) +++ haiku/trunk/src/apps/mediaplayer/media_node_framework/audio/AudioProducer.cpp 2008-06-02 18:21:55 UTC (rev 25763) @@ -711,10 +711,10 @@ * 1000000.0 / double(fOutput.format.u.raw_audio.frame_rate)); // fill in data from audio supplier - size_t frameCount = numSamples / fOutput.format.u.raw_audio.channel_count; + int64 frameCount = numSamples / fOutput.format.u.raw_audio.channel_count; bigtime_t startTime = performanceTime; bigtime_t endTime = bigtime_t(double(fFramesSent + frameCount) - * 1000000.0 / double(fOutput.format.u.raw_audio.frame_rate)); + * 1000000.0 / fOutput.format.u.raw_audio.frame_rate); if (!fSupplier || fSupplier->InitCheck() != B_OK || fSupplier->GetFrames(buffer->Data(), frameCount, startTime, From stippi at mail.berlios.de Mon Jun 2 20:25:31 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Mon, 2 Jun 2008 20:25:31 +0200 Subject: [Haiku-commits] r25764 - in haiku/trunk/src/apps/mediaplayer/media_node_framework: . video Message-ID: <200806021825.m52IPVv9029235@sheep.berlios.de> Author: stippi Date: 2008-06-02 20:25:31 +0200 (Mon, 02 Jun 2008) New Revision: 25764 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25764&view=rev Modified: haiku/trunk/src/apps/mediaplayer/media_node_framework/NodeManager.cpp haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.cpp haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.h Log: Do not reference bitmap color spaces directly anymore, but use bitmaps_support_space() interface kit function. First try to use overlays, if that fails, try again without overlays. The NodeManager makes sure to fall back to B_RGB32 if the given mode is not supported for drawing bitmaps in by BViews. Thanks, Axel, for the suggestion! Modified: haiku/trunk/src/apps/mediaplayer/media_node_framework/NodeManager.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/media_node_framework/NodeManager.cpp 2008-06-02 18:21:55 UTC (rev 25763) +++ haiku/trunk/src/apps/mediaplayer/media_node_framework/NodeManager.cpp 2008-06-02 18:25:31 UTC (rev 25764) @@ -358,15 +358,29 @@ }; format.u.raw_video = videoFormat; - // connect video producer to consumer (B_YCbCr422) + // connect video producer to consumer (hopefully using overlays) + fVideoConsumer->SetTryOverlay(true); fStatus = fMediaRoster->Connect(videoOutput.source, videoInput.destination, &format, &videoOutput, &videoInput); - if (fStatus != B_OK && preferredVideoFormat != B_RGB32) { + if (fStatus != B_OK) { print_error("Can't connect the video source to the video window... " - "trying B_RGB32", fStatus); - format.u.raw_video.display.format = B_RGB32; - // connect video producer to consumer (B_RGB32) + "trying without overlays", fStatus); + + uint32 flags = 0; + bool supported = bitmaps_support_space( + format.u.raw_video.display.format, &flags); + if (!supported || (flags & B_VIEWS_SUPPORT_DRAW_BITMAP) == 0) { + // cannot create bitmaps with such a color space + // or BViews don't support drawing it, fallback to B_RGB32 + format.u.raw_video.display.format = B_RGB32; + printf("NodeManager::_SetupVideoNodes() - falling back to " + "B_RGB32\n"); + } + + fVideoConsumer->SetTryOverlay(false); + // connect video producer to consumer (not using overlays and using + // a colorspace that BViews support drawing) fStatus = fMediaRoster->Connect(videoOutput.source, videoInput.destination, &format, &videoOutput, &videoInput); } Modified: haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.cpp 2008-06-02 18:21:55 UTC (rev 25763) +++ haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.cpp 2008-06-02 18:25:31 UTC (rev 25764) @@ -7,20 +7,19 @@ */ #include "VideoConsumer.h" +#include #include -#include +#include +#include + #include -#include -#include +#include #include -#include #include #include -#include #include #include #include -#include #include "NodeManager.h" #include "VideoTarget.h" @@ -61,7 +60,8 @@ fManager(manager), fTargetLock(), fTarget(target), - fTargetBufferIndex(-1) + fTargetBufferIndex(-1), + fTryOverlay(true) { FUNCTION("VideoConsumer::VideoConsumer\n"); @@ -219,14 +219,13 @@ ERROR("VideoConsumer::CreateBuffers - ERROR CREATING BUFFER GROUP\n"); return status; } - + // and attach the bitmaps to the buffer group BRect bounds(0, 0, width - 1, height - 1); for (uint32 i = 0; i < kBufferCount; i++) { // figure out the bitmap creation flags uint32 bitmapFlags = 0; - if (colorSpace == B_YCbCr420 || colorSpace == B_YCbCr411 - || colorSpace == B_YCbCr422 || colorSpace == B_YCbCr444) { + if (fTryOverlay) { // try to use hardware overlay bitmapFlags |= B_BITMAP_WILL_OVERLAY; if (i == 0) @@ -338,6 +337,13 @@ } +void +VideoConsumer::SetTryOverlay(bool tryOverlay) +{ + fTryOverlay = tryOverlay; +} + + status_t VideoConsumer::Connected(const media_source& producer, const media_destination& where, const media_format& format, @@ -429,23 +435,31 @@ return B_MEDIA_BAD_FORMAT; } - if (format->u.raw_video.display.format != B_YCbCr444 && - format->u.raw_video.display.format != B_YCbCr422 && - format->u.raw_video.display.format != B_RGB32 && - format->u.raw_video.display.format != B_RGB16 && - format->u.raw_video.display.format != B_RGB15 && - format->u.raw_video.display.format != B_GRAY8 && - format->u.raw_video.display.format + if (format->u.raw_video.display.format != media_raw_video_format::wildcard.display.format) { - ERROR("AcceptFormat - not a format we know about!\n"); - return B_MEDIA_BAD_FORMAT; + uint32 flags = 0; + bool supported = bitmaps_support_space( + format->u.raw_video.display.format, &flags); + if (!supported) { + // cannot create bitmaps with such a color space + ERROR("AcceptFormat - unsupported color space for BBitmaps!\n"); + return B_MEDIA_BAD_FORMAT; + } + if (!fTryOverlay && (flags & B_VIEWS_SUPPORT_DRAW_BITMAP) == 0) { + // BViews do not support drawing such a bitmap + ERROR("AcceptFormat - BViews cannot draw bitmaps in given " + "colorspace!\n"); + return B_MEDIA_BAD_FORMAT; + } } - - char string[256]; - string[0] = 0; - string_for_format(*format, string, 256); - FUNCTION("VideoConsumer::AcceptFormat: %s\n", string); + #ifdef TRACE_VIDEO_CONSUMER + char string[256]; + string[0] = 0; + string_for_format(*format, string, 256); + FUNCTION("VideoConsumer::AcceptFormat: %s\n", string); + #endif + return B_OK; } Modified: haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.h 2008-06-02 18:21:55 UTC (rev 25763) +++ haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.h 2008-06-02 18:25:31 UTC (rev 25764) @@ -100,7 +100,8 @@ void DeleteBuffers(); void SetTarget(VideoTarget* target); - + void SetTryOverlay(bool tryOverlay); + private: uint32 fInternalID; BMediaAddOn* fAddOn; @@ -119,6 +120,8 @@ BLocker fTargetLock; // locks the following variable VideoTarget* volatile fTarget; int32 fTargetBufferIndex; + + bool fTryOverlay; }; #endif // VIDEO_CONSUMER_H From stippi at mail.berlios.de Mon Jun 2 20:28:31 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Mon, 2 Jun 2008 20:28:31 +0200 Subject: [Haiku-commits] r25765 - in haiku/trunk/src/apps/mediaplayer: . supplier Message-ID: <200806021828.m52ISVdk029489@sheep.berlios.de> Author: stippi Date: 2008-06-02 20:28:31 +0200 (Mon, 02 Jun 2008) New Revision: 25765 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25765&view=rev Modified: haiku/trunk/src/apps/mediaplayer/Controller.cpp haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.h haiku/trunk/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp Log: I tracked down a problem with a specific clip I have here. In the end, the problem was that no codec was installed for it, but I fixed a bunch of issues on the way to find out. Now the controller will not rely on the number of audio and video tracks, but on the fact that it could instantiate suppliers at all. Made the MediaTrackVideoSupplier return an init error. Should be replicated for the MediaTrackAudioSupplier. Modified: haiku/trunk/src/apps/mediaplayer/Controller.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/Controller.cpp 2008-06-02 18:25:31 UTC (rev 25764) +++ haiku/trunk/src/apps/mediaplayer/Controller.cpp 2008-06-02 18:28:31 UTC (rev 25765) @@ -230,12 +230,6 @@ } } - if (AudioTrackCount() == 0 && VideoTrackCount() == 0) { - printf("Controller::SetTo: no audio or video tracks found\n"); - _NotifyFileChanged(); - return B_MEDIA_NO_HANDLER; - } - printf("Controller::SetTo: %d audio track, %d video track\n", AudioTrackCount(), VideoTrackCount()); @@ -245,6 +239,15 @@ SelectAudioTrack(0); SelectVideoTrack(0); + if (fAudioTrackSupplier == NULL && fVideoTrackSupplier == NULL) { + printf("Controller::SetTo: no audio or video tracks found or " + "no decoders\n"); + _NotifyFileChanged(); + delete fMediaFile; + fMediaFile = NULL; + return B_MEDIA_NO_HANDLER; + } + // prevent blocking the creation of new overlay buffers fVideoView->DisableOverlay(); @@ -350,13 +353,25 @@ if (!track) return B_ERROR; + status_t initStatus; ObjectDeleter deleter(fVideoTrackSupplier); - fVideoTrackSupplier = new MediaTrackVideoSupplier(track); + fVideoTrackSupplier = new MediaTrackVideoSupplier(track, initStatus); + if (initStatus < B_OK) { + delete fVideoTrackSupplier; + fVideoTrackSupplier = NULL; + return initStatus; + } bigtime_t a = fAudioTrackSupplier ? fAudioTrackSupplier->Duration() : 0; bigtime_t v = fVideoTrackSupplier->Duration(); fDuration = max_c(a, v); fVideoFrameRate = fVideoTrackSupplier->Format().u.raw_video.field_rate; + if (fVideoFrameRate <= 0.0) { + printf("Controller::SelectVideoTrack(%d) - invalid video frame rate: %.1f\n", n, + fVideoFrameRate); + fVideoFrameRate = 25.0; + } + DurationChanged(); // TODO: notify duration changed! Modified: haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp 2008-06-02 18:25:31 UTC (rev 25764) +++ haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp 2008-06-02 18:28:31 UTC (rev 25765) @@ -27,7 +27,8 @@ // constructor -MediaTrackVideoSupplier::MediaTrackVideoSupplier(BMediaTrack* track) +MediaTrackVideoSupplier::MediaTrackVideoSupplier(BMediaTrack* track, + status_t& initStatus) : VideoTrackSupplier() , fVideoTrack(track) @@ -40,7 +41,7 @@ return; } - _SwitchFormat(B_NO_COLOR_SPACE, 0); + initStatus = _SwitchFormat(B_NO_COLOR_SPACE, 0); fDuration = fVideoTrack->Duration(); @@ -354,7 +355,19 @@ if (ret < B_OK) { printf("MediaTrackVideoSupplier::_SwitchFormat() - " - "fVideoTrack->DecodedFormat(): %s\n", strerror(ret)); + "fVideoTrack->DecodedFormat(): %s - retrying with B_RGB32\n", + strerror(ret)); + fFormat.u.raw_video.display.format = format; + minBytesPerRow = width * 4; + fFormat.u.raw_video.display.bytes_per_row = max_c(minBytesPerRow, + bytesPerRow); + + ret = fVideoTrack->DecodedFormat(&fFormat); + if (ret < B_OK) { + printf("MediaTrackVideoSupplier::_SwitchFormat() - " + "fVideoTrack->DecodedFormat(): %s - giving up\n", + strerror(ret)); + } return ret; } Modified: haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.h 2008-06-02 18:25:31 UTC (rev 25764) +++ haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.h 2008-06-02 18:28:31 UTC (rev 25765) @@ -16,7 +16,8 @@ class MediaTrackVideoSupplier : public VideoTrackSupplier { public: - MediaTrackVideoSupplier(BMediaTrack* track); + MediaTrackVideoSupplier(BMediaTrack* track, + status_t& initStatus); virtual ~MediaTrackVideoSupplier(); virtual const media_format& Format() const; Modified: haiku/trunk/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp 2008-06-02 18:25:31 UTC (rev 25764) +++ haiku/trunk/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp 2008-06-02 18:28:31 UTC (rev 25765) @@ -12,18 +12,20 @@ #include #include +#include "AudioTrackSupplier.h" #include "AudioAdapter.h" -#include "AudioTrackSupplier.h" #include "PlaybackManager.h" using std::nothrow; -//#define TRACE_PROXY_AUDIO_SUPPLIER +#define TRACE_PROXY_AUDIO_SUPPLIER #ifdef TRACE_PROXY_AUDIO_SUPPLIER # define TRACE(x...) printf("ProxyAudioSupplier::"); printf(x) +# define ERROR(x...) fprintf(stderr, "ProxyAudioSupplier::"); fprintf(stderr, x) #else # define TRACE(x...) +# define ERROR(x...) fprintf(stderr, "ProxyAudioSupplier::"); fprintf(stderr, x) #endif @@ -87,9 +89,18 @@ interval->start_time, interval->end_time, interval->x_start_time, interval->x_end_time, interval->speed); + if (intervalStartTime == interval->end_time) { + delete interval; + error = B_ERROR; + sLastInvalidStartTime = intervalStartTime; + ERROR("GetFrames() - zero duration audio interval! start " + "time: %lld\n", intervalStartTime); + break; + } if (!playingIntervals.AddItem(interval)) { delete interval; error = B_NO_MEMORY; + ERROR("GetFrames() - Out of memory\n"); break; } intervalStartTime = interval->end_time; @@ -102,6 +113,9 @@ BAutolock _(fSupplierLock); + if (!fSupplier) + return B_ERROR; + // retrieve the audio data for each interval. int64 framesRead = 0; while (!playingIntervals.IsEmpty()) { From anevilyak at gmail.com Mon Jun 2 20:40:28 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Mon, 2 Jun 2008 13:40:28 -0500 Subject: [Haiku-commits] r25765 - in haiku/trunk/src/apps/mediaplayer: . supplier In-Reply-To: <200806021828.m52ISVdk029489@sheep.berlios.de> References: <200806021828.m52ISVdk029489@sheep.berlios.de> Message-ID: Hi Stephan, Was the line about sLastInvalidStartTime intended to be there? It throws an error about being undeclared, and I see no other use of that variable in the file. Regards, Rene On Mon, Jun 2, 2008 at 1:28 PM, stippi at BerliOS wrote: > Author: stippi > Date: 2008-06-02 20:28:31 +0200 (Mon, 02 Jun 2008) > New Revision: 25765 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25765&view=rev > > Modified: > haiku/trunk/src/apps/mediaplayer/Controller.cpp > haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp > haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.h > haiku/trunk/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp > Log: > I tracked down a problem with a specific clip I have here. > In the end, the problem was that no codec was installed > for it, but I fixed a bunch of issues on the way to find > out. Now the controller will not rely on the number > of audio and video tracks, but on the fact that it could > instantiate suppliers at all. Made the MediaTrackVideoSupplier > return an init error. Should be replicated for the > MediaTrackAudioSupplier. > > > Modified: haiku/trunk/src/apps/mediaplayer/Controller.cpp > =================================================================== > --- haiku/trunk/src/apps/mediaplayer/Controller.cpp 2008-06-02 18:25:31 UTC (rev 25764) > +++ haiku/trunk/src/apps/mediaplayer/Controller.cpp 2008-06-02 18:28:31 UTC (rev 25765) > @@ -230,12 +230,6 @@ > } > } > > - if (AudioTrackCount() == 0 && VideoTrackCount() == 0) { > - printf("Controller::SetTo: no audio or video tracks found\n"); > - _NotifyFileChanged(); > - return B_MEDIA_NO_HANDLER; > - } > - > printf("Controller::SetTo: %d audio track, %d video track\n", > AudioTrackCount(), VideoTrackCount()); > > @@ -245,6 +239,15 @@ > SelectAudioTrack(0); > SelectVideoTrack(0); > > + if (fAudioTrackSupplier == NULL && fVideoTrackSupplier == NULL) { > + printf("Controller::SetTo: no audio or video tracks found or " > + "no decoders\n"); > + _NotifyFileChanged(); > + delete fMediaFile; > + fMediaFile = NULL; > + return B_MEDIA_NO_HANDLER; > + } > + > // prevent blocking the creation of new overlay buffers > fVideoView->DisableOverlay(); > > @@ -350,13 +353,25 @@ > if (!track) > return B_ERROR; > > + status_t initStatus; > ObjectDeleter deleter(fVideoTrackSupplier); > - fVideoTrackSupplier = new MediaTrackVideoSupplier(track); > + fVideoTrackSupplier = new MediaTrackVideoSupplier(track, initStatus); > + if (initStatus < B_OK) { > + delete fVideoTrackSupplier; > + fVideoTrackSupplier = NULL; > + return initStatus; > + } > > bigtime_t a = fAudioTrackSupplier ? fAudioTrackSupplier->Duration() : 0; > bigtime_t v = fVideoTrackSupplier->Duration(); > fDuration = max_c(a, v); > fVideoFrameRate = fVideoTrackSupplier->Format().u.raw_video.field_rate; > + if (fVideoFrameRate <= 0.0) { > + printf("Controller::SelectVideoTrack(%d) - invalid video frame rate: %.1f\n", n, > + fVideoFrameRate); > + fVideoFrameRate = 25.0; > + } > + > DurationChanged(); > // TODO: notify duration changed! > > > Modified: haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp > =================================================================== > --- haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp 2008-06-02 18:25:31 UTC (rev 25764) > +++ haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp 2008-06-02 18:28:31 UTC (rev 25765) > @@ -27,7 +27,8 @@ > > > // constructor > -MediaTrackVideoSupplier::MediaTrackVideoSupplier(BMediaTrack* track) > +MediaTrackVideoSupplier::MediaTrackVideoSupplier(BMediaTrack* track, > + status_t& initStatus) > : VideoTrackSupplier() > , fVideoTrack(track) > > @@ -40,7 +41,7 @@ > return; > } > > - _SwitchFormat(B_NO_COLOR_SPACE, 0); > + initStatus = _SwitchFormat(B_NO_COLOR_SPACE, 0); > > fDuration = fVideoTrack->Duration(); > > @@ -354,7 +355,19 @@ > > if (ret < B_OK) { > printf("MediaTrackVideoSupplier::_SwitchFormat() - " > - "fVideoTrack->DecodedFormat(): %s\n", strerror(ret)); > + "fVideoTrack->DecodedFormat(): %s - retrying with B_RGB32\n", > + strerror(ret)); > + fFormat.u.raw_video.display.format = format; > + minBytesPerRow = width * 4; > + fFormat.u.raw_video.display.bytes_per_row = max_c(minBytesPerRow, > + bytesPerRow); > + > + ret = fVideoTrack->DecodedFormat(&fFormat); > + if (ret < B_OK) { > + printf("MediaTrackVideoSupplier::_SwitchFormat() - " > + "fVideoTrack->DecodedFormat(): %s - giving up\n", > + strerror(ret)); > + } > return ret; > } > > > Modified: haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.h > =================================================================== > --- haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.h 2008-06-02 18:25:31 UTC (rev 25764) > +++ haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.h 2008-06-02 18:28:31 UTC (rev 25765) > @@ -16,7 +16,8 @@ > > class MediaTrackVideoSupplier : public VideoTrackSupplier { > public: > - MediaTrackVideoSupplier(BMediaTrack* track); > + MediaTrackVideoSupplier(BMediaTrack* track, > + status_t& initStatus); > virtual ~MediaTrackVideoSupplier(); > > virtual const media_format& Format() const; > > Modified: haiku/trunk/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp > =================================================================== > --- haiku/trunk/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp 2008-06-02 18:25:31 UTC (rev 25764) > +++ haiku/trunk/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp 2008-06-02 18:28:31 UTC (rev 25765) > @@ -12,18 +12,20 @@ > #include > #include > > +#include "AudioTrackSupplier.h" > #include "AudioAdapter.h" > -#include "AudioTrackSupplier.h" > #include "PlaybackManager.h" > > using std::nothrow; > > > -//#define TRACE_PROXY_AUDIO_SUPPLIER > +#define TRACE_PROXY_AUDIO_SUPPLIER > #ifdef TRACE_PROXY_AUDIO_SUPPLIER > # define TRACE(x...) printf("ProxyAudioSupplier::"); printf(x) > +# define ERROR(x...) fprintf(stderr, "ProxyAudioSupplier::"); fprintf(stderr, x) > #else > # define TRACE(x...) > +# define ERROR(x...) fprintf(stderr, "ProxyAudioSupplier::"); fprintf(stderr, x) > #endif > > > @@ -87,9 +89,18 @@ > interval->start_time, interval->end_time, > interval->x_start_time, interval->x_end_time, > interval->speed); > + if (intervalStartTime == interval->end_time) { > + delete interval; > + error = B_ERROR; > + sLastInvalidStartTime = intervalStartTime; > + ERROR("GetFrames() - zero duration audio interval! start " > + "time: %lld\n", intervalStartTime); > + break; > + } > if (!playingIntervals.AddItem(interval)) { > delete interval; > error = B_NO_MEMORY; > + ERROR("GetFrames() - Out of memory\n"); > break; > } > intervalStartTime = interval->end_time; > @@ -102,6 +113,9 @@ > > BAutolock _(fSupplierLock); > > + if (!fSupplier) > + return B_ERROR; > + > // retrieve the audio data for each interval. > int64 framesRead = 0; > while (!playingIntervals.IsEmpty()) { > > _______________________________________________ > Haiku-commits mailing list > Haiku-commits at lists.berlios.de > https://lists.berlios.de/mailman/listinfo/haiku-commits > From stippi at mail.berlios.de Mon Jun 2 20:46:39 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Mon, 2 Jun 2008 20:46:39 +0200 Subject: [Haiku-commits] r25766 - haiku/trunk/src/apps/mediaplayer/supplier Message-ID: <200806021846.m52Ikdc8031357@sheep.berlios.de> Author: stippi Date: 2008-06-02 20:46:38 +0200 (Mon, 02 Jun 2008) New Revision: 25766 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25766&view=rev Modified: haiku/trunk/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp Log: Accidentally left tracing on... Modified: haiku/trunk/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp 2008-06-02 18:28:31 UTC (rev 25765) +++ haiku/trunk/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp 2008-06-02 18:46:38 UTC (rev 25766) @@ -19,7 +19,7 @@ using std::nothrow; -#define TRACE_PROXY_AUDIO_SUPPLIER +//#define TRACE_PROXY_AUDIO_SUPPLIER #ifdef TRACE_PROXY_AUDIO_SUPPLIER # define TRACE(x...) printf("ProxyAudioSupplier::"); printf(x) # define ERROR(x...) fprintf(stderr, "ProxyAudioSupplier::"); fprintf(stderr, x) From stippi at mail.berlios.de Mon Jun 2 20:50:42 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Mon, 2 Jun 2008 20:50:42 +0200 Subject: [Haiku-commits] r25767 - haiku/trunk/src/apps/mediaplayer/supplier Message-ID: <200806021850.m52IogkT031994@sheep.berlios.de> Author: stippi Date: 2008-06-02 20:50:42 +0200 (Mon, 02 Jun 2008) New Revision: 25767 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25767&view=rev Modified: haiku/trunk/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp Log: And now it should even compile again! Sorry about that, forgot to remove the debug output completely. Modified: haiku/trunk/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp 2008-06-02 18:46:38 UTC (rev 25766) +++ haiku/trunk/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp 2008-06-02 18:50:42 UTC (rev 25767) @@ -92,7 +92,6 @@ if (intervalStartTime == interval->end_time) { delete interval; error = B_ERROR; - sLastInvalidStartTime = intervalStartTime; ERROR("GetFrames() - zero duration audio interval! start " "time: %lld\n", intervalStartTime); break; From superstippi at gmx.de Mon Jun 2 20:51:21 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Mon, 02 Jun 2008 20:51:21 +0200 Subject: [Haiku-commits] r25765 - in haiku/trunk/src/apps/mediaplayer: . supplier In-Reply-To: References: <200806021828.m52ISVdk029489@sheep.berlios.de> Message-ID: <20080602185121.33540@gmx.net> -------- Original-Nachricht -------- > Datum: Mon, 2 Jun 2008 13:40:28 -0500 > Von: "Rene Gollent" > An: "SVN commits to the Haiku source repository" > Betreff: Re: [Haiku-commits] r25765 - in haiku/trunk/src/apps/mediaplayer: . supplier > Hi Stephan, > > Was the line about sLastInvalidStartTime intended to be there? It > throws an error about being undeclared, and I see no other use of that > variable in the file. Sorry about that... :-\ Best regards, -Stephan From mmlr at mlotz.ch Mon Jun 2 20:57:40 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Mon, 02 Jun 2008 20:57:40 +0200 Subject: [Haiku-commits] =?windows-1252?q?r25752_-_in_haiku/trunk=3A_heade?= =?windows-1252?q?rs/os/drivers_headers/private/kernel__headers/private/sy?= =?windows-1252?q?stem_src/add-ons/kernel/bus=5Fmanagers/ide_src/add-ons/k?= =?windows-1252?q?ernel/bus=5Fmanagers/pci/arch/x86_src/add-ons/kernel/bus?= =?windows-1252?q?=5Fmanagers/ps2_src/add-ons/kernel/bus=5Fmanagers/scsi_s?= =?windows-1252?q?rc/add-ons/kernel/busses/scsi/ahci__src/add-ons/kernel/b?= =?windows-1252?q?usses/usb_src/add-ons/kernel/drivers/audio/ac97/auich_sr?= =?windows-1252?q?c/add-ons/kernel/drivers/audio/ac97/auvia_src/add-ons/ke?= =?windows-1252?q?rnel/drivers/audio/emuxki_src/add-ons/kernel/drivers/gra?= =?windows-1252?q?phics/radeon_src/add-ons/kernel/drivers/network/rtl8169_?= =?windows-1252?q?src/add-ons/kernel/generic/dpc__src/add-ons/kernel/gener?= =?windows-1252?q?ic/mpu401_src/libs/compat/freebsd=5Fnetwork_src/system/k?= =?windows-1252?q?ernel_src/system/kernel/arch/m68k_src/system/kernel/arch?= =?windows-1252?q?/x86_src/system/kernel/debug?= In-Reply-To: <200806020204.m5224IeL027525@sheep.berlios.de> Message-ID: <1163535131-BeMail@primary> > Author: bonefish > Date: 2008-06-02 04:04:12 +0200 (Mon, 02 Jun 2008) > New Revision: 25752 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25752&view=rev > Log: > * Added macros for spinlock initialization and access and changed > code using spinlocks accordingly. This breaks compilation for BeOS > -- > the macros should be defined in the respective compatibility > wrappers. Well at least for the USB parts this still compiles just fine (with the bone target in my case). The Haiku KernelExport.h is included there and not the host one, so the initializers you provide are picked up and everything compiles. Regards Michael From korli at users.berlios.de Mon Jun 2 21:15:35 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Mon, 2 Jun 2008 21:15:35 +0200 Subject: [Haiku-commits] r25752 - in haiku/trunk: headers/os/drivers headers/private/kernel headers/private/system src/add-ons/kernel/bus_managers/ide src/add-ons/kernel/bus_managers/pci/arch/x86 src/add-ons/kernel/bus_managers/ps2 src/add-ons/kernel/bus_ Message-ID: Hi Ingo, 2008/6/2 bonefish at BerliOS : > * Added macros for spinlock initialization and access and changed > code using spinlocks accordingly. This breaks compilation for BeOS -- > the macros should be defined in the respective compatibility wrappers. Shouldn't B_SPINLOCK_INITIALIZER be added to Haiku compatibility header ? Bye, J?r?me From oruizdorantes at mail.berlios.de Mon Jun 2 22:16:09 2008 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Mon, 2 Jun 2008 22:16:09 +0200 Subject: [Haiku-commits] r25768 - in haiku/trunk: headers/os/bluetooth headers/os/bluetooth/L2CAP src/add-ons/kernel/network/protocols src/add-ons/kernel/network/protocols/l2cap Message-ID: <200806022016.m52KG9Wv009880@sheep.berlios.de> Author: oruizdorantes Date: 2008-06-02 22:16:00 +0200 (Mon, 02 Jun 2008) New Revision: 25768 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25768&view=rev Added: haiku/trunk/headers/os/bluetooth/L2CAP/ haiku/trunk/headers/os/bluetooth/L2CAP/btL2CAP.h haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/ haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/Jamfile haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.cpp haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_address.cpp haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_address.h Log: L2CAP, without functionality, for the moment my playground in the netstack Added: haiku/trunk/headers/os/bluetooth/L2CAP/btL2CAP.h =================================================================== --- haiku/trunk/headers/os/bluetooth/L2CAP/btL2CAP.h 2008-06-02 18:50:42 UTC (rev 25767) +++ haiku/trunk/headers/os/bluetooth/L2CAP/btL2CAP.h 2008-06-02 20:16:00 UTC (rev 25768) @@ -0,0 +1,21 @@ +/* + * Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * + * All rights reserved. Distributed under the terms of the MIT License. + * + */ + +#ifndef _BTL2CAP_H_ +#define _BTL2CAP_H_ + +#include + +struct sockaddr_l2cap { + uint8 l2cap_len; /* total length */ + uint8 l2cap_family; /* address family */ + uint16 l2cap_psm; /* PSM (Protocol/Service Multiplexor) */ + bdaddr_t l2cap_bdaddr; /* address */ +}; + + +#endif \ No newline at end of file Added: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/Jamfile 2008-06-02 18:50:42 UTC (rev 25767) +++ haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/Jamfile 2008-06-02 20:16:00 UTC (rev 25768) @@ -0,0 +1,26 @@ +SubDir HAIKU_TOP src add-ons kernel network protocols l2cap ; + +SetSubDirSupportedPlatformsBeOSCompatible ; + +if $(TARGET_PLATFORM) != haiku { + UseHeaders [ FStandardOSHeaders ] : true ; + # Needed for and maybe other stuff. + UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; + # We need the public network headers also when not compiling for Haiku. + # Unfortunately we get more than we want, namely all POSIX headers. +} + +UsePrivateHeaders kernel net bluetooth ; + +KernelAddon l2cap : + l2cap.cpp + l2cap_address.cpp +; + +# Installation +HaikuInstall install-networking : /boot/home/config/add-ons/kernel/haiku_network/protocols + : l2cap ; + +Package haiku-networkingkit-cvs : + haiku : + boot home config add-ons kernel haiku_network protocols ; Added: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.cpp 2008-06-02 18:50:42 UTC (rev 25767) +++ haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.cpp 2008-06-02 20:16:00 UTC (rev 25768) @@ -0,0 +1,304 @@ +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + + +typedef NetBufferField ICMPChecksumField; + +#define ICMP_TYPE_ECHO_REPLY 0 +#define ICMP_TYPE_UNREACH 3 +#define ICMP_TYPE_REDIRECT 5 +#define ICMP_TYPE_ECHO_REQUEST 8 + +// type unreach codes +#define ICMP_CODE_UNREACH_NEED_FRAGMENT 4 // this is used for path MTU discovery + +struct l2cap_protocol : net_protocol { +}; + + +net_buffer_module_info *gBufferModule; +static net_stack_module_info *sStackModule; + + +net_protocol * +l2cap_init_protocol(net_socket *socket) +{ + l2cap_protocol *protocol = new (std::nothrow) l2cap_protocol; + if (protocol == NULL) + return NULL; + + return protocol; +} + + +status_t +l2cap_uninit_protocol(net_protocol *protocol) +{ + delete protocol; + return B_OK; +} + + +status_t +l2cap_open(net_protocol *protocol) +{ + return B_OK; +} + + +status_t +l2cap_close(net_protocol *protocol) +{ + return B_OK; +} + + +status_t +l2cap_free(net_protocol *protocol) +{ + return B_OK; +} + + +status_t +l2cap_connect(net_protocol *protocol, const struct sockaddr *address) +{ + return B_ERROR; +} + + +status_t +l2cap_accept(net_protocol *protocol, struct net_socket **_acceptedSocket) +{ + return EOPNOTSUPP; +} + + +status_t +l2cap_control(net_protocol *protocol, int level, int option, void *value, + size_t *_length) +{ + return protocol->next->module->control(protocol->next, level, option, + value, _length); +} + + +status_t +l2cap_getsockopt(net_protocol *protocol, int level, int option, + void *value, int *length) +{ + return protocol->next->module->getsockopt(protocol->next, level, option, + value, length); +} + + +status_t +l2cap_setsockopt(net_protocol *protocol, int level, int option, + const void *value, int length) +{ + return protocol->next->module->setsockopt(protocol->next, level, option, + value, length); +} + + +status_t +l2cap_bind(net_protocol *protocol, const struct sockaddr *address) +{ + return B_ERROR; +} + + +status_t +l2cap_unbind(net_protocol *protocol, struct sockaddr *address) +{ + return B_ERROR; +} + + +status_t +l2cap_listen(net_protocol *protocol, int count) +{ + return EOPNOTSUPP; +} + + +status_t +l2cap_shutdown(net_protocol *protocol, int direction) +{ + return EOPNOTSUPP; +} + + +status_t +l2cap_send_data(net_protocol *protocol, net_buffer *buffer) +{ + return protocol->next->module->send_data(protocol->next, buffer); +} + + +status_t +l2cap_send_routed_data(net_protocol *protocol, struct net_route *route, + net_buffer *buffer) +{ + return protocol->next->module->send_routed_data(protocol->next, route, buffer); +} + + +ssize_t +l2cap_send_avail(net_protocol *protocol) +{ + return B_ERROR; +} + + +status_t +l2cap_read_data(net_protocol *protocol, size_t numBytes, uint32 flags, + net_buffer **_buffer) +{ + return B_ERROR; +} + + +ssize_t +l2cap_read_avail(net_protocol *protocol) +{ + return B_ERROR; +} + + +struct net_domain * +l2cap_get_domain(net_protocol *protocol) +{ + return protocol->next->module->get_domain(protocol->next); +} + + +size_t +l2cap_get_mtu(net_protocol *protocol, const struct sockaddr *address) +{ + return protocol->next->module->get_mtu(protocol->next, address); +} + + +status_t +l2cap_receive_data(net_buffer *buffer) +{ + debugf("ICMP received some data, buffer length %lu\n", buffer->size); + + NetBufferHeaderReader bufferHeader(buffer); + if (bufferHeader.Status() < B_OK) + return bufferHeader.Status(); + + hci_acl_header &header = bufferHeader.Data(); + + debugf(" got type %u, code %u, checksum %u\n", header.type, header.code, ntohs(header.checksum)); + debugf(" computed checksum: %ld\n", gBufferModule->checksum(buffer, 0, buffer->size, true)); + + if (gBufferModule->checksum(buffer, 0, buffer->size, true) != 0) + return B_BAD_DATA; + + gBufferModule->free(buffer); + return B_OK; +} + + +status_t +l2cap_error(uint32 code, net_buffer *data) +{ + return B_ERROR; +} + + +status_t +l2cap_error_reply(net_protocol *protocol, net_buffer *causedError, uint32 code, + void *errorData) +{ + return B_ERROR; +} + + +// #pragma mark - + + +static status_t +l2cap_std_ops(int32 op, ...) +{ + switch (op) { + case B_MODULE_INIT: + { + sStackModule->register_domain_protocols(AF_INET, SOCK_DGRAM, IPPROTO_ICMP, + "network/protocols/l2cap/v1", + NULL); + + sStackModule->register_domain_receiving_protocol(AF_INET, IPPROTO_ICMP, + "network/protocols/l2cap/v1"); + return B_OK; + } + + case B_MODULE_UNINIT: + return B_OK; + + default: + return B_ERROR; + } +} + + +net_protocol_module_info sL2CAPModule = { + { + "network/protocols/l2cap/v1", + 0, + l2cap_std_ops + }, + NET_PROTOCOL_ATOMIC_MESSAGES, + + l2cap_init_protocol, + l2cap_uninit_protocol, + l2cap_open, + l2cap_close, + l2cap_free, + l2cap_connect, + l2cap_accept, + l2cap_control, + l2cap_getsockopt, + l2cap_setsockopt, + l2cap_bind, + l2cap_unbind, + l2cap_listen, + l2cap_shutdown, + l2cap_send_data, + l2cap_send_routed_data, + l2cap_send_avail, + l2cap_read_data, + l2cap_read_avail, + l2cap_get_domain, + l2cap_get_mtu, + l2cap_receive_data, + NULL, + l2cap_error, + l2cap_error_reply, +}; + +module_dependency module_dependencies[] = { + {NET_STACK_MODULE_NAME, (module_info **)&sStackModule}, + {NET_BUFFER_MODULE_NAME, (module_info **)&gBufferModule}, + {} +}; + +module_info *modules[] = { + (module_info *)&sL2CAPModule, + NULL +}; Added: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_address.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_address.cpp 2008-06-02 18:50:42 UTC (rev 25767) +++ haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_address.cpp 2008-06-02 20:16:00 UTC (rev 25768) @@ -0,0 +1,416 @@ +/* + * Copyright 2006-2008, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Oliver Ruiz Dorantes, oliver-ruiz.dorantes_at_gmail.com + */ + + +#include + +#include +#include + +#include + +#include +#include +#include + +#include + +#define L2CAP_CHECKSUM(address) (address.b[0]+\ + address.b[1]+\ + address.b[2]+\ + address.b[3]+\ + address.b[4]+\ + address.b[5]) + +/*! + Routing utility function: copies address \a from into a new address + that is put into \a to. + If \a replaceWithZeros is set \a from will be replaced by an empty + address. + If a \a mask is given it is applied to \a from (such that \a to is the + result of \a from & \a mask). + \return B_OK if the address could be copied + \return B_NO_MEMORY if the new address could not be allocated + \return B_MISMATCHED_VALUES if \a address does not match family AF_INET +*/ +static status_t +l2cap_copy_address(const sockaddr *from, sockaddr **to, + bool replaceWithZeros = false, const sockaddr *mask = NULL) +{ + if (replaceWithZeros) { + *to = (sockaddr *)malloc(sizeof(sockaddr_in)); + if (*to == NULL) + return B_NO_MEMORY; + + memset(*to, 0, sizeof(sockaddr_in)); + (*to)->sa_family = AF_INET; + (*to)->sa_len = sizeof(sockaddr_in); + } else { + if (from == NULL) + return B_OK; + if (from->sa_family != AF_INET) + return B_MISMATCHED_VALUES; + + *to = (sockaddr *)malloc(sizeof(sockaddr_in)); + if (*to == NULL) + return B_NO_MEMORY; + + memcpy(*to, from, sizeof(sockaddr_l2cap)); + + } + return B_OK; +} + + +/*! + Routing utility function: applies \a mask to given \a address and puts + the resulting address into \a result. + \return B_OK if the mask has been applied + \return B_BAD_VALUE if \a address or \a mask is NULL +*/ +static status_t +l2cap_mask_address(const sockaddr *address, const sockaddr *mask, sockaddr *result) +{ + if (address == NULL || result == NULL) + return B_BAD_VALUE; + + return B_OK; +} + + +/*! + Checks if the given \a address is the empty address. By default, the port + is checked, too, but you can avoid that by passing \a checkPort = false. + \return true if \a address is NULL, uninitialized or the empty address, + false if not +*/ +static bool +l2cap_is_empty_address(const sockaddr *address, bool checkPort) +{ + if (address == NULL || address->sa_len == 0) + return true; + + return ((bacmp(&((sockaddr_l2cap *)address)->l2cap_bdaddr, BDADDR_NULL)==0) + && (!checkPort || ((sockaddr_l2cap *)address)->l2cap_psm == 0) ); +} + + +/*! + Compares the IP-addresses of the two given address structures \a a and \a b. + \return true if IP-addresses of \a a and \a b are equal, false if not +*/ +static bool +l2cap_equal_addresses(const sockaddr *a, const sockaddr *b) +{ + if (a == NULL && b == NULL) + return true; + if (a != NULL && b == NULL) + return l2cap_is_empty_address(a, false); + if (a == NULL && b != NULL) + return l2cap_is_empty_address(b, false); + + return (bacmp(&((sockaddr_l2cap*)a)->l2cap_bdaddr, + &((sockaddr_l2cap*)b)->l2cap_bdaddr)==0); +} + + +/*! + Compares the ports of the two given address structures \a a and \a b. + \return true if ports of \a a and \a b are equal, false if not +*/ +static bool +l2cap_equal_ports(const sockaddr *a, const sockaddr *b) +{ + uint16 portA = a ? ((sockaddr_l2cap *)a)->l2cap_psm : 0; + uint16 portB = b ? ((sockaddr_l2cap *)b)->l2cap_psm : 0; + return portA == portB; +} + + +/*! + Compares the IP-addresses and ports of the two given address structures + \a a and \a b. + \return true if IP-addresses and ports of \a a and \a b are equal, false if not +*/ +static bool +l2cap_equal_addresses_and_ports(const sockaddr *a, const sockaddr *b) +{ + if (a == NULL && b == NULL) + return true; + if (a != NULL && b == NULL) + return l2cap_is_empty_address(a, true); + if (a == NULL && b != NULL) + return l2cap_is_empty_address(b, true); + + return (bacmp(&((sockaddr_l2cap*)a)->l2cap_bdaddr,&((sockaddr_l2cap *)b)->l2cap_bdaddr)==0) + && ((sockaddr_l2cap *)a)->l2cap_psm == ((sockaddr_l2cap *)b)->l2cap_psm; +} + + +/*! + Applies the given \a mask two \a a and \a b and then checks whether + the masked addresses match. + \return true if \a a matches \a b after masking both, false if not +*/ +static bool +l2cap_equal_masked_addresses(const sockaddr *a, const sockaddr *b, + const sockaddr *mask) +{ + if (a == NULL && b == NULL) + return true; + + return false; +} + + +/*! + Routing utility function: determines the least significant bit that is set + in the given \a mask. + \return the number of the first bit that is set (0-32, where 32 means + that there's no bit set in the mask). +*/ +static int32 +l2cap_first_mask_bit(const sockaddr *_mask) +{ + if (_mask == NULL) + return 0; + + return 0; +} + + +/*! + Routing utility function: checks the given \a mask for correctness (which + means that (starting with LSB) consists zero or more unset bits, followed + by bits that are all set). + \return true if \a mask is ok, false if not +*/ +static bool +l2cap_check_mask(const sockaddr *_mask) +{ + + return true; +} + + +/*! + Creates a buffer for the given \a address and prints the address into + it (hexadecimal representation in host byte order or ''). + If \a printPort is set, the port is printed, too. + \return B_OK if the address could be printed, \a buffer will point to + the resulting string + \return B_BAD_VALUE if no buffer has been given + \return B_NO_MEMORY if the buffer could not be allocated +*/ +static status_t +l2cap_print_address_buffer(const sockaddr *_address, char *buffer, + size_t bufferSize, bool printPort) +{ + const sockaddr_l2cap *address = (const sockaddr_l2cap *)_address; + + if (buffer == NULL) + return B_BAD_VALUE; + + if (address == NULL) + strlcpy(buffer, "", bufferSize); + else { + bdaddr_t addr = address->l2cap_bdaddr; + if (printPort) { + snprintf(buffer, bufferSize, "%2X:%2X:%2X:%2X:%2X:%2X|%u", addr.b[0], + addr.b[1],addr.b[2],addr.b[3],addr.b[4],addr.b[5],address->l2cap_psm); + } + else { + snprintf(buffer, bufferSize, "%2X:%2X:%2X:%2X:%2X:%2X",addr.b[0], + addr.b[1],addr.b[2],addr.b[3],addr.b[4],addr.b[5]); + } + } + + return B_OK; +} + + +static status_t +l2cap_print_address(const sockaddr *_address, char **_buffer, bool printPort) +{ + if (_buffer == NULL) + return B_BAD_VALUE; + + char tmp[32]; + l2cap_print_address_buffer(_address, tmp, sizeof(tmp), printPort); + + *_buffer = strdup(tmp); + if (*_buffer == NULL) + return B_NO_MEMORY; + + return B_OK; +} + + +/*! + Determines the port of the given \a address. + \return uint16 representing the port-nr +*/ +static uint16 +l2cap_get_port(const sockaddr *address) +{ + if (address == NULL) + return 0; + + return ((sockaddr_l2cap *)address)->l2cap_psm; +} + + +/*! + Sets the port of the given \a address to \a port. + \return B_OK if the port has been set + \return B_BAD_VALUE if \a address is NULL +*/ +static status_t +l2cap_set_port(sockaddr *address, uint16 port) +{ + if (address == NULL) + return B_BAD_VALUE; + + ((sockaddr_l2cap *)address)->l2cap_psm = port; + return B_OK; +} + + +/*! + Sets \a address to \a from. + \return B_OK if \a from has been copied into \a address + \return B_BAD_VALUE if either \a address or \a from is NULL + \return B_MISMATCHED_VALUES if from is not of family AF_INET +*/ +static status_t +l2cap_set_to(sockaddr *address, const sockaddr *from) +{ + if (address == NULL || from == NULL) + return B_BAD_VALUE; + + if (from->sa_family != AF_BLUETOOTH) + return B_MISMATCHED_VALUES; + + memcpy(address, from, sizeof(sockaddr_l2cap)); + address->sa_len = sizeof(sockaddr_l2cap); + return B_OK; +} + + +static status_t +l2cap_update_to(sockaddr *_address, const sockaddr *_from) +{ + sockaddr_l2cap *address = (sockaddr_l2cap *)_address; + const sockaddr_l2cap *from = (const sockaddr_l2cap *)_from; + + if (address == NULL || from == NULL) + return B_BAD_VALUE; + + if (from->l2cap_family != AF_BLUETOOTH) + return B_BAD_VALUE; + + address->l2cap_family = AF_INET; + address->l2cap_len = sizeof(sockaddr_l2cap); + + if (address->l2cap_psm == 0) + address->l2cap_psm = from->l2cap_psm; + + if (bacmp(&address->l2cap_bdaddr, BDADDR_BROADCAST)==0) + address->l2cap_bdaddr = from->l2cap_bdaddr; + + return B_OK; +} + + +/*! + Sets \a address to the empty address (0.0.0.0). + \return B_OK if \a address has been set + \return B_BAD_VALUE if \a address is NULL +*/ +static status_t +l2cap_set_to_empty_address(sockaddr *address) +{ + if (address == NULL) + return B_BAD_VALUE; + + memset(address, 0, sizeof(sockaddr_l2cap)); + address->sa_len = sizeof(sockaddr_l2cap); + address->sa_family = AF_BLUETOOTH; + return B_OK; +} + + +static status_t +l2cap_set_to_defaults(sockaddr *_defaultMask, sockaddr *_defaultBroadcast, + sockaddr *_address, sockaddr *_mask) +{ + + return B_OK; +} + +/*! + Computes a hash-value of the given addresses \a ourAddress + and \a peerAddress. + \return uint32 representing the hash-value +*/ +static uint32 +l2cap_hash_address_pair(const sockaddr *ourAddress, const sockaddr *peerAddress) +{ + const sockaddr_l2cap *our = (const sockaddr_l2cap *)ourAddress; + const sockaddr_l2cap *peer = (const sockaddr_l2cap *)peerAddress; + + return ((our ? our->l2cap_psm : 0) | ((peer ? peer->l2cap_psm : 0) << 16)) + ^ (our ? L2CAP_CHECKSUM(our->l2cap_bdaddr) : 0) ^ (peer ? L2CAP_CHECKSUM(peer->l2cap_bdaddr) : 0); +} + + +/*! + Adds the given \a address to the IP-checksum \a checksum. + \return B_OK if \a address has been added to the checksum + \return B_BAD_VALUE if either \a address or \a checksum is NULL +*/ +static status_t +l2cap_checksum_address(struct Checksum *checksum, const sockaddr *address) +{ + if (checksum == NULL || address == NULL) + return B_BAD_VALUE; + + for (uint i = 0; i < sizeof(bdaddr_t); i++) + (*checksum) << ((sockaddr_l2cap*)address)->l2cap_bdaddr.b[i]; + + return B_OK; +} + + +net_address_module_info gL2cap4AddressModule = { + { + NULL, + 0, + NULL + }, + l2cap_copy_address, + l2cap_mask_address, + l2cap_equal_addresses, + l2cap_equal_ports, + l2cap_equal_addresses_and_ports, + l2cap_equal_masked_addresses, + l2cap_is_empty_address, + l2cap_first_mask_bit, + l2cap_check_mask, + l2cap_print_address, + l2cap_print_address_buffer, + l2cap_get_port, + l2cap_set_port, + l2cap_set_to, + l2cap_set_to_empty_address, + l2cap_set_to_defaults, + l2cap_update_to, + l2cap_hash_address_pair, + l2cap_checksum_address, + NULL // l2cap_matches_broadcast_address, +}; Added: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_address.h =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_address.h 2008-06-02 18:50:42 UTC (rev 25767) +++ haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_address.h 2008-06-02 20:16:00 UTC (rev 25768) @@ -0,0 +1,15 @@ +/* + * Copyright 2006, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Oliver Ruiz Dorantes, oliver-ruiz.dorantes_at_gmail.com + */ + + +#ifndef L2CAP_ADDRESS_H +#define L2CAP_ADDRESS_H + +extern struct net_address_module_info gL2cap4AddressModule; + +#endif // L2CAP_ADDRESS_H From julun at mail.berlios.de Mon Jun 2 22:21:40 2008 From: julun at mail.berlios.de (julun at BerliOS) Date: Mon, 2 Jun 2008 22:21:40 +0200 Subject: [Haiku-commits] r25769 - haiku/trunk/src/kits/interface Message-ID: <200806022021.m52KLeId010425@sheep.berlios.de> Author: julun Date: 2008-06-02 22:21:40 +0200 (Mon, 02 Jun 2008) New Revision: 25769 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25769&view=rev Modified: haiku/trunk/src/kits/interface/PrintJob.cpp Log: * don't print child views with invalid rect, this makes printing e.g. from Scooby nearly the same as on R5 (still misses the gray header color) Modified: haiku/trunk/src/kits/interface/PrintJob.cpp =================================================================== --- haiku/trunk/src/kits/interface/PrintJob.cpp 2008-06-02 20:16:00 UTC (rev 25768) +++ haiku/trunk/src/kits/interface/PrintJob.cpp 2008-06-02 20:21:40 UTC (rev 25769) @@ -673,13 +673,12 @@ BView *child = view->ChildAt(0); while (child != NULL) { if ((child->Flags() & B_WILL_DRAW) && !child->IsHidden()) { - BRect bounds(child->Bounds()); - BPoint childLeftTop = view->Bounds().LeftTop() - + (child->Frame().LeftTop() - bounds.LeftTop()); - _RecurseView(child, origin + childLeftTop, picture, - bounds & rect.OffsetToCopy(rect.LeftTop() - childLeftTop)); - child = child->NextSibling(); + BPoint leftTop(view->Bounds().LeftTop() + child->Frame().LeftTop()); + BRect printRect(rect.OffsetToCopy(rect.LeftTop() - leftTop) & child->Bounds()); + if (printRect.IsValid()) + _RecurseView(child, origin + leftTop, picture, printRect); } + child = child->NextSibling(); } if (view->Flags() & B_DRAW_ON_CHILDREN) { From korli at mail.berlios.de Mon Jun 2 22:53:47 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Mon, 2 Jun 2008 22:53:47 +0200 Subject: [Haiku-commits] r25770 - haiku/trunk/src/apps/workspaces Message-ID: <200806022053.m52KrlPu013975@sheep.berlios.de> Author: korli Date: 2008-06-02 22:53:46 +0200 (Mon, 02 Jun 2008) New Revision: 25770 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25770&view=rev Modified: haiku/trunk/src/apps/workspaces/Workspaces.cpp Log: HasBorder and HasTitle are exclusive, fix bug #2325 Modified: haiku/trunk/src/apps/workspaces/Workspaces.cpp =================================================================== --- haiku/trunk/src/apps/workspaces/Workspaces.cpp 2008-06-02 20:21:40 UTC (rev 25769) +++ haiku/trunk/src/apps/workspaces/Workspaces.cpp 2008-06-02 20:53:46 UTC (rev 25770) @@ -554,8 +554,10 @@ if (enable) SetLook(B_TITLED_WINDOW_LOOK); - else + else { SetLook(B_NO_BORDER_WINDOW_LOOK); + fSettings->SetHasTitle(true); + } fSettings->SetHasBorder(enable); break; @@ -569,8 +571,10 @@ if (enable) SetLook(B_TITLED_WINDOW_LOOK); - else + else { SetLook(B_MODAL_WINDOW_LOOK); + fSettings->SetHasBorder(true); + } fSettings->SetHasTitle(enable); break; From axeld at pinc-software.de Mon Jun 2 23:28:49 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 02 Jun 2008 23:28:49 +0200 CEST Subject: [Haiku-commits] r25762 - haiku/trunk/src/kits/interface In-Reply-To: <200806021818.m52IIuoZ028545@sheep.berlios.de> Message-ID: <47430005181-BeMail@zon> stippi at BerliOS wrote: > Log: > Resolved TODO and set the flags for the kind of additional > bitmap support (bitmaps support child views or BViews can > draw them) Wasn't aware of this function - so we can just add a B_BITMAP_SUPPORTS_OVERLAY there and that's it? Bye, Axel. From korli at mail.berlios.de Tue Jun 3 00:29:15 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 3 Jun 2008 00:29:15 +0200 Subject: [Haiku-commits] r25771 - haiku/trunk/src/apps/installer Message-ID: <200806022229.m52MTFEV022956@sheep.berlios.de> Author: korli Date: 2008-06-03 00:29:15 +0200 (Tue, 03 Jun 2008) New Revision: 25771 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25771&view=rev Modified: haiku/trunk/src/apps/installer/FSUtils.cpp Log: ported back a change from Tracker FSUtils.cpp Modified: haiku/trunk/src/apps/installer/FSUtils.cpp =================================================================== --- haiku/trunk/src/apps/installer/FSUtils.cpp 2008-06-02 20:53:46 UTC (rev 25770) +++ haiku/trunk/src/apps/installer/FSUtils.cpp 2008-06-02 22:29:15 UTC (rev 25771) @@ -1146,6 +1146,11 @@ continue; } + // Special case for a size 0 attribute. It wouldn't be written at all + // otherwise. + if (info.size == 0) + destNode->WriteAttr(name, info.type, 0, buffer, 0); + ssize_t bytes; ssize_t numToRead = (ssize_t)info.size; for (off_t offset = 0; numToRead > 0; offset += bytes) { From korli at mail.berlios.de Tue Jun 3 00:34:49 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 3 Jun 2008 00:34:49 +0200 Subject: [Haiku-commits] r25772 - haiku/trunk/src/apps/installer Message-ID: <200806022234.m52MYnbP030051@sheep.berlios.de> Author: korli Date: 2008-06-03 00:34:48 +0200 (Tue, 03 Jun 2008) New Revision: 25772 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25772&view=rev Modified: haiku/trunk/src/apps/installer/CopyEngine.cpp haiku/trunk/src/apps/installer/CopyEngine.h haiku/trunk/src/apps/installer/InstallerWindow.cpp Log: better handles error and cancellation when copying Modified: haiku/trunk/src/apps/installer/CopyEngine.cpp =================================================================== --- haiku/trunk/src/apps/installer/CopyEngine.cpp 2008-06-02 22:29:15 UTC (rev 25771) +++ haiku/trunk/src/apps/installer/CopyEngine.cpp 2008-06-02 22:34:48 UTC (rev 25772) @@ -1,5 +1,5 @@ /* - * Copyright 2005-2006, J?r?me DUVAL. All rights reserved. + * Copyright 2005-2008, J?r?me DUVAL. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -76,7 +76,10 @@ fWindow->GetTargetMenu()); if (err != B_OK) { ERR("Start failed"); + SetStatusMessage("Installation aborted."); BMessenger(fWindow).SendMessage(RESET_INSTALL); + } else { + BMessenger(fWindow).SendMessage(INSTALL_FINISHED); } break; } @@ -229,8 +232,11 @@ // copy source volume BDirectory targetDir(targetDirectory.Path()); BDirectory srcDir(srcDirectory.Path()); - CopyFolder(srcDir, targetDir); + err = CopyFolder(srcDir, targetDir); + if (err != B_OK) + return err; + // copy selected packages if (fPackages) { srcDirectory.Append(PACKAGES_DIRECTORY); @@ -239,25 +245,28 @@ int32 count = fPackages->CountItems(); for (int32 i = 0; i < count; i++) { if (fControl->CheckUserCanceled()) - return B_OK; + return B_CANCELED; Package *p = static_cast(fPackages->ItemAt(i)); packageDir.SetTo(&srcDir, p->Folder()); - CopyFolder(packageDir, targetDir); + err = CopyFolder(packageDir, targetDir); + if (err != B_OK) + break; } } - if (!fControl->CheckUserCanceled()) { - LaunchFinishScript(targetDirectory); + if (err != B_OK) + return err; - BMessage msg(INSTALL_FINISHED); - BMessenger(fWindow).SendMessage(&msg); - } + if (fControl->CheckUserCanceled()) + return B_CANCELED; + + LaunchFinishScript(targetDirectory); return B_OK; } -void +status_t CopyEngine::CopyFolder(BDirectory &srcDir, BDirectory &targetDir) { BEntry entry; @@ -283,8 +292,11 @@ BPath path; entry.GetPath(&path); ERR2("error while copying %s", path.Path()); + return err; } } + + return B_OK; } Modified: haiku/trunk/src/apps/installer/CopyEngine.h =================================================================== --- haiku/trunk/src/apps/installer/CopyEngine.h 2008-06-02 22:29:15 UTC (rev 25771) +++ haiku/trunk/src/apps/installer/CopyEngine.h 2008-06-02 22:34:48 UTC (rev 25772) @@ -32,7 +32,7 @@ private: void LaunchInitScript(BPath &path); void LaunchFinishScript(BPath &path); - void CopyFolder(BDirectory &srcDir, BDirectory &targetDir); + status_t CopyFolder(BDirectory &srcDir, BDirectory &targetDir); InstallerWindow *fWindow; BDiskDeviceRoster fDDRoster; Modified: haiku/trunk/src/apps/installer/InstallerWindow.cpp =================================================================== --- haiku/trunk/src/apps/installer/InstallerWindow.cpp 2008-06-02 22:29:15 UTC (rev 25771) +++ haiku/trunk/src/apps/installer/InstallerWindow.cpp 2008-06-02 22:34:48 UTC (rev 25772) @@ -1,5 +1,5 @@ /* - * Copyright 2005, J?r?me DUVAL. All rights reserved. + * Copyright 2005-2008, J?r?me DUVAL. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -213,7 +213,6 @@ if (fCopyEngine->Cancel()) { fInstallStatus = kCancelled; SetStatusMessage("Installation cancelled."); - PostMessage(RESET_INSTALL); } break; case kFinished: @@ -263,6 +262,7 @@ } case INSTALL_FINISHED: fBeginButton->SetLabel("Quit"); + SetStatusMessage("Installation completed."); fInstallStatus = kFinished; DisableInterface(false); break; From ingo_weinhold at gmx.de Tue Jun 3 01:11:56 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Tue, 03 Jun 2008 01:11:56 +0200 Subject: [Haiku-commits] r25762 - haiku/trunk/src/kits/interface In-Reply-To: <200806021818.m52IIuoZ028545@sheep.berlios.de> References: <200806021818.m52IIuoZ028545@sheep.berlios.de> Message-ID: <20080603011156.631.2@knochen-vm.1212446751.fake> On 2008-06-02 at 20:18:56 [+0200], stippi at BerliOS wrote: > Author: stippi > Date: 2008-06-02 20:18:56 +0200 (Mon, 02 Jun 2008) > New Revision: 25762 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25762&view=rev > > Modified: > haiku/trunk/src/kits/interface/GraphicsDefs.cpp > Log: > Resolved TODO and set the flags for the kind of additional > bitmap support (bitmaps support child views or BViews can > draw them) > > > Modified: haiku/trunk/src/kits/interface/GraphicsDefs.cpp > =================================================================== > --- haiku/trunk/src/kits/interface/GraphicsDefs.cpp 2008-06-02 17:08:42 > UTC (rev 25761) > +++ haiku/trunk/src/kits/interface/GraphicsDefs.cpp 2008-06-02 18:18:56 > UTC (rev 25762) > @@ -144,17 +144,21 @@ > bool > bitmaps_support_space(color_space space, uint32 *supportFlags) > { > - // TODO: fill supportFlags with the supported flags: > - // - B_VIEWS_SUPPORT_DRAW_BITMAP > - // - B_BITMAPS_SUPPORT_ATTACHED_VIEWS > - bool result = false; > + bool result = true; > switch (space) { > - // supported > + // supported, also for drawing and for attaching BViews > case B_RGB32: case B_RGBA32: case B_RGB24: > case B_RGB32_BIG: case B_RGBA32_BIG: case B_RGB24_BIG: > case B_RGB16: case B_RGB15: case B_RGBA15: > case B_RGB16_BIG: case B_RGB15_BIG: case B_RGBA15_BIG: > case B_CMAP8: case B_GRAY8: case B_GRAY1: > + if (supportFlags) { > + *supportFlags = 0; > + *supportFlags |= B_VIEWS_SUPPORT_DRAW_BITMAP; > + *supportFlags |= B_BITMAPS_SUPPORT_ATTACHED_VIEWS; I don't really see why this isn't a single statement. Not that this is particularly important... CU, Ingo From ingo_weinhold at gmx.de Tue Jun 3 01:12:44 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Tue, 03 Jun 2008 01:12:44 +0200 Subject: [Haiku-commits] r25752 - in haiku/trunk: headers/os/drivers headers/private/kernel headers/private/system src/add-ons/kernel/bus_managers/ide src/add-ons/kernel/bus_managers/pci/arch/x86 src/add-ons/kernel/bus_managers/ps2 src/add-ons/kernel/bus_managers/scsi src/add-ons/kernel/busses/scsi/ahci src/add-ons/kernel/busses/usb src/add-ons/kernel/drivers/audio/ac97/auich src/add-ons/kernel/drivers/audio/ac97/auvia src/add-ons/kernel/drivers/audio/emuxki src/add-ons/kernel/drivers/graphics/radeon src/add-ons/kernel/drivers/network/rtl8169 src/add-ons/kernel/generic/dpc src/add-ons/kernel/generic/mpu401 src/libs/compat/freebsd_network src/system/kernel src/system/kernel/arch/m68k src/system/kernel/arch/x86 src/system/kernel/debug In-Reply-To: <1163535131-BeMail@primary> References: <1163535131-BeMail@primary> Message-ID: <20080603011244.661.3@knochen-vm.1212446751.fake> On 2008-06-02 at 20:57:40 [+0200], Michael Lotz wrote: > > Author: bonefish > > Date: 2008-06-02 04:04:12 +0200 (Mon, 02 Jun 2008) > > New Revision: 25752 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25752&view=rev > > Log: > > * Added macros for spinlock initialization and access and changed > > code using spinlocks accordingly. This breaks compilation for BeOS > > -- > > the macros should be defined in the respective compatibility > > wrappers. > > Well at least for the USB parts this still compiles just fine (with the > bone target in my case). The Haiku KernelExport.h is included there and > not the host one, so the initializers you provide are picked up and > everything compiles. OK, sounds a bit hacky, but I suppose there's a reason for not using the target platform's KernelExport.h. CU, Ingo From ingo_weinhold at gmx.de Tue Jun 3 01:14:27 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Tue, 03 Jun 2008 01:14:27 +0200 Subject: [Haiku-commits] r25752 - in haiku/trunk: headers/os/drivers headers/private/kernel headers/private/system src/add-ons/kernel/bus_managers/ide src/add-ons/kernel/bus_managers/pci/arch/x86 src/add-ons/kernel/bus_managers/ps2 src/add-ons/kernel/bus_ In-Reply-To: References: Message-ID: <20080603011427.704.4@knochen-vm.1212446751.fake> On 2008-06-02 at 21:15:35 [+0200], J?r?me Duval wrote: > 2008/6/2 bonefish at BerliOS : > > * Added macros for spinlock initialization and access and changed > > code using spinlocks accordingly. This breaks compilation for BeOS -- > > the macros should be defined in the respective compatibility wrappers. > > Shouldn't B_SPINLOCK_INITIALIZER be added to Haiku compatibility header ? If you mean HaikuBuildCompatibility.h, I don't think this is included from any kernel code. It's original purpose was for building the build tools, anyway. CU, Ingo From jackburton at mail.berlios.de Tue Jun 3 06:37:20 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Tue, 3 Jun 2008 06:37:20 +0200 Subject: [Haiku-commits] r25773 - in haiku/trunk: headers/private/kernel/arch/x86 src/system/kernel/arch/x86 Message-ID: <200806030437.m534bKgT017729@sheep.berlios.de> Author: jackburton Date: 2008-06-03 06:37:18 +0200 (Tue, 03 Jun 2008) New Revision: 25773 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25773&view=rev Added: haiku/trunk/headers/private/kernel/arch/x86/arch_hpet.h haiku/trunk/src/system/kernel/arch/x86/arch_hpet.c Modified: haiku/trunk/src/system/kernel/arch/x86/Jamfile Log: Added patch by Dustin Howett: header with HPET definitions and (empty) file for hpet implementation. Not yet added to the build. Added: haiku/trunk/headers/private/kernel/arch/x86/arch_hpet.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/x86/arch_hpet.h 2008-06-02 22:34:48 UTC (rev 25772) +++ haiku/trunk/headers/private/kernel/arch/x86/arch_hpet.h 2008-06-03 04:37:18 UTC (rev 25773) @@ -0,0 +1,46 @@ +/* + * Copyright 2008, Dustin Howett, dustin.howett at gmail.com. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _KERNEL_ARCH_x86_HPET_H +#define _KERNEL_ARCH_x86_HPET_H + +/* All masks are 64 bits wide to represent bit locations; + the HPET registers are 64 bits wide. */ + +/* Global Capability Register Masks */ +#define HPET_CAP_MASK_ID 0x00000000000000FF +#define HPET_CAP_MASK_NUMTIMERS 0x0000000000001F00 +#define HPET_CAP_MASK_WIDTH 0x0000000000002000 +#define HPET_CAP_MASK_LEGACY 0x0000000000008000 +#define HPET_CAP_MASK_VENDOR_ID 0x00000000FFFF0000 +#define HPET_CAP_MASK_PERIOD 0xFFFFFFFF00000000 + +/* Retrieve Global Capabilities */ +#define HPET_GET_ID(regs) ((regs)->caps & HPET_CAP_MASK_ID) +#define HPET_GET_NUM_TIMERS(regs) (((regs)->caps & HPET_CAP_MASK_NUMTIMERS) >> 8) +#define HPET_IS_64BIT_CAPABLE(regs) (((regs)->caps & HPET_CAP_MASK_WIDTH) >> 13) +#define HPET_IS_LEGACY_CAPABLE(regs) (((regs)->caps & HPET_CAP_MASK_LEGACY) >> 15) +#define HPET_GET_VENDOR_ID(regs) (((regs)->caps & HPET_CAP_MASK_VENDOR_ID) >> 16) +#define HPET_GET_PERIOD(regs) (((regs)->caps & HPET_CAP_MASK_PERIOD) >> 32) + +struct hpet_timer { + uint64 config, /* Timer configuration and capabilities */ + uint64 comparator, /* Comparator value */ + uint64 introute, /* FSB Interrupt Routing */ + uint64 reserved +}; + +struct hpet_regs { + uint64 caps, /* HPET Capabilities and ID */ + uint64 reserved1, + uint64 config, /* General Configuration */ + uint64 reserved2, + uint64 intstatus, /* General Interrupt Status */ + uint8 reserved3[200], + uint64 mainvalue, /* Main Counter Value */ + uint64 reserved3, + struct hpet_timer timers[1] /* Timers */ +}; + +#endif Modified: haiku/trunk/src/system/kernel/arch/x86/Jamfile =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/Jamfile 2008-06-02 22:34:48 UTC (rev 25772) +++ haiku/trunk/src/system/kernel/arch/x86/Jamfile 2008-06-03 04:37:18 UTC (rev 25773) @@ -15,6 +15,7 @@ arch_debug.cpp arch_debug_console.c arch_elf.c +# arch_hpet.c arch_int.c arch_platform.c # arch_selector.c Added: haiku/trunk/src/system/kernel/arch/x86/arch_hpet.c =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_hpet.c 2008-06-02 22:34:48 UTC (rev 25772) +++ haiku/trunk/src/system/kernel/arch/x86/arch_hpet.c 2008-06-03 04:37:18 UTC (rev 25773) @@ -0,0 +1,6 @@ +/* + * Copyright 2008, Dustin Howett, dustin.howett at gmail.com. All rights reserved. + * Distributed under the terms of the MIT License. + */ + +#include From jackburton at mail.berlios.de Tue Jun 3 07:03:01 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Tue, 3 Jun 2008 07:03:01 +0200 Subject: [Haiku-commits] r25774 - in haiku/trunk: headers/private/kernel/arch/x86 src/system/kernel/arch/x86 Message-ID: <200806030503.m53531Na017101@sheep.berlios.de> Author: jackburton Date: 2008-06-03 07:02:59 +0200 (Tue, 03 Jun 2008) New Revision: 25774 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25774&view=rev Modified: haiku/trunk/headers/private/kernel/arch/x86/arch_hpet.h haiku/trunk/src/system/kernel/arch/x86/Jamfile Log: took the liberty to add this to the buiild and fix compilation :) Modified: haiku/trunk/headers/private/kernel/arch/x86/arch_hpet.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/x86/arch_hpet.h 2008-06-03 04:37:18 UTC (rev 25773) +++ haiku/trunk/headers/private/kernel/arch/x86/arch_hpet.h 2008-06-03 05:02:59 UTC (rev 25774) @@ -5,6 +5,8 @@ #ifndef _KERNEL_ARCH_x86_HPET_H #define _KERNEL_ARCH_x86_HPET_H +#include + /* All masks are 64 bits wide to represent bit locations; the HPET registers are 64 bits wide. */ @@ -25,22 +27,23 @@ #define HPET_GET_PERIOD(regs) (((regs)->caps & HPET_CAP_MASK_PERIOD) >> 32) struct hpet_timer { - uint64 config, /* Timer configuration and capabilities */ - uint64 comparator, /* Comparator value */ - uint64 introute, /* FSB Interrupt Routing */ - uint64 reserved + uint64 config; /* Timer configuration and capabilities */ + uint64 comparator; /* Comparator value */ + uint64 introute; /* FSB Interrupt Routing */ + uint64 reserved; }; + struct hpet_regs { - uint64 caps, /* HPET Capabilities and ID */ - uint64 reserved1, - uint64 config, /* General Configuration */ - uint64 reserved2, - uint64 intstatus, /* General Interrupt Status */ - uint8 reserved3[200], - uint64 mainvalue, /* Main Counter Value */ - uint64 reserved3, - struct hpet_timer timers[1] /* Timers */ + uint64 caps; /* HPET Capabilities and ID */ + uint64 reserved1; + uint64 config; /* General Configuration */ + uint64 reserved2; + uint64 intstatus; /* General Interrupt Status */ + uint8 reserved3[200]; + uint64 mainvalue; /* Main Counter Value */ + uint64 reserved4; + struct hpet_timer timers[1]; /* Timers */ }; #endif Modified: haiku/trunk/src/system/kernel/arch/x86/Jamfile =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/Jamfile 2008-06-03 04:37:18 UTC (rev 25773) +++ haiku/trunk/src/system/kernel/arch/x86/Jamfile 2008-06-03 05:02:59 UTC (rev 25774) @@ -15,7 +15,7 @@ arch_debug.cpp arch_debug_console.c arch_elf.c -# arch_hpet.c + arch_hpet.c arch_int.c arch_platform.c # arch_selector.c From mmlr at mail.berlios.de Tue Jun 3 08:53:58 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Tue, 3 Jun 2008 08:53:58 +0200 Subject: [Haiku-commits] r25775 - haiku/trunk/src/system/kernel/device_manager Message-ID: <200806030653.m536rw4R011049@sheep.berlios.de> Author: mmlr Date: 2008-06-03 08:53:57 +0200 (Tue, 03 Jun 2008) New Revision: 25775 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25775&view=rev Modified: haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp Log: Move the device deletion after the unpublish call. Fixes crashes where a device is still referenced through the devfs and used right between deleting and unpublishing. Modified: haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp 2008-06-03 05:02:59 UTC (rev 25774) +++ haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp 2008-06-03 06:53:57 UTC (rev 25775) @@ -312,12 +312,11 @@ TRACE(("devfs: unpublishing no more present \"%s\"\n", entry->path)); LegacyDevice* device = get_device_for_path(driver, entry->path); - if (device != NULL) { + if (device != NULL) driver->devices.Remove(device); - delete device; - } devfs_unpublish_device(entry->path, true); + delete device; delete entry; } From mmlr at mail.berlios.de Tue Jun 3 08:56:24 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Tue, 3 Jun 2008 08:56:24 +0200 Subject: [Haiku-commits] r25776 - haiku/trunk/src/system/kernel Message-ID: <200806030656.m536uO52011220@sheep.berlios.de> Author: mmlr Date: 2008-06-03 08:56:24 +0200 (Tue, 03 Jun 2008) New Revision: 25776 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25776&view=rev Modified: haiku/trunk/src/system/kernel/heap.cpp Log: Directly use memalign instead of malloc to safe one indirection. Modified: haiku/trunk/src/system/kernel/heap.cpp =================================================================== --- haiku/trunk/src/system/kernel/heap.cpp 2008-06-03 06:53:57 UTC (rev 25775) +++ haiku/trunk/src/system/kernel/heap.cpp 2008-06-03 06:56:24 UTC (rev 25776) @@ -1419,7 +1419,7 @@ } if (address == NULL) - return malloc(newSize); + return memalign(0, newSize); if (newSize == 0) { free(address); From axeld at pinc-software.de Tue Jun 3 09:02:20 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 03 Jun 2008 09:02:20 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r25773_-_in_haiku/trunk=3A_headers/priv?= =?utf-8?q?ate/kernel/arch/x86__src/system/kernel/arch/x86?= In-Reply-To: <200806030437.m534bKgT017729@sheep.berlios.de> Message-ID: <569727871-BeMail@zon> jackburton at BerliOS wrote: > + uint64 introute, /* FSB Interrupt Routing */ > + uint64 reserved > +}; > + > +struct hpet_regs { > + uint64 caps, /* HPET Capabilities and ID */ > + uint64 reserved1, > + uint64 config, /* General Configuration */ > + uint64 reserved2, > + uint64 intstatus, /* General Interrupt Status */ > + uint8 reserved3[200], > + uint64 mainvalue, /* Main Counter Value */ How about using interrupt_route, interrupt_status, and main_counter_value and remove the then superfluous comments (or make them more specific to change that)? We should always use expressive names rather than ones you'll have to look up before understanding their purpose. Also, concatenations (like "mainvalue") are separated by '_' in C structures. And finally, since HPET is an x86 specific thing (unless there will be an arch/hpet.h header), so the header should just be called hpet.h in that directory (just like apm.h, vesa.h, ...). Looking forward to the implementation :-) Bye, Axel. From axeld at mail.berlios.de Tue Jun 3 09:28:05 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 3 Jun 2008 09:28:05 +0200 Subject: [Haiku-commits] r25777 - haiku/trunk/src/system/kernel/device_manager Message-ID: <200806030728.m537S5Of013567@sheep.berlios.de> Author: axeld Date: 2008-06-03 09:28:04 +0200 (Tue, 03 Jun 2008) New Revision: 25777 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25777&view=rev Modified: haiku/trunk/src/system/kernel/device_manager/device_manager.cpp Log: Patch by Vasilis Kaoutsis: * Added a missing close_module_list(). Modified: haiku/trunk/src/system/kernel/device_manager/device_manager.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/device_manager.cpp 2008-06-03 06:56:24 UTC (rev 25776) +++ haiku/trunk/src/system/kernel/device_manager/device_manager.cpp 2008-06-03 07:28:04 UTC (rev 25777) @@ -305,6 +305,7 @@ devfs_publish_directory(path.Path()); } + close_module_list(list); } else { // TODO: implement module directory traversal! } From axeld at mail.berlios.de Tue Jun 3 11:13:04 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 3 Jun 2008 11:13:04 +0200 Subject: [Haiku-commits] r25778 - haiku/trunk/src/system/kernel/device_manager Message-ID: <200806030913.m539D4cV026950@sheep.berlios.de> Author: axeld Date: 2008-06-03 11:13:04 +0200 (Tue, 03 Jun 2008) New Revision: 25778 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25778&view=rev Modified: haiku/trunk/src/system/kernel/device_manager/device_manager.cpp Log: * As Korli pointed out, I got a bit confused with Rescan() vs. Probe(). * Therefore, device_manager::rescan_node() now actually causes the driver::rescan_child_devices() function to be called, instead of probing again. * Added a device_node::Reprobe() method that does what Rescan() did previously. * Probe() should now also work with "dumb" busses that don't support type information - it will now probe all of these nodes. Modified: haiku/trunk/src/system/kernel/device_manager/device_manager.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/device_manager.cpp 2008-06-03 07:28:04 UTC (rev 25777) +++ haiku/trunk/src/system/kernel/device_manager/device_manager.cpp 2008-06-03 09:13:04 UTC (rev 25778) @@ -117,6 +117,7 @@ status_t Register(device_node* parent); status_t Probe(const char* devicePath, uint32 updateCycle); + status_t Reprobe(); status_t Rescan(); bool IsRegistered() const { return fRegistered; } @@ -153,7 +154,7 @@ status_t _RegisterDynamic(device_node* previous = NULL); status_t _RemoveChildren(); device_node* _FindCurrentChild(); - status_t _Rescan(); + status_t _Probe(); void _ReleaseWaiting(); device_node* fParent; @@ -1695,7 +1696,7 @@ status_t -device_node::_Rescan() +device_node::_Probe() { device_node* previous = NULL; @@ -1733,31 +1734,37 @@ MethodDeleter uninit(this, &device_node::UninitDriver); - uint16 type = 0; - uint16 subType = 0; - if (get_attr_uint16(this, B_DEVICE_TYPE, &type, false) == B_OK - && get_attr_uint16(this, B_DEVICE_SUB_TYPE, &subType, false) == B_OK) { - // Check if this node matches the device path - // TODO: maybe make this extendible via settings file? + if ((fFlags & B_FIND_CHILD_ON_DEMAND) != 0) { bool matches = false; - if (!strcmp(devicePath, "disk")) { - matches = type == PCI_mass_storage; - } else if (!strcmp(devicePath, "audio")) { - matches = type == PCI_multimedia - && (subType == PCI_audio || subType == PCI_hd_audio); - } else if (!strcmp(devicePath, "net")) { - matches = type == PCI_network; - } else if (!strcmp(devicePath, "graphics")) { - matches = type == PCI_display; - } else if (!strcmp(devicePath, "video")) { - matches = type == PCI_multimedia && subType == PCI_video; + uint16 type = 0; + uint16 subType = 0; + if (get_attr_uint16(this, B_DEVICE_SUB_TYPE, &subType, false) == B_OK + && get_attr_uint16(this, B_DEVICE_TYPE, &type, false) == B_OK) { + // Check if this node matches the device path + // TODO: maybe make this extendible via settings file? + if (!strcmp(devicePath, "disk")) { + matches = type == PCI_mass_storage; + } else if (!strcmp(devicePath, "audio")) { + matches = type == PCI_multimedia + && (subType == PCI_audio || subType == PCI_hd_audio); + } else if (!strcmp(devicePath, "net")) { + matches = type == PCI_network; + } else if (!strcmp(devicePath, "graphics")) { + matches = type == PCI_display; + } else if (!strcmp(devicePath, "video")) { + matches = type == PCI_multimedia && subType == PCI_video; + } + } else { + // This driver does not support types, but still wants to its + // children explored on demand only. + matches = true; } if (matches) { fLastUpdateCycle = updateCycle; // This node will be probed in this update cycle - return _Rescan(); + return _Probe(); } return B_OK; @@ -1777,10 +1784,17 @@ status_t -device_node::Rescan() +device_node::Reprobe() { + status_t status = InitDriver(); + if (status < B_OK) + return status; + + MethodDeleter uninit(this, + &device_node::UninitDriver); + // If this child has been probed already, probe it again - status_t status = _Rescan(); + status = _Probe(); if (status != B_OK) return status; @@ -1788,6 +1802,35 @@ while (iterator.HasNext()) { device_node* child = iterator.Next(); + status = child->Reprobe(); + if (status != B_OK) + return status; + } + + return B_OK; +} + + +status_t +device_node::Rescan() +{ + status_t status = InitDriver(); + if (status < B_OK) + return status; + + MethodDeleter uninit(this, + &device_node::UninitDriver); + + if (DriverModule()->rescan_child_devices != NULL) { + status = DriverModule()->rescan_child_devices(DriverData()); + if (status != B_OK) + return status; + } + + NodeList::Iterator iterator = fChildren.GetIterator(); + while (iterator.HasNext()) { + device_node* child = iterator.Next(); + status = child->Rescan(); if (status != B_OK) return status; @@ -2062,6 +2105,7 @@ status_t device_manager_init_post_modules(struct kernel_args* args) { - return sRootNode->Rescan(); + RecursiveLocker _(sLock); + return sRootNode->Reprobe(); } From axeld at mail.berlios.de Tue Jun 3 15:22:25 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 3 Jun 2008 15:22:25 +0200 Subject: [Haiku-commits] r25779 - in haiku/trunk/src: add-ons/kernel/bus_managers/isa system/kernel/device_manager Message-ID: <200806031322.m53DMPY5021302@sheep.berlios.de> Author: axeld Date: 2008-06-03 15:22:24 +0200 (Tue, 03 Jun 2008) New Revision: 25779 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25779&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/isa/isa.c haiku/trunk/src/system/kernel/device_manager/device_manager.cpp Log: * device_nodes now have a priority that is used to sort them when they are added to their parent. Currently, only the existence of B_FIND_MULTIPLE_CHILDREN influences the priority. * This makes it possible to register/probe intelligent busses earlier than simple/generic busses. * Reenabled the ISA bus manager using the new device architecture; the ide_isa driver can and will now actually work. * device_node::Probe() now sets the global sGenericContextPath for generic nodes. This causes a special handling in _GetNextDriverPath(). Modified: haiku/trunk/src/add-ons/kernel/bus_managers/isa/isa.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/isa/isa.c 2008-06-03 09:13:04 UTC (rev 25778) +++ haiku/trunk/src/add-ons/kernel/bus_managers/isa/isa.c 2008-06-03 13:22:24 UTC (rev 25779) @@ -34,7 +34,7 @@ // (for example, the Pegasos (PPC based) also has an ISA bus) -#define ISA_MODULE_NAME "bus_managers/isa/root/device_v1" +#define ISA_MODULE_NAME "bus_managers/isa/root/driver_v1" device_manager_info *pnp; @@ -73,75 +73,54 @@ } -#if 0 +// #pragma mark - driver module API + + static status_t -isa_init_driver(device_node_handle node, void *user_cookie, void **cookie) +isa_init_driver(device_node *node, void **cookie) { - *cookie = NULL; + *cookie = node; return B_OK; } -static status_t +static void isa_uninit_driver(void *cookie) { - return B_OK; } static float -isa_supports_device(device_node_handle parent, bool *_noConnection) +isa_supports_device(device_node *parent) { - char *bus; + const char *bus; // make sure parent is really pnp root - if (pnp->get_attr_string(parent, B_DRIVER_BUS, &bus, false)) + if (pnp->get_attr_string(parent, B_DEVICE_BUS, &bus, false)) return B_ERROR; - if (strcmp(bus, "root")) { - free(bus); + if (strcmp(bus, "root")) return 0.0; - } - free(bus); return 1.0; } static status_t -isa_register_device(device_node_handle parent) +isa_register_device(device_node *parent) { static const device_attr attrs[] = { - // info about ourself - { B_DRIVER_MODULE, B_STRING_TYPE, { string: ISA_MODULE_NAME }}, - // unique connection - { PNP_DRIVER_CONNECTION, B_STRING_TYPE, { string: "ISA" }}, - - // mark as being a bus - { PNP_BUS_IS_BUS, B_UINT8_TYPE, { ui8: 1 }}, - // tell where to look for child devices - { B_DRIVER_BUS, B_STRING_TYPE, { string: "isa" }}, - { B_DRIVER_FIND_DEVICES_ON_DEMAND, B_UINT8_TYPE, { ui8: 1 }}, - { B_DRIVER_EXPLORE_LAST, B_UINT8_TYPE, { ui8: 1 }}, - { NULL } + {B_DEVICE_BUS, B_STRING_TYPE, {string: "isa" }}, + {B_DEVICE_FLAGS, B_UINT32_TYPE, + {ui32: B_FIND_CHILD_ON_DEMAND | B_FIND_MULTIPLE_CHILDREN}}, + {} }; - return pnp->register_device(parent, attrs, NULL, NULL); + return pnp->register_node(parent, ISA_MODULE_NAME, attrs, NULL, NULL); } -static void -isa_get_paths(const char ***_bus, const char ***_device) -{ - static const char *kBus[] = {"root", NULL}; - - *_bus = kBus; - *_device = NULL; -} -#endif - - static status_t std_ops(int32 op, ...) { @@ -185,27 +164,19 @@ &unlock_isa_dma_channel }; -#if 0 static isa2_module_info isa2_module = { { { - { - ISA_MODULE_NAME, - 0, - std_ops - }, - - isa_supports_device, - isa_register_device, - isa_init_driver, - isa_uninit_driver, - NULL, // removed device - NULL, // cleanup device - isa_get_paths, + ISA_MODULE_NAME, + 0, + std_ops }, - // as ISA relies on device drivers to detect their devices themselves, - // we don't have an universal rescan method + isa_supports_device, + isa_register_device, + isa_init_driver, + isa_uninit_driver, + NULL, // removed device NULL, // register child devices NULL, // rescan bus }, @@ -218,10 +189,9 @@ arch_start_isa_dma, }; -#endif module_info *modules[] = { (module_info *)&isa_module, -// (module_info *)&isa2_module, + (module_info *)&isa2_module, NULL }; Modified: haiku/trunk/src/system/kernel/device_manager/device_manager.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/device_manager.cpp 2008-06-03 09:13:04 UTC (rev 25778) +++ haiku/trunk/src/system/kernel/device_manager/device_manager.cpp 2008-06-03 13:22:24 UTC (rev 25779) @@ -136,6 +136,8 @@ device_node* FindChild(const device_attr* attributes) const; device_node* FindChild(const char* moduleName) const; + int32 Priority(); + void Dump(int32 level = 0); private: @@ -189,6 +191,7 @@ static device_node *sRootNode; static recursive_lock sLock; +static const char* sGenericContextPath; static uint32 sDriverUpdateCycle = 1; @@ -1260,7 +1263,22 @@ // we must not be destroyed as long as we have children Acquire(); node->fParent = this; - fChildren.Add(node); + + int32 priority = node->Priority(); + + // Enforce an order in which the children are traversed - from most + // specific to least specific child. + NodeList::Iterator iterator = fChildren.GetIterator(); + device_node* before = NULL; + while (iterator.HasNext()) { + device_node* child = iterator.Next(); + if (child->Priority() <= priority) { + before = child; + break; + } + } + + fChildren.Insert(before, node); } @@ -1411,11 +1429,16 @@ return B_NO_MEMORY; StackDeleter stackDeleter(stack); + + bool generic = false; uint16 type = 0; uint16 subType = 0; uint16 interface = 0; - get_attr_uint16(this, B_DEVICE_TYPE, &type, false); - get_attr_uint16(this, B_DEVICE_SUB_TYPE, &subType, false); + if (get_attr_uint16(this, B_DEVICE_TYPE, &type, false) != B_OK + || get_attr_uint16(this, B_DEVICE_SUB_TYPE, &subType, false) + != B_OK) + generic = true; + get_attr_uint16(this, B_DEVICE_INTERFACE, &interface, false); // TODO: maybe make this extendible via settings file? @@ -1475,8 +1498,19 @@ if (sRootNode == this) { _AddPath(*stack, "busses/pci"); _AddPath(*stack, "bus_managers"); - } else + } else if (!generic) { _AddPath(*stack, "drivers"); + } else { + // For generic drivers, we only allow busses when the + // request is more specified + if (sGenericContextPath != NULL + && (!strcmp(sGenericContextPath, "disk") + || !strcmp(sGenericContextPath, "ports") + || !strcmp(sGenericContextPath, "bus"))) { + _AddPath(*stack, "busses"); + } + _AddPath(*stack, "drivers", sGenericContextPath); + } break; } @@ -1758,13 +1792,17 @@ // This driver does not support types, but still wants to its // children explored on demand only. matches = true; + sGenericContextPath = devicePath; } if (matches) { fLastUpdateCycle = updateCycle; // This node will be probed in this update cycle - return _Probe(); + status = _Probe(); + + sGenericContextPath = NULL; + return status; } return B_OK; @@ -2005,6 +2043,19 @@ } +/*! This returns the priority or importance of this node. Nodes with higher + priority are registered/probed first. + Currently, only the B_FIND_MULITPLE_CHILDREN flag alters the priority; + it might make sense to be able to directly set the priority via an + attribute. +*/ +int32 +device_node::Priority() +{ + return (fFlags & B_FIND_MULTIPLE_CHILDREN) != 0 ? 0 : 100; +} + + void device_node::Dump(int32 level) { From axeld at mail.berlios.de Tue Jun 3 15:30:45 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 3 Jun 2008 15:30:45 +0200 Subject: [Haiku-commits] r25780 - haiku/trunk/src/system/kernel/device_manager Message-ID: <200806031330.m53DUjEE024251@sheep.berlios.de> Author: axeld Date: 2008-06-03 15:30:45 +0200 (Tue, 03 Jun 2008) New Revision: 25780 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25780&view=rev Modified: haiku/trunk/src/system/kernel/device_manager/device_manager.cpp Log: * Added a bit more debug output when enabled. Modified: haiku/trunk/src/system/kernel/device_manager/device_manager.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/device_manager.cpp 2008-06-03 13:22:24 UTC (rev 25779) +++ haiku/trunk/src/system/kernel/device_manager/device_manager.cpp 2008-06-03 13:30:45 UTC (rev 25780) @@ -1410,6 +1410,8 @@ if (status == B_OK) status = stack.Push(path); + TRACE((" add path: \"%s\", %ld\n", path->Path(), status)); + if (status != B_OK) delete path; From superstippi at gmx.de Tue Jun 3 16:12:43 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Tue, 03 Jun 2008 16:12:43 +0200 Subject: [Haiku-commits] r25762 - haiku/trunk/src/kits/interface In-Reply-To: <47430005181-BeMail@zon> References: <47430005181-BeMail@zon> Message-ID: <20080603141243.239490@gmx.net> -------- Original-Nachricht -------- > Datum: Mon, 02 Jun 2008 23:28:49 +0200 CEST > Von: "Axel D?rfler" > An: "SVN commits to the Haiku sourcerepository=?utf-8?q?" > Betreff: Re: [Haiku-commits] r25762 - haiku/trunk/src/kits/interface > stippi at BerliOS wrote: > > Log: > > Resolved TODO and set the flags for the kind of additional > > bitmap support (bitmaps support child views or BViews can > > draw them) > > Wasn't aware of this function - so we can just add a > B_BITMAP_SUPPORTS_OVERLAY there and that's it? Ah yeah, didn't even think of that, but yes! We could also add flags whether or not BBitmap can convert from/to the format (from B_RGBA32 as intermediate). Would be a nice, unintrucive way to extend existing API. Best regards, -Stephan From axeld at mail.berlios.de Tue Jun 3 16:31:47 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 3 Jun 2008 16:31:47 +0200 Subject: [Haiku-commits] r25781 - haiku/trunk/src/servers/app/drawing Message-ID: <200806031431.m53EVlXG005375@sheep.berlios.de> Author: axeld Date: 2008-06-03 16:31:47 +0200 (Tue, 03 Jun 2008) New Revision: 25781 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25781&view=rev Modified: haiku/trunk/src/servers/app/drawing/drawing_support.h Log: Minor cleanup. Modified: haiku/trunk/src/servers/app/drawing/drawing_support.h =================================================================== --- haiku/trunk/src/servers/app/drawing/drawing_support.h 2008-06-03 13:30:45 UTC (rev 25780) +++ haiku/trunk/src/servers/app/drawing/drawing_support.h 2008-06-03 14:31:47 UTC (rev 25781) @@ -5,8 +5,8 @@ * Authors: * Stephan A?mus */ -#ifndef SUPPORT_H -#define SUPPORT_H +#ifndef DRAWING_SUPPORT_H +#define DRAWING_SUPPORT_H #include @@ -42,7 +42,7 @@ dst += numBytesBegin - numBytes; src += numBytesBegin - numBytes; numBytesBegin = numBytes; - + uint32* d32 = (uint32*)dst; uint32* s32 = (uint32*)src; while (numBytes >= 4) { @@ -52,7 +52,7 @@ // update original pointers dst += numBytesBegin - numBytes; src += numBytesBegin - numBytes; - + while (numBytes > 0) { *dst++ = *src++; numBytes--; @@ -142,9 +142,6 @@ gfxcpy32(buffer, tempBuffer, pixels * 4); } -void -align_rect_to_pixels(BRect* rect); +void align_rect_to_pixels(BRect* rect); -#endif // SUPPORT_H - - +#endif // DRAWING_SUPPORT_H From axeld at mail.berlios.de Tue Jun 3 16:35:32 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 3 Jun 2008 16:35:32 +0200 Subject: [Haiku-commits] r25782 - haiku/trunk/src/servers/app Message-ID: <200806031435.m53EZWf3006155@sheep.berlios.de> Author: axeld Date: 2008-06-03 16:35:31 +0200 (Tue, 03 Jun 2008) New Revision: 25782 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25782&view=rev Modified: haiku/trunk/src/servers/app/Screen.cpp haiku/trunk/src/servers/app/Screen.h haiku/trunk/src/servers/app/VirtualScreen.cpp Log: * Renamed the "simple" mode setter Screen::SetMode() variant to SetBestMode(); it can also no longer create a default mode. * This SetBestMode() function now follows a similar logic than the boot loader, that is, only the width must not deviate, all other values are chosen as close to the original as possible. * VirtualScreen::AddScreen() now follows the same logic as the boot loader in case no configuration was found, and the current screen has no preferred mode (for example via EDID). That is, it will first try 1024x768, and then 800x600. * This means there is no mode change anymore when switching from the boot loader to the app_server in Qemu and VMware. Modified: haiku/trunk/src/servers/app/Screen.cpp =================================================================== --- haiku/trunk/src/servers/app/Screen.cpp 2008-06-03 14:31:47 UTC (rev 25781) +++ haiku/trunk/src/servers/app/Screen.cpp 2008-06-03 14:35:31 UTC (rev 25782) @@ -64,6 +64,9 @@ delete fHWInterface; } +/*! Finds the mode in the mode list that is closest to the mode specified. + As long as the mode list is not empty, this method will always succeed. +*/ status_t Screen::Initialize() @@ -120,35 +123,47 @@ status_t -Screen::SetMode(uint16 width, uint16 height, uint32 colorSpace, - float frequency, bool makeDefault) +Screen::SetBestMode(uint16 width, uint16 height, uint32 colorSpace, + float frequency) { // search for a matching mode - display_mode mode; - status_t status = _FindMode(width, height, colorSpace, frequency, &mode); + display_mode* modes = NULL; + uint32 count; + status_t status = fHWInterface->GetModeList(&modes, &count); if (status < B_OK) return status; + if (count <= 0) + return B_ERROR; - if (status >= B_OK) { - float modeFrequency = get_mode_frequency(mode); - display_mode originalMode = mode; - bool adjusted = false; + int32 index = _FindBestMode(modes, count, width, height, colorSpace, + frequency); + if (index < 0) { + debug_printf("Finding best mode failed"); + delete[] modes; + return B_ERROR; + } - if (modeFrequency != frequency) { - // adjust timing to fit the requested frequency if needed - // (taken from Screen preferences application) - mode.timing.pixel_clock = ((uint32)mode.timing.h_total - * mode.timing.v_total / 10 * int32(frequency * 10)) / 1000; - adjusted = true; - } + display_mode mode = modes[index]; + delete[] modes; - status = SetMode(mode, makeDefault); - if (status < B_OK) { - // try again with the unchanged mode - status = SetMode(originalMode, makeDefault); - } + float modeFrequency = get_mode_frequency(mode); + display_mode originalMode = mode; + bool adjusted = false; + + if (modeFrequency != frequency) { + // adjust timing to fit the requested frequency if needed + // (taken from Screen preferences application) + mode.timing.pixel_clock = ((uint32)mode.timing.h_total + * mode.timing.v_total / 10 * int32(frequency * 10)) / 1000; + adjusted = true; } + status = SetMode(mode, false); + if (status < B_OK && adjusted) { + // try again with the unchanged mode + status = SetMode(originalMode, false); + } + return status; } @@ -199,7 +214,7 @@ display_mode mode; fHWInterface->GetMode(&mode); - return BRect(0, 0, mode.virtual_width - 1, mode.virtual_height - 1); + return BRect(0, 0, mode.virtual_width - 1, mode.virtual_height - 1); } @@ -213,75 +228,32 @@ } -status_t -Screen::_FindMode(uint16 width, uint16 height, uint32 colorspace, - float frequency, display_mode* mode) const -{ - display_mode* modes = NULL; - uint32 count; - - status_t status = fHWInterface->GetModeList(&modes, &count); - if (status < B_OK || count <= 0) { - // We've run into quite a problem here! This is a function which is a requirement - // for a graphics module. The best thing that we can hope for is 640x480x8 without - // knowing anything else. While even this seems like insanity to assume that we - // can support this, the only lower mode supported is 640x400, but we shouldn't even - // bother with such a pathetic possibility. - if (width == 640 && height == 480 && colorspace == B_CMAP8) - return B_OK; - - return status; - } - - int32 index = _FindMode(modes, count, width, height, colorspace, frequency); - if (index < 0) { - fprintf(stderr, "mode not found (%d, %d, %f) -> using first mode from list!\n", - width, height, frequency); - // fallback to first mode from list - TODO: ?!? - // NOTE: count > 0 is checked above - *mode = modes[0]; - } else { - *mode = modes[index]; - } - - delete[] modes; - - return B_OK; -} - - -/*! - \brief Returns the mode that matches the given criteria. The frequency - doesn't have to match, though - the closest one found is used. +/*! \brief Returns the mode that matches the given criteria best. + The "width" argument is the only hard argument, the rest will be adapted + as needed. */ int32 -Screen::_FindMode(const display_mode* modes, uint32 count, - uint16 width, uint16 height, uint32 colorspace, - float frequency) const +Screen::_FindBestMode(const display_mode* modes, uint32 count, + uint16 width, uint16 height, uint32 colorSpace, float frequency) const { - // we always try to choose the mode with the closest frequency - float bestFrequencyDiff = 0.0f; - int32 index = -1; - + int32 bestDiff = 0; + int32 bestIndex = -1; for (uint32 i = 0; i < count; i++) { - if (modes[i].virtual_width == width - && modes[i].virtual_height == height - && modes[i].space == colorspace) { - // we have found a mode with the correct width, height and format - // now see if the frequency matches - float modeFrequency = get_mode_frequency(modes[i]); - float frequencyDiff = fabs(modeFrequency - frequency); + const display_mode& mode = modes[i]; + if (mode.virtual_width != width) + continue; - if (index == -1 || bestFrequencyDiff > frequencyDiff) { - index = i; - if (frequencyDiff == 0.0f) - break; + // compute some random equality score + // TODO: check if these scores make sense + int32 diff = 1000 * abs(mode.timing.v_display - height) + + int32(fabs(get_mode_frequency(mode) - frequency) * 10) + + 100 * abs(mode.space - colorSpace); - bestFrequencyDiff = frequencyDiff; - } + if (bestIndex == -1 || diff < bestDiff) { + bestDiff = diff; + bestIndex = i; } } - return index; + return bestIndex; } - Modified: haiku/trunk/src/servers/app/Screen.h =================================================================== --- haiku/trunk/src/servers/app/Screen.h 2008-06-03 14:31:47 UTC (rev 25781) +++ haiku/trunk/src/servers/app/Screen.h 2008-06-03 14:35:31 UTC (rev 25782) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2007, Haiku, Inc. + * Copyright (c) 2001-2008, Haiku, Inc. * Distributed under the terms of the MIT license. * * Authors: @@ -34,13 +34,12 @@ status_t SetMode(const display_mode& mode, bool makeDefault); status_t SetMode(uint16 width, uint16 height, - uint32 colorspace, float frequency, - bool makeDefault); - status_t SetMode(uint16 width, uint16 height, uint32 colorspace, const display_timing& timing, bool makeDefault); status_t SetPreferredMode(); + status_t SetBestMode(uint16 width, uint16 height, + uint32 colorspace, float frequency); void GetMode(display_mode* mode) const; void GetMode(uint16 &width, uint16 &height, @@ -56,11 +55,7 @@ { return fHWInterface; } private: - status_t _FindMode(uint16 width, uint16 height, - uint32 colorspace, float frequency, - display_mode* mode) const; - - int32 _FindMode(const display_mode* modeList, + int32 _FindBestMode(const display_mode* modeList, uint32 count, uint16 width, uint16 height, uint32 colorspace, float frequency) const; Modified: haiku/trunk/src/servers/app/VirtualScreen.cpp =================================================================== --- haiku/trunk/src/servers/app/VirtualScreen.cpp 2008-06-03 14:31:47 UTC (rev 25781) +++ haiku/trunk/src/servers/app/VirtualScreen.cpp 2008-06-03 14:35:31 UTC (rev 25782) @@ -156,8 +156,11 @@ } if (status < B_OK) { // TODO: more intelligent standard mode (monitor preference, desktop default, ...) - if (screen->SetPreferredMode() != B_OK) - screen->SetMode(800, 600, B_RGB32, 60.f, false); + status_t status = screen->SetPreferredMode(); + if (status != B_OK) + status = screen->SetBestMode(1024, 768, B_RGB32, 60.f); + if (status != B_OK) + screen->SetBestMode(800, 600, B_RGB32, 60.f); } // TODO: this works only for single screen configurations From bonefish at mail.berlios.de Tue Jun 3 17:04:10 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 3 Jun 2008 17:04:10 +0200 Subject: [Haiku-commits] r25783 - haiku/trunk/src/system/kernel/debug Message-ID: <200806031504.m53F4A6M009123@sheep.berlios.de> Author: bonefish Date: 2008-06-03 17:04:09 +0200 (Tue, 03 Jun 2008) New Revision: 25783 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25783&view=rev Modified: haiku/trunk/src/system/kernel/debug/debug.cpp Log: _user_debug_output() used kputs() and thus wouldn't print anything anymore. Modified: haiku/trunk/src/system/kernel/debug/debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug.cpp 2008-06-03 14:35:31 UTC (rev 25782) +++ haiku/trunk/src/system/kernel/debug/debug.cpp 2008-06-03 15:04:09 UTC (rev 25783) @@ -920,6 +920,7 @@ if (length >= OUTPUT_BUFFER_SIZE) length = OUTPUT_BUFFER_SIZE - 1; + // TODO: Code duplication! Cf. dprintf_args()! if (length > 1 && string[length - 1] == '\n' && strncmp(string, sLastOutputBuffer, length) == 0) { sMessageRepeatCount++; @@ -928,12 +929,16 @@ sMessageRepeatFirstTime = sMessageRepeatLastTime; } else { flush_pending_repeats(); - kputs(string); - // kputs() doesn't output to syslog (as it's only used - // from the kernel debugger elsewhere) + if (sSerialDebugEnabled) + arch_debug_serial_puts(string); if (sSyslogOutputEnabled) syslog_write(string, length); + if (sBlueScreenEnabled || sDebugScreenEnabled) + blue_screen_puts(string); + for (uint32 i = 0; sSerialDebugEnabled && i < kMaxDebuggerModules; i++) + if (sDebuggerModules[i] && sDebuggerModules[i]->debugger_puts) + sDebuggerModules[i]->debugger_puts(string, length); memcpy(sLastOutputBuffer, string, length); sLastOutputBuffer[length] = 0; From bonefish at mail.berlios.de Tue Jun 3 17:05:18 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 3 Jun 2008 17:05:18 +0200 Subject: [Haiku-commits] r25784 - haiku/trunk/src/system/runtime_loader Message-ID: <200806031505.m53F5I8m009248@sheep.berlios.de> Author: bonefish Date: 2008-06-03 17:05:16 +0200 (Tue, 03 Jun 2008) New Revision: 25784 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25784&view=rev Modified: haiku/trunk/src/system/runtime_loader/elf.cpp Log: Don't spam to the standard output when not finding a symbol. Modified: haiku/trunk/src/system/runtime_loader/elf.cpp =================================================================== --- haiku/trunk/src/system/runtime_loader/elf.cpp 2008-06-03 15:04:09 UTC (rev 25783) +++ haiku/trunk/src/system/runtime_loader/elf.cpp 2008-06-03 15:05:16 UTC (rev 25784) @@ -1078,20 +1078,23 @@ // it's undefined, must be outside this image, try the other images sym2 = find_undefined_symbol(rootImage, image, symname, &shimg); if (!sym2) { - printf("elf_resolve_symbol: could not resolve symbol '%s'\n", symname); + FATAL("elf_resolve_symbol: could not resolve symbol '%s'\n", + symname); return B_MISSING_SYMBOL; } // make sure they're the same type if (ELF32_ST_TYPE(sym->st_info) != STT_NOTYPE && ELF32_ST_TYPE(sym->st_info) != ELF32_ST_TYPE(sym2->st_info)) { - printf("elf_resolve_symbol: found symbol '%s' in shared image but wrong type\n", symname); + FATAL("elf_resolve_symbol: found symbol '%s' in shared image " + "but wrong type\n", symname); return B_MISSING_SYMBOL; } if (ELF32_ST_BIND(sym2->st_info) != STB_GLOBAL && ELF32_ST_BIND(sym2->st_info) != STB_WEAK) { - printf("elf_resolve_symbol: found symbol '%s' but not exported\n", symname); + FATAL("elf_resolve_symbol: found symbol '%s' but not " + "exported\n", symname); return B_MISSING_SYMBOL; } @@ -1104,7 +1107,7 @@ case SHN_COMMON: // ToDo: finish this - printf("elf_resolve_symbol: COMMON symbol, finish me!\n"); + FATAL("elf_resolve_symbol: COMMON symbol, finish me!\n"); return B_ERROR; //ERR_NOT_IMPLEMENTED_YET; default: From revol at free.fr Tue Jun 3 17:08:16 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Tue, 03 Jun 2008 17:08:16 +0200 CEST Subject: [Haiku-commits] r25762 - haiku/trunk/src/kits/interface In-Reply-To: <47430005181-BeMail@zon> Message-ID: <473118456-BeMail@laptop> > stippi at BerliOS wrote: > > Log: > > Resolved TODO and set the flags for the kind of additional > > bitmap support (bitmaps support child views or BViews can > > draw them) > > Wasn't aware of this function - so we can just add a > B_BITMAP_SUPPORTS_OVERLAY there and that's it? Hmm overlay support depends on the gfx card usually... So it should be tied to BScreen I think. Anyway most cards have a limited number (1 but sometimes 2 or 3) of available overlays, so apps should fall back in that case. Fran?ois. From anevilyak at gmail.com Tue Jun 3 17:13:02 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Tue, 3 Jun 2008 10:13:02 -0500 Subject: [Haiku-commits] r25762 - haiku/trunk/src/kits/interface In-Reply-To: <473118456-BeMail@laptop> References: <47430005181-BeMail@zon> <473118456-BeMail@laptop> Message-ID: On Tue, Jun 3, 2008 at 10:08 AM, Fran?ois Revol wrote: > Anyway most cards have a limited number (1 but sometimes 2 or 3) of > available overlays, so apps should fall back in that case. Really? I haven't heard of a card that had more than one BES, at least not in the consumer space. Happen to know one offhand? Or does double/triple buffer overlay count as multiple as well? Regards, Rene From bonefish at mail.berlios.de Tue Jun 3 17:13:34 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 3 Jun 2008 17:13:34 +0200 Subject: [Haiku-commits] r25785 - haiku/trunk/build/jam Message-ID: <200806031513.m53FDYem010238@sheep.berlios.de> Author: bonefish Date: 2008-06-03 17:13:33 +0200 (Tue, 03 Jun 2008) New Revision: 25785 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25785&view=rev Modified: haiku/trunk/build/jam/MainBuildRules Log: The Executable and Addon rules also use --no-undefined, now. Apparently -nostdlib disables that for executables although it should be enabled by default. Modified: haiku/trunk/build/jam/MainBuildRules =================================================================== --- haiku/trunk/build/jam/MainBuildRules 2008-06-03 15:05:16 UTC (rev 25784) +++ haiku/trunk/build/jam/MainBuildRules 2008-06-03 15:13:33 UTC (rev 25785) @@ -52,7 +52,7 @@ Main $(1) : $(2) ; LinkAgainst $(1) : $(3) ; LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ] - -Xlinker -soname=_APP_ ; + -Xlinker --no-undefined -Xlinker -soname=_APP_ ; # we link with -nostdlib and add the required libs manually, when building # for Haiku @@ -112,7 +112,8 @@ Main $(target) : $(sources) ; - local linkFlags = -Xlinker -soname=\"$(target:G=)\" ; + local linkFlags = -Xlinker --no-undefined + -Xlinker -soname=\"$(target:G=)\" ; if $(isExecutable) != true { linkFlags = -nostart $(linkFlags) ; } From axeld at mail.berlios.de Tue Jun 3 17:18:00 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 3 Jun 2008 17:18:00 +0200 Subject: [Haiku-commits] r25786 - in haiku/trunk: headers/private/graphics/vesa headers/private/kernel/boot src/add-ons/accelerants/vesa src/add-ons/kernel/drivers/graphics/vesa src/system/boot/platform/bios_ia32 src/system/kernel/debug Message-ID: <200806031518.m53FI0le010517@sheep.berlios.de> Author: axeld Date: 2008-06-03 17:17:59 +0200 (Tue, 03 Jun 2008) New Revision: 25786 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25786&view=rev Modified: haiku/trunk/headers/private/graphics/vesa/vesa_info.h haiku/trunk/headers/private/kernel/boot/kernel_args.h haiku/trunk/src/add-ons/accelerants/vesa/accelerant_protos.h haiku/trunk/src/add-ons/accelerants/vesa/hooks.cpp haiku/trunk/src/add-ons/accelerants/vesa/mode.cpp haiku/trunk/src/add-ons/kernel/drivers/graphics/vesa/Jamfile haiku/trunk/src/add-ons/kernel/drivers/graphics/vesa/vesa.cpp haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp haiku/trunk/src/system/kernel/debug/Jamfile haiku/trunk/src/system/kernel/debug/frame_buffer_console.cpp Log: * The boot loader now passes on its EDID info to the kernel, and that will be put into a boot_item in frame_buffer_console_init(). * The VESA driver now supports gettings the EDID information as well; this is necessary now, since the app_server no longer takes over the mode the boot loader had chosen. * Note, we might want to do this via vm86 instead in the future, and remove the kernel part again. Modified: haiku/trunk/headers/private/graphics/vesa/vesa_info.h =================================================================== --- haiku/trunk/headers/private/graphics/vesa/vesa_info.h 2008-06-03 15:13:33 UTC (rev 25785) +++ haiku/trunk/headers/private/graphics/vesa/vesa_info.h 2008-06-03 15:17:59 UTC (rev 25786) @@ -10,7 +10,10 @@ #include #include +#include + +#define VESA_EDID_BOOT_INFO "vesa_edid/v1" #define VESA_MODES_BOOT_INFO "vesa_modes/v1" struct vesa_mode { @@ -34,6 +37,9 @@ uint32 vesa_mode_offset; uint32 vesa_mode_count; + + edid1_info edid_info; + bool has_edid; }; //----------------- ioctl() interface ---------------- Modified: haiku/trunk/headers/private/kernel/boot/kernel_args.h =================================================================== --- haiku/trunk/headers/private/kernel/boot/kernel_args.h 2008-06-03 15:13:33 UTC (rev 25785) +++ haiku/trunk/headers/private/kernel/boot/kernel_args.h 2008-06-03 15:17:59 UTC (rev 25786) @@ -1,4 +1,4 @@ -/* +/* * Copyright 2002-2008, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. * @@ -73,6 +73,7 @@ void *vesa_modes; uint32 vesa_modes_size; + void *edid_info; void *debug_output; uint32 debug_size; Modified: haiku/trunk/src/add-ons/accelerants/vesa/accelerant_protos.h =================================================================== --- haiku/trunk/src/add-ons/accelerants/vesa/accelerant_protos.h 2008-06-03 15:13:33 UTC (rev 25785) +++ haiku/trunk/src/add-ons/accelerants/vesa/accelerant_protos.h 2008-06-03 15:17:59 UTC (rev 25786) @@ -1,5 +1,5 @@ /* - * Copyright 2005, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2005-2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _ACCELERANT_PROTOS_H @@ -26,14 +26,18 @@ // modes & constraints uint32 vesa_accelerant_mode_count(void); status_t vesa_get_mode_list(display_mode *dm); -status_t vesa_propose_display_mode(display_mode *target, const display_mode *low, const display_mode *high); +status_t vesa_propose_display_mode(display_mode *target, + const display_mode *low, const display_mode *high); status_t vesa_set_display_mode(display_mode *mode_to_set); status_t vesa_get_display_mode(display_mode *current_mode); +status_t vesa_get_edid_info(void *info, size_t size, uint32 *_version); status_t vesa_get_frame_buffer_config(frame_buffer_config *config); -status_t vesa_get_pixel_clock_limits(display_mode *dm, uint32 *low, uint32 *high); +status_t vesa_get_pixel_clock_limits(display_mode *dm, uint32 *low, + uint32 *high); status_t vesa_move_display(uint16 h_display_start, uint16 v_display_start); status_t vesa_get_timing_constraints(display_timing_constraints *dtc); -void vesa_set_indexed_colors(uint count, uint8 first, uint8 *color_data, uint32 flags); +void vesa_set_indexed_colors(uint count, uint8 first, uint8 *color_data, + uint32 flags); // DPMS uint32 vesa_dpms_capabilities(void); @@ -41,34 +45,42 @@ status_t vesa_set_dpms_mode(uint32 dpms_flags); // cursor -status_t vesa_set_cursor_shape(uint16 width, uint16 height, uint16 hot_x, uint16 hot_y, uint8 *andMask, uint8 *xorMask); +status_t vesa_set_cursor_shape(uint16 width, uint16 height, uint16 hot_x, + uint16 hot_y, uint8 *andMask, uint8 *xorMask); void vesa_move_cursor(uint16 x, uint16 y); void vesa_show_cursor(bool is_visible); // accelerant engine uint32 vesa_accelerant_engine_count(void); -status_t vesa_acquire_engine(uint32 capabilities, uint32 max_wait, sync_token *st, engine_token **et); +status_t vesa_acquire_engine(uint32 capabilities, uint32 max_wait, + sync_token *st, engine_token **et); status_t vesa_release_engine(engine_token *et, sync_token *st); void vesa_wait_engine_idle(void); status_t vesa_get_sync_token(engine_token *et, sync_token *st); status_t vesa_sync_to_token(sync_token *st); // 2D acceleration -void vesa_screen_to_screen_blit(engine_token *et, blit_params *list, uint32 count); -void vesa_fill_rectangle(engine_token *et, uint32 color, fill_rect_params *list, uint32 count); -void vesa_invert_rectangle(engine_token *et, fill_rect_params *list, uint32 count); +void vesa_screen_to_screen_blit(engine_token *et, blit_params *list, + uint32 count); +void vesa_fill_rectangle(engine_token *et, uint32 color, fill_rect_params *list, + uint32 count); +void vesa_invert_rectangle(engine_token *et, fill_rect_params *list, + uint32 count); void vesa_fill_span(engine_token *et, uint32 color, uint16 *list, uint32 count); // overlay uint32 vesa_overlay_count(const display_mode *dm); const uint32 *vesa_overlay_supported_spaces(const display_mode *dm); uint32 vesa_overlay_supported_features(uint32 a_color_space); -const overlay_buffer *vesa_allocate_overlay_buffer(color_space cs, uint16 width, uint16 height); +const overlay_buffer *vesa_allocate_overlay_buffer(color_space cs, uint16 width, + uint16 height); status_t vesa_release_overlay_buffer(const overlay_buffer *ob); -status_t vesa_get_overlay_constraints(const display_mode *dm, const overlay_buffer *ob, overlay_constraints *oc); +status_t vesa_get_overlay_constraints(const display_mode *dm, + const overlay_buffer *ob, overlay_constraints *oc); overlay_token vesa_allocate_overlay(void); status_t vesa_release_overlay(overlay_token ot); -status_t vesa_configure_overlay(overlay_token ot, const overlay_buffer *ob, const overlay_window *ow, const overlay_view *ov); +status_t vesa_configure_overlay(overlay_token ot, const overlay_buffer *ob, + const overlay_window *ow, const overlay_view *ov); #ifdef __cplusplus } Modified: haiku/trunk/src/add-ons/accelerants/vesa/hooks.cpp =================================================================== --- haiku/trunk/src/add-ons/accelerants/vesa/hooks.cpp 2008-06-03 15:13:33 UTC (rev 25785) +++ haiku/trunk/src/add-ons/accelerants/vesa/hooks.cpp 2008-06-03 15:17:59 UTC (rev 25786) @@ -1,5 +1,5 @@ /* - * Copyright 2005, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2005-2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -16,13 +16,13 @@ } -void +void vesa_move_cursor(uint16 x, uint16 y) { } -void +void vesa_show_cursor(bool is_visible) { } @@ -59,6 +59,8 @@ return (void*)vesa_set_display_mode; case B_GET_DISPLAY_MODE: return (void*)vesa_get_display_mode; + case B_GET_EDID_INFO: + return (void*)vesa_get_edid_info; case B_GET_FRAME_BUFFER_CONFIG: return (void*)vesa_get_frame_buffer_config; case B_GET_PIXEL_CLOCK_LIMITS: Modified: haiku/trunk/src/add-ons/accelerants/vesa/mode.cpp =================================================================== --- haiku/trunk/src/add-ons/accelerants/vesa/mode.cpp 2008-06-03 15:13:33 UTC (rev 25785) +++ haiku/trunk/src/add-ons/accelerants/vesa/mode.cpp 2008-06-03 15:17:59 UTC (rev 25786) @@ -112,7 +112,7 @@ TRACE(("vesa_propose_display_mode()\n")); // just search for the specified mode in the list - + for (uint32 i = 0; i < gInfo->shared_info->mode_count; i++) { display_mode *current = &gInfo->mode_list[i]; @@ -162,6 +162,22 @@ status_t +vesa_get_edid_info(void *info, size_t size, uint32 *_version) +{ + TRACE(("intel_get_edid_info()\n")); + + if (!gInfo->shared_info->has_edid) + return B_ERROR; + if (size < sizeof(struct edid1_info)) + return B_BUFFER_OVERFLOW; + + memcpy(info, &gInfo->shared_info->edid_info, sizeof(struct edid1_info)); + *_version = EDID_VERSION_1; + return B_OK; +} + + +status_t vesa_get_frame_buffer_config(frame_buffer_config *config) { TRACE(("vesa_get_frame_buffer_config()\n")); @@ -185,7 +201,7 @@ /* lower limit of about 48Hz vertical refresh */ *low = (total_pix * 48L) / 1000L; - if (*low > clock_limit) + if (*low > clock_limit) return B_ERROR; *high = clock_limit; Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/vesa/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/vesa/Jamfile 2008-06-03 15:13:33 UTC (rev 25785) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/vesa/Jamfile 2008-06-03 15:17:59 UTC (rev 25786) @@ -1,5 +1,6 @@ SubDir HAIKU_TOP src add-ons kernel drivers graphics vesa ; +UsePrivateHeaders kernel graphics [ FDirName graphics common ] ; UsePrivateHeaders kernel graphics [ FDirName graphics vesa ] ; KernelAddon vesa : Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/vesa/vesa.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/vesa/vesa.cpp 2008-06-03 15:13:33 UTC (rev 25785) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/vesa/vesa.cpp 2008-06-03 15:17:59 UTC (rev 25786) @@ -138,6 +138,14 @@ bufferInfo->depth); sharedInfo.bytes_per_row = bufferInfo->bytes_per_row; + // TODO: we might want to do this via vm86 instead + edid1_info *edidInfo = (edid1_info *)get_boot_item(VESA_EDID_BOOT_INFO, + NULL); + if (edidInfo != NULL) { + sharedInfo.has_edid = true; + memcpy(&sharedInfo.edid_info, edidInfo, sizeof(edid1_info)); + } + physical_entry mapping; get_memory_map((void *)sharedInfo.frame_buffer, B_PAGE_SIZE, &mapping, 1); Modified: haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp 2008-06-03 15:13:33 UTC (rev 25785) +++ haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp 2008-06-03 15:17:59 UTC (rev 25786) @@ -29,7 +29,7 @@ #include -//#define TRACE_VIDEO +#define TRACE_VIDEO #ifdef TRACE_VIDEO # define TRACE(x) dprintf x #else @@ -1030,6 +1030,10 @@ // We found a new default mode to use! sDefaultMode = defaultMode; } + + gKernelArgs.edid_info = kernel_args_malloc(sizeof(edid1_info)); + if (gKernelArgs.edid_info != NULL) + memcpy(gKernelArgs.edid_info, &info, sizeof(edid1_info)); } sMode = sDefaultMode; Modified: haiku/trunk/src/system/kernel/debug/Jamfile =================================================================== --- haiku/trunk/src/system/kernel/debug/Jamfile 2008-06-03 15:13:33 UTC (rev 25785) +++ haiku/trunk/src/system/kernel/debug/Jamfile 2008-06-03 15:17:59 UTC (rev 25786) @@ -1,6 +1,7 @@ SubDir HAIKU_TOP src system kernel debug ; UsePrivateHeaders [ FDirName kernel debug ] syslog_daemon ; +UsePrivateHeaders [ FDirName graphics common ] ; UsePrivateHeaders [ FDirName graphics vesa ] ; KernelMergeObject kernel_debug.o : Modified: haiku/trunk/src/system/kernel/debug/frame_buffer_console.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/frame_buffer_console.cpp 2008-06-03 15:13:33 UTC (rev 25785) +++ haiku/trunk/src/system/kernel/debug/frame_buffer_console.cpp 2008-06-03 15:17:59 UTC (rev 25786) @@ -4,6 +4,13 @@ */ +#include + +#include +#include +#include +#include + #include #include #include @@ -13,15 +20,11 @@ #include #include -#include +#include + #include "font.h" -#include -#include -#include -#include - //#define TRACE_FB_CONSOLE #ifdef TRACE_FB_CONSOLE # define TRACE(x) dprintf x @@ -56,11 +59,11 @@ }; static uint16 sPalette15[] = { // 0bbbbbgggggrrrrr (5-5-5) - 0x7fff, 0x001f, 0x03e0, 0x03ff, 0x7c00, 0x7c1f, 0x7fe0, 0x0000, + 0x7fff, 0x001f, 0x03e0, 0x03ff, 0x7c00, 0x7c1f, 0x7fe0, 0x0000, }; static uint16 sPalette16[] = { // bbbbbggggggrrrrr (5-6-5) - 0xffff, 0x001f, 0x07e0, 0x07ff, 0xf800, 0xf81f, 0xffe0, 0x0000, + 0xffff, 0x001f, 0x07e0, 0x07ff, 0xf800, 0xf81f, 0xffe0, 0x0000, }; static uint32 sPalette32[] = { // is also used by 24 bit modes @@ -119,7 +122,7 @@ uint8 bits = FONT[CHAR_HEIGHT * glyph + y]; for (x = 0; x < CHAR_WIDTH; x++) { for (int32 i = 0; i < sConsole.bytes_per_pixel; i++) { - if (bits & 1) + if (bits & 1) base[x * sConsole.bytes_per_pixel + i] = color[i]; else base[x * sConsole.bytes_per_pixel + i] = backgroundColor[i]; @@ -206,7 +209,7 @@ draw_cursor(sConsole.cursor_x, sConsole.cursor_y); draw_cursor(x, y); - + sConsole.cursor_x = x; sConsole.cursor_y = y; } @@ -425,6 +428,14 @@ add_boot_item(VESA_MODES_BOOT_INFO, sVesaModes, args->vesa_modes_size); } + if (args->edid_info != NULL) { + edid1_info *info = (edid1_info *)malloc(sizeof(edid1_info)); + if (info != NULL) { + memcpy(info, args->edid_info, sizeof(edid1_info)); + add_boot_item(VESA_EDID_BOOT_INFO, info, sizeof(edid1_info)); + } + } + return B_OK; } From bonefish at mail.berlios.de Tue Jun 3 17:29:11 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 3 Jun 2008 17:29:11 +0200 Subject: [Haiku-commits] r25787 - haiku/trunk/src/apps/terminal Message-ID: <200806031529.m53FTBbN012218@sheep.berlios.de> Author: bonefish Date: 2008-06-03 17:29:10 +0200 (Tue, 03 Jun 2008) New Revision: 25787 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25787&view=rev Added: haiku/trunk/src/apps/terminal/TerminalBuffer.cpp haiku/trunk/src/apps/terminal/TerminalBuffer.h Modified: haiku/trunk/src/apps/terminal/Jamfile haiku/trunk/src/apps/terminal/Shell.cpp haiku/trunk/src/apps/terminal/Shell.h haiku/trunk/src/apps/terminal/TermParse.cpp haiku/trunk/src/apps/terminal/TermParse.h haiku/trunk/src/apps/terminal/TermView.h Log: Pulled the TermView interface used by TermParse into a new interface class TerminalBuffer, which will evolve into a TermBuffer replacement and decouple the parse thread from the window. Modified: haiku/trunk/src/apps/terminal/Jamfile =================================================================== --- haiku/trunk/src/apps/terminal/Jamfile 2008-06-03 15:17:59 UTC (rev 25786) +++ haiku/trunk/src/apps/terminal/Jamfile 2008-06-03 15:29:10 UTC (rev 25787) @@ -20,6 +20,7 @@ SmartTabView.cpp TermApp.cpp TermBuffer.cpp + TerminalBuffer.cpp TermParse.cpp TermView.cpp TermWindow.cpp @@ -29,4 +30,4 @@ VTPrsTbl.c : be game tracker textencoding : Terminal.rdef Terminal.icons.rdef - ; +; Modified: haiku/trunk/src/apps/terminal/Shell.cpp =================================================================== --- haiku/trunk/src/apps/terminal/Shell.cpp 2008-06-03 15:17:59 UTC (rev 25786) +++ haiku/trunk/src/apps/terminal/Shell.cpp 2008-06-03 15:29:10 UTC (rev 25787) @@ -10,11 +10,6 @@ #include "Shell.h" -#include "TermConst.h" -#include "TermParse.h" - -#include - #include #include #include @@ -31,7 +26,14 @@ #include #include +#include +#include "TermConst.h" +#include "TermParse.h" +#include "TermView.h" + // TODO: Fix dependency! + + #ifndef CEOF #define CEOF ('D'&037) #endif @@ -225,6 +227,7 @@ } +// TODO: Fix this dependency! void Shell::ViewAttached(TermView *view) { Modified: haiku/trunk/src/apps/terminal/Shell.h =================================================================== --- haiku/trunk/src/apps/terminal/Shell.h 2008-06-03 15:17:59 UTC (rev 25786) +++ haiku/trunk/src/apps/terminal/Shell.h 2008-06-03 15:29:10 UTC (rev 25787) @@ -18,6 +18,7 @@ // TODO: Maybe merge TermParse and Shell classes ? class TermParse; class TermView; + class Shell { public: Shell(); Modified: haiku/trunk/src/apps/terminal/TermParse.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-03 15:17:59 UTC (rev 25786) +++ haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-03 15:29:10 UTC (rev 25787) @@ -6,11 +6,6 @@ */ #include "TermParse.h" -#include "CodeConv.h" -#include "TermConst.h" -#include "TermView.h" -#include "VTparse.h" - #include #include #include @@ -20,7 +15,12 @@ #include #include +#include "CodeConv.h" +#include "TermConst.h" +#include "TerminalBuffer.h" +#include "VTparse.h" + ////////////////////////////////////////////////////////////////////////////// // EscParse ... Escape sequence parse and character encoding. // @@ -56,7 +56,7 @@ fReaderLocker(-1), fBufferPosition(0), fLockFlag(0), - fView(NULL), + fBuffer(NULL), fQuitting(true) { } @@ -69,24 +69,24 @@ status_t -TermParse::StartThreads(TermView *view) +TermParse::StartThreads(TerminalBuffer *buffer) { - if (fView != NULL) + if (fBuffer != NULL) return B_ERROR; fQuitting = false; - fView = view; + fBuffer = buffer; status_t status = InitPtyReader(); if (status < B_OK) { - fView = NULL; + fBuffer = NULL; return status; } status = InitTermParse(); if (status < B_OK) { StopPtyReader(); - fView = NULL; + fBuffer = NULL; return status; } @@ -97,7 +97,7 @@ status_t TermParse::StopThreads() { - if (fView == NULL) + if (fBuffer == NULL) return B_ERROR; fQuitting = true; @@ -105,7 +105,7 @@ StopPtyReader(); StopTermParse(); - fView = NULL; + fBuffer = NULL; return B_OK; } @@ -121,11 +121,11 @@ } while (status == B_INTERRUPTED); if (status == B_TIMED_OUT) { - fView->ScrollAtCursor(); - fView->UpdateLine(); + fBuffer->ScrollAtCursor(); + fBuffer->UpdateLine(); // Reset cursor blinking time and turn on cursor blinking. - fView->SetCurDraw(true); + fBuffer->SetCurDraw(true); // wait new input from pty. do { @@ -146,7 +146,7 @@ release_sem(fReaderLocker); } - fView->SetCurDraw(false); + fBuffer->SetCurDraw(false); return B_OK; } @@ -256,7 +256,7 @@ uchar buf[READ_BUF_SIZE]; int nread = read(fFd, buf, READ_BUF_SIZE - (read_p - fBufferPosition)); if (nread <= 0) { - fView->NotifyQuit(errno); + fBuffer->NotifyQuit(errno); return B_OK; } @@ -348,11 +348,11 @@ //DumpState(groundtable, parsestate, c); - if (now_coding != fView->Encoding()) { + if (now_coding != fBuffer->Encoding()) { /* * Change coding, change parse table. */ - switch (fView->Encoding()) { + switch (fBuffer->Encoding()) { case B_ISO1_CONVERSION: case B_ISO2_CONVERSION: case B_ISO3_CONVERSION: @@ -379,14 +379,14 @@ break; } parsestate = groundtable; - now_coding = fView->Encoding(); + now_coding = fBuffer->Encoding(); } switch (parsestate[c]) { case CASE_PRINT: cbuf[0] = c; cbuf[1] = '\0'; - fView->Insert(cbuf, attr); + fBuffer->Insert(cbuf, attr); break; case CASE_PRINT_GR: @@ -427,7 +427,7 @@ else CodeConv::ConvertToInternal((char*)cbuf, -1, (char*)dstbuf, B_EUC_CONVERSION); - fView->Insert(dstbuf, attr); + fBuffer->Insert(dstbuf, attr); break; case CASE_PRINT_CS96: @@ -436,22 +436,22 @@ cbuf[1] |= 0x80; cbuf[2] = 0; CodeConv::ConvertToInternal((char*)cbuf, 2, (char*)dstbuf, B_EUC_CONVERSION); - fView->Insert(dstbuf, attr); + fBuffer->Insert(dstbuf, attr); break; case CASE_LF: - fView->InsertLF(); + fBuffer->InsertLF(); break; case CASE_CR: - fView->InsertCR(); + fBuffer->InsertCR(); break; case CASE_SJIS_KANA: cbuf[0] = (uchar)c; cbuf[1] = '\0'; CodeConv::ConvertToInternal((char*)cbuf, 1, (char*)dstbuf, now_coding); - fView->Insert(dstbuf, attr); + fBuffer->Insert(dstbuf, attr); break; case CASE_SJIS_INSTRING: @@ -459,7 +459,7 @@ GetReaderBuf(cbuf[1]); cbuf[2] = '\0'; CodeConv::ConvertToInternal((char*)cbuf, 2, (char*)dstbuf, now_coding); - fView->Insert(dstbuf, attr); + fBuffer->Insert(dstbuf, attr); break; case CASE_UTF8_2BYTE: @@ -470,7 +470,7 @@ cbuf[1] = (uchar)c; cbuf[2] = '\0'; - fView->Insert(cbuf, attr); + fBuffer->Insert(cbuf, attr); break; case CASE_UTF8_3BYTE: @@ -485,7 +485,7 @@ break; cbuf[2] = c; cbuf[3] = '\0'; - fView->Insert(cbuf, attr); + fBuffer->Insert(cbuf, attr); break; case CASE_MBCS: @@ -517,13 +517,13 @@ break; case CASE_BS: - fView->MoveCurLeft(1); + fBuffer->MoveCurLeft(1); break; case CASE_TAB: - tmp = fView->GetCurX(); + tmp = fBuffer->GetCurX(); tmp %= 8; - fView->MoveCurRight(8 - tmp); + fBuffer->MoveCurRight(8 - tmp); break; case CASE_ESC: @@ -583,7 +583,7 @@ /* ICH */ if ((row = param[0]) < 1) row = 1; - fView->InsertSpace(row); + fBuffer->InsertSpace(row); parsestate = groundtable; break; @@ -591,7 +591,7 @@ /* CUU */ if ((row = param[0]) < 1) row = 1; - fView->MoveCurUp(row); + fBuffer->MoveCurUp(row); parsestate = groundtable; break; @@ -599,7 +599,7 @@ /* CUD */ if ((row = param[0]) < 1) row = 1; - fView->MoveCurDown(row); + fBuffer->MoveCurDown(row); parsestate = groundtable; break; @@ -607,7 +607,7 @@ /* CUF */ if ((row = param[0]) < 1) row = 1; - fView->MoveCurRight(row); + fBuffer->MoveCurRight(row); parsestate = groundtable; break; @@ -615,7 +615,7 @@ /* CUB */ if ((row = param[0]) < 1) row = 1; - fView->MoveCurLeft(row); + fBuffer->MoveCurLeft(row); parsestate = groundtable; break; @@ -626,7 +626,7 @@ if (nparam < 2 || (col = param[1]) < 1) col = 1; - fView->SetCurPos(col - 1, row - 1 ); + fBuffer->SetCurPos(col - 1, row - 1 ); parsestate = groundtable; break; @@ -635,15 +635,15 @@ switch (param[0]) { case DEFAULT: case 0: - fView->EraseBelow(); + fBuffer->EraseBelow(); break; case 1: break; case 2: - fView->SetCurPos(0, 0); - fView->EraseBelow(); + fBuffer->SetCurPos(0, 0); + fBuffer->EraseBelow(); break; } parsestate = groundtable; @@ -651,7 +651,7 @@ case CASE_EL: // delete line /* EL */ - fView->DeleteColumns(); + fBuffer->DeleteColumns(); parsestate = groundtable; break; @@ -659,7 +659,7 @@ /* IL */ if ((row = param[0]) < 1) row = 1; - fView->InsertNewLine(row); + fBuffer->InsertNewLine(row); parsestate = groundtable; break; @@ -667,7 +667,7 @@ /* DL */ if ((row = param[0]) < 1) row = 1; - fView->DeleteLine(row); + fBuffer->DeleteLine(row); parsestate = groundtable; break; @@ -675,19 +675,19 @@ /* DCH */ if ((row = param[0]) < 1) row = 1; - fView->DeleteChar(row); + fBuffer->DeleteChar(row); parsestate = groundtable; break; case CASE_SET: /* SET */ - fView->SetInsertMode(MODE_INSERT); + fBuffer->SetInsertMode(MODE_INSERT); parsestate = groundtable; break; case CASE_RST: /* RST */ - fView->SetInsertMode(MODE_OVER); + fBuffer->SetInsertMode(MODE_OVER); parsestate = groundtable; break; @@ -766,7 +766,7 @@ case CASE_CPR: // Q & D hack by Y.Hayakawa (hida at sawada.riec.tohoku.ac.jp) // 21-JUL-99 - fView->DeviceStatusReport(param[0]); + fBuffer->DeviceStatusReport(param[0]); parsestate = groundtable; break; @@ -785,7 +785,7 @@ bot--; if (bot > top) - fView->SetScrollRegion(top, bot); + fBuffer->SetScrollRegion(top, bot); parsestate = groundtable; break; @@ -822,13 +822,13 @@ case CASE_DECSC: /* DECSC */ - fView->SaveCursor(); + fBuffer->SaveCursor(); parsestate = groundtable; break; case CASE_DECRC: /* DECRC */ - fView->RestoreCursor(); + fBuffer->RestoreCursor(); parsestate = groundtable; break; @@ -840,7 +840,7 @@ case CASE_RI: /* RI */ - fView->ScrollRegion(-1, -1, SCRDOWN, 1); + fBuffer->ScrollRegion(-1, -1, SCRDOWN, 1); parsestate = groundtable; break; @@ -890,7 +890,7 @@ switch (mode_char) { case '0': case '2': - fView->SetTitle(string); + fBuffer->SetTitle(string); break; case '1': break; @@ -939,7 +939,7 @@ row = 1; // note beterm wants it 1-based unlike usual terminals - fView->SetCurY(row - 1); + fBuffer->SetCurY(row - 1); parsestate = groundtable; break; @@ -949,7 +949,7 @@ col = 1; // note beterm wants it 1-based unlike usual terminals - fView->SetCurX(col - 1); + fBuffer->SetCurX(col - 1); parsestate = groundtable; break; Modified: haiku/trunk/src/apps/terminal/TermParse.h =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.h 2008-06-03 15:17:59 UTC (rev 25786) +++ haiku/trunk/src/apps/terminal/TermParse.h 2008-06-03 15:29:10 UTC (rev 25787) @@ -40,13 +40,14 @@ //PtyReader buffer size. #define READ_BUF_SIZE 2048 -class TermView; +class TerminalBuffer; + class TermParse : public BHandler { public: TermParse(int fd); ~TermParse(); - status_t StartThreads(TermView *view); + status_t StartThreads(TerminalBuffer *view); status_t StopThreads(); private: @@ -80,7 +81,7 @@ int fLockFlag; - TermView *fView; + TerminalBuffer *fBuffer; bool fQuitting; }; Modified: haiku/trunk/src/apps/terminal/TermView.h =================================================================== --- haiku/trunk/src/apps/terminal/TermView.h 2008-06-03 15:17:59 UTC (rev 25786) +++ haiku/trunk/src/apps/terminal/TermView.h 2008-06-03 15:29:10 UTC (rev 25787) @@ -12,21 +12,22 @@ #ifndef TERMVIEW_H #define TERMVIEW_H - -#include "CurPos.h" - #include #include #include +#include "CurPos.h" +#include "TerminalBuffer.h" + class BClipboard; class BMessageRunner; class BScrollBar; class BString; class Shell; class TermBuffer; -class TermView : public BView { + +class TermView : public BView, public TerminalBuffer { public: TermView(BRect frame, int32 argc, const char **argv, int32 historySize = 1000); TermView(int rows, int columns, int32 argc, const char **argv, int32 historySize = 1000); Added: haiku/trunk/src/apps/terminal/TerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TerminalBuffer.cpp 2008-06-03 15:17:59 UTC (rev 25786) +++ haiku/trunk/src/apps/terminal/TerminalBuffer.cpp 2008-06-03 15:29:10 UTC (rev 25787) @@ -0,0 +1,16 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ + +#include "TerminalBuffer.h" + + +TerminalBuffer::TerminalBuffer() +{ +} + + +TerminalBuffer::~TerminalBuffer() +{ +} Added: haiku/trunk/src/apps/terminal/TerminalBuffer.h =================================================================== --- haiku/trunk/src/apps/terminal/TerminalBuffer.h 2008-06-03 15:17:59 UTC (rev 25786) +++ haiku/trunk/src/apps/terminal/TerminalBuffer.h 2008-06-03 15:29:10 UTC (rev 25787) @@ -0,0 +1,63 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef TERMINAL_BUFFER_H +#define TERMINAL_BUFFER_H + +#include + + +class TerminalBuffer { +public: + TerminalBuffer(); + virtual ~TerminalBuffer(); + + virtual int Encoding() const = 0; + + // Output Character + virtual void Insert(uchar* string, ushort attr) = 0; + virtual void InsertCR() = 0; + virtual void InsertLF() = 0; + virtual void InsertNewLine(int num) = 0; + virtual void SetInsertMode(int flag) = 0; + virtual void InsertSpace(int num) = 0; + + // Delete Character + virtual void EraseBelow() = 0; + virtual void DeleteChar(int num) = 0; + virtual void DeleteColumns() = 0; + virtual void DeleteLine(int num) = 0; + + // Get and Set Cursor position + virtual void SetCurPos(int x, int y) = 0; + virtual void SetCurX(int x) = 0; + virtual void SetCurY(int y) = 0; + virtual int GetCurX() = 0; + virtual void SaveCursor() = 0; + virtual void RestoreCursor() = 0; + + // Move Cursor + virtual void MoveCurRight(int num) = 0; + virtual void MoveCurLeft(int num) = 0; + virtual void MoveCurUp(int num) = 0; + virtual void MoveCurDown(int num) = 0; + + // Cursor setting + virtual void SetCurDraw(bool flag) = 0; + + // Scroll region + virtual void ScrollRegion(int top, int bot, int dir, + int num) = 0; + virtual void SetScrollRegion(int top, int bot) = 0; + virtual void ScrollAtCursor() = 0; + + // Other + virtual void DeviceStatusReport(int) = 0; + virtual void UpdateLine() = 0; + + virtual void SetTitle(const char* title) = 0; + virtual void NotifyQuit(int32 reason) = 0; +}; + +#endif // TERMINAL_BUFFER_H From axeld at pinc-software.de Tue Jun 3 17:34:33 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 03 Jun 2008 17:34:33 +0200 CEST Subject: [Haiku-commits] r25762 - haiku/trunk/src/kits/interface In-Reply-To: <473118456-BeMail@laptop> Message-ID: <31302405687-BeMail@zon> "Fran?ois Revol" wrote: > > stippi at BerliOS wrote: > > > Log: > > > Resolved TODO and set the flags for the kind of additional > > > bitmap support (bitmaps support child views or BViews can > > > draw them) > > Wasn't aware of this function - so we can just add a > > B_BITMAP_SUPPORTS_OVERLAY there and that's it? > Hmm overlay support depends on the gfx card usually... > So it should be tied to BScreen I think. In the Be API, overlay support is completely implemented by BBitmap. There is not a single overlay related function in BScreen. > Anyway most cards have a limited number (1 but sometimes 2 or 3) of > available overlays, so apps should fall back in that case. This has nothing to do with the general capability of using the overlay with a certain color space. Bye, Axel. From revol at free.fr Tue Jun 3 17:36:28 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Tue, 03 Jun 2008 17:36:28 +0200 CEST Subject: [Haiku-commits] r25785 - haiku/trunk/build/jam In-Reply-To: <200806031513.m53FDYem010238@sheep.berlios.de> Message-ID: <1199766362-BeMail@laptop> > Author: bonefish > Date: 2008-06-03 17:13:33 +0200 (Tue, 03 Jun 2008) > New Revision: 25785 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25785&view=rev > > Modified: > haiku/trunk/build/jam/MainBuildRules > Log: > The Executable and Addon rules also use --no-undefined, now. > Apparently > -nostdlib disables that for executables although it should be enabled > by > default. Hmm is that for all platforms ? Sometimes when building things for R5 (with specifically an R5 devkit for zeta) it fails as the old gcc doesn't handle that option... Fran?ois. From revol at free.fr Tue Jun 3 17:40:26 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Tue, 03 Jun 2008 17:40:26 +0200 CEST Subject: [Haiku-commits] r25762 - haiku/trunk/src/kits/interface In-Reply-To: <31302405687-BeMail@zon> Message-ID: <1437451805-BeMail@laptop> > "Fran?ois Revol" wrote: > > > stippi at BerliOS wrote: > > > > Log: > > > > Resolved TODO and set the flags for the kind of additional > > > > bitmap support (bitmaps support child views or BViews can > > > > draw them) > > > Wasn't aware of this function - so we can just add a > > > B_BITMAP_SUPPORTS_OVERLAY there and that's it? > > Hmm overlay support depends on the gfx card usually... > > So it should be tied to BScreen I think. > > In the Be API, overlay support is completely implemented by BBitmap. Indeed. > There is not a single overlay related function in BScreen. Yes but it's the most logical place for it. > > > Anyway most cards have a limited number (1 but sometimes 2 or 3) of > > available overlays, so apps should fall back in that case. > > This has nothing to do with the general capability of using the > overlay > with a certain color space. Well unless you mean being able to convert to/from that colorspace, BBitmap is just a container for overlay in R5, it doesn't necessarily know how to convert the data itself. Oh and BTW, some cards do support some RGB colorspaces (ATI Rage Pro comes to mind). Fran?ois. From ingo_weinhold at gmx.de Tue Jun 3 17:43:49 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Tue, 03 Jun 2008 17:43:49 +0200 Subject: [Haiku-commits] r25785 - haiku/trunk/build/jam In-Reply-To: <1199766362-BeMail@laptop> References: <1199766362-BeMail@laptop> Message-ID: <20080603174349.576.3@knochen-vm.1212499610.fake> On 2008-06-03 at 17:36:28 [+0200], Fran?ois Revol wrote: > > Author: bonefish > > Date: 2008-06-03 17:13:33 +0200 (Tue, 03 Jun 2008) > > New Revision: 25785 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25785&view=rev > > > > Modified: > > haiku/trunk/build/jam/MainBuildRules > > Log: > > The Executable and Addon rules also use --no-undefined, now. > > Apparently > > -nostdlib disables that for executables although it should be enabled > > by > > default. > > Hmm is that for all platforms ? ATM, yes. > Sometimes when building things for R5 (with specifically an R5 devkit > for zeta) it fails as the old gcc doesn't handle that option... I thought gcc 2.95.3 supports it. Or do you mean the ancient gcc 2.9? CU, Ingo From anevilyak at gmail.com Tue Jun 3 17:46:30 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Tue, 3 Jun 2008 10:46:30 -0500 Subject: [Haiku-commits] r25787 - haiku/trunk/src/apps/terminal In-Reply-To: <200806031529.m53FTBbN012218@sheep.berlios.de> References: <200806031529.m53FTBbN012218@sheep.berlios.de> Message-ID: Hi Ingo, On Tue, Jun 3, 2008 at 10:29 AM, bonefish at BerliOS wrote: > Author: bonefish > Date: 2008-06-03 17:29:10 +0200 (Tue, 03 Jun 2008) > New Revision: 25787 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25787&view=rev > Log: > Pulled the TermView interface used by TermParse into a new interface > class TerminalBuffer, which will evolve into a TermBuffer replacement > and decouple the parse thread from the window. > > Is there more to come with respect to this commit? Right now it breaks the build on gcc4 complaining about memcpy being undeclared in TermParse.cpp . Regards, Rene From revol at free.fr Tue Jun 3 17:50:10 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Tue, 03 Jun 2008 17:50:10 +0200 CEST Subject: [Haiku-commits] r25785 - haiku/trunk/build/jam In-Reply-To: <20080603174349.576.3@knochen-vm.1212499610.fake> Message-ID: <150363106-BeMail@laptop> > > On 2008-06-03 at 17:36:28 [+0200], Fran?ois Revol > wrote: > > > Author: bonefish > > > Date: 2008-06-03 17:13:33 +0200 (Tue, 03 Jun 2008) > > > New Revision: 25785 > > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25785&view=rev > > > > > > Modified: > > > haiku/trunk/build/jam/MainBuildRules > > > Log: > > > The Executable and Addon rules also use --no-undefined, now. > > > Apparently > > > -nostdlib disables that for executables although it should be > > > enabled > > > by > > > default. > > > > Hmm is that for all platforms ? > > ATM, yes. > > > Sometimes when building things for R5 (with specifically an R5 > > devkit > > for zeta) it fails as the old gcc doesn't handle that option... > > I thought gcc 2.95.3 supports it. Or do you mean the ancient gcc 2.9? Yes I have R5 and BONE devkits using it... I guess I can always comment that out. Fran?ois. From axeld at mail.berlios.de Tue Jun 3 18:00:14 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 3 Jun 2008 18:00:14 +0200 Subject: [Haiku-commits] r25788 - haiku/trunk/src/add-ons/accelerants/intel_extreme Message-ID: <200806031600.m53G0EP0015475@sheep.berlios.de> Author: axeld Date: 2008-06-03 18:00:09 +0200 (Tue, 03 Jun 2008) New Revision: 25788 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25788&view=rev Modified: haiku/trunk/src/add-ons/accelerants/intel_extreme/hooks.cpp Log: Fixed copy and paste error. Modified: haiku/trunk/src/add-ons/accelerants/intel_extreme/hooks.cpp =================================================================== --- haiku/trunk/src/add-ons/accelerants/intel_extreme/hooks.cpp 2008-06-03 15:29:10 UTC (rev 25787) +++ haiku/trunk/src/add-ons/accelerants/intel_extreme/hooks.cpp 2008-06-03 16:00:09 UTC (rev 25788) @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2008, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -104,7 +104,7 @@ // overlay case B_OVERLAY_COUNT: - return (void*)intel_overlay_supported_spaces; + return (void*)intel_overlay_count; case B_OVERLAY_SUPPORTED_SPACES: return (void*)intel_overlay_supported_spaces; case B_OVERLAY_SUPPORTED_FEATURES: From bonefish at mail.berlios.de Tue Jun 3 18:31:37 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 3 Jun 2008 18:31:37 +0200 Subject: [Haiku-commits] r25789 - haiku/trunk/src/apps/terminal Message-ID: <200806031631.m53GVbKJ019679@sheep.berlios.de> Author: bonefish Date: 2008-06-03 18:31:36 +0200 (Tue, 03 Jun 2008) New Revision: 25789 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25789&view=rev Modified: haiku/trunk/src/apps/terminal/TermParse.cpp Log: Fixed gcc 4 build. Modified: haiku/trunk/src/apps/terminal/TermParse.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-03 16:00:09 UTC (rev 25788) +++ haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-03 16:31:36 UTC (rev 25789) @@ -10,6 +10,7 @@ #include #include #include +#include #include #include From bonefish at mail.berlios.de Tue Jun 3 18:34:08 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 3 Jun 2008 18:34:08 +0200 Subject: [Haiku-commits] r25790 - haiku/trunk/build/jam Message-ID: <200806031634.m53GY85q023462@sheep.berlios.de> Author: bonefish Date: 2008-06-03 18:34:02 +0200 (Tue, 03 Jun 2008) New Revision: 25790 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25790&view=rev Modified: haiku/trunk/build/jam/MainBuildRules Log: Moved --no-undefined flag addition to AddSharedObjectGlueCode where it is added in case of target platform haiku only. Modified: haiku/trunk/build/jam/MainBuildRules =================================================================== --- haiku/trunk/build/jam/MainBuildRules 2008-06-03 16:31:36 UTC (rev 25789) +++ haiku/trunk/build/jam/MainBuildRules 2008-06-03 16:34:02 UTC (rev 25790) @@ -30,7 +30,8 @@ NEEDLIBS on $(1) = [ on $(1) return $(NEEDLIBS) ] $(stdLibs) ; Depends $(1) : $(stdLibs) $(beginGlue) $(endGlue) ; - LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ] -nostdlib ; + LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ] -nostdlib + -Xlinker --no-undefined ; } } @@ -52,7 +53,7 @@ Main $(1) : $(2) ; LinkAgainst $(1) : $(3) ; LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ] - -Xlinker --no-undefined -Xlinker -soname=_APP_ ; + -Xlinker -soname=_APP_ ; # we link with -nostdlib and add the required libs manually, when building # for Haiku @@ -112,8 +113,7 @@ Main $(target) : $(sources) ; - local linkFlags = -Xlinker --no-undefined - -Xlinker -soname=\"$(target:G=)\" ; + local linkFlags = -Xlinker -soname=\"$(target:G=)\" ; if $(isExecutable) != true { linkFlags = -nostart $(linkFlags) ; } @@ -398,7 +398,7 @@ MainFromObjects $(_lib) : $(2) ; LINKFLAGS on $(_lib) = [ on $(_lib) return $(LINKFLAGS) ] - -nostart -Xlinker --no-undefined -Xlinker -soname=\"$(_lib:G=)\" ; + -nostart -Xlinker -soname=\"$(_lib:G=)\" ; LinkAgainst $(_lib) : $(3) ; AddSharedObjectGlueCode $(_lib) : false ; From ingo_weinhold at gmx.de Tue Jun 3 18:37:10 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Tue, 03 Jun 2008 18:37:10 +0200 Subject: [Haiku-commits] r25787 - haiku/trunk/src/apps/terminal In-Reply-To: References: <200806031529.m53FTBbN012218@sheep.berlios.de> Message-ID: <20080603183710.721.4@knochen-vm.1212499610.fake> On 2008-06-03 at 17:46:30 [+0200], Rene Gollent wrote: > On Tue, Jun 3, 2008 at 10:29 AM, bonefish at BerliOS > wrote: > > Author: bonefish > > Date: 2008-06-03 17:29:10 +0200 (Tue, 03 Jun 2008) > > New Revision: 25787 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25787&view=rev > > > > Log: > > Pulled the TermView interface used by TermParse into a new interface > > class TerminalBuffer, which will evolve into a TermBuffer replacement > > and decouple the parse thread from the window. > > Is there more to come with respect to this commit? Right now it breaks > the build on gcc4 complaining about memcpy being undeclared in > TermParse.cpp . There's definitely more to come, though it will take a bit of time. I'll try to think of checking the gcc 4 build before checking something in -- no promises, though. :-) CU, Ingo From anevilyak at gmail.com Tue Jun 3 18:38:47 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Tue, 3 Jun 2008 11:38:47 -0500 Subject: [Haiku-commits] r25787 - haiku/trunk/src/apps/terminal In-Reply-To: <20080603183710.721.4@knochen-vm.1212499610.fake> References: <200806031529.m53FTBbN012218@sheep.berlios.de> <20080603183710.721.4@knochen-vm.1212499610.fake> Message-ID: On Tue, Jun 3, 2008 at 11:37 AM, Ingo Weinhold wrote: > > On 2008-06-03 at 17:46:30 [+0200], Rene Gollent wrote: > There's definitely more to come, though it will take a bit of time. I'll > try to think of checking the gcc 4 build before checking something in -- no > promises, though. :-) > No worries, I would've fixed it myself but wasn't sure if you were still tinkering in that file. Didn't want to cause any conflicts so I thought I'd just ask to be sure first :) Regards, Rene From ingo_weinhold at gmx.de Tue Jun 3 18:41:54 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Tue, 03 Jun 2008 18:41:54 +0200 Subject: [Haiku-commits] r25785 - haiku/trunk/build/jam In-Reply-To: <150363106-BeMail@laptop> References: <150363106-BeMail@laptop> Message-ID: <20080603184154.751.5@knochen-vm.1212499610.fake> On 2008-06-03 at 17:50:10 [+0200], Fran?ois Revol wrote: > > On 2008-06-03 at 17:36:28 [+0200], Fran?ois Revol > > wrote: > > > Sometimes when building things for R5 (with specifically an R5 > > > devkit > > > for zeta) it fails as the old gcc doesn't handle that option... > > > > I thought gcc 2.95.3 supports it. Or do you mean the ancient gcc 2.9? > > Yes I have R5 and BONE devkits using it... > I guess I can always comment that out. I've changed it, so that the flag is only used for platform "haiku" now. We might want to move it to another place later (e.g. TARGET_LINKFLAGS). CU, Ingo From stippi at mail.berlios.de Tue Jun 3 19:07:48 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 3 Jun 2008 19:07:48 +0200 Subject: [Haiku-commits] r25791 - haiku/trunk/src/kits/media Message-ID: <200806031707.m53H7mga032667@sheep.berlios.de> Author: stippi Date: 2008-06-03 19:07:47 +0200 (Tue, 03 Jun 2008) New Revision: 25791 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25791&view=rev Modified: haiku/trunk/src/kits/media/PluginManager.cpp Log: Honor the 80 char per line limit. Modified: haiku/trunk/src/kits/media/PluginManager.cpp =================================================================== --- haiku/trunk/src/kits/media/PluginManager.cpp 2008-06-03 16:34:02 UTC (rev 25790) +++ haiku/trunk/src/kits/media/PluginManager.cpp 2008-06-03 17:07:47 UTC (rev 25791) @@ -17,20 +17,23 @@ status_t -PluginManager::CreateReader(Reader **reader, int32 *streamCount, media_file_format *mff, BDataIO *source) +PluginManager::CreateReader(Reader **reader, int32 *streamCount, + media_file_format *mff, BDataIO *source) { TRACE("PluginManager::CreateReader enter\n"); BPositionIO *seekable_source = dynamic_cast(source); if (seekable_source == 0) { - printf("PluginManager::CreateReader: non-seekable sources not supported yet\n"); + printf("PluginManager::CreateReader: non-seekable sources not " + "supported yet\n"); return B_ERROR; } // get list of available readers from the server server_get_readers_request request; server_get_readers_reply reply; - if (B_OK != QueryServer(SERVER_GET_READERS, &request, sizeof(request), &reply, sizeof(reply))) { + if (QueryServer(SERVER_GET_READERS, &request, sizeof(request), + &reply, sizeof(reply)) != B_OK) { printf("PluginManager::CreateReader: can't get list of readers\n"); return B_ERROR; } @@ -61,8 +64,9 @@ seekable_source->Seek(0, SEEK_SET); (*reader)->Setup(seekable_source); - if (B_OK == (*reader)->Sniff(streamCount)) { - TRACE("PluginManager::CreateReader: Sniff success (%ld stream(s))\n", *streamCount); + if ((*reader)->Sniff(streamCount) == B_OK) { + TRACE("PluginManager::CreateReader: Sniff success " + "(%ld stream(s))\n", *streamCount); (*reader)->GetFileFormatInfo(mff); return B_OK; } @@ -136,7 +140,8 @@ status_t -PluginManager::GetDecoderInfo(Decoder *decoder, media_codec_info *out_info) const +PluginManager::GetDecoderInfo(Decoder *decoder, + media_codec_info *out_info) const { if (!decoder) return B_BAD_VALUE; @@ -174,7 +179,8 @@ while (!fPluginList->IsEmpty()) { plugin_info *info = NULL; fPluginList->Get(fPluginList->CountItems() - 1, &info); - printf("PluginManager: Error, unloading PlugIn %s with usecount %d\n", info->name, info->usecount); + printf("PluginManager: Error, unloading PlugIn %s with usecount " + "%d\n", info->name, info->usecount); delete info->plugin; unload_add_on(info->image); fPluginList->Remove(fPluginList->CountItems() - 1); @@ -247,7 +253,8 @@ status_t -PluginManager::LoadPlugin(const entry_ref &ref, MediaPlugin **plugin, image_id *image) +PluginManager::LoadPlugin(const entry_ref &ref, MediaPlugin **plugin, + image_id *image) { BPath p(&ref); @@ -260,8 +267,10 @@ MediaPlugin *(*instantiate_plugin_func)(); - if (get_image_symbol(id, "instantiate_plugin", B_SYMBOL_TYPE_TEXT, (void**)&instantiate_plugin_func) < B_OK) { - printf("PluginManager: Error, LoadPlugin can't find instantiate_plugin in %s\n", p.Path()); + if (get_image_symbol(id, "instantiate_plugin", B_SYMBOL_TYPE_TEXT, + (void**)&instantiate_plugin_func) < B_OK) { + printf("PluginManager: Error, LoadPlugin can't find " + "instantiate_plugin in %s\n", p.Path()); unload_add_on(id); return B_ERROR; } @@ -270,7 +279,8 @@ pl = (*instantiate_plugin_func)(); if (pl == NULL) { - printf("PluginManager: Error, LoadPlugin instantiate_plugin in %s returned NULL\n", p.Path()); + printf("PluginManager: Error, LoadPlugin instantiate_plugin in %s " + "returned NULL\n", p.Path()); unload_add_on(id); return B_ERROR; } From stippi at mail.berlios.de Tue Jun 3 19:09:14 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 3 Jun 2008 19:09:14 +0200 Subject: [Haiku-commits] r25792 - haiku/trunk/src/kits/media Message-ID: <200806031709.m53H9EWP001025@sheep.berlios.de> Author: stippi Date: 2008-06-03 19:09:13 +0200 (Tue, 03 Jun 2008) New Revision: 25792 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25792&view=rev Modified: haiku/trunk/src/kits/media/PluginManager.cpp Log: Do not remove the plugin from the list if the ref count has not reached zero, otherwise we leak these plugins, since the ref counting is based on the plugin still being in the list. Modified: haiku/trunk/src/kits/media/PluginManager.cpp =================================================================== --- haiku/trunk/src/kits/media/PluginManager.cpp 2008-06-03 17:07:47 UTC (rev 25791) +++ haiku/trunk/src/kits/media/PluginManager.cpp 2008-06-03 17:09:13 UTC (rev 25792) @@ -239,8 +239,8 @@ if (pinfo->usecount == 0) { delete pinfo->plugin; unload_add_on(pinfo->image); + fPluginList->RemoveCurrent(); } - fPluginList->RemoveCurrent(); fLocker->Unlock(); return; } From superstippi at gmx.de Tue Jun 3 19:19:19 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Tue, 03 Jun 2008 19:19:19 +0200 Subject: [Haiku-commits] r25762 - haiku/trunk/src/kits/interface In-Reply-To: References: <47430005181-BeMail@zon> <473118456-BeMail@laptop> Message-ID: <20080603171919.312560@gmx.net> -------- Original-Nachricht -------- > Datum: Tue, 3 Jun 2008 10:13:02 -0500 > Von: "Rene Gollent" > An: "SVN commits to the Haiku source repository" > Betreff: Re: [Haiku-commits] r25762 - haiku/trunk/src/kits/interface > On Tue, Jun 3, 2008 at 10:08 AM, Fran?ois Revol wrote: > > Anyway most cards have a limited number (1 but sometimes 2 or 3) of > > available overlays, so apps should fall back in that case. > > Really? I haven't heard of a card that had more than one BES, at least > not in the consumer space. Happen to know one offhand? Or does > double/triple buffer overlay count as multiple as well? No it doesn't. In fact, you can create as many overlay bitmaps as fit into your video mem with just one overlay engine. IIRC, later Matrox models supported 2 or more overlay engines. However, with 3D engines which support video colorspaces in textures, you can use as many "overlays" as you want, with even better scaling algorithms. Not that this would change anyhing for Haiku at the moment... :-) But Francois is right, if the function reported overlay capabilities, it would need to know which screen would be used by the application. Fortunately at least the BBitmap constructor already gets the screen id. Best regards, -Stephan From axeld at mail.berlios.de Tue Jun 3 19:44:47 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 3 Jun 2008 19:44:47 +0200 Subject: [Haiku-commits] r25793 - in haiku/trunk: headers/os/interface src/kits/interface src/servers/app Message-ID: <200806031744.m53HilqN017358@sheep.berlios.de> Author: axeld Date: 2008-06-03 19:44:46 +0200 (Tue, 03 Jun 2008) New Revision: 25793 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25793&view=rev Modified: haiku/trunk/headers/os/interface/GraphicsDefs.h haiku/trunk/src/kits/interface/GraphicsDefs.cpp haiku/trunk/src/servers/app/ServerApp.cpp Log: * Implemented retrieving additional bitmap support flags by the app_server. * Added B_BITMAPS_SUPPORT_OVERLAY flag to indicate overlay support for the color space. * Rewrote GraphicsDefs.h - the previous one was obvious a copy of the Be header, including typos and strange white space. I was a bit lazy with respect to the color space details, and mostly trusted the information provided by the Be header else. Modified: haiku/trunk/headers/os/interface/GraphicsDefs.h =================================================================== --- haiku/trunk/headers/os/interface/GraphicsDefs.h 2008-06-03 17:09:13 UTC (rev 25792) +++ haiku/trunk/headers/os/interface/GraphicsDefs.h 2008-06-03 17:44:46 UTC (rev 25793) @@ -1,52 +1,19 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: GraphicsDefs.h -// Author: Frans van Nispen -// Description: BMessageFilter class creates objects that filter -// in-coming BMessages. -//------------------------------------------------------------------------------ - +/* + * Copyright 2008, Haiku Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ #ifndef _GRAPHICS_DEFS_H #define _GRAPHICS_DEFS_H -// Standard Includes ----------------------------------------------------------- -// System Includes ------------------------------------------------------------- #include #include -// Project Includes ------------------------------------------------------------ -// Local Includes -------------------------------------------------------------- +// Pattern -// Local Defines --------------------------------------------------------------- - -// Globals --------------------------------------------------------------------- - - -//------------------------------------------------------------------------------ - typedef struct pattern { - uint8 data[8]; + uint8 data[8]; } pattern; #ifdef __cplusplus @@ -69,8 +36,9 @@ extern const pattern B_MIXED_COLORS; extern const pattern B_SOLID_LOW; -//------------------------------------------------------------------------------ +// rgb_color + typedef struct rgb_color { uint8 red; uint8 green; @@ -119,8 +87,6 @@ } #endif -//------------------------------------------------------------------------------ - extern const rgb_color B_TRANSPARENT_COLOR; extern const uint8 B_TRANSPARENT_MAGIC_CMAP8; extern const uint16 B_TRANSPARENT_MAGIC_RGBA15; @@ -131,8 +97,9 @@ extern const uint8 B_TRANSPARENT_8_BIT; extern const rgb_color B_TRANSPARENT_32_BIT; -//------------------------------------------------------------------------------ +// color map + typedef struct color_map { int32 id; rgb_color color_list[256]; @@ -140,6 +107,9 @@ uint8 index_map[32768]; } color_map; + +// overlay + typedef struct overlay_rect_limits { uint16 horizontal_alignment; uint16 vertical_alignment; @@ -162,133 +132,128 @@ uint32 reserved[8]; } overlay_restrictions; -//------------------------------------------------------------------------------ +// screen ID + struct screen_id { int32 id; }; extern const struct screen_id B_MAIN_SCREEN_ID; -//------------------------------------------------------------------------------ -typedef enum -{ - B_NO_COLOR_SPACE = 0x0000, //* byte in memory order, high bit first - - // linear color space (little endian is the default) - B_RGB32 = 0x0008, //* B[7:0] G[7:0] R[7:0] -[7:0] - B_RGBA32 = 0x2008, // B[7:0] G[7:0] R[7:0] A[7:0] - B_RGB24 = 0x0003, // B[7:0] G[7:0] R[7:0] - B_RGB16 = 0x0005, // G[2:0],B[4:0] R[4:0],G[5:3] - B_RGB15 = 0x0010, // G[2:0],B[4:0] -[0],R[4:0],G[4:3] - B_RGBA15 = 0x2010, // G[2:0],B[4:0] A[0],R[4:0],G[4:3] - B_CMAP8 = 0x0004, // D[7:0] - B_GRAY8 = 0x0002, // Y[7:0] - B_GRAY1 = 0x0001, // Y0[0],Y1[0],Y2[0],Y3[0],Y4[0],Y5[0],Y6[0],Y7[0] +// color spaces - // big endian version, when the encoding is not endianess independant - B_RGB32_BIG = 0x1008, // -[7:0] R[7:0] G[7:0] B[7:0] - B_RGBA32_BIG = 0x3008, // A[7:0] R[7:0] G[7:0] B[7:0] - B_RGB24_BIG = 0x1003, // R[7:0] G[7:0] B[7:0] - B_RGB16_BIG = 0x1005, // R[4:0],G[5:3] G[2:0],B[4:0] - B_RGB15_BIG = 0x1010, // -[0],R[4:0],G[4:3] G[2:0],B[4:0] - B_RGBA15_BIG = 0x3010, // A[0],R[4:0],G[4:3] G[2:0],B[4:0] +typedef enum { + B_NO_COLOR_SPACE = 0x0000, - // little-endian declarations, for completness - B_RGB32_LITTLE = B_RGB32, - B_RGBA32_LITTLE = B_RGBA32, - B_RGB24_LITTLE = B_RGB24, - B_RGB16_LITTLE = B_RGB16, - B_RGB15_LITTLE = B_RGB15, - B_RGBA15_LITTLE = B_RGBA15, + // linear color space (little endian) + B_RGB32 = 0x0008, // BGR- + B_RGBA32 = 0x2008, // BGRA + B_RGB24 = 0x0003, // BGR + B_RGB16 = 0x0005, + B_RGB15 = 0x0010, + B_RGBA15 = 0x2010, + B_CMAP8 = 0x0004, + B_GRAY8 = 0x0002, + B_GRAY1 = 0x0001, - // non linear color space -- note that these are here for exchange purposes; - // a BBitmap or BView may not necessarily support all these color spaces. + // big endian version + B_RGB32_BIG = 0x1008, // -RGB + B_RGBA32_BIG = 0x3008, // ARGB + B_RGB24_BIG = 0x1003, // RGB + B_RGB16_BIG = 0x1005, + B_RGB15_BIG = 0x1010, + B_RGBA15_BIG = 0x3010, - // Loss/Saturation points are Y 16-235 (absoulte); Cb/Cr 16-240 (center 128) + // explicit little-endian for completeness + B_RGB32_LITTLE = B_RGB32, + B_RGBA32_LITTLE = B_RGBA32, + B_RGB24_LITTLE = B_RGB24, + B_RGB16_LITTLE = B_RGB16, + B_RGB15_LITTLE = B_RGB15, + B_RGBA15_LITTLE = B_RGBA15, - B_YCbCr422 = 0x4000, // Y0[7:0] Cb0[7:0] Y1[7:0] Cr0[7:0] Y2[7:0]... - // Cb2[7:0] Y3[7:0] Cr2[7:0] - B_YCbCr411 = 0x4001, // Cb0[7:0] Y0[7:0] Cr0[7:0] Y1[7:0] Cb4[7:0]... - // Y2[7:0] Cr4[7:0] Y3[7:0] Y4[7:0] Y5[7:0]... - // Y6[7:0] Y7[7:0] - B_YCbCr444 = 0x4003, // Y0[7:0] Cb0[7:0] Cr0[7:0] - B_YCbCr420 = 0x4004, // Non-interlaced only, Cb0 Y0 Y1 Cb2 Y2 Y3 - // on even scan lines, Cr0 Y0 Y1 Cr2 Y2 Y3 - // on odd scan lines + // non linear color space -- incidently, all with 8 bits per value + // Note, BBitmap and BView do not support all of these! - // Extrema points are - // Y 0 - 207 (absolute) - // U -91 - 91 (offset 128) - // V -127 - 127 (offset 128) - // note that YUV byte order is different from YCbCr - // USE YCbCr, not YUV, when that's what you mean! - B_YUV422 = 0x4020, // U0[7:0] Y0[7:0] V0[7:0] Y1[7:0] ... - // U2[7:0] Y2[7:0] V2[7:0] Y3[7:0] - B_YUV411 = 0x4021, // U0[7:0] Y0[7:0] Y1[7:0] V0[7:0] Y2[7:0] Y3[7:0] - // U4[7:0] Y4[7:0] Y5[7:0] V4[7:0] Y6[7:0] Y7[7:0] - B_YUV444 = 0x4023, // U0[7:0] Y0[7:0] V0[7:0] U1[7:0] Y1[7:0] V1[7:0] - B_YUV420 = 0x4024, // Non-interlaced only, U0 Y0 Y1 U2 Y2 Y3 - // on even scan lines, V0 Y0 Y1 V2 Y2 Y3 - // on odd scan lines - B_YUV9 = 0x402C, // planar? 410? - B_YUV12 = 0x402D, // planar? 420? + // loss/saturation points are Y 16-235 (absolute), Cb/Cr 16-240 (center 128) - B_UVL24 = 0x4030, // U0[7:0] V0[7:0] L0[7:0] ... - B_UVL32 = 0x4031, // U0[7:0] V0[7:0] L0[7:0] X0[7:0]... - B_UVLA32 = 0x6031, // U0[7:0] V0[7:0] L0[7:0] A0[7:0]... + B_YCbCr422 = 0x4000, // Y0 Cb0 Y1 Cr0 Y2... + // Cb2 Y3 Cr2... + B_YCbCr411 = 0x4001, // Cb0 Y0 Cr0 Y1 Cb4... + // Y2 Cr4 Y3 Y4 Y5... + // Y6 Y7... + B_YCbCr444 = 0x4003, // Y Cb Cr + B_YCbCr420 = 0x4004, // Non-interlaced only + // on even scan lines: Cb0 Y0 Y1 Cb2 Y2 Y3 + // on odd scan lines: Cr0 Y0 Y1 Cr2 Y2 Y3 - B_LAB24 = 0x4032, // L0[7:0] a0[7:0] b0[7:0] ... (a is not alpha!) - B_LAB32 = 0x4033, // L0[7:0] a0[7:0] b0[7:0] X0[7:0] ... (b is not alpha!) - B_LABA32 = 0x6033, // L0[7:0] a0[7:0] b0[7:0] A0[7:0] ... (A is alpha) + // Extrema points are: + // Y 0 - 207 (absolute) + // U -91 - 91 (offset 128) + // V -127 - 127 (offset 128) - // red is at hue = 0 + // Note that YUV byte order is different from YCbCr; use YCbCr, not YUV, + // when that's what you mean! + B_YUV422 = 0x4020, // U0 Y0 V0 Y1... + // U2 Y2 V2 Y3... + B_YUV411 = 0x4021, // U0 Y0 Y1 V0 Y2 Y3... + // U4 Y4 Y5 V4 Y6 Y7... + B_YUV444 = 0x4023, // U0 Y0 V0 U1 Y1 V1 + B_YUV420 = 0x4024, // Non-interlaced only + // on even scan lines: U0 Y0 Y1 U2 Y2 Y3 + // on odd scan lines: V0 Y0 Y1 V2 Y2 Y3 + B_YUV9 = 0x402C, + B_YUV12 = 0x402D, - B_HSI24 = 0x4040, // H[7:0] S[7:0] I[7:0] - B_HSI32 = 0x4041, // H[7:0] S[7:0] I[7:0] X[7:0] - B_HSIA32 = 0x6041, // H[7:0] S[7:0] I[7:0] A[7:0] + B_UVL24 = 0x4030, // UVL + B_UVL32 = 0x4031, // UVL- + B_UVLA32 = 0x6031, // UVLA - B_HSV24 = 0x4042, // H[7:0] S[7:0] V[7:0] - B_HSV32 = 0x4043, // H[7:0] S[7:0] V[7:0] X[7:0] - B_HSVA32 = 0x6043, // H[7:0] S[7:0] V[7:0] A[7:0] + // L lightness, a/b color-opponent dimensions + B_LAB24 = 0x4032, // Lab + B_LAB32 = 0x4033, // Lab- + B_LABA32 = 0x6033, // LabA - B_HLS24 = 0x4044, // H[7:0] L[7:0] S[7:0] - B_HLS32 = 0x4045, // H[7:0] L[7:0] S[7:0] X[7:0] - B_HLSA32 = 0x6045, // H[7:0] L[7:0] S[7:0] A[7:0] + // Red is at hue 0 + B_HSI24 = 0x4040, // HSI + B_HSI32 = 0x4041, // HSI- + B_HSIA32 = 0x6041, // HSIA - B_CMY24 = 0xC001, // C[7:0] M[7:0] Y[7:0] No gray removal done - B_CMY32 = 0xC002, // C[7:0] M[7:0] Y[7:0] X[7:0] No gray removal done - B_CMYA32 = 0xE002, // C[7:0] M[7:0] Y[7:0] A[7:0] No gray removal done - B_CMYK32 = 0xC003, // C[7:0] M[7:0] Y[7:0] K[7:0] + B_HSV24 = 0x4042, // HSV + B_HSV32 = 0x4043, // HSV- + B_HSVA32 = 0x6043, // HSVA + B_HLS24 = 0x4044, // HLS + B_HLS32 = 0x4045, // HLS- + B_HLSA32 = 0x6045, // HLSA + + B_CMY24 = 0xC001, // CMY + B_CMY32 = 0xC002, // CMY- + B_CMYA32 = 0xE002, // CMYA + B_CMYK32 = 0xC003, // CMYK + // compatibility declarations - B_MONOCHROME_1_BIT = B_GRAY1, - B_GRAYSCALE_8_BIT = B_GRAY8, - B_COLOR_8_BIT = B_CMAP8, - B_RGB_32_BIT = B_RGB32, - B_RGB_16_BIT = B_RGB15, - B_BIG_RGB_32_BIT = B_RGB32_BIG, - B_BIG_RGB_16_BIT = B_RGB15_BIG + B_MONOCHROME_1_BIT = B_GRAY1, + B_GRAYSCALE_8_BIT = B_GRAY8, + B_COLOR_8_BIT = B_CMAP8, + B_RGB_32_BIT = B_RGB32, + B_RGB_16_BIT = B_RGB15, + B_BIG_RGB_32_BIT = B_RGB32_BIG, + B_BIG_RGB_16_BIT = B_RGB15_BIG } color_space; -// Find out whether a specific color space is supported by BBitmaps. -// Support_flags will be set to what kinds of support are available. -// If support_flags is set to 0, false will be returned. +// Bitmap Support Flags + enum { - B_VIEWS_SUPPORT_DRAW_BITMAP = 0x1, - B_BITMAPS_SUPPORT_ATTACHED_VIEWS = 0x2 + B_VIEWS_SUPPORT_DRAW_BITMAP = 0x1, + B_BITMAPS_SUPPORT_ATTACHED_VIEWS = 0x2, + B_BITMAPS_SUPPORT_OVERLAY = 0x4, }; -bool bitmaps_support_space(color_space space, uint32 * support_flags); +bool bitmaps_support_space(color_space space, uint32* _supportFlags); -//------------------------------------------------------------------------------ -// "pixel_chunk" is the native increment from one pixel starting on an integral byte -// to the next. "row_alignment" is the native alignment for pixel scanline starts. -// "pixels_per_chunk" is the number of pixels in a pixel_chunk. For instance, B_GRAY1 -// sets pixel_chunk to 1, row_alignment to 4 and pixels_per_chunk to 8, whereas -// B_RGB24 sets pixel_chunk to 3, row_alignment to 4 and pixels_per_chunk to 1. -//------------------------------------------------------------------------------ -status_t get_pixel_size_for(color_space space, size_t * pixel_chunk, - size_t * row_alignment, size_t * pixels_per_chunk); +status_t get_pixel_size_for(color_space space, size_t* _pixelChunk, + size_t* _rowAlignment, size_t* _pixelsPerChunk); enum buffer_orientation { @@ -299,8 +264,9 @@ enum buffer_layout { B_BUFFER_NONINTERLEAVED = 1 }; + -//------------------------------------------------------------------------------ +// Drawing Modes enum drawing_mode { B_OP_COPY, @@ -317,52 +283,45 @@ }; enum source_alpha { - B_PIXEL_ALPHA=0, + B_PIXEL_ALPHA = 0, B_CONSTANT_ALPHA }; enum alpha_function { - B_ALPHA_OVERLAY=0, + B_ALPHA_OVERLAY = 0, B_ALPHA_COMPOSITE }; + +// Fixed Screen Modes + enum { - B_8_BIT_640x480 = 0x00000001, - B_8_BIT_800x600 = 0x00000002, - B_8_BIT_1024x768 = 0x00000004, - B_8_BIT_1280x1024 = 0x00000008, - B_8_BIT_1600x1200 = 0x00000010, - B_16_BIT_640x480 = 0x00000020, - B_16_BIT_800x600 = 0x00000040, - B_16_BIT_1024x768 = 0x00000080, - B_16_BIT_1280x1024 = 0x00000100, - B_16_BIT_1600x1200 = 0x00000200, - B_32_BIT_640x480 = 0x00000400, - B_32_BIT_800x600 = 0x00000800, - B_32_BIT_1024x768 = 0x00001000, - B_32_BIT_1280x1024 = 0x00002000, - B_32_BIT_1600x1200 = 0x00004000, - B_8_BIT_1152x900 = 0x00008000, - B_16_BIT_1152x900 = 0x00010000, - B_32_BIT_1152x900 = 0x00020000, - B_15_BIT_640x480 = 0x00040000, - B_15_BIT_800x600 = 0x00080000, - B_15_BIT_1024x768 = 0x00100000, - B_15_BIT_1280x1024 = 0x00200000, - B_15_BIT_1600x1200 = 0x00400000, - B_15_BIT_1152x900 = 0x00800000, + B_8_BIT_640x480 = 0x00000001, + B_8_BIT_800x600 = 0x00000002, + B_8_BIT_1024x768 = 0x00000004, + B_8_BIT_1280x1024 = 0x00000008, + B_8_BIT_1600x1200 = 0x00000010, + B_16_BIT_640x480 = 0x00000020, + B_16_BIT_800x600 = 0x00000040, + B_16_BIT_1024x768 = 0x00000080, + B_16_BIT_1280x1024 = 0x00000100, + B_16_BIT_1600x1200 = 0x00000200, + B_32_BIT_640x480 = 0x00000400, + B_32_BIT_800x600 = 0x00000800, + B_32_BIT_1024x768 = 0x00001000, + B_32_BIT_1280x1024 = 0x00002000, + B_32_BIT_1600x1200 = 0x00004000, + B_8_BIT_1152x900 = 0x00008000, + B_16_BIT_1152x900 = 0x00010000, + B_32_BIT_1152x900 = 0x00020000, + B_15_BIT_640x480 = 0x00040000, + B_15_BIT_800x600 = 0x00080000, + B_15_BIT_1024x768 = 0x00100000, + B_15_BIT_1280x1024 = 0x00200000, + B_15_BIT_1600x1200 = 0x00400000, + B_15_BIT_1152x900 = 0x00800000, - // do not use B_FAKE_DEVICE--it will go away! - B_FAKE_DEVICE = 0x40000000, - B_8_BIT_640x400 = (int)0x80000000 + B_8_BIT_640x400 = 0x80000000 }; -#endif // _GRAPHICSDEFS_H - -/* - * $Log $ - * - * $Id $ - * - */ - +#endif // _GRAPHICS_DEFS_H Modified: haiku/trunk/src/kits/interface/GraphicsDefs.cpp =================================================================== --- haiku/trunk/src/kits/interface/GraphicsDefs.cpp 2008-06-03 17:09:13 UTC (rev 25792) +++ haiku/trunk/src/kits/interface/GraphicsDefs.cpp 2008-06-03 17:44:46 UTC (rev 25793) @@ -1,34 +1,21 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2004, Haiku -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: GraphicsDefs.cpp -// Author: DarkWyrm -// Caz -// Axel D?rfler -// Description: Graphics functions and variables for the Interface Kit -// -//------------------------------------------------------------------------------ +/* + * Copyright 2001-2008, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * DarkWyrm + * Caz + * Axel D?rfler, axeld at pinc-software.de + */ +//! Graphics functions and variables for the Interface Kit + #include +#include +#include + + // patterns const pattern B_SOLID_HIGH = {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}; const pattern B_MIXED_COLORS = {{0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55}}; @@ -50,7 +37,8 @@ status_t -get_pixel_size_for(color_space space, size_t *pixelChunk, size_t *rowAlignment, size_t *pixelsPerChunk) +get_pixel_size_for(color_space space, size_t *pixelChunk, size_t *rowAlignment, + size_t *pixelsPerChunk) { status_t status = B_OK; int32 bytesPerPixel = 0; @@ -152,12 +140,22 @@ case B_RGB16: case B_RGB15: case B_RGBA15: case B_RGB16_BIG: case B_RGB15_BIG: case B_RGBA15_BIG: case B_CMAP8: case B_GRAY8: case B_GRAY1: - if (supportFlags) { - *supportFlags = 0; - *supportFlags |= B_VIEWS_SUPPORT_DRAW_BITMAP; - *supportFlags |= B_BITMAPS_SUPPORT_ATTACHED_VIEWS; + if (supportFlags != NULL) { + *supportFlags = B_VIEWS_SUPPORT_DRAW_BITMAP + | B_BITMAPS_SUPPORT_ATTACHED_VIEWS; + + BPrivate::AppServerLink link; + link.StartMessage(AS_GET_BITMAP_SUPPORT_FLAGS); + + int32 code; + if (link.FlushWithReply(code) == B_OK && code == B_OK) { + uint32 flags = 0; + if (link.Read(&flags) == B_OK) + *supportFlags |= flags; + } } break; + // supported, but cannot draw case B_YCbCr422: case B_YCbCr411: case B_YCbCr444: case B_YCbCr420: case B_YUV422: case B_YUV411: case B_YUV444: case B_YUV420: Modified: haiku/trunk/src/servers/app/ServerApp.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerApp.cpp 2008-06-03 17:09:13 UTC (rev 25792) +++ haiku/trunk/src/servers/app/ServerApp.cpp 2008-06-03 17:44:46 UTC (rev 25793) @@ -682,7 +682,22 @@ fLink.Flush(); break; } + case AS_GET_BITMAP_SUPPORT_FLAGS: + { + uint32 colorSpace; + if (link.Read(&colorSpace) != B_OK) + break; + bool overlay = fDesktop->HWInterface()->CheckOverlayRestrictions( + 64, 64, (color_space)colorSpace); + uint32 flags = overlay ? B_BITMAPS_SUPPORT_OVERLAY : 0; + + fLink.StartMessage(B_OK); + fLink.Attach(flags); + fLink.Flush(); + break; + } + case AS_CREATE_PICTURE: { // TODO: Maybe rename this to AS_UPLOAD_PICTURE ? From axeld at mail.berlios.de Tue Jun 3 19:45:54 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 3 Jun 2008 19:45:54 +0200 Subject: [Haiku-commits] r25794 - haiku/trunk/headers/private/app Message-ID: <200806031745.m53Hjs8C017501@sheep.berlios.de> Author: axeld Date: 2008-06-03 19:45:54 +0200 (Tue, 03 Jun 2008) New Revision: 25794 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25794&view=rev Modified: haiku/trunk/headers/private/app/ServerProtocol.h Log: This should have been part of r25793. Modified: haiku/trunk/headers/private/app/ServerProtocol.h =================================================================== --- haiku/trunk/headers/private/app/ServerProtocol.h 2008-06-03 17:44:46 UTC (rev 25793) +++ haiku/trunk/headers/private/app/ServerProtocol.h 2008-06-03 17:45:54 UTC (rev 25794) @@ -54,6 +54,7 @@ AS_CREATE_BITMAP, AS_DELETE_BITMAP, AS_GET_BITMAP_OVERLAY_RESTRICTIONS, + AS_GET_BITMAP_SUPPORT_FLAGS, // Cursor commands AS_SET_CURSOR, From axeld at pinc-software.de Tue Jun 3 19:45:51 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 03 Jun 2008 19:45:51 +0200 CEST Subject: [Haiku-commits] r25762 - haiku/trunk/src/kits/interface In-Reply-To: <20080603141243.239490@gmx.net> Message-ID: <39180157702-BeMail@zon> "Stephan Assmus" wrote: > > Wasn't aware of this function - so we can just add a > > B_BITMAP_SUPPORTS_OVERLAY there and that's it? > Ah yeah, didn't even think of that, but yes! We could also add flags > whether or not > BBitmap can convert from/to the format (from B_RGBA32 as > intermediate). > Would be a nice, unintrucive way to extend existing API. Indeed, sounds nice :-) I took the liberty and implemented the overlay part of it in r25793. Bye, Axel. From axeld at pinc-software.de Tue Jun 3 20:37:47 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 03 Jun 2008 20:37:47 +0200 CEST Subject: [Haiku-commits] r25762 - haiku/trunk/src/kits/interface In-Reply-To: <20080603171919.312560@gmx.net> Message-ID: <42296061755-BeMail@zon> "Stephan Assmus" wrote: > But Francois is right, if the function reported overlay capabilities, > it would need to > know which screen would be used by the application. Fortunately at > least the BBitmap > constructor already gets the screen id. That is indeed some sort of a problem. But if there is more than one graphcis card in the system (the only case where different supported overlay spaces can occur), we might want to only show the conjunction of their supported spaces; else, it would not be possible to move an overlay window from one workspace to another (at least the current API does not allow for a way to handle this IIRC). Bye, Axel. From axeld at pinc-software.de Tue Jun 3 20:41:24 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 03 Jun 2008 20:41:24 +0200 CEST Subject: [Haiku-commits] r25762 - haiku/trunk/src/kits/interface In-Reply-To: <1437451805-BeMail@laptop> Message-ID: <42513946310-BeMail@zon> "Fran?ois Revol" wrote: > > > Hmm overlay support depends on the gfx card usually... > > > So it should be tied to BScreen I think. > > In the Be API, overlay support is completely implemented by > > BBitmap. > Indeed. > > There is not a single overlay related function in BScreen. > Yes but it's the most logical place for it. You would think so, indeed :-) But OTOH, there is little that BScreen could provide besides some informational things (or a GetOverlayBitmap() method). > > > Anyway most cards have a limited number (1 but sometimes 2 or 3) > > > of > > > available overlays, so apps should fall back in that case. > > This has nothing to do with the general capability of using the > > overlay with a certain color space. > Well unless you mean being able to convert to/from that colorspace, > BBitmap is just a container for overlay in R5, it doesn't necessarily > know how to convert the data itself. > > Oh and BTW, some cards do support some RGB colorspaces (ATI Rage Pro > comes to mind). See my other mail - that's not really a problem. Bye, Axel. From axeld at mail.berlios.de Tue Jun 3 20:59:12 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 3 Jun 2008 20:59:12 +0200 Subject: [Haiku-commits] r25795 - haiku/trunk/src/preferences/screen Message-ID: <200806031859.m53IxCgY025588@sheep.berlios.de> Author: axeld Date: 2008-06-03 20:59:12 +0200 (Tue, 03 Jun 2008) New Revision: 25795 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25795&view=rev Modified: haiku/trunk/src/preferences/screen/ScreenWindow.cpp haiku/trunk/src/preferences/screen/ScreenWindow.h Log: Applied patch by Jan Kl?\195?\182tzke with some changes by myself: * The vesa driver/accelerant supports mode switching now. No special handling is needed anymore. * Always write the vesa settings file to directly start with the right resolution regardless of the used graphics driver. Should save an additional mode switch while booting. Modified: haiku/trunk/src/preferences/screen/ScreenWindow.cpp =================================================================== --- haiku/trunk/src/preferences/screen/ScreenWindow.cpp 2008-06-03 17:45:54 UTC (rev 25794) +++ haiku/trunk/src/preferences/screen/ScreenWindow.cpp 2008-06-03 18:59:12 UTC (rev 25795) @@ -216,8 +216,7 @@ ScreenWindow::ScreenWindow(ScreenSettings *settings) : BWindow(settings->WindowFrame(), "Screen", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE, B_ALL_WORKSPACES), - fIsVesa(false), - fVesaApplied(false), + fBootWorkspaceApplied(false), fScreenMode(this), fTempScreenMode(this), fModified(false) @@ -249,11 +248,8 @@ // TODO: since per workspace settings is unimplemented (Ticket #693) // we force the menu to "All Workspaces" for now - //if (_IsVesa()) { - fAllWorkspacesItem->SetMarked(true); - item->SetEnabled(false); - //} else - // item->SetMarked(true); + fAllWorkspacesItem->SetMarked(true); + item->SetEnabled(false); popUpMenu->AddItem(item); @@ -530,14 +526,16 @@ ScreenWindow::QuitRequested() { fSettings->SetWindowFrame(Frame()); - if (fVesaApplied) { - status_t status = _WriteVesaModeFile(fSelected); + + // Write mode of workspace 0 (the boot workspace) to the vesa settings file + screen_mode vesaMode; + if (fBootWorkspaceApplied && fScreenMode.Get(vesaMode, 0) == B_OK) { + status_t status = _WriteVesaModeFile(vesaMode); if (status < B_OK) { BString warning = "Could not write VESA mode settings file:\n\t"; warning << strerror(status); (new BAlert("VesaAlert", warning.String(), "Okay", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); - } } @@ -766,8 +764,7 @@ // has been set manually; still, as the graphics driver // is free to fiddle with mode passed, we better ask // what kind of mode we actually got - if (!fVesaApplied) - fScreenMode.Get(fActive); + fScreenMode.Get(fActive); fSelected = fActive; _UpdateControls(); @@ -789,10 +786,8 @@ void ScreenWindow::WorkspaceActivated(int32 workspace, bool state) { - if (!_IsVesa()) { - fScreenMode.GetOriginalMode(fOriginal, workspace); - _UpdateActiveMode(); - } + fScreenMode.GetOriginalMode(fOriginal, workspace); + _UpdateActiveMode(); BMessage message(UPDATE_DESKTOP_COLOR_MSG); PostMessage(&message, fMonitorView); @@ -948,7 +943,7 @@ case BUTTON_REVERT_MSG: { fModified = false; - fVesaApplied = false; + fBootWorkspaceApplied = false; BMenuItem *item; item = fWorkspaceCountField->Menu()->ItemAt(fOriginalWorkspaceCount - 1); if (item != NULL) @@ -956,17 +951,9 @@ // ScreenMode::Revert() assumes that we first set the correct number // of workspaces - - if (_IsVesa()) { - set_workspace_count(fOriginalWorkspaceCount); - fActive = fOriginal; - fSelected = fOriginal; - _UpdateControls(); - } else { - set_workspace_count(fOriginalWorkspaceCount); - fScreenMode.Revert(); - _UpdateActiveMode(); - } + set_workspace_count(fOriginalWorkspaceCount); + fScreenMode.Revert(); + _UpdateActiveMode(); break; } @@ -1018,68 +1005,6 @@ } -status_t -ScreenWindow::_ReadVesaModeFile(screen_mode& mode) const -{ - BPath path; - status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path, true); - if (status < B_OK) - return status; - - path.Append("kernel/drivers/vesa"); - BFile file; - status = file.SetTo(path.Path(), B_READ_ONLY); - if (status < B_OK) - return status; - - char buffer[256]; - - ssize_t bytesRead = file.Read(buffer, sizeof(buffer) - 1); - if (bytesRead < B_OK) { - return bytesRead; - } else { - buffer[bytesRead] = '\0'; - } - - char ignore[256]; - // if the file is malformed, sscanf shouldn't crash - // on reading a big string since we don't even read - // as much from the file - uint32 bitDepth = 0; - - if (sscanf(buffer, "%s %ld %ld %ld", ignore, &mode.width, &mode.height, - &bitDepth) != 4) { - return B_ERROR; - } - - // TODO: check for valid width and height values - - switch (bitDepth) { - case 32: - mode.space = B_RGB32; - break; - case 24: - mode.space = B_RGB24; - break; - case 16: - mode.space = B_RGB16; - break; - case 15: - mode.space = B_RGB15; - break; - case 8: - mode.space = B_CMAP8; - break; - default: - // invalid value, we force it to B_RGB16 just in case - mode.space = B_RGB16; - return B_ERROR; - } - - return B_OK; -} - - void ScreenWindow::_CheckApplyEnabled() { @@ -1094,12 +1019,6 @@ { fOriginalWorkspaceCount = count_workspaces(); fScreenMode.Get(fOriginal); - - // If we are in vesa we overwrite fOriginal's resolution and bitdepth - // with those found the vesa settings file. (if the file exists) - if (_IsVesa()) - _ReadVesaModeFile(fOriginal); - fScreenMode.UpdateOriginalModes(); } @@ -1107,18 +1026,6 @@ void ScreenWindow::_Apply() { - if (_IsVesa()) { - (new BAlert("VesaAlert", - "Haiku is using your video card in compatibility mode (VESA)." - " Your settings will be applied on next startup.\n", "Okay", NULL, NULL, B_WIDTH_AS_USUAL, - B_INFO_ALERT))->Go(NULL); - - fVesaApplied = true; - fActive = fSelected; - _UpdateControls(); - return; - } - // make checkpoint, so we can undo these changes fTempScreenMode.UpdateOriginalModes(); status_t status = fScreenMode.Set(fSelected); @@ -1136,6 +1043,10 @@ if (i != originatingWorkspace) screen.SetMode(i, &newMode, true); } + fBootWorkspaceApplied = true; + } else { + if (current_workspace() == 0) + fBootWorkspaceApplied = true; } fActive = fSelected; Modified: haiku/trunk/src/preferences/screen/ScreenWindow.h =================================================================== --- haiku/trunk/src/preferences/screen/ScreenWindow.h 2008-06-03 17:45:54 UTC (rev 25794) +++ haiku/trunk/src/preferences/screen/ScreenWindow.h 2008-06-03 18:59:12 UTC (rev 25795) @@ -51,7 +51,6 @@ void _Apply(); status_t _WriteVesaModeFile(const screen_mode& mode) const; - status_t _ReadVesaModeFile(screen_mode& mode) const; bool _IsVesa() const { return fIsVesa; } void _LayoutControls(uint32 flags); @@ -59,7 +58,7 @@ ScreenSettings* fSettings; bool fIsVesa; - bool fVesaApplied; + bool fBootWorkspaceApplied; BBox* fScreenBox; BBox* fControlsBox; From axeld at mail.berlios.de Tue Jun 3 21:06:58 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 3 Jun 2008 21:06:58 +0200 Subject: [Haiku-commits] r25796 - haiku/trunk/src/add-ons/kernel/drivers/network/etherpci Message-ID: <200806031906.m53J6wnv027899@sheep.berlios.de> Author: axeld Date: 2008-06-03 21:06:57 +0200 (Tue, 03 Jun 2008) New Revision: 25796 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25796&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/network/etherpci/etherpci.c Log: * Fixed warnings, and turned off debugging output. * This fixes bug #2274. Modified: haiku/trunk/src/add-ons/kernel/drivers/network/etherpci/etherpci.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/etherpci/etherpci.c 2008-06-03 18:59:12 UTC (rev 25795) +++ haiku/trunk/src/add-ons/kernel/drivers/network/etherpci/etherpci.c 2008-06-03 19:06:57 UTC (rev 25796) @@ -39,9 +39,14 @@ /* diagnostic debug flags - compile in here or set while running with debugger "AcmeRoadRunner" command */ #define DEFAULT_DEBUG_FLAGS ( ERR | INFO | WARN | FUNCTION ) -#define ETHER_DEBUG(mask, enabled, format, args...) \ - do { if (mask & enabled) \ - dprintf(format , ##args); } while (0) +//#define TRACE_ETHERPCI +#ifdef TRACE_ETHERPCI +# define ETHER_DEBUG(mask, enabled, format, args...) \ + do { if (mask & enabled) \ + dprintf(format , ##args); } while (0) +#else +# define ETHER_DEBUG(mask, enabled, format, args...) ; +#endif static pci_module_info *gPCIModInfo; @@ -1494,7 +1499,7 @@ data->nonblocking = 0; data->debug = DEFAULT_DEBUG_FLAGS; - ETHER_DEBUG(FUNCTION, data->debug, kDevName ": open %s dev=%x\n", name, data); + ETHER_DEBUG(FUNCTION, data->debug, kDevName ": open %s dev=%p\n", name, data); #if DEBUGGER_COMMAND gdev = data; @@ -1543,7 +1548,7 @@ close_hook(void *_data) { etherpci_private_t *data = (etherpci_private_t *)_data; - ETHER_DEBUG(FUNCTION, data->debug, kDevName ": close dev=%x\n", data); + ETHER_DEBUG(FUNCTION, data->debug, kDevName ": close dev=%p\n", data); /* * Force pending reads and writes to terminate @@ -1613,7 +1618,7 @@ etherpci_private_t *data = (etherpci_private_t *)_data; int32 mask; - ETHER_DEBUG(FUNCTION, data->debug, kDevName ": free %s dev=%x\n", data); + ETHER_DEBUG(FUNCTION, data->debug, kDevName ": free dev=%p\n", data); #if !__INTEL__ delete_area(data->ioarea); @@ -1706,7 +1711,7 @@ return B_OK; case ETHER_ADDMULTI: - ETHER_DEBUG(FUNCTION, data->debug, kDevName ": control: DO_MULTI %x\n"); + ETHER_DEBUG(FUNCTION, data->debug, kDevName ": control: DO_MULTI\n"); return domulti(data, (char *)buf); } From anevilyak at mail.berlios.de Tue Jun 3 21:24:57 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Tue, 3 Jun 2008 21:24:57 +0200 Subject: [Haiku-commits] r25797 - haiku/trunk/headers/os/interface Message-ID: <200806031924.m53JOvei029582@sheep.berlios.de> Author: anevilyak Date: 2008-06-03 21:24:56 +0200 (Tue, 03 Jun 2008) New Revision: 25797 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25797&view=rev Modified: haiku/trunk/headers/os/interface/GraphicsDefs.h Log: Fix GCC4 build. Modified: haiku/trunk/headers/os/interface/GraphicsDefs.h =================================================================== --- haiku/trunk/headers/os/interface/GraphicsDefs.h 2008-06-03 19:06:57 UTC (rev 25796) +++ haiku/trunk/headers/os/interface/GraphicsDefs.h 2008-06-03 19:24:56 UTC (rev 25797) @@ -248,7 +248,7 @@ enum { B_VIEWS_SUPPORT_DRAW_BITMAP = 0x1, B_BITMAPS_SUPPORT_ATTACHED_VIEWS = 0x2, - B_BITMAPS_SUPPORT_OVERLAY = 0x4, + B_BITMAPS_SUPPORT_OVERLAY = 0x4 }; bool bitmaps_support_space(color_space space, uint32* _supportFlags); From korli at mail.berlios.de Tue Jun 3 22:13:59 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 3 Jun 2008 22:13:59 +0200 Subject: [Haiku-commits] r25798 - haiku/trunk/headers/os/drivers Message-ID: <200806032013.m53KDxQZ001290@sheep.berlios.de> Author: korli Date: 2008-06-03 22:13:59 +0200 (Tue, 03 Jun 2008) New Revision: 25798 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25798&view=rev Modified: haiku/trunk/headers/os/drivers/block_io.h Log: use the typedef Modified: haiku/trunk/headers/os/drivers/block_io.h =================================================================== --- haiku/trunk/headers/os/drivers/block_io.h 2008-06-03 19:24:56 UTC (rev 25797) +++ haiku/trunk/headers/os/drivers/block_io.h 2008-06-03 20:13:59 UTC (rev 25798) @@ -57,7 +57,7 @@ #define B_BLOCK_DEVICE_MAX_SG_BLOCKS "block_device/max_sg_blocks" typedef struct block_device_cookie { - struct device_node *node; + device_node *node; } block_device_cookie; // interface to be provided by device driver From korli at mail.berlios.de Tue Jun 3 23:05:59 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 3 Jun 2008 23:05:59 +0200 Subject: [Haiku-commits] r25799 - haiku/trunk/src/system/kernel/device_manager Message-ID: <200806032105.m53L5xWj007815@sheep.berlios.de> Author: korli Date: 2008-06-03 23:05:58 +0200 (Tue, 03 Jun 2008) New Revision: 25799 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25799&view=rev Modified: haiku/trunk/src/system/kernel/device_manager/device_manager.cpp Log: * some typos * a driver can register children and have a fixed child (ie for a bus manager). Modified: haiku/trunk/src/system/kernel/device_manager/device_manager.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/device_manager.cpp 2008-06-03 20:13:59 UTC (rev 25798) +++ haiku/trunk/src/system/kernel/device_manager/device_manager.cpp 2008-06-03 21:05:58 UTC (rev 25799) @@ -1325,7 +1325,6 @@ } if (registered > 0) { fRegistered = true; - return B_OK; } // Register the children the driver wants @@ -1355,7 +1354,7 @@ } -/*! Registers any children that are identified via the B_DRIVER_FIXED_CHILD +/*! Registers any children that are identified via the B_DEVICE_FIXED_CHILD attribute. If any of these children cannot be registered, this call will fail (we don't remove children we already registered up to this point in this case). @@ -2047,7 +2046,7 @@ /*! This returns the priority or importance of this node. Nodes with higher priority are registered/probed first. - Currently, only the B_FIND_MULITPLE_CHILDREN flag alters the priority; + Currently, only the B_FIND_MULTIPLE_CHILDREN flag alters the priority; it might make sense to be able to directly set the priority via an attribute. */ From axeld at pinc-software.de Tue Jun 3 23:15:28 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 03 Jun 2008 23:15:28 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r25799_-_haiku/trunk/src/system/kernel/?= =?utf-8?q?device=5Fmanager?= In-Reply-To: <200806032105.m53L5xWj007815@sheep.berlios.de> Message-ID: <51757542339-BeMail@zon> korli at BerliOS wrote: > * a driver can register children and have a fixed child (ie for a bus > manager). Should it really? And even if (which is probably handy indeed, although I don't have a good example), the change is not correct, as it now also allows dynamic children when there shouldn't be any. Bye, Axel. From marcusoverhagen at arcor.de Tue Jun 3 23:55:57 2008 From: marcusoverhagen at arcor.de (Marcus Overhagen) Date: Tue, 03 Jun 2008 23:55:57 +0200 Subject: [Haiku-commits] r25773 - in haiku/trunk: headers/private/kernel/arch/x86 src/system/kernel/arch/x86 In-Reply-To: <200806030437.m534bKgT017729@sheep.berlios.de> References: <200806030437.m534bKgT017729@sheep.berlios.de> Message-ID: <4845BDED.1000500@arcor.de> jackburton at BerliOS schrieb: > +/* Global Capability Register Masks */ > +#define HPET_CAP_MASK_ID 0x00000000000000FF > +#define HPET_CAP_MASK_NUMTIMERS 0x0000000000001F00 > +#define HPET_CAP_MASK_WIDTH 0x0000000000002000 > +#define HPET_CAP_MASK_LEGACY 0x0000000000008000 > +#define HPET_CAP_MASK_VENDOR_ID 0x00000000FFFF0000 > +#define HPET_CAP_MASK_PERIOD 0xFFFFFFFF00000000 I think those defines need ULL appended, to avoid truncation to 32 bit integer. At least the last one probably won't work this way. regards Marcus From korli at users.berlios.de Wed Jun 4 09:09:35 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Wed, 4 Jun 2008 09:09:35 +0200 Subject: [Haiku-commits] r25799 - haiku/trunk/src/system/kernel/device_manager In-Reply-To: <51757542339-BeMail@zon> References: <200806032105.m53L5xWj007815@sheep.berlios.de> <51757542339-BeMail@zon> Message-ID: 2008/6/3 Axel D?rfler : > korli at BerliOS wrote: >> * a driver can register children and have a fixed child (ie for a bus >> manager). > > Should it really? I have the following problem with acpi atm : acpi_root -| |=> acpi_namespace (fixed child for a devfs entry) |=> device1 (dynamic) |=> device2 (dynamic) |=> device3 (dynamic) -| |=> device5 (dynamic) |=> device6 (dynamic) |=> device4 (dynamic) > And even if (which is probably handy indeed, although I don't have a > good example), the change is not correct, as it now also allows dynamic > children when there shouldn't be any. Why shouldn't there be any ? Bye, J?r?me From axeld at pinc-software.de Wed Jun 4 10:27:06 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 04 Jun 2008 10:27:06 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r25799_-_haiku/trunk/src/system/kernel/?= =?utf-8?q?device=5Fmanager?= In-Reply-To: Message-ID: <736262293-BeMail@zon> "J?r?me Duval" wrote: > acpi_root -| > |=> acpi_namespace (fixed child for a devfs entry) You don't need a fixed child for a devfs entry, you would publish it with your other children in register_child_devices(). What should be the purpose of that devfs entry, BTW? I have ACPI on my list as well in the future, so it's very appreciated that you work on that :-) > > And even if (which is probably handy indeed, although I don't have > > a > > good example), the change is not correct, as it now also allows > > dynamic > > children when there shouldn't be any. > Why shouldn't there be any ? Because that's how it works, you either have dynamic or fixed children, never both. Bye, Axel. From axeld at mail.berlios.de Wed Jun 4 12:39:02 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 4 Jun 2008 12:39:02 +0200 Subject: [Haiku-commits] r25800 - in haiku/trunk: headers/os/drivers src/add-ons/kernel/bus_managers/scsi src/add-ons/kernel/generic/block_io src/system/kernel/device_manager src/system/kernel/fs Message-ID: <200806041039.m54Ad2qn016023@sheep.berlios.de> Author: axeld Date: 2008-06-04 12:38:59 +0200 (Wed, 04 Jun 2008) New Revision: 25800 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25800&view=rev Removed: haiku/trunk/headers/os/drivers/pnp_devfs.h Modified: haiku/trunk/src/add-ons/kernel/bus_managers/scsi/scsi.c haiku/trunk/src/add-ons/kernel/generic/block_io/block_io_private.h haiku/trunk/src/system/kernel/device_manager/devfs.cpp haiku/trunk/src/system/kernel/fs/IOScheduler.cpp haiku/trunk/src/system/kernel/fs/IOScheduler.h Log: * Removed the now superfluous pnp_devfs.h header. * There was a leftover in devfs that still needed it. Deleted: haiku/trunk/headers/os/drivers/pnp_devfs.h Modified: haiku/trunk/src/add-ons/kernel/bus_managers/scsi/scsi.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/scsi/scsi.c 2008-06-03 21:05:58 UTC (rev 25799) +++ haiku/trunk/src/add-ons/kernel/bus_managers/scsi/scsi.c 2008-06-04 10:38:59 UTC (rev 25800) @@ -4,7 +4,6 @@ */ #include "scsi_internal.h" -#include locked_pool_interface *locked_pool; device_manager_info *pnp; Modified: haiku/trunk/src/add-ons/kernel/generic/block_io/block_io_private.h =================================================================== --- haiku/trunk/src/add-ons/kernel/generic/block_io/block_io_private.h 2008-06-03 21:05:58 UTC (rev 25799) +++ haiku/trunk/src/add-ons/kernel/generic/block_io/block_io_private.h 2008-06-04 10:38:59 UTC (rev 25800) @@ -10,9 +10,7 @@ */ #include -#include #include -#include #include #include Modified: haiku/trunk/src/system/kernel/device_manager/devfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/devfs.cpp 2008-06-03 21:05:58 UTC (rev 25799) +++ haiku/trunk/src/system/kernel/device_manager/devfs.cpp 2008-06-04 10:38:59 UTC (rev 25800) @@ -450,47 +450,6 @@ } -static pnp_devfs_driver_info * -create_new_driver_info(device_hooks *ops, int32 version) -{ - pnp_devfs_driver_info *info = (pnp_devfs_driver_info *)malloc( - sizeof(pnp_devfs_driver_info)); - if (info == NULL) - return NULL; - - memset(info, 0, sizeof(driver_module_info)); - - info->open = NULL; - // ops->open is used directly for old devices - info->close = ops->close; - info->free = ops->free; - info->control = ops->control; - info->read = ops->read; - info->write = ops->write; - // depends on api_version - info->select = NULL; - info->deselect = NULL; - - info->read_pages = NULL; - info->write_pages = NULL; - // old devices can't know how to do physical page access - - if (version >= 2) { - // According to Be newsletter, vol II, issue 36, - // version 2 added readv/writev, which we don't support, but also - // select/deselect. - info->select = ops->select; - info->deselect = ops->deselect; - - // ops->readv; - // ops->writev; - // we don't implement scatter-gather atm, so ignore those. - } - - return info; -} - - static status_t get_node_for_path(struct devfs *fs, const char *path, struct devfs_vnode **_node) Modified: haiku/trunk/src/system/kernel/fs/IOScheduler.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/IOScheduler.cpp 2008-06-03 21:05:58 UTC (rev 25799) +++ haiku/trunk/src/system/kernel/fs/IOScheduler.cpp 2008-06-04 10:38:59 UTC (rev 25800) @@ -1,7 +1,7 @@ /* -** Copyright 2004, Axel D?rfler, axeld at pinc-software.de. All rights reserved. -** Distributed under the terms of the Haiku License. -*/ + * Copyright 2004-2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ #include "IOScheduler.h" @@ -41,9 +41,9 @@ // #pragma mark - -IOScheduler::IOScheduler(const char *name, pnp_devfs_driver_info *hooks) +IOScheduler::IOScheduler(const char* name, device_module_info* module) : - fDeviceHooks(hooks) + fModule(module) { mutex_init(&fLock, "I/O scheduler queue"); @@ -82,9 +82,9 @@ // ToDo: assume locked memory? if (request.write) - return fDeviceHooks->write(request.cookie, request.offset, (const void *)request.virtual_address, &request.size); + return fModule->write(request.cookie, request.offset, (const void *)request.virtual_address, &request.size); - return fDeviceHooks->read(request.cookie, request.offset, (void *)request.virtual_address, &request.size); + return fModule->read(request.cookie, request.offset, (void *)request.virtual_address, &request.size); } Modified: haiku/trunk/src/system/kernel/fs/IOScheduler.h =================================================================== --- haiku/trunk/src/system/kernel/fs/IOScheduler.h 2008-06-03 21:05:58 UTC (rev 25799) +++ haiku/trunk/src/system/kernel/fs/IOScheduler.h 2008-06-04 10:38:59 UTC (rev 25800) @@ -1,14 +1,12 @@ /* -** Copyright 2004, Axel D?rfler, axeld at pinc-software.de. All rights reserved. -** Distributed under the terms of the Haiku License. -*/ + * Copyright 2004-2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ #ifndef IO_SCHEDULER_H #define IO_SCHEDULER_H -#include -#include -#include +#include #include #include @@ -34,11 +32,11 @@ class IOScheduler { public: - IOScheduler(const char *name, pnp_devfs_driver_info *hooks); + IOScheduler(const char* name, device_module_info* module); ~IOScheduler(); status_t InitCheck() const; - status_t Process(IORequest &request); + status_t Process(IORequest& request); #if 0 static IOScheduler *GetScheduler(); @@ -46,10 +44,10 @@ private: int32 Scheduler(); - static int32 scheduler(void *); + static int32 scheduler(void*); private: - pnp_devfs_driver_info *fDeviceHooks; + device_module_info* fModule; mutex fLock; thread_id fThread; DoublyLinkedList fRequests; From axeld at mail.berlios.de Wed Jun 4 12:50:09 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 4 Jun 2008 12:50:09 +0200 Subject: [Haiku-commits] r25801 - haiku/trunk/src/system/kernel/device_manager Message-ID: <200806041050.m54Ao9d4032664@sheep.berlios.de> Author: axeld Date: 2008-06-04 12:50:06 +0200 (Wed, 04 Jun 2008) New Revision: 25801 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25801&view=rev Modified: haiku/trunk/src/system/kernel/device_manager/device_manager.cpp Log: * While it's okay to allow nodes with fixed children to register their own children, you either have dynamic or fixed children, never both. Modified: haiku/trunk/src/system/kernel/device_manager/device_manager.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/device_manager.cpp 2008-06-04 10:38:59 UTC (rev 25800) +++ haiku/trunk/src/system/kernel/device_manager/device_manager.cpp 2008-06-04 10:50:06 UTC (rev 25801) @@ -1317,15 +1317,12 @@ // We don't uninitialize the driver - this is done by the caller // in order to save reinitializing during driver loading. - uint32 registered; - status = _RegisterFixed(registered); + uint32 registeredFixedCount; + status = _RegisterFixed(registeredFixedCount); if (status != B_OK) { UninitUnusedDriver(); return status; } - if (registered > 0) { - fRegistered = true; - } // Register the children the driver wants @@ -1342,6 +1339,13 @@ } } + if (registeredFixedCount > 0) { + // Nodes with fixed children cannot have any dynamic children, so bail + // out here + fRegistered = true; + return B_OK; + } + // Register all possible child device nodes status = _RegisterDynamic(); From korli at users.berlios.de Wed Jun 4 13:17:02 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Wed, 4 Jun 2008 13:17:02 +0200 Subject: [Haiku-commits] r25799 - haiku/trunk/src/system/kernel/device_manager In-Reply-To: <736262293-BeMail@zon> References: <736262293-BeMail@zon> Message-ID: Hi Axel, 2008/6/4 Axel D?rfler : > "J?r?me Duval" wrote: >> acpi_root -| >> |=> acpi_namespace (fixed child for a devfs entry) > > You don't need a fixed child for a devfs entry, you would publish it > with your other children in register_child_devices(). Will try that. > What should be the purpose of that devfs entry, BTW? I have ACPI on my > list as well in the future, so it's very appreciated that you work on > that :-) it is used to publish a /dev/bus/acpi/namespace entry, then cat /dev/bus/acpi/namespace dumps the acpi tree (not that useful). If you wonder, the current driver lives in src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.c > >> > And even if (which is probably handy indeed, although I don't have >> > a >> > good example), the change is not correct, as it now also allows >> > dynamic >> > children when there shouldn't be any. >> Why shouldn't there be any ? > > Because that's how it works, you either have dynamic or fixed children, > never both. It wasn't the case on the previous device manager, so one cannot know :) BTW when registering a tree of devices in acpi, it seems that a reference has to be acquired on each non-leaf device. If not, the second probe triggers a deletion of non-leaf devices, which is bad. I added a get_parent_node() call to avoid this deletion. Bye, J?r?me From axeld at mail.berlios.de Wed Jun 4 13:40:01 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 4 Jun 2008 13:40:01 +0200 Subject: [Haiku-commits] r25802 - haiku/trunk/docs/develop/kernel Message-ID: <200806041140.m54Be1D2004829@sheep.berlios.de> Author: axeld Date: 2008-06-04 13:40:00 +0200 (Wed, 04 Jun 2008) New Revision: 25802 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25802&view=rev Modified: haiku/trunk/docs/develop/kernel/device_manager_introduction.html Log: More or less completed the introduction. I would just want to add the image, and publish it on the website - comments are still welcome, though. Modified: haiku/trunk/docs/develop/kernel/device_manager_introduction.html =================================================================== --- haiku/trunk/docs/develop/kernel/device_manager_introduction.html 2008-06-04 10:50:06 UTC (rev 25801) +++ haiku/trunk/docs/develop/kernel/device_manager_introduction.html 2008-06-04 11:40:00 UTC (rev 25802) @@ -11,7 +11,7 @@ although most of its details are already specificed.

-

1. The Basics

+

1. The Basics

The device manager functionality builds upon device_node objects. Every driver in the system publishes one or more of such nodes, building a @@ -36,7 +36,7 @@ userland applications. All drivers and devices are kernel modules.

-

2. Exploring the Device Tree

+

2. Exploring the Device Tree

So how does it all work? When building the initial device tree, the system only explores a minimum of device drivers only, resulting in a tree that basically @@ -55,10 +55,15 @@ are in a matching module directory. In the above example of a disk driver, this would be either in "busses/scsi", "busses/ide", "drivers/disk", ...

-TODO: untyped/generic busses are not yet supported! +

For untyped or generic busses, it will use the context information gained +from the devfs query directly, and will search for drivers in that sub directory +only. The only exception to this rule are the devfs directories "disk", "ports", +and "bus", which will also allow to search matching drivers in "busses". While +this is relatively limited, it is a good way to cut down the number of drivers +to be loaded.

-

3. Writing a Driver

+

3. Writing a Driver

The device manager assumes the following API from a driver module:

    @@ -92,6 +97,7 @@
  • resume()
    Resumes a device from a previous sleep mode.
+

To ensure that a module exports this API, it must end its module name with "driver_v1" to denote the version of the API it supports. Note that suspend() and resume() are currently never called, as Haiku has @@ -100,6 +106,7 @@

If your driver can give the device it is attached to a nice name that can be presented to the user, it should add the B_DEVICE_PRETTY_NAME attribute to the device node. +

The B_DEVICE_UNIQUE_ID should be used in case the device has a unique ID that can be used to identify it, and also differentiate it from other devices of the same model and vendor. This information will be added to the file system @@ -107,15 +114,21 @@ can identify, say, a USB printer no matter what USB slot it is attached to, and assign it additional data, like paper configuration, or recognize it as the default printer.

+

If your driver implements an API that is used by a support or bus module, you will usually use the B_DEVICE_FIXED_CHILD attribute to specify exactly which child device node you will be talking to. If you support several child nodes, you may want to have a closer look at the section explaining how to write a bus driver.

+

In addition to the child nodes a driver registers itself, a driver can either +have dynamic children or fixed children, never both. Also, fixed children are +registered before register_child_devices() is called, while dynamic +children are registered afterwards.

-

4. Publishing a Device

+

4. Publishing a Device

+ To publish a device entry in the device file system under /dev, all your driver has to do is to call the
@@ -166,7 +179,7 @@
 
 
 
-

5. Writing a Bus Driver

+

5. Writing a Bus Driver

A bus driver is a driver that represents a bus where one or more arbitrary devices can be attached to.

@@ -211,11 +224,28 @@

5.2. Writing a Simple Bus Driver

-TODO: support for these drivers is still missing! +

A bus can be simple in a number of ways:

+
    +
  1. It may not know how many or if any devices are attached to it
  2. +
  3. It cannot retrieve any type information about the devices it has, but + knows all devices that are attached to it
  4. +
+

An example of the latter would be the Zorro bus of the Amiga - it only has +information about the vendor and device ID, but no type information. It should +be implemented like an intelligent bus, though, with the type information simply +omitted.

-

6. Open Issues

+

Therefore, this section is about the former case, that is, a simple bus like +the ISA bus. Since it doesn't know anything about its children, it does not +publish any child nodes, instead, it will just specify the +B_FIND_MULTIPLE_CHILDREN and B_FIND_CHILD_ON_DEMAND flags for its device node. +Since there are no additional informations about this bus, the device manager +will assume a simple bus, and will try to find drivers on demand only.

+ +

6. Open Issues

+ While most of the new device manager is fledged out, there are some areas that could use improvements or are problematic under certain requirements. Also, some parts just haven't been written yet. @@ -245,5 +275,39 @@

6.5. Unregistering Nodes

+

6.6. Support for generic drivers is missing

+ +

This should probably be done by simply adding a simple bus driver named +"generic" that generic drivers need to ask for.

+ +

6.7. Mappings, And Other Optimizations

+ +

Due to the way the device tree is built, the device manager could remember +which driver served a given device node. That way, it wouldn't need to search +for a driver anymore, but could just pick it up. Practically, the device manager +should cache the type (and/or vendor/device) information of a node, and assign +one or more drivers (via module name) to this information. It should also +remember negative outcome, that is if there is no driver supporting the +hardware.

+ +

This way, only the first boot would require an actual search for drivers, as +subsequent boots would reuse the type-driver assignments. If a new driver is +installed, the cached assignments would need to be updated immediately. If a +driver has been installed outside of the running system, the device manager +might want to create a hash per module directory to see if anything changed to +flush the cache. Alternatively or additionally, the boot loader could have a +menu causing the cache to be ignored.

+ +

It would be nice to find a way for generic and simple busses to reduce the +amount of searching necessary for them. One way would be to remember which +driver supports which bus - but this information is currently only accessible +derived from what the driver does, and is therefore not reliable or complete. +A separately exported information would be necessary for this.

+ +

Also, when looking for a generic or simple bus driver, actual directories +could be omitted; currently, driver search is always recursive, as that's how +the module mechanism is working. Eventually, we might want to extend the +open_module_list_etc() call a bit more to accomplish that.

+ From axeld at pinc-software.de Wed Jun 4 13:46:38 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 04 Jun 2008 13:46:38 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r25799_-_haiku/trunk/src/system/kernel/?= =?utf-8?q?device=5Fmanager?= In-Reply-To: Message-ID: <12708970478-BeMail@zon> "J?r?me Duval" wrote: > it is used to publish a /dev/bus/acpi/namespace entry, then cat > /dev/bus/acpi/namespace dumps the acpi tree (not that useful). > If you wonder, the current driver lives in > src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.c If it's not useful, we could also just remove it ;-)) But for debugging purposes, it probably okay to keep it for now. > > Because that's how it works, you either have dynamic or fixed > > children, > > never both. > It wasn't the case on the previous device manager, so one cannot know > :) With the old device manager, you would need to specify a mapping to have dynamic children; this way you could probably manage to have both. But it doesn't work like this anymore. > BTW when registering a tree of devices in acpi, it seems that a > reference has to be acquired on each non-leaf device. If not, the > second probe triggers a deletion of non-leaf devices, which is bad. I > added a get_parent_node() call to avoid this deletion. That sounds like you would do something wrong. A child must always have a reference to its parent; the device_node::AddChild() method takes care of that. You might want to have a look at the output of the device tree at different stages (it contains the reference count as well), to see where it goes wrong. Bye, Axel. From korli at users.berlios.de Wed Jun 4 13:55:49 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Wed, 4 Jun 2008 13:55:49 +0200 Subject: [Haiku-commits] r25799 - haiku/trunk/src/system/kernel/device_manager In-Reply-To: <12708970478-BeMail@zon> References: <12708970478-BeMail@zon> Message-ID: 2008/6/4 Axel D?rfler : > If it's not useful, we could also just remove it ;-)) > But for debugging purposes, it probably okay to keep it for now. At least it could help to check this specific use of the device manager. > That sounds like you would do something wrong. A child must always have > a reference to its parent; the device_node::AddChild() method takes > care of that. AddChild() is not a public method for drivers AFAICT. I used register_node for this reason. > You might want to have a look at the output of the device tree at > different stages (it contains the reference count as well), to see > where it goes wrong. Did so. I wasn't sure of which values I should expect though :) Bye, J?r?me From axeld at pinc-software.de Wed Jun 4 14:31:12 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 04 Jun 2008 14:31:12 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r25799_-_haiku/trunk/src/system/kernel/?= =?utf-8?q?device=5Fmanager?= In-Reply-To: Message-ID: <15382146662-BeMail@zon> "J?r?me Duval" wrote: > 2008/6/4 Axel D?rfler : > > That sounds like you would do something wrong. A child must always > > have > > a reference to its parent; the device_node::AddChild() method takes > > care of that. > AddChild() is not a public method for drivers AFAICT. I used > register_node for this reason. AddChild() is called implicitly for all device nodes that are added to the tree; they don't lose that reference unless they are explicitly removed. > > You might want to have a look at the output of the device tree at > > different stages (it contains the reference count as well), to see > > where it goes wrong. > Did so. I wasn't sure of which values I should expect though :) Every node has a reference of 1 when starting. When a node is removed, it loses that reference, typically causing it to be deleted. Every node keeps a reference to its parent - therefore, the parent cannot go away before the child. Also, when the child is called, the parent is always initialized (causing one extra ref + initialized). To see how it should look like for a simple situation, you can check out the "device_manager_test" app in src/tests/system/kernel/ device_manager/. Bye, Axel. From mmlr at mail.berlios.de Wed Jun 4 19:56:31 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Wed, 4 Jun 2008 19:56:31 +0200 Subject: [Haiku-commits] r25803 - in haiku/trunk: build/config_headers headers/private/kernel src/system/kernel/arch/x86 Message-ID: <200806041756.m54HuVtQ009594@sheep.berlios.de> Author: mmlr Date: 2008-06-04 19:56:30 +0200 (Wed, 04 Jun 2008) New Revision: 25803 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25803&view=rev Added: haiku/trunk/build/config_headers/kernel_debugger_config.h haiku/trunk/headers/private/kernel/debugger_keymaps.h Modified: haiku/trunk/src/system/kernel/arch/x86/arch_debug_console.c Log: * Extract the KDL keymap to a separate header and provide a 'sg' swiss german keymap there too. * Add a config header where one can select what KDL keymap should be used (currently only 'us' and 'sg' are available though). * Provide a third keymap that is used when the alt modifier is used (the swiss german keymap is pretty useless without alt as all the useful keys like backslash and curly braces use alt). Our KDL is so powerful and nice to use, the only thing that bothered me was that I always had to think about where some of the special keys are located in the US keymap. So this simple compile-time keymap switching provided to be helpful for me and might be for others too. Keymaps for other layouts obviously have to be written before this becomes really useful. Added: haiku/trunk/build/config_headers/kernel_debugger_config.h =================================================================== --- haiku/trunk/build/config_headers/kernel_debugger_config.h 2008-06-04 11:40:00 UTC (rev 25802) +++ haiku/trunk/build/config_headers/kernel_debugger_config.h 2008-06-04 17:56:30 UTC (rev 25803) @@ -0,0 +1,10 @@ +#ifndef KERNEL_DEBUGGER_CONFIG_H +#define KERNEL_DEBUGGER_CONFIG_H + +// Available keymaps: +// 'us' default US keymap +// 'sg' swiss-german keymap +#define KDL_KEYMAP 'us' + + +#endif // KERNEL_DEBUGGER_CONFIG_H Added: haiku/trunk/headers/private/kernel/debugger_keymaps.h =================================================================== --- haiku/trunk/headers/private/kernel/debugger_keymaps.h 2008-06-04 11:40:00 UTC (rev 25802) +++ haiku/trunk/headers/private/kernel/debugger_keymaps.h 2008-06-04 17:56:30 UTC (rev 25803) @@ -0,0 +1,80 @@ +/* + * Copyright 2008, Michael Lotz + * Distributed under the terms of the Haiku License. + */ +#ifndef DEBUGGER_KEYMAPS_H +#define DEBUGGER_KEYMAPS_H + +#include "kernel_debugger_config.h" + +#if KDL_KEYMAP == 'sg' +const char kUnshiftedKeymap[128] = { + 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '\'', '^', 8, '\t', + 'q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 0, 0, '\n', 0, 'a', 's', + 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0, 0, 0, 0, '$', 'y', 'x', 'c', 'v', + 'b', 'n', 'm', ',', '.', '-', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '-', 0, 0, 0, '+', 0, + 0, 0, 0, 0, 0, 0, '<', 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static const char kShiftedKeymap[128] = { + 0, 27, '+', '"', '*', 0, '%', '&', '/', '(', ')', '=', '?', '`', 8, '\t', + 'Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 0, '!', '\n', 0, 'A', 'S', + 'D', 'F', 'G', 'H', 'J', 'K', 'L', 0, 0, 0, 0, 0, 'Y', 'X', 'C', 'V', + 'B', 'N', 'M', ';', ':', '_', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, '>', 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static const char kAltedKeymap[128] = { + 0, 27, 0, '@', '#', 0, 0, 0, '|', 0, 0, 0, 0, '~', 8, '\t', + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '[', ']', 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, '{', 0, 0, '}', 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, '\\', 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +#else // default US keymap + +static const char kUnshiftedKeymap[128] = { + 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 8, '\t', + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', 0, 'a', 's', + 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', 0, '\\', 'z', 'x', 'c', 'v', + 'b', 'n', 'm', ',', '.', '/', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\\', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static const char kShiftedKeymap[128] = { + 0, 27, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', 8, '\t', + 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', '\n', 0, 'A', 'S', + 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '~', 0, '|', 'Z', 'X', 'C', 'V', + 'B', 'N', 'M', '<', '>', '?', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static const char kAltedKeymap[128] = { + 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 8, '\t', + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', 0, 'a', 's', + 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', 0, '\\', 'z', 'x', 'c', 'v', + 'b', 'n', 'm', ',', '.', '/', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\\', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +#endif +#endif // DEBUGGER_KEYMAPS_H Modified: haiku/trunk/src/system/kernel/arch/x86/arch_debug_console.c =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_debug_console.c 2008-06-04 11:40:00 UTC (rev 25802) +++ haiku/trunk/src/system/kernel/arch/x86/arch_debug_console.c 2008-06-04 17:56:30 UTC (rev 25803) @@ -7,8 +7,7 @@ * Copyright 2001, Travis Geiselbrecht. All rights reserved. * Distributed under the terms of the NewOS License. */ - - +#include "debugger_keymaps.h" #include "ps2_defs.h" #include @@ -67,30 +66,8 @@ F12 = 88, }; -static const char kUnshiftedKeymap[128] = { - 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 8, '\t', - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', 0, 'a', 's', - 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', 0, '\\', 'z', 'x', 'c', 'v', - 'b', 'n', 'm', ',', '.', '/', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - '\\', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; -static const char kShiftedKeymap[128] = { - 0, 27, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', 8, '\t', - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', '\n', 0, 'A', 'S', - 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '~', 0, '|', 'Z', 'X', 'C', 'V', - 'B', 'N', 'M', '<', '>', '?', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - static const uint32 kSerialBaudRate = 115200; - static uint16 sSerialBasePort = 0x3f8; // COM1 is the default debug output port @@ -317,6 +294,9 @@ return 0x1f & c; } + if (altPressed) + return kAltedKeymap[key]; + return shiftPressed ? kShiftedKeymap[key] : kUnshiftedKeymap[key]; } From emitrax at gmail.com Wed Jun 4 20:08:55 2008 From: emitrax at gmail.com (Salvatore Benedetto) Date: Wed, 4 Jun 2008 18:08:55 +0000 Subject: [Haiku-commits] r25802 - haiku/trunk/docs/develop/kernel In-Reply-To: <200806041140.m54Be1D2004829@sheep.berlios.de> References: <200806041140.m54Be1D2004829@sheep.berlios.de> Message-ID: Personally I haven't had the time to read it, but I definitely will soon. Thanks again for your great work! Hope to finally see the usb_scsi port completed! ;-) Regards, -- Salvatore Benedetto (a.k.a. emitrax) Student of Computer Engineer University of Pisa www.haiku-os.it From anevilyak at gmail.com Wed Jun 4 20:35:27 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Wed, 4 Jun 2008 13:35:27 -0500 Subject: [Haiku-commits] r25803 - in haiku/trunk: build/config_headers headers/private/kernel src/system/kernel/arch/x86 In-Reply-To: <200806041756.m54HuVtQ009594@sheep.berlios.de> References: <200806041756.m54HuVtQ009594@sheep.berlios.de> Message-ID: > Our KDL is so powerful and nice to use, the only thing that bothered me was > that I always had to think about where some of the special keys are located in > the US keymap. So this simple compile-time keymap switching provided to be > helpful for me and might be for others too. Keymaps for other layouts obviously > have to be written before this becomes really useful. > Is there no feasible way to reconfigure the KDL keyboard layout on the fly to match the system selected one? Regards, Rene From mmlr at mail.berlios.de Wed Jun 4 20:37:29 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Wed, 4 Jun 2008 20:37:29 +0200 Subject: [Haiku-commits] r25804 - haiku/trunk/src/system/kernel/debug Message-ID: <200806041837.m54IbTX1014202@sheep.berlios.de> Author: mmlr Date: 2008-06-04 20:37:29 +0200 (Wed, 04 Jun 2008) New Revision: 25804 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25804&view=rev Modified: haiku/trunk/src/system/kernel/debug/debug.cpp Log: Add a welcome message including the revision number when initializing the syslog so syslogs always contain the revision number too (as does serial output). This is only necessary because the early part of the serial output (that contains the revision number) does not make it into the syslog. So fixing that might be the better way. Modified: haiku/trunk/src/system/kernel/debug/debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug.cpp 2008-06-04 17:56:30 UTC (rev 25803) +++ haiku/trunk/src/system/kernel/debug/debug.cpp 2008-06-04 18:37:29 UTC (rev 25804) @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -832,6 +833,7 @@ syslog_init(struct kernel_args *args) { status_t status; + int32 length = 0; if (!sSyslogOutputEnabled) return B_OK; @@ -858,6 +860,11 @@ if (args->debug_output != NULL) syslog_write((const char*)args->debug_output, args->debug_size); + char revisionBuffer[64]; + length = snprintf(revisionBuffer, sizeof(revisionBuffer), + "Welcome to syslog debug output!\nHaiku revision: %lu\n", + get_haiku_revision()); + syslog_write(revisionBuffer, length); return B_OK; err3: From mmlr at mlotz.ch Wed Jun 4 20:51:10 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Wed, 04 Jun 2008 20:51:10 +0200 Subject: [Haiku-commits] =?windows-1252?q?r25803_-_in_haiku/trunk=3A_build?= =?windows-1252?q?/config=5Fheaders_headers/private/kernel__src/system/ker?= =?windows-1252?q?nel/arch/x86?= In-Reply-To: Message-ID: <874937783-BeMail@primary> > > Our KDL is so powerful and nice to use, the only thing that > > bothered me was > > that I always had to think about where some of the special keys are > > located in > > the US keymap. So this simple compile-time keymap switching > > provided to be > > helpful for me and might be for others too. Keymaps for other > > layouts obviously > > have to be written before this becomes really useful. > > Is there no feasible way to reconfigure the KDL keyboard layout on > the > fly to match the system selected one? That would be a bit more involved. For one the normal keymaps and the KDL keymaps are not really compatible. The KDL keymap is really only three tables that translate keycodes as array index to characters while the input_server keymaps are a bit more complex and provide much more custom mappings (AFAIR at least). That would probably require some parsing on the kernel debugger side that is probably not really worth the effort. Also when entering KDL you normally don't want to rely on too many things, so accessing the disk to get the current keymap from a settings file would probably not be something you would want to do. It would of course be possible to compile in all available KDL keymaps and then allow to switch them while in KDL. I just figured if someone really wanted to use the kernel debugger intensively and is limited by the US keymap, then that person probably has a local Haiku tree and knows how to switch those anyway. Regards Michael From anevilyak at gmail.com Wed Jun 4 20:57:18 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Wed, 4 Jun 2008 13:57:18 -0500 Subject: [Haiku-commits] r25803 - in haiku/trunk: build/config_headers headers/private/kernel src/system/kernel/arch/x86 In-Reply-To: <874937783-BeMail@primary> References: <874937783-BeMail@primary> Message-ID: On Wed, Jun 4, 2008 at 1:51 PM, Michael Lotz wrote: > That would be a bit more involved. For one the normal keymaps and the > KDL keymaps are not really compatible. The KDL keymap is really only > three tables that translate keycodes as array index to characters while > the input_server keymaps are a bit more complex and provide much more > custom mappings (AFAIR at least). That would probably require some > parsing on the kernel debugger side that is probably not really worth > the effort. Also when entering KDL you normally don't want to rely on > too many things, so accessing the disk to get the current keymap from a > settings file would probably not be something you would want to do. Well, I didn't mean so much having it use the on-disk one as, say, having the keymap preflet invoke a syscall to force the kernel to update its in mem tables to match the current map, ignoring any special stuff it doesn't understand. > > It would of course be possible to compile in all available KDL keymaps > and then allow to switch them while in KDL. I just figured if someone > really wanted to use the kernel debugger intensively and is limited by > the US keymap, then that person probably has a local Haiku tree and > knows how to switch those anyway. True. Alternatively we could also modify the build tool that generates the binary keymap files to also generate the appropriate kdebug keymap headers too, instead of making manual copies in the tree of each one, no? Regards, Rene From axeld at pinc-software.de Wed Jun 4 22:18:18 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 04 Jun 2008 22:18:18 +0200 CEST Subject: [Haiku-commits] r25804 - haiku/trunk/src/system/kernel/debug In-Reply-To: <200806041837.m54IbTX1014202@sheep.berlios.de> Message-ID: <43408099722-BeMail@zon> mmlr at BerliOS wrote: > This is only necessary because the early part of the serial output > (that > contains the revision number) does not make it into the syslog. So > fixing that > might be the better way. Definitely :-) Enlarging some buffers might do wonders. This can be changed again once our debug output can be cut down to something acceptable for daily use. Bye, Axel. From axeld at pinc-software.de Wed Jun 4 22:21:18 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 04 Jun 2008 22:21:18 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r25803_-_in_haiku/trunk=3A_build/config?= =?utf-8?q?=5Fheaders_headers/private/kernel__src/system/kernel/arch/x86?= In-Reply-To: Message-ID: <43588843037-BeMail@zon> "Rene Gollent" wrote: > > Our KDL is so powerful and nice to use, the only thing that > > bothered me was > > that I always had to think about where some of the special keys are > > located in > > the US keymap. So this simple compile-time keymap switching > > provided to be > > helpful for me and might be for others too. Keymaps for other > > layouts obviously > > have to be written before this becomes really useful. > Is there no feasible way to reconfigure the KDL keyboard layout on > the > fly to match the system selected one? For gods sake, its the kernel debugger. It won't get localized either ; -) IMO the US keymap is acceptable for everyone (well, now at least you can change the keymap at compile time which is a compromise). Bye, Axel. From mmlr at mlotz.ch Wed Jun 4 22:48:34 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Wed, 04 Jun 2008 22:48:34 +0200 Subject: [Haiku-commits] r25803 - in haiku/trunk: build/config_headers headers/private/kernel src/system/kernel/arch/x86 In-Reply-To: <43588843037-BeMail@zon> Message-ID: <7918854970-BeMail@primary> > "Rene Gollent" wrote: > > > Our KDL is so powerful and nice to use, the only thing that > > > bothered me was > > > that I always had to think about where some of the special keys > > > are > > > located in > > > the US keymap. So this simple compile-time keymap switching > > > provided to be > > > helpful for me and might be for others too. Keymaps for other > > > layouts obviously > > > have to be written before this becomes really useful. > > Is there no feasible way to reconfigure the KDL keyboard layout on > > the > > fly to match the system selected one? > > For gods sake, its the kernel debugger. It won't get localized either > ;-) Are you sure about that ;-) > IMO the US keymap is acceptable for everyone (well, now at least you > can change the keymap at compile time which is a compromise). While I understand that it is a non-issue to use the US keymap if you are used to it, it was always a bit difficult for me. I use the kernel debugger only semi-frequently, so I am not really used to use a US keymap. Especially when debugging something in QEMU while writing code besides, I always used the wrong keys in one or the other a few times at first (and I get annoyed by such unnecessary things pretty quickly ; -). It is just way easier when you can type ahead and don't have to worry about different keymaps at all. The compromise to be able to switch it at compile time gets the job done, was simple enough to implement and doesn't really add any complexity to the debugger. Regards Michael From axeld at pinc-software.de Wed Jun 4 23:17:51 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 04 Jun 2008 23:17:51 +0200 CEST Subject: [Haiku-commits] r25803 - in haiku/trunk: build/config_headers headers/private/kernel src/system/kernel/arch/x86 In-Reply-To: <7918854970-BeMail@primary> Message-ID: <46981657643-BeMail@zon> "Michael Lotz" wrote: > > For gods sake, its the kernel debugger. It won't get localized > > either > > ;-) > Are you sure about that ;-) Maybe I should have added: while I'm alive ;-) > While I understand that it is a non-issue to use the US keymap if you > are used to it, There was a time that I wasn't, but I had a laptop with a US keymap for quite some time, and switched to the US keymap permanently at some point :-) [...] > The compromise to be able to > switch it at compile time gets the job done, was simple enough to > implement and doesn't really add any complexity to the debugger. And that's why it's a good compromise that I can easily live with :-) Bye, Axel. From korli at mail.berlios.de Thu Jun 5 01:05:03 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Thu, 5 Jun 2008 01:05:03 +0200 Subject: [Haiku-commits] r25805 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi Message-ID: <200806042305.m54N532Z021333@sheep.berlios.de> Author: korli Date: 2008-06-05 01:05:02 +0200 (Thu, 05 Jun 2008) New Revision: 25805 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25805&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_device.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h Log: converted acpi to the new device architecture Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_device.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_device.c 2008-06-04 18:37:29 UTC (rev 25804) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_device.c 2008-06-04 23:05:02 UTC (rev 25805) @@ -14,7 +14,7 @@ typedef struct acpi_device_info { char *path; // path uint32 type; // type - device_node_handle node; + device_node *node; char name[32]; // name (for fast log) } acpi_device_info; @@ -44,9 +44,9 @@ static status_t -acpi_device_init_driver(device_node_handle node, void *user_cookie, void **cookie) +acpi_device_init_driver(device_node *node, void **cookie) { - char *path; + const char *path; acpi_device_info *device; status_t status = B_OK; uint32 type; @@ -57,14 +57,12 @@ return B_ERROR; device = malloc(sizeof(*device)); - if (device == NULL) { - free(path); + if (device == NULL) return B_NO_MEMORY; - } memset(device, 0, sizeof(*device)); - device->path = path; + device->path = strdup(path); device->type = type; device->node = node; @@ -83,14 +81,13 @@ } -static status_t +static void acpi_device_uninit_driver(void *cookie) { acpi_device_info *device = cookie; free(device->path); free(device); - return B_OK; } @@ -118,9 +115,9 @@ NULL, // register device (our parent registered us) acpi_device_init_driver, acpi_device_uninit_driver, - NULL, // removed - NULL, // cleanup - NULL, // get supported paths + NULL, // register child devices + NULL, // rescan devices + NULL, // device removed }, acpi_get_object_type, acpi_get_object, Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c 2008-06-04 18:37:29 UTC (rev 25804) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c 2008-06-04 23:05:02 UTC (rev 25805) @@ -33,64 +33,53 @@ static float -acpi_module_supports_device(device_node_handle parent, bool *_noConnection) +acpi_module_supports_device(device_node *parent) { - char *bus; + const char *bus; // make sure parent is really device root - if (gDeviceManager->get_attr_string(parent, B_DRIVER_BUS, &bus, false)) + if (gDeviceManager->get_attr_string(parent, B_DEVICE_BUS, &bus, false)) return B_ERROR; - if (strcmp(bus, "root")) { - free(bus); + if (strcmp(bus, "root")) return 0.0; - } - - free(bus); + return 1.0; } static status_t -acpi_module_register_device(device_node_handle parent) +acpi_module_register_device(device_node *parent) { device_attr attrs[] = { - // info about ourself - { B_DRIVER_MODULE, B_STRING_TYPE, { string: ACPI_ROOT_MODULE_NAME }}, - // unique connection name - { PNP_DRIVER_CONNECTION, B_STRING_TYPE, { string: "ACPI" }}, - - // mark as being a bus - { PNP_BUS_IS_BUS, B_UINT8_TYPE, { ui8: 1 }}, - // search for device drivers once all devices are detected - //{ PNP_BUS_DEFER_PROBE, B_UINT8_TYPE, { ui8: 1 }}, - // don't scan if loaded as we own I/O resources - //{ PNP_DRIVER_NO_LIVE_RESCAN, B_UINT8_TYPE, { ui8: 1 }}, + { B_DEVICE_PRETTY_NAME, B_STRING_TYPE, { string: "ACPI" }}, - // tell ns dump driver to register a device in devfs - { B_DRIVER_FIXED_CHILD, B_STRING_TYPE, { string: ACPI_NS_DUMP_MODULE_NAME }}, + { B_DEVICE_FLAGS, B_UINT32_TYPE, { ui32: B_KEEP_DRIVER_LOADED }}, {} }; - io_resource_handle *resourceHandles = NULL; - device_node_handle node; - - return gDeviceManager->register_device(parent, attrs, resourceHandles, &node); + io_resource *resources = NULL; + + return gDeviceManager->register_node(parent, ACPI_ROOT_MODULE_NAME, attrs, resources, NULL); } static status_t -acpi_enumerate_child_devices(device_node_handle node, const char *root) +acpi_enumerate_child_devices(device_node *node, const char *root) { char result[255]; void *counter = NULL; + device_node *parent = NULL; TRACE(("acpi_enumerate_child_devices: recursing from %s\n", root)); + // get a reference on the parent + parent = gDeviceManager->get_parent_node(node); + while (get_next_entry(ACPI_TYPE_ANY, root, result, 255, &counter) == B_OK) { uint32 type = get_object_type(result); - device_node_handle deviceNode; + device_node *deviceNode; if (!strcmp("\\_PR_", result) || !strcmp("\\_TZ_", result) || !strcmp("\\_SI_", result) || !strcmp("\\_SB_", result)) { @@ -103,10 +92,8 @@ char hid[9] = ""; device_attr attrs[] = { // info about device - { B_DRIVER_MODULE, B_STRING_TYPE, { string: ACPI_DEVICE_MODULE_NAME }}, - { PNP_DRIVER_CONNECTION, B_STRING_TYPE, { string: - "path: %"ACPI_DEVICE_PATH_ITEM"%" }}, - + { B_DEVICE_BUS, B_STRING_TYPE, { string: "acpi" }}, + // location on ACPI bus { ACPI_DEVICE_PATH_ITEM, B_STRING_TYPE, { string: result }}, @@ -115,17 +102,17 @@ { ACPI_DEVICE_TYPE_ITEM, B_UINT32_TYPE, { ui32: type }}, // consumer specification - { B_DRIVER_BUS, B_STRING_TYPE, { string: "acpi" }}, - { B_DRIVER_MAPPING, B_STRING_TYPE, { string: + /*{ B_DRIVER_MAPPING, B_STRING_TYPE, { string: "hid_%" ACPI_DEVICE_HID_ITEM "%" }}, { B_DRIVER_MAPPING "/0", B_STRING_TYPE, { string: - "type_%" ACPI_DEVICE_TYPE_ITEM "%" }}, + "type_%" ACPI_DEVICE_TYPE_ITEM "%" }},*/ + { B_DEVICE_FLAGS, B_UINT32_TYPE, { ui32: B_FIND_CHILD_ON_DEMAND }}, { NULL } }; get_device_hid(result, hid); - - if (gDeviceManager->register_device(node, attrs, NULL, &deviceNode) == B_OK) + + if (gDeviceManager->register_node(node, ACPI_DEVICE_MODULE_NAME, attrs, NULL, &deviceNode) == B_OK) acpi_enumerate_child_devices(deviceNode, result); break; } @@ -134,10 +121,8 @@ case ACPI_TYPE_THERMAL: { device_attr attrs[] = { // info about device - { B_DRIVER_MODULE, B_STRING_TYPE, { string: ACPI_DEVICE_MODULE_NAME }}, - { PNP_DRIVER_CONNECTION, B_STRING_TYPE, { string: - "path: %"ACPI_DEVICE_PATH_ITEM"%" }}, - + { B_DEVICE_BUS, B_STRING_TYPE, { string: "acpi" }}, + // location on ACPI bus { ACPI_DEVICE_PATH_ITEM, B_STRING_TYPE, { string: result }}, @@ -145,13 +130,13 @@ { ACPI_DEVICE_TYPE_ITEM, B_UINT32_TYPE, { ui32: type }}, // consumer specification - { B_DRIVER_BUS, B_STRING_TYPE, { string: "acpi" }}, - { B_DRIVER_MAPPING, B_STRING_TYPE, { string: - "type_%" ACPI_DEVICE_TYPE_ITEM "%" }}, + /*{ B_DRIVER_MAPPING, B_STRING_TYPE, { string: + "type_%" ACPI_DEVICE_TYPE_ITEM "%" }},*/ + { B_DEVICE_FLAGS, B_UINT32_TYPE, { ui32: B_FIND_CHILD_ON_DEMAND }}, { NULL } }; - if (gDeviceManager->register_device(node, attrs, NULL, &deviceNode) == B_OK) + if (gDeviceManager->register_node(node, ACPI_DEVICE_MODULE_NAME, attrs, NULL, &deviceNode) == B_OK) acpi_enumerate_child_devices(deviceNode, result); break; } @@ -169,33 +154,29 @@ static status_t acpi_module_register_child_devices(void *cookie) { - device_node_handle node = cookie; + status_t err; + device_node *node = cookie; + + err = gDeviceManager->publish_device(node, "acpi/namespace", ACPI_NS_DUMP_DEVICE_MODULE_NAME); + if (err != B_OK) { + return err; + } + return acpi_enumerate_child_devices(node, "\\"); } -static void -acpi_module_get_paths(const char ***_bus, const char ***_device) -{ - static const char *kBus[] = {"root", NULL}; - - *_bus = kBus; - *_device = NULL; -} - - static status_t -acpi_module_init(device_node_handle node, void *user_cookie, void **_cookie) +acpi_module_init(device_node *node, void **_cookie) { *_cookie = node; return B_OK; } -static status_t +static void acpi_module_uninit(void *cookie) { - return B_OK; } @@ -221,23 +202,18 @@ static struct acpi_root_info sACPIModule = { { { - { - ACPI_ROOT_MODULE_NAME, - 0, - apci_module_std_ops - }, - - acpi_module_supports_device, - acpi_module_register_device, - acpi_module_init, - acpi_module_uninit, - NULL, // removed - NULL, // cleanup - acpi_module_get_paths, + ACPI_ROOT_MODULE_NAME, + 0, + apci_module_std_ops }, + acpi_module_supports_device, + acpi_module_register_device, + acpi_module_init, + acpi_module_uninit, acpi_module_register_child_devices, - NULL, // rescan bus + NULL, // rescan devices + NULL, // device removed }, enable_fixed_event, Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.c 2008-06-04 18:37:29 UTC (rev 25804) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.c 2008-06-04 23:05:02 UTC (rev 25805) @@ -13,7 +13,7 @@ typedef struct acpi_ns_device_info { - device_node_handle node; + device_node *node; acpi_root_info *acpi; void *acpi_cookie; } acpi_ns_device_info; @@ -104,8 +104,9 @@ ----- */ static status_t -acpi_namespace_open(acpi_ns_device_info *device, uint32 flags, void** cookie) +acpi_namespace_open(void *_cookie, const char* path, int flags, void** cookie) { + acpi_ns_device_info *device = (acpi_ns_device_info *)_cookie; dprintf("\nacpi_ns_dump: device_open\n"); *cookie = device; @@ -117,8 +118,9 @@ acpi_namespace_read - handle read() calls ----- */ static status_t -acpi_namespace_read (acpi_ns_device_info *device, off_t position, void *buf, size_t* num_bytes) +acpi_namespace_read(void *_cookie, off_t position, void *buf, size_t* num_bytes) { + acpi_ns_device_info *device = (acpi_ns_device_info *)_cookie; size_t bytes = 0; if (position == 0) { // First read @@ -143,7 +145,7 @@ ----- */ static status_t -acpi_namespace_write (void* cookie, off_t position, const void* buffer, size_t* num_bytes) +acpi_namespace_write(void* cookie, off_t position, const void* buffer, size_t* num_bytes) { dprintf("acpi_ns_dump: device_write\n"); *num_bytes = 0; /* tell caller nothing was written */ @@ -156,7 +158,7 @@ ----- */ static status_t -acpi_namespace_control (void* cookie, uint32 op, void* arg, size_t len) +acpi_namespace_control(void* cookie, uint32 op, void* arg, size_t len) { dprintf("acpi_ns_dump: device_control\n"); return B_BAD_VALUE; @@ -168,7 +170,7 @@ ----- */ static status_t -acpi_namespace_close (void* cookie) +acpi_namespace_close(void* cookie) { dprintf("acpi_ns_dump: device_close\n"); return B_OK; @@ -180,7 +182,7 @@ all i/o is complete. ----- */ static status_t -acpi_namespace_free (void* cookie) +acpi_namespace_free(void* cookie) { dprintf("acpi_ns_dump: device_free\n"); @@ -188,103 +190,59 @@ } +// #pragma mark - device module API + + static status_t -acpi_namespace_init_device(device_node_handle node, void *user_cookie, void **cookie) +acpi_namespace_init_device(void *_cookie, void **cookie) { - acpi_ns_device_info *device; - status_t res; - - device = (acpi_ns_device_info *)calloc(1, sizeof(*device)); + device_node *node = (device_node *)_cookie; + status_t err; + + acpi_ns_device_info *device = (acpi_ns_device_info *)calloc(1, sizeof(*device)); if (device == NULL) return B_NO_MEMORY; device->node = node; - - // register it everywhere - res = gDeviceManager->init_driver(gDeviceManager->get_parent(node), NULL, - (driver_module_info **)&device->acpi, &device->acpi_cookie); - if (res != B_OK) - goto err; - + err = gDeviceManager->get_driver(node, (driver_module_info **)&device->acpi, + (void **)&device->acpi_cookie); + if (err != B_OK) { + free(device); + return err; + } + *cookie = device; return B_OK; - -err: - free(device); - return res; } -static status_t -acpi_namespace_uninit_device(acpi_ns_device_info *device) +static void +acpi_namespace_uninit_device(void *_cookie) { - gDeviceManager->uninit_driver(gDeviceManager->get_parent(device->node)); + acpi_ns_device_info *device = (acpi_ns_device_info *)_cookie; free(device); - - return B_OK; } -static status_t -acpi_namespace_added(device_node_handle node) -{ - device_attr attrs[] = { - { B_DRIVER_MODULE, B_STRING_TYPE, { string: ACPI_NS_DUMP_MODULE_NAME }}, - - { PNP_DRIVER_CONNECTION, B_STRING_TYPE, { string: "namespace" }}, - // we want devfs on top of us (who wouldn't?) - { B_DRIVER_FIXED_CHILD, B_STRING_TYPE, { string: PNP_DEVFS_MODULE_NAME }}, - // tell which name we want to have in devfs - { PNP_DEVFS_FILENAME, B_STRING_TYPE, { string: "acpi/namespace" }}, - { NULL } - }; - - return gDeviceManager->register_device(node, attrs, NULL, &node); -} - - -static status_t -std_ops(int32 op, ...) -{ - switch (op) { - case B_MODULE_INIT: - case B_MODULE_UNINIT: - return B_OK; - - default: - return B_ERROR; - } -} - - -pnp_devfs_driver_info acpi_ns_dump_module = { +struct device_module_info acpi_ns_dump_module = { { - { - ACPI_NS_DUMP_MODULE_NAME, - 0, - std_ops - }, - - NULL, - acpi_namespace_added, - acpi_namespace_init_device, - (status_t (*) (void *))acpi_namespace_uninit_device, + ACPI_NS_DUMP_DEVICE_MODULE_NAME, + 0, NULL }, - (status_t (*)(void *, uint32, void **)) &acpi_namespace_open, + acpi_namespace_init_device, + acpi_namespace_uninit_device, + NULL, + + acpi_namespace_open, acpi_namespace_close, acpi_namespace_free, - (status_t (*)(void *, uint32, void *, size_t)) &acpi_namespace_control, - acpi_namespace_read, acpi_namespace_write, - NULL, - NULL, + acpi_namespace_control, NULL, NULL }; - - Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h 2008-06-04 18:37:29 UTC (rev 25804) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h 2008-06-04 23:05:02 UTC (rev 25805) @@ -7,18 +7,18 @@ #ifndef __ACPI_PRIV_H__ #define __ACPI_PRIV_H__ +#include #include #include -#include // name of ACPI root module -#define ACPI_ROOT_MODULE_NAME "bus_managers/acpi/root/device_v1" +#define ACPI_ROOT_MODULE_NAME "bus_managers/acpi/root/driver_v1" // name of ACPI device modules -#define ACPI_DEVICE_MODULE_NAME "bus_managers/acpi/device_v1" +#define ACPI_DEVICE_MODULE_NAME "bus_managers/acpi/driver_v1" // name of the ACPI namespace device -#define ACPI_NS_DUMP_MODULE_NAME "drivers/power/namespace/acpi/device/v1" +#define ACPI_NS_DUMP_DEVICE_MODULE_NAME "bus_managers/acpi/namespace/device_v1" extern device_manager_info *gDeviceManager; @@ -28,7 +28,7 @@ // ACPI root. typedef struct acpi_root_info { - bus_module_info info; + driver_module_info info; /* Fixed Event Management */ @@ -61,7 +61,7 @@ extern struct acpi_module_info acpi_module; -extern pnp_devfs_driver_info acpi_ns_dump_module; +extern struct device_module_info acpi_ns_dump_module; extern acpi_device_module_info gACPIDeviceModule; From darian505 at gmail.com Thu Jun 5 04:14:56 2008 From: darian505 at gmail.com (Darian Rackham) Date: Wed, 4 Jun 2008 20:14:56 -0600 Subject: [Haiku-commits] r25803 - in haiku/trunk: build/config_headers headers/private/kernel src/system/kernel/arch/x86 In-Reply-To: <200806041756.m54HuVtQ009594@sheep.berlios.de> References: <200806041756.m54HuVtQ009594@sheep.berlios.de> Message-ID: <20080605021454.GA5489@dmb> Wed 06/04/08 19:56 - mmlr at mail.berlios.de used 7.6K of perfectly good ASCII to say: [snip] > Our KDL is so powerful and nice to use, the only thing that bothered me was > that I always had to think about where some of the special keys are located in > the US keymap. So this simple compile-time keymap switching provided to be > helpful for me and might be for others too. Keymaps for other layouts obviously > have to be written before this becomes really useful. [snip] I think this is an excellent idea. My layout of choice (dvorak) has almost no keys in common with US which has made KDL quite awkward to use until know. I've attached a patch that adds a 'dv' keymap option if someone would be so kind as to apply it. Thanks, Darian Rackham -------------- next part -------------- Index: build/config_headers/kernel_debugger_config.h =================================================================== --- build/config_headers/kernel_debugger_config.h (revision 25805) +++ build/config_headers/kernel_debugger_config.h (working copy) @@ -4,6 +4,7 @@ // Available keymaps: // 'us' default US keymap // 'sg' swiss-german keymap +// 'dv' dvorak keymap #define KDL_KEYMAP 'us' Index: headers/private/kernel/debugger_keymaps.h =================================================================== --- headers/private/kernel/debugger_keymaps.h (revision 25805) +++ headers/private/kernel/debugger_keymaps.h (working copy) @@ -7,7 +7,41 @@ #include "kernel_debugger_config.h" -#if KDL_KEYMAP == 'sg' +#if KDL_KEYMAP == 'dv' +static const char kUnshiftedKeymap[128] = { + 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '[', ']', 8, '\t', + '\'', ',', '.', 'p', 'y', 'f', 'g', 'c', 'r', 'l', '/', '=', '\n', 0, 'a', 'o', + 'e', 'u', 'i', 'd', 'h', 't', 'n', 's', '-', '`', 0, '\\', ';', 'q', 'j', 'k', + 'x', 'b', 'm', 'w', 'v', 'z', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\\', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static const char kShiftedKeymap[128] = { + 0, 27, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '{', '}', 8, '\t', + '"', '<', '>', 'P', 'Y', 'F', 'G', 'C', 'R', 'L', '?', '+', '\n', 0, 'A', 'O', + 'E', 'U', 'I', 'D', 'H', 'T', 'N', 'S', '_', '~', 0, '|', ':', 'Q', 'J', 'K', + 'X', 'B', 'M', 'W', 'V', 'Z', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static const char kAltedKeymap[128] = { + 0, 27, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '{', '}', 8, '\t', + '"', '<', '>', 'P', 'Y', 'F', 'G', 'C', 'R', 'L', '?', '+', '\n', 0, 'A', 'O', + 'E', 'U', 'I', 'D', 'H', 'T', 'N', 'S', '_', '~', 0, '|', ':', 'Q', 'J', 'K', + 'X', 'B', 'M', 'W', 'V', 'Z', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +#elif KDL_KEYMAP == 'sg' const char kUnshiftedKeymap[128] = { 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '\'', '^', 8, '\t', 'q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 0, 0, '\n', 0, 'a', 's', From axeld at pinc-software.de Thu Jun 5 09:44:13 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Thu, 05 Jun 2008 09:44:13 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r25805_-_haiku/trunk/src/add-ons/kernel?= =?utf-8?q?/bus=5Fmanagers/acpi?= In-Reply-To: <200806042305.m54N532Z021333@sheep.berlios.de> Message-ID: <1228198056-BeMail@zon> korli at BerliOS wrote: > +acpi_enumerate_child_devices(device_node *node, const char *root) [...] > + // get a reference on the parent > + parent = gDeviceManager->get_parent_node(node); So you did not solve the problem yet, I guess? BTW for device nodes that don't get any on-demand drivers (since you register the childs recursively in a tree and not flat), you shouldn't use the B_FIND_CHILD_ON_DEMAND flag, as that could confuse the device manager, or at least causes unnecessary work. Bye, Axel. From philippe.houdoin at free.fr Thu Jun 5 09:42:23 2008 From: philippe.houdoin at free.fr (philippe.houdoin at free.fr) Date: Thu, 5 Jun 2008 09:42:23 +0200 Subject: [Haiku-commits] r25799 - haiku/trunk/src/system/kernel/device_manager Message-ID: >> "J?r?me Duval" wrote: >> it is used to publish a /dev/bus/acpi/namespace entry, then cat >> /dev/bus/acpi/namespace dumps the acpi tree (not that useful). >> If you wonder, the current driver lives in >> src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.c > > If it's not useful, we could also just remove it ;-)) > But for debugging purposes, it probably okay to keep it for now. To allow userland access to this bus, I suggest we keep the pattern already used by usb_raw, scsi_raw, fw_raw, aka exporting an acpi_raw to exposed ACPI features to third-party userland "drivers". Hardware thermal & power monitoring, extra LEDs and multimedia keys, such things are now often bound to ACPI. An /dev/bus/acpi/raw could exposed its API via control(), while the current /dev/bus/acpi/namespace entry feature merged into it. Plus, that will expand our consistency on busses userland API pattern... Bye, Philippe. From axeld at pinc-software.de Thu Jun 5 10:33:54 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Thu, 05 Jun 2008 10:33:54 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r25799_-_haiku/trunk/src/system/kernel/?= =?utf-8?q?device=5Fmanager?= In-Reply-To: Message-ID: <4209145036-BeMail@zon> wrote: > To allow userland access to this bus, I suggest we keep the pattern > already > used by usb_raw, scsi_raw, fw_raw, aka exporting an acpi_raw to > exposed ACPI > features to third-party userland "drivers". Hardware thermal & power > monitoring, > extra LEDs and multimedia keys, such things are now often bound to > ACPI. > > An /dev/bus/acpi/raw could exposed its API via control(), while the > current /dev/bus/acpi/namespace > entry feature merged into it. > > Plus, that will expand our consistency on busses userland API > pattern... I'm not that familiar with ACPI yet, but from what I know, that sounds like the way to go. Bye, Axel. From korli at users.berlios.de Thu Jun 5 10:42:53 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Thu, 5 Jun 2008 10:42:53 +0200 Subject: [Haiku-commits] r25805 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi In-Reply-To: <1228198056-BeMail@zon> References: <200806042305.m54N532Z021333@sheep.berlios.de> <1228198056-BeMail@zon> Message-ID: 2008/6/5 Axel D?rfler : > korli at BerliOS wrote: >> +acpi_enumerate_child_devices(device_node *node, const char *root) > [...] >> + // get a reference on the parent >> + parent = gDeviceManager->get_parent_node(node); > > So you did not solve the problem yet, I guess? No, it's a workaround for the time being :) > > BTW for device nodes that don't get any on-demand drivers (since you > register the childs recursively in a tree and not flat), you shouldn't > use the B_FIND_CHILD_ON_DEMAND flag, as that could confuse the device > manager, or at least causes unnecessary work. Drivers could register anywhere in the tree, no ? Bye, J?r?me From axeld at pinc-software.de Thu Jun 5 10:58:36 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Thu, 05 Jun 2008 10:58:36 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r25805_-_haiku/trunk/src/add-ons/kernel?= =?utf-8?q?/bus=5Fmanagers/acpi?= In-Reply-To: Message-ID: <5691483167-BeMail@zon> "J?r?me Duval" wrote: > > BTW for device nodes that don't get any on-demand drivers (since > > you > > register the childs recursively in a tree and not flat), you > > shouldn't > > use the B_FIND_CHILD_ON_DEMAND flag, as that could confuse the > > device > > manager, or at least causes unnecessary work. > Drivers could register anywhere in the tree, no ? If you specify B_FIND_CHILD_ON_DEMAND but not B_FIND_MULTIPLE_CHILDREN, the child you added, and eventual new ones interested in that node are competing with each other - that combination means there can only be * one* driver. I'll change the device manager to prohibit this. Bye, Axel. From revol at free.fr Thu Jun 5 18:06:11 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Thu, 05 Jun 2008 18:06:11 +0200 CEST Subject: [Haiku-commits] =?windows-1252?q?r25773_-_in_haiku/trunk=3A_heade?= =?windows-1252?q?rs/private/kernel/arch/x86__src/system/kernel/arch/x86?= In-Reply-To: <4845BDED.1000500@arcor.de> Message-ID: <469371847-BeMail@laptop> > jackburton at BerliOS schrieb: > > > > +/* Global Capability Register Masks */ > > +#define HPET_CAP_MASK_ID 0x00000000000000FF > > +#define HPET_CAP_MASK_NUMTIMERS 0x0000000000001F00 > > +#define HPET_CAP_MASK_WIDTH 0x0000000000002000 > > +#define HPET_CAP_MASK_LEGACY 0x0000000000008000 > > +#define HPET_CAP_MASK_VENDOR_ID 0x00000000FFFF0000 > > +#define HPET_CAP_MASK_PERIOD 0xFFFFFFFF00000000 > > I think those defines need ULL appended, to avoid truncation > to 32 bit integer. At least the last one probably won't work > this way. > Or more portably, using UINT64_C(), as ULL is a gccism. Hmm do we have that one yet in headers ? Fran?ois. From revol at free.fr Thu Jun 5 18:22:35 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Thu, 05 Jun 2008 18:22:35 +0200 CEST Subject: [Haiku-commits] r25803 - in haiku/trunk: build/config_headers headers/private/kernel src/system/kernel/arch/x86 In-Reply-To: <7918854970-BeMail@primary> Message-ID: <1453980264-BeMail@laptop> > > "Rene Gollent" wrote: > > > > Our KDL is so powerful and nice to use, the only thing that > > > > bothered me was > > > > that I always had to think about where some of the special keys > > > > are > > > > located in > > > > the US keymap. So this simple compile-time keymap switching > > > > provided to be > > > > helpful for me and might be for others too. Keymaps for other > > > > layouts obviously > > > > have to be written before this becomes really useful. > > > Is there no feasible way to reconfigure the KDL keyboard layout > > > on > > > the > > > fly to match the system selected one? > > > > For gods sake, its the kernel debugger. It won't get localized > > either > > ;-) +1 Else we should use fr as default one :P > > IMO the US keymap is acceptable for everyone (well, now at least > > you > > can change the keymap at compile time which is a compromise). > > While I understand that it is a non-issue to use the US keymap if you > are used to it, it was always a bit difficult for me. I use the > kernel > debugger only semi-frequently, so I am not really used to use a US > keymap. Especially when debugging something in QEMU while writing > code > besides, I always used the wrong keys in one or the other a few times > at first (and I get annoyed by such unnecessary things pretty quickly > ; > -). It is just way easier when you can type ahead and don't have to > worry about different keymaps at all. The compromise to be able to > switch it at compile time gets the job done, was simple enough to > implement and doesn't really add any complexity to the debugger. > Don't we have a serial input as well ? R5 had set serial to switch input to the com port... with -serial stdio it should allow typing from the terminal qemu runs in. Fran?ois. From revol at free.fr Thu Jun 5 18:25:26 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Thu, 05 Jun 2008 18:25:26 +0200 CEST Subject: [Haiku-commits] r25803 - in haiku/trunk: build/config_headers headers/private/kernel src/system/kernel/arch/x86 In-Reply-To: <46981657643-BeMail@zon> Message-ID: <1624379189-BeMail@laptop> > "Michael Lotz" wrote: > > > For gods sake, its the kernel debugger. It won't get localized > > > either > > > ;-) > > Are you sure about that ;-) > > Maybe I should have added: while I'm alive ;-) > > > While I understand that it is a non-issue to use the US keymap if > > you > > are used to it, > > There was a time that I wasn't, but I had a laptop with a US keymap > for > quite some time, and switched to the US keymap permanently at some > point :-) Don't complain, I have a laptop with a qwertz keyboard with an azerty keymap :D Fran?ois. From mmlr at mail.berlios.de Thu Jun 5 18:34:32 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Thu, 5 Jun 2008 18:34:32 +0200 Subject: [Haiku-commits] r25806 - in haiku/trunk: build/config_headers headers/private/kernel Message-ID: <200806051634.m55GYWeh015260@sheep.berlios.de> Author: mmlr Date: 2008-06-05 18:34:30 +0200 (Thu, 05 Jun 2008) New Revision: 25806 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25806&view=rev Modified: haiku/trunk/build/config_headers/kernel_debugger_config.h haiku/trunk/headers/private/kernel/debugger_keymaps.h Log: * Add Dvorak keymap contributed by Darian Rackham, thanks! * Cleanup the license header and add authors * Sort the available keymaps list in the config file and add 'dv' Modified: haiku/trunk/build/config_headers/kernel_debugger_config.h =================================================================== --- haiku/trunk/build/config_headers/kernel_debugger_config.h 2008-06-04 23:05:02 UTC (rev 25805) +++ haiku/trunk/build/config_headers/kernel_debugger_config.h 2008-06-05 16:34:30 UTC (rev 25806) @@ -2,8 +2,9 @@ #define KERNEL_DEBUGGER_CONFIG_H // Available keymaps: +// 'dv' dvorak keymap +// 'sg' swiss-german keymap // 'us' default US keymap -// 'sg' swiss-german keymap #define KDL_KEYMAP 'us' Modified: haiku/trunk/headers/private/kernel/debugger_keymaps.h =================================================================== --- haiku/trunk/headers/private/kernel/debugger_keymaps.h 2008-06-04 23:05:02 UTC (rev 25805) +++ haiku/trunk/headers/private/kernel/debugger_keymaps.h 2008-06-05 16:34:30 UTC (rev 25806) @@ -1,14 +1,54 @@ /* - * Copyright 2008, Michael Lotz - * Distributed under the terms of the Haiku License. + * Copyright 2008, Haiku Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Lotz + * Darian Rackham */ #ifndef DEBUGGER_KEYMAPS_H #define DEBUGGER_KEYMAPS_H #include "kernel_debugger_config.h" -#if KDL_KEYMAP == 'sg' -const char kUnshiftedKeymap[128] = { +#if KDL_KEYMAP == 'dv' + +static const char kUnshiftedKeymap[128] = { + 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '[', ']', 8, '\t', + '\'', ',', '.', 'p', 'y', 'f', 'g', 'c', 'r', 'l', '/', '=', '\n', 0, 'a', 'o', + 'e', 'u', 'i', 'd', 'h', 't', 'n', 's', '-', '`', 0, '\\', ';', 'q', 'j', 'k', + 'x', 'b', 'm', 'w', 'v', 'z', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + '\\', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static const char kShiftedKeymap[128] = { + 0, 27, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '{', '}', 8, '\t', + '"', '<', '>', 'P', 'Y', 'F', 'G', 'C', 'R', 'L', '?', '+', '\n', 0, 'A', 'O', + 'E', 'U', 'I', 'D', 'H', 'T', 'N', 'S', '_', '~', 0, '|', ':', 'Q', 'J', 'K', + 'X', 'B', 'M', 'W', 'V', 'Z', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static const char kAltedKeymap[128] = { + 0, 27, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '{', '}', 8, '\t', + '"', '<', '>', 'P', 'Y', 'F', 'G', 'C', 'R', 'L', '?', '+', '\n', 0, 'A', 'O', + 'E', 'U', 'I', 'D', 'H', 'T', 'N', 'S', '_', '~', 0, '|', ':', 'Q', 'J', 'K', + 'X', 'B', 'M', 'W', 'V', 'Z', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +#elif KDL_KEYMAP == 'sg' + +static const char kUnshiftedKeymap[128] = { 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '\'', '^', 8, '\t', 'q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 0, 0, '\n', 0, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0, 0, 0, 0, '$', 'y', 'x', 'c', 'v', From mmlr at mlotz.ch Thu Jun 5 18:39:18 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Thu, 05 Jun 2008 18:39:18 +0200 Subject: [Haiku-commits] =?windows-1252?q?r25803_-_in_haiku/trunk=3A_build?= =?windows-1252?q?/config=5Fheaders_headers/private/kernel_src/system/kern?= =?windows-1252?q?el/arch/x86?= In-Reply-To: <20080605021454.GA5489@dmb> Message-ID: <28986920091-BeMail@primary> Hi Darian > I've attached a patch that adds a 'dv' keymap option > if someone would be so kind as to apply it. I have added it in r25806, thanks for the contribution. Regards Michael From stefano.ceccherini at gmail.com Thu Jun 5 18:55:11 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Thu, 5 Jun 2008 18:55:11 +0200 Subject: [Haiku-commits] r25773 - in haiku/trunk: headers/private/kernel/arch/x86 src/system/kernel/arch/x86 In-Reply-To: <469371847-BeMail@laptop> References: <4845BDED.1000500@arcor.de> <469371847-BeMail@laptop> Message-ID: <894b9700806050955y634f822avd3fd78e616551b79@mail.gmail.com> >> jackburton at BerliOS schrieb: >> I think those defines need ULL appended, to avoid truncation >> to 32 bit integer. At least the last one probably won't work >> this way. >> > Will do. From mmlr at mail.berlios.de Thu Jun 5 20:58:03 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Thu, 5 Jun 2008 20:58:03 +0200 Subject: [Haiku-commits] r25807 - haiku/trunk/src/system/kernel/device_manager Message-ID: <200806051858.m55Iw3Zq012190@sheep.berlios.de> Author: mmlr Date: 2008-06-05 20:58:03 +0200 (Thu, 05 Jun 2008) New Revision: 25807 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25807&view=rev Modified: haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp Log: Replace the legacy driver mutex with a recursive lock. This fixes the deadlock when hot-plugging a USB mass storage device. The legacy driver (usb_disk in this case) was rescanned which locked the legacy driver mutex. The insertion of the new device node caused the disk device manager (notified through node monitoring) to try to scan the new node. As opening the node triggers LegacyDevice::InitDevice() that locks the legacy driver mutex again a deadlock occured. Modified: haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp 2008-06-05 16:34:30 UTC (rev 25806) +++ haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp 2008-06-05 18:58:03 UTC (rev 25807) @@ -185,7 +185,7 @@ static DoublyLinkedList sDriversToAdd; static DirectoryWatcher sDirectoryWatcher; static DirectoryNodeHash sDirectoryNodeHash; -static mutex sLock; +static recursive_lock sLock; static bool sWatching; @@ -575,8 +575,7 @@ int32 priority = get_priority(path); -// RecursiveLocker locker(&sDeviceFileSystem->lock); - MutexLocker _(sLock); + RecursiveLocker _(sLock); legacy_driver *driver = (legacy_driver *)hash_lookup(sDriverHash, get_leaf(path)); @@ -678,8 +677,7 @@ // something happened, let's see what it was -// RecursiveLocker locker(fs->lock); - MutexLocker locker(sLock); + RecursiveLocker locker(sLock); while (true) { path_entry *path = sDriversToAdd.RemoveHead(); @@ -729,7 +727,7 @@ || (event->GetInt32("fields", 0) & B_STAT_MODIFICATION_TIME) == 0) return; - MutexLocker locker(sLock); + RecursiveLocker locker(sLock); legacy_driver* driver = find_driver(event->GetInt32("device", -1), event->GetInt64("node", 0)); @@ -1172,7 +1170,7 @@ status_t LegacyDevice::InitDevice() { - MutexLocker _(sLock); + RecursiveLocker _(sLock); if (fInitialized++ > 0) return B_OK; @@ -1194,7 +1192,7 @@ void LegacyDevice::UninitDevice() { - MutexLocker _(sLock); + RecursiveLocker _(sLock); if (fInitialized-- > 1) return; @@ -1301,7 +1299,7 @@ devfs_driver_added(const char *path) { int32 priority = get_priority(path); - MutexLocker locker(sLock); + RecursiveLocker locker(sLock); legacy_driver *driver = (legacy_driver *)hash_lookup(sDriverHash, get_leaf(path)); @@ -1330,7 +1328,7 @@ devfs_driver_removed(const char* path) { int32 priority = get_priority(path); - MutexLocker locker(sLock); + RecursiveLocker locker(sLock); legacy_driver* driver = (legacy_driver*)hash_lookup(sDriverHash, get_leaf(path)); @@ -1364,7 +1362,7 @@ extern "C" status_t legacy_driver_rescan(const char* driverName) { - MutexLocker locker(sLock); + RecursiveLocker locker(sLock); legacy_driver* driver = (legacy_driver*)hash_lookup(sDriverHash, driverName); @@ -1429,7 +1427,7 @@ if (sDriverHash == NULL) return B_NO_MEMORY; - mutex_init(&sLock, "legacy driver"); + recursive_lock_init(&sLock, "legacy driver"); new(&sDriverWatcher) DriverWatcher; new(&sDriversToAdd) DoublyLinkedList; From mmlr at mail.berlios.de Thu Jun 5 23:01:49 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Thu, 5 Jun 2008 23:01:49 +0200 Subject: [Haiku-commits] r25808 - haiku/trunk/src/system/kernel Message-ID: <200806052101.m55L1njJ022908@sheep.berlios.de> Author: mmlr Date: 2008-06-05 23:01:47 +0200 (Thu, 05 Jun 2008) New Revision: 25808 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25808&view=rev Modified: haiku/trunk/src/system/kernel/lock.cpp Log: * Panic when trying to lock a mutex twice from the same thread. Should make mutex deadlocks more obvious. * Fix wrong function name in panic string. Modified: haiku/trunk/src/system/kernel/lock.cpp =================================================================== --- haiku/trunk/src/system/kernel/lock.cpp 2008-06-05 18:58:03 UTC (rev 25807) +++ haiku/trunk/src/system/kernel/lock.cpp 2008-06-05 21:01:47 UTC (rev 25808) @@ -389,7 +389,7 @@ { #ifdef KDEBUG if (!kernel_startup && !threadsLocked && !are_interrupts_enabled()) { - panic("_mutex_unlock(): called with interrupts disabled for lock %p", + panic("_mutex_lock(): called with interrupts disabled for lock %p", lock); } #endif @@ -400,6 +400,11 @@ // Might have been released after we decremented the count, but before // we acquired the spinlock. #ifdef KDEBUG + if (!kernel_startup && lock->holder == thread_get_current_thread_id()) { + panic("_mutex_lock(): double lock of %p by thread %ld", lock, + lock->holder); + } + if (lock->holder <= 0) { lock->holder = thread_get_current_thread_id(); return B_OK; From mmlr at mail.berlios.de Thu Jun 5 23:16:35 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Thu, 5 Jun 2008 23:16:35 +0200 Subject: [Haiku-commits] r25809 - haiku/trunk/src/system/kernel/debug Message-ID: <200806052116.m55LGZMp024849@sheep.berlios.de> Author: mmlr Date: 2008-06-05 23:16:34 +0200 (Thu, 05 Jun 2008) New Revision: 25809 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25809&view=rev Modified: haiku/trunk/src/system/kernel/debug/debug.cpp Log: Give the debugger add-ons a chance when reading input characters. They already got a debugger_getchar hook, it just wasn't used yet. Not that there would be any debugger add-on implementing that hook currently... Modified: haiku/trunk/src/system/kernel/debug/debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug.cpp 2008-06-05 21:01:47 UTC (rev 25808) +++ haiku/trunk/src/system/kernel/debug/debug.cpp 2008-06-05 21:16:34 UTC (rev 25809) @@ -402,8 +402,21 @@ readChar = arch_debug_serial_getchar; while (!done) { - c = readChar(); + bool hasChar = false; + for (int32 i = 0; i < kMaxDebuggerModules; i++) { + if (sDebuggerModules[i] && sDebuggerModules[i]->debugger_getchar) { + int getChar = sDebuggerModules[i]->debugger_getchar(); + if (getChar >= 0) { + hasChar = true; + c = (char)getChar; + break; + } + } + } + if (!hasChar) + c = readChar(); + switch (c) { case '\n': case '\r': From stippi at mail.berlios.de Thu Jun 5 23:17:20 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 5 Jun 2008 23:17:20 +0200 Subject: [Haiku-commits] r25810 - haiku/trunk/src/servers/media Message-ID: <200806052117.m55LHKfE024971@sheep.berlios.de> Author: stippi Date: 2008-06-05 23:17:19 +0200 (Thu, 05 Jun 2008) New Revision: 25810 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25810&view=rev Modified: haiku/trunk/src/servers/media/media_server.cpp Log: Honor the 80 chars per line limit. Modified: haiku/trunk/src/servers/media/media_server.cpp =================================================================== --- haiku/trunk/src/servers/media/media_server.cpp 2008-06-05 21:16:34 UTC (rev 25809) +++ haiku/trunk/src/servers/media/media_server.cpp 2008-06-05 21:17:19 UTC (rev 25810) @@ -28,7 +28,8 @@ */ /* to comply with the license above, do not remove the following line */ -char __dont_remove_copyright_from_binary[] = "Copyright (c) 2002, 2003 Marcus Overhagen "; +char __dont_remove_copyright_from_binary[] = "Copyright (c) 2002, 2003 " + "Marcus Overhagen "; #include #include @@ -136,7 +137,8 @@ gAddOnManager = new AddOnManager; control_port = create_port(64, MEDIA_SERVER_PORT_NAME); - control_thread = spawn_thread(controlthread, "media_server control", 105, this); + control_thread = spawn_thread(controlthread, "media_server control", 105, + this); resume_thread(control_thread); } @@ -235,8 +237,10 @@ if (err == B_OK) return; - (new BAlert("media_server", "Launching media_addon_server failed.\n\nmedia_server will terminate", "OK"))->Go(); - fprintf(stderr, "Launching media_addon_server (%s) failed: %s\n", B_MEDIA_ADDON_SERVER_SIGNATURE, strerror(err)); + (new BAlert("media_server", "Launching media_addon_server failed.\n\n" + "media_server will terminate", "OK"))->Go(); + fprintf(stderr, "Launching media_addon_server (%s) failed: %s\n", + B_MEDIA_ADDON_SERVER_SIGNATURE, strerror(err)); exit(1); } @@ -253,9 +257,11 @@ ERROR("Trouble terminating media_addon_server. Messenger invalid\n"); } else { BMessage msg(B_QUIT_REQUESTED); - status_t err = msger.SendMessage(&msg, (BHandler *)NULL, 2000000 /* 2 sec timeout */); + status_t err = msger.SendMessage(&msg, (BHandler *)NULL, 2000000); + // 2 sec timeout if (err) { - ERROR("Trouble terminating media_addon_server (2). Error %d (%s)\n", err, strerror(err)); + ERROR("Trouble terminating media_addon_server (2). Error %d " + "(%s)\n", err, strerror(err)); } } @@ -289,13 +295,19 @@ switch (code) { case SERVER_CHANGE_ADDON_FLAVOR_INSTANCES_COUNT: { - const server_change_addon_flavor_instances_count_request *request = reinterpret_cast(data); + const server_change_addon_flavor_instances_count_request *request + = reinterpret_cast< + const server_change_addon_flavor_instances_count_request *>( + data); server_change_addon_flavor_instances_count_reply reply; ASSERT(request->delta == 1 || request->delta == -1); - if (request->delta == 1) - rv = gNodeManager->IncrementAddonFlavorInstancesCount(request->addonid, request->flavorid, request->team); - else - rv = gNodeManager->DecrementAddonFlavorInstancesCount(request->addonid, request->flavorid, request->team); + if (request->delta == 1) { + rv = gNodeManager->IncrementAddonFlavorInstancesCount( + request->addonid, request->flavorid, request->team); + } else { + rv = gNodeManager->DecrementAddonFlavorInstancesCount( + request->addonid, request->flavorid, request->team); + } request->SendReply(rv, &reply, sizeof(reply)); break; } @@ -308,7 +320,8 @@ case SERVER_REGISTER_APP: { - const server_register_app_request *request = reinterpret_cast(data); + const server_register_app_request *request + = reinterpret_cast(data); server_register_app_reply reply; rv = gAppManager->RegisterTeam(request->team, request->messenger); request->SendReply(rv, &reply, sizeof(reply)); @@ -317,7 +330,9 @@ case SERVER_UNREGISTER_APP: { - const server_unregister_app_request *request = reinterpret_cast(data); + const server_unregister_app_request *request + = reinterpret_cast( + data); server_unregister_app_reply reply; rv = gAppManager->UnregisterTeam(request->team); request->SendReply(rv, &reply, sizeof(reply)); @@ -326,7 +341,8 @@ case SERVER_GET_MEDIAADDON_REF: { - server_get_mediaaddon_ref_request *msg = (server_get_mediaaddon_ref_request *)data; + server_get_mediaaddon_ref_request *msg + = (server_get_mediaaddon_ref_request *)data; server_get_mediaaddon_ref_reply reply; entry_ref tempref; reply.result = gNodeManager->GetAddonRef(&tempref, msg->addonid); @@ -337,7 +353,8 @@ case SERVER_NODE_ID_FOR: { - const server_node_id_for_request *request = reinterpret_cast(data); + const server_node_id_for_request *request + = reinterpret_cast(data); server_node_id_for_reply reply; rv = gNodeManager->FindNodeId(&reply.nodeid, request->port); request->SendReply(rv, &reply, sizeof(reply)); @@ -346,16 +363,21 @@ case SERVER_GET_LIVE_NODE_INFO: { - const server_get_live_node_info_request *request = reinterpret_cast(data); + const server_get_live_node_info_request *request + = reinterpret_cast( + data); server_get_live_node_info_reply reply; - rv = gNodeManager->GetLiveNodeInfo(&reply.live_info, request->node); + rv = gNodeManager->GetLiveNodeInfo(&reply.live_info, + request->node); request->SendReply(rv, &reply, sizeof(reply)); break; } case SERVER_GET_LIVE_NODES: { - const server_get_live_nodes_request *request = reinterpret_cast(data); + const server_get_live_nodes_request *request + = reinterpret_cast( + data); server_get_live_nodes_reply reply; Stack livenodes; rv = gNodeManager->GetLiveNodes( @@ -371,13 +393,18 @@ livenodes.Pop(&reply.live_info[index]); reply.area = -1; } else { - // we create an area here, and pass it to the library, where it will be deleted. + // we create an area here, and pass it to the library, + // where it will be deleted. live_node_info *start_addr; size_t size; - size = ((reply.count * sizeof(live_node_info)) + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1); - reply.area = create_area("get live nodes", reinterpret_cast(&start_addr), B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); + size = ((reply.count * sizeof(live_node_info)) + B_PAGE_SIZE + - 1) & ~(B_PAGE_SIZE - 1); + reply.area = create_area("get live nodes", + reinterpret_cast(&start_addr), B_ANY_ADDRESS, + size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); if (reply.area < B_OK) { - ERROR("SERVER_GET_LIVE_NODES: failed to create area, error %#lx\n", reply.area); + ERROR("SERVER_GET_LIVE_NODES: failed to create area, " + "error %#lx\n", reply.area); reply.count = 0; rv = B_ERROR; } else { @@ -386,23 +413,28 @@ } } rv = request->SendReply(rv, &reply, sizeof(reply)); - if (rv != B_OK) - delete_area(reply.area); // if we couldn't send the message, delete the area + if (rv != B_OK) { + // if we couldn't send the message, delete the area + delete_area(reply.area); + } break; } case SERVER_GET_NODE_FOR: { - const server_get_node_for_request *request = reinterpret_cast(data); + const server_get_node_for_request *request + = reinterpret_cast(data); server_get_node_for_reply reply; - rv = gNodeManager->GetCloneForId(&reply.clone, request->nodeid, request->team); + rv = gNodeManager->GetCloneForId(&reply.clone, request->nodeid, + request->team); request->SendReply(rv, &reply, sizeof(reply)); break; } case SERVER_RELEASE_NODE: { - const server_release_node_request *request = reinterpret_cast(data); + const server_release_node_request *request + = reinterpret_cast(data); server_release_node_reply reply; rv = gNodeManager->ReleaseNode(request->node, request->team); request->SendReply(rv, &reply, sizeof(reply)); @@ -411,37 +443,50 @@ case SERVER_REGISTER_NODE: { - const server_register_node_request *request = reinterpret_cast(data); + const server_register_node_request *request + = reinterpret_cast(data); server_register_node_reply reply; - rv = gNodeManager->RegisterNode(&reply.nodeid, request->addon_id, request->addon_flavor_id, request->name, request->kinds, request->port, request->team); + rv = gNodeManager->RegisterNode(&reply.nodeid, request->addon_id, + request->addon_flavor_id, request->name, request->kinds, + request->port, request->team); request->SendReply(rv, &reply, sizeof(reply)); break; } case SERVER_UNREGISTER_NODE: { - const server_unregister_node_request *request = reinterpret_cast(data); + const server_unregister_node_request *request + = reinterpret_cast( + data); server_unregister_node_reply reply; - rv = gNodeManager->UnregisterNode(&reply.addonid, &reply.flavorid, request->nodeid, request->team); + rv = gNodeManager->UnregisterNode(&reply.addonid, &reply.flavorid, + request->nodeid, request->team); request->SendReply(rv, &reply, sizeof(reply)); break; } case SERVER_PUBLISH_INPUTS: { - const server_publish_inputs_request *request = reinterpret_cast(data); + const server_publish_inputs_request *request + = reinterpret_cast( + data); server_publish_inputs_reply reply; if (request->count <= MAX_INPUTS) { - rv = gNodeManager->PublishInputs(request->node, request->inputs, request->count); + rv = gNodeManager->PublishInputs(request->node, + request->inputs, request->count); } else { media_input *inputs; area_id clone; - clone = clone_area("media_inputs clone", reinterpret_cast(&inputs), B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, request->area); + clone = clone_area("media_inputs clone", + reinterpret_cast(&inputs), B_ANY_ADDRESS, + B_READ_AREA | B_WRITE_AREA, request->area); if (clone < B_OK) { - ERROR("SERVER_PUBLISH_INPUTS: failed to clone area, error %#lx\n", clone); + ERROR("SERVER_PUBLISH_INPUTS: failed to clone area, " + "error %#lx\n", clone); rv = B_ERROR; } else { - rv = gNodeManager->PublishInputs(request->node, inputs, request->count); + rv = gNodeManager->PublishInputs(request->node, inputs, + request->count); delete_area(clone); } } @@ -451,19 +496,24 @@ case SERVER_PUBLISH_OUTPUTS: { - const server_publish_outputs_request *request = reinterpret_cast(data); + const server_publish_outputs_request *request + = reinterpret_cast( + data); server_publish_outputs_reply reply; if (request->count <= MAX_OUTPUTS) { - rv = gNodeManager->PublishOutputs(request->node, request->outputs, request->count); + rv = gNodeManager->PublishOutputs(request->node, + request->outputs, request->count); } else { media_output *outputs; area_id clone; clone = clone_area("media_outputs clone", reinterpret_cast(&outputs), B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, request->area); if (clone < B_OK) { - ERROR("SERVER_PUBLISH_OUTPUTS: failed to clone area, error %#lx\n", clone); + ERROR("SERVER_PUBLISH_OUTPUTS: failed to clone area, " + "error %#lx\n", clone); rv = B_ERROR; } else { - rv = gNodeManager->PublishOutputs(request->node, outputs, request->count); + rv = gNodeManager->PublishOutputs(request->node, outputs, + request->count); delete_area(clone); } } @@ -473,38 +523,54 @@ case SERVER_GET_NODE: { - const server_get_node_request *request = reinterpret_cast(data); + const server_get_node_request *request + = reinterpret_cast(data); server_get_node_reply reply; - rv = gNodeManager->GetClone(&reply.node, reply.input_name, &reply.input_id, request->type, request->team); + rv = gNodeManager->GetClone(&reply.node, reply.input_name, + &reply.input_id, request->type, request->team); request->SendReply(rv, &reply, sizeof(reply)); break; } case SERVER_SET_NODE: { - const server_set_node_request *request = reinterpret_cast(data); + const server_set_node_request *request + = reinterpret_cast(data); server_set_node_reply reply; - rv = gNodeManager->SetDefaultNode(request->type, request->use_node ? &request->node : NULL, request->use_dni ? &request->dni : NULL, request->use_input ? &request->input : NULL); + rv = gNodeManager->SetDefaultNode(request->type, + request->use_node ? &request->node : NULL, + request->use_dni ? &request->dni : NULL, + request->use_input ? &request->input : NULL); request->SendReply(rv, &reply, sizeof(reply)); break; } case SERVER_GET_DORMANT_NODE_FOR: { - const server_get_dormant_node_for_request *request = reinterpret_cast(data); + const server_get_dormant_node_for_request *request + = reinterpret_cast< + const server_get_dormant_node_for_request *>(data); server_get_dormant_node_for_reply reply; - rv = gNodeManager->GetDormantNodeInfo(&reply.node_info, request->node); + rv = gNodeManager->GetDormantNodeInfo(&reply.node_info, + request->node); request->SendReply(rv, &reply, sizeof(reply)); break; } case SERVER_GET_INSTANCES_FOR: { - const server_get_instances_for_request *request = reinterpret_cast(data); + const server_get_instances_for_request *request + = reinterpret_cast( + data); server_get_instances_for_reply reply; - rv = gNodeManager->GetInstances(reply.node_id, &reply.count, min_c(request->maxcount, MAX_NODE_ID), request->addon_id, request->addon_flavor_id); - if (reply.count == MAX_NODE_ID && request->maxcount > MAX_NODE_ID) { // XXX might be fixed by using an area - PRINT(1, "Warning: SERVER_GET_INSTANCES_FOR: returning possibly truncated list of node id's\n"); + rv = gNodeManager->GetInstances(reply.node_id, &reply.count, + min_c(request->maxcount, MAX_NODE_ID), request->addon_id, + request->addon_flavor_id); + if (reply.count == MAX_NODE_ID + && request->maxcount > MAX_NODE_ID) { + // XXX might be fixed by using an area + PRINT(1, "Warning: SERVER_GET_INSTANCES_FOR: returning " + "possibly truncated list of node id's\n"); } request->SendReply(rv, &reply, sizeof(reply)); break; @@ -512,7 +578,8 @@ case SERVER_REGISTER_MEDIAADDON: { - server_register_mediaaddon_request *msg = (server_register_mediaaddon_request *)data; + server_register_mediaaddon_request *msg + = (server_register_mediaaddon_request *)data; server_register_mediaaddon_reply reply; gNodeManager->RegisterAddon(msg->ref, &reply.addonid); write_port(msg->reply_port, 0, &reply, sizeof(reply)); @@ -521,14 +588,16 @@ case SERVER_UNREGISTER_MEDIAADDON: { - server_unregister_mediaaddon_command *msg = (server_unregister_mediaaddon_command *)data; + server_unregister_mediaaddon_command *msg + = (server_unregister_mediaaddon_command *)data; gNodeManager->UnregisterAddon(msg->addonid); break; } case SERVER_REGISTER_DORMANT_NODE: { - xfer_server_register_dormant_node *msg = (xfer_server_register_dormant_node *)data; + xfer_server_register_dormant_node *msg + = (xfer_server_register_dormant_node *)data; dormant_flavor_info dfi; if (msg->purge_id > 0) gNodeManager->InvalidateDormantFlavorInfo(msg->purge_id); @@ -540,7 +609,8 @@ case SERVER_GET_DORMANT_NODES: { - xfer_server_get_dormant_nodes *msg = (xfer_server_get_dormant_nodes *)data; + xfer_server_get_dormant_nodes *msg + = (xfer_server_get_dormant_nodes *)data; xfer_server_get_dormant_nodes_reply reply; dormant_node_info * infos = new dormant_node_info[msg->maxcount]; reply.count = msg->maxcount; @@ -556,18 +626,21 @@ reply.count = 0; write_port(msg->reply_port, 0, &reply, sizeof(reply)); if (reply.count > 0) - write_port(msg->reply_port, 0, infos, reply.count * sizeof(dormant_node_info)); + write_port(msg->reply_port, 0, infos, reply.count + * sizeof(dormant_node_info)); delete [] infos; break; } case SERVER_GET_DORMANT_FLAVOR_INFO: { - xfer_server_get_dormant_flavor_info *msg = (xfer_server_get_dormant_flavor_info *)data; + xfer_server_get_dormant_flavor_info *msg + = (xfer_server_get_dormant_flavor_info *)data; dormant_flavor_info dfi; status_t rv; - rv = gNodeManager->GetDormantFlavorInfoFor(msg->addon, msg->flavor_id, &dfi); + rv = gNodeManager->GetDormantFlavorInfoFor(msg->addon, + msg->flavor_id, &dfi); if (rv != B_OK) { xfer_server_get_dormant_flavor_info_reply reply; reply.result = rv; @@ -575,8 +648,10 @@ } else { xfer_server_get_dormant_flavor_info_reply *reply; int replysize; - replysize = sizeof(xfer_server_get_dormant_flavor_info_reply) + dfi.FlattenedSize(); - reply = (xfer_server_get_dormant_flavor_info_reply *)malloc(replysize); + replysize = sizeof(xfer_server_get_dormant_flavor_info_reply) + + dfi.FlattenedSize(); + reply = (xfer_server_get_dormant_flavor_info_reply *)malloc( + replysize); reply->dfi_size = dfi.FlattenedSize(); reply->dfi_type = dfi.TypeCode(); @@ -589,7 +664,9 @@ case SERVER_SET_NODE_CREATOR: { - const server_set_node_creator_request *request = reinterpret_cast(data); + const server_set_node_creator_request *request + = reinterpret_cast( + data); server_set_node_creator_reply reply; rv = gNodeManager->SetNodeCreator(request->node, request->creator); request->SendReply(rv, &reply, sizeof(reply)); @@ -598,7 +675,9 @@ case SERVER_GET_SHARED_BUFFER_AREA: { - const server_get_shared_buffer_area_request *request = reinterpret_cast(data); + const server_get_shared_buffer_area_request *request + = reinterpret_cast< + const server_get_shared_buffer_area_request *>(data); server_get_shared_buffer_area_reply reply; reply.area = gBufferManager->SharedBufferListID(); @@ -608,16 +687,24 @@ case SERVER_REGISTER_BUFFER: { - const server_register_buffer_request *request = reinterpret_cast(data); + const server_register_buffer_request *request + = reinterpret_cast( + data); server_register_buffer_reply reply; status_t status; if (request->info.buffer == 0) { - reply.info = request->info; //size, offset, flags, area is kept + reply.info = request->info; + // size, offset, flags, area is kept // get a new beuffer id into reply.info.buffer - status = gBufferManager->RegisterBuffer(request->team, request->info.size, request->info.flags, request->info.offset, request->info.area, &reply.info.buffer); + status = gBufferManager->RegisterBuffer(request->team, + request->info.size, request->info.flags, + request->info.offset, request->info.area, + &reply.info.buffer); } else { reply.info = request->info; //buffer id is kept - status = gBufferManager->RegisterBuffer(request->team, request->info.buffer, &reply.info.size, &reply.info.flags, &reply.info.offset, &reply.info.area); + status = gBufferManager->RegisterBuffer(request->team, + request->info.buffer, &reply.info.size, &reply.info.flags, + &reply.info.offset, &reply.info.area); } request->SendReply(status, &reply, sizeof(reply)); break; @@ -625,7 +712,8 @@ case SERVER_UNREGISTER_BUFFER: { - const server_unregister_buffer_command *cmd = reinterpret_cast(data); + const server_unregister_buffer_command *cmd = reinterpret_cast< + const server_unregister_buffer_command *>(data); gBufferManager->UnregisterBuffer(cmd->team, cmd->bufferid); break; @@ -633,7 +721,8 @@ case SERVER_REWINDTYPES: { - const server_rewindtypes_request *request = reinterpret_cast(data); + const server_rewindtypes_request *request + = reinterpret_cast(data); server_rewindtypes_reply reply; BString **types = NULL; @@ -641,99 +730,125 @@ rv = gMMediaFilesManager->RewindTypes( &types, &reply.count); if(reply.count>0) { - // we create an area here, and pass it to the library, where it will be deleted. + // we create an area here, and pass it to the library, + // where it will be deleted. char *start_addr; - size_t size = ((reply.count * B_MEDIA_NAME_LENGTH) + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1); - reply.area = create_area("rewind types", reinterpret_cast(&start_addr), B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); + size_t size = ((reply.count * B_MEDIA_NAME_LENGTH) + + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1); + reply.area = create_area("rewind types", + reinterpret_cast(&start_addr), B_ANY_ADDRESS, + size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); if (reply.area < B_OK) { - ERROR("SERVER_REWINDTYPES: failed to create area, error %s\n", strerror(reply.area)); + ERROR("SERVER_REWINDTYPES: failed to create area, " + "error %s\n", strerror(reply.area)); reply.count = 0; rv = B_ERROR; } else { - for (int32 index = 0; index < reply.count; index++) - strncpy(start_addr + B_MEDIA_NAME_LENGTH * index, types[index]->String(), B_MEDIA_NAME_LENGTH); + for (int32 index = 0; index < reply.count; index++) { + strncpy(start_addr + B_MEDIA_NAME_LENGTH * index, + types[index]->String(), B_MEDIA_NAME_LENGTH); + } } } delete types; rv = request->SendReply(rv, &reply, sizeof(reply)); - if (rv != B_OK) - delete_area(reply.area); // if we couldn't send the message, delete the area + if (rv != B_OK) { + // if we couldn't send the message, delete the area + delete_area(reply.area); + } break; } case SERVER_REWINDREFS: { - const server_rewindrefs_request *request = reinterpret_cast(data); + const server_rewindrefs_request *request + = reinterpret_cast(data); server_rewindrefs_reply reply; BString **items = NULL; rv = gMMediaFilesManager->RewindRefs(request->type, &items, &reply.count); - // we create an area here, and pass it to the library, where it will be deleted. + // we create an area here, and pass it to the library, + // where it will be deleted. if(reply.count>0) { char *start_addr; - size_t size = ((reply.count * B_MEDIA_NAME_LENGTH) + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1); - reply.area = create_area("rewind refs", reinterpret_cast(&start_addr), B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); + size_t size = ((reply.count * B_MEDIA_NAME_LENGTH) + + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1); + reply.area = create_area("rewind refs", + reinterpret_cast(&start_addr), B_ANY_ADDRESS, + size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); if (reply.area < B_OK) { - ERROR("SERVER_REWINDREFS: failed to create area, error %s\n", strerror(reply.area)); + ERROR("SERVER_REWINDREFS: failed to create area, " + "error %s\n", strerror(reply.area)); reply.count = 0; rv = B_ERROR; } else { - for (int32 index = 0; index < reply.count; index++) - strncpy(start_addr + B_MEDIA_NAME_LENGTH * index, items[index]->String(), B_MEDIA_NAME_LENGTH); + for (int32 index = 0; index < reply.count; index++) { + strncpy(start_addr + B_MEDIA_NAME_LENGTH * index, + items[index]->String(), B_MEDIA_NAME_LENGTH); + } } } delete items; rv = request->SendReply(rv, &reply, sizeof(reply)); - if (rv != B_OK) - delete_area(reply.area); // if we couldn't send the message, delete the area + if (rv != B_OK) { + // if we couldn't send the message, delete the area + delete_area(reply.area); + } break; } case SERVER_GETREFFOR: { - const server_getreffor_request *request = reinterpret_cast(data); + const server_getreffor_request *request + = reinterpret_cast(data); server_getreffor_reply reply; entry_ref *ref; - rv = gMMediaFilesManager->GetRefFor(request->type, request->item, &ref); - if(rv==B_OK) { + rv = gMMediaFilesManager->GetRefFor(request->type, request->item, + &ref); + if (rv == B_OK) reply.ref = *ref; - } + request->SendReply(rv, &reply, sizeof(reply)); break; } case SERVER_SETREFFOR: { - const server_setreffor_request *request = reinterpret_cast(data); + const server_setreffor_request *request + = reinterpret_cast(data); server_setreffor_reply reply; entry_ref ref = request->ref; - rv = gMMediaFilesManager->SetRefFor(request->type, request->item, ref); + rv = gMMediaFilesManager->SetRefFor(request->type, request->item, + ref); request->SendReply(rv, &reply, sizeof(reply)); break; } case SERVER_REMOVEREFFOR: { - const server_removereffor_request *request = reinterpret_cast(data); + const server_removereffor_request *request + = reinterpret_cast(data); server_removereffor_reply reply; entry_ref ref = request->ref; - rv = gMMediaFilesManager->RemoveRefFor(request->type, request->item, ref); + rv = gMMediaFilesManager->RemoveRefFor(request->type, + request->item, ref); request->SendReply(rv, &reply, sizeof(reply)); break; } case SERVER_REMOVEITEM: { - const server_removeitem_request *request = reinterpret_cast(data); + const server_removeitem_request *request + = reinterpret_cast(data); server_removeitem_reply reply; rv = gMMediaFilesManager->RemoveItem(request->type, request->item); @@ -743,24 +858,30 @@ case SERVER_GET_READERS: { - const server_get_readers_request *request = reinterpret_cast(data); + const server_get_readers_request *request + = reinterpret_cast(data); server_get_readers_reply reply; - rv = gAddOnManager->GetReaders(reply.ref, &reply.count, MAX_READERS); + rv = gAddOnManager->GetReaders(reply.ref, &reply.count, + MAX_READERS); request->SendReply(rv, &reply, sizeof(reply)); break; } case SERVER_GET_DECODER_FOR_FORMAT: { - const server_get_decoder_for_format_request *request = reinterpret_cast(data); + const server_get_decoder_for_format_request *request + = reinterpret_cast< + const server_get_decoder_for_format_request *>(data); server_get_decoder_for_format_reply reply; - rv = gAddOnManager->GetDecoderForFormat(&reply.ref, request->format); + rv = gAddOnManager->GetDecoderForFormat(&reply.ref, + request->format); request->SendReply(rv, &reply, sizeof(reply)); break; } default: - printf("media_server: received unknown message code %#08lx\n",code); + printf("media_server: received unknown message code %#08lx\n", + code); } TRACE("ServerApp::HandleMessage %#lx leave\n", code); } @@ -774,8 +895,10 @@ int32 code; app = (ServerApp *)arg; - while ((size = read_port_etc(app->control_port, &code, data, sizeof(data), 0, 0)) > 0) + while ((size = read_port_etc(app->control_port, &code, data, sizeof(data), + 0, 0)) > 0) { app->HandleMessage(code, data, size); + } return 0; } From mmlr at mail.berlios.de Fri Jun 6 00:18:31 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 6 Jun 2008 00:18:31 +0200 Subject: [Haiku-commits] r25811 - haiku/trunk/src/system/kernel/debug Message-ID: <200806052218.m55MIVkk000269@sheep.berlios.de> Author: mmlr Date: 2008-06-06 00:18:31 +0200 (Fri, 06 Jun 2008) New Revision: 25811 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25811&view=rev Modified: haiku/trunk/src/system/kernel/debug/debug.cpp Log: Fix two warnings caused by previous commit. Modified: haiku/trunk/src/system/kernel/debug/debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug.cpp 2008-06-05 21:17:19 UTC (rev 25810) +++ haiku/trunk/src/system/kernel/debug/debug.cpp 2008-06-05 22:18:31 UTC (rev 25811) @@ -393,7 +393,7 @@ int32 position = 0; int32 length = 0; bool done = false; - char c; + char c = 0; char (*readChar)(void); if (sBlueScreenOutput) @@ -403,7 +403,7 @@ while (!done) { bool hasChar = false; - for (int32 i = 0; i < kMaxDebuggerModules; i++) { + for (uint32 i = 0; i < kMaxDebuggerModules; i++) { if (sDebuggerModules[i] && sDebuggerModules[i]->debugger_getchar) { int getChar = sDebuggerModules[i]->debugger_getchar(); if (getChar >= 0) { From mmlr at mail.berlios.de Fri Jun 6 01:19:30 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 6 Jun 2008 01:19:30 +0200 Subject: [Haiku-commits] r25812 - in haiku/trunk: headers/private/kernel src/system/kernel src/system/kernel/arch/generic src/system/kernel/debug src/system/kernel/device_manager src/system/kernel/fs src/system/kernel/slab src/system/kernel/util src/system/kernel/vm src/system/libroot/os Message-ID: <200806052319.m55NJU0N006179@sheep.berlios.de> Author: mmlr Date: 2008-06-06 01:19:27 +0200 (Fri, 06 Jun 2008) New Revision: 25812 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25812&view=rev Modified: haiku/trunk/headers/private/kernel/kdriver_settings.h haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_mapper.cpp haiku/trunk/src/system/kernel/debug/frame_buffer_console.cpp haiku/trunk/src/system/kernel/device_manager/id_generator.cpp haiku/trunk/src/system/kernel/elf.cpp haiku/trunk/src/system/kernel/fs/vfs.cpp haiku/trunk/src/system/kernel/image.c haiku/trunk/src/system/kernel/kernel_daemon.cpp haiku/trunk/src/system/kernel/lock.cpp haiku/trunk/src/system/kernel/main.cpp haiku/trunk/src/system/kernel/slab/Slab.cpp haiku/trunk/src/system/kernel/syscalls.cpp haiku/trunk/src/system/kernel/util/cbuf.c haiku/trunk/src/system/kernel/vm/vm.cpp haiku/trunk/src/system/kernel/vm/vm_low_memory.cpp haiku/trunk/src/system/libroot/os/driver_settings.c Log: * Initialize all static mutexes in the kernel through a MUTEX_INITIALIZER() and remove the then unneeded mutex_init() for them. * Remove the workaround for allowing uninitialized mutexes on kernel startup. As they are all initialized statically through the MUTEX_INITIALIZER() now this is not needed anymore. * An uninitialized mutex will now cause a panic when used to find possibly remaining cases. * Remove now unnecessary driver_settings_init_post_sem() function. Modified: haiku/trunk/headers/private/kernel/kdriver_settings.h =================================================================== --- haiku/trunk/headers/private/kernel/kdriver_settings.h 2008-06-05 22:18:31 UTC (rev 25811) +++ haiku/trunk/headers/private/kernel/kdriver_settings.h 2008-06-05 23:19:27 UTC (rev 25812) @@ -16,7 +16,6 @@ #endif status_t driver_settings_init(struct kernel_args *args); -status_t driver_settings_init_post_sem(struct kernel_args *args); #ifdef __cplusplus } Modified: haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_mapper.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_mapper.cpp 2008-06-05 22:18:31 UTC (rev 25811) +++ haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_mapper.cpp 2008-06-05 23:19:27 UTC (rev 25812) @@ -43,7 +43,7 @@ static int first_free_vmapping; static int num_virtual_chunks; static queue mapped_paddr_lru; -static mutex sMutex; +static mutex sMutex = MUTEX_INITIALIZER("iospace_mutex"); static sem_id sChunkAvailableSem; static int32 sChunkAvailableWaitingCounter; @@ -282,7 +282,6 @@ memset(virtual_pmappings, 0, sizeof(paddr_chunk_desc *) * num_virtual_chunks); first_free_vmapping = 0; queue_init(&mapped_paddr_lru); - mutex_init(&sMutex, "iospace_mutex"); sChunkAvailableSem = -1; TRACE(("generic_vm_physical_page_mapper_init: done\n")); Modified: haiku/trunk/src/system/kernel/debug/frame_buffer_console.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/frame_buffer_console.cpp 2008-06-05 22:18:31 UTC (rev 25811) +++ haiku/trunk/src/system/kernel/debug/frame_buffer_console.cpp 2008-06-05 23:19:27 UTC (rev 25812) @@ -396,6 +396,8 @@ if (!args->frame_buffer.enabled) return B_OK; + mutex_init(&sConsole.lock, "console_lock"); + void *frameBuffer; sConsole.area = map_physical_memory("vesa_fb", (void *)args->frame_buffer.physical_buffer.start, @@ -443,8 +445,6 @@ status_t frame_buffer_console_init_post_modules(kernel_args *args) { - mutex_init(&sConsole.lock, "console_lock"); - if (sConsole.frame_buffer == 0) return B_OK; Modified: haiku/trunk/src/system/kernel/device_manager/id_generator.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/id_generator.cpp 2008-06-05 22:18:31 UTC (rev 25811) +++ haiku/trunk/src/system/kernel/device_manager/id_generator.cpp 2008-06-05 23:19:27 UTC (rev 25812) @@ -67,7 +67,7 @@ GeneratorList sGenerators; -static mutex sLock; +static mutex sLock = MUTEX_INITIALIZER("id generator"); /*! Create new generator. @@ -169,7 +169,6 @@ dm_init_id_generator(void) { new(&sGenerators) GeneratorList; - mutex_init(&sLock, "id generator"); } Modified: haiku/trunk/src/system/kernel/elf.cpp =================================================================== --- haiku/trunk/src/system/kernel/elf.cpp 2008-06-05 22:18:31 UTC (rev 25811) +++ haiku/trunk/src/system/kernel/elf.cpp 2008-06-05 23:19:27 UTC (rev 25812) @@ -59,9 +59,11 @@ static hash_table *sImagesHash; static struct elf_image_info *sKernelImage = NULL; -static mutex sImageMutex; // guards sImagesHash -static mutex sImageLoadMutex; // serializes loading/unloading add-ons - // locking order sImageLoadMutex -> sImageMutex +static mutex sImageMutex = MUTEX_INITIALIZER("kimages_lock"); + // guards sImagesHash +static mutex sImageLoadMutex = MUTEX_INITIALIZER("kimages_load_lock"); + // serializes loading/unloading add-ons locking order + // sImageLoadMutex -> sImageMutex static bool sInitialized = false; @@ -1785,9 +1787,6 @@ image_init(); - mutex_init(&sImageMutex, "kimages_lock"); - mutex_init(&sImageLoadMutex, "kimages_load_lock"); - sImagesHash = hash_init(IMAGE_HASH_SIZE, 0, image_compare, image_hash); if (sImagesHash == NULL) return B_NO_MEMORY; Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-06-05 22:18:31 UTC (rev 25811) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-06-05 23:19:27 UTC (rev 25812) @@ -169,7 +169,7 @@ } }; -static mutex sFileSystemsMutex; +static mutex sFileSystemsMutex = MUTEX_INITIALIZER("vfs_lock"); /*! \brief Guards sMountsTable. @@ -177,7 +177,7 @@ Manipulation of the fs_mount structures themselves (and their destruction) requires different locks though. */ -static mutex sMountMutex; +static mutex sMountMutex = MUTEX_INITIALIZER("vfs_mount_lock"); /*! \brief Guards mount/unmount operations. @@ -201,7 +201,8 @@ The thread trying to lock the must not hold sVnodeMutex. */ -static mutex sVnodeCoveredByMutex; +static mutex sVnodeCoveredByMutex + = MUTEX_INITIALIZER("vfs_vnode_covered_by_lock"); /*! \brief Guards sVnodeTable. @@ -215,7 +216,7 @@ You must not have this mutex held when calling create_sem(), as this might call vfs_free_unused_vnodes(). */ -static mutex sVnodeMutex; +static mutex sVnodeMutex = MUTEX_INITIALIZER("vfs_vnode_lock"); /*! \brief Guards io_context::root. @@ -223,7 +224,7 @@ The only operation allowed while holding this lock besides getting or setting the field is inc_vnode_ref_count() on io_context::root. */ -static mutex sIOContextRootLock; +static mutex sIOContextRootLock = MUTEX_INITIALIZER("io_context::root lock"); #define VNODE_HASH_TABLE_SIZE 1024 static hash_table *sVnodeTable; @@ -4414,13 +4415,7 @@ sRoot = NULL; - mutex_init(&sFileSystemsMutex, "vfs_lock"); - recursive_lock_init(&sMountOpLock, "vfs_mount_op_lock"); - mutex_init(&sMountMutex, "vfs_mount_lock"); - mutex_init(&sVnodeCoveredByMutex, "vfs_vnode_covered_by_lock"); - mutex_init(&sVnodeMutex, "vfs_vnode_lock"); - mutex_init(&sIOContextRootLock, "io_context::root lock"); if (block_cache_init() != B_OK) return B_ERROR; Modified: haiku/trunk/src/system/kernel/image.c =================================================================== --- haiku/trunk/src/system/kernel/image.c 2008-06-05 22:18:31 UTC (rev 25811) +++ haiku/trunk/src/system/kernel/image.c 2008-06-05 23:19:27 UTC (rev 25812) @@ -38,7 +38,7 @@ static image_id sNextImageID = 1; -static mutex sImageMutex; +static mutex sImageMutex = MUTEX_INITIALIZER("image"); /*! Registers an image with the specified team. @@ -274,7 +274,6 @@ add_debugger_command("team_images", &dump_images_list, "Dump all registered images from the current team"); #endif - mutex_init(&sImageMutex, "image"); return B_OK; } Modified: haiku/trunk/src/system/kernel/kernel_daemon.cpp =================================================================== --- haiku/trunk/src/system/kernel/kernel_daemon.cpp 2008-06-05 22:18:31 UTC (rev 25811) +++ haiku/trunk/src/system/kernel/kernel_daemon.cpp 2008-06-05 23:19:27 UTC (rev 25812) @@ -33,7 +33,7 @@ typedef DoublyLinkedList DaemonList; -static mutex sDaemonMutex; +static mutex sDaemonMutex = MUTEX_INITIALIZER("kernel daemon"); static DaemonList sDaemons; @@ -130,12 +130,9 @@ extern "C" status_t kernel_daemon_init(void) { - thread_id thread; - - mutex_init(&sDaemonMutex, "kernel daemon"); new(&sDaemons) DaemonList; - thread = spawn_kernel_thread(&kernel_daemon, "kernel daemon", + thread_id thread = spawn_kernel_thread(&kernel_daemon, "kernel daemon", B_LOW_PRIORITY, NULL); send_signal_etc(thread, SIGCONT, B_DO_NOT_RESCHEDULE); Modified: haiku/trunk/src/system/kernel/lock.cpp =================================================================== --- haiku/trunk/src/system/kernel/lock.cpp 2008-06-05 22:18:31 UTC (rev 25811) +++ haiku/trunk/src/system/kernel/lock.cpp 2008-06-05 23:19:27 UTC (rev 25812) @@ -400,15 +400,14 @@ // Might have been released after we decremented the count, but before // we acquired the spinlock. #ifdef KDEBUG - if (!kernel_startup && lock->holder == thread_get_current_thread_id()) { - panic("_mutex_lock(): double lock of %p by thread %ld", lock, - lock->holder); - } - - if (lock->holder <= 0) { + if (lock->holder < 0) { lock->holder = thread_get_current_thread_id(); return B_OK; - } + } else if (lock->holder == thread_get_current_thread_id()) { + panic("_mutex_lock(): double lock of %p by thread %ld", lock, + lock->holder); + } else if (lock->holder == 0) + panic("_mutex_lock(): using unitialized lock %p", lock); #else if ((lock->flags & MUTEX_FLAG_RELEASED) != 0) { lock->flags &= ~MUTEX_FLAG_RELEASED; Modified: haiku/trunk/src/system/kernel/main.cpp =================================================================== --- haiku/trunk/src/system/kernel/main.cpp 2008-06-05 22:18:31 UTC (rev 25811) +++ haiku/trunk/src/system/kernel/main.cpp 2008-06-05 23:19:27 UTC (rev 25812) @@ -156,8 +156,6 @@ // now we can create and use semaphores TRACE("init VM semaphores\n"); vm_init_post_sem(&sKernelArgs); - TRACE("init driver_settings\n"); - driver_settings_init_post_sem(&sKernelArgs); TRACE("init generic syscall\n"); generic_syscall_init(); smp_init_post_generic_syscalls(); Modified: haiku/trunk/src/system/kernel/slab/Slab.cpp =================================================================== --- haiku/trunk/src/system/kernel/slab/Slab.cpp 2008-06-05 22:18:31 UTC (rev 25811) +++ haiku/trunk/src/system/kernel/slab/Slab.cpp 2008-06-05 23:19:27 UTC (rev 25812) @@ -164,7 +164,7 @@ static ObjectCacheList sObjectCaches; -static mutex sObjectCacheListLock; +static mutex sObjectCacheListLock = MUTEX_INITIALIZER("object cache list"); static uint8 *sInitialBegin, *sInitialLimit, *sInitialPointer; static kernel_args *sKernelArgs; @@ -1454,8 +1454,6 @@ void slab_init_post_sem() { - mutex_init(&sObjectCacheListLock, "object cache list"); - ObjectCacheList::Iterator it = sObjectCaches.GetIterator(); while (it.HasNext()) { Modified: haiku/trunk/src/system/kernel/syscalls.cpp =================================================================== --- haiku/trunk/src/system/kernel/syscalls.cpp 2008-06-05 22:18:31 UTC (rev 25811) +++ haiku/trunk/src/system/kernel/syscalls.cpp 2008-06-05 23:19:27 UTC (rev 25812) @@ -55,7 +55,7 @@ generic_syscall *previous; }; -static struct mutex sGenericSyscallLock; +static mutex sGenericSyscallLock = MUTEX_INITIALIZER("generic syscall"); static struct list sGenericSyscalls; @@ -212,7 +212,6 @@ generic_syscall_init(void) { list_init(&sGenericSyscalls); - mutex_init(&sGenericSyscallLock, "generic syscall"); #if SYSCALL_TRACING add_debugger_command_etc("straced", &dump_syscall_tracing, Modified: haiku/trunk/src/system/kernel/util/cbuf.c =================================================================== --- haiku/trunk/src/system/kernel/util/cbuf.c 2008-06-05 22:18:31 UTC (rev 25811) +++ haiku/trunk/src/system/kernel/util/cbuf.c 2008-06-05 23:19:27 UTC (rev 25812) @@ -44,7 +44,7 @@ #define CBUF_BITMAP_SIZE (CBUF_REGION_SIZE / CBUF_LENGTH) static cbuf *sFreeBufferList; -static mutex sFreeBufferListMutex; +static mutex sFreeBufferListMutex = MUTEX_INITIALIZER("cbuf_free_list"); static cbuf *sFreeBufferNoBlockList; static spinlock sNoBlockSpinlock; @@ -950,8 +950,6 @@ // add the debug command add_debugger_command("cbuf_freelist", &dbg_dump_cbuf_freelists, "Dumps the cbuf free lists"); - mutex_init(&sFreeBufferListMutex, "cbuf_free_list"); - // errors are fatal, that's why we don't clean up here sBufferArea = create_area("cbuf region", (void **)&sBuffer, B_ANY_KERNEL_ADDRESS, Modified: haiku/trunk/src/system/kernel/vm/vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm.cpp 2008-06-05 22:18:31 UTC (rev 25811) +++ haiku/trunk/src/system/kernel/vm/vm.cpp 2008-06-05 23:19:27 UTC (rev 25812) @@ -194,11 +194,11 @@ static area_id sNextAreaID; static hash_table *sAreaHash; static sem_id sAreaHashLock; -static mutex sMappingLock; -static mutex sAreaCacheLock; +static mutex sMappingLock = MUTEX_INITIALIZER("page mappings"); +static mutex sAreaCacheLock = MUTEX_INITIALIZER("area->cache"); static off_t sAvailableMemory; -static mutex sAvailableMemoryLock; +static mutex sAvailableMemoryLock = MUTEX_INITIALIZER("available memory lock"); #if DEBUG_CACHE_LIST @@ -3955,13 +3955,10 @@ // since we're still single threaded and only the kernel address space exists, // it isn't that hard to find all of the ones we need to create - mutex_init(&sAvailableMemoryLock, "available memory lock"); arch_vm_translation_map_init_post_sem(args); vm_address_space_init_post_sem(); sAreaHashLock = create_sem(WRITE_COUNT, "area hash"); - mutex_init(&sAreaCacheLock, "area->cache"); - mutex_init(&sMappingLock, "page mappings"); slab_init_post_sem(); return heap_init_post_sem(); Modified: haiku/trunk/src/system/kernel/vm/vm_low_memory.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_low_memory.cpp 2008-06-05 22:18:31 UTC (rev 25811) +++ haiku/trunk/src/system/kernel/vm/vm_low_memory.cpp 2008-06-05 23:19:27 UTC (rev 25812) @@ -50,7 +50,7 @@ static int32 sLowMemoryState = B_NO_LOW_MEMORY; static bigtime_t sLastMeasurement; -static mutex sLowMemoryMutex; +static mutex sLowMemoryMutex = MUTEX_INITIALIZER("low memory"); static sem_id sLowMemoryWaitSem; static HandlerList sLowMemoryHandlers; @@ -184,8 +184,6 @@ status_t vm_low_memory_init_post_thread(void) { - mutex_init(&sLowMemoryMutex, "low memory"); - sLowMemoryWaitSem = create_sem(0, "low memory wait"); if (sLowMemoryWaitSem < B_OK) return sLowMemoryWaitSem; Modified: haiku/trunk/src/system/libroot/os/driver_settings.c =================================================================== --- haiku/trunk/src/system/libroot/os/driver_settings.c 2008-06-05 22:18:31 UTC (rev 25811) +++ haiku/trunk/src/system/libroot/os/driver_settings.c 2008-06-05 23:19:27 UTC (rev 25812) @@ -88,7 +88,7 @@ #ifdef _KERNEL_MODE static struct list sHandles; -static mutex sLock; +static mutex sLock = MUTEX_INITIALIZER("driver settings"); #endif @@ -652,14 +652,6 @@ return B_OK; } - - -status_t -driver_settings_init_post_sem(kernel_args *args) -{ - mutex_init(&sLock, "driver settings"); - return B_OK; -} #endif From mmlr at mail.berlios.de Fri Jun 6 01:28:40 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 6 Jun 2008 01:28:40 +0200 Subject: [Haiku-commits] r25813 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid Message-ID: <200806052328.m55NSexN001284@sheep.berlios.de> Author: mmlr Date: 2008-06-06 01:28:39 +0200 (Fri, 06 Jun 2008) New Revision: 25813 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25813&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp Log: Even though there is a space after that backslash GCC4 complains... Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp 2008-06-05 23:19:27 UTC (rev 25812) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp 2008-06-05 23:28:39 UTC (rev 25813) @@ -202,7 +202,7 @@ 0x31, // [ 0x32, // ] 0x00, // unmapped - 0x33, // \ + 0x33, // backslash 0x45, // ; 0x46, // ' 0x11, // ` From mmlr at mail.berlios.de Fri Jun 6 01:29:27 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 6 Jun 2008 01:29:27 +0200 Subject: [Haiku-commits] r25814 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid Message-ID: <200806052329.m55NTRiQ001358@sheep.berlios.de> Author: mmlr Date: 2008-06-06 01:29:26 +0200 (Fri, 06 Jun 2008) New Revision: 25814 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25814&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDDevice.cpp Log: Also use the interface index when generating the report descriptor dump. Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDDevice.cpp 2008-06-05 23:28:39 UTC (rev 25813) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDDevice.cpp 2008-06-05 23:29:26 UTC (rev 25814) @@ -113,8 +113,9 @@ const usb_device_descriptor *deviceDescriptor = gUSBModule->get_device_descriptor(device); char outputFile[128]; - sprintf(outputFile, "/tmp/usb_hid_report_descriptor_%04x_%04x.bin", - deviceDescriptor->vendor_id, deviceDescriptor->product_id); + sprintf(outputFile, "/tmp/usb_hid_report_descriptor_%04x_%04x_%lu.bin", + deviceDescriptor->vendor_id, deviceDescriptor->product_id, + interfaceIndex); int fd = open(outputFile, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd >= 0) { write(fd, reportDescriptor, descriptorLength); From mmlr at mail.berlios.de Fri Jun 6 01:32:59 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 6 Jun 2008 01:32:59 +0200 Subject: [Haiku-commits] r25815 - in haiku/trunk/src/add-ons/kernel: bus_managers/usb busses/usb Message-ID: <200806052332.m55NWx3h001659@sheep.berlios.de> Author: mmlr Date: 2008-06-06 01:32:58 +0200 (Fri, 06 Jun 2008) New Revision: 25815 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25815&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb.rdef haiku/trunk/src/add-ons/kernel/busses/usb/ehci.rdef haiku/trunk/src/add-ons/kernel/busses/usb/ohci.rdef haiku/trunk/src/add-ons/kernel/busses/usb/uhci.rdef Log: Updating the resource definitions of the USB stack components. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb.rdef =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb.rdef 2008-06-05 23:29:26 UTC (rev 25814) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb.rdef 2008-06-05 23:32:58 UTC (rev 25815) @@ -5,11 +5,11 @@ resource app_signature "application/x-vnd.haiku-usb"; resource app_version { - major = 0, + major = 1, middle = 0, - minor = 1, + minor = 0, variety = 0, internal = 1, short_info = "USB bus manager", - long_info = "Haiku USB bus manager - Copyright 2003-2006, Haiku Inc." + long_info = "Haiku USB bus manager - Copyright 2003-2008, Haiku Inc." }; Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.rdef =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ehci.rdef 2008-06-05 23:29:26 UTC (rev 25814) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ehci.rdef 2008-06-05 23:32:58 UTC (rev 25815) @@ -5,11 +5,11 @@ resource app_signature "application/x-vnd.haiku-ehci"; resource app_version { - major = 0, + major = 1, middle = 0, - minor = 1, + minor = 0, variety = 0, internal = 0, short_info = "EHCI host controller driver", - long_info = "Haiku EHCI HCD - Copyright 2006, Haiku Inc." + long_info = "Haiku EHCI HCD - Copyright 2006-2008, Haiku Inc." }; Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ohci.rdef =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ohci.rdef 2008-06-05 23:29:26 UTC (rev 25814) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ohci.rdef 2008-06-05 23:32:58 UTC (rev 25815) @@ -6,12 +6,12 @@ resource app_signature "application/x-vnd.haiku-ohci"; resource app_version { - major = 0, + major = 1, middle = 0, - minor = 1, + minor = 0, variety = 0, internal = 0, short_info = "OHCI host controller driver", - long_info = "Haiku - This driver is (c) 2005 Jan-Rixt Van Hoye" + long_info = "Haiku OHCI HCD - Copyright 2005-2008, Haiku Inc." }; Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.rdef =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.rdef 2008-06-05 23:29:26 UTC (rev 25814) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.rdef 2008-06-05 23:32:58 UTC (rev 25815) @@ -5,11 +5,11 @@ resource app_signature "application/x-vnd.haiku-uhci"; resource app_version { - major = 0, + major = 1, middle = 0, - minor = 1, + minor = 0, variety = 0, internal = 0, short_info = "UHCI host controller driver", - long_info = "Haiku UHCI HCD - Copyright 2003-2006, Haiku Inc." + long_info = "Haiku UHCI HCD - Copyright 2003-2008, Haiku Inc." }; From mmlr at mail.berlios.de Fri Jun 6 01:36:25 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 6 Jun 2008 01:36:25 +0200 Subject: [Haiku-commits] r25816 - haiku/trunk/src/system/kernel/cache Message-ID: <200806052336.m55NaPTf002038@sheep.berlios.de> Author: mmlr Date: 2008-06-06 01:36:24 +0200 (Fri, 06 Jun 2008) New Revision: 25816 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25816&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp Log: Missed that file in the commit for r25812. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-06-05 23:32:58 UTC (rev 25815) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-06-05 23:36:24 UTC (rev 25816) @@ -283,9 +283,9 @@ static DoublyLinkedList sCaches; -static mutex sCachesLock; +static mutex sCachesLock = MUTEX_INITIALIZER("block caches"); static sem_id sEventSemaphore; -static mutex sNotificationsLock; +static mutex sNotificationsLock = MUTEX_INITIALIZER("block cache notifications"); static thread_id sNotifierWriterThread; static DoublyLinkedListLink sMarkCache; // TODO: this only works if the link is the first entry of block_cache @@ -1622,9 +1622,6 @@ if (sBlockCache == NULL) return B_NO_MEMORY; - mutex_init(&sCachesLock, "block caches"); - mutex_init(&sNotificationsLock, "block cache notifications"); - new (&sCaches) DoublyLinkedList; // manually call constructor From anevilyak at mail.berlios.de Fri Jun 6 07:27:04 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Fri, 6 Jun 2008 07:27:04 +0200 Subject: [Haiku-commits] r25817 - haiku/trunk/src/add-ons/accelerants/atimach64 Message-ID: <200806060527.m565R4Ys009062@sheep.berlios.de> Author: anevilyak Date: 2008-06-06 07:27:01 +0200 (Fri, 06 Jun 2008) New Revision: 25817 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25817&view=rev Modified: haiku/trunk/src/add-ons/accelerants/atimach64/InitAccelerant.c Log: Build fix. Modified: haiku/trunk/src/add-ons/accelerants/atimach64/InitAccelerant.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/atimach64/InitAccelerant.c 2008-06-05 23:36:24 UTC (rev 25816) +++ haiku/trunk/src/add-ons/accelerants/atimach64/InitAccelerant.c 2008-06-06 05:27:01 UTC (rev 25817) @@ -8,6 +8,7 @@ #include "sys/stat.h" #include "fcntl.h" #include +#include #include "stdio.h" /* defined in ProposeDisplayMode.c */ From axeld at mail.berlios.de Fri Jun 6 09:42:59 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 6 Jun 2008 09:42:59 +0200 Subject: [Haiku-commits] r25818 - haiku/trunk/headers/posix Message-ID: <200806060742.m567gxsM021879@sheep.berlios.de> Author: axeld Date: 2008-06-06 09:42:58 +0200 (Fri, 06 Jun 2008) New Revision: 25818 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25818&view=rev Modified: haiku/trunk/headers/posix/search.h Log: The "search.h" header had a couple of issues: * It was not self containing, as it used size_t without defining it. * It was not C++ safe. * It used the restrict keyword that is not recognized in GCC2. This fixes bug #2262. * It did not contain parameter names as demanded by our coding style. Modified: haiku/trunk/headers/posix/search.h =================================================================== --- haiku/trunk/headers/posix/search.h 2008-06-06 05:27:01 UTC (rev 25817) +++ haiku/trunk/headers/posix/search.h 2008-06-06 07:42:58 UTC (rev 25818) @@ -5,6 +5,10 @@ #ifndef _SEARCH_H_ #define _SEARCH_H_ + +#include + + typedef enum { FIND, ENTER @@ -23,23 +27,30 @@ } VISIT; -extern int hcreate(size_t); +#ifdef __cplusplus +extern "C" { +#endif + +extern int hcreate(size_t elementCount); extern void hdestroy(void); -extern ENTRY *hsearch(ENTRY, ACTION); -extern void insque(void *, void *); -extern void *lfind(const void *, const void *, size_t *, - size_t, int (*)(const void *, const void *)); -extern void *lsearch(const void *, void *, size_t *, - size_t, int (*)(const void *, const void *)); -extern void remque(void *); -extern void *tdelete(const void *restrict, void **restrict, - int(*)(const void *, const void *)); -extern void *tfind(const void *, void *const *, - int(*)(const void *, const void *)); -extern void *tsearch(const void *, void **, - int(*)(const void *, const void *)); -extern void twalk(const void *, - void (*)(const void *, VISIT, int )); +extern ENTRY *hsearch(ENTRY iteam, ACTION action); +extern void insque(void *element, void *insertAfter); +extern void *lfind(const void *key, const void *base, size_t *_elementCount, + size_t width, int (*compareFunction)(const void *, const void *)); +extern void *lsearch(const void *key, void *base, size_t *_elementCount, + size_t width, int (*compareFunction)(const void *, const void *)); +extern void remque(void *element); +extern void *tdelete(const void *key, void **_root, + int (*compare)(const void *, const void *)); +extern void *tfind(const void *key, void *const *root, + int (*compare)(const void *, const void *)); +extern void *tsearch(const void *key, void **_root, + int (*compare)(const void *, const void *)); +extern void twalk(const void *root, + void (*action)(const void *, VISIT, int )); -#endif /* _SEARCH_H_ */ +#ifdef __cplusplus +} +#endif +#endif /* _SEARCH_H_ */ From stippi at mail.berlios.de Fri Jun 6 12:17:28 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 6 Jun 2008 12:17:28 +0200 Subject: [Haiku-commits] r25819 - haiku/trunk/src/apps/mediaplayer/supplier Message-ID: <200806061017.m56AHSju003935@sheep.berlios.de> Author: stippi Date: 2008-06-06 12:17:28 +0200 (Fri, 06 Jun 2008) New Revision: 25819 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25819&view=rev Modified: haiku/trunk/src/apps/mediaplayer/supplier/ProxyVideoSupplier.cpp Log: The seeking algo stopped decoding frames one frame too early. Modified: haiku/trunk/src/apps/mediaplayer/supplier/ProxyVideoSupplier.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/supplier/ProxyVideoSupplier.cpp 2008-06-06 07:42:58 UTC (rev 25818) +++ haiku/trunk/src/apps/mediaplayer/supplier/ProxyVideoSupplier.cpp 2008-06-06 10:17:28 UTC (rev 25819) @@ -33,12 +33,16 @@ return B_NO_INIT; bigtime_t performanceTime = 0; + if (fSupplier->CurrentFrame() == startFrame + 1) { + printf("ProxyVideoSupplier::FillBuffer(%lld) - Could re-use previous " + "buffer!\n", startFrame); + } if (fSupplier->CurrentFrame() != startFrame) { int64 frame = startFrame; status_t ret = fSupplier->SeekToFrame(&frame); if (ret != B_OK) return ret; - while (frame < (startFrame - 1)) { + while (frame < startFrame) { ret = fSupplier->ReadFrame(buffer, &performanceTime, format, wasCached); if (ret != B_OK) @@ -47,7 +51,8 @@ } } - // TODO: cache into intermediate buffer! + // TODO: cache into intermediate buffer to handle the + // currentFrame = startFrame + 1 case! return fSupplier->ReadFrame(buffer, &performanceTime, format, wasCached); } From stippi at mail.berlios.de Fri Jun 6 12:33:52 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 6 Jun 2008 12:33:52 +0200 Subject: [Haiku-commits] r25820 - haiku/trunk/src/apps/mediaplayer/media_node_framework Message-ID: <200806061033.m56AXqSd011299@sheep.berlios.de> Author: stippi Date: 2008-06-06 12:33:47 +0200 (Fri, 06 Jun 2008) New Revision: 25820 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25820&view=rev Modified: haiku/trunk/src/apps/mediaplayer/media_node_framework/PlaybackManager.cpp Log: Do not insert a new playing state when seeking to the same frame. In the end, this results in trying to decode the last frame again, which would the decoder to seek unnecessarily. Modified: haiku/trunk/src/apps/mediaplayer/media_node_framework/PlaybackManager.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/media_node_framework/PlaybackManager.cpp 2008-06-06 10:17:28 UTC (rev 25819) +++ haiku/trunk/src/apps/mediaplayer/media_node_framework/PlaybackManager.cpp 2008-06-06 10:33:47 UTC (rev 25820) @@ -351,6 +351,8 @@ void PlaybackManager::SetCurrentFrame(int64 frame) { + if (_LastState()->current_frame == frame) + return; PlayingState* newState = new PlayingState(*_LastState()); newState->current_frame = frame; _PushState(newState, false); From stippi at mail.berlios.de Fri Jun 6 12:36:51 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 6 Jun 2008 12:36:51 +0200 Subject: [Haiku-commits] r25821 - haiku/trunk/src/apps/mediaplayer/supplier Message-ID: <200806061036.m56AapmL016203@sheep.berlios.de> Author: stippi Date: 2008-06-06 12:36:50 +0200 (Fri, 06 Jun 2008) New Revision: 25821 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25821&view=rev Modified: haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp Log: * Actually set the format to B_RGB32 when retrying for that format. * Do not exit in case of success to retry with B_RGB32, so the bytes per row check is performed. * Ignore if bytes per row is big enough. * Check the success for the last attempt to set DecodedFormat(). Modified: haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp 2008-06-06 10:33:47 UTC (rev 25820) +++ haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp 2008-06-06 10:36:50 UTC (rev 25821) @@ -189,8 +189,10 @@ return B_OK; } -if (wantFrame != *frame) -printf("seeked by frame: %lld -> %lld\n", wantFrame, *frame); +if (wantFrame != *frame) { + printf("seeked by frame: %lld -> %lld, was %lld\n", wantFrame, *frame, + currentFrame); +} ret = fVideoTrack->SeekToFrame(frame); if (ret == B_OK) { @@ -357,6 +359,7 @@ printf("MediaTrackVideoSupplier::_SwitchFormat() - " "fVideoTrack->DecodedFormat(): %s - retrying with B_RGB32\n", strerror(ret)); + format = B_RGB32; fFormat.u.raw_video.display.format = format; minBytesPerRow = width * 4; fFormat.u.raw_video.display.bytes_per_row = max_c(minBytesPerRow, @@ -367,15 +370,13 @@ printf("MediaTrackVideoSupplier::_SwitchFormat() - " "fVideoTrack->DecodedFormat(): %s - giving up\n", strerror(ret)); + return ret; } - return ret; } if (fFormat.u.raw_video.display.format != format) { printf("MediaTrackVideoSupplier::_SwitchFormat() - " - " codec changed colorspace of decoded format (%s -> %s)!\n" - " this is bad for performance, since colorspace conversion\n" - " needs to happen during playback.\n", + " codec changed colorspace of decoded format (%s -> %s)!\n", string_for_color_space(format), string_for_color_space(fFormat.u.raw_video.display.format)); // check if the codec forgot to adjust bytes_per_row @@ -385,10 +386,10 @@ minBPR = ((width * 2 + 3) / 4) * 4; else minBPR = width * 4; - if (minBPR != fFormat.u.raw_video.display.bytes_per_row) { + if (minBPR > fFormat.u.raw_video.display.bytes_per_row) { printf(" -> stupid codec forgot to adjust bytes_per_row!\n"); fFormat.u.raw_video.display.bytes_per_row = minBPR; - fVideoTrack->DecodedFormat(&fFormat); + ret = fVideoTrack->DecodedFormat(&fFormat); } } From mmlr at mail.berlios.de Fri Jun 6 13:23:40 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 6 Jun 2008 13:23:40 +0200 Subject: [Haiku-commits] r25822 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200806061123.m56BNew3015081@sheep.berlios.de> Author: mmlr Date: 2008-06-06 13:23:38 +0200 (Fri, 06 Jun 2008) New Revision: 25822 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25822&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp haiku/trunk/src/add-ons/kernel/busses/usb/ehci.h haiku/trunk/src/add-ons/kernel/busses/usb/ehci_hardware.h Log: Only check the explicitly enabled interrupts in EHCI. Otherwise we might steal a shared interrupt from someone else. Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2008-06-06 10:36:50 UTC (rev 25821) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2008-06-06 11:23:38 UTC (rev 25822) @@ -103,6 +103,7 @@ fRegisterArea(-1), fPCIInfo(info), fStack(stack), + fEnabledInterrupts(0), fPeriodicFrameListArea(-1), fPeriodicFrameList(NULL), fInterruptEntries(NULL), @@ -243,8 +244,9 @@ // install the interrupt handler and enable interrupts install_io_interrupt_handler(fPCIInfo->u.h0.interrupt_line, InterruptHandler, (void *)this, 0); - WriteOpReg(EHCI_USBINTR, EHCI_USBINTR_HOSTSYSERR - | EHCI_USBINTR_USBERRINT | EHCI_USBINTR_USBINT | EHCI_USBINTR_INTONAA); + fEnabledInterrupts = EHCI_USBINTR_HOSTSYSERR | EHCI_USBINTR_USBERRINT + | EHCI_USBINTR_USBINT | EHCI_USBINTR_INTONAA; + WriteOpReg(EHCI_USBINTR, fEnabledInterrupts); // allocate the periodic frame list fPeriodicFrameListArea = fStack->AllocateArea((void **)&fPeriodicFrameList, @@ -787,7 +789,7 @@ // check if any interrupt was generated uint32 status = ReadOpReg(EHCI_USBSTS); - if ((status & EHCI_USBSTS_INTMASK) == 0) { + if ((status & fEnabledInterrupts) == 0) { release_spinlock(&lock); return B_UNHANDLED_INTERRUPT; } Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ehci.h 2008-06-06 10:36:50 UTC (rev 25821) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ehci.h 2008-06-06 11:23:38 UTC (rev 25822) @@ -134,6 +134,7 @@ area_id fRegisterArea; pci_info *fPCIInfo; Stack *fStack; + uint32 fEnabledInterrupts; // Periodic transfer framelist and interrupt entries area_id fPeriodicFrameListArea; Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci_hardware.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ehci_hardware.h 2008-06-06 10:36:50 UTC (rev 25821) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ehci_hardware.h 2008-06-06 11:23:38 UTC (rev 25822) @@ -56,7 +56,6 @@ #define EHCI_USBSTS_PORTCHANGE (1 << 2) // Port Change Detected #define EHCI_USBSTS_USBERRINT (1 << 1) // USB Error Interrupt #define EHCI_USBSTS_USBINT (1 << 0) // USB Interrupt -#define EHCI_USBSTS_INTMASK 0x37 // All except frame list rollover // USB Interrupt Enable Register (EHCI Spec 2.3.3) From axeld at pinc-software.de Fri Jun 6 13:26:33 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Fri, 06 Jun 2008 13:26:33 +0200 CEST Subject: [Haiku-commits] r25822 - haiku/trunk/src/add-ons/kernel/busses/usb In-Reply-To: <200806061123.m56BNew3015081@sheep.berlios.de> Message-ID: <16068141595-BeMail@zon> mmlr at BerliOS wrote: > - WriteOpReg(EHCI_USBINTR, EHCI_USBINTR_HOSTSYSERR > - | EHCI_USBINTR_USBERRINT | EHCI_USBINTR_USBINT | > EHCI_USBINTR_INTONAA); > + fEnabledInterrupts = EHCI_USBINTR_HOSTSYSERR | > EHCI_USBINTR_USBERRINT > + | EHCI_USBINTR_USBINT | EHCI_USBINTR_INTONAA; > + WriteOpReg(EHCI_USBINTR, fEnabledInterrupts); If those are always the same, isn't that more the job of a constant than a member variable? Bye, Axel. From mmlr at mlotz.ch Fri Jun 6 13:30:21 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Fri, 06 Jun 2008 13:30:21 +0200 Subject: [Haiku-commits] r25822 - haiku/trunk/src/add-ons/kernel/busses/usb In-Reply-To: <16068141595-BeMail@zon> Message-ID: <1442168000-BeMail@primary> > mmlr at BerliOS wrote: > > - WriteOpReg(EHCI_USBINTR, EHCI_USBINTR_HOSTSYSERR > > - | EHCI_USBINTR_USBERRINT | EHCI_USBINTR_USBINT | > > EHCI_USBINTR_INTONAA); > > + fEnabledInterrupts = EHCI_USBINTR_HOSTSYSERR | > > EHCI_USBINTR_USBERRINT > > + | EHCI_USBINTR_USBINT | EHCI_USBINTR_INTONAA; > > + WriteOpReg(EHCI_USBINTR, fEnabledInterrupts); > > If those are always the same, isn't that more the job of a constant > than a member variable? They might in fact change. For example when enabling support for port change notifications we want to dynamically en- and disable those interrupts as they should be reported, turned off and then only reenabled after being handled by the roothub. Regards Michael From mmlr at mail.berlios.de Fri Jun 6 13:45:11 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 6 Jun 2008 13:45:11 +0200 Subject: [Haiku-commits] r25823 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200806061145.m56BjBZf003024@sheep.berlios.de> Author: mmlr Date: 2008-06-06 13:45:10 +0200 (Fri, 06 Jun 2008) New Revision: 25823 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25823&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h haiku/trunk/src/add-ons/kernel/busses/usb/uhci_hardware.h Log: * When encountering an unrecoverable error at least turn off interrupts until we properly handle this case (cancel everything and reset the controller) to avoid flooding the system with interrupts. * Also only check for enabled interrupts to not steal potentially shared interrupts. Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2008-06-06 11:23:38 UTC (rev 25822) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2008-06-06 11:45:10 UTC (rev 25823) @@ -287,6 +287,7 @@ : BusManager(stack), fPCIInfo(info), fStack(stack), + fEnabledInterrupts(0), fFrameArea(-1), fFrameList(NULL), fFrameBandwidth(NULL), @@ -453,8 +454,10 @@ InterruptHandler, (void *)this, 0); // Enable interrupts - WriteReg16(UHCI_USBINTR, UHCI_USBINTR_CRC | UHCI_USBINTR_RESUME - | UHCI_USBINTR_IOC | UHCI_USBINTR_SHORT); + fEnabledInterrupts = UHCI_USBSTS_USBINT | UHCI_USBSTS_ERRINT + | UHCI_USBSTS_HOSTERR | UHCI_USBSTS_HCPRERR | UHCI_USBSTS_HCHALT; + WriteReg16(UHCI_USBINTR, UHCI_USBINTR_CRC | UHCI_USBINTR_IOC + | UHCI_USBINTR_SHORT); TRACE(("usb_uhci: UHCI Host Controller Driver constructed\n")); fInitOK = true; @@ -1536,7 +1539,7 @@ // Check if we really had an interrupt uint16 status = ReadReg16(UHCI_USBSTS); - if ((status & UHCI_INTERRUPT_MASK) == 0) { + if ((status & fEnabledInterrupts) == 0) { release_spinlock(&lock); return B_UNHANDLED_INTERRUPT; } @@ -1575,7 +1578,10 @@ } if (status & UHCI_USBSTS_HCHALT) { - TRACE(("usb_uhci: host controller halted\n")); + TRACE_ERROR(("usb_uhci: host controller halted\n")); + // at least disable interrupts so we do not flood the system + WriteReg16(UHCI_USBINTR, 0); + fEnabledInterrupts = 0; // ToDo: cancel all transfers and reset the host controller // acknowledge not needed } Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h 2008-06-06 11:23:38 UTC (rev 25822) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h 2008-06-06 11:45:10 UTC (rev 25823) @@ -194,6 +194,7 @@ uint32 fRegisterBase; pci_info *fPCIInfo; Stack *fStack; + uint32 fEnabledInterrupts; // Frame list memory area_id fFrameArea; Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci_hardware.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci_hardware.h 2008-06-06 11:23:38 UTC (rev 25822) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci_hardware.h 2008-06-06 11:45:10 UTC (rev 25823) @@ -50,7 +50,6 @@ #define UHCI_USBSTS_HOSTERR 0x08 // Host System Error #define UHCI_USBSTS_HCPRERR 0x10 // Host Controller Process error #define UHCI_USBSTS_HCHALT 0x20 // HCHalted -#define UHCI_INTERRUPT_MASK 0x3f // Mask for all the interrupts //USBINTR #define UHCI_USBINTR_CRC 0x01 // Timeout/ CRC interrupt enable From stippi at mail.berlios.de Fri Jun 6 14:40:11 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 6 Jun 2008 14:40:11 +0200 Subject: [Haiku-commits] r25824 - in haiku/trunk/src/apps/mediaplayer: . media_node_framework/video supplier support Message-ID: <200806061240.m56CeBaC006930@sheep.berlios.de> Author: stippi Date: 2008-06-06 14:40:10 +0200 (Fri, 06 Jun 2008) New Revision: 25824 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25824&view=rev Added: haiku/trunk/src/apps/mediaplayer/support/ColorSpaceToString.cpp haiku/trunk/src/apps/mediaplayer/support/ColorSpaceToString.h Modified: haiku/trunk/src/apps/mediaplayer/Jamfile haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.cpp haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.h Log: * Move the color_space_to_string() function into it's own file. * On BeOS "bitmaps_support_space()" returns false for YCbCr color spaces. :-( * Refactor the code which sets up the decoded format in the MediaTrack- VideoSupplier to always start with a clean format for multiple calls to BMediaTrack::DecodedFormat(). Modified: haiku/trunk/src/apps/mediaplayer/Jamfile =================================================================== --- haiku/trunk/src/apps/mediaplayer/Jamfile 2008-06-06 11:45:10 UTC (rev 25823) +++ haiku/trunk/src/apps/mediaplayer/Jamfile 2008-06-06 12:40:10 UTC (rev 25824) @@ -76,6 +76,7 @@ # support AbstractLOAdapter.cpp + ColorSpaceToString.cpp Command.cpp CommandStack.cpp Event.cpp Modified: haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.cpp 2008-06-06 11:45:10 UTC (rev 25823) +++ haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.cpp 2008-06-06 12:40:10 UTC (rev 25824) @@ -21,6 +21,7 @@ #include #include +#include "ColorSpaceToString.h" #include "NodeManager.h" #include "VideoTarget.h" @@ -440,15 +441,32 @@ uint32 flags = 0; bool supported = bitmaps_support_space( format->u.raw_video.display.format, &flags); +#ifndef HAIKU_TARGET_PLATFORM_HAIKU + // GRRR! BeOS implementation claims not + // to support these formats, while they work just fine. + switch (format->u.raw_video.display.format) { + case B_YCbCr422: + case B_YCbCr411: + case B_YCbCr444: + case B_YCbCr420: + supported = true; + break; + default: + break; + } +#endif if (!supported) { // cannot create bitmaps with such a color space - ERROR("AcceptFormat - unsupported color space for BBitmaps!\n"); + ERROR("AcceptFormat - unsupported color space for BBitmaps " + "(%s)!\n", + color_space_to_string(format->u.raw_video.display.format)); return B_MEDIA_BAD_FORMAT; } if (!fTryOverlay && (flags & B_VIEWS_SUPPORT_DRAW_BITMAP) == 0) { // BViews do not support drawing such a bitmap ERROR("AcceptFormat - BViews cannot draw bitmaps in given " - "colorspace!\n"); + "colorspace (%s)!\n", + color_space_to_string(format->u.raw_video.display.format)); return B_MEDIA_BAD_FORMAT; } } Modified: haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp 2008-06-06 11:45:10 UTC (rev 25823) +++ haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp 2008-06-06 12:40:10 UTC (rev 25824) @@ -1,9 +1,6 @@ /* - * Copyright 2007, Haiku. All rights reserved. - * Distributed under the terms of the MIT License. - * - * Authors: - * Stephan A?mus + * Copyright 2007-2008, Haiku. Stephan A?mus + * All rights reserved. Distributed under the terms of the MIT License. */ #include "MediaTrackVideoSupplier.h" @@ -13,6 +10,8 @@ #include +#include "ColorSpaceToString.h" + using std::nothrow; #define DEBUG_DECODED_FRAME 0 @@ -23,9 +22,6 @@ # include #endif // DEBUG_DECODED_FRAME -static const char* string_for_color_space(color_space format); - - // constructor MediaTrackVideoSupplier::MediaTrackVideoSupplier(BMediaTrack* track, status_t& initStatus) @@ -232,83 +228,8 @@ // #pragma mark - -const char* -string_for_color_space(color_space format) -{ - const char* name = ""; - switch (format) { - case B_RGB32: - name = "B_RGB32"; - break; - case B_RGBA32: - name = "B_RGBA32"; - break; - case B_RGB32_BIG: - name = "B_RGB32_BIG"; - break; - case B_RGBA32_BIG: - name = "B_RGBA32_BIG"; - break; - case B_RGB24: - name = "B_RGB24"; - break; - case B_RGB24_BIG: - name = "B_RGB24_BIG"; - break; - case B_CMAP8: - name = "B_CMAP8"; - break; - case B_GRAY8: - name = "B_GRAY8"; - break; - case B_GRAY1: - name = "B_GRAY1"; - break; - - // YCbCr - case B_YCbCr422: - name = "B_YCbCr422"; - break; - case B_YCbCr411: - name = "B_YCbCr411"; - break; - case B_YCbCr444: - name = "B_YCbCr444"; - break; - case B_YCbCr420: - name = "B_YCbCr420"; - break; - - // YUV - case B_YUV422: - name = "B_YUV422"; - break; - case B_YUV411: - name = "B_YUV411"; - break; - case B_YUV444: - name = "B_YUV444"; - break; - case B_YUV420: - name = "B_YUV420"; - break; - - case B_YUV9: - name = "B_YUV9"; - break; - case B_YUV12: - name = "B_YUV12"; - break; - - default: - break; - } - return name; -} - - status_t -MediaTrackVideoSupplier::_SwitchFormat(color_space format, int32 bytesPerRow) +MediaTrackVideoSupplier::_SwitchFormat(color_space format, uint32 bytesPerRow) { // get the encoded format memset(&fFormat, 0, sizeof(media_format)); @@ -331,41 +252,26 @@ } else { printf("MediaTrackVideoSupplier::_SwitchFormat() - " "preferred color space: %s\n", - string_for_color_space(format)); + color_space_to_string(format)); } } - // specifiy the decoded format. we derive this information from - // the encoded format (width & height). - memset(&fFormat, 0, sizeof(media_format)); -// fFormat.u.raw_video.last_active = height - 1; -// fFormat.u.raw_video.orientation = B_VIDEO_TOP_LEFT_RIGHT; -// fFormat.u.raw_video.pixel_width_aspect = 1; -// fFormat.u.raw_video.pixel_height_aspect = 1; - fFormat.u.raw_video.display.format = format; - fFormat.u.raw_video.display.line_width = width; - fFormat.u.raw_video.display.line_count = height; - int32 minBytesPerRow; + uint32 minBytesPerRow; if (format == B_YCbCr422) minBytesPerRow = ((width * 2 + 3) / 4) * 4; else minBytesPerRow = width * 4; - fFormat.u.raw_video.display.bytes_per_row = max_c(minBytesPerRow, - bytesPerRow); + bytesPerRow = max_c(bytesPerRow, minBytesPerRow); - ret = fVideoTrack->DecodedFormat(&fFormat); - + ret = _SetDecodedFormat(width, height, format, bytesPerRow); if (ret < B_OK) { printf("MediaTrackVideoSupplier::_SwitchFormat() - " "fVideoTrack->DecodedFormat(): %s - retrying with B_RGB32\n", strerror(ret)); format = B_RGB32; - fFormat.u.raw_video.display.format = format; - minBytesPerRow = width * 4; - fFormat.u.raw_video.display.bytes_per_row = max_c(minBytesPerRow, - bytesPerRow); + bytesPerRow = max_c(bytesPerRow, width * 4); - ret = fVideoTrack->DecodedFormat(&fFormat); + ret = _SetDecodedFormat(width, height, format, bytesPerRow); if (ret < B_OK) { printf("MediaTrackVideoSupplier::_SwitchFormat() - " "fVideoTrack->DecodedFormat(): %s - giving up\n", @@ -377,19 +283,18 @@ if (fFormat.u.raw_video.display.format != format) { printf("MediaTrackVideoSupplier::_SwitchFormat() - " " codec changed colorspace of decoded format (%s -> %s)!\n", - string_for_color_space(format), - string_for_color_space(fFormat.u.raw_video.display.format)); + color_space_to_string(format), + color_space_to_string(fFormat.u.raw_video.display.format)); // check if the codec forgot to adjust bytes_per_row - uint32 minBPR; format = fFormat.u.raw_video.display.format; if (format == B_YCbCr422) - minBPR = ((width * 2 + 3) / 4) * 4; + minBytesPerRow = ((width * 2 + 3) / 4) * 4; else - minBPR = width * 4; - if (minBPR > fFormat.u.raw_video.display.bytes_per_row) { + minBytesPerRow = width * 4; + if (minBytesPerRow > fFormat.u.raw_video.display.bytes_per_row) { printf(" -> stupid codec forgot to adjust bytes_per_row!\n"); - fFormat.u.raw_video.display.bytes_per_row = minBPR; - ret = fVideoTrack->DecodedFormat(&fFormat); + + ret = _SetDecodedFormat(width, height, format, minBytesPerRow); } } @@ -400,3 +305,24 @@ return ret; } + + +status_t +MediaTrackVideoSupplier::_SetDecodedFormat(uint32 width, uint32 height, + color_space format, uint32 bytesPerRow) +{ + // specifiy the decoded format. we derive this information from + // the encoded format (width & height). + memset(&fFormat, 0, sizeof(media_format)); +// fFormat.u.raw_video.last_active = height - 1; +// fFormat.u.raw_video.orientation = B_VIDEO_TOP_LEFT_RIGHT; +// fFormat.u.raw_video.pixel_width_aspect = 1; +// fFormat.u.raw_video.pixel_height_aspect = 1; + fFormat.u.raw_video.display.format = format; + fFormat.u.raw_video.display.line_width = width; + fFormat.u.raw_video.display.line_count = height; + fFormat.u.raw_video.display.bytes_per_row = bytesPerRow; + + return fVideoTrack->DecodedFormat(&fFormat); +} + Modified: haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.h 2008-06-06 11:45:10 UTC (rev 25823) +++ haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.h 2008-06-06 12:40:10 UTC (rev 25824) @@ -44,7 +44,9 @@ private: status_t _SwitchFormat(color_space format, - int32 bytesPerRow); + uint32 bytesPerRow); + status_t _SetDecodedFormat(uint32 width, uint32 height, + color_space format, uint32 bytesPerRow); BMediaTrack* fVideoTrack; Added: haiku/trunk/src/apps/mediaplayer/support/ColorSpaceToString.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/support/ColorSpaceToString.cpp 2008-06-06 11:45:10 UTC (rev 25823) +++ haiku/trunk/src/apps/mediaplayer/support/ColorSpaceToString.cpp 2008-06-06 12:40:10 UTC (rev 25824) @@ -0,0 +1,80 @@ +/* + * Copyright 2007-2008, Haiku. Stephan A?mus + * All rights reserved. Distributed under the terms of the MIT License. + */ +#include "ColorSpaceToString.h" + + +const char* +color_space_to_string(color_space format) +{ + const char* name = ""; + switch (format) { + case B_RGB32: + name = "B_RGB32"; + break; + case B_RGBA32: + name = "B_RGBA32"; + break; + case B_RGB32_BIG: + name = "B_RGB32_BIG"; + break; + case B_RGBA32_BIG: + name = "B_RGBA32_BIG"; + break; + case B_RGB24: + name = "B_RGB24"; + break; + case B_RGB24_BIG: + name = "B_RGB24_BIG"; + break; + case B_CMAP8: + name = "B_CMAP8"; + break; + case B_GRAY8: + name = "B_GRAY8"; + break; + case B_GRAY1: + name = "B_GRAY1"; + break; + + // YCbCr + case B_YCbCr422: + name = "B_YCbCr422"; + break; + case B_YCbCr411: + name = "B_YCbCr411"; + break; + case B_YCbCr444: + name = "B_YCbCr444"; + break; + case B_YCbCr420: + name = "B_YCbCr420"; + break; + + // YUV + case B_YUV422: + name = "B_YUV422"; + break; + case B_YUV411: + name = "B_YUV411"; + break; + case B_YUV444: + name = "B_YUV444"; + break; + case B_YUV420: + name = "B_YUV420"; + break; + + case B_YUV9: + name = "B_YUV9"; + break; + case B_YUV12: + name = "B_YUV12"; + break; + + default: + break; + } + return name; +} Added: haiku/trunk/src/apps/mediaplayer/support/ColorSpaceToString.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/support/ColorSpaceToString.h 2008-06-06 11:45:10 UTC (rev 25823) +++ haiku/trunk/src/apps/mediaplayer/support/ColorSpaceToString.h 2008-06-06 12:40:10 UTC (rev 25824) @@ -0,0 +1,13 @@ +/* + * Copyright 2007-2008, Haiku. Stephan A?mus + * All rights reserved. Distributed under the terms of the MIT License. + */ + +#ifndef COLOR_SPACE_TO_STRING_H +#define COLOR_SPACE_TO_STRING_H + +#include + +const char* color_space_to_string(color_space format); + +#endif // COLOR_SPACE_TO_STRING_H From stippi at mail.berlios.de Fri Jun 6 15:07:02 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 6 Jun 2008 15:07:02 +0200 Subject: [Haiku-commits] r25825 - haiku/trunk/src/kits/media Message-ID: <200806061307.m56D72cG008948@sheep.berlios.de> Author: stippi Date: 2008-06-06 15:07:02 +0200 (Fri, 06 Jun 2008) New Revision: 25825 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25825&view=rev Modified: haiku/trunk/src/kits/media/MediaExtractor.cpp haiku/trunk/src/kits/media/MediaTrack.cpp Log: * Use NULL instead of 0 for some pointer initializations. * Slightly more debug output for failed atempts to create a decoder. Modified: haiku/trunk/src/kits/media/MediaExtractor.cpp =================================================================== --- haiku/trunk/src/kits/media/MediaExtractor.cpp 2008-06-06 12:40:10 UTC (rev 25824) +++ haiku/trunk/src/kits/media/MediaExtractor.cpp 2008-06-06 13:07:02 UTC (rev 25825) @@ -21,7 +21,7 @@ { CALLED(); fSource = source; - fStreamInfo = 0; + fStreamInfo = NULL; fExtractorThread = -1; fExtractorWaitSem = -1; fTerminateExtractor = false; @@ -276,8 +276,11 @@ res = _plugin_manager.CreateDecoder(&decoder, fStreamInfo[stream].encodedFormat); if (res != B_OK) { + char formatString[256]; + string_for_format(&fStreamInfo[stream].encodedFormat, formatString, + 256); ERROR("MediaExtractor::CreateDecoder _plugin_manager.CreateDecoder " - "failed for stream %ld\n", stream); + "failed for stream %ld, format: %s\n", stream, formatString); return res; } Modified: haiku/trunk/src/kits/media/MediaTrack.cpp =================================================================== --- haiku/trunk/src/kits/media/MediaTrack.cpp 2008-06-06 12:40:10 UTC (rev 25824) +++ haiku/trunk/src/kits/media/MediaTrack.cpp 2008-06-06 13:07:02 UTC (rev 25825) @@ -708,11 +708,13 @@ fErr = B_OK; SetupWorkaround(); - - if (fExtractor->CreateDecoder(fStream, &fDecoder, &fMCI) != B_OK) { - TRACE("BMediaTrack::BMediaTrack: Error: creating decoder failed\n"); + + status_t ret = fExtractor->CreateDecoder(fStream, &fDecoder, &fMCI); + if (ret != B_OK) { + TRACE("BMediaTrack::BMediaTrack: Error: creating decoder failed: " + "%s\n", strerror(ret)); // we do not set fErr here, because ReadChunk should still work - fDecoder = 0; + fDecoder = NULL; return; } @@ -720,9 +722,9 @@ fCurTime = 0; // not used: - fEncoder = 0; + fEncoder = NULL; fEncoderID = 0; - fWriter = 0; + fWriter = NULL; } From ingo_weinhold at gmx.de Fri Jun 6 17:42:31 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Fri, 06 Jun 2008 17:42:31 +0200 Subject: [Haiku-commits] r25818 - haiku/trunk/headers/posix In-Reply-To: <200806060742.m567gxsM021879@sheep.berlios.de> References: <200806060742.m567gxsM021879@sheep.berlios.de> Message-ID: <20080606174231.373.1@knochen-vm.1212766623.fake> On 2008-06-06 at 09:42:59 [+0200], axeld at BerliOS wrote: > Author: axeld > Date: 2008-06-06 09:42:58 +0200 (Fri, 06 Jun 2008) > New Revision: 25818 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25818&view=rev > > Modified: > haiku/trunk/headers/posix/search.h > Log: > The "search.h" header had a couple of issues: > * It was not self containing, as it used size_t without defining it. > * It was not C++ safe. > * It used the restrict keyword that is not recognized in GCC2. This fixes > bug > #2262. > * It did not contain parameter names as demanded by our coding style. It still has the problem that it declares functions (namely the hash table functions) that aren't exported by libroot. CU, Ingo From aldeck at mail.berlios.de Fri Jun 6 17:07:40 2008 From: aldeck at mail.berlios.de (aldeck at BerliOS) Date: Fri, 6 Jun 2008 17:07:40 +0200 Subject: [Haiku-commits] r25826 - haiku/trunk/src/apps/deskbar Message-ID: <200806061507.m56F7eqN019502@sheep.berlios.de> Author: aldeck Date: 2008-06-06 17:07:40 +0200 (Fri, 06 Jun 2008) New Revision: 25826 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25826&view=rev Modified: haiku/trunk/src/apps/deskbar/ExpandoMenuBar.cpp Log: - In vertical mode, TExpandoMenuBar used its own width to set the width of a newly added item. Removing the last item made the MenuBar resizes itself to (0,0), and broke further item width computation. We now use the parent view width (BarView) instead. This fixes #471 Modified: haiku/trunk/src/apps/deskbar/ExpandoMenuBar.cpp =================================================================== --- haiku/trunk/src/apps/deskbar/ExpandoMenuBar.cpp 2008-06-06 13:07:02 UTC (rev 25825) +++ haiku/trunk/src/apps/deskbar/ExpandoMenuBar.cpp 2008-06-06 15:07:40 UTC (rev 25826) @@ -488,7 +488,7 @@ void TExpandoMenuBar::AddTeam(BList *team, BBitmap *icon, char *name, char *signature) { - float itemWidth = fVertical ? Frame().Width() : kMinimumWindowWidth; + float itemWidth = fVertical ? fBarView->Bounds().Width() : kMinimumWindowWidth; float itemHeight = -1.0f; desk_settings *settings = ((TBarApp *)be_app)->Settings(); From anevilyak at mail.berlios.de Fri Jun 6 17:27:32 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Fri, 6 Jun 2008 17:27:32 +0200 Subject: [Haiku-commits] r25827 - haiku/trunk/src/kits/media Message-ID: <200806061527.m56FRWpV021081@sheep.berlios.de> Author: anevilyak Date: 2008-06-06 17:27:28 +0200 (Fri, 06 Jun 2008) New Revision: 25827 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25827&view=rev Modified: haiku/trunk/src/kits/media/MediaExtractor.cpp Log: Build fix. Modified: haiku/trunk/src/kits/media/MediaExtractor.cpp =================================================================== --- haiku/trunk/src/kits/media/MediaExtractor.cpp 2008-06-06 15:07:40 UTC (rev 25826) +++ haiku/trunk/src/kits/media/MediaExtractor.cpp 2008-06-06 15:27:28 UTC (rev 25827) @@ -277,7 +277,7 @@ fStreamInfo[stream].encodedFormat); if (res != B_OK) { char formatString[256]; - string_for_format(&fStreamInfo[stream].encodedFormat, formatString, + string_for_format(fStreamInfo[stream].encodedFormat, formatString, 256); ERROR("MediaExtractor::CreateDecoder _plugin_manager.CreateDecoder " "failed for stream %ld, format: %s\n", stream, formatString); From mmlr at mail.berlios.de Fri Jun 6 20:53:45 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 6 Jun 2008 20:53:45 +0200 Subject: [Haiku-commits] r25828 - haiku/trunk/src/add-ons/kernel/file_systems/fat Message-ID: <200806061853.m56IrjUf000819@sheep.berlios.de> Author: mmlr Date: 2008-06-06 20:53:44 +0200 (Fri, 06 Jun 2008) New Revision: 25828 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25828&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/fat/dosfs.c Log: * Unify reading the FAT volume label. One of two places didn't yet handle FAT32 volume labels at all. * Use the common function in both identifying and mounting the volume so the name is in sync between what the disk device manager got through scanning and what Tracker gets through reading the fs stat. * Strip trailing spaces from volume names in all places. Modified: haiku/trunk/src/add-ons/kernel/file_systems/fat/dosfs.c =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/fat/dosfs.c 2008-06-06 15:27:28 UTC (rev 25827) +++ haiku/trunk/src/add-ons/kernel/file_systems/fat/dosfs.c 2008-06-06 18:53:44 UTC (rev 25828) @@ -146,6 +146,35 @@ #endif +static void +dosfs_trim_spaces(char *label) +{ + uint8 index; + for (index = 10; index > 0; index--) { + if (label[index] == ' ') + label[index] = 0; + else + break; + } +} + +static bool +dosfs_read_label(bool fat32, uint8 *buffer, char *label) +{ + uint8 check = fat32 ? 0x42 : 0x29; + uint8 offset = fat32 ? 0x47 : 0x2b; + + if (buffer[check] == 0x29 + && memcmp(buffer + offset, " ", 11) != 0) { + memcpy(label, buffer + offset, 11); + dosfs_trim_spaces(label); + return true; + } + + return false; +} + + static int lock_removable_device(int fd, bool state) { @@ -283,7 +312,7 @@ } vol->vol_entry = -2; // for now, assume there is no volume entry - memset(vol->vol_label, ' ', 11); + strcpy(vol->vol_label, "no name"); // now become more discerning citizens vol->sectors_per_fat = read16(buf,0x16); @@ -311,6 +340,9 @@ dprintf("dosfs: root vnode cluster too large (%lx)\n", vol->root_vnode.cluster); goto error; } + + if (dosfs_read_label(true, buf, vol->vol_label)) + vol->vol_entry = -1; } else { // fat12 & fat16 if (vol->fat_count != 2) { @@ -351,15 +383,6 @@ } } - - if (buf[0x26] == 0x29) { - // fill in the volume label - if (memcmp(buf+0x2b, " ", 11)) { - memcpy(vol->vol_label, buf+0x2b, 11); - vol->vol_entry = -1; - } - } - vol->fat_mirrored = true; vol->active_fat = 0; @@ -378,6 +401,9 @@ vol->fat_bits = 16; else vol->fat_bits = 12; + + if (dosfs_read_label(false, buf, vol->vol_label)) + vol->vol_entry = -1; } /* check that the partition is large enough to contain the file system */ @@ -528,6 +554,7 @@ if ((buffer[0x0b] & FAT_VOLUME) && (buffer[0x0b] != 0xf) && (buffer[0] != 0xe5)) { vol->vol_entry = diri.current_index; memcpy(vol->vol_label, buffer, 11); + dosfs_trim_spaces(vol->vol_label); break; } } @@ -535,7 +562,7 @@ } DPRINTF(0, ("root vnode id = %Lx\n", vol->root_vnode.vnid)); - DPRINTF(0, ("volume label [%11.11s] (%lx)\n", vol->vol_label, vol->vol_entry)); + DPRINTF(0, ("volume label [%s] (%lx)\n", vol->vol_label, vol->vol_entry)); // steal a trick from bfs if (!memcmp(vol->vol_label, "__RO__ ", 11)) { @@ -622,26 +649,17 @@ return -1; } - strcpy(name, "no name "); + strcpy(name, "no name"); sectors_per_fat = read16(buf,0x16); if (sectors_per_fat == 0) { total_sectors = read32(buf,0x20); - - if (buf[0x42] == 0x29) { - // fill in FAT32 volume label - if (memcmp(buf + 0x47, " ", 11) != 0) - memcpy(name, buf + 0x47, 11); - } + dosfs_read_label(true, buf, name); } else { total_sectors = read16(buf,0x13); // partition size if (total_sectors == 0) total_sectors = read32(buf,0x20); - if (buf[0x26] == 0x29) { - // fill in the volume label - if (memcmp(buf + 0x2b, " ", 11) != 0) - memcpy(name, buf + 0x2b, 11); - } + dosfs_read_label(false, buf, name); } cookie = (identify_cookie *)malloc(sizeof(identify_cookie)); @@ -924,7 +942,7 @@ if (vol->vol_entry > -2) strncpy(fss->volume_name, vol->vol_label, sizeof(fss->volume_name)); else - strcpy(fss->volume_name, "no name "); + strcpy(fss->volume_name, "no name"); // XXX: should sanitize name as well for (i=10;i>0;i--) @@ -996,13 +1014,16 @@ result = EIO; goto bi; } - if ((buffer[0x26] != 0x29) || memcmp(buffer + 0x2b, vol->vol_label, 11)) { + if ((vol->sectors_per_fat == 0 && (buffer[0x42] != 0x29 + || strncmp(buffer + 0x47, vol->vol_label, 11) != 0)) + || (vol->sectors_per_fat != 0 && (buffer[0x26] != 0x29 + || strncmp(buffer + 0x2b, vol->vol_label, 11) != 0))) { dprintf("dosfs_wfsstat: label mismatch\n"); block_cache_set_dirty(vol->fBlockCache, 0, false, tid); result = B_ERROR; } else { memcpy(buffer + 0x2b, name, 11); - result = 0; + result = B_OK; } block_cache_put(vol->fBlockCache, 0); cache_end_transaction(vol->fBlockCache, tid, NULL, NULL); @@ -1012,7 +1033,7 @@ buffer = diri_init(vol, vol->root_vnode.cluster, vol->vol_entry, &diri); // check if it is the same as the old volume label - if ((buffer == NULL) || (memcmp(buffer, vol->vol_label, 11))) { + if ((buffer == NULL) || (strncmp(buffer, vol->vol_label, 11))) { dprintf("dosfs_wfsstat: label mismatch\n"); diri_free(&diri); result = B_ERROR; @@ -1021,15 +1042,17 @@ memcpy(buffer, name, 11); diri_mark_dirty(&diri); diri_free(&diri); - result = 0; + result = B_OK; } else { uint32 index; result = create_volume_label(vol, name, &index); if (result == B_OK) vol->vol_entry = index; } - if (result == 0) + if (result == B_OK) { memcpy(vol->vol_label, name, 11); + dosfs_trim_spaces(vol->vol_label); + } } if (vol->fs_flags & FS_FLAGS_OP_SYNC) @@ -1083,7 +1106,7 @@ dprintf("fat mirroring is %s, fs info sector at sector %x\n", (vol->fat_mirrored) ? "on" : "off", vol->fsinfo_sector); dprintf("last allocated cluster = %lx\n", vol->last_allocated); dprintf("root vnode id = %Lx\n", vol->root_vnode.vnid); - dprintf("volume label [%11.11s]\n", vol->vol_label); + dprintf("volume label [%s]\n", vol->vol_label); break; case 100001 : From mmlr at mail.berlios.de Fri Jun 6 22:31:00 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 6 Jun 2008 22:31:00 +0200 Subject: [Haiku-commits] r25829 - haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk Message-ID: <200806062031.m56KV0Ao009758@sheep.berlios.de> Author: mmlr Date: 2008-06-06 22:30:58 +0200 (Fri, 06 Jun 2008) New Revision: 25829 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25829&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp Log: Fix a deadlock when removing a mass storage device that had active transfers. Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp 2008-06-06 18:53:44 UTC (rev 25828) +++ haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp 2008-06-06 20:30:58 UTC (rev 25829) @@ -631,9 +631,9 @@ gLunCount -= device->lun_count; gDeviceCount--; - mutex_lock(&device->lock); device->removed = true; - mutex_unlock(&device->lock); + gUSBModule->cancel_queued_transfers(device->bulk_in); + gUSBModule->cancel_queued_transfers(device->bulk_out); if (device->open_count == 0) usb_disk_free_device_and_luns(device); From mmlr at mail.berlios.de Fri Jun 6 22:36:23 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 6 Jun 2008 22:36:23 +0200 Subject: [Haiku-commits] r25830 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid Message-ID: <200806062036.m56KaNqX010222@sheep.berlios.de> Author: mmlr Date: 2008-06-06 22:36:23 +0200 (Fri, 06 Jun 2008) New Revision: 25830 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25830&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/Driver.cpp Log: Initialize the mutex before using it. Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/Driver.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/Driver.cpp 2008-06-06 20:30:58 UTC (rev 25829) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/Driver.cpp 2008-06-06 20:36:23 UTC (rev 25830) @@ -226,6 +226,8 @@ return B_NO_MEMORY; } + mutex_init(&sDriverLock, "usb hid driver lock"); + static usb_notify_hooks notifyHooks = { &usb_hid_device_added, &usb_hid_device_removed @@ -250,6 +252,7 @@ put_module(B_USB_MODULE_NAME); delete gDeviceList; gDeviceList = NULL; + mutex_destroy(&sDriverLock); } From anevilyak at mail.berlios.de Fri Jun 6 23:01:52 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Fri, 6 Jun 2008 23:01:52 +0200 Subject: [Haiku-commits] r25831 - haiku/trunk/src/kits/interface Message-ID: <200806062101.m56L1qeG012479@sheep.berlios.de> Author: anevilyak Date: 2008-06-06 23:01:51 +0200 (Fri, 06 Jun 2008) New Revision: 25831 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25831&view=rev Modified: haiku/trunk/src/kits/interface/OutlineListView.cpp Log: Fix logic bug in quick sort routine. This would result in infinite recursion such as that in bug #2343. Modified: haiku/trunk/src/kits/interface/OutlineListView.cpp =================================================================== --- haiku/trunk/src/kits/interface/OutlineListView.cpp 2008-06-06 20:36:23 UTC (rev 25830) +++ haiku/trunk/src/kits/interface/OutlineListView.cpp 2008-06-06 21:01:51 UTC (rev 25831) @@ -27,6 +27,9 @@ quick_sort_item_array(BListItem** items, int32 first, int32 last, int (*compareFunc)(const BListItem* a, const BListItem* b)) { + printf("quick_sort_item_array(items: %p, first: %ld, last: %ld, comparefunc: %p)\n", + items, first, last, compareFunc); + if (last <= first) return; @@ -42,7 +45,6 @@ while ((compareFunc(items[right], pivot) > 0) && (right > first)) right--; - if (left < right) { // swap entries @@ -61,13 +63,13 @@ // At this point, the elements in the left half are all smaller // than the elements in the right half - if (first < right) { + if (first < left) { // sort left half - quick_sort_item_array(items, first, right, compareFunc); + quick_sort_item_array(items, first, left, compareFunc); } - if (left < last) { + if (right < last) { // sort right half - quick_sort_item_array(items, left, last, compareFunc); + quick_sort_item_array(items, right, last, compareFunc); } } From anevilyak at mail.berlios.de Fri Jun 6 23:03:37 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Fri, 6 Jun 2008 23:03:37 +0200 Subject: [Haiku-commits] r25832 - haiku/trunk/src/kits/interface Message-ID: <200806062103.m56L3b3T012655@sheep.berlios.de> Author: anevilyak Date: 2008-06-06 23:03:37 +0200 (Fri, 06 Jun 2008) New Revision: 25832 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25832&view=rev Modified: haiku/trunk/src/kits/interface/OutlineListView.cpp Log: Remove stray debug output. Modified: haiku/trunk/src/kits/interface/OutlineListView.cpp =================================================================== --- haiku/trunk/src/kits/interface/OutlineListView.cpp 2008-06-06 21:01:51 UTC (rev 25831) +++ haiku/trunk/src/kits/interface/OutlineListView.cpp 2008-06-06 21:03:37 UTC (rev 25832) @@ -27,9 +27,6 @@ quick_sort_item_array(BListItem** items, int32 first, int32 last, int (*compareFunc)(const BListItem* a, const BListItem* b)) { - printf("quick_sort_item_array(items: %p, first: %ld, last: %ld, comparefunc: %p)\n", - items, first, last, compareFunc); - if (last <= first) return; From korli at mail.berlios.de Sat Jun 7 00:23:26 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 7 Jun 2008 00:23:26 +0200 Subject: [Haiku-commits] r25833 - in haiku/trunk: headers/private/system src/bin/listdev src/system/kernel/device_manager Message-ID: <200806062223.m56MNQdq018807@sheep.berlios.de> Author: korli Date: 2008-06-07 00:23:25 +0200 (Sat, 07 Jun 2008) New Revision: 25833 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25833&view=rev Modified: haiku/trunk/headers/private/system/device_manager_defs.h haiku/trunk/src/bin/listdev/dm_wrapper.c haiku/trunk/src/bin/listdev/dm_wrapper.h haiku/trunk/src/bin/listdev/listdev.c haiku/trunk/src/system/kernel/device_manager/device_manager.cpp Log: fixed listdev and device_manager syscalls Modified: haiku/trunk/headers/private/system/device_manager_defs.h =================================================================== --- haiku/trunk/headers/private/system/device_manager_defs.h 2008-06-06 21:03:37 UTC (rev 25832) +++ haiku/trunk/headers/private/system/device_manager_defs.h 2008-06-06 22:23:25 UTC (rev 25833) @@ -17,9 +17,11 @@ #define DM_GET_NEXT_CHILD 3 #define DM_GET_NEXT_ATTRIBUTE 4 +typedef addr_t device_node_cookie; + struct device_attr_info { - uint32 node_cookie; - uint32 cookie; + device_node_cookie node_cookie; + device_node_cookie cookie; char name[255]; type_code type; union { Modified: haiku/trunk/src/bin/listdev/dm_wrapper.c =================================================================== --- haiku/trunk/src/bin/listdev/dm_wrapper.c 2008-06-06 21:03:37 UTC (rev 25832) +++ haiku/trunk/src/bin/listdev/dm_wrapper.c 2008-06-06 22:23:25 UTC (rev 25833) @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -23,26 +24,26 @@ } status_t -get_root(uint32 *cookie) +get_root(device_node_cookie *cookie) { - return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_ROOT, cookie, sizeof(uint32)); + return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_ROOT, cookie, sizeof(device_node_cookie)); } status_t -get_child(uint32 *device) +get_child(device_node_cookie *device) { - return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_CHILD, device, sizeof(uint32)); + return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_CHILD, device, sizeof(device_node_cookie)); } status_t -get_next_child(uint32 *device) +get_next_child(device_node_cookie *device) { - return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_NEXT_CHILD, device, sizeof(uint32)); + return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_NEXT_CHILD, device, sizeof(device_node_cookie)); } status_t -dm_get_next_attr(struct dev_attr *attr) +dm_get_next_attr(struct device_attr_info *attr) { - return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_NEXT_ATTRIBUTE, attr, sizeof(struct dev_attr)); + return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_NEXT_ATTRIBUTE, attr, sizeof(struct device_attr_info)); } Modified: haiku/trunk/src/bin/listdev/dm_wrapper.h =================================================================== --- haiku/trunk/src/bin/listdev/dm_wrapper.h 2008-06-06 21:03:37 UTC (rev 25832) +++ haiku/trunk/src/bin/listdev/dm_wrapper.h 2008-06-06 22:23:25 UTC (rev 25833) @@ -1,14 +1,14 @@ #ifndef _DM_WRAPPER_H_ #define _DM_WRAPPER_H_ -#include "kdevice_manager.h" +#include "device_manager_defs.h" status_t init_dm_wrapper(void); status_t uninit_dm_wrapper(void); -status_t get_root(uint32 *cookie); -status_t get_child(uint32 *cookie); -status_t get_next_child(uint32 *cookie); -status_t dm_get_next_attr(struct dev_attr *attr); +status_t get_root(device_node_cookie *cookie); +status_t get_child(device_node_cookie *cookie); +status_t get_next_child(device_node_cookie *cookie); +status_t dm_get_next_attr(struct device_attr_info *attr); #endif Modified: haiku/trunk/src/bin/listdev/listdev.c =================================================================== --- haiku/trunk/src/bin/listdev/listdev.c 2008-06-06 21:03:37 UTC (rev 25832) +++ haiku/trunk/src/bin/listdev/listdev.c 2008-06-06 22:23:25 UTC (rev 25833) @@ -74,7 +74,7 @@ static void -dump_attribute(struct dev_attr *attr, int32 level) +dump_attribute(struct device_attr_info *attr, int32 level) { if (attr == NULL) return; @@ -105,10 +105,10 @@ static void -dump_device(uint32 *node, uint8 level) +dump_device(device_node_cookie *node, uint8 level) { char data[256]; - struct dev_attr attr; + struct device_attr_info attr; attr.cookie = 0; attr.node_cookie = *node; attr.value.raw.data = data; @@ -121,14 +121,12 @@ static void -dump_nodes(uint32 *node, uint8 level) +dump_nodes(device_node_cookie *node, uint8 level) { status_t err; - uint32 child = *node; + device_node_cookie child = *node; dump_device(node, level); - printf("node %lu\n", *node); - if (get_child(&child) != B_OK) return; @@ -140,17 +138,17 @@ static int32 -display_device(uint32 *node, uint8 level, int parent_bus, int *bus) +display_device(device_node_cookie *node, uint8 level) { uint8 new_level = level; char data[256]; - struct dev_attr attr; + struct device_attr_info attr; // BUS attributes - uint8 is_bus = 0; - char connection[64]; + char device_bus[64]; uint8 scsi_path_id = 255; + int bus = 0; // PCI attributes uint8 pci_class_base_id = 0; @@ -179,76 +177,62 @@ attr.value.raw.length = sizeof(data); while (dm_get_next_attr(&attr) == B_OK) { - if (!strcmp(attr.name, PNP_BUS_IS_BUS) - && attr.type == B_UINT8_TYPE) { - is_bus = attr.value.ui8; - } else if (!strcmp(attr.name, PNP_DRIVER_CONNECTION) + if (!strcmp(attr.name, B_DEVICE_BUS) && attr.type == B_STRING_TYPE) { - strlcpy(connection, attr.value.string, 64); + strlcpy(device_bus, attr.value.string, 64); } else if (!strcmp(attr.name, "scsi/path_id") && attr.type == B_UINT8_TYPE) { scsi_path_id = attr.value.ui8; - } + } else if (!strcmp(attr.name, B_DEVICE_TYPE) + && attr.type == B_UINT8_TYPE) + pci_class_base_id = attr.value.ui8; + else if (!strcmp(attr.name, B_DEVICE_SUB_TYPE) + && attr.type == B_UINT8_TYPE) + pci_class_sub_id = attr.value.ui8; + else if (!strcmp(attr.name, B_DEVICE_INTERFACE) + && attr.type == B_UINT8_TYPE) + pci_class_api_id = attr.value.ui8; + else if (!strcmp(attr.name, B_DEVICE_VENDOR_ID) + && attr.type == B_UINT16_TYPE) + pci_vendor_id = attr.value.ui16; + else if (!strcmp(attr.name, B_DEVICE_ID) + && attr.type == B_UINT16_TYPE) + pci_device_id = attr.value.ui16; + else if (!strcmp(attr.name, SCSI_DEVICE_TARGET_LUN_ITEM) + && attr.type == B_UINT8_TYPE) + scsi_target_lun = attr.value.ui8; + else if (!strcmp(attr.name, SCSI_DEVICE_TARGET_ID_ITEM) + && attr.type == B_UINT8_TYPE) + scsi_target_id = attr.value.ui8; + else if (!strcmp(attr.name, SCSI_DEVICE_TYPE_ITEM) + && attr.type == B_UINT8_TYPE) + scsi_type = attr.value.ui8; + else if (!strcmp(attr.name, SCSI_DEVICE_VENDOR_ITEM) + && attr.type == B_STRING_TYPE) + strlcpy(scsi_vendor, attr.value.string, 64); + else if (!strcmp(attr.name, SCSI_DEVICE_PRODUCT_ITEM) + && attr.type == B_STRING_TYPE) + strlcpy(scsi_product, attr.value.string, 64); - switch (parent_bus) { - case BUS_ISA: - break; - case BUS_PCI: - if (!strcmp(attr.name, PCI_DEVICE_BASE_CLASS_ID_ITEM) - && attr.type == B_UINT8_TYPE) - pci_class_base_id = attr.value.ui8; - else if (!strcmp(attr.name, PCI_DEVICE_SUB_CLASS_ID_ITEM) - && attr.type == B_UINT8_TYPE) - pci_class_sub_id = attr.value.ui8; - else if (!strcmp(attr.name, PCI_DEVICE_API_ID_ITEM) - && attr.type == B_UINT8_TYPE) - pci_class_api_id = attr.value.ui8; - else if (!strcmp(attr.name, PCI_DEVICE_VENDOR_ID_ITEM) - && attr.type == B_UINT16_TYPE) - pci_vendor_id = attr.value.ui16; - else if (!strcmp(attr.name, PCI_DEVICE_DEVICE_ID_ITEM) - && attr.type == B_UINT16_TYPE) - pci_device_id = attr.value.ui16; - else if (!strcmp(attr.name, PCI_DEVICE_SUBVENDOR_ID_ITEM) - && attr.type == B_UINT16_TYPE) - pci_subsystem_vendor_id = attr.value.ui16; - else if (!strcmp(attr.name, PCI_DEVICE_SUBSYSTEM_ID_ITEM) - && attr.type == B_UINT16_TYPE) - pci_subsystem_id = attr.value.ui16; - break; - case BUS_SCSI: - if (!strcmp(attr.name, SCSI_DEVICE_TARGET_LUN_ITEM) - && attr.type == B_UINT8_TYPE) - scsi_target_lun = attr.value.ui8; - if (!strcmp(attr.name, SCSI_DEVICE_TARGET_ID_ITEM) - && attr.type == B_UINT8_TYPE) - scsi_target_id = attr.value.ui8; - if (!strcmp(attr.name, SCSI_DEVICE_TYPE_ITEM) - && attr.type == B_UINT8_TYPE) - scsi_type = attr.value.ui8; - if (!strcmp(attr.name, SCSI_DEVICE_VENDOR_ITEM) - && attr.type == B_STRING_TYPE) - strlcpy(scsi_vendor, attr.value.string, 64); - if (!strcmp(attr.name, SCSI_DEVICE_PRODUCT_ITEM) - && attr.type == B_STRING_TYPE) - strlcpy(scsi_product, attr.value.string, 64); - break; - }; + if (!strcmp(device_bus, "isa")) + bus = BUS_ISA; + else if (!strcmp(device_bus, "pci")) + bus = BUS_PCI; + else if (scsi_path_id < 255) + bus = BUS_SCSI; + /*else if (!strcmp(attr.name, PCI_DEVICE_SUBVENDOR_ID_ITEM) + && attr.type == B_UINT16_TYPE) + pci_subsystem_vendor_id = attr.value.ui16; + else if (!strcmp(attr.name, PCI_DEVICE_SUBSYSTEM_ID_ITEM) + && attr.type == B_UINT16_TYPE) + pci_subsystem_id = attr.value.ui16;*/ + attr.value.raw.data = data; attr.value.raw.length = sizeof(data); } - if (is_bus) { - if (!strcmp(connection, "ISA")) - *bus = BUS_ISA; - else if (!strcmp(connection, "PCI")) - *bus = BUS_PCI; - else if (scsi_path_id < 255) - *bus = BUS_SCSI; - } - - switch (parent_bus) { + switch (bus) { case BUS_ISA: new_level=level+1; break; @@ -303,18 +287,17 @@ static void -display_nodes(uint32 *node, uint8 level, int parent_bus) +display_nodes(device_node_cookie *node, uint8 level) { status_t err; - uint32 child = *node; - int bus = 0; - level = display_device(node, level, parent_bus, &bus); + device_node_cookie child = *node; + level = display_device(node, level); if (get_child(&child) != B_OK) return; do { - display_nodes(&child, level, bus); + display_nodes(&child, level); } while ((err = get_next_child(&child)) == B_OK); } @@ -323,7 +306,7 @@ main(int argc, char **argv) { status_t error; - uint32 root; + device_node_cookie root; if ((error = init_dm_wrapper()) < 0) { printf("Error initializing device manager (%s)\n", strerror(error)); @@ -346,7 +329,7 @@ dump_nodes(&root, 0); } else { get_root(&root); - display_nodes(&root, 0, 0); + display_nodes(&root, 0); } uninit_dm_wrapper(); Modified: haiku/trunk/src/system/kernel/device_manager/device_manager.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/device_manager.cpp 2008-06-06 21:03:37 UTC (rev 25832) +++ haiku/trunk/src/system/kernel/device_manager/device_manager.cpp 2008-06-06 22:23:25 UTC (rev 25833) @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -323,134 +324,115 @@ switch (function) { case DM_GET_ROOT: { - return B_ERROR; -#if 0 - uint32 cookie; + device_node_cookie cookie; if (!IS_USER_ADDRESS(buffer)) return B_BAD_ADDRESS; - if (bufferSize < sizeof(uint32)) + if (bufferSize < sizeof(device_node_cookie)) return B_BAD_VALUE; - cookie = sRootNode->ID(); + cookie = (device_node_cookie)sRootNode; // copy back to user space - return user_memcpy(buffer, &cookie, sizeof(uint32)); -#endif + return user_memcpy(buffer, &cookie, sizeof(device_node_cookie)); } case DM_GET_CHILD: { - return B_ERROR; -#if 0 - device_node_info* node; - device_node_info* child; - if (!IS_USER_ADDRESS(buffer)) return B_BAD_ADDRESS; - if (bufferSize < sizeof(uint32)) + if (bufferSize < sizeof(device_node_cookie)) return B_BAD_VALUE; - uint32 cookie; - if (user_memcpy(&cookie, buffer, sizeof(uint32)) < B_OK) + device_node_cookie cookie; + if (user_memcpy(&cookie, buffer, sizeof(device_node_cookie)) < B_OK) return B_BAD_ADDRESS; - mutex_lock(&gNodeLock); - node = device_manager_find_device(gRootNode, cookie); - if (!node) { - mutex_unlock(&gNodeLock); - return B_BAD_VALUE; - } - - child = (device_node_info *)list_get_next_item(&node->children, NULL); - if (child) - cookie = child->internal_id; - mutex_unlock(&gNodeLock); - - if (!child) + device_node* node = (device_node*)cookie; + NodeList::ConstIterator iterator = node->Children().GetIterator(); + + if (!iterator.HasNext()) { return B_ENTRY_NOT_FOUND; + } + node = iterator.Next(); + cookie = (device_node_cookie)node; + // copy back to user space - return user_memcpy(buffer, &cookie, sizeof(uint32)); -#endif + return user_memcpy(buffer, &cookie, sizeof(device_node_cookie)); } case DM_GET_NEXT_CHILD: { - return B_ERROR; -#if 0 - device_node_info* node; - device_node_info* child; - if (!IS_USER_ADDRESS(buffer)) return B_BAD_ADDRESS; - if (bufferSize < sizeof(uint32)) + if (bufferSize < sizeof(device_node_cookie)) return B_BAD_VALUE; - uint32 cookie; - if (user_memcpy(&cookie, buffer, sizeof(uint32)) < B_OK) + device_node_cookie cookie; + if (user_memcpy(&cookie, buffer, sizeof(device_node_cookie)) < B_OK) return B_BAD_ADDRESS; - mutex_lock(&gNodeLock); - node = device_manager_find_device(gRootNode, cookie); - if (!node) { - mutex_unlock(&gNodeLock); - return B_BAD_VALUE; + device_node* last = (device_node*)cookie; + if (!last->Parent()) + return B_ENTRY_NOT_FOUND; + NodeList::ConstIterator iterator = last->Parent()->Children().GetIterator(); + + // skip those we already traversed + while (iterator.HasNext() && last != NULL) { + device_node* node = iterator.Next(); + + if (node == last) + break; } - child = (device_node_info *)list_get_next_item(&node->parent->children, node); - if (child) - cookie = child->internal_id; - mutex_unlock(&gNodeLock); - if (!child) + if (!iterator.HasNext()) return B_ENTRY_NOT_FOUND; + device_node* node = iterator.Next(); + cookie = (device_node_cookie)node; + // copy back to user space - return user_memcpy(buffer, &cookie, sizeof(uint32)); -#endif + return user_memcpy(buffer, &cookie, sizeof(device_node_cookie)); } case DM_GET_NEXT_ATTRIBUTE: { - return B_ERROR; -#if 0 - struct dev_attr attr; - device_node_info* node; - uint32 i = 0; - device_attr_info *attr_info; + struct device_attr_info attr_info; if (!IS_USER_ADDRESS(buffer)) return B_BAD_ADDRESS; - if (bufferSize < sizeof(struct dev_attr)) + if (bufferSize < sizeof(struct device_attr_info)) return B_BAD_VALUE; - if (user_memcpy(&attr, buffer, sizeof(struct dev_attr)) < B_OK) + if (user_memcpy(&attr_info, buffer, sizeof(struct device_attr_info)) < B_OK) return B_BAD_ADDRESS; - mutex_lock(&gNodeLock); - node = device_manager_find_device(gRootNode, attr.node_cookie); - if (!node) { - mutex_unlock(&gNodeLock); - return B_BAD_VALUE; + device_node* node = (device_node*)attr_info.node_cookie; + device_attr* last = (device_attr*)attr_info.cookie; + AttributeList::Iterator iterator = node->Attributes().GetIterator(); + // skip those we already traversed + while (iterator.HasNext() && last != NULL) { + device_attr* attr = iterator.Next(); + + if (attr == last) + break; } - for (attr_info = node->attributes; attr.cookie > i && attr_info != NULL; attr_info = attr_info->next) { - i++; - } - if (!attr_info) { - mutex_unlock(&gNodeLock); + if (!iterator.HasNext()) { + attr_info.cookie = 0; return B_ENTRY_NOT_FOUND; } - attr.cookie++; - - strlcpy(attr.name, attr_info->attr.name, 254); - attr.type = attr_info->attr.type; - switch (attr_info->attr.type) { + device_attr* attr = iterator.Next(); + attr_info.cookie = (device_node_cookie)attr; + strlcpy(attr_info.name, attr->name, 254); + attr_info.type = attr->type; + switch (attr_info.type) { case B_UINT8_TYPE: - attr.value.ui8 = attr_info->attr.value.ui8; break; + attr_info.value.ui8 = attr->value.ui8; break; case B_UINT16_TYPE: - attr.value.ui16 = attr_info->attr.value.ui16; break; + attr_info.value.ui16 = attr->value.ui16; break; case B_UINT32_TYPE: - attr.value.ui32 = attr_info->attr.value.ui32; break; + attr_info.value.ui32 = attr->value.ui32; break; case B_UINT64_TYPE: - attr.value.ui64 = attr_info->attr.value.ui64; break; + attr_info.value.ui64 = attr->value.ui64; break; case B_STRING_TYPE: - strlcpy(attr.value.string, attr_info->attr.value.string, 254); break; + strlcpy(attr_info.value.string, attr->value.string, 254); break; /*case B_RAW_TYPE: if (attr.value.raw.length > attr_info->attr.value.raw.length) attr.value.raw.length = attr_info->attr.value.raw.length; @@ -459,11 +441,8 @@ break;*/ } - mutex_unlock(&gNodeLock); - // copy back to user space - return user_memcpy(buffer, &attr, sizeof(struct dev_attr)); -#endif + return user_memcpy(buffer, &attr_info, sizeof(struct device_attr_info)); } } From korli at mail.berlios.de Sat Jun 7 00:32:31 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 7 Jun 2008 00:32:31 +0200 Subject: [Haiku-commits] r25834 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi Message-ID: <200806062232.m56MWVqC023292@sheep.berlios.de> Author: korli Date: 2008-06-07 00:32:29 +0200 (Sat, 07 Jun 2008) New Revision: 25834 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25834&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c Log: added B_FIND_MULTIPLE_CHILDREN on acpi devices as suggested by Axel. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c 2008-06-06 22:23:25 UTC (rev 25833) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c 2008-06-06 22:32:29 UTC (rev 25834) @@ -106,7 +106,7 @@ "hid_%" ACPI_DEVICE_HID_ITEM "%" }}, { B_DRIVER_MAPPING "/0", B_STRING_TYPE, { string: "type_%" ACPI_DEVICE_TYPE_ITEM "%" }},*/ - { B_DEVICE_FLAGS, B_UINT32_TYPE, { ui32: B_FIND_CHILD_ON_DEMAND }}, + { B_DEVICE_FLAGS, B_UINT32_TYPE, { ui32: B_FIND_CHILD_ON_DEMAND|B_FIND_MULTIPLE_CHILDREN }}, { NULL } }; @@ -132,7 +132,7 @@ // consumer specification /*{ B_DRIVER_MAPPING, B_STRING_TYPE, { string: "type_%" ACPI_DEVICE_TYPE_ITEM "%" }},*/ - { B_DEVICE_FLAGS, B_UINT32_TYPE, { ui32: B_FIND_CHILD_ON_DEMAND }}, + { B_DEVICE_FLAGS, B_UINT32_TYPE, { ui32: B_FIND_CHILD_ON_DEMAND|B_FIND_MULTIPLE_CHILDREN }}, { NULL } }; From ingo_weinhold at gmx.de Sat Jun 7 08:37:37 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sat, 07 Jun 2008 08:37:37 +0200 Subject: [Haiku-commits] r25831 - haiku/trunk/src/kits/interface In-Reply-To: <200806062101.m56L1qeG012479@sheep.berlios.de> References: <200806062101.m56L1qeG012479@sheep.berlios.de> Message-ID: <20080607083737.399.1@knochen-vm.1212820138.fake> On 2008-06-06 at 23:01:52 [+0200], anevilyak at BerliOS wrote: > Author: anevilyak > Date: 2008-06-06 23:01:51 +0200 (Fri, 06 Jun 2008) > New Revision: 25831 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25831&view=rev > > Modified: > haiku/trunk/src/kits/interface/OutlineListView.cpp > Log: > Fix logic bug in quick sort routine. This would result in infinite > recursion such as that in bug #2343. I wonder why it implements its own quick sort in the first place. There are already qsort() and std::sort(), which are supposed to be efficient and correct implementations. CU, Ingo From anevilyak at gmail.com Sat Jun 7 08:44:16 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sat, 7 Jun 2008 01:44:16 -0500 Subject: [Haiku-commits] r25831 - haiku/trunk/src/kits/interface In-Reply-To: <20080607083737.399.1@knochen-vm.1212820138.fake> References: <200806062101.m56L1qeG012479@sheep.berlios.de> <20080607083737.399.1@knochen-vm.1212820138.fake> Message-ID: > > I wonder why it implements its own quick sort in the first place. There are > already qsort() and std::sort(), which are supposed to be efficient and > correct implementations. > Good point...will check if there's any special reason it does this, if not I'll replace it. Regards, Rene From anevilyak at gmail.com Sat Jun 7 08:51:28 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sat, 7 Jun 2008 01:51:28 -0500 Subject: [Haiku-commits] r25831 - haiku/trunk/src/kits/interface In-Reply-To: References: <200806062101.m56L1qeG012479@sheep.berlios.de> <20080607083737.399.1@knochen-vm.1212820138.fake> Message-ID: On Sat, Jun 7, 2008 at 1:44 AM, Rene Gollent wrote: >> >> I wonder why it implements its own quick sort in the first place. There are >> already qsort() and std::sort(), which are supposed to be efficient and >> correct implementations. >> > > Good point...will check if there's any special reason it does this, if > not I'll replace it. > An immediate problem comes up: STL sort does not allow you to pass in a comparator function as the Be API does, and qsort's comparator function signature isn't compatible with the one you can pass to BListView either (int (*compareFunc)(const BListItem *, const BListItem *)). Unless there's a casting trick I'm missing, I don't see how to use qsort() in this case. Regards, Rene From anevilyak at mail.berlios.de Sat Jun 7 09:10:09 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 7 Jun 2008 09:10:09 +0200 Subject: [Haiku-commits] r25835 - haiku/trunk/src/kits/interface Message-ID: <200806070710.m577A9PQ007443@sheep.berlios.de> Author: anevilyak Date: 2008-06-07 09:10:08 +0200 (Sat, 07 Jun 2008) New Revision: 25835 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25835&view=rev Modified: haiku/trunk/src/kits/interface/View.cpp Log: A view shouldn't be able to RemoveChild a view that it isn't in fact the parent of. Modified: haiku/trunk/src/kits/interface/View.cpp =================================================================== --- haiku/trunk/src/kits/interface/View.cpp 2008-06-06 22:32:29 UTC (rev 25834) +++ haiku/trunk/src/kits/interface/View.cpp 2008-06-07 07:10:08 UTC (rev 25835) @@ -3488,6 +3488,9 @@ if (!child) return false; + if (child->fParent != this) + return false; + return child->RemoveSelf(); } From ingo_weinhold at gmx.de Sat Jun 7 09:23:48 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sat, 07 Jun 2008 09:23:48 +0200 Subject: [Haiku-commits] r25831 - haiku/trunk/src/kits/interface In-Reply-To: References: <200806062101.m56L1qeG012479@sheep.berlios.de> <20080607083737.399.1@knochen-vm.1212820138.fake> Message-ID: <20080607092348.414.2@knochen-vm.1212821639.fake> On 2008-06-07 at 08:51:28 [+0200], Rene Gollent wrote: > On Sat, Jun 7, 2008 at 1:44 AM, Rene Gollent wrote: > >> > >> I wonder why it implements its own quick sort in the first place. There > >> are > >> already qsort() and std::sort(), which are supposed to be efficient and > >> correct implementations. > >> > > > > Good point...will check if there's any special reason it does this, if > > not I'll replace it. > > > > An immediate problem comes up: STL sort does not allow you to pass in > a comparator function as the Be API does, Sure it does. You can pass a comparator object as third parameter. It would look roughly like this: struct ListItemComparator { ListItemComparator(int (*compareFunc)(const BListItem*, const BListItem*)) : fCompareFunc(compareFunc) { } bool operator()(const BListItem* a, const BListItem* b) const { return fCompareFunc(a, b) < 0; } private: int (*fCompareFunc)(const BListItem*, const BListItem*); }; [...] BListItem** list = ...; std::sort(list, list + listSize, ListItemComparator(compareFunc)); > and qsort's comparator > function signature isn't compatible with the one you can pass to > BListView either (int (*compareFunc)(const BListItem *, const > BListItem *)). Unless there's a casting trick I'm missing, I don't see > how to use qsort() in this case. No, I think you're right. CU, Ingo From axeld at pinc-software.de Sat Jun 7 11:39:11 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 07 Jun 2008 11:39:11 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r25834_-_haiku/trunk/src/add-ons/kernel?= =?utf-8?q?/bus=5Fmanagers/acpi?= In-Reply-To: <200806062232.m56MWVqC023292@sheep.berlios.de> Message-ID: <388438770-BeMail@zon> korli at BerliOS wrote: > Log: > added B_FIND_MULTIPLE_CHILDREN on acpi devices as suggested by Axel. Actually, I intended to suggest the other way around, specifying B_FIND_CHILD_ON_DEMAND only when it's actually needed. Bye, Axel. From axeld at pinc-software.de Sat Jun 7 12:37:14 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 07 Jun 2008 12:37:14 +0200 CEST Subject: [Haiku-commits] r25831 - haiku/trunk/src/kits/interface In-Reply-To: <20080607092348.414.2@knochen-vm.1212821639.fake> Message-ID: <3872021435-BeMail@zon> Ingo Weinhold wrote: > > and qsort's comparator > > function signature isn't compatible with the one you can pass to > > BListView either (int (*compareFunc)(const BListItem *, const > > BListItem *)). Unless there's a casting trick I'm missing, I don't > > see > > how to use qsort() in this case. > No, I think you're right. While I'm sorry that I'm too dumb to write a working quick sort, I definitely had my reasons to do my own :-) Bye, Axel. From axeld at pinc-software.de Sat Jun 7 12:37:56 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 07 Jun 2008 12:37:56 +0200 CEST Subject: [Haiku-commits] r25818 - haiku/trunk/headers/posix In-Reply-To: <20080606174231.373.1@knochen-vm.1212766623.fake> Message-ID: <3913523770-BeMail@zon> Ingo Weinhold wrote: > It still has the problem that it declares functions (namely the hash > table > functions) that aren't exported by libroot. I didn't know that. I guess we'll want to export them, though. Bye, Axel. From mmlr at mail.berlios.de Sat Jun 7 12:48:52 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sat, 7 Jun 2008 12:48:52 +0200 Subject: [Haiku-commits] r25836 - haiku/trunk/build/jam Message-ID: <200806071048.m57AmqBP015035@sheep.berlios.de> Author: mmlr Date: 2008-06-07 12:48:49 +0200 (Sat, 07 Jun 2008) New Revision: 25836 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25836&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: Put the USB stack components and usb_disk in the boot module symlinks. This should make default images bootable from USB automatically. DDing one to a USB stick should work out of the box then (but this wipes the stick of course). Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-06-07 07:10:08 UTC (rev 25835) +++ haiku/trunk/build/jam/HaikuImage 2008-06-07 10:48:49 UTC (rev 25836) @@ -356,11 +356,12 @@ # boot module links AddBootModuleSymlinksToHaikuImage - pci $(X86_ONLY)isa config_manager ide scsi + pci $(X86_ONLY)isa config_manager ide scsi usb $(PPC_ONLY)openpic block_io ide_adapter locked_pool scsi_periph generic_ide_pci ahci legacy_sata silicon_image_3112 $(X86_ONLY)ide_isa - scsi_cd scsi_disk + uhci ohci ehci + scsi_cd scsi_disk usb_disk intel bfs ; From emitrax at gmail.com Sat Jun 7 13:13:58 2008 From: emitrax at gmail.com (Salvatore Benedetto) Date: Sat, 7 Jun 2008 11:13:58 +0000 Subject: [Haiku-commits] r25818 - haiku/trunk/headers/posix In-Reply-To: <200806060742.m567gxsM021879@sheep.berlios.de> References: <200806060742.m567gxsM021879@sheep.berlios.de> Message-ID: 2008/6/6 axeld at BerliOS : > Author: axeld > Date: 2008-06-06 09:42:58 +0200 (Fri, 06 Jun 2008) > New Revision: 25818 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25818&view=rev > > Modified: > haiku/trunk/headers/posix/search.h > Log: > The "search.h" header had a couple of issues: > * It was not self containing, as it used size_t without defining it. > * It was not C++ safe. By the way, shouldn't we use the macro __BEGIN_DECLS __END_DECLS defined in sys/cdefs.h, instead of extern "C" etc.., to keep the posix headers uniform and more clean? Regards, -- Salvatore Benedetto (a.k.a. emitrax) Student of Computer Engineer University of Pisa www.haiku-os.it From revol at free.fr Sat Jun 7 13:35:09 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sat, 07 Jun 2008 13:35:09 +0200 CEST Subject: [Haiku-commits] r25809 - haiku/trunk/src/system/kernel/debug In-Reply-To: <200806052116.m55LGZMp024849@sheep.berlios.de> Message-ID: <676918567-BeMail@laptop> > Author: mmlr > Date: 2008-06-05 23:16:34 +0200 (Thu, 05 Jun 2008) > New Revision: 25809 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25809&view=rev > > Modified: > haiku/trunk/src/system/kernel/debug/debug.cpp > Log: > Give the debugger add-ons a chance when reading input characters. > They already > got a debugger_getchar hook, it just wasn't used yet. Not that there > would be > any debugger add-on implementing that hook currently... Yes I added those. Note they are loaded quite late in the boot process, so they don't really have any use to debug the boot itself. From axeld at pinc-software.de Sat Jun 7 13:49:46 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 07 Jun 2008 13:49:46 +0200 CEST Subject: [Haiku-commits] r25818 - haiku/trunk/headers/posix In-Reply-To: Message-ID: <8223490116-BeMail@zon> "Salvatore Benedetto" wrote: > > * It was not C++ safe. > By the way, shouldn't we use the macro > __BEGIN_DECLS > __END_DECLS > defined in sys/cdefs.h, instead of extern "C" etc.., to keep the > posix > headers uniform and more clean? Actually, most POSIX headers use the more expressive 'extern "C"' version, and I'm not really a friend of macros. But I agree that we should make them uniform, and __{BEGIN|END}_DECLS seems to be necessary for compatibility anyway. Bye, Axel. From stefano.ceccherini at gmail.com Sat Jun 7 13:48:06 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Sat, 7 Jun 2008 13:48:06 +0200 Subject: [Haiku-commits] r25826 - haiku/trunk/src/apps/deskbar In-Reply-To: <200806061507.m56F7eqN019502@sheep.berlios.de> References: <200806061507.m56F7eqN019502@sheep.berlios.de> Message-ID: <894b9700806070448u7c1a6ccdo3d83baab861b269a@mail.gmail.com> 2008/6/6 aldeck at BerliOS : > Author: aldeck > Date: 2008-06-06 17:07:40 +0200 (Fri, 06 Jun 2008) > New Revision: 25826 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25826&view=rev > > Modified: > haiku/trunk/src/apps/deskbar/ExpandoMenuBar.cpp > Log: > - In vertical mode, TExpandoMenuBar used its own width to set the width of a newly added item. Removing the last item made the MenuBar resizes > itself to (0,0), and broke further item width computation. We now use the parent view width (BarView) instead. This fixes #471 > > > Modified: haiku/trunk/src/apps/deskbar/ExpandoMenuBar.cpp > =================================================================== > --- haiku/trunk/src/apps/deskbar/ExpandoMenuBar.cpp 2008-06-06 13:07:02 UTC (rev 25825) > +++ haiku/trunk/src/apps/deskbar/ExpandoMenuBar.cpp 2008-06-06 15:07:40 UTC (rev 25826) > @@ -488,7 +488,7 @@ > void > TExpandoMenuBar::AddTeam(BList *team, BBitmap *icon, char *name, char *signature) > { > - float itemWidth = fVertical ? Frame().Width() : kMinimumWindowWidth; > + float itemWidth = fVertical ? fBarView->Bounds().Width() : kMinimumWindowWidth; > float itemHeight = -1.0f; > Nice one! I tried to track down this a couple of times, but always failed. From stippi at mail.berlios.de Sat Jun 7 14:38:28 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 7 Jun 2008 14:38:28 +0200 Subject: [Haiku-commits] r25837 - haiku/trunk/headers/private/interface Message-ID: <200806071238.m57CcSrZ021791@sheep.berlios.de> Author: stippi Date: 2008-06-07 14:38:28 +0200 (Sat, 07 Jun 2008) New Revision: 25837 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25837&view=rev Modified: haiku/trunk/headers/private/interface/ColumnListView.h Log: Removed trailing white space. Modified: haiku/trunk/headers/private/interface/ColumnListView.h =================================================================== --- haiku/trunk/headers/private/interface/ColumnListView.h 2008-06-07 10:48:49 UTC (rev 25836) +++ haiku/trunk/headers/private/interface/ColumnListView.h 2008-06-07 12:38:28 UTC (rev 25837) @@ -306,7 +306,7 @@ // Does not delete row or children at this time. // todo: Make delete row and children - void RemoveRow(BRow*); + void RemoveRow(BRow*); void UpdateRow(BRow*); void Clear(); From stippi at mail.berlios.de Sat Jun 7 14:39:14 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 7 Jun 2008 14:39:14 +0200 Subject: [Haiku-commits] r25838 - haiku/trunk/headers/build Message-ID: <200806071239.m57CdEBG021872@sheep.berlios.de> Author: stippi Date: 2008-06-07 14:39:14 +0200 (Sat, 07 Jun 2008) New Revision: 25838 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25838&view=rev Modified: haiku/trunk/headers/build/HaikuBuildCompatibility.h Log: Added one more define that helps when host headers are included. Modified: haiku/trunk/headers/build/HaikuBuildCompatibility.h =================================================================== --- haiku/trunk/headers/build/HaikuBuildCompatibility.h 2008-06-07 12:38:28 UTC (rev 25837) +++ haiku/trunk/headers/build/HaikuBuildCompatibility.h 2008-06-07 12:39:14 UTC (rev 25838) @@ -74,6 +74,7 @@ # define _IMPEXP_TRACKER __declspec(dllimport) # define _IMPEXP_TRANSLATION __declspec(dllimport) # define _IMPEXP_DEVICE __declspec(dllimport) +# define _IMPEXP_NET __declspec(dllimport) #endif #ifdef __cplusplus From stippi at mail.berlios.de Sat Jun 7 14:39:57 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 7 Jun 2008 14:39:57 +0200 Subject: [Haiku-commits] r25839 - haiku/trunk/src/kits/storage Message-ID: <200806071239.m57CdvD5021928@sheep.berlios.de> Author: stippi Date: 2008-06-07 14:39:56 +0200 (Sat, 07 Jun 2008) New Revision: 25839 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25839&view=rev Modified: haiku/trunk/src/kits/storage/Node.cpp Log: Small coding style fix. Modified: haiku/trunk/src/kits/storage/Node.cpp =================================================================== --- haiku/trunk/src/kits/storage/Node.cpp 2008-06-07 12:39:14 UTC (rev 25838) +++ haiku/trunk/src/kits/storage/Node.cpp 2008-06-07 12:39:56 UTC (rev 25839) @@ -559,7 +559,7 @@ return error; // Lock the string's buffer so we can meddle with it - char *data = result->LockBuffer(info.size+1); + char *data = result->LockBuffer(info.size + 1); if (!data) return B_NO_MEMORY; From stippi at mail.berlios.de Sat Jun 7 14:43:59 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 7 Jun 2008 14:43:59 +0200 Subject: [Haiku-commits] r25840 - haiku/trunk/src/add-ons/kernel/partitioning_systems/intel Message-ID: <200806071243.m57ChxER022399@sheep.berlios.de> Author: stippi Date: 2008-06-07 14:43:59 +0200 (Sat, 07 Jun 2008) New Revision: 25840 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25840&view=rev Modified: haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.cpp Log: More specific tracing output when rejecting partitions. Modified: haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.cpp 2008-06-07 12:39:56 UTC (rev 25839) +++ haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.cpp 2008-06-07 12:43:59 UTC (rev 25840) @@ -384,11 +384,37 @@ { // offsets and size must be block aligned, PTS and partition must lie // within the session - return fPTSOffset % SECTOR_SIZE == 0 - && fOffset % SECTOR_SIZE == 0 - && fSize % SECTOR_SIZE == 0 - && fPTSOffset >= 0 && fPTSOffset < sessionSize - && fOffset >= 0 && fOffset + fSize <= sessionSize; + if (fPTSOffset % SECTOR_SIZE != 0) { + TRACE(("Partition::CheckLocation() - bad pts offset: %lld " + "(session: %lld)\n", fPTSOffset, sessionSize)); + return false; + } + if (fOffset % SECTOR_SIZE != 0) { + TRACE(("Partition::CheckLocation() - bad offset: %lld " + "(session: %lld)\n", fOffset, sessionSize)); + return false; + } + if (fSize % SECTOR_SIZE != 0) { + TRACE(("Partition::CheckLocation() - bad size: %lld " + "(session: %lld)\n", fSize, sessionSize)); + return false; + } + if (fPTSOffset < 0 || fPTSOffset >= sessionSize) { + TRACE(("Partition::CheckLocation() - pts offset outside session: %lld " + "(session: %lld)\n", fPTSOffset, sessionSize)); + return false; + } + if (fOffset < 0) { + TRACE(("Partition::CheckLocation() - offset before session: %lld " + "(session: %lld)\n", fOffset, sessionSize)); + return false; + } + if (fOffset + fSize > sessionSize) { + TRACE(("Partition::CheckLocation() - end after session: %lld " + "(session: %lld)\n", fOffset + fSize, sessionSize)); + return false; + } + return true; } From stippi at mail.berlios.de Sat Jun 7 14:44:39 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 7 Jun 2008 14:44:39 +0200 Subject: [Haiku-commits] r25841 - haiku/trunk/src/add-ons/kernel/partitioning_systems/intel Message-ID: <200806071244.m57Cidhr022448@sheep.berlios.de> Author: stippi Date: 2008-06-07 14:44:39 +0200 (Sat, 07 Jun 2008) New Revision: 25841 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25841&view=rev Modified: haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMapParser.cpp Log: Improved tracing output. Modified: haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMapParser.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMapParser.cpp 2008-06-07 12:43:59 UTC (rev 25840) +++ haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMapParser.cpp 2008-06-07 12:44:39 UTC (rev 25841) @@ -88,7 +88,8 @@ // check the signature if (pts->signature != kPartitionTableSectorSignature) { - TRACE(("intel: _ParsePrimary(): invalid PTS signature\n")); + TRACE(("intel: _ParsePrimary(): invalid PTS signature: %lx\n", + (uint32)pts->signature)); return B_BAD_DATA; } @@ -151,7 +152,8 @@ // check the signature if (error == B_OK && fPTS->signature != kPartitionTableSectorSignature) { - TRACE(("intel: _ParseExtended(): invalid PTS signature\n")); + TRACE(("intel: _ParseExtended(): invalid PTS signature: %lx\n", + (uint32)fPTS->signature)); error = B_BAD_DATA; } From stippi at mail.berlios.de Sat Jun 7 14:45:19 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 7 Jun 2008 14:45:19 +0200 Subject: [Haiku-commits] r25842 - haiku/trunk/src/add-ons/media/media-add-ons/dvb Message-ID: <200806071245.m57CjJQj022529@sheep.berlios.de> Author: stippi Date: 2008-06-07 14:45:17 +0200 (Sat, 07 Jun 2008) New Revision: 25842 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25842&view=rev Modified: haiku/trunk/src/add-ons/media/media-add-ons/dvb/DVBMediaNode.cpp Log: Honor 80 char line width, not complete. Modified: haiku/trunk/src/add-ons/media/media-add-ons/dvb/DVBMediaNode.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/dvb/DVBMediaNode.cpp 2008-06-07 12:44:39 UTC (rev 25841) +++ haiku/trunk/src/add-ons/media/media-add-ons/dvb/DVBMediaNode.cpp 2008-06-07 12:45:17 UTC (rev 25842) @@ -138,7 +138,8 @@ , fThreadIdEncVideo(-1) , fThreadIdMpegTS(-1) , fTerminateThreads(false) - , fDemux(new TransportStreamDemux(fRawVideoQueue, fRawAudioQueue, fEncVideoQueue, fEncAudioQueue, fMpegTsQueue)) + , fDemux(new TransportStreamDemux(fRawVideoQueue, fRawAudioQueue, + fEncVideoQueue, fEncAudioQueue, fMpegTsQueue)) , fBufferGroupRawVideo(0) , fBufferGroupRawAudio(0) , fInterfaceType(DVB_TYPE_UNKNOWN) @@ -1738,12 +1739,14 @@ // decode data and send buffers uint32 video_buffer_size_max = 720 * 576 * 4; - uint32 video_buffer_size = fOutputRawVideo.format.u.raw_video.display.line_count * fOutputRawVideo.format.u.raw_video.display.bytes_per_row; + uint32 video_buffer_size + = fOutputRawVideo.format.u.raw_video.display.line_count + * fOutputRawVideo.format.u.raw_video.display.bytes_per_row; delete fBufferGroupRawVideo; fBufferGroupRawVideo = new BBufferGroup(video_buffer_size_max, 4); - while (!fTerminateThreads) { + while (!fTerminateThreads) { int64 frameCount; media_header mh; media_header_ex *mhe = (media_header_ex *)&mh; @@ -1756,7 +1759,8 @@ // fetch a new buffer (always of maximum size, as the stream may change) BBuffer* buf; - buf = fBufferGroupRawVideo->RequestBuffer(video_buffer_size_max, VIDEO_BUFFER_REQUEST_TIMEOUT); + buf = fBufferGroupRawVideo->RequestBuffer(video_buffer_size_max, + VIDEO_BUFFER_REQUEST_TIMEOUT); if (!buf) { TRACE("video: request buffer timout\n"); continue; From stippi at mail.berlios.de Sat Jun 7 14:46:08 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 7 Jun 2008 14:46:08 +0200 Subject: [Haiku-commits] r25843 - haiku/trunk/src/add-ons/media/plugins/xvid_decoder Message-ID: <200806071246.m57Ck8ro022623@sheep.berlios.de> Author: stippi Date: 2008-06-07 14:46:07 +0200 (Sat, 07 Jun 2008) New Revision: 25843 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25843&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.cpp Log: * Fixed typo in "pretty name". * Improved debug output. Modified: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.cpp 2008-06-07 12:45:17 UTC (rev 25842) +++ haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.cpp 2008-06-07 12:46:07 UTC (rev 25843) @@ -188,7 +188,7 @@ return;// B_NO_INIT; sprintf(mci->short_name, "xvid"); - sprintf(mci->pretty_name, "xvid - %s)", + sprintf(mci->pretty_name, "xvid - %s", gCodecTable[fIndexInCodecTable].prettyName); mci->id = 0; @@ -208,7 +208,7 @@ if (inputFormat->type != B_MEDIA_ENCODED_VIDEO) return B_BAD_VALUE; -// PRINT(("%p->XvidDecoder::Sniff()\n", this)); +// PRINT(("%p->XvidDecoder::Setup()\n", this)); //#if DEBUG // char buffer[1024]; @@ -229,7 +229,7 @@ // && !memcmp(inputFormat->user_data, "AVI ", 4)) { // codecID = ((uint32*)inputFormat->user_data)[1]; // familyID = B_AVI_FORMAT_FAMILY; -// PRINT(("XvidDecoder::Sniff() - AVI 4CC: %4s\n", +// PRINT(("XvidDecoder::Setup() - AVI 4CC: %4s\n", // inputFormat->user_data + 4)); // } @@ -253,7 +253,7 @@ #if PRINT_FOURCC uint32 bigEndianID = B_HOST_TO_BENDIAN_INT32(codecID); - printf("%p->XvidDecoder::Sniff() - AVI 4CC: %.4s\n", this, + printf("%p->XvidDecoder::Setup() - AVI 4CC: %.4s\n", this, (const char*)&bigEndianID); #endif } else if (formats.GetCodeFor(*inputFormat, B_MPEG_FORMAT_FAMILY, From stippi at mail.berlios.de Sat Jun 7 14:46:29 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 7 Jun 2008 14:46:29 +0200 Subject: [Haiku-commits] r25844 - haiku/trunk/src/tests/apps/partitioner Message-ID: <200806071246.m57CkT00022700@sheep.berlios.de> Author: stippi Date: 2008-06-07 14:46:29 +0200 (Sat, 07 Jun 2008) New Revision: 25844 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25844&view=rev Modified: haiku/trunk/src/tests/apps/partitioner/Partitioner.cpp Log: Fixed typo in printf output. Modified: haiku/trunk/src/tests/apps/partitioner/Partitioner.cpp =================================================================== --- haiku/trunk/src/tests/apps/partitioner/Partitioner.cpp 2008-06-07 12:46:07 UTC (rev 25843) +++ haiku/trunk/src/tests/apps/partitioner/Partitioner.cpp 2008-06-07 12:46:29 UTC (rev 25844) @@ -627,7 +627,7 @@ error = partition->CreateChild(start, size, type, NULL, parameters.String()); if (error != B_OK) - printf("Creating the partiiton failed: %s\n", strerror(error)); + printf("Creating the partition failed: %s\n", strerror(error)); } void _WriteChanges() From stippi at mail.berlios.de Sat Jun 7 14:46:51 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 7 Jun 2008 14:46:51 +0200 Subject: [Haiku-commits] r25845 - haiku/trunk/src/tests/servers/app/playground Message-ID: <200806071246.m57CkpE1022742@sheep.berlios.de> Author: stippi Date: 2008-06-07 14:46:50 +0200 (Sat, 07 Jun 2008) New Revision: 25845 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25845&view=rev Modified: haiku/trunk/src/tests/servers/app/playground/run Log: Fixed typo in script. Modified: haiku/trunk/src/tests/servers/app/playground/run =================================================================== --- haiku/trunk/src/tests/servers/app/playground/run 2008-06-07 12:46:29 UTC (rev 25844) +++ haiku/trunk/src/tests/servers/app/playground/run 2008-06-07 12:46:50 UTC (rev 25845) @@ -3,7 +3,7 @@ ../../../../../generated/tests/libbe_test/x86/apps/run_haiku_registrar || exit if test -f ../../../../../generated/tests/libbe_test/x86/apps/haiku_app_server; then - ../../../../../generated/tests/libbe_test/x86/apps//haiku_app_server & + ../../../../../generated/tests/libbe_test/x86/apps/haiku_app_server & else echo "You need to \"TARGET_PLATFORM=libbe_test jam install-test-apps\" first." fi From stippi at mail.berlios.de Sat Jun 7 14:50:38 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 7 Jun 2008 14:50:38 +0200 Subject: [Haiku-commits] r25846 - haiku/trunk/src/servers/input Message-ID: <200806071250.m57CocNW023191@sheep.berlios.de> Author: stippi Date: 2008-06-07 14:50:37 +0200 (Sat, 07 Jun 2008) New Revision: 25846 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25846&view=rev Modified: haiku/trunk/src/servers/input/InputServer.cpp Log: * Check return code. * Make check slightly more readable. Modified: haiku/trunk/src/servers/input/InputServer.cpp =================================================================== --- haiku/trunk/src/servers/input/InputServer.cpp 2008-06-07 12:46:50 UTC (rev 25845) +++ haiku/trunk/src/servers/input/InputServer.cpp 2008-06-07 12:50:37 UTC (rev 25846) @@ -1526,11 +1526,13 @@ PRINT(("SanitizeEvents: %lx, %lx\n", fKeyInfo.modifiers, fKeyInfo.key_states[KEY_Spacebar >> 3])); - int8 byte = 0; - event->FindInt8("byte", &byte); + uint8 byte; + if (event->FindInt8("byte", (int8*)&byte) < B_OK) + byte = 0; + if (((fKeyInfo.modifiers & B_COMMAND_KEY) != 0 && byte == ' ') - || static_cast(byte) == B_ZENKAKU_HANKAKU) { - SetNextMethod(!fKeyInfo.modifiers & B_SHIFT_KEY); + || byte == B_KATAKANA_HIRAGANA) { + SetNextMethod(!(fKeyInfo.modifiers & B_SHIFT_KEY)); // this event isn't sent to the user events.RemoveItemAt(index); From emitrax at gmail.com Sat Jun 7 15:28:34 2008 From: emitrax at gmail.com (Salvatore Benedetto) Date: Sat, 7 Jun 2008 13:28:34 +0000 Subject: [Haiku-commits] r25818 - haiku/trunk/headers/posix In-Reply-To: <8223490116-BeMail@zon> References: <8223490116-BeMail@zon> Message-ID: 2008/6/7 Axel D?rfler : > "Salvatore Benedetto" wrote: >> > * It was not C++ safe. >> By the way, shouldn't we use the macro >> __BEGIN_DECLS >> __END_DECLS >> defined in sys/cdefs.h, instead of extern "C" etc.., to keep the >> posix >> headers uniform and more clean? > > Actually, most POSIX headers use the more expressive 'extern "C"' > version, and I'm not really a friend of macros. But I agree that we > should make them uniform, and __{BEGIN|END}_DECLS seems to be necessary > for compatibility anyway. Ok then. Since I'm going through the posix code, I'll replace them myself if that's ok. > > Bye, > Axel. > > _____ Regards -- Salvatore Benedetto (a.k.a. emitrax) Student of Computer Engineer University of Pisa www.haiku-os.it From axeld at pinc-software.de Sat Jun 7 16:12:12 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 07 Jun 2008 16:12:12 +0200 CEST Subject: [Haiku-commits] r25818 - haiku/trunk/headers/posix In-Reply-To: Message-ID: <16769541025-BeMail@zon> "Salvatore Benedetto" wrote: > > Actually, most POSIX headers use the more expressive 'extern "C"' > > version, and I'm not really a friend of macros. But I agree that we > > should make them uniform, and __{BEGIN|END}_DECLS seems to be > > necessary > > for compatibility anyway. > Ok then. Since I'm going through the posix code, I'll replace them > myself if that's ok. Sure, just go ahead. Bye, Axel. From stippi at mail.berlios.de Sat Jun 7 17:14:01 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 7 Jun 2008 17:14:01 +0200 Subject: [Haiku-commits] r25847 - haiku/trunk/src/kits/interface Message-ID: <200806071514.m57FE1OZ005964@sheep.berlios.de> Author: stippi Date: 2008-06-07 17:14:00 +0200 (Sat, 07 Jun 2008) New Revision: 25847 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25847&view=rev Modified: haiku/trunk/src/kits/interface/GraphicsDefs.cpp Log: Axel!! Since _Thursday_ I am trying to track this down. "MediaPlayer wouldn't play any more clips." Of course I was searching in my own commits. In the end, I resorted to binary searching revisions for when this broke. Turns out it is your change r25793/r25794, in which you forgot to attach the colorspace to the app_server message. Which of course makes it lock up. Another of those instances where you think passing data structures between client and app_server instead of this "protocol" would be the better idea... * Fixed bitmaps_support_space() retrieving the currently supported overlay flags for a given color space. This makes MediaPlayer play files again, the media node connection would time out because of the broken app_server communication. (I have not tested this change yet, but I will in a minute, on a different computer.) * Also retrieve the overlay supported flag for YCbCr colorspaces. Modified: haiku/trunk/src/kits/interface/GraphicsDefs.cpp =================================================================== --- haiku/trunk/src/kits/interface/GraphicsDefs.cpp 2008-06-07 12:50:37 UTC (rev 25846) +++ haiku/trunk/src/kits/interface/GraphicsDefs.cpp 2008-06-07 15:14:00 UTC (rev 25847) @@ -129,6 +129,23 @@ } +static uint32 +get_overlay_flags(color_space space) +{ + BPrivate::AppServerLink link; + link.StartMessage(AS_GET_BITMAP_SUPPORT_FLAGS); + link.Attach((uint32)space); + + uint32 flags = 0; + int32 code; + if (link.FlushWithReply(code) == B_OK && code == B_OK) { + if (link.Read(&flags) < B_OK) + flags = 0; + } + return flags; +} + + bool bitmaps_support_space(color_space space, uint32 *supportFlags) { @@ -142,17 +159,8 @@ case B_CMAP8: case B_GRAY8: case B_GRAY1: if (supportFlags != NULL) { *supportFlags = B_VIEWS_SUPPORT_DRAW_BITMAP - | B_BITMAPS_SUPPORT_ATTACHED_VIEWS; - - BPrivate::AppServerLink link; - link.StartMessage(AS_GET_BITMAP_SUPPORT_FLAGS); - - int32 code; - if (link.FlushWithReply(code) == B_OK && code == B_OK) { - uint32 flags = 0; - if (link.Read(&flags) == B_OK) - *supportFlags |= flags; - } + | B_BITMAPS_SUPPORT_ATTACHED_VIEWS + | get_overlay_flags(space); } break; @@ -165,6 +173,8 @@ case B_HSV24: case B_HSV32: case B_HSVA32: case B_HLS24: case B_HLS32: case B_HLSA32: case B_CMY24: case B_CMY32: case B_CMYA32: case B_CMYK32: + if (supportFlags != NULL) + *supportFlags = get_overlay_flags(space); break; // unsupported case B_NO_COLOR_SPACE: From superstippi at gmx.de Sat Jun 7 17:27:32 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 07 Jun 2008 17:27:32 +0200 Subject: [Haiku-commits] r25847 - haiku/trunk/src/kits/interface In-Reply-To: <200806071514.m57FE1OZ005964@sheep.berlios.de> References: <200806071514.m57FE1OZ005964@sheep.berlios.de> Message-ID: <20080607172732.3934.1@stippis2.1212836428.fake> stippi at BerliOS wrote: > * Fixed bitmaps_support_space() retrieving the currently supported overlay > flags for a given color space. This makes MediaPlayer play files again, > the media node connection would time out because of the broken app_server > communication. (I have not tested this change yet, but I will in a > minute, on a different computer.) Confirmed... MediaPlayer works again. :-) Puh! Best regards, -Stephan From axeld at pinc-software.de Sat Jun 7 18:02:08 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 07 Jun 2008 18:02:08 +0200 CEST Subject: [Haiku-commits] r25847 - haiku/trunk/src/kits/interface In-Reply-To: <200806071514.m57FE1OZ005964@sheep.berlios.de> Message-ID: <23365952918-BeMail@zon> stippi at BerliOS wrote: > Axel!! Since _Thursday_ I am trying to track this down. "MediaPlayer > wouldn't > play any more clips." Of course I was searching in my own commits. In > the > end, I resorted to binary searching revisions for when this broke. > Turns out > it is your change r25793/r25794, in which you forgot to attach the > colorspace > to the app_server message. Which of course makes it lock up. Another > of those > instances where you think passing data structures between client and > app_server > instead of this "protocol" would be the better idea... Oops, sorry for that... A stronger typed protocol would indeed be nice. Maybe we could write an application that analyzes the source code to find deviations, though - but that's probably a lot of work. Bye, Axel. From anevilyak at mail.berlios.de Sat Jun 7 18:14:30 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 7 Jun 2008 18:14:30 +0200 Subject: [Haiku-commits] r25848 - haiku/trunk/src/kits/interface Message-ID: <200806071614.m57GEUJC011782@sheep.berlios.de> Author: anevilyak Date: 2008-06-07 18:14:30 +0200 (Sat, 07 Jun 2008) New Revision: 25848 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25848&view=rev Modified: haiku/trunk/src/kits/interface/OutlineListView.cpp Log: Remove BOutlineListView's home-brew quicksort implementation in favor of a comparator that hooks into the STL's sort algorithm as suggested by Ingo. Tested and seems to work nicely. Modified: haiku/trunk/src/kits/interface/OutlineListView.cpp =================================================================== --- haiku/trunk/src/kits/interface/OutlineListView.cpp 2008-06-07 15:14:00 UTC (rev 25847) +++ haiku/trunk/src/kits/interface/OutlineListView.cpp 2008-06-07 16:14:30 UTC (rev 25848) @@ -16,61 +16,23 @@ #include #include +#include -/*! - \brief A simple recursive quick sort implementations for BListItem arrays. +struct ListItemComparator { + ListItemComparator(int (*compareFunc)(const BListItem *, const BListItem *)) + : fCompareFunc(compareFunc) + { + } - We need to implement it ourselves, since the BOutlineListView sort methods - use a different comparison function than the standard functions. -*/ -static void -quick_sort_item_array(BListItem** items, int32 first, int32 last, - int (*compareFunc)(const BListItem* a, const BListItem* b)) -{ - if (last <= first) - return; - - BListItem* pivot = items[first + (rand() % (last - first))]; - // choose an arbitrary pivot element - - int32 left = first; - int32 right = last; - - do { - while ((compareFunc(items[left], pivot) < 0) && (left < last)) - left++; - - while ((compareFunc(items[right], pivot) > 0) && (right > first)) - right--; - - if (left < right) { - // swap entries - BListItem* temp = items[left]; - items[left] = items[right]; - items[right] = temp; - - left++; - right--; - } - } while (left < right); - - // if our subset of the array consists of two elements, then we're done recursing - if (last - first <= 1) - return; - - // At this point, the elements in the left half are all smaller - // than the elements in the right half - if (first < left) { - // sort left half - quick_sort_item_array(items, first, left, compareFunc); + bool operator()(const BListItem *a, const BListItem *b) const + { + return fCompareFunc(a, b) < 0; } - if (right < last) { - // sort right half - quick_sort_item_array(items, right, last, compareFunc); - } -} - +private: + int (*fCompareFunc)(const BListItem *, const BListItem *); +}; + // #pragma mark - @@ -662,9 +624,8 @@ BOutlineListView::_SortTree(BList* tree, bool oneLevelOnly, int (*compareFunc)(const BListItem* a, const BListItem* b)) { - // home-brewn quick sort for our compareFunc - quick_sort_item_array((BListItem**)tree->Items(), 0, tree->CountItems() - 1, - compareFunc); + BListItem **items = (BListItem **)tree->Items(); + std::sort(items, items + tree->CountItems(), ListItemComparator(compareFunc)); if (oneLevelOnly) return; From anevilyak at gmail.com Sat Jun 7 18:16:16 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sat, 7 Jun 2008 11:16:16 -0500 Subject: [Haiku-commits] r25831 - haiku/trunk/src/kits/interface In-Reply-To: <20080607092348.414.2@knochen-vm.1212821639.fake> References: <200806062101.m56L1qeG012479@sheep.berlios.de> <20080607083737.399.1@knochen-vm.1212820138.fake> <20080607092348.414.2@knochen-vm.1212821639.fake> Message-ID: On Sat, Jun 7, 2008 at 2:23 AM, Ingo Weinhold wrote: > Sure it does. You can pass a comparator object as third parameter. It would > look roughly like this: > Ah, I overlooked the 3 parameter version of it, thanks for the tip! Done in r25848. Regards, Rene From anevilyak at gmail.com Sat Jun 7 18:31:14 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sat, 7 Jun 2008 11:31:14 -0500 Subject: [Haiku-commits] r25848 - haiku/trunk/src/kits/interface In-Reply-To: <200806071614.m57GEUJC011782@sheep.berlios.de> References: <200806071614.m57GEUJC011782@sheep.berlios.de> Message-ID: On Sat, Jun 7, 2008 at 11:14 AM, anevilyak at BerliOS wrote: - \brief A simple recursive quick sort implementations for BListItem arrays. > +struct ListItemComparator { > + ListItemComparator(int (*compareFunc)(const BListItem *, const BListItem *)) > + : fCompareFunc(compareFunc) Before I get assaulted by the style police... a question that I wasn't able to determine from our style guide: if a class/struct has no base type, can the line after the : be used to init the first member as I've done here, or should it be left blank with the member on the next line? Regards, Rene From axeld at pinc-software.de Sat Jun 7 18:35:24 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 07 Jun 2008 18:35:24 +0200 CEST Subject: [Haiku-commits] r25831 - haiku/trunk/src/kits/interface In-Reply-To: Message-ID: <25361918878-BeMail@zon> "Rene Gollent" wrote: > On Sat, Jun 7, 2008 at 2:23 AM, Ingo Weinhold > wrote: > > Sure it does. You can pass a comparator object as third parameter. > > It would > > look roughly like this: > Ah, I overlooked the 3 parameter version of it, thanks for the tip! > Done in r25848. Hm, that reduces my reasoning of having developed it in the first place to having overlooked that version as well... I just noticed that our PointerList implementation is now using this, too. Bye, Axel. From korli at users.berlios.de Sat Jun 7 19:01:38 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Sat, 7 Jun 2008 19:01:38 +0200 Subject: [Haiku-commits] r25846 - haiku/trunk/src/servers/input In-Reply-To: <200806071250.m57CocNW023191@sheep.berlios.de> References: <200806071250.m57CocNW023191@sheep.berlios.de> Message-ID: 2008/6/7 stippi at BerliOS : > - || static_cast(byte) == B_ZENKAKU_HANKAKU) { > - SetNextMethod(!fKeyInfo.modifiers & B_SHIFT_KEY); > + || byte == B_KATAKANA_HIRAGANA) { > + SetNextMethod(!(fKeyInfo.modifiers & B_SHIFT_KEY)); was it your intention of changing B_ZENKAKU_HANKAKU to B_KATAKANA_HIRAGANA ? Bye, J?r?me From superstippi at gmx.de Sat Jun 7 19:19:13 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 07 Jun 2008 19:19:13 +0200 Subject: [Haiku-commits] r25846 - haiku/trunk/src/servers/input In-Reply-To: References: <200806071250.m57CocNW023191@sheep.berlios.de> Message-ID: <20080607191913.4091.3@stippis2.1212836428.fake> J?r?me Duval wrote: > 2008/6/7 stippi at BerliOS : > > - || static_cast(byte) == > > B_ZENKAKU_HANKAKU) { > > - > > SetNextMethod(!fKeyInfo.modifiers & B_SHIFT_KEY); > > + || byte == B_KATAKANA_HIRAGANA) > > { > > + > > SetNextMethod(!(fKeyInfo.modifiers & B_SHIFT_KEY)); > > was it your intention of changing B_ZENKAKU_HANKAKU to > B_KATAKANA_HIRAGANA ? Woha, no! I was going through uncommited changes... seems like I was not careful. Sorry about that. Best regards, -Stephan From stippi at mail.berlios.de Sat Jun 7 19:19:19 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 7 Jun 2008 19:19:19 +0200 Subject: [Haiku-commits] r25849 - haiku/trunk/src/servers/input Message-ID: <200806071719.m57HJJLZ019226@sheep.berlios.de> Author: stippi Date: 2008-06-07 19:19:19 +0200 (Sat, 07 Jun 2008) New Revision: 25849 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25849&view=rev Modified: haiku/trunk/src/servers/input/InputServer.cpp Log: Revert the bad part of my previous change. Wasn't supposed to exchange the modifier key. Modified: haiku/trunk/src/servers/input/InputServer.cpp =================================================================== --- haiku/trunk/src/servers/input/InputServer.cpp 2008-06-07 16:14:30 UTC (rev 25848) +++ haiku/trunk/src/servers/input/InputServer.cpp 2008-06-07 17:19:19 UTC (rev 25849) @@ -1531,7 +1531,7 @@ byte = 0; if (((fKeyInfo.modifiers & B_COMMAND_KEY) != 0 && byte == ' ') - || byte == B_KATAKANA_HIRAGANA) { + || byte == B_ZENKAKU_HANKAKU) { SetNextMethod(!(fKeyInfo.modifiers & B_SHIFT_KEY)); // this event isn't sent to the user From axeld at pinc-software.de Sat Jun 7 19:19:35 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 07 Jun 2008 19:19:35 +0200 CEST Subject: [Haiku-commits] r25848 - haiku/trunk/src/kits/interface In-Reply-To: Message-ID: <28012522013-BeMail@zon> "Rene Gollent" wrote: > On Sat, Jun 7, 2008 at 11:14 AM, anevilyak at BerliOS > wrote: - \brief A simple recursive > quick sort implementations for BListItem arrays. > > +struct ListItemComparator { > > + ListItemComparator(int (*compareFunc)(const BListItem *, > > const BListItem *)) > > + : fCompareFunc(compareFunc) > Before I get assaulted by the style police... a question that I > wasn't > able to determine from our style guide: if a class/struct has no base > type, can the line after the : be used to init the first member as > I've done here, or should it be left blank with the member on the > next > line? As with many other things, our style guide doesn't define this currently. I usually leave the rest of the line blank then, but there are enough other develops that do it differently; IOW do as think until we have put something into the style guide. Bye, Axel. From korli at mail.berlios.de Sat Jun 7 20:33:58 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 7 Jun 2008 20:33:58 +0200 Subject: [Haiku-commits] r25850 - haiku/trunk/src/add-ons/kernel/drivers/power/acpi_thermal Message-ID: <200806071833.m57IXw53011271@sheep.berlios.de> Author: korli Date: 2008-06-07 20:33:58 +0200 (Sat, 07 Jun 2008) New Revision: 25850 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25850&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/power/acpi_thermal/acpi_thermal.c Log: Converted acpi_thermal to new driver architecture Modified: haiku/trunk/src/add-ons/kernel/drivers/power/acpi_thermal/acpi_thermal.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/power/acpi_thermal/acpi_thermal.c 2008-06-07 17:19:19 UTC (rev 25849) +++ haiku/trunk/src/add-ons/kernel/drivers/power/acpi_thermal/acpi_thermal.c 2008-06-07 18:33:58 UTC (rev 25850) @@ -1,8 +1,13 @@ -/* ++++++++++ - ACPI Generic Thermal Zone Driver. - Obtains general status of passive devices, monitors / sets critical temperatures - Controls active devices. -+++++ */ +/* + * Copyright 2006-2008, Haiku, Inc. All Rights Reserved. + * + * Distributed under the terms of the MIT License. + * + * ACPI Generic Thermal Zone Driver. + * Obtains general status of passive devices, monitors / sets critical temperatures + * Controls active devices. + */ + #include #include #include @@ -12,40 +17,43 @@ #include #include -#include #include "acpi_thermal.h" -#define ACPI_THERMAL_MODULE_NAME "drivers/bin/acpi_thermal/acpi_device_v1" +#define ACPI_THERMAL_MODULE_NAME "drivers/power/acpi_thermal/driver_v1" +#define ACPI_THERMAL_DEVICE_MODULE_NAME "drivers/power/acpi_thermal/device_v1" + /* Base Namespace devices are published to */ -#define ACPI_THERMAL_BASENAME "acpi/thermal/%d" +#define ACPI_THERMAL_BASENAME "power/acpi_thermal/%d" // name of pnp generator of path ids #define ACPI_THERMAL_PATHID_GENERATOR "acpi_thermal/path_id" -device_manager_info *gDeviceManager; +static device_manager_info *sDeviceManager; typedef struct acpi_ns_device_info { - device_node_handle node; + device_node *node; acpi_device_module_info *acpi; acpi_device acpi_cookie; } acpi_thermal_device_info; -status_t acpi_thermal_control(acpi_thermal_device_info* device, uint32 op, void* arg, size_t len); +status_t acpi_thermal_control(void* _cookie, uint32 op, void* arg, size_t len); static status_t -acpi_thermal_open(acpi_thermal_device_info *device, uint32 flags, void** cookie) +acpi_thermal_open(void *_cookie, const char *path, int flags, void** cookie) { + acpi_thermal_device_info *device = (acpi_thermal_device_info *)_cookie; *cookie = device; return B_OK; } static status_t -acpi_thermal_read(acpi_thermal_device_info* device, off_t position, void *buf, size_t* num_bytes) +acpi_thermal_read(void* _cookie, off_t position, void *buf, size_t* num_bytes) { + acpi_thermal_device_info* device = (acpi_thermal_device_info*)_cookie; acpi_thermal_type therm_info; if (*num_bytes < 1) return B_IO_ERROR; @@ -98,15 +106,16 @@ static status_t -acpi_thermal_write (void* cookie, off_t position, const void* buffer, size_t* num_bytes) +acpi_thermal_write(void* cookie, off_t position, const void* buffer, size_t* num_bytes) { return B_ERROR; } status_t -acpi_thermal_control (acpi_thermal_device_info* device, uint32 op, void* arg, size_t len) +acpi_thermal_control(void* _cookie, uint32 op, void* arg, size_t len) { + acpi_thermal_device_info* device = (acpi_thermal_device_info*)_cookie; status_t err = B_ERROR; acpi_thermal_type *att = NULL; @@ -161,161 +170,160 @@ } +// #pragma mark - driver module API + + static float -acpi_thermal_support(device_node_handle parent, bool *_noConnection) +acpi_thermal_support(device_node *parent) { - char *bus; + const char *bus; uint32 device_type; // make sure parent is really the ACPI bus manager - if (gDeviceManager->get_attr_string(parent, B_DRIVER_BUS, &bus, false) != B_OK) { - dprintf("no bus\n"); + if (sDeviceManager->get_attr_string(parent, B_DEVICE_BUS, &bus, false)) + return -1; + + if (strcmp(bus, "acpi")) return 0.0; - } - - if (strcmp(bus, "acpi")) { - dprintf("bad bus\n"); - goto err; - } // check whether it's really a thermal Device - if (gDeviceManager->get_attr_uint32(parent, ACPI_DEVICE_TYPE_ITEM, &device_type, false) != B_OK + if (sDeviceManager->get_attr_uint32(parent, ACPI_DEVICE_TYPE_ITEM, &device_type, false) != B_OK || device_type != ACPI_TYPE_THERMAL) { - dprintf("bad type\n"); - goto err; + return 0.0; } // TODO check there are _CRT and _TMP ? - free(bus); return 0.6; -err: - free(bus); - return 0.0; } static status_t -acpi_thermal_init_device(device_node_handle node, void *user_cookie, void **cookie) +acpi_thermal_register_device(device_node *node) { - acpi_thermal_device_info *device; - status_t res; + device_attr attrs[] = { + { B_DEVICE_PRETTY_NAME, B_STRING_TYPE, { string: "ACPI Thermal" }}, + { NULL } + }; - device = (acpi_thermal_device_info *)calloc(1, sizeof(*device)); - if (device == NULL) - return B_NO_MEMORY; + return sDeviceManager->register_node(node, ACPI_THERMAL_MODULE_NAME, attrs, NULL, NULL); +} - device->node = node; - // register it everywhere - res = gDeviceManager->init_driver(gDeviceManager->get_parent(node), NULL, - (driver_module_info **)&device->acpi, (void**) &device->acpi_cookie); - if (res != B_OK) - goto err; - - *cookie = device; +static status_t +acpi_thermal_init_driver(device_node *node, void **_driverCookie) +{ + *_driverCookie = node; return B_OK; - -err: - free(device); - return res; } -static status_t -acpi_thermal_uninit_device(acpi_thermal_device_info *device) +static void +acpi_thermal_uninit_driver(void *driverCookie) { - gDeviceManager->uninit_driver(gDeviceManager->get_parent(device->node)); - free(device); - - return B_OK; } static status_t -acpi_thermal_added(device_node_handle node) +acpi_thermal_register_child_devices(void *_cookie) { + status_t err; + device_node *node = _cookie; int path_id; char name[128]; - path_id = gDeviceManager->create_id(ACPI_THERMAL_PATHID_GENERATOR); + path_id = sDeviceManager->create_id(ACPI_THERMAL_PATHID_GENERATOR); if (path_id < 0) { + dprintf("acpi_thermal_register_child_devices: couldn't create a path_id\n"); return B_ERROR; } snprintf(name, sizeof(name), ACPI_THERMAL_BASENAME, path_id); - { - device_attr attrs[] = { - { B_DRIVER_MODULE, B_STRING_TYPE, { string: ACPI_THERMAL_MODULE_NAME }}, - { PNP_DRIVER_CONNECTION, B_STRING_TYPE, { string: "acpi_thermal" }}, - // we want devfs on top of us (who wouldn't?) - { B_DRIVER_FIXED_CHILD, B_STRING_TYPE, { string: PNP_DEVFS_MODULE_NAME }}, + return sDeviceManager->publish_device(node, name, ACPI_THERMAL_DEVICE_MODULE_NAME); +} - { PNP_MANAGER_ID_GENERATOR, B_STRING_TYPE, { string: ACPI_THERMAL_PATHID_GENERATOR }}, - { PNP_MANAGER_AUTO_ID, B_UINT32_TYPE, { ui32: path_id }}, - // tell which name we want to have in devfs - { PNP_DEVFS_FILENAME, B_STRING_TYPE, { string: name }}, - { NULL } - }; +static status_t +acpi_thermal_init_device(void *_cookie, void **cookie) +{ + device_node *node = (device_node *)_cookie; + acpi_thermal_device_info *device; + device_node *parent; + + device = (acpi_thermal_device_info *)calloc(1, sizeof(*device)); + if (device == NULL) + return B_NO_MEMORY; - return gDeviceManager->register_device(node, attrs, NULL, &node); - } - + device->node = node; + + parent = sDeviceManager->get_parent_node(node); + sDeviceManager->get_driver(parent, (driver_module_info **)&device->acpi, + (void **)&device->acpi_cookie); + sDeviceManager->put_node(parent); + + *cookie = device; + return B_OK; } -static status_t -std_ops(int32 op, ...) +static void +acpi_thermal_uninit_device(void *_cookie) { - switch (op) { - case B_MODULE_INIT: - case B_MODULE_UNINIT: - return B_OK; - - default: - return B_ERROR; - } + acpi_thermal_device_info *device = (acpi_thermal_device_info *)_cookie; + free(device); } + + module_dependency module_dependencies[] = { - { B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&gDeviceManager }, + { B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&sDeviceManager }, {} }; -pnp_devfs_driver_info acpi_thermal_dump_module = { +driver_module_info acpi_thermal_driver_module = { { - { - ACPI_THERMAL_MODULE_NAME, - 0, - std_ops - }, + ACPI_THERMAL_MODULE_NAME, + 0, + NULL + }, - acpi_thermal_support, - acpi_thermal_added, - acpi_thermal_init_device, - (status_t (*) (void *))acpi_thermal_uninit_device, + acpi_thermal_support, + acpi_thermal_register_device, + acpi_thermal_init_driver, + acpi_thermal_uninit_driver, + acpi_thermal_register_child_devices, + NULL, // rescan + NULL, // removed +}; + + +struct device_module_info acpi_thermal_device_module = { + { + ACPI_THERMAL_DEVICE_MODULE_NAME, + 0, NULL }, - (pnp_device_open_hook) &acpi_thermal_open, + acpi_thermal_init_device, + acpi_thermal_uninit_device, + NULL, + + acpi_thermal_open, acpi_thermal_close, acpi_thermal_free, - (device_control_hook) &acpi_thermal_control, - - (device_read_hook) acpi_thermal_read, + acpi_thermal_read, acpi_thermal_write, - NULL, - NULL, + acpi_thermal_control, NULL, NULL }; module_info *modules[] = { - (module_info *)&acpi_thermal_dump_module, + (module_info *)&acpi_thermal_driver_module, + (module_info *)&acpi_thermal_device_module, NULL }; From korli at mail.berlios.de Sat Jun 7 20:39:30 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 7 Jun 2008 20:39:30 +0200 Subject: [Haiku-commits] r25851 - haiku/trunk/src/add-ons/kernel/drivers/power Message-ID: <200806071839.m57IdUXY011651@sheep.berlios.de> Author: korli Date: 2008-06-07 20:39:30 +0200 (Sat, 07 Jun 2008) New Revision: 25851 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25851&view=rev Removed: haiku/trunk/src/add-ons/kernel/drivers/power/acpi_ns_dump/ Modified: haiku/trunk/src/add-ons/kernel/drivers/power/Jamfile Log: acpi_ns_dump was merged into acpi_busman Modified: haiku/trunk/src/add-ons/kernel/drivers/power/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/power/Jamfile 2008-06-07 18:33:58 UTC (rev 25850) +++ haiku/trunk/src/add-ons/kernel/drivers/power/Jamfile 2008-06-07 18:39:30 UTC (rev 25851) @@ -2,4 +2,3 @@ SubInclude HAIKU_TOP src add-ons kernel drivers power acpi_button ; SubInclude HAIKU_TOP src add-ons kernel drivers power acpi_thermal ; -SubInclude HAIKU_TOP src add-ons kernel drivers power acpi_ns_dump ; From rudolfc at mail.berlios.de Sat Jun 7 21:28:28 2008 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Sat, 7 Jun 2008 21:28:28 +0200 Subject: [Haiku-commits] r25852 - haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich Message-ID: <200806071928.m57JSSrV015814@sheep.berlios.de> Author: rudolfc Date: 2008-06-07 21:28:27 +0200 (Sat, 07 Jun 2008) New Revision: 25852 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25852&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/io.c Log: probably/hopefully fixed auich driver for many systems: note that the codec_access_semaphore will NOT be reset on certain systems if an illegal/non existing register was accessed before. We need to do the access anyway to get such systems working. I hope someone can create a more extensive entry in syslog here to identify the offending access as that can be done AFAICT. This will help improve the driver later on because the non-existing-register accesses could be removed. Anyhow: I think the change I just did should remain, as it makes the driver more fault-tolerant to faults in itself (or hardware). Lowered the wait time to 1mS btw as that should suffice big_time. My Dell Inspiron C610 laptop with ICH3-M and Crystal CS4205 now works perfectly. No sound at all before.. Fix found in Linux-2.6.17/sound/pci/intel8x0m.c. Hope no-one is offended by my 'intrusion' here. Bye. Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/io.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/io.c 2008-06-07 18:39:30 UTC (rev 25851) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/io.c 2008-06-07 19:28:27 UTC (rev 25852) @@ -108,13 +108,19 @@ auich_codec_wait(device_config *config) { int i; - for (i = 0; i < 1100; i++) { + /* Anyone holding a semaphore for 1 msec should be 'shot'... */ + for (i = 0; i < 200; i++) { if ((auich_reg_read_8(config, AUICH_REG_ACC_SEMA) & 0x01) == 0) return B_OK; if (i > 100) snooze(10); } - return B_TIMED_OUT; + /* access to some forbidden (non existant) ac97 registers will not + * reset the semaphore. So even if you don't get the semaphore, still + * continue the access. We don't really need the semaphore anyway. */ + PRINT(("codec semaphore timed out!\n")); + + return B_OK; } uint16 From mmlr at mail.berlios.de Sat Jun 7 23:53:09 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sat, 7 Jun 2008 23:53:09 +0200 Subject: [Haiku-commits] r25853 - haiku/trunk/src/tests/kits/interface Message-ID: <200806072153.m57Lr9QT025464@sheep.berlios.de> Author: mmlr Date: 2008-06-07 23:53:08 +0200 (Sat, 07 Jun 2008) New Revision: 25853 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25853&view=rev Added: haiku/trunk/src/tests/kits/interface/ClippingPlusRedraw.cpp Modified: haiku/trunk/src/tests/kits/interface/Jamfile Log: Add a simple test that demonstrates that the Haiku app_server incorrectly (or at least incompatibly) uses the user set clipping region when determining whether or not to call Draw() on a view. Under BeOS when a some part of a view is exposed it will always trigger a Draw(), even if the current clipping region disallows drawing in the supplied update rect. Under Haiku however the view is not considered for an update when the current clipping region does not intersect with the newly exposed area. Running this test app from the Terminal this behaviour can be seen. When clicking inside the window a floating window pops up. When clicking again it goes away and triggers a redraw. When hitting a key, a clipping region is set that does not overlap with the floating window. After this clipping is set, the view does not get any Draw() call anymore when the floating window goes away. This is the reason for the redraw issues in firefox, as firefox uses the clipping region to constrain its asynchronous drawing, but does never reset the clipping to NULL. As firefox just collects the update rects in Draw() and then draws the contents itself, once the clipping region is set, many of the Draw() calls don't get called and the interface parts are never redrawn. Added: haiku/trunk/src/tests/kits/interface/ClippingPlusRedraw.cpp =================================================================== --- haiku/trunk/src/tests/kits/interface/ClippingPlusRedraw.cpp 2008-06-07 19:28:27 UTC (rev 25852) +++ haiku/trunk/src/tests/kits/interface/ClippingPlusRedraw.cpp 2008-06-07 21:53:08 UTC (rev 25853) @@ -0,0 +1,112 @@ +#include +#include +#include +#include +#include +#include + + +class ClippingView : public BView { +public: + ClippingView(BRect frame); + +virtual void Draw(BRect updateRect); +virtual void MouseDown(BPoint where); +virtual void KeyDown(const char *bytes, int32 numBytes); + +private: + BWindow * fFloatingWindow; +}; + + +class ClippingWindow : public BWindow { +public: + ClippingWindow(BRect frame); + +private: + ClippingView * fView; +}; + + +class ClippingApp : public BApplication { +public: + ClippingApp(); + +private: + ClippingWindow * fWindow; +}; + + +ClippingApp::ClippingApp() + : BApplication("application/x.vnd-Haiku.ClippingPlusRedraw") +{ + fWindow = new ClippingWindow(BRect(200, 200, 500, 400)); + fWindow->Show(); +} + + +ClippingWindow::ClippingWindow(BRect frame) + : BWindow(frame, "Window", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE) +{ + fView = new ClippingView(frame.OffsetToSelf(0, 0)); + AddChild(fView); + fView->MakeFocus(); +} + + +ClippingView::ClippingView(BRect frame) + : BView(frame, "View", B_FOLLOW_ALL, B_WILL_DRAW), + fFloatingWindow(NULL) +{ +} + + +void +ClippingView::Draw(BRect updateRect) +{ + printf("got draw with update rect: %f, %f, %f, %f\n", + updateRect.left, updateRect.top, updateRect.right, updateRect.bottom); + + SetHighColor(0, 255, 0); + FillRect(Bounds(), B_SOLID_HIGH); +} + + +void +ClippingView::MouseDown(BPoint where) +{ + if (fFloatingWindow == NULL) { + BPoint leftTop = ConvertToScreen(BPoint(50, 50)); + fFloatingWindow = new BWindow(BRect(leftTop, leftTop + BPoint(100, 50)), + "Floating", B_FLOATING_WINDOW, B_AVOID_FOCUS); + fFloatingWindow->Show(); + } else { + fFloatingWindow->Lock(); + fFloatingWindow->Quit(); + fFloatingWindow = NULL; + } +} + + +void +ClippingView::KeyDown(const char *bytes, int32 numBytes) +{ + SetHighColor(0, 0, 255); + FillRect(Bounds(), B_SOLID_HIGH); + + BRegion region(BRect(200, 100, 250, 150)); + ConstrainClippingRegion(®ion); + + SetHighColor(255, 0, 0); + FillRect(Bounds(), B_SOLID_HIGH); +} + + +int +main(int argc, const char *argv[]) +{ + ClippingApp *app = new ClippingApp(); + app->Run(); + delete app; + return 0; +} Modified: haiku/trunk/src/tests/kits/interface/Jamfile =================================================================== --- haiku/trunk/src/tests/kits/interface/Jamfile 2008-06-07 19:28:27 UTC (rev 25852) +++ haiku/trunk/src/tests/kits/interface/Jamfile 2008-06-07 21:53:08 UTC (rev 25853) @@ -129,6 +129,12 @@ : be ; + +SimpleTest ClippingPlusRedraw : + ClippingPlusRedraw.cpp + : be +; + SEARCH on [ FGristFiles ScrollView.cpp CheckBox.cpp ChannelSlider.cpp ChannelControl.cpp Slider.cpp Control.cpp ] = [ FDirName $(HAIKU_TOP) src kits interface ] ; From superstippi at gmx.de Sun Jun 8 00:31:27 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 08 Jun 2008 00:31:27 +0200 Subject: [Haiku-commits] r25853 - haiku/trunk/src/tests/kits/interface In-Reply-To: <200806072153.m57Lr9QT025464@sheep.berlios.de> References: <200806072153.m57Lr9QT025464@sheep.berlios.de> Message-ID: <20080608003127.722.1@stippis2.1212877306.fake> mmlr at BerliOS wrote: > Author: mmlr > Date: 2008-06-07 23:53:08 +0200 (Sat, 07 Jun 2008) New Revision: 25853 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25853&view=rev > > Added: > haiku/trunk/src/tests/kits/interface/ClippingPlusRedraw.cpp > Modified: > haiku/trunk/src/tests/kits/interface/Jamfile > Log: > Add a simple test that demonstrates that the Haiku app_server incorrectly > (or at least incompatibly) uses the user set clipping region when > determining whether or not to call Draw() on a view. Under BeOS when a > some part of a view is exposed it will always trigger a Draw(), even if > the current clipping region disallows drawing in the supplied update > rect. Under Haiku however the view is not considered for an update when > the current clipping region does not intersect with the newly exposed > area. > Running this test app from the Terminal this behaviour can be seen. When > clicking inside the window a floating window pops up. When clicking again > it goes away and triggers a redraw. When hitting a key, a clipping region > is set that does not overlap with the floating window. After this > clipping is set, the view does not get any Draw() call anymore when the > floating window goes away. > This is the reason for the redraw issues in firefox, as firefox uses the > clipping region to constrain its asynchronous drawing, but does never > reset the clipping to NULL. As firefox just collects the update rects in > Draw() and then draws the contents itself, once the clipping region is > set, many of the Draw() calls don't get called and the interface parts > are never redrawn. Wow! Thanks! I remember thinking along those lines, but it never "clicked". I didn't add all the info up to get to this conclusion. Now I guess I can fix this in app_server tomorrow. Should be just a matter of ignoring user clipping for all the invalidation code paths. Yay! :-D Best regards, -Stephan P.S. The Swiss should have won today! From mmlr at mlotz.ch Sun Jun 8 00:36:49 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Sun, 08 Jun 2008 00:36:49 +0200 Subject: [Haiku-commits] r25853 - haiku/trunk/src/tests/kits/interface In-Reply-To: <20080608003127.722.1@stippis2.1212877306.fake> Message-ID: <44841795176-BeMail@primary> Hi Stephan > Wow! Thanks! I remember thinking along those lines, but it never > "clicked". > I didn't add all the info up to get to this conclusion. Now I guess I > can > fix this in app_server tomorrow. Should be just a matter of ignoring > user > clipping for all the invalidation code paths. Yay! :-D I built a small DrawingDebugger that sent everything I was interested in through a port and then visualized it in a separate window. So I could then see what regions/views/rects were involved and came to the conclusion that it simply didn't call Draw() at all. The trickier part was to find out why it didn't, but once I had the user clipping as a suspect it was doable. In fact I am going to try to fix it right now as I have all the relevant stuff handy from debugging. But as this is not really my usual working area I'd be glad if you could review with what I've come up. If you don't see a commit by tomorrow it means I gave up on it and you should feel free to fix it :-) Regards Michael From superstippi at gmx.de Sun Jun 8 00:53:38 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 08 Jun 2008 00:53:38 +0200 Subject: [Haiku-commits] r25853 - haiku/trunk/src/tests/kits/interface In-Reply-To: <44841795176-BeMail@primary> References: <44841795176-BeMail@primary> Message-ID: <20080608005338.797.3@stippis2.1212877306.fake> Michael Lotz wrote: > Hi Stephan > > > Wow! Thanks! I remember thinking along those lines, but it never > > "clicked". > > I didn't add all the info up to get to this conclusion. Now I guess I > > can > > fix this in app_server tomorrow. Should be just a matter of ignoring > > user > > clipping for all the invalidation code paths. Yay! :-D > > I built a small DrawingDebugger that sent everything I was interested in > through a port and then visualized it in a separate window. So I could > then see what regions/views/rects were involved and came to the > conclusion that it simply didn't call Draw() at all. The trickier part > was to find out why it didn't, but once I had the user clipping as a > suspect it was doable. > > In fact I am going to try to fix it right now as I have all the relevant > stuff handy from debugging. But as this is not really my usual working > area I'd be glad if you could review with what I've come up. If you don't > see a commit by tomorrow it means I gave up on it and you should feel > free to fix it :-) Ok! Thanks for doing that... I was just checking mails before going to bed, so feel free to dig in! From memory... I think the combined clipping is cached, so you might have to work around that. That's going to make it non-straight forward, in the sense that a decision might have to be made with regards to different "speed trade-offs". Maybe you can add a flag to View::ScreenClipping() to indicate whether or not this is supposed to contain the user clipping, and remember what is contained in the cached clipping and then force rebuilding, but only if there is any user clipping defined at all, so that there is no impact for "regular views". Best regards, -Stephan From mmlr at mail.berlios.de Sun Jun 8 01:09:22 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 8 Jun 2008 01:09:22 +0200 Subject: [Haiku-commits] r25854 - haiku/trunk/src/servers/app Message-ID: <200806072309.m57N9MAq017914@sheep.berlios.de> Author: mmlr Date: 2008-06-08 01:09:21 +0200 (Sun, 08 Jun 2008) New Revision: 25854 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25854&view=rev Modified: haiku/trunk/src/servers/app/View.cpp haiku/trunk/src/servers/app/View.h haiku/trunk/src/servers/app/Window.cpp haiku/trunk/src/servers/app/WorkspacesView.cpp Log: * Decouple local and user clipping into normal local clipping and a user clipping region pointer. * Provide _ScreenClipping() that only includes local and screen clipping but not user clipping. * Provide ScreenAndUserClipping() that returns screen clipping if no user clipping is present, or returns a combined region that is then cached. * Adapt all places where the former methods are used and decide which one to use depending on the relevance of user clipping. User clipping is now ignored for background clearing and when determining whether or not to call Draw() on a view. This should make Haiku behaviourally compatible with BeOS (confirmed by the ClippingAndRedraw test app) and should also fix the Firefox redraw issues. Stephan please review! Modified: haiku/trunk/src/servers/app/View.cpp =================================================================== --- haiku/trunk/src/servers/app/View.cpp 2008-06-07 21:53:08 UTC (rev 25853) +++ haiku/trunk/src/servers/app/View.cpp 2008-06-07 23:09:21 UTC (rev 25854) @@ -109,7 +109,9 @@ fLocalClipping((BRect)Bounds()), fScreenClipping(), - fScreenClippingValid(false) + fScreenClippingValid(false), + fUserClipping(NULL), + fScreenAndUserClipping(NULL) { if (fDrawState) fDrawState->SetSubPixelPrecise(fFlags & B_SUBPIXEL_PRECISE); @@ -1121,19 +1123,19 @@ // move src rect to destination here for efficiency reasons visibleSrc.OffsetBy(xOffset, yOffset); - // we need to interstect the copyRegion too times, onces + // we need to interstect the copyRegion two times, onces // at the source and once at the destination (here done // the other way arround but it doesn't matter) // the reason for this is that we are not supposed to visually // copy children in the source rect and neither to copy onto // children in the destination rect... copyRegion->Set((clipping_rect)visibleSrc); - copyRegion->IntersectWith(&ScreenClipping(&windowContentClipping)); - // note that fScreenClipping is used directly from hereon + copyRegion->IntersectWith(&ScreenAndUserClipping(&windowContentClipping)); + // note that fScreenAndUserClipping is used directly from hereon // because it is now up to date copyRegion->OffsetBy(-xOffset, -yOffset); - copyRegion->IntersectWith(&fScreenClipping); + copyRegion->IntersectWith(fScreenAndUserClipping); // do the actual blit fWindow->CopyContents(copyRegion, xOffset, yOffset); @@ -1155,7 +1157,7 @@ // exclude the part that we could copy dirty->Exclude(copyRegion); - dirty->IntersectWith(&fScreenClipping); + dirty->IntersectWith(fScreenAndUserClipping); fWindow->MarkContentDirty(*dirty); fWindow->RecycleRegion(dirty); @@ -1242,7 +1244,8 @@ if (fViewBitmap != NULL || fViewColor != B_TRANSPARENT_COLOR) { // we can only draw within our own area - BRegion* redraw = fWindow->GetRegion(ScreenClipping(windowContentClipping)); + BRegion* redraw = fWindow->GetRegion( + _ScreenClipping(windowContentClipping)); if (!redraw) return; // add the current clipping @@ -1478,7 +1481,7 @@ if (!fVisible) return; - if (region.Intersects(ScreenClipping(windowContentClipping).Frame())) + if (region.Intersects(_ScreenClipping(windowContentClipping).Frame())) message->AddInt32("_token", fToken); for (View* child = FirstChild(); child; child = child->NextSibling()) { @@ -1500,7 +1503,7 @@ if (!region.Intersects((clipping_rect)screenBounds)) return; - if (region.Intersects(ScreenClipping(windowContentClipping).Frame())) + if (region.Intersects(_ScreenClipping(windowContentClipping).Frame())) link.Attach(fToken); for (View* child = FirstChild(); child; child = child->NextSibling()) { @@ -1525,6 +1528,19 @@ printf(" fScreenClipping:\n"); fScreenClipping.PrintToStream(); printf(" valid: %d\n", fScreenClippingValid); + + printf(" fUserClipping:\n"); + if (fUserClipping != NULL) + fUserClipping->PrintToStream(); + else + printf(" none\n"); + + printf(" fScreenAndUserClipping:\n"); + if (fScreenAndUserClipping != NULL) + fScreenAndUserClipping->PrintToStream(); + else + printf(" invalid\n"); + printf(" state:\n"); printf(" user clipping: %d\n", fDrawState->HasClipping()); BPoint origin = fDrawState->CombinedOrigin(); @@ -1572,45 +1588,44 @@ // hand, views for which this feature is actually used will // probably not have any children, so it is not that expensive // after all - BRegion* screenUserClipping = fWindow->GetRegion(); - if (!screenUserClipping) - return; - fDrawState->GetCombinedClippingRegion(screenUserClipping); - fLocalClipping.IntersectWith(screenUserClipping); - fWindow->RecycleRegion(screenUserClipping); + if (fUserClipping == NULL) { + fUserClipping = new (nothrow) BRegion; + if (fUserClipping == NULL) + return; + } + + fDrawState->GetCombinedClippingRegion(fUserClipping); + } else { + delete fUserClipping; + fUserClipping = NULL; } + delete fScreenAndUserClipping; + fScreenAndUserClipping = NULL; fScreenClippingValid = false; } BRegion& -View::ScreenClipping(BRegion* windowContentClipping, bool force) const +View::ScreenAndUserClipping(BRegion* windowContentClipping, bool force) const { - if (!fScreenClippingValid || force) { - fScreenClipping = fLocalClipping; - ConvertToScreen(&fScreenClipping); + // no user clipping - return screen clipping directly + if (fUserClipping == NULL) + return _ScreenClipping(windowContentClipping, force); - // see if parts of our bounds are hidden underneath - // the parent, the local clipping does not account for this - IntRect clippedBounds = Bounds(); - ConvertToVisibleInTopView(&clippedBounds); - if (clippedBounds.Width() < fScreenClipping.Frame().Width() - || clippedBounds.Height() < fScreenClipping.Frame().Height()) { - BRegion* temp = fWindow->GetRegion(); - if (temp) { - temp->Set((clipping_rect)clippedBounds); - fScreenClipping.IntersectWith(temp); - fWindow->RecycleRegion(temp); - } - } + // combined screen and user clipping already valid + if (fScreenAndUserClipping != NULL) + return *fScreenAndUserClipping; - fScreenClipping.IntersectWith(windowContentClipping); - fScreenClippingValid = true; - } -//printf("###View(%s)::ScreenClipping():\n", Name()); -//fScreenClipping.PrintToStream(); - return fScreenClipping; + // build a new combined user and screen clipping + fScreenAndUserClipping = new (nothrow) BRegion(*fUserClipping); + if (fScreenAndUserClipping == NULL) + return fScreenClipping; + + ConvertToScreen(fScreenAndUserClipping); + fScreenAndUserClipping->IntersectWith( + &_ScreenClipping(windowContentClipping, force)); + return *fScreenAndUserClipping; } @@ -1633,6 +1648,8 @@ // if (!fScreenClippingValid) // return; + delete fScreenAndUserClipping; + fScreenAndUserClipping = NULL; fScreenClippingValid = false; // invalidate the childrens screen clipping as well for (View* child = FirstChild(); child; child = child->NextSibling()) { @@ -1641,11 +1658,43 @@ } +BRegion& +View::_ScreenClipping(BRegion* windowContentClipping, bool force) const +{ + if (!fScreenClippingValid || force) { + fScreenClipping = fLocalClipping; + ConvertToScreen(&fScreenClipping); + + // see if parts of our bounds are hidden underneath + // the parent, the local clipping does not account for this + IntRect clippedBounds = Bounds(); + ConvertToVisibleInTopView(&clippedBounds); + if (clippedBounds.Width() < fScreenClipping.Frame().Width() + || clippedBounds.Height() < fScreenClipping.Frame().Height()) { + BRegion* temp = fWindow->GetRegion(); + if (temp) { + temp->Set((clipping_rect)clippedBounds); + fScreenClipping.IntersectWith(temp); + fWindow->RecycleRegion(temp); + } + } + + fScreenClipping.IntersectWith(windowContentClipping); + fScreenClippingValid = true; + } + + return fScreenClipping; +} + + void View::_MoveScreenClipping(int32 x, int32 y, bool deep) { - if (fScreenClippingValid) + if (fScreenClippingValid) { fScreenClipping.OffsetBy(x, y); + delete fScreenAndUserClipping; + fScreenAndUserClipping = NULL; + } if (deep) { // move the childrens screen clipping as well Modified: haiku/trunk/src/servers/app/View.h =================================================================== --- haiku/trunk/src/servers/app/View.h 2008-06-07 21:53:08 UTC (rev 25853) +++ haiku/trunk/src/servers/app/View.h 2008-06-07 23:09:21 UTC (rev 25854) @@ -225,11 +225,17 @@ // clipping void RebuildClipping(bool deep); - BRegion& ScreenClipping(BRegion* windowContentClipping, + BRegion& ScreenAndUserClipping( + BRegion* windowContentClipping, bool force = false) const; void InvalidateScreenClipping(); inline bool IsScreenClippingValid() const - { return fScreenClippingValid; } + { + return fScreenClippingValid + && (fUserClipping == NULL + || (fUserClipping != NULL + && fScreenAndUserClipping != NULL)); + } // debugging void PrintToStream() const; @@ -239,6 +245,8 @@ #endif protected: + BRegion& _ScreenClipping(BRegion* windowContentClipping, + bool force = false) const; void _MoveScreenClipping(int32 x, int32 y, bool deep); Overlay* _Overlay() const; @@ -285,6 +293,9 @@ mutable BRegion fScreenClipping; mutable bool fScreenClippingValid; + + BRegion* fUserClipping; + mutable BRegion* fScreenAndUserClipping; }; #endif // VIEW_H Modified: haiku/trunk/src/servers/app/Window.cpp =================================================================== --- haiku/trunk/src/servers/app/Window.cpp 2008-06-07 21:53:08 UTC (rev 25853) +++ haiku/trunk/src/servers/app/Window.cpp 2008-06-07 23:09:21 UTC (rev 25854) @@ -581,7 +581,7 @@ if (!fContentRegionValid) _UpdateContentRegion(); - region.IntersectWith(&view->ScreenClipping(&fContentRegion)); + region.IntersectWith(&view->ScreenAndUserClipping(&fContentRegion)); } @@ -706,7 +706,8 @@ view->ConvertToScreen(&viewRegion); viewRegion.IntersectWith(&VisibleContentRegion()); if (viewRegion.CountRects() > 0) { - viewRegion.IntersectWith(&view->ScreenClipping(&fContentRegion)); + viewRegion.IntersectWith( + &view->ScreenAndUserClipping(&fContentRegion)); //fDrawingEngine->FillRegion(viewRegion, rgb_color{ 0, 255, 0, 255 }); //snooze(10000); Modified: haiku/trunk/src/servers/app/WorkspacesView.cpp =================================================================== --- haiku/trunk/src/servers/app/WorkspacesView.cpp 2008-06-07 21:53:08 UTC (rev 25853) +++ haiku/trunk/src/servers/app/WorkspacesView.cpp 2008-06-07 23:09:21 UTC (rev 25854) @@ -325,7 +325,7 @@ BRegion* windowContentClipping, bool deep) { // we can only draw within our own area - BRegion redraw(ScreenClipping(windowContentClipping)); + BRegion redraw(ScreenAndUserClipping(windowContentClipping)); // add the current clipping redraw.IntersectWith(effectiveClipping); From mmlr at mlotz.ch Sun Jun 8 01:12:22 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Sun, 08 Jun 2008 01:12:22 +0200 Subject: [Haiku-commits] r25853 - haiku/trunk/src/tests/kits/interface In-Reply-To: <20080608005338.797.3@stippis2.1212877306.fake> Message-ID: <46974256267-BeMail@primary> Hi Stephan > Ok! Thanks for doing that... I was just checking mails before going > to bed, > so feel free to dig in! From memory... I think the combined clipping > is > cached, so you might have to work around that. That's going to make > it > non-straight forward, in the sense that a decision might have to be > made > with regards to different "speed trade-offs". Maybe you can add a > flag to > View::ScreenClipping() to indicate whether or not this is supposed to > contain the user clipping, and remember what is contained in the > cached > clipping and then force rebuilding, but only if there is any user > clipping > defined at all, so that there is no impact for "regular views". I've come up with r25854. It separates the local and user clipping and combines and caches them when necessary. Views without user clipping will get screen clipping right away. The user clipping and the combined clipping are dynamically allocated now though, so you might want to further optimize on that. Hope I understood the concepts correct ;-) Regards Michael From mmlr at mail.berlios.de Sun Jun 8 01:37:58 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 8 Jun 2008 01:37:58 +0200 Subject: [Haiku-commits] r25855 - in haiku/trunk/src/tests/servers/app: . drawing_debugger Message-ID: <200806072337.m57Nbw4R023337@sheep.berlios.de> Author: mmlr Date: 2008-06-08 01:37:58 +0200 (Sun, 08 Jun 2008) New Revision: 25855 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25855&view=rev Added: haiku/trunk/src/tests/servers/app/drawing_debugger/ haiku/trunk/src/tests/servers/app/drawing_debugger/DrawingDebugger.cpp haiku/trunk/src/tests/servers/app/drawing_debugger/Jamfile Modified: haiku/trunk/src/tests/servers/app/Jamfile Log: Adding DrawingDebugger app that creates a port listening for BRects that then get drawn into a window with random colors. With that one can for example add code to the app_server or interface kit classes that push through rects or regions to see what exactly is going on in drawing operations. Code examples of how to use are at the top of the file. Has fixed window dimensions though as I was lazy :-) Modified: haiku/trunk/src/tests/servers/app/Jamfile =================================================================== --- haiku/trunk/src/tests/servers/app/Jamfile 2008-06-07 23:09:21 UTC (rev 25854) +++ haiku/trunk/src/tests/servers/app/Jamfile 2008-06-07 23:37:58 UTC (rev 25855) @@ -167,6 +167,7 @@ SubInclude HAIKU_TOP src tests servers app cursor_test ; SubInclude HAIKU_TOP src tests servers app desktop_window ; SubInclude HAIKU_TOP src tests servers app draw_after_children ; +SubInclude HAIKU_TOP src tests servers app drawing_debugger ; SubInclude HAIKU_TOP src tests servers app event_mask ; SubInclude HAIKU_TOP src tests servers app following ; SubInclude HAIKU_TOP src tests servers app idle_test ; Added: haiku/trunk/src/tests/servers/app/drawing_debugger/DrawingDebugger.cpp =================================================================== --- haiku/trunk/src/tests/servers/app/drawing_debugger/DrawingDebugger.cpp 2008-06-07 23:09:21 UTC (rev 25854) +++ haiku/trunk/src/tests/servers/app/drawing_debugger/DrawingDebugger.cpp 2008-06-07 23:37:58 UTC (rev 25855) @@ -0,0 +1,188 @@ +#include +#include +#include +#include +#include +#include + + +#if 0 +{ + // usage example for simple rects + port_id port = find_port("drawing_debugger_port"); + if (port >= 0) { + write_port_etc(port, 'RECT', &interestingRect, sizeof(BRect), + B_RELATIVE_TIMEOUT, 0); + } + + + // usage example for regions + port_id port = find_port("drawing_debugger_port"); + if (port >= 0) { + int32 rectCount = region->CountRects(); + for (int32 i = 0; i < rectCount; i++) { + BRect interestingRect = region->RectAt(i); + write_port_etc(port, 'RECT', &interestingRect, sizeof(BRect), + B_RELATIVE_TIMEOUT, 0); + } + } +} +#endif + + +class DrawingDebuggerView : public BView { +public: + DrawingDebuggerView(BRect frame); +virtual ~DrawingDebuggerView(); + +virtual void Draw(BRect updateRect); + +private: +static int32 _PortListener(void *data); + + BBitmap * fBitmap; + BView * fOffscreenView; + thread_id fListenerThread; + bool fStopListener; +}; + + +class DrawingDebuggerWindow : public BWindow { +public: + DrawingDebuggerWindow(BRect frame); + +private: + DrawingDebuggerView * fView; +}; + + +class DrawingDebuggerApp : public BApplication { +public: + DrawingDebuggerApp(); + +private: + DrawingDebuggerWindow * fWindow; +}; + + +rgb_color +random_color() +{ + rgb_color result; + result.red = system_time() % 256; + result.green = (system_time() >> 8) % 256; + result.blue = (system_time() >> 16) % 256; + return result; +} + + +DrawingDebuggerApp::DrawingDebuggerApp() + : BApplication("application/x.vnd-Haiku.DrawingDebugger") +{ + fWindow = new DrawingDebuggerWindow(BRect(200, 200, 999, 799)); + fWindow->Show(); +} + + +DrawingDebuggerWindow::DrawingDebuggerWindow(BRect frame) + : BWindow(frame, "DrawingDebugger", B_TITLED_WINDOW, + B_QUIT_ON_WINDOW_CLOSE) +{ + fView = new DrawingDebuggerView(frame.OffsetToSelf(0, 0)); + AddChild(fView); +} + + +DrawingDebuggerView::DrawingDebuggerView(BRect frame) + : BView(frame, "DrawingDebuggerView", B_FOLLOW_ALL, B_WILL_DRAW) +{ + fBitmap = new BBitmap(frame, B_RGB32, true); + fOffscreenView= new BView(frame, "OffscreenView", B_FOLLOW_NONE, 0); + fOffscreenView->SetViewColor(B_TRANSPARENT_32_BIT); + fBitmap->AddChild(fOffscreenView); + + fStopListener = false; + fListenerThread = spawn_thread(_PortListener, "port_listener", + B_NORMAL_PRIORITY, this); + resume_thread(fListenerThread); +} + + +DrawingDebuggerView::~DrawingDebuggerView() +{ + fStopListener = true; + int32 returnCode = B_OK; + wait_for_thread(fListenerThread, &returnCode); + delete fBitmap; +} + + +void +DrawingDebuggerView::Draw(BRect updateRect) +{ + DrawBitmap(fBitmap, updateRect, updateRect); +} + + +int32 +DrawingDebuggerView::_PortListener(void *data) +{ + DrawingDebuggerView *view = (DrawingDebuggerView *)data; + port_id port = create_port(1000, "drawing_debugger_port"); + if (port < 0) { + printf("failed to create port\n"); + return port; + } + + size_t bufferSize = 1024; + uint8 *buffer = (uint8 *)malloc(bufferSize); + if (buffer == NULL) + return B_NO_MEMORY; + + while (!view->fStopListener) { + int32 code = 0; + status_t result = read_port_etc(port, &code, buffer, bufferSize, + B_RELATIVE_TIMEOUT, 100000); + if (result == B_INTERRUPTED || result == B_TIMED_OUT) + continue; + if (result < B_OK) { + printf("failed to read from port\n"); + return result; + } + + switch (code) { + case 'RECT': + { + BRect *rect = (BRect *)buffer; + view->fBitmap->Lock(); + view->fOffscreenView->SetHighColor(random_color()); + view->fOffscreenView->FillRect(*rect, B_SOLID_HIGH); + view->fOffscreenView->Sync(); + view->fBitmap->Unlock(); + + view->LockLooper(); + view->Invalidate(*rect); + view->UnlockLooper(); + break; + } + + default: + printf("unsupported code '%.4s'\n", (char *)&code); + break; + } + } + + free(buffer); + delete_port(port); + return 0; +} + + +int +main(int argc, const char *argv[]) +{ + DrawingDebuggerApp *app = new DrawingDebuggerApp(); + app->Run(); + delete app; + return 0; +} Added: haiku/trunk/src/tests/servers/app/drawing_debugger/Jamfile =================================================================== --- haiku/trunk/src/tests/servers/app/drawing_debugger/Jamfile 2008-06-07 23:09:21 UTC (rev 25854) +++ haiku/trunk/src/tests/servers/app/drawing_debugger/Jamfile 2008-06-07 23:37:58 UTC (rev 25855) @@ -0,0 +1,12 @@ +SubDir HAIKU_TOP src tests servers app drawing_debugger ; + +SetSubDirSupportedPlatformsBeOSCompatible ; +AddSubDirSupportedPlatforms libbe_test ; + +UseHeaders [ FDirName os app ] ; +UseHeaders [ FDirName os interface ] ; + +Application DrawingDebugger : + DrawingDebugger.cpp + : be +; From alex at zappotek.com Sun Jun 8 01:31:46 2008 From: alex at zappotek.com (Alexandre Deckner) Date: Sun, 08 Jun 2008 01:31:46 +0200 Subject: [Haiku-commits] r25826 - haiku/trunk/src/apps/deskbar In-Reply-To: <894b9700806070448u7c1a6ccdo3d83baab861b269a@mail.gmail.com> References: <200806061507.m56F7eqN019502@sheep.berlios.de> <894b9700806070448u7c1a6ccdo3d83baab861b269a@mail.gmail.com> Message-ID: <484B1A62.3040804@zappotek.com> Stefano Ceccherini a ?crit : > > Nice one! I tried to track down this a couple of times, but always failed. > > Indeed, it wasn't easy to track down! This was my second attempt :-) From mmlr at mail.berlios.de Sun Jun 8 01:49:04 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 8 Jun 2008 01:49:04 +0200 Subject: [Haiku-commits] r25856 - haiku/trunk/src/servers/app Message-ID: <200806072349.m57Nn4wQ024435@sheep.berlios.de> Author: mmlr Date: 2008-06-08 01:49:04 +0200 (Sun, 08 Jun 2008) New Revision: 25856 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25856&view=rev Modified: haiku/trunk/src/servers/app/View.cpp Log: * Fix leaking the user and combined screen and user clipping. * Fix using fScreenAndUserClipping directly in CopyBits() that could crash when in fScreenAndUserClipping wasn't used (when there's no user clipping for example). Modified: haiku/trunk/src/servers/app/View.cpp =================================================================== --- haiku/trunk/src/servers/app/View.cpp 2008-06-07 23:37:58 UTC (rev 25855) +++ haiku/trunk/src/servers/app/View.cpp 2008-06-07 23:49:04 UTC (rev 25856) @@ -123,6 +123,8 @@ if (fViewBitmap != NULL) gBitmapManager->DeleteBitmap(fViewBitmap); + delete fScreenAndUserClipping; + delete fUserClipping; delete fDrawState; // if (fWindow && this == fWindow->TopView()) @@ -1130,12 +1132,11 @@ // copy children in the source rect and neither to copy onto // children in the destination rect... copyRegion->Set((clipping_rect)visibleSrc); - copyRegion->IntersectWith(&ScreenAndUserClipping(&windowContentClipping)); - // note that fScreenAndUserClipping is used directly from hereon - // because it is now up to date - + BRegion *screenAndUserClipping + = &ScreenAndUserClipping(&windowContentClipping); + copyRegion->IntersectWith(screenAndUserClipping); copyRegion->OffsetBy(-xOffset, -yOffset); - copyRegion->IntersectWith(fScreenAndUserClipping); + copyRegion->IntersectWith(screenAndUserClipping); // do the actual blit fWindow->CopyContents(copyRegion, xOffset, yOffset); @@ -1157,7 +1158,7 @@ // exclude the part that we could copy dirty->Exclude(copyRegion); - dirty->IntersectWith(fScreenAndUserClipping); + dirty->IntersectWith(screenAndUserClipping); fWindow->MarkContentDirty(*dirty); fWindow->RecycleRegion(dirty); From mmlr at mail.berlios.de Sun Jun 8 02:23:20 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 8 Jun 2008 02:23:20 +0200 Subject: [Haiku-commits] r25857 - haiku/trunk/src/system/kernel Message-ID: <200806080023.m580NKDB027855@sheep.berlios.de> Author: mmlr Date: 2008-06-08 02:23:17 +0200 (Sun, 08 Jun 2008) New Revision: 25857 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25857&view=rev Modified: haiku/trunk/src/system/kernel/port.cpp Log: * Add read, write and total count to the ports KDL command so one can see what the ports of a team are up to without having to go through each port individually. * Enlarge the port id column so even large ids fit nicely. Modified: haiku/trunk/src/system/kernel/port.cpp =================================================================== --- haiku/trunk/src/system/kernel/port.cpp 2008-06-07 23:49:04 UTC (rev 25856) +++ haiku/trunk/src/system/kernel/port.cpp 2008-06-08 00:23:17 UTC (rev 25857) @@ -95,7 +95,7 @@ } else if (argc > 1) owner = strtoul(argv[1], NULL, 0); - kprintf("port id cap r-sem w-sem team name\n"); + kprintf("port id cap r-sem r-cnt w-sem w-cnt total team name\n"); for (i = 0; i < sMaxPorts; i++) { struct port_entry *port = &sPorts[i]; @@ -104,8 +104,12 @@ || (name != NULL && strstr(port->name, name) == NULL)) continue; - kprintf("%p %6ld %4ld %6ld %6ld %6ld %s\n", port, port->id, - port->capacity, port->read_sem, port->write_sem, port->owner, + int32 readCount, writeCount; + get_sem_count(port->read_sem, &readCount); + get_sem_count(port->write_sem, &writeCount); + kprintf("%p %8ld %4ld %6ld %6ld %6ld %6ld %8ld %6ld %s\n", port, + port->id, port->capacity, port->read_sem, readCount, + port->write_sem, writeCount, port->total_count, port->owner, port->name); } return 0; From mmlr at mail.berlios.de Sun Jun 8 02:32:16 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 8 Jun 2008 02:32:16 +0200 Subject: [Haiku-commits] r25858 - in haiku/trunk: build/config_headers headers/private/kernel Message-ID: <200806080032.m580WGUa028381@sheep.berlios.de> Author: mmlr Date: 2008-06-08 02:32:14 +0200 (Sun, 08 Jun 2008) New Revision: 25858 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25858&view=rev Modified: haiku/trunk/build/config_headers/kernel_debugger_config.h haiku/trunk/headers/private/kernel/debugger_keymaps.h Log: Add french KDL keymap contributed by Olivier Coursiere, thanks! Modified: haiku/trunk/build/config_headers/kernel_debugger_config.h =================================================================== --- haiku/trunk/build/config_headers/kernel_debugger_config.h 2008-06-08 00:23:17 UTC (rev 25857) +++ haiku/trunk/build/config_headers/kernel_debugger_config.h 2008-06-08 00:32:14 UTC (rev 25858) @@ -3,6 +3,7 @@ // Available keymaps: // 'dv' dvorak keymap +// 'fr' french keymap // 'sg' swiss-german keymap // 'us' default US keymap #define KDL_KEYMAP 'us' Modified: haiku/trunk/headers/private/kernel/debugger_keymaps.h =================================================================== --- haiku/trunk/headers/private/kernel/debugger_keymaps.h 2008-06-08 00:23:17 UTC (rev 25857) +++ haiku/trunk/headers/private/kernel/debugger_keymaps.h 2008-06-08 00:32:14 UTC (rev 25858) @@ -5,6 +5,7 @@ * Authors: * Michael Lotz * Darian Rackham + * Olivier Coursi?re */ #ifndef DEBUGGER_KEYMAPS_H #define DEBUGGER_KEYMAPS_H @@ -46,6 +47,41 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +#elif KDL_KEYMAP == 'fr' + +static const char kUnshiftedKeymap[128] = { + 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '?', '+', 8, '\t', + 'a', 'z', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 0, '$', '\n', 0, 'q', 's', + 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', '?', '*', 0, '$', 'w', 'x', 'c', 'v', + 'b', 'n', ',', ';', ':', '!', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '-', 0, 0, 0, '+', 0, + 0, 0, 0, 0, 0, 0, '<', 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static const char kShiftedKeymap[128] = { + 0, 27, '&', '?', '"', '\'', '(', '-', '?', '_', '?', '?', ')', '=', 8, '\t', + 'A', 'Z', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 0, '?', '\n', 0, 'Q', 'S', + 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', '%', '?', 0, 0, 'W', 'X', 'C', 'V', + 'B', 'N', '?', '.', '/', '?', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, '>', 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static const char kAltedKeymap[128] = { + 0, 27, 0, '~', '#', '{', '[', '|', '`', '\\', '^', '@', ']', '}', 8, '\t', + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '?', 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, '\\', 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + #elif KDL_KEYMAP == 'sg' static const char kUnshiftedKeymap[128] = { From korli at mail.berlios.de Sun Jun 8 03:11:31 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 8 Jun 2008 03:11:31 +0200 Subject: [Haiku-commits] r25859 - haiku/trunk/src/system/kernel/arch/x86 Message-ID: <200806080111.m581BVXM030651@sheep.berlios.de> Author: korli Date: 2008-06-08 03:11:29 +0200 (Sun, 08 Jun 2008) New Revision: 25859 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25859&view=rev Modified: haiku/trunk/src/system/kernel/arch/x86/arch_vm.cpp Log: find_nearest() now saves a solution when reaching the max number of solutions and not near enough Modified: haiku/trunk/src/system/kernel/arch/x86/arch_vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_vm.cpp 2008-06-08 00:32:14 UTC (rev 25858) +++ haiku/trunk/src/system/kernel/arch/x86/arch_vm.cpp 2008-06-08 01:11:29 UTC (rev 25859) @@ -223,11 +223,18 @@ static void find_nearest(uint64 value, int iteration) { + int i; + uint64 down, up; TRACE_MTRR("find_nearest %Lx %d\n", value, iteration); - if (iteration > (MTRR_MAX_SOLUTIONS - 1) || (iteration + 1) >= sSolutionCount) + if (iteration > (MTRR_MAX_SOLUTIONS - 1) || (iteration + 1) >= sSolutionCount) { + if (sSolutionCount > MTRR_MAX_SOLUTIONS) { + // no solutions yet, save something + for (i=0; i References: <46974256267-BeMail@primary> Message-ID: <20080608114714.787.2@stippis2.1212917071.fake> Michael Lotz wrote: > Hi Stephan > > > Ok! Thanks for doing that... I was just checking mails before going to > > bed, > > so feel free to dig in! From memory... I think the combined clipping is > > cached, so you might have to work around that. That's going to make it > > non-straight forward, in the sense that a decision might have to be > > made > > with regards to different "speed trade-offs". Maybe you can add a flag > > to > > View::ScreenClipping() to indicate whether or not this is supposed to > > contain the user clipping, and remember what is contained in the cached > > clipping and then force rebuilding, but only if there is any user > > clipping > > defined at all, so that there is no impact for "regular views". > > I've come up with r25854. It separates the local and user clipping and > combines and caches them when necessary. Views without user clipping will > get screen clipping right away. The user clipping and the combined > clipping are dynamically allocated now though, so you might want to > further optimize on that. Hope I understood the concepts correct ;-) It looks pretty good. I am only considering using a different name like fScreenDrawingRegion, but maybe your choice it more clear from a different perspective. The only other thing I am not sure about is that background drawing ignores the user clipping. I am 99% sure I tested that and on BeOS the background clearing honors the user clipping. Also have you tested the CopyBits() behavior on BeOS with regards to user clipping? Right now the user clipping would affect it, correct? It sounds odd that it would do that. Thanks a lot for all your work! Best regards, -Stephan From mmlr at mlotz.ch Sun Jun 8 13:07:36 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Sun, 08 Jun 2008 13:07:36 +0200 Subject: [Haiku-commits] r25853 - haiku/trunk/src/tests/kits/interface In-Reply-To: <20080608114714.787.2@stippis2.1212917071.fake> Message-ID: <3048770108-BeMail@primary> Hi Stephan > It looks pretty good. I am only considering using a different name > like > fScreenDrawingRegion, but maybe your choice it more clear from a > different > perspective. I have pretty much left the other variables and just added the user and combined screen + user there. I haven't actually thought about renaming the existing stuff. So if you feel they could be renamed please do so. > The only other thing I am not sure about is that background > drawing ignores the user clipping. I am 99% sure I tested that and on > BeOS > the background clearing honors the user clipping. When testing with the ClippingAndRedraw testapp under BeOS, once the clipping is set, the view background is still cleared to white (as default view color). If I set the view color to something else it is cleared to that other color, also when the update area is not within the user set clipping. You can easily check the behaviour with ClippingAndRedraw: Run the app, press space so clipping is set (to the red square area) and then click in the view twice so the floating window comes up and goes away again. The area behind the floating window will redraw with the current view color. If I constrain background clearing to the user clipping in the Haiku app_server ("src/ servers/app/View.cpp line 1249 using ScreenAndUserClipping() instead of _ScreenClipping()) and do the same test under Haiku, the floating window will stay visible (even though it is gone) because the background is not cleared to the view color. Also when moving something over the window or moving the window offscreen you will see the obvious tearing happening because of no background being applied. If the app_server clears to the background ignoring the user clipping (like it currenlty is) the test app behaves exactly as under R5 however. The same is true when employing a view bitmap BTW, just checked that. The only thing I noticed is that when a view bitmap is set, the current clipping region is apparently redrawn for some reason, while this is not the case for R5. After all that should not matter though because this is not something an application could rely on (as it could be exposed and redrawn at any time anyway). > Also have you tested the > CopyBits() behavior on BeOS with regards to user clipping? Right now > the > user clipping would affect it, correct? It sounds odd that it would > do > that. Thanks a lot for all your work! I haven't tested that yet at all. I assumed as it is a user initiated operation it would also honor the user set clipping, but I might not have fully understood what is supposed to happen with CopyBits(). Will investigate that and correct it to disregard user clipping if necessary. Regards Michael From mmlr at mlotz.ch Sun Jun 8 13:43:28 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Sun, 08 Jun 2008 13:43:28 +0200 Subject: [Haiku-commits] r25853 - haiku/trunk/src/tests/kits/interface In-Reply-To: <3048770108-BeMail@primary> Message-ID: <5200598145-BeMail@primary> Hi again > > Also have you tested the > > CopyBits() behavior on BeOS with regards to user clipping? Right > > now > > the > > user clipping would affect it, correct? It sounds odd that it would > > do > > that. Thanks a lot for all your work! > > I haven't tested that yet at all. I assumed as it is a user initiated > operation it would also honor the user set clipping, but I might not > have fully understood what is supposed to happen with CopyBits(). > Will > investigate that and correct it to disregard user clipping if > necessary. Replying to myself. I tested CopyBits() ander R5 now and it does indeed honor user clipping. So if I constrain the clipping region to BRect(0, 0, 40, 40) and then do a CopyBits() of that region to somewhere else in the view, nothing is drawn at that place. If I copy something from the outside into the clipping region the area nothing happens, so the user clipping does apply to both the source and destination. When I let it copy bits halfway overlapping the user clipping, one area (the one inside the clipping) is copied as expected and the rest (with a source outside the user clipping but a destination inside user clipping) is filled through a Draw() call as documented by the BeBook. I have verified that Haiku behaves exactly the same with all the above tests. So CopyBits() does respect the user clipping for both the source and destination rectangle and Haiku currently behaves like R5. Regards Michael From korli at mail.berlios.de Sun Jun 8 14:09:11 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 8 Jun 2008 14:09:11 +0200 Subject: [Haiku-commits] r25860 - haiku/trunk/src/apps/installer Message-ID: <200806081209.m58C9BT6025522@sheep.berlios.de> Author: korli Date: 2008-06-08 14:09:10 +0200 (Sun, 08 Jun 2008) New Revision: 25860 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25860&view=rev Modified: haiku/trunk/src/apps/installer/InstallerApp.cpp Log: * show EULA before the Installer window * this fixes #2332 Modified: haiku/trunk/src/apps/installer/InstallerApp.cpp =================================================================== --- haiku/trunk/src/apps/installer/InstallerApp.cpp 2008-06-08 01:11:29 UTC (rev 25859) +++ haiku/trunk/src/apps/installer/InstallerApp.cpp 2008-06-08 12:09:10 UTC (rev 25860) @@ -28,11 +28,7 @@ InstallerApp::InstallerApp() : BApplication(APP_SIG) { - BRect windowFrame(0, 0, INSTALLER_RIGHT, 160); BRect frame = BScreen().Frame(); - windowFrame.OffsetBy((frame.Width() - windowFrame.Width()) / 2, - frame.Height() / 2 - windowFrame.Height() / 4 - 113); - fWindow = new InstallerWindow(windowFrame); // show the EULA BAlert *alert = new BAlert("", EULA_TEXT, " Disagree ", " Agree ", NULL, @@ -51,8 +47,15 @@ alertFrame.OffsetTo((frame.Width() - alertFrame.Width()) / 2, (frame.Height() - alertFrame.Height()) / 2); alert->MoveTo(alertFrame.LeftTop()); - if (alert->Go() != 1) + if (alert->Go() != 1) { PostMessage(B_QUIT_REQUESTED); + return; + } + + BRect windowFrame(0, 0, INSTALLER_RIGHT, 160); + windowFrame.OffsetBy((frame.Width() - windowFrame.Width()) / 2, + frame.Height() / 2 - windowFrame.Height() / 4 - 113); + fWindow = new InstallerWindow(windowFrame); } void From mmlr at mail.berlios.de Sun Jun 8 15:19:34 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 8 Jun 2008 15:19:34 +0200 Subject: [Haiku-commits] r25861 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200806081319.m58DJYpW030747@sheep.berlios.de> Author: mmlr Date: 2008-06-08 15:19:33 +0200 (Sun, 08 Jun 2008) New Revision: 25861 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25861&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp Log: When canceling transfers, do not call the callbacks with the lock held. This prevents deadlocks in cases where a new transfer is scheduled from within the cancel callback. This is an edge case, as generally you don't want to schedule anything when explicitly canceling transfers, but there are a valid use cases when you cancel because of a timeout and then have to reset the device for example. Note that this hides bug #2353, where the cancel case is probably not handled correctly. Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2008-06-08 12:09:10 UTC (rev 25860) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2008-06-08 13:19:33 UTC (rev 25861) @@ -888,9 +888,15 @@ if (!Lock()) return B_ERROR; + struct transfer_entry { + Transfer * transfer; + transfer_entry * next; + }; + + transfer_entry *list = NULL; transfer_data *current = fFirstTransfer; while (current) { - if (current->transfer->TransferPipe() == pipe) { + if (current->transfer && current->transfer->TransferPipe() == pipe) { // clear the active bit so the descriptors are canceled ehci_qtd *descriptor = (ehci_qtd *)current->queue_head->element_log; while (descriptor) { @@ -902,7 +908,14 @@ // if the transfer is canceled by force, the one causing the // cancel is probably not the one who initiated the transfer // and the callback is likely not safe anymore - current->transfer->Finished(B_CANCELED, 0); + transfer_entry *entry + = (transfer_entry *)malloc(sizeof(transfer_entry)); + if (entry != NULL) { + entry->transfer = current->transfer; + current->transfer = NULL; + entry->next = list; + list = entry; + } } current->canceled = true; @@ -913,6 +926,14 @@ Unlock(); + while (list != NULL) { + transfer_entry *next = list->next; + list->transfer->Finished(B_CANCELED, 0); + delete list->transfer; + free(list); + list = next; + } + // notify the finisher so it can clean up the canceled transfers release_sem_etc(fFinishTransfersSem, 1, B_DO_NOT_RESCHEDULE); return B_OK; Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp 2008-06-08 12:09:10 UTC (rev 25860) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp 2008-06-08 13:19:33 UTC (rev 25861) @@ -426,9 +426,15 @@ if (!Lock()) return B_ERROR; + struct transfer_entry { + Transfer * transfer; + transfer_entry * next; + }; + + transfer_entry *list = NULL; transfer_data *current = fFirstTransfer; while (current) { - if (current->transfer->TransferPipe() == pipe) { + if (current->transfer && current->transfer->TransferPipe() == pipe) { // Check if the skip bit is already set if (!(current->endpoint->flags & OHCI_ENDPOINT_SKIP)) { current->endpoint->flags |= OHCI_ENDPOINT_SKIP; @@ -445,7 +451,14 @@ // If the transfer is canceled by force, the one causing the // cancel is probably not the one who initiated the transfer // and the callback is likely not safe anymore - current->transfer->Finished(B_CANCELED, 0); + transfer_entry *entry + = (transfer_entry *)malloc(sizeof(transfer_entry)); + if (entry != NULL) { + entry->transfer = current->transfer; + current->transfer = NULL; + entry->next = list; + list = entry; + } } current->canceled = true; } @@ -454,6 +467,14 @@ Unlock(); + while (list != NULL) { + transfer_entry *next = list->next; + list->transfer->Finished(B_CANCELED, 0); + delete list->transfer; + free(list); + list = next; + } + // notify the finisher so it can clean up the canceled transfers release_sem_etc(fFinishTransfersSem, 1, B_DO_NOT_RESCHEDULE); return B_OK; Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2008-06-08 12:09:10 UTC (rev 25860) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2008-06-08 13:19:33 UTC (rev 25861) @@ -614,9 +614,15 @@ if (!Lock()) return B_ERROR; + struct transfer_entry { + Transfer * transfer; + transfer_entry * next; + }; + + transfer_entry *list = NULL; transfer_data *current = fFirstTransfer; while (current) { - if (current->transfer->TransferPipe() == pipe) { + if (current->transfer && current->transfer->TransferPipe() == pipe) { // clear the active bit so the descriptors are canceled uhci_td *descriptor = current->first_descriptor; while (descriptor) { @@ -628,7 +634,14 @@ // if the transfer is canceled by force, the one causing the // cancel is probably not the one who initiated the transfer // and the callback is likely not safe anymore - current->transfer->Finished(B_CANCELED, 0); + transfer_entry *entry + = (transfer_entry *)malloc(sizeof(transfer_entry)); + if (entry != NULL) { + entry->transfer = current->transfer; + current->transfer = NULL; + entry->next = list; + list = entry; + } } current->canceled = true; @@ -638,6 +651,14 @@ Unlock(); + while (list != NULL) { + transfer_entry *next = list->next; + list->transfer->Finished(B_CANCELED, 0); + delete list->transfer; + free(list); + list = next; + } + // notify the finisher so it can clean up the canceled transfers release_sem_etc(fFinishTransfersSem, 1, B_DO_NOT_RESCHEDULE); return B_OK; From mmlr at mail.berlios.de Sun Jun 8 16:09:52 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 8 Jun 2008 16:09:52 +0200 Subject: [Haiku-commits] r25862 - haiku/trunk/src/system/kernel/device_manager Message-ID: <200806081409.m58E9qYi005330@sheep.berlios.de> Author: mmlr Date: 2008-06-08 16:09:51 +0200 (Sun, 08 Jun 2008) New Revision: 25862 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25862&view=rev Modified: haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp Log: Update the driver path and set binary_updated when we encounter a driver with the same name but different path. In case of usb_disk that is now loaded as a boot module the driver got registered with a different path, which prevented later rescans from working. USB mass storage should now work again. Modified: haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp 2008-06-08 13:19:33 UTC (rev 25861) +++ haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp 2008-06-08 14:09:51 UTC (rev 25862) @@ -581,6 +581,17 @@ get_leaf(path)); if (driver != NULL) { // we know this driver + if (strcmp(driver->path, path) != 0) { + // TODO: do properly, but for now we just update the path if it + // isn't the same anymore so rescanning of drivers will work in + // case this driver was loaded so early that it has a boot module + // path and not a proper driver path + free((char *)driver->path); + driver->path = strdup(path); + driver->name = get_leaf(driver->path); + driver->binary_updated = true; + } + // TODO: check if this driver is a different one and has precendence // (ie. common supersedes system). //dprintf("new driver has priority %ld, old %ld\n", priority, driver->priority); From mmlr at mail.berlios.de Sun Jun 8 16:27:01 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 8 Jun 2008 16:27:01 +0200 Subject: [Haiku-commits] r25863 - haiku/trunk/src/add-ons/kernel/bus_managers/usb Message-ID: <200806081427.m58ER1Sv007431@sheep.berlios.de> Author: mmlr Date: 2008-06-08 16:27:00 +0200 (Sun, 08 Jun 2008) New Revision: 25863 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25863&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/Pipe.cpp Log: Lock the control pipe mutex before destroying it to ensure that a possibly still open transfer has enough time to cleanly exit with error. Fixes a crash when removing a device while a control transfer on the device endpoint was open and would have timed out otherwise. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/Pipe.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/Pipe.cpp 2008-06-08 14:09:51 UTC (rev 25862) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/Pipe.cpp 2008-06-08 14:27:00 UTC (rev 25863) @@ -301,6 +301,7 @@ { if (fNotifySem >= 0) delete_sem(fNotifySem); + mutex_lock(&fSendRequestLock); mutex_destroy(&fSendRequestLock); } From modeenf at mail.berlios.de Sun Jun 8 17:42:35 2008 From: modeenf at mail.berlios.de (modeenf at mail.berlios.de) Date: Sun, 8 Jun 2008 17:42:35 +0200 Subject: [Haiku-commits] r25864 - haiku/trunk/src/kits/device Message-ID: <200806081542.m58FgZqO017984@sheep.berlios.de> Author: modeenf Date: 2008-06-08 17:42:29 +0200 (Sun, 08 Jun 2008) New Revision: 25864 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25864&view=rev Modified: haiku/trunk/src/kits/device/Jamfile haiku/trunk/src/kits/device/Joystick.cpp Log: Added some part from BSerialPort and some missing things R5 Joystick Pref app reports as missing, with this R5 Joystick Pref App starts in Haiku Modified: haiku/trunk/src/kits/device/Jamfile =================================================================== --- haiku/trunk/src/kits/device/Jamfile 2008-06-08 14:27:00 UTC (rev 25863) +++ haiku/trunk/src/kits/device/Jamfile 2008-06-08 15:42:29 UTC (rev 25864) @@ -1,5 +1,7 @@ SubDir HAIKU_TOP src kits device ; +SetSubDirSupportedPlatformsBeOSCompatible ; + # for usb_raw.h that defines the ioctl protocol used by the USB classes UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel drivers bus usb ] : true ; Modified: haiku/trunk/src/kits/device/Joystick.cpp =================================================================== --- haiku/trunk/src/kits/device/Joystick.cpp 2008-06-08 14:27:00 UTC (rev 25863) +++ haiku/trunk/src/kits/device/Joystick.cpp 2008-06-08 15:42:29 UTC (rev 25864) @@ -1,24 +1,104 @@ -/* - * Copyright 2002, Marcus Overhagen. All rights reserved. +/* + * Copyright 2002-2008, Marcus Overhagen, Stefano Ceccherini, Fredrik Mod?en. + * All rights reserved. * Distributed under the terms of the MIT License. */ #include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define DEVICEPATH "/dev/joystick/" + +typedef struct _joystick_info { + char module_name[64]; + char device_name[64]; + int16 num_axes; + int16 num_buttons; + int16 num_hats; + uint16 num_sticks; +} joystick_info; + +//Scans a directory and adds the entries it founds as strings to the given list +static status_t +scan_directory(const char* rootPath, BList *list, BEntry *rootEntry = NULL) +{ + BDirectory root; + + if (rootEntry != NULL) + root.SetTo( rootEntry); + else if (rootPath != NULL) + root.SetTo(rootPath); + else + return B_ERROR; + + BEntry entry; + + ASSERT(list != NULL); + while ((root.GetNextEntry(&entry)) > B_ERROR ) { + if (entry.IsDirectory()) { + scan_directory(rootPath, list, &entry); + } else { + BPath path; + entry.GetPath(&path); + BString str(path.Path()); + str.RemoveFirst(rootPath); + list->AddItem(strdup(str.String())); + } + } + return B_OK; +} + +class _BJoystickTweaker { + +public: + _BJoystickTweaker(); + _BJoystickTweaker(BJoystick &stick); +virtual ~_BJoystickTweaker(); + +protected: +private: + status_t scan_including_disabled(); + status_t save_config(const entry_ref * ref = NULL); + status_t get_info(); + BJoystick* fJoystick; +}; +//-------------------------------------------------------------------// + + BJoystick::BJoystick() + : _mBeBoxMode(false) + , _fDevices(new BList) { + ScanDevices(); } BJoystick::~BJoystick() { + if (ffd >= 0) + close(ffd); + + for (int32 count = _fDevices->CountItems() - 1; count >= 0; count--) + free(_fDevices->RemoveItem(count)); + + delete _fDevices; } status_t BJoystick::Open(const char *portName) { - return B_ERROR; + return Open(portName, true); } @@ -26,41 +106,107 @@ BJoystick::Open(const char *portName, bool enter_enhanced) { - return B_ERROR; + char buf[64]; + + //We don't want to use enhanced mode but _mBeBoxMode sugest if we use + //BeBoxMode + if(!enter_enhanced) + _mBeBoxMode = !enter_enhanced; + + if (portName == NULL) + return B_BAD_VALUE; // Heheee, we won't crash + + if (portName[0] != '/') + snprintf(buf, 64, DEVICEPATH"/%s", portName); + else + // A name like "/dev/joystick/usb/0" was passed + snprintf(buf, 64, "%s", portName); + + if (ffd >= 0) //If this port is already open, close it + close(ffd); + + // TODO: BeOS don't use O_EXCL, and this seems to lead to some issues. I + // added this flag having read some comments by Marco Nelissen on the + // annotated BeBook. I think BeOS uses O_RDWR|O_NONBLOCK here. + ffd = open(buf, O_RDWR | O_NONBLOCK | O_EXCL); + + if (ffd >= 0) { + // we used open() with O_NONBLOCK flag to let it return immediately, + // but we want read/write operations to block if needed, so we clear + // that bit here. + int flags = fcntl(ffd, F_GETFL); + fcntl(ffd, F_SETFL, flags & ~O_NONBLOCK); + + //DriverControl(); + } + // TODO: I wonder why the return type is a status_t, + // since we (as BeOS does) return the descriptor number for the device... + return (ffd >= 0) ? ffd : errno; } void BJoystick::Close(void) { + if (ffd >= 0) + close(ffd); + ffd = -1; } -status_t -BJoystick::Update(void) +void +BJoystick::ScanDevices(bool use_disabled = false) { - return B_ERROR; + // First, we empty the list + for (int32 count = _fDevices->CountItems() - 1; count >= 0; count--) + free(_fDevices->RemoveItem(count)); + + // Add devices to the list + scan_directory(DEVICEPATH, _fDevices); } +int32 +BJoystick::CountDevices() +{ + int32 count = 0; + + // Refresh devices list + ScanDevices(); + + if (_fDevices != NULL) + count = _fDevices->CountItems(); + + return count; +} + + status_t -BJoystick::SetMaxLatency(bigtime_t max_latency) +BJoystick::GetDeviceName(int32 n, char *name, size_t bufSize) { - return B_ERROR; + status_t result = B_ERROR; + const char *dev = NULL; + if (_fDevices != NULL) + dev = static_cast(_fDevices->ItemAt(n)); + + if (dev != NULL && name != NULL) { + strncpy(name, dev, bufSize); + name[bufSize - 1] = '\0'; + result = B_OK; + } + return result; } -int32 -BJoystick::CountDevices() +status_t +BJoystick::Update(void) { - return 0; + return B_ERROR; } status_t -BJoystick::GetDeviceName(int32 n, - char *name, - size_t bufSize) +BJoystick::SetMaxLatency(bigtime_t max_latency) { return B_ERROR; } @@ -69,7 +215,8 @@ bool BJoystick::EnterEnhancedMode(const entry_ref *ref) { - return false; + _mBeBoxMode = false; + return !_mBeBoxMode; } @@ -196,42 +343,50 @@ } -void -BJoystick::_ReservedJoystick1() +/* These functions are here to maintain Binary Compatibility */ +void BJoystick::_ReservedJoystick1() {} +void BJoystick::_ReservedJoystick2() {} +void BJoystick::_ReservedJoystick3() {} +status_t BJoystick::_Reserved_Joystick_4(void *, ...) {return B_ERROR;} +status_t BJoystick::_Reserved_Joystick_5(void *, ...) {return B_ERROR;} +status_t BJoystick::_Reserved_Joystick_6(void *, ...) {return B_ERROR;} + + +//-------------------------------------------------------------------// + + +_BJoystickTweaker::_BJoystickTweaker() { } -void -BJoystick::_ReservedJoystick2() +_BJoystickTweaker::_BJoystickTweaker(BJoystick &stick) { + fJoystick = &stick; } -void -BJoystick::_ReservedJoystick3() +_BJoystickTweaker::~_BJoystickTweaker() { } status_t -BJoystick::_Reserved_Joystick_4(void *, ...) +_BJoystickTweaker::save_config(const entry_ref *ref) { return B_ERROR; } status_t -BJoystick::_Reserved_Joystick_5(void *, ...) +_BJoystickTweaker::scan_including_disabled() { return B_ERROR; } status_t -BJoystick::_Reserved_Joystick_6(void *, ...) +_BJoystickTweaker::get_info() { return B_ERROR; } - - From axeld at pinc-software.de Sun Jun 8 17:57:04 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sun, 08 Jun 2008 17:57:04 +0200 CEST Subject: [Haiku-commits] r25864 - haiku/trunk/src/kits/device In-Reply-To: <200806081542.m58FgZqO017984@sheep.berlios.de> Message-ID: <24417613264-BeMail@zon> Some style issues: modeenf at mail.berlios.de wrote: > +//Scans a directory and adds the entries it founds as strings to the > given list There is always a spacing between "//" and the text. Since this is a function description, it should further be a doxygen comment, ie.: //! Scans a directory and adds the entries it founds as strings to the given list. > +static status_t > +scan_directory(const char* rootPath, BList *list, BEntry *rootEntry > = NULL) > +{ [...] > + while ((root.GetNextEntry(&entry)) > B_ERROR ) { Please don't use extensive parenthesis without reason, and also, there is a superfluous space before the last closing parenthesis. > + if (entry.IsDirectory()) { > + scan_directory(rootPath, list, &entry); > + } else { > + BPath path; > + entry.GetPath(&path); > + BString str(path.Path()); > + str.RemoveFirst(rootPath); > + list->AddItem(strdup(str.String())); Things can always fail, and OS code shouldn't be vulnerable to any of these problems. So if NULL items in the list are problematic, please correct. > +class _BJoystickTweaker { > + > +public: No blank line here. Why the underscore? If it's a private class, it probably also shouldn't have the B prefix, and be in some BPrivate namespace. > +protected: > +private: > + status_t scan_including_disabled(); > + status_t save_config(const entry_ref * ref = NULL); > + status_t get_info(); Method names are UpperCaseCompounds(). > BJoystick::BJoystick() > + : _mBeBoxMode(false) > + , _fDevices(new BList) We don't use this style, but have the comma always at the end of a line, never at the start of it. If you come across code that uses this style, feel free to correct it, but please don't introduce new code with it. BTW members start with 'f', not _m or _f - if those are private in the header they should be corrected. Bye, Axel. From umccullough at gmail.com Sun Jun 8 18:18:24 2008 From: umccullough at gmail.com (Urias McCullough) Date: Sun, 8 Jun 2008 09:18:24 -0700 Subject: [Haiku-commits] r25864 - haiku/trunk/src/kits/device In-Reply-To: <200806081542.m58FgZqO017984@sheep.berlios.de> References: <200806081542.m58FgZqO017984@sheep.berlios.de> Message-ID: <1e80d8750806080918x7a20a05vb323dddcd35dc2ee@mail.gmail.com> 2008/6/8 : > Author: modeenf > Date: 2008-06-08 17:42:29 +0200 (Sun, 08 Jun 2008) > New Revision: 25864 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25864&view=rev > > Modified: > haiku/trunk/src/kits/device/Jamfile > haiku/trunk/src/kits/device/Joystick.cpp > Log: > Added some part from BSerialPort and some missing things R5 Joystick Pref app reports as missing, with this R5 Joystick Pref App starts in Haiku Does not build under gcc4 now: C++ generated/objects/haiku/x86/release/kits/device/Joystick.o src/kits/device/Joystick.cpp:158: error: default argument given for parameter 1 of 'void BJoystick::ScanDevices(bool)' headers/os/device/Joystick.h:96: error: after previous specification in 'void BJoystick::ScanDevices(bool)' /home/umccullough/haiku/haiku/trunk-gcc4/generated/cross-tools/bin/i586-pc-haiku-gcc -c "src/kits/device/Joystick.cpp" -O -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare -fno-strict-aliasing -fno-tree-vrp -nostdinc -Wno-multichar -Wno-deprecated -D_ZETA_USING_DEPRECATED_API_=1 -D_ZETA_TS_FIND_DIR_=1 -D__HAIKU__ -DHAIKU_DISTRO_COMPATIBILITY_DEFAULT -D__INTEL__ -DARCH_x86 -DHAIKU_TARGET_PLATFORM_HAIKU -iquote build/user_config_headers -iquote build/config_headers -iquote src/kits/device -iquote generated/objects/common/kits/device -iquote generated/objects/linux/x86/common/kits/device -iquote generated/objects/haiku/x86/common/kits/device -I src/add-ons/kernel/drivers/bus/usb -I /home/umccullough/haiku/haiku/trunk-gcc4/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/include -I headers -I headers/posix -I headers/gnu -I headers/glibc -I headers/os -I headers/os/add-ons -I headers/os/add-ons/file_system -I headers/os/add-ons/graphics -I headers/os/add-ons/input_server -I headers/os/add-ons/registrar -I headers/os/add-ons/screen_saver -I headers/os/add-ons/tracker -I headers/os/app -I headers/os/device -I headers/os/drivers -I headers/os/game -I headers/os/interface -I headers/os/kernel -I headers/os/media -I headers/os/mail -I headers/os/midi -I headers/os/midi2 -I headers/os/net -I headers/os/opengl -I headers/os/storage -I headers/os/support -I headers/os/translation -I headers/private/. -I /home/umccullough/haiku/haiku/trunk-gcc4/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2 -I /home/umccullough/haiku/haiku/trunk-gcc4/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2/i586-pc-haiku -I /home/umccullough/haiku/haiku/trunk-gcc4/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2/backward -I /home/umccullough/haiku/haiku/trunk-gcc4/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2/ext -o "generated/objects/haiku/x86/release/kits/device/Joystick.o" ; ...failed C++ generated/objects/haiku/x86/release/kits/device/Joystick.o ... From umccullough at gmail.com Sun Jun 8 18:27:28 2008 From: umccullough at gmail.com (Urias McCullough) Date: Sun, 8 Jun 2008 09:27:28 -0700 Subject: [Haiku-commits] r25864 - haiku/trunk/src/kits/device In-Reply-To: <200806081542.m58FgZqO017984@sheep.berlios.de> References: <200806081542.m58FgZqO017984@sheep.berlios.de> Message-ID: <1e80d8750806080927u25600fb2i5314b547e4d5c80@mail.gmail.com> 2008/6/8 : > Author: modeenf > Date: 2008-06-08 17:42:29 +0200 (Sun, 08 Jun 2008) > New Revision: 25864 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25864&view=rev > > Modified: > haiku/trunk/src/kits/device/Jamfile > haiku/trunk/src/kits/device/Joystick.cpp > Log: > Added some part from BSerialPort and some missing things R5 Joystick Pref app reports as missing, with this R5 Joystick Pref App starts in Haiku Does not build under gcc4 now: C++ generated/objects/haiku/x86/release/kits/device/Joystick.o src/kits/device/Joystick.cpp:158: error: default argument given for parameter 1 of 'void BJoystick::ScanDevices(bool)' headers/os/device/Joystick.h:96: error: after previous specification in 'void BJoystick::ScanDevices(bool)' /home/umccullough/haiku/haiku/trunk-gcc4/generated/cross-tools/bin/i586-pc-haiku-gcc -c "src/kits/device/Joystick.cpp" -O -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare -fno-strict-aliasing -fno-tree-vrp -nostdinc -Wno-multichar -Wno-deprecated -D_ZETA_USING_DEPRECATED_API_=1 -D_ZETA_TS_FIND_DIR_=1 -D__HAIKU__ -DHAIKU_DISTRO_COMPATIBILITY_DEFAULT -D__INTEL__ -DARCH_x86 -DHAIKU_TARGET_PLATFORM_HAIKU -iquote build/user_config_headers -iquote build/config_headers -iquote src/kits/device -iquote generated/objects/common/kits/device -iquote generated/objects/linux/x86/common/kits/device -iquote generated/objects/haiku/x86/common/kits/device -I src/add-ons/kernel/drivers/bus/usb -I /home/umccullough/haiku/haiku/trunk-gcc4/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/include -I headers -I headers/posix -I headers/gnu -I headers/glibc -I headers/os -I headers/os/add-ons -I headers/os/add-ons/file_system -I headers/os/add-ons/graphics -I headers/os/add-ons/input_server -I headers/os/add-ons/registrar -I headers/os/add-ons/screen_saver -I headers/os/add-ons/tracker -I headers/os/app -I headers/os/device -I headers/os/drivers -I headers/os/game -I headers/os/interface -I headers/os/kernel -I headers/os/media -I headers/os/mail -I headers/os/midi -I headers/os/midi2 -I headers/os/net -I headers/os/opengl -I headers/os/storage -I headers/os/support -I headers/os/translation -I headers/private/. -I /home/umccullough/haiku/haiku/trunk-gcc4/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2 -I /home/umccullough/haiku/haiku/trunk-gcc4/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2/i586-pc-haiku -I /home/umccullough/haiku/haiku/trunk-gcc4/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2/backward -I /home/umccullough/haiku/haiku/trunk-gcc4/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2/ext -o "generated/objects/haiku/x86/release/kits/device/Joystick.o" ; ...failed C++ generated/objects/haiku/x86/release/kits/device/Joystick.o ... From modeenf at mail.berlios.de Sun Jun 8 18:31:08 2008 From: modeenf at mail.berlios.de (modeenf at mail.berlios.de) Date: Sun, 8 Jun 2008 18:31:08 +0200 Subject: [Haiku-commits] r25865 - haiku/trunk/src/preferences/joysticks Message-ID: <200806081631.m58GV8us025525@sheep.berlios.de> Author: modeenf Date: 2008-06-08 18:30:58 +0200 (Sun, 08 Jun 2008) New Revision: 25865 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25865&view=rev Added: haiku/trunk/src/preferences/joysticks/PortItem.cpp haiku/trunk/src/preferences/joysticks/PortItem.h Modified: haiku/trunk/src/preferences/joysticks/Global.h haiku/trunk/src/preferences/joysticks/Jamfile haiku/trunk/src/preferences/joysticks/JoyWin.cpp haiku/trunk/src/preferences/joysticks/JoyWin.h haiku/trunk/src/preferences/joysticks/Joysticks.cpp haiku/trunk/src/preferences/joysticks/Joysticks.h Log: Work in progress, now the Joystick pref should show the right text and error (that I can reproduce without joystick) Modified: haiku/trunk/src/preferences/joysticks/Global.h =================================================================== --- haiku/trunk/src/preferences/joysticks/Global.h 2008-06-08 15:42:29 UTC (rev 25864) +++ haiku/trunk/src/preferences/joysticks/Global.h 2008-06-08 16:30:58 UTC (rev 25865) @@ -17,6 +17,11 @@ #define PORT_INVOKE 'PInV' #define JOY_INVOKE 'jInV' +#define DISABLEPORT 'pdis' +#define PROBE 'prob' +#define CALIBRATE 'cali' +#define SELECTED 'sele' + #endif /* _GLOBAL_H */ Modified: haiku/trunk/src/preferences/joysticks/Jamfile =================================================================== --- haiku/trunk/src/preferences/joysticks/Jamfile 2008-06-08 15:42:29 UTC (rev 25864) +++ haiku/trunk/src/preferences/joysticks/Jamfile 2008-06-08 16:30:58 UTC (rev 25865) @@ -1,12 +1,14 @@ SubDir HAIKU_TOP src preferences joysticks ; SetSubDirSupportedPlatformsBeOSCompatible ; +AddSubDirSupportedPlatforms libbe_test ; Preference Joysticks : CalibWin.cpp JoyWin.cpp Joysticks.cpp MessageWin.cpp + PortItem.cpp : be device : Joysticks.rdef ; Modified: haiku/trunk/src/preferences/joysticks/JoyWin.cpp =================================================================== --- haiku/trunk/src/preferences/joysticks/JoyWin.cpp 2008-06-08 15:42:29 UTC (rev 25864) +++ haiku/trunk/src/preferences/joysticks/JoyWin.cpp 2008-06-08 16:30:58 UTC (rev 25865) @@ -1,222 +1,625 @@ /* - * Copyright 2007 Haiku. + * Copyright 2007-2008 Haiku. * Distributed under the terms of the MIT License. * * Authors: - * Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com - * Ryan Leavengood, leavengood at gmail.com + * Oliver Ruiz Dorantes oliver.ruiz.dorantes_at_gmail.com + * Ryan Leavengood leavengood at gmail.com + * Fredrik Mod?en fredrik at modeen.se */ - #include "JoyWin.h" -#include "MessagedItem.h" #include "MessageWin.h" #include "CalibWin.h" #include "Global.h" +#include "PortItem.h" +//#include "FileReadWrite.h" +#include +#include + #include #include #include #include +#include #include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define JOYSTICKPATH "/dev/joystick/" +#define JOYSTICKFILEPATH "/boot/beos/etc/joysticks/" +#define JOYSTICKFILESETTINGS "/boot/home/config/settings/joysticks/" +#define SELECTGAMEPORTFIRST "Select a game port first" -JoyWin::JoyWin(BRect frame, const char *title, window_look look, - window_feel feel, uint32 flags, uint32 workspace = B_CURRENT_WORKSPACE) - : BWindow(frame, title, look, feel, flags, workspace) +static int +ShowMessage(char* string) { - fProbeButton = new BButton(BRect(15.00, 260.00, 115.00, 285.00), "ProbeButton", "Probe", NULL); - fCalibrateButton = new BButton(BRect(270.00, 260.00, 370.00, 285.00), "CalibrateButton", "Calibrate", NULL); + BAlert *alert = new BAlert("Message", string, "OK"); + alert->SetShortcut(1, B_ESCAPE); + return alert->Go(); +} - fGamePortL = new BListView(BRect(15.00, 30.00, 145.00, 250.00), "gamePort"); +JoyWin::JoyWin(BRect frame, const char *title) + : BWindow(frame, title, B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, + B_NOT_ZOOMABLE), fSystemUsedSelect(false), + fJoystick(new BJoystick) +{ + fProbeButton = new BButton(BRect(15.00, 260.00, 115.00, 285.00), + "ProbeButton", "Probe", new BMessage(PROBE)); + + fCalibrateButton = new BButton(BRect(270.00, 260.00, 370.00, 285.00), + "CalibrateButton", "Calibrate", new BMessage(CALIBRATE)); + + fGamePortL = new BListView(BRect(15.00, 30.00, 145.00, 250.00), + "gamePort"); fGamePortL->SetSelectionMessage(new BMessage(PORT_SELECTED)); fGamePortL->SetInvocationMessage(new BMessage(PORT_INVOKE)); - fConControllerL = new BListView(BRect(175.00,30.00,370.00,250.00),"conController"); + fConControllerL = new BListView(BRect(175.00,30.00,370.00,250.00), + "conController"); fConControllerL->SetSelectionMessage(new BMessage(JOY_SELECTED)); fConControllerL->SetInvocationMessage(new BMessage(JOY_INVOKE)); - fGamePortS = new BStringView(BRect(15, 5, 160, 25), "gpString", "Game Port"); + fGamePortS = new BStringView(BRect(15, 5, 160, 25), "gpString", + "Game Port"); fGamePortS->SetFont(be_bold_font); - fConControllerS = new BStringView(BRect(170, 5, 330, 25), "ccString", "Connected Controller"); + fConControllerS = new BStringView(BRect(170, 5, 330, 25), "ccString", + "Connected Controller"); + fConControllerS->SetFont(be_bold_font); - fCheckbox = new BCheckBox(BRect(131.00, 260.00, 227.00, 280.00), "Disabled", "Disabled", NULL); - fBox = new BBox( Bounds(),"box", B_FOLLOW_ALL, + fCheckbox = new BCheckBox(BRect(131.00, 260.00, 227.00, 280.00), + "Disabled", "Disabled", new BMessage(DISABLEPORT)); + BBox *box = new BBox( Bounds(),"box", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE, B_PLAIN_BORDER); - fBox->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + + box->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - // Adding object - fBox->AddChild(fCheckbox); - - fBox->AddChild(fGamePortS); - fBox->AddChild(fConControllerS); - // Add listViews with their scrolls - fBox->AddChild(new BScrollView("PortScroll", fGamePortL, + box->AddChild(new BScrollView("PortScroll", fGamePortL, B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW, false, true)); - fBox->AddChild(new BScrollView("ConScroll", fConControllerL, - B_FOLLOW_ALL, B_WILL_DRAW, false, true)); + + box->AddChild(new BScrollView("ConScroll", fConControllerL, B_FOLLOW_ALL, + B_WILL_DRAW, false, true)); - fBox->AddChild(fProbeButton); - fBox->AddChild(fCalibrateButton); - - AddChild(fBox); - - // This resizable feature is not in R5 but. - // making horizontal resizing allows - // long joysticks names to be seen completelly + // Adding object + box->AddChild(fCheckbox); + box->AddChild(fGamePortS); + box->AddChild(fConControllerS); + box->AddChild(fProbeButton); + box->AddChild(fCalibrateButton); + AddChild(box); + SetSizeLimits(400, 600, Bounds().Height(), Bounds().Height()); - /* Add all the devices */ - AddDevices(); - + /* Add all the devices */ + int32 nr = fJoystick->CountDevices(); + for (int32 i = 0; i < nr;i++) { + //BString str(path.Path()); + char buf[B_OS_NAME_LENGTH]; + fJoystick->GetDeviceName(i, buf, B_OS_NAME_LENGTH); + fGamePortL->AddItem(new PortItem(buf)); + } + fGamePortL->Select(0); + /* Add the joysticks specifications */ - AddJoysticks(); + _AddToList(fConControllerL, JOY_SELECTED, JOYSTICKFILEPATH); + + _GetSettings(); } -void JoyWin::MessageReceived(BMessage *message) +JoyWin::~JoyWin() { + //delete fFileTempProbeJoystick; + be_app_messenger.SendMessage(B_QUIT_REQUESTED); +} + + +void +JoyWin::MessageReceived(BMessage *message) +{ +// message->PrintToStream(); switch(message->what) - { + { + case DISABLEPORT: + break; + { + PortItem *item = _GetSelectedItem(fGamePortL); + if (item != NULL) { + //ToDo: item->SetEnabled(true); + //don't work as you can't select a item that are disabled + if(fCheckbox->Value()) { + item->SetEnabled(false); + _SelectDeselectJoystick(fConControllerL, false); + } else { + item->SetEnabled(true); + _SelectDeselectJoystick(fConControllerL, true); + _PerformProbe(item->Text()); + } + } //else + //printf("We have a null value\n"); + break; + } + case PORT_SELECTED: + { + PortItem *item = _GetSelectedItem(fGamePortL); + if (item != NULL) { + fSystemUsedSelect = true; + if (item->IsEnabled()) { + //printf("SetEnabled = false\n"); + fCheckbox->SetValue(false); + _SelectDeselectJoystick(fConControllerL, true); + } else { + //printf("SetEnabled = true\n"); + fCheckbox->SetValue(true); + _SelectDeselectJoystick(fConControllerL, false); + } + + if (_CheckJoystickExist(item->Text()) == B_ERROR) { + if (_ShowCantFindFileMessage(item->Text()) == B_OK) { + _PerformProbe(item->Text()); + } + } else { + BString str(_FindFilePathForSymLink(JOYSTICKFILESETTINGS, + item)); + if (str != NULL) { + BString str(_FixPathToName(str.String())); + int32 id = _FindStringItemInList(fConControllerL, + new PortItem(str.String())); + if (id > -1) { + fConControllerL->Select(id); + item->SetJoystickName(BString(str.String())); + } + } + } + } else { + fConControllerL->DeselectAll(); + ShowMessage(SELECTGAMEPORTFIRST); + } + break; + } + + case PROBE: + case PORT_INVOKE: + { + PortItem *item = _GetSelectedItem(fGamePortL); + if (item != NULL) { + //printf("invoke.. inte null\n"); + _PerformProbe(item->Text()); + } else + ShowMessage(SELECTGAMEPORTFIRST); + break; + } + + case JOY_SELECTED: + { + if (!fSystemUsedSelect) { + PortItem *controllerName = _GetSelectedItem(fConControllerL); + PortItem *portname = _GetSelectedItem(fGamePortL); + if (portname != NULL && controllerName != NULL) { + portname->SetJoystickName(BString(controllerName->Text())); + + BString str = portname->GetOldJoystickName(); + if (str != NULL) { + BString strOldFile(JOYSTICKFILESETTINGS); + strOldFile.Append(portname->Text()); + BEntry entry(strOldFile.String()); + entry.Remove(); + } + BString strLinkPlace(JOYSTICKFILESETTINGS); + strLinkPlace.Append(portname->Text()); + + BString strLinkTo(JOYSTICKFILEPATH); + strLinkTo.Append(controllerName->Text()); + + BDirectory *dir = new BDirectory(); + dir->CreateSymLink(strLinkPlace.String(), + strLinkTo.String(), NULL); + } else + ShowMessage(SELECTGAMEPORTFIRST); + } + + fSystemUsedSelect = false; + break; + } + + case CALIBRATE: + case JOY_INVOKE: + { + PortItem *controllerName = _GetSelectedItem(fConControllerL); + PortItem *portname = _GetSelectedItem(fGamePortL); + if (portname != NULL) { + if (controllerName == NULL) + _ShowNoDeviceConnectedMessage("known", portname->Text()); + else { + _ShowNoDeviceConnectedMessage(controllerName->Text(), portname->Text()); + /* + ToDo: + Check for a device, and show calibrate window if so + */ + } + } else + ShowMessage(SELECTGAMEPORTFIRST); + break; + } + default: + BWindow::MessageReceived(message); break; + } +} - case PORT_INVOKE: - // Do we have any port? - // And some joysticks ? +bool +JoyWin::QuitRequested() +{ + _ApplyChanges(); + return BWindow::QuitRequested(); +} - // Probe! - PerformProbe(); - break; +//---------------------- Private ---------------------------------// +status_t +JoyWin::_AddToList(BListView *list, uint32 command, + const char* rootPath, BEntry *rootEntry = NULL) +{ + BDirectory root; - case JOY_SELECTED: - break; + if ( rootEntry != NULL ) + root.SetTo( rootEntry ); + else if ( rootPath != NULL ) + root.SetTo( rootPath ); + else + return B_ERROR; + + BEntry entry; + while ((root.GetNextEntry(&entry)) > B_ERROR ) { + if (entry.IsDirectory()) { + _AddToList(list, command, rootPath, &entry); + } else { + BPath path; + entry.GetPath(&path); + BString str(path.Path()); + str.RemoveFirst(rootPath); + list->AddItem(new PortItem(str.String())); + } + } + return B_OK; +} - case JOY_INVOKE: - // Do we have a selected definition? +status_t +JoyWin::_Calibrate() +{ + CalibWin* calibw; + BRect rect(100, 100, 500, 400); + calibw = new CalibWin(rect, "Calibrate", B_DOCUMENT_WINDOW_LOOK, + B_NORMAL_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_ZOOMABLE); + calibw->Show(); + return B_OK; +} - // And a suitale selected port? - // Calibrate it! - Calibrate(); +status_t +JoyWin::_PerformProbe(const char* path) +{ + status_t err = B_ERROR; + err = _ShowProbeMesage(path); + if (err != B_OK) { + return err; + } + + MessageWin* mesgw = new MessageWin(Frame(),"Probing", B_MODAL_WINDOW_LOOK, + B_MODAL_APP_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_ZOOMABLE); + + mesgw->Show(); + int32 number = fConControllerL->CountItems(); + PortItem *item; + for (int i = 0; i < number; i++) { + // Do a search in JOYSTICKFILEPATH with item->Text() find the string + // that starts with "gadget" (tex gadget = "GamePad Pro") remove + // spacing and the "=" ty to open this one, if failed move to next and + // try to open.. list those that suxesfully work + fConControllerL->Select(i); + int32 selected = fConControllerL->CurrentSelection(); + item = dynamic_cast(fConControllerL->ItemAt(selected)); + BString str("Looking for: "); + str << item->Text() << " in port " << path; + mesgw->SetText(str.String()); + _FindSettingString(item->Text(), JOYSTICKFILEPATH); + //Need a check to find joysticks (don't know how right now so show a + // don't find message) + } + mesgw->Hide(); + + //Need a if !found then show this message. else list joysticks. + _ShowNoCompatibleJoystickMessage(); + return B_OK; +} - break; - default: - BWindow::MessageReceived(message); - break; - } +status_t +JoyWin::_ApplyChanges() +{ + BString str = _BuildDisabledJoysticksFile(); + //ToDo; Save the string as the file "disabled_joysticks" under settings + // (/boot/home/config/settings/disabled_joysticks) + return B_OK; } -bool JoyWin::QuitRequested() +status_t +JoyWin::_GetSettings() { - // Apply changes and save configurations etc etc + // ToDo; Read the file "disabled_joysticks" and make the port with the + // same name disabled (/boot/home/config/settings/disabled_joysticks) + return B_OK; +} - be_app->PostMessage(B_QUIT_REQUESTED); - return BWindow::QuitRequested(); +status_t +JoyWin::_CheckJoystickExist(const char* path) +{ + BString str(JOYSTICKFILESETTINGS); + str << path; + + BFile file; + status_t status = file.SetTo(str.String(), B_READ_ONLY | B_FAIL_IF_EXISTS); + + if (status == B_FILE_EXISTS || status == B_OK) + return B_OK; + else + return B_ERROR; } -/* Initialization */ status_t -JoyWin::AddDevices() +JoyWin::_ShowProbeMesage(const char* device) { - char name[B_FILE_NAME_LENGTH]; - int devId = 0; - MessagedItem* device; - BMessage* message; - BString str; - - while (!fJoystick.GetDeviceName(devId, name, sizeof(name))) { - message = new BMessage(PORT_SELECTED); - message->AddString("devname", name); - // NOTE: Adding the index in the list might be useful. + BString str("An attempt will be made to probe the port '"); + str << device << "' to try to figure out what kind of joystick (if any) "; + str << "are attached.There is a small chance this process might cause "; + str << "your machine to lock up and require a reboot. Make sure you have "; + str << "savedchanges in all open applications before you Probe"; + + BAlert *alert = new BAlert("test1", str.String(), "Probe", "Cancel"); + alert->SetShortcut(1, B_ESCAPE); + int32 bindex = alert->Go(); - // TODO: Change it with leaf path - str.SetTo(name); - //str = str.Remove(0, str.FindLast('/') ); + if (bindex == 0) + return B_OK; + else + return B_ERROR; +} + + +//Used when a files/joysticks are no were to be found +status_t +JoyWin::_ShowCantFindFileMessage(const char* port) +{ + BString str("The file '"); + str << _FixPathToName(port).String() << "' used by '" << port; + str << "' cannot be found.\n Do you want to "; + str << "try to auto-detect a joystick for this port?"; - device = new MessagedItem(str.String(), message); - fGamePortL->AddItem(device); + BAlert *alert = new BAlert("test1", str.String(), "Stop", "Probe"); + alert->SetShortcut(1, B_ENTER); + int32 bindex = alert->Go(); + + if (bindex == 1) + return B_OK; + else + return B_ERROR; +} + + +void +JoyWin::_ShowNoCompatibleJoystickMessage() +{ + BString str("There where no compatible joysticks detected on this game"); + str << " port. Try another port, or ask the manufacture of your jostick"; + str << " for a driver designed for Haiku or BeOS."; - devId++; - } + BAlert *alert = new BAlert("test1", str.String(), "Ok"); + alert->SetShortcut(0, B_ENTER); + alert->Go(); +} + +void +JoyWin::_ShowNoDeviceConnectedMessage(const char* joy, const char* port) +{ + BString str("There does not appear to be a "); + str << joy << " device connected to the port '" << port << "'."; - /* TODO: Add the Disabled devices */ - - /* We do not have any Joystick dev */ - if (devId == 0) { - // keep track of it - // Alert it + BAlert *alert = new BAlert("test1", str.String(), "Stop"); + alert->SetShortcut(0, B_ENTER); + alert->Go(); +} - return B_ERROR; + +// Use this function to get a string of disabled ports +BString +JoyWin::_BuildDisabledJoysticksFile() +{ + BString temp("# This is a list of disabled joystick devices."); + temp << "# Do not include the /dev/joystick/ part of the device name."; + + int32 number = fGamePortL->CountItems(); + PortItem *item; + for (int i = 0; i < number; i++) { + item = dynamic_cast(fGamePortL->ItemAt(i)); + if (!item->IsEnabled()) + temp << "disable = \"" << item->Text() << "\""; } + return temp; +} - return B_OK; + +PortItem* +JoyWin::_GetSelectedItem(BListView* list) +{ + int32 id = list->CurrentSelection(); + if (id > -1) { + //PortItem *item = dynamic_cast(list->ItemAt(id)); + return dynamic_cast(list->ItemAt(id)); + } else { + return NULL; + } } -status_t JoyWin::AddJoysticks() +BString +JoyWin::_FixPathToName(const char* port) { - return B_OK; + BString temp(port); + temp = temp.Remove(0, temp.FindLast('/') + 1) ; + return temp; } -/* Management */ -status_t JoyWin::Calibrate() +void +JoyWin::_SelectDeselectJoystick(BListView* list, bool enable) { - CalibWin* calibw; + list->DeselectAll(); + int32 number = fGamePortL->CountItems(); + PortItem *item; + for (int i = 0; i < number; i++) { + item = dynamic_cast(list->ItemAt(i)); + item->SetEnabled(enable); + } +} - calibw = new CalibWin(BRect(100, 100, 500, 400), "Calibrate", - B_DOCUMENT_WINDOW_LOOK, - B_NORMAL_WINDOW_FEEL, - B_NOT_RESIZABLE | B_NOT_ZOOMABLE); - calibw->Show(); - - return B_OK; +int32 +JoyWin::_FindStringItemInList(BListView *view, PortItem *item) +{ + PortItem *strItem; + int32 number = view->CountItems(); + for (int32 i = 0; i < number; i++) { + strItem = dynamic_cast(view->ItemAt(i)); + if (!strcmp(strItem->Text(), item->Text())) { + return i; + } + } + delete strItem; + return -1; } -status_t JoyWin::PerformProbe() +BString +JoyWin::_FindFilePathForSymLink(const char* symLinkPath, PortItem *item) { - MessageWin* mesgw; - - // [...] - - mesgw = new MessageWin(Frame(),"Probing", - B_MODAL_WINDOW_LOOK, - B_MODAL_APP_WINDOW_FEEL, - B_NOT_RESIZABLE | B_NOT_ZOOMABLE ); - - mesgw->Show(); - mesgw->SetText("Looking for: X in port Y ..."); - return B_OK; + BPath path(symLinkPath); + path.Append(item->Text()); + BEntry entry(path.Path()); + if (entry.IsSymLink()) { + BSymLink symLink(&entry); + BDirectory parent; + entry.GetParent(&parent); + symLink.MakeLinkedPath(&parent, &path); + BString str(path.Path()); + return str; + } + return NULL; } -/* Configuration */ -status_t JoyWin::ApplyChanges() +status_t +JoyWin::_FindStick(const char* name) { - return B_OK; + BJoystick *stick = new BJoystick(); + return stick->Open(name); } -/* Configuration */ -status_t JoyWin::GetSettings() +const char* +JoyWin::_FindSettingString(const char* name, const char* strPath) { - return B_OK; + //Make a BJoystick try open it + BString str; + + BPath path(strPath); + path.Append(name); + fFileTempProbeJoystick = new BFile(path.Path(), B_READ_ONLY); + + //status_t err = find_directory(B_COMMON_ETC_DIRECTORY, &path); +// if (err == B_OK) { + //BString str(path.Path()); + //str << "/joysticks/" << name; + //printf("path'%s'\n", str.String()); + //err = file->SetTo(strPath, B_READ_ONLY); + status_t err = fFileTempProbeJoystick->InitCheck(); + if (err == B_OK) { + //FileReadWrite frw(fFileTempProbeJoystick); + //printf("Get going\n"); + //printf("Opening file = %s\n", path.Path()); + //while (frw.Next(str)) { + //printf("In While loop\n"); + // printf("getline %s \n", str.String()); + //Test to open joystick with x number + //} + /*while (_GetLine(str)) { + //printf("In While loop\n"); + printf("getline %s \n", str.String()); + //Test to open joystick with x number + }*/ + return ""; + } else + printf("BFile.SetTo error: %s, Path = %s\n", strerror(err), str.String()); +// } else +// printf("find_directory error: %s\n", strerror(err)); + +// delete file; + return ""; } +/* +//Function to get a line from a file +bool +JoyWin::_GetLine(BString& string) +{ + // Fill up the buffer with the first chunk of code + if (fPositionInBuffer == 0) + fAmtRead = fFileTempProbeJoystick->Read(&fBuffer, sizeof(fBuffer)); + while (fAmtRead > 0) { + while (fPositionInBuffer < fAmtRead) { + // Return true if we hit a newline or the end of the file + if (fBuffer[fPositionInBuffer] == '\n') { + fPositionInBuffer++; + //Convert begin + int32 state = 0; + int32 bufferLen = string.Length(); + int32 destBufferLen = bufferLen; + char destination[destBufferLen]; +// if (fSourceEncoding) +// convert_to_utf8(fSourceEncoding, string.String(), &bufferLen, destination, &destBufferLen, &state); + string = destination; + return true; + } + string += fBuffer[fPositionInBuffer]; + fPositionInBuffer++; + } + + // Once the buffer runs out, grab some more and start again + fAmtRead = fFileTempProbeJoystick->Read(&fBuffer, sizeof(fBuffer)); + fPositionInBuffer = 0; + } + return false; +} +*/ Modified: haiku/trunk/src/preferences/joysticks/JoyWin.h =================================================================== --- haiku/trunk/src/preferences/joysticks/JoyWin.h 2008-06-08 15:42:29 UTC (rev 25864) +++ haiku/trunk/src/preferences/joysticks/JoyWin.h 2008-06-08 16:30:58 UTC (rev 25865) @@ -1,61 +1,81 @@ /* - * Copyright 2007 Haiku. + * Copyright 2007-2008 Haiku. * Distributed under the terms of the MIT License. * * Authors: - * Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com - * Ryan Leavengood, leavengood at gmail.com + * Oliver Ruiz Dorantes oliver.ruiz.dorantes_at_gmail.com + * Ryan Leavengood leavengood at gmail.com + * Fredrik Mod?en fredrik at modeen.se */ + #ifndef _JOY_WIN_H #define _JOY_WIN_H - #include -#include -class BView; +class BJoystick; class BCheckBox; class BStringView; class BListView; +class PortItem; class BButton; -class BBox; +class BEntry; +class BFile; - -class JoyWin : public BWindow -{ +class JoyWin : public BWindow { public: - JoyWin(BRect frame,const char *title, - window_look look, - window_feel feel, - uint32 flags, - uint32 workspace = B_CURRENT_WORKSPACE); - + JoyWin(BRect frame,const char *title); + virtual ~JoyWin(); virtual void MessageReceived(BMessage *message); virtual bool QuitRequested(); - protected: - BJoystick fJoystick; + private: + status_t _AddToList(BListView *list, uint32 command, + const char* rootPath, BEntry *rootEntry = NULL); + + status_t _Calibrate(); + status_t _PerformProbe(const char* path); + status_t _ApplyChanges(); + status_t _GetSettings(); + status_t _CheckJoystickExist(const char* path); + + /*Show Alert Boxes*/ + status_t _ShowProbeMesage(const char* str); + status_t _ShowCantFindFileMessage(const char* port); + void _ShowNoDeviceConnectedMessage(const char* joy, + const char* port); + void _ShowNoCompatibleJoystickMessage(); + + /*Util*/ + BString _FixPathToName(const char* port); + BString _BuildDisabledJoysticksFile(); + PortItem* _GetSelectedItem(BListView* list); + void _SelectDeselectJoystick(BListView* list, bool enable); + int32 _FindStringItemInList(BListView *view, + PortItem *item); + BString _FindFilePathForSymLink(const char* symLinkPath, + PortItem *item); + status_t _FindStick(const char* name); + const char* _FindSettingString(const char* name, const char* strPath); + bool _GetLine(BString& string); - BBox* fBox; + //this one are used when we select joystick when portare selected + bool fSystemUsedSelect; + + BJoystick* fJoystick; BCheckBox* fCheckbox; - BStringView* fGamePortS; BStringView* fConControllerS; - BListView* fGamePortL; BListView* fConControllerL; - BButton* fCalibrateButton; BButton* fProbeButton; - - status_t AddDevices(); - status_t AddJoysticks(); - status_t Calibrate(); - status_t PerformProbe(); - status_t ApplyChanges(); - status_t GetSettings(); - + + BFile* fFileTempProbeJoystick; +// int32 fSourceEncoding; + char fBuffer[4096]; + off_t fPositionInBuffer; + ssize_t fAmtRead; }; #endif /* _JOY_WIN_H */ - Modified: haiku/trunk/src/preferences/joysticks/Joysticks.cpp =================================================================== --- haiku/trunk/src/preferences/joysticks/Joysticks.cpp 2008-06-08 15:42:29 UTC (rev 25864) +++ haiku/trunk/src/preferences/joysticks/Joysticks.cpp 2008-06-08 16:30:58 UTC (rev 25865) @@ -11,43 +11,46 @@ #include "Joysticks.h" #include "JoyWin.h" +#include +#include + #include #include #include #include #include - int main(void) { Joysticks application("application/x-vnd.Haiku-Joysticks"); - - // Start Application application.Run(); - return 0; } -Joysticks::Joysticks(const char *signature) : BApplication(signature) -{ - +Joysticks::Joysticks(const char *signature) + : BApplication(signature) +{ } Joysticks::~Joysticks() { + be_app_messenger.SendMessage(B_QUIT_REQUESTED); +} + +bool +Joysticks::QuitRequested() +{ + return BApplication::QuitRequested(); } -void Joysticks::ReadyToRun() +void +Joysticks::ReadyToRun() { - fJoywin = new JoyWin(BRect(100, 100, 500, 400), "Joysticks", - B_DOCUMENT_WINDOW_LOOK, - B_NORMAL_WINDOW_FEEL, - B_NOT_ZOOMABLE); - + fJoywin = new JoyWin(BRect(100, 100, 500, 400), "Joysticks"); if (fJoywin != NULL) fJoywin->Show(); else Modified: haiku/trunk/src/preferences/joysticks/Joysticks.h =================================================================== --- haiku/trunk/src/preferences/joysticks/Joysticks.h 2008-06-08 15:42:29 UTC (rev 25864) +++ haiku/trunk/src/preferences/joysticks/Joysticks.h 2008-06-08 16:30:58 UTC (rev 25865) @@ -23,6 +23,7 @@ ~Joysticks(); virtual void ReadyToRun(); + virtual bool QuitRequested(); protected: JoyWin* fJoywin; Added: haiku/trunk/src/preferences/joysticks/PortItem.cpp =================================================================== --- haiku/trunk/src/preferences/joysticks/PortItem.cpp 2008-06-08 15:42:29 UTC (rev 25864) +++ haiku/trunk/src/preferences/joysticks/PortItem.cpp 2008-06-08 16:30:58 UTC (rev 25865) @@ -0,0 +1,44 @@ +/* + * Copyright 2008 Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Fredrik Mod?en fredrik at modeen.se + */ + +#include "PortItem.h" + +PortItem::PortItem(const char* label) [... truncated: 69 lines follow ...] From korli at mail.berlios.de Sun Jun 8 18:32:08 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 8 Jun 2008 18:32:08 +0200 Subject: [Haiku-commits] r25866 - haiku/trunk/src/kits/device Message-ID: <200806081632.m58GW8ru027786@sheep.berlios.de> Author: korli Date: 2008-06-08 18:32:07 +0200 (Sun, 08 Jun 2008) New Revision: 25866 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25866&view=rev Modified: haiku/trunk/src/kits/device/Joystick.cpp Log: gcc4 build fix Modified: haiku/trunk/src/kits/device/Joystick.cpp =================================================================== --- haiku/trunk/src/kits/device/Joystick.cpp 2008-06-08 16:30:58 UTC (rev 25865) +++ haiku/trunk/src/kits/device/Joystick.cpp 2008-06-08 16:32:07 UTC (rev 25866) @@ -155,7 +155,7 @@ void -BJoystick::ScanDevices(bool use_disabled = false) +BJoystick::ScanDevices(bool use_disabled) { // First, we empty the list for (int32 count = _fDevices->CountItems() - 1; count >= 0; count--) From mmlr at mail.berlios.de Sun Jun 8 21:57:45 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 8 Jun 2008 21:57:45 +0200 Subject: [Haiku-commits] r25867 - haiku/trunk/src/add-ons/kernel/bus_managers/pci Message-ID: <200806081957.m58Jvj6N007267@sheep.berlios.de> Author: mmlr Date: 2008-06-08 21:57:44 +0200 (Sun, 08 Jun 2008) New Revision: 25867 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25867&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/pci/pci.cpp haiku/trunk/src/add-ons/kernel/bus_managers/pci/pci_device.cpp Log: * The bus value of child devices are not necessarily the same as the one of the parent bus. It is possible that there are other busses below the root bus and we must therefore always iterate through the child devices when searching for a device with a bus unequal to our own. Otherwise devices for non-null busses could not be found which would lead to crashes in operations involving them. * Adding a panic in case finding a device failed as this should clearly not happen. This probably fixes bug #2293 and might affect #2284 too. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/pci/pci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/pci/pci.cpp 2008-06-08 16:32:07 UTC (rev 25866) +++ haiku/trunk/src/add-ons/kernel/bus_managers/pci/pci.cpp 2008-06-08 19:57:44 UTC (rev 25867) @@ -1301,12 +1301,13 @@ PCI::_FindDevice(PCIBus *current, int domain, uint8 bus, uint8 device, uint8 function) { - if (current->domain == domain && current->bus == bus) { + if (current->domain == domain) { // search device on this bus for (PCIDev *child = current->child; child != NULL; child = child->next) { - if (child->device == device && child->function == function) + if (child->bus == bus && child->device == device + && child->function == function) return child; if (child->child != NULL) { Modified: haiku/trunk/src/add-ons/kernel/bus_managers/pci/pci_device.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/pci/pci_device.cpp 2008-06-08 16:32:07 UTC (rev 25866) +++ haiku/trunk/src/add-ons/kernel/bus_managers/pci/pci_device.cpp 2008-06-08 19:57:44 UTC (rev 25867) @@ -124,6 +124,9 @@ return B_NO_MEMORY; device->device = gPCI->FindDevice(domain, bus, deviceNumber, function); + if (device->device == NULL) + panic("device not found!\n"); + device->node = node; *_cookie = device; From mmlr at mail.berlios.de Sun Jun 8 22:09:13 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 8 Jun 2008 22:09:13 +0200 Subject: [Haiku-commits] r25868 - in haiku/trunk: build/jam src/add-ons/kernel/busses/ide src/add-ons/kernel/busses/ide/it8211 Message-ID: <200806082009.m58K9CaI008009@sheep.berlios.de> Author: mmlr Date: 2008-06-08 22:09:12 +0200 (Sun, 08 Jun 2008) New Revision: 25868 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25868&view=rev Added: haiku/trunk/src/add-ons/kernel/busses/ide/it8211/ haiku/trunk/src/add-ons/kernel/busses/ide/it8211/Jamfile haiku/trunk/src/add-ons/kernel/busses/ide/it8211/it8211.c Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/src/add-ons/kernel/busses/ide/Jamfile Log: * Adding a driver for the not quite standard IT8211 single channel IDE controller. The device doesn't use the PCI_ide subclass (but PCI_mass_storage_other) and requires not using compatibility mode. Otherwise it's pretty much the generic_ide_pci driver. * Directly adding the driver to the image. This driver could either be merged into the generic ide driver so it supports not quite standard devices, or this could be made into a driver that collects all those non standard devices. Either way, this works for now and lets my machine boot off the IDE drive :-) Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-06-08 19:57:44 UTC (rev 25867) +++ haiku/trunk/build/jam/HaikuImage 2008-06-08 20:09:12 UTC (rev 25868) @@ -145,7 +145,7 @@ AddFilesToHaikuImage beos system add-ons kernel busses agp_gart : $(X86_ONLY)intel ; AddFilesToHaikuImage beos system add-ons kernel busses ide - : generic_ide_pci silicon_image_3112 legacy_sata $(X86_ONLY)ide_isa ; + : generic_ide_pci it8211 legacy_sata silicon_image_3112 $(X86_ONLY)ide_isa ; AddFilesToHaikuImage beos system add-ons kernel busses scsi : ahci ; AddFilesToHaikuImage beos system add-ons kernel busses usb @@ -359,7 +359,7 @@ pci $(X86_ONLY)isa config_manager ide scsi usb $(PPC_ONLY)openpic block_io ide_adapter locked_pool scsi_periph - generic_ide_pci ahci legacy_sata silicon_image_3112 $(X86_ONLY)ide_isa + ahci generic_ide_pci it8211 legacy_sata silicon_image_3112 $(X86_ONLY)ide_isa uhci ohci ehci scsi_cd scsi_disk usb_disk intel Modified: haiku/trunk/src/add-ons/kernel/busses/ide/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ide/Jamfile 2008-06-08 19:57:44 UTC (rev 25867) +++ haiku/trunk/src/add-ons/kernel/busses/ide/Jamfile 2008-06-08 20:09:12 UTC (rev 25868) @@ -2,6 +2,7 @@ SubInclude HAIKU_TOP src add-ons kernel busses ide generic_ide_pci ; SubInclude HAIKU_TOP src add-ons kernel busses ide ide_isa ; +SubInclude HAIKU_TOP src add-ons kernel busses ide it8211 ; SubInclude HAIKU_TOP src add-ons kernel busses ide promise_tx2 ; SubInclude HAIKU_TOP src add-ons kernel busses ide silicon_image_3112 ; SubInclude HAIKU_TOP src add-ons kernel busses ide legacy_sata ; Added: haiku/trunk/src/add-ons/kernel/busses/ide/it8211/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ide/it8211/Jamfile 2008-06-08 19:57:44 UTC (rev 25867) +++ haiku/trunk/src/add-ons/kernel/busses/ide/it8211/Jamfile 2008-06-08 20:09:12 UTC (rev 25868) @@ -0,0 +1,8 @@ +SubDir HAIKU_TOP src add-ons kernel busses ide it8211 ; + +UsePrivateHeaders kernel ; +UsePrivateHeaders drivers ; + +KernelAddon it8211 : + it8211.c + ; Added: haiku/trunk/src/add-ons/kernel/busses/ide/it8211/it8211.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ide/it8211/it8211.c 2008-06-08 19:57:44 UTC (rev 25867) +++ haiku/trunk/src/add-ons/kernel/busses/ide/it8211/it8211.c 2008-06-08 20:09:12 UTC (rev 25868) @@ -0,0 +1,242 @@ +/* + * Copyright 2008, Michael Lotz. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#include +#include +#include + +#include + +#define IT8211_CONTROLLER_MODULE_NAME "busses/ide/it8211/driver_v1" +#define IT8211_CHANNEL_MODULE_NAME "busses/ide/it8211/channel/v1" + +#define PCI_VENDOR_ITE 0x1283 +#define PCI_DEVICE_ITE_IT8211 0x8211 + +static ide_adapter_interface *sIDEAdapter; +static device_manager_info *sDeviceManager; + + +static void +it8211_set_channel(void *channelCookie, ide_channel channel) +{ + sIDEAdapter->set_channel((ide_adapter_channel_info *)channelCookie, + channel); +} + + +static status_t +it8211_write_command_block_regs(void *channelCookie, ide_task_file *taskFile, + ide_reg_mask registerMask) +{ + return sIDEAdapter->write_command_block_regs( + (ide_adapter_channel_info *)channelCookie, taskFile, registerMask); +} + + +static status_t +it8211_read_command_block_regs(void *channelCookie, ide_task_file *taskFile, + ide_reg_mask registerMask) +{ + return sIDEAdapter->read_command_block_regs( + (ide_adapter_channel_info *)channelCookie, taskFile, registerMask); +} + + +static uint8 +it8211_get_altstatus(void *channelCookie) +{ + return sIDEAdapter->get_altstatus((ide_adapter_channel_info *)channelCookie); +} + + +static status_t +it8211_write_device_control(void *channelCookie, uint8 value) +{ + return sIDEAdapter->write_device_control( + (ide_adapter_channel_info *)channelCookie, value); +} + + +static status_t +it8211_write_pio(void *channelCookie, uint16 *data, int count, bool force16bit) +{ + return sIDEAdapter->write_pio( + (ide_adapter_channel_info *)channelCookie, data, count, force16bit); +} + + +static status_t +it8211_read_pio(void *channelCookie, uint16 *data, int count, bool force16bit) +{ + return sIDEAdapter->read_pio( + (ide_adapter_channel_info *)channelCookie, data, count, force16bit); +} + + +static status_t +it8211_prepare_dma(void *channelCookie, const physical_entry *sgList, + size_t sgListCount, bool toDevice) +{ + return sIDEAdapter->prepare_dma((ide_adapter_channel_info *)channelCookie, + sgList, sgListCount, toDevice); +} + + +static status_t +it8211_start_dma(void *channelCookie) +{ + return sIDEAdapter->start_dma((ide_adapter_channel_info *)channelCookie); +} + + +static status_t +it8211_finish_dma(void *channelCookie) +{ + return sIDEAdapter->finish_dma((ide_adapter_channel_info *)channelCookie); +} + + +static status_t +init_channel(device_node *node, void **channelCookie) +{ + return sIDEAdapter->init_channel(node, + (ide_adapter_channel_info **)channelCookie, + sizeof(ide_adapter_channel_info), sIDEAdapter->inthand); +} + + +static void +uninit_channel(void *channelCookie) +{ + sIDEAdapter->uninit_channel((ide_adapter_channel_info *)channelCookie); +} + + +static void +channel_removed(void *channelCookie) +{ + sIDEAdapter->channel_removed((ide_adapter_channel_info *)channelCookie); +} + + +static status_t +init_controller(device_node *node, void **cookie) +{ + return sIDEAdapter->init_controller(node, + (ide_adapter_controller_info **)cookie, + sizeof(ide_adapter_controller_info)); +} + + +static void +uninit_controller(void *cookie) +{ + sIDEAdapter->uninit_controller((ide_adapter_controller_info *)cookie); +} + + +static void +controller_removed(void *cookie) +{ + sIDEAdapter->controller_removed((ide_adapter_controller_info *)cookie); +} + + +static status_t +probe_controller(device_node *parent) +{ + return sIDEAdapter->probe_controller(parent, + IT8211_CONTROLLER_MODULE_NAME, "it8211", + "ITE IT8211", IT8211_CHANNEL_MODULE_NAME, + true, /* DMA */ + true, /* command queuing */ + 1, /* 16 bit alignment */ + 0xffff, /* 64k boundary */ + 0x10000, /* up to 64k per scatter/gather block */ + false); /* no compatibility mode */ +} + + +static float +supports_device(device_node *parent) +{ + const char *bus; + uint16 vendorID; + uint16 deviceID; + + if (sDeviceManager->get_attr_string(parent, B_DEVICE_BUS, &bus, false) != B_OK + || sDeviceManager->get_attr_uint16(parent, B_DEVICE_VENDOR_ID, &vendorID, false) != B_OK + || sDeviceManager->get_attr_uint16(parent, B_DEVICE_ID, &deviceID, false) != B_OK) { + return -1.0f; + } + + if (strcmp(bus, "pci") != 0 || vendorID != PCI_VENDOR_ITE + || deviceID != PCI_DEVICE_ITE_IT8211) + return 0.0f; + + return 1.0f; +} + + +module_dependency module_dependencies[] = { + { B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&sDeviceManager }, + { IDE_ADAPTER_MODULE_NAME, (module_info **)&sIDEAdapter }, + {} +}; + + +// exported interface +static ide_controller_interface sChannelInterface = { + { + { + IT8211_CHANNEL_MODULE_NAME, + 0, + NULL + }, + + NULL, // supports device + NULL, // register device + &init_channel, + &uninit_channel, + NULL, // register child devices + NULL, // rescan + &channel_removed + }, + + &it8211_set_channel, + &it8211_write_command_block_regs, + &it8211_read_command_block_regs, + &it8211_get_altstatus, + &it8211_write_device_control, + &it8211_write_pio, + &it8211_read_pio, + &it8211_prepare_dma, + &it8211_start_dma, + &it8211_finish_dma +}; + + +static driver_module_info sControllerInterface = { + { + IT8211_CONTROLLER_MODULE_NAME, + 0, + NULL + }, + + &supports_device, + &probe_controller, + &init_controller, + &uninit_controller, + NULL, // register child devices + NULL, // rescan + &controller_removed +}; + + +module_info *modules[] = { + (module_info *)&sControllerInterface, + (module_info *)&sChannelInterface, + NULL +}; From korli at mail.berlios.de Sun Jun 8 22:34:49 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 8 Jun 2008 22:34:49 +0200 Subject: [Haiku-commits] r25869 - haiku/trunk/src/system/libroot/os/arch/m68k Message-ID: <200806082034.m58KYnJ9011710@sheep.berlios.de> Author: korli Date: 2008-06-08 22:34:49 +0200 (Sun, 08 Jun 2008) New Revision: 25869 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25869&view=rev Modified: haiku/trunk/src/system/libroot/os/arch/m68k/Jamfile Log: build fix Modified: haiku/trunk/src/system/libroot/os/arch/m68k/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/os/arch/m68k/Jamfile 2008-06-08 20:09:12 UTC (rev 25868) +++ haiku/trunk/src/system/libroot/os/arch/m68k/Jamfile 2008-06-08 20:34:49 UTC (rev 25869) @@ -1,5 +1,6 @@ SubDir HAIKU_TOP src system libroot os arch m68k ; +UsePrivateKernelHeaders ; UsePrivateSystemHeaders ; MergeObject os_arch_$(TARGET_ARCH).o : From mmlr at mail.berlios.de Sun Jun 8 23:48:23 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 8 Jun 2008 23:48:23 +0200 Subject: [Haiku-commits] r25870 - haiku/trunk/headers/private/kernel Message-ID: <200806082148.m58LmNLn018762@sheep.berlios.de> Author: mmlr Date: 2008-06-08 23:48:23 +0200 (Sun, 08 Jun 2008) New Revision: 25870 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25870&view=rev Modified: haiku/trunk/headers/private/kernel/debugger_keymaps.h Log: Patch by Olivier Coursiere that removes unneeded special characters. Modified: haiku/trunk/headers/private/kernel/debugger_keymaps.h =================================================================== --- haiku/trunk/headers/private/kernel/debugger_keymaps.h 2008-06-08 20:34:49 UTC (rev 25869) +++ haiku/trunk/headers/private/kernel/debugger_keymaps.h 2008-06-08 21:48:23 UTC (rev 25870) @@ -50,9 +50,9 @@ #elif KDL_KEYMAP == 'fr' static const char kUnshiftedKeymap[128] = { - 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '?', '+', 8, '\t', + 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 0, '+', 8, '\t', 'a', 'z', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 0, '$', '\n', 0, 'q', 's', - 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', '?', '*', 0, '$', 'w', 'x', 'c', 'v', + 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 0, '*', 0, '$', 'w', 'x', 'c', 'v', 'b', 'n', ',', ';', ':', '!', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '-', 0, 0, 0, '+', 0, 0, 0, 0, 0, 0, 0, '<', 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -61,10 +61,10 @@ }; static const char kShiftedKeymap[128] = { - 0, 27, '&', '?', '"', '\'', '(', '-', '?', '_', '?', '?', ')', '=', 8, '\t', - 'A', 'Z', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 0, '?', '\n', 0, 'Q', 'S', - 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', '%', '?', 0, 0, 'W', 'X', 'C', 'V', - 'B', 'N', '?', '.', '/', '?', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 27, '&', 0, '"', '\'', '(', '-', 0, '_', 0, 0, ')', '=', 8, '\t', + 'A', 'Z', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 0, 0, '\n', 0, 'Q', 'S', + 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', '%', 0, 0, 0, 'W', 'X', 'C', 'V', + 'B', 'N', '?', '.', '/', 0, 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '>', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -73,8 +73,8 @@ static const char kAltedKeymap[128] = { 0, 27, 0, '~', '#', '{', '[', '|', '`', '\\', '^', '@', ']', '}', 8, '\t', - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '?', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '\\', 0, 0, 0, 0, 0, 0, 0, 0, 0, From bonefish at mail.berlios.de Mon Jun 9 01:47:33 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 9 Jun 2008 01:47:33 +0200 Subject: [Haiku-commits] r25871 - haiku/trunk/src/kits/interface Message-ID: <200806082347.m58NlXAW025815@sheep.berlios.de> Author: bonefish Date: 2008-06-09 01:47:32 +0200 (Mon, 09 Jun 2008) New Revision: 25871 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25871&view=rev Modified: haiku/trunk/src/kits/interface/View.cpp Log: Also do fast mouse wheel scrolling when Command or Control is pressed (was Option only). Modified: haiku/trunk/src/kits/interface/View.cpp =================================================================== --- haiku/trunk/src/kits/interface/View.cpp 2008-06-08 21:48:23 UTC (rev 25870) +++ haiku/trunk/src/kits/interface/View.cpp 2008-06-08 23:47:32 UTC (rev 25871) @@ -3845,10 +3845,11 @@ if (horizontal != NULL) { horizontal->GetSteps(&smallStep, &largeStep); - // pressing the option key scrolls faster - if (modifiers() & B_OPTION_KEY) + // pressing the option/command/control key scrolls faster + if (modifiers() + & (B_OPTION_KEY | B_COMMAND_KEY | B_CONTROL_KEY)) { deltaX *= largeStep; - else + } else deltaX *= smallStep * 3; horizontal->SetValue(horizontal->Value() + deltaX); @@ -3857,10 +3858,11 @@ if (vertical != NULL) { vertical->GetSteps(&smallStep, &largeStep); - // pressing the option key scrolls faster - if (modifiers() & B_OPTION_KEY) + // pressing the option/command/control key scrolls faster + if (modifiers() + & (B_OPTION_KEY | B_COMMAND_KEY | B_CONTROL_KEY)) { deltaY *= largeStep; - else + } else deltaY *= smallStep * 3; vertical->SetValue(vertical->Value() + deltaY); From korli at users.berlios.de Mon Jun 9 11:28:21 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Mon, 9 Jun 2008 11:28:21 +0200 Subject: [Haiku-commits] r25834 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi In-Reply-To: <388438770-BeMail@zon> References: <200806062232.m56MWVqC023292@sheep.berlios.de> <388438770-BeMail@zon> Message-ID: 2008/6/7 Axel D?rfler : > korli at BerliOS wrote: >> Log: >> added B_FIND_MULTIPLE_CHILDREN on acpi devices as suggested by Axel. > > Actually, I intended to suggest the other way around, specifying > B_FIND_CHILD_ON_DEMAND only when it's actually needed. I'm a bit lost : so I should remove all flags ? I ported the acpi_thermal driver to the new driver architecture, and two problems arise: * the driver is only picked up when it has a boot symlink * the driver is registered twice for the thermal node, hence two dev entries instead of one. Bye, J?r?me From axeld at pinc-software.de Mon Jun 9 12:45:18 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 09 Jun 2008 12:45:18 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r25834_-_haiku/trunk/src/add-ons/kernel?= =?utf-8?q?/bus=5Fmanagers/acpi?= In-Reply-To: Message-ID: <12486477289-BeMail@zon> "J?r?me Duval" wrote: > 2008/6/7 Axel D?rfler : > > korli at BerliOS wrote: > >> Log: > >> added B_FIND_MULTIPLE_CHILDREN on acpi devices as suggested by > > > Axel. > > Actually, I intended to suggest the other way around, specifying > > B_FIND_CHILD_ON_DEMAND only when it's actually needed. > I'm a bit lost : so I should remove all flags ? You just need to specify the flags as actually needed: if a driver can and should be able to hook in, you should specify B_FIND_CHILD_ON_DEMAND. There is probably something wrong with the tree if that node has other children. In any case, I am not really familiar with ACPI yet, so I can't give a good advise. > I ported the acpi_thermal driver to the new driver architecture, and > two problems arise: > * the driver is only picked up when it has a boot symlink That hints to a problem with the path. The "power" path is currently not supported by any specific device type, so it should actually be able to find it by scanning "drivers" recursively, but there seems to be something wrong. I currently don't have the time to look into that, but that will change next week. If you want me to investigate the issue, I can certainly do so then. > * the driver is registered twice for the thermal node, hence two dev > entries instead of one. The ISA bus manager seems to have the same problem - the device manager should prevent this by comparing the attributes of the nodes, but that obviously fails for some reason (it did work in my playground, though). Bye, Axel. From axeld at mail.berlios.de Mon Jun 9 15:01:58 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 9 Jun 2008 15:01:58 +0200 Subject: [Haiku-commits] r25872 - haiku/trunk/src/apps/mail Message-ID: <200806091301.m59D1wLR020662@sheep.berlios.de> Author: axeld Date: 2008-06-09 15:01:58 +0200 (Mon, 09 Jun 2008) New Revision: 25872 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25872&view=rev Modified: haiku/trunk/src/apps/mail/Content.cpp Log: * Slightly improved invalid suffix removal from URLs. Modified: haiku/trunk/src/apps/mail/Content.cpp =================================================================== --- haiku/trunk/src/apps/mail/Content.cpp 2008-06-08 23:47:32 UTC (rev 25871) +++ haiku/trunk/src/apps/mail/Content.cpp 2008-06-09 13:01:58 UTC (rev 25872) @@ -346,10 +346,19 @@ if (type == 0) return 0; - int32 index = 0; - if (type == TYPE_URL) { - index = strcspn(string, " <>\"\r\n"); + int32 index = strcspn(string, " \t<>)\"\\,\r\n"); + // filter out some punctuation marks if they are the last character + char suffix = string[index - 1]; + if (suffix == '.' + || suffix == ',' + || suffix == '?' + || suffix == '!' + || suffix == ':' + || suffix == ';') + index--; + + if (type == TYPE_URL) { char *parenthesis = NULL; // filter out a trailing ')' if there is no left parenthesis before @@ -366,19 +375,7 @@ index--; } } - else - index = strcspn(string, " \t>)\"\\,\r\n"); - // filter out some punctuation marks if they are the last character - char suffix = string[index - 1]; - if (suffix == '.' - || suffix == ',' - || suffix == '?' - || suffix == '!' - || suffix == ':' - || suffix == ';') - index--; - if (url != NULL) { // copy the address to the specified string if (type == TYPE_URL && string[0] == 'w') { From rudolfc at mail.berlios.de Mon Jun 9 16:37:06 2008 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Mon, 9 Jun 2008 16:37:06 +0200 Subject: [Haiku-commits] r25873 - in haiku/trunk/src/add-ons/accelerants: . nvidia_gpgpu nvidia_gpgpu/engine Message-ID: <200806091437.m59Eb6dk031089@sheep.berlios.de> Author: rudolfc Date: 2008-06-09 16:37:03 +0200 (Mon, 09 Jun 2008) New Revision: 25873 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25873&view=rev Added: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/ Modified: haiku/trunk/src/add-ons/accelerants/Jamfile haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/GetAccelerantHook.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/InitAccelerant.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/Jamfile haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/SetDisplayMode.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/Jamfile haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_acc.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_acc_dma.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_general.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_proto.h Log: copied nvidia driver over to nvidia_gpgpu driver. Does nothing but compile. I hope to be fidding around with a EN8500GT soon. If for some reason I shouldn't be creating these folders, feel free to remove it again, and let me know :) Modified: haiku/trunk/src/add-ons/accelerants/Jamfile =================================================================== --- haiku/trunk/src/add-ons/accelerants/Jamfile 2008-06-09 13:01:58 UTC (rev 25872) +++ haiku/trunk/src/add-ons/accelerants/Jamfile 2008-06-09 14:37:03 UTC (rev 25873) @@ -5,6 +5,7 @@ SubInclude HAIKU_TOP src add-ons accelerants intel_extreme ; SubInclude HAIKU_TOP src add-ons accelerants matrox ; SubInclude HAIKU_TOP src add-ons accelerants neomagic ; +SubInclude HAIKU_TOP src add-ons accelerants nvidia_gpgpu ; SubInclude HAIKU_TOP src add-ons accelerants nvidia ; SubInclude HAIKU_TOP src add-ons accelerants radeon ; SubInclude HAIKU_TOP src add-ons accelerants s3 ; Copied: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu (from rev 25872, haiku/trunk/src/add-ons/accelerants/nvidia) Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/GetAccelerantHook.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/GetAccelerantHook.c 2008-06-09 13:01:58 UTC (rev 25872) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/GetAccelerantHook.c 2008-06-09 14:37:03 UTC (rev 25873) @@ -4,7 +4,7 @@ Other authors: Mark Watson, - Rudolf Cornelissen 10/2002-1/2006 + Rudolf Cornelissen 10/2002-6/2008 */ #define MODULE_BIT 0x08000000 @@ -74,9 +74,9 @@ HOOK(SET_DPMS_MODE); /* cursor managment */ - HRDC(SET_CURSOR_SHAPE); - HRDC(MOVE_CURSOR); - HRDC(SHOW_CURSOR); + //HRDC(SET_CURSOR_SHAPE); + //HRDC(MOVE_CURSOR); + //HRDC(SHOW_CURSOR); /* synchronization */ HOOK(ACCELERANT_ENGINE_COUNT); @@ -94,15 +94,15 @@ */ /* only export video overlay functions if card is capable of it */ - CHKO(OVERLAY_COUNT); - CHKO(OVERLAY_SUPPORTED_SPACES); - CHKO(OVERLAY_SUPPORTED_FEATURES); - CHKO(ALLOCATE_OVERLAY_BUFFER); - CHKO(RELEASE_OVERLAY_BUFFER); - CHKO(GET_OVERLAY_CONSTRAINTS); - CHKO(ALLOCATE_OVERLAY); - CHKO(RELEASE_OVERLAY); - CHKO(CONFIGURE_OVERLAY); + //CHKO(OVERLAY_COUNT); + //CHKO(OVERLAY_SUPPORTED_SPACES); + //CHKO(OVERLAY_SUPPORTED_FEATURES); + //CHKO(ALLOCATE_OVERLAY_BUFFER); + //CHKO(RELEASE_OVERLAY_BUFFER); + //CHKO(GET_OVERLAY_CONSTRAINTS); + //CHKO(ALLOCATE_OVERLAY); + //CHKO(RELEASE_OVERLAY); + //CHKO(CONFIGURE_OVERLAY); /* When requesting an acceleration hook, the calling application provides a @@ -116,14 +116,14 @@ /* only export 2D acceleration functions in modes that are capable of it */ /* used by the app_server and applications (BWindowScreen) */ - CHKA(SCREEN_TO_SCREEN_BLIT); - CHKA(FILL_RECTANGLE); - CHKA(INVERT_RECTANGLE); - CHKA(FILL_SPAN); + //CHKA(SCREEN_TO_SCREEN_BLIT); + //CHKA(FILL_RECTANGLE); + //CHKA(INVERT_RECTANGLE); + //CHKA(FILL_SPAN); /* not (yet) used by the app_server: * so just for application use (BWindowScreen) */ // CHKA(SCREEN_TO_SCREEN_TRANSPARENT_BLIT); - CHKA(SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT); + //CHKA(SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT); } /* Return a null pointer for any feature we don't understand. */ Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/InitAccelerant.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/InitAccelerant.c 2008-06-09 13:01:58 UTC (rev 25872) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/InitAccelerant.c 2008-06-09 14:37:03 UTC (rev 25873) @@ -38,10 +38,10 @@ goto error0; } // LOG is now available, si !NULL - LOG(4,("init_common: logmask 0x%08x, memory %dMB, hardcursor %d, usebios %d, switchhead %d, force_pci %d\n", - si->settings.logmask, si->settings.memory, si->settings.hardcursor, si->settings.usebios, si->settings.switchhead, si->settings.force_pci)); - LOG(4,("init_common: dumprom %d, unhide_fw %d, pgm_panel %d, dma_acc %d, tv_output %d, vga_on_tv %d\n", - si->settings.dumprom, si->settings.unhide_fw, si->settings.pgm_panel, si->settings.dma_acc, si->settings.tv_output, si->settings.vga_on_tv)); + LOG(4,("init_common: logmask 0x%08x, memory %dMB, hardcursor %d, usebios %d, switchhead %d\n", + si->settings.logmask, si->settings.memory, si->settings.hardcursor, si->settings.usebios, si->settings.switchhead)); + LOG(4,("init_common: dumprom %d, pgm_panel %d, dma_acc %d, tv_output %d, vga_on_tv %d\n", + si->settings.dumprom, si->settings.pgm_panel, si->settings.dma_acc, si->settings.tv_output, si->settings.vga_on_tv)); LOG(4,("init_common: force_sync %d, gpu_clk %dMhz, ram_clk %dMhz, force_ws %d\n", si->settings.force_sync, si->settings.gpu_clk, si->settings.ram_clk, si->settings.force_ws)); Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/Jamfile =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/Jamfile 2008-06-09 13:01:58 UTC (rev 25872) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/Jamfile 2008-06-09 14:37:03 UTC (rev 25873) @@ -1,12 +1,12 @@ -SubDir HAIKU_TOP src add-ons accelerants nvidia ; +SubDir HAIKU_TOP src add-ons accelerants nvidia_gpgpu ; SetSubDirSupportedPlatformsBeOSCompatible ; UsePrivateHeaders graphics ; -UsePrivateHeaders [ FDirName graphics nvidia ] ; +UsePrivateHeaders [ FDirName graphics nvidia_gpgpu ] ; UseHeaders [ FDirName $(SUBDIR) engine ] ; -Addon nvidia.accelerant : +Addon nvidia_gpgpu.accelerant : Acceleration.c Cursor.c EngineManagment.c @@ -18,13 +18,13 @@ Overlay.c ProposeDisplayMode.c SetDisplayMode.c - : libnvidia_engine.a + : libnvidia_gpgpu_engine.a ; -Package haiku-nvidia-cvs : - nvidia.accelerant : +Package haiku-nvidia_gpgpu-cvs : + nvidia_gpgpu.accelerant : boot home config add-ons accelerants ; -Depends nvidia.accelerant : nvidia ; +Depends nvidia_gpgpu.accelerant : nvidia_gpgpu ; -SubInclude HAIKU_TOP src add-ons accelerants nvidia engine ; +SubInclude HAIKU_TOP src add-ons accelerants nvidia_gpgpu engine ; Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/SetDisplayMode.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/SetDisplayMode.c 2008-06-09 13:01:58 UTC (rev 25872) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/SetDisplayMode.c 2008-06-09 14:37:03 UTC (rev 25873) @@ -59,16 +59,16 @@ si->engine.threeD.clones = 0x00000000; /* disable interrupts using the kernel driver */ - head1_interrupt_enable(false); - if (si->ps.secondary_head) head2_interrupt_enable(false); +// head1_interrupt_enable(false); +// if (si->ps.secondary_head) head2_interrupt_enable(false); /* disable TVout if supported */ - if (si->ps.tvout) BT_stop_tvout(); +// if (si->ps.tvout) BT_stop_tvout(); /* turn off screen(s) _after_ TVout is disabled (if applicable) */ - head1_dpms(false, false, false, true); - if (si->ps.secondary_head) head2_dpms(false, false, false, true); - if (si->ps.tvout) BT_dpms(false); +// head1_dpms(false, false, false, true); +// if (si->ps.secondary_head) head2_dpms(false, false, false, true); +// if (si->ps.tvout) BT_dpms(false); /*where in framebuffer the screen is (should this be dependant on previous MOVEDISPLAY?)*/ startadd = (uint8*)si->fbc.frame_buffer - (uint8*)si->framebuffer; @@ -116,43 +116,43 @@ // cross = false; // } /* set output connectors assignment if possible */ - if ((target.flags & DUALHEAD_BITS) == DUALHEAD_SWITCH) +// if ((target.flags & DUALHEAD_BITS) == DUALHEAD_SWITCH) /* invert output assignment in switch mode */ - nv_general_head_select(true); - else - nv_general_head_select(false); +// nv_general_head_select(true); +// else +// nv_general_head_select(false); /* set the pixel clock PLL(s) */ LOG(8,("SETMODE: target clock %dkHz\n",target.timing.pixel_clock)); - if (head1_set_pix_pll(target) == B_ERROR) - LOG(8,("SETMODE: error setting pixel clock (internal DAC)\n")); +// if (head1_set_pix_pll(target) == B_ERROR) +// LOG(8,("SETMODE: error setting pixel clock (internal DAC)\n")); LOG(8,("SETMODE: target2 clock %dkHz\n",target2.timing.pixel_clock)); - if (head2_set_pix_pll(target2) == B_ERROR) - LOG(8,("SETMODE: error setting pixel clock (DAC2)\n")); +// if (head2_set_pix_pll(target2) == B_ERROR) +// LOG(8,("SETMODE: error setting pixel clock (DAC2)\n")); /*set the colour depth for CRTC1 and the DAC */ switch(target.space) { case B_CMAP8: colour_depth1 = 8; - head1_mode(BPP8, 1.0); - head1_depth(BPP8); +// head1_mode(BPP8, 1.0); +// head1_depth(BPP8); break; case B_RGB15_LITTLE: colour_depth1 = 16; - head1_mode(BPP15, 1.0); - head1_depth(BPP15); +// head1_mode(BPP15, 1.0); +// head1_depth(BPP15); break; case B_RGB16_LITTLE: colour_depth1 = 16; - head1_mode(BPP16, 1.0); - head1_depth(BPP16); +// head1_mode(BPP16, 1.0); +// head1_depth(BPP16); break; case B_RGB32_LITTLE: colour_depth1 = 32; - head1_mode(BPP32, 1.0); - head1_depth(BPP32); +// head1_mode(BPP32, 1.0); +// head1_depth(BPP32); break; } /*set the colour depth for CRTC2 and DAC2 */ @@ -160,23 +160,23 @@ { case B_CMAP8: colour_depth2 = 8; - head2_mode(BPP8, 1.0); - head2_depth(BPP8); +// head2_mode(BPP8, 1.0); +// head2_depth(BPP8); break; case B_RGB15_LITTLE: colour_depth2 = 16; - head2_mode(BPP15, 1.0); - head2_depth(BPP15); +// head2_mode(BPP15, 1.0); +// head2_depth(BPP15); break; case B_RGB16_LITTLE: colour_depth2 = 16; - head2_mode(BPP16, 1.0); - head2_depth(BPP16); +// head2_mode(BPP16, 1.0); +// head2_depth(BPP16); break; case B_RGB32_LITTLE: colour_depth2 = 32; - head2_mode(BPP32, 1.0); - head2_depth(BPP32); +// head2_mode(BPP32, 1.0); +// head2_depth(BPP32); break; } @@ -185,10 +185,10 @@ si->interlaced_tv_mode = false; /*set the display(s) pitches*/ - head1_set_display_pitch (); +// head1_set_display_pitch (); //fixme: seperate for real dualhead modes: //we need a secondary si->fbc! - head2_set_display_pitch (); +// head2_set_display_pitch (); /*work out where the "right" screen starts*/ startadd_right = startadd + (target.timing.h_display * (colour_depth1 >> 3)); @@ -198,21 +198,21 @@ { case DUALHEAD_ON: case DUALHEAD_SWITCH: - head1_set_display_start(startadd,colour_depth1); - head2_set_display_start(startadd_right,colour_depth2); +// head1_set_display_start(startadd,colour_depth1); +// head2_set_display_start(startadd_right,colour_depth2); break; case DUALHEAD_CLONE: - head1_set_display_start(startadd,colour_depth1); - head2_set_display_start(startadd,colour_depth2); +// head1_set_display_start(startadd,colour_depth1); +// head2_set_display_start(startadd,colour_depth2); break; } /* set the timing */ - head1_set_timing(target); - head2_set_timing(target2); +// head1_set_timing(target); +// head2_set_timing(target2); /* TVout support: program TVout encoder and modify CRTC timing */ - if (si->ps.tvout && (target2.flags & TV_BITS)) BT_setmode(target2); +// if (si->ps.tvout && (target2.flags & TV_BITS)) BT_setmode(target2); } else /* single head mode */ { @@ -257,26 +257,26 @@ } /* set the pixel clock PLL */ - if (head1_set_pix_pll(target) == B_ERROR) - LOG(8,("CRTC: error setting pixel clock (internal DAC)\n")); +// if (head1_set_pix_pll(target) == B_ERROR) +// LOG(8,("CRTC: error setting pixel clock (internal DAC)\n")); /* set the colour depth for CRTC1 and the DAC */ /* first set the colordepth */ - head1_depth(colour_mode); +// head1_depth(colour_mode); /* then(!) program the PAL (<8bit colordepth does not support 8bit PAL) */ - head1_mode(colour_mode,1.0); +// head1_mode(colour_mode,1.0); /* set the display pitch */ - head1_set_display_pitch(); +// head1_set_display_pitch(); /* tell the card what memory to display */ - head1_set_display_start(startadd,colour_depth1); +// head1_set_display_start(startadd,colour_depth1); /* set the timing */ - head1_set_timing(target); +// head1_set_timing(target); /* TVout support: program TVout encoder and modify CRTC timing */ - if (si->ps.tvout && (target.flags & TV_BITS)) BT_setmode(target); +// if (si->ps.tvout && (target.flags & TV_BITS)) BT_setmode(target); //fixme: shut-off the videoPLL if it exists... } @@ -285,8 +285,8 @@ si->dm = target; /* update FIFO data fetching according to mode */ - nv_crtc_update_fifo(); - if (si->ps.secondary_head) nv_crtc2_update_fifo(); +// nv_crtc_update_fifo(); +// if (si->ps.secondary_head) nv_crtc2_update_fifo(); /* set up acceleration for this mode */ /* note: @@ -301,7 +301,7 @@ nv_acc_init_dma(); } /* set up overlay unit for this mode */ - nv_bes_init(); +// nv_bes_init(); /* note freemem range */ /* first free adress follows hardcursor and workspace */ @@ -322,12 +322,12 @@ si->engine.threeD.mem_high -= (MAXBUFFERS * 1024 * 1024 * 2); /* see overlay.c file */ /* restore screen(s) output state(s) */ - SET_DPMS_MODE(si->dpms_flags); +// SET_DPMS_MODE(si->dpms_flags); /* enable interrupts using the kernel driver */ //fixme: //add head2 once we use one driver instance 'per head' (instead of 'per card') - head1_interrupt_enable(true); +// head1_interrupt_enable(true); /* make sure a possible 3D add-on will re-initialize itself by signalling ready */ si->engine.threeD.mode_changing = false; @@ -336,7 +336,7 @@ // head1_mem_priority(colour_depth1); /* Tune RAM CAS-latency if needed. Must be done *here*! */ - nv_set_cas_latency(); +// nv_set_cas_latency(); LOG(1,("SETMODE: booted since %f mS\n", system_time()/1000.0)); Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/Jamfile =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/Jamfile 2008-06-09 13:01:58 UTC (rev 25872) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/Jamfile 2008-06-09 14:37:03 UTC (rev 25873) @@ -1,11 +1,11 @@ -SubDir HAIKU_TOP src add-ons accelerants nvidia engine ; +SubDir HAIKU_TOP src add-ons accelerants nvidia_gpgpu engine ; SetSubDirSupportedPlatformsBeOSCompatible ; UsePrivateHeaders graphics ; -UsePrivateHeaders [ FDirName graphics nvidia ] ; +UsePrivateHeaders [ FDirName graphics nvidia_gpgpu ] ; -StaticLibrary libnvidia_engine.a : +StaticLibrary libnvidia_gpgpu_engine.a : nv_acc.c nv_acc_dma.c nv_bes.c @@ -15,7 +15,6 @@ nv_dac.c nv_dac2.c nv_general.c - nv_agp.c nv_globals.c nv_i2c.c nv_info.c Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_acc.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_acc.c 2008-06-09 13:01:58 UTC (rev 25872) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_acc.c 2008-06-09 14:37:03 UTC (rev 25873) @@ -68,6 +68,7 @@ status_t nv_acc_wait_idle() { +return B_OK; /* wait until engine completely idle */ while (ACCR(STATUS)) { Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_acc_dma.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_acc_dma.c 2008-06-09 13:01:58 UTC (rev 25872) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_acc_dma.c 2008-06-09 14:37:03 UTC (rev 25873) @@ -36,6 +36,7 @@ /* we'd better check for timeouts on the DMA engine as it's theoretically * breakable by malfunctioning software */ uint16 cnt = 0; +return B_OK; /* wait until all upcoming commands are in execution at least. Do this until * we hit a timeout; abort if we failed at least three times before: @@ -488,7 +489,7 @@ ACCW(PR_CTX3_B, 0x00000000); /* method traps disabled */ } /* setup DMA set pointed at by PF_CACH1_DMAI */ - if (si->engine.agp_mode) + if (0)//si->engine.agp_mode) { /* DMA page table present and of linear type; * DMA class is $002 (b0-11); Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_general.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c 2008-06-09 13:01:58 UTC (rev 25872) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_general.c 2008-06-09 14:37:03 UTC (rev 25873) @@ -1,7 +1,7 @@ /* Authors: Mark Watson 12/1999, Apsed, - Rudolf Cornelissen 10/2002-10/2007 + Rudolf Cornelissen 10/2002-6/2008 */ #define MODULE_BIT 0x00008000 @@ -91,7 +91,7 @@ { status_t status; - LOG(1,("POWERUP: Haiku nVidia Accelerant 0.84 running.\n")); + LOG(1,("POWERUP: Haiku nVidia-gpgpu Accelerant 0.00 running.\n")); /* log VBLANK INT usability status */ if (si->ps.int_assigned) @@ -109,585 +109,6 @@ switch(CFGR(DEVID)) { /* Vendor Nvidia */ - case 0x002010de: /* Nvidia TNT1 */ - si->ps.card_type = NV04; - si->ps.card_arch = NV04A; - sprintf(si->adi.name, "Nvidia TNT1"); - sprintf(si->adi.chipset, "NV04"); - status = nvxx_general_powerup(); - break; - case 0x002810de: /* Nvidia TNT2 (pro) */ - case 0x002910de: /* Nvidia TNT2 Ultra */ - case 0x002a10de: /* Nvidia TNT2 */ - case 0x002b10de: /* Nvidia TNT2 */ - si->ps.card_type = NV05; - si->ps.card_arch = NV04A; - sprintf(si->adi.name, "Nvidia TNT2"); - sprintf(si->adi.chipset, "NV05"); - status = nvxx_general_powerup(); - break; - case 0x002c10de: /* Nvidia Vanta (Lt) */ - si->ps.card_type = NV05; - si->ps.card_arch = NV04A; - sprintf(si->adi.name, "Nvidia Vanta (Lt)"); - sprintf(si->adi.chipset, "NV05"); - status = nvxx_general_powerup(); - break; - case 0x002d10de: /* Nvidia TNT2-M64 (Pro) */ - si->ps.card_type = NV05M64; - si->ps.card_arch = NV04A; - sprintf(si->adi.name, "Nvidia TNT2-M64 (Pro)"); - sprintf(si->adi.chipset, "NV05 model 64"); - status = nvxx_general_powerup(); - break; - case 0x002e10de: /* Nvidia NV06 Vanta */ - case 0x002f10de: /* Nvidia NV06 Vanta */ - si->ps.card_type = NV06; - si->ps.card_arch = NV04A; - sprintf(si->adi.name, "Nvidia Vanta"); - sprintf(si->adi.chipset, "NV06"); - status = nvxx_general_powerup(); - break; - case 0x004010de: /* Nvidia GeForce FX 6800 Ultra */ - case 0x004110de: /* Nvidia GeForce FX 6800 */ - case 0x004210de: /* Nvidia GeForce FX 6800LE */ - si->ps.card_type = NV40; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce FX 6800"); - sprintf(si->adi.chipset, "NV40"); - status = nvxx_general_powerup(); - break; - case 0x004310de: /* Nvidia GeForce 6800 XE */ - si->ps.card_type = NV40; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce 6800 XE"); - sprintf(si->adi.chipset, "NV40"); - status = nvxx_general_powerup(); - break; - case 0x004510de: /* Nvidia GeForce FX 6800 GT */ - case 0x004610de: /* Nvidia GeForce FX 6800 GT */ - case 0x004710de: /* Nvidia GeForce FX 6800 GS */ - case 0x004810de: /* Nvidia GeForce FX 6800 XT */ - si->ps.card_type = NV40; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce FX 6800"); - sprintf(si->adi.chipset, "NV40"); - status = nvxx_general_powerup(); - break; - case 0x004910de: /* Nvidia unknown FX */ - si->ps.card_type = NV40; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia unknown FX"); - sprintf(si->adi.chipset, "NV40"); - status = nvxx_general_powerup(); - break; - case 0x004d10de: /* Nvidia Quadro FX 4400 */ - case 0x004e10de: /* Nvidia Quadro FX 4000 */ - si->ps.card_type = NV40; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia Quadro FX 4000/4400"); - sprintf(si->adi.chipset, "NV40"); - status = nvxx_general_powerup(); - break; - case 0x009110de: /* Nvidia GeForce 7800 GTX PCIe */ - case 0x009210de: /* Nvidia Geforce 7800 GT PCIe */ - si->ps.card_type = G70; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia Geforce 7800 GT PCIe"); - sprintf(si->adi.chipset, "G70"); - status = nvxx_general_powerup(); - break; - case 0x009810de: /* Nvidia Geforce 7800 Go PCIe */ - case 0x009910de: /* Nvidia Geforce 7800 GTX Go PCIe */ - si->ps.card_type = G70; - si->ps.card_arch = NV40A; - si->ps.laptop = true; - sprintf(si->adi.name, "Nvidia Geforce 7800 GTX Go PCIe"); - sprintf(si->adi.chipset, "G70"); - status = nvxx_general_powerup(); - break; - case 0x009d10de: /* Nvidia Quadro FX 4500 */ - si->ps.card_type = G70; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia Quadro FX 4500"); - sprintf(si->adi.chipset, "G70"); - status = nvxx_general_powerup(); - break; - case 0x00a010de: /* Nvidia Aladdin TNT2 */ - si->ps.card_type = NV05; - si->ps.card_arch = NV04A; - sprintf(si->adi.name, "Nvidia Aladdin TNT2"); - sprintf(si->adi.chipset, "NV05"); - status = nvxx_general_powerup(); - break; - case 0x00c010de: /* Nvidia GeForce 6800 GS */ - si->ps.card_type = NV41; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce 6800 GS"); - sprintf(si->adi.chipset, "NV41"); - status = nvxx_general_powerup(); - break; - case 0x00c110de: /* Nvidia GeForce FX 6800 */ - case 0x00c210de: /* Nvidia GeForce FX 6800LE */ - case 0x00c310de: /* Nvidia GeForce FX 6800 XT */ - si->ps.card_type = NV41; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce FX 6800"); - sprintf(si->adi.chipset, "NV41"); - status = nvxx_general_powerup(); - break; - case 0x00c810de: /* Nvidia GeForce FX 6800 Go */ - case 0x00c910de: /* Nvidia GeForce FX 6800 Ultra Go */ - si->ps.card_type = NV41; - si->ps.card_arch = NV40A; - si->ps.laptop = true; - sprintf(si->adi.name, "Nvidia GeForce FX 6800 Go"); - sprintf(si->adi.chipset, "NV41"); - status = nvxx_general_powerup(); - break; - case 0x00cc10de: /* Nvidia Quadro FX 1400 Go */ - si->ps.card_type = NV41; - si->ps.card_arch = NV40A; - si->ps.laptop = true; - sprintf(si->adi.name, "Nvidia Quadro FX 1400 Go"); - sprintf(si->adi.chipset, "NV41"); - status = nvxx_general_powerup(); - break; - case 0x00cd10de: /* Nvidia Quadro FX 3450/4000 SDI */ - si->ps.card_type = NV41; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia Quadro FX 3450/4000 SDI"); - sprintf(si->adi.chipset, "NV41"); - status = nvxx_general_powerup(); - break; - case 0x00ce10de: /* Nvidia Quadro FX 1400 */ - si->ps.card_type = NV41; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia Quadro FX 1400"); - sprintf(si->adi.chipset, "NV41"); - status = nvxx_general_powerup(); - break; - case 0x00f010de: /* Nvidia GeForce FX 6800 (Ultra) AGP(?) */ - si->ps.card_type = NV40; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce FX 6800 AGP(?)"); - sprintf(si->adi.chipset, "NV40(?)"); - status = nvxx_general_powerup(); - break; - case 0x00f110de: /* Nvidia GeForce FX 6600 GT AGP */ - case 0x00f210de: /* Nvidia GeForce FX 6600 AGP */ - si->ps.card_type = NV43; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce FX 6600 (GT) AGP"); - sprintf(si->adi.chipset, "NV43"); - status = nvxx_general_powerup(); - break; - case 0x00f310de: /* Nvidia GeForce 6200 */ - si->ps.card_type = NV44; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce 6200"); - sprintf(si->adi.chipset, "NV44"); - status = nvxx_general_powerup(); - break; - case 0x00f410de: /* Nvidia GeForce 6600 LE */ - si->ps.card_type = NV43; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce 6600 LE"); - sprintf(si->adi.chipset, "NV43"); - status = nvxx_general_powerup(); - break; - case 0x00f510de: /* Nvidia GeForce FX 7800 GS AGP */ - si->ps.card_type = G70; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce 7800 GS AGP"); - sprintf(si->adi.chipset, "G70"); - status = nvxx_general_powerup(); - break; - case 0x00f610de: /* Nvidia GeForce 6800 GS */ - si->ps.card_type = NV43; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce 6800 GS"); - sprintf(si->adi.chipset, "NV43"); - status = nvxx_general_powerup(); - break; - case 0x00f810de: /* Nvidia Quadro FX 3400/4400 PCIe */ - si->ps.card_type = NV45; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia Quadro FX 3400 PCIe"); - sprintf(si->adi.chipset, "NV45"); - status = nvxx_general_powerup(); - break; - case 0x00f910de: /* Nvidia GeForce PCX 6800 PCIe */ - si->ps.card_type = NV45; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce PCX 6800 PCIe"); - sprintf(si->adi.chipset, "NV45"); - status = nvxx_general_powerup(); - break; - case 0x00fa10de: /* Nvidia GeForce PCX 5750 PCIe */ - si->ps.card_type = NV36; - si->ps.card_arch = NV30A; - sprintf(si->adi.name, "Nvidia GeForce PCX 5750 PCIe"); - sprintf(si->adi.chipset, "NV36"); - status = nvxx_general_powerup(); - break; - case 0x00fb10de: /* Nvidia GeForce PCX 5900 PCIe */ - si->ps.card_type = NV35; - si->ps.card_arch = NV30A; - sprintf(si->adi.name, "Nvidia GeForce PCX 5900 PCIe"); - sprintf(si->adi.chipset, "NV35(?)"); - status = nvxx_general_powerup(); - break; - case 0x00fc10de: /* Nvidia GeForce PCX 5300 PCIe */ - si->ps.card_type = NV34; - si->ps.card_arch = NV30A; - sprintf(si->adi.name, "Nvidia GeForce PCX 5300 PCIe"); - sprintf(si->adi.chipset, "NV34"); - status = nvxx_general_powerup(); - break; - case 0x00fd10de: /* Nvidia Quadro PCX PCIe */ - si->ps.card_type = NV45; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia Quadro PCX PCIe"); - sprintf(si->adi.chipset, "NV45"); - status = nvxx_general_powerup(); - break; - case 0x00fe10de: /* Nvidia Quadro FX 1300 PCIe(?) */ - si->ps.card_type = NV36; - si->ps.card_arch = NV30A; - sprintf(si->adi.name, "Nvidia Quadro FX 1300 PCIe(?)"); - sprintf(si->adi.chipset, "NV36(?)"); - status = nvxx_general_powerup(); - break; - case 0x00ff10de: /* Nvidia GeForce PCX 4300 PCIe */ - si->ps.card_type = NV18; - si->ps.card_arch = NV10A; - sprintf(si->adi.name, "Nvidia GeForce PCX 4300 PCIe"); - sprintf(si->adi.chipset, "NV18"); - status = nvxx_general_powerup(); - break; - case 0x010010de: /* Nvidia GeForce256 SDR */ - case 0x010110de: /* Nvidia GeForce256 DDR */ - case 0x010210de: /* Nvidia GeForce256 Ultra */ - si->ps.card_type = NV10; - si->ps.card_arch = NV10A; - sprintf(si->adi.name, "Nvidia GeForce256"); - sprintf(si->adi.chipset, "NV10"); - status = nvxx_general_powerup(); - break; - case 0x010310de: /* Nvidia Quadro */ - si->ps.card_type = NV10; - si->ps.card_arch = NV10A; - sprintf(si->adi.name, "Nvidia Quadro"); - sprintf(si->adi.chipset, "NV10"); - status = nvxx_general_powerup(); - break; - case 0x011010de: /* Nvidia GeForce2 MX/MX400 */ - case 0x011110de: /* Nvidia GeForce2 MX100/MX200 DDR */ - si->ps.card_type = NV11; - si->ps.card_arch = NV10A; - sprintf(si->adi.name, "Nvidia GeForce2 MX"); - sprintf(si->adi.chipset, "NV11"); - status = nvxx_general_powerup(); - break; - case 0x011210de: /* Nvidia GeForce2 Go */ - si->ps.card_type = NV11; - si->ps.card_arch = NV10A; - si->ps.laptop = true; - sprintf(si->adi.name, "Nvidia GeForce2 Go"); - sprintf(si->adi.chipset, "NV11"); - status = nvxx_general_powerup(); - break; - case 0x011310de: /* Nvidia Quadro2 MXR/EX/Go */ - si->ps.card_type = NV11; - si->ps.card_arch = NV10A; - sprintf(si->adi.name, "Nvidia Quadro2 MXR/EX/Go"); - sprintf(si->adi.chipset, "NV11"); - status = nvxx_general_powerup(); - break; - case 0x014010de: /* Nvidia GeForce FX 6600 GT */ - case 0x014110de: /* Nvidia GeForce FX 6600 */ - case 0x014210de: /* Nvidia GeForce FX 6600LE */ - si->ps.card_type = NV43; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce FX 6600"); - sprintf(si->adi.chipset, "NV43"); - status = nvxx_general_powerup(); - break; - case 0x014310de: /* Nvidia GeForce 6600 VE */ - si->ps.card_type = NV43; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce 6600 VE"); - sprintf(si->adi.chipset, "NV43"); - status = nvxx_general_powerup(); - break; - case 0x014410de: /* Nvidia GeForce FX 6600 Go */ - si->ps.card_type = NV43; - si->ps.card_arch = NV40A; - si->ps.laptop = true; - sprintf(si->adi.name, "Nvidia GeForce FX 6600 Go"); - sprintf(si->adi.chipset, "NV43"); - status = nvxx_general_powerup(); - break; - case 0x014510de: /* Nvidia GeForce FX 6610 XL */ - si->ps.card_type = NV43; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce FX 6610 XL"); - sprintf(si->adi.chipset, "NV43"); - status = nvxx_general_powerup(); - break; - case 0x014710de: /* Nvidia GeForce FX 6700 XL */ - si->ps.card_type = NV43; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce FX 6700 XL"); - sprintf(si->adi.chipset, "NV43"); - status = nvxx_general_powerup(); - break; - case 0x014610de: /* Nvidia GeForce FX 6600 TE Go / 6200 TE Go */ - case 0x014810de: /* Nvidia GeForce FX 6600 Go */ - case 0x014910de: /* Nvidia GeForce FX 6600 GT Go */ - si->ps.card_type = NV43; - si->ps.card_arch = NV40A; - si->ps.laptop = true; - sprintf(si->adi.name, "Nvidia GeForce FX 6600Go/6200Go"); - sprintf(si->adi.chipset, "NV43"); - status = nvxx_general_powerup(); - break; - case 0x014b10de: /* Nvidia unknown FX */ - case 0x014c10de: /* Nvidia Quadro FX 540 MXM */ - case 0x014d10de: /* Nvidia unknown FX */ - si->ps.card_type = NV43; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia Quadro FX"); - sprintf(si->adi.chipset, "NV43"); - status = nvxx_general_powerup(); - break; - case 0x014e10de: /* Nvidia Quadro FX 540 */ - si->ps.card_type = NV43; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia Quadro FX 540"); - sprintf(si->adi.chipset, "NV43"); - status = nvxx_general_powerup(); - break; - case 0x014f10de: /* Nvidia GeForce 6200 PCIe (128Mb) */ - si->ps.card_type = NV44; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce 6200 PCIe 128Mb"); - sprintf(si->adi.chipset, "NV44"); - status = nvxx_general_powerup(); - break; - case 0x015010de: /* Nvidia GeForce2 GTS/Pro */ - case 0x015110de: /* Nvidia GeForce2 Ti DDR */ - case 0x015210de: /* Nvidia GeForce2 Ultra */ - si->ps.card_type = NV15; - si->ps.card_arch = NV10A; - sprintf(si->adi.name, "Nvidia GeForce2"); - sprintf(si->adi.chipset, "NV15"); - status = nvxx_general_powerup(); - break; - case 0x015310de: /* Nvidia Quadro2 Pro */ - si->ps.card_type = NV15; - si->ps.card_arch = NV10A; - sprintf(si->adi.name, "Nvidia Quadro2 Pro"); - sprintf(si->adi.chipset, "NV15"); - status = nvxx_general_powerup(); - break; - case 0x016010de: /* Nvidia GeForce 6500 Go */ - si->ps.card_type = NV44; - si->ps.card_arch = NV40A; - si->ps.laptop = true; - sprintf(si->adi.name, "Nvidia GeForce 6500 Go"); - sprintf(si->adi.chipset, "NV44"); - status = nvxx_general_powerup(); - break; - case 0x016110de: /* Nvidia GeForce 6200 TurboCache */ - si->ps.card_type = NV44; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce 6200 TC"); - sprintf(si->adi.chipset, "NV44"); - status = nvxx_general_powerup(); - break; - case 0x016210de: /* Nvidia GeForce 6200SE TurboCache */ - si->ps.card_type = NV44; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce 6200SE TC"); - sprintf(si->adi.chipset, "NV44"); - status = nvxx_general_powerup(); - break; - case 0x016310de: /* Nvidia GeForce 6200LE */ - si->ps.card_type = NV44; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce 6200LE"); - sprintf(si->adi.chipset, "NV44"); - status = nvxx_general_powerup(); - break; - case 0x016410de: /* Nvidia GeForce FX 6200 Go */ - si->ps.card_type = NV44; - si->ps.card_arch = NV40A; - si->ps.laptop = true; - sprintf(si->adi.name, "Nvidia GeForce FX 6200 Go"); - sprintf(si->adi.chipset, "NV44"); - status = nvxx_general_powerup(); - break; - case 0x016510de: /* Nvidia Quadro FX NVS 285 */ - si->ps.card_type = NV44; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia Quadro FX NVS 285"); - sprintf(si->adi.chipset, "NV44"); - status = nvxx_general_powerup(); - break; - case 0x016610de: /* Nvidia GeForce 6400 Go */ - si->ps.card_type = NV44; - si->ps.card_arch = NV40A; - si->ps.laptop = true; - sprintf(si->adi.name, "Nvidia GeForce 6400 Go"); - sprintf(si->adi.chipset, "NV44"); - status = nvxx_general_powerup(); - break; - case 0x016710de: /* Nvidia GeForce 6200 Go */ - si->ps.card_type = NV44; - si->ps.card_arch = NV40A; - si->ps.laptop = true; - sprintf(si->adi.name, "Nvidia GeForce 6200 Go"); - sprintf(si->adi.chipset, "NV44"); - status = nvxx_general_powerup(); - break; - case 0x016810de: /* Nvidia GeForce 6400 Go */ - si->ps.card_type = NV44; - si->ps.card_arch = NV40A; - si->ps.laptop = true; - sprintf(si->adi.name, "Nvidia GeForce 6400 Go"); - sprintf(si->adi.chipset, "NV44"); - status = nvxx_general_powerup(); - break; - case 0x016910de: /* Nvidia GeForce 6250 Go */ - si->ps.card_type = NV44; - si->ps.card_arch = NV40A; - si->ps.laptop = true; - sprintf(si->adi.name, "Nvidia GeForce 6250 Go"); - sprintf(si->adi.chipset, "NV44"); - status = nvxx_general_powerup(); - break; - case 0x016a10de: /* Nvidia 7100 GS */ - si->ps.card_type = NV44; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia GeForce 7100 GS"); - sprintf(si->adi.chipset, "NV44"); - status = nvxx_general_powerup(); - break; - case 0x016b10de: /* Nvidia unknown FX Go */ - case 0x016c10de: /* Nvidia unknown FX Go */ - case 0x016d10de: /* Nvidia unknown FX Go */ - si->ps.card_type = NV44; - si->ps.card_arch = NV40A; - si->ps.laptop = true; - sprintf(si->adi.name, "Nvidia unknown FX Go"); - sprintf(si->adi.chipset, "NV44"); - status = nvxx_general_powerup(); - break; - case 0x016e10de: /* Nvidia unknown FX */ - si->ps.card_type = NV44; - si->ps.card_arch = NV40A; - sprintf(si->adi.name, "Nvidia unknown FX"); - sprintf(si->adi.chipset, "NV44"); - status = nvxx_general_powerup(); - break; - case 0x017010de: /* Nvidia GeForce4 MX 460 */ - case 0x017110de: /* Nvidia GeForce4 MX 440 */ - case 0x017210de: /* Nvidia GeForce4 MX 420 */ - case 0x017310de: /* Nvidia GeForce4 MX 440SE */ - si->ps.card_type = NV17; - si->ps.card_arch = NV10A; - sprintf(si->adi.name, "Nvidia GeForce4 MX"); - sprintf(si->adi.chipset, "NV17"); - status = nvxx_general_powerup(); - break; - case 0x017410de: /* Nvidia GeForce4 440 Go */ - case 0x017510de: /* Nvidia GeForce4 420 Go */ - case 0x017610de: /* Nvidia GeForce4 420 Go 32M */ - case 0x017710de: /* Nvidia GeForce4 460 Go */ - case 0x017910de: /* Nvidia GeForce4 440 Go 64M (on PPC GeForce4 MX) */ - si->ps.card_type = NV17; - si->ps.card_arch = NV10A; - si->ps.laptop = true; - sprintf(si->adi.name, "Nvidia GeForce4 Go"); - sprintf(si->adi.chipset, "NV17"); - status = nvxx_general_powerup(); - break; - case 0x017810de: /* Nvidia Quadro4 500 XGL/550 XGL */ - case 0x017a10de: /* Nvidia Quadro4 200 NVS/400 NVS */ - si->ps.card_type = NV17; - si->ps.card_arch = NV10A; - sprintf(si->adi.name, "Nvidia Quadro4"); - sprintf(si->adi.chipset, "NV17"); - status = nvxx_general_powerup(); - break; - case 0x017c10de: /* Nvidia Quadro4 500 GoGL */ - si->ps.card_type = NV17; - si->ps.card_arch = NV10A; - si->ps.laptop = true; - sprintf(si->adi.name, "Nvidia Quadro4 500 GoGL"); - sprintf(si->adi.chipset, "NV17"); - status = nvxx_general_powerup(); - break; - case 0x017d10de: /* Nvidia GeForce4 410 Go 16M*/ - si->ps.card_type = NV17; [... truncated: 768 lines follow ...] From anevilyak at gmail.com Mon Jun 9 16:43:01 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Mon, 9 Jun 2008 09:43:01 -0500 Subject: [Haiku-commits] r25873 - in haiku/trunk/src/add-ons/accelerants: . nvidia_gpgpu nvidia_gpgpu/engine In-Reply-To: <200806091437.m59Eb6dk031089@sheep.berlios.de> References: <200806091437.m59Eb6dk031089@sheep.berlios.de> Message-ID: Hi Rudolf :) On Mon, Jun 9, 2008 at 9:37 AM, rudolfc at BerliOS wrote: > Author: rudolfc > Date: 2008-06-09 16:37:03 +0200 (Mon, 09 Jun 2008) > New Revision: 25873 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25873&view=rev > I'm just curious, wasn't gpgpu a previous name for what nvidia now refers to as CUDA? Are you planning on implementing support for something like this? Regards, Rene From axeld at pinc-software.de Mon Jun 9 16:52:17 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 09 Jun 2008 16:52:17 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r25873_-_in_haiku/trunk/src/add-ons/acc?= =?utf-8?q?elerants=3A_=2E_nvidia=5Fgpgpu_nvidia=5Fgpgpu/engine?= In-Reply-To: <200806091437.m59Eb6dk031089@sheep.berlios.de> Message-ID: <27305813453-BeMail@zon> rudolfc at BerliOS wrote: > Log: > copied nvidia driver over to nvidia_gpgpu driver. Does nothing but > compile. > I hope to be fidding around with a EN8500GT soon. If for some reason > I shouldn't be > creating these folders, feel free to remove it again, and let me know > :) Depends on what you will do with it. If it's for a new driver, then this is certainly appreciated (even though the naming is a bit questionable IMO) :-) If you are just playing around with an existing driver, a branch would be the preferred method. Bye, Axel. From rudolfc at mail.berlios.de Mon Jun 9 16:53:17 2008 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Mon, 9 Jun 2008 16:53:17 +0200 Subject: [Haiku-commits] r25874 - in haiku/trunk/headers/private/graphics: . nvidia_gpgpu Message-ID: <200806091453.m59ErHMD000179@sheep.berlios.de> Author: rudolfc Date: 2008-06-09 16:53:17 +0200 (Mon, 09 Jun 2008) New Revision: 25874 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25874&view=rev Added: haiku/trunk/headers/private/graphics/nvidia_gpgpu/ Modified: haiku/trunk/headers/private/graphics/nvidia_gpgpu/DriverInterface.h Log: headers for nvidia_gpgpu driver Copied: haiku/trunk/headers/private/graphics/nvidia_gpgpu (from rev 25869, haiku/trunk/headers/private/graphics/nvidia) Modified: haiku/trunk/headers/private/graphics/nvidia_gpgpu/DriverInterface.h =================================================================== --- haiku/trunk/headers/private/graphics/nvidia/DriverInterface.h 2008-06-08 20:34:49 UTC (rev 25869) +++ haiku/trunk/headers/private/graphics/nvidia_gpgpu/DriverInterface.h 2008-06-09 14:53:17 UTC (rev 25874) @@ -16,9 +16,8 @@ #include #include #include -#include "AGP.h" -#define DRIVER_PREFIX "nvidia" +#define DRIVER_PREFIX "nvidia_gpgpu" #define DEVICE_FORMAT "%04x_%04x_%02x%02x%02x" /* @@ -33,7 +32,7 @@ int32 ben; } benaphore; -#define INIT_BEN(x) x.sem = create_sem(0, "NV "#x" benaphore"); x.ben = 0; +#define INIT_BEN(x) x.sem = create_sem(0, "NV_GPGPU "#x" benaphore"); x.ben = 0; #define AQUIRE_BEN(x) if((atomic_add(&(x.ben), 1)) >= 1) acquire_sem(x.sem); #define RELEASE_BEN(x) if((atomic_add(&(x.ben), -1)) > 1) release_sem(x.sem); #define DELETE_BEN(x) delete_sem(x.sem); @@ -68,8 +67,6 @@ NV_SET_PCI, NV_DEVICE_NAME, NV_RUN_INTERRUPTS, - NV_GET_NTH_AGP_INFO, - NV_ENABLE_AGP, NV_ISA_OUT, NV_ISA_IN }; @@ -221,8 +218,6 @@ bool usebios; bool hardcursor; bool switchhead; - bool force_pci; - bool unhide_fw; bool pgm_panel; bool dma_acc; bool vga_on_tv; @@ -315,7 +310,6 @@ uint32 free; /* nr. of useable free 32-bit words remaining in buffer */ uint32 max; /* command buffer's useable size in 32-bit words */ } dma; - bool agp_mode; /* card is running in AGP mode */ struct { uint32 clones; /* clone 'number' (mask, slot) (one bit per clone) */ uint32 reload; /* reload state and surfaces (one bit per clone) */ @@ -443,23 +437,6 @@ char *name; /* The name of the device, less the /dev root */ } nv_device_name; -/* Retrieve an AGP device interface if there. Usefull to find the AGP speed scheme -used (pre 3.x or 3.x) */ -typedef struct { - uint32 magic; /* magic number to make sure the caller groks us */ - bool agp_bus;/* indicates if we have access to the AGP busmanager */ - uint8 index; /* device index in list of devices found */ - bool exist; /* we got AGP device info */ - agp_info agpi; /* AGP interface info of a device */ -} nv_nth_agp_info; - -/* Execute an AGP command */ -typedef struct { - uint32 magic; /* magic number to make sure the caller groks us */ - bool agp_bus;/* indicates if we have access to the AGP busmanager */ - uint32 cmd; /* actual command to execute */ -} nv_cmd_agp; - /* Read or write a value in ISA I/O space */ typedef struct { uint32 magic; /* magic number to make sure the caller groks us */ From rudolfc at mail.berlios.de Mon Jun 9 16:54:33 2008 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Mon, 9 Jun 2008 16:54:33 +0200 Subject: [Haiku-commits] r25875 - in haiku/trunk/src/add-ons/kernel/drivers/graphics: . nvidia_gpgpu Message-ID: <200806091454.m59EsXsO000242@sheep.berlios.de> Author: rudolfc Date: 2008-06-09 16:54:32 +0200 (Mon, 09 Jun 2008) New Revision: 25875 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25875&view=rev Added: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/ Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/Jamfile haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/Jamfile haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/README.html haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/UPDATE.html haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/driver.c Log: kerneldriver for nvidia gpgpu driver Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/Jamfile 2008-06-09 14:53:17 UTC (rev 25874) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/Jamfile 2008-06-09 14:54:32 UTC (rev 25875) @@ -6,6 +6,7 @@ SubInclude HAIKU_TOP src add-ons kernel drivers graphics matrox ; SubInclude HAIKU_TOP src add-ons kernel drivers graphics neomagic ; SubInclude HAIKU_TOP src add-ons kernel drivers graphics nvidia ; +SubInclude HAIKU_TOP src add-ons kernel drivers graphics nvidia_gpgpu ; SubInclude HAIKU_TOP src add-ons kernel drivers graphics radeon ; SubInclude HAIKU_TOP src add-ons kernel drivers graphics s3 ; SubInclude HAIKU_TOP src add-ons kernel drivers graphics tdfx ; Copied: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu (from rev 25872, haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia) Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/Jamfile 2008-06-09 13:01:58 UTC (rev 25872) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/Jamfile 2008-06-09 14:54:32 UTC (rev 25875) @@ -1,21 +1,21 @@ -SubDir HAIKU_TOP src add-ons kernel drivers graphics nvidia ; +SubDir HAIKU_TOP src add-ons kernel drivers graphics nvidia_gpgpu ; SetSubDirSupportedPlatformsBeOSCompatible ; UsePrivateHeaders graphics ; -UsePrivateHeaders [ FDirName graphics nvidia ] ; +UsePrivateHeaders [ FDirName graphics nvidia_gpgpu ] ; -KernelAddon nvidia : +KernelAddon nvidia_gpgpu : driver.c ; -Package haiku-nvidia-cvs : +Package haiku-nvidia_gpgpu-cvs : README.html UPDATE.html ; -Package haiku-nvidia-cvs : - nvidia : +Package haiku-nvidia_gpgpu-cvs : + nvidia_gpgpu : boot home config add-ons kernel drivers bin ; -PackageDriverSymLink haiku-nvidia-cvs : graphics nvidia ; -Package haiku-nvidia-cvs : - nvidia.settings : +PackageDriverSymLink haiku-nvidia_gpgpu-cvs : graphics nvidia_gpgpu ; +Package haiku-nvidia_gpgpu-cvs : + nvidia_gpgpu.settings : boot home config settings kernel drivers ; Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/README.html =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/README.html 2008-06-09 13:01:58 UTC (rev 25872) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/README.html 2008-06-09 14:54:32 UTC (rev 25875) @@ -2,247 +2,32 @@ - Readme for Haiku Unified Nvidia graphics driver + Readme for Haiku Unified Nvidia GPGPU graphics driver -

Unified Nvidia graphics driver for Haiku



+

Unified Nvidia GPGPU graphics driver for Haiku




NOTE PLEASE:
You use this software at your own risk! Although I don't expect it to damage your PC, videocard or Monitor, I cannot guarantee this!


Supported cards (as far as is known):

    -
  • TNT 1/2; -
  • TNT 2-M64; -
  • Vanta/Aladdin TNT2; -
  • GeForce 256; -
  • GeForce 2 MX/Ti/GTS/Go; -
  • GeForce 2 Integrated GPU (Nforce); -
  • GeForce 3 (Ti); -
  • GeForce 4 MX/Ti/Go; -
  • GeForce 4 Integrated GPU (Nforce 2); -
  • GeForce (4 MX) PCX 4300; -
  • GeForce FX/PCX 5xxx/Go; -
  • GeForce FX/PCX 6xxx/Go; -
  • GeForce FX/PCX 7xxx/Go; -
  • Quadro (2/4/FX/PCX/Go); +
  • None yet (will be G80+, I hope, also known as General Purpose GPU architecture cards);


Features:

    -
  • Hardware cursor support (on both heads on dualhead cards); -
  • Full 2D acceleration; -
  • Basic 3D acceleration for older cards: see the seperately available 3D accelerant's documentation for details; -
  • Full BWindowScreen support (used for hardware pageflipping, scrolling/panning and acceleration in applications/games); -
  • DPMS support for both DVI and most laptop panels, and for analog connected screens (on both heads on dualhead cards), but not (yet?) for external DVI panels on laptops; -
  • B_YCbCr422 hardware overlay support on both TNT and GeForce series cards, except for GeForce 6xxx and 7xxx series (GeForce 6800 works though). Overlay output 'follows head' in dualhead stretch/switch modes; -
  • Dualhead support on GeForce dualhead cards (use 'Dualhead Setup' from BeBits for now); -
  • DVI and laptop panel support; -
  • Widescreen mode support (all screens must be widescreen type and they must all be digitally connected); -
  • Basic AGP mode support on AGP cards, using the new (seperate) Haiku AGP busmanager; -
  • Basic ('legacy') PCIe support; -
  • Coldstart support for analog connected screens on most cards except TNT1, GeForce 6xxx and 7xxx series; -
  • TVout support on cards with Brooktree BT868/BT869 and Conexant CX25870/CX25871 encoders (use 'Dualhead Setup' 0.04 from BeBits for now). +
  • None (yet?).
Known limitations:
    -
  • If you want BScreen 'Sync_to_Retrace' capability make sure you enabled 'assign IRQ to VGA card' in your system BIOS (if available); -
  • If the driver still seems to create 'random' trouble make sure you have a fully functional VGA BIOS, or system BIOS for embedded cards (check for updates on the manufacturor's site). Make sure you mail me if you still have trouble but also if this version fixed that! -
  • If on a laptop the internal panel doesn't work when you connect an external monitor, make sure you set 'output device selection' to 'internal' (instead of 'auto') in the system BIOS if it has such an option. If you have this symptom on a normal card, or on a laptop without that BIOS option then you are probably out of luck for dualhead support; -
  • NV40 architecture cards: (GeForce 6xxx, but 6800 AGP seems to be OK)
    - Secondary analog monitor detection doesn't work and we can't control very well to which connector the card's output gets routed (lack of specs). This means you might have to experiment a bit with the way you connect your monitor to the card. A single analog or DVI screen should work OK, and two analog screens should be OK as well. +
  • Everything.


-

Installation:

-If you encounter bugs, please checkout the driver's website to see if it's already on the todo list. You can also checkout the UPDATE file included with this driver to see if it should have been fixed. If you think it's prudent, or if you are unsure, then please fill out the bugreport form on the site or send me an Email. Make sure you are as precise as possible because that will make things easier to trackdown and fix...

-
-OK, now that's all said let's get to it ;-)
-
-In contrary to what I have said before you don't need to de-install official Be drivers for this driver to work correctly. This driver will install in the user part of the BeOS, so not in the system part where the official drivers are.
-BeOS first checks (during boot) if there are 'user-addons' that should be loaded for a device. If not, it loads it's own drivers (if any). You can select which driver should be loaded by hitting the spacebar as soon as the BeOS 'icons' screen appears. If you select disable user addons the system will load it's own drivers. If you don't do anything, the system will load the Haiku Nvidia TNT/GeForce graphics driver.
-
-Note: This might turn out to be handy if you run into trouble upon testing the driver, or if you are 'tweaking' the nv.settings file...
-

-actual INSTALLATION:
-
-Doubleclick on the install.sh file and follow the instructions. You have to reboot in order to load the driver. Make sure you read the Settings information below before you do that...
-
-
-alternate INSTALLATION method:
-
-Unzip the zip file that contains the driver to the root folder. Now reboot and you should be using the new driver.
-
-
-DE-INSTALLATION:
-
-Currently there's no uninstall script included. Just do it manually:
-
-Delete the nv.accelerant file in home/config/add-ons/accelerants/
-Delete the nv.driver file in home/config/add-ons/kernel/drivers/bin/
-Delete the nv.settings file in home/config/settings/kernel/drivers/
-Delete the nv.driver shortcut in home/config/add-ons/kernel/drivers/dev/graphics/ which pointed to the file nv.driver.
-
-You have to reboot in order to apply the original configuration.
-
-
-
-

Settings:


-Please read this information carefully *before* installing and using the Haiku Nvidia TNT/GeForce graphics driver. It might spare you some trouble afterwards..
-

The driver uses a file named nv.settings to determine how to use your card. After installation this file will be located at home/config/settings/kernel/drivers/. How you should setup this file depends on what you want to do with the driver. While it has a 'failsave' default configuration, you might be able to do better than that... Anyway, read the nifty details below.
-
-Note: The driver only reads this file during it's initialisation. This means that you have to reboot in order to let changes take effect.
-
-
-
-nv.settings driver configuration:
-

    -
  • usebios:
    -The name of this item may be somewhat misleading, it might be changed in the future. It actually tells the driver if it should coldstart the card or not. The driver will rely on the VGA BIOS to have coldstarted the card before BeOS booted if you specify 'true'.
    -To make things look even more complex the driver might actually use the BIOS to determine your cards specifications on *both* possible settings. -
      -
    • false:
      - If you specify usebios false the driver will attempt to coldstart the card, which is the preferred way of doing it because of the better tuned setup if all is right. Unfortunately there's not enough info available to make this work reliably, so it's not used by default. This setting would enable you to use your nVidia card as a secondary card in your system. Be advised though that BeOS officially does not (yet) support multiple VGA cards, so you need special software in order to be able to actually use it (a video consumer node for instance). -
    • true: (default setting)
      - Specify usebios true unless you want to try to use a nVidia card as a secondary card in your system. -
    - Notes: -
      -
    • On driverversion 0.23 and before usebios had no effect at all. The cards were never coldstarted; -
    • Coldstarting should work on most cards except TNT1, GeForce 6xxx and GeForce 7xxx; -
    • Coldstarting will not yet work with laptop- and DVI panels. -
    -
  • memory: (disabled by default)
    - This option enables you to override the 'memory amount autodetection' of the driver. If autodetection is working incorrect, you can manually set the amount this way. You could also lower the amount of RAM to a lower value than actually there to test with for instance overlay use in applications. So this option is probably mostly of interest to developers. Specify the RAM amount in Mb (use only 'whole' numbers!).
    -This option is disabled by default (preceded by a '#').
    -
  • hardcursor:
    - A hardcursor is nessesary for DirectWindow windowed mode support. -
      -
    • false:
      - If you have trouble with the hardcursor (on one or both of the heads), select hardcursor false. Make sure you let me know about the hardcursor trouble also: this should not happen! -
    • true: (default setting)
      - A software cursor 'flickers' a bit sometimes because it has to be redrawn constantly. So hardcursor true is the preferred setting. For DirectWindow windowed mode functionality you need to use this setting also (Chart demo app for instance). -
    -
  • logmask: (set to disabled by default)
    -The logmask option is very handy to track down trouble in the driver. You should only enable this if you are doing so, otherwise keep it turned off because it slows down your system. (All lines have a '#' preceding 'logmask' by default.) Logging creates a logfile called nv.(/dev/graphics name).0.log in your ~ (home) folder. A second logfile may get created depending on how the driver is used (on cloning; for BWindowScreen for example). The second file is called nv.(/dev/graphics name).1.log, and it will also be in your home folder.
    -Note: -
      -
    • You may only enable *one* logmask-line. The value you place after it (hexadecimal 32bit) determines what will be logged. The first 7 digits determine the part of the driver that will be logging, the last single digit determines the level of logging (like 'all messages', or only 'error messages'). -
    -
  • dumprom:
    -Dumprom is another 'tool' for bug-tracking purposes. -
      -
    • false: (default setting)
      - Keep it set to dumprom false, unless you want the driver to dump the contents of your VGA BIOS ROM in a file. -
    • true:
      - dumprom true lets the driver dump a copy of your VGA BIOS in a file called nv.(/dev/graphics name).rom in your ~ (home) folder. -
    -
  • switchhead:
    -The driver always autodetects which output should be used as primary one, but you can let the driver 'invert' the outcome of that detection with this option (only for dualhead cards). -
      -
    • false: (default setting)
      - Keep it set to switchhead false, unless you feel you want the card's other output to be used as primary one. Note that if a single connected screen is found, that screen will be the driver's primary output with this setting. -
    • true:
      - switchhead true lets the driver 'invert' the output assignments for all modes. Use only when you have two screens connected, otherwise the one connected screen will remain black as the other (not connected) output is being used.
      -
    -Note: -
      -
    • If the driver determines it cannot use a digital panel despite it being physically connected and powered on, using the switchhead option will not fix this. This is no fault in your card or the panel, but happens only because the driver relies on certain functions inside your cards BIOS to behave in a certain way. -
    -
  • force_pci:
    -On AGP cards you can block the use of AGP mode transfers. -
      -
    • false: (default setting)
      -Keep this option set to force_pci false, unless the graphics card or motherboard has trouble using AGP. -
    • true:
      -force_pci true prevents the graphicsdriver from activating AGP mode, so it will be using PCI mode like it has always been in the past. The downside of this is that this comes at a performance penalty if your motherboard supports the AGP 'fastwrite' (FW) option, which won't be utilized with this setting. -
    -Note: -
      -
    • If you have trouble using AGP mode, you should prefer tweaking the AGP busmanager settings file as it might well enable you to use a 'lesser' AGP mode instead of falling back to PCI mode alltogether. -
    -
  • dma_acc:
    -You can select one of two methods for (2D) acceleration here: PIO mode and DMA mode. DMA mode works 4-10 times as fast as PIO mode on modern CPU's (beyond 2Ghz or so), and should still be 2-3 times as fast as PIO mode on slower CPU's (below 500Mhz). -
      -
    • false:
      -If the default setting does not work as expected, you can try falling back to PIO mode acceleration. Note however that PIO mode is currently not working on NV40 and higher GPU's (GeForce 6200, 6600, 6800 and 7800 like types). Also, chances are that this method of acceleration will be removed in future driverversions (so be sure to let me know if you are having trouble with DMA mode!). -
    • true: (default setting)
      -dma_acc true enables DMA cmd fetching by the GPU for (2D) acceleration instead of using the old PIO method (which directly programs acceleration commands inside the GPU). The DMA method works (much) faster than PIO mode depending on system CPU speed. Also the DMA method is the only method that works on NV40 and higher GPU's (GeForce 6xxx and 7xxx series) currently. -
    -
  • tv_output: (disabled by default: preceded by a '#')
    - This option enables you to override the 'TV output signal cable autodetection' of the driver. If autodetection is working incorrect, you can manually select a signal type this way. Specify 0, 1 or 2 (if enabled).
    -
      -
    • disabled or 0: (default setting)
      - With this setting the driver will autodetect which signal(s) to output for a TVout mode. Normally you can leave it at that: but it's possible that the manufacturor of your card and/or TVset made a mistake in their design concerning line 'impedance'. In this case the driver might detect incorrectly leaving you with a (almost) black-and-white or color-distorted TV picture. In such a case you would probably like to instruct the driver what signals to output, overruling the autodetection result. -
    • 1:
      - Force Y/C (and CVBS if supported by hardware). Use this setting if you use a Y/C cable with or without a CVBS cable (some cards have both Y/C and CVBS outputs, so you can output a head to two sets at the same time). -
    • 2:
      - Force CVBS on all outputs. Use this setting if you use CVBS cable(s) only. -
    -Notes: -
      -
    • Y/C stands for Luminance/Chrominance, or S-VHS. This signal is transferred using a 4 (or more) pins mini-DIN connector: two pins carry the color-info, and two pins carry the intensity-info. -
    • CVBS stands for 'Composite Video Baseband Signal' which means that '2 pins' carry both color- and intensity info 'frequency-multiplexed' (at the same time). This signal is transferred using a 'Tulip', 'Cinch' or RCA plugged cable (all the same thing). -
    • Y/C connections deliver a better image quality than CVBS connections do. Originally, CVBS connections were used for VHS video recorders (about 300 'vertical lines' horizontal resolution), while Y/C connections were used for S-VHS recorders (about 400 'vertical lines' horizontal resolution). -
    • Some cards only having a Y/C connector also have a seperate short cable with them which 'converts' the Y/C connector into a CVBS connector. If you use that you are in fact using a CVBS connection. -
    • TVsets that do not have a RCA and/or mini-DIN video connector might still be useable: most sets have a SCART connector. SCART has settings that can accomodate RGB (some sets on some inputs), Y/C and CVBS signals. You can get Y/C and CVBS to/from (switched) SCART adaptors seperately from stores. You need to set the switch (if there) to 'input', and select the signal type you want to use on your TVset. A/V stands for CVBS, and Y/C stands for Y/C. -
    • Turn the TVset on before setting a TVout mode if you use the driver's default 'autodetection' setting. You probably don't need to pre-select the correct TV input as turning the power on is mostly enough to enable all of the set's input 'impendances' enabling correct autodetection by the driver. -
    -
  • unhide_fw:
    -This option is only used if your card is running in AGP mode. It's a real tweak option. It's officially unsupported, and it's unknown if it can do harm to your card or system. It exists because using it can speedup unaccelerated graphics a lot. Think about video playback or playing quake2 in software rendering mode... -
      -
    • false: (default setting)
      -Keep this option set to unhide_fw false unless you are certain you want to try the 'unsupported' graphics speedup. NV15, NV18, NV28 and NV34 cards for example probably don't need it as they officially support the AGP FW (fastwrites) feature already. On cards supporting FW by default the unhide_fw option has no effect. -
    • true:
      -If you have an older card that officially doesn't support the AGP FW feature, you could possibly get this feature anyway by setting unhide_fw true. For instance (some) NV11 cards work nicely with AGP FW enabled this way and unaccelerated graphics speedup considerably. Please make sure that at the first sign of trouble (system hanging, displaying artifacts, etc) you disable this feature here again, or you might risk destroying your card and/or AGP slot. -
    -
  • pgm_panel:
    -This option only has an effect if you have a laptop panel or DVI panel connected. It's existing because it's currently impossible to setup the driver in a way every single panel outthere is happy about it. -
      -
    • false:
      -If you select pgm_panel false the driver will not program the panel's pixelclock (refreshrate). Instead it relies on your cardBIOS to have done that correctly. While this is probably the case, it might introduce some displaying errors every now and then. -
    • true: (default setting)
      -With the pgm_panel true setting, the driver will fix your panel's refreshrate to 60Hz. While this should be working on all panels outthere, some panels are particular picky about refreshrates below 60.0Hz (they shut off), and some other panels are particular picky about refreshrates above 60.0Hz (they shut off). While the driver requests the hardware to set 60.0Hz, this isn't exactly possible, so the actual setting is bound to be a tiny bit below or above 60.0Hz. -
    -
  • vga_on_tv:
    -This option only has an effect if you have a card with supported TV encoder chip when you use TV out modes. When set to true it provides a 'tweaked' dualhead clone mode for singlehead cards and dualhead cards using singlehead modes on TV. Because this special mode can possibly destroy old VGA monitors it's disabled by default. -
      -
    • false: (default setting)
      -If you select vga_on_tv false the driver will automatically shut-off your VGA (or DVI) monitor (by means of special internal DPMS settings) when a TVout mode is enabled on the head the monitor is connected to. This means that on singlehead cards and on dualhead cards using singlehead TV modes your only output will be on TV. This is the standard way of doing things. -
    • true: With this setting VGA (or DVI) output on a head is enabled concurrent with TV output on that head: that is if you select a TVout mode. This setting is a 'tweak' because the modeline used to drive your monitor is the same modeline that is used for the TV output. This means that the monitor picture positioning is probably a bit odd, in some modes it might distort somewhat, and the refreshrate will be 50Hz for PAL modes, and 60Hz for NTSC modes. Make sure you only enable this tweak if you know your monitor supports down to 50Hz refreshrate, and preferably has a failsafe built in that blocks output when out-of-range signals are sent to it (almost every newer monitor has this feature).
      -
    -
  • force_sync:
    -This option only has an effect on hardware accelerated 3D rendering. When set to true it forces the 3D screen updates to be synchronized to your screen's vertical retraces, preventing 'tearing' to occur. -
      -
    • false: (default setting)
      -If you select force_sync false the driver's 3D accelerant will render 3D scenes as fast as it can, without paying attention to the actual screen's refreshrate. The upside of this setting is that you can measure the actual rendering power your card has in a specific mode for a specific application (if that application supports benchmarking). The downside is that you'll be able to witness 'tearing': the effect of seeing random horizontal distortion 'stripes' onscreen, especially when the view moves fast in a horizontal direction (like looking around in a room in Quake2). If you need the last bit of rendering power because you run a heavy app on a relatively 'slow' card, this setting might be your best option: it's a bit faster than using force_sync true. -
    • true: With this setting all tearing effects should be gone. Another reason to use this setting would be 'fixing' the driver's fps (frames per second) rendered. That is, when you are using a screen mode that your card can render at least at the speed your screen's refreshrate is set to: In this case the fps will be virtually independant of the complexity of the rendered scenes. Hardcore gamers amongst us really want this feature to get 'fixed' latencies so they can issue (firing) commands at the exact right time...
      -
    -Note please: -
      -
    • Forcing vertical retrace synchronisation using the force_sync option 'overrules' retrace sync settings done in your applications: all applications will be synchronized to the vertical retrace events. -
    -
  • force_ws:
    -This option (if enabled) overrules the aspect ratio detection for screens inside the driver. When set to true it forces all monitors to be treated as widescreen types. -
      -
    • false: (default setting)
      -If you select force_ws false the driver will autodetect the screen's aspect ratio if it can, otherwise it will force 4:3 aspect. Screens that are connected with a DVI cable and screens inside a laptop are autodetected (according to the cardBIOS presets done), but analog connected screens will always make the driver block widescreen modes. Connected analog TV sets are always treated like widescreen devices though. -
    • true: With this setting all monitors are treated as being widescreen types. This setting should only be used if you are having trouble using a widescreen monitor, because on non-widescreen monitors there's a (small) chance of destroying them if used with a widescreen mode. So use this setting with care. -
    -
  • primary: (set to disabled by default)
    -Primary lets you force a certain card to be used as primary card in your system if you have multiple graphics cards installed: so it will display your desktop. To enable this (hack) feature uncomment this item and fill in the exact name of the card that is to be primary (as exported by the kerneldriver in /dev/graphics/). If you are going to select a card other than the one displaying your system's POST messages at bootup, make sure you also set 'usebios false' as otherwise the card(s) aren't coldstarted by the driver.
    -Note please: -
      -
    • DVI and laptop panels don't work yet with the 'usebios false' setting. Analog connected screens should work though. -
    • Coldstarting doesn't work on TNT1 and GeForce 6xxx/7xxx cards yet. -
    • Primary forces the primary card by preceding the exported name by a minus-sign (-) for the selected device. This ensures that this device will be listed at the top in the /dev/graphics/ folder, which is alphabetically ordered. Please make sure you enable the 'primary' feature on just one graphics driver, otherwise it's effect isn't 'guaranteed'. -
    -
-
-
Rudolf Cornelissen. -

(Page last updated on April 11, 2006)

+

(Page last updated on June 9, 2008)

Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/UPDATE.html =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html 2008-06-09 13:01:58 UTC (rev 25872) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/UPDATE.html 2008-06-09 14:54:32 UTC (rev 25875) @@ -4,245 +4,16 @@

Changes done for each driverversion:

-

head (SVN 0.84, Rudolf)

+

head (SVN 0.00, Rudolf)

    -
  • Fixed driver assuming enabling AGP mode succeeded on some occasions if it did not block it itself. Blocking AGP mode completely via the AGP busmanager (option 'block_agp') resulted in a crashing acceleration engine because it was setup for AGP transfers instead of using PCI transfers. Error was solved with help from user kraton. -
  • Fixed shared_info struct problem occuring when 3D 'accelerant' is used (tested Alpha 4.1): the TVencoder type definition list apparantly gets some memory assigned these days when done inside the definition of shared_info. Moved encoder list outside the shared_info definition. -
  • Updated naming for some previous unknown cards, added 25 new cards for support/recognition in the kernel driver and accelerant, being GF 6xxx, 7xxx and 8xxx types. Also two more nforce 6100 4x0 cards are recognized now. All cards listed in nvidia's official april 2007 ID list are now recognized.
    Note please:
      -
    • GF8xxx is recognized, but not supported. It looks like nVidia's card architecture was revised in such an extensive way that we probably best create a seperate accelerant for these cards. +
    • GF8xxx is recognized, but not supported. yet?
-

nv_driver 0.80 (Rudolf)

-
    -
  • Improved 3D speed related initialisation programming for NV11 and NV15: NV11 just gained 44% rendering speed, NV15 gained 21% speed. The GeForce2Ti (NV15) is the new winner: Quake 2 timedemo 1 runs at 28.3fps in 1024x768x32 mode @ 75Hz refreshrate (P4 2.8Ghz, fsb 533Mhz, AGP4x), while on the GeForce4MX (NV18) it keeps running at 26.3fps. The GeForce2MX (NV11) now runs at 18.9fps. -
  • Improved 3D speed related initialisation programming again. This time confirmed for NV11, NV15 and NV18 (so works on probably all NV1x cards): NV11 just gained another 43% rendering speed, NV15 gained another 60% speed, and NV18 gained 41% speed. The GeForce2Ti (NV15) is the definate winner: Quake 2 timedemo 1 runs at 45.4fps in 1024x768x32 mode @ 75Hz refreshrate (P4 2.8Ghz, fsb 533Mhz, AGP4x), while on the GeForce4MX (NV18) it now runs at 37.0fps. The GeForce2MX (NV11) now runs at 27.1fps. -
  • Improved 3D speed related initialisation programming for TNT2 and TNT2-M64 card types, TNT1 speed remains unchanged. The speed improvement depends on colorspace and exact card type: there's a 1-4% gain. TNT2 runs Quake 2 timedemo 1 at about 17fps in 1024x768x32 mode @ 75Hz refreshrate, while TNT2-M64 is at 10.2fps (P4 2.8Ghz, fsb 533Mhz, AGP mode). -
  • Added new nv.setting called 'force_ws' that forces all your connected screens to be treated as being widescreen types. This enables listing of the widescreen modes in most screen preference panels and the use of these modes. Only use this new option if appropriate of course, non-widescreen monitors might not like them! -
  • Added support for 23 new cards in the GeForce 6xxx and 7xxx range (7300 - G72; 7600 - G73; 7900 - G71), along with support for nVidia's latest IGP Nforce4 (GeForce 6100/6150 - NV44). All new ID's come from nVidia's own March 2006 ID release, except for one which was reported by a BeOS user. -
  • Fixed coldstart trouble on a number of cards probably (confirmed GeForce4 MX4000): Coldstarting must be performed in PCI mode as some cards reset their AGP PLL during this action. The driver now forces PCI mode before attempting a coldstart; AGP mode is re-enabled after that (if used).
    -Note please:
    -
      -
    • Forcing PCI mode doesn't work reliably with AGP busmanager V0.01. Please upgrade to AGP busmanager V0.02!! -
    -
-

nv_driver 0.74 (Rudolf)

-
    -
  • The overlay engine code now respects the B_OVERLAY_COLOR_KEY flag instead of forcing keying ON; -
  • Hook GET_ACCELERANT_DEVICE_INFO now returns much more detailed info about the card in use; -
  • Hooks INIT_ACCELERANT and CLONE_ACCELERANT now enforce their correct use; returning error B_NOT_ALLOWED in case of errors; -
  • Improved coldstart RAM tests for NV10 and higher: they could fail to correctly program the card on 'high-voltage' AGP 1.0 slots (confirmed a NV11); -
  • Added support for acceleration engine 2D command SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT (as defined by Be) for all cards; -
  • Fixed driver not always finding it's VGA BIOS when started and stopped more than once per system uptime 'session'; -
  • Fixed 'BScreen Sync-to-Retrace not working' bug that appeared on all dualhead cards when CRTC2 was used as primary CRTC. On some systems outthere this bug might have shown itself as a 'system (or app) hanging' error occuring while using apps that feature explicit retrace sync. Completely rewrote interrupt handling to now handle retrace syncs on both CRTC1 and CRTC2, although only the CRTC used as primary will be enabled (for now); -
  • Modified hardware 3D rendering colorspace setting for 32bit depth: this gives us upto some 11% gain on accelerated 3D rendering speed using the 3D accelerant; -
  • Added new nv.setting called 'force_sync': this option (if enabled) forces accelerated 3D rendering to be synchronized to the screen's vertical retrace (refreshrate). This option is disabled by default; -
  • Added new nv.setting called 'gpu_clk': this TWEAK! option (if enabled) forces the requested GPU clockspeed, as long as it's within certain sanity limits. This option might be handy for 3D application developers for determining bottlenecks (via underclocking), and it might be handy for hardcore gamers to overclock their graphics card. Be carefull with overclocking though: it might DESTROY your computer!! -
  • Added new nv.setting called 'ram_clk': this TWEAK! option (if enabled) forces the requested card-memory clockspeed, as long as it's within certain sanity limits. This option might be handy for 3D application developers for determining bottlenecks (via underclocking), and it might be handy for hardcore gamers to overclock their graphics card. Be carefull with overclocking though: it might DESTROY your computer!! -
-

nv_driver 0.67 (Rudolf)

-
    -
  • Added capability to driver to run without an INT assigned. Driver will now automatically disable the 'Sync_to_Retrace' function if no INT was assigned instead of not loading/running at all; -
  • Fixed PLL reference recognition (used for refreshrate calculations) and dualhead detection for a number of 'newer' cards: most notably for a lot of GeForce 6200 types! Code is rewritten so it's much less breakable when new cards are added to the supported list in the future; -
  • Added TVout support for Brooktree BT868/BT869 and Conexant CX25870/CX25871 TV encoders: NTSC and PAL 640x480 and 800x600 Desktop modes are supported, NTSC VCD 640x480 and DVD 720x480 Video modes are supported, PAL VCD 768x576 and DVD 720x576 Video modes are supported; -
  • Added 'force TV output signal type' (called tv_output) to nv.settings: Now you can select Y/C or CVBS output manually in case autodetection fails for your TV set. That might happen in case the TV and/or card manufacturor didn't adhere to the impedance specs that exist for these signals; -
  • Added detection for some ten new cards being Geforce 6600/6800 and 7800 types; -
  • Added 'force VGA output ON while TVout enabled' (called 'vga_on_tv') to nv.settings: Now the VGA (or DVI) screen is disabled by default for a head outputting to TV. You can turn it on however using this new preset setting. Note though: doing that is considered a tweak which might damage your screen (if it's an old one); -
  • Added custom modeflag for users to be able to select TVout head on a 'per mode' basis. The Dualhead Setup preference panel needs to be updated (to a version newer than 0.03a) to correctly issue this flag; -
  • Added rudimentary NV11 CRTC2 FIFO watermark/burst-size programming to remove/minimize vertical distortion stripes occuring on some cards due to data fetching errors (because of limited bandwidth); -
  • Modified NV05M64 (TNT2-M64) watermark/burst-size programming to be executed independant of coldstart feature; -
  • Updated acceleration engine DMA-mode initialisation code: This should fix trouble on some newer cards with acceleration, and also adds NV47 (G70) acceleration support; -
  • Added preliminary laptop panel DPMS support (except for NV11): currently only in use when no external DVI panels are connected. Please provide feedback on this item if you have a laptop (send a logfile along): only then can this feature be expanded/finalized! -
  • Added new nv.setting ("primary") to force a certain card to be primary card in a system with multiple graphics cards: so it will display your desktop. To enable this (hack) feature uncomment this item and fill in the exact name of the card that is to be primary (as exported by the kerneldriver in /dev/graphics/). If you are going to select a card other than the one displaying your system's POST messages at bootup, make sure you also set 'usebios false' as otherwise the card(s) aren't coldstarted by the driver.
    -Note please: -
      -
    • DVI and laptop panels don't work yet with the 'usebios false' setting. Analog connected screens should work though. -
    • Coldstarting doesn't work on TNT1 and GeForce 6xxx/7xxx cards yet. -
    -
-

nv_driver 0.53 (Rudolf)

-
    -
  • Added recognition for 10-15 more newer cards: mostly GeForce 6200, 6600 and 6800 types; -
  • Added 3D initialisation and updated 2D/3D command setup (defines and hash) for DMA acceleration (pre-NV40 only, 3D confirmed functional on TNT1 upto/including GeForce2Ti and GeForce4MX types: MX440 and MX4000 confirmed); -
  • Moved the DMA command buffer from graphics memory to main system memory, plus expanded it's size from 32kB to 1Mb. Buffer is mapped using MTRR-WC where available (confirmed speedups for both modifications; pre-NV40 only). Note that all TNT1 cards will be much faster with DMA acceleration now: the new mode is 'officially' working on them, while the old mode used a 'nasty' workaround; -
  • Graphics engine is now using AGP transfers for fetching commands from the DMA buffer where available. Note that direct memory accesses are used: GART and AGP aperture (scatter-gather) are not in use. (confirmed speedup for this modification); -
  • Concurrent overlay and 3D acceleration are now possible: no more acceleration engine hangs should occur now; -
  • Added shared_info flag to inform 3D add-on that it should reload it's rendering state whenever 2D commands are executed. This makes room for further speed improvements for 3D as it can minimize reloading rendering states; -
  • Added more shared_info flags to support upto 32 3D accelerants in a simple fashion. Texture memory allocation sharing support isn't there yet though. -
-

nv_driver 0.45 (Rudolf)

-
    -
  • Added recognition for one more card: a GeForce 6200 PCIe (ID 0x014f); -
  • Fixed long-standing trouble with NV15 cards (GeForce 2 Ti/GTS/pro/ultra, Quadro 2 pro), and maybe also for other singlehead cards. RAM access trouble is now fixed so the screen output nolonger distorts and engine hangs are gone. This error was 'introduced' in nVidia driver V0.10: V0.09 was the last previous version working correctly on some of these cards!
    -Note please that this fix was only possible thanks to someone donating a 'malfunctioning' card. So: thanks again Atilla!!
    -Note also: with 3D add-on alpha 1-final these NV15 cards are the fastest supported ones ;-) -
  • Fixed driver coldstart capability for pre-GeForce type cards using PINS V3-V5.15. Newer TNT2-M64 cards will now coldstart OK; -
  • Added pre-PINS V5.16 coldstart RAM-size check and correction code. This feature was still lacking and possibly solves coldstart trouble on pre-GeForce type cards; -
  • Added rudimentary CRTC1 FIFO watermark/burst-size programming for TNT2-M64 cards (if coldstarted). This minimizes output distortions on high resolutions. Note please that these distortions can't be completely removed: the RAM bandwidth these cards have is too limited: Bandwidth in increasing order: TNT2-M64, TNT1, TNT2 original, all GeForce types. With the TNT2-M64 watermark/burst-size programming in place it performs still less good than a TNT1 in this respect. -
-

nv_driver 0.43 (Rudolf)

-
    -
  • Updated 3D specific engine initialisation for PIO mode to make the 3D add-on work on pre-NV10 cards. It now works on NV04-NV18 (although NV18 is slow) if you select PIO mode acceleration; -
  • Added two shared_info 'flags' informing the 3D add-on about modeswitches when they happen. -
-

nv_driver 0.41 (Rudolf)

-
    -
  • Added new acceleration method using DMA command fetching. You can now choose beween (the old) PIO mode and (the new) DMA mode acceleration via a new switch in nv.settings (DMA mode is now the default). DMA acceleration is say 2-3 times as fast as PIO mode acceleration on systems with relative fast CPU's (above 2Ghz or so). On relative slow CPU's (500Mhz or lower) there is no speedgain left and both methods match about up.
    - Note please: On NV40 and higher only DMA mode acceleration currently works; -
  • Execution of acceleration commands (DMA mode) has been optimized (compared to PIO mode): now the top-level acceleration functions are incorporated in the engine, and the engine's command execution itself is also optimized. This further increases DMA mode acceleration with upto a factor of 2-3, independant of CPU speed; -
  • Execution of acceleration commands (PIO mode) is re-setup. Now it should be possible to use more engine commands than there are FIFO channels for them, by doing on-the-fly reconfiguring (DMA mode can do this also). This should be especially usefull when 3D acceleration is going to be setup later on; -
  • Added recognition for 20 new cards: Most GeForce 6200, 6600 and 6800 types are now recognized, and some more other cards as well; -
  • Modified cursor to be hardware synchronized to the screen's vertical retrace. This fixes the high CPU load on moving the mouse especially while being on the bottom of the screen (all GeForce series cards); -
  • Added DPMS support for digital flatpanels connected via DVI; -
  • Updated 'extended PLL' VCO limits: this (could) fix PLL locking trouble (shivering image / too low refreshrate) on NV31 (FX 5600), NV36 (FX/PCX 57xx) and NV40 and up (FX/PCX 6200, 6600 and 6800). Confirmed NV36, on a PCX 5750 for PCIe. -
-

nv_driver 0.30 (Rudolf)

-
    -
  • Overlay fix for GeForce2 and GeForce4 MX Integrated GPU boards: updated RAM amount detection. The last 64Kb RAM is used for the card's BIOS or something so it's not available to the graphicsdriver; -
  • Enabled coldstart switch setting (called 'usebios' in nv.settings) in drivercode. Changed the default setting to keep the driver working in the same way it did before; -
  • Added recognition for 25 new cards including the first PCI-express (PCX) cards: FX/PCX 6800, FX 6600, PCX 5300/5750/5900, PCX Quadro. New 'old style' cards: Quadro FX 700, Quadro FX 1000 Go, FX 5100 and FX 5700 Go. While FX6800 still seems to be non-functional, a Quadro4 280 NVS PCIe (GeForce PCX 5300 PCIe) has been confirmed working OK already; -
  • Card coldstarts should now be operational (if enabled in nv.settings) on most cards, except TNT1, GeForce 6600 and GeForce 6800. Tested successfully on TNT2/TNT2-M64 (NV05), GeForce2 MX400 (NV11), GeForce4 MX440 (NV18), GeForce4 Ti4200 (NV28) and GeForce FX5200 (NV34). Note however that laptop panels and DVI panels will not work via coldstarting yet! -
  • The 'bandwidth trouble' existing on older cards, especially on some GeForce2 types, should be fixed now if you enable card coldstarting for these cards. Note that this problem existed because of a fault in these card's BIOSes (they missed some specific register programming). Confirmed a NV15 working OK now. -
-

nv_driver 0.22 (Rudolf)

-
    -
  • Added AGP mode capability on AGP cards along with the option to block it in nv.settings. No GART and AGP aperture support; but if your card and system AGP host bridge support the 'fastwrite' (FW) feature, you'll notice a nice speedup of unaccelerated graphics. -
      -
    • Tested Quake 2 in software rendering mode over here using timedemo1 with demo1.dm2: framerates jumped up to 140% of the 'original' in AGP2.0 4X mode! -
    • Also tested video playback using bitmap output mode: CPU load drops considerably depending on desktop colordepth and size of the video output window.
      -
    • 2D acceleration will not speedup because it's working 'local', so within the graphics cards engine and it's RAM only. -
    -Note please:
    -
      -
    • You need the new (seperate) Haiku AGP busmanager module that has been setup for this feature, without it you will remain using PCI mode as usual. -
    • If you have trouble with AGP, you have the option to shut it off by setting 'force_pci true' in nv.settings. You are adviced however to tweak the AGP busmanager settings file instead, as this might enable you to keep using AGP mode, be it in a slower setting. -
    -
  • Updated CRTC modeline tuning for panels: this should fix the 'right-shifted' picture on some panels in their native modes; -
  • Fixed BIOS ROM dump (to file) option; -
  • Fixed GET_TIMING_CONSTRAINTS and GET_ACCELERANT_DEVICE_INFO accelerant hooks to return valid data; updated modeline checking and modification code (used by ProposeDisplayMode) to adhere to one more timing constraint -
  • Lowered fixed refreshrate setting for panels to be 60Hz now: it turns out panels exist that are picky 'on the high side' as well; -
  • Added option in nv.settings to block refreshrate programming if a flatpanel is active: this should enable support on picky panels; -
  • Added option in nv.settings to 'unhide' fastwrite support in AGP cards. Some older cards support FW even though normally they don't show it so it won't get activated (confirmed GeForce2 MX400, NV11).
    - NOTE please:
    - This is a tweak that you can enable, but you do so at your own risk (of course)! -
  • Fixed RAM amount detection for GeForce2 and GeForce4 MX Integrated GPU boards. -
-

nv_driver 0.10 (Rudolf)

-
    -
  • Implemented laptop internal flatpanel presence and native resolution detection; -
  • Implemented external DVI flatpanel(s) presence and native resolution detection; -
  • Added flatpanel(s) refreshrate protection: it(they) is(are) always kept at 62Hz refresh (60Hz shuts off some panels); -
  • Added flatpanel specific CRTC modeline and DFP modeline tuning: DVI connected panels work now on both heads (if applicable); -
  • Added aspect correction programming for flatpanels: corrects if mode aspect differs too much from panel aspect; -
  • Fixed acceleration engine management regarding sync_to_token: no more updating glitches should occur now; -
  • Added recognition for GeForce4 MX 4000, GeForceFX 5700LE and GeForceFX 5700VE cards; also modified a few others to be more correct; -
  • Implemented virtualized CRTC1/DAC1 and CRTC2/DAC2 access: when one flatpanel is found on a card that panel is always primary output now; -
  • Dualhead switch mode is operational with flatpanels now (via the virtualized setup); -
  • The user has the option to select the primary output via nv.settings now (via the new 'switchhead' option); -
  • Modified analog type monitor detection to work the same as for digital panels (detect on bootup only); -
  • Added dualhead switch mode for NV11 (works via virtualized head access implemented now); -
  • Modified dualhead switch mode for all other cards to work via the virtualized head access also; -
  • Modified overlay to work correctly with the virtualized setup; -
  • Added output-devices/heads matrix setup: the driver now selects the right head for primary output and dualhead should work for all cards with all monitor-types now (if connected before boot); -
  • Updated head selection code for register programming: NV11 needs a special treatment (again); NV11 dualhead modes are finally OK now, including switch mode; -
  • Updated secondary head specs: they are improved for nview cards (like GeForce4 and FX) in comparison to twinview cards (like GeForce2); -
  • Added move_overlay() so overlay (finally) works correctly in virtualscreens; -
  • You can now select upto one more 4:3 aspect, and 6 new 16:10 aspect modes by just selecting them from the Screenprefs app, except if you use the native R5 one. Use Dualhead setup instead (for example): -
      -
    • Added standard (4:3 aspect) mode 1400x1050 for panels and analog monitors to the modelist exported by the driver; -
    • Added widescreen (16:10 aspect) modes 800x500, 1024x640, 1280x800, 1440x900, 1680x1050 and 1920x1200 for panel(s) to the modelist exported by the driver if only widescreen panel(s) is (are) connected (so also no analog monitors may be connected!); -
    • Added blocking of modes above panel (with lowest) native resotution: this includes blocking of all widescreen modes if a non-widescreen (analog) screen is detected. -
    -
  • Cursor update for dualhead cards: when the 'softcursor' is used, the hardcursors are both actually turned off now. -
-
-NOTE:
-The features below are shutdown because they are possibly dangerous without feedback: No documentation on this exists, so this was setup by me tested on my cards only. Feedback (logfiles!) you might send to me might help me gain more info about IF we can use (or need) this, and IF it's OK to use it for a later driver release. -
    -
  • Added flatpanel LVDS and TMDS transmitters powerup if a panel is detected (not finished: needs more feedback); -
  • Added flatpanel DPMS support for both heads via powerup/powerdown of LVDS and TMDS transmitters (not finished: needs more feedback). - -
-

nv_driver 0.09 (Rudolf)

-
    -
  • Fixed NV11 trouble with repeating screen(s) on the right side of the monitor; -
  • Updated CRTC memory granularity code to work-around a hardware bug in older cards; -
  • Fixed fuzzy modes / no picture on GeForceFX 5700 cards: PLL discriminator restrictions updated. -
-

nv_driver 0.08 (Rudolf)

-
    -
  • Fixed GeForceFX 5600 and FX 5700 monitor 'refresh out of range' / shutoff fault. nVidia changed the pixelPLL for the NV31 and NV36; -
  • Fixed acceleration engine restrictions code to adhere to GeForceFX 5600 restrictions: those are still NV20 style for this card; -
  • Fixed overlay scaling restriction code to adhere to GeForceFX 5600 restrictions: engine is still the NV10/NV20 one, so it can downscale to 1/8 of the picture size; -
  • Kernel driver now signals abort on not being able to setup the INT routine instead of letting the machine freeze during accelerant initialisation; -
  • BWindowScreen R3-style function update for acceleration and page flipping/virtualscreens in apps ('Allegro' update): fixed cloning accelerants; -
  • Now only programming options head select register on dualhead cards. This fixes driver hanging on integrated GeForce2 cards (ID 0x01a0), and maybe also on some other cards; -
  • Expanded modelist to include suggested modes above 1600x1200 upto 2048x1536 resolution (if a card supports them): Done by Andrew Bachmann; -
  • Added card recognition for GeForceFX 5700, FX 5950 and some other (older) cards; -
  • Added 256Mb RAM detection; -
  • Improved startup code: this should (could) fix random trouble on some cards like for instance hardcursor trouble on especially laptops; -
  • Added dualhead support (use Mark Watson's 'Dualhead Setup' from BeBits for now); -
  • Updated mode granularity and max virtual size checking/limiting; -
  • Added dualhead support for 8- and 15bit colordepths; -
  • Fixed move_display distortions in virtualscreens especially visible in 8-bit colordepth (for both heads); -
  • Added 'overlay follows head' for dualhead stretch and switch modes: if more than half the overlay output window is on a screen, that screen gets the overlay output; -
  • Added dualhead switch mode (except for NV11 cards as they do not have output connector switching capability); -
  • Added monitor presence detection for both monitor output connectors on dualhead cards (analog type signals only); -
  • Added 'output follows monitor' for all modes: it does not matter on which connector you connect your monitor, the output will go there after setting a mode; like the card's BIOS does (except for NV11 cards as they do not have output connector switching capability). -
-

nv_driver 0.07 (Rudolf)

-
    -
  • Added card recognition for some Nvidia GeForce4 Ti 4600 cards (ID 0x0252); -
  • GeForce overlay activation updated: hardware should respond to the first request instead of to the second ('stampTV' update); -
  • Included B_YCbCr422 hardware overlay for TNT 1/2 class cards (pre NV10 architecture). -
-

nv_driver 0.06 (Rudolf)

-
    -
  • Added full 2D acceleration for TNT1 - GeForce FX cards; -
  • Added card recognition for GeForce FX Go and some older laptop cards; -
  • Implemented retrace synchronisation (INT routine); -
  • Geforce overlay updated: turned off ints explicitly, corrected upscaling restriction to be 8x, small speed improvement; -
  • Vertical timing updated: missed a register on all GeForce cards, missed another register on older cards; -
  • Register unlocking updated: missed a register on all supported cards. -
-

nv_driver 0.05 (Rudolf)

-
    -
  • Update on cursor move routine: pointer will nolonger accept illegal left-top positions. As a result it will nolonger vanish on some cards; -
  • Fixed hardware overlay on GeForce4 MX and Go series cards: disabled the embedded MPEG2 decoder engine which exist on these cards only; -
  • Fixed driver to adhere to the downscaling limitations of the new overlay engine existing in the GeForceFX series cards. -
-

nv_driver 0.04 (Rudolf)

-
    -
  • New cursor_move sync_to_retrace for all supported cards: now all display distortions should be gone (GeForce4 for example); -
  • Added hardware overlay support for the entire GeForce series cards; -
  • Now powering up all card function blocks: dualhead cards should now switch to the connected head (by it's BIOS) instead of hanging the system on boot (tested on a dualhead GeForce4 with a DVI and a VGA connector). -
-

nv_driver 0.03 (Rudolf)

-
    -
  • Prevent system or video freeze on dragging files or so in tracker windows; -
  • Pre NV10 cursor sync_to_retrace: no more distortions in cursor bitmaps on moving it; -
  • Cursor bitmapadress setup modification for laptops: The cursor should be visible now also on 'Go' type of cards; -
  • BWindowScreen / Sync_to_retrace fix: prevent apps from crashing on endless waiting for retrace. Wait_for_retrace is temporary disabled now until it's actually implemented. -
-

nv_driver 0.02 (Rudolf)

-
    -
  • hardcursor support; -
  • virtual screens / BWindowScreen support including panning/scrolling; -
  • colorspace selection; -
  • colorpalette setup; -
  • refreshrate selection; -
  • 85 cards of 4 brands are detected now: These are all TNT1 - GeForce FX5900 Ultra cards as far as I know. Hopefully all those cards will actually work OK with the driver; -
  • DPMS support; -
  • resolution selection (CRTC setup); -
  • switch to 'enhanced mode' included: VESA is gone now! -
  • cardspecs are setup (faked PINS); -
  • several small fixes done to get the driver working correctly on all four of my cards: PCI TNT1, AGP TNT1, AGP TNT2 and AGP GeForce2MX400. -

Still todo:

    -
  • Extend TVout feature to support more encoder-types (Chrontel, Philips); -
  • Improve/extend various stuff when/if possible (like adding DDC/EDID, GTF). +
  • Hmm, everything.

Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/driver.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c 2008-06-09 13:01:58 UTC (rev 25872) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/driver.c 2008-06-09 14:54:32 UTC (rev 25875) @@ -4,11 +4,10 @@ Other authors: Mark Watson; - Rudolf Cornelissen 3/2002-10/2007. + Rudolf Cornelissen 3/2002-6/2008. */ -#include "AGP.h" #include "DriverInterface.h" #include "nv_macros.h" @@ -76,7 +75,6 @@ static DeviceData *pd; static isa_module_info *isa_bus = NULL; static pci_module_info *pci_bus = NULL; -static agp_gart_module_info *agp_bus = NULL; static device_hooks graphics_device_hooks = { open_hook, close_hook, @@ -96,238 +94,10 @@ #define VENDOR_ID_VARISYS 0x1888 /* Varisys Limited */ static uint16 nvidia_device_list[] = { - 0x0020, /* Nvidia TNT1 */ - 0x0028, /* Nvidia TNT2 (pro) */ - 0x0029, /* Nvidia TNT2 Ultra */ - 0x002a, /* Nvidia TNT2 */ - 0x002b, /* Nvidia TNT2 */ - 0x002c, /* Nvidia Vanta (Lt) */ - 0x002d, /* Nvidia TNT2-M64 (Pro) */ - 0x002e, /* Nvidia NV06 Vanta */ - 0x002f, /* Nvidia NV06 Vanta */ - 0x0040, /* Nvidia GeForce FX 6800 Ultra */ - 0x0041, /* Nvidia GeForce FX 6800 */ - 0x0042, /* Nvidia GeForce FX 6800LE */ - 0x0043, /* Nvidia GeForce 6800 XE */ - 0x0045, /* Nvidia GeForce FX 6800 GT */ - 0x0046, /* Nvidia GeForce FX 6800 GT */ - 0x0047, /* Nvidia GeForce 6800 GS */ - 0x0048, /* Nvidia GeForce FX 6800 XT */ - 0x0049, /* Nvidia unknown FX */ - 0x004d, /* Nvidia Quadro FX 4400 */ - 0x004e, /* Nvidia Quadro FX 4000 */ - 0x0091, /* Nvidia GeForce 7800 GTX PCIe */ - 0x0092, /* Nvidia Geforce 7800 GT PCIe */ - 0x0098, /* Nvidia Geforce 7800 Go PCIe */ - 0x0099, /* Nvidia Geforce 7800 GTX Go PCIe */ - 0x009d, /* Nvidia Quadro FX 4500 */ - 0x00a0, /* Nvidia Aladdin TNT2 */ - 0x00c0, /* Nvidia GeForce 6800 GS */ - 0x00c1, /* Nvidia GeForce FX 6800 */ - 0x00c2, /* Nvidia GeForce FX 6800LE */ - 0x00c3, /* Nvidia GeForce FX 6800 XT */ - 0x00c8, /* Nvidia GeForce FX 6800 Go */ - 0x00c9, /* Nvidia GeForce FX 6800 Ultra Go */ - 0x00cc, /* Nvidia Quadro FX 1400 Go */ - 0x00cd, /* Nvidia Quadro FX 3450/4000 SDI */ - 0x00ce, /* Nvidia Quadro FX 1400 */ - 0x00f0, /* Nvidia GeForce FX 6800 (Ultra) AGP(?) */ - 0x00f1, /* Nvidia GeForce FX 6600 GT AGP */ - 0x00f2, /* Nvidia GeForce FX 6600 AGP */ - 0x00f3, /* Nvidia GeForce 6200 */ - 0x00f4, /* Nvidia GeForce 6600 LE */ - 0x00f5, /* Nvidia GeForce FX 7800 GS AGP */ - 0x00f6, /* Nvidia GeForce 6800 GS */ - 0x00f8, /* Nvidia Quadro FX 3400/4400 PCIe */ - 0x00f9, /* Nvidia GeForce PCX 6800 PCIe */ - 0x00fa, /* Nvidia GeForce PCX 5750 PCIe */ - 0x00fb, /* Nvidia GeForce PCX 5900 PCIe */ - 0x00fc, /* Nvidia GeForce PCX 5300 PCIe */ - 0x00fd, /* Nvidia Quadro PCX PCIe */ - 0x00fe, /* Nvidia Quadro FX 1300 PCIe(?) */ - 0x00ff, /* Nvidia GeForce PCX 4300 PCIe */ - 0x0100, /* Nvidia GeForce256 SDR */ - 0x0101, /* Nvidia GeForce256 DDR */ - 0x0102, /* Nvidia GeForce256 Ultra */ - 0x0103, /* Nvidia Quadro */ - 0x0110, /* Nvidia GeForce2 MX/MX400 */ - 0x0111, /* Nvidia GeForce2 MX100/MX200 DDR */ - 0x0112, /* Nvidia GeForce2 Go */ - 0x0113, /* Nvidia Quadro2 MXR/EX/Go */ - 0x0140, /* Nvidia GeForce FX 6600 GT */ #if 0 - // TODO: investigate! Other cards might be affected, see tickets #1530 - // and #1712. - 0x0141, /* Nvidia GeForce FX 6600 */ -#endif - 0x0142, /* Nvidia GeForce FX 6600LE */ - 0x0143, /* Nvidia GeForce 6600 VE */ - 0x0144, /* Nvidia GeForce FX 6600 Go */ - 0x0145, /* Nvidia GeForce FX 6610 XL */ - 0x0146, /* Nvidia GeForce FX 6600 TE Go / 6200 TE Go */ - 0x0147, /* Nvidia GeForce FX 6700 XL */ - 0x0148, /* Nvidia GeForce FX 6600 Go */ - 0x0149, /* Nvidia GeForce FX 6600 GT Go */ - 0x014b, /* Nvidia unknown FX */ - 0x014c, /* Nvidia Quadro FX 540 MXM */ - 0x014d, /* Nvidia unknown FX */ - 0x014e, /* Nvidia Quadro FX 540 */ - 0x014f, /* Nvidia GeForce 6200 PCIe (128Mb) */ - 0x0150, /* Nvidia GeForce2 GTS/Pro */ - 0x0151, /* Nvidia GeForce2 Ti DDR */ - 0x0152, /* Nvidia GeForce2 Ultra */ - 0x0153, /* Nvidia Quadro2 Pro */ - 0x0160, /* Nvidia GeForce 6500 Go */ - 0x0161, /* Nvidia GeForce 6200 TurboCache */ - 0x0162, /* Nvidia GeForce 6200SE TurboCache */ - 0x0163, /* Nvidia GeForce 6200LE */ - 0x0164, /* Nvidia GeForce FX 6200 Go */ - 0x0165, /* Nvidia Quadro FX NVS 285 */ - 0x0166, /* Nvidia GeForce 6400 Go */ - 0x0167, /* Nvidia GeForce 6200 Go */ - 0x0168, /* Nvidia GeForce 6400 Go */ - 0x0169, /* Nvidia GeForce 6250 Go */ - 0x016a, /* Nvidia Geforce 7100 GS */ - 0x016b, /* Nvidia unknown FX Go */ - 0x016c, /* Nvidia unknown FX Go */ - 0x016d, /* Nvidia unknown FX Go */ - 0x016e, /* Nvidia unknown FX */ - 0x0170, /* Nvidia GeForce4 MX 460 */ - 0x0171, /* Nvidia GeForce4 MX 440 */ - 0x0172, /* Nvidia GeForce4 MX 420 */ - 0x0173, /* Nvidia GeForce4 MX 440SE */ - 0x0174, /* Nvidia GeForce4 440 Go */ - 0x0175, /* Nvidia GeForce4 420 Go */ - 0x0176, /* Nvidia GeForce4 420 Go 32M */ - 0x0177, /* Nvidia GeForce4 460 Go */ - 0x0178, /* Nvidia Quadro4 500 XGL/550 XGL */ - 0x0179, /* Nvidia GeForce4 440 Go 64M (PPC: GeForce4 MX) */ - 0x017a, /* Nvidia Quadro4 200 NVS/400 NVS */ - 0x017c, /* Nvidia Quadro4 500 GoGL */ - 0x017d, /* Nvidia GeForce4 410 Go 16M */ - 0x0181, /* Nvidia GeForce4 MX 440 AGP8X */ - 0x0182, /* Nvidia GeForce4 MX 440SE AGP8X */ - 0x0183, /* Nvidia GeForce4 MX 420 AGP8X */ - 0x0185, /* Nvidia GeForce4 MX 4000 AGP8X */ - 0x0186, /* Nvidia GeForce4 448 Go */ - 0x0187, /* Nvidia GeForce4 488 Go */ - 0x0188, /* Nvidia Quadro4 580 XGL */ - 0x0189, /* Nvidia GeForce4 MX AGP8X (PPC) */ - 0x018a, /* Nvidia Quadro4 280 NVS AGP8X */ - 0x018b, /* Nvidia Quadro4 380 XGL */ - 0x018c, /* Nvidia Quadro4 NVS 50 PCI */ - 0x018d, /* Nvidia GeForce4 448 Go */ + // TODO: these cards are not yet supported 0x0191, /* Nvidia GeForce 8800 GTX */ 0x0193, /* Nvidia GeForce 8800 GTS */ - 0x01a0, /* Nvidia GeForce2 Integrated GPU */ - 0x01d1, /* Nvidia GeForce 7300 LE */ - 0x01d3, /* Nvidia GeForce 7300 SE */ - 0x01d8, /* Nvidia GeForce 7400 GO */ - 0x01dd, /* Nvidia GeForce 7500 LE */ - 0x01df, /* Nvidia GeForce 7300 GS */ - 0x01f0, /* Nvidia GeForce4 MX Integrated GPU */ - 0x0200, /* Nvidia GeForce3 */ - 0x0201, /* Nvidia GeForce3 Ti 200 */ - 0x0202, /* Nvidia GeForce3 Ti 500 */ - 0x0203, /* Nvidia Quadro DCC */ - 0x0211, /* Nvidia GeForce FX 6800 */ - 0x0212, /* Nvidia GeForce FX 6800LE */ - 0x0215, /* Nvidia GeForce FX 6800 GT */ - 0x0218, /* Nvidia GeForce 6800 XT */ - 0x0220, /* Nvidia unknown FX */ - 0x0221, /* Nvidia GeForce 6200 AGP (256Mb - 128bit) */ - 0x0222, /* Nvidia unknown FX */ - 0x0228, /* Nvidia unknown FX Go */ - 0x0240, /* Nvidia GeForce 6150 (NFORCE4 Integr.GPU) */ - 0x0241, /* Nvidia GeForce 6150 LE (NFORCE4 Integr.GPU) */ - 0x0242, /* Nvidia GeForce 6100 (NFORCE4 Integr.GPU) */ - 0x0245, /* Nvidia Quadro NVS 210S / GeForce 6150LE */ - 0x0250, /* Nvidia GeForce4 Ti 4600 */ - 0x0251, /* Nvidia GeForce4 Ti 4400 */ - 0x0252, /* Nvidia GeForce4 Ti 4600 */ - 0x0253, /* Nvidia GeForce4 Ti 4200 */ - 0x0258, /* Nvidia Quadro4 900 XGL */ - 0x0259, /* Nvidia Quadro4 750 XGL */ - 0x025b, /* Nvidia Quadro4 700 XGL */ - 0x0280, /* Nvidia GeForce4 Ti 4800 AGP8X */ - 0x0281, /* Nvidia GeForce4 Ti 4200 AGP8X */ - 0x0282, /* Nvidia GeForce4 Ti 4800SE */ - 0x0286, /* Nvidia GeForce4 4200 Go */ - 0x0288, /* Nvidia Quadro4 980 XGL */ - 0x0289, /* Nvidia Quadro4 780 XGL */ - 0x028c, /* Nvidia Quadro4 700 GoGL */ - 0x0290, /* Nvidia GeForce 7900 GTX */ - 0x0291, /* Nvidia GeForce 7900 GT */ - 0x0293, /* Nvidia GeForce 7900 GX2 */ - 0x0294, /* Nvidia GeForce 7950 GX2 */ - 0x0295, /* Nvidia GeForce 7950 GT */ - 0x0298, /* Nvidia GeForce Go 7900 GS */ - 0x0299, /* Nvidia GeForce Go 7900 GTX */ - 0x029c, /* Nvidia Quadro FX 5500 */ - 0x029f, /* Nvidia Quadro FX 4500 X2 */ - 0x02a0, /* Nvidia GeForce3 Integrated GPU */ - 0x02e1, /* Nvidia GeForce 7600 GS */ - 0x0301, /* Nvidia GeForce FX 5800 Ultra */ - 0x0302, /* Nvidia GeForce FX 5800 */ - 0x0308, /* Nvidia Quadro FX 2000 */ - 0x0309, /* Nvidia Quadro FX 1000 */ - 0x0311, /* Nvidia GeForce FX 5600 Ultra */ - 0x0312, /* Nvidia GeForce FX 5600 */ - 0x0313, /* Nvidia unknown FX */ - 0x0314, /* Nvidia GeForce FX 5600XT */ - 0x0316, /* Nvidia unknown FX Go */ - 0x0317, /* Nvidia unknown FX Go */ - 0x031a, /* Nvidia GeForce FX 5600 Go */ - 0x031b, /* Nvidia GeForce FX 5650 Go */ - 0x031c, /* Nvidia Quadro FX 700 Go */ - 0x031d, /* Nvidia unknown FX Go */ - 0x031e, /* Nvidia unknown FX Go */ - 0x031f, /* Nvidia unknown FX Go */ - 0x0320, /* Nvidia GeForce FX 5200 */ - 0x0321, /* Nvidia GeForce FX 5200 Ultra */ - 0x0322, /* Nvidia GeForce FX 5200 */ - 0x0323, /* Nvidia GeForce FX 5200LE */ - 0x0324, /* Nvidia GeForce FX 5200 Go */ - 0x0325, /* Nvidia GeForce FX 5250 Go */ - 0x0326, /* Nvidia GeForce FX 5500 */ - 0x0327, /* Nvidia GeForce FX 5100 */ - 0x0328, /* Nvidia GeForce FX 5200 Go 32M/64M */ - 0x0329, /* Nvidia GeForce FX 5200 (PPC) */ - 0x032a, /* Nvidia Quadro NVS 280 PCI */ - 0x032b, /* Nvidia Quadro FX 500/600 PCI */ - 0x032c, /* Nvidia GeForce FX 5300 Go */ - 0x032d, /* Nvidia GeForce FX 5100 Go */ - 0x032e, /* Nvidia unknown FX Go */ - 0x032f, /* Nvidia unknown FX Go */ - 0x0330, /* Nvidia GeForce FX 5900 Ultra */ - 0x0331, /* Nvidia GeForce FX 5900 */ - 0x0332, /* Nvidia GeForce FX 5900 XT */ - 0x0333, /* Nvidia GeForce FX 5950 Ultra */ - 0x0334, /* Nvidia GeForce FX 5900 ZT */ - 0x0338, /* Nvidia Quadro FX 3000 */ - 0x033f, /* Nvidia Quadro FX 700 */ - 0x0341, /* Nvidia GeForce FX 5700 Ultra */ - 0x0342, /* Nvidia GeForce FX 5700 */ - 0x0343, /* Nvidia GeForce FX 5700LE */ - 0x0344, /* Nvidia GeForce FX 5700VE */ - 0x0345, /* Nvidia unknown FX */ - 0x0347, /* Nvidia GeForce FX 5700 Go */ - 0x0348, /* Nvidia GeForce FX 5700 Go */ - 0x0349, /* Nvidia unknown FX Go */ - 0x034b, /* Nvidia unknown FX Go */ - 0x034c, /* Nvidia Quadro FX 1000 Go */ - 0x034e, /* Nvidia Quadro FX 1100 */ - 0x034f, /* Nvidia unknown FX */ - 0x0391, /* Nvidia GeForce 7600 GT */ - 0x0392, /* Nvidia GeForce 7600 GS */ - 0x0393, /* Nvidia GeForce 7300 GT */ - 0x0394, /* Nvidia GeForce 7600 LE */ - 0x0398, /* Nvidia GeForce 7600 GO */ - 0x03d0, /* Nvidia GeForce 6100 nForce 430 */ - 0x03d1, /* Nvidia GeForce 6100 nForce 405 */ - 0x03d2, /* Nvidia GeForce 6100 nForce 400 */ -#if 0 - // TODO: these cards are not yet supported 0x0400, /* Nvidia GeForce 8600 GTS */ 0x0402, /* Nvidia GeForce 8600 GT */ 0x0407, /* Nvidia GeForce 8600M GT */ @@ -338,43 +108,15 @@ 0 }; -static uint16 elsa_device_list[] = { - 0x0c60, /* Elsa Gladiac Geforce2 MX */ - 0 -}; - -static uint16 nvstbsgs_device_list[] = { - 0x0020, /* Nvidia STB/SGS-Thompson TNT1 */ - 0x0028, /* Nvidia STB/SGS-Thompson TNT2 (pro) */ - 0x0029, /* Nvidia STB/SGS-Thompson TNT2 Ultra */ - 0x002a, /* Nvidia STB/SGS-Thompson TNT2 */ - 0x002b, /* Nvidia STB/SGS-Thompson TNT2 */ - 0x002c, /* Nvidia STB/SGS-Thompson Vanta (Lt) */ - 0x002d, /* Nvidia STB/SGS-Thompson TNT2-M64 (Pro) */ - 0x002e, /* Nvidia STB/SGS-Thompson NV06 Vanta */ - 0x002f, /* Nvidia STB/SGS-Thompson NV06 Vanta */ - 0x00a0, /* Nvidia STB/SGS-Thompson Aladdin TNT2 */ - 0 -}; - -static uint16 varisys_device_list[] = { - 0x3503, /* Varisys GeForce4 MX440 */ - 0x3505, /* Varisys GeForce4 Ti 4200 */ - 0 -}; - static struct { uint16 vendor; uint16 *devices; } SupportedDevices[] = { {VENDOR_ID_NVIDIA, nvidia_device_list}, - {VENDOR_ID_ELSA, elsa_device_list}, - {VENDOR_ID_NVSTBSGS, nvstbsgs_device_list}, - {VENDOR_ID_VARISYS, varisys_device_list}, {0x0000, NULL} }; -static nv_settings sSettings = { // see comments in nvidia.settings +static nv_settings sSettings = { // see comments in nvidia_gpgpu.settings /* for driver */ DRIVER_PREFIX ".accelerant", "none", // primary @@ -386,8 +128,6 @@ true, // usebios true, // hardcursor false, // switchhead - false, // force_pci - false, // unhide_fw true, // pgm_panel true, // dma_acc false, // vga_on_tv @@ -1234,39 +974,6 @@ break; } - case NV_GET_NTH_AGP_INFO: - { - nv_nth_agp_info *nai = (nv_nth_agp_info *)buf; - if (nai->magic == NV_PRIVATE_DATA_MAGIC) { - nai->exist = false; - nai->agp_bus = false; - if (agp_bus) { - nai->agp_bus = true; - if ((*agp_bus->get_nth_agp_info)(nai->index, &(nai->agpi)) == B_NO_ERROR) { - nai->exist = true; - } - } - result = B_OK; - } - break; - } - - case NV_ENABLE_AGP: - { - nv_cmd_agp *nca = (nv_cmd_agp *)buf; - if (nca->magic == NV_PRIVATE_DATA_MAGIC) { - if (agp_bus) { - nca->agp_bus = true; - nca->cmd = agp_bus->set_agp_mode(nca->cmd); - } else { - nca->agp_bus = false; - nca->cmd = 0; - } - result = B_OK; - } - break; - } - case NV_ISA_OUT: { nv_in_out_isa *io_isa = (nv_in_out_isa *)buf; @@ -1437,10 +1144,6 @@ "usebios", false, false); sSettings.switchhead = get_driver_boolean_parameter(settings, "switchhead", false, false); - sSettings.force_pci = get_driver_boolean_parameter(settings, - "force_pci", false, false); - sSettings.unhide_fw = get_driver_boolean_parameter(settings, - "unhide_fw", false, false); sSettings.pgm_panel = get_driver_boolean_parameter(settings, "pgm_panel", false, false); sSettings.dma_acc = get_driver_boolean_parameter(settings, @@ -1475,9 +1178,6 @@ return B_ERROR; } - /* get a handle for the agp bus if it exists */ - get_module(B_AGP_GART_MODULE_NAME, (module_info **)&agp_bus); - /* driver private data */ pd = (DeviceData *)calloc(1, sizeof(DeviceData)); if (!pd) { @@ -1525,9 +1225,5 @@ /* put the pci module away */ put_module(B_PCI_MODULE_NAME); put_module(B_ISA_MODULE_NAME); - - /* put the agp module away if it's there */ - if (agp_bus) - put_module(B_AGP_GART_MODULE_NAME); } From rudolfc at mail.berlios.de Mon Jun 9 17:17:03 2008 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Mon, 9 Jun 2008 17:17:03 +0200 Subject: [Haiku-commits] r25876 - haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu Message-ID: <200806091517.m59FH3Ho003319@sheep.berlios.de> Author: rudolfc Date: 2008-06-09 17:17:02 +0200 (Mon, 09 Jun 2008) New Revision: 25876 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25876&view=rev Added: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/nvidia_gpgpu.settings Removed: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/nvidia.settings Log: renamed nvidia.settings Deleted: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/nvidia.settings Copied: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/nvidia_gpgpu.settings (from rev 25875, haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/nvidia.settings) From rudolfc at mail.berlios.de Mon Jun 9 17:25:04 2008 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Mon, 9 Jun 2008 17:25:04 +0200 Subject: [Haiku-commits] r25877 - haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine Message-ID: <200806091525.m59FP48s004331@sheep.berlios.de> Author: rudolfc Date: 2008-06-09 17:25:03 +0200 (Mon, 09 Jun 2008) New Revision: 25877 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25877&view=rev Removed: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_agp.c Log: removed nv_agp.c Deleted: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_agp.c From rudolfc at mail.berlios.de Mon Jun 9 17:36:55 2008 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Mon, 9 Jun 2008 17:36:55 +0200 Subject: [Haiku-commits] r25878 - haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu Message-ID: <200806091536.m59FatCQ005427@sheep.berlios.de> Author: rudolfc Date: 2008-06-09 17:36:54 +0200 (Mon, 09 Jun 2008) New Revision: 25878 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25878&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/nvidia_gpgpu.settings Log: updated settings file Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/nvidia_gpgpu.settings =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/nvidia_gpgpu.settings 2008-06-09 15:25:03 UTC (rev 25877) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/nvidia_gpgpu.settings 2008-06-09 15:36:54 UTC (rev 25878) @@ -1,15 +1,15 @@ -# Settings file for the nv driver and accelerant +# Settings file for the nvidia_gpgpu driver and accelerant # # This file should be moved to the directory # ~/config/settings/kernel/drivers/ # # nv.driver parameters: -#accelerant "nvidia.accelerant" # if enabled selects accelerant filename to be used +#accelerant "nvidia_gpgpu.accelerant" # if enabled selects accelerant filename to be used #primary "10de_0110_010000" # if enabled selects device to be used as primary device ('hack') dumprom false # dump bios rom to file (in home folder) -# nv.accelerant parameters: +# nvidia_gpgpu.accelerant parameters: usebios true # if true rely on bios to coldstart the card #memory 2 # in MB, override builtin memory size detection hardcursor true # if true use on-chip cursor capabilities @@ -17,14 +17,12 @@ #logmask 0x08000604 # log overlay use in full to file (in home folder) #logmask 0xffffffff # log everything to file (in home folder) switchhead false # switch head assignment (dualhead cards only) -force_pci false # block AGP mode use if true (AGP cards only) dma_acc true # if true enable DMA cmd fetching for 2D acc (instead of using PIO) #tv_output 0 # disabled or 0 = autodetect, 1 = Y/C (and CVBS if possible), 2 = CVBS force_sync false # if true forces 3D rendering to be synchronized to the vertical retrace force_ws false # if true forces widescreen type detection for all connected screens # WARNING: tweak alert! modify stuff below on your own risk... -unhide_fw false # if true 'unhide' cards AGP fastwrite support on cards that hide it pgm_panel true # if false don't program DVI and laptop panel pixelclocks (refreshrates) vga_on_tv false # if true enables VGA output on the head outputting to TV #gpu_clk 150 # in Mhz, (tries to) override default GPU clockspeed (be carefull!!!) @@ -47,7 +45,6 @@ #logmask 0x00000008 # log errors #log modules: -#logmask 0x00000100 # engine: agp #logmask 0x00000200 # engine: bes #logmask 0x00000400 # overlay #logmask 0x00000800 # engine: support From stippi at mail.berlios.de Mon Jun 9 18:07:19 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Mon, 9 Jun 2008 18:07:19 +0200 Subject: [Haiku-commits] r25879 - in haiku/trunk/src: kits/interface servers/app Message-ID: <200806091607.m59G7JuX008341@sheep.berlios.de> Author: stippi Date: 2008-06-09 18:07:18 +0200 (Mon, 09 Jun 2008) New Revision: 25879 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25879&view=rev Modified: haiku/trunk/src/kits/interface/Window.cpp haiku/trunk/src/servers/app/View.cpp haiku/trunk/src/servers/app/View.h haiku/trunk/src/servers/app/Window.cpp Log: * Change the protocol for sending the affected view tokens during an update session to also include each view's individual update rect (in screen coords). Should actually not be mush slower than the old version, and hopefully makes it possible to have smarter BView::Draw() implementations which should make more than up for any potential speed loss. * Removed unused version of View::AddTokensForViewsInRegion(). Modified: haiku/trunk/src/kits/interface/Window.cpp =================================================================== --- haiku/trunk/src/kits/interface/Window.cpp 2008-06-09 15:36:54 UTC (rev 25878) +++ haiku/trunk/src/kits/interface/Window.cpp 2008-06-09 16:07:18 UTC (rev 25879) @@ -1154,7 +1154,6 @@ //bigtime_t now = system_time(); //bigtime_t drawTime = 0; STRACE(("info:BWindow handling _UPDATE_.\n")); - BRect updateRect; fLink->StartMessage(AS_BEGIN_UPDATE); fInTransaction = true; @@ -1189,36 +1188,55 @@ FrameResized(width, height); } - // read culmulated update rect (is in screen coords) - fLink->Read(&updateRect); - // read tokens for views that need to be drawn // NOTE: we need to read the tokens completely - // first, or other calls would likely mess up the - // data in the link. - BList tokens(20); - int32 token; - status_t error = fLink->Read(&token); - while (error >= B_OK && token != B_NULL_TOKEN) { - tokens.AddItem((void*)token); - error = fLink->Read(&token); + // first, we cannot draw views in between reading + // the tokens, since other communication would likely + // mess up the data in the link. + struct ViewUpdateInfo { + int32 token; + BRect updateRect; + }; + BList infos(20); + while (true) { + // read next token and create/add ViewUpdateInfo + int32 token; + status_t error = fLink->Read(&token); + if (error < B_OK || token == B_NULL_TOKEN) + break; + ViewUpdateInfo* info = new (nothrow) ViewUpdateInfo; + if (info == NULL || !infos.AddItem(info)) { + delete info; + break; + } + info->token = token; + // read culmulated update rect (is in screen coords) + error = fLink->Read(&(info->updateRect)); + if (error < B_OK) + break; } // draw - int32 count = tokens.CountItems(); + int32 count = infos.CountItems(); for (int32 i = 0; i < count; i++) { //bigtime_t drawStart = system_time(); - if (BView* view = _FindView((int32)tokens.ItemAtFast(i))) - view->_Draw(updateRect); + ViewUpdateInfo* info + = (ViewUpdateInfo*)infos.ItemAtFast(i); + if (BView* view = _FindView(info->token)) + view->_Draw(info->updateRect); else - printf("_UPDATE_ - didn't find view by token: %ld\n", (int32)tokens.ItemAtFast(i)); + printf("_UPDATE_ - didn't find view by token: %ld\n", + info->token); //drawTime += system_time() - drawStart; } // NOTE: The tokens are actually hirachically sorted, // so traversing the list in revers and calling - // child->DrawAfterChildren actually works correctly + // child->_DrawAfterChildren() actually works like intended. for (int32 i = count - 1; i >= 0; i--) { - if (BView* view = _FindView((int32)tokens.ItemAtFast(i))) - view->_DrawAfterChildren(updateRect); + ViewUpdateInfo* info + = (ViewUpdateInfo*)infos.ItemAtFast(i); + if (BView* view = _FindView(info->token)) + view->_DrawAfterChildren(info->updateRect); + delete info; } //printf(" %ld views drawn, total Draw() time: %lld\n", count, drawTime); Modified: haiku/trunk/src/servers/app/View.cpp =================================================================== --- haiku/trunk/src/servers/app/View.cpp 2008-06-09 15:36:54 UTC (rev 25878) +++ haiku/trunk/src/servers/app/View.cpp 2008-06-09 16:07:18 UTC (rev 25879) @@ -1476,40 +1476,34 @@ void -View::AddTokensForViewsInRegion(BMessage* message, BRegion& region, - BRegion* windowContentClipping) -{ - if (!fVisible) - return; - - if (region.Intersects(_ScreenClipping(windowContentClipping).Frame())) - message->AddInt32("_token", fToken); - - for (View* child = FirstChild(); child; child = child->NextSibling()) { - child->AddTokensForViewsInRegion(message, region, - windowContentClipping); - } -} - - -void View::AddTokensForViewsInRegion(BPrivate::PortLink& link, BRegion& region, BRegion* windowContentClipping) { if (!fVisible) return; - IntRect screenBounds(Bounds()); - ConvertToScreen(&screenBounds); - if (!region.Intersects((clipping_rect)screenBounds)) - return; + { + // NOTE: use scope in order to reduce stack space requirements - if (region.Intersects(_ScreenClipping(windowContentClipping).Frame())) - link.Attach(fToken); + // This check will prevent descending the view hierarchy + // any further than necessary + IntRect screenBounds(Bounds()); + ConvertToScreen(&screenBounds); + if (!region.Intersects((clipping_rect)screenBounds)) + return; - for (View* child = FirstChild(); child; child = child->NextSibling()) { - child->AddTokensForViewsInRegion(link, region, windowContentClipping); + // Unfortunately, we intersecting another region, but otherwise + // we couldn't provide the exact update rect to the client + BRegion localDirty = _ScreenClipping(windowContentClipping); + localDirty.IntersectWith(®ion); + if (localDirty.CountRects() > 0) { + link.Attach(fToken); + link.Attach(localDirty.Frame()); + } } + + for (View* child = FirstChild(); child; child = child->NextSibling()) + child->AddTokensForViewsInRegion(link, region, windowContentClipping); } Modified: haiku/trunk/src/servers/app/View.h =================================================================== --- haiku/trunk/src/servers/app/View.h 2008-06-09 15:36:54 UTC (rev 25878) +++ haiku/trunk/src/servers/app/View.h 2008-06-09 16:07:18 UTC (rev 25879) @@ -215,10 +215,6 @@ bool IsDesktopBackground() const { return fIsDesktopBackground; } - void AddTokensForViewsInRegion(BMessage* message, - BRegion& region, - BRegion* windowContentClipping); - void AddTokensForViewsInRegion(BPrivate::PortLink& link, BRegion& region, BRegion* windowContentClipping); Modified: haiku/trunk/src/servers/app/Window.cpp =================================================================== --- haiku/trunk/src/servers/app/Window.cpp 2008-06-09 15:36:54 UTC (rev 25878) +++ haiku/trunk/src/servers/app/Window.cpp 2008-06-09 16:07:18 UTC (rev 25879) @@ -1915,8 +1915,6 @@ link.Attach(fFrame.LeftTop()); link.Attach(fFrame.Width()); link.Attach(fFrame.Height()); - // append he update rect in screen coords - link.Attach(dirty->Frame()); // find and attach all views that intersect with // the dirty region fTopView->AddTokensForViewsInRegion(link, *dirty, &fContentRegion); From stippi at mail.berlios.de Mon Jun 9 18:09:20 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Mon, 9 Jun 2008 18:09:20 +0200 Subject: [Haiku-commits] r25880 - haiku/trunk/src/kits/interface Message-ID: <200806091609.m59G9KCa008834@sheep.berlios.de> Author: stippi Date: 2008-06-09 18:09:20 +0200 (Mon, 09 Jun 2008) New Revision: 25880 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25880&view=rev Modified: haiku/trunk/src/kits/interface/View.cpp Log: The given updateRect in screen coords (_Draw()/_DrawAfterChildren()) should no longer extend outside the view after r25879. Modified: haiku/trunk/src/kits/interface/View.cpp =================================================================== --- haiku/trunk/src/kits/interface/View.cpp 2008-06-09 16:07:18 UTC (rev 25879) +++ haiku/trunk/src/kits/interface/View.cpp 2008-06-09 16:09:20 UTC (rev 25880) @@ -4697,7 +4697,6 @@ _SwitchServerCurrentView(); ConvertFromScreen(&updateRect); - updateRect = Bounds() & updateRect; // TODO: make states robust (the hook implementation could // mess things up if it uses non-matching Push- and PopState(), @@ -4719,7 +4718,6 @@ _SwitchServerCurrentView(); ConvertFromScreen(&updateRect); - updateRect = Bounds() & updateRect; // TODO: make states robust (see above) PushState(); From bonefish at mail.berlios.de Mon Jun 9 19:04:29 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 9 Jun 2008 19:04:29 +0200 Subject: [Haiku-commits] r25881 - haiku/trunk/src/apps/terminal Message-ID: <200806091704.m59H4TO5022274@sheep.berlios.de> Author: bonefish Date: 2008-06-09 19:04:26 +0200 (Mon, 09 Jun 2008) New Revision: 25881 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25881&view=rev Added: haiku/trunk/src/apps/terminal/TermPos.h haiku/trunk/src/apps/terminal/TermScrollView.cpp haiku/trunk/src/apps/terminal/TermScrollView.h haiku/trunk/src/apps/terminal/TerminalCharClassifier.cpp haiku/trunk/src/apps/terminal/TerminalCharClassifier.h haiku/trunk/src/apps/terminal/UTF8Char.h Removed: haiku/trunk/src/apps/terminal/CurPos.cpp haiku/trunk/src/apps/terminal/CurPos.h haiku/trunk/src/apps/terminal/TermBuffer.cpp haiku/trunk/src/apps/terminal/TermBuffer.h Modified: haiku/trunk/src/apps/terminal/CodeConv.h haiku/trunk/src/apps/terminal/Jamfile haiku/trunk/src/apps/terminal/Shell.cpp haiku/trunk/src/apps/terminal/TermConst.h haiku/trunk/src/apps/terminal/TermParse.cpp haiku/trunk/src/apps/terminal/TermParse.h haiku/trunk/src/apps/terminal/TermView.cpp haiku/trunk/src/apps/terminal/TermView.h haiku/trunk/src/apps/terminal/TermWindow.cpp haiku/trunk/src/apps/terminal/TermWindow.h haiku/trunk/src/apps/terminal/TerminalBuffer.cpp haiku/trunk/src/apps/terminal/TerminalBuffer.h Log: Terminal changes. This is still work in progress, some features are disabled, lots of commented debug code is still in there, and quite a bit of cleanup is needed, but basically things work at least as well as before with several improvements: * Changed TerminalBuffer from an interface to a complete implementation. Removed all related code from TermView. Removed the now obsolete TermBuffer. TermParse uses TerminalBuffer instead of TermView, and TerminalBuffer asynchronously notifies TermView. This avoids potential deadlocks, fixing #1918. It also speeds up tty-output-bound programs. E.g. a "seq 10000" is about twice at fast with the default terminal size in my setup, now. It's still horribly slow compared to e.g. Konsole, though. * Replaced CurPos by a more compact and fully inline class TermPos. * Removed the offset feature (that insets the used text area) from TermView, thus simplifying the code. Instead put the view into a new parent view which provides the insets. This also fixes artifacts that could sometimes be observed in the insets area. * Scrolling related changes: - When scrolling fully down, the (80x25 or whatever) terminal screen is seen. It is not possible to scroll below the screen as in Be's Terminal. Scrolling in Haiku's Terminal was weirdly broken in this respect. As a side effect this fixes #2070. - When not scrolled fully down, further output won't cause any scrolling. It is thus possible to read earlier output while something is still going on. Fixes #1772. - Particularly to avoid unnecessary scrolling in the not scrolled fully down case, TermView no longer actually scrolls. It only sets an internal offset and manually uses CopyBits() as needed. Introduced a (hacky) BScrollView subclass using a BScrollBar subclass to make that possible. * Selection related changes: - Double/triple click plus dragging allows for selecting multiple words/lines. - Word selection no longer selects ranges of non-space characters. Instead it knows that words are made of alpha numerical chars and a certain set of other chars, and selects a range of commonly classified characters (word chars, non-word non-whitespace chars, whitespace chars). The non-alpha-num word characters should be made user-settable. Due to missing multi-byte character classification multi-byte whitespace is not recognized. - Beyond the end of the line there no longer are invisible spaces. Trying to select the region selects the end of the line (i.e. line break). This is similar to how Konsole and xterm work. - Added auto-scrolling when selecting with the mouse. Formerly the Terminal scrolled only while moving the mouse. The scroll speed might need some fine-tuning. - Don't know what change exactly did that (likely the switch to non-end-inclusive text ranges used internally), but the occasional selection artifacts are gone. * Resizing the terminal window re-wraps soft-wrapped lines. * The find functionality seemed to be completely broken. At least it never found anything for me. Should work now, though multi-byte characters are not matched correctly in case-insensitive mode. Regressions: * Printing is disabled. * Cursor blinking is disabled. Do we want it anyway? * In several cases full-width characters are not handled correctly (in more cases than before). * Shrinking the terminal width doesn't work very well with "less" (and probably other full-screen terminal apps), due to line re-wrapping. "less" expects them to be truncated only. When supporting an alternate screen buffer re-wrapping should be disabled for it, which should solve the problem. Modified: haiku/trunk/src/apps/terminal/CodeConv.h =================================================================== --- haiku/trunk/src/apps/terminal/CodeConv.h 2008-06-09 16:09:20 UTC (rev 25880) +++ haiku/trunk/src/apps/terminal/CodeConv.h 2008-06-09 17:04:26 UTC (rev 25881) @@ -26,4 +26,5 @@ static unsigned short UTF8toUnicode(const char *utf8); }; + #endif /* CODECONV_H */ Deleted: haiku/trunk/src/apps/terminal/CurPos.cpp Deleted: haiku/trunk/src/apps/terminal/CurPos.h Modified: haiku/trunk/src/apps/terminal/Jamfile =================================================================== --- haiku/trunk/src/apps/terminal/Jamfile 2008-06-09 16:09:20 UTC (rev 25880) +++ haiku/trunk/src/apps/terminal/Jamfile 2008-06-09 17:04:26 UTC (rev 25881) @@ -9,7 +9,6 @@ Arguments.cpp CodeConv.cpp Coding.cpp - CurPos.cpp FindWindow.cpp MenuUtil.cpp Terminal.cpp @@ -19,9 +18,10 @@ Shell.cpp SmartTabView.cpp TermApp.cpp - TermBuffer.cpp TerminalBuffer.cpp + TerminalCharClassifier.cpp TermParse.cpp + TermScrollView.cpp TermView.cpp TermWindow.cpp TTextControl.cpp Modified: haiku/trunk/src/apps/terminal/Shell.cpp =================================================================== --- haiku/trunk/src/apps/terminal/Shell.cpp 2008-06-09 16:09:20 UTC (rev 25880) +++ haiku/trunk/src/apps/terminal/Shell.cpp 2008-06-09 17:04:26 UTC (rev 25881) @@ -234,7 +234,7 @@ if (fAttached) return; - status_t status = fTermParse->StartThreads(view); + status_t status = fTermParse->StartThreads(view->TextBuffer()); if (status < B_OK) { // TODO: What can we do here ? fprintf(stderr, "Shell:ViewAttached():" Deleted: haiku/trunk/src/apps/terminal/TermBuffer.cpp Deleted: haiku/trunk/src/apps/terminal/TermBuffer.h Modified: haiku/trunk/src/apps/terminal/TermConst.h =================================================================== --- haiku/trunk/src/apps/terminal/TermConst.h 2008-06-09 16:09:20 UTC (rev 25880) +++ haiku/trunk/src/apps/terminal/TermConst.h 2008-06-09 17:04:26 UTC (rev 25881) @@ -83,6 +83,10 @@ const uint32 SAVE_AS_DEFAULT = 'sadf'; const uint32 MSG_CHECK_CHILDREN = 'ckch'; +const uint32 MSG_TERMINAL_BUFFER_CHANGED = 'bufc'; +const uint32 MSG_SET_TERMNAL_TITLE = 'sett'; +const uint32 MSG_QUIT_TERMNAL = 'qutt'; + // Preference Read/Write Keys const char* const PREF_HALF_FONT_FAMILY = "Half Font Family"; const char* const PREF_HALF_FONT_STYLE = "Half Font Style"; @@ -144,7 +148,7 @@ #define MIN_COLS 10 #define MAX_COLS 256 -#define MIN_ROWS 1 +#define MIN_ROWS 10 #define MAX_ROWS 256 // Insert mode flag Modified: haiku/trunk/src/apps/terminal/TermParse.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-09 16:09:20 UTC (rev 25880) +++ haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-09 17:04:26 UTC (rev 25881) @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -117,6 +118,7 @@ TermParse::GetReaderBuf(uchar &c) { status_t status; +#if 0 do { status = acquire_sem_etc(fReaderSem, 1, B_TIMEOUT, 10000); } while (status == B_INTERRUPTED); @@ -127,17 +129,23 @@ // Reset cursor blinking time and turn on cursor blinking. fBuffer->SetCurDraw(true); +#endif // wait new input from pty. +fBuffer->Unlock(); do { status = acquire_sem(fReaderSem); } while (status == B_INTERRUPTED); +fBuffer->Lock(); if (status < B_OK) return status; + +#if 0 } else if (status == B_OK) { // Do nothing } else return status; +#endif c = fReadBuffer[fBufferPosition % READ_BUF_SIZE]; fBufferPosition++; @@ -147,7 +155,7 @@ release_sem(fReaderLocker); } - fBuffer->SetCurDraw(false); +// fBuffer->SetCurDraw(false); return B_OK; } @@ -343,6 +351,9 @@ int *parsestate = groundtable; while (!fQuitting) { +// TODO: Fix the locking! + BAutolock locker(fBuffer); + uchar c; if (GetReaderBuf(c) < B_OK) break; @@ -383,6 +394,7 @@ now_coding = fBuffer->Encoding(); } +//debug_printf("TermParse: char: '%c' (%d), parse state: %d\n", c, c, parsestate[c]); switch (parsestate[c]) { case CASE_PRINT: cbuf[0] = c; @@ -767,7 +779,7 @@ case CASE_CPR: // Q & D hack by Y.Hayakawa (hida at sawada.riec.tohoku.ac.jp) // 21-JUL-99 - fBuffer->DeviceStatusReport(param[0]); + _DeviceStatusReport(param[0]); parsestate = groundtable; break; @@ -975,3 +987,27 @@ { return reinterpret_cast(data)->EscParse(); } + + +void +TermParse::_DeviceStatusReport(int n) +{ + char sbuf[16] ; + int len; + + switch (n) { + case 5: + { + const char* toWrite = "\033[0n"; + write(fFd, toWrite, strlen(toWrite)); + break ; + } + case 6: + len = sprintf(sbuf, "\033[%ld;%ldR", fBuffer->Height(), + fBuffer->Width()) ; + write(fFd, sbuf, len); + break ; + default: + return; + } +} Modified: haiku/trunk/src/apps/terminal/TermParse.h =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.h 2008-06-09 16:09:20 UTC (rev 25880) +++ haiku/trunk/src/apps/terminal/TermParse.h 2008-06-09 17:04:26 UTC (rev 25881) @@ -68,7 +68,9 @@ // Reading ReadBuf at one Char. status_t GetReaderBuf(uchar &c); - + + void _DeviceStatusReport(int n); + int fFd; thread_id fParseThread; Added: haiku/trunk/src/apps/terminal/TermPos.h =================================================================== --- haiku/trunk/src/apps/terminal/TermPos.h 2008-06-09 16:09:20 UTC (rev 25880) +++ haiku/trunk/src/apps/terminal/TermPos.h 2008-06-09 17:04:26 UTC (rev 25881) @@ -0,0 +1,65 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef TERM_POS_H +#define TERM_POS_H + +#include + + +class TermPos { +public: + int32 x; + int32 y; + + inline TermPos() : x(0), y(0) { } + inline TermPos(int32 x, int32 y) : x(x), y(y) { } + inline TermPos(const TermPos& other) : x(other.x), y(other.y) { } + + inline void SetTo(int32 x, int32 y) + { + this->x = x; + this->y = y; + } + + inline bool operator==(const TermPos& other) const + { + return x == other.x && y == other.y; + } + + inline bool operator!=(const TermPos& other) const + { + return x != other.x || y != other.y; + } + + inline bool operator<=(const TermPos& other) const + { + return y < other.y || y == other.y && x <= other.x; + } + + inline bool operator>=(const TermPos& other) const + { + return other <= *this; + } + + inline bool operator<(const TermPos& other) const + { + return !(*this >= other); + } + + inline bool operator>(const TermPos& other) const + { + return !(*this <= other); + } + + inline TermPos& operator=(const TermPos& other) + { + x = other.x; + y = other.y; + return *this; + } +}; + + +#endif // TERM_POS_H Added: haiku/trunk/src/apps/terminal/TermScrollView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermScrollView.cpp 2008-06-09 16:09:20 UTC (rev 25880) +++ haiku/trunk/src/apps/terminal/TermScrollView.cpp 2008-06-09 17:04:26 UTC (rev 25881) @@ -0,0 +1,52 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ + +// NOTE: Nasty hack to get access to BScrollView's private parts. +#include +#define private protected +#include +#undef private + +#include "TermScrollView.h" + + +class TermScrollBar : public BScrollBar { +public: + TermScrollBar(BRect frame, const char *name, BView *target, + float min, float max, orientation direction) + : + BScrollBar(frame, name, target, min, max, direction) + { + } + + virtual void ValueChanged(float newValue) + { + if (BView* target = Target()) + Target()->ScrollTo(0, newValue); + } +}; + + +TermScrollView::TermScrollView(const char* name, BView* child, BView* target, + uint32 resizingMode) + : + BScrollView(name, child, resizingMode, 0, false, true) +{ + // replace the vertical scroll bar with our own + if (fVerticalScrollBar != NULL) { + BRect frame(fVerticalScrollBar->Frame()); + RemoveChild(fVerticalScrollBar); + + TermScrollBar* scrollBar = new TermScrollBar(frame, "_VSB_", target, 0, + 1000, B_VERTICAL); + AddChild(scrollBar); + fVerticalScrollBar = scrollBar; + } +} + + +TermScrollView::~TermScrollView() +{ +} Added: haiku/trunk/src/apps/terminal/TermScrollView.h =================================================================== --- haiku/trunk/src/apps/terminal/TermScrollView.h 2008-06-09 16:09:20 UTC (rev 25880) +++ haiku/trunk/src/apps/terminal/TermScrollView.h 2008-06-09 17:04:26 UTC (rev 25881) @@ -0,0 +1,20 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef TERM_SCROLL_VIEW_H +#define TERM_SCROLL_VIEW_H + +#include + + +class TermScrollView : public BScrollView { +public: + TermScrollView(const char* name, BView* child, + BView* target, + uint32 resizingMode = B_FOLLOW_ALL); + ~TermScrollView(); +}; + + +#endif // TERM_SCROLL_VIEW_H Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-09 16:09:20 UTC (rev 25880) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-09 17:04:26 UTC (rev 25881) @@ -8,17 +8,21 @@ * Stefano Ceccherini * Kian Duffy, myob at users.sourceforge.net * Y.Hayakawa, hida at sawada.riec.tohoku.ac.jp + * Ingo Weinhold */ #include "TermView.h" -#include "CodeConv.h" -#include "Shell.h" -#include "TermBuffer.h" -#include "TermConst.h" -#include "VTkeymap.h" +#include +#include +#include +#include +#include +#include +#include + #include #include #include @@ -30,19 +34,18 @@ #include #include #include +#include #include #include #include #include -#include -#include -#include -#include -#include +#include "CodeConv.h" +#include "Shell.h" +#include "TermConst.h" +#include "TerminalCharClassifier.h" +#include "VTkeymap.h" -#include -#include // defined VTKeyTbl.c extern int function_keycode_table[]; @@ -59,13 +62,17 @@ {245, 245, 245, 0}, // white }; -// Space at the borders of the view -const int32 kOffset = 3; - #define ROWS_DEFAULT 25 #define COLUMNS_DEFAULT 80 +// selection granularity +enum { + SELECT_CHARS, + SELECT_WORDS, + SELECT_LINES +}; + static property_info sPropList[] = { { "encoding", {B_GET_PROPERTY, 0}, @@ -83,26 +90,111 @@ }; -const static uint32 kUpdateSigWinch = 'Rwin'; -const static uint32 kBlinkCursor = 'BlCr'; +static const uint32 kUpdateSigWinch = 'Rwin'; +static const uint32 kBlinkCursor = 'BlCr'; +static const uint32 kAutoScroll = 'AScr'; -const static rgb_color kBlackColor = { 0, 0, 0, 255 }; -const static rgb_color kWhiteColor = { 255, 255, 255, 255 }; +static const rgb_color kBlackColor = { 0, 0, 0, 255 }; +static const rgb_color kWhiteColor = { 255, 255, 255, 255 }; +static const char* kDefaultSpecialWordChars = ":@-./_~"; + +template +static inline Type +restrict_value(const Type& value, const Type& min, const Type& max) +{ + return value < min ? min : (value > max ? max : value); +} + + +class TermView::CharClassifier : public TerminalCharClassifier +{ +public: + CharClassifier(const char* specialWordChars) + : + fSpecialWordChars(specialWordChars) + { + } + + virtual int Classify(const char* character) + { + // TODO: Deal correctly with non-ASCII chars. + char c = *character; + if (UTF8Char::ByteCount(c) > 1) + return CHAR_TYPE_WORD_CHAR; + + if (isspace(c)) + return CHAR_TYPE_SPACE; + if (isalnum(c) || strchr(fSpecialWordChars, c) != NULL) + return CHAR_TYPE_WORD_CHAR; + + return CHAR_TYPE_WORD_DELIMITER; + } + +private: + const char* fSpecialWordChars; +}; + + +inline int32 +TermView::_LineAt(float y) +{ + int32 location = int32(y + fScrollOffset); + + // Make sure negative offsets are rounded towards the lower neighbor, too. + if (location < 0) + location -= fFontHeight - 1; + + return location / fFontHeight; +} + + +inline float +TermView::_LineOffset(int32 index) +{ + return index * fFontHeight - fScrollOffset; +} + + +// convert view coordinates to terminal text buffer position +inline TermPos +TermView::_ConvertToTerminal(const BPoint &p) +{ + return TermPos(p.x >= 0 ? (int32)p.x / fFontWidth : -1, _LineAt(p.y)); +} + + +// convert terminal text buffer position to view coordinates +inline BPoint +TermView::_ConvertFromTerminal(const TermPos &pos) +{ + return BPoint(fFontWidth * pos.x, _LineOffset(pos.y)); +} + + +inline void +TermView::_InvalidateTextRect(int32 x1, int32 y1, int32 x2, int32 y2) +{ + BRect rect(x1 * fFontWidth, _LineOffset(y1), + (x2 + 1) * fFontWidth - 1, _LineOffset(y2 + 1) - 1); +//debug_printf("Invalidate((%f, %f) - (%f, %f))\n", rect.left, rect.top, +//rect.right, rect.bottom); + Invalidate(rect); +} + + TermView::TermView(BRect frame, int32 argc, const char **argv, int32 historySize) : BView(frame, "termview", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE | B_PULSE_NEEDED), fShell(NULL), fWinchRunner(NULL), fCursorBlinkRunner(NULL), + fAutoScrollRunner(NULL), + fCharClassifier(NULL), fFontWidth(0), fFontHeight(0), fFontAscent(0), - fUpdateFlag(false), - fInsertModeFlag(MODE_OVER), - fScrollUpCount(0), - fScrollBarRange(0), fFrameResized(false), fLastCursorTime(0), fCursorDrawFlag(true), @@ -110,13 +202,10 @@ fCursorBlinkingFlag(true), fCursorRedrawFlag(true), fCursorHeight(0), - fCurPos(0, 0), - fCurStack(0, 0), - fBufferStartPos(-1), + fCursor(0, 0), fTermRows(ROWS_DEFAULT), fTermColumns(COLUMNS_DEFAULT), fEncoding(M_UTF8), - fTop(0), fTextBuffer(NULL), fScrollBar(NULL), fTextForeColor(kBlackColor), @@ -125,11 +214,8 @@ fCursorBackColor(kBlackColor), fSelectForeColor(kWhiteColor), fSelectBackColor(kBlackColor), - fScrTop(0), - fScrBot(fTermRows - 1), + fScrollOffset(0), fScrBufSize(historySize), - fScrRegionSet(0), - fClickPoint(0, 0), fSelStart(-1, -1), fSelEnd(-1, -1), fMouseTracking(false), @@ -145,13 +231,11 @@ fShell(NULL), fWinchRunner(NULL), fCursorBlinkRunner(NULL), + fAutoScrollRunner(NULL), + fCharClassifier(NULL), fFontWidth(0), fFontHeight(0), fFontAscent(0), - fUpdateFlag(false), - fInsertModeFlag(MODE_OVER), - fScrollUpCount(0), - fScrollBarRange(0), fFrameResized(false), fLastCursorTime(0), fCursorDrawFlag(true), @@ -159,13 +243,10 @@ fCursorBlinkingFlag(true), fCursorRedrawFlag(true), fCursorHeight(0), - fCurPos(0, 0), - fCurStack(0, 0), - fBufferStartPos(-1), + fCursor(0, 0), fTermRows(rows), fTermColumns(columns), fEncoding(M_UTF8), - fTop(0), fTextBuffer(NULL), fScrollBar(NULL), fTextForeColor(kBlackColor), @@ -174,11 +255,8 @@ fCursorBackColor(kBlackColor), fSelectForeColor(kWhiteColor), fSelectBackColor(kBlackColor), - fScrTop(0), - fScrBot(fTermRows - 1), + fScrollOffset(0), fScrBufSize(historySize), - fScrRegionSet(0), - fClickPoint(0, 0), fSelStart(-1, -1), fSelEnd(-1, -1), fMouseTracking(false), @@ -206,13 +284,11 @@ fShell(NULL), fWinchRunner(NULL), fCursorBlinkRunner(NULL), + fAutoScrollRunner(NULL), + fCharClassifier(NULL), fFontWidth(0), fFontHeight(0), fFontAscent(0), - fUpdateFlag(false), - fInsertModeFlag(MODE_OVER), - fScrollUpCount(0), - fScrollBarRange(0), fFrameResized(false), fLastCursorTime(0), fCursorDrawFlag(true), @@ -220,13 +296,10 @@ fCursorBlinkingFlag(true), fCursorRedrawFlag(true), fCursorHeight(0), - fCurPos(0, 0), - fCurStack(0, 0), - fBufferStartPos(-1), + fCursor(0, 0), fTermRows(ROWS_DEFAULT), fTermColumns(COLUMNS_DEFAULT), fEncoding(M_UTF8), - fTop(0), fTextBuffer(NULL), fScrollBar(NULL), fTextForeColor(kBlackColor), @@ -235,11 +308,7 @@ fCursorBackColor(kBlackColor), fSelectForeColor(kWhiteColor), fSelectBackColor(kBlackColor), - fScrTop(0), - fScrBot(fTermRows - 1), fScrBufSize(1000), - fScrRegionSet(0), - fClickPoint(0, 0), fSelStart(-1, -1), fSelEnd(-1, -1), fMouseTracking(false), @@ -274,10 +343,20 @@ status_t TermView::_InitObject(int32 argc, const char **argv) { - fTextBuffer = new (std::nothrow) TermBuffer(fTermRows, fTermColumns, fScrBufSize); + fTextBuffer = new(std::nothrow) TerminalBuffer; if (fTextBuffer == NULL) return B_NO_MEMORY; + // TODO: Make the special word chars user-settable! + fCharClassifier = new(std::nothrow) CharClassifier( + kDefaultSpecialWordChars); + if (fCharClassifier == NULL) + return B_NO_MEMORY; + + status_t error = fTextBuffer->Init(fTermColumns, fTermRows, fScrBufSize); + if (error != B_OK) + return error; + fShell = new (std::nothrow) Shell(); if (fShell == NULL) return B_NO_MEMORY; @@ -299,8 +378,8 @@ SetLowColor(fTextBackColor); - SetViewColor(fTextBackColor); - + SetViewColor(B_TRANSPARENT_32_BIT); + return B_OK; } @@ -311,7 +390,9 @@ // _DetachShell sets fShell to NULL _DetachShell(); - + + delete fAutoScrollRunner; + delete fCharClassifier; delete fTextBuffer; delete shell; } @@ -352,9 +433,9 @@ TermView::GetPreferredSize(float *width, float *height) { if (width) - *width = fTermColumns * fFontWidth + 2 * kOffset; + *width = fTermColumns * fFontWidth; if (height) - *height = fTermRows * fFontHeight + 2 * kOffset; + *height = fTermRows * fFontHeight; } @@ -379,21 +460,36 @@ //! Set number of rows and columns in terminal BRect -TermView::SetTermSize(int rows, int cols, bool resize) +TermView::SetTermSize(int rows, int columns, bool resize) { +//debug_printf("TermView::SetTermSize(%d, %d)\n", rows, columns); if (rows > 0) fTermRows = rows; - if (cols > 0) - fTermColumns = cols; + if (columns > 0) + fTermColumns = columns; - fTextBuffer->ResizeTo(fTermRows, fTermColumns, 0); + // To keep things simple, get rid of the selection first. + _Deselect(); - fScrTop = 0; - fScrBot = fTermRows - 1; + { + BAutolock _(fTextBuffer); + if (fTextBuffer->ResizeTo(columns, rows) != B_OK) + return Bounds(); + } - BRect rect(0, 0, fTermColumns * fFontWidth + 2 * kOffset, - fTermRows * fFontHeight + 2 * kOffset); + fTermRows = rows; + fTermColumns = columns; +//debug_printf("Invalidate()\n"); + Invalidate(); + + if (fScrollBar != NULL) { + _UpdateScrollBarRange(); + fScrollBar->SetSteps(fFontHeight, fFontHeight * fTermRows); + } + + BRect rect(0, 0, fTermColumns * fFontWidth, fTermRows * fFontHeight); + if (resize) ResizeTo(rect.Width(), rect.Height()); @@ -408,7 +504,6 @@ fTextBackColor = back; SetLowColor(fTextBackColor); - SetViewColor(fTextBackColor); } @@ -461,7 +556,7 @@ fHalfFont = font; - _FixFontAttributes(fHalfFont); + fHalfFont.SetSpacing(B_FIXED_SPACING); // calculate half font's max width // Not Bounding, check only A-Z(For case of fHalfFont is KanjiFont. ) @@ -485,19 +580,14 @@ if (font_leading == 0) font_leading = 1; - if (fTop) - fTop = fTop / fFontHeight; - fFontAscent = font_ascent; fFontHeight = font_ascent + font_descent + font_leading + 1; - fTop = fTop * fFontHeight; - fCursorHeight = fFontHeight; - if (fScrollBar != NULL) { + _ScrollTo(0, false); + if (fScrollBar != NULL) fScrollBar->SetSteps(fFontHeight, fFontHeight * fTermRows); - } } @@ -524,6 +614,8 @@ void TermView::Copy(BClipboard *clipboard) { + BAutolock _(fTextBuffer); + if (!_HasSelection()) return; @@ -541,12 +633,6 @@ } clipboard->Unlock(); } - - // Deselecting the current selection is not the behavior that - // R5's Terminal app displays. We want to mimic the behavior, so we will - // no longer do the deselection -// if (!fMouseTracking) -// _DeSelect(); } @@ -555,13 +641,11 @@ { if (clipboard->Lock()) { BMessage *clipMsg = clipboard->Data(); - char *text; + const char* text; ssize_t numBytes; if (clipMsg->FindData("text/plain", B_MIME_TYPE, - (const void **)&text, &numBytes) == B_OK ) { - // Clipboard text doesn't attached EOF? - text[numBytes] = '\0'; - _WritePTY((uchar *)text, numBytes); + (const void**)&text, &numBytes) == B_OK ) { + _WritePTY(text, numBytes); } clipboard->Unlock(); @@ -572,432 +656,58 @@ void TermView::SelectAll() { - int screen_top = fTop / fFontHeight; - int viewheight = fTermRows; - - int start_pos = screen_top -(fScrBufSize - viewheight * 2); - - CurPos start, end; - start.x = 0; - end.x = fTermColumns -1; - - if (start_pos > 0) - start.y = start_pos; - else - start.y = 0; - - end.y = fCurPos.y + screen_top; - - _Select(start, end); + BAutolock _(fTextBuffer); + + _Select(TermPos(0, -fTextBuffer->HistorySize()), + TermPos(0, fTextBuffer->Height()), false, true); } void TermView::Clear() { - _DeSelect(); - fTextBuffer->Clear(); - - fTop = 0; - ScrollTo(0, 0); - - if (LockLooper()) { - SetHighColor(fTextBackColor); - FillRect(Bounds()); - SetHighColor(fTextForeColor); - UnlockLooper(); - } - - // reset cursor pos - SetCurPos(0, 0); - - if (fScrollBar) { - fScrollBar->SetRange(0, 0); - fScrollBar->SetProportion(1); - } -} + _Deselect(); - -//! Print one character -void -TermView::Insert(uchar *string, ushort attr) -{ - int width = CodeConv::UTF8GetFontWidth((char*)string); - if (width == FULL_WIDTH) - attr |= A_WIDTH; - - // check column over flow. - if (fCurPos.x + width > fTermColumns) { - UpdateLine(); - fCurPos.x = 0; - - if (fCurPos.y == fTermRows -1) - ScrollScreen(); - else - fCurPos.y++; + { + BAutolock _(fTextBuffer); + fTextBuffer->Clear(); } - if (fInsertModeFlag == MODE_INSERT) - fTextBuffer->InsertSpace(fCurPos, width); +//debug_printf("Invalidate()\n"); + Invalidate(); - fTextBuffer->WriteChar(fCurPos, string, attr); - - if (!fUpdateFlag) - fBufferStartPos = fCurPos.x; - - fCurPos.x += width; - fUpdateFlag = true; -} - - -//! Print a CR and move the cursor -void -TermView::InsertCR() -{ - UpdateLine(); - fTextBuffer->WriteCR(fCurPos); - fCurPos.x = 0; -} - - -//! Print a LF and move the cursor -void -TermView::InsertLF() -{ - UpdateLine(); - - if (fScrRegionSet) { - if (fCurPos.y == fScrBot) { - ScrollRegion(-1, -1, SCRUP, 1); - return; - } + _ScrollTo(0, false); + if (fScrollBar) { + fScrollBar->SetRange(0, 0); + fScrollBar->SetProportion(1); } - - if (fCurPos.x != fTermColumns){ - if (fCurPos.y == fTermRows -1) - ScrollScreen(); - else - fCurPos.y++; - } } -//! Print a NL and move the cursor +//! Draw region void -TermView::InsertNewLine(int num) +TermView::_InvalidateTextRange(TermPos start, TermPos end) { - ScrollRegion(fCurPos.y, -1, SCRDOWN, num); -} + if (end < start) + swap(start, end); - -//! Print a space -void -TermView::InsertSpace(int num) -{ - UpdateLine(); [... truncated: 4082 lines follow ...] From bonefish at mail.berlios.de Mon Jun 9 19:28:28 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 9 Jun 2008 19:28:28 +0200 Subject: [Haiku-commits] r25882 - haiku/trunk/src/apps/terminal Message-ID: <200806091728.m59HSSmU021290@sheep.berlios.de> Author: bonefish Date: 2008-06-09 19:28:28 +0200 (Mon, 09 Jun 2008) New Revision: 25882 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25882&view=rev Modified: haiku/trunk/src/apps/terminal/TermView.cpp Log: Removed work-around for now fixed bug #2355. Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-09 17:04:26 UTC (rev 25881) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-09 17:28:28 UTC (rev 25882) @@ -978,18 +978,6 @@ // } // } - // TODO: Work-around for #2355: updateRect is sometimes way larger than the - // clipping region frame). Determine the minimal update rect. - BRegion region; - GetClippingRegion(®ion); - if (region.CountRects() > 0) { - BRect clippingRect(region.Frame()); -//if (clippingRect != updateRect) -//debug_printf(" clipping rect: (%f, %f) - (%f, %f)\n", -//clippingRect.left, clippingRect.top, clippingRect.right, clippingRect.bottom); - updateRect = clippingRect; - } - _SynchronizeWithTextBuffer(&updateRect); int32 x1 = (int32)(updateRect.left) / fFontWidth; From anevilyak at gmail.com Mon Jun 9 19:30:39 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Mon, 9 Jun 2008 12:30:39 -0500 Subject: [Haiku-commits] r25881 - haiku/trunk/src/apps/terminal In-Reply-To: <200806091704.m59H4TO5022274@sheep.berlios.de> References: <200806091704.m59H4TO5022274@sheep.berlios.de> Message-ID: On Mon, Jun 9, 2008 at 12:04 PM, bonefish at BerliOS wrote: > Author: bonefish > Date: 2008-06-09 19:04:26 +0200 (Mon, 09 Jun 2008) > New Revision: 25881 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25881&view=rev > Wow, nice work! Regards, Rene From mmu_man at mail.berlios.de Mon Jun 9 20:08:25 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Mon, 9 Jun 2008 20:08:25 +0200 Subject: [Haiku-commits] r25883 - haiku/trunk/src/kits/interface Message-ID: <200806091808.m59I8PRc010367@sheep.berlios.de> Author: mmu_man Date: 2008-06-09 20:08:24 +0200 (Mon, 09 Jun 2008) New Revision: 25883 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25883&view=rev Modified: haiku/trunk/src/kits/interface/Window.cpp Log: gcc4 fix. Modified: haiku/trunk/src/kits/interface/Window.cpp =================================================================== --- haiku/trunk/src/kits/interface/Window.cpp 2008-06-09 17:28:28 UTC (rev 25882) +++ haiku/trunk/src/kits/interface/Window.cpp 2008-06-09 18:08:24 UTC (rev 25883) @@ -1204,7 +1204,7 @@ status_t error = fLink->Read(&token); if (error < B_OK || token == B_NULL_TOKEN) break; - ViewUpdateInfo* info = new (nothrow) ViewUpdateInfo; + ViewUpdateInfo* info = new (std::nothrow) ViewUpdateInfo; if (info == NULL || !infos.AddItem(info)) { delete info; break; From anevilyak at gmail.com Mon Jun 9 20:25:06 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Mon, 9 Jun 2008 13:25:06 -0500 Subject: [Haiku-commits] r25881 - haiku/trunk/src/apps/terminal In-Reply-To: References: <200806091704.m59H4TO5022274@sheep.berlios.de> Message-ID: On Mon, Jun 9, 2008 at 12:30 PM, Rene Gollent wrote: > On Mon, Jun 9, 2008 at 12:04 PM, bonefish at BerliOS > wrote: >> Author: bonefish >> Date: 2008-06-09 19:04:26 +0200 (Mon, 09 Jun 2008) >> New Revision: 25881 >> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25881&view=rev >> > By the way, has several build errors on gcc4, attached find a patch to fix (the ones in parse are due to ISO C++ forbidding assignment of arrays). Regards, Rene -------------- next part -------------- A non-text attachment was scrubbed... Name: term.gcc4.patch Type: application/octet-stream Size: 1239 bytes Desc: not available URL: From axeld at pinc-software.de Mon Jun 9 20:30:39 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 09 Jun 2008 20:30:39 +0200 CEST Subject: [Haiku-commits] r25881 - haiku/trunk/src/apps/terminal In-Reply-To: <200806091704.m59H4TO5022274@sheep.berlios.de> Message-ID: <40407754561-BeMail@zon> bonefish at BerliOS wrote: > * Cursor blinking is disabled. Do we want it anyway? Yes, as it's used everywhere to highlight possible keyboard input - the Terminal should be no exception there. Bye, Axel. From oruizdorantes at mail.berlios.de Mon Jun 9 20:51:05 2008 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Mon, 9 Jun 2008 20:51:05 +0200 Subject: [Haiku-commits] r25884 - haiku/trunk/src/add-ons/kernel/network/protocols/l2cap Message-ID: <200806091851.m59Ip5hR015795@sheep.berlios.de> Author: oruizdorantes Date: 2008-06-09 20:51:04 +0200 (Mon, 09 Jun 2008) New Revision: 25884 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25884&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.cpp haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_address.cpp Log: - Add some traces - Register the protocol - Remove some AF_INET stuff Although step by step will become the L2CAP protocol implementation, for the moment is just a testing and learning code. Modified: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.cpp 2008-06-09 18:08:24 UTC (rev 25883) +++ haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.cpp 2008-06-09 18:51:04 UTC (rev 25884) @@ -6,36 +6,38 @@ #include #include -#include #include #include #include #include + +#include "l2cap_address.h" + + +#define BT_DEBUG_THIS_MODULE #include -typedef NetBufferField ICMPChecksumField; +typedef NetBufferField AclLenField; -#define ICMP_TYPE_ECHO_REPLY 0 -#define ICMP_TYPE_UNREACH 3 -#define ICMP_TYPE_REDIRECT 5 -#define ICMP_TYPE_ECHO_REQUEST 8 -// type unreach codes -#define ICMP_CODE_UNREACH_NEED_FRAGMENT 4 // this is used for path MTU discovery - struct l2cap_protocol : net_protocol { }; +extern net_protocol_module_info gL2CAPModule; + net_buffer_module_info *gBufferModule; static net_stack_module_info *sStackModule; +static struct net_domain *sDomain; net_protocol * l2cap_init_protocol(net_socket *socket) { + flowf("\n"); + l2cap_protocol *protocol = new (std::nothrow) l2cap_protocol; if (protocol == NULL) return NULL; @@ -47,6 +49,8 @@ status_t l2cap_uninit_protocol(net_protocol *protocol) { + flowf("\n"); + delete protocol; return B_OK; } @@ -55,6 +59,8 @@ status_t l2cap_open(net_protocol *protocol) { + flowf("\n"); + return B_OK; } @@ -62,6 +68,8 @@ status_t l2cap_close(net_protocol *protocol) { + flowf("\n"); + return B_OK; } @@ -69,6 +77,8 @@ status_t l2cap_free(net_protocol *protocol) { + flowf("\n"); + return B_OK; } @@ -76,6 +86,8 @@ status_t l2cap_connect(net_protocol *protocol, const struct sockaddr *address) { + flowf("\n"); + return B_ERROR; } @@ -83,6 +95,8 @@ status_t l2cap_accept(net_protocol *protocol, struct net_socket **_acceptedSocket) { + flowf("\n"); + return EOPNOTSUPP; } @@ -91,8 +105,10 @@ l2cap_control(net_protocol *protocol, int level, int option, void *value, size_t *_length) { - return protocol->next->module->control(protocol->next, level, option, - value, _length); + flowf("\n"); + +/* return protocol->next->module->control(protocol->next, level, option, value, _length); */ + return EOPNOTSUPP; } @@ -100,8 +116,10 @@ l2cap_getsockopt(net_protocol *protocol, int level, int option, void *value, int *length) { - return protocol->next->module->getsockopt(protocol->next, level, option, - value, length); + flowf("\n"); + +/* return protocol->next->module->getsockopt(protocol->next, level, option, value, length); */ + return EOPNOTSUPP; } @@ -109,14 +127,18 @@ l2cap_setsockopt(net_protocol *protocol, int level, int option, const void *value, int length) { - return protocol->next->module->setsockopt(protocol->next, level, option, - value, length); + flowf("\n"); + +/* return protocol->next->module->setsockopt(protocol->next, level, option, value, length); */ + return EOPNOTSUPP; } status_t l2cap_bind(net_protocol *protocol, const struct sockaddr *address) { + flowf("\n"); + return B_ERROR; } @@ -124,6 +146,8 @@ status_t l2cap_unbind(net_protocol *protocol, struct sockaddr *address) { + flowf("\n"); + return B_ERROR; } @@ -131,6 +155,8 @@ status_t l2cap_listen(net_protocol *protocol, int count) { + flowf("\n"); + return EOPNOTSUPP; } @@ -138,6 +164,8 @@ status_t l2cap_shutdown(net_protocol *protocol, int direction) { + flowf("\n"); + return EOPNOTSUPP; } @@ -145,6 +173,8 @@ status_t l2cap_send_data(net_protocol *protocol, net_buffer *buffer) { + flowf("\n"); + return protocol->next->module->send_data(protocol->next, buffer); } @@ -153,6 +183,8 @@ l2cap_send_routed_data(net_protocol *protocol, struct net_route *route, net_buffer *buffer) { + flowf("\n"); + return protocol->next->module->send_routed_data(protocol->next, route, buffer); } @@ -160,6 +192,8 @@ ssize_t l2cap_send_avail(net_protocol *protocol) { + flowf("\n"); + return B_ERROR; } @@ -168,6 +202,8 @@ l2cap_read_data(net_protocol *protocol, size_t numBytes, uint32 flags, net_buffer **_buffer) { + flowf("\n"); + return B_ERROR; } @@ -175,6 +211,8 @@ ssize_t l2cap_read_avail(net_protocol *protocol) { + flowf("\n"); + return B_ERROR; } @@ -182,13 +220,17 @@ struct net_domain * l2cap_get_domain(net_protocol *protocol) { - return protocol->next->module->get_domain(protocol->next); + flowf("\n"); + + return sDomain; } size_t l2cap_get_mtu(net_protocol *protocol, const struct sockaddr *address) { + flowf("\n"); + return protocol->next->module->get_mtu(protocol->next, address); } @@ -196,7 +238,7 @@ status_t l2cap_receive_data(net_buffer *buffer) { - debugf("ICMP received some data, buffer length %lu\n", buffer->size); + debugf("received some data, buffer length %lu\n", buffer->size); NetBufferHeaderReader bufferHeader(buffer); if (bufferHeader.Status() < B_OK) @@ -204,7 +246,7 @@ hci_acl_header &header = bufferHeader.Data(); - debugf(" got type %u, code %u, checksum %u\n", header.type, header.code, ntohs(header.checksum)); + debugf(" got handle %u, len %u\n", header.handle, header.alen); debugf(" computed checksum: %ld\n", gBufferModule->checksum(buffer, 0, buffer->size, true)); if (gBufferModule->checksum(buffer, 0, buffer->size, true) != 0) @@ -218,6 +260,8 @@ status_t l2cap_error(uint32 code, net_buffer *data) { + flowf("\n"); + return B_ERROR; } @@ -226,29 +270,52 @@ l2cap_error_reply(net_protocol *protocol, net_buffer *causedError, uint32 code, void *errorData) { + flowf("\n"); + return B_ERROR; } -// #pragma mark - +#if 0 +#pragma mark - +#endif - static status_t l2cap_std_ops(int32 op, ...) { + flowf("\n"); + switch (op) { case B_MODULE_INIT: { - sStackModule->register_domain_protocols(AF_INET, SOCK_DGRAM, IPPROTO_ICMP, + status_t error; + + error = sStackModule->register_domain_protocols(AF_BLUETOOTH, SOCK_STREAM, BLUETOOTH_PROTO_L2CAP, "network/protocols/l2cap/v1", NULL); + if (error != B_OK) { + return error; + } - sStackModule->register_domain_receiving_protocol(AF_INET, IPPROTO_ICMP, + error = sStackModule->register_domain_receiving_protocol(AF_BLUETOOTH, BLUETOOTH_PROTO_L2CAP, "network/protocols/l2cap/v1"); + if (error != B_OK) { + return error; + } + + error = sStackModule->register_domain(AF_BLUETOOTH, "l2cap", &gL2CAPModule, + &gL2cap4AddressModule, &sDomain); + if (error != B_OK) { + return error; + } + + return B_OK; } case B_MODULE_UNINIT: + + sStackModule->unregister_domain(sDomain); return B_OK; default: @@ -257,7 +324,7 @@ } -net_protocol_module_info sL2CAPModule = { +net_protocol_module_info gL2CAPModule = { { "network/protocols/l2cap/v1", 0, @@ -299,6 +366,6 @@ }; module_info *modules[] = { - (module_info *)&sL2CAPModule, + (module_info *)&gL2CAPModule, NULL }; Modified: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_address.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_address.cpp 2008-06-09 18:08:24 UTC (rev 25883) +++ haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_address.cpp 2008-06-09 18:51:04 UTC (rev 25884) @@ -18,6 +18,7 @@ #include #include +#include #include #define L2CAP_CHECKSUM(address) (address.b[0]+\ @@ -36,7 +37,7 @@ result of \a from & \a mask). \return B_OK if the address could be copied \return B_NO_MEMORY if the new address could not be allocated - \return B_MISMATCHED_VALUES if \a address does not match family AF_INET + \return B_MISMATCHED_VALUES if \a address does not match family AF_BLUETOOTH */ static status_t l2cap_copy_address(const sockaddr *from, sockaddr **to, @@ -47,13 +48,13 @@ if (*to == NULL) return B_NO_MEMORY; - memset(*to, 0, sizeof(sockaddr_in)); - (*to)->sa_family = AF_INET; - (*to)->sa_len = sizeof(sockaddr_in); + memset(*to, 0, sizeof(sockaddr_l2cap)); + (*to)->sa_family = AF_BLUETOOTH; + (*to)->sa_len = sizeof(sockaddr_l2cap); } else { if (from == NULL) return B_OK; - if (from->sa_family != AF_INET) + if (from->sa_family != AF_BLUETOOTH) return B_MISMATCHED_VALUES; *to = (sockaddr *)malloc(sizeof(sockaddr_in)); @@ -285,7 +286,7 @@ Sets \a address to \a from. \return B_OK if \a from has been copied into \a address \return B_BAD_VALUE if either \a address or \a from is NULL - \return B_MISMATCHED_VALUES if from is not of family AF_INET + \return B_MISMATCHED_VALUES if from is not of family AF_BLUETOOTH */ static status_t l2cap_set_to(sockaddr *address, const sockaddr *from) @@ -314,7 +315,7 @@ if (from->l2cap_family != AF_BLUETOOTH) return B_BAD_VALUE; - address->l2cap_family = AF_INET; + address->l2cap_family = AF_BLUETOOTH; address->l2cap_len = sizeof(sockaddr_l2cap); if (address->l2cap_psm == 0) From bonefish at mail.berlios.de Mon Jun 9 20:52:09 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 9 Jun 2008 20:52:09 +0200 Subject: [Haiku-commits] r25885 - haiku/trunk/src/apps/terminal Message-ID: <200806091852.m59Iq9lP015957@sheep.berlios.de> Author: bonefish Date: 2008-06-09 20:52:09 +0200 (Mon, 09 Jun 2008) New Revision: 25885 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25885&view=rev Modified: haiku/trunk/src/apps/terminal/TermScrollView.cpp haiku/trunk/src/apps/terminal/TermView.cpp haiku/trunk/src/apps/terminal/TermWindow.cpp haiku/trunk/src/apps/terminal/TerminalBuffer.cpp haiku/trunk/src/apps/terminal/UTF8Char.h Log: GCC 4 fixes. Modified: haiku/trunk/src/apps/terminal/TermScrollView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermScrollView.cpp 2008-06-09 18:51:04 UTC (rev 25884) +++ haiku/trunk/src/apps/terminal/TermScrollView.cpp 2008-06-09 18:52:09 UTC (rev 25885) @@ -24,7 +24,7 @@ virtual void ValueChanged(float newValue) { if (BView* target = Target()) - Target()->ScrollTo(0, newValue); + target->ScrollTo(0, newValue); } }; Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-09 18:51:04 UTC (rev 25884) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-09 18:52:09 UTC (rev 25885) @@ -689,7 +689,7 @@ TermView::_InvalidateTextRange(TermPos start, TermPos end) { if (end < start) - swap(start, end); + std::swap(start, end); if (start.y == end.y) { _InvalidateTextRect(start.x, start.y, end.x, end.y); @@ -871,7 +871,7 @@ memcpy(buffer, character.bytes, bytes); buffer[bytes] = '\0'; - _DrawLinePart(fCursor.x * fFontWidth, _LineOffset(fCursor.y), + _DrawLinePart(fCursor.x * fFontWidth, (int32)_LineOffset(fCursor.y), attr, buffer, width, selected, true, this); } else { if (selected) @@ -1022,7 +1022,7 @@ continue; } - _DrawLinePart(fFontWidth * i, _LineOffset(j), + _DrawLinePart(fFontWidth * i, (int32)_LineOffset(j), attr, buf, count, insideSelection, false, this); i += count; if (i >= fTermColumns) Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.cpp 2008-06-09 18:51:04 UTC (rev 25884) +++ haiku/trunk/src/apps/terminal/TermWindow.cpp 2008-06-09 18:52:09 UTC (rev 25885) @@ -487,7 +487,7 @@ font.SetSize(size); view->SetTermFont(&font); - PrefHandler::Default()->setInt32(PREF_HALF_FONT_SIZE, size); + PrefHandler::Default()->setInt32(PREF_HALF_FONT_SIZE, (int32)size); _ResizeView(view); break; Modified: haiku/trunk/src/apps/terminal/TerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TerminalBuffer.cpp 2008-06-09 18:51:04 UTC (rev 25884) +++ haiku/trunk/src/apps/terminal/TerminalBuffer.cpp 2008-06-09 18:52:09 UTC (rev 25885) @@ -561,8 +561,7 @@ while (*_pattern != '\0') { int32 charLen = UTF8Char::ByteCount(*_pattern); if (charLen > 0) { - pattern[patternLen].bytes = (char[]){ 0, 0, 0, 0 }; - memcpy(pattern[patternLen].bytes, _pattern, charLen); + pattern[patternLen].SetTo(_pattern, charLen); // if not case sensitive, convert to lower case if (!caseSensitive && charLen == 1) @@ -678,8 +677,7 @@ TerminalBuffer::Insert(uchar* string, ushort attr) { // TODO: Remove! Use InsertChar instead! - UTF8Char character; - character.bytes = (char[]){ string[0], string[1], string[2], string[3] }; + UTF8Char character((const char*)string, 4); InsertChar(character, attr); } Modified: haiku/trunk/src/apps/terminal/UTF8Char.h =================================================================== --- haiku/trunk/src/apps/terminal/UTF8Char.h 2008-06-09 18:51:04 UTC (rev 25884) +++ haiku/trunk/src/apps/terminal/UTF8Char.h 2008-06-09 18:52:09 UTC (rev 25885) @@ -21,6 +21,24 @@ bytes[0] = c; } + UTF8Char(const char* c, int32 count) + { + SetTo(c, count); + } + + void SetTo(const char* c, int32 count) + { + bytes[0] = c[0]; + if (count > 1) { + bytes[1] = c[1]; + if (count > 2) { + bytes[2] = c[2]; + if (count > 3) + bytes[3] = c[3]; + } + } + } + static int32 ByteCount(char firstChar) { // Note, this does not recognize invalid chars From ingo_weinhold at gmx.de Mon Jun 9 20:50:23 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Mon, 09 Jun 2008 20:50:23 +0200 Subject: [Haiku-commits] r25881 - haiku/trunk/src/apps/terminal In-Reply-To: References: <200806091704.m59H4TO5022274@sheep.berlios.de> Message-ID: <20080609205023.750.1@knochen-vm.1213013263.fake> On 2008-06-09 at 20:25:06 [+0200], Rene Gollent wrote: > On Mon, Jun 9, 2008 at 12:30 PM, Rene Gollent wrote: > > On Mon, Jun 9, 2008 at 12:04 PM, bonefish at BerliOS > > wrote: > >> Author: bonefish > >> Date: 2008-06-09 19:04:26 +0200 (Mon, 09 Jun 2008) > >> New Revision: 25881 > >> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25881&view=rev > >> > > > > By the way, has several build errors on gcc4, attached find a patch to > fix (the ones in parse are due to ISO C++ forbidding assignment of > arrays). Thanks, I solved the character assignment a little differently though. CU, Ingo From anevilyak at gmail.com Mon Jun 9 20:56:24 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Mon, 9 Jun 2008 13:56:24 -0500 Subject: [Haiku-commits] r25881 - haiku/trunk/src/apps/terminal In-Reply-To: <20080609205023.750.1@knochen-vm.1213013263.fake> References: <200806091704.m59H4TO5022274@sheep.berlios.de> <20080609205023.750.1@knochen-vm.1213013263.fake> Message-ID: On Mon, Jun 9, 2008 at 1:50 PM, Ingo Weinhold wrote: > > Thanks, I solved the character assignment a little differently though. > Cool, mine was more or less just quick and dirty, I'll confess I didn't look too closely at UTF8Char before patching that. Regards, Rene From bonefish at mail.berlios.de Mon Jun 9 21:35:34 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 9 Jun 2008 21:35:34 +0200 Subject: [Haiku-commits] r25886 - haiku/trunk/src/apps/terminal Message-ID: <200806091935.m59JZYub020320@sheep.berlios.de> Author: bonefish Date: 2008-06-09 21:35:33 +0200 (Mon, 09 Jun 2008) New Revision: 25886 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25886&view=rev Modified: haiku/trunk/src/apps/terminal/TermParse.cpp haiku/trunk/src/apps/terminal/TermParse.h Log: Changed the way the pty reader and output parser thread communicate. The parser was acquiring a semaphore for each character. Now it only acquires a semaphore when the buffer is empty. This speeds up output bound programs. In my setup "seq" is now 3 times faster. Which is still rather slow. Modified: haiku/trunk/src/apps/terminal/TermParse.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-09 18:52:09 UTC (rev 25885) +++ haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-09 19:35:33 UTC (rev 25886) @@ -56,8 +56,9 @@ fReaderThread(-1), fReaderSem(-1), fReaderLocker(-1), - fBufferPosition(0), - fLockFlag(0), + fBufferPosition(0), + fReadBufferSize(0), + fParserWaiting(false), fBuffer(NULL), fQuitting(true) { @@ -117,45 +118,37 @@ status_t TermParse::GetReaderBuf(uchar &c) { - status_t status; -#if 0 - do { - status = acquire_sem_etc(fReaderSem, 1, B_TIMEOUT, 10000); - } while (status == B_INTERRUPTED); + // wait for new input from pty + if (fReadBufferSize == 0) { + fBuffer->Unlock(); - if (status == B_TIMED_OUT) { - fBuffer->ScrollAtCursor(); - fBuffer->UpdateLine(); + fParserWaiting = true; - // Reset cursor blinking time and turn on cursor blinking. - fBuffer->SetCurDraw(true); -#endif + status_t status = B_OK; + while (fReadBufferSize == 0 && status == B_OK) { + do { + status = acquire_sem(fReaderSem); + } while (status == B_INTERRUPTED); + } - // wait new input from pty. -fBuffer->Unlock(); - do { - status = acquire_sem(fReaderSem); - } while (status == B_INTERRUPTED); -fBuffer->Lock(); + fParserWaiting = false; + + fBuffer->Lock(); + if (status < B_OK) return status; + } -#if 0 - } else if (status == B_OK) { - // Do nothing - } else - return status; -#endif + c = fReadBuffer[fBufferPosition]; + fBufferPosition = (fBufferPosition + 1) % READ_BUF_SIZE; - c = fReadBuffer[fBufferPosition % READ_BUF_SIZE]; - fBufferPosition++; - // If PtyReader thread locked, decrement counter and unlock thread. - if (fLockFlag != 0) { - if (--fLockFlag == 0) - release_sem(fReaderLocker); - } + int32 bufferSize = atomic_add(&fReadBufferSize, -1) - 1; -// fBuffer->SetCurDraw(false); + // If the pty reader thread waits and we have made enough space in the + // buffer now, let it run again. + if (READ_BUF_SIZE - bufferSize == MIN_PTY_BUFFER_SPACE) + release_sem(fReaderLocker); + return B_OK; } @@ -248,22 +241,24 @@ int32 TermParse::PtyReader() { - uint read_p = 0; + int32 bufferSize = 0; + int32 readPos = 0; while (!fQuitting) { // If Pty Buffer nearly full, snooze this thread, and continue. - if ((read_p - fBufferPosition) > READ_BUF_SIZE - 16) { - fLockFlag = READ_BUF_SIZE / 2; + while (READ_BUF_SIZE - bufferSize < MIN_PTY_BUFFER_SPACE) { status_t status; do { status = acquire_sem(fReaderLocker); } while (status == B_INTERRUPTED); if (status < B_OK) return status; + + bufferSize = fReadBufferSize; } // Read PTY uchar buf[READ_BUF_SIZE]; - int nread = read(fFd, buf, READ_BUF_SIZE - (read_p - fBufferPosition)); + ssize_t nread = read(fFd, buf, READ_BUF_SIZE - bufferSize); if (nread <= 0) { fBuffer->NotifyQuit(errno); return B_OK; @@ -271,19 +266,20 @@ // Copy read string to PtyBuffer. - int left = READ_BUF_SIZE - (read_p % READ_BUF_SIZE); - int mod = read_p % READ_BUF_SIZE; + int32 left = READ_BUF_SIZE - readPos; if (nread >= left) { - memcpy(fReadBuffer + mod, buf, left); + memcpy(fReadBuffer + readPos, buf, left); memcpy(fReadBuffer, buf + left, nread - left); } else - memcpy(fReadBuffer + mod, buf, nread); + memcpy(fReadBuffer + readPos, buf, nread); - read_p += nread; + bufferSize = atomic_add(&fReadBufferSize, nread); + if (bufferSize == 0 && fParserWaiting) + release_sem(fReaderSem); - // Release semaphore. Number of semaphore counter is nread. - release_sem_etc(fReaderSem, nread, 0); + bufferSize += nread; + readPos = (readPos + nread) % READ_BUF_SIZE; } return B_OK; Modified: haiku/trunk/src/apps/terminal/TermParse.h =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.h 2008-06-09 18:52:09 UTC (rev 25885) +++ haiku/trunk/src/apps/terminal/TermParse.h 2008-06-09 19:35:33 UTC (rev 25886) @@ -37,9 +37,12 @@ #include -//PtyReader buffer size. #define READ_BUF_SIZE 2048 + // pty read buffer size +#define MIN_PTY_BUFFER_SPACE 16 + // minimal space left before the reader tries to read more + class TerminalBuffer; class TermParse : public BHandler { @@ -80,6 +83,8 @@ uint fBufferPosition; uchar fReadBuffer[READ_BUF_SIZE]; + vint32 fReadBufferSize; + volatile bool fParserWaiting; int fLockFlag; From bonefish at mail.berlios.de Mon Jun 9 22:12:38 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 9 Jun 2008 22:12:38 +0200 Subject: [Haiku-commits] r25887 - haiku/trunk/src/apps/terminal Message-ID: <200806092012.m59KCc2o024971@sheep.berlios.de> Author: bonefish Date: 2008-06-09 22:12:38 +0200 (Mon, 09 Jun 2008) New Revision: 25887 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25887&view=rev Modified: haiku/trunk/src/apps/terminal/TermView.cpp haiku/trunk/src/apps/terminal/TerminalBuffer.cpp haiku/trunk/src/apps/terminal/TerminalBuffer.h Log: Propagate the encoding to TerminalBuffer. It doesn't really belong there, but that's the easiest solution for the time being. Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-09 19:35:33 UTC (rev 25886) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-09 20:12:38 UTC (rev 25887) @@ -356,6 +356,7 @@ status_t error = fTextBuffer->Init(fTermColumns, fTermRows, fScrBufSize); if (error != B_OK) return error; + fTextBuffer->SetEncoding(fEncoding); fShell = new (std::nothrow) Shell(); if (fShell == NULL) @@ -537,6 +538,9 @@ // the string value of encoding. But when this function is called and // the encoding changes, the new value is never passed to Shell. fEncoding = encoding; + + BAutolock _(fTextBuffer); + fTextBuffer->SetEncoding(fEncoding); } Modified: haiku/trunk/src/apps/terminal/TerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TerminalBuffer.cpp 2008-06-09 19:35:33 UTC (rev 25886) +++ haiku/trunk/src/apps/terminal/TerminalBuffer.cpp 2008-06-09 20:12:38 UTC (rev 25887) @@ -89,7 +89,8 @@ TerminalBuffer::TerminalBuffer() : BLocker("terminal buffer"), - fHistory(NULL) + fHistory(NULL), + fEncoding(M_UTF8) { } @@ -145,11 +146,17 @@ int TerminalBuffer::Encoding() const { -// TODO: Remove, if not needed! - return M_UTF8; + return fEncoding; } +void +TerminalBuffer::SetEncoding(int encoding) +{ + fEncoding = encoding; +} + + status_t TerminalBuffer::ResizeTo(int32 width, int32 height) { Modified: haiku/trunk/src/apps/terminal/TerminalBuffer.h =================================================================== --- haiku/trunk/src/apps/terminal/TerminalBuffer.h 2008-06-09 19:35:33 UTC (rev 25886) +++ haiku/trunk/src/apps/terminal/TerminalBuffer.h 2008-06-09 20:12:38 UTC (rev 25887) @@ -50,6 +50,7 @@ void SetListener(BMessenger listener); int Encoding() const; + void SetEncoding(int encoding); int32 Width() const { return fWidth; } int32 Height() const { return fHeight; } @@ -182,6 +183,8 @@ bool fOverwriteMode; // false for insert + int fEncoding; + // listener/dirty region management BMessenger fListener; TerminalBufferDirtyInfo fDirtyInfo; From bonefish at mail.berlios.de Mon Jun 9 22:14:45 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 9 Jun 2008 22:14:45 +0200 Subject: [Haiku-commits] r25888 - haiku/trunk/src/apps/terminal Message-ID: <200806092014.m59KEjmQ025155@sheep.berlios.de> Author: bonefish Date: 2008-06-09 22:14:45 +0200 (Mon, 09 Jun 2008) New Revision: 25888 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25888&view=rev Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp Log: Renamed "Font Encoding" to "Text Encoding" as it really has nothing to do with the font. Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.cpp 2008-06-09 20:12:38 UTC (rev 25887) +++ haiku/trunk/src/apps/terminal/TermWindow.cpp 2008-06-09 20:14:45 UTC (rev 25888) @@ -203,7 +203,7 @@ fWindowSizeMenu = new BMenu("Window Size"); _BuildWindowSizeMenu(fWindowSizeMenu); - fEncodingmenu = new BMenu("Font Encoding"); + fEncodingmenu = new BMenu("Text Encoding"); fEncodingmenu->SetRadioMode(true); MakeEncodingMenu(fEncodingmenu, true); fHelpmenu->AddItem(fWindowSizeMenu); From korli at mail.berlios.de Mon Jun 9 22:32:55 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Mon, 9 Jun 2008 22:32:55 +0200 Subject: [Haiku-commits] r25889 - haiku/trunk/build/jam Message-ID: <200806092032.m59KWtcL026840@sheep.berlios.de> Author: korli Date: 2008-06-09 22:32:54 +0200 (Mon, 09 Jun 2008) New Revision: 25889 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25889&view=rev Modified: haiku/trunk/build/jam/ImageRules Log: added AddNewDriversToHaikuImage to replace AddDriverRegistrationToHaikuImage: it places drivers which supports the new device architecture at the right place Modified: haiku/trunk/build/jam/ImageRules =================================================================== --- haiku/trunk/build/jam/ImageRules 2008-06-09 20:14:45 UTC (rev 25888) +++ haiku/trunk/build/jam/ImageRules 2008-06-09 20:32:54 UTC (rev 25889) @@ -298,25 +298,16 @@ } } -rule AddDriverRegistrationToContainer container : relativeDirectoryTokens - : target : links +rule AddNewDriversToContainer container : relativeDirectoryTokens + : targets { - # AddDriverRegistrationToContainer : - # : : ] ; + # AddNewDriversToContainer : : ; # - local directoryTokens = beos system add-ons kernel registration + local directoryTokens = beos system add-ons kernel drivers $(relativeDirectoryTokens) ; - # get the relative symlink path prefix - local linkPrefix = ; - for i in $(relativeDirectoryTokens) { - linkPrefix += .. ; - } - linkPrefix += .. drivers bin ; - - # add the symlink - AddSymlinkToContainer $(container) : $(directoryTokens) - : [ FDirName $(linkPrefix) $(target:BS) ] : $(links) ; + AddFilesToContainer $(container) : $(directoryTokens) + : $(targets) ; } rule AddBootModuleSymlinksToContainer container : targets @@ -666,12 +657,12 @@ : $(relativeDirectoryTokens) : $(targets) ; } -rule AddDriverRegistrationToHaikuImage relativeDirectoryTokens : target : links +rule AddNewDriversToHaikuImage relativeDirectoryTokens : targets { - # AddDriverRegistrationToHaikuImage : : ] ; + # AddNewDriversToHaikuImage : ; - AddDriverRegistrationToContainer $(HAIKU_IMAGE_CONTAINER_NAME) - : $(relativeDirectoryTokens) : $(target) : $(links) ; + AddNewDriversToContainer $(HAIKU_IMAGE_CONTAINER_NAME) + : $(relativeDirectoryTokens) : $(targets) ; } rule AddBootModuleSymlinksToHaikuImage targets From korli at mail.berlios.de Mon Jun 9 22:42:53 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Mon, 9 Jun 2008 22:42:53 +0200 Subject: [Haiku-commits] r25890 - in haiku/trunk/src/add-ons/kernel/drivers/power: . acpi_lid Message-ID: <200806092042.m59KgrAL027929@sheep.berlios.de> Author: korli Date: 2008-06-09 22:42:53 +0200 (Mon, 09 Jun 2008) New Revision: 25890 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25890&view=rev Added: haiku/trunk/src/add-ons/kernel/drivers/power/acpi_lid/ haiku/trunk/src/add-ons/kernel/drivers/power/acpi_lid/Jamfile haiku/trunk/src/add-ons/kernel/drivers/power/acpi_lid/acpi_lid.c haiku/trunk/src/add-ons/kernel/drivers/power/acpi_lid/acpi_lid.h Log: added a driver for ACPI lid: only detection is implemented, and not sure a dev entry is needed Added: haiku/trunk/src/add-ons/kernel/drivers/power/acpi_lid/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/power/acpi_lid/Jamfile 2008-06-09 20:32:54 UTC (rev 25889) +++ haiku/trunk/src/add-ons/kernel/drivers/power/acpi_lid/Jamfile 2008-06-09 20:42:53 UTC (rev 25890) @@ -0,0 +1,15 @@ +SubDir HAIKU_TOP src add-ons kernel drivers power acpi_lid ; + +SetSubDirSupportedPlatformsBeOSCompatible ; + +if $(TARGET_PLATFORM) != haiku { + # Needed for . Unfortunately we also get the other headers there, + # that we don't really want. + UsePublicHeaders drivers ; +} + +KernelAddon acpi_lid : + acpi_lid.c + ; + +Depends acpi_thermal : acpi ; Added: haiku/trunk/src/add-ons/kernel/drivers/power/acpi_lid/acpi_lid.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/power/acpi_lid/acpi_lid.c 2008-06-09 20:32:54 UTC (rev 25889) +++ haiku/trunk/src/add-ons/kernel/drivers/power/acpi_lid/acpi_lid.c 2008-06-09 20:42:53 UTC (rev 25890) @@ -0,0 +1,249 @@ +/* + * Copyright 2008, Haiku, Inc. All Rights Reserved. + * + * Distributed under the terms of the MIT License. + */ + +#include +#include +#include +#include + +#include +#include + +#include +#include "acpi_lid.h" + +#define ACPI_LID_MODULE_NAME "drivers/power/acpi_lid/driver_v1" + +#define ACPI_LID_DEVICE_MODULE_NAME "drivers/power/acpi_lid/device_v1" + +/* Base Namespace devices are published to */ +#define ACPI_LID_BASENAME "power/acpi_lid/%d" + +// name of pnp generator of path ids +#define ACPI_LID_PATHID_GENERATOR "acpi_lid/path_id" + +static device_manager_info *sDeviceManager; + +typedef struct acpi_ns_device_info { + device_node *node; + acpi_device_module_info *acpi; + acpi_device acpi_cookie; +} acpi_lid_device_info; + + +// #pragma mark - device module API + + +static status_t +acpi_lid_init_device(void *_cookie, void **cookie) +{ + device_node *node = (device_node *)_cookie; + acpi_lid_device_info *device; + device_node *parent; + + device = (acpi_lid_device_info *)calloc(1, sizeof(*device)); + if (device == NULL) + return B_NO_MEMORY; + + device->node = node; + + parent = sDeviceManager->get_parent_node(node); + sDeviceManager->get_driver(parent, (driver_module_info **)&device->acpi, + (void **)&device->acpi_cookie); + sDeviceManager->put_node(parent); + + *cookie = device; + return B_OK; +} + + +static void +acpi_lid_uninit_device(void *_cookie) +{ + acpi_lid_device_info *device = (acpi_lid_device_info *)_cookie; + free(device); +} + + +static status_t +acpi_lid_open(void *_cookie, const char *path, int flags, void** cookie) +{ + acpi_lid_device_info *device = (acpi_lid_device_info *)_cookie; + *cookie = device; + return B_OK; +} + + +static status_t +acpi_lid_read(void* _cookie, off_t position, void *buf, size_t* num_bytes) +{ + return B_ERROR; +} + + +static status_t +acpi_lid_write(void* cookie, off_t position, const void* buffer, size_t* num_bytes) +{ + return B_ERROR; +} + + +static status_t +acpi_lid_control(void* _cookie, uint32 op, void* arg, size_t len) +{ + acpi_lid_device_info* device = (acpi_lid_device_info*)_cookie; + + return B_ERROR; +} + + +static status_t +acpi_lid_close (void* cookie) +{ + return B_OK; +} + + +static status_t +acpi_lid_free (void* cookie) +{ + return B_OK; +} + + +// #pragma mark - driver module API + + +static float +acpi_lid_support(device_node *parent) +{ + const char *bus; + uint32 device_type; + const char *hid; + + dprintf("acpi_lid_support\n"); + + // make sure parent is really the ACPI bus manager + if (sDeviceManager->get_attr_string(parent, B_DEVICE_BUS, &bus, false)) + return -1; + + if (strcmp(bus, "acpi")) + return 0.0; + + // check whether it's really a device + if (sDeviceManager->get_attr_uint32(parent, ACPI_DEVICE_TYPE_ITEM, &device_type, false) != B_OK + || device_type != ACPI_TYPE_DEVICE) { + return 0.0; + } + + // check whether it's a lid device + if (sDeviceManager->get_attr_string(parent, ACPI_DEVICE_HID_ITEM, &hid, false) != B_OK + || strcmp(hid, "PNP0C0D")) { + return 0.0; + } + + return 0.6; +} + + +static status_t +acpi_lid_register_device(device_node *node) +{ + device_attr attrs[] = { + { B_DEVICE_PRETTY_NAME, B_STRING_TYPE, { string: "ACPI Lid" }}, + { NULL } + }; + + return sDeviceManager->register_node(node, ACPI_LID_MODULE_NAME, attrs, NULL, NULL); +} + + +static status_t +acpi_lid_init_driver(device_node *node, void **_driverCookie) +{ + *_driverCookie = node; + return B_OK; +} + + +static void +acpi_lid_uninit_driver(void *driverCookie) +{ +} + + +static status_t +acpi_lid_register_child_devices(void *_cookie) +{ + device_node *node = _cookie; + int path_id; + char name[128]; + + dprintf("acpi_lid_register_child_devices\n"); + + path_id = sDeviceManager->create_id(ACPI_LID_PATHID_GENERATOR); + if (path_id < 0) { + dprintf("acpi_lid_register_child_devices: couldn't create a path_id\n"); + return B_ERROR; + } + + snprintf(name, sizeof(name), ACPI_LID_BASENAME, path_id); + + return sDeviceManager->publish_device(node, name, ACPI_LID_DEVICE_MODULE_NAME); +} + + +module_dependency module_dependencies[] = { + { B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&sDeviceManager }, + {} +}; + + +driver_module_info acpi_lid_driver_module = { + { + ACPI_LID_MODULE_NAME, + 0, + NULL + }, + + acpi_lid_support, + acpi_lid_register_device, + acpi_lid_init_driver, + acpi_lid_uninit_driver, + acpi_lid_register_child_devices, + NULL, // rescan + NULL, // removed +}; + + +struct device_module_info acpi_lid_device_module = { + { + ACPI_LID_DEVICE_MODULE_NAME, + 0, + NULL + }, + + acpi_lid_init_device, + acpi_lid_uninit_device, + NULL, + + acpi_lid_open, + acpi_lid_close, + acpi_lid_free, + acpi_lid_read, + acpi_lid_write, + NULL, + acpi_lid_control, + + NULL, + NULL +}; + +module_info *modules[] = { + (module_info *)&acpi_lid_driver_module, + (module_info *)&acpi_lid_device_module, + NULL +}; Added: haiku/trunk/src/add-ons/kernel/drivers/power/acpi_lid/acpi_lid.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/power/acpi_lid/acpi_lid.h 2008-06-09 20:32:54 UTC (rev 25889) +++ haiku/trunk/src/add-ons/kernel/drivers/power/acpi_lid/acpi_lid.h 2008-06-09 20:42:53 UTC (rev 25890) @@ -0,0 +1,13 @@ +/* + * Copyright 2008, Haiku, Inc. All Rights Reserved. + * + * Distributed under the terms of the MIT License. + */ +#ifndef _ACPI_LID_H +#define _ACPI_LID_H + +#include +#include + + +#endif /* _ACPI_LID_H */ From korli at mail.berlios.de Mon Jun 9 22:45:19 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Mon, 9 Jun 2008 22:45:19 +0200 Subject: [Haiku-commits] r25891 - haiku/trunk/src/add-ons/kernel/drivers/power/acpi_lid Message-ID: <200806092045.m59KjJqp028293@sheep.berlios.de> Author: korli Date: 2008-06-09 22:45:19 +0200 (Mon, 09 Jun 2008) New Revision: 25891 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25891&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/power/acpi_lid/Jamfile Log: fix dependency Modified: haiku/trunk/src/add-ons/kernel/drivers/power/acpi_lid/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/power/acpi_lid/Jamfile 2008-06-09 20:42:53 UTC (rev 25890) +++ haiku/trunk/src/add-ons/kernel/drivers/power/acpi_lid/Jamfile 2008-06-09 20:45:19 UTC (rev 25891) @@ -12,4 +12,4 @@ acpi_lid.c ; -Depends acpi_thermal : acpi ; +Depends acpi_lid : acpi ; From bonefish at mail.berlios.de Mon Jun 9 23:09:02 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 9 Jun 2008 23:09:02 +0200 Subject: [Haiku-commits] r25892 - haiku/trunk/src/apps/terminal Message-ID: <200806092109.m59L92CA031042@sheep.berlios.de> Author: bonefish Date: 2008-06-09 23:09:02 +0200 (Mon, 09 Jun 2008) New Revision: 25892 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25892&view=rev Modified: haiku/trunk/src/apps/terminal/TermParse.cpp haiku/trunk/src/apps/terminal/TerminalBuffer.cpp haiku/trunk/src/apps/terminal/TerminalBuffer.h Log: Some renaming and inlining of TerminalBuffer methods. Modified: haiku/trunk/src/apps/terminal/TermParse.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-09 20:45:19 UTC (rev 25891) +++ haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-09 21:09:02 UTC (rev 25892) @@ -330,8 +330,8 @@ int cs96 = 0; uchar curess = 0; - uchar cbuf[4], dstbuf[4]; - uchar *ptr; + char cbuf[4], dstbuf[4]; + char *ptr; int now_coding = -1; @@ -393,9 +393,7 @@ //debug_printf("TermParse: char: '%c' (%d), parse state: %d\n", c, c, parsestate[c]); switch (parsestate[c]) { case CASE_PRINT: - cbuf[0] = c; - cbuf[1] = '\0'; - fBuffer->Insert(cbuf, attr); + fBuffer->InsertChar((char)c, attr); break; case CASE_PRINT_GR: @@ -414,14 +412,16 @@ case CASE_SS3: /* JIS X 0212 */ *ptr++ = curess; *ptr++ = c; - GetReaderBuf(*ptr++); + GetReaderBuf(c); + *ptr++ = c; *ptr = 0; curess = 0; break; default: /* JIS X 0208 */ *ptr++ = c; - GetReaderBuf(*ptr++); + GetReaderBuf(c); + *ptr++ = c; *ptr = 0; break; } @@ -431,21 +431,23 @@ *ptr = 0; } - if (now_coding != B_JIS_CONVERSION) - CodeConv::ConvertToInternal((char*)cbuf, -1, (char*)dstbuf, now_coding); - else - CodeConv::ConvertToInternal((char*)cbuf, -1, (char*)dstbuf, B_EUC_CONVERSION); + if (now_coding != B_JIS_CONVERSION) { + CodeConv::ConvertToInternal(cbuf, -1, dstbuf, now_coding); + } else { + CodeConv::ConvertToInternal(cbuf, -1, dstbuf, + B_EUC_CONVERSION); + } - fBuffer->Insert(dstbuf, attr); + fBuffer->InsertChar(dstbuf, 4, attr); break; case CASE_PRINT_CS96: cbuf[0] = c | 0x80; - GetReaderBuf(cbuf[1]); - cbuf[1] |= 0x80; + GetReaderBuf(c); + cbuf[1] = c | 0x80; cbuf[2] = 0; - CodeConv::ConvertToInternal((char*)cbuf, 2, (char*)dstbuf, B_EUC_CONVERSION); - fBuffer->Insert(dstbuf, attr); + CodeConv::ConvertToInternal(cbuf, 2, dstbuf, B_EUC_CONVERSION); + fBuffer->InsertChar(dstbuf, 4, attr); break; case CASE_LF: @@ -457,29 +459,30 @@ break; case CASE_SJIS_KANA: - cbuf[0] = (uchar)c; + cbuf[0] = c; cbuf[1] = '\0'; - CodeConv::ConvertToInternal((char*)cbuf, 1, (char*)dstbuf, now_coding); - fBuffer->Insert(dstbuf, attr); + CodeConv::ConvertToInternal(cbuf, 1, dstbuf, now_coding); + fBuffer->InsertChar(dstbuf, 4, attr); break; case CASE_SJIS_INSTRING: - cbuf[0] = (uchar)c; - GetReaderBuf(cbuf[1]); + cbuf[0] = c; + GetReaderBuf(c); + cbuf[1] = c; cbuf[2] = '\0'; - CodeConv::ConvertToInternal((char*)cbuf, 2, (char*)dstbuf, now_coding); - fBuffer->Insert(dstbuf, attr); + CodeConv::ConvertToInternal(cbuf, 2, dstbuf, now_coding); + fBuffer->InsertChar(dstbuf, 4, attr); break; case CASE_UTF8_2BYTE: - cbuf[0] = (uchar)c; + cbuf[0] = c; GetReaderBuf(c); if (groundtable[c] != CASE_UTF8_INSTRING) break; - cbuf[1] = (uchar)c; + cbuf[1] = c; cbuf[2] = '\0'; - fBuffer->Insert(cbuf, attr); + fBuffer->InsertChar(cbuf, 2, attr); break; case CASE_UTF8_3BYTE: @@ -494,7 +497,7 @@ break; cbuf[2] = c; cbuf[3] = '\0'; - fBuffer->Insert(cbuf, attr); + fBuffer->InsertChar(cbuf, 3, attr); break; case CASE_MBCS: @@ -526,13 +529,13 @@ break; case CASE_BS: - fBuffer->MoveCurLeft(1); + fBuffer->MoveCursorLeft(1); break; case CASE_TAB: - tmp = fBuffer->GetCurX(); + tmp = fBuffer->Cursor().x; tmp %= 8; - fBuffer->MoveCurRight(8 - tmp); + fBuffer->MoveCursorRight(8 - tmp); break; case CASE_ESC: @@ -600,7 +603,7 @@ /* CUU */ if ((row = param[0]) < 1) row = 1; - fBuffer->MoveCurUp(row); + fBuffer->MoveCursorUp(row); parsestate = groundtable; break; @@ -608,7 +611,7 @@ /* CUD */ if ((row = param[0]) < 1) row = 1; - fBuffer->MoveCurDown(row); + fBuffer->MoveCursorDown(row); parsestate = groundtable; break; @@ -616,7 +619,7 @@ /* CUF */ if ((row = param[0]) < 1) row = 1; - fBuffer->MoveCurRight(row); + fBuffer->MoveCursorRight(row); parsestate = groundtable; break; @@ -624,7 +627,7 @@ /* CUB */ if ((row = param[0]) < 1) row = 1; - fBuffer->MoveCurLeft(row); + fBuffer->MoveCursorLeft(row); parsestate = groundtable; break; @@ -635,7 +638,7 @@ if (nparam < 2 || (col = param[1]) < 1) col = 1; - fBuffer->SetCurPos(col - 1, row - 1 ); + fBuffer->SetCursor(col - 1, row - 1 ); parsestate = groundtable; break; @@ -651,7 +654,7 @@ break; case 2: - fBuffer->SetCurPos(0, 0); + fBuffer->SetCursor(0, 0); fBuffer->EraseBelow(); break; } @@ -668,7 +671,7 @@ /* IL */ if ((row = param[0]) < 1) row = 1; - fBuffer->InsertNewLine(row); + fBuffer->InsertLines(row); parsestate = groundtable; break; @@ -676,7 +679,7 @@ /* DL */ if ((row = param[0]) < 1) row = 1; - fBuffer->DeleteLine(row); + fBuffer->DeleteLines(row); parsestate = groundtable; break; @@ -684,7 +687,7 @@ /* DCH */ if ((row = param[0]) < 1) row = 1; - fBuffer->DeleteChar(row); + fBuffer->DeleteChars(row); parsestate = groundtable; break; @@ -849,7 +852,7 @@ case CASE_RI: /* RI */ - fBuffer->ScrollRegion(-1, -1, SCRDOWN, 1); + fBuffer->ScrollBy(-1); parsestate = groundtable; break; @@ -948,7 +951,7 @@ row = 1; // note beterm wants it 1-based unlike usual terminals - fBuffer->SetCurY(row - 1); + fBuffer->SetCursorY(row - 1); parsestate = groundtable; break; @@ -958,7 +961,7 @@ col = 1; // note beterm wants it 1-based unlike usual terminals - fBuffer->SetCurX(col - 1); + fBuffer->SetCursorX(col - 1); parsestate = groundtable; break; Modified: haiku/trunk/src/apps/terminal/TerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TerminalBuffer.cpp 2008-06-09 20:45:19 UTC (rev 25891) +++ haiku/trunk/src/apps/terminal/TerminalBuffer.cpp 2008-06-09 21:09:02 UTC (rev 25892) @@ -681,15 +681,6 @@ void -TerminalBuffer::Insert(uchar* string, ushort attr) -{ -// TODO: Remove! Use InsertChar instead! - UTF8Char character((const char*)string, 4); - InsertChar(character, attr); -} - - -void TerminalBuffer::InsertCR() { _LineAt(fCursor.y)->softBreak = false; @@ -713,7 +704,7 @@ void -TerminalBuffer::InsertNewLine(int numLines) +TerminalBuffer::InsertLines(int32 numLines) { if (fCursor.y >= fScrollTop && fCursor.y < fScrollBottom) _Scroll(fCursor.y, fScrollBottom, -numLines); @@ -728,7 +719,7 @@ void -TerminalBuffer::InsertSpace(int num) +TerminalBuffer::InsertSpace(int32 num) { // TODO: Deal with full-width chars! if (fCursor.x + num > fWidth) @@ -755,7 +746,7 @@ void -TerminalBuffer::DeleteChar(int numChars) +TerminalBuffer::DeleteChars(int32 numChars) { Line* line = _LineAt(fCursor.y); if (fCursor.x < line->length) { @@ -786,7 +777,7 @@ void -TerminalBuffer::DeleteLine(int numLines) +TerminalBuffer::DeleteLines(int32 numLines) { if (fCursor.y >= fScrollTop && fCursor.y <= fScrollBottom) _Scroll(fCursor.y, fScrollBottom, numLines); @@ -794,9 +785,9 @@ void -TerminalBuffer::SetCurPos(int x, int y) +TerminalBuffer::SetCursor(int32 x, int32 y) { -//debug_printf("TerminalBuffer::SetCurPos(%d, %d)\n", x, y); +//debug_printf("TerminalBuffer::SetCursor(%d, %d)\n", x, y); x = restrict_value(x, 0, fWidth - 1); y = restrict_value(y, fScrollTop, fScrollBottom); if (x != fCursor.x || y != fCursor.y) { @@ -808,27 +799,6 @@ void -TerminalBuffer::SetCurX(int x) -{ - SetCurPos(x, fCursor.y); -} - - -void -TerminalBuffer::SetCurY(int y) -{ - SetCurPos(fCursor.x, y); -} - - -int -TerminalBuffer::GetCurX() -{ - return fCursor.x; -} - - -void TerminalBuffer::SaveCursor() { fSavedCursor = fCursor; @@ -838,54 +808,18 @@ void TerminalBuffer::RestoreCursor() { - SetCurPos(fSavedCursor.x, fSavedCursor.y); + SetCursor(fSavedCursor.x, fSavedCursor.y); } void -TerminalBuffer::MoveCurRight(int num) +TerminalBuffer::SetScrollRegion(int32 top, int32 bottom) { - SetCurPos(fCursor.x + num, fCursor.y); -} - - -void -TerminalBuffer::MoveCurLeft(int num) -{ - SetCurPos(fCursor.x - num, fCursor.y); -} - - -void -TerminalBuffer::MoveCurUp(int num) -{ - SetCurPos(fCursor.x, fCursor.y - num); -} - - -void -TerminalBuffer::MoveCurDown(int num) -{ - SetCurPos(fCursor.x, fCursor.y + num); -} - - -void -TerminalBuffer::ScrollRegion(int top, int bot, int dir, int numLines) -{ -// TODO: Is only invoked with SCRDOWN and numLines = 1 - _Scroll(fScrollTop, fScrollBottom, -1); -} - - -void -TerminalBuffer::SetScrollRegion(int top, int bottom) -{ fScrollTop = restrict_value(top, 0, fHeight - 1); fScrollBottom = restrict_value(bottom, fScrollTop, fHeight - 1); // also sets the cursor position - SetCurPos(0, 0); + SetCursor(0, 0); } Modified: haiku/trunk/src/apps/terminal/TerminalBuffer.h =================================================================== --- haiku/trunk/src/apps/terminal/TerminalBuffer.h 2008-06-09 20:45:19 UTC (rev 25891) +++ haiku/trunk/src/apps/terminal/TerminalBuffer.h 2008-06-09 21:09:02 UTC (rev 25892) @@ -54,7 +54,6 @@ int32 Width() const { return fWidth; } int32 Height() const { return fHeight; } - TermPos Cursor() const { return fCursor; } int32 HistorySize() const { return fHistorySize; } TerminalBufferDirtyInfo& DirtyInfo() { return fDirtyInfo; } @@ -83,42 +82,41 @@ bool matchWord, TermPos& matchStart, TermPos& matchEnd) const; - // output character + // insert chars/lines void InsertChar(UTF8Char c, uint32 attributes); - void Insert(uchar* string, ushort attr); + inline void InsertChar(const char* c, int32 length, + uint32 attributes); void InsertCR(); void InsertLF(); - void InsertNewLine(int numLines); void SetInsertMode(int flag); - void InsertSpace(int num); + void InsertSpace(int32 num); + void InsertLines(int32 numLines); - // delete character + // delete chars/lines void EraseBelow(); - void DeleteChar(int num); + void DeleteChars(int32 numChars); void DeleteColumns(); - void DeleteLine(int num); + void DeleteLines(int32 numLines); - // get and set cursor position -// TODO: Inline most of these! - void SetCurPos(int x, int y); - void SetCurX(int x); - void SetCurY(int y); - int GetCurX(); + // get and set cursor position + void SetCursor(int32 x, int32 y); + inline void SetCursorX(int32 x); + inline void SetCursorY(int32 y); + inline TermPos Cursor() const { return fCursor; } void SaveCursor(); void RestoreCursor(); - // move cursor - void MoveCurRight(int num); - void MoveCurLeft(int num); - void MoveCurUp(int num); - void MoveCurDown(int num); + // move cursor + inline void MoveCursorRight(int32 num); + inline void MoveCursorLeft(int32 num); + inline void MoveCursorUp(int32 num); + inline void MoveCursorDown(int32 num); - // scroll region - void ScrollRegion(int top, int bot, int dir, - int num); - void SetScrollRegion(int top, int bot); + // scroll region + inline void ScrollBy(int32 numLines); + void SetScrollRegion(int32 top, int32 bot); - // other + // other void SetTitle(const char* title); void NotifyQuit(int32 reason); @@ -190,4 +188,61 @@ TerminalBufferDirtyInfo fDirtyInfo; }; + +void +TerminalBuffer::InsertChar(const char* c, int32 length, uint32 attributes) +{ + return InsertChar(UTF8Char(c, length), attributes); +} + + +void +TerminalBuffer::SetCursorX(int32 x) +{ + SetCursor(x, fCursor.y); +} + + +void +TerminalBuffer::SetCursorY(int32 y) +{ + SetCursor(fCursor.x, y); +} + + +void +TerminalBuffer::MoveCursorRight(int32 num) +{ + SetCursor(fCursor.x + num, fCursor.y); +} + + +void +TerminalBuffer::MoveCursorLeft(int32 num) +{ + SetCursor(fCursor.x - num, fCursor.y); +} + + +void +TerminalBuffer::MoveCursorUp(int32 num) +{ + SetCursor(fCursor.x, fCursor.y - num); +} + + +void +TerminalBuffer::MoveCursorDown(int32 num) +{ + SetCursor(fCursor.x, fCursor.y + num); +} + + +void +TerminalBuffer::ScrollBy(int32 numLines) +{ + _Scroll(fScrollTop, fScrollBottom, numLines); +} + + #endif // TERMINAL_BUFFER_H From bonefish at mail.berlios.de Mon Jun 9 23:46:53 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 9 Jun 2008 23:46:53 +0200 Subject: [Haiku-commits] r25893 - haiku/trunk/src/apps/terminal Message-ID: <200806092146.m59Lkr9X002147@sheep.berlios.de> Author: bonefish Date: 2008-06-09 23:46:52 +0200 (Mon, 09 Jun 2008) New Revision: 25893 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25893&view=rev Added: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h Modified: haiku/trunk/src/apps/terminal/Jamfile haiku/trunk/src/apps/terminal/TerminalBuffer.cpp haiku/trunk/src/apps/terminal/TerminalBuffer.h Log: Pulled base class BasicTerminalBuffer out of TerminalBuffer. It contains pretty much all the meaty code. Left in TerminalBuffer is only stuff that didn't quite fit, like the encoding and view notifications. Copied: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp (from rev 25892, haiku/trunk/src/apps/terminal/TerminalBuffer.cpp) =================================================================== --- haiku/trunk/src/apps/terminal/TerminalBuffer.cpp 2008-06-09 21:09:02 UTC (rev 25892) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-09 21:46:52 UTC (rev 25893) @@ -0,0 +1,1092 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ + +#include "BasicTerminalBuffer.h" + +#include +#include + +#include + +#include + +#include "CodeConv.h" +#include "TermConst.h" +#include "TerminalCharClassifier.h" + + +static const UTF8Char kSpaceChar(' '); + + +static inline int32 +restrict_value(int32 value, int32 min, int32 max) +{ + return value < min ? min : (value > max ? max : value); +} + + +// #pragma mark - private inline methods + + +inline int32 +BasicTerminalBuffer::_LineIndex(int32 index) const +{ + return (index + fScreenOffset) % fHistoryCapacity; +} + + +inline BasicTerminalBuffer::Line* +BasicTerminalBuffer::_LineAt(int32 index) const +{ + return fHistory[_LineIndex(index)]; +} + + +inline BasicTerminalBuffer::Line* +BasicTerminalBuffer::_HistoryLineAt(int32 index) const +{ + if (index >= fHeight || index < -fHistorySize) + return NULL; + + return _LineAt(index + fHistoryCapacity); +} + + +inline void +BasicTerminalBuffer::_Invalidate(int32 top, int32 bottom) +{ +//debug_printf("BasicTerminalBuffer::_Invalidate(%ld, %ld)\n", top, bottom); + if (top < fDirtyInfo.dirtyTop) + fDirtyInfo.dirtyTop = top; + if (bottom > fDirtyInfo.dirtyBottom) + fDirtyInfo.dirtyBottom = bottom; + + if (!fDirtyInfo.messageSent) { + NotifyListener(); + fDirtyInfo.messageSent = true; + } +} + + +inline void +BasicTerminalBuffer::_CursorChanged() +{ + if (!fDirtyInfo.messageSent) { + NotifyListener(); + fDirtyInfo.messageSent = true; + } +} + + +// #pragma mark - public methods + + +BasicTerminalBuffer::BasicTerminalBuffer() + : + fHistory(NULL) +{ +} + + +BasicTerminalBuffer::~BasicTerminalBuffer() +{ + _FreeLines(fHistory, fHistoryCapacity); +} + + +status_t +BasicTerminalBuffer::Init(int32 width, int32 height, int32 historySize) +{ + if (historySize < 2 * height) + historySize = 2 * height; + + fWidth = width; + fHeight = height; + + fScrollTop = 0; + fScrollBottom = fHeight - 1; + + fCursor.x = 0; + fCursor.y = 0; + + fOverwriteMode = true; + + fHistoryCapacity = historySize; + fHistorySize = 0; + + fHistory = _AllocateLines(width, historySize); + if (fHistory == NULL) + return B_NO_MEMORY; + + _ClearLines(0, fHeight - 1); + + fDirtyInfo.Reset(); + + return B_OK; +} + + +status_t +BasicTerminalBuffer::ResizeTo(int32 width, int32 height) +{ + if (height < MIN_ROWS || height > MAX_ROWS || width < MIN_COLS + || width > MAX_COLS) { + return B_BAD_VALUE; + } + +//debug_printf("BasicTerminalBuffer::ResizeTo(): (%ld, %ld) -> (%ld, %ld)\n", +//fWidth, fHeight, width, height); + + if (width != fWidth) { + // The width changes. We have to allocate a new line array and re-wrap + // all lines. + Line** history = _AllocateLines(width, fHistoryCapacity); + if (history == NULL) + return B_NO_MEMORY; + + int32 totalLines = fHistorySize + fHeight; + int32 historyOffset = fHistoryCapacity - fHistorySize; + // base for _LineAt() invocations to iterate through the history + + // re-wrap + TermPos cursor; + int32 destIndex = 0; + int32 sourceIndex = 0; + int32 sourceX = 0; + int32 destTotalLines = 0; + int32 destScreenOffset = 0; + int32 maxDestTotalLines = INT_MAX; + bool newDestLine = true; + while (sourceIndex < totalLines) { + Line* sourceLine = _LineAt(historyOffset + sourceIndex); + Line* destLine = history[destIndex]; + + if (newDestLine) { + destLine->Clear(); + newDestLine = false; + } + + int32 sourceLeft = sourceLine->length - sourceX; + int32 destLeft = width - destLine->length; +//debug_printf(" source: %ld, left: %ld, dest: %ld, left: %ld\n", +//sourceIndex, sourceLeft, destIndex, destLeft); + + if (sourceIndex == fHistorySize && sourceX == 0) { + destScreenOffset = destTotalLines; + if (destLeft == 0 && sourceLeft > 0) + destScreenOffset++; +//debug_printf(" destScreenOffset: %ld\n", destScreenOffset); + } + + int32 toCopy = min_c(sourceLeft, destLeft); + if (toCopy > 0) { + // If the last cell to copy is the first cell of a + // full-width char, don't copy it yet. + if (sourceX + toCopy > 0 && IS_WIDTH( + sourceLine->cells[sourceX + toCopy - 1].attributes)) { +//debug_printf(" -> last char is full-width -- don't copy it\n"); + toCopy--; + } + + // translate the cursor position + if (fCursor.y + fHistorySize == sourceIndex + && fCursor.x >= sourceX + && (fCursor.x < sourceX + toCopy + || sourceX + sourceLeft <= fCursor.x)) { + cursor.x = destLine->length + fCursor.x - sourceX; + cursor.y = destTotalLines; + + if (cursor.x >= width) { + // The cursor was in free space after the official end + // of line. + cursor.x = width - 1; + } +//debug_printf(" cursor: (%ld, %ld)\n", cursor.x, cursor.y); + + // don't allow the cursor to get out of screen + maxDestTotalLines = cursor.y + fHeight; + } + + memcpy(destLine->cells + destLine->length, + sourceLine->cells + sourceX, toCopy * sizeof(Cell)); + destLine->length += toCopy; + } + + bool nextDestLine = false; + if (toCopy == sourceLeft) { + if (!sourceLine->softBreak) + nextDestLine = true; + sourceIndex++; + sourceX = 0; + } else { + destLine->softBreak = true; + nextDestLine = true; + sourceX += toCopy; + } + + if (nextDestLine) { + destIndex = (destIndex + 1) % fHistoryCapacity; + destTotalLines++; + newDestLine = true; + if (destTotalLines == maxDestTotalLines) + break; + } + } + + // If the last source line had a soft break, the last dest line + // won't have been counted yet. + if (!newDestLine) { + destIndex = (destIndex + 1) % fHistoryCapacity; + destTotalLines++; + } + +//debug_printf(" total lines: %ld -> %ld\n", totalLines, destTotalLines); + + int32 tempHeight = destTotalLines - destScreenOffset; + cursor.y -= destScreenOffset; + + // Re-wrapping might have produced more lines than we have room for. + if (destTotalLines > fHistoryCapacity) + destTotalLines = fHistoryCapacity; + + // Update the values +//debug_printf(" cursor: (%ld, %ld) -> (%ld, %ld)\n", fCursor.x, fCursor.y, +//cursor.x, cursor.y); + fCursor.x = cursor.x; + fCursor.y = cursor.y; +//debug_printf(" screen offset: %ld -> %ld\n", fScreenOffset, +//destScreenOffset % fHistoryCapacity); + fScreenOffset = destScreenOffset % fHistoryCapacity; +//debug_printf(" history size: %ld -> %ld\n", fHistorySize, destTotalLines - fHeight); + fHistorySize = destTotalLines - tempHeight; +//debug_printf(" height %ld -> %ld\n", fHeight, tempHeight); + fHeight = tempHeight; + fWidth = width; + + _FreeLines(fHistory, fHistoryCapacity); + fHistory = history; + } + + if (height == fHeight) + return B_OK; + + // The height changes. We just add/remove lines at the end of the screen. + + if (height < fHeight) { + // The screen shrinks. We just drop the lines at the end of the screen, + // but we keep the cursor on screen at all costs. + if (fCursor.y >= height) { + int32 toShift = fCursor.y - height + 1; + fScreenOffset = (fScreenOffset + fHistoryCapacity + toShift) + % fHistoryCapacity; + fHistorySize += toShift; + fCursor.y -= toShift; + } + } else { + // The screen grows. We add empty lines at the end of the current + // screen. + if (fHistorySize + height > fHistoryCapacity) + fHistorySize = fHistoryCapacity - height; + + for (int32 i = fHeight; i < height; i++) + _LineAt(i)->Clear(); + } + +//debug_printf(" cursor: -> (%ld, %ld)\n", fCursor.x, fCursor.y); +//debug_printf(" screen offset: -> %ld\n", fScreenOffset); +//debug_printf(" history size: -> %ld\n", fHistorySize); + + fHeight = height; + + // reset scroll range to keep it simple + fScrollTop = 0; + fScrollBottom = fHeight - 1; + + return B_OK; +} + + +void +BasicTerminalBuffer::Clear() +{ + fHistorySize = 0; + fScreenOffset = 0; + + _ClearLines(0, fHeight - 1); + + fCursor.SetTo(0, 0); + + fDirtyInfo.linesScrolled = 0; + _Invalidate(0, fHeight - 1); +} + + +bool +BasicTerminalBuffer::IsFullWidthChar(int32 row, int32 column) const +{ + Line* line = _HistoryLineAt(row); + return line != NULL && column > 0 && column < line->length + && (line->cells[column - 1].attributes & A_WIDTH) != 0; +} + + +int +BasicTerminalBuffer::GetChar(int32 row, int32 column, UTF8Char& character, + uint16& attributes) const +{ + Line* line = _HistoryLineAt(row); + if (line == NULL) + return NO_CHAR; + + if (column < 0 || column >= line->length) + return NO_CHAR; + + if (column > 0 && (line->cells[column - 1].attributes & A_WIDTH) != 0) + return IN_STRING; + + Cell& cell = line->cells[column]; + character = cell.character; + attributes = cell.attributes; + return A_CHAR; +} + + +int32 +BasicTerminalBuffer::GetString(int32 row, int32 firstColumn, int32 lastColumn, + char* buffer, uint16& attributes) const +{ + Line* line = _HistoryLineAt(row); + if (line == NULL) + return NO_CHAR; + + if (lastColumn >= line->length) + lastColumn = line->length - 1; + + int32 column = firstColumn; + if (column <= lastColumn) + attributes = line->cells[column].attributes; + + for (; column <= lastColumn; column++) { + Cell& cell = line->cells[column]; + if (cell.attributes != attributes) + break; + + int32 bytes = cell.character.ByteCount(); + for (int32 i = 0; i < bytes; i++) + *buffer++ = cell.character.bytes[i]; + } + + *buffer = '\0'; + + return column - firstColumn; +} + + +void +BasicTerminalBuffer::GetStringFromRegion(BString& string, const TermPos& start, + const TermPos& end) const +{ +//debug_printf("BasicTerminalBuffer::GetStringFromRegion((%ld, %ld), (%ld, %ld))\n", +//start.x, start.y, end.x, end.y); + if (start >= end) + return; + + TermPos pos(start); + + if (IsFullWidthChar(pos.y, pos.x)) + pos.x--; + + // get all but the last line + while (pos.y < end.y) { + if (_GetPartialLineString(string, pos.y, pos.x, fWidth)) + string.Append('\n', 1); + pos.x = 0; + pos.y++; + } + + // get the last line, if not empty + if (end.x > 0) + _GetPartialLineString(string, end.y, pos.x, end.x); +} + + +bool +BasicTerminalBuffer::FindWord(const TermPos& pos, + TerminalCharClassifier* classifier, bool findNonWords, TermPos& _start, + TermPos& _end) const +{ + int32 x = pos.x; + int32 y = pos.y; + + Line* line = _HistoryLineAt(y); + if (line == NULL || x < 0 || x >= fWidth) + return false; + + if (x >= line->length) { + // beyond the end of the line -- select all space + if (!findNonWords) + return false; + + _start.SetTo(line->length, y); + _end.SetTo(fWidth, y); + return true; + } + + if (x > 0 && IS_WIDTH(line->cells[x - 1].attributes)) + x--; + + // get the char type at the given position + int type = classifier->Classify(line->cells[x].character.bytes); + + // check whether we are supposed to find words only + if (type != CHAR_TYPE_WORD_CHAR && !findNonWords) + return false; + + // find the beginning + TermPos start(x, y); + TermPos end(x + (IS_WIDTH(line->cells[x].attributes) ? 2 : 1), y); + while (true) { + if (--x < 0) { + // Hit the beginning of the line -- continue at the end of the + // previous line, if it soft-breaks. + y--; + if ((line = _HistoryLineAt(y)) == NULL || !line->softBreak + || line->length == 0) { + break; + } + x = line->length - 1; + } + if (x > 0 && IS_WIDTH(line->cells[x - 1].attributes)) + x--; + + if (classifier->Classify(line->cells[x].character.bytes) != type) + break; + + start.SetTo(x, y); + } + + // find the end + x = end.x; + y = end.y; + line = _HistoryLineAt(y); + + while (true) { + if (x >= line->length) { + // Hit the end of the line -- if it soft-breaks continue with the + // next line. + if (!line->softBreak) + break; + y++; + x = 0; + if ((line = _HistoryLineAt(y)) == NULL) + break; + } + + if (classifier->Classify(line->cells[x].character.bytes) != type) + break; + + x += IS_WIDTH(line->cells[x].attributes) ? 2 : 1; + end.SetTo(x, y); + } + + _start = start; + _end = end; + return true; +} + + +int32 +BasicTerminalBuffer::LineLength(int32 index) const +{ + Line* line = _HistoryLineAt(index); + return line != NULL ? line->length : 0; +} + + +bool +BasicTerminalBuffer::Find(const char* _pattern, const TermPos& start, + bool forward, bool caseSensitive, bool matchWord, TermPos& _matchStart, + TermPos& _matchEnd) const +{ +//debug_printf("BasicTerminalBuffer::Find(\"%s\", (%ld, %ld), forward: %d, case: %d, " +//"word: %d)\n", _pattern, start.x, start.y, forward, caseSensitive, matchWord); + // normalize pos, so that _NextChar() and _PreviousChar() are happy + TermPos pos(start); + Line* line = _HistoryLineAt(pos.y); + if (line != NULL) { + if (forward) { + while (line != NULL && pos.x >= line->length && line->softBreak) { + pos.x = 0; + pos.y++; + line = _HistoryLineAt(pos.y); + } + } else { + if (pos.x > line->length) + pos.x = line->length; + } + } + + int32 patternByteLen = strlen(_pattern); + + // convert pattern to UTF8Char array + UTF8Char pattern[patternByteLen]; + int32 patternLen = 0; + while (*_pattern != '\0') { + int32 charLen = UTF8Char::ByteCount(*_pattern); + if (charLen > 0) { + pattern[patternLen].SetTo(_pattern, charLen); + + // if not case sensitive, convert to lower case + if (!caseSensitive && charLen == 1) + pattern[patternLen] = pattern[patternLen].ToLower(); + + patternLen++; + _pattern += charLen; + } else + _pattern++; + } +//debug_printf(" pattern byte len: %ld, pattern len: %ld\n", patternByteLen, patternLen); + + if (patternLen == 0) + return false; + + // reverse pattern, if searching backward + if (!forward) { + for (int32 i = 0; i < patternLen / 2; i++) + std::swap(pattern[i], pattern[patternLen - i - 1]); + } + + // search loop + int32 matchIndex = 0; + TermPos matchStart; + while (true) { +//debug_printf(" (%ld, %ld): matchIndex: %ld\n", pos.x, pos.y, matchIndex); + TermPos previousPos(pos); + UTF8Char c; + if (!(forward ? _NextChar(pos, c) : _PreviousChar(pos, c))) + return false; + + if (caseSensitive ? (c == pattern[matchIndex]) + : (c.ToLower() == pattern[matchIndex])) { + if (matchIndex == 0) + matchStart = previousPos; + + matchIndex++; + + if (matchIndex == patternLen) { +//debug_printf(" match!\n"); + // compute the match range + TermPos matchEnd(pos); + if (!forward) + std::swap(matchStart, matchEnd); + + // check word match + if (matchWord) { + TermPos tempPos(matchStart); + if (_PreviousChar(tempPos, c) && !c.IsSpace() + || _NextChar(tempPos = matchEnd, c) && !c.IsSpace()) { +//debug_printf(" but no word match!\n"); + continue; + } + } + + _matchStart = matchStart; + _matchEnd = matchEnd; +//debug_printf(" -> (%ld, %ld) - (%ld, %ld)\n", matchStart.x, matchStart.y, +//matchEnd.x, matchEnd.y); + return true; + } + } else if (matchIndex > 0) { + // continue after the position where we started matching + pos = matchStart; + if (forward) + _NextChar(pos, c); + else + _PreviousChar(pos, c); + matchIndex = 0; + } + } +} + + +void +BasicTerminalBuffer::InsertChar(UTF8Char c, uint32 attributes) +{ +//debug_printf("BasicTerminalBuffer::InsertChar('%.*s' (%d), %#lx)\n", +//(int)c.ByteCount(), c.bytes, c.bytes[0], attributes); + int width = CodeConv::UTF8GetFontWidth(c.bytes); + if (width == FULL_WIDTH) + attributes |= A_WIDTH; + + if (fCursor.x + width > fWidth) + _SoftBreakLine(); + else + _PadLineToCursor(); + + if (!fOverwriteMode) + _InsertGap(width); + + Line* line = _LineAt(fCursor.y); + line->cells[fCursor.x].character = c; + line->cells[fCursor.x].attributes = attributes; + + if (line->length < fCursor.x + width) + line->length = fCursor.x + width; + + _Invalidate(fCursor.y, fCursor.y); + + fCursor.x += width; + +// TODO: Deal correctly with full-width chars! We must take care not to +// overwrite half of a full-width char. This holds also for other methods. + + if (fCursor.x == fWidth) + _SoftBreakLine(); + // TODO: Handle a subsequent CR correctly! +} + + +void +BasicTerminalBuffer::InsertCR() +{ + _LineAt(fCursor.y)->softBreak = false; + fCursor.x = 0; + _CursorChanged(); +} + + +void +BasicTerminalBuffer::InsertLF() +{ + // If we're at the end of the scroll region, scroll. Otherwise just advance + // the cursor. + if (fCursor.y == fScrollBottom) { + _Scroll(fScrollTop, fScrollBottom, 1); + } else { + fCursor.y++; + _CursorChanged(); + } +} + + +void +BasicTerminalBuffer::InsertLines(int32 numLines) +{ + if (fCursor.y >= fScrollTop && fCursor.y < fScrollBottom) + _Scroll(fCursor.y, fScrollBottom, -numLines); +} + + +void +BasicTerminalBuffer::SetInsertMode(int flag) +{ + fOverwriteMode = flag == MODE_OVER; +} + + +void +BasicTerminalBuffer::InsertSpace(int32 num) +{ +// TODO: Deal with full-width chars! + if (fCursor.x + num > fWidth) + num = fWidth - fCursor.x; + + if (num > 0) { + _PadLineToCursor(); + _InsertGap(num); + + Line* line = _LineAt(fCursor.y); + for (int32 i = fCursor.x; i < fCursor.x + num; i++) { + line->cells[i].character = kSpaceChar; + line->cells[i].attributes = 0; + } + } +} + + +void +BasicTerminalBuffer::EraseBelow() +{ + _Scroll(fCursor.y, fHeight - 1, fHeight); +} + + +void +BasicTerminalBuffer::DeleteChars(int32 numChars) +{ + Line* line = _LineAt(fCursor.y); + if (fCursor.x < line->length) { + if (fCursor.x + numChars < line->length) { + int32 left = line->length - fCursor.x - numChars; + memmove(line->cells + fCursor.x, line->cells + fCursor.x + numChars, + left * sizeof(Cell)); + line->length = fCursor.x + left; + } else { + // remove all remaining chars + line->length = fCursor.x; + } + + _Invalidate(fCursor.y, fCursor.y); + } +} + + +void +BasicTerminalBuffer::DeleteColumns() +{ + Line* line = _LineAt(fCursor.y); + if (fCursor.x < line->length) { + line->length = fCursor.x; + _Invalidate(fCursor.y, fCursor.y); + } +} + + +void +BasicTerminalBuffer::DeleteLines(int32 numLines) +{ + if (fCursor.y >= fScrollTop && fCursor.y <= fScrollBottom) + _Scroll(fCursor.y, fScrollBottom, numLines); +} + + +void +BasicTerminalBuffer::SetCursor(int32 x, int32 y) +{ +//debug_printf("BasicTerminalBuffer::SetCursor(%d, %d)\n", x, y); + x = restrict_value(x, 0, fWidth - 1); + y = restrict_value(y, fScrollTop, fScrollBottom); + if (x != fCursor.x || y != fCursor.y) { + fCursor.x = x; + fCursor.y = y; + _CursorChanged(); + } +} + + +void +BasicTerminalBuffer::SaveCursor() +{ + fSavedCursor = fCursor; +} + + +void +BasicTerminalBuffer::RestoreCursor() +{ + SetCursor(fSavedCursor.x, fSavedCursor.y); +} + + +void +BasicTerminalBuffer::SetScrollRegion(int32 top, int32 bottom) +{ + fScrollTop = restrict_value(top, 0, fHeight - 1); + fScrollBottom = restrict_value(bottom, fScrollTop, fHeight - 1); + + // also sets the cursor position + SetCursor(0, 0); +} + + +void +BasicTerminalBuffer::NotifyListener() +{ + // Implemented by derived classes. +} + + +// #pragma mark - private methods + + +/* static */ BasicTerminalBuffer::Line** +BasicTerminalBuffer::_AllocateLines(int32 width, int32 count) +{ + Line** lines = (Line**)malloc(sizeof(Line*) * count); + if (lines == NULL) + return NULL; + + for (int32 i = 0; i < count; i++) { + lines[i] = (Line*)malloc(sizeof(Line) + sizeof(Cell) * (width - 1)); + if (lines[i] == NULL) { + _FreeLines(lines, i); + return NULL; + } + } + + return lines; +} + + +/* static */ void +BasicTerminalBuffer::_FreeLines(Line** lines, int32 count) +{ + if (lines != NULL) { + for (int32 i = 0; i < count; i++) + free(lines[i]); + + free(lines); + } +} + + +void +BasicTerminalBuffer::_ClearLines(int32 first, int32 last) +{ + int32 firstCleared = -1; + int32 lastCleared = -1; + + for (int32 i = first; i <= last; i++) { + Line* line = _LineAt(i); + if (line->length > 0) { + if (firstCleared == -1) + firstCleared = i; + lastCleared = i; + + line->Clear(); + } + } + + if (firstCleared >= 0) + _Invalidate(firstCleared, lastCleared); +} + + +void +BasicTerminalBuffer::_Scroll(int32 top, int32 bottom, int32 numLines) +{ + if (numLines == 0) + return; + + if (numLines > 0) { + if (numLines > fHistoryCapacity - fHeight) { + numLines = fHistoryCapacity - fHeight; + // TODO: This is not quite correct -- we should replace the complete + // history and screen with empty lines. + } + + // scroll text up + if (top == 0) { + // The lines scrolled out of the screen range are transferred to + // the history. + + // make room for numLines new lines + if (fHistorySize + fHeight + numLines > fHistoryCapacity) { + int32 toDrop = fHistorySize + fHeight + numLines + - fHistoryCapacity; + fHistorySize -= toDrop; + } + + // clear numLines after the current screen + for (int32 i = fHeight; i < fHeight + numLines; i++) + _LineAt(i)->Clear(); + + if (bottom < fHeight - 1) { + // Only scroll part of the screen. Move the unscrolled lines to + // their new location. + for (int32 i = bottom + 1; i < fHeight; i++) { + std::swap(fHistory[_LineIndex(i)], + fHistory[_LineIndex(i) + numLines]); + } + } + + // all lines are in place -- offset the screen + fScreenOffset = (fScreenOffset + numLines) % fHistoryCapacity; + fHistorySize += numLines; + + // scroll/extend dirty range + if (fDirtyInfo.dirtyTop != INT_MAX) { + if (fDirtyInfo.dirtyTop <= bottom + && top <= fDirtyInfo.dirtyBottom) { + // intersects with the scroll region -- extend + if (top < fDirtyInfo.dirtyTop) + fDirtyInfo.dirtyTop = top - numLines; + else + fDirtyInfo.dirtyTop -= numLines; + if (bottom > fDirtyInfo.dirtyBottom) + fDirtyInfo.dirtyBottom = bottom; + } else if (fDirtyInfo.dirtyBottom < top) { + // does not intersect with the scroll region -- just offset + fDirtyInfo.dirtyTop -= numLines; + fDirtyInfo.dirtyBottom -= numLines; + } + } + + fDirtyInfo.linesScrolled += numLines; +// TODO: The linesScrolled might be suboptimal when scrolling partially +// only, since we would scroll the whole visible area, including unscrolled +// lines, which invalidates them, too. + + // invalidate new empty lines + _Invalidate(bottom + 1 - numLines, bottom); + + } else if (numLines >= bottom - top + 1) { + // all lines are completely scrolled out of range -- just clear + // them + _ClearLines(top, bottom); + } else { + // partial scroll -- clear the lines scrolled out of range and move + // the other ones + for (int32 i = top + numLines; i <= bottom; i++) { + int32 lineToDrop = _LineIndex(i - numLines); + int32 lineToKeep = _LineIndex(i); + fHistory[lineToDrop]->Clear(); + std::swap(fHistory[lineToDrop], fHistory[lineToKeep]); + } + + _Invalidate(top, bottom); + } + } else { + // scroll text down + numLines = -numLines; + + if (numLines >= bottom - top + 1) { + // all lines are completely scrolled out of range -- just clear + // them + _ClearLines(top, bottom); + } else { + // partial scroll -- clear the lines scrolled out of range and move + // the other ones + for (int32 i = bottom - numLines; i >= top; i--) { + int32 lineToKeep = _LineIndex(i); + int32 lineToDrop = _LineIndex(i + numLines); + fHistory[lineToDrop]->Clear(); + std::swap(fHistory[lineToDrop], fHistory[lineToKeep]); + } + + _Invalidate(top, bottom); + } + } +} + + +void +BasicTerminalBuffer::_SoftBreakLine() +{ + Line* line = _LineAt(fCursor.y); + line->length = fCursor.x; + line->softBreak = true; + + fCursor.x = 0; + if (fCursor.y == fScrollBottom) + _Scroll(fScrollTop, fScrollBottom, 1); + else + fCursor.y++; +} + + +void +BasicTerminalBuffer::_PadLineToCursor() +{ + Line* line = _LineAt(fCursor.y); + if (line->length < fCursor.x) { + for (int32 i = line->length; i < fCursor.x; i++) { + line->cells[i].character = kSpaceChar; + line->cells[i].attributes = 0; + // TODO: Other attributes? + } + } +} + + +void +BasicTerminalBuffer::_InsertGap(int32 width) [... truncated: 1719 lines follow ...] From revol at free.fr Tue Jun 10 00:05:48 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Tue, 10 Jun 2008 00:05:48 +0200 CEST Subject: [Haiku-commits] r25869 - haiku/trunk/src/system/libroot/os/arch/m68k In-Reply-To: <200806082034.m58KYnJ9011710@sheep.berlios.de> Message-ID: <2672291972-BeMail@laptop> > Author: korli > Date: 2008-06-08 22:34:49 +0200 (Sun, 08 Jun 2008) > New Revision: 25869 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25869&view=rev > > Modified: > haiku/trunk/src/system/libroot/os/arch/m68k/Jamfile > Log: > build fix Oh thanks :) Still need to implement stuff in the kernel before it's buildable though. Fran?ois. From revol at free.fr Tue Jun 10 00:52:53 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Tue, 10 Jun 2008 00:52:53 +0200 CEST Subject: [Haiku-commits] r25881 - haiku/trunk/src/apps/terminal In-Reply-To: <200806091704.m59H4TO5022274@sheep.berlios.de> Message-ID: <5497845367-BeMail@laptop> > Log: > Terminal changes. This is still work in progress, some features > are disabled, lots of commented debug code is still in there, > and quite a bit of cleanup is needed, but basically things work > at least as well as before with several improvements: While at it if you can implement the line-drawing charset... :) It should be accessible using UTF-8 but the plane needs more than 1 byte which termcap cannot encode, so implementing the regular escape codes would allow using them. Fran?ois. From phoudoin at mail.berlios.de Tue Jun 10 00:52:54 2008 From: phoudoin at mail.berlios.de (phoudoin at BerliOS) Date: Tue, 10 Jun 2008 00:52:54 +0200 Subject: [Haiku-commits] r25894 - haiku/trunk/src/apps/mediaplayer Message-ID: <200806092252.m59MqsB8010866@sheep.berlios.de> Author: phoudoin Date: 2008-06-10 00:52:53 +0200 (Tue, 10 Jun 2008) New Revision: 25894 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25894&view=rev Modified: haiku/trunk/src/apps/mediaplayer/MainWin.cpp Log: Run Alert/AboutBox in asynchronous mode: otherwise it freeze video (can't tell if it was the same for audio, as mine -hda- is not supported yet). Modified: haiku/trunk/src/apps/mediaplayer/MainWin.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainWin.cpp 2008-06-09 21:46:52 UTC (rev 25893) +++ haiku/trunk/src/apps/mediaplayer/MainWin.cpp 2008-06-09 22:52:53 UTC (rev 25894) @@ -479,10 +479,10 @@ ", Stephan A?mus and Frederik Mod?en", "Thanks"); if (fAlwaysOnTop) { _ToggleAlwaysOnTop(); - alert->Go(); + alert->Go(NULL); // Asynchronous mode _ToggleAlwaysOnTop(); } else { - alert->Go(); + alert->Go(NULL); // Asynchronous mode } break; case M_FILE_CLOSE: From revol at free.fr Tue Jun 10 01:14:17 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Tue, 10 Jun 2008 01:14:17 +0200 CEST Subject: [Haiku-commits] r25894 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <200806092252.m59MqsB8010866@sheep.berlios.de> Message-ID: <6781384219-BeMail@laptop> > (can't tell if it was the same for audio, as mine -hda- is not > supported > yet). Tried OSS ? :D Fran?ois. From mmu_man at mail.berlios.de Tue Jun 10 01:29:09 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 10 Jun 2008 01:29:09 +0200 Subject: [Haiku-commits] r25895 - haiku/trunk/src/system/kernel Message-ID: <200806092329.m59NT9uQ007964@sheep.berlios.de> Author: mmu_man Date: 2008-06-10 01:29:09 +0200 (Tue, 10 Jun 2008) New Revision: 25895 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25895&view=rev Modified: haiku/trunk/src/system/kernel/Jamfile Log: Do not use -shared when linking linkhack.so for PPC. It is however needed for other archs. This is a temporary workaround to get the thing building until someone has enough cafein available to update binutils. Modified: haiku/trunk/src/system/kernel/Jamfile =================================================================== --- haiku/trunk/src/system/kernel/Jamfile 2008-06-09 22:52:53 UTC (rev 25894) +++ haiku/trunk/src/system/kernel/Jamfile 2008-06-09 23:29:09 UTC (rev 25895) @@ -56,11 +56,19 @@ syscall_numbers.h ; +# TODO: fix or update binutils for ppc, in the meantime this should get things going. +local linkHackLdFlags ; +if $(TARGET_ARCH) = ppc { + linkHackLdFlags = -Bdynamic ; +} else { + linkHackLdFlags = -shared -Bdynamic ; +} + KernelLd linkhack.so : <$(SOURCE_GRIST)>linkhack.o : : - -shared -Bdynamic + $(linkHackLdFlags) ; KernelLd kernel_$(TARGET_ARCH) : From aldeck at mail.berlios.de Tue Jun 10 02:52:03 2008 From: aldeck at mail.berlios.de (aldeck at BerliOS) Date: Tue, 10 Jun 2008 02:52:03 +0200 Subject: [Haiku-commits] r25896 - haiku/trunk/src/kits/tracker Message-ID: <200806100052.m5A0q3kV016897@sheep.berlios.de> Author: aldeck Date: 2008-06-10 02:52:01 +0200 (Tue, 10 Jun 2008) New Revision: 25896 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25896&view=rev Modified: haiku/trunk/src/kits/tracker/PoseView.cpp Log: - Scrollbar proportions computation was wrong in icon mode. The problem showed when a folder contained few icons regrouped in a small area (Extent() smaller than Bounds()). The viewable extent is always Bounds() now. This fixes #361, again we're better than R5! Although in this test case, the scrollbars shouldn't be activated in the first place. In icon mode the poseview is still putting too much white space on the left (x<0) and make the scrollbars show. Fix is almost ready :-) Modified: haiku/trunk/src/kits/tracker/PoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.cpp 2008-06-09 23:29:09 UTC (rev 25895) +++ haiku/trunk/src/kits/tracker/PoseView.cpp 2008-06-10 00:52:01 UTC (rev 25896) @@ -7988,17 +7988,16 @@ } // set proportions for bars - BRect visibleExtent(extent & bounds); BRect totalExtent(extent | bounds); - - if (fHScrollBar) { - float proportion = visibleExtent.Width() / totalExtent.Width(); + + if (fHScrollBar && totalExtent.Width() != 0.0) { + float proportion = bounds.Width() / totalExtent.Width(); if (fHScrollBar->Proportion() != proportion) fHScrollBar->SetProportion(proportion); } - if (fVScrollBar) { - float proportion = visibleExtent.Height() / totalExtent.Height(); + if (fVScrollBar && totalExtent.Height() != 0.0) { + float proportion = bounds.Height() / totalExtent.Height(); if (fVScrollBar->Proportion() != proportion) fVScrollBar->SetProportion(proportion); } From aldeck at mail.berlios.de Tue Jun 10 02:53:18 2008 From: aldeck at mail.berlios.de (aldeck at BerliOS) Date: Tue, 10 Jun 2008 02:53:18 +0200 Subject: [Haiku-commits] r25897 - haiku/trunk/src/kits/interface Message-ID: <200806100053.m5A0rIAs017101@sheep.berlios.de> Author: aldeck Date: 2008-06-10 02:53:16 +0200 (Tue, 10 Jun 2008) New Revision: 25897 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25897&view=rev Modified: haiku/trunk/src/kits/interface/ScrollBar.cpp Log: - The bug in Tracker (previous commit) uncovered a bug in BScrollBar's thumb positioning. The + 1.0 was well intented and produced the right effect unless fMax-fMin was too close to 1.0. It could leave a unusable gap on the right (or down) of the thumb. Modified: haiku/trunk/src/kits/interface/ScrollBar.cpp =================================================================== --- haiku/trunk/src/kits/interface/ScrollBar.cpp 2008-06-10 00:52:01 UTC (rev 25896) +++ haiku/trunk/src/kits/interface/ScrollBar.cpp 2008-06-10 00:53:16 UTC (rev 25897) @@ -1171,9 +1171,12 @@ thumbSize = floorf(thumbSize + 0.5); thumbSize--; - // the thumb can be scrolled within the remaining area "maxSize - thumbSize" - float offset = floorf(((fValue - fMin) / (fMax - fMin + 1.0)) - * (maxSize - thumbSize)); + // the thumb can be scrolled within the remaining area "maxSize - thumbSize - 1.0" + float offset = 0.0; + if (fMax > fMin) { + offset = floorf(((fValue - fMin) / (fMax - fMin)) + * (maxSize - thumbSize - 1.0)); + } if (_DoubleArrows()) { offset += buttonSize * 2; From mmu_man at mail.berlios.de Tue Jun 10 04:01:15 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 10 Jun 2008 04:01:15 +0200 Subject: [Haiku-commits] r25898 - haiku/trunk/src/add-ons/media/media-add-ons/opensound Message-ID: <200806100201.m5A21FYl022273@sheep.berlios.de> Author: mmu_man Date: 2008-06-10 04:01:12 +0200 (Tue, 10 Jun 2008) New Revision: 25898 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25898&view=rev Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.h haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDeviceEngine.cpp haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDeviceEngine.h haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.h haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSound_README.txt Log: work in progress: use one thread per connected channel, and a BList of BBuffer * to avoid dropping them. Disabled early buffer recycling as latency calculation is still broken. I can now play something without missing buffers. Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.h =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.h 2008-06-10 00:53:16 UTC (rev 25897) +++ haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.h 2008-06-10 02:01:12 UTC (rev 25898) @@ -33,6 +33,13 @@ #define ENABLE_REC 1 +// timeout in OpenSoundNode::RunThread() +#define MIN_SNOOZING 2000 + +// pretend we don't drift +#define DISABLE_DRIFT 1 + + /* bit mask of supported formats for raw_audio */ /* also used to mark the raw_audio node input&outputs */ //XXX: _OE ? Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDeviceEngine.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDeviceEngine.cpp 2008-06-10 00:53:16 UTC (rev 25897) +++ haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDeviceEngine.cpp 2008-06-10 02:01:12 UTC (rev 25898) @@ -193,8 +193,27 @@ } +bigtime_t OpenSoundDeviceEngine::PlaybackLatency(void) +{ + bigtime_t latency; + int delay; + delay = GetODelay(); + delay = 0; //XXX + latency = ((double)delay * 1000000LL + / (fMediaFormat.u.raw_audio.channel_count * fMediaFormat.u.raw_audio.frame_rate + * (fMediaFormat.AudioFormat() & media_raw_audio_format::B_AUDIO_SIZE_MASK))); + PRINT(("PlaybackLatency: odelay %d latency %Ld card %Ld\n", delay, latency, CardLatency())); + latency += CardLatency(); + return latency; +} +bigtime_t OpenSoundDeviceEngine::RecordingLatency(void) +{ + return 0LL; //XXX +} + + int OpenSoundDeviceEngine::GetChannels(void) { int chans = -1; @@ -307,6 +326,108 @@ } +int64 +OpenSoundDeviceEngine::GetCurrentIPtr(int32 *fifoed, oss_count_t *info) +{ + oss_count_t ocount; + count_info cinfo; + CALLED(); + if (!info) + info = &ocount; + memset(info, 0, sizeof(oss_count_t)); + if (!(fOpenMode & OPEN_READ)) + return 0; + if (ioctl(fFD, SNDCTL_DSP_CURRENT_IPTR, info, sizeof(oss_count_t)) < 0) { + PRINT(("OpenSoundDeviceEngine::%s: %s: %s\n", + __FUNCTION__, "SNDCTL_DSP_CURRENT_IPTR", strerror(errno))); + //return EIO; + // fallback: try GET*PTR + if (ioctl(fFD, SNDCTL_DSP_GETIPTR, &cinfo, sizeof(count_info)) < 0) { + PRINT(("OpenSoundDeviceEngine::%s: %s: %s\n", + __FUNCTION__, "SNDCTL_DSP_GETIPTR", strerror(errno))); + return 0; + } + // it's probably wrong... + info->samples = cinfo.bytes / (fMediaFormat.u.raw_audio.channel_count + * (fMediaFormat.AudioFormat() & media_raw_audio_format::B_AUDIO_SIZE_MASK)); + info->fifo_samples = 0; + } + PRINT(("OpenSoundDeviceEngine::%s: IPTR: { samples=%Ld, fifo_samples=%d }\n", __FUNCTION__, info->samples, info->fifo_samples)); + if (fifoed) + *fifoed = info->fifo_samples; + return info->samples; +} + + +int64 +OpenSoundDeviceEngine::GetCurrentOPtr(int32 *fifoed, oss_count_t *info) +{ + oss_count_t ocount; + count_info cinfo; + CALLED(); + if (!info) + info = &ocount; + memset(info, 0, sizeof(oss_count_t)); + if (!(fOpenMode & OPEN_WRITE)) + return 0; + if (ioctl(fFD, SNDCTL_DSP_CURRENT_OPTR, info, sizeof(oss_count_t)) < 0) { + PRINT(("OpenSoundDeviceEngine::%s: %s: %s\n", + __FUNCTION__, "SNDCTL_DSP_CURRENT_OPTR", strerror(errno))); + //return EIO; + // fallback: try GET*PTR + if (ioctl(fFD, SNDCTL_DSP_GETOPTR, &cinfo, sizeof(count_info)) < 0) { + PRINT(("OpenSoundDeviceEngine::%s: %s: %s\n", + __FUNCTION__, "SNDCTL_DSP_GETOPTR", strerror(errno))); + return 0; + } + // it's probably wrong... + info->samples = cinfo.bytes / (fMediaFormat.u.raw_audio.channel_count + * (fMediaFormat.AudioFormat() & media_raw_audio_format::B_AUDIO_SIZE_MASK)); + info->fifo_samples = 0; + } + //PRINT(("OpenSoundDeviceEngine::%s: OPTR: { samples=%Ld, fifo_samples=%d }\n", __FUNCTION__, info->samples, info->fifo_samples)); + if (fifoed) + *fifoed = info->fifo_samples; + return info->samples; +} + + +int32 +OpenSoundDeviceEngine::GetIOverruns() +{ + audio_errinfo info; + CALLED(); + memset(&info, 0, sizeof(info)); + if (!(fOpenMode & OPEN_WRITE)) + return 0; + if (ioctl(fFD, SNDCTL_DSP_GETERROR, &info, sizeof(info)) < 0) { + PRINT(("OpenSoundDeviceEngine::%s: %s: %s\n", + __FUNCTION__, "SNDCTL_DSP_GETERROR", strerror(errno))); + return 0; + } + PRINT(("OpenSoundDeviceEngine::%s: IOVERRUNS: { overruns=%d }\n", __FUNCTION__, info.rec_overruns)); + return info.rec_overruns; +} + + +int32 +OpenSoundDeviceEngine::GetOUnderruns() +{ + audio_errinfo info; + CALLED(); + memset(&info, 0, sizeof(info)); + if (!(fOpenMode & OPEN_WRITE)) + return 0; + if (ioctl(fFD, SNDCTL_DSP_GETERROR, &info, sizeof(info)) < 0) { + PRINT(("OpenSoundDeviceEngine::%s: %s: %s\n", + __FUNCTION__, "SNDCTL_DSP_GETERROR", strerror(errno))); + return 0; + } + //PRINT(("OpenSoundDeviceEngine::%s: OUNDERRUNS: { underruns=%d }\n", __FUNCTION__, info.play_underruns)); + return info.play_underruns; +} + + int OpenSoundDeviceEngine::GetODelay(void) { //CALLED(); @@ -340,6 +461,12 @@ int64 OpenSoundDeviceEngine::PlayedFramesCount(void) { + int64 played; + int32 fifoed; + played = GetCurrentOPtr(&fifoed); + //played += fifoed; + //return played; + fPlayedFramesCount = played - fifoed; return fPlayedFramesCount;//XXX return fPlayedFramesCount - (GetODelay() / (fMediaFormat.u.raw_audio.channel_count * (fMediaFormat.AudioFormat() & media_raw_audio_format::B_AUDIO_SIZE_MASK))); @@ -443,8 +570,10 @@ { status_t err; int afmt = 0; + char buf[1024]; CALLED(); fmt &= rec ? Info()->iformats : Info()->oformats; + if (fmt == 0) return B_MEDIA_BAD_FORMAT; media_format wc; @@ -540,12 +669,12 @@ raw.buffer_size = DEFAULT_BUFFER_SIZE; } else { + PRINT(("%s: unknown media type\n", __FUNCTION__)); Close(); return EINVAL; } // cache it fMediaFormat = format; - char buf[1024]; string_for_format(format, buf, 1024); PRINT(("%s: %s\n", __FUNCTION__, buf)); return B_OK; @@ -676,3 +805,4 @@ PRINT(("%s: %s\n", __FUNCTION__, buf)); return B_OK; } + Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDeviceEngine.h =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDeviceEngine.h 2008-06-10 00:53:16 UTC (rev 25897) +++ haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDeviceEngine.h 2008-06-10 02:01:12 UTC (rev 25898) @@ -38,7 +38,9 @@ status_t UpdateInfo(); // shortcuts int Caps() const { return fAudioInfo.caps; }; - int Latency() const { return fAudioInfo.latency; }; + bigtime_t CardLatency(void) const { return (fAudioInfo.latency<0) ? 0 : fAudioInfo.latency; }; + bigtime_t PlaybackLatency(void); + bigtime_t RecordingLatency(void); int GetChannels(void); @@ -55,10 +57,16 @@ size_t GetISpace(audio_buf_info *info=NULL); size_t GetOSpace(audio_buf_info *info=NULL); + int64 GetCurrentIPtr(int32 *fifoed=NULL, oss_count_t *info=NULL); + int64 GetCurrentOPtr(int32 *fifoed=NULL, oss_count_t *info=NULL); + + int32 GetIOverruns(); + int32 GetOUnderruns(); + int GetODelay(void); status_t StartRecording(void); - + int64 PlayedFramesCount(void); bigtime_t PlayedRealTime(void); Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp 2008-06-10 00:53:16 UTC (rev 25897) +++ haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp 2008-06-10 02:01:12 UTC (rev 25898) @@ -44,12 +44,13 @@ #include #include #include -#include #include #include #include #include #include +#include +#include #include "OpenSoundNode.h" #include "driver_io.h" @@ -73,13 +74,15 @@ node_input::node_input(media_input &input, media_format format) { CALLED(); + fNode = NULL; fEngineId = -1; fRealEngine = NULL; fAFmt = 0; fInput = input; fPreferredFormat = format; fBufferCycle = 1; - fBuffer = NULL; + //fBuffer = NULL; + fThread = -1; } node_input::~node_input() @@ -92,12 +95,14 @@ fOutputEnabled(true) { CALLED(); + fNode = NULL; fEngineId = -1; fRealEngine = NULL; fAFmt = 0; fOutput = output; fPreferredFormat = format; fBufferCycle = 1; + fThread = -1; } node_output::~node_output() @@ -115,7 +120,7 @@ CALLED(); fAddOn->GetConfigurationFor(this, NULL); - StopThread(); + //StopThread(); BMediaEventLooper::Quit(); fWeb = NULL; @@ -283,6 +288,7 @@ currentInput->fChannelId = i;//XXX:REMOVEME fDevice->MD.channels[i].channel_id; currentInput->fEngineId = i; currentInput->fAFmt = fmt; + currentInput->fNode = this; fInputs.AddItem(currentInput); currentInput->fInput.format.u.raw_audio.format = media_raw_audio_format::wildcard.format; @@ -332,6 +338,7 @@ currentOutput->fChannelId = i;//XXX:REMOVEME fDevice->MD.channels[i].channel_id; currentOutput->fEngineId = i; currentOutput->fAFmt = fmt; + currentOutput->fNode = this; fOutputs.AddItem(currentOutput); } } @@ -553,11 +560,15 @@ node_input *channel = FindInput(for_whom); - if(channel==NULL) { + if(channel==NULL || channel->fRealEngine==NULL) { fprintf(stderr,"<- B_MEDIA_BAD_DESTINATION\n"); return B_MEDIA_BAD_DESTINATION; } - *out_latency = EventLatency(); + *out_latency = EventLatency(); // mmu_man: that's the own node latency (1 buffer) + // add the OSS driver buffer's latency as well + *out_latency += channel->fRealEngine->PlaybackLatency(); + PRINT(("############ OpenSoundNode::%s: EventLatency %Ld, OSS %Ld\n", __FUNCTION__, EventLatency(), channel->fRealEngine->PlaybackLatency())); + //*out_latency += MIN_SNOOZING; *out_timesource = TimeSource()->ID(); return B_OK; } @@ -599,7 +610,8 @@ *out_input = channel->fInput; // we are sure the thread is started - StartThread(); + //StartThread(); + StartPlayThread(channel); return B_OK; } @@ -619,7 +631,8 @@ fprintf(stderr,"<- B_MEDIA_BAD_SOURCE\n"); return; } - + + StopPlayThread(channel); channel->fInput.source = media_source::null; channel->fInput.format = channel->fPreferredFormat; if (channel->fRealEngine) @@ -942,7 +955,8 @@ engine->StartRecording(); // we are sure the thread is started - StartThread(); + //StartThread(); + StartRecThread(channel); } void @@ -959,6 +973,8 @@ return; } + StopRecThread(channel); + BAutolock L(fDevice->Locker()); OpenSoundDeviceEngine *engine = channel->fRealEngine; @@ -1129,26 +1145,49 @@ // who sent it to us if ((RunMode() != B_OFFLINE) && // lateness doesn't matter in offline mode... (RunMode() != B_RECORDING) && // ...or in recording mode - (how_early < 0LL)) + (how_early < 0LL) && false /* XXX:DEBUG */) { //mLateBuffers++; NotifyLateProducer(channel->fInput.source, -how_early, perf_time); fprintf(stderr," <- LATE BUFFER : %lli\n", how_early); buffer->Recycle(); + release_sem(fBufferAvailableSem); } else { //WriteBuffer(buffer, *channel); - if(channel->fBuffer != NULL) { + + fDevice->Locker()->Lock(); + if (channel->fBuffers.CountItems() > 10) { + fDevice->Locker()->Unlock(); + PRINT(("OpenSoundNode::HandleBuffer too many buffers, recycling\n")); + buffer->Recycle(); + release_sem(fBufferAvailableSem); + } else { + //PRINT(("OpenSoundNode::HandleBuffer writing channelId : %i, how_early:%lli\n", channel->fChannelId, how_early)); + channel->fBuffers.AddItem(buffer); + fDevice->Locker()->Unlock(); + release_sem(fBufferAvailableSem); + } + +#if 0 + if (channel->fBuffer != NULL) { PRINT(("OpenSoundNode::HandleBuffer snoozing recycling channelId : %i, how_early:%lli\n", channel->fChannelId, how_early)); //channel->fBuffer->Recycle(); + release_sem(fBufferAvailableSem); snooze(100); - if(channel->fBuffer != NULL) + if(channel->fBuffer != NULL) { + PRINT(("OpenSoundNode::HandleBuffer old buffer still there, recycling\n")); buffer->Recycle(); - else + //release_sem(fBufferAvailableSem); + } else { channel->fBuffer = buffer; + release_sem(fBufferAvailableSem); + } } else { //PRINT(("OpenSoundNode::HandleBuffer writing channelId : %i, how_early:%lli\n", channel->fChannelId, how_early)); channel->fBuffer = buffer; + release_sem(fBufferAvailableSem); } +#endif } return B_OK; } @@ -1247,7 +1286,7 @@ PRINT(("TimeSourceOp op B_TIMESOURCE_START\n")); if (RunState() != BMediaEventLooper::B_STARTED) { fTimeSourceStarted = true; - StartThread(); + //StartThread(); media_timed_event startEvent(0, BTimedEventQueue::B_START); EventQueue()->AddEvent(startEvent); @@ -1259,7 +1298,7 @@ media_timed_event stopEvent(0, BTimedEventQueue::B_STOP); EventQueue()->AddEvent(stopEvent); fTimeSourceStarted = false; - StopThread(); + //StopThread(); PublishTime(0, 0, 0); } break; @@ -1269,7 +1308,7 @@ media_timed_event stopEvent(0, BTimedEventQueue::B_STOP); EventQueue()->AddEvent(stopEvent); fTimeSourceStarted = false; - StopThread(); + //StopThread(); PublishTime(0, 0, 0); } break; @@ -2044,19 +2083,43 @@ // OpenSoundNode specific functions // -------------------------------------------------------- // +#if 0 int32 OpenSoundNode::RunThread() { int32 i; + int32 bufferAvailReq = 1; + bigtime_t timeout = MIN_SNOOZING; CALLED(); + //set_thread_priority(find_thread(NULL), 5);//XXX:DEBUG + + return 0; //XXX: REMOVE + while ( 1 ) { + status_t err; + bigtime_t before = system_time(); // XXX: use select() here when it gets implemented! + if (bufferAvailReq < 1) + bufferAvailReq = 1; + + PRINT(("OpenSoundNode::RunThread: waiting for %d buffers, timeout %lld\n", bufferAvailReq, timeout)); + //acquire buffer if any - if ( acquire_sem_etc( fBuffer_free, 1, B_RELATIVE_TIMEOUT, 0 ) == B_BAD_SEM_ID ) { + err = acquire_sem_etc( fBufferAvailableSem, bufferAvailReq, B_RELATIVE_TIMEOUT, timeout ); + if (err == B_BAD_SEM_ID ) { return B_OK; } + if (err == B_OK) + bufferAvailReq = 0;//1; + if (err == B_TIMED_OUT) { + PRINT(("OpenSoundNode::RunThread: acquire_sem timed out\n")); + bufferAvailReq = 0;//1; + } else { + PRINT(("OpenSoundNode::RunThread: acquire_sem done, waited %Ld\n", system_time() - before)); + } + timeout = MIN_SNOOZING; //PRINT(("OpenSoundNode::RunThread: RunState= %d, EventQ: %d events\n", RunState(), EventQueue()->EventCount())); @@ -2082,7 +2145,8 @@ if (avail < 1) continue; -#if 0 +//engine->GetOUnderruns(); +#if 1 // update the timesource if(input->fChannelId==0) { //PRINT(("updating timesource\n")); @@ -2093,21 +2157,39 @@ if(input->fBuffer!=NULL) { if (avail < input->fBuffer->SizeUsed()) continue; - //PRINT(("OpenSoundNode::RunThread: input[%d]: sending buffer\n", i)); + PRINT(("OpenSoundNode::RunThread: input[%d]: sending buffer (%d bytes)\n", i, input->fBuffer->SizeUsed())); + + { + bigtime_t tout; // = input->fBuffer->SizeUsed(); + tout = abinfo.fragsize * abinfo.fragstotal - abinfo.bytes; + tout = tout * 1000000LL / (input->fInput.format.u.raw_audio.channel_count + * (input->fInput.format.AudioFormat() & media_raw_audio_format::B_AUDIO_SIZE_MASK) + * input->fInput.format.u.raw_audio.frame_rate); + if (tout && (tout < timeout)) { + //PRINT(("new timeout: %Ld\n", tout)); + timeout = tout; + } + // let's try this... + //SendLatencyChange(input->fInput.source, input->fInput.destination, EventLatency()+tout); + } FillNextBuffer(*input, input->fBuffer); input->fBuffer->Recycle(); input->fBuffer = NULL; + bufferAvailReq++; } else { if (avail < abinfo.fragsize) continue; //XXX: write silence // write a nulled fragment + PRINT(("OpenSoundNode::RunThread: input[%d]: sending zeros\n", i)); +//#ifdef WRITE_ZEROS if(input->fInput.source != media_source::null) WriteZeros(*input, abinfo.fragsize); +//#endif } -#if 1 +#if 0 // update the timesource if(input->fChannelId==0) { //PRINT(("updating timesource\n")); @@ -2164,8 +2246,8 @@ fDevice->Locker()->Unlock(); //XXX - snooze(5000); - release_sem(fBuffer_free);//XXX + //snooze(1000); + //release_sem(fBufferAvailableSem);//XXX } #if MA multi_buffer_info MBI;//, oldMBI; @@ -2175,7 +2257,7 @@ while ( 1 ) { //acquire buffer if any - if ( acquire_sem_etc( fBuffer_free, 1, B_RELATIVE_TIMEOUT, 0 ) == B_BAD_SEM_ID ) { + if ( acquire_sem_etc( fBufferAvailableSem, 1, B_RELATIVE_TIMEOUT, 0 ) == B_BAD_SEM_ID ) { return B_OK; } @@ -2227,7 +2309,7 @@ } //mark buffer free - release_sem( fBuffer_free ); + release_sem( fBufferAvailableSem ); } else { //PRINT(("playback_buffer_cycle non ok input : %i\n", i)); } @@ -2274,7 +2356,158 @@ #endif return B_OK; } +#endif + +int32 +OpenSoundNode::EnginePlayThread(node_input *input) +{ + //int32 i; + CALLED(); + //set_thread_priority(find_thread(NULL), 5);//XXX:DEBUG + signal(SIGUSR1, &_sig_handler_); + + OpenSoundDeviceEngine *engine = input->fRealEngine; + if (!engine || !engine->InUse()) + return B_NO_INIT; + // skip unconnected or non-busy engines + if (input->fInput.source == media_source::null + && input->fChannelId == 0) + return B_NO_INIT; + // must be open for write + ASSERT (engine->OpenMode() & OPEN_WRITE); + + do { + fDevice->Locker()->Lock(); + + audio_buf_info abinfo; + size_t avail = engine->GetOSpace(&abinfo); + //PRINT(("OpenSoundNode::EnginePlayThread: avail: %d\n", avail)); + +#if 1 + // TODO: do not assume channel 0 will always be running! + // update the timesource + if(input->fChannelId==0) { + //PRINT(("updating timesource\n")); + UpdateTimeSource(&abinfo, *input); + } +#endif +#if 0 + BBuffer *buffer = input->fBuffer; + input->fBuffer = NULL; +#endif + BBuffer *buffer = (BBuffer *)input->fBuffers.RemoveItem((int32)0); + + fDevice->Locker()->Unlock(); + if (input->fThread < 0) + break; + + if (buffer != NULL) { + //if (avail < input->fBuffer->SizeUsed()) + // continue; + //PRINT(("OpenSoundNode::EnginePlayThread: input[%d]: sending buffer (%d bytes)\n", input->fChannelId, buffer->SizeUsed())); + +#if 0 + { + bigtime_t tout; // = input->fBuffer->SizeUsed(); + tout = abinfo.fragsize * abinfo.fragstotal - abinfo.bytes; + tout = tout * 1000000LL / (input->fInput.format.u.raw_audio.channel_count + * (input->fInput.format.AudioFormat() & media_raw_audio_format::B_AUDIO_SIZE_MASK) + * input->fInput.format.u.raw_audio.frame_rate); + if (tout && (tout < timeout)) { + //PRINT(("new timeout: %Ld\n", tout)); + timeout = tout; + } + // let's try this... + //SendLatencyChange(input->fInput.source, input->fInput.destination, EventLatency()+tout); + } +#endif + FillNextBuffer(*input, buffer); + buffer->Recycle(); + } else { + //if (avail < abinfo.fragsize) + // continue; + //XXX: write silence + // write a nulled fragment + //PRINT(("OpenSoundNode::EnginePlayThread: input[%d]: sending zeros\n", input->fChannelId)); +//#ifdef WRITE_ZEROS + if (input->fInput.source != media_source::null) + WriteZeros(*input, abinfo.fragsize); +//#endif + + } + +#if 0 + // update the timesource + if(input->fChannelId==0) { + //PRINT(("updating timesource\n")); + UpdateTimeSource(&abinfo, *input); + } +#endif + } while (input->fThread > -1); + return 0; +} + + +int32 +OpenSoundNode::EngineRecThread(node_output *output) +{ + int32 i; + CALLED(); + //set_thread_priority(find_thread(NULL), 5);//XXX:DEBUG + signal(SIGUSR1, &_sig_handler_); + + OpenSoundDeviceEngine *engine = output->fRealEngine; + if (!engine || !engine->InUse()) + return B_NO_INIT; + // make sure we're both started *and* connected before delivering a buffer + if ((RunState() != BMediaEventLooper::B_STARTED) || (output->fOutput.destination == media_destination::null)) + return B_NO_INIT; + + // must be open for read + ASSERT (engine->OpenMode() & OPEN_READ); +#ifdef ENABLE_REC + + fDevice->Locker()->Lock(); + do { + audio_buf_info abinfo; + size_t avail = engine->GetISpace(&abinfo); + //PRINT(("OpenSoundNode::RunThread: I avail: %d\n", avail)); + + // skip if less than 1 buffer + //if (avail < output->fOutput.format.u.raw_audio.buffer_size) + // continue; + + fDevice->Locker()->Unlock(); + // Get the next buffer of data + BBuffer* buffer = FillNextBuffer(&abinfo, *output); + fDevice->Locker()->Lock(); + + if (buffer) { + // send the buffer downstream if and only if output is enabled + status_t err = B_ERROR; + if (output->fOutputEnabled) + err = SendBuffer(buffer, output->fOutput.destination); + //PRINT(("OpenSoundNode::RunThread: I avail: %d, OE %d, %s\n", avail, output->fOutputEnabled, strerror(err))); + if (err) { + buffer->Recycle(); + } else { + // track how much media we've delivered so far + size_t nSamples = output->fOutput.format.u.raw_audio.buffer_size + / (output->fOutput.format.u.raw_audio.format & media_raw_audio_format::B_AUDIO_SIZE_MASK); + output->fSamplesSent += nSamples; + //PRINT(("OpenSoundNode::%s: sent %d samples\n", __FUNCTION__, nSamples)); + } + + } + } while (output->fThread > -1); + fDevice->Locker()->Unlock(); + +#endif + return 0; +} + + void OpenSoundNode::WriteZeros(node_input &input, size_t len) { @@ -2542,17 +2775,17 @@ //allocate buffer free semaphore int bufcount = MAX(fDevice->fFragments.fragstotal, 2);//XXX -// fBuffer_free = create_sem( fDevice->MBL.return_playback_buffers - 1, "multi_audio out buffer free" ); - fBuffer_free = create_sem( bufcount - 1, "OpenSound out buffer free" ); +// fBufferAvailableSem = create_sem( fDevice->MBL.return_playback_buffers - 1, "multi_audio out buffer free" ); + fBufferAvailableSem = create_sem( bufcount - 1, "OpenSound out buffer free" ); - if ( fBuffer_free < B_OK ) { + if ( fBufferAvailableSem < B_OK ) { return B_ERROR; } fThread = spawn_thread( _run_thread_, "OpenSound audio output", B_REAL_TIME_PRIORITY, this ); if ( fThread < B_OK ) { - delete_sem( fBuffer_free ); + delete_sem( fBufferAvailableSem ); return B_ERROR; } @@ -2564,11 +2797,101 @@ OpenSoundNode::StopThread() { CALLED(); - delete_sem( fBuffer_free ); + delete_sem( fBufferAvailableSem ); wait_for_thread( fThread, &fThread ); return B_OK; } +status_t +OpenSoundNode::StartPlayThread(node_input *input) +{ + CALLED(); + BAutolock L(fDevice->Locker()); + // the thread is already started ? + if (input->fThread > B_OK) + return B_OK; + + //allocate buffer free semaphore +// int bufcount = MAX(fDevice->fFragments.fragstotal, 2);//XXX + +// fBufferAvailableSem = create_sem( fDevice->MBL.return_playback_buffers - 1, "multi_audio out buffer free" ); +// fBufferAvailableSem = create_sem( bufcount - 1, "OpenSound out buffer free" ); + +// if ( fBufferAvailableSem < B_OK ) { +// return B_ERROR; +// } + + input->fThread = spawn_thread(_engine_play_thread_, "OpenSound audio output", B_REAL_TIME_PRIORITY, input); + + if (input->fThread < B_OK) { +// delete_sem( fBufferAvailableSem ); + return B_ERROR; + } + + resume_thread(input->fThread); + return B_OK; +} + +status_t +OpenSoundNode::StopPlayThread(node_input *input) +{ + thread_id th; + status_t ret; + CALLED(); + { + BAutolock L(fDevice->Locker()); + th = input->fThread; + input->fThread = -1; + //kill(th, SIGUSR1); + } + wait_for_thread(th, &ret); + return B_OK; +} + +status_t +OpenSoundNode::StartRecThread(node_output *output) +{ + CALLED(); + // the thread is already started ? + if (output->fThread > B_OK) + return B_OK; + + //allocate buffer free semaphore +// int bufcount = MAX(fDevice->fFragments.fragstotal, 2);//XXX + +// fBufferAvailableSem = create_sem( fDevice->MBL.return_playback_buffers - 1, "multi_audio out buffer free" ); +// fBufferAvailableSem = create_sem( bufcount - 1, "OpenSound out buffer free" ); + +// if ( fBufferAvailableSem < B_OK ) { +// return B_ERROR; +// } + + output->fThread = spawn_thread(_engine_rec_thread_, "OpenSound audio input", B_REAL_TIME_PRIORITY, output); + + if (output->fThread < B_OK) { + //delete_sem( fBufferAvailableSem ); + return B_ERROR; + } + + resume_thread(output->fThread); + return B_OK; +} + +status_t +OpenSoundNode::StopRecThread(node_output *output) +{ + thread_id th = output->fThread; + status_t ret; + output->fThread = -1; + CALLED(); + { + BAutolock L(fDevice->Locker()); + //kill(th, SIGUSR1); + } + wait_for_thread(th, &ret); + return B_OK; +} + void OpenSoundNode::AllocateBuffers(node_output &channel) { @@ -2593,17 +2916,18 @@ if(fTimeSourceStarted) { int64 played_frames = engine->PlayedFramesCount(); bigtime_t perf_time = (bigtime_t)(played_frames / - input.fInput.format.u.raw_audio.frame_rate * 1000000); + input.fInput.format.u.raw_audio.frame_rate * 1000000LL); bigtime_t real_time = engine->PlayedRealTime(); //XXX! //MBI.played_real_time; - /*PRINT(("TS: frames: last %Ld curr %Ld diff %Ld, time: last %Ld curr %Ld diff %Ld\n", + /* + PRINT(("TS: frames: last %Ld curr %Ld diff %Ld, time: last %Ld curr %Ld diff %Ld\n", fOldPlayedFramesCount, played_frames, played_frames - fOldPlayedFramesCount, fOldPlayedRealTime, real_time, real_time - fOldPlayedRealTime)); */ float drift; if (real_time - fOldPlayedRealTime) drift = ((played_frames - fOldPlayedFramesCount) - / input.fInput.format.u.raw_audio.frame_rate * 1000000) + / input.fInput.format.u.raw_audio.frame_rate * 1000000LL) / (real_time - fOldPlayedRealTime); else drift = 1; @@ -2620,7 +2944,9 @@ * In theory we should pass it, but it seems to work better if we fake a perfect world... * Maybe it interferes with OSS's queing. */ +#ifdef DISABLE_DRIFT drift = 1; +#endif PublishTime(perf_time, real_time, drift); @@ -2837,13 +3163,40 @@ // static: + int32 OpenSoundNode::_run_thread_( void *data ) { CALLED(); +#if 0 return static_cast( data )->RunThread(); +#endif } + +void +OpenSoundNode::_sig_handler_(int sig) +{ +} + +int32 +OpenSoundNode::_engine_play_thread_(void *data) +{ + CALLED(); + node_input *channel = static_cast(data); + return channel->fNode->EnginePlayThread(channel); +} + + +int32 +OpenSoundNode::_engine_rec_thread_(void *data) +{ + CALLED(); + node_output *channel = static_cast(data); + return channel->fNode->EngineRecThread(channel); +} + + void OpenSoundNode::GetFlavor(flavor_info * outInfo, int32 id) { CALLED(); Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.h =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.h 2008-06-10 00:53:16 UTC (rev 25897) +++ haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.h 2008-06-10 02:01:12 UTC (rev 25898) @@ -42,8 +42,9 @@ #include #include #include +#include #include -#include +#include //#include "soundcard.h" #include "OpenSoundDevice.h" #include "OpenSoundDeviceEngine.h" @@ -53,13 +54,15 @@ const media_format & producer_format, const media_format & consumer_format);*/ - +class OpenSoundNode; + class node_input { public: node_input(media_input &input, media_format format); ~node_input(); + OpenSoundNode *fNode; int32 fEngineId; OpenSoundDeviceEngine *fRealEngine; // engine it's connected to. can be a shadow one (!= fEngineId) int fAFmt; // AFMT_* for this one @@ -67,9 +70,12 @@ media_input fInput; media_format fPreferredFormat; media_format fFormat; + + thread_id fThread; uint32 fBufferCycle; // multi_buffer_info fOldMBI; - BBuffer *fBuffer; +// BBuffer *fBuffer; + BList fBuffers; // of (BBuffer *) }; class node_output @@ -78,6 +84,7 @@ node_output(media_output &output, media_format format); ~node_output(); + OpenSoundNode *fNode; int32 fEngineId; OpenSoundDeviceEngine *fRealEngine; // engine it's connected to. can be a shadow one (!= fEngineId) int fAFmt; // AFMT_* for this one @@ -86,6 +93,7 @@ media_format fPreferredFormat; media_format fFormat; + thread_id fThread; BBufferGroup *fBufferGroup; bool fOutputEnabled; uint64 fSamplesSent; @@ -353,6 +361,16 @@ status_t StartThread(); [... truncated: 39 lines follow ...] From rudolfc at mail.berlios.de Tue Jun 10 12:38:51 2008 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Tue, 10 Jun 2008 12:38:51 +0200 Subject: [Haiku-commits] r25899 - haiku/trunk/src/add-ons/accelerants/nvidia Message-ID: <200806101038.m5AAcpHj004796@sheep.berlios.de> Author: rudolfc Date: 2008-06-10 12:38:50 +0200 (Tue, 10 Jun 2008) New Revision: 25899 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25899&view=rev Modified: haiku/trunk/src/add-ons/accelerants/nvidia/ProposeDisplayMode.c Log: re-enabled force-WS option, but changed default to being true. Also modified default setting for program panel to being false since this may provide a higher chance for a working panel outthere. If people experience trouble please let me know. Modified: haiku/trunk/src/add-ons/accelerants/nvidia/ProposeDisplayMode.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/ProposeDisplayMode.c 2008-06-10 02:01:12 UTC (rev 25898) +++ haiku/trunk/src/add-ons/accelerants/nvidia/ProposeDisplayMode.c 2008-06-10 10:38:50 UTC (rev 25899) @@ -217,19 +217,15 @@ } break; default: -#if 0 /* at least one analog monitor is connected, or nothing detected at all */ /* (if forcing widescreen type was requested don't block mode) */ if (target_aspect > 1.34 && !si->settings.force_ws) { LOG(4, ("PROPOSEMODE: not all output devices can display widescreen modes, aborted.\n")); return B_ERROR; } -#endif break; } -// Wide screen modes are pretty common these days... - better use EDID! -#if 0 /* only export widescreen panel-TV modes when an exact resolution match exists, * to prevent the modelist from becoming too crowded */ if (target_aspect > 1.61 && !si->settings.force_ws) { @@ -250,7 +246,6 @@ return B_ERROR; } } -#endif } /* check if panel(s) can display the requested resolution (if connected) */ From rudolfc at mail.berlios.de Tue Jun 10 12:39:04 2008 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Tue, 10 Jun 2008 12:39:04 +0200 Subject: [Haiku-commits] r25900 - haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia Message-ID: <200806101039.m5AAd4Pk004840@sheep.berlios.de> Author: rudolfc Date: 2008-06-10 12:39:03 +0200 (Tue, 10 Jun 2008) New Revision: 25900 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25900&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/README.html haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/nvidia.settings Log: re-enabled force-WS option, but changed default to being true. Also modified default setting for program panel to being false since this may provide a higher chance for a working panel outthere. If people experience trouble please let me know. Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/README.html =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/README.html 2008-06-10 10:38:50 UTC (rev 25899) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/README.html 2008-06-10 10:39:03 UTC (rev 25900) @@ -201,9 +201,9 @@
  • pgm_panel:
    This option only has an effect if you have a laptop panel or DVI panel connected. It's existing because it's currently impossible to setup the driver in a way every single panel outthere is happy about it.
      -
    • false:
      +
    • false: (default setting)
      If you select pgm_panel false the driver will not program the panel's pixelclock (refreshrate). Instead it relies on your cardBIOS to have done that correctly. While this is probably the case, it might introduce some displaying errors every now and then. -
    • true: (default setting)
      +
    • true:
      With the pgm_panel true setting, the driver will fix your panel's refreshrate to 60Hz. While this should be working on all panels outthere, some panels are particular picky about refreshrates below 60.0Hz (they shut off), and some other panels are particular picky about refreshrates above 60.0Hz (they shut off). While the driver requests the hardware to set 60.0Hz, this isn't exactly possible, so the actual setting is bound to be a tiny bit below or above 60.0Hz.
  • vga_on_tv:
    @@ -227,9 +227,11 @@
  • force_ws:
    This option (if enabled) overrules the aspect ratio detection for screens inside the driver. When set to true it forces all monitors to be treated as widescreen types.
      -
    • false: (default setting)
      +
    • false:
      If you select force_ws false the driver will autodetect the screen's aspect ratio if it can, otherwise it will force 4:3 aspect. Screens that are connected with a DVI cable and screens inside a laptop are autodetected (according to the cardBIOS presets done), but analog connected screens will always make the driver block widescreen modes. Connected analog TV sets are always treated like widescreen devices though. -
    • true: With this setting all monitors are treated as being widescreen types. This setting should only be used if you are having trouble using a widescreen monitor, because on non-widescreen monitors there's a (small) chance of destroying them if used with a widescreen mode. So use this setting with care. +
    • true: (default setting)
      With this setting all monitors are treated as being widescreen types. This setting should only be used if you are having trouble using a widescreen monitor, because on non-widescreen monitors there's a (small) chance of destroying them if used with a widescreen mode. So use this setting with care.
      +Note please:
      +The default setting was changed from false to being true on request by Haiku because widescreen monitors are rapidly becoming commonplace these days. In the future EDID will be implemented in the driver to actually fetch this info from the connected screens.
  • primary: (set to disabled by default)
    Primary lets you force a certain card to be used as primary card in your system if you have multiple graphics cards installed: so it will display your desktop. To enable this (hack) feature uncomment this item and fill in the exact name of the card that is to be primary (as exported by the kerneldriver in /dev/graphics/). If you are going to select a card other than the one displaying your system's POST messages at bootup, make sure you also set 'usebios false' as otherwise the card(s) aren't coldstarted by the driver.
    @@ -243,6 +245,6 @@

    Rudolf Cornelissen. -

    (Page last updated on April 11, 2006)

    +

    (Page last updated on June 10, 2008)

    Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c 2008-06-10 10:38:50 UTC (rev 25899) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c 2008-06-10 10:39:03 UTC (rev 25900) @@ -388,11 +388,11 @@ false, // switchhead false, // force_pci false, // unhide_fw - true, // pgm_panel + false, // pgm_panel true, // dma_acc false, // vga_on_tv false, // force_sync - false, // force_ws + true, // force_ws 0, // gpu_clk 0, // ram_clk }; Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/nvidia.settings =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/nvidia.settings 2008-06-10 10:38:50 UTC (rev 25899) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/nvidia.settings 2008-06-10 10:39:03 UTC (rev 25900) @@ -21,11 +21,11 @@ dma_acc true # if true enable DMA cmd fetching for 2D acc (instead of using PIO) #tv_output 0 # disabled or 0 = autodetect, 1 = Y/C (and CVBS if possible), 2 = CVBS force_sync false # if true forces 3D rendering to be synchronized to the vertical retrace -force_ws false # if true forces widescreen type detection for all connected screens +force_ws true # if true forces widescreen type detection for all connected screens # WARNING: tweak alert! modify stuff below on your own risk... unhide_fw false # if true 'unhide' cards AGP fastwrite support on cards that hide it -pgm_panel true # if false don't program DVI and laptop panel pixelclocks (refreshrates) +pgm_panel false # if false don't program DVI and laptop panel pixelclocks (refreshrates) vga_on_tv false # if true enables VGA output on the head outputting to TV #gpu_clk 150 # in Mhz, (tries to) override default GPU clockspeed (be carefull!!!) #ram_clk 150 # in Mhz, (tries to) override default cardRAM clockspeed (be carefull!!!) From rudolfc at mail.berlios.de Tue Jun 10 12:44:11 2008 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Tue, 10 Jun 2008 12:44:11 +0200 Subject: [Haiku-commits] r25901 - haiku/trunk/src/add-ons/accelerants/nvidia/engine Message-ID: <200806101044.m5AAiBil013205@sheep.berlios.de> Author: rudolfc Date: 2008-06-10 12:44:10 +0200 (Tue, 10 Jun 2008) New Revision: 25901 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25901&view=rev Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c Log: added verified support for Nvidia GeForce 6150 Go (NFORCE4 Integr.GPU) on behalf of Dustin Howett. Thanks for your work on this. Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c 2008-06-10 10:39:03 UTC (rev 25900) +++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c 2008-06-10 10:44:10 UTC (rev 25901) @@ -1,7 +1,7 @@ /* Authors: Mark Watson 12/1999, Apsed, - Rudolf Cornelissen 10/2002-10/2007 + Rudolf Cornelissen 10/2002-6/2008 */ #define MODULE_BIT 0x00008000 @@ -809,6 +809,14 @@ sprintf(si->adi.chipset, "NV44"); status = nvxx_general_powerup(); break; + case 0x024410de: /* Nvidia GeForce 6150 Go (NFORCE4 Integr.GPU) */ + si->ps.card_type = NV44; + si->ps.card_arch = NV40A; + si->ps.laptop = true; + sprintf(si->adi.name, "Nvidia GeForce 6150 Go"); + sprintf(si->adi.chipset, "NV44"); + status = nvxx_general_powerup(); + break; case 0x024510de: /* Nvidia Quadro NVS 210S / NVIDIA GeForce 6150LE (NFORCE4 Integr.GPU) */ si->ps.card_type = NV44; si->ps.card_arch = NV40A; From rudolfc at mail.berlios.de Tue Jun 10 12:45:57 2008 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Tue, 10 Jun 2008 12:45:57 +0200 Subject: [Haiku-commits] r25902 - haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia Message-ID: <200806101045.m5AAjvdL015612@sheep.berlios.de> Author: rudolfc Date: 2008-06-10 12:45:54 +0200 (Tue, 10 Jun 2008) New Revision: 25902 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25902&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c Log: added verified support for Nvidia GeForce 6150 Go (NFORCE4 Integr.GPU) on behalf of Dustin Howett. Thanks for your work on this. Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c 2008-06-10 10:44:10 UTC (rev 25901) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c 2008-06-10 10:45:54 UTC (rev 25902) @@ -4,7 +4,7 @@ Other authors: Mark Watson; - Rudolf Cornelissen 3/2002-10/2007. + Rudolf Cornelissen 3/2002-6/2008. */ @@ -241,6 +241,7 @@ 0x0240, /* Nvidia GeForce 6150 (NFORCE4 Integr.GPU) */ 0x0241, /* Nvidia GeForce 6150 LE (NFORCE4 Integr.GPU) */ 0x0242, /* Nvidia GeForce 6100 (NFORCE4 Integr.GPU) */ + 0x0244, /* Nvidia GeForce Go 6150 (NFORCE4 Integr.GPU) */ 0x0245, /* Nvidia Quadro NVS 210S / GeForce 6150LE */ 0x0250, /* Nvidia GeForce4 Ti 4600 */ 0x0251, /* Nvidia GeForce4 Ti 4400 */ From rudolfc at mail.berlios.de Tue Jun 10 13:10:04 2008 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Tue, 10 Jun 2008 13:10:04 +0200 Subject: [Haiku-commits] r25903 - in haiku/trunk/src/add-ons/accelerants/nvidia: . engine Message-ID: <200806101110.m5ABA4TS009482@sheep.berlios.de> Author: rudolfc Date: 2008-06-10 13:10:01 +0200 (Tue, 10 Jun 2008) New Revision: 25903 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25903&view=rev Modified: haiku/trunk/src/add-ons/accelerants/nvidia/SetDisplayMode.c haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c Log: removed all references to G80 and newer cards. Bumped version to 0.85 Modified: haiku/trunk/src/add-ons/accelerants/nvidia/SetDisplayMode.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/SetDisplayMode.c 2008-06-10 10:45:54 UTC (rev 25902) +++ haiku/trunk/src/add-ons/accelerants/nvidia/SetDisplayMode.c 2008-06-10 11:10:01 UTC (rev 25903) @@ -6,7 +6,7 @@ Other authors: Mark Watson, Apsed, - Rudolf Cornelissen 11/2002-10/2007 + Rudolf Cornelissen 11/2002-6/2008 */ #define MODULE_BIT 0x00200000 @@ -292,14 +292,11 @@ /* note: * Maybe later we can forget about non-DMA mode (depends on 3D acceleration * attempts). */ -//no acc support for G8x yet! -if (si->ps.card_arch < NV50A) -{ if (!si->settings.dma_acc) nv_acc_init(); else nv_acc_init_dma(); -} + /* set up overlay unit for this mode */ nv_bes_init(); Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c 2008-06-10 10:45:54 UTC (rev 25902) +++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c 2008-06-10 11:10:01 UTC (rev 25903) @@ -91,7 +91,7 @@ { status_t status; - LOG(1,("POWERUP: Haiku nVidia Accelerant 0.84 running.\n")); + LOG(1,("POWERUP: Haiku nVidia Accelerant 0.85 running.\n")); /* log VBLANK INT usability status */ if (si->ps.int_assigned) @@ -688,14 +688,6 @@ sprintf(si->adi.chipset, "NV18"); status = nvxx_general_powerup(); break; - case 0x019110de: /* Nvidia GeForce 8800 GTX */ - case 0x019310de: /* Nvidia GeForce 8800 GTS */ - si->ps.card_type = G80; - si->ps.card_arch = NV50A; - sprintf(si->adi.name, "Nvidia GeForce 8800"); - sprintf(si->adi.chipset, "G80"); - status = nvxx_general_powerup(); - break; case 0x01a010de: /* Nvidia GeForce2 Integrated GPU */ si->ps.card_type = NV11; si->ps.card_arch = NV10A; @@ -1249,43 +1241,6 @@ sprintf(si->adi.chipset, "NV44"); status = nvxx_general_powerup(); break; - case 0x040010de: /* Nvidia GeForce 8600 GTS */ - case 0x040210de: /* Nvidia GeForce 8600 GT */ - si->ps.card_type = G84; - si->ps.card_arch = NV50A; - sprintf(si->adi.name, "Nvidia GeForce 8600"); - sprintf(si->adi.chipset, "G84"); - status = nvxx_general_powerup(); - break; - case 0x040710de: /* Nvidia GeForce 8600M GT */ - si->ps.card_type = G86; - si->ps.card_arch = NV50A; - si->ps.laptop = true; - sprintf(si->adi.name, "Nvidia GeForce 8600M GT"); - sprintf(si->adi.chipset, "G86"); - status = nvxx_general_powerup(); - break; - case 0x042110de: /* Nvidia GeForce 8500 GT */ - si->ps.card_type = G86; - si->ps.card_arch = NV50A; - sprintf(si->adi.name, "Nvidia GeForce 8500 GT"); - sprintf(si->adi.chipset, "G86"); - status = nvxx_general_powerup(); - break; - case 0x042210de: /* Nvidia GeForce 8400 GS */ - si->ps.card_type = G86; - si->ps.card_arch = NV50A; - sprintf(si->adi.name, "Nvidia GeForce 8400 GS"); - sprintf(si->adi.chipset, "G86"); - status = nvxx_general_powerup(); - break; - case 0x042310de: /* Nvidia GeForce 8300 GS */ - si->ps.card_type = G86; - si->ps.card_arch = NV50A; - sprintf(si->adi.name, "Nvidia GeForce 8300 GS"); - sprintf(si->adi.chipset, "G86"); - status = nvxx_general_powerup(); - break; /* Vendor Elsa GmbH */ case 0x0c601048: /* Elsa Gladiac Geforce2 MX */ si->ps.card_type = NV11; @@ -1561,12 +1516,6 @@ LOG(4, ("INIT: NV powerup\n")); LOG(4,("POWERUP: Detected %s (%s)\n", si->adi.name, si->adi.chipset)); - if (si->ps.card_arch >= NV50A) - { - LOG(8,("POWERUP: G80 and higher support not implemented: different architecture!\n")); - return B_ERROR; - } - /* setup cardspecs */ /* note: * this MUST be done before the driver attempts a card coldstart */ @@ -2088,9 +2037,6 @@ { /* check if we can setup this mode with acceleration */ *acc_mode = true; - //no acc support for G8x yet! - if (si->ps.card_arch >= NV50A) *acc_mode = false; - /* virtual_width */ if (target->virtual_width > max_acc_width) *acc_mode = false; /* virtual_height */ @@ -2123,8 +2069,6 @@ { /* check if we can setup this mode with acceleration */ *acc_mode = true; - //no acc support for G8x yet! - if (si->ps.card_arch >= NV50A) *acc_mode = false; /* (we already know virtual_width will be no problem) */ /* virtual_height */ /* (NV cards can even do more than this(?)... From rudolfc at mail.berlios.de Tue Jun 10 13:10:32 2008 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Tue, 10 Jun 2008 13:10:32 +0200 Subject: [Haiku-commits] r25904 - haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia Message-ID: <200806101110.m5ABAWFq010007@sheep.berlios.de> Author: rudolfc Date: 2008-06-10 13:10:31 +0200 (Tue, 10 Jun 2008) New Revision: 25904 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25904&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/README.html haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c Log: removed all references to G80 and newer cards. Bumped version to 0.85 and updated docs. Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/README.html =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/README.html 2008-06-10 11:10:01 UTC (rev 25903) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/README.html 2008-06-10 11:10:31 UTC (rev 25904) @@ -27,6 +27,8 @@
  • GeForce FX/PCX 7xxx/Go;
  • Quadro (2/4/FX/PCX/Go); +Note please:
    +Geforce 8xxx and later series cards (NV50, G80, also known as GPGPU, general purpose graphics processing unit architecture) will NOT be supported with this driver. These cards are quite different in architecture compared to everything before so they need a seperate driver.


    Features:

    Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html 2008-06-10 11:10:01 UTC (rev 25903) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html 2008-06-10 11:10:31 UTC (rev 25904) @@ -4,16 +4,19 @@

    Changes done for each driverversion:

    -

    head (SVN 0.84, Rudolf)

    +

    head (SVN 0.85, Rudolf)

    • Fixed driver assuming enabling AGP mode succeeded on some occasions if it did not block it itself. Blocking AGP mode completely via the AGP busmanager (option 'block_agp') resulted in a crashing acceleration engine because it was setup for AGP transfers instead of using PCI transfers. Error was solved with help from user kraton.
    • Fixed shared_info struct problem occuring when 3D 'accelerant' is used (tested Alpha 4.1): the TVencoder type definition list apparantly gets some memory assigned these days when done inside the definition of shared_info. Moved encoder list outside the shared_info definition. -
    • Updated naming for some previous unknown cards, added 25 new cards for support/recognition in the kernel driver and accelerant, being GF 6xxx, 7xxx and 8xxx types. Also two more nforce 6100 4x0 cards are recognized now. All cards listed in nvidia's official april 2007 ID list are now recognized.
      -Note please:
      +
    • Updated naming for some previous unknown cards, added some 20 new cards for support/recognition in the kernel driver and accelerant, being GF 6xxx and 7xxx types. Also two more nforce 6100 cards are recognized now. All non GF 8xxx cards listed in nvidia's official april 2007 ID list are now recognized. GF 8xxx and later cards will not be supported by this driver as their architecture is quite different from before.
      +
    • Modified two default settings for the driver:
        -
      • GF8xxx is recognized, but not supported. It looks like nVidia's card architecture was revised in such an extensive way that we probably best create a seperate accelerant for these cards. +
      • 'pgm_panel' is now preset to 'false' since this will probably increase chances of a good picture on panels outthere. +
      • 'force_ws' is now (re-enabled but) preset to 'true' since the number of widescreen monitors outthere is rapidly becoming mainstream.
        Note please:
        +'force_ws' was hardcoded to setting 'true' some time ago by the Haiku team because of these monitors.
    +

    nv_driver 0.80 (Rudolf)

    • Improved 3D speed related initialisation programming for NV11 and NV15: NV11 just gained 44% rendering speed, NV15 gained 21% speed. The GeForce2Ti (NV15) is the new winner: Quake 2 timedemo 1 runs at 28.3fps in 1024x768x32 mode @ 75Hz refreshrate (P4 2.8Ghz, fsb 533Mhz, AGP4x), while on the GeForce4MX (NV18) it keeps running at 26.3fps. The GeForce2MX (NV11) now runs at 18.9fps. Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c 2008-06-10 11:10:01 UTC (rev 25903) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c 2008-06-10 11:10:31 UTC (rev 25904) @@ -217,8 +217,6 @@ 0x018b, /* Nvidia Quadro4 380 XGL */ 0x018c, /* Nvidia Quadro4 NVS 50 PCI */ 0x018d, /* Nvidia GeForce4 448 Go */ - 0x0191, /* Nvidia GeForce 8800 GTX */ - 0x0193, /* Nvidia GeForce 8800 GTS */ 0x01a0, /* Nvidia GeForce2 Integrated GPU */ 0x01d1, /* Nvidia GeForce 7300 LE */ 0x01d3, /* Nvidia GeForce 7300 SE */ @@ -327,15 +325,6 @@ 0x03d0, /* Nvidia GeForce 6100 nForce 430 */ 0x03d1, /* Nvidia GeForce 6100 nForce 405 */ 0x03d2, /* Nvidia GeForce 6100 nForce 400 */ -#if 0 - // TODO: these cards are not yet supported - 0x0400, /* Nvidia GeForce 8600 GTS */ - 0x0402, /* Nvidia GeForce 8600 GT */ - 0x0407, /* Nvidia GeForce 8600M GT */ - 0x0421, /* Nvidia GeForce 8500 GT */ - 0x0422, /* Nvidia GeForce 8400 GS */ - 0x0423, /* Nvidia GeForce 8300 GS */ -#endif 0 }; From rudolfc at mail.berlios.de Tue Jun 10 13:10:53 2008 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Tue, 10 Jun 2008 13:10:53 +0200 Subject: [Haiku-commits] r25905 - haiku/trunk/headers/private/graphics/nvidia Message-ID: <200806101110.m5ABArmv010479@sheep.berlios.de> Author: rudolfc Date: 2008-06-10 13:10:52 +0200 (Tue, 10 Jun 2008) New Revision: 25905 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25905&view=rev Modified: haiku/trunk/headers/private/graphics/nvidia/DriverInterface.h Log: removed all references to G80 and newer cards. Modified: haiku/trunk/headers/private/graphics/nvidia/DriverInterface.h =================================================================== --- haiku/trunk/headers/private/graphics/nvidia/DriverInterface.h 2008-06-10 11:10:31 UTC (rev 25904) +++ haiku/trunk/headers/private/graphics/nvidia/DriverInterface.h 2008-06-10 11:10:52 UTC (rev 25905) @@ -5,7 +5,7 @@ Other authors: Mark Watson; Apsed; - Rudolf Cornelissen 10/2002-9/2007. + Rudolf Cornelissen 10/2002-6/2008. */ #ifndef DRIVERINTERFACE_H @@ -117,8 +117,7 @@ NV10A, NV20A, NV30A, - NV40A, - NV50A + NV40A }; /* card info - information gathered from PINS (and other sources) */ From axeld at pinc-software.de Tue Jun 10 13:46:04 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 10 Jun 2008 13:46:04 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r25903_-_in_haiku/trunk/src/add-ons/acc?= =?utf-8?q?elerants/nvidia=3A_=2E_engine?= In-Reply-To: <200806101110.m5ABA4TS009482@sheep.berlios.de> Message-ID: <19306965071-BeMail@zon> rudolfc at BerliOS wrote: > Log: > removed all references to G80 and newer cards. Bumped version to 0.85 Can you please combine these commits to a single one next time that spans over several directories? You can do this like this: $ svn commit src/add-ons/accelerants/ src/add-ons/kernel/drivers/ Bye, Axel. From Info.Be-Hold at inter.nl.net Tue Jun 10 14:07:02 2008 From: Info.Be-Hold at inter.nl.net (Info.Be-Hold at inter.nl.net) Date: Tue, 10 Jun 2008 14:07:02 +0200 (CEST) Subject: [Haiku-commits] hi there.. Message-ID: <49193.85.223.98.72.1213099622.squirrel@webmail.inter.nl.net> Hi there, I am now member of this list, as axel told me I have to do that. never heard that before though :-/ Anyhow, I heard there were reactions to my commits. Anything I should respond to that I missed? Thanks :) Rudolf. From mmu_man at mail.berlios.de Tue Jun 10 15:27:42 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 10 Jun 2008 15:27:42 +0200 Subject: [Haiku-commits] r25906 - haiku/trunk/src/add-ons/media/media-add-ons/opensound Message-ID: <200806101327.m5ADRguN029889@sheep.berlios.de> Author: mmu_man Date: 2008-06-10 15:27:42 +0200 (Tue, 10 Jun 2008) New Revision: 25906 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25906&view=rev Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.h Log: - Remove some multi-audio leftovers. - spice up select_oss_rate() to use the passed rate as hint, and also check in the rate array, or the range for cards with the FREERATE cap. Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp 2008-06-10 11:10:52 UTC (rev 25905) +++ haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp 2008-06-10 13:27:42 UTC (rev 25906) @@ -137,16 +137,32 @@ int OpenSoundDevice::select_oss_rate(const oss_audioinfo *info, int rate) { - //highest rate - return info->max_rate; - //XXX:FIXME: use min/max + array - return rate; + if (info->caps & PCM_CAP_FREERATE) { + // if not wildcard and matches, return the hint + if (rate && rate >= info->min_rate && rate <= info->max_rate) + return rate; + // else use max available + return info->max_rate; + } + int i; + int max_rate; + for (i = 0; i < info->nrates; i++) { + if (info->rates[i] < info->min_rate || info->rates[i] > info->max_rate) + continue; + // if the hint matches + if (rate && rate == info->rates[i]) + return rate; + if (info->rates[i] > max_rate) + max_rate = info->rates[i]; + } + // highest rate + return max_rate; } int OpenSoundDevice::select_oss_format(int fmt) { - //highest format, native endian first + //highest format, Native Endian first if (fmt & AFMT_FLOAT) { return AFMT_FLOAT; } else if (fmt & AFMT_S32_NE) { @@ -357,159 +373,6 @@ fInitCheckStatus = B_OK; return B_OK; - -#if MA - multi_channel_enable MCE; - uint32 mce_enable_bits; - int rval, i, num_outputs, num_inputs, num_channels; - - CALLED(); - - //open the device driver for output - fd = open(fDevice_path, O_WRONLY); - - if (fd == -1) { - fprintf(stderr, "Failed to open %s: %s\n", fDevice_path, strerror(errno)); - return B_ERROR; - } - - // - // Get description - // - MD.info_size = sizeof(MD); - MD.request_channel_count = MAX_CHANNELS; - MD.channels = MCI; - rval = DRIVER_GET_DESCRIPTION(&MD, 0); - if (B_OK != rval) - { - fprintf(stderr, "Failed on B_MULTI_GET_DESCRIPTION\n"); - return B_ERROR; - } - - PRINT(("Friendly name:\t%s\nVendor:\t\t%s\n", - MD.friendly_name, MD.vendor_info)); - PRINT(("%ld outputs\t%ld inputs\n%ld out busses\t%ld in busses\n", - MD.output_channel_count, MD.input_channel_count, - MD.output_bus_channel_count, MD.input_bus_channel_count)); - PRINT(("\nChannels\n" - "ID\tKind\tDesig\tConnectors\n")); - - for (i = 0 ; i < (MD.output_channel_count + MD.input_channel_count); i++) - { - PRINT(("%ld\t%d\t0x%lx\t0x%lx\n", MD.channels[i].channel_id, - MD.channels[i].kind, - MD.channels[i].designations, - MD.channels[i].connectors)); - } - PRINT(("\n")); - - PRINT(("Output rates\t\t0x%lx\n", MD.output_rates)); - PRINT(("Input rates\t\t0x%lx\n", MD.input_rates)); - PRINT(("Max CVSR\t\t%.0f\n", MD.max_cvsr_rate)); - PRINT(("Min CVSR\t\t%.0f\n", MD.min_cvsr_rate)); - PRINT(("Output formats\t\t0x%lx\n", MD.output_formats)); - PRINT(("Input formats\t\t0x%lx\n", MD.input_formats)); - PRINT(("Lock sources\t\t0x%lx\n", MD.lock_sources)); - PRINT(("Timecode sources\t0x%lx\n", MD.timecode_sources)); - PRINT(("Interface flags\t\t0x%lx\n", MD.interface_flags)); - PRINT(("Control panel string:\t\t%s\n", MD.control_panel)); - PRINT(("\n")); - - num_outputs = MD.output_channel_count; - num_inputs = MD.input_channel_count; - num_channels = num_outputs + num_inputs; - - // Get and set enabled channels - MCE.info_size = sizeof(MCE); - MCE.enable_bits = (uchar *) & mce_enable_bits; - rval = DRIVER_GET_ENABLED_CHANNELS(&MCE, sizeof(MCE)); - if (B_OK != rval) - { - fprintf(stderr, "Failed on B_MULTI_GET_ENABLED_CHANNELS len is 0x%lx\n", sizeof(MCE)); - return B_ERROR; - } - - mce_enable_bits = (1 << num_channels) - 1; - MCE.lock_source = B_MULTI_LOCK_INTERNAL; - rval = DRIVER_SET_ENABLED_CHANNELS(&MCE, 0); - if (B_OK != rval) - { - fprintf(stderr, "Failed on B_MULTI_SET_ENABLED_CHANNELS 0x%p 0x%x\n", MCE.enable_bits, *(MCE.enable_bits)); - return B_ERROR; - } - - // - // Set the sample rate - // - MFI.info_size = sizeof(MFI); - MFI.output.rate = select_oss_rate(MD.output_rates); - MFI.output.cvsr = 0; - MFI.output.format = select_oss_format(MD.output_formats); - MFI.input.rate = MFI.output.rate; - MFI.input.cvsr = MFI.output.cvsr; - MFI.input.format = MFI.output.format; - rval = DRIVER_SET_GLOBAL_FORMAT(&MFI, 0); - if (B_OK != rval) - { - fprintf(stderr, "Failed on B_MULTI_SET_GLOBAL_FORMAT\n"); - return B_ERROR; - } - - // - // Get the buffers - // - for (i = 0; i < NB_BUFFERS; i++) { - play_buffer_desc[i] = &play_buffer_list[i * MAX_CHANNELS]; - record_buffer_desc[i] = &record_buffer_list[i * MAX_CHANNELS]; - } - MBL.info_size = sizeof(MBL); - MBL.request_playback_buffer_size = 0; //use the default...... - MBL.request_playback_buffers = NB_BUFFERS; - MBL.request_playback_channels = num_outputs; - MBL.playback_buffers = (buffer_desc **) play_buffer_desc; - MBL.request_record_buffer_size = 0; //use the default...... - MBL.request_record_buffers = NB_BUFFERS; - MBL.request_record_channels = num_inputs; - MBL.record_buffers = (buffer_desc **) record_buffer_desc; - - rval = DRIVER_GET_BUFFERS(&MBL, 0); - - if (B_OK != rval) - { - fprintf(stderr, "Failed on B_MULTI_GET_BUFFERS\n"); - return B_ERROR; - } - - for (i = 0; i < MBL.return_playback_buffers; i++) - for (int j = 0; j < MBL.return_playback_channels; j++) { - PRINT(("MBL.playback_buffers[%d][%d].base: %p\n", - i, j, MBL.playback_buffers[i][j].base)); - PRINT(("MBL.playback_buffers[%d][%d].stride: %i\n", - i, j, MBL.playback_buffers[i][j].stride)); - } - - for (i = 0; i < MBL.return_record_buffers; i++) - for (int j = 0; j < MBL.return_record_channels; j++) { - PRINT(("MBL.record_buffers[%d][%d].base: %p\n", - i, j, MBL.record_buffers[i][j].base)); - PRINT(("MBL.record_buffers[%d][%d].stride: %i\n", - i, j, MBL.record_buffers[i][j].stride)); - } - - MMCI.info_size = sizeof(MMCI); - MMCI.control_count = MAX_CONTROLS; - MMCI.controls = MMC; - - rval = DRIVER_LIST_MIX_CONTROLS(&MMCI, 0); - - if (B_OK != rval) - { - fprintf(stderr, "Failed on DRIVER_LIST_MIX_CONTROLS\n"); - return B_ERROR; - } - - return B_OK; -#endif } @@ -594,23 +457,3 @@ return engine; } - -#if MA -int -OpenSoundDevice::DoBufferExchange(multi_buffer_info *MBI) -{ - return DRIVER_BUFFER_EXCHANGE(MBI, 0); -} - -int -OpenSoundDevice::DoSetMix(multi_mix_value_info *MMVI) -{ - return DRIVER_SET_MIX(MMVI, 0); -} - -int -OpenSoundDevice::DoGetMix(multi_mix_value_info *MMVI) -{ - return DRIVER_GET_MIX(MMVI, 0); -} -#endif Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.h =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.h 2008-06-10 11:10:52 UTC (rev 25905) +++ haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.h 2008-06-10 13:27:42 UTC (rev 25906) @@ -92,48 +92,10 @@ static status_t get_media_format_description_for(int fmt, media_format_description *desc, int count=1); static status_t register_media_formats(); static status_t get_media_format_for(int fmt, media_format &format); -#if MA - static float convert_oss_rate_to_media_rate(uint32 rate); - static uint32 convert_media_rate_to_oss_rate(float rate); - static uint32 convert_oss_format_to_media_format(uint32 fmt); - static int16 convert_oss_format_to_valid_bits(uint32 fmt); - static uint32 convert_media_format_to_oss_format(uint32 fmt); - static uint32 select_oss_rate(uint32 rate); - static uint32 select_oss_format(uint32 fmt); - int DoBufferExchange(multi_buffer_info *MBI); - int DoSetMix(multi_mix_value_info *MMVI); - int DoGetMix(multi_mix_value_info *MMVI); -#endif - - private: - - char fDevice_name[32]; - char fDevice_path[32]; - int fMixFD; - int fPcmFDs[MAX_CHANNELS]; - int fSpdifFDs[MAX_CHANNELS]; -#if MA - int fd; //file descriptor for hw driver -#endif - public: oss_card_info fCardInfo; -#if MA - multi_description MD; - multi_channel_info MCI[MAX_CHANNELS]; - multi_format_info MFI; - multi_buffer_list MBL; - multi_mix_control_info MMCI; - multi_mix_control MMC[MAX_CONTROLS]; - - buffer_desc play_buffer_list[NB_BUFFERS * MAX_CHANNELS]; - buffer_desc record_buffer_list[NB_BUFFERS * MAX_CHANNELS]; - buffer_desc *play_buffer_desc[NB_BUFFERS]; - buffer_desc *record_buffer_desc[NB_BUFFERS]; -#endif - private: status_t fInitCheckStatus; BList fEngines; From Info.Be-Hold at inter.nl.net Tue Jun 10 15:48:11 2008 From: Info.Be-Hold at inter.nl.net (Info.Be-Hold at inter.nl.net) Date: Tue, 10 Jun 2008 15:48:11 +0200 (CEST) Subject: [Haiku-commits] r25873 - in haiku/trunk/src/add-ons/accelerants: . nvidia_gpgpu nvidia_gpgpu/engine Message-ID: <49185.85.223.98.72.1213105691.squirrel@webmail.inter.nl.net> Hi there Rene, how are you? :) Hi Axel (about the not-so-nice-name) I was able to retrieve this message from the log, since I was no member of this list. Anyhow, I plan to support the 8500 GPU since someone donated one to me. But I'll work only from time to time on it (in my not soo often spare time). Since starting with G80 nvidia came up with a new architecture a new driver is prudent. The current driver is full enough with switches and if/else statements as it is. So in the end the new driver should support G80 and up, until nvidia throws this architecture in the bin and comes up with 'yet' a new one. If someone has a better name for the driver then, by all means, come up with it. I cerntainly don't since for instance nvidia_g80 doesn't cut it because g90 and g100 (if they come to exist) will probably work with this driver as well. And just 'nvidia' is taken.. Bye! Rudolf. -------- Hi Rudolf :) On Mon, Jun 9, 2008 at 9:37 AM, rudolfc at BerliOS wrote: > Author: rudolfc > Date: 2008-06-09 16:37:03 +0200 (Mon, 09 Jun 2008) > New Revision: 25873 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25873&view=rev > I'm just curious, wasn't gpgpu a previous name for what nvidia now refers to as CUDA? Are you planning on implementing support for something like this? Regards, Rene From ingo_weinhold at gmx.de Tue Jun 10 16:05:49 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Tue, 10 Jun 2008 16:05:49 +0200 Subject: [Haiku-commits] r25873 - in haiku/trunk/src/add-ons/accelerants: . nvidia_gpgpu nvidia_gpgpu/engine In-Reply-To: <49185.85.223.98.72.1213105691.squirrel@webmail.inter.nl.net> References: <49185.85.223.98.72.1213105691.squirrel@webmail.inter.nl.net> Message-ID: <20080610160549.447.1@knochen-vm.1213104057.fake> On 2008-06-10 at 15:48:11 [+0200], Info.Be-Hold at inter.nl.net wrote: [...] > If someone has a better name for the driver then, by all means, come up > with it. I cerntainly don't since for instance nvidia_g80 doesn't cut it > because g90 and g100 (if they come to exist) will probably work with this > driver as well. And just 'nvidia' is taken.. How about renaming the old driver to something like "nvidia--" (/ being supported models/families) and naming the new one just "nvidia" for the time being? CU, Ingo From ingo_weinhold at gmx.de Tue Jun 10 16:10:36 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Tue, 10 Jun 2008 16:10:36 +0200 Subject: [Haiku-commits] r25881 - haiku/trunk/src/apps/terminal In-Reply-To: <5497845367-BeMail@laptop> References: <5497845367-BeMail@laptop> Message-ID: <20080610161036.480.2@knochen-vm.1213104057.fake> On 2008-06-10 at 00:52:53 [+0200], Fran?ois Revol wrote: > > Log: > > Terminal changes. This is still work in progress, some features > > are disabled, lots of commented debug code is still in there, > > and quite a bit of cleanup is needed, but basically things work > > at least as well as before with several improvements: > > While at it if you can implement the line-drawing charset... :) > It should be accessible using UTF-8 but the plane needs more than 1 > byte which termcap cannot encode, so implementing the regular escape > codes would allow using them. I don't think I'll do that. I'm only working on the Terminal because it annoyed me one time too often. I basically just want to get to a state where everything works at least as well as before. I may make it a bit more xtermy, but aside from that I don't really want to dig too deep. CU, Ingo From umccullough at gmail.com Tue Jun 10 16:46:18 2008 From: umccullough at gmail.com (Urias McCullough) Date: Tue, 10 Jun 2008 07:46:18 -0700 Subject: [Haiku-commits] hi there.. In-Reply-To: <49193.85.223.98.72.1213099622.squirrel@webmail.inter.nl.net> References: <49193.85.223.98.72.1213099622.squirrel@webmail.inter.nl.net> Message-ID: <1e80d8750806100746g2d52ffe6p966d7f6693a5475@mail.gmail.com> 2008/6/10 : > Hi there, > > I am now member of this list, as axel told me I have to do that. never > heard that before though :-/ > > Anyhow, I heard there were reactions to my commits. Anything I should > respond to that I missed? > > Thanks :) You can go back and read the threaded archives here: http://lists.berlios.de/pipermail/haiku-commits/2008-June/thread.html welcome back! :) From axeld at pinc-software.de Tue Jun 10 17:10:13 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 10 Jun 2008 17:10:13 +0200 CEST Subject: [Haiku-commits] r25881 - haiku/trunk/src/apps/terminal In-Reply-To: <20080610161036.480.2@knochen-vm.1213104057.fake> Message-ID: <31555109989-BeMail@zon> Ingo Weinhold wrote: > I don't think I'll do that. I'm only working on the Terminal because > it > annoyed me one time too often. I basically just want to get to a > state > where everything works at least as well as before. I may make it a > bit more > xtermy, but aside from that I don't really want to dig too deep. BTW how about having a larger history by default? I think 1000 lines are a bit cheap, and are easily filled several times by a compilation of the Haiku tree. With the current TerminalBuffer implementation, 1000 lines equate to 480KB in case of 80 chars per line. BTW in BeOS, of a "seq 10000" a bit more than 2000 lines survive, and the memory consumption is about 140KB for this. If the lines are longer, more memory is used up, so it seems to be a bit more intelligent in the way it manages its memory :-) Bye, Axel. From Info.Be-Hold at inter.nl.net Tue Jun 10 19:02:42 2008 From: Info.Be-Hold at inter.nl.net (Info.Be-Hold at inter.nl.net) Date: Tue, 10 Jun 2008 19:02:42 +0200 (CEST) Subject: [Haiku-commits] r25873 - in haiku/trunk/src/add-ons/accelerants: . nvidia_gpgpu nvidia_gpgpu/engine In-Reply-To: <20080610160549.447.1@knochen-vm.1213104057.fake> References: <49185.85.223.98.72.1213105691.squirrel@webmail.inter.nl.net> <20080610160549.447.1@knochen-vm.1213104057.fake> Message-ID: <49169.85.223.98.72.1213117362.squirrel@webmail.inter.nl.net> Hi, Sounds like a plan. But the nvidia plain I would do something like nvidia-g8x-plus or so since that won't create messups (in for instance my mind) between people reporting nvidia driver trouble. The current old driver would then become nvidia-tnt1-g7x. I can modify the exported devfs names, but I'd rather not mess with folder names, so if that should be modified as well I'd rather see someone else do that. (I'd hate to break the build so to speak..) Anyhow, I'll leave it as it is for now to see what more comes up. Bye! Rudolf. Op Di, 10 juni, 2008 4:05 pm schreef Ingo Weinhold: > > On 2008-06-10 at 15:48:11 [+0200], Info.Be-Hold at inter.nl.net wrote: > [...] > >> If someone has a better name for the driver then, by all means, come up >> with it. I cerntainly don't since for instance nvidia_g80 doesn't cut >> it because g90 and g100 (if they come to exist) will probably work with >> this driver as well. And just 'nvidia' is taken.. > > How about renaming the old driver to something like > "nvidia--" (/ being supported > models/families) and naming the new one just "nvidia" for the time being? > > CU, Ingo > _______________________________________________ > Haiku-commits mailing list > Haiku-commits at lists.berlios.de > https://lists.berlios.de/mailman/listinfo/haiku-commits > > From Info.Be-Hold at inter.nl.net Tue Jun 10 19:04:34 2008 From: Info.Be-Hold at inter.nl.net (Info.Be-Hold at inter.nl.net) Date: Tue, 10 Jun 2008 19:04:34 +0200 (CEST) Subject: [Haiku-commits] hi there.. In-Reply-To: <1e80d8750806100746g2d52ffe6p966d7f6693a5475@mail.gmail.com> References: <49193.85.223.98.72.1213099622.squirrel@webmail.inter.nl.net> <1e80d8750806100746g2d52ffe6p966d7f6693a5475@mail.gmail.com> Message-ID: <49175.85.223.98.72.1213117474.squirrel@webmail.inter.nl.net> Thanks and thanks! I found the archives indeed. Bye! Rudolf. Op Di, 10 juni, 2008 4:46 pm schreef Urias McCullough: > 2008/6/10 : > >> Hi there, >> >> >> I am now member of this list, as axel told me I have to do that. never >> heard that before though :-/ >> >> Anyhow, I heard there were reactions to my commits. Anything I should >> respond to that I missed? >> >> Thanks :) >> > > You can go back and read the threaded archives here: > > > http://lists.berlios.de/pipermail/haiku-commits/2008-June/thread.html > > > welcome back! :) _______________________________________________ > Haiku-commits mailing list > Haiku-commits at lists.berlios.de > https://lists.berlios.de/mailman/listinfo/haiku-commits > > From pierluigi.fiorini at gmail.com Tue Jun 10 19:23:49 2008 From: pierluigi.fiorini at gmail.com (Pier Luigi Fiorini) Date: Tue, 10 Jun 2008 19:23:49 +0200 Subject: [Haiku-commits] r25873 - in haiku/trunk/src/add-ons/accelerants: . nvidia_gpgpu nvidia_gpgpu/engine In-Reply-To: <49185.85.223.98.72.1213105691.squirrel@webmail.inter.nl.net> References: <49185.85.223.98.72.1213105691.squirrel@webmail.inter.nl.net> Message-ID: <27d8137d0806101023h4cd19ef2p1d919f277d06f6b@mail.gmail.com> 2008/6/10 : > If someone has a better name for the driver then, by all means, come up > with it. I cerntainly don't since for instance nvidia_g80 doesn't cut it > because g90 and g100 (if they come to exist) will probably work with this > driver as well. And just 'nvidia' is taken.. > AFAIK GeForce G80 and G9X are the same family. Some 8*00 cards even have the G9X chip, my GeForce 8800 GT is a G92. Ubuntu calls the TNT, TNT2 or older GeForce package nvidia-glx-legacy. http://packages.ubuntu.com/hardy/x11/nvidia-glx -- Pier Luigi Fiorini Wir sind alle Alkoholiker http://plfiorini.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From rudolfc at mail.berlios.de Tue Jun 10 19:56:13 2008 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Tue, 10 Jun 2008 19:56:13 +0200 Subject: [Haiku-commits] r25907 - in haiku/trunk/src/add-ons: accelerants/nvidia_gpgpu accelerants/nvidia_gpgpu/engine kernel/drivers/graphics/nvidia_gpgpu Message-ID: <200806101756.m5AHuDCD017428@sheep.berlios.de> Author: rudolfc Date: 2008-06-10 19:56:12 +0200 (Tue, 10 Jun 2008) New Revision: 25907 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25907&view=rev Removed: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_acc.c Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/Acceleration.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/EngineManagment.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/GetAccelerantHook.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/InitAccelerant.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/SetDisplayMode.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/Jamfile haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_proto.h haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/driver.c haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/nvidia_gpgpu.settings Log: removed PIO mode acceleration completely. Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/Acceleration.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/Acceleration.c 2008-06-10 13:27:42 UTC (rev 25906) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/Acceleration.c 2008-06-10 17:56:12 UTC (rev 25907) @@ -3,7 +3,7 @@ This file may be used under the terms of the Be Sample Code License. Other authors: - Rudolf Cornelissen 9/2003-2/2005. + Rudolf Cornelissen 9/2003-6/2008. */ /* @@ -11,149 +11,8 @@ moved DMA acceleration 'top-level' routines to be integrated in the engine: it is costly to call the engine for every single function within a loop! (measured with BeRoMeter 1.2.6: upto 15% speed increase on all CPU's.) - Leaving PIO acceleration as it is for now, for the purpose of benchmarking :-) - - note also: - attempting DMA on NV40 and higher because without it I can't get them going ATM. - Maybe later we can forget about PIO mode acceleration totally (depends on 3D - acceleration attempts). */ #define MODULE_BIT 0x40000000 #include "acc_std.h" - -void SCREEN_TO_SCREEN_BLIT_PIO(engine_token *et, blit_params *list, uint32 count) -{ - int i; - - /* init acc engine for blit function */ - nv_acc_setup_blit(); - - /* do each blit */ - i=0; - while (count--) - { - nv_acc_blit - ( - list[i].src_left, - list[i].src_top, - list[i].dest_left, - list[i].dest_top, - list[i].width, - list[i].height - ); - i++; - } -} - -void SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT_PIO(engine_token *et, scaled_blit_params *list, uint32 count) -{ - int i; - - /* do each blit */ - i=0; - while (count--) - { - nv_acc_video_blit - ( - list[i].src_left, - list[i].src_top, - list[i].src_width, - list[i].src_height, - list[i].dest_left, - list[i].dest_top, - list[i].dest_width, - list[i].dest_height - ); - i++; - } -} - -void SCREEN_TO_SCREEN_TRANSPARENT_BLIT_PIO(engine_token *et, uint32 transparent_colour, blit_params *list, uint32 count) -{ - int i; - - /* do each blit */ - i=0; - while (count--) - { - nv_acc_transparent_blit - ( - list[i].src_left, - list[i].src_top, - list[i].dest_left, - list[i].dest_top, - list[i].width, - list[i].height, - transparent_colour - ); - i++; - } -} - -void FILL_RECTANGLE_PIO(engine_token *et, uint32 colorIndex, fill_rect_params *list, uint32 count) -{ - int i; - - /* init acc engine for fill function */ - nv_acc_setup_rectangle(colorIndex); - - /* draw each rectangle */ - i=0; - while (count--) - { - nv_acc_rectangle - ( - list[i].left, - (list[i].right)+1, - list[i].top, - (list[i].bottom-list[i].top)+1 - ); - i++; - } -} - -void INVERT_RECTANGLE_PIO(engine_token *et, fill_rect_params *list, uint32 count) -{ - int i; - - /* init acc engine for invert function */ - nv_acc_setup_rect_invert(); - - /* invert each rectangle */ - i=0; - while (count--) - { - nv_acc_rectangle_invert - ( - list[i].left, - (list[i].right)+1, - list[i].top, - (list[i].bottom-list[i].top)+1 - ); - i++; - } -} - -void FILL_SPAN_PIO(engine_token *et, uint32 colorIndex, uint16 *list, uint32 count) -{ - int i; - - /* init acc engine for fill function */ - nv_acc_setup_rectangle(colorIndex); - - /* draw each span */ - i=0; - while (count--) - { - nv_acc_rectangle - ( - list[i+1], - list[i+2]+1, - list[i], - 1 - ); - i+=3; - } -} Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/EngineManagment.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/EngineManagment.c 2008-06-10 13:27:42 UTC (rev 25906) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/EngineManagment.c 2008-06-10 17:56:12 UTC (rev 25907) @@ -4,16 +4,9 @@ other authors: Mark Watson - Rudolf Cornelissen 3/2004-2/2005 + Rudolf Cornelissen 3/2004-6/2008 */ -/* - note: - attempting DMA on NV40 and higher because without it I can't get it going ATM. - Later on this can become a nv.settings switch, and maybe later we can even - forget about non-DMA completely (depends on 3D acceleration attempts). -*/ - #define MODULE_BIT 0x10000000 #include "acc_std.h" @@ -27,21 +20,6 @@ return 1; } -status_t ACQUIRE_ENGINE_PIO(uint32 capabilities, uint32 max_wait, sync_token *st, engine_token **et) -{ - /* acquire the shared benaphore */ - AQUIRE_BEN(si->engine.lock) - /* sync if required */ - if (st) SYNC_TO_TOKEN(st); - - /* make sure all needed engine cmd's are mapped to the FIFO */ - nv_acc_assert_fifo(); - - /* return an engine token */ - *et = &nv_engine_token; - return B_OK; -} - status_t ACQUIRE_ENGINE_DMA(uint32 capabilities, uint32 max_wait, sync_token *st, engine_token **et) { /* acquire the shared benaphore */ @@ -70,10 +48,7 @@ void WAIT_ENGINE_IDLE(void) { /*wait for the engine to be totally idle*/ - if (!si->settings.dma_acc) - nv_acc_wait_idle(); - else - nv_acc_wait_idle_dma(); + nv_acc_wait_idle_dma(); } status_t GET_SYNC_TOKEN(engine_token *et, sync_token *st) Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/GetAccelerantHook.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/GetAccelerantHook.c 2008-06-10 13:27:42 UTC (rev 25906) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/GetAccelerantHook.c 2008-06-10 17:56:12 UTC (rev 25907) @@ -28,10 +28,10 @@ if (check_overlay_capability(B_##x) == B_OK) return (void *)x; else return (void *)0 #define CHKA(x) case B_##x: \ if (check_acc_capability(B_##x) == B_OK) \ - {if(!si->settings.dma_acc) return (void *)x##_PIO; else return (void *)x##_DMA;} \ - else return (void *)0 -#define CHKS(x) case B_##x: \ - if(!si->settings.dma_acc) return (void *)x##_PIO; else return (void *)x##_DMA + return (void *)x##_DMA; \ + else \ + return (void *)0 +#define CHKS(x) case B_##x: return (void *)x##_DMA #define HOOK(x) case B_##x: return (void *)x #define ZERO(x) case B_##x: return (void *)0 #define HRDC(x) case B_##x: return si->settings.hardcursor? (void *)x: (void *)0; // apsed @@ -212,10 +212,9 @@ break; case B_SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT: msg = "B_SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT"; - /* this function is only defined for DMA acceleration, - * but doesn't support the B_CMAP8 colorspace */ + /* this function doesn't support the B_CMAP8 colorspace */ //fixme: checkout B_CMAP8 support sometime, as some cards seem to support it? - if (!si->settings.dma_acc || (si->dm.space == B_CMAP8)) + if (si->dm.space == B_CMAP8) { LOG(4, ("Acc: Not exporting hook %s.\n", msg)); return B_ERROR; Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/InitAccelerant.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/InitAccelerant.c 2008-06-10 13:27:42 UTC (rev 25906) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/InitAccelerant.c 2008-06-10 17:56:12 UTC (rev 25907) @@ -4,7 +4,7 @@ Other authors: Mark Watson, - Rudolf Cornelissen 10/2002-4/2006. + Rudolf Cornelissen 10/2002-6/2008. */ #define MODULE_BIT 0x00800000 @@ -40,8 +40,8 @@ // LOG is now available, si !NULL LOG(4,("init_common: logmask 0x%08x, memory %dMB, hardcursor %d, usebios %d, switchhead %d\n", si->settings.logmask, si->settings.memory, si->settings.hardcursor, si->settings.usebios, si->settings.switchhead)); - LOG(4,("init_common: dumprom %d, pgm_panel %d, dma_acc %d, tv_output %d, vga_on_tv %d\n", - si->settings.dumprom, si->settings.pgm_panel, si->settings.dma_acc, si->settings.tv_output, si->settings.vga_on_tv)); + LOG(4,("init_common: dumprom %d, pgm_panel %d, tv_output %d, vga_on_tv %d\n", + si->settings.dumprom, si->settings.pgm_panel, si->settings.tv_output, si->settings.vga_on_tv)); LOG(4,("init_common: force_sync %d, gpu_clk %dMhz, ram_clk %dMhz, force_ws %d\n", si->settings.force_sync, si->settings.gpu_clk, si->settings.ram_clk, si->settings.force_ws)); Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/SetDisplayMode.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/SetDisplayMode.c 2008-06-10 13:27:42 UTC (rev 25906) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/SetDisplayMode.c 2008-06-10 17:56:12 UTC (rev 25907) @@ -6,7 +6,7 @@ Other authors: Mark Watson, Apsed, - Rudolf Cornelissen 11/2002-10/2007 + Rudolf Cornelissen 11/2002-6/2008 */ #define MODULE_BIT 0x00200000 @@ -295,10 +295,7 @@ //no acc support for G8x yet! if (si->ps.card_arch < NV50A) { - if (!si->settings.dma_acc) - nv_acc_init(); - else - nv_acc_init_dma(); + nv_acc_init_dma(); } /* set up overlay unit for this mode */ // nv_bes_init(); Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/Jamfile =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/Jamfile 2008-06-10 13:27:42 UTC (rev 25906) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/Jamfile 2008-06-10 17:56:12 UTC (rev 25907) @@ -6,7 +6,6 @@ UsePrivateHeaders [ FDirName graphics nvidia_gpgpu ] ; StaticLibrary libnvidia_gpgpu_engine.a : - nv_acc.c nv_acc_dma.c nv_bes.c nv_brooktreetv.c Deleted: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_acc.c Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_proto.h =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_proto.h 2008-06-10 13:27:42 UTC (rev 25906) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_proto.h 2008-06-10 17:56:12 UTC (rev 25907) @@ -104,18 +104,6 @@ /* acceleration functions */ status_t check_acc_capability(uint32 feature); -status_t nv_acc_init(void); -void nv_acc_assert_fifo(void); -status_t nv_acc_setup_blit(void); -status_t nv_acc_blit(uint16,uint16,uint16, uint16,uint16,uint16 ); -status_t nv_acc_setup_rectangle(uint32 color); -status_t nv_acc_rectangle(uint32 xs,uint32 xe,uint32 ys,uint32 yl); -status_t nv_acc_setup_rect_invert(void); -status_t nv_acc_rectangle_invert(uint32 xs,uint32 xe,uint32 ys,uint32 yl); -status_t nv_acc_transparent_blit(uint16,uint16,uint16, uint16,uint16,uint16, uint32); -status_t nv_acc_video_blit(uint16 xs,uint16 ys,uint16 ws, uint16 hs, - uint16 xd,uint16 yd,uint16 wd,uint16 hd); -status_t nv_acc_wait_idle(void); /* DMA versions */ status_t nv_acc_wait_idle_dma(void); status_t nv_acc_init_dma(void); Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/driver.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/driver.c 2008-06-10 13:27:42 UTC (rev 25906) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/driver.c 2008-06-10 17:56:12 UTC (rev 25907) @@ -129,7 +129,6 @@ true, // hardcursor false, // switchhead true, // pgm_panel - true, // dma_acc false, // vga_on_tv false, // force_sync false, // force_ws @@ -1146,8 +1145,6 @@ "switchhead", false, false); sSettings.pgm_panel = get_driver_boolean_parameter(settings, "pgm_panel", false, false); - sSettings.dma_acc = get_driver_boolean_parameter(settings, - "dma_acc", false, false); sSettings.vga_on_tv = get_driver_boolean_parameter(settings, "vga_on_tv", false, false); sSettings.force_sync = get_driver_boolean_parameter(settings, Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/nvidia_gpgpu.settings =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/nvidia_gpgpu.settings 2008-06-10 13:27:42 UTC (rev 25906) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/nvidia_gpgpu.settings 2008-06-10 17:56:12 UTC (rev 25907) @@ -17,7 +17,6 @@ #logmask 0x08000604 # log overlay use in full to file (in home folder) #logmask 0xffffffff # log everything to file (in home folder) switchhead false # switch head assignment (dualhead cards only) -dma_acc true # if true enable DMA cmd fetching for 2D acc (instead of using PIO) #tv_output 0 # disabled or 0 = autodetect, 1 = Y/C (and CVBS if possible), 2 = CVBS force_sync false # if true forces 3D rendering to be synchronized to the vertical retrace force_ws false # if true forces widescreen type detection for all connected screens From rudolfc at mail.berlios.de Tue Jun 10 19:56:55 2008 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Tue, 10 Jun 2008 19:56:55 +0200 Subject: [Haiku-commits] r25908 - haiku/trunk/headers/private/graphics/nvidia_gpgpu Message-ID: <200806101756.m5AHutfg017496@sheep.berlios.de> Author: rudolfc Date: 2008-06-10 19:56:54 +0200 (Tue, 10 Jun 2008) New Revision: 25908 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25908&view=rev Modified: haiku/trunk/headers/private/graphics/nvidia_gpgpu/DriverInterface.h haiku/trunk/headers/private/graphics/nvidia_gpgpu/nv_acc.h Log: removed PIO mode acceleration completely. Modified: haiku/trunk/headers/private/graphics/nvidia_gpgpu/DriverInterface.h =================================================================== --- haiku/trunk/headers/private/graphics/nvidia_gpgpu/DriverInterface.h 2008-06-10 17:56:12 UTC (rev 25907) +++ haiku/trunk/headers/private/graphics/nvidia_gpgpu/DriverInterface.h 2008-06-10 17:56:54 UTC (rev 25908) @@ -5,7 +5,7 @@ Other authors: Mark Watson; Apsed; - Rudolf Cornelissen 10/2002-9/2007. + Rudolf Cornelissen 10/2002-6/2008. */ #ifndef DRIVERINTERFACE_H @@ -219,7 +219,6 @@ bool hardcursor; bool switchhead; bool pgm_panel; - bool dma_acc; bool vga_on_tv; bool force_sync; bool force_ws; Modified: haiku/trunk/headers/private/graphics/nvidia_gpgpu/nv_acc.h =================================================================== --- haiku/trunk/headers/private/graphics/nvidia_gpgpu/nv_acc.h 2008-06-10 17:56:12 UTC (rev 25907) +++ haiku/trunk/headers/private/graphics/nvidia_gpgpu/nv_acc.h 2008-06-10 17:56:54 UTC (rev 25908) @@ -1,272 +1,12 @@ /* definitions for used nVidia acceleration engine commands. - Written by Rudolf Cornelissen 12/2004-12/2005 + Written by Rudolf Cornelissen 12/2004-6/2008 */ #ifndef NV_ACC_H #define NV_ACC_H -typedef struct { - uint32 reserved00[0x0004]; - uint16 FifoFree; /* little endian (FIFO internal register) */ - uint16 Nop; /* little endian (FIFO internal register) */ - uint32 reserved01[0x000b]; - uint32 DMAPut; /* b2-28 is DMA Put offset (FIFO internal register) */ - uint32 DMAGet; /* b2-28 is DMA Get offset (FIFO internal register) */ - uint32 reserved02[0x00ae]; - uint32 SetRop5; /* b0-7 is ROP5 */ -} cmd_nv_rop5_solid; - -typedef struct { - uint32 reserved00[0x0004]; - uint16 FifoFree; /* little endian (FIFO internal register) */ - uint16 Nop; /* little endian (FIFO internal register) */ - uint32 reserved01[0x000b]; - uint32 DMAPut; /* b2-28 is DMA Put offset (FIFO internal register) */ - uint32 DMAGet; /* b2-28 is DMA Get offset (FIFO internal register) */ - uint32 reserved02[0x00ae]; - uint32 TopLeft; /* b0-15 is left, b16-31 is top */ - uint32 HeightWidth; /* b0-15 is width, b16-31 is height */ -} cmd_nv_image_black_rectangle; - -typedef struct { - uint32 reserved00[0x0004]; - uint16 FifoFree; /* little endian (FIFO internal register) */ - uint16 Nop; /* little endian (FIFO internal register) */ - uint32 reserved01[0x000b]; - uint32 DMAPut; /* b2-28 is DMA Put offset (FIFO internal register) */ - uint32 DMAGet; /* b2-28 is DMA Get offset (FIFO internal register) */ - uint32 reserved02[0x00ae]; - uint32 SetColorFormat; /* colorspace */ - uint32 reserved03[0x0001]; - uint32 SetShape; /* b0-1: %00 = 8X_8Y; %01 = 64X_1Y; %10 = 1X_64Y */ - uint32 reserved04[0x0001]; - uint32 SetColor0; /* b0-31 is color */ - uint32 SetColor1; /* b0-31 is color */ - uint32 SetPattern[0x0002]; /* b0-31 is bitmap */ -} cmd_nv_image_pattern; - -typedef struct { - uint32 reserved00[0x0004]; - uint16 FifoFree; /* little endian (FIFO internal register) */ - uint16 Nop; /* little endian (FIFO internal register) */ - uint32 reserved01[0x000b]; - uint32 DMAPut; /* b2-28 is DMA Put offset (FIFO internal register) */ - uint32 DMAGet; /* b2-28 is DMA Get offset (FIFO internal register) */ - uint32 reserved02[0x00ae]; - uint32 SourceOrg; /* b0-15 is X, b16-31 is Y */ - uint32 DestOrg; /* b0-15 is X, b16-31 is Y */ - uint32 HeightWidth; /* b0-15 is width, b16-31 is height */ -} cmd_nv_image_blit; - -//fixme: using nv4_gdi_rectangle_text for DMA acc. Differs slightly from this one! -//WARNING: nv4_gdi_rectangle_text can only do 32 unclipped rects at once! -typedef struct { - uint32 reserved00[0x0004]; - uint16 FifoFree; /* little endian (FIFO internal register) */ - uint16 Nop; /* little endian (FIFO internal register) */ - uint32 reserved01[0x000b]; - uint32 DMAPut; /* b2-28 is DMA Put offset (FIFO internal register) */ - uint32 DMAGet; /* b2-28 is DMA Get offset (FIFO internal register) */ - uint32 reserved02[0x00ae]; - uint32 SetColorFormat; /* colorspace */ - uint32 reserved03[0x003e]; - uint32 Color1A; /* b0-31 is color */ - struct { - uint32 LeftTop; /* b0-15 is top, b16-31 is left */ - uint32 WidthHeight; /* b0-15 is height, b16-31 is width */ - } UnclippedRectangle[0x40]; /* command can handle upto 64 unclipped rects */ -/* fixme: XFree also defines the registers below: - * (used for the 2D 'ScanlineCPUToScreenColorExpandFill' and 'ColorExpandScanline' - * functions.) - * We don't use this currently. */ -/* - U032 reserved04[(0x080)-3]; - struct - { - U032 TopLeft; - U032 BottomRight; - } ClipB; - U032 Color1B; - struct - { - U032 TopLeft; - U032 BottomRight; - } ClippedRectangle[64]; - U032 reserved05[(0x080)-5]; - struct - { - U032 TopLeft; - U032 BottomRight; - } ClipC; - U032 Color1C; - U032 WidthHeightC; - U032 PointC; - U032 MonochromeData1C; - U032 reserved06[(0x080)+121]; - struct - { - U032 TopLeft; - U032 BottomRight; - } ClipD; - U032 Color1D; - U032 WidthHeightInD; - U032 WidthHeightOutD; - U032 PointD; - U032 MonochromeData1D; - U032 reserved07[(0x080)+120]; - struct - { - U032 TopLeft; - U032 BottomRight; - } ClipE; - U032 Color0E; - U032 Color1E; - U032 WidthHeightInE; - U032 WidthHeightOutE; - U032 PointE; - U032 MonochromeData01E; -*/ -} cmd_nv3_gdi_rectangle_text; - -/* This command could (at least) potentially speed-up our fill_span command... :-) */ -//fixme: test this 2D command! -typedef struct { - uint32 reserved00[0x0004]; - uint16 FifoFree; /* little endian (FIFO internal register) */ - uint16 Nop; /* little endian (FIFO internal register) */ - uint32 reserved01[0x000b]; - uint32 DMAPut; /* b2-28 is DMA Put offset (FIFO internal register) */ - uint32 DMAGet; /* b2-28 is DMA Get offset (FIFO internal register) */ - uint32 reserved02[0x00af]; - uint32 Color; /* b0-31 is color */ - uint32 reserved03[0x003e]; - struct { - uint32 Point0; /* b0-15 is X, b16-31 is Y: starting coordinate */ - uint32 Point1; /* b0-15 is X, b16-31 is Y: ending coordinate */ - } Line[0x10]; /* command can handle upto 16 lines */ - struct { - uint32 Point0X; /* b0-31 is X: starting coordinate */ - uint32 Point0Y; /* b0-31 is Y: starting coordinate */ - uint32 Point1X; /* b0-31 is X: ending coordinate */ - uint32 Point1Y; /* b0-31 is Y: ending coordinate */ - } Line32[0x08]; /* cmd can handle upto 8 lines with 32-bit coordinates */ - struct { - uint32 Point; /* b0-15 is X, b16-31 is Y */ - } Polyline[0x20]; /* cmd can handle upto 32 points polylines */ - struct { - uint32 PointX; /* b0-31 is X */ - uint32 PointY; /* b0-31 is Y */ - } Polyline32[0x10]; /* cmd can handle upto 16 point polylines with 32-bit coord's */ - struct { - uint32 Color; /* b0-31 is color */ - uint32 Point; /* b0-15 is X, b16-31 is Y */ - } ColorPolyline[0x10]; /* cmd can handle upto 16 point polylines with individually - * colored sections */ -} cmd_nv1_render_solid_lin; - -/* Someone defined this in XFree once (as 'RivaRectangle') but never used it: - * a handle should also be defined in the engine's init code, which was never done AFAIK. - * The command could be very interesting for us, as it could potentially speed-up our - * rectangle_fills :-) */ -//fixme: test this 2D command! -typedef struct { - uint32 reserved00[0x0004]; - uint16 FifoFree; /* little endian (FIFO internal register) */ - uint16 Nop; /* little endian (FIFO internal register) */ - uint32 reserved01[0x000b]; - uint32 DMAPut; /* b2-28 is DMA Put offset (FIFO internal register) */ - uint32 DMAGet; /* b2-28 is DMA Get offset (FIFO internal register) */ - uint32 reserved02[0x00af]; - uint32 Color; /* b0-31 is color */ - uint32 reserved03[0x003e]; - struct { - uint32 TopLeft; /* b0-15 is left, b16-31 is top */ - uint32 HeightWidth; /* b0-15 is width, b16-31 is height */ - } Rectangle[0x10]; /* command can handle upto 16 rectangles */ -} cmd_nv_render_solid_rectangle;/* nv1_render_solid_rectangle is identical */ - -//fixme: (setup in progress for DMA) complete or remove (this cmd is not used currently) -typedef struct { -} cmd_nv1_image_from_cpu; /* 'pixmap': used in XFree 4.2.0, but not beyond. - * (Used for the 2D 'ImageWriteScanline' and - * 'ScanlineImageWriteRect' functions.) - * Is this command actually usefull? */ - -typedef struct { - uint32 reserved00[0x0004]; - uint16 FifoFree; /* little endian (FIFO internal register) */ - uint16 Nop; /* little endian (FIFO internal register) */ - uint32 reserved01[0x000b]; - uint32 DMAPut; /* b2-28 is DMA Put offset (FIFO internal register) */ - uint32 DMAGet; /* b2-28 is DMA Get offset (FIFO internal register) */ - uint32 reserved02[0x00ae]; - uint32 Format; /* buffer colorspace */ - uint32 Pitch; /* b0-15 is source pitch, b16-31 is dest pitch */ - uint32 OffsetSource; /* b0-31 is source bufferadress offset */ - uint32 OffsetDest; /* b0-31 is dest bufferadress offset */ -} cmd_nv4_surface; /* nv10_context_surfaces_2d is identical as far as used */ - -/************************ - * 3D specific commands * - ************************/ - -typedef struct { - uint32 reserved00[0x0004]; - uint16 FifoFree; /* little endian (FIFO internal register) */ - uint16 Nop; /* little endian (FIFO internal register) */ - uint32 reserved01[0x000b]; - uint32 DMAPut; /* b2-28 is DMA Put offset (FIFO internal register) */ - uint32 DMAGet; /* b2-28 is DMA Get offset (FIFO internal register) */ - uint32 reserved02[0x00ae]; - uint32 Colorkey; /* texture colorkey */ - uint32 Offset; /* texture offset */ - uint32 Format; /* texture colorspace, size, and a lot more */ - uint32 Filter; /* texture filtering modes (used for scaling) */ - uint32 Blend; /* triangle blend: shade, perspective, specular.. */ - uint32 Control; /* triangle control: Z-enable, culling, dither.. */ - uint32 FogColor; /* fog colorvalue */ - uint32 reserved03[0x0039]; - struct { - float ScreenX; /* X */ - float ScreenY; /* Y */ - float ScreenZ; /* depth */ - float RWH; /* eyeM */ - uint32 Color; /* b24-31 Alpha, b16-23 Red, b8-15 Green, b0-7 Blue */ - uint32 Specular; /* b24-31 Fog, b16-23 Red, b8-15 Green, b0-7 Blue */ - float TU; /* texture S */ - float TV; /* texture T */ - } TLVertex[0x10]; /* command can handle upto 16 textured, lit(?) vertexes */ - uint32 TLVDrawPrim[0x40]; /* b20-31 is I5, b16-19 is I4, b12-15 is I3, - * b8-11 is I2, 4-7 is I1, b0-3 is I0: - * Ix is a TLVertex[Ix]. - * So: define your (single) texture, define your - * vertexes, and then program TLVDrawPrim with the - * order to draw them. - * You can draw primitives consisting of sets of upto - * 6 out of 16 defined vertexes this way; and you can - * draw 64 sets maximum. */ -} cmd_nv4_dx5_texture_triangle; /* nv10_dx5_texture_triangle is identical */ - -typedef struct { - uint32 reserved00[0x0004]; - uint16 FifoFree; /* little endian (FIFO internal register) */ - uint16 Nop; /* little endian (FIFO internal register) */ - uint32 reserved01[0x000b]; - uint32 DMAPut; /* b2-28 is DMA Put offset (FIFO internal register) */ - uint32 DMAGet; /* b2-28 is DMA Get offset (FIFO internal register) */ - uint32 reserved02[0x00b0]; /* fixme? there's more here that's not used apparantly */ - uint32 Pitch; /* b16-31 is Z-buffer, b0-15 is colorbuffer pitch */ - uint32 SetOffsetColor; /* b0-31 is colorbuffer (renderbuffer) offset */ - uint32 SetOffsetZeta; /* b0-31 is Z-buffer (zeta buffer) offset */ -} cmd_nv4_context_surfaces_argb_zs; /* nv10_context_surfaces_argb_zs is identical */ - -//fixme: fill this out... -typedef struct { -} cmd_nv4_dx6_multi_texture_triangle;/* nv10_dx6_multi_texture_triangle is identical? */ - - /************ DMA command defines ***********/ /* FIFO channels */ From julun at mail.berlios.de Tue Jun 10 20:42:47 2008 From: julun at mail.berlios.de (julun at BerliOS) Date: Tue, 10 Jun 2008 20:42:47 +0200 Subject: [Haiku-commits] r25909 - haiku/trunk/src/kits/interface Message-ID: <200806101842.m5AIglwm021541@sheep.berlios.de> Author: julun Date: 2008-06-10 20:42:47 +0200 (Tue, 10 Jun 2008) New Revision: 25909 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25909&view=rev Modified: haiku/trunk/src/kits/interface/PrintJob.cpp Log: * fill the view with it's high color, BPrintJob behaves now like on R5 fixes printing from e.g Scooby (missing header color) finally found the missing peace here: http://www.freelists.org/archives/haiku-development/06-2008/msg00086.html thanks Stephan :) Modified: haiku/trunk/src/kits/interface/PrintJob.cpp =================================================================== --- haiku/trunk/src/kits/interface/PrintJob.cpp 2008-06-10 17:56:54 UTC (rev 25908) +++ haiku/trunk/src/kits/interface/PrintJob.cpp 2008-06-10 18:42:47 UTC (rev 25909) @@ -665,6 +665,14 @@ view->PushState(); view->SetOrigin(origin); view->ConstrainClippingRegion(®ion); + + if (view->ViewColor() != B_TRANSPARENT_COLOR) { + rgb_color highColor = view->HighColor(); + view->SetHighColor(view->ViewColor()); + view->FillRect(rect); + view->SetHighColor(highColor); + } + view->Draw(rect); view->PopState(); view->fIsPrinting = false; From julun at mail.berlios.de Tue Jun 10 20:47:07 2008 From: julun at mail.berlios.de (julun at BerliOS) Date: Tue, 10 Jun 2008 20:47:07 +0200 Subject: [Haiku-commits] r25910 - haiku/trunk/src/servers/print Message-ID: <200806101847.m5AIl70s021829@sheep.berlios.de> Author: julun Date: 2008-06-10 20:47:07 +0200 (Tue, 10 Jun 2008) New Revision: 25910 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25910&view=rev Modified: haiku/trunk/src/servers/print/PrintServerApp.R5.cpp Log: * in case we do not show the config window, still distinguish between config page and config job Modified: haiku/trunk/src/servers/print/PrintServerApp.R5.cpp =================================================================== --- haiku/trunk/src/servers/print/PrintServerApp.R5.cpp 2008-06-10 18:42:47 UTC (rev 25909) +++ haiku/trunk/src/servers/print/PrintServerApp.R5.cpp 2008-06-10 18:47:07 UTC (rev 25910) @@ -64,7 +64,13 @@ w->Go(); } else { BMessage reply(*msg); - if (printer->ConfigurePage(reply) == B_OK) + status_t status = B_ERROR; + if (msg->what == PSRV_SHOW_PAGE_SETUP) + status = printer->ConfigurePage(reply); + else + status = printer->ConfigureJob(reply); + + if (status == B_OK) sender.SetReply(&reply); } } else { From bonefish at mail.berlios.de Tue Jun 10 23:34:51 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 10 Jun 2008 23:34:51 +0200 Subject: [Haiku-commits] r25911 - haiku/trunk/src/apps/terminal Message-ID: <200806102134.m5ALYpTx004355@sheep.berlios.de> Author: bonefish Date: 2008-06-10 23:34:50 +0200 (Tue, 10 Jun 2008) New Revision: 25911 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25911&view=rev Modified: haiku/trunk/src/apps/terminal/TermParse.cpp haiku/trunk/src/apps/terminal/TermParse.h Log: * Renamed GetReaderBuf() to _NextParseChar(). * Introduced a small (64 byte) buffer for the parser thread. Instead of directly reading single characters out of the reader buffer, we read a full parser buffer and process the characters from the parser buffer. Thus _NextParseChar() could be inlined, since it merely consists of a conditional method call and an access to the parser buffer, now. * Improved the locking of the terminal buffer. Instead of unlocking and relocking after every multi-byte char or escape sequence, we only unlock while refilling the parser buffer. Modified: haiku/trunk/src/apps/terminal/TermParse.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-10 18:47:07 UTC (rev 25910) +++ haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-10 21:34:50 UTC (rev 25911) @@ -49,6 +49,23 @@ #define NPARAM 10 // Max parameters +//! Get char from pty reader buffer. +inline status_t +TermParse::_NextParseChar(uchar &c) +{ + if (fParserBufferOffset >= fParserBufferSize) { + // parser buffer empty + status_t error = _ReadParserBuffer(); + if (error != B_OK) + return error; + } + + c = fParserBuffer[fParserBufferOffset++]; + + return B_OK; +} + + TermParse::TermParse(int fd) : fFd(fd), @@ -58,6 +75,8 @@ fReaderLocker(-1), fBufferPosition(0), fReadBufferSize(0), + fParserBufferSize(0), + fParserBufferOffset(0), fParserWaiting(false), fBuffer(NULL), fQuitting(true) @@ -114,45 +133,6 @@ } -//! Get char from pty reader buffer. -status_t -TermParse::GetReaderBuf(uchar &c) -{ - // wait for new input from pty - if (fReadBufferSize == 0) { - fBuffer->Unlock(); - - fParserWaiting = true; - - status_t status = B_OK; - while (fReadBufferSize == 0 && status == B_OK) { - do { - status = acquire_sem(fReaderSem); - } while (status == B_INTERRUPTED); - } - - fParserWaiting = false; - - fBuffer->Lock(); - - if (status < B_OK) - return status; - } - - c = fReadBuffer[fBufferPosition]; - fBufferPosition = (fBufferPosition + 1) % READ_BUF_SIZE; - - int32 bufferSize = atomic_add(&fReadBufferSize, -1) - 1; - - // If the pty reader thread waits and we have made enough space in the - // buffer now, let it run again. - if (READ_BUF_SIZE - bufferSize == MIN_PTY_BUFFER_SPACE) - release_sem(fReaderLocker); - - return B_OK; -} - - //! Initialize and spawn EscParse thread. status_t TermParse::InitTermParse() @@ -346,12 +326,11 @@ int *groundtable = gUTF8GroundTable; int *parsestate = groundtable; + BAutolock locker(fBuffer); + while (!fQuitting) { -// TODO: Fix the locking! - BAutolock locker(fBuffer); - uchar c; - if (GetReaderBuf(c) < B_OK) + if (_NextParseChar(c) < B_OK) break; //DumpState(groundtable, parsestate, c); @@ -412,7 +391,7 @@ case CASE_SS3: /* JIS X 0212 */ *ptr++ = curess; *ptr++ = c; - GetReaderBuf(c); + _NextParseChar(c); *ptr++ = c; *ptr = 0; curess = 0; @@ -420,7 +399,7 @@ default: /* JIS X 0208 */ *ptr++ = c; - GetReaderBuf(c); + _NextParseChar(c); *ptr++ = c; *ptr = 0; break; @@ -443,7 +422,7 @@ case CASE_PRINT_CS96: cbuf[0] = c | 0x80; - GetReaderBuf(c); + _NextParseChar(c); cbuf[1] = c | 0x80; cbuf[2] = 0; CodeConv::ConvertToInternal(cbuf, 2, dstbuf, B_EUC_CONVERSION); @@ -467,7 +446,7 @@ case CASE_SJIS_INSTRING: cbuf[0] = c; - GetReaderBuf(c); + _NextParseChar(c); cbuf[1] = c; cbuf[2] = '\0'; CodeConv::ConvertToInternal(cbuf, 2, dstbuf, now_coding); @@ -476,7 +455,7 @@ case CASE_UTF8_2BYTE: cbuf[0] = c; - GetReaderBuf(c); + _NextParseChar(c); if (groundtable[c] != CASE_UTF8_INSTRING) break; cbuf[1] = c; @@ -487,12 +466,12 @@ case CASE_UTF8_3BYTE: cbuf[0] = c; - GetReaderBuf(c); + _NextParseChar(c); if (groundtable[c] != CASE_UTF8_INSTRING) break; cbuf[1] = c; - GetReaderBuf(c); + _NextParseChar(c); if (groundtable[c] != CASE_UTF8_INSTRING) break; cbuf[2] = c; @@ -515,7 +494,7 @@ { cs96 = 0; uchar dummy; - GetReaderBuf(dummy); + _NextParseChar(dummy); parsestate = groundtable; break; } @@ -881,7 +860,7 @@ char string[512]; uint32 len = 0; uchar mode_char; - GetReaderBuf(mode_char); + _NextParseChar(mode_char); if (mode_char != '0' && mode_char != '1' && mode_char != '2') { @@ -889,8 +868,8 @@ break; } uchar current_char; - GetReaderBuf(current_char); - while (GetReaderBuf(current_char) == B_OK + _NextParseChar(current_char); + while (_NextParseChar(current_char) == B_OK && current_char != 0x7) { if (!isprint(current_char & 0x7f) || len+2 >= sizeof(string)) @@ -988,6 +967,59 @@ } +status_t +TermParse::_ReadParserBuffer() +{ + // We have to unlock the terminal buffer while waiting for data from the + // PTY. We don't have to unlock when we don't need to wait, but we do it + // anyway, so that TermView won't be starved when trying to synchronize. + fBuffer->Unlock(); + + // wait for new input from pty + if (fReadBufferSize == 0) { + fParserWaiting = true; + + status_t status = B_OK; + while (fReadBufferSize == 0 && status == B_OK) { + do { + status = acquire_sem(fReaderSem); + } while (status == B_INTERRUPTED); + } + + fParserWaiting = false; + + if (status < B_OK) { + fBuffer->Lock(); + return status; + } + } + + int32 toRead = fReadBufferSize; + if (toRead > ESC_PARSER_BUFFER_SIZE) + toRead = ESC_PARSER_BUFFER_SIZE; + + for (int32 i = 0; i < toRead; i++) { + fParserBuffer[i] = fReadBuffer[fBufferPosition]; + fBufferPosition = (fBufferPosition + 1) % READ_BUF_SIZE; + } + + int32 bufferSize = atomic_add(&fReadBufferSize, -toRead); + + // If the pty reader thread waits and we have made enough space in the + // buffer now, let it run again. + if (bufferSize > READ_BUF_SIZE - MIN_PTY_BUFFER_SPACE + && bufferSize - toRead <= READ_BUF_SIZE - MIN_PTY_BUFFER_SPACE) { + release_sem(fReaderLocker); + } + + fParserBufferSize = toRead; + fParserBufferOffset = 0; + + fBuffer->Lock(); + return B_OK; +} + + void TermParse::_DeviceStatusReport(int n) { Modified: haiku/trunk/src/apps/terminal/TermParse.h =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.h 2008-06-10 18:47:07 UTC (rev 25910) +++ haiku/trunk/src/apps/terminal/TermParse.h 2008-06-10 21:34:50 UTC (rev 25911) @@ -41,6 +41,8 @@ // pty read buffer size #define MIN_PTY_BUFFER_SPACE 16 // minimal space left before the reader tries to read more +#define ESC_PARSER_BUFFER_SIZE 64 + // size of the parser buffer class TerminalBuffer; @@ -54,6 +56,8 @@ status_t StopThreads(); private: + inline status_t _NextParseChar(uchar &c); + // Initialize TermParse and PtyReader thread. status_t InitTermParse(); status_t InitPtyReader(); @@ -69,8 +73,7 @@ static int32 _ptyreader_thread(void *); static int32 _escparse_thread(void *); - // Reading ReadBuf at one Char. - status_t GetReaderBuf(uchar &c); + status_t _ReadParserBuffer(); void _DeviceStatusReport(int n); @@ -84,6 +87,10 @@ uint fBufferPosition; uchar fReadBuffer[READ_BUF_SIZE]; vint32 fReadBufferSize; + + uchar fParserBuffer[ESC_PARSER_BUFFER_SIZE]; + int32 fParserBufferSize; + int32 fParserBufferOffset; volatile bool fParserWaiting; int fLockFlag; From bonefish at mail.berlios.de Tue Jun 10 23:43:42 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 10 Jun 2008 23:43:42 +0200 Subject: [Haiku-commits] r25912 - haiku/trunk/src/apps/terminal Message-ID: <200806102143.m5ALhghf005493@sheep.berlios.de> Author: bonefish Date: 2008-06-10 23:43:42 +0200 (Tue, 10 Jun 2008) New Revision: 25912 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25912&view=rev Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h Log: * Added a SetHistoryCapacity() method. * Added a ResizeTo() version that allows to set the history capacity at the same time. * Added a SynchronizeWith() method that allows synchronizing with (a part of) another buffer. * Fixed TODO in _Scroll(). * Improved the dirty region update code in _Scroll(). It would in certain (not exactly uncommon) situations needlessly invalidate the whole screen. Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-10 21:34:50 UTC (rev 25911) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-10 21:43:42 UTC (rev 25912) @@ -57,11 +57,8 @@ inline void BasicTerminalBuffer::_Invalidate(int32 top, int32 bottom) { -//debug_printf("BasicTerminalBuffer::_Invalidate(%ld, %ld)\n", top, bottom); - if (top < fDirtyInfo.dirtyTop) - fDirtyInfo.dirtyTop = top; - if (bottom > fDirtyInfo.dirtyBottom) - fDirtyInfo.dirtyBottom = bottom; +//debug_printf("%p->BasicTerminalBuffer::_Invalidate(%ld, %ld)\n", this, top, bottom); + fDirtyInfo.ExtendDirtyRegion(top, bottom); if (!fDirtyInfo.messageSent) { NotifyListener(); @@ -131,18 +128,26 @@ status_t BasicTerminalBuffer::ResizeTo(int32 width, int32 height) { + return ResizeTo(width, height, fHistoryCapacity); +} + + +status_t +BasicTerminalBuffer::ResizeTo(int32 width, int32 height, int32 historyCapacity) +{ if (height < MIN_ROWS || height > MAX_ROWS || width < MIN_COLS - || width > MAX_COLS) { + || width > MAX_COLS || height > historyCapacity) { return B_BAD_VALUE; } -//debug_printf("BasicTerminalBuffer::ResizeTo(): (%ld, %ld) -> (%ld, %ld)\n", -//fWidth, fHeight, width, height); +//debug_printf("BasicTerminalBuffer::ResizeTo(): (%ld, %ld, history: %ld) -> " +//"(%ld, %ld, history: %ld)\n", fWidth, fHeight, fHistoryCapacity, width, height, +//historyCapacity); if (width != fWidth) { // The width changes. We have to allocate a new line array and re-wrap // all lines. - Line** history = _AllocateLines(width, fHistoryCapacity); + Line** history = _AllocateLines(width, historyCapacity); if (history == NULL) return B_NO_MEMORY; @@ -181,34 +186,35 @@ } int32 toCopy = min_c(sourceLeft, destLeft); - if (toCopy > 0) { - // If the last cell to copy is the first cell of a - // full-width char, don't copy it yet. - if (sourceX + toCopy > 0 && IS_WIDTH( - sourceLine->cells[sourceX + toCopy - 1].attributes)) { + // If the last cell to copy is the first cell of a + // full-width char, don't copy it yet. + if (toCopy > 0 && IS_WIDTH( + sourceLine->cells[sourceX + toCopy - 1].attributes)) { //debug_printf(" -> last char is full-width -- don't copy it\n"); - toCopy--; - } + toCopy--; + } - // translate the cursor position - if (fCursor.y + fHistorySize == sourceIndex - && fCursor.x >= sourceX - && (fCursor.x < sourceX + toCopy - || sourceX + sourceLeft <= fCursor.x)) { - cursor.x = destLine->length + fCursor.x - sourceX; - cursor.y = destTotalLines; + // translate the cursor position + if (fCursor.y + fHistorySize == sourceIndex + && fCursor.x >= sourceX + && (fCursor.x < sourceX + toCopy + || destLeft >= sourceLeft + && sourceX + sourceLeft <= fCursor.x)) { + cursor.x = destLine->length + fCursor.x - sourceX; + cursor.y = destTotalLines; - if (cursor.x >= width) { - // The cursor was in free space after the official end - // of line. - cursor.x = width - 1; - } + if (cursor.x >= width) { + // The cursor was in free space after the official end + // of line. + cursor.x = width - 1; + } //debug_printf(" cursor: (%ld, %ld)\n", cursor.x, cursor.y); - // don't allow the cursor to get out of screen - maxDestTotalLines = cursor.y + fHeight; - } + // don't allow the cursor to get out of screen + maxDestTotalLines = cursor.y + height - 1; + } + if (toCopy > 0) { memcpy(destLine->cells + destLine->length, sourceLine->cells + sourceX, toCopy * sizeof(Cell)); destLine->length += toCopy; @@ -227,10 +233,10 @@ } if (nextDestLine) { - destIndex = (destIndex + 1) % fHistoryCapacity; + destIndex = (destIndex + 1) % historyCapacity; destTotalLines++; newDestLine = true; - if (destTotalLines == maxDestTotalLines) + if (destTotalLines >= maxDestTotalLines) break; } } @@ -238,7 +244,7 @@ // If the last source line had a soft break, the last dest line // won't have been counted yet. if (!newDestLine) { - destIndex = (destIndex + 1) % fHistoryCapacity; + destIndex = (destIndex + 1) % historyCapacity; destTotalLines++; } @@ -248,8 +254,8 @@ cursor.y -= destScreenOffset; // Re-wrapping might have produced more lines than we have room for. - if (destTotalLines > fHistoryCapacity) - destTotalLines = fHistoryCapacity; + if (destTotalLines > historyCapacity) + destTotalLines = historyCapacity; // Update the values //debug_printf(" cursor: (%ld, %ld) -> (%ld, %ld)\n", fCursor.x, fCursor.y, @@ -258,7 +264,7 @@ fCursor.y = cursor.y; //debug_printf(" screen offset: %ld -> %ld\n", fScreenOffset, //destScreenOffset % fHistoryCapacity); - fScreenOffset = destScreenOffset % fHistoryCapacity; + fScreenOffset = destScreenOffset % historyCapacity; //debug_printf(" history size: %ld -> %ld\n", fHistorySize, destTotalLines - fHeight); fHistorySize = destTotalLines - tempHeight; //debug_printf(" height %ld -> %ld\n", fHeight, tempHeight); @@ -267,8 +273,12 @@ _FreeLines(fHistory, fHistoryCapacity); fHistory = history; + fHistoryCapacity = historyCapacity; } + if (historyCapacity > fHistoryCapacity) + SetHistoryCapacity(historyCapacity); + if (height == fHeight) return B_OK; @@ -304,10 +314,59 @@ fScrollTop = 0; fScrollBottom = fHeight - 1; + if (historyCapacity < fHistoryCapacity) + SetHistoryCapacity(historyCapacity); + return B_OK; } +status_t +BasicTerminalBuffer::SetHistoryCapacity(int32 historyCapacity) +{ + if (historyCapacity < fHeight) + return B_BAD_VALUE; + + if (fHistoryCapacity == historyCapacity) + return B_OK; + + // The history capacity changes. + Line** history = _AllocateLines(fWidth, historyCapacity); + if (history == NULL) + return B_NO_MEMORY; + + int32 totalLines = fHistorySize + fHeight; + int32 historyOffset = fHistoryCapacity - fHistorySize; + // base for _LineAt() invocations to iterate through the history + + if (totalLines > historyCapacity) { + // Our new history capacity is smaller than currently stored line, + // so we have to drop lines. + historyOffset += totalLines - historyCapacity; + totalLines = historyCapacity; + } + + for (int32 i = 0; i < totalLines; i++) { + Line* sourceLine = _LineAt(historyOffset + i); + Line* destLine = history[i]; + destLine->length = sourceLine->length; + destLine->softBreak = sourceLine->softBreak; + if (destLine->length > 0) { + memcpy(destLine->cells, sourceLine->cells, + destLine->length * sizeof(Cell)); + } + } + + _FreeLines(fHistory, fHistoryCapacity); + fHistory = history; + fHistoryCapacity = historyCapacity; + fHistorySize = totalLines - fHeight; + fScreenOffset = fHistorySize; + + return B_OK; +} + + void BasicTerminalBuffer::Clear() { @@ -323,6 +382,45 @@ } +void +BasicTerminalBuffer::SynchronizeWith(const BasicTerminalBuffer* other, + int32 offset, int32 dirtyTop, int32 dirtyBottom) +{ +//debug_printf("BasicTerminalBuffer::SynchronizeWith(%p, %ld, %ld - %ld)\n", +//other, offset, dirtyTop, dirtyBottom); + + // intersect the visible region with the dirty region + int32 first = 0; + int32 last = fHeight - 1; + dirtyTop -= offset; + dirtyBottom -= offset; + + if (first > dirtyBottom || dirtyTop > last) + return; + + if (first < dirtyTop) + first = dirtyTop; + if (last > dirtyBottom) + last = dirtyBottom; + + // update the dirty lines +//debug_printf(" updating: %ld - %ld\n", first, last); + for (int32 i = first; i <= last; i++) { + Line* sourceLine = other->_HistoryLineAt(i + offset); + Line* destLine = _LineAt(i); + if (sourceLine != NULL) { + destLine->length = sourceLine->length; + destLine->softBreak = sourceLine->softBreak; + if (destLine->length > 0) { + memcpy(destLine->cells, sourceLine->cells, + destLine->length * sizeof(Cell)); + } + } else + destLine->Clear(); + } +} + + bool BasicTerminalBuffer::IsFullWidthChar(int32 row, int32 column) const { @@ -359,7 +457,7 @@ { Line* line = _HistoryLineAt(row); if (line == NULL) - return NO_CHAR; + return 0; if (lastColumn >= line->length) lastColumn = line->length - 1; @@ -861,22 +959,21 @@ return; if (numLines > 0) { - if (numLines > fHistoryCapacity - fHeight) { - numLines = fHistoryCapacity - fHeight; - // TODO: This is not quite correct -- we should replace the complete - // history and screen with empty lines. - } - // scroll text up if (top == 0) { // The lines scrolled out of the screen range are transferred to // the history. + if (numLines > fHistoryCapacity) + numLines = fHistoryCapacity; + // make room for numLines new lines if (fHistorySize + fHeight + numLines > fHistoryCapacity) { int32 toDrop = fHistorySize + fHeight + numLines - fHistoryCapacity; fHistorySize -= toDrop; + // Note that fHistorySize can temporarily become negative, + // but all will be well again, when we offset the screen. } // clear numLines after the current screen @@ -897,21 +994,18 @@ fHistorySize += numLines; // scroll/extend dirty range + if (fDirtyInfo.dirtyTop != INT_MAX) { - if (fDirtyInfo.dirtyTop <= bottom - && top <= fDirtyInfo.dirtyBottom) { - // intersects with the scroll region -- extend - if (top < fDirtyInfo.dirtyTop) - fDirtyInfo.dirtyTop = top - numLines; - else - fDirtyInfo.dirtyTop -= numLines; - if (bottom > fDirtyInfo.dirtyBottom) - fDirtyInfo.dirtyBottom = bottom; - } else if (fDirtyInfo.dirtyBottom < top) { - // does not intersect with the scroll region -- just offset + // If the top or bottom of the dirty region are above the + // bottom of the scroll region, we have to scroll them up. + if (fDirtyInfo.dirtyTop <= bottom) { fDirtyInfo.dirtyTop -= numLines; - fDirtyInfo.dirtyBottom -= numLines; + if (fDirtyInfo.dirtyBottom <= bottom) + fDirtyInfo.dirtyBottom -= numLines; } + + // numLines above the bottom become dirty + _Invalidate(bottom - numLines + 1, bottom); } fDirtyInfo.linesScrolled += numLines; Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h =================================================================== --- haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h 2008-06-10 21:34:50 UTC (rev 25911) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h 2008-06-10 21:43:42 UTC (rev 25912) @@ -26,6 +26,14 @@ return dirtyTop <= dirtyBottom; } + void ExtendDirtyRegion(int32 top, int32 bottom) + { + if (top < dirtyTop) + dirtyTop = top; + if (bottom > dirtyBottom) + dirtyBottom = bottom; + } + void Reset() { linesScrolled = 0; @@ -42,7 +50,7 @@ virtual ~BasicTerminalBuffer(); status_t Init(int32 width, int32 height, - int32 historySize); + int32 historyCapacity); int32 Width() const { return fWidth; } int32 Height() const { return fHeight; } @@ -51,8 +59,16 @@ TerminalBufferDirtyInfo& DirtyInfo() { return fDirtyInfo; } status_t ResizeTo(int32 width, int32 height); + status_t ResizeTo(int32 width, int32 height, + int32 historyCapacity); + status_t SetHistoryCapacity(int32 historyCapacity); void Clear(); + void SynchronizeWith( + const BasicTerminalBuffer* other, + int32 offset, int32 dirtyTop, + int32 dirtyBottom); + bool IsFullWidthChar(int32 row, int32 column) const; int GetChar(int32 row, int32 column, UTF8Char& character, From axeld at mail.berlios.de Tue Jun 10 23:53:01 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 10 Jun 2008 23:53:01 +0200 Subject: [Haiku-commits] r25913 - in haiku/trunk: build/jam src/system/kernel/arch/ppc Message-ID: <200806102153.m5ALr1XY006837@sheep.berlios.de> Author: axeld Date: 2008-06-10 23:53:00 +0200 (Tue, 10 Jun 2008) New Revision: 25913 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25913&view=rev Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/src/system/kernel/arch/ppc/arch_int.cpp Log: Applied patch by Urias in order to let the PPC port build again. Temporarily removed the VESA driver, as long as it only builds on x86. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-06-10 21:43:42 UTC (rev 25912) +++ haiku/trunk/build/jam/HaikuImage 2008-06-10 21:53:00 UTC (rev 25913) @@ -83,7 +83,7 @@ BEOS_ADD_ONS_ACCELERANTS = $(X86_ONLY)radeon.accelerant $(X86_ONLY)nvidia.accelerant $(X86_ONLY)matrox.accelerant $(X86_ONLY)neomagic.accelerant - $(X86_ONLY)intel_extreme.accelerant $(X86_ONLY)s3.accelerant vesa.accelerant + $(X86_ONLY)intel_extreme.accelerant $(X86_ONLY)s3.accelerant $(X86_ONLY)vesa.accelerant #$(X86_ONLY)via.accelerant #$(X86_ONLY)vmware.accelerant ; @@ -122,7 +122,7 @@ BEOS_ADD_ONS_DRIVERS_AUDIO = auich auvia emuxki ; #hda BEOS_ADD_ONS_DRIVERS_GRAPHICS = $(X86_ONLY)radeon $(X86_ONLY)nvidia $(X86_ONLY)neomagic $(X86_ONLY)matrox $(X86_ONLY)intel_extreme - $(X86_ONLY)s3 vesa #$(X86_ONLY)via #$(X86_ONLY)vmware + $(X86_ONLY)s3 $(X86_ONLY)vesa #$(X86_ONLY)via #$(X86_ONLY)vmware ; BEOS_ADD_ONS_DRIVERS_MIDI = emuxki ; BEOS_ADD_ONS_DRIVERS_NET = $(X86_ONLY)3com etherpci $(X86_ONLY)ipro1000 Modified: haiku/trunk/src/system/kernel/arch/ppc/arch_int.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/ppc/arch_int.cpp 2008-06-10 21:43:42 UTC (rev 25912) +++ haiku/trunk/src/system/kernel/arch/ppc/arch_int.cpp 2008-06-10 21:53:00 UTC (rev 25913) @@ -349,14 +349,14 @@ ~DeviceTreeIterator() { if (fParent != NULL) - fDeviceManager->put_device_node(fParent); + fDeviceManager->put_node(fParent); if (fNode != NULL) - fDeviceManager->put_device_node(fNode); + fDeviceManager->put_node(fNode); } void Rewind() { - fNode = fDeviceManager->get_root(); + fNode = fDeviceManager->get_root_node(); } bool HasNext() const @@ -364,38 +364,38 @@ return (fNode != NULL); } - device_node_handle Next() + device_node *Next() { if (fNode == NULL) return NULL; - device_node_handle foundNode = fNode; + device_node *foundNode = fNode; // get first child - device_node_handle child = NULL; - if (fDeviceManager->get_next_child_device(fNode, &child, NULL) + device_node *child = NULL; + if (fDeviceManager->get_next_child_node(fNode, NULL, &child) == B_OK) { // move to the child node if (fParent != NULL) - fDeviceManager->put_device_node(fParent); + fDeviceManager->put_node(fParent); fParent = fNode; fNode = child; // no more children; backtrack to find the next sibling } else { while (fParent != NULL) { - if (fDeviceManager->get_next_child_device(fParent, &fNode, NULL) + if (fDeviceManager->get_next_child_node(fParent, NULL, &fNode) == B_OK) { - // get_next_child_device() always puts the node + // get_next_child_node() always puts the node break; } fNode = fParent; - fParent = fDeviceManager->get_parent(fNode); + fParent = fDeviceManager->get_parent_node(fNode); } // if we hit the root node again, we're done if (fParent == NULL) { - fDeviceManager->put_device_node(fNode); + fDeviceManager->put_node(fNode); fNode = NULL; } } @@ -405,8 +405,8 @@ private: device_manager_info *fDeviceManager; - device_node_handle fNode; - device_node_handle fParent; + device_node *fNode; + device_node *fParent; }; @@ -444,13 +444,13 @@ static bool -probe_pic_device(device_node_handle node, PICModuleList &picModules) +probe_pic_device(device_node *node, PICModuleList &picModules) { for (PICModule *module = picModules.Head(); module; module = picModules.GetNext(module)) { - bool noConnection; - if (module->module->info.supports_device(node, &noConnection) > 0) { + //bool noConnection; + if (module->module->info.supports_device(node) > 0) { if (module->module->info.register_device(node) == B_OK) return true; } @@ -484,29 +484,32 @@ // iterate through the device tree and probe the interrupt controllers DeviceTreeIterator iterator(deviceManager); - while (device_node_handle node = iterator.Next()) + while (device_node *node = iterator.Next()) probe_pic_device(node, picModules); // iterate through the tree again and get an interrupt controller node iterator.Rewind(); - while (device_node_handle node = iterator.Next()) { - char *deviceType; - if (deviceManager->get_attr_string(node, B_DRIVER_DEVICE_TYPE, + while (device_node *node = iterator.Next()) { + const char *deviceType; + if (deviceManager->get_attr_string(node, B_DEVICE_TYPE, &deviceType, false) == B_OK) { + bool isPIC = false; + + /* bool isPIC = (strcmp(deviceType, B_INTERRUPT_CONTROLLER_DRIVER_TYPE) == 0); free(deviceType); + */ if (isPIC) { driver_module_info *driver; void *driverCookie; - error = deviceManager->init_driver(node, NULL, &driver, - &driverCookie); - if (error == B_OK) { - sPIC = (interrupt_controller_module_info *)driver; - sPICCookie = driverCookie; - return B_OK; - } + + deviceManager->get_driver(node, (driver_module_info **)&driver, (void **)&driverCookie); + + sPIC = (interrupt_controller_module_info *)driver; + sPICCookie = driverCookie; + return B_OK; } } } From axeld at mail.berlios.de Tue Jun 10 23:54:35 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 10 Jun 2008 23:54:35 +0200 Subject: [Haiku-commits] r25914 - haiku/trunk/src/apps/aboutsystem Message-ID: <200806102154.m5ALsZSP006952@sheep.berlios.de> Author: axeld Date: 2008-06-10 23:54:35 +0200 (Tue, 10 Jun 2008) New Revision: 25914 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25914&view=rev Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp Log: I can't believe Urias wasn't mentioned here yet... Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp =================================================================== --- haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-06-10 21:53:00 UTC (rev 25913) +++ haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-06-10 21:54:35 UTC (rev 25914) @@ -473,6 +473,7 @@ "Christopher ML Zumwalt May\n" "Andrew McCall\n" "Scott McCreary\n" + "Urias McCullough\n" "Michele (zuMi)\n" "Marius Middelthon\n" "Misza\n" From mmlr at mail.berlios.de Wed Jun 11 00:07:46 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Wed, 11 Jun 2008 00:07:46 +0200 Subject: [Haiku-commits] r25915 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200806102207.m5AM7kYm008174@sheep.berlios.de> Author: mmlr Date: 2008-06-11 00:07:45 +0200 (Wed, 11 Jun 2008) New Revision: 25915 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25915&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp Log: * Fix the check after waiting for owner change to happen and don't reset if the handover indeed worked. Doesn't really matter though, as we reset anyway, just not twice in the success case. * Disable all interrupts and clear any pending active interrupts just after taking over the controller. This might fix bug #2361. * Also trace output when the ownership change is successful. * Don't disable interrupts during reset. Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp 2008-06-10 21:54:35 UTC (rev 25914) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp 2008-06-10 22:07:45 UTC (rev 25915) @@ -204,7 +204,7 @@ // Determine in what context we are running (Kindly copied from FreeBSD) uint32 control = _ReadReg(OHCI_CONTROL); if (control & OHCI_INTERRUPT_ROUTING) { - TRACE(("usb_ohci: SMM is in control of the host controller\n")); + TRACE(("usb_ohci: smm is in control of the host controller\n")); uint32 status = _ReadReg(OHCI_COMMAND_STATUS); _WriteReg(OHCI_COMMAND_STATUS, status | OHCI_OWNERSHIP_CHANGE_REQUEST); for (uint32 i = 0; i < 100 && (control & OHCI_INTERRUPT_ROUTING); i++) { @@ -212,16 +212,22 @@ control = _ReadReg(OHCI_CONTROL); } - if (!(control & OHCI_INTERRUPT_ROUTING)) { - TRACE(("usb_ohci: SMM does not respond. Resetting...\n")); + if ((control & OHCI_INTERRUPT_ROUTING) != 0) { + TRACE_ERROR(("usb_ohci: smm does not respond. resetting...\n")); _WriteReg(OHCI_CONTROL, OHCI_HC_FUNCTIONAL_STATE_RESET); snooze(USB_DELAY_BUS_RESET); - } + } else + TRACE(("usb_ohci: ownership change successful\n")); } else { TRACE(("usb_ohci: cold started\n")); snooze(USB_DELAY_BUS_RESET); } + // Disable all interrupts and clear any current interrupt status + _WriteReg(OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTERRUPTS + | OHCI_MASTER_INTERRUPT_ENABLE); + _WriteReg(OHCI_INTERRUPT_STATUS, OHCI_ALL_INTERRUPTS); + // This reset should not be necessary according to the OHCI spec, but // without it some controllers do not start. _WriteReg(OHCI_CONTROL, OHCI_HC_FUNCTIONAL_STATE_RESET); @@ -232,7 +238,6 @@ uint32 intervalValue = OHCI_GET_INTERVAL_VALUE(frameInterval); // Disable interrupts right before we reset - cpu_status former = disable_interrupts(); _WriteReg(OHCI_COMMAND_STATUS, OHCI_HOST_CONTROLLER_RESET); // Nominal time for a reset is 10 us uint32 reset = 0; @@ -244,7 +249,6 @@ } if (reset) { - restore_interrupts(former); TRACE_ERROR(("usb_ohci: Error resetting the host controller (timeout)\n")); return; } @@ -267,8 +271,6 @@ // And finally start the controller _WriteReg(OHCI_CONTROL, control); - restore_interrupts(former); - // The controller is now OPERATIONAL. frameInterval = (_ReadReg(OHCI_FRAME_INTERVAL) & OHCI_FRAME_INTERVAL_TOGGLE) ^ OHCI_FRAME_INTERVAL_TOGGLE; From umccullough at gmail.com Tue Jun 10 23:58:42 2008 From: umccullough at gmail.com (Urias McCullough) Date: Tue, 10 Jun 2008 14:58:42 -0700 Subject: [Haiku-commits] r25914 - haiku/trunk/src/apps/aboutsystem In-Reply-To: <200806102154.m5ALsZSP006952@sheep.berlios.de> References: <200806102154.m5ALsZSP006952@sheep.berlios.de> Message-ID: <1e80d8750806101458r74796592xbbdfb63499953c47@mail.gmail.com> 2008/6/10 axeld at BerliOS : > Author: axeld > Date: 2008-06-10 23:54:35 +0200 (Tue, 10 Jun 2008) > New Revision: 25914 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25914&view=rev > > Modified: > haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp > Log: > I can't believe Urias wasn't mentioned here yet... LOL - thanks! :) From anevilyak at mail.berlios.de Wed Jun 11 00:10:14 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Wed, 11 Jun 2008 00:10:14 +0200 Subject: [Haiku-commits] r25916 - haiku/trunk/src/kits/support Message-ID: <200806102210.m5AMAETI008377@sheep.berlios.de> Author: anevilyak Date: 2008-06-11 00:10:13 +0200 (Wed, 11 Jun 2008) New Revision: 25916 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25916&view=rev Modified: haiku/trunk/src/kits/support/List.cpp Log: Rework BList's Resize() functionality: instead of altering the size of the list a block at a time, we now double/halve the current size of the list, starting with the constructor blocksize as a baseline. This has the net effect that when doing large numbers of inserts/removes, the number of resize operations needed scales logarithmically to the number of operations, which should yield a decent performance improvement in such cases. Review welcome. This does not yet affect ticket #2363 that I'm aware of, as I'm currently in the process of attempting to find a copy of said app to test with. Modified: haiku/trunk/src/kits/support/List.cpp =================================================================== --- haiku/trunk/src/kits/support/List.cpp 2008-06-10 22:07:45 UTC (rev 25915) +++ haiku/trunk/src/kits/support/List.cpp 2008-06-10 22:10:13 UTC (rev 25916) @@ -174,7 +174,7 @@ if (index >= 0 && index < fItemCount) { item = fObjectList[index]; move_items(fObjectList + index + 1, -1, fItemCount - index - 1); - Resize(fItemCount - 1); + Resize(fItemCount - 1); } return item; } @@ -433,11 +433,17 @@ BList::Resize(int32 count) { bool result = true; + // calculate the new physical size - int32 newSize = count; - if (newSize <= 0) - newSize = 1; - newSize = ((newSize - 1) / fBlockSize + 1) * fBlockSize; + // by doubling the existing size + // until we can hold at least count items + int32 newSize = fBlockSize; + if (count <= 0) + count = fBlockSize; + if ((size_t)count != fPhysicalSize) + while (newSize < count) + newSize <<= 1; + // resize if necessary if ((size_t)newSize != fPhysicalSize) { void** newObjectList From bonefish at mail.berlios.de Wed Jun 11 00:20:15 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 11 Jun 2008 00:20:15 +0200 Subject: [Haiku-commits] r25917 - haiku/trunk/src/apps/terminal Message-ID: <200806102220.m5AMKFPo009295@sheep.berlios.de> Author: bonefish Date: 2008-06-11 00:20:14 +0200 (Wed, 11 Jun 2008) New Revision: 25917 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25917&view=rev Modified: haiku/trunk/src/apps/terminal/TermView.cpp haiku/trunk/src/apps/terminal/TermView.h Log: * TermView does now maintain an additional visible area sized BasicTerminalBuffer. It synchronizes this buffer with the actual terminal buffer and uses it for drawing. This does significantly decrease the time the terminal buffer is locked by the window thread, and avoids the necessity to do invalidations in Draw() when the terminal buffer changed in the meantime. * When the view detects heavy scrolling of the terminal buffer due to lots of continued output, it throttles redraws to one every 0.1s. The detection condition might need some fine-tuning -- it's probably a bit too strict for most situations. I guess I'm done now with optimizations. After testing on real iron for the first time, I'm a little impressed. In the "time seq ..." speed competition Haiku's Terminal easily beats Konsole by 10 to 20% for 80x25 and by factor 3+ for full screen. And if I interpret the results correctly 90% of the time is actually used by "seq" itself which seems to be about 5 times slower than under Linux. Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-10 22:10:13 UTC (rev 25916) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-10 22:20:14 UTC (rev 25917) @@ -94,6 +94,8 @@ static const uint32 kBlinkCursor = 'BlCr'; static const uint32 kAutoScroll = 'AScr'; +static const bigtime_t kSyncUpdateGranularity = 100000; // 0.1 s + static const rgb_color kBlackColor = { 0, 0, 0, 255 }; static const rgb_color kWhiteColor = { 255, 255, 255, 255 }; @@ -207,6 +209,7 @@ fTermColumns(COLUMNS_DEFAULT), fEncoding(M_UTF8), fTextBuffer(NULL), + fVisibleTextBuffer(NULL), fScrollBar(NULL), fTextForeColor(kBlackColor), fTextBackColor(kWhiteColor), @@ -216,6 +219,10 @@ fSelectBackColor(kBlackColor), fScrollOffset(0), fScrBufSize(historySize), + fLastSyncTime(0), + fScrolledSinceLastSync(0), + fSyncRunner(NULL), + fConsiderClockedSync(false), fSelStart(-1, -1), fSelEnd(-1, -1), fMouseTracking(false), @@ -248,6 +255,7 @@ fTermColumns(columns), fEncoding(M_UTF8), fTextBuffer(NULL), + fVisibleTextBuffer(NULL), fScrollBar(NULL), fTextForeColor(kBlackColor), fTextBackColor(kWhiteColor), @@ -257,6 +265,10 @@ fSelectBackColor(kBlackColor), fScrollOffset(0), fScrBufSize(historySize), + fLastSyncTime(0), + fScrolledSinceLastSync(0), + fSyncRunner(NULL), + fConsiderClockedSync(false), fSelStart(-1, -1), fSelEnd(-1, -1), fMouseTracking(false), @@ -301,6 +313,7 @@ fTermColumns(COLUMNS_DEFAULT), fEncoding(M_UTF8), fTextBuffer(NULL), + fVisibleTextBuffer(NULL), fScrollBar(NULL), fTextForeColor(kBlackColor), fTextBackColor(kWhiteColor), @@ -309,6 +322,10 @@ fSelectForeColor(kWhiteColor), fSelectBackColor(kBlackColor), fScrBufSize(1000), + fLastSyncTime(0), + fScrolledSinceLastSync(0), + fSyncRunner(NULL), + fConsiderClockedSync(false), fSelStart(-1, -1), fSelEnd(-1, -1), fMouseTracking(false), @@ -347,6 +364,10 @@ if (fTextBuffer == NULL) return B_NO_MEMORY; + fVisibleTextBuffer = new(std::nothrow) BasicTerminalBuffer; + if (fVisibleTextBuffer == NULL) + return B_NO_MEMORY; + // TODO: Make the special word chars user-settable! fCharClassifier = new(std::nothrow) CharClassifier( kDefaultSpecialWordChars); @@ -358,6 +379,11 @@ return error; fTextBuffer->SetEncoding(fEncoding); + error = fVisibleTextBuffer->Init(fTermColumns, fTermRows + 2, + fTermRows + 2); + if (error != B_OK) + return error; + fShell = new (std::nothrow) Shell(); if (fShell == NULL) return B_NO_MEMORY; @@ -392,8 +418,10 @@ _DetachShell(); + delete fSyncRunner; delete fAutoScrollRunner; - delete fCharClassifier; + delete fCharClassifier; + delete fVisibleTextBuffer; delete fTextBuffer; delete shell; } @@ -474,8 +502,11 @@ { BAutolock _(fTextBuffer); - if (fTextBuffer->ResizeTo(columns, rows) != B_OK) + if (fTextBuffer->ResizeTo(columns, rows) != B_OK + || fVisibleTextBuffer->ResizeTo(columns, rows + 2, rows + 2) + != B_OK) { return Bounds(); + } } fTermRows = rows; @@ -493,6 +524,17 @@ if (resize) ResizeTo(rect.Width(), rect.Height()); + + + // synchronize the visible text buffer + { + BAutolock _(fTextBuffer); + + _SynchronizeWithTextBuffer(0, -1); + int32 offset = _LineAt(0); + fVisibleTextBuffer->SynchronizeWith(fTextBuffer, offset, offset, + offset + rows + 2); + } return rect; } @@ -858,12 +900,14 @@ BRect rect(fFontWidth * fCursor.x, _LineOffset(fCursor.y), 0, 0); rect.right = rect.left + fFontWidth - 1; rect.bottom = rect.top + fCursorHeight - 1; + int32 firstVisible = _LineAt(0); UTF8Char character; uint16 attr; bool selected = _CheckSelectedRegion(TermPos(fCursor.x, fCursor.y)); - if (fTextBuffer->GetChar(fCursor.y, fCursor.x, character, attr) == A_CHAR) { + if (fVisibleTextBuffer->GetChar(fCursor.y - firstVisible, fCursor.x, + character, attr) == A_CHAR) { int32 width; if (IS_WIDTH(attr)) width = 2; @@ -875,8 +919,8 @@ memcpy(buffer, character.bytes, bytes); buffer[bytes] = '\0'; - _DrawLinePart(fCursor.x * fFontWidth, (int32)_LineOffset(fCursor.y), - attr, buffer, width, selected, true, this); + _DrawLinePart(fCursor.x * fFontWidth, (int32)rect.top, attr, buffer, + width, selected, true, this); } else { if (selected) SetHighColor(fSelectBackColor); @@ -965,7 +1009,8 @@ // return; // } - BAutolock _(fTextBuffer); +// BAutolock _(fTextBuffer); + // debug_printf("TermView::Draw((%f, %f) - (%f, %f))\n", updateRect.left, // updateRect.top, updateRect.right, updateRect.bottom); // { @@ -982,11 +1027,12 @@ // } // } - _SynchronizeWithTextBuffer(&updateRect); +// _SynchronizeWithTextBuffer(&updateRect); int32 x1 = (int32)(updateRect.left) / fFontWidth; int32 x2 = (int32)(updateRect.right) / fFontWidth; + int32 firstVisible = _LineAt(0); int32 y1 = _LineAt(updateRect.top); int32 y2 = _LineAt(updateRect.bottom); @@ -999,7 +1045,8 @@ int32 k = x1; char buf[fTermColumns * 4 + 1]; - if (fTextBuffer->IsFullWidthChar(j, k)) +// if (fTextBuffer->IsFullWidthChar(j, k)) + if (fVisibleTextBuffer->IsFullWidthChar(j - firstVisible, k)) k--; if (k < 0) @@ -1009,10 +1056,13 @@ int32 lastColumn = x2; bool insideSelection = _CheckSelectedRegion(j, i, lastColumn); uint16 attr; - int32 count = fTextBuffer->GetString(j, i, lastColumn, buf, attr); -//debug_printf(" fTextBuffer->GetString(%ld, %ld, %ld) -> (%ld, \"%.*s\"), selected: %d\n", -//j, i, lastColumn, count, (int)count, buf, insideSelection); +// int32 count = fTextBuffer->GetString(j, i, lastColumn, buf, attr); + int32 count = fVisibleTextBuffer->GetString(j - firstVisible, i, + lastColumn, buf, attr); +//debug_printf(" fVisibleTextBuffer->GetString(%ld, %ld, %ld) -> (%ld, \"%.*s\"), selected: %d\n", +//j - firstVisible, i, lastColumn, count, (int)count, buf, insideSelection); + if (count == 0) { BRect rect(fFontWidth * i, _LineOffset(j), fFontWidth * (lastColumn + 1) - 1, 0); @@ -1402,7 +1452,7 @@ case MSG_TERMINAL_BUFFER_CHANGED: { BAutolock _(fTextBuffer); - _SynchronizeWithTextBuffer(NULL); + _SynchronizeWithTextBuffer(0, -1); break; } case MSG_SET_TERMNAL_TITLE: @@ -1445,6 +1495,12 @@ if (diff == 0) return; + float bottom = Bounds().bottom; + int32 oldFirstLine = _LineAt(0); + int32 oldLastLine = _LineAt(bottom); + int32 newFirstLine = _LineAt(diff); + int32 newLastLine = _LineAt(bottom + diff); + fScrollOffset = where.y; // invalidate the current cursor position before scrolling @@ -1457,7 +1513,21 @@ //sourceRect.left, sourceRect.top, sourceRect.right, sourceRect.bottom, //destRect.left, destRect.top, destRect.right, destRect.bottom); CopyBits(sourceRect, destRect); + + // sync visible text buffer with text buffer + if (newFirstLine != oldFirstLine || newLastLine != oldLastLine) { + if (newFirstLine != oldFirstLine) +{ +//debug_printf("fVisibleTextBuffer->ScrollBy(%ld)\n", newFirstLine - oldFirstLine); + fVisibleTextBuffer->ScrollBy(newFirstLine - oldFirstLine); } + BAutolock _(fTextBuffer); + if (diff < 0) + _SynchronizeWithTextBuffer(newFirstLine, oldFirstLine - 1); + else + _SynchronizeWithTextBuffer(oldLastLine + 1, newLastLine); + } +} BHandler* @@ -1489,23 +1559,85 @@ /*! Text buffer must already be locked. */ void -TermView::_SynchronizeWithTextBuffer(BRect* invalidateWhenScrolling) +TermView::_SynchronizeWithTextBuffer(int32 visibleDirtyTop, + int32 visibleDirtyBottom) { TerminalBufferDirtyInfo& info = fTextBuffer->DirtyInfo(); - -//debug_printf("TermView::_SynchronizeWithTextBuffer(): dirty: %ld - %ld, " -//"scrolled: %ld\n", info.dirtyTop, info.dirtyBottom, info.linesScrolled); - + int32 linesScrolled = info.linesScrolled; BRect bounds = Bounds(); int32 firstVisible = _LineAt(0); int32 lastVisible = _LineAt(bounds.bottom); int32 historySize = fTextBuffer->HistorySize(); - int32 linesScrolled = info.linesScrolled; +//debug_printf("TermView::_SynchronizeWithTextBuffer(): dirty: %ld - %ld, " +//"scrolled: %ld, visible dirty: %ld - %ld\n", info.dirtyTop, info.dirtyBottom, +//info.linesScrolled, visibleDirtyTop, visibleDirtyBottom); + + bigtime_t now = system_time(); + bigtime_t timeElapsed = now - fLastSyncTime; + if (timeElapsed > 2 * kSyncUpdateGranularity) { + // last sync was ages ago + fLastSyncTime = now; + fScrolledSinceLastSync = linesScrolled; + } + + if (fSyncRunner == NULL) { + // We consider clocked syncing when more than a full screen height has + // been scrolled in less than a sync update period. Once we're + // actively considering it, the same condition will convince us to + // actually do it. + if (fScrolledSinceLastSync + linesScrolled <= fTermRows) { + // Condition doesn't hold yet. Reset if time is up, or otherwise + // keep counting. + if (timeElapsed > kSyncUpdateGranularity) { + fConsiderClockedSync = false; + fLastSyncTime = now; + fScrolledSinceLastSync = linesScrolled; + } else + fScrolledSinceLastSync += linesScrolled; + } else if (fConsiderClockedSync) { + // We are convinced -- create the sync runner. + fLastSyncTime = now; + fScrolledSinceLastSync = 0; + + BMessage message(MSG_TERMINAL_BUFFER_CHANGED); + fSyncRunner = new(std::nothrow) BMessageRunner(BMessenger(this), + &message, kSyncUpdateGranularity); + if (fSyncRunner != NULL && fSyncRunner->InitCheck() == B_OK) + return; + + delete fSyncRunner; + fSyncRunner = NULL; + } else { + // Looks interesting so far. Reset the counts and consider clocked + // syncing. + fConsiderClockedSync = true; + fLastSyncTime = now; + fScrolledSinceLastSync = 0; + } + } else if (timeElapsed < kSyncUpdateGranularity) { + // sync time not passed yet -- keep counting + fScrolledSinceLastSync += linesScrolled; + return; + } else if (fScrolledSinceLastSync + linesScrolled <= fTermRows) { + // time's up, but not enough happened + delete fSyncRunner; + fSyncRunner = NULL; + fLastSyncTime = now; + fScrolledSinceLastSync = linesScrolled; + } else { + // Things are still rolling, but the sync time's up. + fLastSyncTime = now; + fScrolledSinceLastSync = 0; + } + bool doScroll = false; if (linesScrolled > 0) { _UpdateScrollBarRange(); + visibleDirtyTop -= linesScrolled; + visibleDirtyBottom -= linesScrolled; + if (firstVisible < 0) { firstVisible -= linesScrolled; lastVisible -= linesScrolled; @@ -1515,6 +1647,25 @@ firstVisible = -historySize; doScroll = true; scrollOffset = -historySize * fFontHeight; + // We need to invalidate the lower linesScrolled lines of the + // visible text buffer, since those will be scrolled up and + // need to be replaced. We just use visibleDirty{Top,Bottom} + // for that purpose. Unless invoked from ScrollTo() (i.e. + // user-initiated scrolling) those are unused. In the unlikely + // case that the user is scrolling at the same time we may + // invalidate too many lines, since we have to extend the given + // region. + // Note that in the firstVisible == 0 case the new lines are + // already in the dirty region, so they will be updated anyway. + if (visibleDirtyTop <= visibleDirtyBottom) { + if (lastVisible < visibleDirtyTop) + visibleDirtyTop = lastVisible; + if (visibleDirtyBottom < lastVisible + linesScrolled) + visibleDirtyBottom = lastVisible + linesScrolled; + } else { + visibleDirtyTop = lastVisible + 1; + visibleDirtyBottom = lastVisible + linesScrolled; + } } else scrollOffset = fScrollOffset - linesScrolled * fFontHeight; @@ -1538,13 +1689,7 @@ //destRect.left, destRect.top, destRect.right, destRect.bottom); CopyBits(sourceRect, destRect); - if (invalidateWhenScrolling != NULL) -{ - Invalidate(invalidateWhenScrolling->OffsetByCopy(0, -scrollBy)); -//BRect rect(invalidateWhenScrolling->OffsetByCopy(0, scrollBy)); -//debug_printf("Invalidate((%f, %f) - (%f, %f))\n", rect.left, rect.top, -//rect.right, rect.bottom); -} + fVisibleTextBuffer->ScrollBy(linesScrolled); } // move selection @@ -1577,6 +1722,14 @@ } } + if (visibleDirtyTop <= visibleDirtyBottom) + info.ExtendDirtyRegion(visibleDirtyTop, visibleDirtyBottom); + + if (linesScrolled != 0 || info.IsDirtyRegionValid()) { + fVisibleTextBuffer->SynchronizeWith(fTextBuffer, firstVisible, + info.dirtyTop, info.dirtyBottom); + } + // invalidate cursor, if it changed TermPos cursor = fTextBuffer->Cursor(); if (fCursor != cursor) { @@ -1792,7 +1945,7 @@ { BAutolock _(fTextBuffer); - _SynchronizeWithTextBuffer(NULL); + _SynchronizeWithTextBuffer(0, -1); if (end < start) std::swap(start, end); @@ -2008,7 +2161,7 @@ bool matchWord) { BAutolock _(fTextBuffer); - _SynchronizeWithTextBuffer(NULL); + _SynchronizeWithTextBuffer(0, -1); TermPos start; if (_HasSelection()) { Modified: haiku/trunk/src/apps/terminal/TermView.h =================================================================== --- haiku/trunk/src/apps/terminal/TermView.h 2008-06-10 22:10:13 UTC (rev 25916) +++ haiku/trunk/src/apps/terminal/TermView.h 2008-06-10 22:20:14 UTC (rev 25917) @@ -130,7 +130,8 @@ void _UpdateScrollBarRange(); void _DoFileDrop(entry_ref &ref); - void _SynchronizeWithTextBuffer(BRect* invalidateWhenScrolling); + void _SynchronizeWithTextBuffer(int32 visibleDirtyTop, + int32 visibleDirtyBottom); void _WritePTY(const char* text, int32 numBytes); @@ -201,8 +202,9 @@ int fEncoding; // Object pointer. - TerminalBuffer *fTextBuffer; - BScrollBar *fScrollBar; + TerminalBuffer *fTextBuffer; + BasicTerminalBuffer *fVisibleTextBuffer; + BScrollBar *fScrollBar; // Color and Attribute. rgb_color fTextForeColor, fTextBackColor; @@ -216,6 +218,12 @@ // buffer is created. float fAutoScrollSpeed; + // redraw management + bigtime_t fLastSyncTime; + int32 fScrolledSinceLastSync; + BMessageRunner* fSyncRunner; + bool fConsiderClockedSync; + // selection TermPos fSelStart; TermPos fSelEnd; From anevilyak at gmail.com Wed Jun 11 00:28:31 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Tue, 10 Jun 2008 17:28:31 -0500 Subject: [Haiku-commits] r25917 - haiku/trunk/src/apps/terminal In-Reply-To: <200806102220.m5AMKFPo009295@sheep.berlios.de> References: <200806102220.m5AMKFPo009295@sheep.berlios.de> Message-ID: On Tue, Jun 10, 2008 at 5:20 PM, bonefish at BerliOS wrote: > Author: bonefish > Date: 2008-06-11 00:20:14 +0200 (Wed, 11 Jun 2008) > New Revision: 25917 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25917&view=rev > > Modified: > haiku/trunk/src/apps/terminal/TermView.cpp > haiku/trunk/src/apps/terminal/TermView.h > Log: > * TermView does now maintain an additional visible area sized > BasicTerminalBuffer. It synchronizes this buffer with the actual > terminal buffer and uses it for drawing. This does significantly > decrease the time the terminal buffer is locked by the window thread, > and avoids the necessity to do invalidations in Draw() when the > terminal buffer changed in the meantime. > * When the view detects heavy scrolling of the terminal buffer due to > lots of continued output, it throttles redraws to one every 0.1s. The > detection condition might need some fine-tuning -- it's probably a bit > too strict for most situations. > > I guess I'm done now with optimizations. After testing on real iron for > the first time, I'm a little impressed. In the "time seq ..." speed > competition Haiku's Terminal easily beats Konsole by 10 to 20% for 80x25 > and by factor 3+ for full screen. And if I interpret the results > correctly 90% of the time is actually used by "seq" itself which seems > to be about 5 times slower than under Linux. Nice work! A question though: why would seq by 5 times slower than in linux? If I understand the function of it correctly, it seems that should more or less be purely CPU bound and not really relying on any other OS services except printf. Regards, Rene From mmlr at mail.berlios.de Wed Jun 11 00:35:58 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Wed, 11 Jun 2008 00:35:58 +0200 Subject: [Haiku-commits] r25918 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200806102235.m5AMZw0T018112@sheep.berlios.de> Author: mmlr Date: 2008-06-11 00:35:57 +0200 (Wed, 11 Jun 2008) New Revision: 25918 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25918&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp Log: If the BIOS doesn't give up ownership of an EHCI controller, simply clear the BIOS owned flag and clear all possibly enabled SMIs. It seems to be common practice to just ignore this error case, probably because there are enough broken BIOSs out there that do not correctly hand over the controller. Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2008-06-10 22:20:14 UTC (rev 25917) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2008-06-10 22:35:57 UTC (rev 25918) @@ -194,11 +194,13 @@ } if (legacySupport & EHCI_LEGSUP_BIOSOWNED) { - // in any case disable interrupts so we do not flood the system - // if the BIOS still decides to give up control - WriteOpReg(EHCI_USBINTR, 0); - TRACE_ERROR(("usb_ehci: bios won't give up control over the host controller\n")); - return; + TRACE_ERROR(("usb_ehci: bios won't give up control over the host controller (ignoring)\n")); + + // turn off the BIOS owned flag, clear all SMIs and continue + sPCIModule->write_pci_config(fPCIInfo->bus, fPCIInfo->device, + fPCIInfo->function, extendedCapPointer + 2, 1, 0); + sPCIModule->write_pci_config(fPCIInfo->bus, fPCIInfo->device, + fPCIInfo->function, extendedCapPointer + 4, 4, 0); } else if (legacySupport & EHCI_LEGSUP_OSOWNED) { dprintf("usb_ehci: successfully took ownership of the host controller\n"); } From ingo_weinhold at gmx.de Wed Jun 11 00:48:31 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 11 Jun 2008 00:48:31 +0200 Subject: [Haiku-commits] r25881 - haiku/trunk/src/apps/terminal In-Reply-To: <31555109989-BeMail@zon> References: <31555109989-BeMail@zon> Message-ID: <20080611004831.577.1@knochen-vm.1213121927.fake> On 2008-06-10 at 17:10:13 [+0200], Axel D?rfler wrote: > Ingo Weinhold wrote: > > I don't think I'll do that. I'm only working on the Terminal because > > it > > annoyed me one time too often. I basically just want to get to a > > state > > where everything works at least as well as before. I may make it a > > bit more > > xtermy, but aside from that I don't really want to dig too deep. > > BTW how about having a larger history by default? I think 1000 lines > are a bit cheap, and are easily filled several times by a compilation > of the Haiku tree. Agreed. I'm used to much larger histories under Linux myself. Making the history size user-settable seems to be the way to go. > With the current TerminalBuffer implementation, 1000 lines equate to > 480KB in case of 80 chars per line. BTW in BeOS, of a "seq 10000" a bit > more than 2000 lines survive, and the memory consumption is about 140KB > for this. If the lines are longer, more memory is used up, so it seems > to be a bit more intelligent in the way it manages its memory :-) When I rewrote TermBuffer I actually started with a design where the history lines would have another (more compact) format than the lines for the screen. I ditched it, since dealing with uniform lines is way easier and faster. Now that Terminal is pretty fast, maybe it's time to consider slowing it down again. :-) I'm not sure about the dynamic history memory allocation, though. It doesn't sound like a particularly fast choice. I guess a lines * (width + ...) bytes ring buffer will be fine. If the lines contain lots of multi-byte chars or different character styles and are very long, less lines can be stored, but I guess that will work for most people. CU, Ingo From anevilyak at mail.berlios.de Wed Jun 11 01:25:33 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Wed, 11 Jun 2008 01:25:33 +0200 Subject: [Haiku-commits] r25919 - haiku/trunk/src/kits/support Message-ID: <200806102325.m5ANPX8V019969@sheep.berlios.de> Author: anevilyak Date: 2008-06-11 01:25:33 +0200 (Wed, 11 Jun 2008) New Revision: 25919 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25919&view=rev Modified: haiku/trunk/src/kits/support/List.cpp Log: Revert this change until I determine why it now crashes the app_server when it didn't during my tests. Modified: haiku/trunk/src/kits/support/List.cpp =================================================================== --- haiku/trunk/src/kits/support/List.cpp 2008-06-10 22:35:57 UTC (rev 25918) +++ haiku/trunk/src/kits/support/List.cpp 2008-06-10 23:25:33 UTC (rev 25919) @@ -174,7 +174,7 @@ if (index >= 0 && index < fItemCount) { item = fObjectList[index]; move_items(fObjectList + index + 1, -1, fItemCount - index - 1); - Resize(fItemCount - 1); + Resize(fItemCount - 1); } return item; } @@ -433,17 +433,11 @@ BList::Resize(int32 count) { bool result = true; - // calculate the new physical size - // by doubling the existing size - // until we can hold at least count items - int32 newSize = fBlockSize; - if (count <= 0) - count = fBlockSize; - if ((size_t)count != fPhysicalSize) - while (newSize < count) - newSize <<= 1; - + int32 newSize = count; + if (newSize <= 0) + newSize = 1; + newSize = ((newSize - 1) / fBlockSize + 1) * fBlockSize; // resize if necessary if ((size_t)newSize != fPhysicalSize) { void** newObjectList From ingo_weinhold at gmx.de Wed Jun 11 01:26:18 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 11 Jun 2008 01:26:18 +0200 Subject: [Haiku-commits] r25917 - haiku/trunk/src/apps/terminal In-Reply-To: References: <200806102220.m5AMKFPo009295@sheep.berlios.de> Message-ID: <20080611012618.677.2@knochen-vm.1213121927.fake> On 2008-06-11 at 00:28:31 [+0200], Rene Gollent wrote: > > Nice work! A question though: why would seq by 5 times slower than in > linux? If I understand the function of it correctly, it seems that > should more or less be purely CPU bound and not really relying on any > other OS services except printf. I hadn't run a comparison with "time seq ... > /dev/null" before, but just did. This one is only 20 - 30% slower than in Linux. Since it's mostly user time, it can't really be TTY related. I'm a bit clueless. Maybe our Terminal touches more memory, thus evicting seq's code/memory from CPU caches, while that doesn't happen in Linux. It might also be scheduler related -- e.g. caused by different quanta. Admittedly I also forgot to disable kernel tracing. This should have direct influence only on the kernel times, but might indirectly (through cache effects) affect user times, too. CU, Ingo From anevilyak at mail.berlios.de Wed Jun 11 02:32:52 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Wed, 11 Jun 2008 02:32:52 +0200 Subject: [Haiku-commits] r25920 - haiku/trunk/src/kits/support Message-ID: <200806110032.m5B0WqSw015133@sheep.berlios.de> Author: anevilyak Date: 2008-06-11 02:32:48 +0200 (Wed, 11 Jun 2008) New Revision: 25920 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25920&view=rev Modified: haiku/trunk/src/kits/support/List.cpp Log: Tracked down issue with previous commit. For some reason, modifying the passed in parameter's value directly results in a segfault in registrar, and I cannot see why. Thoughts? Modified: haiku/trunk/src/kits/support/List.cpp =================================================================== --- haiku/trunk/src/kits/support/List.cpp 2008-06-10 23:25:33 UTC (rev 25919) +++ haiku/trunk/src/kits/support/List.cpp 2008-06-11 00:32:48 UTC (rev 25920) @@ -34,8 +34,8 @@ #include #include #include +#include - // helper function static inline void @@ -174,7 +174,7 @@ if (index >= 0 && index < fItemCount) { item = fObjectList[index]; move_items(fObjectList + index + 1, -1, fItemCount - index - 1); - Resize(fItemCount - 1); + Resize(fItemCount - 1); } return item; } @@ -434,10 +434,20 @@ { bool result = true; // calculate the new physical size - int32 newSize = count; - if (newSize <= 0) - newSize = 1; - newSize = ((newSize - 1) / fBlockSize + 1) * fBlockSize; + // by doubling the existing size + // until we can hold at least count items + int32 newSize = fBlockSize; + // TODO: determine why modifying count directly via + // if (count <= 0) count = fBlockSize; + // results in this code segfaulting the registrar while using the local var 'c' does not. + int32 c = count; + if (c <= 0) + c = fBlockSize; + if ((size_t)c != fPhysicalSize) { + while (newSize < c) + newSize <<= 1; + } + // resize if necessary if ((size_t)newSize != fPhysicalSize) { void** newObjectList From mmu_man at mail.berlios.de Wed Jun 11 03:16:51 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 11 Jun 2008 03:16:51 +0200 Subject: [Haiku-commits] r25921 - in haiku/trunk/headers/private/kernel/arch: m68k ppc Message-ID: <200806110116.m5B1GpPU018795@sheep.berlios.de> Author: mmu_man Date: 2008-06-11 03:16:48 +0200 (Wed, 11 Jun 2008) New Revision: 25921 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25921&view=rev Modified: haiku/trunk/headers/private/kernel/arch/m68k/arch_cpu.h haiku/trunk/headers/private/kernel/arch/ppc/arch_cpu.h Log: Remove PAGE_SIZE define for ppc and m68k from kernel private headers. It's not needed there and should be in public header anyway. Modified: haiku/trunk/headers/private/kernel/arch/m68k/arch_cpu.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/m68k/arch_cpu.h 2008-06-11 00:32:48 UTC (rev 25920) +++ haiku/trunk/headers/private/kernel/arch/m68k/arch_cpu.h 2008-06-11 01:16:48 UTC (rev 25921) @@ -10,8 +10,6 @@ #include -#define PAGE_SIZE 4096 - /* 68k has many different possible stack frames, differentiated by a 4 bit number, * but they also depend on the cpu type. * cf. mint/sys/arch/check_exc.h Modified: haiku/trunk/headers/private/kernel/arch/ppc/arch_cpu.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/ppc/arch_cpu.h 2008-06-11 00:32:48 UTC (rev 25920) +++ haiku/trunk/headers/private/kernel/arch/ppc/arch_cpu.h 2008-06-11 01:16:48 UTC (rev 25921) @@ -10,8 +10,6 @@ #include -#define PAGE_SIZE 4096 - struct iframe { uint32 vector; uint32 srr0; From mmu_man at mail.berlios.de Wed Jun 11 03:26:03 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 11 Jun 2008 03:26:03 +0200 Subject: [Haiku-commits] r25922 - in haiku/trunk/src/kits/debug/arch: . m68k Message-ID: <200806110126.m5B1Q3iw019518@sheep.berlios.de> Author: mmu_man Date: 2008-06-11 03:26:02 +0200 (Wed, 11 Jun 2008) New Revision: 25922 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25922&view=rev Added: haiku/trunk/src/kits/debug/arch/m68k/ haiku/trunk/src/kits/debug/arch/m68k/arch_debug_support.cpp Log: Debugger stubs for m68k. Added: haiku/trunk/src/kits/debug/arch/m68k/arch_debug_support.cpp =================================================================== --- haiku/trunk/src/kits/debug/arch/m68k/arch_debug_support.cpp 2008-06-11 01:16:48 UTC (rev 25921) +++ haiku/trunk/src/kits/debug/arch/m68k/arch_debug_support.cpp 2008-06-11 01:26:02 UTC (rev 25922) @@ -0,0 +1,34 @@ +/* + * Copyright 2005, Ingo Weinhold, bonefish at users.sf.net. + * Distributed under the terms of the MIT License. + */ + + +#include + +#include "arch_debug_support.h" + + +struct stack_frame { + struct stack_frame *previous; + void *return_address; +}; + + +status_t +arch_debug_get_instruction_pointer(debug_context *context, thread_id thread, + void **ip, void **stackFrameAddress) +{ + // get the CPU state +#warning M68K: TODO + return B_ERROR; +} + + +status_t +arch_debug_get_stack_frame(debug_context *context, void *stackFrameAddress, + debug_stack_frame_info *stackFrameInfo) +{ +#warning M68K: TODO + return B_ERROR; +} From aldeck at mail.berlios.de Wed Jun 11 03:47:50 2008 From: aldeck at mail.berlios.de (aldeck at BerliOS) Date: Wed, 11 Jun 2008 03:47:50 +0200 Subject: [Haiku-commits] r25923 - haiku/trunk/src/kits/media Message-ID: <200806110147.m5B1loNd021433@sheep.berlios.de> Author: aldeck Date: 2008-06-11 03:47:49 +0200 (Wed, 11 Jun 2008) New Revision: 25923 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25923&view=rev Modified: haiku/trunk/src/kits/media/DefaultMediaTheme.cpp Log: - MakeViewFor didn't return a view with a good default size when no hintRect was provided (as in Cortex). This happened only when needing a tabbed view. It will now return a view with the most fitting size. This fixes #597 Modified: haiku/trunk/src/kits/media/DefaultMediaTheme.cpp =================================================================== --- haiku/trunk/src/kits/media/DefaultMediaTheme.cpp 2008-06-11 01:26:02 UTC (rev 25922) +++ haiku/trunk/src/kits/media/DefaultMediaTheme.cpp 2008-06-11 01:47:49 UTC (rev 25923) @@ -697,8 +697,8 @@ BRect rect; if (hintRect) rect = *hintRect; - else - rect.Set(0, 0, 80, 100); + + BRect bestRect; // do we have more than one attached parameter group? // if so, use a tabbed view with a tab for each group @@ -737,9 +737,24 @@ return new DynamicScrollView(groupView->Name(), groupView); } - - tabView->AddTab(new DynamicScrollView(groupView->Name(), groupView)); + + DynamicScrollView *scrollView = new DynamicScrollView(groupView->Name(), groupView); + tabView->AddTab(scrollView); + + if (!hintRect) { + bestRect = bestRect | scrollView->Bounds(); + } } + + if (tabView != NULL) { + // this adjustment must be kept in sync with TabView::FrameResized + bestRect.bottom += tabView->TabHeight(); + bestRect.InsetBy(-3.0,-3.0); + + tabView->ResizeTo(bestRect.Width(), bestRect.Height()); + tabView->FrameResized(bestRect.Width(), bestRect.Height()); + //needed since we're not attached to a window yet + } return tabView; } From mmu_man at mail.berlios.de Wed Jun 11 03:50:34 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 11 Jun 2008 03:50:34 +0200 Subject: [Haiku-commits] r25924 - haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k Message-ID: <200806110150.m5B1oYYL021698@sheep.berlios.de> Author: mmu_man Date: 2008-06-11 03:50:30 +0200 (Wed, 11 Jun 2008) New Revision: 25924 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25924&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/pci_io.c Log: Fix include for pci. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/pci_io.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/pci_io.c 2008-06-11 01:47:49 UTC (rev 25923) +++ haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/pci_io.c 2008-06-11 01:50:30 UTC (rev 25924) @@ -5,7 +5,7 @@ #include "pci_io.h" -#include "pci_priv.h" +#include "pci_private.h" status_t From revol at free.fr Wed Jun 11 03:56:02 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Wed, 11 Jun 2008 03:56:02 +0200 CEST Subject: [Haiku-commits] r25923 - haiku/trunk/src/kits/media In-Reply-To: <200806110147.m5B1loNd021433@sheep.berlios.de> Message-ID: <30289569255-BeMail@laptop> > Author: aldeck > Date: 2008-06-11 03:47:49 +0200 (Wed, 11 Jun 2008) > New Revision: 25923 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25923&view=rev > > Modified: > haiku/trunk/src/kits/media/DefaultMediaTheme.cpp > Log: > - MakeViewFor didn't return a view with a good default size when no > hintRect > was provided (as > in Cortex). This happened only when needing a tabbed view. It will > now return > a view with the > most fitting size. This fixes #597 > Ah thanks, one less on my TODO list :) Fran?ois. From alex at zappotek.com Wed Jun 11 03:58:23 2008 From: alex at zappotek.com (Alexandre Deckner) Date: Wed, 11 Jun 2008 03:58:23 +0200 Subject: [Haiku-commits] r25923 - haiku/trunk/src/kits/media In-Reply-To: <30289569255-BeMail@laptop> References: <30289569255-BeMail@laptop> Message-ID: <484F313F.3090705@zappotek.com> Fran?ois Revol wrote: > > Ah thanks, one less on my TODO list :) > > > You're welcome :) From axeld at pinc-software.de Wed Jun 11 09:08:40 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 11 Jun 2008 09:08:40 +0200 CEST Subject: [Haiku-commits] r25923 - haiku/trunk/src/kits/media In-Reply-To: <200806110147.m5B1loNd021433@sheep.berlios.de> Message-ID: <474904244-BeMail@zon> aldeck at BerliOS wrote: > Log: > - MakeViewFor didn't return a view with a good default size when no > hintRect was provided (as > in Cortex). This happened only when needing a tabbed view. It will > now return a view with the > most fitting size. This fixes #597 You probably don't want to adapt the DefaultMediaTheme to use our layout kit, don't you? :-)) Bye, Axel. From stippi at mail.berlios.de Wed Jun 11 10:32:45 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 11 Jun 2008 10:32:45 +0200 Subject: [Haiku-commits] r25925 - haiku/trunk/src/add-ons/media/plugins/xvid_decoder Message-ID: <200806110832.m5B8WjRj024216@sheep.berlios.de> Author: stippi Date: 2008-06-11 10:32:44 +0200 (Wed, 11 Jun 2008) New Revision: 25925 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25925&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/Jamfile haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.cpp haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.h Log: * Move the global initialization of the xvid core to a static initializer, only the decoder structure is now initialized per instance, this should be better (thread safe). Modified: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/Jamfile =================================================================== --- haiku/trunk/src/add-ons/media/plugins/xvid_decoder/Jamfile 2008-06-11 01:50:30 UTC (rev 25924) +++ haiku/trunk/src/add-ons/media/plugins/xvid_decoder/Jamfile 2008-06-11 08:32:44 UTC (rev 25925) @@ -8,7 +8,7 @@ XvidDecoder.cpp supported_codecs.cpp : - libxvid.a + libxvidcore.a be libmedia.so ; Modified: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.cpp 2008-06-11 01:50:30 UTC (rev 25924) +++ haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.cpp 2008-06-11 08:32:44 UTC (rev 25925) @@ -378,7 +378,7 @@ PRINT(("%p->XvidDecoder: out_format=%s\n", this, buffer)); #endif - return _XvidInit(true, 0) == 0 ? B_OK : B_ERROR; + return _XvidInit() == 0 ? B_OK : B_ERROR; } @@ -622,22 +622,15 @@ // #pragma mark - -// _XvidInit -int -XvidDecoder::_XvidInit(int useAssembler, int debugLevel) +static bool +init_xvid(bool useAssembler, int debugLevel) { - if (fXvidDecoderHandle != NULL) - return 0; - + // XviD core initialization xvid_gbl_init_t xvidGlobalInit; - xvid_dec_create_t xvidDecoderCreate; // reset the structure with zeros memset(&xvidGlobalInit, 0, sizeof(xvid_gbl_init_t)); - memset(&xvidDecoderCreate, 0, sizeof(xvid_dec_create_t)); - // XviD core initialization - // version xvidGlobalInit.version = XVID_VERSION; @@ -647,12 +640,31 @@ else xvidGlobalInit.cpu_flags = XVID_CPU_FORCE; + // debug level xvidGlobalInit.debug = debugLevel; xvid_global(NULL, 0, &xvidGlobalInit, NULL); - // XviD encoder initialization + return true; +} + +static bool sXvidInitialized = init_xvid(true, 0); + + +// _XvidInit +int +XvidDecoder::_XvidInit() +{ + if (fXvidDecoderHandle != NULL) + return 0; + + // XviD decoder initialization + xvid_dec_create_t xvidDecoderCreate; + + // reset the structure with zeros + memset(&xvidDecoderCreate, 0, sizeof(xvid_dec_create_t)); + // version xvidDecoderCreate.version = XVID_VERSION; Modified: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.h 2008-06-11 01:50:30 UTC (rev 25924) +++ haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.h 2008-06-11 08:32:44 UTC (rev 25925) @@ -51,7 +51,7 @@ bigtime_t* _inOutTime); private: - int _XvidInit(int useAssembler, int debugLevel); + int _XvidInit(); int _XvidUninit(); int _XvidDecode(uchar *istream, uchar *ostream, From stippi at mail.berlios.de Wed Jun 11 10:37:00 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 11 Jun 2008 10:37:00 +0200 Subject: [Haiku-commits] r25926 - haiku/trunk/src/add-ons/media/plugins/xvid_decoder Message-ID: <200806110837.m5B8b0Qj025025@sheep.berlios.de> Author: stippi Date: 2008-06-11 10:37:00 +0200 (Wed, 11 Jun 2008) New Revision: 25926 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25926&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/supported_codecs.cpp Log: Updated supported codec table. Modified: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/supported_codecs.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/xvid_decoder/supported_codecs.cpp 2008-06-11 08:32:44 UTC (rev 25925) +++ haiku/trunk/src/add-ons/media/plugins/xvid_decoder/supported_codecs.cpp 2008-06-11 08:37:00 UTC (rev 25926) @@ -22,19 +22,24 @@ #include "supported_codecs.h" const struct codec_table_entry gCodecTable[] = { - {B_QUICKTIME_FORMAT_FAMILY, '3IV1', "3ivx Delta v1"}, - {B_QUICKTIME_FORMAT_FAMILY, '3IV2', "3ivx v2"}, +// {B_QUICKTIME_FORMAT_FAMILY, '3IV1', "3ivx Delta v1"}, +// {B_QUICKTIME_FORMAT_FAMILY, '3IV2', "3ivx v2"}, // [seems to works but corrupts memory] +// {B_QUICKTIME_FORMAT_FAMILY, '3IVX', "3ivx"}, {B_QUICKTIME_FORMAT_FAMILY, 'DIVX', "MPEG4 Video"}, // OpenDivX - {B_QUICKTIME_FORMAT_FAMILY, 'divx', "MPEG4 Video"}, // OpenDivX + {B_QUICKTIME_FORMAT_FAMILY, 'divx', "MPEG4 Video"}, // OpenDivX [confirmed] {B_QUICKTIME_FORMAT_FAMILY, 'mp4v', "MPEG4 Video"}, // OpenDivX - {B_QUICKTIME_FORMAT_FAMILY, 'XVID', "XVID"}, // OpenDivX + {B_QUICKTIME_FORMAT_FAMILY, 'XVID', "XVID"}, // OpenDivX [confirmed] +// {B_AVI_FORMAT_FAMILY, '3IV1', "3ivx Delta v1"}, +// {B_AVI_FORMAT_FAMILY, '3IV2', "3ivx v2"}, // [seems to works but corrupts memory] +// {B_AVI_FORMAT_FAMILY, '3IVX', "3ivx"}, + {B_AVI_FORMAT_FAMILY, 'DIVX', "MPEG4 Video"}, // OpenDivX {B_AVI_FORMAT_FAMILY, 'divx', "MPEG4 Video"}, // OpenDivX {B_AVI_FORMAT_FAMILY, 'XVID', "XVID"}, // XVID {B_AVI_FORMAT_FAMILY, 'xvid', "XVID"}, // XVID - {B_AVI_FORMAT_FAMILY, 'DX50', "DivX 5"}, // DivX 5.0 + {B_AVI_FORMAT_FAMILY, 'DX50', "DivX 5"}, // DivX 5.0 [confirmed] {B_AVI_FORMAT_FAMILY, 'dx50', "DivX 5"}, // DivX 5.0 {B_AVI_FORMAT_FAMILY, 'MP4S', "MPEG4 Video"}, // from ffmpeg @@ -63,7 +68,7 @@ // {B_AVI_FORMAT_FAMILY, 'MP41', "Microsoft MPEG4 v1"}, // microsoft mpeg4 v1 // {B_AVI_FORMAT_FAMILY, 'MP42', "Microsoft MPEG4 v2"}, // seems to be broken -// {B_AVI_FORMAT_FAMILY, 'MP43', "Microsoft MPEG4 v3"}, // microsoft mpeg4 v3 +// {B_AVI_FORMAT_FAMILY, 'MP43', "Microsoft MPEG4 v3"}, // microsoft mpeg4 v3 [confirmed unsupported] // {B_AVI_FORMAT_FAMILY, 'MPG3', "Microsoft MPEG4"}, // {B_AVI_FORMAT_FAMILY, 'MPG4', "Microsoft MPEG4"}, // {B_AVI_FORMAT_FAMILY, 'AP41', "Angel Potion MPEG4"}, // AngelPotion 1 From axeld at pinc-software.de Wed Jun 11 11:55:57 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 11 Jun 2008 11:55:57 +0200 CEST Subject: [Haiku-commits] r25920 - haiku/trunk/src/kits/support In-Reply-To: <200806110032.m5B0WqSw015133@sheep.berlios.de> Message-ID: <10511902012-BeMail@zon> anevilyak at BerliOS wrote: > Log: > Tracked down issue with previous commit. For some reason, modifying > the passed > in parameter's value directly results in a segfault in registrar, and > I cannot see why. > Thoughts? That doesn't really qualify as "tracked down", but rather as "worded around" - or did you mean thoughts about what this could be causing? ;- )) I would guess you best look at the component that triggers the problem, and see how that happens; it sounds like some case of stack/memory corruption we rather want to avoid. Bye, Axel. From anevilyak at gmail.com Wed Jun 11 14:25:18 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Wed, 11 Jun 2008 07:25:18 -0500 Subject: [Haiku-commits] r25920 - haiku/trunk/src/kits/support In-Reply-To: <10511902012-BeMail@zon> References: <200806110032.m5B0WqSw015133@sheep.berlios.de> <10511902012-BeMail@zon> Message-ID: On Wed, Jun 11, 2008 at 4:55 AM, Axel D?rfler wrote: > I would guess you best look at the component that triggers the problem, > and see how that happens; it sounds like some case of stack/memory > corruption we rather want to avoid. > Indeed, but I don't understand why putting one extra variable on the stack would avoid it. The problem is, the stack trace I get across serial doesn't actually give me the symbol names, only the library + offset, so I have no idea where in the registrar it's in fact crashing, only that it's crashing trying to access 0x45 or thereabouts. Any ideas? Regards, Rene From leavengood at gmail.com Wed Jun 11 16:09:50 2008 From: leavengood at gmail.com (Ryan Leavengood) Date: Wed, 11 Jun 2008 10:09:50 -0400 Subject: [Haiku-commits] r25923 - haiku/trunk/src/kits/media In-Reply-To: <474904244-BeMail@zon> References: <200806110147.m5B1loNd021433@sheep.berlios.de> <474904244-BeMail@zon> Message-ID: On Wed, Jun 11, 2008 at 3:08 AM, Axel D?rfler wrote: > > You probably don't want to adapt the DefaultMediaTheme to use our > layout kit, don't you? :-)) Hmmm, I might want to do that. I want to finish my long overdue layout article but I need a good example of "converting" some code from the old style to the layout system. This might be a good one. I will look into it. Ryan From ingo_weinhold at gmx.de Wed Jun 11 16:12:54 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 11 Jun 2008 16:12:54 +0200 Subject: [Haiku-commits] r25920 - haiku/trunk/src/kits/support In-Reply-To: References: <200806110032.m5B0WqSw015133@sheep.berlios.de> <10511902012-BeMail@zon> Message-ID: <20080611161254.511.1@knochen-vm.1213191225.fake> On 2008-06-11 at 14:25:18 [+0200], Rene Gollent wrote: > On Wed, Jun 11, 2008 at 4:55 AM, Axel D?rfler > wrote: > > I would guess you best look at the component that triggers the problem, > > and see how that happens; it sounds like some case of stack/memory > > corruption we rather want to avoid. > > > > Indeed, but I don't understand why putting one extra variable on the > stack would avoid it. The problem is, the stack trace I get across > serial doesn't actually give me the symbol names, only the library + > offset, so I have no idea where in the registrar it's in fact > crashing, only that it's crashing trying to access 0x45 or > thereabouts. Any ideas? You get the image-relative addresses in the stack trace. You can just look them up in an objdump of the respective libraries/executables. Looking into the objdump is something that's often helpful even if one gets symbols in the stack trace (particularly for bugs that aren't easily reproducible), since one can find out exactly at what line the crash happened and what pointer was invalid. Anyway, the bug is in BList::Resize(). In case of success fItemCount is set to count. Modifying count is obviously not a good idea. CU, Ingo From anevilyak at gmail.com Wed Jun 11 16:24:21 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Wed, 11 Jun 2008 09:24:21 -0500 Subject: [Haiku-commits] r25920 - haiku/trunk/src/kits/support In-Reply-To: <20080611161254.511.1@knochen-vm.1213191225.fake> References: <200806110032.m5B0WqSw015133@sheep.berlios.de> <10511902012-BeMail@zon> <20080611161254.511.1@knochen-vm.1213191225.fake> Message-ID: On Wed, Jun 11, 2008 at 9:12 AM, Ingo Weinhold wrote: > You get the image-relative addresses in the stack trace. You can just look > them up in an objdump of the respective libraries/executables. Looking into > the objdump is something that's often helpful even if one gets symbols in > the stack trace (particularly for bugs that aren't easily reproducible), > since one can find out exactly at what line the crash happened and what > pointer was invalid. > > Anyway, the bug is in BList::Resize(). In case of success fItemCount is set > to count. Modifying count is obviously not a good idea. > Ahh, good catch!. Though this does beg the question of whether it shouldn't fail the resize call if an invalid count is passed in. Regards, Rene From ingo_weinhold at gmx.de Wed Jun 11 16:15:27 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 11 Jun 2008 16:15:27 +0200 Subject: [Haiku-commits] r25920 - haiku/trunk/src/kits/support In-Reply-To: <200806110032.m5B0WqSw015133@sheep.berlios.de> References: <200806110032.m5B0WqSw015133@sheep.berlios.de> Message-ID: <20080611161527.540.2@knochen-vm.1213191225.fake> On 2008-06-11 at 02:32:52 [+0200], anevilyak at BerliOS wrote: [...] > @@ -174,7 +174,7 @@ > if (index >= 0 && index < fItemCount) { > item = fObjectList[index]; > move_items(fObjectList + index + 1, -1, fItemCount - index - 1); > - Resize(fItemCount - 1); > + Resize(fItemCount - 1); > } > return item; > } This is surely unintended. CU, Ingo From anevilyak at mail.berlios.de Wed Jun 11 16:29:59 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Wed, 11 Jun 2008 16:29:59 +0200 Subject: [Haiku-commits] r25927 - haiku/trunk/src/kits/support Message-ID: <200806111429.m5BETxSW014751@sheep.berlios.de> Author: anevilyak Date: 2008-06-11 16:29:59 +0200 (Wed, 11 Jun 2008) New Revision: 25927 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25927&view=rev Modified: haiku/trunk/src/kits/support/List.cpp Log: Remove (invalid) TODO note. Rename variable more meaningfully. Remove stray whitespace that crept into previous commit. Modified: haiku/trunk/src/kits/support/List.cpp =================================================================== --- haiku/trunk/src/kits/support/List.cpp 2008-06-11 08:37:00 UTC (rev 25926) +++ haiku/trunk/src/kits/support/List.cpp 2008-06-11 14:29:59 UTC (rev 25927) @@ -174,7 +174,7 @@ if (index >= 0 && index < fItemCount) { item = fObjectList[index]; move_items(fObjectList + index + 1, -1, fItemCount - index - 1); - Resize(fItemCount - 1); + Resize(fItemCount - 1); } return item; } @@ -437,14 +437,11 @@ // by doubling the existing size // until we can hold at least count items int32 newSize = fBlockSize; - // TODO: determine why modifying count directly via - // if (count <= 0) count = fBlockSize; - // results in this code segfaulting the registrar while using the local var 'c' does not. - int32 c = count; - if (c <= 0) - c = fBlockSize; - if ((size_t)c != fPhysicalSize) { - while (newSize < c) + int32 targetSize = count; + if (targetSize <= 0) + targetSize = fBlockSize; + if ((size_t)targetSize != fPhysicalSize) { + while (newSize < targetSize) newSize <<= 1; } From mmu_man at mail.berlios.de Wed Jun 11 16:59:41 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 11 Jun 2008 16:59:41 +0200 Subject: [Haiku-commits] r25928 - haiku/trunk/src/add-ons/media/media-add-ons/opensound Message-ID: <200806111459.m5BExfVg017879@sheep.berlios.de> Author: mmu_man Date: 2008-06-11 16:59:40 +0200 (Wed, 11 Jun 2008) New Revision: 25928 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25928&view=rev Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.h Log: Use 2KB buffers now, seems to work fine. Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.h =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.h 2008-06-11 14:29:59 UTC (rev 25927) +++ haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.h 2008-06-11 14:59:40 UTC (rev 25928) @@ -24,8 +24,8 @@ //#define DEFAULT_BUFFER_SIZE 2048 //#define DEFAULT_BUFFER_SIZE (32*1024) -#define DEFAULT_BUFFER_SIZE (16*1024) -//#define DEFAULT_BUFFER_SIZE (2*1024) +//#define DEFAULT_BUFFER_SIZE (16*1024) +#define DEFAULT_BUFFER_SIZE (2*1024) /* define to support encoded audio (AC3, MPEG, ...) when the card supports it */ //#define ENABLE_NON_RAW_SUPPORT 1 From alex at zappotek.com Wed Jun 11 17:25:34 2008 From: alex at zappotek.com (Alexandre Deckner) Date: Wed, 11 Jun 2008 17:25:34 +0200 Subject: [Haiku-commits] r25923 - haiku/trunk/src/kits/media In-Reply-To: <474904244-BeMail@zon> References: <474904244-BeMail@zon> Message-ID: <484FEE6E.6080707@zappotek.com> Axel D?rfler wrote: > > You probably don't want to adapt the DefaultMediaTheme to use our > layout kit, don't you? :-)) > > Hehe! That would be nice but i never took the time to familiarize with the new layout system! And as Ryan proposes to do it and write the doc too, i'll leave it to him :-) Go Ryan, go!! Regards, Alex From ingo_weinhold at gmx.de Wed Jun 11 17:23:46 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 11 Jun 2008 17:23:46 +0200 Subject: [Haiku-commits] r25920 - haiku/trunk/src/kits/support In-Reply-To: References: <200806110032.m5B0WqSw015133@sheep.berlios.de> <10511902012-BeMail@zon> <20080611161254.511.1@knochen-vm.1213191225.fake> Message-ID: <20080611172346.612.3@knochen-vm.1213191225.fake> On 2008-06-11 at 16:24:21 [+0200], Rene Gollent wrote: > On Wed, Jun 11, 2008 at 9:12 AM, Ingo Weinhold wrote: > > You get the image-relative addresses in the stack trace. You can just look > > them up in an objdump of the respective libraries/executables. Looking > > into > > the objdump is something that's often helpful even if one gets symbols in > > the stack trace (particularly for bugs that aren't easily reproducible), > > since one can find out exactly at what line the crash happened and what > > pointer was invalid. > > > > Anyway, the bug is in BList::Resize(). In case of success fItemCount is > > set > > to count. Modifying count is obviously not a good idea. > > > > Ahh, good catch!. Though this does beg the question of whether it > shouldn't fail the resize call if an invalid count is passed in. 0 is a perfectly valid count, though. CU, Ingo From anevilyak at gmail.com Wed Jun 11 17:29:26 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Wed, 11 Jun 2008 10:29:26 -0500 Subject: [Haiku-commits] r25920 - haiku/trunk/src/kits/support In-Reply-To: <20080611172346.612.3@knochen-vm.1213191225.fake> References: <200806110032.m5B0WqSw015133@sheep.berlios.de> <10511902012-BeMail@zon> <20080611161254.511.1@knochen-vm.1213191225.fake> <20080611172346.612.3@knochen-vm.1213191225.fake> Message-ID: On Wed, Jun 11, 2008 at 10:23 AM, Ingo Weinhold wrote: > > 0 is a perfectly valid count, though. > That is, though it might be worth guarding against a negative. Oh well, should work nicely as is now, and as far as I can tell the up/down resize behavior is correct. The only thing I'd consider tuning is that RemoveItem always tries to call Resize() even if the item count isn't close to the threshold where the array size gets halved. Not sure if that optimization is worthwhile or not though. Regards, Rene From anevilyak at gmail.com Wed Jun 11 17:32:49 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Wed, 11 Jun 2008 10:32:49 -0500 Subject: [Haiku-commits] r25920 - haiku/trunk/src/kits/support In-Reply-To: References: <200806110032.m5B0WqSw015133@sheep.berlios.de> <10511902012-BeMail@zon> <20080611161254.511.1@knochen-vm.1213191225.fake> <20080611172346.612.3@knochen-vm.1213191225.fake> Message-ID: On Wed, Jun 11, 2008 at 10:29 AM, Rene Gollent wrote: > On Wed, Jun 11, 2008 at 10:23 AM, Ingo Weinhold wrote: >> >> 0 is a perfectly valid count, though. >> > > That is, though it might be worth guarding against a negative. Oh > well, should work nicely as is now, and as far as I can tell the > up/down resize behavior is correct. The only thing I'd consider tuning > is that RemoveItem always tries to call Resize() even if the item > count isn't close to the threshold where the array size gets halved. > Not sure if that optimization is worthwhile or not though. That'd also mean factoring out how almost everything else relies on Resize() to update the item count, I might note, since right now it can't avoid calling Resize() because of that also. Regards, Rene From ingo_weinhold at gmx.de Wed Jun 11 17:58:04 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 11 Jun 2008 17:58:04 +0200 Subject: [Haiku-commits] r25920 - haiku/trunk/src/kits/support In-Reply-To: References: <200806110032.m5B0WqSw015133@sheep.berlios.de> <10511902012-BeMail@zon> <20080611161254.511.1@knochen-vm.1213191225.fake> <20080611172346.612.3@knochen-vm.1213191225.fake> Message-ID: <20080611175804.696.4@knochen-vm.1213191225.fake> On 2008-06-11 at 17:32:49 [+0200], Rene Gollent wrote: > On Wed, Jun 11, 2008 at 10:29 AM, Rene Gollent wrote: > > On Wed, Jun 11, 2008 at 10:23 AM, Ingo Weinhold > > wrote: > >> > >> 0 is a perfectly valid count, though. > >> > > > > That is, though it might be worth guarding against a negative. Oh > > well, should work nicely as is now, and as far as I can tell the > > up/down resize behavior is correct. The only thing I'd consider tuning > > is that RemoveItem always tries to call Resize() even if the item > > count isn't close to the threshold where the array size gets halved. > > Not sure if that optimization is worthwhile or not though. > > That'd also mean factoring out how almost everything else relies on > Resize() to update the item count, I might note, since right now it > can't avoid calling Resize() because of that also. Calling Resize() only when necessary seems to be a reasonable optimization for method like RemoveItem() that is called relatively often. You can use a reserved field to cache the lower bounds for resizing. CU, Ingo From anevilyak at gmail.com Wed Jun 11 18:03:25 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Wed, 11 Jun 2008 11:03:25 -0500 Subject: [Haiku-commits] r25920 - haiku/trunk/src/kits/support In-Reply-To: <20080611175804.696.4@knochen-vm.1213191225.fake> References: <200806110032.m5B0WqSw015133@sheep.berlios.de> <10511902012-BeMail@zon> <20080611161254.511.1@knochen-vm.1213191225.fake> <20080611172346.612.3@knochen-vm.1213191225.fake> <20080611175804.696.4@knochen-vm.1213191225.fake> Message-ID: On Wed, Jun 11, 2008 at 10:58 AM, Ingo Weinhold wrote: > > Calling Resize() only when necessary seems to be a reasonable optimization > for method like RemoveItem() that is called relatively often. You can use a > reserved field to cache the lower bounds for resizing. > Shouldn't really need a reserved field for it, since the lower bound will always be fItemCount <= fPhysicalSize / 2 with the new resize approach. I'll just need to update some other places so they don't have to call Resize just to change the item count, since that seems a bit counterintuitive anyways. Regards, Rene From ingo_weinhold at gmx.de Wed Jun 11 18:20:22 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 11 Jun 2008 18:20:22 +0200 Subject: [Haiku-commits] r25920 - haiku/trunk/src/kits/support In-Reply-To: References: <200806110032.m5B0WqSw015133@sheep.berlios.de> <10511902012-BeMail@zon> <20080611161254.511.1@knochen-vm.1213191225.fake> <20080611172346.612.3@knochen-vm.1213191225.fake> <20080611175804.696.4@knochen-vm.1213191225.fake> Message-ID: <20080611182022.760.5@knochen-vm.1213191225.fake> On 2008-06-11 at 18:03:25 [+0200], Rene Gollent wrote: > On Wed, Jun 11, 2008 at 10:58 AM, Ingo Weinhold > wrote: > > > > Calling Resize() only when necessary seems to be a reasonable optimization > > for method like RemoveItem() that is called relatively often. You can use > > a > > reserved field to cache the lower bounds for resizing. > > Shouldn't really need a reserved field for it, since the lower bound > will always be fItemCount <= fPhysicalSize / 2 with the new resize > approach. I should think it's 0 for fItemCount < fBlockSize, no? > I'll just need to update some other places so they don't > have to call Resize just to change the item count, since that seems a > bit counterintuitive anyways. I actually don't find it that counterintuitive. Resize() resizes the list to the given size. The underlying array is resized if necessary. Maybe I'm a bit biased, since it was probably me who wrote it that way in the first place, but that was like six years ago, so that doesn't really count I suppose. :-) CU, Ingo From ingo_weinhold at gmx.de Wed Jun 11 18:26:53 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 11 Jun 2008 18:26:53 +0200 Subject: [Haiku-commits] r25920 - haiku/trunk/src/kits/support In-Reply-To: <20080611182022.760.5@knochen-vm.1213191225.fake> References: <200806110032.m5B0WqSw015133@sheep.berlios.de> <10511902012-BeMail@zon> <20080611161254.511.1@knochen-vm.1213191225.fake> <20080611172346.612.3@knochen-vm.1213191225.fake> <20080611175804.696.4@knochen-vm.1213191225.fake> <20080611182022.760.5@knochen-vm.1213191225.fake> Message-ID: <20080611182653.799.6@knochen-vm.1213191225.fake> On 2008-06-11 at 18:20:22 [+0200], Ingo Weinhold wrote: > On 2008-06-11 at 18:03:25 [+0200], Rene Gollent wrote: > > On Wed, Jun 11, 2008 at 10:58 AM, Ingo Weinhold > > wrote: > > > > > > Calling Resize() only when necessary seems to be a reasonable > > > optimization > > > for method like RemoveItem() that is called relatively often. You can > > > use > > > a > > > reserved field to cache the lower bounds for resizing. > > > > Shouldn't really need a reserved field for it, since the lower bound > > will always be fItemCount <= fPhysicalSize / 2 with the new resize > > approach. > > I should think it's 0 for fItemCount < fBlockSize, no? > > > I'll just need to update some other places so they don't > > have to call Resize just to change the item count, since that seems a > > bit counterintuitive anyways. > > I actually don't find it that counterintuitive. Resize() resizes the list to > the given size. The underlying array is resized if necessary. Maybe I'm a > bit > biased, since it was probably me who wrote it that way in the first place, > but that was like six years ago, so that doesn't really count I suppose. :-) Just to avoid misunderstandings: Feel free to change it as you proposed anyway. I'd recommend renaming Resize() then, though (to _ResizeArray() maybe). Since it's private, it should be renamed anyway. CU, Ingo From anevilyak at gmail.com Wed Jun 11 18:31:24 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Wed, 11 Jun 2008 11:31:24 -0500 Subject: [Haiku-commits] r25920 - haiku/trunk/src/kits/support In-Reply-To: <20080611182022.760.5@knochen-vm.1213191225.fake> References: <200806110032.m5B0WqSw015133@sheep.berlios.de> <20080611161254.511.1@knochen-vm.1213191225.fake> <20080611172346.612.3@knochen-vm.1213191225.fake> <20080611175804.696.4@knochen-vm.1213191225.fake> <20080611182022.760.5@knochen-vm.1213191225.fake> Message-ID: On Wed, Jun 11, 2008 at 11:20 AM, Ingo Weinhold wrote: > I should think it's 0 for fItemCount < fBlockSize, no? That's true, good point, will take that into account. > I actually don't find it that counterintuitive. Resize() resizes the list to > the given size. The underlying array is resized if necessary. Maybe I'm a bit > biased, since it was probably me who wrote it that way in the first place, > but that was like six years ago, so that doesn't really count I suppose. :-) > The part that I mostly find counterintuitive is that some of the other methods (such as RemoveItem) rely on Resize to update the active item count even if no actual array resize took place. Regards, Rene From ingo_weinhold at gmx.de Wed Jun 11 18:39:21 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 11 Jun 2008 18:39:21 +0200 Subject: [Haiku-commits] r25920 - haiku/trunk/src/kits/support In-Reply-To: References: <200806110032.m5B0WqSw015133@sheep.berlios.de> <20080611161254.511.1@knochen-vm.1213191225.fake> <20080611172346.612.3@knochen-vm.1213191225.fake> <20080611175804.696.4@knochen-vm.1213191225.fake> <20080611182022.760.5@knochen-vm.1213191225.fake> Message-ID: <20080611183921.835.7@knochen-vm.1213191225.fake> On 2008-06-11 at 18:31:24 [+0200], Rene Gollent wrote: > On Wed, Jun 11, 2008 at 11:20 AM, Ingo Weinhold > wrote: > > I should think it's 0 for fItemCount < fBlockSize, no? > > That's true, good point, will take that into account. > > > I actually don't find it that counterintuitive. Resize() resizes the list > > to > > the given size. The underlying array is resized if necessary. Maybe I'm a > > bit > > biased, since it was probably me who wrote it that way in the first place, > > but that was like six years ago, so that doesn't really count I suppose. > > :-) > > The part that I mostly find counterintuitive is that some of the other > methods (such as RemoveItem) rely on Resize to update the active item > count even if no actual array resize took place. That's what I was trying to say, the method resizes the list (hence its name). The array is resized only as a side effect, so to speak. CU, Ingo From anevilyak at gmail.com Wed Jun 11 18:44:40 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Wed, 11 Jun 2008 11:44:40 -0500 Subject: [Haiku-commits] r25920 - haiku/trunk/src/kits/support In-Reply-To: <20080611183921.835.7@knochen-vm.1213191225.fake> References: <200806110032.m5B0WqSw015133@sheep.berlios.de> <20080611172346.612.3@knochen-vm.1213191225.fake> <20080611175804.696.4@knochen-vm.1213191225.fake> <20080611182022.760.5@knochen-vm.1213191225.fake> <20080611183921.835.7@knochen-vm.1213191225.fake> Message-ID: On Wed, Jun 11, 2008 at 11:39 AM, Ingo Weinhold wrote: > > That's what I was trying to say, the method resizes the list (hence its > name). The array is resized only as a side effect, so to speak. > Ahh. Ok that makes more sense :) Will see what I can get done tonight. Regards, Rene From rudolfc at mail.berlios.de Wed Jun 11 20:14:18 2008 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Wed, 11 Jun 2008 20:14:18 +0200 Subject: [Haiku-commits] r25929 - in haiku/trunk: headers/private/graphics/nvidia_gpgpu src/add-ons/accelerants/nvidia_gpgpu src/add-ons/accelerants/nvidia_gpgpu/engine src/add-ons/kernel/drivers/graphics/nvidia_gpgpu Message-ID: <200806111814.m5BIEI5I027684@sheep.berlios.de> Author: rudolfc Date: 2008-06-11 20:14:15 +0200 (Wed, 11 Jun 2008) New Revision: 25929 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25929&view=rev Removed: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_brooktreetv.c Modified: haiku/trunk/headers/private/graphics/nvidia_gpgpu/DriverInterface.h haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/InitAccelerant.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/ProposeDisplayMode.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/SetDisplayMode.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/Jamfile haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_acc_dma.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_crtc.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_crtc2.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_general.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_globals.h haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_info.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_proto.h haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/driver.c haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/nvidia_gpgpu.settings Log: removed all pre-NV20 refs, removed all TVout stuff except clearing some flags, re-enabled force_ws option, force_ws is now default true, pgm_panel is now default false. Modified: haiku/trunk/headers/private/graphics/nvidia_gpgpu/DriverInterface.h =================================================================== --- haiku/trunk/headers/private/graphics/nvidia_gpgpu/DriverInterface.h 2008-06-11 14:59:40 UTC (rev 25928) +++ haiku/trunk/headers/private/graphics/nvidia_gpgpu/DriverInterface.h 2008-06-11 18:14:15 UTC (rev 25929) @@ -73,18 +73,6 @@ /* card_type in order of date of NV chip design */ enum { - NV04 = 0, - NV05, - NV05M64, - NV06, - NV10, - NV11, - NV11M, - NV15, - NV17, - NV17M, - NV18, - NV18M, NV20, NV25, NV28, @@ -118,27 +106,6 @@ NV50A }; -/* card info - information gathered from PINS (and other sources) */ -enum -{ // tv_encoder_type in order of capability (more or less) - NONE = 0, - CH7003, - CH7004, - CH7005, - CH7006, - CH7007, - CH7008, - SAA7102, - SAA7103, - SAA7104, - SAA7105, - BT868, - BT869, - CX25870, - CX25871, - NVIDIA -}; - /* handles to pre-defined engine commands */ #define NV_ROP5_SOLID 0x00000000 /* 2D */ #define NV_IMAGE_BLACK_RECTANGLE 0x00000001 /* 2D/3D */ @@ -214,12 +181,10 @@ // for accelerant uint32 logmask; uint32 memory; - uint32 tv_output; bool usebios; bool hardcursor; bool switchhead; bool pgm_panel; - bool vga_on_tv; bool force_sync; bool force_ws; uint32 gpu_clk; @@ -287,7 +252,6 @@ display_mode dm; /* current display mode configuration: head1 */ uint32 dpms_flags; /* current DPMS mode */ bool acc_mode; /* signals (non)accelerated mode */ - bool interlaced_tv_mode;/* signals interlaced CRTC TV output mode */ bool crtc_switch_mode; /* signals dualhead switch mode if panels are used */ /*frame buffer config - for BDirectScreen*/ @@ -343,13 +307,6 @@ bool i2c_bus1; /* we have a wired I2C bus 1 on board */ bool i2c_bus2; /* we have a wired I2C bus 2 on board */ bool i2c_bus3; /* we have a wired I2C bus 3 on board */ - struct - { - uint32 type; /* see tvchip_type enum above */ - uint8 version; /* chip silicon version */ - uint8 bus; /* I2C bus on which TVout chip resides */ - uint8 adress; /* I2C adress on which TVout chip resides */ - } tv_encoder; uint8 monitors; /* output devices connection matrix */ bool int_assigned; /* card has a useable INT assigned to it */ status_t pins_status; /* B_OK if read correctly, B_ERROR if faked */ @@ -378,7 +335,6 @@ uint32 max_dac2_clock_32; uint32 max_dac2_clock_32dh; bool secondary_head; /* presence of functions */ - bool tvout; bool primary_dvi; bool secondary_dvi; uint32 memory_size; /* memory (in bytes) */ Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/InitAccelerant.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/InitAccelerant.c 2008-06-11 14:59:40 UTC (rev 25928) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/InitAccelerant.c 2008-06-11 18:14:15 UTC (rev 25929) @@ -40,8 +40,8 @@ // LOG is now available, si !NULL LOG(4,("init_common: logmask 0x%08x, memory %dMB, hardcursor %d, usebios %d, switchhead %d\n", si->settings.logmask, si->settings.memory, si->settings.hardcursor, si->settings.usebios, si->settings.switchhead)); - LOG(4,("init_common: dumprom %d, pgm_panel %d, tv_output %d, vga_on_tv %d\n", - si->settings.dumprom, si->settings.pgm_panel, si->settings.tv_output, si->settings.vga_on_tv)); + LOG(4,("init_common: dumprom %d, pgm_panel %d\n", + si->settings.dumprom, si->settings.pgm_panel)); LOG(4,("init_common: force_sync %d, gpu_clk %dMhz, ram_clk %dMhz, force_ws %d\n", si->settings.force_sync, si->settings.gpu_clk, si->settings.ram_clk, si->settings.force_ws)); @@ -202,11 +202,6 @@ /* ensure DPMS state */ si->dpms_flags = B_DPMS_ON; - /* ensure TVout state: - * TVencoder is on head to be assigned primary, no dualhead switch mode active. */ - //fixme: actually check on what CRTC TVout was active during boot (if any)... - si->dm.flags = TV_PRIMARY; - /* make sure a possible 3D add-on will block rendering and re-initialize itself. * note: update in _this_ order only */ /* SET_DISPLAY_MODE will reset this flag when it's done. */ Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/ProposeDisplayMode.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/ProposeDisplayMode.c 2008-06-11 14:59:40 UTC (rev 25928) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/ProposeDisplayMode.c 2008-06-11 18:14:15 UTC (rev 25929) @@ -4,7 +4,7 @@ Other authors for NV driver: Mark Watson, - Rudolf Cornelissen 9/2002-4/2006 + Rudolf Cornelissen 9/2002-6/2008 */ #define MODULE_BIT 0x00400000 @@ -188,69 +188,60 @@ return result; } - /* disable aspect checks for a requested TVout mode when mode is TVout capable */ - if (!si->ps.tvout - || !(BT_check_tvmode(*target) && (target->flags & TV_BITS))) { - /* check if all connected output devices can display the requested mode's aspect: */ - /* calculate display mode aspect */ - target_aspect = (target->timing.h_display / ((float)target->timing.v_display)); - /* NOTE: - * allow 0.10 difference so 5:4 aspect panels will be able to use 4:3 aspect modes! */ - switch (si->ps.monitors) { - case 0x01: /* digital panel on head 1, nothing on head 2 */ - if (si->ps.panel1_aspect < (target_aspect - 0.10)) { - LOG(4, ("PROPOSEMODE: connected panel1 is not widescreen type, aborted.\n")); - return B_ERROR; - } - break; - case 0x10: /* nothing on head 1, digital panel on head 2 */ - if (si->ps.panel2_aspect < (target_aspect - 0.10)) { - LOG(4, ("PROPOSEMODE: connected panel2 is not widescreen type, aborted.\n")); - return B_ERROR; - } - break; - case 0x11: /* digital panels on both heads */ - if ((si->ps.panel1_aspect < (target_aspect - 0.10)) - || (si->ps.panel2_aspect < (target_aspect - 0.10))) { - LOG(4, ("PROPOSEMODE: not all connected panels are widescreen type, aborted.\n")); - return B_ERROR; - } - break; - default: -#if 0 - /* at least one analog monitor is connected, or nothing detected at all */ - /* (if forcing widescreen type was requested don't block mode) */ - if (target_aspect > 1.34 && !si->settings.force_ws) { - LOG(4, ("PROPOSEMODE: not all output devices can display widescreen modes, aborted.\n")); - return B_ERROR; - } -#endif - break; - } - -// Wide screen modes are pretty common these days... - better use EDID! -#if 0 - /* only export widescreen panel-TV modes when an exact resolution match exists, - * to prevent the modelist from becoming too crowded */ - if (target_aspect > 1.61 && !si->settings.force_ws) { - status_t panel_TV_stat = B_ERROR; - - if (si->ps.tmds1_active) { - if (target->timing.h_display == si->ps.p1_timing.h_display - && target->timing.v_display == si->ps.p1_timing.v_display) - panel_TV_stat = B_OK; + /* check if all connected output devices can display the requested mode's aspect: */ + /* calculate display mode aspect */ + target_aspect = (target->timing.h_display / ((float)target->timing.v_display)); + /* NOTE: + * allow 0.10 difference so 5:4 aspect panels will be able to use 4:3 aspect modes! */ + switch (si->ps.monitors) { + case 0x01: /* digital panel on head 1, nothing on head 2 */ + if (si->ps.panel1_aspect < (target_aspect - 0.10)) { + LOG(4, ("PROPOSEMODE: connected panel1 is not widescreen type, aborted.\n")); + return B_ERROR; } - if (si->ps.tmds2_active) { - if (target->timing.h_display == si->ps.p2_timing.h_display - && target->timing.v_display == si->ps.p2_timing.v_display) - panel_TV_stat = B_OK; + break; + case 0x10: /* nothing on head 1, digital panel on head 2 */ + if (si->ps.panel2_aspect < (target_aspect - 0.10)) { + LOG(4, ("PROPOSEMODE: connected panel2 is not widescreen type, aborted.\n")); + return B_ERROR; } - if (panel_TV_stat != B_OK) { - LOG(4, ("PROPOSEMODE: WS panel_TV mode requested but no such TV here, aborted.\n")); + break; + case 0x11: /* digital panels on both heads */ + if ((si->ps.panel1_aspect < (target_aspect - 0.10)) + || (si->ps.panel2_aspect < (target_aspect - 0.10))) { + LOG(4, ("PROPOSEMODE: not all connected panels are widescreen type, aborted.\n")); return B_ERROR; } + break; + default: + /* at least one analog monitor is connected, or nothing detected at all */ + /* (if forcing widescreen type was requested don't block mode) */ + if (target_aspect > 1.34 && !si->settings.force_ws) { + LOG(4, ("PROPOSEMODE: not all output devices can display widescreen modes, aborted.\n")); + return B_ERROR; + } + break; + } + + /* only export widescreen panel-TV modes when an exact resolution match exists, + * to prevent the modelist from becoming too crowded */ + if (target_aspect > 1.61 && !si->settings.force_ws) { + status_t panel_TV_stat = B_ERROR; + + if (si->ps.tmds1_active) { + if (target->timing.h_display == si->ps.p1_timing.h_display + && target->timing.v_display == si->ps.p1_timing.v_display) + panel_TV_stat = B_OK; } -#endif + if (si->ps.tmds2_active) { + if (target->timing.h_display == si->ps.p2_timing.h_display + && target->timing.v_display == si->ps.p2_timing.v_display) + panel_TV_stat = B_OK; + } + if (panel_TV_stat != B_OK) { + LOG(4, ("PROPOSEMODE: WS panel_TV mode requested but no such TV here, aborted.\n")); + return B_ERROR; + } } /* check if panel(s) can display the requested resolution (if connected) */ @@ -444,23 +435,10 @@ if (!(target->flags & DUALHEAD_CAPABLE)) target->flags &= ~DUALHEAD_BITS; - /* set TV_CAPABLE if suitable: pixelclock is not important (defined by TVstandard) */ - if (si->ps.tvout && BT_check_tvmode(*target)) - target->flags |= TV_CAPABLE; - /* if not TVout capable card clear TVout flags */ if (!(target->flags & TV_CAPABLE)) target->flags &= ~TV_BITS; - /* make sure TV head assignment is sane */ - if (target->flags & TV_BITS) { - if (!si->ps.secondary_head) - target->flags |= TV_PRIMARY; - else if ((target->flags & DUALHEAD_BITS) == DUALHEAD_OFF) - target->flags |= TV_PRIMARY; - } else - target->flags &= ~TV_PRIMARY; - /* set HARDWARE_CURSOR mode if suitable */ if (si->settings.hardcursor) target->flags |= B_HARDWARE_CURSOR; Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/SetDisplayMode.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/SetDisplayMode.c 2008-06-11 14:59:40 UTC (rev 25928) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/SetDisplayMode.c 2008-06-11 18:14:15 UTC (rev 25929) @@ -62,13 +62,9 @@ // head1_interrupt_enable(false); // if (si->ps.secondary_head) head2_interrupt_enable(false); - /* disable TVout if supported */ -// if (si->ps.tvout) BT_stop_tvout(); - - /* turn off screen(s) _after_ TVout is disabled (if applicable) */ + /* turn off screen(s) */ // head1_dpms(false, false, false, true); // if (si->ps.secondary_head) head2_dpms(false, false, false, true); -// if (si->ps.tvout) BT_dpms(false); /*where in framebuffer the screen is (should this be dependant on previous MOVEDISPLAY?)*/ startadd = (uint8*)si->fbc.frame_buffer - (uint8*)si->framebuffer; @@ -86,15 +82,6 @@ LOG(1,("SETMODE: setting DUALHEAD mode\n")); - /* validate flags for secondary TVout */ - //fixme: remove or block on autodetect fail. (is now shutoff) - if ((0) && (target2.flags & TV_BITS)) - { - target.flags &= ~TV_BITS;//still needed for some routines... - target2.flags &= ~TV_BITS; - LOG(1,("SETMODE: blocking TVout: no TVout cable connected!\n")); - } - /* detect which connectors have a CRT connected */ //fixme: 'hot-plugging' for analog monitors removed: remove code as well; //or make it work with digital panels connected as well. @@ -180,10 +167,6 @@ break; } - /* check if we are doing interlaced TVout mode */ - //fixme: we don't support interlaced mode? - si->interlaced_tv_mode = false; - /*set the display(s) pitches*/ // head1_set_display_pitch (); //fixme: seperate for real dualhead modes: @@ -210,9 +193,6 @@ /* set the timing */ // head1_set_timing(target); // head2_set_timing(target2); - - /* TVout support: program TVout encoder and modify CRTC timing */ -// if (si->ps.tvout && (target2.flags & TV_BITS)) BT_setmode(target2); } else /* single head mode */ { @@ -275,9 +255,6 @@ /* set the timing */ // head1_set_timing(target); - /* TVout support: program TVout encoder and modify CRTC timing */ -// if (si->ps.tvout && (target.flags & TV_BITS)) BT_setmode(target); - //fixme: shut-off the videoPLL if it exists... } @@ -493,100 +470,10 @@ return B_ERROR; } - /* CRTC used for TVout needs specific DPMS programming */ - if (si->dm.flags & TV_BITS) - { - /* TV_PRIMARY tells us that the head to be used with TVout is the head that's - * actually assigned as being the primary head at powerup: - * so non dualhead-mode-dependant, and not 'fixed' CRTC1! */ - if (si->dm.flags & TV_PRIMARY) - { - LOG(4,("SET_DPMS_MODE: tuning primary head DPMS settings for TVout compatibility\n")); - - if ((si->dm.flags & DUALHEAD_BITS) != DUALHEAD_SWITCH) - { - if (!(si->settings.vga_on_tv)) - { - /* block VGA output on head displaying on TV */ - /* Note: - * this specific sync setting is required: Vsync is used to keep TVout - * synchronized to the CRTC 'vertically' (otherwise 'rolling' occurs). - * This leaves Hsync only for shutting off the VGA screen. */ - h1h = false; - h1v = true; - /* block panel DPMS updates */ - do_p1 = false; - } - else - { - /* when concurrent VGA is used alongside TVout on a head, DPMS is safest - * applied this way: Vsync is needed for stopping TVout successfully when - * a (new) modeswitch occurs. - * (see routine BT_stop_tvout() in nv_brooktreetv.c) */ - /* Note: - * applying 'normal' DPMS here and forcing Vsync on in the above mentioned - * routine seems to not always be enough: sometimes image generation will - * not resume in that case. */ - h1h = display; - h1v = true; - } - } - else - { - if (!(si->settings.vga_on_tv)) - { - h2h = false; - h2v = true; - do_p2 = false; - } - else - { - h2h = display; - h2v = true; - } - } - } - else - { - LOG(4,("SET_DPMS_MODE: tuning secondary head DPMS settings for TVout compatibility\n")); - - if ((si->dm.flags & DUALHEAD_BITS) != DUALHEAD_SWITCH) - { - if (!(si->settings.vga_on_tv)) - { - h2h = false; - h2v = true; - do_p2 = false; - } - else - { - h2h = display; - h2v = true; - } - } - else - { - if (!(si->settings.vga_on_tv)) - { - h1h = false; - h1v = true; - do_p1 = false; - } - else - { - h1h = display; - h1v = true; - } - } - } - } - /* issue actual DPMS commands as far as applicable */ head1_dpms(display, h1h, h1v, do_p1); if ((si->ps.secondary_head) && (si->dm.flags & DUALHEAD_BITS)) head2_dpms(display, h2h, h2v, do_p2); - if (si->dm.flags & TV_BITS) - BT_dpms(display); //fixme: //add head2 once we use one driver instance 'per head' (instead of 'per card') Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/Jamfile =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/Jamfile 2008-06-11 14:59:40 UTC (rev 25928) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/Jamfile 2008-06-11 18:14:15 UTC (rev 25929) @@ -8,7 +8,6 @@ StaticLibrary libnvidia_gpgpu_engine.a : nv_acc_dma.c nv_bes.c - nv_brooktreetv.c nv_crtc.c nv_crtc2.c nv_dac.c Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_acc_dma.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_acc_dma.c 2008-06-11 14:59:40 UTC (rev 25928) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_acc_dma.c 2008-06-11 18:14:15 UTC (rev 25929) @@ -1,7 +1,7 @@ /* NV Acceleration functions */ /* Author: - Rudolf Cornelissen 8/2003-9/2007. + Rudolf Cornelissen 8/2003-6/2008. This code was possible thanks to: - the Linux XFree86 NV driver, @@ -270,14 +270,6 @@ ACCW(HT_HANDL_13, (0x80000000 | NV_SCALED_IMAGE_FROM_MEMORY)); /* 32bit handle */ ACCW(HT_VALUE_13, 0x8001114b); /* instance $114b, engine = acc engine, CHID = $00 */ - - //2007 3D tests.. - if (si->ps.card_type == NV15) - { - ACCW(HT_HANDL_14, (0x80000000 | NV_TCL_PRIMITIVE_3D)); /* 32bit handle */ - ACCW(HT_VALUE_14, 0x8001114d); /* instance $114d, engine = acc engine, CHID = $00 */ - } - } /* program CTX registers: CTX1 is mostly done later (colorspace dependant) */ @@ -359,202 +351,7 @@ * table is located at end of cardRAM (b12-31): * It's adress needs to be at a 4kb boundary! */ } - else - { - /* setup a DMA define for use by command defines below. */ - ACCW(PR_CTX0_R, 0x00003000); /* DMA page table present and of linear type; - * DMA target node is NVM (non-volatile memory?) - * (instead of doing PCI or AGP transfers) */ - ACCW(PR_CTX1_R, (si->ps.memory_size - 1)); /* DMA limit: size is all cardRAM */ - ACCW(PR_CTX2_R, ((0x00000000 & 0xfffff000) | 0x00000002)); - /* DMA access type is READ_AND_WRITE; - * memory starts at start of cardRAM (b12-31): - * It's adress needs to be at a 4kb boundary! */ - ACCW(PR_CTX3_R, 0x00000002); /* unknown (looks like this is rubbish/not needed?) */ - /* setup set '0' for cmd NV_ROP5_SOLID */ - ACCW(PR_CTX0_0, 0x01008043); /* NVclass $043, patchcfg ROP_AND, nv10+: little endian */ - ACCW(PR_CTX1_0, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ - ACCW(PR_CTX2_0, 0x00000000); /* DMA0 and DMA1 instance invalid */ - ACCW(PR_CTX3_0, 0x00000000); /* method traps disabled */ - /* setup set '1' for cmd NV_IMAGE_BLACK_RECTANGLE */ - ACCW(PR_CTX0_1, 0x01008019); /* NVclass $019, patchcfg ROP_AND, nv10+: little endian */ - ACCW(PR_CTX1_1, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ - ACCW(PR_CTX2_1, 0x00000000); /* DMA0 and DMA1 instance invalid */ - ACCW(PR_CTX3_1, 0x00000000); /* method traps disabled */ - /* setup set '2' for cmd NV_IMAGE_PATTERN */ - ACCW(PR_CTX0_2, 0x01008018); /* NVclass $018, patchcfg ROP_AND, nv10+: little endian */ - ACCW(PR_CTX1_2, 0x00000002); /* colorspace not set, notify instance is $0200 (b16-31) */ - ACCW(PR_CTX2_2, 0x00000000); /* DMA0 and DMA1 instance invalid */ - ACCW(PR_CTX3_2, 0x00000000); /* method traps disabled */ - /* setup set '3' for ... */ - if(si->ps.card_arch >= NV10A) - { - /* ... cmd NV10_CONTEXT_SURFACES_2D */ - ACCW(PR_CTX0_3, 0x01008062); /* NVclass $062, nv10+: little endian */ - } - else - { - /* ... cmd NV4_SURFACE */ - ACCW(PR_CTX0_3, 0x01008042); /* NVclass $042, nv10+: little endian */ - } - ACCW(PR_CTX1_3, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ - ACCW(PR_CTX2_3, 0x11401140); /* DMA0 instance is $1140, DMA1 instance invalid */ - ACCW(PR_CTX3_3, 0x00000000); /* method trap 0 is $1140, trap 1 disabled */ - /* setup set '4' for ... */ - if (si->ps.card_type >= NV11) - { - /* ... cmd NV12_IMAGE_BLIT */ - ACCW(PR_CTX0_4, 0x0100809f); /* NVclass $09f, patchcfg ROP_AND, nv10+: little endian */ - } - else - { - /* ... cmd NV_IMAGE_BLIT */ - ACCW(PR_CTX0_4, 0x0100805f); /* NVclass $05f, patchcfg ROP_AND, nv10+: little endian */ - } - ACCW(PR_CTX1_4, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ - ACCW(PR_CTX2_4, 0x11401140); /* DMA0 instance is $1140, DMA1 instance invalid */ - ACCW(PR_CTX3_4, 0x00000000); /* method trap 0 is $1140, trap 1 disabled */ - /* setup set '5' for cmd NV4_GDI_RECTANGLE_TEXT */ - ACCW(PR_CTX0_5, 0x0100804a); /* NVclass $04a, patchcfg ROP_AND, nv10+: little endian */ - ACCW(PR_CTX1_5, 0x00000002); /* colorspace not set, notify instance is $0200 (b16-31) */ - ACCW(PR_CTX2_5, 0x00000000); /* DMA0 and DMA1 instance invalid */ - ACCW(PR_CTX3_5, 0x00000000); /* method traps disabled */ - /* setup set '6' ... */ - if (si->ps.card_arch >= NV10A) - { - /* ... for cmd NV10_CONTEXT_SURFACES_ARGB_ZS */ - ACCW(PR_CTX0_6, 0x00000093); /* NVclass $093, nv10+: little endian */ - } - else - { - /* ... for cmd NV4_CONTEXT_SURFACES_ARGB_ZS */ - ACCW(PR_CTX0_6, 0x00000053); /* NVclass $053, nv10+: little endian */ - } - ACCW(PR_CTX1_6, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ - ACCW(PR_CTX2_6, 0x11401140); /* DMA0, DMA1 instance = $1140 */ - ACCW(PR_CTX3_6, 0x00000000); /* method traps disabled */ - /* setup set '7' ... */ - if (si->ps.card_arch >= NV10A) - { - /* ... for cmd NV10_DX5_TEXTURE_TRIANGLE */ - ACCW(PR_CTX0_7, 0x0300a094); /* NVclass $094, patchcfg ROP_AND, userclip enable, - * context surface0 valid, nv10+: little endian */ - } - else - { - /* ... for cmd NV4_DX5_TEXTURE_TRIANGLE */ - ACCW(PR_CTX0_7, 0x0300a054); /* NVclass $054, patchcfg ROP_AND, userclip enable, - * context surface0 valid */ - } - ACCW(PR_CTX1_7, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ - ACCW(PR_CTX2_7, 0x11401140); /* DMA0, DMA1 instance = $1140 */ - ACCW(PR_CTX3_7, 0x00000000); /* method traps disabled */ - /* setup set '8' ... */ - if (si->ps.card_arch >= NV10A) - { - /* ... for cmd NV10_DX6_MULTI_TEXTURE_TRIANGLE (not used) */ - ACCW(PR_CTX0_8, 0x0300a095); /* NVclass $095, patchcfg ROP_AND, userclip enable, - * context surface0 valid, nv10+: little endian */ - } - else - { - /* ... for cmd NV4_DX6_MULTI_TEXTURE_TRIANGLE (not used) */ - ACCW(PR_CTX0_8, 0x0300a055); /* NVclass $055, patchcfg ROP_AND, userclip enable, - * context surface0 valid */ - } - ACCW(PR_CTX1_8, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ - ACCW(PR_CTX2_8, 0x11401140); /* DMA0, DMA1 instance = $1140 */ - ACCW(PR_CTX3_8, 0x00000000); /* method traps disabled */ - /* setup set '9' for cmd NV_SCALED_IMAGE_FROM_MEMORY */ - ACCW(PR_CTX0_9, 0x01018077); /* NVclass $077, patchcfg SRC_COPY, - * context surface0 valid, nv10+: little endian */ - ACCW(PR_CTX1_9, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ - ACCW(PR_CTX2_9, 0x11401140); /* DMA0, DMA1 instance = $1140 */ - ACCW(PR_CTX3_9, 0x00000000); /* method traps disabled */ - /* setup set 'A' for cmd NV1_RENDER_SOLID_LIN (not used) */ - ACCW(PR_CTX0_A, 0x0300a01c); /* NVclass $01c, patchcfg ROP_AND, userclip enable, - * context surface0 valid, nv10+: little endian */ - ACCW(PR_CTX1_A, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ - ACCW(PR_CTX2_A, 0x11401140); /* DMA0, DMA1 instance = $1140 */ - ACCW(PR_CTX3_A, 0x00000000); /* method traps disabled */ - //2007 3D tests.. - /* setup set 'B' ... */ - if (si->ps.card_type == NV15) - { - /* ... for cmd NV11_TCL_PRIMITIVE_3D */ - ACCW(PR_CTX0_B, 0x0300a096); /* NVclass $096, patchcfg ROP_AND, userclip enable, - * context surface0 valid, nv10+: little endian */ - ACCW(PR_CTX1_B, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ - ACCW(PR_CTX2_B, 0x11401140); /* DMA0, DMA1 instance = $1140 */ - ACCW(PR_CTX3_B, 0x00000000); /* method traps disabled */ - } - /* setup DMA set pointed at by PF_CACH1_DMAI */ - if (0)//si->engine.agp_mode) - { - /* DMA page table present and of linear type; - * DMA class is $002 (b0-11); - * DMA target node is AGP */ - ACCW(PR_CTX0_C, 0x00033002); - } - else - { - /* DMA page table present and of linear type; - * DMA class is $002 (b0-11); - * DMA target node is PCI */ - ACCW(PR_CTX0_C, 0x00023002); - } - ACCW(PR_CTX1_C, 0x000fffff); /* DMA limit: tablesize is 1M bytes */ - ACCW(PR_CTX2_C, (((uint32)((uint8 *)(si->dma_buffer_pci))) | 0x00000002)); - /* DMA access type is READ_AND_WRITE; - * table is located in main system RAM (b12-31): - * It's adress needs to be at a 4kb boundary! */ - /* set the 3D rendering functions colordepth via BPIXEL's 'depth 2' */ - /* note: - * setting a depth to 'invalid' (zero) makes the engine report - * ready with drawing 'immediately'. */ - //fixme: NV30A and above (probably) needs to be corrected... - switch(si->dm.space) - { - case B_CMAP8: - if (si->ps.card_arch < NV30A) - /* set depth 2: $1 = Y8 */ - ACCW(BPIXEL, 0x00000100); - else - /* set depth 0-1: $1 = Y8, $2 = X1R5G5B5_Z1R5G5B5 */ - ACCW(BPIXEL, 0x00000021); - break; - case B_RGB15_LITTLE: - if (si->ps.card_arch < NV30A) - /* set depth 2: $4 = A1R5G5B5 */ - ACCW(BPIXEL, 0x00000400); - else - /* set depth 0-1: $2 = X1R5G5B5_Z1R5G5B5, $4 = A1R5G5B5 */ - ACCW(BPIXEL, 0x00000042); - break; - case B_RGB16_LITTLE: - if (si->ps.card_arch < NV30A) - /* set depth 2: $5 = R5G6B5 */ - ACCW(BPIXEL, 0x00000500); - else - /* set depth 0-1: $5 = R5G6B5, $a = X1A7R8G8B8_O1A7R8G8B8 */ - ACCW(BPIXEL, 0x000000a5); - break; - case B_RGB32_LITTLE: - case B_RGBA32_LITTLE: - if (si->ps.card_arch < NV30A) - /* set depth 2: $c = A8R8G8B8 */ - ACCW(BPIXEL, 0x00000c00); - else - /* set depth 0-1: $7 = X8R8G8B8_Z8R8G8B8, $e = V8YB8U8YA8 */ - ACCW(BPIXEL, 0x000000e7); - break; - default: - LOG(8,("ACC: init, invalid bit depth\n")); - return B_ERROR; - } - } - if (si->ps.card_arch == NV04A) { /* do a explicit engine reset */ @@ -921,11 +718,8 @@ /* setup sync parameters for NV12_IMAGE_BLIT command for the current mode: * values given are CRTC vertical counter limit values. The NV12 command will wait * for the specified's CRTC's vertical counter to be in between the given values */ - if (si->ps.card_type >= NV11) - { - ACCW(NV11_CRTC_LO, si->dm.timing.v_display - 1); - ACCW(NV11_CRTC_HI, si->dm.timing.v_display + 1); - } + ACCW(NV11_CRTC_LO, si->dm.timing.v_display - 1); + ACCW(NV11_CRTC_HI, si->dm.timing.v_display + 1); /*** PFIFO ***/ /* (setup caches) */ @@ -1773,26 +1567,15 @@ ((uint32*)(si->dma_buffer))[si->engine.dma.current++] = 0x00000002; /* Format */ } - /* TNT1 has fixed operation mode 'SRCcopy' while the rest can be programmed: */ - if (si->ps.card_type != NV04) - { - /* wait for room in fifo for cmds if needed. */ - if (nv_acc_fifofree_dma(5) != B_OK) return; - /* now setup source bitmap colorspace */ - nv_acc_cmd_dma(NV_SCALED_IMAGE_FROM_MEMORY, NV_SCALED_IMAGE_FROM_MEMORY_SETCOLORFORMAT, 2); - ((uint32*)(si->dma_buffer))[si->engine.dma.current++] = cmd_depth; /* SetColorFormat */ - /* now setup operation mode to SRCcopy */ - ((uint32*)(si->dma_buffer))[si->engine.dma.current++] = 0x00000003; /* SetOperation */ - } - else - { - /* wait for room in fifo for cmd if needed. */ - if (nv_acc_fifofree_dma(4) != B_OK) return; - /* now setup source bitmap colorspace */ - nv_acc_cmd_dma(NV_SCALED_IMAGE_FROM_MEMORY, NV_SCALED_IMAGE_FROM_MEMORY_SETCOLORFORMAT, 1); - ((uint32*)(si->dma_buffer))[si->engine.dma.current++] = cmd_depth; /* SetColorFormat */ - /* TNT1 has fixed operation mode SRCcopy */ - } + /* program operation mode 'SRCcopy' */ + /* wait for room in fifo for cmds if needed. */ + if (nv_acc_fifofree_dma(5) != B_OK) return; + /* now setup source bitmap colorspace */ + nv_acc_cmd_dma(NV_SCALED_IMAGE_FROM_MEMORY, NV_SCALED_IMAGE_FROM_MEMORY_SETCOLORFORMAT, 2); + ((uint32*)(si->dma_buffer))[si->engine.dma.current++] = cmd_depth; /* SetColorFormat */ + /* now setup operation mode to SRCcopy */ + ((uint32*)(si->dma_buffer))[si->engine.dma.current++] = 0x00000003; /* SetOperation */ + /* now setup fill color (writing 2 32bit words) */ nv_acc_cmd_dma(NV4_GDI_RECTANGLE_TEXT, NV4_GDI_RECTANGLE_TEXT_COLOR1A, 1); ((uint32*)(si->dma_buffer))[si->engine.dma.current++] = 0x00000000; /* Color1A */ Deleted: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_brooktreetv.c Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_crtc.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_crtc.c 2008-06-11 14:59:40 UTC (rev 25928) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_crtc.c 2008-06-11 18:14:15 UTC (rev 25929) @@ -1,6 +1,6 @@ /* CTRC functionality */ /* Author: - Rudolf Cornelissen 11/2002-2/2006 + Rudolf Cornelissen 11/2002-6/2008 */ #define MODULE_BIT 0x00040000 @@ -29,79 +29,8 @@ return result; } -/* doing general fail-safe default setup here */ -//fixme: this is a _very_ basic setup, and it's preliminary... status_t nv_crtc_update_fifo() { - uint8 bytes_per_pixel = 1; - uint32 drain; - - /* we are only using this on >>coldstarted<< cards which really need this */ - //fixme: re-enable or remove after general user confirmation of behaviour... - if (/*(si->settings.usebios) ||*/ (si->ps.card_type != NV05M64)) return B_OK; - - /* enable access to primary head */ - set_crtc_owner(0); - - /* set CRTC FIFO low watermark according to memory drain */ - switch(si->dm.space) - { - case B_CMAP8: - bytes_per_pixel = 1; - break; - case B_RGB15_LITTLE: - case B_RGB16_LITTLE: - bytes_per_pixel = 2; - break; - case B_RGB24_LITTLE: - bytes_per_pixel = 3; - break; - case B_RGB32_LITTLE: - bytes_per_pixel = 4; - break; - } - /* fixme: - * - I should probably include the refreshrate as well; - * - and the memory clocking speed, core clocking speed, RAM buswidth.. */ - drain = si->dm.timing.h_display * si->dm.timing.v_display * bytes_per_pixel; - - /* Doesn't work for other than 32bit space (yet?) */ - if (si->dm.space != B_RGB32_LITTLE) - { - /* BIOS defaults */ - CRTCW(FIFO, 0x03); - CRTCW(FIFO_LWM, 0x20); - LOG(4,("CRTC: FIFO low-watermark set to $20, burst size 256 (BIOS defaults)\n")); - return B_OK; - } - - if (drain > (((uint32)1280) * 1024 * 4)) - { - /* set CRTC FIFO burst size for 'smaller' bursts */ - CRTCW(FIFO, 0x01); - /* Instruct CRTC to fetch new data 'earlier' */ - CRTCW(FIFO_LWM, 0x40); - LOG(4,("CRTC: FIFO low-watermark set to $40, burst size 64\n")); - } - else - { - if (drain > (((uint32)1024) * 768 * 4)) - { - /* BIOS default */ - CRTCW(FIFO, 0x02); - /* Instruct CRTC to fetch new data 'earlier' */ - CRTCW(FIFO_LWM, 0x40); - LOG(4,("CRTC: FIFO low-watermark set to $40, burst size 128\n")); - } - else - { - /* BIOS defaults */ - CRTCW(FIFO, 0x03); - CRTCW(FIFO_LWM, 0x20); - LOG(4,("CRTC: FIFO low-watermark set to $20, burst size 256 (BIOS defaults)\n")); - } - } - return B_OK; } @@ -127,14 +56,7 @@ /* NOTE: keep horizontal timing at multiples of 8! */ /* confine to a reasonable width */ if (*hd_e < 640) *hd_e = 640; - if (si->ps.card_type > NV04) - { - if (*hd_e > 2048) *hd_e = 2048; - } - else - { - if (*hd_e > 1920) *hd_e = 1920; - } + if (*hd_e > 2048) *hd_e = 2048; /* if hor. total does not leave room for a sensible sync pulse, increase it! */ if (*ht < (*hd_e + 80)) *ht = (*hd_e + 80); @@ -160,14 +82,7 @@ /* confine to a reasonable height */ if (*vd_e < 480) *vd_e = 480; - if (si->ps.card_type > NV04) - { - if (*vd_e > 1536) *vd_e = 1536; - } - else - { - if (*vd_e > 1440) *vd_e = 1440; - } + if (*vd_e > 1536) *vd_e = 1536; /*if vertical total does not leave room for a sync pulse, increase it!*/ if (*vt < (*vd_e + 3)) *vt = (*vd_e + 3); @@ -238,12 +153,8 @@ * OTOH the overlay unit distorts if we reserve too much time! */ if (target.timing.h_display == si->ps.p1_timing.h_display) { - /* NV11 timing has different constraints than later cards */ - if (si->ps.card_type == NV11) - target.timing.h_total -= 56; - else - /* confirmed NV34 with 1680x1050 panel */ - target.timing.h_total -= 32; + /* confirmed NV34 with 1680x1050 panel */ + target.timing.h_total -= 32; } if (target.timing.h_sync_start == target.timing.h_display) @@ -409,7 +320,6 @@ CRTCW(INTERLACE, 0xff); /* disable CRTC slaved mode unless a panel is in use */ - // fixme: this kills TVout when it was in use... if (!si->ps.tmds1_active) CRTCW(PIXEL, (CRTCR(PIXEL) & 0x7f)); /* setup flatpanel if connected and active */ @@ -622,7 +532,7 @@ { //fixme? linux only does this on dualhead cards... //fixme: see if LVDS head can be determined with two panels there... - if (!si->ps.tmds2_active && (si->ps.card_type != NV11)) + if (!si->ps.tmds2_active) { /* b2 = 0 = enable laptop panel backlight */ /* note: this seems to be a write-only register. */ @@ -665,7 +575,7 @@ { //fixme? linux only does this on dualhead cards... //fixme: see if LVDS head can be determined with two panels there... - if (!si->ps.tmds2_active && (si->ps.card_type != NV11)) + if (!si->ps.tmds2_active) { /* b2 = 1 = disable laptop panel backlight */ /* note: this seems to be a write-only register. */ @@ -984,131 +894,3 @@ return B_OK; } - -status_t nv_crtc_stop_tvout(void) -{ - uint16 cnt; - - LOG(4,("CRTC: stopping TV output\n")); - - /* enable access to primary head */ - set_crtc_owner(0); - - /* just to be sure Vsync is _really_ enabled */ - CRTCW(REPAINT1, (CRTCR(REPAINT1) & 0xbf)); - - /* wait for one image to be generated to make sure VGA has kicked in and is - * running OK before continuing... - * (Kicking in will fail often if we do not wait here) */ - /* Note: - * The used CRTC's Vsync is required to be enabled here. The DPMS state - * programming in the driver makes sure this is the case. - * (except for driver startup: see nv_general.c.) */ - - /* make sure we are 'in' active VGA picture: wait with timeout! */ - cnt = 1; - while ((NV_REG8(NV8_INSTAT1) & 0x08) && cnt) - { - snooze(1); - cnt++; - } - /* wait for next vertical retrace start on VGA: wait with timeout! */ - cnt = 1; - while ((!(NV_REG8(NV8_INSTAT1) & 0x08)) && cnt) - { - snooze(1); - cnt++; - } - /* now wait until we are 'in' active VGA picture again: wait with timeout! */ - cnt = 1; - while ((NV_REG8(NV8_INSTAT1) & 0x08) && cnt) - { - snooze(1); - cnt++; - } - - /* set CRTC to master mode (b7 = 0) if it wasn't slaved for a panel before */ - if (!(si->ps.slaved_tmds1)) CRTCW(PIXEL, (CRTCR(PIXEL) & 0x03)); - - /* CAUTION: - * On old cards, PLLSEL (and TV_SETUP?) cannot be read (sometimes?), but - * write actions do succeed ... - * This is confirmed for both ISA and PCI access, on NV04 and NV11. */ - - /* setup TVencoder connection */ - /* b1-0 = %00: encoder type is SLAVE; - * b24 = 1: VIP datapos is b0-7 */ - //fixme if needed: setup completely instead of relying on pre-init by BIOS.. - //(it seems to work OK on NV04 and NV11 although read reg. doesn't seem to work) - DACW(TV_SETUP, ((DACR(TV_SETUP) & ~0x00000003) | 0x01000000)); - - /* tell GPU to use pixelclock from internal source instead of using TVencoder */ - if (si->ps.secondary_head) - DACW(PLLSEL, 0x30000f00); - else - DACW(PLLSEL, 0x10000700); - - /* HTOTAL, VTOTAL and OVERFLOW return their default CRTC use, instead of - * H, V-low and V-high 'shadow' counters(?)(b0, 4 and 6 = 0) (b7 use = unknown) */ - CRTCW(TREG, 0x00); - - /* select panel encoder, not TV encoder if needed (b0 = 1). - * Note: - * Both are devices (often) using the CRTC in slaved mode. */ - if (si->ps.slaved_tmds1) CRTCW(LCD, (CRTCR(LCD) | 0x01)); - - return B_OK; -} - -status_t nv_crtc_start_tvout(void) -{ - LOG(4,("CRTC: starting TV output\n")); - - if (si->ps.secondary_head) - { - /* switch TV encoder to CRTC1 */ - NV_REG32(NV32_2FUNCSEL) &= ~0x00000100; - NV_REG32(NV32_FUNCSEL) |= 0x00000100; - } [... truncated: 1366 lines follow ...] From aldeck at mail.berlios.de Wed Jun 11 21:43:37 2008 From: aldeck at mail.berlios.de (aldeck at BerliOS) Date: Wed, 11 Jun 2008 21:43:37 +0200 Subject: [Haiku-commits] r25930 - haiku/trunk/src/kits/interface Message-ID: <200806111943.m5BJhb4n002426@sheep.berlios.de> Author: aldeck Date: 2008-06-11 21:43:36 +0200 (Wed, 11 Jun 2008) New Revision: 25930 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25930&view=rev Modified: haiku/trunk/src/kits/interface/View.cpp Log: - BView::MoveBy was letting BView::MoveTo do the rounding after adding the delta. For example, MoveBy(-0.5, 0.0) would do nothing in this case: roundf(150.0 - 0.5) = 150.0, when rounding the delta it gives the expected value: roundf(150.0 + roundf(-0.5)) = 149. On the other hand, BView::ResizeBy was doing it right, and this explains the bug in Cortex (#333). Cortex was doing scrollBar->MoveBy(-0.5,0) then scrollBar->ResizeBy(0.5,0) and the inconsistency lead to the visual bug. (see StatusView::MouseMoved()) This fixes #333. The bug was strange to reproduce since sometimes the point received in MouseMoved would be "some_integer+0.5" values sometimes just integral. This has still to be investigated though not problematic here anymore. See cortex/RouteApp/StatusView.cpp line 222. Modified: haiku/trunk/src/kits/interface/View.cpp =================================================================== --- haiku/trunk/src/kits/interface/View.cpp 2008-06-11 18:14:15 UTC (rev 25929) +++ haiku/trunk/src/kits/interface/View.cpp 2008-06-11 19:43:36 UTC (rev 25930) @@ -3617,7 +3617,7 @@ void BView::MoveBy(float deltaX, float deltaY) { - MoveTo(fParentOffset.x + deltaX, fParentOffset.y + deltaY); + MoveTo(fParentOffset.x + roundf(deltaX), fParentOffset.y + roundf(deltaY)); } From aldeck at mail.berlios.de Wed Jun 11 22:51:57 2008 From: aldeck at mail.berlios.de (aldeck at BerliOS) Date: Wed, 11 Jun 2008 22:51:57 +0200 Subject: [Haiku-commits] r25931 - haiku/trunk/src/apps/terminal Message-ID: <200806112051.m5BKpvJG008428@sheep.berlios.de> Author: aldeck Date: 2008-06-11 22:51:56 +0200 (Wed, 11 Jun 2008) New Revision: 25931 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25931&view=rev Modified: haiku/trunk/src/apps/terminal/AppearPrefView.cpp Log: - Changed BColorControl cellsize to account for the fixes in BColorControl. A rounding error gave the right appearance. see r23671 and r23680. Also, we might want to check the minimum cellsize in R5 and use the same for compatibility. Modified: haiku/trunk/src/apps/terminal/AppearPrefView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/AppearPrefView.cpp 2008-06-11 19:43:36 UTC (rev 25930) +++ haiku/trunk/src/apps/terminal/AppearPrefView.cpp 2008-06-11 20:51:56 UTC (rev 25931) @@ -76,7 +76,7 @@ AddChild(fColorField); fColorControl = SetupColorControl(BPoint(r.left, r.bottom + 10), - B_CELLS_32x8, 6, MSG_COLOR_CHANGED); + B_CELLS_32x8, 7.0, MSG_COLOR_CHANGED); fColorControl->SetValue(PrefHandler::Default()->getRGB(PREF_TEXT_FORE_COLOR)); } From superstippi at gmx.de Wed Jun 11 22:52:49 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Wed, 11 Jun 2008 22:52:49 +0200 Subject: [Haiku-commits] r25930 - haiku/trunk/src/kits/interface In-Reply-To: <200806111943.m5BJhb4n002426@sheep.berlios.de> References: <200806111943.m5BJhb4n002426@sheep.berlios.de> Message-ID: <20080611225249.3979.4@stippis2.1213188332.fake> aldeck at BerliOS wrote: > Author: aldeck > Date: 2008-06-11 21:43:36 +0200 (Wed, 11 Jun 2008) New Revision: 25930 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25930&view=rev > > Modified: > haiku/trunk/src/kits/interface/View.cpp > Log: > - BView::MoveBy was letting BView::MoveTo do the rounding after adding > the delta. > For example, MoveBy(-0.5, 0.0) would do nothing in this case: > roundf(150.0 - 0.5) = 150.0, when rounding the delta it gives the > expected value: roundf(150.0 + roundf(-0.5)) = 149. > > On the other hand, BView::ResizeBy was doing it right, and this > explains the bug in Cortex (#333). Cortex was doing > scrollBar->MoveBy(-0.5,0) then scrollBar->ResizeBy(0.5,0) and the > inconsistency lead to the visual bug. (see StatusView::MouseMoved()) > > This fixes #333. The bug was strange to reproduce since sometimes the > point received in MouseMoved would be "some_integer+0.5" values sometimes > just integral. This has still to be investigated though not problematic > here anymore. See cortex/RouteApp/StatusView.cpp line 222. Wow, nice catch! I remember trying to track this down once and even writing a test app... cool, another one down! Best regards, -Stephan From alex at zappotek.com Wed Jun 11 23:01:01 2008 From: alex at zappotek.com (Alexandre Deckner) Date: Wed, 11 Jun 2008 23:01:01 +0200 Subject: [Haiku-commits] r25930 - haiku/trunk/src/kits/interface In-Reply-To: <20080611225249.3979.4@stippis2.1213188332.fake> References: <200806111943.m5BJhb4n002426@sheep.berlios.de> <20080611225249.3979.4@stippis2.1213188332.fake> Message-ID: <48503D0D.3080201@zappotek.com> Stephan Assmus wrote: > Wow, nice catch! I remember trying to track this down once and even writing > a test app... cool, another one down! > I already tried once, but this time, the bug couldn't resist a massive attack of printf's :-D Do you have an idea why MouseMoved gives a non integral value, is it expected? Regards, Alex From stippi at mail.berlios.de Thu Jun 12 00:24:35 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 12 Jun 2008 00:24:35 +0200 Subject: [Haiku-commits] r25932 - haiku/trunk/src/add-ons/media/media-add-ons/opensound Message-ID: <200806112224.m5BMOZbU020461@sheep.berlios.de> Author: stippi Date: 2008-06-12 00:24:34 +0200 (Thu, 12 Jun 2008) New Revision: 25932 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25932&view=rev Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundAddOn.cpp haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.h haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDeviceEngine.cpp haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.h Log: Work in progress: * Cleaning up and refactoring the OpenSoundNode code to use a single coding style and be less C-like in many places. * Fixed quite a few memory leaks in OpenSoundNode. * Removed large chunks of inactive code originating from the MultiAudioNode. * Transfered some functionality into NodeInput and NodeOutput, could be more. * No functional changes. Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundAddOn.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundAddOn.cpp 2008-06-11 20:51:56 UTC (rev 25931) +++ haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundAddOn.cpp 2008-06-11 22:24:34 UTC (rev 25932) @@ -7,6 +7,7 @@ * Based on MultiAudio media addon * Copyright (c) 2002, 2003 Jerome Duval (jerome.duval at free.fr) */ +#include "OpenSoundAddOn.h" #include #include @@ -22,8 +23,8 @@ #include #include "OpenSoundNode.h" -#include "OpenSoundAddOn.h" #include "OpenSoundDevice.h" +#include "OpenSoundDeviceEngine.h" #include #include @@ -119,7 +120,8 @@ { CALLED(); - OpenSoundDevice *device = (OpenSoundDevice*)fDevices.ItemAt(info->internal_id); + OpenSoundDevice *device = (OpenSoundDevice*)fDevices.ItemAt( + info->internal_id); if (device == NULL) { *out_error = B_ERROR; return NULL; Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.h =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.h 2008-06-11 20:51:56 UTC (rev 25931) +++ haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.h 2008-06-11 22:24:34 UTC (rev 25932) @@ -22,10 +22,7 @@ #define MAX_CHANNELS 32 #define NB_BUFFERS 32 -//#define DEFAULT_BUFFER_SIZE 2048 -//#define DEFAULT_BUFFER_SIZE (32*1024) -//#define DEFAULT_BUFFER_SIZE (16*1024) -#define DEFAULT_BUFFER_SIZE (2*1024) +#define DEFAULT_BUFFER_SIZE 2048 /* define to support encoded audio (AC3, MPEG, ...) when the card supports it */ //#define ENABLE_NON_RAW_SUPPORT 1 Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDeviceEngine.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDeviceEngine.cpp 2008-06-11 20:51:56 UTC (rev 25931) +++ haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDeviceEngine.cpp 2008-06-11 22:24:34 UTC (rev 25932) @@ -93,7 +93,7 @@ Close(); return EIO; } -#if 0 +#if 1 // set fragments v = 0x7fff0000 | 0x000b; // unlimited * 2048 if (ioctl(fFD, SNDCTL_DSP_SETFRAGMENT, &v, sizeof(int)) < 0) { @@ -193,22 +193,27 @@ } -bigtime_t OpenSoundDeviceEngine::PlaybackLatency(void) +bigtime_t +OpenSoundDeviceEngine::PlaybackLatency() { bigtime_t latency; int delay; delay = GetODelay(); - delay = 0; //XXX - latency = ((double)delay * 1000000LL - / (fMediaFormat.u.raw_audio.channel_count * fMediaFormat.u.raw_audio.frame_rate - * (fMediaFormat.AudioFormat() & media_raw_audio_format::B_AUDIO_SIZE_MASK))); - PRINT(("PlaybackLatency: odelay %d latency %Ld card %Ld\n", delay, latency, CardLatency())); +delay = 0; //XXX + latency = (bigtime_t)((double)delay * 1000000LL + / (fMediaFormat.u.raw_audio.channel_count + * fMediaFormat.u.raw_audio.frame_rate + * (fMediaFormat.AudioFormat() + & media_raw_audio_format::B_AUDIO_SIZE_MASK))); + PRINT(("PlaybackLatency: odelay %d latency %Ld card %Ld\n", delay, latency, + CardLatency())); latency += CardLatency(); return latency; } -bigtime_t OpenSoundDeviceEngine::RecordingLatency(void) +bigtime_t +OpenSoundDeviceEngine::RecordingLatency() { return 0LL; //XXX } Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp 2008-06-11 20:51:56 UTC (rev 25931) +++ haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp 2008-06-11 22:24:34 UTC (rev 25932) @@ -2,138 +2,222 @@ * OpenSound media addon for BeOS and Haiku * * Copyright (c) 2007, Fran?ois Revol (revol at free.fr) - * Distributed under the terms of the MIT License. - * - * Based on MultiAudio media addon * Copyright (c) 2002, 2003 Jerome Duval (jerome.duval at free.fr) - * - * All rights reserved. - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * Distributed under the terms of the MIT License. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "OpenSoundNode.h" + +#include #include -#include -#include -#include -#include +#include #include -#include +#include +#include #include + #include #include +#include +#include -#include "OpenSoundNode.h" -#include "driver_io.h" #ifdef DEBUG #define PRINTING #endif #include "debug.h" -#include -#include +#include "OpenSoundDevice.h" +#include "OpenSoundDeviceEngine.h" +#include "OpenSoundDeviceMixer.h" -const char * multi_string[] = -{ - "NAME IS ATTACHED", - "Output", "Input", "Setup", "Tone Control", "Extended Setup", "Enhanced Setup", "Master", - "Beep", "Phone", "Mic", "Line", "CD", "Video", "Aux", "Wave", "Gain", "Level", "Volume", - "Mute", "Enable", "Stereo Mix", "Mono Mix", "Output Stereo Mix", "Output Mono Mix", "Output Bass", - "Output Treble", "Output 3D Center", "Output 3D Depth" + +class OpenSoundNode::NodeInput { +public: + NodeInput(const media_input& input, const media_format& format) + : fNode(NULL), + fEngineIndex(-1), + fRealEngine(NULL), + fOSSFormatFlags(0), + + fInput(input), + fPreferredFormat(format), + + fThread(-1), + fBufferCycle(1), + + fBuffers(4) + { + CALLED(); + } + + ~NodeInput() + { + CALLED(); + } + + status_t FillBuffer(BBuffer* buffer) + { + CALLED(); + + ssize_t written = fRealEngine->Write( + buffer->Data(), buffer->SizeUsed()); + + if (written < 0) + return (status_t)written; + if (written < buffer->SizeUsed()) + return B_IO_ERROR; + return B_OK; + } + + void WriteSilence(size_t bytes) + { + CALLED(); + + // TODO: A silenceBuffer could be cached! + uint8 formatSilence = 0; + if (fInput.format.u.raw_audio.format + == media_raw_audio_format::B_AUDIO_UCHAR) + formatSilence = 128; + + size_t bufferSize = 2048; + char buffer[bufferSize]; + + memset(buffer, formatSilence, bufferSize); + + while (bytes) { + size_t chunk = MIN(bytes, bufferSize); + ssize_t written = fRealEngine->Write(buffer, chunk); + if (written < 0) + return; + bytes -= written; + } + } + + OpenSoundNode* fNode; + int32 fEngineIndex; + OpenSoundDeviceEngine* fRealEngine; + // engine it's connected to. can be a shadow one (!= fEngineIndex) + int fOSSFormatFlags; + // AFMT_* flags for this input + media_input fInput; + media_format fPreferredFormat; + + thread_id fThread; + uint32 fBufferCycle; + BList fBuffers; + // contains BBuffer* pointers that have not yet played }; -node_input::node_input(media_input &input, media_format format) -{ - CALLED(); - fNode = NULL; - fEngineId = -1; - fRealEngine = NULL; - fAFmt = 0; - fInput = input; - fPreferredFormat = format; - fBufferCycle = 1; - //fBuffer = NULL; - fThread = -1; -} -node_input::~node_input() -{ - CALLED(); -} +class OpenSoundNode::NodeOutput { +public: + NodeOutput(const media_output& output, const media_format& format) + : fNode(NULL), + fEngineIndex(-1), + fRealEngine(NULL), + fOSSFormatFlags(0), -node_output::node_output(media_output &output, media_format format) - : fBufferGroup(NULL), - fOutputEnabled(true) -{ - CALLED(); - fNode = NULL; - fEngineId = -1; - fRealEngine = NULL; - fAFmt = 0; - fOutput = output; - fPreferredFormat = format; - fBufferCycle = 1; - fThread = -1; -} + fOutput(output), + fPreferredFormat(format), -node_output::~node_output() -{ - CALLED(); -} + fThread(-1), + fBufferGroup(NULL), + fOutputEnabled(true), + fSamplesSent(0), + fBufferCycle(1) + { + CALLED(); + } -// -------------------------------------------------------- // -// ctor/dtor -// -------------------------------------------------------- // + ~NodeOutput() + { + CALLED(); + } -OpenSoundNode::~OpenSoundNode(void) + BBuffer* FillNextBuffer(bigtime_t bufferDuration) + { + if (fBufferGroup == NULL) + return NULL; + + BBuffer* buffer = fBufferGroup->RequestBuffer( + fOutput.format.u.raw_audio.buffer_size, bufferDuration); + + // if we fail to get a buffer (for example, if the request times out), + // we skip this buffer and go on to the next, to avoid locking up the + // control thread + if (!buffer) + return NULL; + + // now fill it with data + ssize_t sizeUsed = fRealEngine->Read(buffer->Data(), + fOutput.format.u.raw_audio.buffer_size); + if (sizeUsed < 0) { + PRINT(("NodeOutput::%s: %s\n", __FUNCTION__, + strerror(sizeUsed))); + buffer->Recycle(); + return NULL; + } + if (sizeUsed < fOutput.format.u.raw_audio.buffer_size) { + PRINT(("NodeOutput::%s: requested %d, got %d\n", __FUNCTION__, + fOutput.format.u.raw_audio.buffer_size, sizeUsed)); + } + + media_header* hdr = buffer->Header(); + if (hdr != NULL) { + hdr->type = B_MEDIA_RAW_AUDIO; + hdr->size_used = sizeUsed; + } + + return buffer; + } + + OpenSoundNode* fNode; + int32 fEngineIndex; + OpenSoundDeviceEngine* fRealEngine; + // engine it's connected to. can be a shadow one (!= fEngineIndex) + int fOSSFormatFlags; + // AFMT_* flags for this output + media_output fOutput; + media_format fPreferredFormat; + + thread_id fThread; + BBufferGroup* fBufferGroup; + bool fOutputEnabled; + uint64 fSamplesSent; + volatile uint32 fBufferCycle; +}; + + +// #pragma mark - OpenSoundNode + + +OpenSoundNode::~OpenSoundNode() { CALLED(); fAddOn->GetConfigurationFor(this, NULL); - - //StopThread(); + + int32 count = fInputs.CountItems(); + for (int32 i = 0; i < count; i++) + delete (NodeInput*)fInputs.ItemAtFast(i); + count = fOutputs.CountItems(); + for (int32 i = 0; i < count; i++) + delete (NodeOutput*)fOutputs.ItemAtFast(i); + BMediaEventLooper::Quit(); fWeb = NULL; } -OpenSoundNode::OpenSoundNode(BMediaAddOn *addon, char* name, OpenSoundDevice *device, - int32 internal_id, BMessage * config) + +OpenSoundNode::OpenSoundNode(BMediaAddOn* addon, const char* name, + OpenSoundDevice* device, int32 internal_id, BMessage* config) : BMediaNode(name), BBufferConsumer(B_MEDIA_RAW_AUDIO), BBufferProducer(B_MEDIA_RAW_AUDIO), BTimeSource(), BMediaEventLooper(), - fThread(-1), + + fInitCheckStatus(B_NO_INIT), fDevice(device), fTimeSourceStarted(false), fOldPlayedFramesCount(0LL), @@ -142,67 +226,65 @@ fConfig(*config) { CALLED(); - fInitCheckStatus = B_NO_INIT; - if(!device) + if (fDevice == NULL) return; fAddOn = addon; fId = internal_id; - AddNodeKind( B_PHYSICAL_OUTPUT ); - AddNodeKind( B_PHYSICAL_INPUT ); + AddNodeKind(B_PHYSICAL_OUTPUT); + AddNodeKind(B_PHYSICAL_INPUT); // initialize our preferred format object - //XXX: this should go away! should use engine's preferred for each afmt. + // TODO: this should go away! should use engine's preferred for each afmt. #if 1 - memset(&fPreferredFormat, 0, sizeof(fPreferredFormat)); // set everything to wildcard first + memset(&fPreferredFormat, 0, sizeof(fPreferredFormat)); + // set everything to wildcard first fPreferredFormat.type = B_MEDIA_RAW_AUDIO; fPreferredFormat.u.raw_audio = media_multi_audio_format::wildcard; fPreferredFormat.u.raw_audio.channel_count = 2; fPreferredFormat.u.raw_audio.byte_order = B_MEDIA_HOST_ENDIAN; OpenSoundDeviceEngine *engine = fDevice->EngineAt(0); if (engine) { - const oss_audioinfo *ai = engine->Info(); + const oss_audioinfo* ai = engine->Info(); int fmt = OpenSoundDevice::select_oss_format(ai->oformats); - fPreferredFormat.u.raw_audio.format = OpenSoundDevice::convert_oss_format_to_media_format(fmt); - fPreferredFormat.u.raw_audio.valid_bits = OpenSoundDevice::convert_oss_format_to_valid_bits(fmt); - //XXX:engine->PreferredChannels() ? (caps & DSP_CH*) - fPreferredFormat.u.raw_audio.frame_rate = OpenSoundDevice::convert_oss_rate_to_media_rate(ai->max_rate); // measured in Hertz + fPreferredFormat.u.raw_audio.format + = OpenSoundDevice::convert_oss_format_to_media_format(fmt); + fPreferredFormat.u.raw_audio.valid_bits + = OpenSoundDevice::convert_oss_format_to_valid_bits(fmt); + // TODO: engine->PreferredChannels() ? (caps & DSP_CH*) + fPreferredFormat.u.raw_audio.frame_rate + = OpenSoundDevice::convert_oss_rate_to_media_rate(ai->max_rate); // measured in Hertz } - // we'll use the consumer's preferred buffer size, if any -#if MA - fPreferredFormat.u.raw_audio.buffer_size = fDevice->MBL.return_record_buffer_size - * (fPreferredFormat.u.raw_audio.format & media_raw_audio_format::B_AUDIO_SIZE_MASK) - * fPreferredFormat.u.raw_audio.channel_count; -#endif - //XXX: SNDCTL_DSP_GETBLKSIZE ? + // TODO: Use the OSS suggested buffer size via SNDCTL_DSP_GETBLKSIZE ? fPreferredFormat.u.raw_audio.buffer_size = DEFAULT_BUFFER_SIZE - * (fPreferredFormat.u.raw_audio.format & media_raw_audio_format::B_AUDIO_SIZE_MASK) - * fPreferredFormat.u.raw_audio.channel_count; + * (fPreferredFormat.u.raw_audio.format + & media_raw_audio_format::B_AUDIO_SIZE_MASK) + * fPreferredFormat.u.raw_audio.channel_count; #endif - if(config) { + if (config) PRINT_OBJECT(*config); - } fInitCheckStatus = B_OK; } -status_t OpenSoundNode::InitCheck(void) const + +status_t +OpenSoundNode::InitCheck() const { CALLED(); return fInitCheckStatus; } -// -------------------------------------------------------- // -// implementation of BMediaNode -// -------------------------------------------------------- // +// #pragma mark - BMediaNode -BMediaAddOn * OpenSoundNode::AddOn( - int32 * internal_id) const + +BMediaAddOn* +OpenSoundNode::AddOn(int32* internal_id) const { CALLED(); // BeBook says this only gets called if we were in an add-on. @@ -215,26 +297,27 @@ return fAddOn; } -void OpenSoundNode::Preroll(void) + +void +OpenSoundNode::Preroll() { CALLED(); // XXX:Performance opportunity BMediaNode::Preroll(); } -status_t OpenSoundNode::HandleMessage( - int32 message, - const void * data, - size_t size) + +status_t +OpenSoundNode::HandleMessage(int32 message, const void* data, size_t size) { CALLED(); return B_ERROR; } -void OpenSoundNode::NodeRegistered(void) + +void +OpenSoundNode::NodeRegistered() { - status_t err; - int i, f, fmt; CALLED(); if (fInitCheckStatus != B_OK) { @@ -246,9 +329,8 @@ Run(); - node_input *currentInput = NULL; PRINT(("NodeRegistered: %d engines\n", fDevice->CountEngines())); - for (i = 0; i < fDevice->CountEngines(); i++) { + for (int32 i = 0; i < fDevice->CountEngines(); i++) { OpenSoundDeviceEngine *engine = fDevice->EngineAt(i); if (!engine) continue; @@ -258,46 +340,48 @@ // skip engines that don't have outputs if ((engine->Caps() & PCM_CAP_OUTPUT) == 0) continue; - PRINT(("NodeRegistered: engine[%d]: .caps=0x%08x, .oformats=0x%08x\n", i, engine->Caps(), engine->Info()->oformats)); - for (f = 0; gSupportedFormats[f]; f++) { - fmt = gSupportedFormats[f] & engine->Info()->oformats; + + PRINT(("NodeRegistered: engine[%d]: .caps=0x%08x, .oformats=0x%08x\n", + i, engine->Caps(), engine->Info()->oformats)); + + for (int32 f = 0; gSupportedFormats[f]; f++) { + int fmt = gSupportedFormats[f] & engine->Info()->oformats; if (fmt == 0) continue; - PRINT(("NodeRegistered() : creating an input for engine %i, format[%i]\n", i, f)); - + PRINT(("NodeRegistered() : creating an input for engine %i, " + "format[%i]\n", i, f)); + media_format preferredFormat; - err = engine->PreferredFormatFor(fmt, preferredFormat); + status_t err = engine->PreferredFormatFor(fmt, preferredFormat); if (err < B_OK) continue; - media_input *input = new media_input; + media_input input; //input->format = fPreferredFormat;//XXX - input->format = preferredFormat; - input->destination.port = ControlPort(); - input->destination.id = fInputs.CountItems(); - input->node = Node(); + input.format = preferredFormat; + input.destination.port = ControlPort(); + input.destination.id = fInputs.CountItems(); + input.node = Node(); char *prefix = ""; if (strstr(engine->Info()->name, "SPDIF")) prefix = "S/PDIF "; - sprintf(input->name, "%s%s output %ld", prefix, gSupportedFormatsNames[f], input->destination.id); + sprintf(input.name, "%s%s output %ld", prefix, + gSupportedFormatsNames[f], input.destination.id); - currentInput = new node_input(*input, preferredFormat); - //currentInput->fPreferredFormat.u.raw_audio.channel_count = engine->Info()->max_channels; + NodeInput* currentInput = new NodeInput(input, preferredFormat); currentInput->fInput.format = currentInput->fPreferredFormat; - currentInput->fChannelId = i;//XXX:REMOVEME fDevice->MD.channels[i].channel_id; - currentInput->fEngineId = i; - currentInput->fAFmt = fmt; + currentInput->fEngineIndex = i; + currentInput->fOSSFormatFlags = fmt; currentInput->fNode = this; fInputs.AddItem(currentInput); - currentInput->fInput.format.u.raw_audio.format = media_raw_audio_format::wildcard.format; + currentInput->fInput.format.u.raw_audio.format + = media_raw_audio_format::wildcard.format; } } - node_output *currentOutput = NULL; - - for (i = 0; i < fDevice->CountEngines(); i++) { + for (int32 i = 0; i < fDevice->CountEngines(); i++) { OpenSoundDeviceEngine *engine = fDevice->EngineAt(i); if (!engine) continue; @@ -307,15 +391,19 @@ // skip engines that don't have inputs if ((engine->Caps() & PCM_CAP_INPUT) == 0) continue; - PRINT(("NodeRegistered: engine[%d]: .caps=0x%08x, .iformats=0x%08x\n", i, engine->Caps(), engine->Info()->iformats)); - for (f = 0; gSupportedFormats[f]; f++) { - fmt = gSupportedFormats[f] & engine->Info()->iformats; + + PRINT(("NodeRegistered: engine[%d]: .caps=0x%08x, .iformats=0x%08x\n", + i, engine->Caps(), engine->Info()->iformats)); + + for (int32 f = 0; gSupportedFormats[f]; f++) { + int fmt = gSupportedFormats[f] & engine->Info()->iformats; if (fmt == 0) continue; - PRINT(("NodeRegistered() : creating an output for engine %i, format[%i]\n", i, f)); + PRINT(("NodeRegistered() : creating an output for engine %i, " + "format[%i]\n", i, f)); media_format preferredFormat; - err = engine->PreferredFormatFor(fmt, preferredFormat); + status_t err = engine->PreferredFormatFor(fmt, preferredFormat); if (err < B_OK) continue; @@ -330,14 +418,16 @@ char *prefix = ""; if (strstr(engine->Info()->name, "SPDIF")) prefix = "S/PDIF "; - sprintf(output->name, "%s%s input %ld", prefix, gSupportedFormatsNames[f], output->source.id); + sprintf(output->name, "%s%s input %ld", prefix, + gSupportedFormatsNames[f], output->source.id); - currentOutput = new node_output(*output, preferredFormat); - //currentOutput->fPreferredFormat.u.raw_audio.channel_count = engine->Info()->max_channels; + NodeOutput* currentOutput = new NodeOutput(*output, + preferredFormat); +// currentOutput->fPreferredFormat.u.raw_audio.channel_count +// = engine->Info()->max_channels; currentOutput->fOutput.format = currentOutput->fPreferredFormat; - currentOutput->fChannelId = i;//XXX:REMOVEME fDevice->MD.channels[i].channel_id; - currentOutput->fEngineId = i; - currentOutput->fAFmt = fmt; + currentOutput->fEngineIndex = i; + currentOutput->fOSSFormatFlags = fmt; currentOutput->fNode = this; fOutputs.AddItem(currentOutput); } @@ -365,35 +455,40 @@ PRINT(("apply configuration in : %ld\n", system_time() - start)); } -status_t OpenSoundNode::RequestCompleted(const media_request_info &info) + +status_t +OpenSoundNode::RequestCompleted(const media_request_info& info) { CALLED(); return B_OK; } -void OpenSoundNode::SetTimeSource(BTimeSource *timeSource) + +void +OpenSoundNode::SetTimeSource(BTimeSource* timeSource) { CALLED(); } -// -------------------------------------------------------- // -// implemention of BBufferConsumer -// -------------------------------------------------------- // -// Check to make sure the format is okay, then remove -// any wildcards corresponding to our requirements. -status_t OpenSoundNode::AcceptFormat( - const media_destination & dest, - media_format * format) +// #pragma mark - BBufferConsumer + + +status_t +OpenSoundNode::AcceptFormat(const media_destination& dest, + media_format* format) { - status_t err; + // Check to make sure the format is okay, then remove + // any wildcards corresponding to our requirements. + CALLED(); - node_input *channel = FindInput(dest); + NodeInput* channel = _FindInput(dest); - if(channel==NULL) { + if (channel == NULL) { fprintf(stderr,"<- B_MEDIA_BAD_DESTINATION"); - return B_MEDIA_BAD_DESTINATION; // we only have one input so that better be it + return B_MEDIA_BAD_DESTINATION; + // we only have one input so that better be it } if (format == 0) { @@ -412,12 +507,12 @@ BAutolock L(fDevice->Locker()); - OpenSoundDeviceEngine *engine = fDevice->NextFreeEngineAt(channel->fEngineId, false); - if (!engine) { + OpenSoundDeviceEngine* engine = fDevice->NextFreeEngineAt( + channel->fEngineIndex, false); + if (!engine) return B_BUSY; - } - err = engine->AcceptFormatFor(channel->fAFmt, *format, false); + status_t err = engine->AcceptFormatFor(channel->fOSSFormatFlags, *format, false); if (err < B_OK) return err; @@ -430,8 +525,8 @@ } */ - //channel->fFormat = channel->fPreferredFormat; - channel->fFormat = *format; + //channel->fInput.format = channel->fPreferredFormat; + channel->fInput.format = *format; /*if(format->u.raw_audio.format == media_raw_audio_format::B_AUDIO_FLOAT && channel->fPreferredFormat.u.raw_audio.format == media_raw_audio_format::B_AUDIO_SHORT) @@ -473,7 +568,7 @@ } if ((*cookie < fInputs.CountItems()) && (*cookie >= 0)) { - node_input *channel = (node_input *)fInputs.ItemAt(*cookie); + NodeInput *channel = (NodeInput *)fInputs.ItemAt(*cookie); *out_input = channel->fInput; *cookie += 1; PRINT(("input.format : %u\n", channel->fInput.format.u.raw_audio.format)); @@ -532,7 +627,7 @@ { /**/CALLED(); - node_input *channel = FindInput(for_whom); + NodeInput *channel = _FindInput(for_whom); if(channel==NULL) { fprintf(stderr,"invalid destination received in OpenSoundNode::ProducerDataStatus\n"); @@ -558,7 +653,7 @@ return B_BAD_VALUE; } - node_input *channel = FindInput(for_whom); + NodeInput *channel = _FindInput(for_whom); if(channel==NULL || channel->fRealEngine==NULL) { fprintf(stderr,"<- B_MEDIA_BAD_DESTINATION\n"); @@ -585,7 +680,7 @@ return B_BAD_VALUE; // no crashing } - node_input *channel = FindInput(where); + NodeInput *channel = _FindInput(where); if(channel==NULL) { fprintf(stderr,"<- B_MEDIA_BAD_DESTINATION\n"); @@ -610,48 +705,50 @@ *out_input = channel->fInput; // we are sure the thread is started - //StartThread(); - StartPlayThread(channel); + _StartPlayThread(channel); return B_OK; } -void OpenSoundNode::Disconnected( - const media_source & producer, - const media_destination & where) + +void +OpenSoundNode::Disconnected(const media_source& producer, + const media_destination& where) { CALLED(); - node_input *channel = FindInput(where); - - if(channel==NULL) { - fprintf(stderr,"<- B_MEDIA_BAD_DESTINATION\n"); + + NodeInput* channel = _FindInput(where); + if (channel == NULL) { + fprintf(stderr,"OpenSoundNode::Disconnected() - " + "B_MEDIA_BAD_DESTINATION\n"); return; } if (channel->fInput.source != producer) { - fprintf(stderr,"<- B_MEDIA_BAD_SOURCE\n"); + fprintf(stderr,"OpenSoundNode::Disconnected() - " + "B_MEDIA_BAD_SOURCE\n"); return; } - - StopPlayThread(channel); + + _StopPlayThread(channel); channel->fInput.source = media_source::null; channel->fInput.format = channel->fPreferredFormat; if (channel->fRealEngine) channel->fRealEngine->Close(); channel->fRealEngine = NULL; - FillWithZeros(*channel); //GetFormat(&channel->fInput.format); } - /* The notification comes from the upstream producer, so he's already cool with */ - /* the format; you should not ask him about it in here. */ -status_t OpenSoundNode::FormatChanged( - const media_source & producer, - const media_destination & consumer, - int32 change_tag, - const media_format & format) + +//! The notification comes from the upstream producer, so he's +// already cool with the format; you should not ask him about it +// in here. +status_t +OpenSoundNode::FormatChanged(const media_source& producer, + const media_destination& consumer, int32 change_tag, + const media_format& format) { CALLED(); - node_input *channel = FindInput(consumer); + NodeInput *channel = _FindInput(consumer); if(channel==NULL) { fprintf(stderr,"<- B_MEDIA_BAD_DESTINATION\n"); @@ -664,37 +761,36 @@ return B_ERROR; } - /* Given a performance time of some previous buffer, retrieve the remembered tag */ - /* of the closest (previous or exact) performance time. Set *out_flags to 0; the */ - /* idea being that flags can be added later, and the understood flags returned in */ - /* *out_flags. */ -status_t OpenSoundNode::SeekTagRequested( - const media_destination & destination, - bigtime_t in_target_time, - uint32 in_flags, - media_seek_tag * out_seek_tag, - bigtime_t * out_tagged_time, - uint32 * out_flags) + +//! Given a performance time of some previous buffer, retrieve the +// remembered tag of the closest (previous or exact) performance +// time. Set *out_flags to 0; the idea being that flags can be +// added later, and the understood flags returned in *out_flags. +status_t +OpenSoundNode::SeekTagRequested(const media_destination& destination, + bigtime_t in_target_time, uint32 in_flags, media_seek_tag* out_seek_tag, + bigtime_t* out_tagged_time, uint32* out_flags) { CALLED(); - return BBufferConsumer::SeekTagRequested(destination,in_target_time,in_flags, - out_seek_tag,out_tagged_time,out_flags); + return BBufferConsumer::SeekTagRequested(destination, in_target_time, + in_flags, out_seek_tag, out_tagged_time, out_flags); } -// -------------------------------------------------------- // -// implementation for BBufferProducer -// -------------------------------------------------------- // +// #pragma mark - BBufferProducer + + +//! FormatSuggestionRequested() is not necessarily part of the format +// negotiation process; it's simply an interrogation -- the caller wants +// to see what the node's preferred data format is, given a suggestion by +// the caller. status_t -OpenSoundNode::FormatSuggestionRequested(media_type type, int32 /*quality*/, media_format* format) +OpenSoundNode::FormatSuggestionRequested(media_type type, int32 /*quality*/, + media_format* format) { - // FormatSuggestionRequested() is not necessarily part of the format negotiation - // process; it's simply an interrogation -- the caller wants to see what the node's - // preferred data format is, given a suggestion by the caller. CALLED(); - if (!format) - { + if (!format) { fprintf(stderr, "\tERROR - NULL format pointer passed in!\n"); return B_BAD_VALUE; } @@ -703,55 +799,69 @@ *format = fPreferredFormat; // a wildcard type is okay; we can specialize it - if (type == B_MEDIA_UNKNOWN_TYPE) type = B_MEDIA_RAW_AUDIO; + if (type == B_MEDIA_UNKNOWN_TYPE) + type = B_MEDIA_RAW_AUDIO; - // we only support raw audio - if (type != B_MEDIA_RAW_AUDIO) return B_MEDIA_BAD_FORMAT; - else return B_OK; + // TODO: For OSS engines that support encoded formats, we could + // handle this here. For the time being, we only support raw audio. + if (type != B_MEDIA_RAW_AUDIO) + return B_MEDIA_BAD_FORMAT; + + return B_OK; } + +//! FormatProposal() is the first stage in the BMediaRoster::Connect() +// process. We hand out a suggested format, with wildcards for any +// variations we support. status_t OpenSoundNode::FormatProposal(const media_source& output, media_format* format) { - status_t err; - // FormatProposal() is the first stage in the BMediaRoster::Connect() process. We hand - // out a suggested format, with wildcards for any variations we support. CALLED(); - node_output *channel = FindOutput(output); + + NodeOutput* channel = _FindOutput(output); // is this a proposal for our select output? - if (channel == NULL) - { - fprintf(stderr, "OpenSoundNode::FormatProposal returning B_MEDIA_BAD_SOURCE\n"); + if (channel == NULL) { + fprintf(stderr, "OpenSoundNode::FormatProposal returning " + "B_MEDIA_BAD_SOURCE\n"); return B_MEDIA_BAD_SOURCE; } media_type requestedType = format->type; #ifdef ENABLE_REC - OpenSoundDeviceEngine *engine = fDevice->NextFreeEngineAt(channel->fEngineId, true); + OpenSoundDeviceEngine* engine = fDevice->NextFreeEngineAt( + channel->fEngineIndex, true); - // we only support floating-point raw audio, so we always return that, but we - // supply an error code depending on whether we found the proposal acceptable. - err = engine->PreferredFormatFor(channel->fAFmt, *format, true); + // We only support raw audio, so we always return that, but we supply an + // error code depending on whether we found the proposal acceptable. + status_t err = engine->PreferredFormatFor(channel->fOSSFormatFlags, *format, true); if (err < B_OK) return err; #else *format = fPreferredFormat; #endif - if ((requestedType != B_MEDIA_UNKNOWN_TYPE) && (requestedType != B_MEDIA_RAW_AUDIO) + if (requestedType != B_MEDIA_UNKNOWN_TYPE + && requestedType != B_MEDIA_RAW_AUDIO #ifdef ENABLE_NON_RAW_SUPPORT - && (requestedType != B_MEDIA_ENCODED_AUDIO) + && requestedType != B_MEDIA_ENCODED_AUDIO #endif [... truncated: 3526 lines follow ...] From superstippi at gmx.de Thu Jun 12 00:33:03 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Thu, 12 Jun 2008 00:33:03 +0200 Subject: [Haiku-commits] r25932 - haiku/trunk/src/add-ons/media/media-add-ons/opensound In-Reply-To: <200806112224.m5BMOZbU020461@sheep.berlios.de> References: <200806112224.m5BMOZbU020461@sheep.berlios.de> Message-ID: <20080612003303.6123.8@stippis2.1213188332.fake> stippi at BerliOS wrote: > * No functional changes. Ah, but I forgot about this: > --- > haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDeviceEngin > e.cpp 2008-06-11 20:51:56 UTC (rev 25931) > +++ > haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDeviceEngin > e.cpp 2008-06-11 22:24:34 UTC (rev 25932) > @@ -93,7 +93,7 @@ > Close(); > return EIO; > } > -#if 0 > +#if 1 > // set fragments > v = 0x7fff0000 | 0x000b; // unlimited * 2048 > if (ioctl(fFD, SNDCTL_DSP_SETFRAGMENT, &v, sizeof(int)) < 0) { > @@ -193,22 +193,27 @@ > } ... which turns on "fragment handling" or whatever in the OSS core - which in turn fixes distorted audio in my T60 (HDA) and another computer with C-Media chipset. Francois told me to try that in IRC and sound is absolutely "listenable" with that change for me. Under headphones, one can still hear clicks, which I believe have to do with incorrect latency handling for the first buffer and timesource drift handling in general. I want to work on those eventually. Best regards, -Stephan From anevilyak at mail.berlios.de Thu Jun 12 00:43:09 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Thu, 12 Jun 2008 00:43:09 +0200 Subject: [Haiku-commits] r25933 - haiku/trunk/src/add-ons/media/media-add-ons/opensound Message-ID: <200806112243.m5BMh9QV007126@sheep.berlios.de> Author: anevilyak Date: 2008-06-12 00:43:07 +0200 (Thu, 12 Jun 2008) New Revision: 25933 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25933&view=rev Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundAddOn.h haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.h Log: Build fixes. Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundAddOn.h =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundAddOn.h 2008-06-11 22:24:34 UTC (rev 25932) +++ haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundAddOn.h 2008-06-11 22:43:07 UTC (rev 25933) @@ -17,6 +17,8 @@ #define SETTINGS_FILE "Media/oss_audio_settings" +class BEntry; + class OpenSoundAddOn : public BMediaAddOn { Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.h =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.h 2008-06-11 22:24:34 UTC (rev 25932) +++ haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.h 2008-06-11 22:43:07 UTC (rev 25933) @@ -23,8 +23,8 @@ class OpenSoundDeviceMixer; struct audio_buf_info; +struct flavor_info; - class OpenSoundNode : public BBufferConsumer, public BBufferProducer, public BTimeSource, public BMediaEventLooper, public BControllable { From mmlr at mail.berlios.de Thu Jun 12 01:49:55 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Thu, 12 Jun 2008 01:49:55 +0200 Subject: [Haiku-commits] r25934 - haiku/trunk/src/servers/app/drawing Message-ID: <200806112349.m5BNntYH018624@sheep.berlios.de> Author: mmlr Date: 2008-06-12 01:49:53 +0200 (Thu, 12 Jun 2008) New Revision: 25934 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25934&view=rev Modified: haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp haiku/trunk/src/servers/app/drawing/DrawingEngine.h Log: * The StrokeLine() variation that takes a rgb_color did change the drawing state of the painter without restoring it afterwards (HighColor and DrawingMode). This function is only used in decorators, but as such it could lead to strange effects. When clicking and holding the close button on the R5 MidiPlayer for example, the background of the scope would suddenly become the color of the close buttons middle line. As the drawing mode was also overwritten this could probably have lead to text rendering issues when zooming applications. As I didn't find a easy way to reproduce such a thing, this is only theory though. * Implement the missing IsExclusiveAccessLocked() method in the DrawingEngine which is not used at the moment. If corresponding debug output is generated though, it reveals possible locking issues with CopyRegion(). * Remove an empty line in the LineArrayData struct. Modified: haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp 2008-06-11 22:43:07 UTC (rev 25933) +++ haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp 2008-06-11 23:49:53 UTC (rev 25934) @@ -132,6 +132,13 @@ } +bool +DrawingEngine::IsExclusiveAccessLocked() +{ + return fGraphicsCard->IsExclusiveAccessLocked(); +} + + void DrawingEngine::UnlockExclusiveAccess() { @@ -682,9 +689,15 @@ AutoFloatingOverlaysHider _(fGraphicsCard, touched); if (!fPainter->StraightLine(start, end, color)) { + rgb_color previousColor = fPainter->HighColor(); + drawing_mode previousMode = fPainter->DrawingMode(); + fPainter->SetHighColor(color); fPainter->SetDrawingMode(B_OP_OVER); fPainter->StrokeLine(start, end); + + fPainter->SetDrawingMode(previousMode); + fPainter->SetHighColor(previousColor); } _CopyToFront(touched); Modified: haiku/trunk/src/servers/app/drawing/DrawingEngine.h =================================================================== --- haiku/trunk/src/servers/app/drawing/DrawingEngine.h 2008-06-11 22:43:07 UTC (rev 25933) +++ haiku/trunk/src/servers/app/drawing/DrawingEngine.h 2008-06-11 23:49:53 UTC (rev 25934) @@ -32,7 +32,6 @@ BPoint pt1; BPoint pt2; rgb_color color; - } LineArrayData; class DrawingEngine : public HWInterfaceListener { From mmlr at mail.berlios.de Thu Jun 12 10:21:04 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Thu, 12 Jun 2008 10:21:04 +0200 Subject: [Haiku-commits] r25935 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200806120821.m5C8L4Tp027937@sheep.berlios.de> Author: mmlr Date: 2008-06-12 10:21:03 +0200 (Thu, 12 Jun 2008) New Revision: 25935 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25935&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp Log: Remove disabling and clearing interrupts again as it doesn't turn out to be a problem. Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp 2008-06-11 23:49:53 UTC (rev 25934) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp 2008-06-12 08:21:03 UTC (rev 25935) @@ -223,11 +223,6 @@ snooze(USB_DELAY_BUS_RESET); } - // Disable all interrupts and clear any current interrupt status - _WriteReg(OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTERRUPTS - | OHCI_MASTER_INTERRUPT_ENABLE); - _WriteReg(OHCI_INTERRUPT_STATUS, OHCI_ALL_INTERRUPTS); - // This reset should not be necessary according to the OHCI spec, but // without it some controllers do not start. _WriteReg(OHCI_CONTROL, OHCI_HC_FUNCTIONAL_STATE_RESET); From stippi at mail.berlios.de Thu Jun 12 10:46:02 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 12 Jun 2008 10:46:02 +0200 Subject: [Haiku-commits] r25936 - haiku/trunk/src/preferences/media Message-ID: <200806120846.m5C8k2Ct031423@sheep.berlios.de> Author: stippi Date: 2008-06-12 10:46:01 +0200 (Thu, 12 Jun 2008) New Revision: 25936 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25936&view=rev Modified: haiku/trunk/src/preferences/media/MediaViews.cpp Log: patch by Nate Eagleson: * The audio and video panes refered to the OS as "BeOS", now it's "Haiku". Thanks! Modified: haiku/trunk/src/preferences/media/MediaViews.cpp =================================================================== --- haiku/trunk/src/preferences/media/MediaViews.cpp 2008-06-12 08:21:03 UTC (rev 25935) +++ haiku/trunk/src/preferences/media/MediaViews.cpp 2008-06-12 08:46:01 UTC (rev 25936) @@ -144,9 +144,9 @@ rect2.bottom = rect.Height() - 5; BRect textRect(3, 3, rect2.Width() - 3, rect2.Height() - 3); BTextView *textView = new BTextView(rect2, "stringView", textRect, B_FOLLOW_ALL, B_WILL_DRAW); - textView->Insert(fIsVideo ? "Enabling Real-Time Video allows the BeOS to perform video operations as fast and smoothly as possible. It achieves optimum performance by using more RAM." + textView->Insert(fIsVideo ? "Enabling Real-Time Video allows Haiku to perform video operations as fast and smoothly as possible. It achieves optimum performance by using more RAM." "\n\nOnly enable this feature if you need the lowest latency possible." - : "Enabling Real-time Audio allows BeOS to record and play audio as fast as possible. It achieves this performance by using more CPU and RAM." + : "Enabling Real-time Audio allows Haiku to record and play audio as fast as possible. It achieves this performance by using more CPU and RAM." "\n\nOnly enable this feature if you need the lowest latency possible."); textView->MakeEditable(false); textView->MakeSelectable(false); From leavengood at gmail.com Thu Jun 12 12:58:33 2008 From: leavengood at gmail.com (Ryan Leavengood) Date: Thu, 12 Jun 2008 06:58:33 -0400 Subject: [Haiku-commits] r25934 - haiku/trunk/src/servers/app/drawing In-Reply-To: <200806112349.m5BNntYH018624@sheep.berlios.de> References: <200806112349.m5BNntYH018624@sheep.berlios.de> Message-ID: On Wed, Jun 11, 2008 at 7:49 PM, mmlr at BerliOS wrote: > Log: > * The StrokeLine() variation that takes a rgb_color did change the drawing > state of the painter without restoring it afterwards (HighColor and > DrawingMode). > This function is only used in decorators, but as such it could lead to > strange effects. When clicking and holding the close button on the R5 > MidiPlayer for example, the background of the scope would suddenly become > the color of the close buttons middle line. As the drawing mode was also > overwritten this could probably have lead to text rendering issues when > zooming applications. As I didn't find a easy way to reproduce such a thing, > this is only theory though. Maybe you fixed this one? http://dev.haiku-os.org/ticket/1468 Ryan From superstippi at gmx.de Thu Jun 12 13:35:03 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Thu, 12 Jun 2008 13:35:03 +0200 Subject: [Haiku-commits] r25917 - haiku/trunk/src/apps/terminal In-Reply-To: <200806102220.m5AMKFPo009295@sheep.berlios.de> References: <200806102220.m5AMKFPo009295@sheep.berlios.de> Message-ID: <20080612133503.674.1@stippis2.1213270075.fake> bonefish at BerliOS wrote: > I guess I'm done now with optimizations. After testing on real iron for > the first time, I'm a little impressed. In the "time seq ..." speed > competition Haiku's Terminal easily beats Konsole by 10 to 20% for 80x25 > and by factor 3+ for full screen. And if I interpret the results > correctly 90% of the time is actually used by "seq" itself which seems to > be about 5 times slower than under Linux. By "Konsole", do you mean the KDE Terminal? On my machine, the "seq 10000" test is about twice as fast in Haiku compared to the Gnome Terminal. When you say "seq itself", do you mean the value for "user" time? Both Haiku and Ubuntu use the VESA driver on my machine. In any case, impressive improvements! :-) Best regards, -Stephan From superstippi at gmx.de Thu Jun 12 13:37:09 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Thu, 12 Jun 2008 13:37:09 +0200 Subject: [Haiku-commits] r25934 - haiku/trunk/src/servers/app/drawing In-Reply-To: References: <200806112349.m5BNntYH018624@sheep.berlios.de> Message-ID: <20080612133709.805.2@stippis2.1213270075.fake> Ryan Leavengood wrote: > On Wed, Jun 11, 2008 at 7:49 PM, mmlr at BerliOS > wrote: > > Log: > > * The StrokeLine() variation that takes a rgb_color did change the > > drawing > > state of the painter without restoring it afterwards (HighColor and > > DrawingMode). > > This function is only used in decorators, but as such it could lead to > > strange effects. When clicking and holding the close button on the R5 > > MidiPlayer for example, the background of the scope would suddenly > > become the color of the close buttons middle line. As the drawing mode > > was also overwritten this could probably have lead to text rendering > > issues when zooming applications. As I didn't find a easy way to > > reproduce such a thing, this is only theory though. > > Maybe you fixed this one? > > http://dev.haiku-os.org/ticket/1468 He probably did. :-) Best regards, -Stephan From revol at free.fr Thu Jun 12 13:53:12 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Thu, 12 Jun 2008 13:53:12 +0200 CEST Subject: [Haiku-commits] r25917 - haiku/trunk/src/apps/terminal In-Reply-To: <20080612133503.674.1@stippis2.1213270075.fake> Message-ID: <5736154884-BeMail@laptop> > > bonefish at BerliOS wrote: > > I guess I'm done now with optimizations. After testing on real iron > > for > > the first time, I'm a little impressed. In the "time seq ..." speed > > competition Haiku's Terminal easily beats Konsole by 10 to 20% for > > 80x25 > > and by factor 3+ for full screen. And if I interpret the results > > correctly 90% of the time is actually used by "seq" itself which > > seems to > > be about 5 times slower than under Linux. > > By "Konsole", do you mean the KDE Terminal? On my machine, the "seq > 10000" > test is about twice as fast in Haiku compared to the Gnome Terminal. > When > you say "seq itself", do you mean the value for "user" time? Both > Haiku and > Ubuntu use the VESA driver on my machine. All in all, they don't have the same feature set though... But one hardly uses 256 colors so I suppose it's better this way. I recently noticed gnome-terminal is really slow displaying the command line when the prompt has non-displayable chars that are wrapped around \[ \] as should be done. Removing the brackets removes the slowness, oddly... Fran?ois. From mmu_man at mail.berlios.de Thu Jun 12 13:57:20 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 12 Jun 2008 13:57:20 +0200 Subject: [Haiku-commits] r25937 - haiku/trunk/3rdparty/mmu_man/scripts Message-ID: <200806121157.m5CBvK1J010343@sheep.berlios.de> Author: mmu_man Date: 2008-06-12 13:57:20 +0200 (Thu, 12 Jun 2008) New Revision: 25937 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25937&view=rev Modified: haiku/trunk/3rdparty/mmu_man/scripts/dev-perso Log: Remove \[ \] markers in PS1. They are supposed to contain non-displayable control characters, but gnome-terminal is painfully slow at editting the command line with those... Modified: haiku/trunk/3rdparty/mmu_man/scripts/dev-perso =================================================================== --- haiku/trunk/3rdparty/mmu_man/scripts/dev-perso 2008-06-12 08:46:01 UTC (rev 25936) +++ haiku/trunk/3rdparty/mmu_man/scripts/dev-perso 2008-06-12 11:57:20 UTC (rev 25937) @@ -98,7 +98,8 @@ ;; *) # prompt: set window title to [project:folder] also - export PS1='\[\033]0;['$1':\W]\a\]\[\033[1m\][\u@\h \w]\[\033[0m\]\$ ' + #export PS1='\[\033]0;['$1':\W]\a\]\[\033[1m\][\u@\h \w]\[\033[0m\]\$ ' + export PS1='\033]0;['$1':\W]\a\033[1m[\u@\h \w]\033[0m\$ ' ;; esac # lower priority so background builds don't slow the GUI too much From superstippi at gmx.de Thu Jun 12 13:59:41 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Thu, 12 Jun 2008 13:59:41 +0200 Subject: [Haiku-commits] r25917 - haiku/trunk/src/apps/terminal In-Reply-To: <5736154884-BeMail@laptop> References: <5736154884-BeMail@laptop> Message-ID: <20080612135941.1458.4@stippis2.1213270075.fake> Fran?ois Revol wrote: > > > > bonefish at BerliOS wrote: > > > I guess I'm done now with optimizations. After testing on real iron > > > for > > > the first time, I'm a little impressed. In the "time seq ..." speed > > > competition Haiku's Terminal easily beats Konsole by 10 to 20% for > > > 80x25 > > > and by factor 3+ for full screen. And if I interpret the results > > > correctly 90% of the time is actually used by "seq" itself which > > > seems to > > > be about 5 times slower than under Linux. > > > > By "Konsole", do you mean the KDE Terminal? On my machine, the "seq > > 10000" > > test is about twice as fast in Haiku compared to the Gnome Terminal. > > When > > you say "seq itself", do you mean the value for "user" time? Both Haiku > > and > > Ubuntu use the VESA driver on my machine. > > All in all, they don't have the same feature set though... But one hardly > uses 256 colors so I suppose it's better this way. I don't understand what you refer to. Both VESA drivers seem to perform very similar if that's what you mean. Best regards, -Stephan From revol at free.fr Thu Jun 12 14:09:24 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Thu, 12 Jun 2008 14:09:24 +0200 CEST Subject: [Haiku-commits] r25917 - haiku/trunk/src/apps/terminal In-Reply-To: <20080612135941.1458.4@stippis2.1213270075.fake> Message-ID: <6708572032-BeMail@laptop> > > > By "Konsole", do you mean the KDE Terminal? On my machine, the > > > "seq > > > 10000" > > > test is about twice as fast in Haiku compared to the Gnome > > > Terminal. > > > When > > > you say "seq itself", do you mean the value for "user" time? Both > > > Haiku > > > and > > > Ubuntu use the VESA driver on my machine. > > > > All in all, they don't have the same feature set though... But one > > hardly > > uses 256 colors so I suppose it's better this way. > > I don't understand what you refer to. Both VESA drivers seem to > perform > very similar if that's what you mean. I mean the 256-colors xterm mode: http://www.frexx.de/xterm-256-notes/ Fran?ois. From mmlr at mlotz.ch Thu Jun 12 14:39:43 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Thu, 12 Jun 2008 14:39:43 +0200 Subject: [Haiku-commits] r25934 - haiku/trunk/src/servers/app/drawing In-Reply-To: <20080612133709.805.2@stippis2.1213270075.fake> References: <200806112349.m5BNntYH018624@sheep.berlios.de> <20080612133709.805.2@stippis2.1213270075.fake> Message-ID: <20080612121430.M306@mlotz.ch> On Thu, 12 Jun 2008 13:37:09 +0200, Stephan Assmus wrote > Ryan Leavengood wrote: >>On Wed, Jun 11, 2008 at 7:49 PM, mmlr at BerliOS >>wrote: >>> Log: >>> * The StrokeLine() variation that takes a rgb_color did change the >>> drawing >>> state of the painter without restoring it afterwards (HighColor and >>> DrawingMode). >>> This function is only used in decorators, but as such it could lead to >>> strange effects. When clicking and holding the close button on the R5 >>> MidiPlayer for example, the background of the scope would suddenly >>> become the color of the close buttons middle line. As the drawing mode >>> was also overwritten this could probably have lead to text rendering >>> issues when zooming applications. As I didn't find a easy way to >>> reproduce such a thing, this is only theory though. >> >> Maybe you fixed this one? >> >> http://dev.haiku-os.org/ticket/1468 > > He probably did. :-) I'm not so sure about that. I only fixed messing with the painter draw state without cleaning it up afterwards. This should only affect the case where the decorator is drawn and then something in a view is drawn without the state being explicitly set again inbetween. The decorator itself always sets the used colors explicitly, so it should not affect decorator drawing at all. That the decorator itself draws the zoom button wrongly (which is just drawing two rectangles over eachother, it's not that one of them actually got clipped), does look generally strange to me. It should not happen, as the rects are always drawn one after the other. We are talking about "src/servers/app/DefaultDecorator.cpp" and its _DrawZoom() method here and looking through it I don't see how this would actually happen. It would be like one thread drawing the gradients and then some other thread drawing the gray rectangle over it at the same time or something like this. Generally this default decorator is extremely inefficient. It always calculates it's colors and then draws the lines individually. It doesn't even use a line array. Setting each of the colors for the lines involves modifying the painter high-color and drawing mode, doing the drawing with that modified draw state and then (now with that commit) resetting the draw state back. Each line itself in that process causes a blit on the graphics card, as they are not combined in a line array, but do actual individual lines. All of the drawing should be cached, probably simply blit-ready bitmaps should be created for both button states and focus/non-focus cases. I will look into this over the coming days, as I am looking through a few other drawing glitches in that area anyway. Regards Michael From ingo_weinhold at gmx.de Thu Jun 12 14:47:58 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Thu, 12 Jun 2008 14:47:58 +0200 Subject: [Haiku-commits] r25917 - haiku/trunk/src/apps/terminal In-Reply-To: <20080612133503.674.1@stippis2.1213270075.fake> References: <200806102220.m5AMKFPo009295@sheep.berlios.de> <20080612133503.674.1@stippis2.1213270075.fake> Message-ID: <20080612144758.538.2@knochen-vm.1213270831.fake> On 2008-06-12 at 13:35:03 [+0200], Stephan Assmus wrote: > bonefish at BerliOS wrote: > > I guess I'm done now with optimizations. After testing on real iron for > > the first time, I'm a little impressed. In the "time seq ..." speed > > competition Haiku's Terminal easily beats Konsole by 10 to 20% for 80x25 > > and by factor 3+ for full screen. And if I interpret the results > > correctly 90% of the time is actually used by "seq" itself which seems to > > be about 5 times slower than under Linux. > > By "Konsole", do you mean the KDE Terminal? Yep, it's called Konsole. :-) IIRC the last terminal performance comparison I read found Konsole and gnome-terminal to be the fastest terminals on Linux. > On my machine, the "seq 10000" > test is about twice as fast in Haiku compared to the Gnome Terminal. When > you say "seq itself", do you mean the value for "user" time? user + kernel time actually (kernel time should be rather low, though), which is the time "seq" actually ran. > Both Haiku and > Ubuntu use the VESA driver on my machine. In my case Linux used a native nvidia driver while Haiku used VESA. But since the redrawing is throttled to 10 times per second in this case, it really doesn't make a difference for Haiku (though I guess Linux actually benefits) -- even in full screen mode it's only a few percent slower than for 80x25. CU, Ingo From philippe.houdoin at free.fr Thu Jun 12 14:59:12 2008 From: philippe.houdoin at free.fr (philippe.houdoin at free.fr) Date: Thu, 12 Jun 2008 14:59:12 +0200 Subject: [Haiku-commits] r25936 - haiku/trunk/src/preferences/media Message-ID: <5d6219c0ef9bb5cf89e6dca64fa49a46@free.fr> > Modified: > haiku/trunk/src/preferences/media/MediaViews.cpp > Log: > patch by Nate Eagleson: > * The audio and video panes refered to the OS as "BeOS", now it's "Haiku". > > Thanks! May I suggest that we stand to our AboutSystem'ist policy : don't hardcode distribution name. Instead, use "system", as in: "Enabling Real-Time {Video|Audio} allows system to perform..." Bye, Philippe. From stippi at mail.berlios.de Thu Jun 12 15:03:05 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 12 Jun 2008 15:03:05 +0200 Subject: [Haiku-commits] r25938 - haiku/trunk/src/add-ons/media/media-add-ons/opensound Message-ID: <200806121303.m5CD353K016218@sheep.berlios.de> Author: stippi Date: 2008-06-12 15:03:05 +0200 (Thu, 12 Jun 2008) New Revision: 25938 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25938&view=rev Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.h Log: * More WIP cleanup and simplifications * Fixed another memory leak in NodeRegistered() Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp 2008-06-12 11:57:20 UTC (rev 25937) +++ haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp 2008-06-12 13:03:05 UTC (rev 25938) @@ -29,7 +29,7 @@ 0 }; -const char *gSupportedFormatsNames[] = { +const char* gSupportedFormatsNames[] = { "raw", //AFMT_SUPPORTED_PCM, "?-law", //AFMT_MU_LAW, "a-law", //AFMT_A_LAW, Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp 2008-06-12 11:57:20 UTC (rev 25937) +++ haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp 2008-06-12 13:03:05 UTC (rev 25938) @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -29,24 +30,30 @@ #include "OpenSoundDeviceEngine.h" #include "OpenSoundDeviceMixer.h" +using std::nothrow; + class OpenSoundNode::NodeInput { public: - NodeInput(const media_input& input, const media_format& format) - : fNode(NULL), - fEngineIndex(-1), + NodeInput(const media_input& input, int engineIndex, int ossFormatFlags, + OpenSoundNode* node) + : fNode(node), + fEngineIndex(engineIndex), fRealEngine(NULL), - fOSSFormatFlags(0), + fOSSFormatFlags(ossFormatFlags), fInput(input), - fPreferredFormat(format), + fPreferredFormat(input.format), + // Keep a version of the original preferred format, + // in case we are re-connected and need to start "clean" fThread(-1), - fBufferCycle(1), - fBuffers(4) { CALLED(); + + fInput.format.u.raw_audio.format + = media_raw_audio_format::wildcard.format; } ~NodeInput() @@ -102,7 +109,6 @@ media_format fPreferredFormat; thread_id fThread; - uint32 fBufferCycle; BList fBuffers; // contains BBuffer* pointers that have not yet played }; @@ -123,8 +129,7 @@ fBufferGroup(NULL), fOutputEnabled(true), - fSamplesSent(0), - fBufferCycle(1) + fSamplesSent(0) { CALLED(); } @@ -184,7 +189,6 @@ BBufferGroup* fBufferGroup; bool fOutputEnabled; uint64 fSamplesSent; - volatile uint32 fBufferCycle; }; @@ -331,8 +335,8 @@ PRINT(("NodeRegistered: %d engines\n", fDevice->CountEngines())); for (int32 i = 0; i < fDevice->CountEngines(); i++) { - OpenSoundDeviceEngine *engine = fDevice->EngineAt(i); - if (!engine) + OpenSoundDeviceEngine* engine = fDevice->EngineAt(i); + if (engine == NULL) continue; // skip shadow engines if (engine->Caps() & PCM_CAP_SHADOW) @@ -344,46 +348,42 @@ PRINT(("NodeRegistered: engine[%d]: .caps=0x%08x, .oformats=0x%08x\n", i, engine->Caps(), engine->Info()->oformats)); + // iterate over all possible OSS formats/encodings and + // create a NodeInput for each for (int32 f = 0; gSupportedFormats[f]; f++) { + // figure out if the engine supports the given format int fmt = gSupportedFormats[f] & engine->Info()->oformats; if (fmt == 0) continue; PRINT(("NodeRegistered() : creating an input for engine %i, " "format[%i]\n", i, f)); - media_format preferredFormat; - status_t err = engine->PreferredFormatFor(fmt, preferredFormat); + media_input mediaInput; + status_t err = engine->PreferredFormatFor(fmt, mediaInput.format); if (err < B_OK) continue; - media_input input; - - //input->format = fPreferredFormat;//XXX - input.format = preferredFormat; - input.destination.port = ControlPort(); - input.destination.id = fInputs.CountItems(); - input.node = Node(); + mediaInput.destination.port = ControlPort(); + mediaInput.destination.id = fInputs.CountItems(); + mediaInput.node = Node(); char *prefix = ""; if (strstr(engine->Info()->name, "SPDIF")) prefix = "S/PDIF "; - sprintf(input.name, "%s%s output %ld", prefix, - gSupportedFormatsNames[f], input.destination.id); + sprintf(mediaInput.name, "%sOutput %ld (%s)", prefix, + mediaInput.destination.id, gSupportedFormatsNames[f]); - NodeInput* currentInput = new NodeInput(input, preferredFormat); - currentInput->fInput.format = currentInput->fPreferredFormat; - currentInput->fEngineIndex = i; - currentInput->fOSSFormatFlags = fmt; - currentInput->fNode = this; - fInputs.AddItem(currentInput); - - currentInput->fInput.format.u.raw_audio.format - = media_raw_audio_format::wildcard.format; + NodeInput* input = new (nothrow) NodeInput(mediaInput, i, fmt, + this); + if (input == NULL || !fInputs.AddItem(input)) { + delete input; + continue; + } } } for (int32 i = 0; i < fDevice->CountEngines(); i++) { - OpenSoundDeviceEngine *engine = fDevice->EngineAt(i); - if (!engine) + OpenSoundDeviceEngine* engine = fDevice->EngineAt(i); + if (engine == NULL) continue; // skip shadow engines if (engine->Caps() & PCM_CAP_SHADOW) @@ -407,52 +407,56 @@ if (err < B_OK) continue; - media_output *output = new media_output; + media_output mediaOutput; - //output->format = fPreferredFormat; //XXX - output->format = preferredFormat; - output->destination = media_destination::null; - output->source.port = ControlPort(); - output->source.id = fOutputs.CountItems(); - output->node = Node(); + mediaOutput.format = preferredFormat; + mediaOutput.destination = media_destination::null; + mediaOutput.source.port = ControlPort(); + mediaOutput.source.id = fOutputs.CountItems(); + mediaOutput.node = Node(); char *prefix = ""; if (strstr(engine->Info()->name, "SPDIF")) prefix = "S/PDIF "; - sprintf(output->name, "%s%s input %ld", prefix, - gSupportedFormatsNames[f], output->source.id); + sprintf(mediaOutput.name, "%sInput %ld (%s)", prefix, + mediaOutput.source.id, gSupportedFormatsNames[f]); - NodeOutput* currentOutput = new NodeOutput(*output, + NodeOutput* output = new (nothrow) NodeOutput(mediaOutput, preferredFormat); -// currentOutput->fPreferredFormat.u.raw_audio.channel_count + if (output == NULL || !fOutputs.AddItem(output)) { + delete output; + continue; + } +// output->fPreferredFormat.u.raw_audio.channel_count // = engine->Info()->max_channels; - currentOutput->fOutput.format = currentOutput->fPreferredFormat; - currentOutput->fEngineIndex = i; - currentOutput->fOSSFormatFlags = fmt; - currentOutput->fNode = this; - fOutputs.AddItem(currentOutput); + output->fOutput.format = output->fPreferredFormat; + output->fEngineIndex = i; + output->fOSSFormatFlags = fmt; + output->fNode = this; } } - // Set up our parameter web + // set up our parameter web fWeb = MakeParameterWeb(); SetParameterWeb(fWeb); - /* apply configuration */ + // apply configuration #ifdef PRINTING bigtime_t start = system_time(); #endif - + int32 index = 0; int32 parameterID = 0; - const void *data; - ssize_t size; - while(fConfig.FindInt32("parameterID", index, ¶meterID) == B_OK) { - if(fConfig.FindData("parameterData", B_RAW_TYPE, index, &data, &size) == B_OK) + while (fConfig.FindInt32("parameterID", index, ¶meterID) == B_OK) { + const void* data; + ssize_t size; + if (fConfig.FindData("parameterData", B_RAW_TYPE, index, &data, + &size) == B_OK) { SetParameterValue(parameterID, TimeSource()->Now(), data, size); + } index++; } - PRINT(("apply configuration in : %ld\n", system_time() - start)); + PRINT(("apply configuration in : %lld?s\n", system_time() - start)); } @@ -474,6 +478,10 @@ // #pragma mark - BBufferConsumer +//! Someone, probably the producer, is asking you about this format. +// Give your honest opinion, possibly modifying *format. Do not ask +// upstream producer about the format, since he's synchronously +// waiting for your reply. status_t OpenSoundNode::AcceptFormat(const media_destination& dest, media_format* format) @@ -486,15 +494,17 @@ NodeInput* channel = _FindInput(dest); if (channel == NULL) { - fprintf(stderr,"<- B_MEDIA_BAD_DESTINATION"); + fprintf(stderr, "OpenSoundNode::AcceptFormat()" + " - B_MEDIA_BAD_DESTINATION"); return B_MEDIA_BAD_DESTINATION; // we only have one input so that better be it } - if (format == 0) { - fprintf(stderr,"<- B_BAD_VALUE\n"); - return B_BAD_VALUE; // no crashing + if (format == NULL) { + fprintf(stderr, "OpenSoundNode::AcceptFormat() - B_BAD_VALUE\n"); + return B_BAD_VALUE; } + /* media_format * myFormat = GetFormat(); fprintf(stderr,"proposed format: "); print_media_format(format); @@ -512,7 +522,8 @@ if (!engine) return B_BUSY; - status_t err = engine->AcceptFormatFor(channel->fOSSFormatFlags, *format, false); + status_t err = engine->AcceptFormatFor(channel->fOSSFormatFlags, *format, + false); if (err < B_OK) return err; @@ -529,179 +540,221 @@ channel->fInput.format = *format; /*if(format->u.raw_audio.format == media_raw_audio_format::B_AUDIO_FLOAT - && channel->fPreferredFormat.u.raw_audio.format == media_raw_audio_format::B_AUDIO_SHORT) + && channel->fPreferredFormat.u.raw_audio.format + == media_raw_audio_format::B_AUDIO_SHORT) format->u.raw_audio.format = media_raw_audio_format::B_AUDIO_FLOAT; else*/ /* format->u.raw_audio.format = channel->fPreferredFormat.u.raw_audio.format; - format->u.raw_audio.valid_bits = channel->fPreferredFormat.u.raw_audio.valid_bits; + format->u.raw_audio.valid_bits + = channel->fPreferredFormat.u.raw_audio.valid_bits; - format->u.raw_audio.frame_rate = channel->fPreferredFormat.u.raw_audio.frame_rate; - format->u.raw_audio.channel_count = channel->fPreferredFormat.u.raw_audio.channel_count; - format->u.raw_audio.byte_order = B_MEDIA_HOST_ENDIAN; + format->u.raw_audio.frame_rate + = channel->fPreferredFormat.u.raw_audio.frame_rate; + format->u.raw_audio.channel_count + = channel->fPreferredFormat.u.raw_audio.channel_count; + format->u.raw_audio.byte_order + = B_MEDIA_HOST_ENDIAN; - format->u.raw_audio.buffer_size = DEFAULT_BUFFER_SIZE - * (format->u.raw_audio.format & media_raw_audio_format::B_AUDIO_SIZE_MASK) - * format->u.raw_audio.channel_count; -*/ + format->u.raw_audio.buffer_size + = DEFAULT_BUFFER_SIZE + * (format->u.raw_audio.format + & media_raw_audio_format::B_AUDIO_SIZE_MASK) + * format->u.raw_audio.channel_count; +*/ - /*media_format myFormat; - GetFormat(&myFormat); - if (!format_is_acceptible(*format,myFormat)) { - fprintf(stderr,"<- B_MEDIA_BAD_FORMAT\n"); - return B_MEDIA_BAD_FORMAT; - }*/ - //AddRequirements(format); +// media_format myFormat; +// GetFormat(&myFormat); +// if (!format_is_acceptible(*format,myFormat)) { +// fprintf(stderr,"<- B_MEDIA_BAD_FORMAT\n"); +// return B_MEDIA_BAD_FORMAT; +// } + return B_OK; } -status_t OpenSoundNode::GetNextInput( - int32 * cookie, - media_input * out_input) + +status_t +OpenSoundNode::GetNextInput(int32* cookie, media_input* out_input) { CALLED(); + // let's not crash even if they are stupid - if (out_input == 0) { + if (out_input == NULL) { // no place to write! - fprintf(stderr,"<- B_BAD_VALUE\n"); + fprintf(stderr,"OpenSoundNode::GetNextInput() - B_BAD_VALUE\n"); return B_BAD_VALUE; } - if ((*cookie < fInputs.CountItems()) && (*cookie >= 0)) { - NodeInput *channel = (NodeInput *)fInputs.ItemAt(*cookie); - *out_input = channel->fInput; - *cookie += 1; - PRINT(("input.format : %u\n", channel->fInput.format.u.raw_audio.format)); - return B_OK; - } else + if (*cookie >= fInputs.CountItems() || *cookie < 0) return B_BAD_INDEX; + + NodeInput* channel = (NodeInput*)fInputs.ItemAt(*cookie); + *out_input = channel->fInput; + *cookie += 1; + + PRINT(("input.format : %u\n", channel->fInput.format.u.raw_audio.format)); + + return B_OK; } -void OpenSoundNode::DisposeInputCookie( - int32 cookie) + +void +OpenSoundNode::DisposeInputCookie(int32 cookie) { CALLED(); // nothing to do since our cookies are just integers } -void OpenSoundNode::BufferReceived( - BBuffer * buffer) + +void +OpenSoundNode::BufferReceived(BBuffer* buffer) { - /**/CALLED(); + CALLED(); + switch (buffer->Header()->type) { - /*case B_MEDIA_PARAMETERS: - { - status_t status = ApplyParameterData(buffer->Data(),buffer->SizeUsed()); - if (status != B_OK) { - fprintf(stderr,"ApplyParameterData in OpenSoundNode::BufferReceived failed\n"); - } - buffer->Recycle(); - } - break;*/ +// case B_MEDIA_PARAMETERS: +// { +// status_t status = ApplyParameterData(buffer->Data(), +// buffer->SizeUsed()); +// if (status != B_OK) { +// fprintf(stderr, "ApplyParameterData() in " +// "OpenSoundNode::BufferReceived() failed: %s\n", +// strerror(status)); +// } +// buffer->Recycle(); +// break; +// } case B_MEDIA_RAW_AUDIO: if (buffer->Flags() & BBuffer::B_SMALL_BUFFER) { - fprintf(stderr,"NOT IMPLEMENTED: B_SMALL_BUFFER in OpenSoundNode::BufferReceived\n"); + fprintf(stderr, "OpenSoundNode::BufferReceived() - " + "B_SMALL_BUFFER not implemented\n"); // XXX: implement this part buffer->Recycle(); } else { - media_timed_event event(buffer->Header()->start_time, BTimedEventQueue::B_HANDLE_BUFFER, - buffer, BTimedEventQueue::B_RECYCLE_BUFFER); + media_timed_event event(buffer->Header()->start_time, + BTimedEventQueue::B_HANDLE_BUFFER, buffer, + BTimedEventQueue::B_RECYCLE_BUFFER); status_t status = EventQueue()->AddEvent(event); if (status != B_OK) { - fprintf(stderr,"EventQueue()->AddEvent(event) in OpenSoundNode::BufferReceived failed\n"); + fprintf(stderr, "OpenSoundNode::BufferReceived() - " + "EventQueue()->AddEvent() failed: %s\n", + strerror(status)); buffer->Recycle(); } } break; default: - fprintf(stderr,"unexpected buffer type in OpenSoundNode::BufferReceived\n"); + fprintf(stderr, "OpenSoundNode::BufferReceived() - unexpected " + "buffer type\n"); buffer->Recycle(); break; } } -void OpenSoundNode::ProducerDataStatus( - const media_destination & for_whom, - int32 status, - bigtime_t at_performance_time) + +void +OpenSoundNode::ProducerDataStatus(const media_destination& for_whom, + int32 status, bigtime_t at_performance_time) { - /**/CALLED(); + CALLED(); - NodeInput *channel = _FindInput(for_whom); + NodeInput* channel = _FindInput(for_whom); - if(channel==NULL) { - fprintf(stderr,"invalid destination received in OpenSoundNode::ProducerDataStatus\n"); + if (channel == NULL) { + fprintf(stderr,"OpenSoundNode::ProducerDataStatus() - " + "invalid destination\n"); return; } - //PRINT(("************ ProducerDataStatus: queuing event ************\n")); - //PRINT(("************ status=%d ************\n", status)); +// PRINT(("************ ProducerDataStatus: queuing event ************\n")); +// PRINT(("************ status=%d ************\n", status)); - media_timed_event event(at_performance_time, BTimedEventQueue::B_DATA_STATUS, - &channel->fInput, BTimedEventQueue::B_NO_CLEANUP, status, 0, NULL); + media_timed_event event(at_performance_time, + BTimedEventQueue::B_DATA_STATUS, &channel->fInput, + BTimedEventQueue::B_NO_CLEANUP, status, 0, NULL); EventQueue()->AddEvent(event); } -status_t OpenSoundNode::GetLatencyFor( - const media_destination & for_whom, - bigtime_t * out_latency, - media_node_id * out_timesource) + +status_t +OpenSoundNode::GetLatencyFor(const media_destination& for_whom, + bigtime_t* out_latency, media_node_id* out_timesource) { CALLED(); - if ((out_latency == 0) || (out_timesource == 0)) { - fprintf(stderr,"<- B_BAD_VALUE\n"); + + if (out_latency == NULL || out_timesource == NULL) { + fprintf(stderr,"OpenSoundNode::GetLatencyFor() - B_BAD_VALUE\n"); return B_BAD_VALUE; } - NodeInput *channel = _FindInput(for_whom); + NodeInput* channel = _FindInput(for_whom); - if(channel==NULL || channel->fRealEngine==NULL) { - fprintf(stderr,"<- B_MEDIA_BAD_DESTINATION\n"); + if (channel == NULL || channel->fRealEngine == NULL) { + fprintf(stderr,"OpenSoundNode::GetLatencyFor() - " + "B_MEDIA_BAD_DESTINATION\n"); return B_MEDIA_BAD_DESTINATION; } - *out_latency = EventLatency(); // mmu_man: that's the own node latency (1 buffer) + + // start with the node latency (1 buffer duration) + *out_latency = EventLatency(); + // add the OSS driver buffer's latency as well *out_latency += channel->fRealEngine->PlaybackLatency(); - PRINT(("############ OpenSoundNode::%s: EventLatency %Ld, OSS %Ld\n", __FUNCTION__, EventLatency(), channel->fRealEngine->PlaybackLatency())); - //*out_latency += MIN_SNOOZING; + + PRINT(("OpenSoundNode::GetLatencyFor() - EventLatency %lld, OSS %lld\n", + EventLatency(), channel->fRealEngine->PlaybackLatency())); + *out_timesource = TimeSource()->ID(); + return B_OK; } -status_t OpenSoundNode::Connected( - const media_source & producer, /* here's a good place to request buffer group usage */ - const media_destination & where, - const media_format & with_format, - media_input * out_input) + +status_t +OpenSoundNode::Connected(const media_source& producer, + const media_destination& where, const media_format& with_format, + media_input* out_input) { CALLED(); - if (out_input == 0) { - fprintf(stderr,"<- B_BAD_VALUE\n"); - return B_BAD_VALUE; // no crashing + + if (out_input == NULL) { + fprintf(stderr,"OpenSoundNode::Connected() - B_BAD_VALUE\n"); + return B_BAD_VALUE; } - + NodeInput *channel = _FindInput(where); - - if(channel==NULL) { - fprintf(stderr,"<- B_MEDIA_BAD_DESTINATION\n"); + + if (channel == NULL) { + fprintf(stderr,"OpenSoundNode::Connected() - " + "B_MEDIA_BAD_DESTINATION\n"); return B_MEDIA_BAD_DESTINATION; } - + BAutolock L(fDevice->Locker()); - + // use one buffer length latency - fInternalLatency = with_format.u.raw_audio.buffer_size * 10000 / 2 - / ( (with_format.u.raw_audio.format & media_raw_audio_format::B_AUDIO_SIZE_MASK) - * with_format.u.raw_audio.channel_count) - / ((int32)(with_format.u.raw_audio.frame_rate / 100)); + size_t bufferSize = with_format.u.raw_audio.buffer_size; + int32 channelCount = with_format.u.raw_audio.channel_count; + size_t sampleSize = with_format.u.raw_audio.format + & media_raw_audio_format::B_AUDIO_SIZE_MASK; + size_t frameSize = sampleSize * channelCount; + float frameRate = with_format.u.raw_audio.frame_rate; + + fInternalLatency = bufferSize * 10000 / 2 + / frameSize / (int32)(frameRate / 100); - PRINT((" internal latency = %lld\n",fInternalLatency)); - //fInternalLatency = 0; + PRINT((" internal latency = %lld\n", fInternalLatency)); + + // TODO: A global node value is assigned a channel specific value! + // That can't be correct. For as long as there is only one output + // in use at a time, this will not matter of course. SetEventLatency(fInternalLatency); // record the agreed upon values channel->fInput.source = producer; channel->fInput.format = with_format; + *out_input = channel->fInput; // we are sure the thread is started @@ -2479,7 +2532,7 @@ OpenSoundNode::_PlayThreadEntry(void* data) { CALLED(); - NodeInput *channel = static_cast(data); + NodeInput* channel = static_cast(data); return channel->fNode->_PlayThread(channel); } @@ -2488,7 +2541,7 @@ OpenSoundNode::_RecThreadEntry(void* data) { CALLED(); - NodeOutput *channel = static_cast(data); + NodeOutput* channel = static_cast(data); return channel->fNode->_RecThread(channel); } Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.h =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.h 2008-06-12 11:57:20 UTC (rev 25937) +++ haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.h 2008-06-12 13:03:05 UTC (rev 25938) @@ -72,10 +72,6 @@ virtual status_t AcceptFormat( const media_destination& dest, media_format* format); - // Someone, probably the producer, is asking you about this format. - // Give your honest opinion, possibly modifying *format. Do not ask - // upstream producer about the format, since he's synchronously - // waiting for your reply. virtual status_t GetNextInput(int32* cookie, media_input* out_input); virtual void DisposeInputCookie(int32 cookie); From mmu_man at mail.berlios.de Thu Jun 12 15:44:50 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 12 Jun 2008 15:44:50 +0200 Subject: [Haiku-commits] r25939 - haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial Message-ID: <200806121344.m5CDioRI022091@sheep.berlios.de> Author: mmu_man Date: 2008-06-12 15:44:49 +0200 (Thu, 12 Jun 2008) New Revision: 25939 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25939&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/ACM.cpp haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/ACM.h haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Driver.h haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/FTDI.cpp haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/FTDI.h haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Jamfile haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/KLSI.cpp haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/KLSI.h haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.h haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Tracing.cpp Log: - change KLSI init the way it's done by the linux driver - do not count usb headers as part of count returned by write(), else we might end up writing more than the passed amount :) Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/ACM.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/ACM.cpp 2008-06-12 13:03:05 UTC (rev 25938) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/ACM.cpp 2008-06-12 13:44:49 UTC (rev 25939) @@ -114,7 +114,7 @@ void -ACMDevice::OnWrite(const char *buffer, size_t *numBytes) +ACMDevice::OnWrite(const char *buffer, size_t *numBytes, size_t *packetBytes) { memcpy(WriteBuffer(), buffer, *numBytes); } Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/ACM.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/ACM.h 2008-06-12 13:03:05 UTC (rev 25938) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/ACM.h 2008-06-12 13:44:49 UTC (rev 25939) @@ -30,7 +30,8 @@ virtual status_t SetLineCoding(usb_serial_line_coding *coding); virtual status_t SetControlLineState(uint16 state); -virtual void OnWrite(const char *buffer, size_t *numBytes); +virtual void OnWrite(const char *buffer, size_t *numBytes, + size_t *packetBytes); }; #endif //_USB_ACM_H_ Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Driver.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Driver.h 2008-06-12 13:03:05 UTC (rev 25938) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Driver.h 2008-06-12 13:44:49 UTC (rev 25939) @@ -11,8 +11,13 @@ #include #include #include +#include +#ifdef __HAIKU__ +#include +#else #include "BeOSCompatibility.h" +#endif #include "kernel_cpp.h" #include "Tracing.h" #include "USB3.h" Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/FTDI.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/FTDI.cpp 2008-06-12 13:03:05 UTC (rev 25938) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/FTDI.cpp 2008-06-12 13:44:49 UTC (rev 25939) @@ -212,16 +212,16 @@ void -FTDIDevice::OnWrite(const char *buffer, size_t *numBytes) +FTDIDevice::OnWrite(const char *buffer, size_t *numBytes, size_t *packetBytes) { char *writeBuffer = WriteBuffer(); if (fHeaderLength > 0) { if (*numBytes >= WriteBufferSize() - fHeaderLength) - *numBytes = WriteBufferSize() - fHeaderLength; + *numBytes = *packetBytes = WriteBufferSize() - fHeaderLength; *writeBuffer = FTDI_OUT_TAG(*numBytes, FTDI_PIT_DEFAULT); } - memcpy(writeBuffer + fHeaderLength, buffer, *numBytes); - *numBytes += fHeaderLength; + memcpy(writeBuffer + fHeaderLength, buffer, *packetBytes); + *packetBytes += fHeaderLength; } Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/FTDI.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/FTDI.h 2008-06-12 13:03:05 UTC (rev 25938) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/FTDI.h 2008-06-12 13:44:49 UTC (rev 25939) @@ -31,7 +31,8 @@ virtual status_t SetControlLineState(uint16 state); virtual void OnRead(char **buffer, size_t *numBytes); -virtual void OnWrite(const char *buffer, size_t *numBytes); +virtual void OnWrite(const char *buffer, size_t *numBytes, + size_t *packetBytes); private: size_t fHeaderLength; Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Jamfile 2008-06-12 13:03:05 UTC (rev 25938) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Jamfile 2008-06-12 13:44:49 UTC (rev 25939) @@ -2,6 +2,11 @@ SetSubDirSupportedPlatformsBeOSCompatible ; +if $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { + UsePrivateKernelHeaders ; + UseHeaders [ FDirName $(HAIKU_TOP) headers os drivers tty ] : true ; +} + SubDirC++Flags -fno-rtti ; KernelAddon usb_serial : Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/KLSI.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/KLSI.cpp 2008-06-12 13:03:05 UTC (rev 25938) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/KLSI.cpp 2008-06-12 13:44:49 UTC (rev 25939) @@ -29,15 +29,18 @@ if (endpoint->descr->attributes == USB_EP_ATTR_INTERRUPT) { if (endpoint->descr->endpoint_address & USB_EP_ADDR_DIR_IN) { SetControlPipe(endpoint->handle); + SetInterruptBufferSize(endpoint->descr->max_packet_size); if (++pipesSet >= 3) break; } } else if (endpoint->descr->attributes == USB_EP_ATTR_BULK) { if (endpoint->descr->endpoint_address & USB_EP_ADDR_DIR_IN) { + SetReadBufferSize(ROUNDUP(endpoint->descr->max_packet_size, 16)); SetReadPipe(endpoint->handle); if (++pipesSet >= 3) break; } else { + SetWriteBufferSize(ROUNDUP(endpoint->descr->max_packet_size, 16)); SetWritePipe(endpoint->handle); if (++pipesSet >= 3) break; @@ -60,11 +63,26 @@ TRACE_FUNCALLS("> KLSIDevice::ResetDevice(%08x)\n", this); size_t length = 0; - status_t status = gUSBModule->send_request(Device(), - USB_REQTYPE_VENDOR | USB_REQTYPE_INTERFACE_OUT, + status_t status; + usb_serial_line_coding linecoding = { 9600, 1, 0, 8 }; + uint8 linestate[2]; + + status = SetLineCoding(&linecoding); + status = gUSBModule->send_request(Device(), + USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, KLSI_CONF_REQUEST, KLSI_CONF_REQUEST_READ_ON, 0, 0, NULL, &length); + TRACE("= KLSIDevice::ResetDevice(): set conf read_on returns: 0x%08x\n", + status); + linestate[0] = 0xff; + linestate[1] = 0xff; + length = 0; + status = gUSBModule->send_request(Device(), + USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN, + KLSI_POLL_REQUEST, + 0, 0, 2, linestate, &length); + TRACE_FUNCRET("< KLSIDevice::ResetDevice() returns: 0x%08x\n", status); return status; } @@ -106,7 +124,7 @@ size_t length = 0; status_t status = gUSBModule->send_request(Device(), - USB_REQTYPE_VENDOR | USB_REQTYPE_INTERFACE_OUT, + USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, KLSI_SET_REQUEST, 0, 0, sizeof(codingPacket), codingPacket, &length); @@ -133,15 +151,15 @@ void -KLSIDevice::OnWrite(const char *buffer, size_t *numBytes) +KLSIDevice::OnWrite(const char *buffer, size_t *numBytes, size_t *packetBytes) { if (*numBytes >= WriteBufferSize() - 2) - *numBytes = WriteBufferSize() - 2; + *numBytes = *packetBytes = WriteBufferSize() - 2; char *writeBuffer = WriteBuffer(); *((uint16 *)writeBuffer) = B_HOST_TO_LENDIAN_INT16(*numBytes); - memcpy(writeBuffer + 2, buffer, *numBytes); - *numBytes += 2; + memcpy(writeBuffer + 2, buffer, *packetBytes); + *packetBytes += 2; } Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/KLSI.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/KLSI.h 2008-06-12 13:03:05 UTC (rev 25938) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/KLSI.h 2008-06-12 13:44:49 UTC (rev 25939) @@ -53,7 +53,8 @@ virtual status_t SetLineCoding(usb_serial_line_coding *coding); virtual void OnRead(char **buffer, size_t *numBytes); -virtual void OnWrite(const char *buffer, size_t *numBytes); +virtual void OnWrite(const char *buffer, size_t *numBytes, + size_t *packetBytes); virtual void OnClose(); }; Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp 2008-06-12 13:03:05 UTC (rev 25938) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp 2008-06-12 13:44:49 UTC (rev 25939) @@ -26,11 +26,11 @@ fWritePipe(0), fBufferArea(-1), fReadBuffer(NULL), - fReadBufferSize(0), + fReadBufferSize(ROUNDUP(DEF_BUFFER_SIZE, 16)), fWriteBuffer(NULL), - fWriteBufferSize(0), + fWriteBufferSize(ROUNDUP(DEF_BUFFER_SIZE, 16)), fInterruptBuffer(NULL), - fInterruptBufferSize(0), + fInterruptBufferSize(16), fDoneRead(-1), fDoneWrite(-1), fControlOut(0), @@ -68,9 +68,6 @@ mutex_init(&fReadLock, "usb_serial:read_lock"); mutex_init(&fWriteLock, "usb_serial:write_lock"); - fReadBufferSize = fWriteBufferSize = ROUNDUP(DEF_BUFFER_SIZE, 16); - fInterruptBufferSize = 16; - size_t totalBuffers = fReadBufferSize + fWriteBufferSize + fInterruptBufferSize; fBufferArea = create_area("usb_serial:buffers_area", (void **)&fReadBuffer, B_ANY_KERNEL_ADDRESS, ROUNDUP(totalBuffers, B_PAGE_SIZE), B_CONTIGUOUS, @@ -342,10 +339,11 @@ while (bytesLeft > 0) { size_t length = MIN(bytesLeft, fWriteBufferSize); - OnWrite(buffer, &length); + size_t packetLength = length; + OnWrite(buffer, &length, &packetLength); status = gUSBModule->queue_bulk(fWritePipe, fWriteBuffer, - length, WriteCallbackFunction, this); + packetLength, WriteCallbackFunction, this); if (status < B_OK) { TRACE_ALWAYS("write: queueing failed with status 0x%08x\n", status); break; @@ -369,9 +367,9 @@ continue; } - buffer += fActualLengthWrite; - *numBytes += fActualLengthWrite; - bytesLeft -= fActualLengthWrite; + buffer += length; + *numBytes += length; + bytesLeft -= length; } mutex_unlock(&fWriteLock); @@ -528,7 +526,7 @@ void -SerialDevice::OnWrite(const char *buffer, size_t *numBytes) +SerialDevice::OnWrite(const char *buffer, size_t *numBytes, size_t *packetBytes) { // default implementation - does nothing } Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.h 2008-06-12 13:03:05 UTC (rev 25938) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.h 2008-06-12 13:44:49 UTC (rev 25939) @@ -68,9 +68,14 @@ virtual status_t SetControlLineState(uint16 state); virtual void OnRead(char **buffer, size_t *numBytes); -virtual void OnWrite(const char *buffer, size_t *numBytes); +virtual void OnWrite(const char *buffer, size_t *numBytes, + size_t *packetBytes); virtual void OnClose(); +protected: + void SetReadBufferSize(size_t size) { fReadBufferSize = size; }; + void SetWriteBufferSize(size_t size) { fWriteBufferSize = size; }; + void SetInterruptBufferSize(size_t size) { fInterruptBufferSize = size; }; private: static int32 DeviceThread(void *data); Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Tracing.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Tracing.cpp 2008-06-12 13:03:05 UTC (rev 25938) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Tracing.cpp 2008-06-12 13:44:49 UTC (rev 25939) @@ -9,10 +9,6 @@ #include "Driver.h" #include "USB3.h" -extern "C" { -#include -} - #include //sprintf #include //posix file i/o - create, write, close #include @@ -121,14 +117,15 @@ "\tc_cflag: 0x%08x\n" "\tc_lflag: 0x%08x\n" "\tc_line: 0x%08x\n" - "\tc_ixxxxx: 0x%08x\n" - "\tc_oxxxxx: 0x%08x\n" +// "\tc_ixxxxx: 0x%08x\n" +// "\tc_oxxxxx: 0x%08x\n" "\tc_cc[0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x]\n", - tios->c_iflag, tios->c_oflag, tios->c_cflag, tios->c_lflag, - tios->c_line, tios->c_ixxxxx, tios->c_oxxxxx, tios->c_cc[0], - tios->c_cc[1], tios->c_cc[2], tios->c_cc[3], tios->c_cc[4], - tios->c_cc[5], tios->c_cc[6], tios->c_cc[7], tios->c_cc[8], - tios->c_cc[9], tios->c_cc[10]); + tios->c_iflag, tios->c_oflag, tios->c_cflag, tios->c_lflag, + tios->c_line, +// tios->c_ixxxxx, tios->c_oxxxxx, + tios->c_cc[0], tios->c_cc[1], tios->c_cc[2], tios->c_cc[3], + tios->c_cc[4], tios->c_cc[5], tios->c_cc[6], tios->c_cc[7], + tios->c_cc[8], tios->c_cc[9], tios->c_cc[10]); } From zharik at gmx.li Thu Jun 12 17:58:55 2008 From: zharik at gmx.li (Siarzhuk Zharski) Date: Thu, 12 Jun 2008 17:58:55 +0200 Subject: [Haiku-commits] r25939 - haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial In-Reply-To: <200806121344.m5CDioRI022091@sheep.berlios.de> References: <200806121344.m5CDioRI022091@sheep.berlios.de> Message-ID: <485147BF.8020604@gmx.li> Hi, 12.06.2008 15:44 you wrote: > Log: > - change KLSI init the way it's done by the linux driver > - do not count usb headers as part of count returned by write(), else we might end up writing more than the passed amount :) > By the way, I have made big refactoring in beos version of my usb_serial driver. Things I have fixed/added: 1) Handling of CTS/RTS flow control functionality. I wonder, how people used this driver without it? 2) BREAK ON/OFF functionality. Looks like defined in tty service codes but not used under R5. 3) handling of usb interrupts for Prolific and ACM code. Current line state is reported in this way. I tried to set line state bits into tty layer engine directly in interrupt handler - but get either complete usb stack lockup or just jump directly into KDL. So this info is only available by request from user application. The tty layer don't know about lines state change until such request will be performed. :-\ 4) support of SiLabs CP2101/2102/2103 hardware. 5) about of 300 new vendor/product id pairs harvested from netbsd,openbsd,freebsd and linux references. ;-) Are there any objections if I transfer my changes to haiku implementation? I'll be very tender. Promise! The second question is about haiku implementation of tty layer module. Are there any movements with it? May I help in this task in any way? --- Kind Regards, S.Zharski. From mmlr at mail.berlios.de Thu Jun 12 20:08:53 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Thu, 12 Jun 2008 20:08:53 +0200 Subject: [Haiku-commits] r25940 - haiku/trunk/src/servers/app Message-ID: <200806121808.m5CI8rg0018938@sheep.berlios.de> Author: mmlr Date: 2008-06-12 20:08:52 +0200 (Thu, 12 Jun 2008) New Revision: 25940 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25940&view=rev Modified: haiku/trunk/src/servers/app/DefaultDecorator.cpp haiku/trunk/src/servers/app/DefaultDecorator.h Log: Whitespace cleanup. No functional changes. Modified: haiku/trunk/src/servers/app/DefaultDecorator.cpp =================================================================== --- haiku/trunk/src/servers/app/DefaultDecorator.cpp 2008-06-12 13:44:49 UTC (rev 25939) +++ haiku/trunk/src/servers/app/DefaultDecorator.cpp 2008-06-12 18:08:52 UTC (rev 25940) @@ -123,7 +123,7 @@ BRect rect = TabRect(); Decorator::SetTitle(string); - + if (updateRegion == NULL) return; @@ -210,7 +210,7 @@ fResizeRect.OffsetBy(pt); fZoomRect.OffsetBy(pt); fBorderRect.OffsetBy(pt); - + fLeftBorder.OffsetBy(pt); fRightBorder.OffsetBy(pt); fTopBorder.OffsetBy(pt); @@ -243,7 +243,7 @@ case B_MODAL_WINDOW_LOOK: case kLeftTitledWindowLook: realResizeRect.Set(fRightBorder.right - 22, fBottomBorder.top, - fRightBorder.right - 22, fBottomBorder.bottom - 1); + fRightBorder.right - 22, fBottomBorder.bottom - 1); // resize rect at old location dirty->Include(realResizeRect); realResizeRect.OffsetBy(pt); @@ -251,7 +251,7 @@ dirty->Include(realResizeRect); realResizeRect.Set(fRightBorder.left, fBottomBorder.bottom - 22, - fRightBorder.right - 1, fBottomBorder.bottom - 22); + fRightBorder.right - 1, fBottomBorder.bottom - 22); // resize rect at old location dirty->Include(realResizeRect); realResizeRect.OffsetBy(pt); @@ -267,13 +267,13 @@ fBorderRect.right += pt.x; fBorderRect.bottom += pt.y; - + fLeftBorder.bottom += pt.y; fTopBorder.right += pt.x; fRightBorder.OffsetBy(pt.x, 0.0); fRightBorder.bottom += pt.y; - + fBottomBorder.OffsetBy(0.0, pt.y); fBottomBorder.right += pt.x; @@ -283,19 +283,19 @@ fRightBorder.right, fTopBorder.bottom); dirty->Include(t); t.Set(fRightBorder.left - pt.x, fBottomBorder.top, - fRightBorder.right, fBottomBorder.bottom); + fRightBorder.right, fBottomBorder.bottom); dirty->Include(t); dirty->Include(fRightBorder); } else if (pt.x < 0.0) { dirty->Include(BRect(fRightBorder.left, fTopBorder.top, - fRightBorder.right, fBottomBorder.bottom)); + fRightBorder.right, fBottomBorder.bottom)); } if (pt.y > 0.0) { BRect t(fLeftBorder.left, fLeftBorder.bottom - pt.y, fLeftBorder.right, fLeftBorder.bottom); dirty->Include(t); t.Set(fRightBorder.left, fRightBorder.bottom - pt.y, - fRightBorder.right, fRightBorder.bottom); + fRightBorder.right, fRightBorder.bottom); dirty->Include(t); dirty->Include(fBottomBorder); } else if (pt.y < 0.0) { @@ -478,7 +478,7 @@ region->Include(fLeftBorder); region->Include(fRightBorder); region->Include(fBottomBorder); - + if (fLook == B_BORDERED_WINDOW_LOOK) return; @@ -540,7 +540,7 @@ || fLook == B_MODAL_WINDOW_LOOK || fLook == kLeftTitledWindowLook)) { BRect temp(BPoint(fBottomBorder.right - 18, fBottomBorder.bottom - 18), - fBottomBorder.RightBottom()); + fBottomBorder.RightBottom()); if (temp.Contains(pt)) return DEC_RESIZE; } @@ -775,7 +775,7 @@ } break; } - + case B_FLOATING_WINDOW_LOOK: case kLeftTitledWindowLook: { @@ -884,7 +884,7 @@ fBottomBorder.bottom - 22, fRightBorder.right - 1, fBottomBorder.bottom - 1))) break; - + fDrawingEngine->StrokeLine( BPoint(fRightBorder.left, fBottomBorder.bottom - 22), BPoint(fRightBorder.right - 1, fBottomBorder.bottom - 22), @@ -957,7 +957,7 @@ _DrawTitle(fTabRect); - // Draw the buttons if we're supposed to + // Draw the buttons if we're supposed to if (!(fFlags & B_NOT_CLOSABLE) && invalid.Intersects(fCloseRect)) _DrawClose(fCloseRect); if (!(fFlags & B_NOT_ZOOMABLE) && invalid.Intersects(fZoomRect)) @@ -1033,7 +1033,7 @@ { // SetFocus() performs necessary duties for color swapping and // other things when a window is deactivated or activated. - + if (IsFocus() || ((fLook == B_FLOATING_WINDOW_LOOK || fLook == kLeftTitledWindowLook) && (fFlags & B_AVOID_FOCUS) != 0)) { @@ -1103,7 +1103,7 @@ tempColor.red = uint8(startColor.red - (i * rstep)); tempColor.green = uint8(startColor.green - (i * gstep)); tempColor.blue = uint8(startColor.blue - (i * bstep)); - + fDrawingEngine->StrokeLine(BPoint(r.left, r.top + i), BPoint(r.left + i, r.top), tempColor); Modified: haiku/trunk/src/servers/app/DefaultDecorator.h =================================================================== --- haiku/trunk/src/servers/app/DefaultDecorator.h 2008-06-12 13:44:49 UTC (rev 25939) +++ haiku/trunk/src/servers/app/DefaultDecorator.h 2008-06-12 18:08:52 UTC (rev 25940) @@ -82,25 +82,25 @@ rgb_color fTabColorShadow; rgb_color fFrameColors[6]; - + // Individual rects for handling window frame // rendering the proper way BRect fRightBorder; BRect fLeftBorder; BRect fTopBorder; BRect fBottomBorder; - + int32 fBorderWidth; - + uint32 fTabOffset; float fTabLocation; float fTextOffset; - + float fMinTabSize; float fMaxTabSize; BString fTruncatedTitle; int32 fTruncatedTitleLength; - + bigtime_t fLastClicked; bool fWasDoubleClick; }; From aldeck at mail.berlios.de Thu Jun 12 20:22:27 2008 From: aldeck at mail.berlios.de (aldeck at BerliOS) Date: Thu, 12 Jun 2008 20:22:27 +0200 Subject: [Haiku-commits] r25941 - haiku/trunk/src/kits/tracker Message-ID: <200806121822.m5CIMRTZ020043@sheep.berlios.de> Author: aldeck Date: 2008-06-12 20:22:27 +0200 (Thu, 12 Jun 2008) New Revision: 25941 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25941&view=rev Modified: haiku/trunk/src/kits/tracker/PoseView.cpp Log: - AddPoses didn't check for the ShowDiskIcon() option when deciding to AddRootPoses. When changing to icon mode with a size other than 32 (ie: kScaleIconMode) PoseView calls Refresh() and all the poses are removed and loaded again (PoseView.cpp line 1995). This called AddPoses but didn't check for ShowDiskIcon(). The Disks icon was shown on startup though, since Tracker uses another code path when starting (caching?). This fixes #1833. Modified: haiku/trunk/src/kits/tracker/PoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.cpp 2008-06-12 18:08:52 UTC (rev 25940) +++ haiku/trunk/src/kits/tracker/PoseView.cpp 2008-06-12 18:22:27 UTC (rev 25941) @@ -1090,7 +1090,7 @@ AddRootPoses(true, settings.MountSharedVolumesOntoDesktop()); return; } else if (IsDesktopView() - && (settings.MountVolumesOntoDesktop() + && (settings.MountVolumesOntoDesktop() || settings.ShowDisksIcon() || (IsFilePanel() && settings.DesktopFilePanelRoot()))) AddRootPoses(true, settings.MountSharedVolumesOntoDesktop()); } From oruizdorantes at mail.berlios.de Thu Jun 12 21:18:32 2008 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Thu, 12 Jun 2008 21:18:32 +0200 Subject: [Haiku-commits] r25942 - in haiku/trunk: headers/private/bluetooth src/kits/bluetooth Message-ID: <200806121918.m5CJIWOC025490@sheep.berlios.de> Author: oruizdorantes Date: 2008-06-12 21:18:32 +0200 (Thu, 12 Jun 2008) New Revision: 25942 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25942&view=rev Modified: haiku/trunk/headers/private/bluetooth/CommandManager.h haiku/trunk/src/kits/bluetooth/CommandManager.cpp Log: - Add PinCode command replies - Add CancelInquiry command Modified: haiku/trunk/headers/private/bluetooth/CommandManager.h =================================================================== --- haiku/trunk/headers/private/bluetooth/CommandManager.h 2008-06-12 18:22:27 UTC (rev 25941) +++ haiku/trunk/headers/private/bluetooth/CommandManager.h 2008-06-12 19:18:32 UTC (rev 25942) @@ -19,6 +19,9 @@ /* LINK CONTROL */ void* buildRemoteNameRequest(bdaddr_t bdaddr,uint8 pscan_rep_mode, uint16 clock_offset, size_t* outsize); void* buildInquiry(uint32 lap, uint8 length, uint8 num_rsp, size_t* outsize); +void* buildInquiryCancel(size_t* outsize); +void* buildPinCodeRequestReply(bdaddr_t bdaddr, uint8 length, char pincode[16], size_t* outsize); +void* buildPinCodeRequestNegativeReply(bdaddr_t bdaddr, uint8 length, char pincode[16], size_t* outsize); /* OGF_INFORMATIONAL_PARAM */ void* buildReadBufferSize(size_t* outsize); Modified: haiku/trunk/src/kits/bluetooth/CommandManager.cpp =================================================================== --- haiku/trunk/src/kits/bluetooth/CommandManager.cpp 2008-06-12 18:22:27 UTC (rev 25941) +++ haiku/trunk/src/kits/bluetooth/CommandManager.cpp 2008-06-12 19:18:32 UTC (rev 25942) @@ -144,10 +144,10 @@ struct hci_cp_inquiry* param; void* command = buildCommand(OGF_LINK_CONTROL, OCF_INQUIRY, (void**) ¶m, sizeof(struct hci_cp_inquiry), outsize); - if (command != NULL) { - - param->lap[2] = (lap >> 16) & 0xFF; - param->lap[1] = (lap >> 8) & 0xFF; + if (command != NULL) { + + param->lap[2] = (lap >> 16) & 0xFF; + param->lap[1] = (lap >> 8) & 0xFF; param->lap[0] = (lap >> 0) & 0xFF; param->length = length; param->num_rsp = num_rsp; @@ -156,7 +156,54 @@ return command; } +void* buildInquiryCancel(size_t* outsize) +{ + return buildCommand(OGF_LINK_CONTROL, OCF_INQUIRY_CANCEL, NULL, 0, outsize); + +} + + +void* buildPinCodeRequestReply(bdaddr_t bdaddr, uint8 length, char pincode[16], size_t* outsize) +{ + + struct hci_cp_pin_code_reply* param; + + if (length > HCI_PIN_SIZE) // PinCode cannot be longer than 16 + return NULL; + + void* command = buildCommand(OGF_LINK_CONTROL, OCF_PIN_CODE_REPLY, (void**) ¶m, sizeof(struct hci_cp_pin_code_reply), outsize); + + if (command != NULL) { + + param->bdaddr = bdaddr; + param->pin_len = length; + memcpy(¶m->pin_code, pincode, length); + + } + + return command; +} + + +void* buildPinCodeRequestNegativeReply(bdaddr_t bdaddr, uint8 length, char pincode[16], size_t* outsize) +{ + + struct hci_cp_pin_code_neg_reply* param; + + void* command = buildCommand(OGF_LINK_CONTROL, OCF_PIN_CODE_NEG_REPLY, + (void**) ¶m, sizeof(struct hci_cp_pin_code_neg_reply), outsize); + + if (command != NULL) { + + param->bdaddr = bdaddr; + + } + + return command; +} + + #if 0 #pragma mark - INFORMATIONAL_PARAM - #endif From mmlr at mlotz.ch Thu Jun 12 21:27:26 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Thu, 12 Jun 2008 21:27:26 +0200 Subject: [Haiku-commits] =?windows-1252?q?r25939_-_haiku/trunk/src/add-ons?= =?windows-1252?q?/kernel/drivers/ports/usb=5Fserial?= In-Reply-To: <485147BF.8020604@gmx.li> Message-ID: <2946660267-BeMail@primary> Hi there > Things I have fixed/added: > 1) Handling of CTS/RTS flow control functionality. I wonder, how > people > used this driver without it? > 2) BREAK ON/OFF functionality. Looks like defined in tty service > codes > but not used under R5. > 3) handling of usb interrupts for Prolific and ACM code. Current line > state is reported in this way. I tried to set line state bits into > tty > layer engine directly in interrupt handler - but get either complete > usb > stack lockup or just jump directly into KDL. So this info is only > available by request from user application. The tty layer don't know > about lines state change until such request will be performed. :-\ > 4) support of SiLabs CP2101/2102/2103 hardware. > 5) about of 300 new vendor/product id pairs harvested from > netbsd,openbsd,freebsd and linux references. ;-) That's a nice set of changes! > Are there any objections if I transfer my changes to haiku > implementation? I'll be very tender. Promise! Please feel free to do so. I rewrote the driver when adding full ACM support to it because it didn't fit in our style guide at all and I found the structure I introduced easier to understand and support. So I would appreciate if you could adhere to the current style where possible. Having said that I certainly don't have any objections. > The second question is about haiku implementation of tty layer > module. > Are there any movements with it? May I help in this task in any way? Not that I know of, but Francois would probably be the one needing to answer this. Regards Michael From oruizdorantes at mail.berlios.de Thu Jun 12 21:31:30 2008 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Thu, 12 Jun 2008 21:31:30 +0200 Subject: [Haiku-commits] r25943 - in haiku/trunk: headers/os/bluetooth headers/os/bluetooth/HCI src/add-ons/kernel/network/protocols/l2cap Message-ID: <200806121931.m5CJVUWc027669@sheep.berlios.de> Author: oruizdorantes Date: 2008-06-12 21:31:29 +0200 (Thu, 12 Jun 2008) New Revision: 25943 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25943&view=rev Added: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.h haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.cpp haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.h Modified: haiku/trunk/headers/os/bluetooth/HCI/btHCI_command.h haiku/trunk/headers/os/bluetooth/bluetooth.h haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/Jamfile haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.cpp Log: - Add some core code for the L2CAP layer (l2cap commands) - Tailor a bit the main module - Fix definitions in the main header Modified: haiku/trunk/headers/os/bluetooth/HCI/btHCI_command.h =================================================================== --- haiku/trunk/headers/os/bluetooth/HCI/btHCI_command.h 2008-06-12 19:18:32 UTC (rev 25942) +++ haiku/trunk/headers/os/bluetooth/HCI/btHCI_command.h 2008-06-12 19:31:29 UTC (rev 25943) @@ -240,7 +240,7 @@ struct hci_cp_pin_code_reply { bdaddr_t bdaddr; uint8 pin_len; - uint8 pin_code[16]; + uint8 pin_code[HCI_PIN_SIZE]; } __attribute__ ((packed)); #define OCF_PIN_CODE_NEG_REPLY 0x000E Modified: haiku/trunk/headers/os/bluetooth/bluetooth.h =================================================================== --- haiku/trunk/headers/os/bluetooth/bluetooth.h 2008-06-12 19:18:32 UTC (rev 25942) +++ haiku/trunk/headers/os/bluetooth/bluetooth.h 2008-06-12 19:31:29 UTC (rev 25943) @@ -26,6 +26,12 @@ uint8 b[6]; } __attribute__((packed)) bdaddr_t; + +#define BDADDR_NULL (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) +#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) +#define BDADDR_BROADCAST (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}) +#define BDADDR_ANY BDADDR_BROADCAST + /* 128 integer type needed for SDP */ struct int128 { int8 b[16]; @@ -33,5 +39,12 @@ typedef struct int128 int128; typedef struct int128 uint128; +/* Protocol definitions - add to as required... */ +#define BLUETOOTH_PROTO_HCI 134 /* HCI protocol number */ +#define BLUETOOTH_PROTO_L2CAP 135 /* L2CAP protocol number */ +#define BLUETOOTH_PROTO_RFCOMM 136 /* RFCOMM protocol number */ +#define BLUETOOTH_PROTO_MAX 256 + + #endif Modified: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/Jamfile 2008-06-12 19:18:32 UTC (rev 25942) +++ haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/Jamfile 2008-06-12 19:31:29 UTC (rev 25943) @@ -15,6 +15,7 @@ KernelAddon l2cap : l2cap.cpp l2cap_address.cpp + l2cap_command.cpp ; # Installation Modified: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.cpp 2008-06-12 19:18:32 UTC (rev 25942) +++ haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.cpp 2008-06-12 19:31:29 UTC (rev 25943) @@ -1,3 +1,23 @@ +/* + * Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * All rights reserved. Distributed under the terms of the MIT License. + * + */ + +/*- + * Copyright (c) Maksim Yevmenkin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. +*/ + #include #include #include Added: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.h =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.h 2008-06-12 19:18:32 UTC (rev 25942) +++ haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.h 2008-06-12 19:31:29 UTC (rev 25943) @@ -0,0 +1,295 @@ +/* + * Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * All rights reserved. Distributed under the terms of the MIT License. + * + */ + +/*- + * Copyright (c) Maksim Yevmenkin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. +*/ + + +/************************************************************************** + ************************************************************************** + ** Common defines and types (L2CAP) + ************************************************************************** + **************************************************************************/ + +#ifndef _L2CAP_ +#define _L2CAP_ + +#include + +// TODO: from BSD compatibility layer +#define htole16(x) (x) + + +/* + * Channel IDs are assigned relative to the instance of L2CAP node, i.e. + * relative to the unit. So the total number of channels that unit can have + * open at the same time is 0xffff - 0x0040 = 0xffbf (65471). This number + * does not depend on number of connections. + */ +#define L2CAP_NULL_CID 0x0000 /* DO NOT USE THIS CID */ +#define L2CAP_SIGNAL_CID 0x0001 /* signaling channel ID */ +#define L2CAP_CLT_CID 0x0002 /* connectionless channel ID */ +/* 0x0003 - 0x003f Reserved */ +#define L2CAP_FIRST_CID 0x0040 /* dynamically alloc. (start) */ +#define L2CAP_LAST_CID 0xffff /* dynamically alloc. (end) */ + + +/* + * L2CAP signaling command ident's are assigned relative to the connection, + * because there is only one signaling channel (cid == 0x01) for every + * connection. So up to 254 (0xff - 0x01) L2CAP commands can be pending at the + * same time for the same connection. + */ +#define L2CAP_NULL_IDENT 0x00 /* DO NOT USE THIS IDENT */ +#define L2CAP_FIRST_IDENT 0x01 /* dynamically alloc. (start) */ +#define L2CAP_LAST_IDENT 0xff /* dynamically alloc. (end) */ + + +/* L2CAP MTU */ +#define L2CAP_MTU_MINIMUM 48 +#define L2CAP_MTU_DEFAULT 672 +#define L2CAP_MTU_MAXIMUM 0xffff + +/* L2CAP flush and link timeouts */ +#define L2CAP_FLUSH_TIMO_DEFAULT 0xffff /* always retransmit */ +#define L2CAP_LINK_TIMO_DEFAULT 0xffff + +/* L2CAP Command Reject reasons */ +#define L2CAP_REJ_NOT_UNDERSTOOD 0x0000 +#define L2CAP_REJ_MTU_EXCEEDED 0x0001 +#define L2CAP_REJ_INVALID_CID 0x0002 +/* 0x0003 - 0xffff - reserved for future use */ + +/* Protocol/Service Multioplexor (PSM) values */ +#define L2CAP_PSM_ANY 0x0000 /* Any/Invalid PSM */ +#define L2CAP_PSM_SDP 0x0001 /* Service Discovery Protocol */ +#define L2CAP_PSM_RFCOMM 0x0003 /* RFCOMM protocol */ +#define L2CAP_PSM_TCP 0x0005 /* Telephony Control Protocol */ +#define L2CAP_PSM_TCS 0x0007 /* TCS cordless */ +#define L2CAP_PSM_BNEP 0x000F /* BNEP */ +#define L2CAP_PSM_HID_CTRL 0x0011 /* HID Control */ +#define L2CAP_PSM_HID_INT 0x0013 /* HID Interrupt */ +#define L2CAP_PSM_UPnP 0x0015 /* UPnP (ESDP) */ +#define L2CAP_PSM_AVCTP 0x0017 /* AVCTP */ +#define L2CAP_PSM_AVDTP 0x0019 /* AVDTP */ +/* < 0x1000 - reserved for future use */ +/* 0x1001 < x < 0xFFFF dinamically assigned */ + +/* L2CAP Connection response command result codes */ +#define L2CAP_SUCCESS 0x0000 +#define L2CAP_PENDING 0x0001 +#define L2CAP_PSM_NOT_SUPPORTED 0x0002 +#define L2CAP_SEQUIRY_BLOCK 0x0003 +#define L2CAP_NO_RESOURCES 0x0004 +#define L2CAP_TIMEOUT 0xeeee +#define L2CAP_UNKNOWN 0xffff +/* 0x0005 - 0xffff - reserved for future use */ + +/* L2CAP Connection response status codes */ +#define L2CAP_NO_INFO 0x0000 +#define L2CAP_AUTH_PENDING 0x0001 +#define L2CAP_AUTZ_PENDING 0x0002 +/* 0x0003 - 0xffff - reserved for future use */ + +/* L2CAP Configuration response result codes */ +#define L2CAP_UNACCEPTABLE_PARAMS 0x0001 +#define L2CAP_REJECT 0x0002 +#define L2CAP_UNKNOWN_OPTION 0x0003 +/* 0x0003 - 0xffff - reserved for future use */ + +/* L2CAP Configuration options */ +#define L2CAP_OPT_CFLAG_BIT 0x0001 +#define L2CAP_OPT_CFLAG(flags) ((flags) & L2CAP_OPT_CFLAG_BIT) +#define L2CAP_OPT_HINT_BIT 0x80 +#define L2CAP_OPT_HINT(type) ((type) & L2CAP_OPT_HINT_BIT) +#define L2CAP_OPT_HINT_MASK 0x7f +#define L2CAP_OPT_MTU 0x01 +#define L2CAP_OPT_MTU_SIZE sizeof(uint16) +#define L2CAP_OPT_FLUSH_TIMO 0x02 +#define L2CAP_OPT_FLUSH_TIMO_SIZE sizeof(uint16) +#define L2CAP_OPT_QOS 0x03 +#define L2CAP_OPT_QOS_SIZE sizeof(l2cap_qos) +/* 0x4 - 0xff - reserved for future use */ + +/* L2CAP Information request type codes */ +#define L2CAP_CONNLESS_MTU 0x0001 +#define L2CAP_EXTENDED_MASK 0x0002 +/* 0x0003 - 0xffff - reserved for future use */ + +/* L2CAP Information response codes */ +#define L2CAP_NOT_SUPPORTED 0x0001 +/* 0x0002 - 0xffff - reserved for future use */ + +/* L2CAP flow (QoS) */ +typedef struct { + uint8 flags; /* reserved for future use */ + uint8 service_type; /* service type */ + uint32 token_rate; /* bytes per second */ + uint32 token_bucket_size; /* bytes */ + uint32 peak_bandwidth; /* bytes per second */ + uint32 latency; /* microseconds */ + uint32 delay_variation; /* microseconds */ +} __attribute__ ((packed)) l2cap_flow_t; + + +/************************************************************************** + ************************************************************************** + ** Link level defines, headers and types + ************************************************************************** + **************************************************************************/ + +/* L2CAP header */ +typedef struct { + uint16 length; /* payload size */ + uint16 dcid; /* destination channel ID */ +} __attribute__ ((packed)) l2cap_hdr_t; + + +/* L2CAP ConnectionLess Traffic (CLT) (if destination cid == 0x2) */ +typedef struct { + uint16 psm; /* Protocol/Service Multiplexor */ +} __attribute__ ((packed)) l2cap_clt_hdr_t; + +#define L2CAP_CLT_MTU_MAXIMUM (L2CAP_MTU_MAXIMUM - sizeof(l2cap_clt_hdr_t)) + +/* L2CAP command header */ +typedef struct { + uint8 code; /* command OpCode */ + uint8 ident; /* identifier to match request and response */ + uint16 length; /* command parameters length */ +} __attribute__ ((packed)) l2cap_cmd_hdr_t; + + +/* L2CAP Command Reject */ +#define L2CAP_CMD_REJ 0x01 +typedef struct { + uint16 reason; /* reason to reject command */ +/* u_int8_t data[]; -- optional data (depends on reason) */ +} __attribute__ ((packed)) l2cap_cmd_rej_cp; + +/* CommandReject data */ +typedef union { + /* L2CAP_REJ_MTU_EXCEEDED */ + struct { + uint16 mtu; /* actual signaling MTU */ + } __attribute__ ((packed)) mtu; + /* L2CAP_REJ_INVALID_CID */ + struct { + uint16 scid; /* local CID */ + uint16 dcid; /* remote CID */ + } __attribute__ ((packed)) cid; +} l2cap_cmd_rej_data_t; +typedef l2cap_cmd_rej_data_t * l2cap_cmd_rej_data_p; + +/* L2CAP Connection Request */ +#define L2CAP_CON_REQ 0x02 +typedef struct { + uint16 psm; /* Protocol/Service Multiplexor (PSM) */ + uint16 scid; /* source channel ID */ +} __attribute__ ((packed)) l2cap_con_req_cp; + +/* L2CAP Connection Response */ +#define L2CAP_CON_RSP 0x03 +typedef struct { + uint16 dcid; /* destination channel ID */ + uint16 scid; /* source channel ID */ + uint16 result; /* 0x00 - success */ + uint16 status; /* more info if result != 0x00 */ +} __attribute__ ((packed)) l2cap_con_rsp_cp; + +/* L2CAP Configuration Request */ +#define L2CAP_CFG_REQ 0x04 +typedef struct { + uint16 dcid; /* destination channel ID */ + uint16 flags; /* flags */ +/* u_int8_t options[] -- options */ +} __attribute__ ((packed)) l2cap_cfg_req_cp; + +/* L2CAP Configuration Response */ +#define L2CAP_CFG_RSP 0x05 +typedef struct { + uint16 scid; /* source channel ID */ + uint16 flags; /* flags */ + uint16 result; /* 0x00 - success */ +/* u_int8_t options[] -- options */ +} __attribute__ ((packed)) l2cap_cfg_rsp_cp; + +/* L2CAP configuration option */ +typedef struct { + u_int8_t type; + u_int8_t length; +/* u_int8_t value[] -- option value (depends on type) */ +} __attribute__ ((packed)) l2cap_cfg_opt_t; +typedef l2cap_cfg_opt_t * l2cap_cfg_opt_p; + +/* L2CAP configuration option value */ +typedef union { + uint16 mtu; /* L2CAP_OPT_MTU */ + uint16 flush_timo; /* L2CAP_OPT_FLUSH_TIMO */ + l2cap_flow_t flow; /* L2CAP_OPT_QOS */ +} l2cap_cfg_opt_val_t; +typedef l2cap_cfg_opt_val_t * l2cap_cfg_opt_val_p; + +/* L2CAP Disconnect Request */ +#define L2CAP_DISCON_REQ 0x06 +typedef struct { + uint16 dcid; /* destination channel ID */ + uint16 scid; /* source channel ID */ +} __attribute__ ((packed)) l2cap_discon_req_cp; + +/* L2CAP Disconnect Response */ +#define L2CAP_DISCON_RSP 0x07 +typedef l2cap_discon_req_cp l2cap_discon_rsp_cp; + +/* L2CAP Echo Request */ +#define L2CAP_ECHO_REQ 0x08 +/* No command parameters, only optional data */ + +/* L2CAP Echo Response */ +#define L2CAP_ECHO_RSP 0x09 +#define L2CAP_MAX_ECHO_SIZE \ + (L2CAP_MTU_MAXIMUM - sizeof(l2cap_cmd_hdr_t)) +/* No command parameters, only optional data */ + +/* L2CAP Information Request */ +#define L2CAP_INFO_REQ 0x0a +typedef struct { + uint16 type; /* requested information type */ +} __attribute__ ((packed)) l2cap_info_req_cp; + +/* L2CAP Information Response */ +#define L2CAP_INFO_RSP 0x0b +typedef struct { + uint16 type; /* requested information type */ + uint16 result; /* 0x00 - success */ +/* u_int8_t info[] -- info data (depends on type) + * + * L2CAP_CONNLESS_MTU - 2 bytes connectionless MTU + */ +} __attribute__ ((packed)) l2cap_info_rsp_cp; + +typedef union { + /* L2CAP_CONNLESS_MTU */ + struct { + uint16 mtu; + } __attribute__ ((packed)) mtu; +} l2cap_info_rsp_data_t; +typedef l2cap_info_rsp_data_t * l2cap_info_rsp_data_p; + + +#endif + Added: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.cpp 2008-06-12 19:18:32 UTC (rev 25942) +++ haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.cpp 2008-06-12 19:31:29 UTC (rev 25943) @@ -0,0 +1,487 @@ +/* + * Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * All rights reserved. Distributed under the terms of the MIT License. + * + */ + +/*- + * Copyright (c) Maksim Yevmenkin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. +*/ + + +#include + +#include "l2cap_command.h" + +/* + * Note: All L2CAP implementations are required to support minimal signaling + * MTU of 48 bytes. In order to simplify things we will send one command + * per one L2CAP packet. Given evrything above we can assume that one + * signaling packet will fit into single mbuf. + */ + + +/* Private types */ +struct _cmd_rej { + l2cap_cmd_hdr_t hdr; + l2cap_cmd_rej_cp param; + l2cap_cmd_rej_data_t data; +} __attribute__ ((packed)) ; + +struct _con_req { + l2cap_cmd_hdr_t hdr; + l2cap_con_req_cp param; +} __attribute__ ((packed)); + +struct _con_rsp { + l2cap_cmd_hdr_t hdr; + l2cap_con_rsp_cp param; +} __attribute__ ((packed)); + +struct _cfg_req { + l2cap_cmd_hdr_t hdr; + l2cap_cfg_req_cp param; +} __attribute__ ((packed)); + +struct _cfg_rsp { + l2cap_cmd_hdr_t hdr; + l2cap_cfg_rsp_cp param; +} __attribute__ ((packed)); + +struct _discon_req { + l2cap_cmd_hdr_t hdr; + l2cap_discon_req_cp param; +} __attribute__ ((packed)); + +struct _discon_rsp { + l2cap_cmd_hdr_t hdr; + l2cap_discon_rsp_cp param; +} __attribute__ ((packed)); + +struct _info_req { + l2cap_cmd_hdr_t hdr; + l2cap_info_req_cp param; +} __attribute__ ((packed)); + +struct _info_rsp { + l2cap_cmd_hdr_t hdr; + l2cap_info_rsp_cp param; + l2cap_info_rsp_data_t data; +} __attribute__ ((packed)); + + +/* L2CAP_CommandRej */ +static inline net_buffer* +l2cap_cmd_rej(uint8 _ident, uint16 _reason, uint16 _mtu, uint16 _scid, uint16 _dcid) +{ + + net_buffer* _m = gBufferModule->create(sizeof(struct _cmd_rej)); + if ((_m) == NULL) + return NULL; + + NetBufferPrepend bufferHeader(_m); + status_t status = bufferHeader.Status(); + if (status < B_OK) { + // free the buffer + return NULL; + } + + bufferHeader->hdr.code = L2CAP_CMD_REJ; + bufferHeader->hdr.ident = (_ident); + bufferHeader->hdr.length = sizeof(bufferHeader->param); + + bufferHeader->param.reason = htole16((_reason)); + + if ((_reason) == L2CAP_REJ_MTU_EXCEEDED) { + bufferHeader->data.mtu.mtu = htole16((_mtu)); + bufferHeader->hdr.length += sizeof(bufferHeader->data.mtu); + } else if ((_reason) == L2CAP_REJ_INVALID_CID) { + bufferHeader->data.cid.scid = htole16((_scid)); + bufferHeader->data.cid.dcid = htole16((_dcid)); + bufferHeader->hdr.length += sizeof(bufferHeader->data.cid); + } + + _m->size = sizeof(bufferHeader->hdr) + bufferHeader->hdr.length; /* TODO: needed ?*/ + + bufferHeader->hdr.length = htole16(bufferHeader->hdr.length); + + bufferHeader.Sync(); + + return _m; +} + + +/* L2CAP_ConnectReq */ +static inline net_buffer* +l2cap_con_req(uint8 _ident, uint16 _psm, uint16 _scid) +{ + + net_buffer* _m = gBufferModule->create(sizeof(struct _con_req)); + if ((_m) == NULL) + return NULL; + + NetBufferPrepend bufferHeader(_m); + status_t status = bufferHeader.Status(); + if (status < B_OK) { + /* TODO free the buffer */ + return NULL; + } + + bufferHeader->hdr.code = L2CAP_CON_REQ; + bufferHeader->hdr.ident = (_ident); + bufferHeader->hdr.length = htole16(sizeof(bufferHeader->param)); + + bufferHeader->param.psm = htole16((_psm)); + bufferHeader->param.scid = htole16((_scid)); + + bufferHeader.Sync(); + + return _m; +} + + +/* L2CAP_ConnectRsp */ +static inline net_buffer* +l2cap_con_rsp(uint8 _ident, uint16 _dcid, uint16 _scid, uint16 _result, uint16 _status) +{ + + net_buffer* _m = gBufferModule->create(sizeof(struct _con_rsp)); + if ((_m) == NULL) + return NULL; + + NetBufferPrepend bufferHeader(_m); + status_t status = bufferHeader.Status(); + if (status < B_OK) { + /* TODO free the buffer */ + return NULL; + } + + bufferHeader->hdr.code = L2CAP_CON_RSP; + bufferHeader->hdr.ident = (_ident); + bufferHeader->hdr.length = htole16(sizeof(bufferHeader->param)); + + bufferHeader->param.dcid = htole16((_dcid)); + bufferHeader->param.scid = htole16((_scid)); + bufferHeader->param.result = htole16((_result)); + bufferHeader->param.status = htole16((_status)); /* reason */ + + bufferHeader.Sync(); + + return _m; +} + + +/* L2CAP_ConfigReq */ +static inline net_buffer* +l2cap_cfg_req(uint8 _ident, uint16 _dcid, uint16 _flags, net_buffer* _data) +{ + + net_buffer* _m = gBufferModule->create(sizeof(struct _cfg_req)); + if ((_m) == NULL){ + /* TODO free the _data buffer? */ + return NULL; + } + + (_m)->size = sizeof(struct _cfg_req); /* check if needed */ + + NetBufferPrepend bufferHeader(_m); + status_t status = bufferHeader.Status(); + if (status < B_OK) { + /* TODO free the buffer */ + return NULL; + } + + bufferHeader->hdr.code = L2CAP_CFG_REQ; + bufferHeader->hdr.ident = (_ident); + bufferHeader->hdr.length = htole16(sizeof(bufferHeader->param)); + + bufferHeader->param.dcid = htole16((_dcid)); + bufferHeader->param.flags = htole16((_flags)); + + bufferHeader.Sync(); + + /* Add the given data */ + gBufferModule->merge(_m, _data, true); + + return _m; +} + + +/* L2CAP_ConfigRsp */ +static inline net_buffer* +l2cap_cfg_rsp(uint8 _ident, uint16 _scid, uint16 _flags, uint16 _result, net_buffer* _data) +{ + + net_buffer* _m = gBufferModule->create(sizeof(struct _cfg_rsp)); + if ((_m) == NULL){ + /* TODO free the _data buffer */ + return NULL; + } + + NetBufferPrepend bufferHeader(_m); + status_t status = bufferHeader.Status(); + if (status < B_OK) { + /* TODO free the buffer */ + return NULL; + } + + bufferHeader->hdr.code = L2CAP_CFG_RSP; + bufferHeader->hdr.ident = (_ident); + bufferHeader->hdr.length = htole16(sizeof(bufferHeader->param)); + + bufferHeader->param.scid = htole16((_scid)); + bufferHeader->param.flags = htole16((_flags)); + bufferHeader->param.result = htole16((_result)); + + bufferHeader.Sync(); + + gBufferModule->merge(_m, _data, true); + + return _m; + +} + + +/* L2CAP_DisconnectReq */ +static inline net_buffer* +l2cap_discon_req(uint8 _ident, uint16 _dcid, uint16 _scid) +{ + + net_buffer* _m = gBufferModule->create(sizeof(struct _discon_req)); + if ((_m) == NULL){ + return NULL; + } + + NetBufferPrepend bufferHeader(_m); + status_t status = bufferHeader.Status(); + if (status < B_OK) { + /* TODO free the buffer */ + return NULL; + } + + bufferHeader->hdr.code = L2CAP_DISCON_REQ; + bufferHeader->hdr.ident = (_ident); + bufferHeader->hdr.length = htole16(sizeof(bufferHeader->param)); + + bufferHeader->param.dcid = htole16((_dcid)); + bufferHeader->param.scid = htole16((_scid)); + + bufferHeader.Sync(); + + return _m; +} + + +/* L2CA_DisconnectRsp */ +static inline net_buffer* +l2cap_discon_rsp(uint8 _ident, uint16 _dcid, uint16 _scid) +{ + + net_buffer* _m = gBufferModule->create(sizeof(struct _discon_rsp)); + if ((_m) == NULL){ + return NULL; + } + + NetBufferPrepend bufferHeader(_m); + status_t status = bufferHeader.Status(); + if (status < B_OK) { + /* TODO free the buffer */ + return NULL; + } + + bufferHeader->hdr.code = L2CAP_DISCON_RSP; + bufferHeader->hdr.ident = (_ident); + bufferHeader->hdr.length = htole16(sizeof(bufferHeader->param)); + + bufferHeader->param.dcid = htole16((_dcid)); + bufferHeader->param.scid = htole16((_scid)); + + bufferHeader.Sync(); + + return _m; +} + + +/* L2CAP_EchoReq */ +static inline net_buffer* +l2cap_echo_req(uint8 _ident, void* _data, size_t _size) +{ + net_buffer* _m = gBufferModule->create(sizeof(l2cap_cmd_hdr_t)); + if ((_m) == NULL){ + /* TODO free the _data buffer */ + return NULL; + } + + NetBufferPrepend bufferHeader(_m); + status_t status = bufferHeader.Status(); + if (status < B_OK) { + /* TODO free the buffer */ + return NULL; + } + + bufferHeader->code = L2CAP_ECHO_REQ; + bufferHeader->ident = (_ident); + bufferHeader->length = htole16(0); + + bufferHeader.Sync(); + + if ((_data) != NULL) { + gBufferModule->append(_m, _data, _size); + } + + return _m; +} + + +/* L2CAP_InfoReq */ +static inline net_buffer* +l2cap_info_req(uint8 _ident, uint16 _type) +{ + + net_buffer* _m = gBufferModule->create(sizeof(struct _info_req)); + if ((_m) == NULL){ + return NULL; + } + + NetBufferPrepend bufferHeader(_m); + status_t status = bufferHeader.Status(); + if (status < B_OK) { + /* TODO free the buffer */ + return NULL; + } + + bufferHeader->hdr.code = L2CAP_INFO_REQ; + bufferHeader->hdr.ident = (_ident); + bufferHeader->hdr.length = htole16(sizeof(bufferHeader->param)); + + bufferHeader->param.type = htole16((_type)); + + bufferHeader.Sync(); + + return _m; +} + + +/* L2CAP_InfoRsp */ +static inline net_buffer* +l2cap_info_rsp(uint8 _ident, uint16 _type, uint16 _result, uint16 _mtu) +{ + + net_buffer* _m = gBufferModule->create(sizeof(struct _info_rsp)); + if ((_m) == NULL){ + return NULL; + } + + NetBufferPrepend bufferHeader(_m); + status_t status = bufferHeader.Status(); + if (status < B_OK) { + /* TODO free the buffer */ + return NULL; + } + + bufferHeader->hdr.code = L2CAP_INFO_REQ; + bufferHeader->hdr.ident = (_ident); + bufferHeader->hdr.length = sizeof(bufferHeader->param); + + bufferHeader->param.type = htole16((_type)); + bufferHeader->param.result = htole16((_result)); + + if ((_result) == L2CAP_SUCCESS) { + switch ((_type)) { + case L2CAP_CONNLESS_MTU: + bufferHeader->data.mtu.mtu = htole16((_mtu)); + bufferHeader->hdr.length += sizeof((bufferHeader->data.mtu.mtu)); + break; + } + } + + (_m)->size = sizeof(bufferHeader->hdr) + bufferHeader->hdr.length; + + bufferHeader->hdr.length = htole16(bufferHeader->hdr.length); + + bufferHeader.Sync(); + + return _m; + +} + +#if 0 +#pragma mark - +#endif + +/* Build configuration options +static inline net_buffer* +l2cap_build_cfg_options(_m, * _mtu, * _flush_timo, _flow) +{ + u_int8_t *p = NULL; + + MGETHDR((_m), M_DONTWAIT, MT_DATA); + if ((_m) == NULL) + break; + + (_m)->m_pkthdr.len = (_m)->m_len = 0; + p = mtod((_m), u_int8_t *); + + if ((_mtu) != NULL) { + struct _cfg_opt_mtu { + l2cap_cfg_opt_t hdr; + u_int16_t val; + } __attribute__ ((packed)) *o = NULL; + + o = (struct _cfg_opt_mtu *) p; + o->hdr.type = L2CAP_OPT_MTU; + o->hdr.length = sizeof(o->val); + o->val = htole16(*(u_int16_t *)(_mtu)); + + (_m)->m_pkthdr.len += sizeof(*o); + p += sizeof(*o); + } + + if ((_flush_timo) != NULL) { + struct _cfg_opt_flush { + l2cap_cfg_opt_t hdr; + u_int16_t val; + } __attribute__ ((packed)) *o = NULL; + + o = (struct _cfg_opt_flush *) p; + o->hdr.type = L2CAP_OPT_FLUSH_TIMO; + o->hdr.length = sizeof(o->val); + o->val = htole16(*(u_int16_t *)(_flush_timo)); + + (_m)->m_pkthdr.len += sizeof(*o); + p += sizeof(*o); + } + + if ((_flow) != NULL) { + struct _cfg_opt_flow { + l2cap_cfg_opt_t hdr; + l2cap_flow_t val; + } __attribute__ ((packed)) *o = NULL; + + o = (struct _cfg_opt_flow *) p; + o->hdr.type = L2CAP_OPT_QOS; + o->hdr.length = sizeof(o->val); + o->val.flags = ((l2cap_flow_p)(_flow))->flags; + o->val.service_type = ((l2cap_flow_p) (_flow))->service_type; + o->val.token_rate = htole32(((l2cap_flow_p)(_flow))->token_rate); + o->val.token_bucket_size = htole32(((l2cap_flow_p) (_flow))->token_bucket_size); + o->val.peak_bandwidth = htole32(((l2cap_flow_p) (_flow))->peak_bandwidth); + o->val.latency = htole32(((l2cap_flow_p) (_flow))->latency); + o->val.delay_variation = htole32(((l2cap_flow_p) (_flow))->delay_variation); + + (_m)->m_pkthdr.len += sizeof(*o); + } + + (_m)->m_len = (_m)->m_pkthdr.len; +} +*/ Added: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.h =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.h 2008-06-12 19:18:32 UTC (rev 25942) +++ haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.h 2008-06-12 19:31:29 UTC (rev 25943) @@ -0,0 +1,50 @@ +/* + * Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * All rights reserved. Distributed under the terms of the MIT License. + * + */ + +#ifndef _L2CAP_CMDS_H_ +#define _L2CAP_CMDS_H_ + +//net +#include + +//bt +#include "l2cap.h" + + +extern net_buffer_module_info *gBufferModule; + +static inline net_buffer* +l2cap_cmd_rej(uint8 _ident, uint16 _reason, uint16 _mtu, uint16 _scid, uint16 _dcid); + +static inline net_buffer* +l2cap_con_req(uint8 _ident, uint16 _psm, uint16 _scid); + +static inline net_buffer* +l2cap_con_rsp(uint8 _ident, uint16 _dcid, uint16 _scid, uint16 _result, uint16 _status); + +static inline net_buffer* +l2cap_cfg_req(uint8 _ident, uint16 _dcid, uint16 _flags, net_buffer* _data); + +static inline net_buffer* +l2cap_cfg_rsp(uint8 _ident, uint16 _scid, uint16 _flags, uint16 _result, net_buffer* _data); + +static inline net_buffer* +l2cap_discon_req(uint8 _ident, uint16 _dcid, uint16 _scid); + +static inline net_buffer* +l2cap_discon_rsp(uint8 _ident, uint16 _dcid, uint16 _scid); + +static inline net_buffer* +l2cap_echo_req(uint8 _ident, void* _data, size_t _size); + +static inline net_buffer* +l2cap_info_req(uint8 _ident, uint16 _type); + +static inline net_buffer* +l2cap_info_rsp(uint8 _ident, uint16 _type, uint16 _result, uint16 _mtu); + +#endif /* L2CAP_CMDS_H_ */ + From oruizdorantes at mail.berlios.de Thu Jun 12 21:42:22 2008 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Thu, 12 Jun 2008 21:42:22 +0200 Subject: [Haiku-commits] r25944 - haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic Message-ID: <200806121942.m5CJgMT7028674@sheep.berlios.de> Author: oruizdorantes Date: 2008-06-12 21:42:21 +0200 (Thu, 12 Jun 2008) New Revision: 25944 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25944&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2transactions.c Log: - Follow directions from mmlr regarding ticket 2353. Do not resubmit if the transfers are already cancelled. - As more cleaning still needs to be done regarding this subject the ticket is not yet closed Modified: haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2transactions.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2transactions.c 2008-06-12 19:31:29 UTC (rev 25943) +++ haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2transactions.c 2008-06-12 19:42:21 UTC (rev 25944) @@ -175,7 +175,9 @@ bt_usb_dev* bdev = cookie; status_t err; - /* TODO: check are we running? */ + /* TODO: or not running anymore */ + if (status == B_CANCELED) + return; if (status != B_OK || actual_len == 0) goto resubmit; @@ -214,7 +216,9 @@ bt_usb_dev* bdev = cookie; status_t err; - /* TODO: check are we running? */ + /* TODO: or not running anymore? */ + if (status == B_CANCELED) + return; if (status != B_OK || actual_len == 0) goto resubmit; @@ -390,6 +394,10 @@ uint16 value = 0; uint16 wLength = B_HOST_TO_LENDIAN_INT16(snb_size(snbuf)); + if (!GET_BIT(bdev->state, RUNNING) ) { + return B_DEV_NOT_READY; + } + /* set cookie */ snb_set_cookie(snbuf, bdev); @@ -415,6 +423,11 @@ /* set cookie */ SET_DEVICE(nbuf,bdev->hdev); + + if (!GET_BIT(bdev->state, RUNNING) ) { + return B_DEV_NOT_READY; + } + err = usb->queue_bulk(bdev->bulk_out_ep->handle, nb_get_whole_buffer(nbuf), nbuf->size, @@ -435,6 +448,10 @@ submit_tx_sco(bt_usb_dev* bdev) { + if (!GET_BIT(bdev->state, RUNNING) ) { + return B_DEV_NOT_READY; + } + /* not yet implemented */ return B_ERROR; } From revol at free.fr Thu Jun 12 21:46:42 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Thu, 12 Jun 2008 21:46:42 +0200 CEST Subject: [Haiku-commits] r25939 - haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial In-Reply-To: <2946660267-BeMail@primary> Message-ID: <701692337-BeMail@laptop> > > The second question is about haiku implementation of tty layer > > module. > > Are there any movements with it? May I help in this task in any > > way? > > Not that I know of, but Francois would probably be the one needing to > answer this. Nothing yet, been busy elsewhere. Fran?ois. From oruizdorantes at mail.berlios.de Thu Jun 12 21:53:07 2008 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Thu, 12 Jun 2008 21:53:07 +0200 Subject: [Haiku-commits] r25945 - haiku/trunk/src/add-ons/kernel/network/protocols/l2cap Message-ID: <200806121953.m5CJr7lR031151@sheep.berlios.de> Author: oruizdorantes Date: 2008-06-12 21:53:06 +0200 (Thu, 12 Jun 2008) New Revision: 25945 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25945&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.h haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.cpp Log: Remove some reference code Replace bsd types for haiku ones -ve-This line, and those below, will be ignored-- M l2cap/l2cap_command.cpp M l2cap/l2cap.h Modified: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.h =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.h 2008-06-12 19:42:21 UTC (rev 25944) +++ haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.h 2008-06-12 19:53:06 UTC (rev 25945) @@ -178,7 +178,7 @@ #define L2CAP_CMD_REJ 0x01 typedef struct { uint16 reason; /* reason to reject command */ -/* u_int8_t data[]; -- optional data (depends on reason) */ +/* uint8 data[]; -- optional data (depends on reason) */ } __attribute__ ((packed)) l2cap_cmd_rej_cp; /* CommandReject data */ @@ -216,7 +216,7 @@ typedef struct { uint16 dcid; /* destination channel ID */ uint16 flags; /* flags */ -/* u_int8_t options[] -- options */ +/* uint8 options[] -- options */ } __attribute__ ((packed)) l2cap_cfg_req_cp; /* L2CAP Configuration Response */ @@ -225,14 +225,14 @@ uint16 scid; /* source channel ID */ uint16 flags; /* flags */ uint16 result; /* 0x00 - success */ -/* u_int8_t options[] -- options */ +/* uint8 options[] -- options */ } __attribute__ ((packed)) l2cap_cfg_rsp_cp; /* L2CAP configuration option */ typedef struct { - u_int8_t type; - u_int8_t length; -/* u_int8_t value[] -- option value (depends on type) */ + uint8 type; + uint8 length; +/* uint8 value[] -- option value (depends on type) */ } __attribute__ ((packed)) l2cap_cfg_opt_t; typedef l2cap_cfg_opt_t * l2cap_cfg_opt_p; @@ -276,7 +276,7 @@ typedef struct { uint16 type; /* requested information type */ uint16 result; /* 0x00 - success */ -/* u_int8_t info[] -- info data (depends on type) +/* uint8 info[] -- info data (depends on type) * * L2CAP_CONNLESS_MTU - 2 bytes connectionless MTU */ Modified: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.cpp 2008-06-12 19:42:21 UTC (rev 25944) +++ haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.cpp 2008-06-12 19:53:06 UTC (rev 25945) @@ -419,69 +419,13 @@ #pragma mark - #endif -/* Build configuration options + +/* Build configuration options */ static inline net_buffer* -l2cap_build_cfg_options(_m, * _mtu, * _flush_timo, _flow) +l2cap_build_cfg_options(uint16* _mtu, uint16* _flush_timo, l2cap_flow_t* _flow) { - u_int8_t *p = NULL; + //TODO: - MGETHDR((_m), M_DONTWAIT, MT_DATA); - if ((_m) == NULL) - break; - - (_m)->m_pkthdr.len = (_m)->m_len = 0; - p = mtod((_m), u_int8_t *); - - if ((_mtu) != NULL) { - struct _cfg_opt_mtu { - l2cap_cfg_opt_t hdr; - u_int16_t val; - } __attribute__ ((packed)) *o = NULL; - - o = (struct _cfg_opt_mtu *) p; - o->hdr.type = L2CAP_OPT_MTU; - o->hdr.length = sizeof(o->val); - o->val = htole16(*(u_int16_t *)(_mtu)); - - (_m)->m_pkthdr.len += sizeof(*o); - p += sizeof(*o); - } - - if ((_flush_timo) != NULL) { - struct _cfg_opt_flush { - l2cap_cfg_opt_t hdr; - u_int16_t val; - } __attribute__ ((packed)) *o = NULL; - - o = (struct _cfg_opt_flush *) p; - o->hdr.type = L2CAP_OPT_FLUSH_TIMO; - o->hdr.length = sizeof(o->val); - o->val = htole16(*(u_int16_t *)(_flush_timo)); - - (_m)->m_pkthdr.len += sizeof(*o); - p += sizeof(*o); - } - - if ((_flow) != NULL) { - struct _cfg_opt_flow { - l2cap_cfg_opt_t hdr; - l2cap_flow_t val; - } __attribute__ ((packed)) *o = NULL; - - o = (struct _cfg_opt_flow *) p; - o->hdr.type = L2CAP_OPT_QOS; - o->hdr.length = sizeof(o->val); - o->val.flags = ((l2cap_flow_p)(_flow))->flags; - o->val.service_type = ((l2cap_flow_p) (_flow))->service_type; - o->val.token_rate = htole32(((l2cap_flow_p)(_flow))->token_rate); - o->val.token_bucket_size = htole32(((l2cap_flow_p) (_flow))->token_bucket_size); - o->val.peak_bandwidth = htole32(((l2cap_flow_p) (_flow))->peak_bandwidth); - o->val.latency = htole32(((l2cap_flow_p) (_flow))->latency); - o->val.delay_variation = htole32(((l2cap_flow_p) (_flow))->delay_variation); - - (_m)->m_pkthdr.len += sizeof(*o); - } - - (_m)->m_len = (_m)->m_pkthdr.len; + return NULL; } -*/ + From philippe.houdoin at free.fr Thu Jun 12 22:45:00 2008 From: philippe.houdoin at free.fr (philippe.houdoin at free.fr) Date: Thu, 12 Jun 2008 22:45:00 +0200 Subject: [Haiku-commits] r25939 - haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial Message-ID: <3c2f4d3d59fd680e07e1cc432793f297@free.fr> > 3) handling of usb interrupts for Prolific and ACM code. Current > line state is reported in this way. I tried to set line state bits > into tty layer engine directly in interrupt handler - but get > either complete usb stack lockup or just jump directly into KDL. > So this info is only available by request from user application. > The tty layer don't know about lines state change until such > request will be performed. :-\ Did you tried to defer setting those line state bits into TTY layer from interrupt handler by using the DPC (deferred procedure call) kernel module? Check trunk/headers/os/drivers/dpc.h. Bye, Philippe. From anevilyak at mail.berlios.de Thu Jun 12 23:30:36 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Thu, 12 Jun 2008 23:30:36 +0200 Subject: [Haiku-commits] r25946 - in haiku/trunk: headers/build/os/support headers/os/support src/build/libbe/support src/kits/support Message-ID: <200806122130.m5CLUaJn008725@sheep.berlios.de> Author: anevilyak Date: 2008-06-12 23:30:28 +0200 (Thu, 12 Jun 2008) New Revision: 25946 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25946&view=rev Modified: haiku/trunk/headers/build/os/support/List.h haiku/trunk/headers/os/support/List.h haiku/trunk/src/build/libbe/support/List.cpp haiku/trunk/src/kits/support/List.cpp Log: Revamp BList somewhat to further optimize the resizing behavior. We now keep track of a lower bound as to when the list should scale itself back down. When increasing the list size, we double the current, with the lower bound set to 1/4 of the current size, not allowing it to go any smaller than the block size. These combined allow us to do very cheap tests to see if an operation requires a resize at all, and minimize how often the list actually needs to be resized, since the difference in upper and lower bounds prevents bouncing back and forth between a size in the case of adding/removing an item while close to a boundary. All in all this should make BList noticably more scalable when doing large numbers of add/remove operations. Modified: haiku/trunk/headers/build/os/support/List.h =================================================================== --- haiku/trunk/headers/build/os/support/List.h 2008-06-12 19:53:06 UTC (rev 25945) +++ haiku/trunk/headers/build/os/support/List.h 2008-06-12 21:30:28 UTC (rev 25946) @@ -43,8 +43,8 @@ /* Adding and removing items. */ bool AddItem(void *item, int32 index); bool AddItem(void *item); - bool AddList(BList *list, int32 index); - bool AddList(BList *list); + bool AddList(const BList *list, int32 index); + bool AddList(const BList *list); bool RemoveItem(void *item); void *RemoveItem(int32 index); bool RemoveItems(int32 index, int32 count); @@ -85,14 +85,14 @@ virtual void _ReservedList2(); // return type differs from BeOS version - bool Resize(int32 count); - + bool _ResizeArray(int32 count); private: void** fObjectList; - size_t fPhysicalSize; + int32 fPhysicalSize; int32 fItemCount; int32 fBlockSize; - uint32 _reserved[2]; + int32 fResizeThreshold; + uint32 _reserved[1]; }; #endif // _BE_LIST_H Modified: haiku/trunk/headers/os/support/List.h =================================================================== --- haiku/trunk/headers/os/support/List.h 2008-06-12 19:53:06 UTC (rev 25945) +++ haiku/trunk/headers/os/support/List.h 2008-06-12 21:30:28 UTC (rev 25946) @@ -56,14 +56,14 @@ virtual void _ReservedList1(); virtual void _ReservedList2(); - bool Resize(int32 count); - + bool _ResizeArray(int32 count); private: void** fObjectList; - size_t fPhysicalSize; + int32 fPhysicalSize; int32 fItemCount; int32 fBlockSize; - uint32 _reserved[2]; + int32 fResizeThreshold; + uint32 _reserved[1]; }; #endif // _BE_LIST_H Modified: haiku/trunk/src/build/libbe/support/List.cpp =================================================================== --- haiku/trunk/src/build/libbe/support/List.cpp 2008-06-12 19:53:06 UTC (rev 25945) +++ haiku/trunk/src/build/libbe/support/List.cpp 2008-06-12 21:30:28 UTC (rev 25946) @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2008, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), @@ -22,6 +22,7 @@ // File Name: List.cpp // Author(s): The Storage kit Team // Isaac Yonemoto +// Rene Gollent // Description: BList class provides storage for pointers. // Not thread safe. //------------------------------------------------------------------------------ @@ -34,8 +35,8 @@ #include #include #include +#include - // helper function static inline void @@ -51,11 +52,12 @@ : fObjectList(NULL), fPhysicalSize(0), fItemCount(0), - fBlockSize(count) + fBlockSize(count), + fResizeThreshold(0) { if (fBlockSize <= 0) fBlockSize = 1; - Resize(fItemCount); + _ResizeArray(fItemCount); } @@ -82,7 +84,8 @@ BList::operator =(const BList &list) { fBlockSize = list.fBlockSize; - Resize(list.fItemCount); + _ResizeArray(list.fItemCount); + fItemCount = list.fItemCount; memcpy(fObjectList, list.fObjectList, fItemCount * sizeof(void*)); return *this; } @@ -92,9 +95,15 @@ bool BList::AddItem(void *item, int32 index) { - bool result = (index >= 0 && index <= fItemCount - && Resize(fItemCount + 1)); + if (index < 0 || index > fItemCount) + return false; + + bool result = true; + + if (fItemCount + 1 > fPhysicalSize) + result = _ResizeArray(fItemCount + 1); if (result) { + ++fItemCount; move_items(fObjectList + index, 1, fItemCount - index - 1); fObjectList[index] = item; } @@ -107,12 +116,14 @@ BList::AddItem(void *item) { bool result = true; - if ((int32)fPhysicalSize > fItemCount) { + if (fPhysicalSize > fItemCount) { fObjectList[fItemCount] = item; - fItemCount++; + ++fItemCount; } else { - if ((result = Resize(fItemCount + 1))) - fObjectList[fItemCount - 1] = item; + if ((result = _ResizeArray(fItemCount + 1))) { + fObjectList[fItemCount] = item; + ++fItemCount; + } } return result; } @@ -120,13 +131,15 @@ // AddList bool -BList::AddList(BList *list, int32 index) +BList::AddList(const BList *list, int32 index) { bool result = (list && index >= 0 && index <= fItemCount); if (result && list->fItemCount > 0) { int32 count = list->fItemCount; - result = Resize(fItemCount + count); + if (fItemCount + count > fPhysicalSize) + result = _ResizeArray(fItemCount + count); if (result) { + fItemCount += count; move_items(fObjectList + index, count, fItemCount - index - count); memcpy(fObjectList + index, list->fObjectList, list->fItemCount * sizeof(void *)); @@ -138,14 +151,16 @@ // AddList bool -BList::AddList(BList *list) +BList::AddList(const BList *list) { bool result = (list != NULL); if (result && list->fItemCount > 0) { int32 index = fItemCount; int32 count = list->fItemCount; - result = Resize(fItemCount + count); + if (fItemCount + count > fPhysicalSize) + result = _ResizeArray(fItemCount + count); if (result) { + fItemCount += count; memcpy(fObjectList + index, list->fObjectList, list->fItemCount * sizeof(void *)); } @@ -174,7 +189,9 @@ if (index >= 0 && index < fItemCount) { item = fObjectList[index]; move_items(fObjectList + index + 1, -1, fItemCount - index - 1); - Resize(fItemCount - 1); + --fItemCount; + if (fItemCount <= fResizeThreshold) + _ResizeArray(fItemCount); } return item; } @@ -191,7 +208,9 @@ if (count > 0) { move_items(fObjectList + index + count, -count, fItemCount - index - count); - Resize(fItemCount - count); + fItemCount -= count; + if (fItemCount <= fResizeThreshold) + _ResizeArray(fItemCount); } else result = false; } @@ -217,7 +236,8 @@ void BList::MakeEmpty() { - Resize(0); + fItemCount = 0; + _ResizeArray(0); } @@ -401,37 +421,45 @@ } } - // FBC void BList::_ReservedList1() {} void BList::_ReservedList2() {} - // Resize // // Resizes fObjectList to be large enough to contain count items. // fItemCount is adjusted accordingly. bool -BList::Resize(int32 count) +BList::_ResizeArray(int32 count) { bool result = true; // calculate the new physical size - int32 newSize = count; - if (newSize <= 0) - newSize = 1; - newSize = ((newSize - 1) / fBlockSize + 1) * fBlockSize; + // by doubling the existing size + // until we can hold at least count items + int32 newSize = fPhysicalSize > 0 ? fPhysicalSize : fBlockSize; + int32 targetSize = count; + if (targetSize <= 0) + targetSize = fBlockSize; + if (targetSize > fPhysicalSize) { + while (newSize < targetSize) + newSize <<= 1; + } else if (targetSize <= fResizeThreshold) { + newSize = fResizeThreshold; + } // resize if necessary - if ((size_t)newSize != fPhysicalSize) { + if (newSize != fPhysicalSize) { void** newObjectList = (void**)realloc(fObjectList, newSize * sizeof(void*)); if (newObjectList) { fObjectList = newObjectList; fPhysicalSize = newSize; + // set our lower bound to either 1/4 + //of the current physical size, or 0 + fResizeThreshold = fPhysicalSize >> 2 >= fBlockSize + ? fPhysicalSize >> 2 : 0; } else result = false; } - if (result) - fItemCount = count; return result; } Modified: haiku/trunk/src/kits/support/List.cpp =================================================================== --- haiku/trunk/src/kits/support/List.cpp 2008-06-12 19:53:06 UTC (rev 25945) +++ haiku/trunk/src/kits/support/List.cpp 2008-06-12 21:30:28 UTC (rev 25946) @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2008, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), @@ -22,6 +22,7 @@ // File Name: List.cpp // Author(s): The Storage kit Team // Isaac Yonemoto +// Rene Gollent // Description: BList class provides storage for pointers. // Not thread safe. //------------------------------------------------------------------------------ @@ -51,11 +52,12 @@ : fObjectList(NULL), fPhysicalSize(0), fItemCount(0), - fBlockSize(count) + fBlockSize(count), + fResizeThreshold(0) { if (fBlockSize <= 0) fBlockSize = 1; - Resize(fItemCount); + _ResizeArray(fItemCount); } @@ -82,7 +84,8 @@ BList::operator =(const BList &list) { fBlockSize = list.fBlockSize; - Resize(list.fItemCount); + _ResizeArray(list.fItemCount); + fItemCount = list.fItemCount; memcpy(fObjectList, list.fObjectList, fItemCount * sizeof(void*)); return *this; } @@ -92,9 +95,15 @@ bool BList::AddItem(void *item, int32 index) { - bool result = (index >= 0 && index <= fItemCount - && Resize(fItemCount + 1)); + if (index < 0 || index > fItemCount) + return false; + + bool result = true; + + if (fItemCount + 1 > fPhysicalSize) + result = _ResizeArray(fItemCount + 1); if (result) { + ++fItemCount; move_items(fObjectList + index, 1, fItemCount - index - 1); fObjectList[index] = item; } @@ -107,12 +116,14 @@ BList::AddItem(void *item) { bool result = true; - if ((int32)fPhysicalSize > fItemCount) { + if (fPhysicalSize > fItemCount) { fObjectList[fItemCount] = item; - fItemCount++; + ++fItemCount; } else { - if ((result = Resize(fItemCount + 1))) - fObjectList[fItemCount - 1] = item; + if ((result = _ResizeArray(fItemCount + 1))) { + fObjectList[fItemCount] = item; + ++fItemCount; + } } return result; } @@ -125,8 +136,10 @@ bool result = (list && index >= 0 && index <= fItemCount); if (result && list->fItemCount > 0) { int32 count = list->fItemCount; - result = Resize(fItemCount + count); + if (fItemCount + count > fPhysicalSize) + result = _ResizeArray(fItemCount + count); if (result) { + fItemCount += count; move_items(fObjectList + index, count, fItemCount - index - count); memcpy(fObjectList + index, list->fObjectList, list->fItemCount * sizeof(void *)); @@ -144,8 +157,10 @@ if (result && list->fItemCount > 0) { int32 index = fItemCount; int32 count = list->fItemCount; - result = Resize(fItemCount + count); + if (fItemCount + count > fPhysicalSize) + result = _ResizeArray(fItemCount + count); if (result) { + fItemCount += count; memcpy(fObjectList + index, list->fObjectList, list->fItemCount * sizeof(void *)); } @@ -174,7 +189,9 @@ if (index >= 0 && index < fItemCount) { item = fObjectList[index]; move_items(fObjectList + index + 1, -1, fItemCount - index - 1); - Resize(fItemCount - 1); + --fItemCount; + if (fItemCount <= fResizeThreshold) + _ResizeArray(fItemCount); } return item; } @@ -191,7 +208,9 @@ if (count > 0) { move_items(fObjectList + index + count, -count, fItemCount - index - count); - Resize(fItemCount - count); + fItemCount -= count; + if (fItemCount <= fResizeThreshold) + _ResizeArray(fItemCount); } else result = false; } @@ -217,7 +236,8 @@ void BList::MakeEmpty() { - Resize(0); + fItemCount = 0; + _ResizeArray(0); } @@ -401,9 +421,15 @@ } } +#if (__GNUC__ == 2) +// This is somewhat of a hack for backwards compatibility - +// the reason these functions are defined this way rather than simply +// being made private members is that if they are included, then whenever +// gcc encounters someone calling AddList() with a non-const BList pointer, +// it will try to use the private version and fail with a compiler error. + // obsolete AddList(BList* list, int32 index) and AddList(BList* list) - // AddList extern "C" bool AddList__5BListP5BListl(BList* self, BList* list, int32 index) @@ -411,52 +437,54 @@ return self->AddList((const BList*)list, index); } - // AddList extern "C" bool AddList__5BListP5BList(BList* self, BList* list) { - return self->AddList((const BList*)list); + return self->AddList((const BList *)list); } +#endif - // FBC void BList::_ReservedList1() {} void BList::_ReservedList2() {} - // Resize // // Resizes fObjectList to be large enough to contain count items. // fItemCount is adjusted accordingly. bool -BList::Resize(int32 count) +BList::_ResizeArray(int32 count) { bool result = true; // calculate the new physical size // by doubling the existing size // until we can hold at least count items - int32 newSize = fBlockSize; + int32 newSize = fPhysicalSize > 0 ? fPhysicalSize : fBlockSize; int32 targetSize = count; if (targetSize <= 0) targetSize = fBlockSize; - if ((size_t)targetSize != fPhysicalSize) { + if (targetSize > fPhysicalSize) { while (newSize < targetSize) newSize <<= 1; + } else if (targetSize <= fResizeThreshold) { + newSize = fResizeThreshold; } // resize if necessary - if ((size_t)newSize != fPhysicalSize) { + if (newSize != fPhysicalSize) { void** newObjectList = (void**)realloc(fObjectList, newSize * sizeof(void*)); if (newObjectList) { fObjectList = newObjectList; fPhysicalSize = newSize; + // set our lower bound to either 1/4 + //of the current physical size, or 0 + fResizeThreshold = fPhysicalSize >> 2 >= fBlockSize + ? fPhysicalSize >> 2 : 0; } else result = false; } - if (result) - fItemCount = count; return result; } From anevilyak at mail.berlios.de Thu Jun 12 23:33:14 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Thu, 12 Jun 2008 23:33:14 +0200 Subject: [Haiku-commits] r25947 - in haiku/trunk/src: build/libbe/support kits/support Message-ID: <200806122133.m5CLXEWw009175@sheep.berlios.de> Author: anevilyak Date: 2008-06-12 23:33:13 +0200 (Thu, 12 Jun 2008) New Revision: 25947 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25947&view=rev Modified: haiku/trunk/src/build/libbe/support/List.cpp haiku/trunk/src/kits/support/List.cpp Log: Remove unneeded header. Modified: haiku/trunk/src/build/libbe/support/List.cpp =================================================================== --- haiku/trunk/src/build/libbe/support/List.cpp 2008-06-12 21:30:28 UTC (rev 25946) +++ haiku/trunk/src/build/libbe/support/List.cpp 2008-06-12 21:33:13 UTC (rev 25947) @@ -35,7 +35,6 @@ #include #include #include -#include // helper function static inline Modified: haiku/trunk/src/kits/support/List.cpp =================================================================== --- haiku/trunk/src/kits/support/List.cpp 2008-06-12 21:30:28 UTC (rev 25946) +++ haiku/trunk/src/kits/support/List.cpp 2008-06-12 21:33:13 UTC (rev 25947) @@ -35,7 +35,6 @@ #include #include #include -#include // helper function static inline From aldeck at mail.berlios.de Fri Jun 13 02:24:02 2008 From: aldeck at mail.berlios.de (aldeck at BerliOS) Date: Fri, 13 Jun 2008 02:24:02 +0200 Subject: [Haiku-commits] r25948 - haiku/trunk/src/kits/interface Message-ID: <200806130024.m5D0O2nd022152@sheep.berlios.de> Author: aldeck Date: 2008-06-13 02:24:01 +0200 (Fri, 13 Jun 2008) New Revision: 25948 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25948&view=rev Modified: haiku/trunk/src/kits/interface/Menu.cpp Log: - BMenu caches the preferred size (since r21396) but didn't recompute it if the ResizingMode changed, it did it only in InvalidateLayout(). This fixes #1461, the bug appeared because DraggableContainerIcon uses a special trick, involving changing the resizing mode, to get the total width of the menu items. (see tracker/ContainerWindow.cpp line 479) Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-06-12 21:33:13 UTC (rev 25947) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-06-13 00:24:01 UTC (rev 25948) @@ -173,6 +173,7 @@ struct BMenu::LayoutData { BSize preferred; + uint32 lastResizingMode; }; @@ -1853,7 +1854,7 @@ BSize BMenu::_ValidatePreferredSize() { - if (!fLayoutData->preferred.IsWidthSet()) + if (!fLayoutData->preferred.IsWidthSet() || ResizingMode() != fLayoutData->lastResizingMode) _ComputeLayout(0, true, false, NULL, NULL); return fLayoutData->preferred; @@ -1867,6 +1868,8 @@ // TODO: Take "bestFit", "moveItems", "index" into account, // Recalculate only the needed items, // not the whole layout every time + + fLayoutData->lastResizingMode = ResizingMode(); BRect frame; From aldeck at mail.berlios.de Fri Jun 13 02:36:06 2008 From: aldeck at mail.berlios.de (aldeck at BerliOS) Date: Fri, 13 Jun 2008 02:36:06 +0200 Subject: [Haiku-commits] r25949 - haiku/trunk/src/kits/interface Message-ID: <200806130036.m5D0a6Dk023167@sheep.berlios.de> Author: aldeck Date: 2008-06-13 02:36:06 +0200 (Fri, 13 Jun 2008) New Revision: 25949 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25949&view=rev Modified: haiku/trunk/src/kits/interface/Menu.cpp Log: - initialize the variable, we never know :) Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-06-13 00:24:01 UTC (rev 25948) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-06-13 00:36:06 UTC (rev 25949) @@ -1262,6 +1262,7 @@ SetFont(&font, B_FONT_FAMILY_AND_STYLE | B_FONT_SIZE); fLayoutData = new LayoutData; + fLayoutData->lastResizingMode = ResizingMode(); SetLowColor(sMenuInfo.background_color); SetViewColor(sMenuInfo.background_color); From korli at mail.berlios.de Fri Jun 13 08:54:04 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Fri, 13 Jun 2008 08:54:04 +0200 Subject: [Haiku-commits] r25950 - haiku/trunk/src/kits/interface Message-ID: <200806130654.m5D6s4Ea016596@sheep.berlios.de> Author: korli Date: 2008-06-13 08:54:03 +0200 (Fri, 13 Jun 2008) New Revision: 25950 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25950&view=rev Modified: haiku/trunk/src/kits/interface/PNGDump.cpp Log: PNGDump supports B_RGB16 now Modified: haiku/trunk/src/kits/interface/PNGDump.cpp =================================================================== --- haiku/trunk/src/kits/interface/PNGDump.cpp 2008-06-13 00:36:06 UTC (rev 25949) +++ haiku/trunk/src/kits/interface/PNGDump.cpp 2008-06-13 06:54:03 UTC (rev 25950) @@ -99,10 +99,34 @@ } break; } + + case B_RGB16: + { + // create file without alpha channel + png_set_IHDR(png, info, width, height, 8, PNG_COLOR_TYPE_RGB, + PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, + PNG_FILTER_TYPE_DEFAULT); + png_write_info(png, info); + + // convert from 16 bit RGB to 24 bit RGB while saving + uint16* src = (uint16 *)bits; + int dstRowBytes = width * 3; + png_byte tempRow[dstRowBytes]; + for (int row = 0; row < height; row++) { + for (int i = 0; i < dstRowBytes; i += 3, src++) { + tempRow[i + 2] = (*src & 0xf800) >> 8; + tempRow[i + 1] = (*src & 0x07e0) >> 3; + tempRow[i] = (*src & 0x001f) << 3; + } + src = (uint16 *)((uint8 *)bits + row * bytesPerRow); + png_write_row(png, tempRow); + } + break; + } default: { - TRACE(("Unsupported color space\n")); + TRACE(("Unsupported color space %lx\n", space)); png_destroy_write_struct(&png, NULL); fclose(file); return B_ERROR; From mmlr at mail.berlios.de Fri Jun 13 15:28:13 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 13 Jun 2008 15:28:13 +0200 Subject: [Haiku-commits] r25951 - haiku/trunk/src/servers/app Message-ID: <200806131328.m5DDSD5d025848@sheep.berlios.de> Author: mmlr Date: 2008-06-13 15:28:13 +0200 (Fri, 13 Jun 2008) New Revision: 25951 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25951&view=rev Added: haiku/trunk/src/servers/app/BitmapDrawingEngine.cpp haiku/trunk/src/servers/app/BitmapDrawingEngine.h Modified: haiku/trunk/src/servers/app/Jamfile Log: Add a handy utility class that provides a DrawingEngine directly attached to a server side UtilityBitmap of a certain size. It sets up the DrawingEngine, the UtilityBitmap and the BitmapHWInterface necessary so that one can directly do drawing to a bitmap using the normal DrawingEngine interface. It provides an ExportToBitmap method that allocates an output UtilityBitmap of a specified size and color space where the content is put into, so a single instance of a BitmapDrawingEngine can be reused for various drawing. Added: haiku/trunk/src/servers/app/BitmapDrawingEngine.cpp =================================================================== --- haiku/trunk/src/servers/app/BitmapDrawingEngine.cpp 2008-06-13 06:54:03 UTC (rev 25950) +++ haiku/trunk/src/servers/app/BitmapDrawingEngine.cpp 2008-06-13 13:28:13 UTC (rev 25951) @@ -0,0 +1,85 @@ +#include "BitmapDrawingEngine.h" +#include "BitmapHWInterface.h" +#include "ServerBitmap.h" +#include + + +BitmapDrawingEngine::BitmapDrawingEngine() + : DrawingEngine(), + fHWInterface(NULL), + fBitmap(NULL) +{ +} + + +BitmapDrawingEngine::~BitmapDrawingEngine() +{ + SetSize(0, 0); +} + + +status_t +BitmapDrawingEngine::SetSize(int32 newWidth, int32 newHeight) +{ + if (fBitmap != NULL && newWidth > 0 && newHeight > 0 + && fBitmap->Bounds().IntegerWidth() >= newWidth + && fBitmap->Bounds().IntegerHeight() >= newHeight) { + return B_OK; + } + + SetHWInterface(NULL); + if (fHWInterface) { + fHWInterface->LockExclusiveAccess(); + fHWInterface->Shutdown(); + fHWInterface->UnlockExclusiveAccess(); + delete fHWInterface; + fHWInterface = NULL; + } + + delete fBitmap; + fBitmap = NULL; + + if (newWidth <= 0 || newHeight <= 0) + return B_OK; + + fBitmap = new(std::nothrow) UtilityBitmap(BRect(0, 0, newWidth - 1, + newHeight - 1), B_RGB32, 0); + if (fBitmap == NULL) + return B_NO_MEMORY; + + fHWInterface = new(std::nothrow) BitmapHWInterface(fBitmap); + if (fHWInterface == NULL) + return B_NO_MEMORY; + + status_t result = fHWInterface->Initialize(); + if (result != B_OK) + return result; + + // we have to set a valid clipping first + fClipping.Set(fBitmap->Bounds()); + ConstrainClippingRegion(&fClipping); + SetHWInterface(fHWInterface); + return B_OK; +} + + +UtilityBitmap * +BitmapDrawingEngine::ExportToBitmap(int32 width, int32 height, + color_space space) +{ + if (width <= 0 || height <= 0) + return NULL; + + UtilityBitmap *result = new(std::nothrow) UtilityBitmap(BRect(0, 0, + width - 1, height - 1), space, 0); + if (result == NULL) + return NULL; + + if (result->ImportBits(fBitmap->Bits(), fBitmap->BitsLength(), + fBitmap->BytesPerRow(), fBitmap->ColorSpace()) != B_OK) { + delete result; + return NULL; + } + + return result; +} Added: haiku/trunk/src/servers/app/BitmapDrawingEngine.h =================================================================== --- haiku/trunk/src/servers/app/BitmapDrawingEngine.h 2008-06-13 06:54:03 UTC (rev 25950) +++ haiku/trunk/src/servers/app/BitmapDrawingEngine.h 2008-06-13 13:28:13 UTC (rev 25951) @@ -0,0 +1,25 @@ +#ifndef BITMAP_DRAWING_ENGINE_H +#define BITMAP_DRAWING_ENGINE_H + +#include "DrawingEngine.h" +#include + +class BitmapHWInterface; +class UtilityBitmap; + +class BitmapDrawingEngine : public DrawingEngine { +public: + BitmapDrawingEngine(); +virtual ~BitmapDrawingEngine(); + + status_t SetSize(int32 newWidth, int32 newHeight); + UtilityBitmap * ExportToBitmap(int32 width, int32 height, + color_space space); + +private: + BitmapHWInterface * fHWInterface; + UtilityBitmap * fBitmap; + BRegion fClipping; +}; + +#endif // BITMAP_DRAWING_ENGINE_H Modified: haiku/trunk/src/servers/app/Jamfile =================================================================== --- haiku/trunk/src/servers/app/Jamfile 2008-06-13 06:54:03 UTC (rev 25950) +++ haiku/trunk/src/servers/app/Jamfile 2008-06-13 13:28:13 UTC (rev 25951) @@ -12,6 +12,7 @@ Angle.cpp AppServer.cpp #BitfieldRegion.cpp + BitmapDrawingEngine.cpp BitmapManager.cpp ClientMemoryAllocator.cpp CursorData.cpp From mmlr at mail.berlios.de Fri Jun 13 15:48:34 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 13 Jun 2008 15:48:34 +0200 Subject: [Haiku-commits] r25952 - haiku/trunk/src/servers/app Message-ID: <200806131348.m5DDmYZN028039@sheep.berlios.de> Author: mmlr Date: 2008-06-13 15:48:33 +0200 (Fri, 13 Jun 2008) New Revision: 25952 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25952&view=rev Modified: haiku/trunk/src/servers/app/DefaultDecorator.cpp haiku/trunk/src/servers/app/DefaultDecorator.h Log: * Cache the close and zoom buttons in a blit-ready bitmap so the buttons don't need to be drawn each time an update occurs (switching focus/non-focus or pressed state, involving many graphics card blits and state updates in the drawing subsystem). * Provide a shared list of already present bitmaps. All the default decorators now use the new _GetBitmapForButton static method to get a rendered bitmap of the button for the given size and state (focus, pressed). If a matching bitmap exists it is returned, otherwise a new one is created on demand using a shared BitmapDrawingEngine. * Cache the colors of the tab and frame for both focus and non-focus states to avoid always looking them up. * Added a todo that these bitmaps and the BitmapDrawingEngine are never freed. They should be freed on app_server quit, but as there are only like 12 of them anyway I didn't really bother. * Some cleanup. This should reduce the waste of cycles for just drawing the default decorator buttons quite a bit. Probably the whole tab should be pre-rendered though to also safe the text rendering of the title. Modified: haiku/trunk/src/servers/app/DefaultDecorator.cpp =================================================================== --- haiku/trunk/src/servers/app/DefaultDecorator.cpp 2008-06-13 13:28:13 UTC (rev 25951) +++ haiku/trunk/src/servers/app/DefaultDecorator.cpp 2008-06-13 13:48:33 UTC (rev 25952) @@ -12,22 +12,25 @@ #include "DefaultDecorator.h" +#include "BitmapDrawingEngine.h" #include "DesktopSettings.h" #include "DrawingEngine.h" #include "DrawState.h" #include "FontManager.h" #include "PatternHandler.h" +#include "ServerBitmap.h" #include +#include #include #include +#include #include //#define DEBUG_DECORATOR #ifdef DEBUG_DECORATOR -# include # define STRACE(x) printf x #else # define STRACE(x) ; @@ -89,13 +92,27 @@ { DefaultDecorator::SetLook(settings, look); + // common colors to both focus and non focus state fFrameColors[0] = (rgb_color){ 152, 152, 152, 255 }; fFrameColors[1] = (rgb_color){ 255, 255, 255, 255 }; - fFrameColors[2] = (rgb_color){ 216, 216, 216, 255 }; - fFrameColors[3] = (rgb_color){ 136, 136, 136, 255 }; fFrameColors[4] = (rgb_color){ 152, 152, 152, 255 }; fFrameColors[5] = (rgb_color){ 96, 96, 96, 255 }; + // state based colors + fFocusFrameColors[0] = (rgb_color){ 216, 216, 216, 255 }; + fFocusFrameColors[1] = (rgb_color){ 136, 136, 136, 255 }; + fNonFocusFrameColors[0] = (rgb_color){ 232, 232, 232, 255 }; + fNonFocusFrameColors[1] = (rgb_color){ 148, 148, 148, 255 }; + + fFocusTabColor = UIColor(B_WINDOW_TAB_COLOR); + fFocusTextColor = UIColor(B_WINDOW_TEXT_COLOR); + fNonFocusTabColor = UIColor(B_WINDOW_INACTIVE_TAB_COLOR); + fNonFocusTextColor = UIColor(B_WINDOW_INACTIVE_TEXT_COLOR); + + fCloseBitmaps[0] = fCloseBitmaps[1] = fCloseBitmaps[2] = fCloseBitmaps[3] + = fZoomBitmaps[0] = fZoomBitmaps[1] = fZoomBitmaps[2] = fZoomBitmaps[3] + = NULL; + // Set appropriate colors based on the current focus value. In this case, each decorator // defaults to not having the focus. _SetFocus(); @@ -435,7 +452,7 @@ _DrawTab(update); } -// Draw + void DefaultDecorator::Draw() { @@ -447,7 +464,7 @@ _DrawTab(fTabRect); } -// GetSizeLimits + void DefaultDecorator::GetSizeLimits(int32* minWidth, int32* minHeight, int32* maxWidth, int32* maxHeight) const @@ -458,7 +475,7 @@ *minHeight = (int32)roundf(max_c(*minHeight, fResizeRect.Height() - fBorderWidth)); } -// GetFootprint + void DefaultDecorator::GetFootprint(BRegion *region) { @@ -712,7 +729,7 @@ } } -// _DrawFrame + void DefaultDecorator::_DrawFrame(BRect invalid) { @@ -903,7 +920,7 @@ } } -// _DrawTab + void DefaultDecorator::_DrawTab(BRect invalid) { @@ -964,16 +981,28 @@ _DrawZoom(fZoomRect); } -// _DrawClose + void -DefaultDecorator::_DrawClose(BRect r) +DefaultDecorator::_DrawClose(BRect rect) { - STRACE(("_DrawClose(%f,%f,%f,%f)\n", r.left, r.top, r.right, r.bottom)); - // Just like DrawZoom, but for a close button - _DrawBlendedRect(r, GetClose()); + STRACE(("_DrawClose(%f,%f,%f,%f)\n", rect.left, rect.top, rect.right, + rect.bottom)); + + int32 index = (fButtonFocus ? 0 : 1) + (GetClose() ? 0 : 2); + ServerBitmap *bitmap = fCloseBitmaps[index]; + if (bitmap == NULL) { + bitmap = _GetBitmapForButton(DEC_CLOSE, GetClose(), fButtonFocus, + rect.IntegerWidth(), rect.IntegerHeight(), this); + fCloseBitmaps[index] = bitmap; + } + + if (bitmap == NULL) + return; + + fDrawingEngine->DrawBitmap(bitmap, rect.OffsetToCopy(0, 0), rect); } -// _DrawTitle + void DefaultDecorator::_DrawTitle(BRect r) { @@ -1008,23 +1037,23 @@ // _DrawZoom void -DefaultDecorator::_DrawZoom(BRect r) +DefaultDecorator::_DrawZoom(BRect rect) { - STRACE(("_DrawZoom(%f,%f,%f,%f)\n", r.left, r.top, r.right, r.bottom)); + STRACE(("_DrawZoom(%f,%f,%f,%f)\n", rect.left, rect.top, rect.right, + rect.bottom)); - float inset = floorf(r.Width() / 4.0); + int32 index = (fButtonFocus ? 0 : 1) + (GetZoom() ? 0 : 2); + ServerBitmap *bitmap = fZoomBitmaps[index]; + if (bitmap == NULL) { + bitmap = _GetBitmapForButton(DEC_ZOOM, GetZoom(), fButtonFocus, + rect.IntegerWidth(), rect.IntegerHeight(), this); + fZoomBitmaps[index] = bitmap; + } - BRect zr(r); - zr.left += inset; - zr.top += inset; - _DrawBlendedRect(zr, GetZoom()); + if (bitmap == NULL) + return; - inset = floorf(r.Width() / 2.1); - - zr = r; - zr.right -= inset; - zr.bottom -= inset; - _DrawBlendedRect(zr, GetZoom()); + fDrawingEngine->DrawBitmap(bitmap, rect.OffsetToCopy(0, 0), rect); } // _SetFocus @@ -1037,21 +1066,17 @@ if (IsFocus() || ((fLook == B_FLOATING_WINDOW_LOOK || fLook == kLeftTitledWindowLook) && (fFlags & B_AVOID_FOCUS) != 0)) { - fTabColor = UIColor(B_WINDOW_TAB_COLOR); - fTextColor = UIColor(B_WINDOW_TEXT_COLOR); - fButtonHighColor = tint_color(fTabColor, B_LIGHTEN_2_TINT); - fButtonLowColor = tint_color(fTabColor, B_DARKEN_1_TINT); - - fFrameColors[2] = (rgb_color){ 216, 216, 216, 255 }; - fFrameColors[3] = (rgb_color){ 136, 136, 136, 255 }; + fTabColor = fFocusTabColor; + fTextColor = fFocusTextColor; + fFrameColors[2] = fFocusFrameColors[0]; + fFrameColors[3] = fFocusFrameColors[1]; + fButtonFocus = true; } else { - fTabColor = UIColor(B_WINDOW_INACTIVE_TAB_COLOR); - fTextColor = UIColor(B_WINDOW_INACTIVE_TEXT_COLOR); - fButtonHighColor = tint_color(fTabColor, B_LIGHTEN_2_TINT); - fButtonLowColor = tint_color(fTabColor, B_DARKEN_1_TINT); - - fFrameColors[2] = (rgb_color){ 232, 232, 232, 255 }; - fFrameColors[3] = (rgb_color){ 148, 148, 148, 255 }; + fTabColor = fNonFocusTabColor; + fTextColor = fNonFocusTextColor; + fFrameColors[2] = fNonFocusFrameColors[0]; + fFrameColors[3] = fNonFocusFrameColors[1]; + fButtonFocus = false; } fTabColorLight = tint_color(fTabColor, @@ -1060,7 +1085,7 @@ B_DARKEN_2_TINT); } -// _SetColors + void DefaultDecorator::_SetColors() { @@ -1073,48 +1098,49 @@ \param down The rectangle should be drawn recessed or not */ void -DefaultDecorator::_DrawBlendedRect(BRect r, bool down) +DefaultDecorator::_DrawBlendedRect(DrawingEngine *engine, BRect rect, + bool down, bool focus) { // Actually just draws a blended square - int32 w = r.IntegerWidth(); - int32 h = r.IntegerHeight(); + int32 width = rect.IntegerWidth(); + int32 height = rect.IntegerHeight(); + int32 steps = width < height ? width : height; - rgb_color tempColor; - rgb_color halfColor, startColor, endColor; - float rstep, gstep, bstep; - - int steps = w < h ? w : h; - + rgb_color startColor, endColor; + rgb_color tabColor = focus ? fFocusTabColor : fNonFocusTabColor; if (down) { - startColor = fButtonLowColor; - endColor = fButtonHighColor; + startColor = tint_color(tabColor, B_DARKEN_1_TINT); + endColor = tint_color(tabColor, B_LIGHTEN_2_TINT);; } else { - startColor = fButtonHighColor; - endColor = fButtonLowColor; + startColor = tint_color(tabColor, B_LIGHTEN_2_TINT); + endColor = tint_color(tabColor, B_DARKEN_1_TINT); } - halfColor = make_blend_color(startColor, endColor, 0.5); + rgb_color halfColor = make_blend_color(startColor, endColor, 0.5); - rstep = float(startColor.red - halfColor.red) / steps; - gstep = float(startColor.green - halfColor.green) / steps; - bstep = float(startColor.blue - halfColor.blue) / steps; + float rstep = float(startColor.red - halfColor.red) / steps; + float gstep = float(startColor.green - halfColor.green) / steps; + float bstep = float(startColor.blue - halfColor.blue) / steps; + rgb_color tempColor; for (int32 i = 0; i <= steps; i++) { tempColor.red = uint8(startColor.red - (i * rstep)); tempColor.green = uint8(startColor.green - (i * gstep)); tempColor.blue = uint8(startColor.blue - (i * bstep)); - fDrawingEngine->StrokeLine(BPoint(r.left, r.top + i), - BPoint(r.left + i, r.top), tempColor); + engine->StrokeLine(BPoint(rect.left, rect.top + i), + BPoint(rect.left + i, rect.top), tempColor); tempColor.red = uint8(halfColor.red - (i * rstep)); tempColor.green = uint8(halfColor.green - (i * gstep)); tempColor.blue = uint8(halfColor.blue - (i * bstep)); - fDrawingEngine->StrokeLine(BPoint(r.left + steps, r.top + i), - BPoint(r.left + i, r.top + steps), tempColor); + engine->StrokeLine(BPoint(rect.left + steps, rect.top + i), + BPoint(rect.left + i, rect.top + steps), tempColor); } - fDrawingEngine->StrokeRect(r, fFrameColors[3]); + + engine->StrokeRect(rect, + focus ? fFocusFrameColors[1] : fNonFocusFrameColors[1]); } // _GetButtonSizeAndOffset @@ -1187,3 +1213,96 @@ fDrawState.Font().TruncateString(&fTruncatedTitle, B_TRUNCATE_END, size); fTruncatedTitleLength = fTruncatedTitle.Length(); } + + +ServerBitmap * +DefaultDecorator::_GetBitmapForButton(int32 item, bool down, bool focus, + int32 width, int32 height, DefaultDecorator *object) +{ + // TODO: the list of shared bitmaps is never freed + struct decorator_bitmap { + int32 item; + bool down; + bool focus; + int32 width; + int32 height; + UtilityBitmap * bitmap; + decorator_bitmap * next; + }; + + static BLocker sBitmapListLock("decorator lock", true); + static decorator_bitmap *sBitmapList = NULL; + BAutolock locker(sBitmapListLock); + + // search our list for a matching bitmap + decorator_bitmap *current = sBitmapList; + while (current) { + if (current->item == item && current->down == down + && current->focus == focus && current->width == width + && current->height == height) { + return current->bitmap; + } + + current = current->next; + } + + static BitmapDrawingEngine *sBitmapDrawingEngine = NULL; + + // didn't find any bitmap, create a new one + if (sBitmapDrawingEngine == NULL) + sBitmapDrawingEngine = new(std::nothrow) BitmapDrawingEngine(); + if (sBitmapDrawingEngine == NULL + || sBitmapDrawingEngine->SetSize(width, height) != B_OK) + return NULL; + + BRect rect(0, 0, width - 1, height - 1); + sBitmapDrawingEngine->FillRect(rect, + focus ? object->fFocusTabColor : object->fNonFocusTabColor); + + STRACE(("DefaultDecorator creating bitmap for %s %sfocus %s at size %ldx%ld\n", + item == DEC_CLOSE ? "close" : "zoom", focus ? "" : "non-", + down ? "down" : "up", width, height)); + switch (item) { + case DEC_CLOSE: + object->_DrawBlendedRect(sBitmapDrawingEngine, rect, down, focus); + break; + + case DEC_ZOOM: + { + float inset = floorf(width / 4.0); + BRect zoomRect(rect); + zoomRect.left += inset; + zoomRect.top += inset; + object->_DrawBlendedRect(sBitmapDrawingEngine, zoomRect, down, focus); + + inset = floorf(width / 2.1); + zoomRect = rect; + zoomRect.right -= inset; + zoomRect.bottom -= inset; + object->_DrawBlendedRect(sBitmapDrawingEngine, zoomRect, down, focus); + break; + } + } + + UtilityBitmap *bitmap = sBitmapDrawingEngine->ExportToBitmap(width, height, + B_RGB32); + if (bitmap == NULL) + return NULL; + + // bitmap ready, put it into the list + decorator_bitmap *entry = new(std::nothrow) decorator_bitmap; + if (entry == NULL) { + delete bitmap; + return NULL; + } + + entry->item = item; + entry->down = down; + entry->focus = focus; + entry->width = width; + entry->height = height; + entry->bitmap = bitmap; + entry->next = sBitmapList; + sBitmapList = entry; + return bitmap; +} Modified: haiku/trunk/src/servers/app/DefaultDecorator.h =================================================================== --- haiku/trunk/src/servers/app/DefaultDecorator.h 2008-06-13 13:28:13 UTC (rev 25951) +++ haiku/trunk/src/servers/app/DefaultDecorator.h 2008-06-13 13:48:33 UTC (rev 25952) @@ -14,8 +14,8 @@ #include class Desktop; +class ServerBitmap; - class DefaultDecorator: public Decorator { public: DefaultDecorator(DesktopSettings& settings, @@ -68,21 +68,36 @@ virtual void _SetColors(); private: - void _DrawBlendedRect(BRect r, bool down); + void _DrawBlendedRect(DrawingEngine *engine, + BRect rect, bool down, bool focus); void _GetButtonSizeAndOffset(const BRect& tabRect, float* offset, float* size, float* inset) const; void _LayoutTabItems(const BRect& tabRect); +static ServerBitmap * _GetBitmapForButton(int32 item, bool down, + bool focus, int32 width, int32 height, + DefaultDecorator *object); + rgb_color fButtonHighColor; rgb_color fButtonLowColor; + rgb_color fTabColor; + rgb_color fFocusTabColor; + rgb_color fNonFocusTabColor; rgb_color fTextColor; - rgb_color fTabColor; + rgb_color fFocusTextColor; + rgb_color fNonFocusTextColor; rgb_color fTabColorLight; rgb_color fTabColorShadow; rgb_color fFrameColors[6]; + rgb_color fFocusFrameColors[2]; + rgb_color fNonFocusFrameColors[2]; + bool fButtonFocus; + ServerBitmap * fCloseBitmaps[4]; + ServerBitmap * fZoomBitmaps[4]; + // Individual rects for handling window frame // rendering the proper way BRect fRightBorder; From anevilyak at gmail.com Fri Jun 13 16:01:22 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Fri, 13 Jun 2008 09:01:22 -0500 Subject: [Haiku-commits] r25952 - haiku/trunk/src/servers/app In-Reply-To: <200806131348.m5DDmYZN028039@sheep.berlios.de> References: <200806131348.m5DDmYZN028039@sheep.berlios.de> Message-ID: On Fri, Jun 13, 2008 at 8:48 AM, mmlr at BerliOS wrote: > Author: mmlr > Date: 2008-06-13 15:48:33 +0200 (Fri, 13 Jun 2008) > New Revision: 25952 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25952&view=rev > > Modified: > haiku/trunk/src/servers/app/DefaultDecorator.cpp > haiku/trunk/src/servers/app/DefaultDecorator.h > Log: > * Cache the close and zoom buttons in a blit-ready bitmap so the buttons don't > need to be drawn each time an update occurs (switching focus/non-focus or > pressed state, involving many graphics card blits and state updates in the > drawing subsystem). > * Provide a shared list of already present bitmaps. All the default decorators > now use the new _GetBitmapForButton static method to get a rendered bitmap > of the button for the given size and state (focus, pressed). If a matching > bitmap exists it is returned, otherwise a new one is created on demand using > a shared BitmapDrawingEngine. > * Cache the colors of the tab and frame for both focus and non-focus states to > avoid always looking them up. > * Added a todo that these bitmaps and the BitmapDrawingEngine are never freed. > They should be freed on app_server quit, but as there are only like 12 of > them anyway I didn't really bother. > * Some cleanup. > > This should reduce the waste of cycles for just drawing the default decorator > buttons quite a bit. Probably the whole tab should be pre-rendered though to > also safe the text rendering of the title. > Nice work! I'm not so sure caching the entire tab is necessarily a good idea though since the app can change the window title at will, while it can't really change the decorator glyphs (that I'm aware of). Also the glyphs will pretty much be shared among all apps, while the titles won't, so caching the entire tab would definitely consume noticeably more mem. Regards, Rene From ingo_weinhold at gmx.de Fri Jun 13 22:51:22 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Fri, 13 Jun 2008 22:51:22 +0200 Subject: [Haiku-commits] r25948 - haiku/trunk/src/kits/interface In-Reply-To: <200806130024.m5D0O2nd022152@sheep.berlios.de> References: <200806130024.m5D0O2nd022152@sheep.berlios.de> Message-ID: <20080613225122.463.2@knochen-vm.1213389699.fake> On 2008-06-13 at 02:24:02 [+0200], aldeck at BerliOS wrote: > Author: aldeck > Date: 2008-06-13 02:24:01 +0200 (Fri, 13 Jun 2008) > New Revision: 25948 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25948&view=rev > > Modified: > haiku/trunk/src/kits/interface/Menu.cpp > Log: > - BMenu caches the preferred size (since r21396) but didn't recompute it if > the ResizingMode changed, it did it only in > InvalidateLayout(). > > This fixes #1461, the bug appeared because DraggableContainerIcon uses a > special trick, involving changing the resizing > mode, to get the total width of the menu items. (see > tracker/ContainerWindow.cpp line 479) This sounds all pretty broken, IMHO. The Tracker method for one, but also BMenu. The preferred size should certainly neither depend on the resizing mode, nor on the current view or window frame. CU, Ingo From alex at zappotek.com Sat Jun 14 00:01:09 2008 From: alex at zappotek.com (Alexandre Deckner) Date: Sat, 14 Jun 2008 00:01:09 +0200 Subject: [Haiku-commits] r25948 - haiku/trunk/src/kits/interface In-Reply-To: <20080613225122.463.2@knochen-vm.1213389699.fake> References: <200806130024.m5D0O2nd022152@sheep.berlios.de> <20080613225122.463.2@knochen-vm.1213389699.fake> Message-ID: <4852EE25.2020304@zappotek.com> Ingo Weinhold wrote: > > This sounds all pretty broken, IMHO. The Tracker method for one, but also > BMenu. The preferred size should certainly neither depend on the resizing > mode, nor on the current view or window frame. > > Sure, we should find something else for the Tracker method :-) Concerning BMenu, if i understand corectly, the GetPrefferedSize calculations should only depend on its own content, the resizing mode being an info destined to parent. Did i get it right? Regards, Alex From laplace at mail.berlios.de Sat Jun 14 11:20:33 2008 From: laplace at mail.berlios.de (laplace at mail.berlios.de) Date: Sat, 14 Jun 2008 11:20:33 +0200 Subject: [Haiku-commits] r25953 - haiku/trunk/src/add-ons/print/drivers/pdf/source Message-ID: <200806140920.m5E9KX79020240@sheep.berlios.de> Author: laplace Date: 2008-06-14 11:19:54 +0200 (Sat, 14 Jun 2008) New Revision: 25953 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25953&view=rev Modified: haiku/trunk/src/add-ons/print/drivers/pdf/source/XReferences.cpp haiku/trunk/src/add-ons/print/drivers/pdf/source/XReferences.h Log: Closed ticket #2281. Method Link in class LocalLink shadowed destructor of parent class Link. Modified: haiku/trunk/src/add-ons/print/drivers/pdf/source/XReferences.cpp =================================================================== --- haiku/trunk/src/add-ons/print/drivers/pdf/source/XReferences.cpp 2008-06-13 13:48:33 UTC (rev 25952) +++ haiku/trunk/src/add-ons/print/drivers/pdf/source/XReferences.cpp 2008-06-14 09:19:54 UTC (rev 25953) @@ -179,9 +179,9 @@ bool cont; ASSERT(found); (void)found; if (pat1->IsLink()) { - cont = r->Link(def1, &match); + cont = r->MatchLink(def1, &match); } else { - cont = r->Dest(def1, &match); + cont = r->MatchDest(def1, &match); } if (!cont) break; @@ -370,12 +370,12 @@ { } -bool RecordDests::Link(XRefDef* def, MatchResult* result) { +bool RecordDests::MatchLink(XRefDef* def, MatchResult* result) { return true; } -bool RecordDests::Dest(XRefDef* def, MatchResult* result) { +bool RecordDests::MatchDest(XRefDef* def, MatchResult* result) { if (result->CountResults() >= 2) { BString s; BRect b; @@ -399,7 +399,7 @@ } -bool LocalLink::Link(XRefDef* def, MatchResult* result) { +bool LocalLink::MatchLink(XRefDef* def, MatchResult* result) { if (result->CountResults() >= 2) { BString label; result->GetString(1, &label); @@ -421,7 +421,7 @@ } -bool LocalLink::Dest(XRefDef* def, MatchResult* result) { +bool LocalLink::MatchDest(XRefDef* def, MatchResult* result) { return true; } Modified: haiku/trunk/src/add-ons/print/drivers/pdf/source/XReferences.h =================================================================== --- haiku/trunk/src/add-ons/print/drivers/pdf/source/XReferences.h 2008-06-13 13:48:33 UTC (rev 25952) +++ haiku/trunk/src/add-ons/print/drivers/pdf/source/XReferences.h 2008-06-14 09:19:54 UTC (rev 25953) @@ -141,8 +141,8 @@ class XMatchResult { public: virtual ~XMatchResult() { }; - virtual bool Link(XRefDef* def, MatchResult* result) = 0; - virtual bool Dest(XRefDef* def, MatchResult* result) = 0; + virtual bool MatchLink(XRefDef* def, MatchResult* result) = 0; + virtual bool MatchDest(XRefDef* def, MatchResult* result) = 0; }; @@ -210,8 +210,8 @@ public: RecordDests(XRefDests* dests, TextLine* line, int32 page); - bool Link(XRefDef* def, MatchResult* result); - bool Dest(XRefDef* def, MatchResult* result); + bool MatchLink(XRefDef* def, MatchResult* result); + bool MatchDest(XRefDef* def, MatchResult* result); }; @@ -231,8 +231,8 @@ public: LocalLink(XRefDefs* defs, XRefDests* dests, PDFWriter* writer, BString* utf8, int32 page); - bool Link(XRefDef* def, MatchResult* result); - bool Dest(XRefDef* def, MatchResult* result); + bool MatchLink(XRefDef* def, MatchResult* result); + bool MatchDest(XRefDef* def, MatchResult* result); }; From mmlr at mail.berlios.de Sat Jun 14 22:51:42 2008 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sat, 14 Jun 2008 22:51:42 +0200 Subject: [Haiku-commits] r25954 - haiku/trunk/src/servers/app Message-ID: <200806142051.m5EKpgUi018231@sheep.berlios.de> Author: mmlr Date: 2008-06-14 22:51:20 +0200 (Sat, 14 Jun 2008) New Revision: 25954 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25954&view=rev Modified: haiku/trunk/src/servers/app/DefaultDecorator.cpp haiku/trunk/src/servers/app/DefaultDecorator.h Log: When drawing the decorator buttons lock the DrawingEngine, enable copying to the front buffer, draw the bitmap, restore the copy to front buffer state and unlock. This fixes that the updated button state was not actually copyied to the front buffer (and therefore visible) when a window was inside an update (disabling front buffer copying). Modified: haiku/trunk/src/servers/app/DefaultDecorator.cpp =================================================================== --- haiku/trunk/src/servers/app/DefaultDecorator.cpp 2008-06-14 09:19:54 UTC (rev 25953) +++ haiku/trunk/src/servers/app/DefaultDecorator.cpp 2008-06-14 20:51:20 UTC (rev 25954) @@ -996,10 +996,7 @@ fCloseBitmaps[index] = bitmap; } - if (bitmap == NULL) - return; - - fDrawingEngine->DrawBitmap(bitmap, rect.OffsetToCopy(0, 0), rect); + _DrawButtonBitmap(bitmap, rect); } @@ -1050,10 +1047,7 @@ fZoomBitmaps[index] = bitmap; } - if (bitmap == NULL) - return; - - fDrawingEngine->DrawBitmap(bitmap, rect.OffsetToCopy(0, 0), rect); + _DrawButtonBitmap(bitmap, rect); } // _SetFocus @@ -1093,6 +1087,22 @@ } +void +DefaultDecorator::_DrawButtonBitmap(ServerBitmap *bitmap, BRect rect) +{ + if (bitmap == NULL) + return; + + if (fDrawingEngine->LockParallelAccess()) { + bool copyToFrontEnabled = fDrawingEngine->CopyToFrontEnabled(); + fDrawingEngine->SetCopyToFrontEnabled(true); + fDrawingEngine->DrawBitmap(bitmap, rect.OffsetToCopy(0, 0), rect); + fDrawingEngine->SetCopyToFrontEnabled(copyToFrontEnabled); + fDrawingEngine->UnlockParallelAccess(); + } +} + + /*! \brief Draws a framed rectangle with a gradient. \param down The rectangle should be drawn recessed or not Modified: haiku/trunk/src/servers/app/DefaultDecorator.h =================================================================== --- haiku/trunk/src/servers/app/DefaultDecorator.h 2008-06-14 09:19:54 UTC (rev 25953) +++ haiku/trunk/src/servers/app/DefaultDecorator.h 2008-06-14 20:51:20 UTC (rev 25954) @@ -68,6 +68,8 @@ virtual void _SetColors(); private: + void _DrawButtonBitmap(ServerBitmap *bitmap, + BRect rect); void _DrawBlendedRect(DrawingEngine *engine, BRect rect, bool down, bool focus); void _GetButtonSizeAndOffset(const BRect& tabRect, From mmlr at mail.berlios.de Sat Jun 14 22:51:58 2008 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sat, 14 Jun 2008 22:51:58 +0200 Subject: [Haiku-commits] r25955 - haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk Message-ID: <200806142051.m5EKpwcZ018294@sheep.berlios.de> Author: mmlr Date: 2008-06-14 22:51:55 +0200 (Sat, 14 Jun 2008) New Revision: 25955 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25955&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk_scsi.h Log: Implement B_EJECT_DEVICE and B_LOAD_MEDIA through the START_STOP_UNIT SCSI command. Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp 2008-06-14 20:51:20 UTC (rev 25954) +++ haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp 2008-06-14 20:51:55 UTC (rev 25955) @@ -840,6 +840,14 @@ usb_disk_synchronize(lun, true); break; + case B_EJECT_DEVICE: + return usb_disk_operation(lun, SCSI_START_STOP_UNIT_6, 6, 0, 2, + NULL, NULL, false); + + case B_LOAD_MEDIA: + return usb_disk_operation(lun, SCSI_START_STOP_UNIT_6, 6, 0, 3, + NULL, NULL, false); + default: TRACE_ALWAYS("unhandled ioctl %ld\n", op); break; Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk_scsi.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk_scsi.h 2008-06-14 20:51:20 UTC (rev 25954) +++ haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk_scsi.h 2008-06-14 20:51:55 UTC (rev 25955) @@ -13,6 +13,7 @@ SCSI_TEST_UNIT_READY_6 = 0x00, SCSI_REQUEST_SENSE_6 = 0x03, SCSI_INQUIRY_6 = 0x12, + SCSI_START_STOP_UNIT_6 = 0x1b, SCSI_READ_CAPACITY_10 = 0x25, SCSI_READ_10 = 0x28, SCSI_WRITE_10 = 0x2a, From mmlr at mail.berlios.de Sat Jun 14 22:52:08 2008 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sat, 14 Jun 2008 22:52:08 +0200 Subject: [Haiku-commits] r25956 - haiku/trunk/src/servers/app/drawing/Painter Message-ID: <200806142052.m5EKq8xn018336@sheep.berlios.de> Author: mmlr Date: 2008-06-14 22:52:05 +0200 (Sat, 14 Jun 2008) New Revision: 25956 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25956&view=rev Modified: haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp haiku/trunk/src/servers/app/drawing/Painter/Painter.h Log: When drawing bitmaps with B_OP_OVER with a color space that does not provide an alpha channel of itself, we have to respect B_TRANSPARENT_MAGIC_* pixels and properly make them transparent. We achive that now by just setting the alpha to 0 in our converted B_RGBA32 bitmap for each pixel where there is a B_TRANSPARENT_MAGIC_* pixel in the source. This is not really efficient, but fixes missing images for example in NetPositive. They were treated as B_RGBA32 while they in fact were B_RGB32 and happened to have all alpha bits set to 0. Modified: haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp 2008-06-14 20:51:55 UTC (rev 25955) +++ haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp 2008-06-14 20:52:05 UTC (rev 25956) @@ -1266,6 +1266,31 @@ memcpy(dst, buffer, bytes); } + +template +void +Painter::_TransparentMagicToAlpha(sourcePixel *buffer, uint32 width, + uint32 height, uint32 sourceBytesPerRow, sourcePixel transparentMagic, + BBitmap *output) const +{ + sourcePixel *sourceRow = buffer; + uint32 *destRow = (uint32 *)output->Bits(); + uint32 destBytesPerRow = output->BytesPerRow(); + + for (uint32 y = 0; y < height; y++) { + sourcePixel *pixel = sourceRow; + uint32 *destPixel = destRow; + for (uint32 x = 0; x < width; x++, pixel++, destPixel++) { + if (*pixel == transparentMagic) + *destPixel &= 0x00ffffff; + } + + (char *)sourceRow += sourceBytesPerRow; + (char *)destRow += destBytesPerRow; + } +} + + // _DrawBitmap void Painter::_DrawBitmap(agg::rendering_buffer& srcBuffer, color_space format, @@ -1338,9 +1363,12 @@ } } - _DrawBitmapGeneric32(srcBuffer, xOffset, yOffset, - xScale, yScale, viewRect); - break; + if (format != B_RGB32 || fDrawingMode != B_OP_OVER) { + _DrawBitmapGeneric32(srcBuffer, xOffset, yOffset, + xScale, yScale, viewRect); + break; + } + // otherwise fall through to get B_OP_OVER handling for B_RGB32 } default: { if (format == B_CMAP8 && xScale == 1.0 && yScale == 1.0) { @@ -1366,7 +1394,44 @@ srcBuffer.height() * srcBuffer.stride(), srcBuffer.stride(), 0, format); + if (err >= B_OK) { + if (fDrawingMode == B_OP_OVER) { + // the original bitmap might have had some of the + // transaparent magic colors set that we now need to + // make transparent in our RGBA32 bitmap again. + switch (format) { + case B_RGB32: + _TransparentMagicToAlpha((uint32 *)srcBuffer.buf(), + srcBuffer.width(), srcBuffer.height(), + srcBuffer.stride(), B_TRANSPARENT_MAGIC_RGBA32, + &temp); + break; + + // TODO: not sure if this applies to B_RGBA15 too. It + // should not because B_RGBA15 actually has an alpha + // channel itself and it should have been preserved + // when importing the bitmap. Maybe it applies to + // B_RGB16 though? + case B_RGB15: + _TransparentMagicToAlpha((uint16 *)srcBuffer.buf(), + srcBuffer.width(), srcBuffer.height(), + srcBuffer.stride(), B_TRANSPARENT_MAGIC_RGBA15, + &temp); + break; + + case B_CMAP8: + _TransparentMagicToAlpha((uint8 *)srcBuffer.buf(), + srcBuffer.width(), srcBuffer.height(), + srcBuffer.stride(), B_TRANSPARENT_MAGIC_CMAP8, + &temp); + break; + + default: + break; + } + } + agg::rendering_buffer convertedBuffer; convertedBuffer.attach((uint8*)temp.Bits(), (uint32)actualBitmapRect.IntegerWidth() + 1, Modified: haiku/trunk/src/servers/app/drawing/Painter/Painter.h =================================================================== --- haiku/trunk/src/servers/app/drawing/Painter/Painter.h 2008-06-14 20:51:55 UTC (rev 25955) +++ haiku/trunk/src/servers/app/drawing/Painter/Painter.h 2008-06-14 20:52:05 UTC (rev 25956) @@ -214,6 +214,13 @@ BPoint pt3, bool fill) const; + template + void _TransparentMagicToAlpha(sourcePixel *buffer, + uint32 width, uint32 height, + uint32 sourceBytesPerRow, + sourcePixel transparentMagic, + BBitmap *output) const; + void _DrawBitmap( agg::rendering_buffer& srcBuffer, color_space format, BRect actualBitmapRect, From anevilyak at gmail.com Sat Jun 14 22:53:52 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sat, 14 Jun 2008 15:53:52 -0500 Subject: [Haiku-commits] r25954 - haiku/trunk/src/servers/app In-Reply-To: <200806142051.m5EKpgUi018231@sheep.berlios.de> References: <200806142051.m5EKpgUi018231@sheep.berlios.de> Message-ID: On Sat, Jun 14, 2008 at 3:51 PM, wrote: > Author: mmlr > Date: 2008-06-14 22:51:20 +0200 (Sat, 14 Jun 2008) > New Revision: 25954 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25954&view=rev > > Modified: > haiku/trunk/src/servers/app/DefaultDecorator.cpp > haiku/trunk/src/servers/app/DefaultDecorator.h Nice! I take it this the magnify bug we talked about? Regards, Rene From mmlr at mlotz.ch Sat Jun 14 23:08:48 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Sat, 14 Jun 2008 23:08:48 +0200 Subject: [Haiku-commits] r25954 - haiku/trunk/src/servers/app In-Reply-To: Message-ID: <5324739369-BeMail@primary> > On Sat, Jun 14, 2008 at 3:51 PM, wrote: > > Author: mmlr > > Date: 2008-06-14 22:51:20 +0200 (Sat, 14 Jun 2008) > > New Revision: 25954 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25954&view=rev > > > > Modified: > > haiku/trunk/src/servers/app/DefaultDecorator.cpp > > haiku/trunk/src/servers/app/DefaultDecorator.h > > Nice! I take it this the magnify bug we talked about? Yes it is (was). When an app did as frequent redraws as Magnify does, there was a high probability of being in an update session that disabled front buffer copying. This should now work more reliable, though I am not so sure the locking is correct (in general). Regards Michael From bonefish at mail.berlios.de Sat Jun 14 23:37:56 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sat, 14 Jun 2008 23:37:56 +0200 Subject: [Haiku-commits] r25957 - haiku/trunk/src/apps/terminal Message-ID: <200806142137.m5ELbuSa022191@sheep.berlios.de> Author: bonefish Date: 2008-06-14 23:37:40 +0200 (Sat, 14 Jun 2008) New Revision: 25957 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25957&view=rev Added: haiku/trunk/src/apps/terminal/HistoryBuffer.cpp haiku/trunk/src/apps/terminal/HistoryBuffer.h haiku/trunk/src/apps/terminal/TerminalLine.h Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h haiku/trunk/src/apps/terminal/Jamfile haiku/trunk/src/apps/terminal/TermConst.h haiku/trunk/src/apps/terminal/TermView.cpp haiku/trunk/src/apps/terminal/TermView.h haiku/trunk/src/apps/terminal/UTF8Char.h Log: * Change the line history to a more compact format. We reserve lines * (width + 8) bytes which is only a little more than a sixth of what it was before. The effect on performance is relatively small. In my tests I measured about 2% slowdown. * Fixed artifacts after soft-wrapped lines. * Re-enabled cursor blinking. I changed it so that the cursor is 1s shown and 0.5s hidden (instead of 1s each). Tell me what you think. Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-14 20:52:05 UTC (rev 25956) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-14 21:37:40 UTC (rev 25957) @@ -5,6 +5,7 @@ #include "BasicTerminalBuffer.h" +#include #include #include @@ -15,11 +16,17 @@ #include "CodeConv.h" #include "TermConst.h" #include "TerminalCharClassifier.h" +#include "TerminalLine.h" static const UTF8Char kSpaceChar(' '); +#define ALLOC_LINE_ON_STACK(width) \ + ((TerminalLine*)alloca(sizeof(TerminalLine) \ + + sizeof(TerminalCell) * ((width) - 1))) + + static inline int32 restrict_value(int32 value, int32 min, int32 max) { @@ -33,24 +40,27 @@ inline int32 BasicTerminalBuffer::_LineIndex(int32 index) const { - return (index + fScreenOffset) % fHistoryCapacity; + return (index + fScreenOffset) % fHeight; } -inline BasicTerminalBuffer::Line* +inline TerminalLine* BasicTerminalBuffer::_LineAt(int32 index) const { - return fHistory[_LineIndex(index)]; + return fScreen[_LineIndex(index)]; } -inline BasicTerminalBuffer::Line* -BasicTerminalBuffer::_HistoryLineAt(int32 index) const +inline TerminalLine* +BasicTerminalBuffer::_HistoryLineAt(int32 index, TerminalLine* lineBuffer) const { - if (index >= fHeight || index < -fHistorySize) + if (index >= fHeight) return NULL; - return _LineAt(index + fHistoryCapacity); + if (index < 0 && fHistory != NULL) + return fHistory->GetTerminalLineAt(-index - 1, lineBuffer); + + return _LineAt(index + fHeight); } @@ -82,6 +92,7 @@ BasicTerminalBuffer::BasicTerminalBuffer() : + fScreen(NULL), fHistory(NULL) { } @@ -89,16 +100,14 @@ BasicTerminalBuffer::~BasicTerminalBuffer() { - _FreeLines(fHistory, fHistoryCapacity); + delete fHistory; + _FreeLines(fScreen, fHeight); } status_t BasicTerminalBuffer::Init(int32 width, int32 height, int32 historySize) { - if (historySize < 2 * height) - historySize = 2 * height; - fWidth = width; fHeight = height; @@ -108,15 +117,24 @@ fCursor.x = 0; fCursor.y = 0; + fScreenOffset = 0; + fOverwriteMode = true; - fHistoryCapacity = historySize; - fHistorySize = 0; - - fHistory = _AllocateLines(width, historySize); - if (fHistory == NULL) + fScreen = _AllocateLines(width, height); + if (fScreen == NULL) return B_NO_MEMORY; + if (historySize > 0) { + fHistory = new(std::nothrow) HistoryBuffer; + if (fHistory == NULL) + return B_NO_MEMORY; + + status_t error = fHistory->Init(width, historySize); + if (error != B_OK) + return error; + } + _ClearLines(0, fHeight - 1); fDirtyInfo.Reset(); @@ -128,7 +146,7 @@ status_t BasicTerminalBuffer::ResizeTo(int32 width, int32 height) { - return ResizeTo(width, height, fHistoryCapacity); + return ResizeTo(width, height, fHistory != NULL ? fHistory->Capacity() : 0); } @@ -136,247 +154,39 @@ BasicTerminalBuffer::ResizeTo(int32 width, int32 height, int32 historyCapacity) { if (height < MIN_ROWS || height > MAX_ROWS || width < MIN_COLS - || width > MAX_COLS || height > historyCapacity) { + || width > MAX_COLS) { return B_BAD_VALUE; } -//debug_printf("BasicTerminalBuffer::ResizeTo(): (%ld, %ld, history: %ld) -> " -//"(%ld, %ld, history: %ld)\n", fWidth, fHeight, fHistoryCapacity, width, height, -//historyCapacity); + if (width == fWidth && height == fHeight) + return SetHistoryCapacity(historyCapacity); - if (width != fWidth) { - // The width changes. We have to allocate a new line array and re-wrap - // all lines. - Line** history = _AllocateLines(width, historyCapacity); - if (history == NULL) - return B_NO_MEMORY; + // TODO: When alternate screen support is implemented, do that only when + // not using the alternate screen. + if (true) + return _ResizeRewrap(width, height, historyCapacity); - int32 totalLines = fHistorySize + fHeight; - int32 historyOffset = fHistoryCapacity - fHistorySize; - // base for _LineAt() invocations to iterate through the history - - // re-wrap - TermPos cursor; - int32 destIndex = 0; - int32 sourceIndex = 0; - int32 sourceX = 0; - int32 destTotalLines = 0; - int32 destScreenOffset = 0; - int32 maxDestTotalLines = INT_MAX; - bool newDestLine = true; - while (sourceIndex < totalLines) { - Line* sourceLine = _LineAt(historyOffset + sourceIndex); - Line* destLine = history[destIndex]; - - if (newDestLine) { - destLine->Clear(); - newDestLine = false; - } - - int32 sourceLeft = sourceLine->length - sourceX; - int32 destLeft = width - destLine->length; -//debug_printf(" source: %ld, left: %ld, dest: %ld, left: %ld\n", -//sourceIndex, sourceLeft, destIndex, destLeft); - - if (sourceIndex == fHistorySize && sourceX == 0) { - destScreenOffset = destTotalLines; - if (destLeft == 0 && sourceLeft > 0) - destScreenOffset++; -//debug_printf(" destScreenOffset: %ld\n", destScreenOffset); - } - - int32 toCopy = min_c(sourceLeft, destLeft); - // If the last cell to copy is the first cell of a - // full-width char, don't copy it yet. - if (toCopy > 0 && IS_WIDTH( - sourceLine->cells[sourceX + toCopy - 1].attributes)) { -//debug_printf(" -> last char is full-width -- don't copy it\n"); - toCopy--; - } - - // translate the cursor position - if (fCursor.y + fHistorySize == sourceIndex - && fCursor.x >= sourceX - && (fCursor.x < sourceX + toCopy - || destLeft >= sourceLeft - && sourceX + sourceLeft <= fCursor.x)) { - cursor.x = destLine->length + fCursor.x - sourceX; - cursor.y = destTotalLines; - - if (cursor.x >= width) { - // The cursor was in free space after the official end - // of line. - cursor.x = width - 1; - } -//debug_printf(" cursor: (%ld, %ld)\n", cursor.x, cursor.y); - - // don't allow the cursor to get out of screen - maxDestTotalLines = cursor.y + height - 1; - } - - if (toCopy > 0) { - memcpy(destLine->cells + destLine->length, - sourceLine->cells + sourceX, toCopy * sizeof(Cell)); - destLine->length += toCopy; - } - - bool nextDestLine = false; - if (toCopy == sourceLeft) { - if (!sourceLine->softBreak) - nextDestLine = true; - sourceIndex++; - sourceX = 0; - } else { - destLine->softBreak = true; - nextDestLine = true; - sourceX += toCopy; - } - - if (nextDestLine) { - destIndex = (destIndex + 1) % historyCapacity; - destTotalLines++; - newDestLine = true; - if (destTotalLines >= maxDestTotalLines) - break; - } - } - - // If the last source line had a soft break, the last dest line - // won't have been counted yet. - if (!newDestLine) { - destIndex = (destIndex + 1) % historyCapacity; - destTotalLines++; - } - -//debug_printf(" total lines: %ld -> %ld\n", totalLines, destTotalLines); - - int32 tempHeight = destTotalLines - destScreenOffset; - cursor.y -= destScreenOffset; - - // Re-wrapping might have produced more lines than we have room for. - if (destTotalLines > historyCapacity) - destTotalLines = historyCapacity; - - // Update the values -//debug_printf(" cursor: (%ld, %ld) -> (%ld, %ld)\n", fCursor.x, fCursor.y, -//cursor.x, cursor.y); - fCursor.x = cursor.x; - fCursor.y = cursor.y; -//debug_printf(" screen offset: %ld -> %ld\n", fScreenOffset, -//destScreenOffset % fHistoryCapacity); - fScreenOffset = destScreenOffset % historyCapacity; -//debug_printf(" history size: %ld -> %ld\n", fHistorySize, destTotalLines - fHeight); - fHistorySize = destTotalLines - tempHeight; -//debug_printf(" height %ld -> %ld\n", fHeight, tempHeight); - fHeight = tempHeight; - fWidth = width; - - _FreeLines(fHistory, fHistoryCapacity); - fHistory = history; - fHistoryCapacity = historyCapacity; - } - - if (historyCapacity > fHistoryCapacity) - SetHistoryCapacity(historyCapacity); - - if (height == fHeight) - return B_OK; - - // The height changes. We just add/remove lines at the end of the screen. - - if (height < fHeight) { - // The screen shrinks. We just drop the lines at the end of the screen, - // but we keep the cursor on screen at all costs. - if (fCursor.y >= height) { - int32 toShift = fCursor.y - height + 1; - fScreenOffset = (fScreenOffset + fHistoryCapacity + toShift) - % fHistoryCapacity; - fHistorySize += toShift; - fCursor.y -= toShift; - } - } else { - // The screen grows. We add empty lines at the end of the current - // screen. - if (fHistorySize + height > fHistoryCapacity) - fHistorySize = fHistoryCapacity - height; - - for (int32 i = fHeight; i < height; i++) - _LineAt(i)->Clear(); - } - -//debug_printf(" cursor: -> (%ld, %ld)\n", fCursor.x, fCursor.y); -//debug_printf(" screen offset: -> %ld\n", fScreenOffset); -//debug_printf(" history size: -> %ld\n", fHistorySize); - - fHeight = height; - - // reset scroll range to keep it simple - fScrollTop = 0; - fScrollBottom = fHeight - 1; - - if (historyCapacity < fHistoryCapacity) - SetHistoryCapacity(historyCapacity); - - return B_OK; + return _ResizeSimple(width, height, historyCapacity); } status_t BasicTerminalBuffer::SetHistoryCapacity(int32 historyCapacity) { - if (historyCapacity < fHeight) - return B_BAD_VALUE; - - if (fHistoryCapacity == historyCapacity) - return B_OK; - - // The history capacity changes. - Line** history = _AllocateLines(fWidth, historyCapacity); - if (history == NULL) - return B_NO_MEMORY; - - int32 totalLines = fHistorySize + fHeight; - int32 historyOffset = fHistoryCapacity - fHistorySize; - // base for _LineAt() invocations to iterate through the history - - if (totalLines > historyCapacity) { - // Our new history capacity is smaller than currently stored line, - // so we have to drop lines. - historyOffset += totalLines - historyCapacity; - totalLines = historyCapacity; - } - - for (int32 i = 0; i < totalLines; i++) { - Line* sourceLine = _LineAt(historyOffset + i); - Line* destLine = history[i]; - destLine->length = sourceLine->length; - destLine->softBreak = sourceLine->softBreak; - if (destLine->length > 0) { - memcpy(destLine->cells, sourceLine->cells, - destLine->length * sizeof(Cell)); - } - } - - _FreeLines(fHistory, fHistoryCapacity); - fHistory = history; - fHistoryCapacity = historyCapacity; - fHistorySize = totalLines - fHeight; - fScreenOffset = fHistorySize; - - return B_OK; + return _ResizeHistory(fWidth, historyCapacity); } void BasicTerminalBuffer::Clear() { - fHistorySize = 0; fScreenOffset = 0; - _ClearLines(0, fHeight - 1); - fCursor.SetTo(0, 0); + if (fHistory != NULL) + fHistory->Clear(); + fDirtyInfo.linesScrolled = 0; _Invalidate(0, fHeight - 1); } @@ -406,14 +216,19 @@ // update the dirty lines //debug_printf(" updating: %ld - %ld\n", first, last); for (int32 i = first; i <= last; i++) { - Line* sourceLine = other->_HistoryLineAt(i + offset); - Line* destLine = _LineAt(i); + TerminalLine* destLine = _LineAt(i); + TerminalLine* sourceLine = other->_HistoryLineAt(i + offset, destLine); if (sourceLine != NULL) { - destLine->length = sourceLine->length; - destLine->softBreak = sourceLine->softBreak; - if (destLine->length > 0) { - memcpy(destLine->cells, sourceLine->cells, - destLine->length * sizeof(Cell)); + if (sourceLine != destLine) { + destLine->length = sourceLine->length; + destLine->softBreak = sourceLine->softBreak; + if (destLine->length > 0) { + memcpy(destLine->cells, sourceLine->cells, + destLine->length * sizeof(TerminalCell)); + } + } else { + // The source line was a history line and has been copied + // directly into destLine. } } else destLine->Clear(); @@ -424,7 +239,8 @@ bool BasicTerminalBuffer::IsFullWidthChar(int32 row, int32 column) const { - Line* line = _HistoryLineAt(row); + TerminalLine* lineBuffer = ALLOC_LINE_ON_STACK(fWidth); + TerminalLine* line = _HistoryLineAt(row, lineBuffer); return line != NULL && column > 0 && column < line->length && (line->cells[column - 1].attributes & A_WIDTH) != 0; } @@ -434,7 +250,8 @@ BasicTerminalBuffer::GetChar(int32 row, int32 column, UTF8Char& character, uint16& attributes) const { - Line* line = _HistoryLineAt(row); + TerminalLine* lineBuffer = ALLOC_LINE_ON_STACK(fWidth); + TerminalLine* line = _HistoryLineAt(row, lineBuffer); if (line == NULL) return NO_CHAR; @@ -444,7 +261,7 @@ if (column > 0 && (line->cells[column - 1].attributes & A_WIDTH) != 0) return IN_STRING; - Cell& cell = line->cells[column]; + TerminalCell& cell = line->cells[column]; character = cell.character; attributes = cell.attributes; return A_CHAR; @@ -455,7 +272,8 @@ BasicTerminalBuffer::GetString(int32 row, int32 firstColumn, int32 lastColumn, char* buffer, uint16& attributes) const { - Line* line = _HistoryLineAt(row); + TerminalLine* lineBuffer = ALLOC_LINE_ON_STACK(fWidth); + TerminalLine* line = _HistoryLineAt(row, lineBuffer); if (line == NULL) return 0; @@ -467,7 +285,7 @@ attributes = line->cells[column].attributes; for (; column <= lastColumn; column++) { - Cell& cell = line->cells[column]; + TerminalCell& cell = line->cells[column]; if (cell.attributes != attributes) break; @@ -518,7 +336,8 @@ int32 x = pos.x; int32 y = pos.y; - Line* line = _HistoryLineAt(y); + TerminalLine* lineBuffer = ALLOC_LINE_ON_STACK(fWidth); + TerminalLine* line = _HistoryLineAt(y, lineBuffer); if (line == NULL || x < 0 || x >= fWidth) return false; @@ -550,8 +369,8 @@ // Hit the beginning of the line -- continue at the end of the // previous line, if it soft-breaks. y--; - if ((line = _HistoryLineAt(y)) == NULL || !line->softBreak - || line->length == 0) { + if ((line = _HistoryLineAt(y, lineBuffer)) == NULL + || !line->softBreak || line->length == 0) { break; } x = line->length - 1; @@ -568,7 +387,7 @@ // find the end x = end.x; y = end.y; - line = _HistoryLineAt(y); + line = _HistoryLineAt(y, lineBuffer); while (true) { if (x >= line->length) { @@ -578,7 +397,7 @@ break; y++; x = 0; - if ((line = _HistoryLineAt(y)) == NULL) + if ((line = _HistoryLineAt(y, lineBuffer)) == NULL) break; } @@ -598,7 +417,8 @@ int32 BasicTerminalBuffer::LineLength(int32 index) const { - Line* line = _HistoryLineAt(index); + TerminalLine* lineBuffer = ALLOC_LINE_ON_STACK(fWidth); + TerminalLine* line = _HistoryLineAt(index, lineBuffer); return line != NULL ? line->length : 0; } @@ -612,13 +432,14 @@ //"word: %d)\n", _pattern, start.x, start.y, forward, caseSensitive, matchWord); // normalize pos, so that _NextChar() and _PreviousChar() are happy TermPos pos(start); - Line* line = _HistoryLineAt(pos.y); + TerminalLine* lineBuffer = ALLOC_LINE_ON_STACK(fWidth); + TerminalLine* line = _HistoryLineAt(pos.y, lineBuffer); if (line != NULL) { if (forward) { while (line != NULL && pos.x >= line->length && line->softBreak) { pos.x = 0; pos.y++; - line = _HistoryLineAt(pos.y); + line = _HistoryLineAt(pos.y, lineBuffer); } } else { if (pos.x > line->length) @@ -726,7 +547,7 @@ if (!fOverwriteMode) _InsertGap(width); - Line* line = _LineAt(fCursor.y); + TerminalLine* line = _LineAt(fCursor.y); line->cells[fCursor.x].character = c; line->cells[fCursor.x].attributes = attributes; @@ -795,7 +616,7 @@ _PadLineToCursor(); _InsertGap(num); - Line* line = _LineAt(fCursor.y); + TerminalLine* line = _LineAt(fCursor.y); for (int32 i = fCursor.x; i < fCursor.x + num; i++) { line->cells[i].character = kSpaceChar; line->cells[i].attributes = 0; @@ -814,12 +635,12 @@ void BasicTerminalBuffer::DeleteChars(int32 numChars) { - Line* line = _LineAt(fCursor.y); + TerminalLine* line = _LineAt(fCursor.y); if (fCursor.x < line->length) { if (fCursor.x + numChars < line->length) { int32 left = line->length - fCursor.x - numChars; memmove(line->cells + fCursor.x, line->cells + fCursor.x + numChars, - left * sizeof(Cell)); + left * sizeof(TerminalCell)); line->length = fCursor.x + left; } else { // remove all remaining chars @@ -834,7 +655,7 @@ void BasicTerminalBuffer::DeleteColumns() { - Line* line = _LineAt(fCursor.y); + TerminalLine* line = _LineAt(fCursor.y); if (fCursor.x < line->length) { line->length = fCursor.x; _Invalidate(fCursor.y, fCursor.y); @@ -899,15 +720,16 @@ // #pragma mark - private methods -/* static */ BasicTerminalBuffer::Line** +/* static */ TerminalLine** BasicTerminalBuffer::_AllocateLines(int32 width, int32 count) { - Line** lines = (Line**)malloc(sizeof(Line*) * count); + TerminalLine** lines = (TerminalLine**)malloc(sizeof(TerminalLine*) * count); if (lines == NULL) return NULL; for (int32 i = 0; i < count; i++) { - lines[i] = (Line*)malloc(sizeof(Line) + sizeof(Cell) * (width - 1)); + lines[i] = (TerminalLine*)malloc(sizeof(TerminalLine) + + sizeof(TerminalCell) * (width - 1)); if (lines[i] == NULL) { _FreeLines(lines, i); return NULL; @@ -919,7 +741,7 @@ /* static */ void -BasicTerminalBuffer::_FreeLines(Line** lines, int32 count) +BasicTerminalBuffer::_FreeLines(TerminalLine** lines, int32 count) { if (lines != NULL) { for (int32 i = 0; i < count; i++) @@ -937,7 +759,7 @@ int32 lastCleared = -1; for (int32 i = first; i <= last; i++) { - Line* line = _LineAt(i); + TerminalLine* line = _LineAt(i); if (line->length > 0) { if (firstCleared == -1) firstCleared = i; @@ -952,6 +774,308 @@ } +status_t +BasicTerminalBuffer::_ResizeHistory(int32 width, int32 historyCapacity) +{ + if (width == fWidth && historyCapacity == HistoryCapacity()) + return B_OK; + + if (historyCapacity <= 0) { + // new history capacity is 0 -- delete the old history object + delete fHistory; + fHistory = NULL; + + return B_OK; + } + + HistoryBuffer* history = new(std::nothrow) HistoryBuffer; + if (history == NULL) + return B_NO_MEMORY; + + status_t error = history->Init(width, historyCapacity); + if (error != B_OK) { + delete history; + return error; + } + + // Transfer the lines from the old history to the new one. + if (fHistory != NULL) { + int32 historySize = min_c(HistorySize(), historyCapacity); + TerminalLine* lineBuffer = ALLOC_LINE_ON_STACK(fWidth); + for (int32 i = historySize - 1; i >= 0; i--) { + TerminalLine* line = fHistory->GetTerminalLineAt(i, lineBuffer); + if (line->length > width) + _TruncateLine(line, width); + history->AddLine(line); + } + } + + delete fHistory; + fHistory = history; + + return B_OK; +} + + +status_t +BasicTerminalBuffer::_ResizeSimple(int32 width, int32 height, + int32 historyCapacity) +{ +//debug_printf("BasicTerminalBuffer::_ResizeSimple(): (%ld, %ld) -> " +//"(%ld, %ld)\n", fWidth, fHeight, width, height); + if (width == fWidth && height == fHeight) + return B_OK; + + if (width != fWidth || historyCapacity != HistoryCapacity()) { + status_t error = _ResizeHistory(width, historyCapacity); + if (error != B_OK) + return error; + } + + TerminalLine** lines = _AllocateLines(width, height); + if (lines == NULL) + return B_NO_MEMORY; + // NOTE: If width or history capacity changed, the object will be in + // an invalid state, since the history will already use the new values. + + int32 endLine = min_c(fHeight, height); + int32 firstLine = 0; + + if (height < fHeight) { + if (endLine <= fCursor.y) { + endLine = fCursor.y + 1; + firstLine = endLine - height; + } + + // push the first lines to the history + if (fHistory != NULL) { + for (int32 i = 0; i < firstLine; i++) { + TerminalLine* line = _LineAt(i); + if (width < fWidth) + _TruncateLine(line, width); + fHistory->AddLine(line); + } + } + } + + // copy the lines we keep + for (int32 i = firstLine; i < endLine; i++) { + TerminalLine* sourceLine = _LineAt(i); + TerminalLine* destLine = lines[i - firstLine]; + if (width < fWidth) + _TruncateLine(sourceLine, width); + memcpy(destLine, sourceLine, sizeof(TerminalLine) + + (sourceLine->length - 1) * sizeof(TerminalCell)); + } + + // clear the remaining lines + for (int32 i = endLine - firstLine; i < height; i++) + lines[i]->Clear(); + + fWidth = width; + fHeight = height; + + fScrollTop = 0; + fScrollBottom = fHeight - 1; + + fScreenOffset = 0; + + if (fCursor.x > width) + fCursor.x = width; + fCursor.y -= firstLine; + + fScreen = lines; + + return B_OK; +} + + +status_t +BasicTerminalBuffer::_ResizeRewrap(int32 width, int32 height, + int32 historyCapacity) +{ +//debug_printf("BasicTerminalBuffer::_ResizeRewrap(): (%ld, %ld, history: %ld) -> " +//"(%ld, %ld, history: %ld)\n", fWidth, fHeight, HistoryCapacity(), width, height, +//historyCapacity); + + // The width stays the same. _ResizeSimple() does exactly what we need. + if (width == fWidth) + return _ResizeSimple(width, height, historyCapacity); + + // The width changes. We have to allocate a new line array, a new history + // and re-wrap all lines. + + TerminalLine** screen = _AllocateLines(width, height); + if (screen == NULL) + return B_NO_MEMORY; + + HistoryBuffer* history = NULL; + + if (historyCapacity > 0) { + history = new(std::nothrow) HistoryBuffer; + if (history == NULL) { + _FreeLines(screen, height); + return B_NO_MEMORY; + } + + status_t error = history->Init(width, historyCapacity); + if (error != B_OK) { + _FreeLines(screen, height); + delete history; + return error; + } + } + + int32 historySize = HistorySize(); + int32 totalLines = historySize + fHeight; + + // re-wrap + TerminalLine* lineBuffer = ALLOC_LINE_ON_STACK(fWidth); + TermPos cursor; + int32 destIndex = 0; + int32 sourceIndex = 0; + int32 sourceX = 0; + int32 destTotalLines = 0; + int32 destScreenOffset = 0; + int32 maxDestTotalLines = INT_MAX; + bool newDestLine = true; + bool cursorSeen = false; + TerminalLine* sourceLine = _HistoryLineAt(-historySize, lineBuffer); + + while (sourceIndex < totalLines) { + TerminalLine* destLine = screen[destIndex]; + + if (newDestLine) { + // Clear a new dest line before using it. If we're about to + // overwrite an previously written line, we push it to the + // history first, though. + if (history != NULL && destTotalLines >= height) + history->AddLine(screen[destIndex]); + destLine->Clear(); + newDestLine = false; + } + + int32 sourceLeft = sourceLine->length - sourceX; + int32 destLeft = width - destLine->length; +//debug_printf(" source: %ld, left: %ld, dest: %ld, left: %ld\n", +//sourceIndex, sourceLeft, destIndex, destLeft); + + if (sourceIndex == historySize && sourceX == 0) { + destScreenOffset = destTotalLines; + if (destLeft == 0 && sourceLeft > 0) + destScreenOffset++; + maxDestTotalLines = destScreenOffset + height; +//debug_printf(" destScreenOffset: %ld\n", destScreenOffset); + } + + int32 toCopy = min_c(sourceLeft, destLeft); + // If the last cell to copy is the first cell of a + // full-width char, don't copy it yet. + if (toCopy > 0 && IS_WIDTH( + sourceLine->cells[sourceX + toCopy - 1].attributes)) { +//debug_printf(" -> last char is full-width -- don't copy it\n"); + toCopy--; + } + + // translate the cursor position + if (fCursor.y + historySize == sourceIndex + && fCursor.x >= sourceX + && (fCursor.x < sourceX + toCopy + || destLeft >= sourceLeft + && sourceX + sourceLeft <= fCursor.x)) { + cursor.x = destLine->length + fCursor.x - sourceX; + cursor.y = destTotalLines; + + if (cursor.x >= width) { + // The cursor was in free space after the official end + // of line. + cursor.x = width - 1; + } +//debug_printf(" cursor: (%ld, %ld)\n", cursor.x, cursor.y); + + cursorSeen = true; + } + + if (toCopy > 0) { + memcpy(destLine->cells + destLine->length, + sourceLine->cells + sourceX, toCopy * sizeof(TerminalCell)); + destLine->length += toCopy; + } + + bool nextDestLine = false; + if (toCopy == sourceLeft) { + if (!sourceLine->softBreak) + nextDestLine = true; + sourceIndex++; + sourceX = 0; + sourceLine = _HistoryLineAt(sourceIndex - historySize, + lineBuffer); + } else { + destLine->softBreak = true; + nextDestLine = true; + sourceX += toCopy; + } + + if (nextDestLine) { + destIndex = (destIndex + 1) % height; + destTotalLines++; + newDestLine = true; + if (cursorSeen && destTotalLines >= maxDestTotalLines) + break; + } + } + + // If the last source line had a soft break, the last dest line + // won't have been counted yet. + if (!newDestLine) { + destIndex = (destIndex + 1) % height; + destTotalLines++; + } + +//debug_printf(" total lines: %ld -> %ld\n", totalLines, destTotalLines); + + if (destTotalLines - destScreenOffset > height) + destScreenOffset = destTotalLines - height; + + cursor.y -= destScreenOffset; + + // When there are less lines (starting with the screen offset) than + // there's room in the screen, clear the remaining screen lines. + for (int32 i = destTotalLines; i < destScreenOffset + height; i++) { + // Move the line we're going to clear to the history, if that's a + // line we've written earlier. + TerminalLine* line = screen[i % height]; + if (history != NULL && i >= height) + history->AddLine(line); + line->Clear(); + } + + // Update the values + _FreeLines(fScreen, fHeight); + delete fHistory; + +//debug_printf(" cursor: (%ld, %ld) -> (%ld, %ld)\n", fCursor.x, fCursor.y, +//cursor.x, cursor.y); + fCursor.x = cursor.x; + fCursor.y = cursor.y; +//debug_printf(" screen offset: %ld -> %ld\n", fScreenOffset, +//destScreenOffset % fHistoryCapacity); + fScreenOffset = destScreenOffset % height; +//debug_printf(" history size: %ld -> %ld\n", fHistorySize, destTotalLines - fHeight); +//debug_printf(" height %ld -> %ld\n", fHeight, tempHeight); + fHeight = height; + fWidth = width; + + fScrollTop = 0; + fScrollBottom = fHeight - 1; + + fScreen = screen; + fHistory = history; + + return B_OK; +} + + void BasicTerminalBuffer::_Scroll(int32 top, int32 bottom, int32 numLines) { @@ -964,35 +1088,42 @@ // The lines scrolled out of the screen range are transferred to // the history. - if (numLines > fHistoryCapacity) - numLines = fHistoryCapacity; + // add the lines to the history + if (fHistory != NULL) { + int32 toHistory = min_c(numLines, bottom - top + 1); + for (int32 i = 0; i < toHistory; i++) + fHistory->AddLine(_LineAt(i)); - // make room for numLines new lines - if (fHistorySize + fHeight + numLines > fHistoryCapacity) { - int32 toDrop = fHistorySize + fHeight + numLines - - fHistoryCapacity; - fHistorySize -= toDrop; - // Note that fHistorySize can temporarily become negative, - // but all will be well again, when we offset the screen. + if (toHistory < numLines) + fHistory->AddEmptyLines(numLines - toHistory); } - // clear numLines after the current screen - for (int32 i = fHeight; i < fHeight + numLines; i++) - _LineAt(i)->Clear(); - - if (bottom < fHeight - 1) { - // Only scroll part of the screen. Move the unscrolled lines to - // their new location. + if (numLines >= bottom - top + 1) { + // all lines are scrolled out of range -- just clear them + _ClearLines(top, bottom); + } else if (bottom == fHeight - 1) { + // full screen scroll -- update the screen offset and clear new + // lines + fScreenOffset = (fScreenOffset + numLines) % fHeight; + for (int32 i = bottom - numLines + 1; i <= bottom; i++) + _LineAt(i)->Clear(); + } else { + // Partial screen scroll. We move the screen offset anyway, but + // have to move the unscrolled lines to their new location. + // TODO: It may be more efficient to actually move the scrolled + // lines only (might depend on the number of scrolled/unscrolled + // lines). for (int32 i = bottom + 1; i < fHeight; i++) { - std::swap(fHistory[_LineIndex(i)], - fHistory[_LineIndex(i) + numLines]); + std::swap(fScreen[_LineIndex(i)], + fScreen[_LineIndex(i) + numLines]); } + + // update the screen offset and clear the new lines + fScreenOffset = (fScreenOffset + numLines) % fHeight; + for (int32 i = bottom - numLines + 1; i <= bottom; i++) + _LineAt(i)->Clear(); } - // all lines are in place -- offset the screen - fScreenOffset = (fScreenOffset + numLines) % fHistoryCapacity; - fHistorySize += numLines; - // scroll/extend dirty range if (fDirtyInfo.dirtyTop != INT_MAX) { @@ -1009,13 +1140,9 @@ } fDirtyInfo.linesScrolled += numLines; -// TODO: The linesScrolled might be suboptimal when scrolling partially -// only, since we would scroll the whole visible area, including unscrolled -// lines, which invalidates them, too. // invalidate new empty lines _Invalidate(bottom + 1 - numLines, bottom); - } else if (numLines >= bottom - top + 1) { // all lines are completely scrolled out of range -- just clear // them [... truncated: 1101 lines follow ...] From alex at zappotek.com Sun Jun 15 00:34:02 2008 From: alex at zappotek.com (Alexandre Deckner) Date: Sun, 15 Jun 2008 00:34:02 +0200 Subject: [Haiku-commits] r25948 - haiku/trunk/src/kits/interface In-Reply-To: <4852EE25.2020304@zappotek.com> References: <200806130024.m5D0O2nd022152@sheep.berlios.de> <20080613225122.463.2@knochen-vm.1213389699.fake> <4852EE25.2020304@zappotek.com> Message-ID: <4854475A.5040700@zappotek.com> [forwarding lost conversation] Ingo Weinhold wrote: >> Sure, we should find something else for the Tracker method :-) >> Concerning BMenu, if i understand corectly, the GetPrefferedSize >> calculations should only depend on its own content, the resizing mode >> being an info destined to parent. Did i get it right? >> > > In my opinion, yes. I can't say how much of how it is currently > implemented is implied by BeOS behavior and can't be changed, though. > I'm looking at it right now. This code is older than the svn repository, it's been there for a while. In BMenu::_ComputeLayout i commented the part that adjust the width depending on the resizing mode. Everything works fine so far (except tracker menubar now). I looked at older revisions and there was a comment saying this code is there for BMenuBar. Anyone familiar with this part? Stefano? I'll have a look at BMenuBar anyway. I also did a search on http://haiku.it.su.se:8180/source/ and it seems GetResizingMode is very rarely used that way. Regards, Alex From bonefish at mail.berlios.de Sun Jun 15 03:02:57 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sun, 15 Jun 2008 03:02:57 +0200 Subject: [Haiku-commits] r25958 - haiku/trunk/src/apps/terminal Message-ID: <200806150102.m5F12vY5027864@sheep.berlios.de> Author: bonefish Date: 2008-06-15 03:02:55 +0200 (Sun, 15 Jun 2008) New Revision: 25958 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25958&view=rev Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp haiku/trunk/src/apps/terminal/TerminalLine.h Log: * Changed TerminalLine::length from int16 to uint16. * BasicTerminalBuffer::Init() no longer uses _ClearLines() to clear the screen lines, since that expects the lines to be somewhat valid at least and also needlessly updates the dirty region. * _ClearLines() always clears lines, even if they were empty. This way the "softBreak" flag is cleared too. * Be a bit more careful when multiplying a potentially negative signed number by an unsigned one. Shouldn't have caused a problem in this case, though. Either of the first three items should fix #2379. Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-14 21:37:40 UTC (rev 25957) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-15 01:02:55 UTC (rev 25958) @@ -135,7 +135,8 @@ return error; } - _ClearLines(0, fHeight - 1); + for (int32 i = 0; i < fHeight; i++) + fScreen[i]->Clear(); fDirtyInfo.Reset(); @@ -764,9 +765,9 @@ if (firstCleared == -1) firstCleared = i; lastCleared = i; + } - line->Clear(); - } + line->Clear(); } if (firstCleared >= 0) @@ -864,8 +865,8 @@ TerminalLine* destLine = lines[i - firstLine]; if (width < fWidth) _TruncateLine(sourceLine, width); - memcpy(destLine, sourceLine, sizeof(TerminalLine) - + (sourceLine->length - 1) * sizeof(TerminalCell)); + memcpy(destLine, sourceLine, (int32)sizeof(TerminalLine) + + (sourceLine->length - 1) * (int32)sizeof(TerminalCell)); } // clear the remaining lines Modified: haiku/trunk/src/apps/terminal/TerminalLine.h =================================================================== --- haiku/trunk/src/apps/terminal/TerminalLine.h 2008-06-14 21:37:40 UTC (rev 25957) +++ haiku/trunk/src/apps/terminal/TerminalLine.h 2008-06-15 01:02:55 UTC (rev 25958) @@ -17,7 +17,7 @@ struct TerminalLine { - int16 length; + uint16 length; bool softBreak; // soft line break TerminalCell cells[1]; From bonefish at mail.berlios.de Sun Jun 15 04:13:11 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sun, 15 Jun 2008 04:13:11 +0200 Subject: [Haiku-commits] r25959 - haiku/trunk/src/apps/terminal Message-ID: <200806150213.m5F2DBnE030661@sheep.berlios.de> Author: bonefish Date: 2008-06-15 04:13:09 +0200 (Sun, 15 Jun 2008) New Revision: 25959 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25959&view=rev Modified: haiku/trunk/src/apps/terminal/SmartTabView.h Log: Made RemoveAndDeleteTab() virtual, so it can be overridden. Deleting the view without notifying anyone isn't always desirable. Modified: haiku/trunk/src/apps/terminal/SmartTabView.h =================================================================== --- haiku/trunk/src/apps/terminal/SmartTabView.h 2008-06-15 01:02:55 UTC (rev 25958) +++ haiku/trunk/src/apps/terminal/SmartTabView.h 2008-06-15 02:13:09 UTC (rev 25959) @@ -20,7 +20,7 @@ B_WILL_DRAW | B_NAVIGABLE_JUMP | B_FRAME_EVENTS | B_NAVIGABLE); virtual ~SmartTabView(); - + virtual void MouseDown(BPoint where); virtual void AttachedToWindow(); @@ -29,9 +29,9 @@ virtual void MessageReceived(BMessage *message); virtual void Select(int32 tab); - - void RemoveAndDeleteTab(int32 index); - + + virtual void RemoveAndDeleteTab(int32 index); + virtual void AddTab(BView *target, BTab *tab = NULL); virtual BTab* RemoveTab(int32 index); From bonefish at mail.berlios.de Sun Jun 15 04:18:34 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sun, 15 Jun 2008 04:18:34 +0200 Subject: [Haiku-commits] r25960 - haiku/trunk/src/apps/terminal Message-ID: <200806150218.m5F2IYld030975@sheep.berlios.de> Author: bonefish Date: 2008-06-15 04:18:31 +0200 (Sun, 15 Jun 2008) New Revision: 25960 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25960&view=rev Modified: haiku/trunk/src/apps/terminal/TermConst.h haiku/trunk/src/apps/terminal/TermView.cpp haiku/trunk/src/apps/terminal/TermWindow.cpp haiku/trunk/src/apps/terminal/TermWindow.h Log: * TermWindow does maintain a separate Session list instead of doing nasty things with the tab view. * The tabs are named "Shell " now, which is somewhat more useful than all being named "Terminal". This is similar to Konsole and we should probably also support setting the tab name by the user. Until Haiku supports persistent sessions, that is not really useful, though. * Shift-Left/Right iterates through the tabs, now. Modified: haiku/trunk/src/apps/terminal/TermConst.h =================================================================== --- haiku/trunk/src/apps/terminal/TermConst.h 2008-06-15 02:13:09 UTC (rev 25959) +++ haiku/trunk/src/apps/terminal/TermConst.h 2008-06-15 02:18:31 UTC (rev 25960) @@ -82,6 +82,8 @@ const uint32 MSG_FONT_CHANGED = 'fntc'; const uint32 SAVE_AS_DEFAULT = 'sadf'; const uint32 MSG_CHECK_CHILDREN = 'ckch'; +const uint32 MSG_PREVIOUS_TAB = 'ptab'; +const uint32 MSG_NEXT_TAB = 'ntab'; const uint32 MSG_TERMINAL_BUFFER_CHANGED = 'bufc'; const uint32 MSG_SET_TERMNAL_TITLE = 'sett'; Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-15 02:13:09 UTC (rev 25959) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-15 02:18:31 UTC (rev 25960) @@ -1155,18 +1155,26 @@ case B_LEFT_ARROW: if (rawChar == B_LEFT_ARROW) { - if (mod & B_CONTROL_KEY) + if (mod & B_SHIFT_KEY) { + BMessage message(MSG_PREVIOUS_TAB); + message.AddPointer("termView", this); + Window()->PostMessage(&message); + } else if (mod & B_CONTROL_KEY) { toWrite = CTRL_LEFT_ARROW_KEY_CODE; - else + } else toWrite = LEFT_ARROW_KEY_CODE; } break; case B_RIGHT_ARROW: if (rawChar == B_RIGHT_ARROW) { - if (mod & B_CONTROL_KEY) + if (mod & B_SHIFT_KEY) { + BMessage message(MSG_NEXT_TAB); + message.AddPointer("termView", this); + Window()->PostMessage(&message); + } else if (mod & B_CONTROL_KEY) { toWrite = CTRL_RIGHT_ARROW_KEY_CODE; - else + } else toWrite = RIGHT_ARROW_KEY_CODE; } break; Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.cpp 2008-06-15 02:13:09 UTC (rev 25959) +++ haiku/trunk/src/apps/terminal/TermWindow.cpp 2008-06-15 02:18:31 UTC (rev 25960) @@ -87,6 +87,41 @@ }; +struct TermWindow::Session { + int32 id; + BString name; + TermViewContainerView* containerView; + + Session(int32 id, TermViewContainerView* containerView) + : + id(id), + containerView(containerView) + { + name = "Shell "; + name << id; + } +}; + + +class TermWindow::TabView : public SmartTabView { +public: + TabView(TermWindow* window, BRect frame, const char *name) + : + SmartTabView(frame, name), + fWindow(window) + { + } + + virtual void RemoveAndDeleteTab(int32 index) + { + fWindow->_RemoveTab(index); + } + +private: + TermWindow* fWindow; +}; + + TermWindow::TermWindow(BRect frame, const char* title, Arguments *args) : BWindow(frame, title, B_DOCUMENT_WINDOW, B_CURRENT_WORKSPACE|B_QUIT_ON_WINDOW_CLOSE), fTabView(NULL), @@ -124,6 +159,9 @@ } PrefHandler::DeleteDefault(); + + for (int32 i = 0; Session* session = (Session*)fSessions.ItemAt(i); i++) + delete session; } @@ -139,7 +177,7 @@ BRect textFrame = Bounds(); textFrame.top = fMenubar->Bounds().bottom + 1.0; - fTabView = new SmartTabView(textFrame, "tab view"); + fTabView = new TabView(this, textFrame, "tab view"); AddChild(fTabView); } @@ -449,6 +487,21 @@ _CheckChildren(); break; + case MSG_PREVIOUS_TAB: + case MSG_NEXT_TAB: + { + TermView* termView; + if (message->FindPointer("termView", (void**)&termView) == B_OK) { + int32 count = fSessions.CountItems(); + int32 index = _IndexOfTermView(termView); + if (count > 1 && index >= 0) { + index += message->what == MSG_PREVIOUS_TAB ? -1 : 1; + fTabView->Select((index + count) % count); + } + } + break; + } + case kNewTab: if (fTabView->CountTabs() < kMaxTabs) _AddTab(NULL); @@ -606,12 +659,15 @@ BScrollView *scrollView = new TermScrollView("scrollView", containerView, view); + Session* session = new Session(_NewSessionID(), containerView); + fSessions.AddItem(session); + BTab *tab = new BTab; // TODO: Use a better name. For example, do like MacOsX's Terminal // and update the title using the last executed command ? // Or like Gnome's Terminal and use the current path ? fTabView->AddTab(scrollView, tab); - tab->SetLabel("Terminal"); + tab->SetLabel(session->name.String()); view->SetScrollBar(scrollView->ScrollBar(B_VERTICAL)); // Resize the vertical scrollbar to take the window gripping handle into account @@ -654,17 +710,21 @@ // TODO: Should cleanup, I guess } } - - + + void TermWindow::_RemoveTab(int32 index) { - if (fTabView->CountTabs() > 1) - delete fTabView->RemoveTab(index); - else + if (fSessions.CountItems() > 1) { + if (Session* session = (Session*)fSessions.RemoveItem(index)) { + delete session; + delete fTabView->RemoveTab(index); + } + } else PostMessage(B_QUIT_REQUESTED); } + TermViewContainerView* TermWindow::_ActiveTermViewContainerView() const { @@ -675,11 +735,9 @@ TermViewContainerView* TermWindow::_TermViewContainerViewAt(int32 index) const { - // TODO: BAD HACK: - // We should probably use the observer api to tell - // the various "tabs" when settings are changed. Fix this. - BScrollView* scrollView = (BScrollView*)fTabView->ViewForTab(index); - return scrollView ? (TermViewContainerView*)scrollView->Target() : NULL; + if (Session* session = (Session*)fSessions.ItemAt(index)) + return session->containerView; + return NULL; } @@ -718,16 +776,10 @@ void TermWindow::_CheckChildren() { - // There seems to be no separate list of sessions, so we have to iterate - // through the tabs. - int32 count = fTabView->CountTabs(); + int32 count = fSessions.CountItems(); for (int32 i = count - 1; i >= 0; i--) { - // get the term view - TermView* termView = _TermViewAt(i); - if (!termView) - continue; - - termView->CheckShellGone(); + Session* session = (Session*)fSessions.ItemAt(i); + session->containerView->GetTermView()->CheckShellGone(); } } @@ -787,6 +839,29 @@ } +int32 +TermWindow::_NewSessionID() +{ + for (int32 id = 1; ; id++) { + bool used = false; + + for (int32 i = 0; + Session* session = (Session*)fSessions.ItemAt(i); i++) { + if (id == session->id) { + used = true; + break; + } + } + + if (!used) + return id; + } +} + + +// #pragma mark - + + // CustomTermView CustomTermView::CustomTermView(int32 rows, int32 columns, int32 argc, const char **argv, int32 historySize) : Modified: haiku/trunk/src/apps/terminal/TermWindow.h =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.h 2008-06-15 02:13:09 UTC (rev 25959) +++ haiku/trunk/src/apps/terminal/TermWindow.h 2008-06-15 02:18:31 UTC (rev 25960) @@ -57,6 +57,10 @@ virtual void MenusBeginning(); private: + struct Session; + class TabView; + friend class TabView; + void _SetTermColors(TermViewContainerView *termView); void _InitWindow(); void _SetupMenu(); @@ -73,10 +77,13 @@ void _CheckChildren(); void _ResizeView(TermView *view); void _BuildWindowSizeMenu(BMenu *menu); + int32 _NewSessionID(); + + BList fSessions; - SmartTabView *fTabView; + TabView *fTabView; TermView *fTermView; - + BMenuBar *fMenubar; BMenu *fFilemenu; BMenu *fEditmenu; From fekdahl at gmail.com Sun Jun 15 11:49:02 2008 From: fekdahl at gmail.com (Fredrik Ekdahl) Date: Sun, 15 Jun 2008 11:49:02 +0200 Subject: [Haiku-commits] r25942 - in haiku/trunk: headers/private/bluetooth src/kits/bluetooth In-Reply-To: <200806121918.m5CJIWOC025490@sheep.berlios.de> References: <200806121918.m5CJIWOC025490@sheep.berlios.de> Message-ID: <4854E58E.7020700@gmail.com> oruizdorantes at BerliOS skrev: > Author: oruizdorantes > Date: 2008-06-12 21:18:32 +0200 (Thu, 12 Jun 2008) > New Revision: 25942 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25942&view=rev > > Modified: > haiku/trunk/headers/private/bluetooth/CommandManager.h > haiku/trunk/src/kits/bluetooth/CommandManager.cpp > Log: > - Add PinCode command replies > - Add CancelInquiry command > Modified: haiku/trunk/src/kits/bluetooth/CommandManager.cpp > =================================================================== > --- haiku/trunk/src/kits/bluetooth/CommandManager.cpp 2008-06-12 18:22:27 UTC (rev 25941) > +++ haiku/trunk/src/kits/bluetooth/CommandManager.cpp 2008-06-12 19:18:32 UTC (rev 25942) > + memcpy(¶m->pin_code, pincode, length); Here's a build fix.. -------------- next part -------------- A non-text attachment was scrubbed... Name: bt.diff Type: text/x-diff Size: 365 bytes Desc: not available URL: From fekdahl at gmail.com Sun Jun 15 11:55:14 2008 From: fekdahl at gmail.com (Fredrik Ekdahl) Date: Sun, 15 Jun 2008 11:55:14 +0200 Subject: [Haiku-commits] r25956 - haiku/trunk/src/servers/app/drawing/Painter In-Reply-To: <200806142052.m5EKq8xn018336@sheep.berlios.de> References: <200806142052.m5EKq8xn018336@sheep.berlios.de> Message-ID: <4854E702.2060200@gmail.com> mmlr at mail.berlios.de skrev: > Author: mmlr > Date: 2008-06-14 22:52:05 +0200 (Sat, 14 Jun 2008) > New Revision: 25956 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25956&view=rev > > Modified: > haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp > haiku/trunk/src/servers/app/drawing/Painter/Painter.h > Log: > When drawing bitmaps with B_OP_OVER with a color space that does not provide > an alpha channel of itself, we have to respect B_TRANSPARENT_MAGIC_* pixels > and properly make them transparent. We achive that now by just setting the > alpha to 0 in our converted B_RGBA32 bitmap for each pixel where there is a > B_TRANSPARENT_MAGIC_* pixel in the source. This is not really efficient, but > fixes missing images for example in NetPositive. They were treated as B_RGBA32 > while they in fact were B_RGB32 and happened to have all alpha bits set to 0. > > Modified: haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp > =================================================================== > --- haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp 2008-06-14 20:51:55 UTC (rev 25955) > +++ haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp 2008-06-14 20:52:05 UTC (rev 25956) > + (char *)sourceRow += sourceBytesPerRow; > + (char *)destRow += destBytesPerRow; Build problem "invalid lvalue in assignment" Output: src/servers/app/drawing/Painter/Painter.cpp: In member function 'void Painter::_TransparentMagicToAlpha(sourcePixel*, uint32, uint32, uint32, sourcePixel, BBitmap*) const [with sourcePixel = uint32]': src/servers/app/drawing/Painter/Painter.cpp:1408: instantiated from here src/servers/app/drawing/Painter/Painter.cpp:1288: error: invalid lvalue in assignment src/servers/app/drawing/Painter/Painter.cpp:1289: error: invalid lvalue in assignment src/servers/app/drawing/Painter/Painter.cpp: In member function 'void Painter::_TransparentMagicToAlpha(sourcePixel*, uint32, uint32, uint32, sourcePixel, BBitmap*) const [with sourcePixel = uint16]': src/servers/app/drawing/Painter/Painter.cpp:1420: instantiated from here src/servers/app/drawing/Painter/Painter.cpp:1288: error: invalid lvalue in assignment src/servers/app/drawing/Painter/Painter.cpp:1289: error: invalid lvalue in assignment src/servers/app/drawing/Painter/Painter.cpp: In member function 'void Painter::_TransparentMagicToAlpha(sourcePixel*, uint32, uint32, uint32, sourcePixel, BBitmap*) const [with sourcePixel = uint8]': src/servers/app/drawing/Painter/Painter.cpp:1427: instantiated from here src/servers/app/drawing/Painter/Painter.cpp:1288: error: invalid lvalue in assignment src/servers/app/drawing/Painter/Painter.cpp:1289: error: invalid lvalue in assignment From stippi at mail.berlios.de Sun Jun 15 12:42:21 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 15 Jun 2008 12:42:21 +0200 Subject: [Haiku-commits] r25961 - haiku/trunk/src/servers/app/drawing/Painter Message-ID: <200806151042.m5FAgLSs021956@sheep.berlios.de> Author: stippi Date: 2008-06-15 12:41:54 +0200 (Sun, 15 Jun 2008) New Revision: 25961 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25961&view=rev Modified: haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp Log: Keep the last changes more in the style of the rest of the file. (Nice catch, btw, Michael!) Modified: haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp 2008-06-15 02:18:31 UTC (rev 25960) +++ haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp 2008-06-15 10:41:54 UTC (rev 25961) @@ -1269,24 +1269,24 @@ template void -Painter::_TransparentMagicToAlpha(sourcePixel *buffer, uint32 width, +Painter::_TransparentMagicToAlpha(sourcePixel* buffer, uint32 width, uint32 height, uint32 sourceBytesPerRow, sourcePixel transparentMagic, - BBitmap *output) const + BBitmap* output) const { - sourcePixel *sourceRow = buffer; - uint32 *destRow = (uint32 *)output->Bits(); + uint8* sourceRow = (uint8*)buffer; + uint8* destRow = (uint8*)output->Bits(); uint32 destBytesPerRow = output->BytesPerRow(); for (uint32 y = 0; y < height; y++) { - sourcePixel *pixel = sourceRow; - uint32 *destPixel = destRow; + sourcePixel* pixel = (sourcePixel*)sourceRow; + uint32* destPixel = (uint32*)destRow; for (uint32 x = 0; x < width; x++, pixel++, destPixel++) { if (*pixel == transparentMagic) *destPixel &= 0x00ffffff; } - (char *)sourceRow += sourceBytesPerRow; - (char *)destRow += destBytesPerRow; + sourceRow += sourceBytesPerRow; + destRow += destBytesPerRow; } } From superstippi at gmx.de Sun Jun 15 12:46:51 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 15 Jun 2008 12:46:51 +0200 Subject: [Haiku-commits] r25956 - haiku/trunk/src/servers/app/drawing/Painter In-Reply-To: <4854E702.2060200@gmail.com> References: <200806142052.m5EKq8xn018336@sheep.berlios.de> <4854E702.2060200@gmail.com> Message-ID: <20080615124651.1117.1@stippis2.1213522404.fake> Hi, Fredrik Ekdahl wrote: > mmlr at mail.berlios.de skrev: > > Modified: haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp > > =================================================================== > > --- haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp > > 2008-06-14 20:51:55 UTC (rev 25955) > > +++ haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp > > 2008-06-14 20:52:05 UTC (rev 25956) > > > + (char *)sourceRow += sourceBytesPerRow; > > + (char *)destRow += destBytesPerRow; > > Build problem "invalid lvalue in assignment" Should be fixed in r25961. Best regards, -Stephan From rudolfc at mail.berlios.de Sun Jun 15 14:39:47 2008 From: rudolfc at mail.berlios.de (rudolfc at mail.berlios.de) Date: Sun, 15 Jun 2008 14:39:47 +0200 Subject: [Haiku-commits] r25962 - haiku/trunk/src/add-ons/accelerants/nvidia/engine Message-ID: <200806151239.m5FCdlOA006714@sheep.berlios.de> Author: rudolfc Date: 2008-06-15 14:39:39 +0200 (Sun, 15 Jun 2008) New Revision: 25962 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25962&view=rev Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c Log: test commit Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c 2008-06-15 10:41:54 UTC (rev 25961) +++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c 2008-06-15 12:39:39 UTC (rev 25962) @@ -2,6 +2,7 @@ Mark Watson 12/1999, Apsed, Rudolf Cornelissen 10/2002-6/2008 + tst.. */ #define MODULE_BIT 0x00008000 From oruizdorantes at mail.berlios.de Sun Jun 15 16:40:11 2008 From: oruizdorantes at mail.berlios.de (oruizdorantes at mail.berlios.de) Date: Sun, 15 Jun 2008 16:40:11 +0200 Subject: [Haiku-commits] r25963 - haiku/trunk/src/kits/bluetooth Message-ID: <200806151440.m5FEeBYS016365@sheep.berlios.de> Author: oruizdorantes Date: 2008-06-15 16:40:03 +0200 (Sun, 15 Jun 2008) New Revision: 25963 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25963&view=rev Modified: haiku/trunk/src/kits/bluetooth/DiscoveryAgent.cpp Log: test Modified: haiku/trunk/src/kits/bluetooth/DiscoveryAgent.cpp =================================================================== --- haiku/trunk/src/kits/bluetooth/DiscoveryAgent.cpp 2008-06-15 12:39:39 UTC (rev 25962) +++ haiku/trunk/src/kits/bluetooth/DiscoveryAgent.cpp 2008-06-15 14:40:03 UTC (rev 25963) @@ -27,7 +27,7 @@ { /* No inquiry process initiated */ if (fLastUsedListener == NULL) - return NULL; + return NULL; // xxx: Fix me return fLastUsedListener->GetRemoteDevicesList(); } @@ -44,7 +44,7 @@ DiscoveryAgent::StartInquiry(uint32 accessCode, DiscoveryListener* listener, bigtime_t secs) { BMessenger* btsm = NULL; - size_t size; + size_t size; if ((btsm = _RetrieveBluetoothMessenger()) == NULL) return B_ERROR; @@ -66,11 +66,11 @@ BMessage reply; request.AddInt32("hci_id", fLocalDevice->GetID()); - - startInquiryCommand = buildInquiry(accessCode, secs, BT_MAX_RESPONSES, &size); - // For stating the inquiry - request.AddData("raw command", B_ANY_TYPE, startInquiryCommand, size); + startInquiryCommand = buildInquiry(accessCode, secs, BT_MAX_RESPONSES, &size); + + // For stating the inquiry + request.AddData("raw command", B_ANY_TYPE, startInquiryCommand, size); request.AddInt16("eventExpected", HCI_EVENT_CMD_STATUS); request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_LINK_CONTROL, OCF_INQUIRY)); @@ -94,7 +94,8 @@ status_t DiscoveryAgent::CancelInquiry(DiscoveryListener* listener) { - BMessenger* btsm = NULL; + BMessenger* btsm = NULL; //TODO: this should be a member field + size_t size; if ((btsm = _RetrieveBluetoothMessenger()) == NULL) return B_ERROR; @@ -107,17 +108,19 @@ BMessage reply; request.AddInt32("hci_id", fLocalDevice->GetID()); - // TODO: Add the raw command to the BMessage + expected event(s) + cancelInquiryCommand = buildInquiryCancel(&size); + request.AddData("raw command", B_ANY_TYPE, cancelInquiryCommand, size); + request.AddInt16("eventExpected", HCI_EVENT_CMD_STATUS); + request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_LINK_CONTROL, OCF_INQUIRY_CANCEL)); + if (btsm->SendMessage(&request, &reply) == B_OK) { + if (reply.FindInt8("status", &bt_status ) == B_OK ) { + return bt_status; + } + } - if (btsm->SendMessage(&request, listener) == B_OK) { - if (reply.FindInt8("status", &bt_status ) == B_OK ) { - return bt_status; - } - } - - return B_ERROR; + return B_ERROR; } void From bonefish at mail.berlios.de Sun Jun 15 18:13:35 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sun, 15 Jun 2008 18:13:35 +0200 Subject: [Haiku-commits] r25964 - haiku/trunk/src/apps/terminal Message-ID: <200806151613.m5FGDZ3w024308@sheep.berlios.de> Author: bonefish Date: 2008-06-15 18:13:33 +0200 (Sun, 15 Jun 2008) New Revision: 25964 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25964&view=rev Modified: haiku/trunk/src/apps/terminal/TerminalBuffer.cpp haiku/trunk/src/apps/terminal/TerminalBuffer.h Log: Allow unsetting the listener. With multiple tabs there's only one terminal view that is attached to the window and can receive messages at all. Modified: haiku/trunk/src/apps/terminal/TerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TerminalBuffer.cpp 2008-06-15 14:40:03 UTC (rev 25963) +++ haiku/trunk/src/apps/terminal/TerminalBuffer.cpp 2008-06-15 16:13:33 UTC (rev 25964) @@ -17,7 +17,8 @@ TerminalBuffer::TerminalBuffer() : BLocker("terminal buffer"), - fEncoding(M_UTF8) + fEncoding(M_UTF8), + fListenerValid(false) { } @@ -41,9 +42,17 @@ TerminalBuffer::SetListener(BMessenger listener) { fListener = listener; + fListenerValid = true; } +void +TerminalBuffer::UnsetListener() +{ + fListenerValid = false; +} + + int TerminalBuffer::Encoding() const { @@ -61,23 +70,28 @@ void TerminalBuffer::SetTitle(const char* title) { - BMessage message(MSG_SET_TERMNAL_TITLE); - message.AddString("title", title); - fListener.SendMessage(&message); + if (fListenerValid) { + BMessage message(MSG_SET_TERMNAL_TITLE); + message.AddString("title", title); + fListener.SendMessage(&message); + } } void TerminalBuffer::NotifyQuit(int32 reason) { - BMessage message(MSG_QUIT_TERMNAL); - message.AddInt32("reason", reason); - fListener.SendMessage(&message); + if (fListenerValid) { + BMessage message(MSG_QUIT_TERMNAL); + message.AddInt32("reason", reason); + fListener.SendMessage(&message); + } } void TerminalBuffer::NotifyListener() { - fListener.SendMessage(MSG_TERMINAL_BUFFER_CHANGED); + if (fListenerValid) + fListener.SendMessage(MSG_TERMINAL_BUFFER_CHANGED); } Modified: haiku/trunk/src/apps/terminal/TerminalBuffer.h =================================================================== --- haiku/trunk/src/apps/terminal/TerminalBuffer.h 2008-06-15 14:40:03 UTC (rev 25963) +++ haiku/trunk/src/apps/terminal/TerminalBuffer.h 2008-06-15 16:13:33 UTC (rev 25964) @@ -20,6 +20,7 @@ int32 historySize); void SetListener(BMessenger listener); + void UnsetListener(); int Encoding() const; void SetEncoding(int encoding); @@ -35,6 +36,7 @@ // listener/dirty region management BMessenger fListener; + bool fListenerValid; }; From bonefish at mail.berlios.de Sun Jun 15 18:17:34 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sun, 15 Jun 2008 18:17:34 +0200 Subject: [Haiku-commits] r25965 - haiku/trunk/src/apps/terminal Message-ID: <200806151617.m5FGHYpi024792@sheep.berlios.de> Author: bonefish Date: 2008-06-15 18:17:32 +0200 (Sun, 15 Jun 2008) New Revision: 25965 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25965&view=rev Modified: haiku/trunk/src/apps/terminal/TermView.cpp Log: Unset the text buffer listener when being detached from the window, and synchronize with the text buffer when being re-attached. Fixes the problem that after switching to another tab and back ongoing output wouldn't show anymore. Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-15 16:13:33 UTC (rev 25964) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-15 16:17:32 UTC (rev 25965) @@ -956,11 +956,16 @@ } BMessenger thisMessenger(this); - fTextBuffer->SetListener(thisMessenger); BMessage message(kUpdateSigWinch); fWinchRunner = new (std::nothrow) BMessageRunner(thisMessenger, &message, 500000); + + { + BAutolock _(fTextBuffer); + fTextBuffer->SetListener(thisMessenger); + _SynchronizeWithTextBuffer(0, -1); + } } @@ -972,6 +977,11 @@ delete fCursorBlinkRunner; fCursorBlinkRunner = NULL; + + { + BAutolock _(fTextBuffer); + fTextBuffer->UnsetListener(); + } } From julun at mail.berlios.de Sun Jun 15 19:37:58 2008 From: julun at mail.berlios.de (julun at mail.berlios.de) Date: Sun, 15 Jun 2008 19:37:58 +0200 Subject: [Haiku-commits] r25966 - haiku/trunk/src/kits/interface Message-ID: <200806151737.m5FHbwxh019085@sheep.berlios.de> Author: julun Date: 2008-06-15 19:37:07 +0200 (Sun, 15 Jun 2008) New Revision: 25966 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25966&view=rev Modified: haiku/trunk/src/kits/interface/PrintJob.cpp Log: * update year in copyright * added a bit more (visual) information about the spool file format * rename Configuration to PrintServerMessenger (still not the best name) * remove ConfigPage{Job}Thread as both share the same code and make it privte in PrintServerMessenger Modified: haiku/trunk/src/kits/interface/PrintJob.cpp =================================================================== --- haiku/trunk/src/kits/interface/PrintJob.cpp 2008-06-15 16:17:32 UTC (rev 25965) +++ haiku/trunk/src/kits/interface/PrintJob.cpp 2008-06-15 17:37:07 UTC (rev 25966) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006, Haiku. + * Copyright 2001-2008, Haiku. * Distributed under the terms of the MIT license. * * Authors: @@ -9,8 +9,6 @@ * julun */ -// TODO refactor (avoid code duplications, decrease method sizes) - #include #include #include @@ -36,27 +34,39 @@ #include -static const int kSemTimeOut = 50000; -static const char *kPrintServerNotRespondingText = "Print Server is not responding."; -static const char *kNoPagesToPrintText = "No Pages to print!"; +/* ! + * + * Summery of R5 spool file: + * + * |-------------------------| + * | print_file_header | + * |-------------------------| + * | BMessage | + * |-------------------------| + * | _page_header_ | + * | BPoint | + * | BRect | + * | BPicture | + * |-------------------------| + * | _page_header_ | + * | BPoint | + * | BRect | + * | BPicture | + * |-------------------------| + * | _page_header_ | + * |-------------------------| + * + * BeOS R5 print_file_header.version is 1 << 16 + * BeOS R5 print_file_header.first_page is -1 + * + * remaining pages start at _page_header_.next_page of previous _page_header_ + * + * See also: "How to Write a BeOS R5 Printer Driver" for description of spool + * file format: http://haiku-os.org/documents/dev/how_to_write_a_printer_driver + * + */ -// Summery of spool file format: -// See articel "How to Write a BeOS R5 Printer Driver" for description -// of spool file format: -// http://haiku-os.org/documents/dev/how_to_write_a_printer_driver - -// print_file_header header -// On BeOS R5 header.version is 1 << 16 and -// header.first_page is -1. -// BMessage job_settings -// _page_header_ page_header -// followed by number_of_pictures: -// BPoint where -// BRect bounds -// BPicture picture -// remaining pages start at page_header.next_page of previous page_header - struct _page_header_ { int32 number_of_pictures; off_t next_page; @@ -64,14 +74,6 @@ }; -static status_t -GetPrinterServerMessenger(BMessenger& messenger) -{ - messenger = BMessenger(PSRV_SIGNATURE_TYPE); - return messenger.IsValid() ? B_OK : B_ERROR; -} - - static void ShowError(const char *message) { @@ -80,157 +82,47 @@ } -namespace BPrivate { +// #pragma mark -- PrintServerMessenger - class Configuration { - public: - Configuration(uint32 what, BMessage *input); - ~Configuration(); - status_t SendRequest(thread_func function); +namespace BPrivate { - BMessage* Request(); - void SetResult(BMessage* result); - BMessage* Result() const { return fResult; } + class PrintServerMessenger { + public: + PrintServerMessenger(uint32 what, BMessage *input); + ~PrintServerMessenger(); - private: - void RejectUserInput(); - void AllowUserInput(); - void DeleteSemaphore(); + BMessage* Request(); + status_t SendRequest(); - uint32 fWhat; - BMessage *fInput; - BMessage *fRequest; - BMessage *fResult; - sem_id fThreadCompleted; - BAlert *fHiddenApplicationModalWindow; - }; + void SetResult(BMessage* result); + BMessage* Result() const { return fResult; } + static status_t GetPrintServerMessenger(BMessenger& msngr); - Configuration::Configuration(uint32 what, BMessage *input) - : fWhat(what), - fInput(input), - fRequest(NULL), - fResult(NULL), - fThreadCompleted(-1), - fHiddenApplicationModalWindow(NULL) - { - RejectUserInput(); - } + private: + void RejectUserInput(); + void AllowUserInput(); + void DeleteSemaphore(); + static status_t MessengerThread(void *data); + uint32 fWhat; + BMessage* fInput; + BMessage* fRequest; + BMessage* fResult; + sem_id fThreadCompleted; + BAlert* fHiddenApplicationModalWindow; + }; - Configuration::~Configuration() - { - DeleteSemaphore(); - // in case SendRequest could not start the thread - delete fRequest; fRequest = NULL; - AllowUserInput(); - } +} // namespace BPrivate +using namespace BPrivate; - void - Configuration::RejectUserInput() - { - BAlert* alert = new BAlert("bogus", "app_modal_dialog", "OK"); - fHiddenApplicationModalWindow = alert; - alert->DefaultButton()->SetEnabled(false); - alert->SetDefaultButton(NULL); - alert->MoveTo(-65000, -65000); - alert->Go(NULL); - } +// #pragma mark -- BPrintJob - void - Configuration::AllowUserInput() - { - fHiddenApplicationModalWindow->Lock(); - fHiddenApplicationModalWindow->Quit(); - } - - void - Configuration::DeleteSemaphore() - { - if (fThreadCompleted >= B_OK) { - sem_id id = fThreadCompleted; - fThreadCompleted = -1; - delete_sem(id); - } - } - - - status_t - Configuration::SendRequest(thread_func function) - { - fThreadCompleted = create_sem(0, "Configuration"); - if (fThreadCompleted < B_OK) - return B_ERROR; - - thread_id id = spawn_thread(function, "async_request", B_NORMAL_PRIORITY, this); - if (id <= 0 || resume_thread(id) != B_OK) - return B_ERROR; - - // Code copied from BAlert::Go() - BWindow* window = dynamic_cast(BLooper::LooperForThread(find_thread(NULL))); - // Get the originating window, if it exists - - // Heavily modified from TextEntryAlert code; the original didn't let the - // blocked window ever draw. - if (window != NULL) { - status_t err; - for (;;) { - do { - err = acquire_sem_etc(fThreadCompleted, 1, B_RELATIVE_TIMEOUT, - kSemTimeOut); - // We've (probably) had our time slice taken away from us - } while (err == B_INTERRUPTED); - - if (err == B_BAD_SEM_ID) { - // Semaphore was finally nuked in SetResult(BMessage *) - break; - } - window->UpdateIfNeeded(); - } - } else { - // No window to update, so just hang out until we're done. - while (acquire_sem(fThreadCompleted) == B_INTERRUPTED); - } - - status_t status; - wait_for_thread(id, &status); - - return Result() != NULL ? B_OK : B_ERROR; - } - - - BMessage * - Configuration::Request() - { - if (fRequest != NULL) - return fRequest; - - if (fInput != NULL) { - fRequest = new BMessage(*fInput); - fRequest->what = fWhat; - } else - fRequest = new BMessage(fWhat); - - return fRequest; - } - - - void - Configuration::SetResult(BMessage *result) - { - fResult = result; - DeleteSemaphore(); - // terminate loop in thread spawned by SendRequest - } - -} // BPrivate - - BPrintJob::BPrintJob(const char *job_name) : fPrintJobName(NULL), fSpoolFile(NULL), @@ -261,93 +153,32 @@ } -static status_t -ConfigPageThread(void *data) -{ - BPrivate::Configuration* configuration = static_cast(data); - - BMessenger printServer; - if (GetPrinterServerMessenger(printServer) != B_OK) { - ShowError(kPrintServerNotRespondingText); - configuration->SetResult(NULL); - return B_ERROR; - } - - BMessage *request = configuration->Request(); - if (request == NULL) { - configuration->SetResult(NULL); - return B_ERROR; - } - - - BMessage reply; - if (printServer.SendMessage(request, &reply) != B_OK - || reply.what != 'okok') { - configuration->SetResult(NULL); - return B_ERROR; - } - - configuration->SetResult(new BMessage(reply)); - return B_OK; -} - - status_t BPrintJob::ConfigPage() { - BPrivate::Configuration configuration(PSRV_SHOW_PAGE_SETUP, fSetupMessage); - status_t status = configuration.SendRequest(ConfigPageThread); + PrintServerMessenger messenger(PSRV_SHOW_PAGE_SETUP, fSetupMessage); + status_t status = messenger.SendRequest(); if (status != B_OK) return status; delete fSetupMessage; - fSetupMessage = configuration.Result(); + fSetupMessage = messenger.Result(); _HandlePageSetup(fSetupMessage); return B_OK; } -static status_t -ConfigJobThread(void *data) -{ - BPrivate::Configuration* configuration = static_cast(data); - - BMessenger printServer; - if (GetPrinterServerMessenger(printServer) != B_OK) { - ShowError(kPrintServerNotRespondingText); - configuration->SetResult(NULL); - return B_ERROR; - } - - BMessage *request = configuration->Request(); - if (request == NULL) { - configuration->SetResult(NULL); - return B_ERROR; - } - - - BMessage reply; - if (printServer.SendMessage(request, &reply) != B_OK - || reply.what != 'okok') { - configuration->SetResult(NULL); - return B_ERROR; - } - - configuration->SetResult(new BMessage(reply)); - return B_OK; -} - status_t BPrintJob::ConfigJob() { - BPrivate::Configuration configuration(PSRV_SHOW_PRINT_SETUP, fSetupMessage); - status_t status = configuration.SendRequest(ConfigJobThread); + PrintServerMessenger messenger(PSRV_SHOW_PRINT_SETUP, fSetupMessage); + status_t status = messenger.SendRequest(); if (status != B_OK) return status; delete fSetupMessage; - fSetupMessage = configuration.Result(); + fSetupMessage = messenger.Result(); _HandlePrintSetup(fSetupMessage); return B_OK; @@ -427,7 +258,7 @@ return; if (fSpoolFileHeader.page_count == 0) { - ShowError(kNoPagesToPrintText); + ShowError("No Pages to print!"); CancelJob(); return; } @@ -465,7 +296,7 @@ // notify print server BMessenger printServer; - if (GetPrinterServerMessenger(printServer) != B_OK) + if (PrintServerMessenger::GetPrintServerMessenger(printServer) != B_OK) return; BMessage request(PSRV_PRINT_SPOOLED_JOB); @@ -631,12 +462,11 @@ BPrintJob::PrinterType(void *) const { BMessenger printServer; - if (GetPrinterServerMessenger(printServer) != B_OK) + if (PrintServerMessenger::GetPrintServerMessenger(printServer) != B_OK) return B_COLOR_PRINTER; // default - BMessage message(PSRV_GET_ACTIVE_PRINTER); BMessage reply; - + BMessage message(PSRV_GET_ACTIVE_PRINTER); printServer.SendMessage(&message, &reply); int32 type; @@ -672,7 +502,7 @@ view->FillRect(rect); view->SetHighColor(highColor); } - + view->Draw(rect); view->PopState(); view->fIsPrinting = false; @@ -791,22 +621,23 @@ picture.Flatten(fSpoolFile); } - -// Returns a copy of the current printer name -// or NULL if it could not be obtained. -// Caller is responsible to free the string using free(). +/* ! + * + * Returns a copy of the applications default printer name or NULL if it + * could not be obtained. Caller is responsible to free the string using free(). + * + */ char * BPrintJob::_GetCurrentPrinterName() const { BMessenger printServer; - if (GetPrinterServerMessenger(printServer)) + if (PrintServerMessenger::GetPrintServerMessenger(printServer) != B_OK) return NULL; - BMessage message(PSRV_GET_ACTIVE_PRINTER); - BMessage reply; - const char *printerName = NULL; + BMessage reply; + BMessage message(PSRV_GET_ACTIVE_PRINTER); if (printServer.SendMessage(&message, &reply) == B_OK) reply.FindString("printer_name", &printerName); @@ -821,7 +652,7 @@ BPrintJob::_LoadDefaultSettings() { BMessenger printServer; - if (GetPrinterServerMessenger(printServer) != B_OK) + if (PrintServerMessenger::GetPrintServerMessenger(printServer) != B_OK) return; BMessage message(PSRV_GET_DEFAULT_SETTINGS); @@ -842,3 +673,167 @@ void BPrintJob::_ReservedPrintJob2() {} void BPrintJob::_ReservedPrintJob3() {} void BPrintJob::_ReservedPrintJob4() {} + + +// #pragma mark -- PrintServerMessenger + + +namespace BPrivate { + + + PrintServerMessenger::PrintServerMessenger(uint32 what, BMessage *input) + : fWhat(what), + fInput(input), + fRequest(NULL), + fResult(NULL), + fThreadCompleted(-1), + fHiddenApplicationModalWindow(NULL) + { + RejectUserInput(); + } + + + PrintServerMessenger::~PrintServerMessenger() + { + DeleteSemaphore(); + // in case SendRequest could not start the thread + delete fRequest; fRequest = NULL; + AllowUserInput(); + } + + + void + PrintServerMessenger::RejectUserInput() + { + fHiddenApplicationModalWindow = new BAlert("bogus", "app_modal", "OK"); + fHiddenApplicationModalWindow->DefaultButton()->SetEnabled(false); + fHiddenApplicationModalWindow->SetDefaultButton(NULL); + fHiddenApplicationModalWindow->MoveTo(-65000, -65000); + fHiddenApplicationModalWindow->Go(NULL); + } + + + void + PrintServerMessenger::AllowUserInput() + { + fHiddenApplicationModalWindow->Lock(); + fHiddenApplicationModalWindow->Quit(); + } + + + void + PrintServerMessenger::DeleteSemaphore() + { + if (fThreadCompleted >= B_OK) { + sem_id id = fThreadCompleted; + fThreadCompleted = -1; + delete_sem(id); + } + } + + + status_t + PrintServerMessenger::SendRequest() + { + fThreadCompleted = create_sem(0, "print_server_messenger_sem"); + if (fThreadCompleted < B_OK) + return B_ERROR; + + thread_id id = spawn_thread(MessengerThread, "async_request", + B_NORMAL_PRIORITY, this); + if (id <= 0 || resume_thread(id) != B_OK) + return B_ERROR; + + // Get the originating window, if it exists + BWindow* window = dynamic_cast(BLooper::LooperForThread(find_thread(NULL))); + if (window) { + status_t err; + while (true) { + do { + err = acquire_sem_etc(fThreadCompleted, 1, B_RELATIVE_TIMEOUT, + 50000); + // We've (probably) had our time slice taken away from us + } while (err == B_INTERRUPTED); + + // Semaphore was finally nuked in SetResult(BMessage *) + if (err == B_BAD_SEM_ID) + break; + window->UpdateIfNeeded(); + } + } else { + // No window to update, so just hang out until we're done. + while (acquire_sem(fThreadCompleted) == B_INTERRUPTED); + } + + status_t status; + wait_for_thread(id, &status); + + return Result() != NULL ? B_OK : B_ERROR; + } + + + BMessage * + PrintServerMessenger::Request() + { + if (fRequest != NULL) + return fRequest; + + if (fInput != NULL) { + fRequest = new BMessage(*fInput); + fRequest->what = fWhat; + } else + fRequest = new BMessage(fWhat); + + return fRequest; + } + + + void + PrintServerMessenger::SetResult(BMessage *result) + { + fResult = result; + DeleteSemaphore(); + // terminate loop in thread spawned by SendRequest + } + + + status_t + PrintServerMessenger::GetPrintServerMessenger(BMessenger& messenger) + { + messenger = BMessenger(PSRV_SIGNATURE_TYPE); + return messenger.IsValid() ? B_OK : B_ERROR; + } + + + status_t + PrintServerMessenger::MessengerThread(void *data) + { + PrintServerMessenger* messenger = static_cast(data); + + BMessenger printServer; + if (messenger->GetPrintServerMessenger(printServer) != B_OK) { + ShowError("Print Server is not responding."); + messenger->SetResult(NULL); + return B_ERROR; + } + + BMessage *request = messenger->Request(); + if (request == NULL) { + messenger->SetResult(NULL); + return B_ERROR; + } + + + BMessage reply; + if (printServer.SendMessage(request, &reply) != B_OK + || reply.what != 'okok') { + messenger->SetResult(NULL); + return B_ERROR; + } + + messenger->SetResult(new BMessage(reply)); + return B_OK; + } + + +} // namespace BPrivate From emitrax at gmail.com Sun Jun 15 21:13:19 2008 From: emitrax at gmail.com (Salvatore Benedetto) Date: Sun, 15 Jun 2008 19:13:19 +0000 Subject: [Haiku-commits] r25965 - haiku/trunk/src/apps/terminal In-Reply-To: <200806151617.m5FGHYpi024792@sheep.berlios.de> References: <200806151617.m5FGHYpi024792@sheep.berlios.de> Message-ID: 2008/6/15 : > Author: bonefish > Date: 2008-06-15 18:17:32 +0200 (Sun, 15 Jun 2008) > New Revision: 25965 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25965&view=rev > > Modified: > haiku/trunk/src/apps/terminal/TermView.cpp > Log: > Unset the text buffer listener when being detached from the window, and > synchronize with the text buffer when being re-attached. Fixes the > problem that after switching to another tab and back ongoing output > wouldn't show anymore. I confirm it works. Thanks! Regards, -- Salvatore Benedetto (a.k.a. emitrax) Student of Computer Engineer University of Pisa www.haiku-os.it From mauricek at mail.berlios.de Sun Jun 15 21:21:06 2008 From: mauricek at mail.berlios.de (mauricek at mail.berlios.de) Date: Sun, 15 Jun 2008 21:21:06 +0200 Subject: [Haiku-commits] r25967 - haiku/trunk/headers/os/support Message-ID: <200806151921.m5FJL6Ak027609@sheep.berlios.de> Author: mauricek Date: 2008-06-15 21:21:00 +0200 (Sun, 15 Jun 2008) New Revision: 25967 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25967&view=rev Modified: haiku/trunk/headers/os/support/Debug.h Log: fix gcc4 warning about wrong argument type. Modified: haiku/trunk/headers/os/support/Debug.h =================================================================== --- haiku/trunk/headers/os/support/Debug.h 2008-06-15 17:37:07 UTC (rev 25966) +++ haiku/trunk/headers/os/support/Debug.h 2008-06-15 19:21:00 UTC (rev 25967) @@ -47,10 +47,10 @@ PRINT(("%s\t", #OBJ)); \ (OBJ).PrintToStream(); \ } ((void)0) - #define TRACE() _debugPrintf("File: %s, Line: %d, Thread: %d\n", \ + #define TRACE() _debugPrintf("File: %s, Line: %d, Thread: %ld\n", \ __FILE__, __LINE__, find_thread(NULL)) - #define SERIAL_TRACE() _sPrintf("File: %s, Line: %d, Thread: %d\n", \ + #define SERIAL_TRACE() _sPrintf("File: %s, Line: %d, Thread: %ld\n", \ __FILE__, __LINE__, find_thread(NULL)) #define DEBUGGER(MSG) if (_rtDebugFlag) debugger(MSG) From axeld at pinc-software.de Sun Jun 15 23:25:18 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sun, 15 Jun 2008 23:25:18 +0200 CEST Subject: [Haiku-commits] r25952 - haiku/trunk/src/servers/app In-Reply-To: <200806131348.m5DDmYZN028039@sheep.berlios.de> Message-ID: <12700907116-BeMail@zon> mmlr at BerliOS wrote: > This should reduce the waste of cycles for just drawing the default > decorator > buttons quite a bit. Nice one! > Probably the whole tab should be pre-rendered though to > also safe the text rendering of the title. Not really; that would be really overkill IMO - text rendering isn't that expensive anyway, the whole interface is using it, and the window tabs aren't really performance critical either. Bye, Axel. From axeld at pinc-software.de Sun Jun 15 23:27:41 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sun, 15 Jun 2008 23:27:41 +0200 CEST Subject: [Haiku-commits] r25948 - haiku/trunk/src/kits/interface In-Reply-To: <20080613225122.463.2@knochen-vm.1213389699.fake> Message-ID: <12843028628-BeMail@zon> Ingo Weinhold wrote: > This sounds all pretty broken, IMHO. The Tracker method for one, but > also > BMenu. The preferred size should certainly neither depend on the > resizing > mode, nor on the current view or window frame. It is a work-around for the IMO indeed broken BMenu layout code in BeOS - it might also be needed on Haiku, but I'm not sure. Changing the resize mode (not a particular resize mode) would trigger the layout to be computed, and that's all this method needed. Bye, Axel. From bonefish at mail.berlios.de Sun Jun 15 23:52:52 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sun, 15 Jun 2008 23:52:52 +0200 Subject: [Haiku-commits] r25968 - haiku/trunk/src/apps/terminal Message-ID: <200806152152.m5FLqqDn006127@sheep.berlios.de> Author: bonefish Date: 2008-06-15 23:52:51 +0200 (Sun, 15 Jun 2008) New Revision: 25968 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25968&view=rev Modified: haiku/trunk/src/apps/terminal/HistoryBuffer.cpp Log: If it extended to the end of the line the length of the last attributes run of a history line would not be initialized correctly. Modified: haiku/trunk/src/apps/terminal/HistoryBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/HistoryBuffer.cpp 2008-06-15 19:21:00 UTC (rev 25967) +++ haiku/trunk/src/apps/terminal/HistoryBuffer.cpp 2008-06-15 21:52:51 UTC (rev 25968) @@ -90,7 +90,8 @@ if (charCount == nextAttributesAt) { if (attributesRunCount > 0) { attributes = attributesRun->attributes; - nextAttributesAt = attributesRun->offset + attributesRun->length; + nextAttributesAt = attributesRun->offset + + attributesRun->length; attributesRun++; attributesRunCount--; } else { @@ -180,6 +181,10 @@ i++; } + // set the last attributes run's length + if (attributes != 0) + attributesRun->length = line->length - attributesRun->offset; + historyLine->softBreak = line->softBreak; //debug_printf(" line: \"%.*s\", history size now: %ld\n", historyLine->byteLength, historyLine->Chars(), fSize); } From alex at zappotek.com Mon Jun 16 00:09:46 2008 From: alex at zappotek.com (Alexandre Deckner) Date: Mon, 16 Jun 2008 00:09:46 +0200 Subject: [Haiku-commits] r25948 - haiku/trunk/src/kits/interface In-Reply-To: <12843028628-BeMail@zon> References: <12843028628-BeMail@zon> Message-ID: <4855932A.8090102@zappotek.com> Axel D?rfler wrote: > It is a work-around for the IMO indeed broken BMenu layout code in BeOS > - it might also be needed on Haiku, but I'm not sure. Changing the > resize mode (not a particular resize mode) would trigger the layout to > be computed, and that's all this method needed. > > > Yep, after looking at the bebook and the sources, the resizeToFit in BMenuBar option needs this. It it set to true by default. I wonder if it could be implemented differently since it is basically the same as setting the right width and height on creation and the B_FOLLOW_LEFT_RIGHT resize flag, isn't it? Anyway, i won't play with functional changes like this :-) I think we can live with this for R1 anyway. Regards, Alex From bonefish at mail.berlios.de Mon Jun 16 03:30:18 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Mon, 16 Jun 2008 03:30:18 +0200 Subject: [Haiku-commits] r25969 - haiku/trunk/src/apps/terminal Message-ID: <200806160130.m5G1UIMq010084@sheep.berlios.de> Author: bonefish Date: 2008-06-16 03:30:10 +0200 (Mon, 16 Jun 2008) New Revision: 25969 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25969&view=rev Modified: haiku/trunk/src/apps/terminal/SmartTabView.cpp haiku/trunk/src/apps/terminal/SmartTabView.h haiku/trunk/src/apps/terminal/TermScrollView.cpp haiku/trunk/src/apps/terminal/TermView.cpp haiku/trunk/src/apps/terminal/TermWindow.cpp Log: Fixed various layout/size related issues (mostly off-by-one bugs). The terminal opens with the correct size, now. Modified: haiku/trunk/src/apps/terminal/SmartTabView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/SmartTabView.cpp 2008-06-15 21:52:51 UTC (rev 25968) +++ haiku/trunk/src/apps/terminal/SmartTabView.cpp 2008-06-16 01:30:10 UTC (rev 25969) @@ -21,11 +21,15 @@ SmartTabView::SmartTabView(BRect frame, const char *name, button_width width, uint32 resizingMode, uint32 flags) : - BTabView(frame, name, width, resizingMode, flags) + BTabView(frame, name, width, resizingMode, flags), + fInsets(0, 0, 0, 0) { - // See BTabView::_InitObject() to see why we are doing this - ContainerView()->MoveBy(-3, -TabHeight() - 3); - ContainerView()->ResizeBy(10, TabHeight() + 9); + // Resize the container view to fill the complete tab view for single-tab + // mode. Later, when more than one tab is added, we shrink the container + // view again. + frame.OffsetTo(B_ORIGIN); + ContainerView()->MoveTo(frame.LeftTop()); + ContainerView()->ResizeTo(frame.Width(), frame.Height()); } @@ -35,6 +39,16 @@ void +SmartTabView::SetInsets(float left, float top, float right, float bottom) +{ + fInsets.left = left; + fInsets.top = top; + fInsets.right = right; + fInsets.bottom = bottom; +} + + +void SmartTabView::MouseDown(BPoint point) { bool handled = false; @@ -106,8 +120,10 @@ BTabView::Select(index); BView *view = ViewForTab(index); if (view != NULL) { - view->ResizeTo(ContainerView()->Bounds().Width(), - ContainerView()->Bounds().Height()); + view->MoveTo(fInsets.LeftTop()); + view->ResizeTo(ContainerView()->Bounds().Width() + - fInsets.left - fInsets.right, + ContainerView()->Bounds().Height() - fInsets.top - fInsets.bottom); } } Modified: haiku/trunk/src/apps/terminal/SmartTabView.h =================================================================== --- haiku/trunk/src/apps/terminal/SmartTabView.h 2008-06-15 21:52:51 UTC (rev 25968) +++ haiku/trunk/src/apps/terminal/SmartTabView.h 2008-06-16 01:30:10 UTC (rev 25969) @@ -21,6 +21,8 @@ B_FRAME_EVENTS | B_NAVIGABLE); virtual ~SmartTabView(); + void SetInsets(float left, float top, float right, float bottom); + virtual void MouseDown(BPoint where); virtual void AttachedToWindow(); @@ -39,6 +41,9 @@ private: int32 _ClickedTabIndex(const BPoint &point); + +private: + BRect fInsets; }; #endif // __SMARTTABVIEW_H Modified: haiku/trunk/src/apps/terminal/TermScrollView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermScrollView.cpp 2008-06-15 21:52:51 UTC (rev 25968) +++ haiku/trunk/src/apps/terminal/TermScrollView.cpp 2008-06-16 01:30:10 UTC (rev 25969) @@ -32,13 +32,18 @@ TermScrollView::TermScrollView(const char* name, BView* child, BView* target, uint32 resizingMode) : - BScrollView(name, child, resizingMode, 0, false, true) + BScrollView(name, child, resizingMode, 0, false, true, B_NO_BORDER) { // replace the vertical scroll bar with our own if (fVerticalScrollBar != NULL) { BRect frame(fVerticalScrollBar->Frame()); RemoveChild(fVerticalScrollBar); + // Overlap one pixel at the top and the bottom of the scroll bar with + // the menu respectively resize knob for aesthetical reasons. + frame.top -= 1; + frame.bottom += 1; + TermScrollBar* scrollBar = new TermScrollBar(frame, "_VSB_", target, 0, 1000, B_VERTICAL); AddChild(scrollBar); Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-15 21:52:51 UTC (rev 25968) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-16 01:30:10 UTC (rev 25969) @@ -456,9 +456,9 @@ TermView::GetPreferredSize(float *width, float *height) { if (width) - *width = fTermColumns * fFontWidth; + *width = fTermColumns * fFontWidth - 1; if (height) - *height = fTermRows * fFontHeight; + *height = fTermRows * fFontHeight - 1; } Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.cpp 2008-06-15 21:52:51 UTC (rev 25968) +++ haiku/trunk/src/apps/terminal/TermWindow.cpp 2008-06-16 01:30:10 UTC (rev 25969) @@ -179,6 +179,10 @@ fTabView = new TabView(this, textFrame, "tab view"); AddChild(fTabView); + + // Make the scroll view one pixel wider than the tab view container view, so + // the scroll bar will look good. + fTabView->SetInsets(0, 0, -1, 0); } @@ -670,10 +674,6 @@ tab->SetLabel(session->name.String()); view->SetScrollBar(scrollView->ScrollBar(B_VERTICAL)); - // Resize the vertical scrollbar to take the window gripping handle into account - // TODO: shouldn't this be done in BScrollView itself ? At least BScrollBar does that. - scrollView->ScrollBar(B_VERTICAL)->ResizeBy(0, -13); - view->SetEncoding(EncodingID(PrefHandler::Default()->getString(PREF_TEXT_ENCODING))); BFont font; @@ -685,14 +685,14 @@ int width, height; view->GetFontSize(&width, &height); - float minimumHeight = 0; + float minimumHeight = -1; if (fMenubar) - minimumHeight += fMenubar->Bounds().Height(); + minimumHeight += fMenubar->Bounds().Height() + 1; if (fTabView && fTabView->CountTabs() > 1) - minimumHeight += fTabView->TabHeight(); - SetSizeLimits(MIN_COLS * width, MAX_COLS * width, - minimumHeight + MIN_ROWS * height, - minimumHeight + MAX_ROWS * height); + minimumHeight += fTabView->TabHeight() + 1; + SetSizeLimits(MIN_COLS * width - 1, MAX_COLS * width - 1, + minimumHeight + MIN_ROWS * height - 1, + minimumHeight + MAX_ROWS * height - 1); // If it's the first time we're called, setup the window if (fTabView->CountTabs() == 1) { @@ -701,7 +701,9 @@ // Resize Window ResizeTo(viewWidth + B_V_SCROLL_BAR_WIDTH, - viewHeight + fMenubar->Bounds().Height()); + viewHeight + fMenubar->Bounds().Height() + 1); + // NOTE: Width is one pixel too small, since the scroll view + // is one pixel wider than its parent. } // TODO: No fTabView->Select(tab); ? fTabView->Select(fTabView->CountTabs() - 1); @@ -789,24 +791,26 @@ { int fontWidth, fontHeight; view->GetFontSize(&fontWidth, &fontHeight); - - float minimumHeight = 0; + + float minimumHeight = -1; if (fMenubar) - minimumHeight += fMenubar->Bounds().Height(); + minimumHeight += fMenubar->Bounds().Height() + 1; if (fTabView && fTabView->CountTabs() > 1) - minimumHeight += fTabView->TabHeight(); + minimumHeight += fTabView->TabHeight() + 1; + + SetSizeLimits(MIN_COLS * fontWidth - 1, MAX_COLS * fontWidth - 1, + minimumHeight + MIN_ROWS * fontHeight - 1, + minimumHeight + MAX_ROWS * fontHeight - 1); - SetSizeLimits(MIN_COLS * fontWidth, MAX_COLS * fontWidth, - minimumHeight + MIN_ROWS * fontHeight, - minimumHeight + MAX_ROWS * fontHeight); - float width, height; view->Parent()->GetPreferredSize(&width, &height); width += B_V_SCROLL_BAR_WIDTH; - height += fMenubar->Bounds().Height() + 2; + // NOTE: Width is one pixel too small, since the scroll view + // is one pixel wider than its parent. + height += fMenubar->Bounds().Height() + 1; ResizeTo(width, height); - + view->Invalidate(); } From axeld at pinc-software.de Mon Jun 16 12:54:56 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 16 Jun 2008 12:54:56 +0200 CEST Subject: [Haiku-commits] r25930 - haiku/trunk/src/kits/interface In-Reply-To: <48503D0D.3080201@zappotek.com> Message-ID: <10033824284-BeMail@zon> Alexandre Deckner wrote: > Do you have an idea why MouseMoved gives a non integral value, is > it > expected? Sure, why not? Bye, Axel. From revol at free.fr Mon Jun 16 13:46:38 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Mon, 16 Jun 2008 13:46:38 +0200 CEST Subject: [Haiku-commits] r25952 - haiku/trunk/src/servers/app In-Reply-To: <12700907116-BeMail@zon> Message-ID: <1759336826-BeMail@laptop> > > Probably the whole tab should be pre-rendered though to > > also safe the text rendering of the title. > > Not really; that would be really overkill IMO - text rendering isn't > that expensive anyway, the whole interface is using it, and the > window > tabs aren't really performance critical either. Except maybe for http://www.bebits.com/app/3410 (which I haven't test in Haiku yet I think) Fran?ois. From axeld at pinc-software.de Mon Jun 16 14:14:30 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 16 Jun 2008 14:14:30 +0200 CEST Subject: [Haiku-commits] r25952 - haiku/trunk/src/servers/app In-Reply-To: <1759336826-BeMail@laptop> Message-ID: <14807275995-BeMail@zon> "Fran?ois Revol" wrote: > > > Probably the whole tab should be pre-rendered though to > > > also safe the text rendering of the title. > > Not really; that would be really overkill IMO - text rendering > > isn't > > that expensive anyway, the whole interface is using it, and the > > window > > tabs aren't really performance critical either. > Except maybe for > http://www.bebits.com/app/3410 > (which I haven't test in Haiku yet I think) But caching wouldn't help with this either. Bye, Axel. From revol at free.fr Mon Jun 16 14:21:38 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Mon, 16 Jun 2008 14:21:38 +0200 CEST Subject: [Haiku-commits] r25952 - haiku/trunk/src/servers/app In-Reply-To: <14807275995-BeMail@zon> Message-ID: <3859731716-BeMail@laptop> > "Fran?ois Revol" wrote: > > > > Probably the whole tab should be pre-rendered though to > > > > also safe the text rendering of the title. > > > Not really; that would be really overkill IMO - text rendering > > > isn't > > > that expensive anyway, the whole interface is using it, and the > > > window > > > tabs aren't really performance critical either. > > Except maybe for > > http://www.bebits.com/app/3410 > > (which I haven't test in Haiku yet I think) > > But caching wouldn't help with this either. Indeed. OTH it'll be a nice bench :D Fran?ois. From aldeck at mail.berlios.de Mon Jun 16 15:15:13 2008 From: aldeck at mail.berlios.de (aldeck at mail.berlios.de) Date: Mon, 16 Jun 2008 15:15:13 +0200 Subject: [Haiku-commits] r25970 - haiku/trunk/src/apps/deskbar Message-ID: <200806161315.m5GDFDiL012976@sheep.berlios.de> Author: aldeck Date: 2008-06-16 15:14:46 +0200 (Mon, 16 Jun 2008) New Revision: 25970 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25970&view=rev Modified: haiku/trunk/src/apps/deskbar/StatusView.cpp haiku/trunk/src/apps/deskbar/TimeView.cpp haiku/trunk/src/apps/deskbar/TimeView.h Log: - Calculating the space left for deskbar replicants was broken. The TimeView could overlap on the left. This fixes #1408 - Placement of the time text was broken. With big fonts, the text was way too low. Using text bounding box now, it looks pretty and robust too. - Fixed the height of the time view to the replicant height. The view has a fixed height now and can never overlap deskbar at the bottom (horizontal deskbar mode) or other replicant below. Modified: haiku/trunk/src/apps/deskbar/StatusView.cpp =================================================================== --- haiku/trunk/src/apps/deskbar/StatusView.cpp 2008-06-16 01:30:10 UTC (rev 25969) +++ haiku/trunk/src/apps/deskbar/StatusView.cpp 2008-06-16 13:14:46 UTC (rev 25970) @@ -236,9 +236,9 @@ if (!fClock) { desk_settings *settings = ((TBarApp *)be_app)->Settings(); - fClock = new TTimeView(settings->timeShowSeconds, - settings->timeShowMil, settings->timeFullDate, - settings->timeShowEuro, false); + fClock = new TTimeView(kMinimumTrayWidth, kMaxReplicantHeight - 1.0, + settings->timeShowSeconds, settings->timeShowMil, + settings->timeFullDate, settings->timeShowEuro, false); AddChild(fClock); fClock->MoveTo(Bounds().right - fClock->Bounds().Width() - 1, 2); @@ -1276,7 +1276,7 @@ // try to find free space in every row for (int32 row = 0; ; loc.y += kMaxReplicantHeight + kIconGap, row++) { // determine free space in this row - BRect rect(loc.x, loc.y, loc.x + kMinimumTrayWidth + 2, kMaxReplicantHeight); + BRect rect(loc.x, loc.y, loc.x + kMinimumTrayWidth - kIconGap - 2.0, loc.y + kMaxReplicantHeight); if (row == 0 && fBarView->ShowingClock()) rect.right -= fClock->Frame().Width() + kIconGap; Modified: haiku/trunk/src/apps/deskbar/TimeView.cpp =================================================================== --- haiku/trunk/src/apps/deskbar/TimeView.cpp 2008-06-16 01:30:10 UTC (rev 25969) +++ haiku/trunk/src/apps/deskbar/TimeView.cpp 2008-06-16 13:14:46 UTC (rev 25970) @@ -55,22 +55,9 @@ const char *kLongEuroDateFormat = "%a, %d %B, %Y"; static const char * const kMinString = "99:99 AM"; +static const float kHMargin = 2.0; -static float -FontHeight(BView *target, bool full) -{ - font_height fontInfo; - target->GetFontHeight(&fontInfo); - float h = fontInfo.ascent + fontInfo.descent; - - if (full) - h += fontInfo.leading; - - return h; -} - - enum { kMsgShowClock, kMsgChangeClock, @@ -78,7 +65,7 @@ }; -TTimeView::TTimeView(bool showSeconds, bool milTime, bool fullDate, bool euroDate, bool) +TTimeView::TTimeView(float maxWidth, float height, bool showSeconds, bool milTime, bool fullDate, bool euroDate, bool) : BView(BRect(-100,-100,-90,-90), "_deskbar_tv_", B_FOLLOW_RIGHT | B_FOLLOW_TOP, B_WILL_DRAW | B_PULSE_NEEDED | B_FRAME_EVENTS), @@ -89,7 +76,9 @@ fFullDate(fullDate), fCanShowFullDate(false), fEuroDate(euroDate), - fOrientation(false) + fMaxWidth(maxWidth), + fHeight(height), + fOrientation(true) { fShowingDate = false; fTime = fLastTime = time(NULL); @@ -159,7 +148,6 @@ } else SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - fFontHeight = FontHeight(this, true); ResizeToPreferred(); CalculateTextPlacement(); } @@ -168,18 +156,23 @@ void TTimeView::GetPreferredSize(float *width, float *height) { - *height = fFontHeight; - + *height = fHeight; + GetCurrentTime(); GetCurrentDate(); + // TODO: SetOrientation never gets called, fix that + // When in vertical mode, we want to limit the width so that it can't + // overlap the bevels in the parent view. if (ShowingDate()) - *width = 6 + StringWidth(fDateStr); - else { - *width = 6 + StringWidth(fTimeStr); - // Changed this from 10 to 6 so even with interval + seconds, there still - // is room for two replicants in the default tray. - } + *width = fOrientation ? + min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fDateStr)) + : kHMargin + StringWidth(fDateStr); + else { + *width = fOrientation ? + min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fTimeStr)) + : kHMargin + StringWidth(fTimeStr); + } } @@ -495,15 +488,20 @@ { BRect bounds(Bounds()); - if (fOrientation) { // vertical mode - fDateLocation.x = bounds.Width()/2 - StringWidth(fDateStr)/2; - fTimeLocation.x = bounds.Width()/2 - StringWidth(fTimeStr)/2; - } else { - fTimeLocation.x = bounds.Width() - StringWidth(fTimeStr) - 5; - fDateLocation.x = bounds.Width() - StringWidth(fDateStr) - 5; - } - // center vertically - fDateLocation.y = fTimeLocation.y = bounds.Height()/2 + fFontHeight/2; + fDateLocation.x = 0.0; + fTimeLocation.x = 0.0; + + BFont font; + GetFont(&font); + const char* stringArray[1]; + stringArray[0] = fTimeStr; + BRect rectArray[1]; + escapement_delta delta = { 0.0, 0.0 }; + font.GetBoundingBoxesForStrings(stringArray, 1, B_SCREEN_METRIC, &delta, + rectArray); + + fTimeLocation.y = fDateLocation.y = ceilf((bounds.Height() - + rectArray[0].Height() + 1.0) / 2.0 - rectArray[0].top); } Modified: haiku/trunk/src/apps/deskbar/TimeView.h =================================================================== --- haiku/trunk/src/apps/deskbar/TimeView.h 2008-06-16 01:30:10 UTC (rev 25969) +++ haiku/trunk/src/apps/deskbar/TimeView.h 2008-06-16 13:14:46 UTC (rev 25970) @@ -51,7 +51,7 @@ class TTimeView : public BView { public: - TTimeView(bool showSeconds = false, bool milTime = false, bool fullDate = false, + TTimeView(float maxWidth, float height, bool showSeconds = false, bool milTime = false, bool fullDate = false, bool euroDate = false, bool showInterval = false); TTimeView(BMessage *data); ~TTimeView(); @@ -119,7 +119,8 @@ bool fCanShowFullDate; bool fEuroDate; - float fFontHeight; + float fMaxWidth; + float fHeight; bool fOrientation; // vertical = true BPoint fTimeLocation; BPoint fDateLocation; From dlmcpaul at mail.berlios.de Mon Jun 16 15:18:54 2008 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Mon, 16 Jun 2008 15:18:54 +0200 Subject: [Haiku-commits] r25971 - in haiku/trunk/src/add-ons/media/plugins/matroska: . libMatroskaParser libebml libebml/ebml libebml/ebml/c libmatroska libmatroska/matroska libmatroska/matroska/c Message-ID: <200806161318.m5GDIs6k013565@sheep.berlios.de> Author: dlmcpaul Date: 2008-06-16 15:18:51 +0200 (Mon, 16 Jun 2008) New Revision: 25971 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25971&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/matroska/libMatroskaParser/MatroskaParser.c haiku/trunk/src/add-ons/media/plugins/matroska/libMatroskaParser/MatroskaParser.h haiku/trunk/src/add-ons/media/plugins/matroska/libMatroskaParser/StreamIO.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libMatroskaParser/StreamIO.h haiku/trunk/src/add-ons/media/plugins/matroska/libebml/Debug.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libebml/EbmlBinary.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libebml/EbmlCrc32.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libebml/EbmlDate.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libebml/EbmlElement.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libebml/EbmlFloat.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libebml/EbmlHead.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libebml/EbmlMaster.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libebml/EbmlSInteger.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libebml/EbmlString.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libebml/EbmlUInteger.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libebml/EbmlUnicodeString.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libebml/EbmlVoid.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libebml/StdIOCallback.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libebml/ebml/EbmlBinary.h haiku/trunk/src/add-ons/media/plugins/matroska/libebml/ebml/EbmlConfig.h haiku/trunk/src/add-ons/media/plugins/matroska/libebml/ebml/EbmlCrc32.h haiku/trunk/src/add-ons/media/plugins/matroska/libebml/ebml/EbmlDate.h haiku/trunk/src/add-ons/media/plugins/matroska/libebml/ebml/EbmlElement.h haiku/trunk/src/add-ons/media/plugins/matroska/libebml/ebml/EbmlEndian.h haiku/trunk/src/add-ons/media/plugins/matroska/libebml/ebml/EbmlFloat.h haiku/trunk/src/add-ons/media/plugins/matroska/libebml/ebml/EbmlId.h haiku/trunk/src/add-ons/media/plugins/matroska/libebml/ebml/EbmlMaster.h haiku/trunk/src/add-ons/media/plugins/matroska/libebml/ebml/EbmlSInteger.h haiku/trunk/src/add-ons/media/plugins/matroska/libebml/ebml/EbmlString.h haiku/trunk/src/add-ons/media/plugins/matroska/libebml/ebml/EbmlUInteger.h haiku/trunk/src/add-ons/media/plugins/matroska/libebml/ebml/EbmlUnicodeString.h haiku/trunk/src/add-ons/media/plugins/matroska/libebml/ebml/EbmlVersion.h haiku/trunk/src/add-ons/media/plugins/matroska/libebml/ebml/EbmlVoid.h haiku/trunk/src/add-ons/media/plugins/matroska/libebml/ebml/MemIOCallback.h haiku/trunk/src/add-ons/media/plugins/matroska/libebml/ebml/StdIOCallback.h haiku/trunk/src/add-ons/media/plugins/matroska/libebml/ebml/c/libebml_t.h haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/KaxAttached.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/KaxBlock.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/KaxBlockData.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/KaxChapters.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/KaxCluster.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/KaxClusterData.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/KaxCues.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/KaxCuesData.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/KaxInfo.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/KaxInfoData.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/KaxSegment.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/KaxTrackEntryData.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/KaxTracks.cpp haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/matroska/KaxAttached.h haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/matroska/KaxBlock.h haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/matroska/KaxBlockData.h haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/matroska/KaxChapters.h haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/matroska/KaxCluster.h haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/matroska/KaxClusterData.h haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/matroska/KaxConfig.h haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/matroska/KaxContexts.h haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/matroska/KaxCues.h haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/matroska/KaxCuesData.h haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/matroska/KaxInfoData.h haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/matroska/KaxTag.h haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/matroska/KaxTrackEntryData.h haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/matroska/KaxTypes.h haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/matroska/KaxVersion.h haiku/trunk/src/add-ons/media/plugins/matroska/libmatroska/matroska/c/libmatroska_t.h haiku/trunk/src/add-ons/media/plugins/matroska/matroska_reader.cpp haiku/trunk/src/add-ons/media/plugins/matroska/matroska_reader.h Log: Update matroska to latest support library versions (libmatroskaparser 1.31) Modified: haiku/trunk/src/add-ons/media/plugins/matroska/libMatroskaParser/MatroskaParser.c =================================================================== --- haiku/trunk/src/add-ons/media/plugins/matroska/libMatroskaParser/MatroskaParser.c 2008-06-16 13:14:46 UTC (rev 25970) +++ haiku/trunk/src/add-ons/media/plugins/matroska/libMatroskaParser/MatroskaParser.c 2008-06-16 13:18:51 UTC (rev 25971) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004 Mike Matsnev. All Rights Reserved. + * Copyright (c) 2004-2005 Mike Matsnev. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: MatroskaParser.c,v 1.8 2004/09/17 12:23:51 mike Exp $ + * $Id: MatroskaParser.c,v 1.31 2005/03/07 11:22:16 mike Exp $ * */ @@ -37,21 +37,22 @@ #ifdef _WIN32 // MS names some functions differently -#define vsnprintf _vsnprintf #define alloca _alloca #define inline __inline #include #endif -#include - #ifndef EVCBUG #define EVCBUG #endif #include "MatroskaParser.h" +#ifdef MATROSKA_COMPRESSION_SUPPORT +#include +#endif + #define EBML_VERSION 1 #define EBML_MAX_ID_LENGTH 4 #define EBML_MAX_SIZE_LENGTH 8 @@ -61,7 +62,7 @@ #define MAX_STRING_LEN 1023 #define QSEGSIZE 512 #define MAX_TRACKS 32 -#define MAX_READAHEAD (384*1024) +#define MAX_READAHEAD (512*1024) #define DEFAULT_PAGE_SIZE 65536 #define MIN_PAGE_SIZE 4096 @@ -69,11 +70,19 @@ #define MAXCLUSTER (64*1048576) #define MAXFRAME (4*1048576) -#define MAXU64 0xffffffffffffffff +#ifdef WIN32 +#define LL(x) x##i64 +#define ULL(x) x##ui64 +#else +#define LL(x) x##ll +#define ULL(x) x##ull +#endif +#define MAXU64 ULL(0xffffffffffffffff) +#define ONE ULL(1) + // compatibility -#ifdef _WIN32_WCE -static char *strdup(const char *src) { +static char *mystrdup(struct InputStream *is,const char *src) { size_t len; char *dst; @@ -81,7 +90,7 @@ return NULL; len = strlen(src); - dst = malloc(len+1); + dst = (char *)is->memalloc(is,len+1); if (dst==NULL) return NULL; @@ -89,9 +98,8 @@ return dst; } -#endif -#if defined(_WIN32) || defined(__BEOS___) +#ifdef _WIN32 static void strlcpy(char *dst,const char *src,unsigned size) { unsigned i; @@ -135,7 +143,7 @@ unsigned flags; // input - FileCache *cache; + InputStream *cache; // internal buffering char inbuf[IBSZ]; @@ -208,11 +216,194 @@ /////////////////////////////////////////////////////////////////////////// // error reporting +static void myvsnprintf_string(char **pdest,char *de,const char *str) { + char *dest = *pdest; + + while (dest < de && *str) + *dest++ = *str++; + + *pdest = dest; +} + +static void myvsnprintf_uint_impl(char **pdest,char *de,int width,int zero, + int neg,unsigned base,int letter, + int ms,ulonglong val) +{ + char *dest = *pdest; + char tmp[21]; /* enough for 64 bit ints */ + char *np = tmp + sizeof(tmp); + int rw,pad,trail; + char pc = zero ? '0' : ' '; + + *--np = '\0'; + while (val != 0) { + int rem = (int)(val % base); + val = val / base; + + *--np = rem < 10 ? rem + '0' : rem - 10 + letter; + } + + rw = (int)(tmp - np + sizeof(tmp) - 1); + if (ms) + ++rw; + + pad = trail = 0; + + if (rw < width) + pad = width - rw; + + if (neg) + trail = pad, pad = 0; + + if (dest < de && ms) + *dest++ = '-'; + + while (dest < de && pad--) + *dest++ = pc; + + while (dest < de && *np) + *dest++ = *np++; + + while (dest < de && trail--) + *dest++ = ' '; + + *pdest = dest; +} + +static void myvsnprintf_uint(char **pdest,char *de,int width,int zero, + int neg,unsigned base,int letter, + ulonglong val) +{ + myvsnprintf_uint_impl(pdest,de,width,zero,neg,base,letter,0,val); +} + +static void myvsnprintf_int(char **pdest,char *de,int width,int zero, + int neg,unsigned base,int letter, + longlong val) +{ + if (val < 0) + myvsnprintf_uint_impl(pdest,de,width,zero,neg,base,letter,1,-val); + else + myvsnprintf_uint_impl(pdest,de,width,zero,neg,base,letter,0,val); +} + +static void myvsnprintf(char *dest,unsigned dsize,const char *fmt,va_list ap) { + // s,d,x,u,ll + char *de = dest + dsize - 1; + int state = 0, width, zero, neg, ll; + + if (dsize <= 1) { + if (dsize > 0) + *dest = '\0'; + return; + } + + while (*fmt && dest < de) + switch (state) { + case 0: + if (*fmt == '%') { + ++fmt; + state = 1; + width = zero = neg = ll = 0; + } else + *dest++ = *fmt++; + break; + case 1: + if (*fmt == '-') { + neg = 1; + ++fmt; + state = 2; + break; + } + state = 2; + case 2: + if (*fmt >= '0' && *fmt <= '9') { + width = width * 10 + *fmt++ - '0'; + break; + } + state = 3; + case 3: + if (*fmt == 'l') { + ++ll; + ++fmt; + break; + } + state = 4; + case 4: + switch (*fmt) { + case 's': + myvsnprintf_string(&dest,de,va_arg(ap,const char *)); + break; + case 'd': + switch (ll) { + case 0: + myvsnprintf_int(&dest,de,width,zero,neg,10,'a',va_arg(ap,int)); + break; + case 1: + myvsnprintf_int(&dest,de,width,zero,neg,10,'a',va_arg(ap,long)); + break; + case 2: + myvsnprintf_int(&dest,de,width,zero,neg,10,'a',va_arg(ap,longlong)); + break; + } + break; + case 'u': + switch (ll) { + case 0: + myvsnprintf_uint(&dest,de,width,zero,neg,10,'a',va_arg(ap,unsigned int)); + break; + case 1: + myvsnprintf_uint(&dest,de,width,zero,neg,10,'a',va_arg(ap,unsigned long)); + break; + case 2: + myvsnprintf_uint(&dest,de,width,zero,neg,10,'a',va_arg(ap,ulonglong)); + break; + } + break; + case 'x': + switch (ll) { + case 0: + myvsnprintf_uint(&dest,de,width,zero,neg,16,'a',va_arg(ap,unsigned int)); + break; + case 1: + myvsnprintf_uint(&dest,de,width,zero,neg,16,'a',va_arg(ap,unsigned long)); + break; + case 2: + myvsnprintf_uint(&dest,de,width,zero,neg,16,'a',va_arg(ap,ulonglong)); + break; + } + break; + case 'X': + switch (ll) { + case 0: + myvsnprintf_uint(&dest,de,width,zero,neg,16,'A',va_arg(ap,unsigned int)); + break; + case 1: + myvsnprintf_uint(&dest,de,width,zero,neg,16,'A',va_arg(ap,unsigned long)); + break; + case 2: + myvsnprintf_uint(&dest,de,width,zero,neg,16,'A',va_arg(ap,ulonglong)); + break; + } + break; + default: + break; + } + ++fmt; + state = 0; + break; + default: + state = 0; + break; + } + *dest = '\0'; +} + static void errorjmp(MatroskaFile *mf,const char *fmt, ...) { va_list ap; va_start(ap, fmt); - vsnprintf(mf->errmsg,sizeof(mf->errmsg),fmt,ap); + myvsnprintf(mf->errmsg,sizeof(mf->errmsg),fmt,ap); va_end(ap); mf->flags |= MPF_ERROR; @@ -231,7 +422,7 @@ if (newsize==0) newsize = 1; - np = realloc(*base,newsize*elem_size); + np = mf->cache->memrealloc(mf->cache,*base,newsize*elem_size); if (np==NULL) errorjmp(mf,"Out of memory in ArrayAlloc"); @@ -242,11 +433,11 @@ return (char*)*base + elem_size * (*cur)++; } -static void ArrayReleaseMemory(void **base, +static void ArrayReleaseMemory(MatroskaFile *mf,void **base, unsigned cur,unsigned *max,unsigned elem_size) { if (cur<*max) { - void *np = realloc(*base,cur*elem_size); + void *np = mf->cache->memrealloc(mf->cache,*base,cur*elem_size); *base = np; *max = cur; } @@ -255,7 +446,7 @@ #define ASGET(f,s,name) ArrayAlloc((f),(void**)&(s)->name,&(s)->n##name,&(s)->n##name##Size,sizeof(*((s)->name))) #define AGET(f,name) ArrayAlloc((f),(void**)&(f)->name,&(f)->n##name,&(f)->n##name##Size,sizeof(*((f)->name))) -#define ARELEASE(f,name) ArrayReleaseMemory((void**)&(f)->name,(f)->n##name,&(f)->n##name##Size,sizeof(*((f)->name))) +#define ARELEASE(f,s,name) ArrayReleaseMemory((f),(void**)&(s)->name,(s)->n##name,&(s)->n##name##Size,sizeof(*((s)->name))) /////////////////////////////////////////////////////////////////////////// // queues @@ -287,7 +478,7 @@ qep = AGET(mf,QBlocks); - *qep = malloc(QSEGSIZE * sizeof(*qe)); + *qep = mf->cache->memalloc(mf->cache,QSEGSIZE * sizeof(*qe)); if (*qep == NULL) errorjmp(mf,"Ouf of memory"); @@ -346,7 +537,7 @@ } static void readbytes(MatroskaFile *mf,void *buffer,int len) { - char *cp = buffer; + char *cp = (char *)buffer; int nb = mf->buflen - mf->bufpos; if (nb > len) @@ -423,7 +614,6 @@ // .. r1 r0 .. // // r = ((x0*y0) >> 32) + (x1*y0) + (x0*y1) + ((x1*y1) << 32) - // TODO calc tc*scale unsigned x0,x1,y0,y1; ulonglong p; char sign = 0; @@ -445,7 +635,7 @@ return p; #else - return (ulonglong)(scale * tc); + return (longlong)(scale * tc); #endif } @@ -524,15 +714,15 @@ ulonglong v = readVLUIntImp(mf,&m); // see if it's unspecified - if (v == (0xffffffffffffffff >> (57-m*7))) + if (v == (MAXU64 >> (57-m*7))) errorjmp(mf,"Unspecified element size is not supported here."); return v; } static inline longlong readVLSInt(MatroskaFile *mf) { - static longlong bias[8] = { (1<<6)-1, (1<<13)-1, (1<<20)-1, (1<<27)-1, - (1LL<<34)-1, (1LL<<41)-1, (1LL<<48)-1, (1LL<<55)-1 }; + static longlong bias[8] = { (ONE<<6)-1, (ONE<<13)-1, (ONE<<20)-1, (ONE<<27)-1, + (ONE<<34)-1, (ONE<<41)-1, (ONE<<48)-1, (ONE<<55)-1 }; int m; longlong v = readVLUIntImp(mf,&m); @@ -553,7 +743,7 @@ do { c = readch(mf); if (c == EOF) - errorjmp(mf,"Got EOF while read EBML unsigned integer"); + errorjmp(mf,"Got EOF while reading EBML unsigned integer"); v = (v<<8) | c; } while (--m); @@ -595,9 +785,9 @@ else if (shift == 255) inf: if (ui & 0x80000000) - f.v = 0x8000000000000000; + f.v = LL(0x8000000000000000); else - f.v = 0x7fffffffffffffff; + f.v = LL(0x7fffffffffffffff); else { shift += -127 + 9; if (shift > 39) @@ -608,11 +798,9 @@ else if (shift > 0) f.v = f.v << shift; } - } - - if (len == 8) { - ulonglong ui = (unsigned)readUInt(mf,(unsigned)len); - f.v = (ui & 0xfffffffffffff) | 0x10000000000000; + } else if (len == 8) { + ulonglong ui = readUInt(mf,(unsigned)len); + f.v = (ui & LL(0xfffffffffffff)) | LL(0x10000000000000); if (ui & 0x80000000) f.v = -f.v; shift = (int)((ui >> 52) & 0x7ff); @@ -695,19 +883,20 @@ #define ENDFOR(f) ENDFOR1(f) ENDFOR2() +#define myalloca(f,c) alloca(c) #define STRGETF(f,v,len,func) \ { \ char *TmpVal; \ unsigned TmpLen = (len)>MAX_STRING_LEN ? MAX_STRING_LEN : (unsigned)(len); \ - TmpVal = func(TmpLen+1); \ + TmpVal = (char *)func(f->cache,TmpLen+1); \ if (TmpVal == NULL) \ errorjmp(mf,"Out of memory"); \ readString(f,len,TmpVal,TmpLen+1); \ (v) = TmpVal; \ } -#define STRGETA(f,v,len) STRGETF(f,v,len,alloca) -#define STRGETM(f,v,len) STRGETF(f,v,len,malloc) +#define STRGETA(f,v,len) STRGETF(f,v,len,myalloca) +#define STRGETM(f,v,len) STRGETF(f,v,len,f->cache->memalloc) static int IsWritingApp(MatroskaFile *mf,const char *str) { const char *cp = mf->Seg.WritingApp; @@ -819,8 +1008,10 @@ static void parseSegmentInfo(MatroskaFile *mf,ulonglong toplen) { MKFLOAT duration; - if (mf->seen.SegmentInfo) + if (mf->seen.SegmentInfo) { + skipbytes(mf,toplen); return; + } mf->seen.SegmentInfo = 1; mf->Seg.TimecodeScale = 1000000; // Default value @@ -852,6 +1043,8 @@ break; case 0x2ad7b1: // TimecodeScale mf->Seg.TimecodeScale = readUInt(mf,(unsigned)len); + if (mf->Seg.TimecodeScale == 0) + errorjmp(mf,"Segment timecode scale is zero"); break; case 0x4489: // Duration duration = readFloat(mf,(unsigned)len); @@ -1089,7 +1282,7 @@ if (len>262144) // 256KB errorjmp(mf,"CodecPrivate is too large: %d",(int)len); cplen = (unsigned)len; - cp = alloca(cplen); + cp = (char *)alloca(cplen); readbytes(mf,cp,(int)cplen); break; case 0x258688: // CodecName @@ -1161,7 +1354,7 @@ errorjmp(mf,"Track has no Codec ID"); // allocate new track - tpp = AGET(mf,Tracks); + tpp = (TrackInfo **)AGET(mf,Tracks); // copy strings if (t.Name) @@ -1171,7 +1364,7 @@ if (t.CodecID) cpadd += strlen(t.CodecID)+1; - tp = malloc(sizeof(*tp) + cplen + cpadd); + tp = (TrackInfo *)mf->cache->memalloc(mf->cache,sizeof(*tp) + cplen + cpadd); if (tp == NULL) errorjmp(mf,"Out of memory"); @@ -1211,14 +1404,36 @@ cc->Block = 0; } +static void fixupCues(MatroskaFile *mf) { + // adjust cues, shift cues if file does not start at 0 + unsigned i; + longlong adjust = mf->firstTimecode * mf->Seg.TimecodeScale; + + for (i=0;inCues;++i) { + mf->Cues[i].Time *= mf->Seg.TimecodeScale; + mf->Cues[i].Time -= adjust; + } +} + static void parseCues(MatroskaFile *mf,ulonglong toplen) { + jmp_buf jb; ulonglong v; struct Cue cc; unsigned i,j,k; mf->seen.Cues = 1; + mf->nCues = 0; cc.Block = 0; + memcpy(&jb,&mf->jb,sizeof(jb)); + + if (setjmp(mf->jb)) { + memcpy(&mf->jb,&jb,sizeof(jb)); + mf->nCues = 0; + mf->seen.Cues = 0; + return; + } + FOREACH(mf,toplen) case 0xbb: // CuePoint FOREACH(mf,len) @@ -1262,24 +1477,29 @@ break; ENDFOR(mf); - if (mf->nCues == 0) - addCue(mf,mf->pCluster,mf->firstTimecode); + if (mf->nCues == 0 && mf->pCluster - mf->pSegment != cc.Position) + addCue(mf,mf->pCluster - mf->pSegment,mf->firstTimecode); memcpy(AGET(mf,Cues),&cc,sizeof(cc)); break; ENDFOR(mf); - ARELEASE(mf,Cues); + memcpy(&mf->jb,&jb,sizeof(jb)); + ARELEASE(mf,mf,Cues); + // bubble sort the cues and fuck the losers that write unordered cues - for (i = mf->nCues - 1, k = 1; i > 0 && k > 0; --i) - for (j = k = 0; j < i; ++j) - if (mf->Cues[j].Time > mf->Cues[j+1].Time) { - struct Cue tmp = mf->Cues[j+1]; - mf->Cues[j+1] = mf->Cues[j]; - mf->Cues[j] = tmp; - ++k; - } + if (mf->nCues > 0) + for (i = mf->nCues - 1, k = 1; i > 0 && k > 0; --i) + for (j = k = 0; j < i; ++j) + if (mf->Cues[j].Time > mf->Cues[j+1].Time) { + struct Cue tmp = mf->Cues[j+1]; + mf->Cues[j+1] = mf->Cues[j]; + mf->Cues[j] = tmp; + ++k; + } + + fixupCues(mf); } static void parseAttachment(MatroskaFile *mf,ulonglong toplen) { @@ -1313,11 +1533,11 @@ memcpy(pa,&a,sizeof(a)); if (a.Description) - pa->Description = strdup(a.Description); + pa->Description = mystrdup(mf->cache,a.Description); if (a.Name) - pa->Name = strdup(a.Name); + pa->Name = mystrdup(mf->cache,a.Name); if (a.MimeType) - pa->MimeType = strdup(a.MimeType); + pa->MimeType = mystrdup(mf->cache,a.MimeType); } static void parseAttachments(MatroskaFile *mf,ulonglong toplen) { @@ -1332,8 +1552,9 @@ static void parseChapter(MatroskaFile *mf,ulonglong toplen,struct Chapter *parent) { struct ChapterDisplay *disp; + struct ChapterProcess *proc; struct ChapterCommand *cmd; - struct Chapter *ch = ASGET(mf,parent,Children); + struct Chapter *ch = (Chapter *)ASGET(mf,parent,Children); memset(ch,0,sizeof(*ch)); @@ -1399,45 +1620,80 @@ ENDFOR(mf); if (disp && !disp->String) { - free(disp->Language); - free(disp->Country); + mf->cache->memfree(mf->cache,disp->Language); + mf->cache->memfree(mf->cache,disp->Country); --ch->nDisplay; } break; - case 0x6944: // ChapterCommand - cmd = NULL; + case 0x6944: // ChapProcess + proc = NULL; FOREACH(mf,len) - case 0x6922: // ChapterCommandTime - if (cmd == NULL) { - cmd = ASGET(mf,ch,Commands); - memset(cmd, 0, sizeof(*cmd)); + case 0x6955: // ChapProcessCodecID + if (proc == NULL) { + proc = ASGET(mf, ch, Process); + memset(proc, 0, sizeof(*proc)); } - cmd->Time = readUInt(mf,(unsigned)len); + proc->CodecID = (unsigned)readUInt(mf,(unsigned)len); break; - case 0x6937: // ChapterCommandString - if (cmd == NULL) { - cmd = ASGET(mf,ch,Commands); - memset(cmd, 0, sizeof(*cmd)); + case 0x450d: // ChapProcessPrivate + if (proc == NULL) { + proc = ASGET(mf, ch, Process); + memset(proc, 0, sizeof(*proc)); } - if (cmd->String) - skipbytes(mf,len); - else - STRGETM(mf,cmd->String,len); + if (proc->CodecPrivate) + skipbytes(mf, len); + else { + proc->CodecPrivateLength = (unsigned)len; + STRGETM(mf,proc->CodecPrivate,len); + } break; + case 0x6911: // ChapProcessCommand + if (proc == NULL) { + proc = ASGET(mf, ch, Process); + memset(proc, 0, sizeof(*proc)); + } + + cmd = NULL; + + FOREACH(mf,len) + case 0x6922: // ChapterCommandTime + if (cmd == NULL) { + cmd = ASGET(mf,proc,Commands); + memset(cmd, 0, sizeof(*cmd)); + } + cmd->Time = (unsigned)readUInt(mf,(unsigned)len); + break; + case 0x6933: // ChapterCommandString + if (cmd == NULL) { + cmd = ASGET(mf,proc,Commands); + memset(cmd, 0, sizeof(*cmd)); + } + if (cmd->Command) + skipbytes(mf,len); + else { + cmd->CommandLength = (unsigned)len; + STRGETM(mf,cmd->Command,len); + } + break; + ENDFOR(mf); + + if (cmd && !cmd->Command) + --proc->nCommands; + break; ENDFOR(mf); - if (cmd && !cmd->String) - --ch->nCommands; + if (proc && !proc->nCommands) + --ch->nProcess; break; case 0xb6: // Nested ChapterAtom parseChapter(mf,len,ch); break; ENDFOR(mf); - ARELEASE(ch,Tracks); - ARELEASE(ch,Display); - ARELEASE(ch,Children); + ARELEASE(mf,ch,Tracks); + ARELEASE(mf,ch,Display); + ARELEASE(mf,ch,Children); } static void parseChapters(MatroskaFile *mf,ulonglong toplen) { @@ -1447,7 +1703,7 @@ FOREACH(mf,toplen) case 0x45b9: // EditionEntry - ch = AGET(mf,Chapters); + ch = (Chapter *)AGET(mf,Chapters); memset(ch, 0, sizeof(*ch)); FOREACH(mf,len) case 0x45bc: // EditionUID @@ -1459,8 +1715,8 @@ case 0x45db: // EditionFlagDefault ch->Default = readUInt(mf,(unsigned)len)!=0; break; - case 0x45dd: // EditionManaged - ch->Managed = readUInt(mf,(unsigned)len)!=0; + case 0x45dd: // EditionFlagOrdered + ch->Ordered = readUInt(mf,(unsigned)len)!=0; break; case 0xb6: // ChapterAtom parseChapter(mf,len,ch); @@ -1479,7 +1735,7 @@ FOREACH(mf,toplen) case 0x7373: // Tag - tag = AGET(mf,Tags); + tag = (Tag *)AGET(mf,Tags); memset(tag,0,sizeof(*tag)); FOREACH(mf,len) @@ -1536,8 +1792,8 @@ ENDFOR(mf); if (!st->Name || !st->Value) { - free(st->Name); - free(st->Value); + mf->cache->memfree(mf->cache,st->Name); + mf->cache->memfree(mf->cache,st->Value); --tag->nSimpleTags; } break; @@ -1591,8 +1847,12 @@ parseContainerPos(mf,mf->pCluster); if (mf->pTracks && !mf->seen.Tracks) parseContainerPos(mf,mf->pTracks); - if (mf->pCues && !mf->seen.Cues) + if (mf->pCues && !mf->seen.Cues) { parseContainerPos(mf,mf->pCues); + + // ignore errors + mf->flags &= ~MPF_ERROR; + } if (mf->pAttachments && !mf->seen.Attachments) parseContainerPos(mf,mf->pAttachments); if (mf->pChapters && !mf->seen.Chapters) @@ -1747,7 +2007,7 @@ nframes = c+1; } else nframes = 1; - sizes = alloca(nframes*sizeof(*sizes)); + sizes = (unsigned *)alloca(nframes*sizeof(*sizes)); switch (lacing) { case 0: // No lacing @@ -1904,7 +2164,7 @@ if (++retries > 3) // don't try too hard goto ex; - for (;;cp) { // <-- XXX TODO FIX THIS! + for (;;) { if (filepos(mf) >= mf->pSegmentTop) { mf->readPosition = filepos(mf); goto ex; @@ -1941,7 +2201,7 @@ seek(mf,mf->readPosition); - for (;;) { + while (filepos(mf) < mf->pSegmentTop) { cid = readID(mf); if (cid == EOF) { ret = EOF; @@ -1972,7 +2232,7 @@ out:; } else { if (toplen > MAXFRAME) - errorjmp(mf,"Element in a cluster is too large %X [%u]",cid,(unsigned)toplen); + errorjmp(mf,"Element in a cluster is too large around %llu, %X [%u]",filepos(mf),cid,(unsigned)toplen); if (cid == 0xa0) // BlockGroup parseBlockGroup(mf,toplen,mf->tcCluster); else @@ -2019,8 +2279,173 @@ } } +static void reindex(MatroskaFile *mf) { + jmp_buf jb; + ulonglong pos = mf->pCluster; + ulonglong step = 10*1024*1024; + ulonglong size, tc, isize; + longlong next_cluster; + int id, have_tc, bad; + struct Cue *cue; + + if (pos >= mf->pSegmentTop) + return; + + if (pos + step * 10 > mf->pSegmentTop) + step = (mf->pSegmentTop - pos) / 10; + if (step == 0) + step = 1; + + memcpy(&jb,&mf->jb,sizeof(jb)); + + // remove all cues + mf->nCues = 0; + + bad = 0; + + while (pos < mf->pSegmentTop) { + if (!mf->cache->progress(mf->cache,pos,mf->pSegmentTop)) + break; + + if (++bad > 50) { + pos += step; + bad = 0; + continue; + } + + // find next cluster header + next_cluster = mf->cache->scan(mf->cache,pos,0x1f43b675); // cluster + if (next_cluster < 0 || (ulonglong)next_cluster >= mf->pSegmentTop) + break; + + pos = next_cluster + 4; // prevent endless loops + + if (setjmp(mf->jb)) // something evil happened while reindexing + continue; + + seek(mf,next_cluster); + + id = readID(mf); + if (id == EOF) + break; + if (id != 0x1f43b675) // shouldn't happen + continue; + + size = readVLUInt(mf); + if (size >= MAXCLUSTER || size < 1024) + continue; + + have_tc = 0; + size += filepos(mf); + + while (filepos(mf) < (ulonglong)next_cluster + 1024) { + id = readID(mf); + if (id == EOF) + break; + + isize = readVLUInt(mf); + + if (id == 0xe7) { // cluster timecode + tc = readUInt(mf,(unsigned)isize); + have_tc = 1; + break; + } + + skipbytes(mf,isize); + } + + if (!have_tc) + continue; + + seek(mf,size); + id = readID(mf); + + if (id == EOF) + break; + + if (id != 0x1f43b675) // cluster + continue; + + // good cluster, remember it + cue = AGET(mf,Cues); + cue->Time = tc; + cue->Position = next_cluster - mf->pSegment; + cue->Block = 0; + cue->Track = 0; + + // advance to the next point + pos = next_cluster + step; + if (pos < size) + pos = size; + + bad = 0; + } + + fixupCues(mf); + + if (mf->nCues == 0) { + cue = AGET(mf,Cues); + cue->Time = mf->firstTimecode; + cue->Position = mf->pCluster - mf->pSegment; + cue->Block = 0; + cue->Track = 0; + } + + mf->cache->progress(mf->cache,0,0); + + memcpy(&mf->jb,&jb,sizeof(jb)); +} + +static void fixupChapter(ulonglong adj, struct Chapter *ch) { + unsigned i; + + if (ch->Start != 0) + ch->Start -= adj; + if (ch->End != 0) + ch->End -= adj; + + for (i=0;inChildren;++i) + fixupChapter(adj,&ch->Children[i]); +} + +static longlong findLastTimecode(MatroskaFile *mf) { + ulonglong nd = 0; + unsigned n,vtrack; + + if (mf->nCues == 0 || mf->nTracks == 0) + return -1; + + for (n=vtrack=0;nnTracks;++n) + if (mf->Tracks[n]->Type == TT_VIDEO) { + vtrack = n; + goto ok; + } + + return -1; +ok: + + mf->trackMask = ~(1 << vtrack); + mf->readPosition = mf->Cues[mf->nCues - 1].Position + mf->pSegment; + mf->tcCluster = mf->Cues[mf->nCues - 1].Time / mf->Seg.TimecodeScale; + + do + while (mf->Queues[vtrack].head) + { + ulonglong tc = mf->Queues[vtrack].head->flags & FRAME_UNKNOWN_END ? + mf->Queues[vtrack].head->Start : mf->Queues[vtrack].head->End; + if (nd < tc) + nd = tc; + QFree(mf,QGet(&mf->Queues[vtrack])); + } + while (readMoreBlocks(mf) != EOF); + + mf->trackMask = 0; + + return nd; +} + static void parseFile(MatroskaFile *mf) { - ulonglong len; + ulonglong len = filepos(mf), adjust; unsigned i; int id = readID(mf); int m; @@ -2028,6 +2453,11 @@ if (id==EOF) errorjmp(mf,"Unexpected EOF at start of file"); + // files with multiple concatenated segments can have only + // one EBML prolog + if (len > 0 && id == 0x18538067) + goto segment; + if (id!=0x1a45dfa3) errorjmp(mf,"First element in file is not EBML"); @@ -2038,6 +2468,7 @@ id = readID(mf); if (id==EOF) errorjmp(mf,"No segments found in the file"); +segment: len = readVLUIntImp(mf,&m); // see if it's unspecified if (len == (MAXU64 >> (57-m*7))) @@ -2060,50 +2491,65 @@ if (!mf->seen.Cluster) errorjmp(mf,"Couldn't find any Clusters"); - // ensure we have cues - if (mf->nCues == 0) - addCue(mf,mf->pCluster,mf->firstTimecode); + adjust = mf->firstTimecode * mf->Seg.TimecodeScale; + for (i=0;inChapters;++i) + fixupChapter(adjust, &mf->Chapters[i]); [... truncated: 5486 lines follow ...] From dlmcpaul at mail.berlios.de Mon Jun 16 15:22:51 2008 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Mon, 16 Jun 2008 15:22:51 +0200 Subject: [Haiku-commits] r25972 - in haiku/trunk/src/apps/mediaplayer: . media_node_framework Message-ID: <200806161322.m5GDMpgR014082@sheep.berlios.de> Author: dlmcpaul Date: 2008-06-16 15:22:50 +0200 (Mon, 16 Jun 2008) New Revision: 25972 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25972&view=rev Modified: haiku/trunk/src/apps/mediaplayer/InfoWin.cpp haiku/trunk/src/apps/mediaplayer/media_node_framework/NodeManager.cpp Log: Correct error message and minor layout changes to InfoWin Modified: haiku/trunk/src/apps/mediaplayer/InfoWin.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/InfoWin.cpp 2008-06-16 13:18:51 UTC (rev 25971) +++ haiku/trunk/src/apps/mediaplayer/InfoWin.cpp 2008-06-16 13:22:50 UTC (rev 25972) @@ -241,7 +241,7 @@ media_raw_video_format videoFormat; err = fController->GetEncodedVideoFormat(&format); if (err < B_OK) { - s << "(" << strerror(err) << ")"; + s << "(" << strerror(err) << ")\n"; } else if (format.type == B_MEDIA_ENCODED_VIDEO) { videoFormat = format.u.encoded_video.output; media_codec_info mci; @@ -276,7 +276,7 @@ //string_for_format(format, buf, sizeof(buf)); //printf("%s\n", buf); if (err < 0) { - s << "(" << strerror(err) << ")"; + s << "(" << strerror(err) << ")\n"; } else if (format.type == B_MEDIA_ENCODED_AUDIO) { audioFormat = format.u.encoded_audio.output; media_codec_info mci; @@ -306,7 +306,7 @@ else if (channelCount == 2) s << "Stereo"; else - s << channelCount << "Channels"; + s << channelCount << " Channels"; s << ", "; if (sr > 0.0) s << sr / 1000; Modified: haiku/trunk/src/apps/mediaplayer/media_node_framework/NodeManager.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/media_node_framework/NodeManager.cpp 2008-06-16 13:18:51 UTC (rev 25971) +++ haiku/trunk/src/apps/mediaplayer/media_node_framework/NodeManager.cpp 2008-06-16 13:22:50 UTC (rev 25972) @@ -270,11 +270,10 @@ // setup the audio nodes fStatus = _SetUpAudioNodes(); if (fStatus != B_OK) { - print_error("Error setting up video nodes", fStatus); + print_error("Error setting up audio nodes", fStatus); fMediaRoster->Unlock(); return fStatus; } - // we're done mocking with the media roster fMediaRoster->Unlock(); From bonefish at mail.berlios.de Mon Jun 16 18:24:37 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 16 Jun 2008 18:24:37 +0200 Subject: [Haiku-commits] r25973 - haiku/trunk/src/apps/terminal Message-ID: <200806161624.m5GGObLV004443@sheep.berlios.de> Author: bonefish Date: 2008-06-16 18:24:37 +0200 (Mon, 16 Jun 2008) New Revision: 25973 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25973&view=rev Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp Log: Incorrect array index calculation in case of scrolling only part of the screen (as vim does for instance). Should fix #2382 and #2386. Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-16 13:22:50 UTC (rev 25972) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-16 16:24:37 UTC (rev 25973) @@ -1116,7 +1116,7 @@ // lines). for (int32 i = bottom + 1; i < fHeight; i++) { std::swap(fScreen[_LineIndex(i)], - fScreen[_LineIndex(i) + numLines]); + fScreen[_LineIndex(i + numLines)]); } // update the screen offset and clear the new lines From korli at mail.berlios.de Mon Jun 16 18:36:39 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Mon, 16 Jun 2008 18:36:39 +0200 Subject: [Haiku-commits] r25974 - haiku/trunk/src/apps/codycam Message-ID: <200806161636.m5GGadKx014634@sheep.berlios.de> Author: korli Date: 2008-06-16 18:36:38 +0200 (Mon, 16 Jun 2008) New Revision: 25974 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25974&view=rev Modified: haiku/trunk/src/apps/codycam/Settings.cpp haiku/trunk/src/apps/codycam/Settings.h haiku/trunk/src/apps/codycam/SettingsHandler.h Log: fix some warnings Modified: haiku/trunk/src/apps/codycam/Settings.cpp =================================================================== --- haiku/trunk/src/apps/codycam/Settings.cpp 2008-06-16 16:24:37 UTC (rev 25973) +++ haiku/trunk/src/apps/codycam/Settings.cpp 2008-06-16 16:36:38 UTC (rev 25974) @@ -148,6 +148,11 @@ } +ScalarValueSetting::~ScalarValueSetting() +{ +} + + void ScalarValueSetting::ValueChanged(int32 newValue) { @@ -209,6 +214,11 @@ } +BooleanValueSetting::~BooleanValueSetting() +{ +} + + bool BooleanValueSetting::Value() const { Modified: haiku/trunk/src/apps/codycam/Settings.h =================================================================== --- haiku/trunk/src/apps/codycam/Settings.h 2008-06-16 16:24:37 UTC (rev 25973) +++ haiku/trunk/src/apps/codycam/Settings.h 2008-06-16 16:36:38 UTC (rev 25974) @@ -53,6 +53,7 @@ ScalarValueSetting(const char* name, int32 defaultValue, const char* valueExpectedErrorString, const char* wrongValueErrorString, int32 min = LONG_MIN, int32 max = LONG_MAX); + virtual ~ScalarValueSetting(); void ValueChanged(int32 newValue); int32 Value() const; @@ -75,6 +76,7 @@ // on-off setting public: BooleanValueSetting(const char* name, bool defaultValue); + virtual ~BooleanValueSetting(); bool Value() const; virtual const char* Handle(const char *const *argv); Modified: haiku/trunk/src/apps/codycam/SettingsHandler.h =================================================================== --- haiku/trunk/src/apps/codycam/SettingsHandler.h 2008-06-16 16:24:37 UTC (rev 25973) +++ haiku/trunk/src/apps/codycam/SettingsHandler.h 2008-06-16 16:36:38 UTC (rev 25974) @@ -72,6 +72,7 @@ // base class for a single setting item public: SettingsArgvDispatcher(const char* name); + virtual ~SettingsArgvDispatcher() {}; void SaveSettings(Settings* settings, bool onlyIfNonDefault); From axeld at mail.berlios.de Mon Jun 16 20:01:35 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 16 Jun 2008 20:01:35 +0200 Subject: [Haiku-commits] r25975 - in haiku/trunk: headers/private/graphics/intel_extreme src/add-ons/accelerants/intel_extreme Message-ID: <200806161801.m5GI1Zee001318@sheep.berlios.de> Author: axeld Date: 2008-06-16 20:01:34 +0200 (Mon, 16 Jun 2008) New Revision: 25975 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25975&view=rev Modified: haiku/trunk/headers/private/graphics/intel_extreme/intel_extreme.h haiku/trunk/src/add-ons/accelerants/intel_extreme/accelerant.cpp haiku/trunk/src/add-ons/accelerants/intel_extreme/accelerant.h haiku/trunk/src/add-ons/accelerants/intel_extreme/dpms.cpp haiku/trunk/src/add-ons/accelerants/intel_extreme/mode.cpp Log: Patch by Christopher Plymire, style-reworked by myself: * first steps of supporting LVDS panels. Modified: haiku/trunk/headers/private/graphics/intel_extreme/intel_extreme.h =================================================================== --- haiku/trunk/headers/private/graphics/intel_extreme/intel_extreme.h 2008-06-16 16:36:38 UTC (rev 25974) +++ haiku/trunk/headers/private/graphics/intel_extreme/intel_extreme.h 2008-06-16 18:01:34 UTC (rev 25975) @@ -203,6 +203,53 @@ #define INTEL_RING_BUFFER_HEAD_MASK 0x001ffffc #define INTEL_RING_BUFFER_ENABLED 1 +// display ports +#define INTEL_DISPLAY_A_ANALOG_PORT 0x61100 +#define DISPLAY_MONITOR_PORT_ENABLED (1UL << 31) +#define DISPLAY_MONITOR_PIPE_B (1UL << 30) +#define DISPLAY_MONITOR_VGA_POLARITY (1UL << 15) +#define DISPLAY_MONITOR_MODE_MASK (3UL << 10) +#define DISPLAY_MONITOR_ON 0 +#define DISPLAY_MONITOR_SUSPEND (1UL << 10) +#define DISPLAY_MONITOR_STAND_BY (2UL << 10) +#define DISPLAY_MONITOR_OFF (3UL << 10) +#define DISPLAY_MONITOR_POLARITY_MASK (3UL << 3) +#define DISPLAY_MONITOR_POSITIVE_HSYNC (1UL << 3) +#define DISPLAY_MONITOR_POSITIVE_VSYNC (2UL << 3) +#define INTEL_DISPLAY_A_DIGITAL_PORT 0x61120 +#define INTEL_DISPLAY_C_DIGITAL 0x61160 +#define INTEL_DISPLAY_LVDS_PORT 0x61180 +#define LVDS_POST2_RATE_SLOW 14 // PLL Divisors +#define LVDS_POST2_RATE_FAST 7 +#define LVDS_CLKB_POWER_MASK (3 << 4) +#define LVDS_CLKB_POWER_UP (3 << 4) +#define LVDS_PORT_EN (1 << 31) +#define LVDS_A0A2_CLKA_POWER_UP (3 << 8) +#define LVDS_PIPEB_SELECT (1 << 30) +#define LVDS_B0B3PAIRS_POWER_UP (3 << 2) +#define LVDS_PLL_MODE_LVDS (2 << 26) + +// PLL flags +#define DISPLAY_PLL_ENABLED (1UL << 31) +#define DISPLAY_PLL_2X_CLOCK (1UL << 30) +#define DISPLAY_PLL_SYNC_LOCK_ENABLED (1UL << 29) +#define DISPLAY_PLL_NO_VGA_CONTROL (1UL << 28) +#define DISPLAY_PLL_MODE_ANALOG (1UL << 26) +#define DISPLAY_PLL_DIVIDE_HIGH (1UL << 24) +#define DISPLAY_PLL_DIVIDE_4X (1UL << 23) +#define DISPLAY_PLL_POST1_DIVIDE_2 (1UL << 21) +#define DISPLAY_PLL_POST1_DIVISOR_MASK 0x001f0000 +#define DISPLAY_PLL_9xx_POST1_DIVISOR_MASK 0x00ff0000 +#define DISPLAY_PLL_POST1_DIVISOR_SHIFT 16 +#define DISPLAY_PLL_DIVISOR_1 (1UL << 8) +#define DISPLAY_PLL_N_DIVISOR_MASK 0x001f0000 +#define DISPLAY_PLL_M1_DIVISOR_MASK 0x00001f00 +#define DISPLAY_PLL_M2_DIVISOR_MASK 0x0000001f +#define DISPLAY_PLL_N_DIVISOR_SHIFT 16 +#define DISPLAY_PLL_M1_DIVISOR_SHIFT 8 +#define DISPLAY_PLL_M2_DIVISOR_SHIFT 0 +#define DISPLAY_PLL_PULSE_PHASE_SHIFT 9 + // display A #define INTEL_DISPLAY_A_HTOTAL 0x60000 #define INTEL_DISPLAY_A_HBLANK 0x60004 @@ -238,56 +285,42 @@ #define INTEL_DISPLAY_A_PLL 0x06014 #define INTEL_DISPLAY_A_PLL_DIVISOR_0 0x06040 #define INTEL_DISPLAY_A_PLL_DIVISOR_1 0x06044 -#define DISPLAY_PLL_ENABLED (1UL << 31) -#define DISPLAY_PLL_2X_CLOCK (1UL << 30) -#define DISPLAY_PLL_SYNC_LOCK_ENABLED (1UL << 29) -#define DISPLAY_PLL_NO_VGA_CONTROL (1UL << 28) -#define DISPLAY_PLL_MODE_ANALOG (1UL << 26) -#define DISPLAY_PLL_DIVIDE_HIGH (1UL << 24) -#define DISPLAY_PLL_DIVIDE_4X (1UL << 23) -#define DISPLAY_PLL_POST1_DIVIDE_2 (1UL << 21) -#define DISPLAY_PLL_POST1_DIVISOR_MASK 0x001f0000 -#define DISPLAY_PLL_9xx_POST1_DIVISOR_MASK 0x00ff0000 -#define DISPLAY_PLL_POST1_DIVISOR_SHIFT 16 -#define DISPLAY_PLL_DIVISOR_1 (1UL << 8) -#define DISPLAY_PLL_N_DIVISOR_MASK 0x001f0000 -#define DISPLAY_PLL_M1_DIVISOR_MASK 0x00001f00 -#define DISPLAY_PLL_M2_DIVISOR_MASK 0x0000001f -#define DISPLAY_PLL_N_DIVISOR_SHIFT 16 -#define DISPLAY_PLL_M1_DIVISOR_SHIFT 8 -#define DISPLAY_PLL_M2_DIVISOR_SHIFT 0 -#define DISPLAY_PLL_PULSE_PHASE_SHIFT 9 -#define INTEL_DISPLAY_A_ANALOG_PORT 0x61100 -#define DISPLAY_MONITOR_PORT_ENABLED (1UL << 31) -#define DISPLAY_MONITOR_PIPE_B (1UL << 30) -#define DISPLAY_MONITOR_VGA_POLARITY (1UL << 15) -#define DISPLAY_MONITOR_MODE_MASK (3UL << 10) -#define DISPLAY_MONITOR_ON 0 -#define DISPLAY_MONITOR_SUSPEND (1UL << 10) -#define DISPLAY_MONITOR_STAND_BY (2UL << 10) -#define DISPLAY_MONITOR_OFF (3UL << 10) -#define DISPLAY_MONITOR_POLARITY_MASK (3UL << 3) -#define DISPLAY_MONITOR_POSITIVE_HSYNC (1UL << 3) -#define DISPLAY_MONITOR_POSITIVE_VSYNC (2UL << 3) +// display B +#define INTEL_DISPLAY_B_HTOTAL 0x61000 +#define INTEL_DISPLAY_B_HBLANK 0x61004 +#define INTEL_DISPLAY_B_HSYNC 0x61008 +#define INTEL_DISPLAY_B_VTOTAL 0x6100c +#define INTEL_DISPLAY_B_VBLANK 0x61010 +#define INTEL_DISPLAY_B_VSYNC 0x61014 -// display B #define INTEL_DISPLAY_B_DIGITAL_PORT 0x61140 -#define INTEL_DISPLAY_B_IMAGE_SIZE 0x6101c +#define INTEL_DISPLAY_B_PIPE_SIZE 0x71190 #define INTEL_DISPLAY_B_PIPE_CONTROL 0x71008 #define INTEL_DISPLAY_B_CONTROL 0x71180 #define INTEL_DISPLAY_B_BASE 0x71184 #define INTEL_DISPLAY_B_BYTES_PER_ROW 0x71188 +#define INTEL_DISPLAY_B_POS 0x7118C + +#define INTEL_DISPLAY_B_IMAGE_SIZE 0x6101c #define INTEL_DISPLAY_B_SURFACE 0x7119c // i965 and up only #define INTEL_DISPLAY_B_PALETTE 0x0a800 -#define INTEL_DISPLAY_A_DIGITAL_PORT 0x61120 -#define INTEL_DISPLAY_C_DIGITAL 0x61160 -#define INTEL_DISPLAY_LVDS_PORT 0x61180 +#define INTEL_DISPLAY_B_PLL 0x06018 +#define INTEL_DISPLAY_B_PLL_MULTIPLIER_DIVISOR 0x06020 +#define INTEL_DISPLAY_B_PLL_DIVISOR_0 0x06048 +// LVDS panel +#define INTEL_PANEL_STATUS 0x61200 +#define PANEL_STATUS_POWER_ON (1UL << 31) +#define INTEL_PANEL_CONTROL 0x61204 +#define PANEL_CONTROL_POWER_TARGET_ON (1UL << 0) +#define INTEL_PANEL_FIT_CONTROL 0x61230 +#define INTEL_PANEL_FIT_RATIOS 0x61234 + // cursor #define INTEL_CURSOR_CONTROL 0x70080 #define INTEL_CURSOR_BASE 0x70084 Modified: haiku/trunk/src/add-ons/accelerants/intel_extreme/accelerant.cpp =================================================================== --- haiku/trunk/src/add-ons/accelerants/intel_extreme/accelerant.cpp 2008-06-16 16:36:38 UTC (rev 25974) +++ haiku/trunk/src/add-ons/accelerants/intel_extreme/accelerant.cpp 2008-06-16 18:01:34 UTC (rev 25975) @@ -201,6 +201,15 @@ if (read32(INTEL_DISPLAY_A_PIPE_CONTROL) & DISPLAY_PIPE_ENABLED) gInfo->head_mode |= HEAD_MODE_A_ANALOG; + uint32 lvds = read32(INTEL_DISPLAY_LVDS_PORT); + + // If we have an enabled display pipe we save the passed information and assume it is the valid panel size.. + // Later we query for proper EDID info if it exists, or figure something else out. (Default modes, etc.) + if ((lvds & DISPLAY_PIPE_ENABLED) != 0) { + save_lvds_mode(); + gInfo->head_mode |= HEAD_MODE_LVDS_PANEL; + } + TRACE(("head detected: %d\n", gInfo->head_mode)); TRACE(("adpa: %08lx, dova: %08lx, dovb: %08lx, lvds: %08lx\n", read32(INTEL_DISPLAY_A_ANALOG_PORT), read32(INTEL_DISPLAY_A_DIGITAL_PORT), Modified: haiku/trunk/src/add-ons/accelerants/intel_extreme/accelerant.h =================================================================== --- haiku/trunk/src/add-ons/accelerants/intel_extreme/accelerant.h 2008-06-16 16:36:38 UTC (rev 25974) +++ haiku/trunk/src/add-ons/accelerants/intel_extreme/accelerant.h 2008-06-16 18:01:34 UTC (rev 25975) @@ -59,11 +59,15 @@ int device; uint8 head_mode; bool is_clone; + + // LVDS panel mode passed from the bios/startup. + display_mode lvds_panel_mode; }; -#define HEAD_MODE_A_ANALOG 0x01 -#define HEAD_MODE_B_DIGITAL 0x02 -#define HEAD_MODE_CLONE 0x03 +#define HEAD_MODE_A_ANALOG 0x01 +#define HEAD_MODE_B_DIGITAL 0x02 +#define HEAD_MODE_CLONE 0x03 +#define HEAD_MODE_LVDS_PANEL 0x08 extern accelerant_info *gInfo; @@ -93,6 +97,7 @@ // modes.cpp extern void wait_for_vblank(void); extern void set_frame_buffer_base(void); +extern void save_lvds_mode(void); extern status_t create_mode_list(void); // memory.cpp Modified: haiku/trunk/src/add-ons/accelerants/intel_extreme/dpms.cpp =================================================================== --- haiku/trunk/src/add-ons/accelerants/intel_extreme/dpms.cpp 2008-06-16 16:36:38 UTC (rev 25974) +++ haiku/trunk/src/add-ons/accelerants/intel_extreme/dpms.cpp 2008-06-16 18:01:34 UTC (rev 25975) @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2008, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -71,6 +71,34 @@ } +static void +enable_lvds_panel(bool enable) +{ + uint32 control = read32(INTEL_PANEL_CONTROL); + uint32 panelStatus; + + if (enable) { + if ((control & PANEL_CONTROL_POWER_TARGET_ON) == 0) { + write32(INTEL_PANEL_CONTROL, control + | PANEL_CONTROL_POWER_TARGET_ON); + } + + do { + panelStatus = read32(INTEL_PANEL_STATUS); + } while ((panelStatus & PANEL_STATUS_POWER_ON) == 0); + } else { + if ((control & PANEL_CONTROL_POWER_TARGET_ON) != 0) { + write32(INTEL_PANEL_CONTROL, control + & ~PANEL_CONTROL_POWER_TARGET_ON); + } + + do { + panelStatus = read32(INTEL_PANEL_STATUS); + } while ((panelStatus & PANEL_STATUS_POWER_ON) != 0); + } +} + + void set_display_power_mode(uint32 mode) { @@ -91,6 +119,20 @@ spin(150); } + pll = read32(INTEL_DISPLAY_B_PLL); + if ((pll & DISPLAY_PLL_ENABLED) == 0) { + // reactivate PLL + write32(INTEL_DISPLAY_B_PLL, pll); + read32(INTEL_DISPLAY_B_PLL); + spin(150); + write32(INTEL_DISPLAY_B_PLL, pll | DISPLAY_PLL_ENABLED); + read32(INTEL_DISPLAY_B_PLL); + spin(150); + write32(INTEL_DISPLAY_B_PLL, pll | DISPLAY_PLL_ENABLED); + read32(INTEL_DISPLAY_B_PLL); + spin(150); + } + enable_display_pipe(true); enable_display_plane(true); } @@ -120,7 +162,8 @@ if (gInfo->head_mode & HEAD_MODE_B_DIGITAL) { write32(INTEL_DISPLAY_B_DIGITAL_PORT, (read32(INTEL_DISPLAY_B_DIGITAL_PORT) & ~(DISPLAY_MONITOR_MODE_MASK | DISPLAY_MONITOR_PORT_ENABLED)) - | monitorMode | (mode != B_DPMS_OFF ? DISPLAY_MONITOR_PORT_ENABLED : 0)); + | (mode != B_DPMS_OFF ? DISPLAY_MONITOR_PORT_ENABLED : 0)); + // TODO: monitorMode? } if (mode != B_DPMS_ON) { @@ -130,11 +173,20 @@ } if (mode == B_DPMS_OFF) { - write32(INTEL_DISPLAY_A_PLL, read32(INTEL_DISPLAY_A_PLL) | DISPLAY_PLL_ENABLED); - read32(INTEL_DISPLAY_A_PLL); + write32(INTEL_DISPLAY_A_PLL, read32(INTEL_DISPLAY_A_PLL) + | DISPLAY_PLL_ENABLED); + write32(INTEL_DISPLAY_B_PLL, read32(INTEL_DISPLAY_B_PLL) + | DISPLAY_PLL_ENABLED); + + read32(INTEL_DISPLAY_B_PLL); + // flush the eventually cached PCI bus writes + spin(150); } + if ((gInfo->head_mode & HEAD_MODE_B_DIGITAL) != 0) + enable_lvds_panel(mode == B_DPMS_ON); + read32(INTEL_DISPLAY_A_BASE); // flush the eventually cached PCI bus writes } Modified: haiku/trunk/src/add-ons/accelerants/intel_extreme/mode.cpp =================================================================== --- haiku/trunk/src/add-ons/accelerants/intel_extreme/mode.cpp 2008-06-16 16:36:38 UTC (rev 25974) +++ haiku/trunk/src/add-ons/accelerants/intel_extreme/mode.cpp 2008-06-16 18:01:34 UTC (rev 25975) @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2008, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Support for i915 chipset and up based on the X driver, @@ -164,6 +164,28 @@ TRACE(("intel_extreme: getting EDID failed!\n")); } + // TODO: support lower modes via scaling and windowing + if (gInfo->head_mode & HEAD_MODE_LVDS_PANEL + && ((gInfo->head_mode & HEAD_MODE_A_ANALOG) == 0)) { + size_t size = (sizeof(display_mode) + B_PAGE_SIZE - 1) + & ~(B_PAGE_SIZE - 1); + + display_mode *list; + area_id area = create_area("intel extreme modes", (void **)&list, + B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); + if (area < B_OK) + return area; + + memcpy(list, &gInfo->lvds_panel_mode, sizeof(display_mode)); + + gInfo->mode_list_area = area; + gInfo->mode_list = list; + gInfo->shared_info->mode_list_area = gInfo->mode_list_area; + gInfo->shared_info->mode_count = 1; + return B_OK; + } + + // Otherwise return the 'real' list of modes display_mode *list; uint32 count = 0; gInfo->mode_list_area = create_display_modes("intel extreme modes", @@ -192,10 +214,13 @@ static void get_pll_limits(pll_limits &limits) { - // Note, the limits are taken from the X driver; they have not yet been tested + // Note, the limits are taken from the X driver; they have not yet been + // tested if ((gInfo->shared_info->device_type & INTEL_TYPE_9xx) != 0) { // TODO: support LVDS output limits as well + // (Update: Output limits are adjusted in the computation (post2=7/14)) + // Should move them here! static const pll_limits kLimits = { // p, p1, p2, high, n, m, m1, m2 { 5, 1, 10, false, 5, 70, 12, 7}, // min @@ -241,7 +266,8 @@ static void -compute_pll_divisors(const display_mode ¤t, pll_divisors& divisors) +compute_pll_divisors(const display_mode ¤t, pll_divisors& divisors, + bool isLVDS) { float requestedPixelClock = current.timing.pixel_clock / 1000.0f; float referenceClock = gInfo->shared_info->pll_info.reference_frequency / 1000.0f; @@ -250,14 +276,22 @@ TRACE(("required MHz: %g\n", requestedPixelClock)); - if (current.timing.pixel_clock < limits.min_post2_frequency) { - // slow DAC timing - divisors.post2 = limits.min.post2; - divisors.post2_high = limits.min.post2_high; + if (isLVDS) { + if ((read32(INTEL_DISPLAY_LVDS_PORT) & LVDS_CLKB_POWER_MASK) + == LVDS_CLKB_POWER_UP) + divisors.post2 = LVDS_POST2_RATE_FAST; + else + divisors.post2 = LVDS_POST2_RATE_SLOW; } else { - // fast DAC timing - divisors.post2 = limits.max.post2; - divisors.post2_high = limits.max.post2_high; + if (current.timing.pixel_clock < limits.min_post2_frequency) { + // slow DAC timing + divisors.post2 = limits.min.post2; + divisors.post2_high = limits.min.post2_high; + } else { + // fast DAC timing + divisors.post2 = limits.max.post2; + divisors.post2_high = limits.max.post2_high; + } } float best = requestedPixelClock; @@ -299,6 +333,117 @@ } +/*! Store away panel information if identified on startup + (used for pipe B->lvds). +*/ +void +save_lvds_mode(void) +{ + // dump currently programmed mode. + display_mode biosMode; + + uint32 pll = read32(INTEL_DISPLAY_B_PLL); + uint32 pllDivisor = read32(INTEL_DISPLAY_B_PLL_DIVISOR_0); + + pll_divisors divisors; + divisors.m1 = (pllDivisor & DISPLAY_PLL_M1_DIVISOR_MASK) + >> DISPLAY_PLL_M1_DIVISOR_SHIFT; + divisors.m2 = (pllDivisor & DISPLAY_PLL_M2_DIVISOR_MASK) + >> DISPLAY_PLL_M2_DIVISOR_SHIFT; + divisors.n = (pllDivisor & DISPLAY_PLL_N_DIVISOR_MASK) + >> DISPLAY_PLL_N_DIVISOR_SHIFT; + + pll_limits limits; + get_pll_limits(limits); + + if ((gInfo->shared_info->device_type & INTEL_TYPE_9xx) != 0) { + divisors.post1 = (pll & DISPLAY_PLL_9xx_POST1_DIVISOR_MASK) + >> DISPLAY_PLL_POST1_DIVISOR_SHIFT; + + if ((pll & DISPLAY_PLL_DIVIDE_HIGH) != 0) + divisors.post2 = limits.max.post2; + else + divisors.post2 = limits.min.post2; + + // Fix this? Need to support dual channel LVDS. + divisors.post2 = LVDS_POST2_RATE_SLOW; + } else { + // 8xx + divisors.post1 = (pll & DISPLAY_PLL_POST1_DIVISOR_MASK) + >> DISPLAY_PLL_POST1_DIVISOR_SHIFT; + + if ((pll & DISPLAY_PLL_DIVIDE_4X) != 0) + divisors.post2 = limits.max.post2; + else + divisors.post2 = limits.min.post2; + } + + divisors.m = 5 * divisors.m1 + divisors.m2; + divisors.post = divisors.post1 * divisors.post2; + + float referenceClock = gInfo->shared_info->pll_info.reference_frequency + / 1000.0f; + float pixelClock = ((referenceClock * divisors.m) / divisors.n) + / divisors.post; + + // timing + + biosMode.timing.pixel_clock = uint32(pixelClock * 1000); + biosMode.timing.flags = 0; + + uint32 value = read32(INTEL_DISPLAY_B_HTOTAL); + biosMode.timing.h_total = (value >> 16) + 1; + biosMode.timing.h_display = (value & 0xffff) + 1; + + value = read32(INTEL_DISPLAY_B_HSYNC); + biosMode.timing.h_sync_end = (value >> 16) + 1; + biosMode.timing.h_sync_start = (value & 0xffff) + 1; + + value = read32(INTEL_DISPLAY_B_VTOTAL); + biosMode.timing.v_total = (value >> 16) + 1; + biosMode.timing.v_display = (value & 0xffff) + 1; + + value = read32(INTEL_DISPLAY_B_VSYNC); + biosMode.timing.v_sync_end = (value >> 16) + 1; + biosMode.timing.v_sync_start = (value & 0xffff) + 1; + + // image size and color space + + // using virtual size based on image size is the 'proper' way to do it, however the bios appears to be + // suggesting scaling or somesuch, so ignore the proper virtual way for now. + + biosMode.virtual_width = biosMode.timing.h_display; + biosMode.virtual_height = biosMode.timing.v_display; + + //value = read32(INTEL_DISPLAY_B_IMAGE_SIZE); + //biosMode.virtual_width = (value >> 16) + 1; + //biosMode.virtual_height = (value & 0xffff) + 1; + + value = read32(INTEL_DISPLAY_B_CONTROL); + switch (value & DISPLAY_CONTROL_COLOR_MASK) { + case DISPLAY_CONTROL_RGB32: + default: + biosMode.space = B_RGB32; + break; + case DISPLAY_CONTROL_RGB16: + biosMode.space = B_RGB16; + break; + case DISPLAY_CONTROL_RGB15: + biosMode.space = B_RGB15; + break; + case DISPLAY_CONTROL_CMAP8: + biosMode.space = B_CMAP8; + break; + } + + biosMode.h_display_start = 0; + biosMode.v_display_start = 0; + biosMode.flags = 0; + + gInfo->lvds_panel_mode = biosMode; +} + + static void get_color_space_format(const display_mode &mode, uint32 &colorMode, uint32 &bytesPerRow, uint32 &bitsPerPixel) @@ -413,6 +558,7 @@ intel_shared_info &sharedInfo = *gInfo->shared_info; Autolock locker(sharedInfo.accelerant_lock); + // TODO: This may not be neccesary set_display_power_mode(B_DPMS_OFF); // free old and allocate new frame buffer in graphics memory @@ -446,9 +592,118 @@ if (gInfo->shared_info->device_type != INTEL_TYPE_85x) { } + if ((gInfo->head_mode & HEAD_MODE_B_DIGITAL) != 0) { + pll_divisors divisors; + compute_pll_divisors(target, divisors,true); + + uint32 dpll = DISPLAY_PLL_NO_VGA_CONTROL; + if ((gInfo->shared_info->device_type & INTEL_TYPE_9xx) != 0) { + dpll |= LVDS_PLL_MODE_LVDS; + // DPLL mode LVDS for i915+ + } + + // compute bitmask from p1 value + dpll |= (1 << (divisors.post1 - 1)) << 16; + switch (divisors.post2) { + case 5: + case 7: + dpll |= DISPLAY_PLL_DIVIDE_HIGH; + break; + } + + dpll |= (1 << (divisors.post1 - 1)) << DISPLAY_PLL_POST1_DIVISOR_SHIFT; + + uint32 displayControl = ~(DISPLAY_CONTROL_COLOR_MASK + | DISPLAY_CONTROL_GAMMA) | colorMode; + displayControl |= 1 << 24; // select pipe B + + // runs in dpms also? + displayControl |= DISPLAY_PIPE_ENABLED; + dpll |= DISPLAY_PLL_ENABLED; + + write32(INTEL_PANEL_FIT_CONTROL, 0); + + if ((dpll & DISPLAY_PLL_ENABLED) != 0) { + write32(INTEL_DISPLAY_B_PLL_DIVISOR_0, + (((divisors.n - 2) << DISPLAY_PLL_N_DIVISOR_SHIFT) & DISPLAY_PLL_N_DIVISOR_MASK) + | (((divisors.m1 - 2) << DISPLAY_PLL_M1_DIVISOR_SHIFT) & DISPLAY_PLL_M1_DIVISOR_MASK) + | (((divisors.m2 - 2) << DISPLAY_PLL_M2_DIVISOR_SHIFT) & DISPLAY_PLL_M2_DIVISOR_MASK)); + write32(INTEL_DISPLAY_B_PLL, dpll & ~DISPLAY_PLL_ENABLED); + read32(INTEL_DISPLAY_B_PLL); + spin(150); + } + + uint32 lvds = read32(INTEL_DISPLAY_LVDS_PORT) + | LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP | LVDS_PIPEB_SELECT; + + float referenceClock = gInfo->shared_info->pll_info.reference_frequency + / 1000.0f; + + // Set the B0-B3 data pairs corresponding to whether we're going to + // set the DPLLs for dual-channel mode or not. + if (divisors.post2 == LVDS_POST2_RATE_FAST) + lvds |= LVDS_B0B3PAIRS_POWER_UP | LVDS_CLKB_POWER_UP; + else + lvds &= ~( LVDS_B0B3PAIRS_POWER_UP | LVDS_CLKB_POWER_UP); + + write32(INTEL_DISPLAY_LVDS_PORT, lvds); + read32(INTEL_DISPLAY_LVDS_PORT); + + write32(INTEL_DISPLAY_B_PLL_DIVISOR_0, + (((divisors.n - 2) << DISPLAY_PLL_N_DIVISOR_SHIFT) & DISPLAY_PLL_N_DIVISOR_MASK) + | (((divisors.m1 - 2) << DISPLAY_PLL_M1_DIVISOR_SHIFT) & DISPLAY_PLL_M1_DIVISOR_MASK) + | (((divisors.m2 - 2) << DISPLAY_PLL_M2_DIVISOR_SHIFT) & DISPLAY_PLL_M2_DIVISOR_MASK)); + + write32(INTEL_DISPLAY_B_PLL, dpll); + read32(INTEL_DISPLAY_B_PLL); + + // Wait for the clocks to stabilize + spin(150); + + if (gInfo->shared_info->device_type == INTEL_TYPE_965) { + float adjusted = ((referenceClock * divisors.m) / divisors.n) + / divisors.post; + uint32 pixelMultiply = uint32(adjusted + / (target.timing.pixel_clock / 1000.0f)); + + write32(INTEL_DISPLAY_B_PLL_MULTIPLIER_DIVISOR, (0 << 24) + | ((pixelMultiply - 1) << 8)); + } else + write32(INTEL_DISPLAY_B_PLL, dpll); + + read32(INTEL_DISPLAY_B_PLL); + spin(150); + + // update timing parameters + write32(INTEL_DISPLAY_B_HTOTAL, ((uint32)(target.timing.h_total - 1) << 16) + | ((uint32)target.timing.h_display - 1)); + write32(INTEL_DISPLAY_B_HBLANK, ((uint32)(target.timing.h_total - 1) << 16) + | ((uint32)target.timing.h_display - 1)); + write32(INTEL_DISPLAY_B_HSYNC, ((uint32)(target.timing.h_sync_end - 1) << 16) + | ((uint32)target.timing.h_sync_start - 1)); + + write32(INTEL_DISPLAY_B_VTOTAL, ((uint32)(target.timing.v_total - 1) << 16) + | ((uint32)target.timing.v_display - 1)); + write32(INTEL_DISPLAY_B_VBLANK, ((uint32)(target.timing.v_total - 1) << 16) + | ((uint32)target.timing.v_display - 1)); + write32(INTEL_DISPLAY_B_VSYNC, ((uint32)(target.timing.v_sync_end - 1) << 16) + | ((uint32)target.timing.v_sync_start - 1)); + + write32(INTEL_DISPLAY_B_IMAGE_SIZE, ((uint32)(target.timing.h_display - 1) << 16) + | ((uint32)target.timing.v_display - 1)); + + write32(INTEL_DISPLAY_B_POS, 0); + write32(INTEL_DISPLAY_B_PIPE_SIZE, ((uint32)(target.timing.v_display - 1) << 16) + | ((uint32)target.timing.h_display - 1)); + + write32(INTEL_DISPLAY_B_PIPE_CONTROL, + read32(INTEL_DISPLAY_B_PIPE_CONTROL) | DISPLAY_PIPE_ENABLED); + read32(INTEL_DISPLAY_B_PIPE_CONTROL); + } + if (gInfo->head_mode & HEAD_MODE_A_ANALOG) { pll_divisors divisors; - compute_pll_divisors(target, divisors); + compute_pll_divisors(target, divisors,false); write32(INTEL_DISPLAY_A_PLL_DIVISOR_0, (((divisors.n - 2) << DISPLAY_PLL_N_DIVISOR_SHIFT) & DISPLAY_PLL_N_DIVISOR_MASK) @@ -510,23 +765,23 @@ & ~(DISPLAY_MONITOR_POLARITY_MASK | DISPLAY_MONITOR_VGA_POLARITY)) | ((target.timing.flags & B_POSITIVE_HSYNC) != 0 ? DISPLAY_MONITOR_POSITIVE_HSYNC : 0) | ((target.timing.flags & B_POSITIVE_VSYNC) != 0 ? DISPLAY_MONITOR_POSITIVE_VSYNC : 0)); - } - // TODO: verify the two comments below: the X driver doesn't seem to - // care about both of them! + // TODO: verify the two comments below: the X driver doesn't seem to + // care about both of them! - // These two have to be set for display B, too - this obviously means - // that the second head always must adopt the color space of the first - // head. - write32(INTEL_DISPLAY_A_CONTROL, (read32(INTEL_DISPLAY_A_CONTROL) - & ~(DISPLAY_CONTROL_COLOR_MASK | DISPLAY_CONTROL_GAMMA)) | colorMode); + // These two have to be set for display B, too - this obviously means + // that the second head always must adopt the color space of the first + // head. + write32(INTEL_DISPLAY_A_CONTROL, (read32(INTEL_DISPLAY_A_CONTROL) + & ~(DISPLAY_CONTROL_COLOR_MASK | DISPLAY_CONTROL_GAMMA)) | colorMode); - if (gInfo->head_mode & HEAD_MODE_B_DIGITAL) { - write32(INTEL_DISPLAY_B_IMAGE_SIZE, ((uint32)(target.timing.h_display - 1) << 16) - | ((uint32)target.timing.v_display - 1)); + if (gInfo->head_mode & HEAD_MODE_B_DIGITAL) { + write32(INTEL_DISPLAY_B_IMAGE_SIZE, ((uint32)(target.timing.h_display - 1) << 16) + | ((uint32)target.timing.v_display - 1)); - write32(INTEL_DISPLAY_B_CONTROL, (read32(INTEL_DISPLAY_B_CONTROL) - & ~(DISPLAY_CONTROL_COLOR_MASK | DISPLAY_CONTROL_GAMMA)) | colorMode); + write32(INTEL_DISPLAY_B_CONTROL, (read32(INTEL_DISPLAY_B_CONTROL) + & ~(DISPLAY_CONTROL_COLOR_MASK | DISPLAY_CONTROL_GAMMA)) | colorMode); + } } set_display_power_mode(sharedInfo.dpms_mode); From korli at mail.berlios.de Mon Jun 16 20:41:32 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Mon, 16 Jun 2008 20:41:32 +0200 Subject: [Haiku-commits] r25976 - haiku/trunk/src/kits/interface Message-ID: <200806161841.m5GIfWPF006434@sheep.berlios.de> Author: korli Date: 2008-06-16 20:41:31 +0200 (Mon, 16 Jun 2008) New Revision: 25976 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25976&view=rev Modified: haiku/trunk/src/kits/interface/PNGDump.cpp Log: added support for dumping B_RGB15 and B_CMAP8 colorspaces Modified: haiku/trunk/src/kits/interface/PNGDump.cpp =================================================================== --- haiku/trunk/src/kits/interface/PNGDump.cpp 2008-06-16 18:01:34 UTC (rev 25975) +++ haiku/trunk/src/kits/interface/PNGDump.cpp 2008-06-16 18:41:31 UTC (rev 25976) @@ -11,6 +11,7 @@ #include "PNGDump.h" +#include #include #include @@ -114,7 +115,7 @@ png_byte tempRow[dstRowBytes]; for (int row = 0; row < height; row++) { for (int i = 0; i < dstRowBytes; i += 3, src++) { - tempRow[i + 2] = (*src & 0xf800) >> 8; + tempRow[i + 2] = (*src & 0xf800) >> 8; tempRow[i + 1] = (*src & 0x07e0) >> 3; tempRow[i] = (*src & 0x001f) << 3; } @@ -123,10 +124,59 @@ } break; } + + case B_RGB15: + { + // create file without alpha channel + png_set_IHDR(png, info, width, height, 8, PNG_COLOR_TYPE_RGB, + PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, + PNG_FILTER_TYPE_DEFAULT); + png_write_info(png, info); + + // convert from 15 bit RGB to 24 bit RGB while saving + uint16* src = (uint16 *)bits; + int dstRowBytes = width * 3; + png_byte tempRow[dstRowBytes]; + for (int row = 0; row < height; row++) { + for (int i = 0; i < dstRowBytes; i += 3, src++) { + tempRow[i + 2] = (*src & 0x7c00) >> 7; + tempRow[i + 1] = (*src & 0x03e0) >> 2; + tempRow[i] = (*src & 0x001f) << 3; + } + src = (uint16 *)((uint8 *)bits + row * bytesPerRow); + png_write_row(png, tempRow); + } + break; + } + + case B_CMAP8: + { + // create file without alpha channel + png_set_IHDR(png, info, width, height, 8, PNG_COLOR_TYPE_RGB, + PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, + PNG_FILTER_TYPE_DEFAULT); + png_write_info(png, info); + + // convert from 8 bit CMAP to 24 bit RGB while saving + const color_map *colorMap = system_colors(); + uint8* src = (uint8 *)bits; + int dstRowBytes = width * 3; + png_byte tempRow[dstRowBytes]; + for (int row = 0; row < height; row++) { + for (int i = 0; i < dstRowBytes; i += 3, src++) { + tempRow[i + 2] = colorMap->color_list[*src].red; + tempRow[i + 1] = colorMap->color_list[*src].green; + tempRow[i] = colorMap->color_list[*src].blue; + } + src = (uint8 *)bits + row * bytesPerRow; + png_write_row(png, tempRow); + } + break; + } default: { - TRACE(("Unsupported color space %lx\n", space)); + TRACE(("Unsupported color space %x\n", space)); png_destroy_write_struct(&png, NULL); fclose(file); return B_ERROR; From axeld at pinc-software.de Mon Jun 16 21:38:50 2008 From: axeld at pinc-software.de (=?iso-8859-1?q?=41=78=65=6c=20=44=f6=72=66=6c=65=72?=) Date: Mon, 16 Jun 2008 21:38:50 +0200 (MEST) Subject: [Haiku-commits] r25976 - haiku/trunk/src/kits/interface Message-ID: <200806161938.m5GJcoeK016090@post.webmailer.de> From: korli at BerliOS > Modified: > haiku/trunk/src/kits/interface/PNGDump.cpp > Log: > added support for dumping B_RGB15 and B_CMAP8 colorspaces But you do know that this file is supposed to go away once Ryan (or whoever will do this) gets around to write the standalone screenshot app? Bye, Axel. From korli at users.berlios.de Mon Jun 16 21:54:01 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Mon, 16 Jun 2008 21:54:01 +0200 Subject: [Haiku-commits] r25976 - haiku/trunk/src/kits/interface In-Reply-To: <200806161938.m5GJcoeK016090@post.webmailer.de> References: <200806161938.m5GJcoeK016090@post.webmailer.de> Message-ID: 2008/6/16 Axel D?rfler : > From: korli at BerliOS >> Modified: >> haiku/trunk/src/kits/interface/PNGDump.cpp >> Log: >> added support for dumping B_RGB15 and B_CMAP8 colorspaces > > But you do know that this file is supposed to go away once Ryan (or whoever will do this) gets around to write the standalone screenshot app? No, I just have a bug report involved :) Bye, J?r?me From korli at mail.berlios.de Mon Jun 16 22:51:21 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Mon, 16 Jun 2008 22:51:21 +0200 Subject: [Haiku-commits] r25977 - in haiku/trunk: headers/libs/freetype2/freetype headers/libs/freetype2/freetype/config headers/libs/freetype2/freetype/internal headers/libs/freetype2/freetype/internal/services src/libs/freetype2/autofit src/libs/freetype2/base src/libs/freetype2/bdf src/libs/freetype2/cff src/libs/freetype2/cid src/libs/freetype2/lzw src/libs/freetype2/otvalid src/libs/freetype2/pcf src/libs/freetype2/pfr src/libs/freetype2/psaux src/libs/freetype2/pshinter src/libs/freetype2/psnames src/libs/freetype2/raster src/libs/freetype2/sfnt src/libs/freetype2/smooth src/libs/freetype2/truetype src/libs/freetype2/type1 src/libs/freetype2/type42 src/libs/freetype2/winfonts Message-ID: <200806162051.m5GKpLsE024126@sheep.berlios.de> Author: korli Date: 2008-06-16 22:51:14 +0200 (Mon, 16 Jun 2008) New Revision: 25977 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25977&view=rev Added: haiku/trunk/headers/libs/freetype2/freetype/ftcid.h haiku/trunk/headers/libs/freetype2/freetype/internal/services/svcid.h haiku/trunk/src/libs/freetype2/base/ftcid.c haiku/trunk/src/libs/freetype2/otvalid/otvmath.c Modified: haiku/trunk/headers/libs/freetype2/freetype/config/ftconfig.h haiku/trunk/headers/libs/freetype2/freetype/config/ftheader.h haiku/trunk/headers/libs/freetype2/freetype/config/ftoption.h haiku/trunk/headers/libs/freetype2/freetype/freetype.h haiku/trunk/headers/libs/freetype2/freetype/ftbbox.h haiku/trunk/headers/libs/freetype2/freetype/ftcache.h haiku/trunk/headers/libs/freetype2/freetype/ftchapters.h haiku/trunk/headers/libs/freetype2/freetype/ftgasp.h haiku/trunk/headers/libs/freetype2/freetype/ftglyph.h haiku/trunk/headers/libs/freetype2/freetype/ftimage.h haiku/trunk/headers/libs/freetype2/freetype/ftincrem.h haiku/trunk/headers/libs/freetype2/freetype/ftlcdfil.h haiku/trunk/headers/libs/freetype2/freetype/ftmac.h haiku/trunk/headers/libs/freetype2/freetype/ftmodapi.h haiku/trunk/headers/libs/freetype2/freetype/ftotval.h haiku/trunk/headers/libs/freetype2/freetype/ftoutln.h haiku/trunk/headers/libs/freetype2/freetype/ftrender.h haiku/trunk/headers/libs/freetype2/freetype/ftstroke.h haiku/trunk/headers/libs/freetype2/freetype/fttypes.h haiku/trunk/headers/libs/freetype2/freetype/ftwinfnt.h haiku/trunk/headers/libs/freetype2/freetype/internal/ftcalc.h haiku/trunk/headers/libs/freetype2/freetype/internal/ftdebug.h haiku/trunk/headers/libs/freetype2/freetype/internal/ftdriver.h haiku/trunk/headers/libs/freetype2/freetype/internal/ftmemory.h haiku/trunk/headers/libs/freetype2/freetype/internal/ftobjs.h haiku/trunk/headers/libs/freetype2/freetype/internal/ftrfork.h haiku/trunk/headers/libs/freetype2/freetype/internal/ftserv.h haiku/trunk/headers/libs/freetype2/freetype/internal/fttrace.h haiku/trunk/headers/libs/freetype2/freetype/internal/psaux.h haiku/trunk/headers/libs/freetype2/freetype/internal/tttypes.h haiku/trunk/headers/libs/freetype2/freetype/t1tables.h haiku/trunk/headers/libs/freetype2/freetype/ttnameid.h haiku/trunk/headers/libs/freetype2/freetype/tttables.h haiku/trunk/headers/libs/freetype2/freetype/tttags.h haiku/trunk/src/libs/freetype2/autofit/afcjk.c haiku/trunk/src/libs/freetype2/autofit/afcjk.h haiku/trunk/src/libs/freetype2/autofit/afglobal.c haiku/trunk/src/libs/freetype2/autofit/afhints.h haiku/trunk/src/libs/freetype2/autofit/afindic.c haiku/trunk/src/libs/freetype2/autofit/aflatin.c haiku/trunk/src/libs/freetype2/autofit/afloader.c haiku/trunk/src/libs/freetype2/autofit/aftypes.h haiku/trunk/src/libs/freetype2/base/ftbase.c haiku/trunk/src/libs/freetype2/base/ftcalc.c haiku/trunk/src/libs/freetype2/base/ftdebug.c haiku/trunk/src/libs/freetype2/base/ftglyph.c haiku/trunk/src/libs/freetype2/base/ftlcdfil.c haiku/trunk/src/libs/freetype2/base/ftmac.c haiku/trunk/src/libs/freetype2/base/ftobjs.c haiku/trunk/src/libs/freetype2/base/ftoutln.c haiku/trunk/src/libs/freetype2/base/ftrfork.c haiku/trunk/src/libs/freetype2/base/ftstream.c haiku/trunk/src/libs/freetype2/base/ftstroke.c haiku/trunk/src/libs/freetype2/bdf/bdfdrivr.c haiku/trunk/src/libs/freetype2/cff/cffcmap.c haiku/trunk/src/libs/freetype2/cff/cffdrivr.c haiku/trunk/src/libs/freetype2/cff/cffgload.c haiku/trunk/src/libs/freetype2/cff/cffgload.h haiku/trunk/src/libs/freetype2/cff/cffload.c haiku/trunk/src/libs/freetype2/cff/cffobjs.c haiku/trunk/src/libs/freetype2/cff/cffobjs.h haiku/trunk/src/libs/freetype2/cff/cffparse.c haiku/trunk/src/libs/freetype2/cff/cfftypes.h haiku/trunk/src/libs/freetype2/cid/cidgload.c haiku/trunk/src/libs/freetype2/cid/cidriver.c haiku/trunk/src/libs/freetype2/lzw/ftzopen.h haiku/trunk/src/libs/freetype2/otvalid/otvalid.c haiku/trunk/src/libs/freetype2/otvalid/otvalid.h haiku/trunk/src/libs/freetype2/otvalid/otvbase.c haiku/trunk/src/libs/freetype2/otvalid/otvcommn.c haiku/trunk/src/libs/freetype2/otvalid/otvcommn.h haiku/trunk/src/libs/freetype2/otvalid/otvgdef.c haiku/trunk/src/libs/freetype2/otvalid/otvgpos.c haiku/trunk/src/libs/freetype2/otvalid/otvgsub.c haiku/trunk/src/libs/freetype2/otvalid/otvjstf.c haiku/trunk/src/libs/freetype2/otvalid/otvmod.c haiku/trunk/src/libs/freetype2/otvalid/rules.mk haiku/trunk/src/libs/freetype2/pcf/pcfdrivr.c haiku/trunk/src/libs/freetype2/pfr/pfrcmap.c haiku/trunk/src/libs/freetype2/pfr/pfrgload.c haiku/trunk/src/libs/freetype2/psaux/psconv.c haiku/trunk/src/libs/freetype2/psaux/psobjs.c haiku/trunk/src/libs/freetype2/psaux/t1cmap.c haiku/trunk/src/libs/freetype2/psaux/t1decode.c haiku/trunk/src/libs/freetype2/pshinter/pshalgo.c haiku/trunk/src/libs/freetype2/pshinter/pshalgo.h haiku/trunk/src/libs/freetype2/pshinter/pshrec.h haiku/trunk/src/libs/freetype2/psnames/psmodule.c haiku/trunk/src/libs/freetype2/raster/ftraster.c haiku/trunk/src/libs/freetype2/sfnt/sfobjs.c haiku/trunk/src/libs/freetype2/sfnt/ttcmap.c haiku/trunk/src/libs/freetype2/sfnt/ttload.c haiku/trunk/src/libs/freetype2/sfnt/ttmtx.c haiku/trunk/src/libs/freetype2/sfnt/ttsbit.c haiku/trunk/src/libs/freetype2/sfnt/ttsbit0.c haiku/trunk/src/libs/freetype2/smooth/ftgrays.c haiku/trunk/src/libs/freetype2/truetype/ttgload.c haiku/trunk/src/libs/freetype2/truetype/ttgxvar.c haiku/trunk/src/libs/freetype2/truetype/ttinterp.c haiku/trunk/src/libs/freetype2/truetype/ttobjs.c haiku/trunk/src/libs/freetype2/type1/t1load.c haiku/trunk/src/libs/freetype2/type1/t1objs.c haiku/trunk/src/libs/freetype2/type1/t1parse.c haiku/trunk/src/libs/freetype2/type1/t1parse.h haiku/trunk/src/libs/freetype2/type42/t42parse.c haiku/trunk/src/libs/freetype2/winfonts/winfnt.c Log: updated freetype to 2.3.6 Modified: haiku/trunk/headers/libs/freetype2/freetype/config/ftconfig.h =================================================================== --- haiku/trunk/headers/libs/freetype2/freetype/config/ftconfig.h 2008-06-16 18:41:31 UTC (rev 25976) +++ haiku/trunk/headers/libs/freetype2/freetype/config/ftconfig.h 2008-06-16 20:51:14 UTC (rev 25977) @@ -139,13 +139,65 @@ /*************************************************************************/ /* */ - /* IntN types */ + /*
      */ + /* basic_types */ /* */ - /* Used to guarantee the size of some specific integers. */ + /*************************************************************************/ + + + /*************************************************************************/ /* */ - typedef signed short FT_Int16; + /* */ + /* FT_Int16 */ + /* */ + /* */ + /* A typedef for a 16bit signed integer type. */ + /* */ + typedef signed short FT_Int16; + + + /*************************************************************************/ + /* */ + /* */ + /* FT_UInt16 */ + /* */ + /* */ + /* A typedef for a 16bit unsigned integer type. */ + /* */ typedef unsigned short FT_UInt16; + /* */ + + + /* this #if 0 ... #endif clause is for documentation purposes */ +#if 0 + + /*************************************************************************/ + /* */ + /* */ + /* FT_Int32 */ + /* */ + /* */ + /* A typedef for a 32bit signed integer type. The size depends on */ + /* the configuration. */ + /* */ + typedef signed XXX FT_Int32; + + + /*************************************************************************/ + /* */ + /* */ + /* FT_UInt32 */ + /* */ + /* A typedef for a 32bit unsigned integer type. The size depends on */ + /* the configuration. */ + /* */ + typedef unsigned XXX FT_UInt32; + + /* */ + +#endif + #if FT_SIZEOF_INT == (32 / FT_CHAR_BIT) typedef signed int FT_Int32; Modified: haiku/trunk/headers/libs/freetype2/freetype/config/ftheader.h =================================================================== --- haiku/trunk/headers/libs/freetype2/freetype/config/ftheader.h 2008-06-16 18:41:31 UTC (rev 25976) +++ haiku/trunk/headers/libs/freetype2/freetype/config/ftheader.h 2008-06-16 20:51:14 UTC (rev 25977) @@ -4,7 +4,7 @@ /* */ /* Build macros of the FreeType 2 library. */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -156,6 +156,7 @@ #define FT_CONFIG_MODULES_H #endif + /* */ /* public headers */ @@ -386,6 +387,20 @@ /************************************************************************* * * @macro: + * FT_CID_H + * + * @description: + * A macro used in #include statements to name the file containing the + * definitions of an API which access CID font information from a + * face. + * + */ +#define FT_CID_H + + + /************************************************************************* + * + * @macro: * FT_GZIP_H * * @description: @@ -681,6 +696,30 @@ /************************************************************************* * * @macro: + * FT_UNPATENTED_HINTING_H + * + * @description: + * A macro used in #include statements to name the file containing the + * FreeType 2 API which performs color filtering for subpixel rendering. + */ +#define FT_UNPATENTED_HINTING_H + + + /************************************************************************* + * + * @macro: + * FT_INCREMENTAL_H + * + * @description: + * A macro used in #include statements to name the file containing the + * FreeType 2 API which performs color filtering for subpixel rendering. + */ +#define FT_INCREMENTAL_H + + + /************************************************************************* + * + * @macro: * FT_GASP_H * * @description: Modified: haiku/trunk/headers/libs/freetype2/freetype/config/ftoption.h =================================================================== --- haiku/trunk/headers/libs/freetype2/freetype/config/ftoption.h 2008-06-16 18:41:31 UTC (rev 25976) +++ haiku/trunk/headers/libs/freetype2/freetype/config/ftoption.h 2008-06-16 20:51:14 UTC (rev 25977) @@ -4,7 +4,7 @@ /* */ /* User-selectable configuration macros (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -436,6 +436,7 @@ #define TT_CONFIG_CMAP_FORMAT_8 #define TT_CONFIG_CMAP_FORMAT_10 #define TT_CONFIG_CMAP_FORMAT_12 +#define TT_CONFIG_CMAP_FORMAT_14 /*************************************************************************/ @@ -624,7 +625,8 @@ /*************************************************************************/ /* */ - /* Compile autofit module with CJK script support. */ + /* Compile autofit module with CJK (Chinese, Japanese, Korean) script */ + /* support. */ /* */ #define AF_CONFIG_OPTION_CJK Modified: haiku/trunk/headers/libs/freetype2/freetype/freetype.h =================================================================== --- haiku/trunk/headers/libs/freetype2/freetype/freetype.h 2008-06-16 18:41:31 UTC (rev 25976) +++ haiku/trunk/headers/libs/freetype2/freetype/freetype.h 2008-06-16 20:51:14 UTC (rev 25977) @@ -4,7 +4,7 @@ /* */ /* FreeType high-level API and common types (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -799,6 +799,8 @@ /* provide localized and Unicode versions of */ /* this string. Applications should use the */ /* format specific interface to access them. */ + /* Can be NULL (e.g., in fonts embedded in a */ + /* PDF file). */ /* */ /* style_name :: The face's style name. This is an ASCII */ /* string, usually in English, which describes */ @@ -1019,6 +1021,15 @@ /* the SFNT `gasp' table only if the native TrueType hinting engine */ /* (with the bytecode interpreter) is available and active. */ /* */ + /* FT_FACE_FLAG_CID_KEYED :: */ + /* Set if the font is CID-keyed. In that case, the font is not */ + /* accessed by glyph indices but by CID values. For subsetted */ + /* CID-keyed fonts this has the consequence that not all index */ + /* values are a valid argument to FT_Load_Glyph. Only the CID */ + /* values for which corresponding glyphs in the subsetted font */ + /* exist make FT_Load_Glyph return successfully; in all other cases */ + /* you get an `FT_Err_Invalid_Argument' error. */ + /* */ #define FT_FACE_FLAG_SCALABLE ( 1L << 0 ) #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 ) #define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 ) @@ -1031,6 +1042,7 @@ #define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 ) #define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 ) #define FT_FACE_FLAG_HINTER ( 1L << 11 ) +#define FT_FACE_FLAG_CID_KEYED ( 1L << 12 ) /* */ @@ -1187,6 +1199,24 @@ ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS ) + /************************************************************************* + * + * @macro: + * FT_IS_CID_KEYED( face ) + * + * @description: + * A macro that returns true whenever a face object contains a CID-keyed + * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more + * details. + * + * If this macro is true, all functions defined in @FT_CID_H are + * available. + * + */ +#define FT_IS_CID_KEYED( face ) \ + ( face->face_flags & FT_FACE_FLAG_CID_KEYED ) + + /*************************************************************************/ /* */ /* */ @@ -1198,11 +1228,17 @@ /* */ /* */ /* FT_STYLE_FLAG_ITALIC :: */ - /* Indicates that a given face is italicized. */ + /* Indicates that a given face style is italic or oblique. */ /* */ /* FT_STYLE_FLAG_BOLD :: */ /* Indicates that a given face is bold. */ /* */ + /* */ + /* The style information as provided by FreeType is very basic. More */ + /* details are beyond the scope and should be done on a higher level */ + /* (for example, by analyzing various fields of the `OS/2' table in */ + /* SFNT based fonts). */ + /* */ #define FT_STYLE_FLAG_ITALIC ( 1 << 0 ) #define FT_STYLE_FLAG_BOLD ( 1 << 1 ) @@ -1214,7 +1250,7 @@ /* */ /* */ /* An opaque handle to an `FT_Size_InternalRec' structure, used to */ - /* model private data of a given FT_Size object. */ + /* model private data of a given @FT_Size object. */ /* */ typedef struct FT_Size_InternalRec_* FT_Size_Internal; @@ -1345,7 +1381,7 @@ /* */ /* */ /* An opaque handle to an `FT_Slot_InternalRec' structure, used to */ - /* model private data of a given FT_GlyphSlot object. */ + /* model private data of a given @FT_GlyphSlot object. */ /* */ typedef struct FT_Slot_InternalRec_* FT_Slot_Internal; @@ -2055,11 +2091,22 @@ FT_UInt horiResolution; FT_UInt vertResolution; - } FT_Size_RequestRec, *FT_Size_Request; + } FT_Size_RequestRec; /*************************************************************************/ /* */ + /* */ + /* FT_Size_Request */ + /* */ + /* */ + /* A handle to a size request structure. */ + /* */ + typedef struct FT_Size_RequestRec_ *FT_Size_Request; + + + /*************************************************************************/ + /* */ /* */ /* FT_Request_Size */ /* */ @@ -2186,6 +2233,11 @@ /* The loaded glyph may be transformed. See @FT_Set_Transform for */ /* the details. */ /* */ + /* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is */ + /* returned for invalid CID values (this is, for CID values which */ + /* don't have a corresponding glyph in the font). See the discussion */ + /* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */ + /* */ FT_EXPORT( FT_Error ) FT_Load_Glyph( FT_Face face, FT_UInt glyph_index, @@ -2367,9 +2419,7 @@ #define FT_LOAD_IGNORE_TRANSFORM 0x800 #define FT_LOAD_MONOCHROME 0x1000 #define FT_LOAD_LINEAR_DESIGN 0x2000 - - /* temporary hack! */ -#define FT_LOAD_SBITS_ONLY 0x4000 +#define FT_LOAD_SBITS_ONLY 0x4000 /* temporary hack! */ #define FT_LOAD_NO_AUTOHINT 0x8000U /* */ @@ -2448,20 +2498,20 @@ #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V ) - /* + /************************************************************************** + * * @macro: * FT_LOAD_TARGET_MODE * * @description: * Return the @FT_Render_Mode corresponding to a given * @FT_LOAD_TARGET_XXX value. + * */ #define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) ) - /* */ - /*************************************************************************/ /* */ /* */ @@ -2537,9 +2587,11 @@ /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */ /* */ /* */ - /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph are */ - /* _not_ _filtered_ to reduce color-fringes. It is up to the caller */ - /* to perform this pass. */ + /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */ + /* filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */ + /* (not active in the default builds). It is up to the caller to */ + /* either call @FT_Library_SetLcdFilter (if available) or do the */ + /* filtering itself. */ /* */ typedef enum FT_Render_Mode_ { @@ -2821,7 +2873,8 @@ /* */ /* Because many fonts contain more than a single cmap for Unicode */ /* encoding, this function has some special code to select the one */ - /* which covers Unicode best. It is thus preferable to */ + /* which covers Unicode best (`best' in the sense that a UCS-4 cmap */ + /* is preferred to a UCS-2 cmap). It is thus preferable to */ /* @FT_Set_Charmap in this case. */ /* */ FT_EXPORT( FT_Error ) @@ -2851,6 +2904,8 @@ /* the face (i.e., if it is not listed in the `face->charmaps' */ /* table). */ /* */ + /* It also fails if a type 14 charmap is selected. */ + /* */ FT_EXPORT( FT_Error ) FT_Set_Charmap( FT_Face face, FT_CharMap charmap ); @@ -3094,6 +3149,223 @@ /*************************************************************************/ /* */ /*
      */ + /* glyph_variants */ + /* */ + /* */ + /* Glyph Variants */ + /* */ + /* <Abstract> */ + /* The FreeType 2 interface to Unicode Ideographic Variation */ + /* Sequences (IVS), using the SFNT cmap format 14. */ + /* */ + /* <Description> */ + /* Many CJK characters have variant forms. They are a sort of grey */ + /* area somewhere between being totally irrelevant and semantically */ + /* distinct; for this reason, the Unicode consortium decided to */ + /* introduce Ideographic Variation Sequences (IVS), consisting of a */ + /* Unicode base character and one of 240 variant selectors */ + /* (U+E0100-U+E01EF), instead of further extending the already huge */ + /* code range for CJK characters. */ + /* */ + /* An IVS is registered and unique; for further details please refer */ + /* to Unicode Technical Report #37, the Ideographic Variation */ + /* Database. To date (October 2007), the character with the most */ + /* variants is U+908A, having 8 such IVS. */ + /* */ + /* Adobe and MS decided to support IVS with a new cmap subtable */ + /* (format 14). It is an odd subtable because it is not a mapping of */ + /* input code points to glyphs, but contains lists of all variants */ + /* supported by the font. */ + /* */ + /* A variant may be either `default' or `non-default'. A default */ + /* variant is the one you will get for that code point if you look it */ + /* up in the standard Unicode cmap. A non-default variant is a */ + /* different glyph. */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Face_GetCharVariantIndex */ + /* */ + /* <Description> */ + /* Return the glyph index of a given character code as modified by */ + /* the variation selector. */ + /* */ + /* <Input> */ + /* face :: */ + /* A handle to the source face object. */ + /* */ + /* charcode :: */ + /* The character code point in Unicode. */ + /* */ + /* variantSelector :: */ + /* The Unicode code point of the variation selector. */ + /* */ + /* <Return> */ + /* The glyph index. 0 means either `undefined character code', or */ + /* `undefined selector code', or `no variation selector cmap */ + /* subtable', or `current CharMap is not Unicode'. */ + /* */ + /* <Note> */ + /* If you use FreeType to manipulate the contents of font files */ + /* directly, be aware that the glyph index returned by this function */ + /* doesn't always correspond to the internal indices used within */ + /* the file. This is done to ensure that value 0 always corresponds */ + /* to the `missing glyph'. */ + /* */ + /* This function is only meaningful if */ + /* a) the font has a variation selector cmap sub table, */ + /* and */ + /* b) the current charmap has a Unicode encoding. */ + /* */ + /* <Since> */ + /* 2.3.6 */ + /* */ + FT_EXPORT( FT_UInt ) + FT_Face_GetCharVariantIndex( FT_Face face, + FT_ULong charcode, + FT_ULong variantSelector ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Face_GetCharVariantIsDefault */ + /* */ + /* <Description> */ + /* Check whether this variant of this Unicode character is the one to */ + /* be found in the `cmap'. */ + /* */ + /* <Input> */ + /* face :: */ + /* A handle to the source face object. */ + /* */ + /* charcode :: */ + /* The character codepoint in Unicode. */ + /* */ + /* variantSelector :: */ + /* The Unicode codepoint of the variation selector. */ + /* */ + /* <Return> */ + /* 1 if found in the standard (Unicode) cmap, 0 if found in the */ + /* variation selector cmap, or -1 if it is not a variant. */ + /* */ + /* <Note> */ + /* This function is only meaningful if the font has a variation */ + /* selector cmap subtable. */ + /* */ + /* <Since> */ + /* 2.3.6 */ + /* */ + FT_EXPORT( FT_Int ) + FT_Face_GetCharVariantIsDefault( FT_Face face, + FT_ULong charcode, + FT_ULong variantSelector ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Face_GetVariantSelectors */ + /* */ + /* <Description> */ + /* Return a zero-terminated list of Unicode variant selectors found */ + /* in the font. */ + /* */ + /* <Input> */ + /* face :: */ + /* A handle to the source face object. */ + /* */ + /* <Return> */ + /* A pointer to an array of selector code points, or NULL if there is */ + /* no valid variant selector cmap subtable. */ + /* */ + /* <Note> */ + /* The last item in the array is 0; the array is owned by the */ + /* @FT_Face object but can be overwritten or released on the next */ + /* call to a FreeType function. */ + /* */ + /* <Since> */ + /* 2.3.6 */ + /* */ + FT_EXPORT( FT_UInt32* ) + FT_Face_GetVariantSelectors( FT_Face face ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Face_GetVariantsOfChar */ + /* */ + /* <Description> */ + /* Return a zero-terminated list of Unicode variant selectors found */ + /* for the specified character code. */ + /* */ + /* <Input> */ + /* face :: */ + /* A handle to the source face object. */ + /* */ + /* charcode :: */ + /* The character codepoint in Unicode. */ + /* */ + /* <Return> */ + /* A pointer to an array of variant selector code points which are */ + /* active for the given character, or NULL if the corresponding list */ + /* is empty. */ + /* */ + /* <Note> */ + /* The last item in the array is 0; the array is owned by the */ + /* @FT_Face object but can be overwritten or released on the next */ + /* call to a FreeType function. */ + /* */ + /* <Since> */ + /* 2.3.6 */ + /* */ + FT_EXPORT( FT_UInt32* ) + FT_Face_GetVariantsOfChar( FT_Face face, + FT_ULong charcode ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Face_GetCharsOfVariant */ + /* */ + /* <Description> */ + /* Return a zero-terminated list of Unicode character codes found for */ + /* the specified variant selector. */ + /* */ + /* <Input> */ + /* face :: */ + /* A handle to the source face object. */ + /* */ + /* variantSelector :: */ + /* The variant selector code point in Unicode. */ + /* */ + /* <Return> */ + /* A list of all the code points which are specified by this selector */ + /* (both default and non-default codes are returned) or NULL if there */ + /* is no valid cmap or the variant selector is invalid. */ + /* */ + /* <Note> */ + /* The last item in the array is 0; the array is owned by the */ + /* @FT_Face object but can be overwritten or released on the next */ + /* call to a FreeType function. */ + /* */ + /* <Since> */ + /* 2.3.6 */ + /* */ + FT_EXPORT( FT_UInt32* ) + FT_Face_GetCharsOfVariant( FT_Face face, + FT_ULong variantSelector ); + + + /*************************************************************************/ + /* */ + /* <Section> */ /* computations */ /* */ /* <Title> */ @@ -3329,7 +3601,7 @@ */ #define FREETYPE_MAJOR 2 #define FREETYPE_MINOR 3 -#define FREETYPE_PATCH 5 +#define FREETYPE_PATCH 6 /*************************************************************************/ Modified: haiku/trunk/headers/libs/freetype2/freetype/ftbbox.h =================================================================== --- haiku/trunk/headers/libs/freetype2/freetype/ftbbox.h 2008-06-16 18:41:31 UTC (rev 25976) +++ haiku/trunk/headers/libs/freetype2/freetype/ftbbox.h 2008-06-16 20:51:14 UTC (rev 25977) @@ -4,7 +4,7 @@ /* */ /* FreeType exact bbox computation (specification). */ /* */ -/* Copyright 1996-2001, 2003 by */ +/* Copyright 1996-2001, 2003, 2007 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -61,7 +61,7 @@ /* Computes the exact bounding box of an outline. This is slower */ /* than computing the control box. However, it uses an advanced */ /* algorithm which returns _very_ quickly when the two boxes */ - /* coincide. Otherwise, the outline B?zier arcs are walked over to */ + /* coincide. Otherwise, the outline B?zier arcs are traversed to */ /* extract their extrema. */ /* */ /* <Input> */ Modified: haiku/trunk/headers/libs/freetype2/freetype/ftcache.h =================================================================== --- haiku/trunk/headers/libs/freetype2/freetype/ftcache.h 2008-06-16 18:41:31 UTC (rev 25976) +++ haiku/trunk/headers/libs/freetype2/freetype/ftcache.h 2008-06-16 20:51:14 UTC (rev 25977) @@ -4,7 +4,7 @@ /* */ /* FreeType Cache subsystem (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -165,7 +165,7 @@ * Failure to do so will result in incorrect behaviour or even * memory leaks and crashes. */ - typedef struct FTC_FaceIDRec_* FTC_FaceID; + typedef FT_Pointer FTC_FaceID; /************************************************************************ @@ -434,11 +434,22 @@ FT_UInt x_res; FT_UInt y_res; - } FTC_ScalerRec, *FTC_Scaler; + } FTC_ScalerRec; /*************************************************************************/ /* */ + /* <Struct> */ + /* FTC_Scaler */ + /* */ + /* <Description> */ + /* A handle to an @FTC_ScalerRec structure. */ + /* */ + typedef struct FTC_ScalerRec_* FTC_Scaler; + + + /*************************************************************************/ + /* */ /* <Function> */ /* FTC_Manager_LookupSize */ /* */ Modified: haiku/trunk/headers/libs/freetype2/freetype/ftchapters.h =================================================================== --- haiku/trunk/headers/libs/freetype2/freetype/ftchapters.h 2008-06-16 18:41:31 UTC (rev 25976) +++ haiku/trunk/headers/libs/freetype2/freetype/ftchapters.h 2008-06-16 20:51:14 UTC (rev 25977) @@ -32,6 +32,7 @@ /* version */ /* basic_types */ /* base_interface */ +/* glyph_variants */ /* glyph_management */ /* mac_specific */ /* sizes_management */ @@ -54,6 +55,7 @@ /* type1_tables */ /* sfnt_names */ /* bdf_fonts */ +/* cid_fonts */ /* pfr_fonts */ /* winfnt_fonts */ /* font_formats */ Added: haiku/trunk/headers/libs/freetype2/freetype/ftcid.h =================================================================== --- haiku/trunk/headers/libs/freetype2/freetype/ftcid.h 2008-06-16 18:41:31 UTC (rev 25976) +++ haiku/trunk/headers/libs/freetype2/freetype/ftcid.h 2008-06-16 20:51:14 UTC (rev 25977) @@ -0,0 +1,98 @@ +/***************************************************************************/ +/* */ +/* ftcid.h */ +/* */ +/* FreeType API for accessing CID font information (specification). */ +/* */ +/* Copyright 2007 by Dereg Clegg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTCID_H__ +#define __FTCID_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* cid_fonts */ + /* */ + /* <Title> */ + /* CID Fonts */ + /* */ + /* <Abstract> */ + /* CID-keyed font specific API. */ + /* */ + /* <Description> */ + /* This section contains the declaration of CID-keyed font specific */ + /* functions. */ + /* */ + /*************************************************************************/ + + + /********************************************************************** + * + * @function: + * FT_Get_CID_Registry_Ordering_Supplement + * + * @description: + * Retrieve the Registry/Ordering/Supplement triple (also known as the + * "R/O/S") from a CID-keyed font. + * + * @input: + * face :: + * A handle to the input face. + * + * @output: + * registry :: + * The registry, as a C string, owned by the face. + * + * ordering :: + * The ordering, as a C string, owned by the face. + * + * supplement :: + * The supplement. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * This function only works with CID faces, returning an error + * otherwise. + * + * @since: + * 2.3.6 + */ + FT_EXPORT( FT_Error ) + FT_Get_CID_Registry_Ordering_Supplement( FT_Face face, + const char* *registry, + const char* *ordering, + FT_Int *supplement); + + /* */ + +FT_END_HEADER + +#endif /* __FTCID_H__ */ + + +/* END */ Modified: haiku/trunk/headers/libs/freetype2/freetype/ftgasp.h =================================================================== --- haiku/trunk/headers/libs/freetype2/freetype/ftgasp.h 2008-06-16 18:41:31 UTC (rev 25976) +++ haiku/trunk/headers/libs/freetype2/freetype/ftgasp.h 2008-06-16 20:51:14 UTC (rev 25977) @@ -4,7 +4,7 @@ /* */ /* Access of TrueType's `gasp' table (specification). */ /* */ -/* Copyright 2007 by */ +/* Copyright 2007, 2008 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -95,7 +95,7 @@ * ppem :: The vertical character pixel size. * * @return: - * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE is there is no + * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no * `gasp' table in the face. * * @since: Modified: haiku/trunk/headers/libs/freetype2/freetype/ftglyph.h =================================================================== --- haiku/trunk/headers/libs/freetype2/freetype/ftglyph.h 2008-06-16 18:41:31 UTC (rev 25976) +++ haiku/trunk/headers/libs/freetype2/freetype/ftglyph.h 2008-06-16 20:51:14 UTC (rev 25977) @@ -537,7 +537,7 @@ /* */ FT_EXPORT( void ) FT_Matrix_Multiply( const FT_Matrix* a, - FT_Matrix* b ); + FT_Matrix* b ); /*************************************************************************/ Modified: haiku/trunk/headers/libs/freetype2/freetype/ftimage.h =================================================================== --- haiku/trunk/headers/libs/freetype2/freetype/ftimage.h 2008-06-16 18:41:31 UTC (rev 25976) +++ haiku/trunk/headers/libs/freetype2/freetype/ftimage.h 2008-06-16 20:51:14 UTC (rev 25977) @@ -5,7 +5,7 @@ /* FreeType glyph image formats and default raster interface */ /* (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -28,7 +28,7 @@ #define __FTIMAGE_H__ -/* _STANDALONE_ is from ftgrays.c */ + /* _STANDALONE_ is from ftgrays.c */ #ifndef _STANDALONE_ #include <ft2build.h> #endif @@ -206,7 +206,7 @@ /* An enumeration type to describe the format of a bitmap palette, */ /* used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8. */ /* */ - /* <Fields> */ + /* <Values> */ /* ft_palette_mode_rgb :: The palette is an array of 3-bytes RGB */ /* records. */ /* */ @@ -222,7 +222,7 @@ ft_palette_mode_rgb = 0, ft_palette_mode_rgba, - ft_palettte_mode_max /* do not remove */ + ft_palette_mode_max /* do not remove */ } FT_Palette_Mode; @@ -458,12 +458,13 @@ #define FT_CURVE_TAG_TOUCH_BOTH ( FT_CURVE_TAG_TOUCH_X | \ FT_CURVE_TAG_TOUCH_Y ) -#define FT_Curve_Tag_On FT_CURVE_TAG_ON -#define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC -#define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC -#define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X -#define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y +#define FT_Curve_Tag_On FT_CURVE_TAG_ON +#define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC +#define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC +#define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X +#define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y + /*************************************************************************/ /* */ /* <FuncType> */ @@ -490,6 +491,7 @@ #define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc + /*************************************************************************/ /* */ /* <FuncType> */ @@ -514,8 +516,9 @@ (*FT_Outline_LineToFunc)( const FT_Vector* to, void* user ); -#define FT_Outline_LineTo_Func FT_Outline_LineToFunc +#define FT_Outline_LineTo_Func FT_Outline_LineToFunc + /*************************************************************************/ /* */ /* <FuncType> */ @@ -545,8 +548,9 @@ const FT_Vector* to, void* user ); -#define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc +#define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc + /*************************************************************************/ /* */ /* <FuncType> */ @@ -577,7 +581,7 @@ const FT_Vector* to, void* user ); -#define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc +#define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc /*************************************************************************/ @@ -868,7 +872,7 @@ const FT_Span* spans, void* user ); -#define FT_Raster_Span_Func FT_SpanFunc +#define FT_Raster_Span_Func FT_SpanFunc /*************************************************************************/ @@ -1073,8 +1077,9 @@ (*FT_Raster_NewFunc)( void* memory, FT_Raster* raster ); -#define FT_Raster_New_Func FT_Raster_NewFunc +#define FT_Raster_New_Func FT_Raster_NewFunc + /*************************************************************************/ /* */ /* <FuncType> */ @@ -1089,8 +1094,9 @@ typedef void (*FT_Raster_DoneFunc)( FT_Raster raster ); -#define FT_Raster_Done_Func FT_Raster_DoneFunc +#define FT_Raster_Done_Func FT_Raster_DoneFunc + /*************************************************************************/ /* */ /* <FuncType> */ @@ -1123,8 +1129,9 @@ unsigned char* pool_base, unsigned long pool_size ); -#define FT_Raster_Reset_Func FT_Raster_ResetFunc +#define FT_Raster_Reset_Func FT_Raster_ResetFunc + /*************************************************************************/ /* */ /* <FuncType> */ @@ -1148,8 +1155,9 @@ [... truncated: 9459 lines follow ...] From korli at mail.berlios.de Tue Jun 17 00:05:53 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 17 Jun 2008 00:05:53 +0200 Subject: [Haiku-commits] r25978 - haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich Message-ID: <200806162205.m5GM5rZn000298@sheep.berlios.de> Author: korli Date: 2008-06-17 00:05:53 +0200 (Tue, 17 Jun 2008) New Revision: 25978 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25978&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/io.c Log: added debug output for accessed codec registers in case of timeout Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/io.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/io.c 2008-06-16 20:51:14 UTC (rev 25977) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/io.c 2008-06-16 22:05:53 UTC (rev 25978) @@ -104,6 +104,9 @@ } /* codec */ +static uint8 sCodecLastReadRegister = 0; +static uint8 sCodecLastWrittenRegister = 0; + static int auich_codec_wait(device_config *config) { @@ -119,6 +122,7 @@ * reset the semaphore. So even if you don't get the semaphore, still * continue the access. We don't really need the semaphore anyway. */ PRINT(("codec semaphore timed out!\n")); + PRINT(("last read/write registers: %x/%x\n", sCodecLastReadRegister, sCodecLastWrittenRegister)); return B_OK; } @@ -126,6 +130,7 @@ uint16 auich_codec_read(device_config *config, uint8 regno) { + sCodecLastReadRegister = regno; ASSERT(regno >= 0); ASSERT(((config->type & TYPE_ICH4) != 0 && regno <= 511) || regno <= 255); if (auich_codec_wait(config)!=B_OK) { @@ -142,6 +147,7 @@ void auich_codec_write(device_config *config, uint8 regno, uint16 value) { + sCodecLastWrittenRegister = regno; ASSERT(regno >= 0); ASSERT(((config->type & TYPE_ICH4) != 0 && regno <= 511) || regno <= 255); if (auich_codec_wait(config)!=B_OK) { From bonefish at mail.berlios.de Tue Jun 17 00:18:40 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 17 Jun 2008 00:18:40 +0200 Subject: [Haiku-commits] r25979 - in haiku/trunk: build/jam data/etc src/libs/termcap Message-ID: <200806162218.m5GMIeQe003942@sheep.berlios.de> Author: bonefish Date: 2008-06-17 00:18:39 +0200 (Tue, 17 Jun 2008) New Revision: 25979 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25979&view=rev Removed: haiku/trunk/data/etc/termcap Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/src/libs/termcap/Jamfile Log: Removed data/etc/termcap. We use termcap.src from src/libs/termcap/ instead. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-06-16 22:05:53 UTC (rev 25978) +++ haiku/trunk/build/jam/HaikuImage 2008-06-16 22:18:39 UTC (rev 25979) @@ -285,10 +285,10 @@ = [ FDirName $(HAIKU_TOP) src tests kits interface picture ] ; AddFilesToHaikuImage beos etc artwork : $(svgFiles) ; -# TODO: Use data/etc/termcap or src/libs/termcap.src? -local etcFiles = inputrc profile termcap teapot.data ; +local etcFiles = inputrc profile teapot.data ; etcFiles = $(etcFiles:G=etc) ; SEARCH on $(etcFiles) = [ FDirName $(HAIKU_TOP) data etc ] ; +etcFiles += <etc>termcap ; AddFilesToHaikuImage beos etc : $(etcFiles) ; local fortuneFiles = Art Computers Education Food Fortunes Goedel Haiku Deleted: haiku/trunk/data/etc/termcap Modified: haiku/trunk/src/libs/termcap/Jamfile =================================================================== --- haiku/trunk/src/libs/termcap/Jamfile 2008-06-16 22:05:53 UTC (rev 25978) +++ haiku/trunk/src/libs/termcap/Jamfile 2008-06-16 22:18:39 UTC (rev 25979) @@ -10,3 +10,17 @@ StaticLibrary libtermcap.a : termcap.c tparam.c version.c ; + +# Build the /etc/termcap file. It's already ready to use, but we filter out the +# comments. + +actions BuildTermcap { + grep -v '^#' $(2) > $(1) +} + +local termcap = <etc>termcap ; +MakeLocateCommonPlatform $(termcap) ; +local termcapSource = [ FGristFiles termcap.src ] ; +SEARCH on $(termcapSource) = $(SUBDIR) ; +Depends $(termcap) : $(termcapSource) ; +BuildTermcap $(termcap) : $(termcapSource) ; From bonefish at mail.berlios.de Tue Jun 17 00:38:52 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 17 Jun 2008 00:38:52 +0200 Subject: [Haiku-commits] r25980 - haiku/trunk/src/apps/terminal Message-ID: <200806162238.m5GMcqXI018599@sheep.berlios.de> Author: bonefish Date: 2008-06-17 00:38:38 +0200 (Tue, 17 Jun 2008) New Revision: 25980 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25980&view=rev Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp Log: Missing invalidation when inserting space. Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-16 22:18:39 UTC (rev 25979) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-16 22:38:38 UTC (rev 25980) @@ -622,6 +622,8 @@ line->cells[i].character = kSpaceChar; line->cells[i].attributes = 0; } + + _Invalidate(fCursor.y, fCursor.y); } } From bonefish at mail.berlios.de Tue Jun 17 01:13:59 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 17 Jun 2008 01:13:59 +0200 Subject: [Haiku-commits] r25981 - haiku/trunk/src/apps/terminal Message-ID: <200806162313.m5GNDxFQ022565@sheep.berlios.de> Author: bonefish Date: 2008-06-17 01:13:58 +0200 (Tue, 17 Jun 2008) New Revision: 25981 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25981&view=rev Modified: haiku/trunk/src/apps/terminal/TermView.cpp Log: Also invalidate the cursor position when it remains the same, but the screen was scrolled. Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-16 22:38:38 UTC (rev 25980) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-16 23:13:58 UTC (rev 25981) @@ -1731,7 +1731,7 @@ // invalidate cursor, if it changed TermPos cursor = fTextBuffer->Cursor(); - if (fCursor != cursor) { + if (fCursor != cursor || linesScrolled != 0) { // Before we scrolled we did already invalidate the old cursor. if (!doScroll) _InvalidateTextRect(fCursor.x, fCursor.y, fCursor.x, fCursor.y); From bonefish at mail.berlios.de Tue Jun 17 01:15:27 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 17 Jun 2008 01:15:27 +0200 Subject: [Haiku-commits] r25982 - haiku/trunk/src/apps/terminal Message-ID: <200806162315.m5GNFR5k024452@sheep.berlios.de> Author: bonefish Date: 2008-06-17 01:15:26 +0200 (Tue, 17 Jun 2008) New Revision: 25982 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25982&view=rev Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h haiku/trunk/src/apps/terminal/TermParse.cpp haiku/trunk/src/apps/terminal/VTPrsTbl.c haiku/trunk/src/apps/terminal/VTparse.h Log: Support for \ESC[%dS (scroll screen up). Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h =================================================================== --- haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h 2008-06-16 23:13:58 UTC (rev 25981) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h 2008-06-16 23:15:26 UTC (rev 25982) @@ -125,7 +125,7 @@ // scroll region inline void ScrollBy(int32 numLines); - void SetScrollRegion(int32 top, int32 bot); + void SetScrollRegion(int32 top, int32 bottom); protected: virtual void NotifyListener(); Modified: haiku/trunk/src/apps/terminal/TermParse.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-16 23:13:58 UTC (rev 25981) +++ haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-16 23:15:26 UTC (rev 25982) @@ -944,6 +944,13 @@ parsestate = groundtable; break; + case CASE_SU: // scroll screen up + if ((row = param[0]) < 1) + row = 1; + fBuffer->ScrollBy(row); + parsestate = groundtable; + break; + default: break; } Modified: haiku/trunk/src/apps/terminal/VTPrsTbl.c =================================================================== --- haiku/trunk/src/apps/terminal/VTPrsTbl.c 2008-06-16 23:13:58 UTC (rev 25981) +++ haiku/trunk/src/apps/terminal/VTPrsTbl.c 2008-06-16 23:15:26 UTC (rev 25982) @@ -1115,7 +1115,7 @@ CASE_DCH, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_SU, /* T U V W */ CASE_GROUND_STATE, CASE_GROUND_STATE, Modified: haiku/trunk/src/apps/terminal/VTparse.h =================================================================== --- haiku/trunk/src/apps/terminal/VTparse.h 2008-06-16 23:13:58 UTC (rev 25981) +++ haiku/trunk/src/apps/terminal/VTparse.h 2008-06-16 23:15:26 UTC (rev 25982) @@ -119,3 +119,5 @@ // additions, maybe reorder/reuse older ones ? #define CASE_VPA 87 #define CASE_HPA 88 + +#define CASE_SU 89 /* scroll screen up */ From bonefish at mail.berlios.de Tue Jun 17 01:22:40 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 17 Jun 2008 01:22:40 +0200 Subject: [Haiku-commits] r25983 - haiku/trunk/src/apps/terminal Message-ID: <200806162322.m5GNMeHX031115@sheep.berlios.de> Author: bonefish Date: 2008-06-17 01:22:39 +0200 (Tue, 17 Jun 2008) New Revision: 25983 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25983&view=rev Modified: haiku/trunk/src/apps/terminal/TermParse.cpp Log: Fixed \ESC[%d;%dr (set scroll region) for omitted second parameter. Modified: haiku/trunk/src/apps/terminal/TermParse.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-16 23:15:26 UTC (rev 25982) +++ haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-16 23:22:39 UTC (rev 25983) @@ -768,7 +768,7 @@ top = 1; if (nparam < 2) - bot = -1; + bot = fBuffer->Height(); else bot = param[1]; From bonefish at mail.berlios.de Tue Jun 17 01:27:08 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 17 Jun 2008 01:27:08 +0200 Subject: [Haiku-commits] r25984 - haiku/trunk/src/apps/terminal Message-ID: <200806162327.m5GNR8JR006594@sheep.berlios.de> Author: bonefish Date: 2008-06-17 01:27:07 +0200 (Tue, 17 Jun 2008) New Revision: 25984 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25984&view=rev Modified: haiku/trunk/src/apps/terminal/TermParse.cpp haiku/trunk/src/apps/terminal/VTPrsTbl.c haiku/trunk/src/apps/terminal/VTparse.h Log: Added support for \ESC[%dT (scroll screen down). Modified: haiku/trunk/src/apps/terminal/TermParse.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-16 23:22:39 UTC (rev 25983) +++ haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-16 23:27:07 UTC (rev 25984) @@ -951,6 +951,13 @@ parsestate = groundtable; break; + case CASE_SD: // scroll screen down + if ((row = param[0]) < 1) + row = 1; + fBuffer->ScrollBy(-row); + parsestate = groundtable; + break; + default: break; } Modified: haiku/trunk/src/apps/terminal/VTPrsTbl.c =================================================================== --- haiku/trunk/src/apps/terminal/VTPrsTbl.c 2008-06-16 23:22:39 UTC (rev 25983) +++ haiku/trunk/src/apps/terminal/VTPrsTbl.c 2008-06-16 23:27:07 UTC (rev 25984) @@ -1117,10 +1117,10 @@ CASE_GROUND_STATE, CASE_SU, /* T U V W */ +CASE_SD, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, /* X Y Z [ */ CASE_GROUND_STATE, CASE_GROUND_STATE, Modified: haiku/trunk/src/apps/terminal/VTparse.h =================================================================== --- haiku/trunk/src/apps/terminal/VTparse.h 2008-06-16 23:22:39 UTC (rev 25983) +++ haiku/trunk/src/apps/terminal/VTparse.h 2008-06-16 23:27:07 UTC (rev 25984) @@ -121,3 +121,4 @@ #define CASE_HPA 88 #define CASE_SU 89 /* scroll screen up */ +#define CASE_SD 90 /* scroll screen down */ From bonefish at mail.berlios.de Tue Jun 17 03:37:06 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 17 Jun 2008 03:37:06 +0200 Subject: [Haiku-commits] r25985 - haiku/trunk/src/apps/terminal Message-ID: <200806170137.m5H1b6k5006467@sheep.berlios.de> Author: bonefish Date: 2008-06-17 03:37:05 +0200 (Tue, 17 Jun 2008) New Revision: 25985 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25985&view=rev Modified: haiku/trunk/src/apps/terminal/HistoryBuffer.cpp Log: Fixed incorrect access of new lines in AddEmptyLines(). The wrong lines would be initialized while the right ones might have remained uninitialized. Could happen only in case that more lines were scrolled out of the screen than there were in the scroll region. Modified: haiku/trunk/src/apps/terminal/HistoryBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/HistoryBuffer.cpp 2008-06-16 23:27:07 UTC (rev 25984) +++ haiku/trunk/src/apps/terminal/HistoryBuffer.cpp 2008-06-17 01:37:05 UTC (rev 25985) @@ -207,7 +207,8 @@ = (AttributesRun*)(fBuffer + fBufferAllocationOffset); for (int32 i = 0; i < count; i++) { - HistoryLine* line = _LineAt(fNextLine++); + HistoryLine* line = &fLines[fNextLine]; + fNextLine = (fNextLine + 1) % fCapacity; line->attributesRuns = attributesRun; line->attributesRunCount = 0; line->byteLength = 0; From bonefish at mail.berlios.de Tue Jun 17 03:44:11 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 17 Jun 2008 03:44:11 +0200 Subject: [Haiku-commits] r25986 - haiku/trunk/src/apps/terminal Message-ID: <200806170144.m5H1iBxv006849@sheep.berlios.de> Author: bonefish Date: 2008-06-17 03:44:10 +0200 (Tue, 17 Jun 2008) New Revision: 25986 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25986&view=rev Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h haiku/trunk/src/apps/terminal/TermParse.cpp Log: * Fixed \ESC[0J (erase screen below). It shall not erase any character on the line before the cursor. * Implemented \ESC[1J (erase screen above. * Fixed \ESC[2J (erase all). It shall not move the cursor. * When scrolling only the top part of the screen, we do now also invalidate the line below the scroll region. Otherwise the view wouldn't know that they have not been scrolled. Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-17 01:37:05 UTC (rev 25985) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-17 01:44:10 UTC (rev 25986) @@ -629,9 +629,38 @@ void +BasicTerminalBuffer::EraseAbove() +{ + // Clear the preceding lines. + if (fCursor.y > 0) + _ClearLines(0, fCursor.y - 1); + + // Delete the chars on the cursor line before (and including) the cursor. + TerminalLine* line = _LineAt(fCursor.y); + if (fCursor.x < line->length) { + int32 to = fCursor.x; + if (IS_WIDTH(line->cells[fCursor.x].attributes)) + to++; + for (int32 i = 0; i <= to; i++) { + line->cells[i].attributes = 0; + line->cells[i].character = kSpaceChar; + } + } else + line->Clear(); + + _Invalidate(fCursor.y, fCursor.y); +} + + +void BasicTerminalBuffer::EraseBelow() { - _Scroll(fCursor.y, fHeight - 1, fHeight); + // Clear the following lines. + if (fCursor.y < fHeight - 1) + _ClearLines(fCursor.y + 1, fHeight - 1); + + // Delete the chars on the cursor line after (and including) the cursor. + DeleteColumns(); } @@ -1146,6 +1175,14 @@ // invalidate new empty lines _Invalidate(bottom + 1 - numLines, bottom); + + // In case only part of the screen was scrolled, we invalidate also + // the lines below the scroll region. Those remain unchanged, but + // we can't convey that they have not been scrolled via + // TerminalBufferDirtyInfo. So we need to force the view to sync + // them again. + if (bottom < fHeight - 1) + _Invalidate(bottom + 1, fHeight - 1); } else if (numLines >= bottom - top + 1) { // all lines are completely scrolled out of range -- just clear // them Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h =================================================================== --- haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h 2008-06-17 01:37:05 UTC (rev 25985) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h 2008-06-17 01:44:10 UTC (rev 25986) @@ -104,6 +104,7 @@ void InsertLines(int32 numLines); // delete chars/lines + void EraseAbove(); void EraseBelow(); void DeleteChars(int32 numChars); void DeleteColumns(); Modified: haiku/trunk/src/apps/terminal/TermParse.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-17 01:37:05 UTC (rev 25985) +++ haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-17 01:44:10 UTC (rev 25986) @@ -630,11 +630,12 @@ break; case 1: + fBuffer->EraseAbove(); break; case 2: - fBuffer->SetCursor(0, 0); fBuffer->EraseBelow(); + fBuffer->EraseAbove(); break; } parsestate = groundtable; From bonefish at mail.berlios.de Tue Jun 17 04:23:30 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 17 Jun 2008 04:23:30 +0200 Subject: [Haiku-commits] r25987 - haiku/trunk/src/apps/terminal Message-ID: <200806170223.m5H2NUTQ008932@sheep.berlios.de> Author: bonefish Date: 2008-06-17 04:23:28 +0200 (Tue, 17 Jun 2008) New Revision: 25987 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25987&view=rev Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp haiku/trunk/src/apps/terminal/TermWindow.h Log: Reenabled setting the window title. Changed things a bit, though: Each session (tab) has it's own window title. Switching between them changes the window title, too. Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.cpp 2008-06-17 01:44:10 UTC (rev 25986) +++ haiku/trunk/src/apps/terminal/TermWindow.cpp 2008-06-17 02:23:28 UTC (rev 25987) @@ -90,6 +90,7 @@ struct TermWindow::Session { int32 id; BString name; + BString windowTitle; TermViewContainerView* containerView; Session(int32 id, TermViewContainerView* containerView) @@ -112,6 +113,12 @@ { } + virtual void Select(int32 tab) + { + SmartTabView::Select(tab); + fWindow->SessionChanged(); + } + virtual void RemoveAndDeleteTab(int32 index) { fWindow->_RemoveTab(index); @@ -123,7 +130,10 @@ TermWindow::TermWindow(BRect frame, const char* title, Arguments *args) - : BWindow(frame, title, B_DOCUMENT_WINDOW, B_CURRENT_WORKSPACE|B_QUIT_ON_WINDOW_CLOSE), + : + BWindow(frame, title, B_DOCUMENT_WINDOW, + B_CURRENT_WORKSPACE | B_QUIT_ON_WINDOW_CLOSE), + fInitialTitle(title), fTabView(NULL), fMenubar(NULL), fFilemenu(NULL), @@ -166,6 +176,29 @@ void +TermWindow::SetSessionWindowTitle(TermView* termView, const char* title) +{ + int32 index = _IndexOfTermView(termView); + if (Session* session = (Session*)fSessions.ItemAt(index)) { + session->windowTitle = title; + BTab* tab = fTabView->TabAt(index); + tab->SetLabel(session->windowTitle.String()); + if (index == fTabView->Selection()) + SetTitle(session->windowTitle.String()); + } +} + + +void +TermWindow::SessionChanged() +{ + int32 index = fTabView->Selection(); + if (Session* session = (Session*)fSessions.ItemAt(index)) + SetTitle(session->windowTitle.String()); +} + + +void TermWindow::_InitWindow() { // make menu bar @@ -664,6 +697,7 @@ containerView, view); Session* session = new Session(_NewSessionID(), containerView); + session->windowTitle = fInitialTitle; fSessions.AddItem(session); BTab *tab = new BTab; @@ -898,6 +932,6 @@ void CustomTermView::SetTitle(const char *title) { - //Window()->SetTitle(title); + dynamic_cast<TermWindow*>(Window())->SetSessionWindowTitle(this, title); } Modified: haiku/trunk/src/apps/terminal/TermWindow.h =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.h 2008-06-17 01:44:10 UTC (rev 25986) +++ haiku/trunk/src/apps/terminal/TermWindow.h 2008-06-17 02:23:28 UTC (rev 25987) @@ -51,6 +51,10 @@ TermWindow(BRect frame, const char* title, Arguments *args); virtual ~TermWindow(); + void SetSessionWindowTitle(TermView* termView, + const char* title); + void SessionChanged(); + protected: virtual void MessageReceived(BMessage *message); virtual void WindowActivated(bool); @@ -79,6 +83,7 @@ void _BuildWindowSizeMenu(BMenu *menu); int32 _NewSessionID(); + BString fInitialTitle; BList fSessions; TabView *fTabView; From bonefish at mail.berlios.de Tue Jun 17 05:06:26 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 17 Jun 2008 05:06:26 +0200 Subject: [Haiku-commits] r25988 - haiku/trunk/src/apps/terminal Message-ID: <200806170306.m5H36Qge010322@sheep.berlios.de> Author: bonefish Date: 2008-06-17 05:06:25 +0200 (Tue, 17 Jun 2008) New Revision: 25988 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25988&view=rev Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h haiku/trunk/src/apps/terminal/TermParse.cpp haiku/trunk/src/apps/terminal/VTPrsTbl.c haiku/trunk/src/apps/terminal/VTparse.h Log: Added support for \ESC[%dX (erase characters). Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-17 02:23:28 UTC (rev 25987) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-17 03:06:25 UTC (rev 25988) @@ -629,6 +629,29 @@ void +BasicTerminalBuffer::EraseChars(int32 numChars) +{ + TerminalLine* line = _LineAt(fCursor.y); + if (fCursor.y >= line->length) + return; + + int32 first = fCursor.x; + int32 end = min_c(fCursor.x + numChars, line->length); + if (first > 0 && IS_WIDTH(line->cells[first - 1].attributes)) + first--; + if (end > 0 && IS_WIDTH(line->cells[end - 1].attributes)) + end++; + + for (int32 i = first; i < end; i++) { + line->cells[i].character = kSpaceChar; + line->cells[i].attributes = 0; + } + + _Invalidate(fCursor.y, fCursor.y); +} + + +void BasicTerminalBuffer::EraseAbove() { // Clear the preceding lines. Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h =================================================================== --- haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h 2008-06-17 02:23:28 UTC (rev 25987) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h 2008-06-17 03:06:25 UTC (rev 25988) @@ -104,6 +104,7 @@ void InsertLines(int32 numLines); // delete chars/lines + void EraseChars(int32 numChars); void EraseAbove(); void EraseBelow(); void DeleteChars(int32 numChars); Modified: haiku/trunk/src/apps/terminal/TermParse.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-17 02:23:28 UTC (rev 25987) +++ haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-17 03:06:25 UTC (rev 25988) @@ -959,6 +959,14 @@ parsestate = groundtable; break; + + case CASE_ECH: // erase characters + if ((col = param[0]) < 1) + col = 1; + fBuffer->EraseChars(col); + parsestate = groundtable; + break; + default: break; } Modified: haiku/trunk/src/apps/terminal/VTPrsTbl.c =================================================================== --- haiku/trunk/src/apps/terminal/VTPrsTbl.c 2008-06-17 02:23:28 UTC (rev 25987) +++ haiku/trunk/src/apps/terminal/VTPrsTbl.c 2008-06-17 03:06:25 UTC (rev 25988) @@ -1122,10 +1122,10 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* X Y Z [ */ +CASE_ECH, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, -CASE_GROUND_STATE, /* \ ] ^ _ */ CASE_GROUND_STATE, CASE_GROUND_STATE, Modified: haiku/trunk/src/apps/terminal/VTparse.h =================================================================== --- haiku/trunk/src/apps/terminal/VTparse.h 2008-06-17 02:23:28 UTC (rev 25987) +++ haiku/trunk/src/apps/terminal/VTparse.h 2008-06-17 03:06:25 UTC (rev 25988) @@ -120,5 +120,6 @@ #define CASE_VPA 87 #define CASE_HPA 88 -#define CASE_SU 89 /* scroll screen up */ -#define CASE_SD 90 /* scroll screen down */ +#define CASE_SU 89 /* scroll screen up */ +#define CASE_SD 90 /* scroll screen down */ +#define CASE_ECH 91 /* erase characters */ From stippi at mail.berlios.de Tue Jun 17 10:27:13 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 17 Jun 2008 10:27:13 +0200 Subject: [Haiku-commits] r25989 - haiku/trunk/src/add-ons/media/media-add-ons/opensound Message-ID: <200806170827.m5H8RD3R023724@sheep.berlios.de> Author: stippi Date: 2008-06-17 10:27:12 +0200 (Tue, 17 Jun 2008) New Revision: 25989 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25989&view=rev Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp Log: Fixed a few warnings and uninitialized variables that could actually lead to bugs. Modified: haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp 2008-06-17 03:06:25 UTC (rev 25988) +++ haiku/trunk/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp 2008-06-17 08:27:12 UTC (rev 25989) @@ -144,13 +144,13 @@ // else use max available return info->max_rate; } - int i; - int max_rate; - for (i = 0; i < info->nrates; i++) { - if (info->rates[i] < info->min_rate || info->rates[i] > info->max_rate) + uint32 max_rate = 0; + for (uint32 i = 0; i < info->nrates; i++) { + if ((int32)info->rates[i] < info->min_rate + || (int32)info->rates[i] > info->max_rate) continue; // if the hint matches - if (rate && rate == info->rates[i]) + if (rate && rate == (int32)info->rates[i]) return rate; if (info->rates[i] > max_rate) max_rate = info->rates[i]; @@ -364,7 +364,8 @@ { CALLED(); - PRINT(("OpenSoundDevice::InitDriver: %d engines, %d mixers\n", CountEngines(), CountMixers())); + PRINT(("OpenSoundDevice::InitDriver: %ld engines, %ld mixers\n", + CountEngines(), CountMixers())); if (CountMixers()) { ;//... From axeld at mail.berlios.de Tue Jun 17 11:28:00 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 17 Jun 2008 11:28:00 +0200 Subject: [Haiku-commits] r25990 - in haiku/trunk: build/jam src/add-ons/kernel/drivers/disk/virtual/remote_disk Message-ID: <200806170928.m5H9S0WU029714@sheep.berlios.de> Author: axeld Date: 2008-06-17 11:28:00 +0200 (Tue, 17 Jun 2008) New Revision: 25990 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25990&view=rev Modified: haiku/trunk/build/jam/NetBootArchive haiku/trunk/src/add-ons/kernel/drivers/disk/virtual/remote_disk/Jamfile haiku/trunk/src/add-ons/kernel/drivers/disk/virtual/remote_disk/remote_disk.cpp Log: Fixed network boot. Modified: haiku/trunk/build/jam/NetBootArchive =================================================================== --- haiku/trunk/build/jam/NetBootArchive 2008-06-17 08:27:12 UTC (rev 25989) +++ haiku/trunk/build/jam/NetBootArchive 2008-06-17 09:28:00 UTC (rev 25990) @@ -42,7 +42,7 @@ AddFilesToNetBootArchive beos system add-ons kernel file_systems : $(BEOS_ADD_ONS_FILE_SYSTEMS) ; AddFilesToNetBootArchive beos system add-ons kernel generic - : block_io fast_log ide_adapter locked_pool scsi_periph ; + : block_io ide_adapter locked_pool scsi_periph ; AddFilesToNetBootArchive beos system add-ons kernel partitioning_systems : intel session ; AddFilesToNetBootArchive beos system add-ons kernel interrupt_controllers @@ -53,8 +53,8 @@ } # drivers -AddDriversToNetBootArchive disk scsi : scsi_cd scsi_dsk ; -#AddDriversToNetBootArchive disk virtual : nbd ; +AddDriversToNetBootArchive disk scsi : scsi_cd scsi_disk ; +#AddDriversToNetBootArchive disk virtual : nbd ; AddDriversToNetBootArchive disk virtual : remote_disk ; AddDriversToNetBootArchive net : $(BEOS_ADD_ONS_DRIVERS_NET) ; @@ -86,7 +86,7 @@ $(BEOS_ADD_ONS_BUS_MANAGERS) ahci generic_ide_pci $(X86_ONLY)ide_isa silicon_image_3112 $(BEOS_ADD_ONS_FILE_SYSTEMS) - block_io fast_log ide_adapter locked_pool scsi_periph + block_io ide_adapter locked_pool scsi_periph intel session $(PPC_ONLY)openpic $(X86_ONLY)generic_x86 @@ -95,7 +95,7 @@ $(BEOS_ADD_ONS_DRIVERS_NET) stack $(BEOS_NETWORK_DEVICES) - $(BEOS_NETWORK_DATALINK_PROTOCOLS) + $(BEOS_NETWORK_DATALINK_PROTOCOLS) $(BEOS_NETWORK_PPP) $(BEOS_NETWORK_PROTOCOLS) ; Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/virtual/remote_disk/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/disk/virtual/remote_disk/Jamfile 2008-06-17 08:27:12 UTC (rev 25989) +++ haiku/trunk/src/add-ons/kernel/drivers/disk/virtual/remote_disk/Jamfile 2008-06-17 09:28:00 UTC (rev 25990) @@ -1,9 +1,7 @@ SubDir HAIKU_TOP src add-ons kernel drivers disk virtual remote_disk ; -UsePrivateHeaders kernel ; -UseArchHeaders $(TARGET_ARCH) ; -UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; - # TODO: Ugly! +UsePrivateKernelHeaders ; +UsePrivateSystemHeaders ; KernelAddon remote_disk : remote_disk.cpp Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/virtual/remote_disk/remote_disk.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/disk/virtual/remote_disk/remote_disk.cpp 2008-06-17 08:27:12 UTC (rev 25989) +++ haiku/trunk/src/add-ons/kernel/drivers/disk/virtual/remote_disk/remote_disk.cpp 2008-06-17 09:28:00 UTC (rev 25990) @@ -35,10 +35,10 @@ bigtime_t lastInitRetryTime; RemoteDiskDevice() - : remoteDisk(NULL), - lastInitRetryTime(-1) + : + remoteDisk(NULL), + lastInitRetryTime(-1) { - sem = -1; } ~RemoteDiskDevice() @@ -236,7 +236,7 @@ *(bool*)arg = true; return B_OK; - case B_GET_WRITE_STATUS: + case B_GET_WRITE_STATUS: TRACE(("remote_disk: B_GET_WRITE_STATUS\n")); *(bool*)arg = true; return B_OK; From bonefish at mail.berlios.de Tue Jun 17 15:19:25 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 17 Jun 2008 15:19:25 +0200 Subject: [Haiku-commits] r25991 - haiku/trunk/src/apps/terminal Message-ID: <200806171319.m5HDJPmA029235@sheep.berlios.de> Author: bonefish Date: 2008-06-17 15:19:25 +0200 (Tue, 17 Jun 2008) New Revision: 25991 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25991&view=rev Modified: haiku/trunk/src/apps/terminal/TermParse.cpp Log: Entering/leaving insert mode should only happen with parameter 4. Modified: haiku/trunk/src/apps/terminal/TermParse.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-17 09:28:00 UTC (rev 25990) +++ haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-17 13:19:25 UTC (rev 25991) @@ -673,13 +673,15 @@ case CASE_SET: /* SET */ - fBuffer->SetInsertMode(MODE_INSERT); + if (param[0] == 4) + fBuffer->SetInsertMode(MODE_INSERT); parsestate = groundtable; break; case CASE_RST: /* RST */ - fBuffer->SetInsertMode(MODE_OVER); + if (param[0] == 4) + fBuffer->SetInsertMode(MODE_OVER); parsestate = groundtable; break; From bonefish at mail.berlios.de Tue Jun 17 15:28:24 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 17 Jun 2008 15:28:24 +0200 Subject: [Haiku-commits] r25992 - haiku/trunk/src/apps/terminal Message-ID: <200806171328.m5HDSOfV030186@sheep.berlios.de> Author: bonefish Date: 2008-06-17 15:28:24 +0200 (Tue, 17 Jun 2008) New Revision: 25992 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25992&view=rev Modified: haiku/trunk/src/apps/terminal/TermParse.cpp Log: Fixed \ESCM (reverse index). It shall only scroll when the cursor is in the first line. Modified: haiku/trunk/src/apps/terminal/TermParse.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-17 13:19:25 UTC (rev 25991) +++ haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-17 13:28:24 UTC (rev 25992) @@ -834,7 +834,10 @@ case CASE_RI: /* RI */ - fBuffer->ScrollBy(-1); + if (fBuffer->Cursor().y == 0) + fBuffer->ScrollBy(-1); + else + fBuffer->MoveCursorUp(1); parsestate = groundtable; break; From bonefish at mail.berlios.de Tue Jun 17 15:46:18 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 17 Jun 2008 15:46:18 +0200 Subject: [Haiku-commits] r25993 - haiku/trunk/src/apps/terminal Message-ID: <200806171346.m5HDkI0H031458@sheep.berlios.de> Author: bonefish Date: 2008-06-17 15:46:17 +0200 (Tue, 17 Jun 2008) New Revision: 25993 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25993&view=rev Modified: haiku/trunk/src/apps/terminal/TermScrollView.cpp Log: For some reasons the scroll bar started overlapping with the resize knob, or actually for some reasons it didn't for me after r25969. Modified: haiku/trunk/src/apps/terminal/TermScrollView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermScrollView.cpp 2008-06-17 13:28:24 UTC (rev 25992) +++ haiku/trunk/src/apps/terminal/TermScrollView.cpp 2008-06-17 13:46:17 UTC (rev 25993) @@ -42,7 +42,7 @@ // Overlap one pixel at the top and the bottom of the scroll bar with // the menu respectively resize knob for aesthetical reasons. frame.top -= 1; - frame.bottom += 1; + frame.bottom -= B_H_SCROLL_BAR_HEIGHT - 1; TermScrollBar* scrollBar = new TermScrollBar(frame, "_VSB_", target, 0, 1000, B_VERTICAL); From axeld at mail.berlios.de Tue Jun 17 16:25:46 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 17 Jun 2008 16:25:46 +0200 Subject: [Haiku-commits] r25994 - haiku/trunk/src/apps/aboutsystem Message-ID: <200806171425.m5HEPkhP002527@sheep.berlios.de> Author: axeld Date: 2008-06-17 16:25:46 +0200 (Tue, 17 Jun 2008) New Revision: 25994 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25994&view=rev Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp Log: * Simplified compiler text - it will now only be shown in case it's not 2.95.3, and it does fit in the line. * Removed extraneous whitespace. Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp =================================================================== --- haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-06-17 13:46:17 UTC (rev 25993) +++ haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-06-17 14:25:46 UTC (rev 25994) @@ -75,15 +75,15 @@ public: AboutView(const BRect &r); ~AboutView(void); - + virtual void AttachedToWindow(); virtual void Pulse(); - + virtual void FrameResized(float width, float height); virtual void Draw(BRect update); virtual void MessageReceived(BMessage *msg); virtual void MouseDown(BPoint pt); - + void AddCopyrightEntry(const char *name, const char *text, const Licenses& licenses, const char *url); void AddCopyrightEntry(const char *name, const char *text, @@ -98,11 +98,11 @@ BStringView *fUptimeView; BView *fInfoView; HyperTextView *fCreditsView; - + BBitmap *fLogo; - + BPoint fDrawPoint; - + bigtime_t fLastActionTime; BMessageRunner *fScrollRunner; BQuery fAppsQuery; @@ -124,12 +124,12 @@ AboutWindow::AboutWindow() - : BWindow(BRect(0, 0, 500, 300), "About This System", B_TITLED_WINDOW, + : BWindow(BRect(0, 0, 500, 300), "About This System", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE) { AboutView *view = new AboutView(Bounds()); AddChild(view); - + // start reading from the app query BMessage msg(READ_APP_QUERY_ENT); BMessenger msgr(view); @@ -238,18 +238,16 @@ stringView->ResizeToPreferred(); // GCC version +#ifdef __GNUC__ != 2 r.OffsetBy(0, textHeight); r.bottom = r.top + textHeight; - - strlcpy(string, "Compiler version: ", sizeof(string)); -#ifdef __GNUC__ - strlcat(string, "GCC ", sizeof(string)); -#endif - strlcat(string, __VERSION__, sizeof(string)); + snprintf(string, sizeof(string), "GCC %d", __GNUC__); + stringView = new BStringView(r, "gcctext", string); fInfoView->AddChild(stringView); stringView->ResizeToPreferred(); +#endif // CPU count, type and clock speed r.OffsetBy(0, textHeight * 1.5); @@ -266,7 +264,7 @@ stringView->ResizeToPreferred(); BString cpuType; - cpuType << get_cpu_vendor_string(systemInfo.cpu_type) + cpuType << get_cpu_vendor_string(systemInfo.cpu_type) << " " << get_cpu_model_string(&systemInfo); r.OffsetBy(0, labelHeight); @@ -337,7 +335,7 @@ // string width changes, so we don't do ResizeToPreferred() fUptimeView->SetText(UptimeToString(string, sizeof(string))); - + // Begin construction of the credits view r = Bounds(); r.left += fInfoView->Bounds().right + 1; @@ -563,96 +561,96 @@ "http://www.netbsd.org"); // FFMpeg copyrights - AddCopyrightEntry("FFMpeg libavcodec", - "Copyright " B_UTF8_COPYRIGHT " 2000-2007 Fabrice Bellard, et al.", + AddCopyrightEntry("FFMpeg libavcodec", + "Copyright " B_UTF8_COPYRIGHT " 2000-2007 Fabrice Bellard, et al.", "http://www.ffmpeg.org"); // AGG copyrights - AddCopyrightEntry("AntiGrain Geometry", - "Copyright " B_UTF8_COPYRIGHT " 2002-2006 Maxim Shemanarev (McSeem).", + AddCopyrightEntry("AntiGrain Geometry", + "Copyright " B_UTF8_COPYRIGHT " 2002-2006 Maxim Shemanarev (McSeem).", "http://www.antigrain.com"); // PDFLib copyrights - AddCopyrightEntry("PDFLib", + AddCopyrightEntry("PDFLib", "Copyright " B_UTF8_COPYRIGHT " 1997-2006 PDFlib GmbH and Thomas Merz. " "All rights reserved.\n" - "PDFlib and PDFlib logo are registered trademarks of PDFlib GmbH.", + "PDFlib and PDFlib logo are registered trademarks of PDFlib GmbH.", "http://www.pdflib.com"); // FreeType copyrights - AddCopyrightEntry("FreeType2", + AddCopyrightEntry("FreeType2", "Portions of this software are copyright " B_UTF8_COPYRIGHT " 1996-2006 " - "The FreeType Project. All rights reserved.", + "The FreeType Project. All rights reserved.", "http://www.freetype.org"); // Mesa3D (http://www.mesa3d.org) copyrights - AddCopyrightEntry("Mesa", + AddCopyrightEntry("Mesa", "Copyright " B_UTF8_COPYRIGHT " 1999-2006 Brian Paul. " - "Mesa3D project. All rights reserved.", + "Mesa3D project. All rights reserved.", "http://www.mesa3d.org"); // SGI's GLU implementation copyrights - AddCopyrightEntry("GLU", + AddCopyrightEntry("GLU", "Copyright " B_UTF8_COPYRIGHT " 1991-2000 Silicon Graphics, Inc. " "SGI's Software FreeB license. All rights reserved."); // GLUT implementation copyrights - AddCopyrightEntry("GLUT", + AddCopyrightEntry("GLUT", "Copyright " B_UTF8_COPYRIGHT " 1994-1997 Mark Kilgard. " "All rights reserved.\n" "Copyright " B_UTF8_COPYRIGHT " 1997 Be Inc.\n" "Copyright " B_UTF8_COPYRIGHT " 1999 Jake Hamby."); // OpenGroup & DEC (BRegion backend) copyright - AddCopyrightEntry("BRegion backend (XFree86)", + AddCopyrightEntry("BRegion backend (XFree86)", "Copyright " B_UTF8_COPYRIGHT " 1987, 1988, 1998 The Open Group.\n" "Copyright " B_UTF8_COPYRIGHT " 1987, 1988 Digital Equipment " "Corporation, Maynard, Massachusetts.\n" "All rights reserved."); // Konatu font - AddCopyrightEntry("Konatu font", + AddCopyrightEntry("Konatu font", "Copyright " B_UTF8_COPYRIGHT " 2002- MASUDA mitiya.\n" "MIT license. All rights reserved."); // expat copyrights - AddCopyrightEntry("expat", + AddCopyrightEntry("expat", "Copyright " B_UTF8_COPYRIGHT " 1998, 1999, 2000 Thai Open Source " "Software Center Ltd and Clark Cooper.\n" "Copyright " B_UTF8_COPYRIGHT " 2001, 2002, 2003 Expat maintainers."); // zlib copyrights - AddCopyrightEntry("zlib", + AddCopyrightEntry("zlib", "Copyright " B_UTF8_COPYRIGHT " 1995-2004 Jean-loup Gailly and Mark " "Adler."); // zip copyrights - AddCopyrightEntry("Info-ZIP", + AddCopyrightEntry("Info-ZIP", "Copyright " B_UTF8_COPYRIGHT " 1990-2002 Info-ZIP. All rights reserved."); // bzip2 copyrights - AddCopyrightEntry("bzip2", + AddCopyrightEntry("bzip2", "Copyright " B_UTF8_COPYRIGHT " 1996-2005 Julian R Seward. All rights " "reserved."); // VIM copyrights - AddCopyrightEntry("Vi IMproved", + AddCopyrightEntry("Vi IMproved", "Copyright " B_UTF8_COPYRIGHT " Bram Moolenaar et al."); // lp_solve copyrights - AddCopyrightEntry("lp_solve", + AddCopyrightEntry("lp_solve", "Copyright " B_UTF8_COPYRIGHT " Michel Berkelaar, Kjell Eikland, Peter Notebaert", "http://lpsolve.sourceforge.net/"); // license: LGPL // OpenEXR copyrights - AddCopyrightEntry("OpenEXR", + AddCopyrightEntry("OpenEXR", "Copyright " B_UTF8_COPYRIGHT " 2002-2005 Industrial Light & Magic, " "a division of Lucas Digital Ltd. LLC."); - + // Bullet copyrights - AddCopyrightEntry("Bullet", + AddCopyrightEntry("Bullet", "Copyright " B_UTF8_COPYRIGHT " 2003-2008 Erwin Coumans", "http://www.bulletphysics.com"); @@ -660,7 +658,7 @@ AddCopyrightEntry("atftp", "Copyright " B_UTF8_COPYRIGHT " 2000 Jean-Pierre Lefebvre and Remi " "Lefebvre"); - + // Netcat copyrights AddCopyrightEntry("Netcat", "Copyright " B_UTF8_COPYRIGHT " 1996 Hobbit"); @@ -721,7 +719,7 @@ // The Tcpdump Group AddCopyrightEntry("The Tcpdump Group", "tcpdump, libpcap", - "http://www.tcpdump.org"); + "http://www.tcpdump.org"); // Matroska AddCopyrightEntry("libmatroska", @@ -733,14 +731,14 @@ // AddCopyrightEntry("OpenSound", // "Copyright " B_UTF8_COPYRIGHT " 1996-2008 4Front Technologies ", // "http://www.opensound.com"); -// BSD license +// BSD license _AddCopyrightsFromAttribute(); - // Build a list of installed applications and show their + // Build a list of installed applications and show their // long version info. Well-behaved apps usually give // copyright info there. - + font.SetSize(be_bold_font->Size() + 4); font.SetFace(B_BOLD_FACE); fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen); @@ -780,7 +778,7 @@ printf("Easter Egg\n"); PickRandomHaiku(); } - + if (Bounds().Contains(pt)) { fLastActionTime = system_time(); delete fScrollRunner; @@ -812,10 +810,10 @@ { char string[255]; system_info info; - get_system_info(&info); + get_system_info(&info); fUptimeView->SetText(UptimeToString(string, sizeof(string))); fMemView->SetText(MemUsageToString(string, sizeof(string), &info)); - + if (fScrollRunner == NULL && (system_time() > fLastActionTime + 10000000)) { BMessage message(SCROLL_CREDITS_VIEW); //fScrollRunner = new BMessageRunner(this, &message, 300000, -1); @@ -836,10 +834,10 @@ scrollBar->GetRange(&min, &max); if (scrollBar->Value() < max) fCreditsView->ScrollBy(0, 5); - + break; } - + case READ_APP_QUERY_ENT: { BEntry ent; @@ -850,7 +848,7 @@ } BFile file; BPath path; - if (ent.Exists() && + if (ent.Exists() && ent.GetPath(&path) >= B_OK && file.SetTo(&ent, B_READ_ONLY) >= B_OK) { /* filter only apps */ @@ -858,8 +856,8 @@ BAppFileInfo appFileInfo(&file); uint32 flags; version_info version; - if (appFileInfo.InitCheck() >= B_OK && - appFileInfo.GetAppFlags(&flags) >= B_OK && + if (appFileInfo.InitCheck() >= B_OK && + appFileInfo.GetAppFlags(&flags) >= B_OK && appFileInfo.GetVersionInfo(&version, B_APP_VERSION_KIND) >= B_OK) { //printf("AppFileInfo for %s :\n", path.Path()); @@ -867,7 +865,7 @@ BString name; BString info; name << path.Leaf(); - if (strlen(version.short_info) && + if (strlen(version.short_info) && strcmp(version.short_info, path.Leaf())) name << " (" << version.short_info << ")"; /* @@ -885,7 +883,7 @@ */ info << version.long_info; AddCopyrightEntry(name.String(), info.String()); - + } } } @@ -894,7 +892,7 @@ BMessenger(this).SendMessage(&m); break; } - + default: BView::MessageReceived(msg); break; @@ -1121,11 +1119,11 @@ static const char * MemUsageToString(char string[], size_t size, system_info *info) { - snprintf(string, size, "%d MB total, %d MB used (%d%%)", + snprintf(string, size, "%d MB total, %d MB used (%d%%)", int(info->max_pages / 256.0f + 0.5f), int(info->used_pages / 256.0f + 0.5f), int(100 * info->used_pages / info->max_pages)); - + return string; } @@ -1154,20 +1152,20 @@ if (hours) { str += snprintf(str, size - strlen(string), "%s%lld hour%s", str != string ? ", " : "", - hours, hours > 1 ? "s" : ""); + hours, hours > 1 ? "s" : ""); } if (minutes) { str += snprintf(str, size - strlen(string), "%s%lld minute%s", str != string ? ", " : "", - minutes, minutes > 1 ? "s" : ""); + minutes, minutes > 1 ? "s" : ""); } - + if (seconds || str == string) { // Haiku would be well-known to boot very fast. - // Let's be ready to handle below minute uptime, zero second included ;-) + // Let's be ready to handle below minute uptime, zero second included ;-) str += snprintf(str, size - strlen(string), "%s%lld second%s", str != string ? ", " : "", - seconds, seconds > 1 ? "s" : ""); + seconds, seconds > 1 ? "s" : ""); } return string; From axeld at mail.berlios.de Tue Jun 17 18:04:25 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 17 Jun 2008 18:04:25 +0200 Subject: [Haiku-commits] r25995 - haiku/trunk/src/add-ons/kernel/network/protocols/icmp Message-ID: <200806171604.m5HG4PVN013070@sheep.berlios.de> Author: axeld Date: 2008-06-17 18:04:24 +0200 (Tue, 17 Jun 2008) New Revision: 25995 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25995&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/protocols/icmp/icmp.cpp Log: * Applied patch by Jan Kl?\195?\182tzke that prevents the ICMP module to answer broadcast ping requests, and those before an interface is configured. * Added comment that explains the consequences. Modified: haiku/trunk/src/add-ons/kernel/network/protocols/icmp/icmp.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/icmp/icmp.cpp 2008-06-17 14:25:46 UTC (rev 25994) +++ haiku/trunk/src/add-ons/kernel/network/protocols/icmp/icmp.cpp 2008-06-17 16:04:24 UTC (rev 25995) @@ -251,10 +251,17 @@ case ICMP_TYPE_ECHO_REQUEST: { net_domain *domain; - if (buffer->interface != NULL) + if (buffer->interface != NULL) { domain = buffer->interface->domain; - else + + // We only reply to echo requests of our local interface; we + // don't reply to broadcast requests + if (!domain->address_module->equal_addresses( + buffer->interface->address, buffer->destination)) + break; + } else domain = sStackModule->get_domain(buffer->source->sa_family); + if (domain == NULL || domain->module == NULL) break; From mmu_man at mail.berlios.de Tue Jun 17 18:32:52 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 17 Jun 2008 18:32:52 +0200 Subject: [Haiku-commits] r25996 - in haiku/trunk/src/add-ons/input_server/methods: . t9 Message-ID: <200806171632.m5HGWqbl018649@sheep.berlios.de> Author: mmu_man Date: 2008-06-17 18:32:42 +0200 (Tue, 17 Jun 2008) New Revision: 25996 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25996&view=rev Added: haiku/trunk/src/add-ons/input_server/methods/t9/ haiku/trunk/src/add-ons/input_server/methods/t9/DictionaryInputServerMethod.cpp haiku/trunk/src/add-ons/input_server/methods/t9/DictionaryInputServerMethod.h haiku/trunk/src/add-ons/input_server/methods/t9/T9Icon.h haiku/trunk/src/add-ons/input_server/methods/t9/T9InputServerMethod.cpp haiku/trunk/src/add-ons/input_server/methods/t9/_APP_ haiku/trunk/src/add-ons/input_server/methods/t9/makefile haiku/trunk/src/add-ons/input_server/methods/t9/test_t9_mode_word.txt Log: The code for a T9 input method, quite empty yet. WIP. Added: haiku/trunk/src/add-ons/input_server/methods/t9/DictionaryInputServerMethod.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/t9/DictionaryInputServerMethod.cpp 2008-06-17 16:04:24 UTC (rev 25995) +++ haiku/trunk/src/add-ons/input_server/methods/t9/DictionaryInputServerMethod.cpp 2008-06-17 16:32:42 UTC (rev 25996) @@ -0,0 +1,204 @@ +/* + Copyright 2005, Francois Revol. All Rights Reserved. + This file may be used under the terms of the Be Sample Code License. +*/ + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +#include <Debug.h> +#include <List.h> +#include <Message.h> +#include <OS.h> + +#include <Application.h> +#include <Alert.h> +#include <Menu.h> +#include <MenuItem.h> +#include <Handler.h> +#include <Locker.h> +#include <Autolock.h> + + +#include <add-ons/input_server/InputServerMethod.h> + +#ifndef _T +#define _T(s) s +#endif + +#include "T9Icon.h" + +extern "C" _EXPORT BInputServerMethod* instantiate_input_method(); + +enum T9Mode { + WordMode, + CharMode, + NumMode +}; + + +// modes: =Abc / Abc / 123 +// flags: Abc / ABC / abc + +class T9InputServerMethod : public BInputServerMethod, public BHandler +{ +public: + T9InputServerMethod(); + virtual ~T9InputServerMethod(); + virtual filter_result Filter(BMessage *message, BList *outList); + virtual status_t MethodActivated(bool active); + virtual void MessageReceived(BMessage *message); + + bool IsEnabled() const { return fEnabled; }; + T9Mode Mode() const { return fMode; }; + void SetMode(T9Mode mode); +private: + bool fEnabled; + T9Mode fMode; + BMenu *fDeskbarMenu; + BLocker fLocker; + BString fTyped; /* what has been typed so far for the current word */ +}; + + + + +BInputServerMethod* instantiate_input_method() +{ + PRINT(("%s\n", __FUNCTION__)); + return (new T9InputServerMethod()); +} + + +T9InputServerMethod::T9InputServerMethod() + : BInputServerMethod("T9", T9IconData), + BHandler("T9IMHandler"), + fEnabled(false), + fMode(WordMode), + fDeskbarMenu(NULL), + fLocker("T9IM") +{ + PRINT(("%s\n", __FUNCTION__)); + + if (be_app) { + be_app->Lock(); + be_app->AddHandler(this); + be_app->Unlock(); + } + + // + fDeskbarMenu = new BMenu(_T("Mode")); + + + BMessage *msg = new BMessage('SetM'); + msg->AddInt32("t9mode", WordMode); + BMenuItem *item; + item = new BMenuItem(_T("Word Mode"), msg); + item->SetMarked(true); + fDeskbarMenu->AddItem(item); + msg = new BMessage('SetM'); + msg->AddInt32("t9mode", CharMode); + item = new BMenuItem(_T("Character Mode"), msg); + fDeskbarMenu->AddItem(item); + msg = new BMessage('SetM'); + msg->AddInt32("t9mode", NumMode); + item = new BMenuItem(_T("Numeric Mode"), msg); + fDeskbarMenu->AddItem(item); + fDeskbarMenu->SetFont(be_plain_font); + // doesn't seem to work here + //fDeskbarMenu->SetRadioMode(true); + //fDeskbarMenu->SetLabelFromMarked(true); + + SetMenu(fDeskbarMenu, BMessenger(this)); +} + +T9InputServerMethod::~T9InputServerMethod() +{ + PRINT(("%s\n", __FUNCTION__)); + SetMenu(NULL, BMessenger()); + delete fDeskbarMenu; + if (be_app) { + be_app->Lock(); + be_app->RemoveHandler(this); + be_app->Unlock(); + } +} + +filter_result T9InputServerMethod::Filter(BMessage *message, BList *outList) +{ + status_t err; + filter_result res = B_DISPATCH_MESSAGE; + bool keyUp = false; + BString bytes; + + if (!IsEnabled()) + return B_DISPATCH_MESSAGE; + + switch (message->what) { + case B_KEY_UP: + keyUp = true; + case B_KEY_DOWN: + if (message->FindString("bytes", &bytes) < B_OK) + break; + if (bytes.Length() == 1) { + BAutolock l(fLocker); + + if (fMode == NumMode) + break; + } + break; + default: + break; + } + + return (res); +} + +status_t T9InputServerMethod::MethodActivated(bool active) +{ + fEnabled = active; + return BInputServerMethod::MethodActivated(active); +} + +void T9InputServerMethod::MessageReceived(BMessage *message) +{ + int32 v; + switch (message->what) { + case 'SetM': + if (message->FindInt32("t9mode", &v) < B_OK) + break; + SetMode((T9Mode)v); + + /*{ + BString s; + s << v; + s << " - "; + s << (long) fDeskbarMenu->FindMarked(); + s << " - "; + s << (long) fDeskbarMenu->ItemAt(v); + BAlert *a = new BAlert("Plop", s.String(), "Ok"); + a->Go(NULL); + }*/ + break; + default: + BHandler::MessageReceived(message); + break; + } +} + +void T9InputServerMethod::SetMode(T9Mode mode) +{ + BAutolock l(fLocker); + BMenuItem *item; + // XXX: check + fMode = mode; + item = fDeskbarMenu->FindMarked(); + if (item) + item->SetMarked(false); + item = fDeskbarMenu->ItemAt((int32)mode); + if (item) + item->SetMarked(true); + // necessary to update the copy used by the Deskbar icon. + SetMenu(fDeskbarMenu, BMessenger(this)); +} Added: haiku/trunk/src/add-ons/input_server/methods/t9/DictionaryInputServerMethod.h =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/t9/DictionaryInputServerMethod.h 2008-06-17 16:04:24 UTC (rev 25995) +++ haiku/trunk/src/add-ons/input_server/methods/t9/DictionaryInputServerMethod.h 2008-06-17 16:32:42 UTC (rev 25996) @@ -0,0 +1,42 @@ +/* + Copyright 2005, Francois Revol. All Rights Reserved. + This file may be used under the terms of the Be Sample Code License. +*/ +#ifndef _DICTIONARY_INPUT_SERVER_METHOD_H +#define _DICTIONARY_INPUT_SERVER_METHOD_H + +#include <OS.h> +#include <Messenger.h> +#include <add-ons/input_server/InputServerMethod.h> + +#if DEBUG +//#include <File.h> +class BAlert; +#endif +class BList; +class BMessage; +class DictionaryInputLooper; + + +class DictionaryInputServerMethod : public BInputServerMethod +{ +public: + DictionaryInputServerMethod(); + virtual ~DictionaryInputServerMethod(); + virtual status_t InitCheck(); + virtual filter_result Filter(BMessage *message, BList *outList); + virtual status_t MethodActivated(bool active); + + bool IsEnabled() const { return fEnabled; }; + +private: + bool fEnabled; + //BLocker fLocker; + BMessenger fLooper; +#if DEBUG + //BFile fDebugFile; + BAlert *fDebugAlert; +#endif +}; + +#endif /* _DICTIONARY_INPUT_SERVER_METHOD_H */ Added: haiku/trunk/src/add-ons/input_server/methods/t9/T9Icon.h =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/t9/T9Icon.h 2008-06-17 16:04:24 UTC (rev 25995) +++ haiku/trunk/src/add-ons/input_server/methods/t9/T9Icon.h 2008-06-17 16:32:42 UTC (rev 25996) @@ -0,0 +1,20 @@ +// will need better, stippi ? +// should have icons showing modes (word/char/num + caps) +const uchar T9IconData[] = { +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF, +0xFF,0x00,0x3F,0x3F,0x3F,0x3F,0x3F,0x00,0x00,0x3F,0x3F,0x3F,0x00,0xFF,0xFF,0xFF, +0xFF,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x3F,0x00,0x3F,0x00,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0x00,0x3F,0x00,0xFF,0xFF,0x00,0x3F,0x3F,0x3F,0x00,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0x00,0x3F,0x00,0xFF,0xFF,0x00,0x00,0x00,0x3F,0x00,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0x00,0x3F,0x00,0xFF,0xFF,0x00,0x3F,0x3F,0x3F,0x00,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; + Added: haiku/trunk/src/add-ons/input_server/methods/t9/T9InputServerMethod.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/t9/T9InputServerMethod.cpp 2008-06-17 16:04:24 UTC (rev 25995) +++ haiku/trunk/src/add-ons/input_server/methods/t9/T9InputServerMethod.cpp 2008-06-17 16:32:42 UTC (rev 25996) @@ -0,0 +1,204 @@ +/* + Copyright 2005, Francois Revol. All Rights Reserved. + This file may be used under the terms of the Be Sample Code License. +*/ + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +#include <Debug.h> +#include <List.h> +#include <Message.h> +#include <OS.h> + +#include <Application.h> +#include <Alert.h> +#include <Menu.h> +#include <MenuItem.h> +#include <Handler.h> +#include <Locker.h> +#include <Autolock.h> + + +#include <add-ons/input_server/InputServerMethod.h> + +#ifndef _T +#define _T(s) s +#endif + +#include "T9Icon.h" + +extern "C" _EXPORT BInputServerMethod* instantiate_input_method(); + +enum T9Mode { + WordMode, + CharMode, + NumMode +}; + + +// modes: =Abc / Abc / 123 +// flags: Abc / ABC / abc + +class T9InputServerMethod : public BInputServerMethod, public BHandler +{ +public: + T9InputServerMethod(); + virtual ~T9InputServerMethod(); + virtual filter_result Filter(BMessage *message, BList *outList); + virtual status_t MethodActivated(bool active); + virtual void MessageReceived(BMessage *message); + + bool IsEnabled() const { return fEnabled; }; + T9Mode Mode() const { return fMode; }; + void SetMode(T9Mode mode); +private: + bool fEnabled; + T9Mode fMode; + BMenu *fDeskbarMenu; + BLocker fLocker; + BString fTyped; /* what has been typed so far for the current word */ +}; + + + + +BInputServerMethod* instantiate_input_method() +{ + PRINT(("%s\n", __FUNCTION__)); + return (new T9InputServerMethod()); +} + + +T9InputServerMethod::T9InputServerMethod() + : BInputServerMethod("T9", T9IconData), + BHandler("T9IMHandler"), + fEnabled(false), + fMode(WordMode), + fDeskbarMenu(NULL), + fLocker("T9IM") +{ + PRINT(("%s\n", __FUNCTION__)); + + if (be_app) { + be_app->Lock(); + be_app->AddHandler(this); + be_app->Unlock(); + } + + // + fDeskbarMenu = new BMenu(_T("Mode")); + + + BMessage *msg = new BMessage('SetM'); + msg->AddInt32("t9mode", WordMode); + BMenuItem *item; + item = new BMenuItem(_T("Word Mode"), msg); + item->SetMarked(true); + fDeskbarMenu->AddItem(item); + msg = new BMessage('SetM'); + msg->AddInt32("t9mode", CharMode); + item = new BMenuItem(_T("Character Mode"), msg); + fDeskbarMenu->AddItem(item); + msg = new BMessage('SetM'); + msg->AddInt32("t9mode", NumMode); + item = new BMenuItem(_T("Numeric Mode"), msg); + fDeskbarMenu->AddItem(item); + fDeskbarMenu->SetFont(be_plain_font); + // doesn't seem to work here + //fDeskbarMenu->SetRadioMode(true); + //fDeskbarMenu->SetLabelFromMarked(true); + + SetMenu(fDeskbarMenu, BMessenger(this)); +} + +T9InputServerMethod::~T9InputServerMethod() +{ + PRINT(("%s\n", __FUNCTION__)); + SetMenu(NULL, BMessenger()); + delete fDeskbarMenu; + if (be_app) { + be_app->Lock(); + be_app->RemoveHandler(this); + be_app->Unlock(); + } +} + +filter_result T9InputServerMethod::Filter(BMessage *message, BList *outList) +{ + status_t err; + filter_result res = B_DISPATCH_MESSAGE; + bool keyUp = false; + BString bytes; + + if (!IsEnabled()) + return B_DISPATCH_MESSAGE; + + switch (message->what) { + case B_KEY_UP: + keyUp = true; + case B_KEY_DOWN: + if (message->FindString("bytes", &bytes) < B_OK) + break; + if (bytes.Length() == 1) { + BAutolock l(fLocker); + + if (fMode == NumMode) + break; + } + break; + default: + break; + } + + return (res); +} + +status_t T9InputServerMethod::MethodActivated(bool active) +{ + fEnabled = active; + return BInputServerMethod::MethodActivated(active); +} + +void T9InputServerMethod::MessageReceived(BMessage *message) +{ + int32 v; + switch (message->what) { + case 'SetM': + if (message->FindInt32("t9mode", &v) < B_OK) + break; + SetMode((T9Mode)v); + + /*{ + BString s; + s << v; + s << " - "; + s << (long) fDeskbarMenu->FindMarked(); + s << " - "; + s << (long) fDeskbarMenu->ItemAt(v); + BAlert *a = new BAlert("Plop", s.String(), "Ok"); + a->Go(NULL); + }*/ + break; + default: + BHandler::MessageReceived(message); + break; + } +} + +void T9InputServerMethod::SetMode(T9Mode mode) +{ + BAutolock l(fLocker); + BMenuItem *item; + // XXX: check + fMode = mode; + item = fDeskbarMenu->FindMarked(); + if (item) + item->SetMarked(false); + item = fDeskbarMenu->ItemAt((int32)mode); + if (item) + item->SetMarked(true); + // necessary to update the copy used by the Deskbar icon. + SetMenu(fDeskbarMenu, BMessenger(this)); +} Added: haiku/trunk/src/add-ons/input_server/methods/t9/_APP_ =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/t9/_APP_ 2008-06-17 16:04:24 UTC (rev 25995) +++ haiku/trunk/src/add-ons/input_server/methods/t9/_APP_ 2008-06-17 16:32:42 UTC (rev 25996) @@ -0,0 +1 @@ +link /system/servers/input_server \ No newline at end of file Property changes on: haiku/trunk/src/add-ons/input_server/methods/t9/_APP_ ___________________________________________________________________ Name: svn:special + * Added: haiku/trunk/src/add-ons/input_server/methods/t9/makefile =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/t9/makefile 2008-06-17 16:04:24 UTC (rev 25995) +++ haiku/trunk/src/add-ons/input_server/methods/t9/makefile 2008-06-17 16:32:42 UTC (rev 25996) @@ -0,0 +1,187 @@ +## ********************************* ## +## Zeta Generic Makefile v3.0 ## + +## Fill in this file to specify the project being created, and the referenced +## makefile-engine will do all of the hard work for you. + +## Application Specific Settings --------------------------------------------- + +# specify the name of the binary +NAME := T9 + +# specify the type of binary +# APP: Application +# SHARED: Shared library or add-on +# STATIC: Static library archive +# DRIVER: Kernel Driver +# MODULE: Kernel Module +# DECOR: A window decorator project +TYPE := SHARED + +# add support for new Pe and Eddie features +# to fill in generic makefile + +#%{ +# @src->@ + +# specify the source files to use +# full paths or paths relative to the makefile can be included +# all files, regardless of directory, will have their object +# files created in the common object directory. +# Note that this means this makefile will not work correctly +# if two source files with the same name (source.c or source.cpp) +# are included from different directories. Also note that spaces +# in folder names do not work well with this makefile. +SRCS := T9InputServerMethod.cpp + +# specify the resource files to use +# full path or a relative path to the resource file can be used. +RSRCS := + +# Specify your RDEF files, if any. +RDEFS := + +# @<-src@ +#%} + +# end support for Pe and Eddie + +# specify additional libraries to link against +# there are two acceptable forms of library specifications +# - if your library follows the naming pattern of: +# libXXX.so or libXXX.a you can simply specify XXX +# library: libbe.so entry: be +# +# - if your library does not follow the standard library +# naming scheme you need to specify the path to the library +# and it's name +# library: my_lib.a entry: my_lib.a or path/my_lib.a +LIBS := _APP_ be + +# specify additional paths to directories following the standard +# libXXX.so or libXXX.a naming scheme. You can specify full paths +# or paths relative to the makefile. The paths included may not +# be recursive, so include all of the paths where libraries can +# be found. Directories where source files are found are +# automatically included. +LIBPATHS := + +# additional paths to look for system headers +# thes use the form: #include <header> +# source file directories are NOT auto-included here +SYSTEM_INCLUDE_PATHS := + +# additional paths to look for local headers +# thes use the form: #include "header" +# source file directories are automatically included +LOCAL_INCLUDE_PATHS := + +# specify the level of optimization that you desire +# NONE, SOME, FULL +OPTIMIZE := + +# specify any preprocessor symbols to be defined. The symbols will not +# have their values set automatically; you must supply the value (if any) +# to use. For example, setting DEFINES to "DEBUG=1" will cause the +# compiler option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG" +# would pass "-DDEBUG" on the compiler's command line. +DEFINES := + +# specify special warning levels +# if unspecified default warnings will be used +# NONE = supress all warnings +# ALL = enable all warnings +WARNINGS := + +# specify whether image symbols will be created +# so that stack crawls in the debugger are meaningful +# if TRUE symbols will be created +SYMBOLS := + +# specify debug settings +# if TRUE will allow application to be run from a source-level +# debugger. Note that this will disable all optimzation. +DEBUGGER := + +# specify additional compiler flags for all files +COMPILER_FLAGS := + +# specify additional linker flags +LINKER_FLAGS := + +# specify the version of this particular item +# (for example, -app 3 4 0 d 0 -short 340 -long "340 "`echo -n -e '\302\251'`"1999 GNU GPL") +#E This may also be specified in a resource. +APP_VERSION := + +# (for TYPE == DRIVER only) Specify desired location of driver in the /dev +# hierarchy. Used by the driverinstall rule. E.g., DRIVER_PATH = video/usb will +# instruct the driverinstall rule to place a symlink to your driver's binary in +# ~/add-ons/kernel/drivers/dev/video/usb, so that your driver will appear at +# /dev/video/usb when loaded. Default is "misc". +DRIVER_PATH := + +# Specify if you want the object files to be somewhere besides the default location. +OBJ_DIR := + +# Specify a non default placement for the target +TARGET_DIR := + +# Specify a directory for the 'install' target. +INSTALL_DIR := + +# Specify the name of this makefile. +# If you leave this blank, the makefile will not be considered as part of the +# dependenies for the project, and the project will not be rebuilt when the makefile +# is changed +MAKEFILE := + +# Specify TRUE if you want the install target to create links in the BeMenu +MENU_LINKS := + +# Related to MENU_LINKS, specify the name of the direcotry in the BeMenu +# you wish the link to go in. If the directory does not exist, it will be +# created. +APP_MENU := + +# If, for some reason, you don't want to use the dependencies (flex and yacc seem to choke +# on them), set this to false +DODEPS := + +# Set this variable if you have an svg text file you wish to use as your targets +# icon. +SVG_ICON := + +# If you have some fancy custom build steps to do, specify them here +EXTRA_BUILD_STEPS = + +# If you have some other files that should trigger a re-link, such as libs in the same +# project that may get rebuilt, specify the full path to them here. +EXTRA_DEPS := + +########################################################################################### +# The following variables are commented out here because the can be very useful to just +# set at the command line or in the env at time of compiling, allowing you to leave your +# makefile the same, but change the build types easily. + + +# If you wish to have the program output a profiling session file which can be read by bprof, +# set this to 'true' +#BUILD_PROFILE := + +# If you wish to have a debug build, +# set this to 'true' +#BUILD_DEBUG := + +# If you wish to have a build which can do memory checking when MALLOC_DEBUG=15 is set, +# set this to 'true' +#CHECK_MEM := + +# If you want to see the complete build line for every file, then set this to 'true', +# otherwise it will tell you at the end what the build flags were. +#CHATTY := + + + +## include the makefile-engine +include $(BUILDHOME)/etc/makefile-engine Added: haiku/trunk/src/add-ons/input_server/methods/t9/test_t9_mode_word.txt =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/t9/test_t9_mode_word.txt 2008-06-17 16:04:24 UTC (rev 25995) +++ haiku/trunk/src/add-ons/input_server/methods/t9/test_t9_mode_word.txt 2008-06-17 16:32:42 UTC (rev 25996) @@ -0,0 +1,22 @@ +test of possible UTF-8 glyphs usable to notify T9 mode like is done on phones (usually "123", "abc", "Abc", "ABC", and the same with some dots on the left implying speed for dictionary modes). +It's probably simpler to use icons anyway. +//Abc +???Abc +???Abc +???Abc +???Abc +???Abc +???Abc +???Abc +???Abc +???Abc +???Abc +???Abc +=Abc +#Abc +"Abc +'Abc +*Abc +??Abc +.:Abc +??Abc From mmu_man at mail.berlios.de Tue Jun 17 18:36:57 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 17 Jun 2008 18:36:57 +0200 Subject: [Haiku-commits] r25997 - in haiku/trunk/src/add-ons/input_server/methods: . pen pen/compat Message-ID: <200806171636.m5HGavGr025187@sheep.berlios.de> Author: mmu_man Date: 2008-06-17 18:36:54 +0200 (Tue, 17 Jun 2008) New Revision: 25997 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25997&view=rev Added: haiku/trunk/src/add-ons/input_server/methods/pen/ haiku/trunk/src/add-ons/input_server/methods/pen/DumpMessage.cpp haiku/trunk/src/add-ons/input_server/methods/pen/DumpMessage.h haiku/trunk/src/add-ons/input_server/methods/pen/PenIcon.h haiku/trunk/src/add-ons/input_server/methods/pen/PenInputBackend.cpp haiku/trunk/src/add-ons/input_server/methods/pen/PenInputBackend.h haiku/trunk/src/add-ons/input_server/methods/pen/PenInputInkWindow.cpp haiku/trunk/src/add-ons/input_server/methods/pen/PenInputInkWindow.h haiku/trunk/src/add-ons/input_server/methods/pen/PenInputLooper.cpp haiku/trunk/src/add-ons/input_server/methods/pen/PenInputLooper.h haiku/trunk/src/add-ons/input_server/methods/pen/PenInputServerMethod.cpp haiku/trunk/src/add-ons/input_server/methods/pen/PenInputServerMethod.h haiku/trunk/src/add-ons/input_server/methods/pen/PenInputStrings.h haiku/trunk/src/add-ons/input_server/methods/pen/RestartInputServer.sh haiku/trunk/src/add-ons/input_server/methods/pen/_APP_ haiku/trunk/src/add-ons/input_server/methods/pen/compat/ haiku/trunk/src/add-ons/input_server/methods/pen/compat/StringIO.cpp haiku/trunk/src/add-ons/input_server/methods/pen/compat/StringIO.h haiku/trunk/src/add-ons/input_server/methods/pen/makefile Log: The code for an handwriting input method front-end, currently doesn't do much more than draw the strokes over the screen. The idea is to have a base backend class that will be used to call several backends like Lipi Toolkit or others. WIP. Added: haiku/trunk/src/add-ons/input_server/methods/pen/DumpMessage.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/pen/DumpMessage.cpp 2008-06-17 16:32:42 UTC (rev 25996) +++ haiku/trunk/src/add-ons/input_server/methods/pen/DumpMessage.cpp 2008-06-17 16:36:54 UTC (rev 25997) @@ -0,0 +1,256 @@ +#include <string.h> +#include <stdio.h> +#include <ctype.h> +#include <BeBuild.h> +#include <Font.h> +#include <Message.h> +#include <String.h> +#include "DumpMessage.h" + +//#define WHAT_ALWAYS_HEX 1 + +const char *msg_header_comment = "// new BMessage\n"; // avoids mime to think it's a .bmp ("BM") + +// '_' also widely used in what codes +inline int myisprint(int c) +{ + if (isalnum(c)) + return 1; + return (c == '_')?1:0; +} + +status_t HexDumpToStream(const void *data, size_t len, BDataIO &stream, const char *prefix = NULL) +{ + const unsigned char *p = (unsigned char *)data; + char buffer[100]; + size_t i, j; + for (i=0; i<len; i+=16) { + if (prefix) stream.Write(prefix, strlen(prefix)); + sprintf(buffer, "0x%06lx: ", i); + stream.Write(buffer, strlen(buffer)); + for (j=0; j<16; j++) { + if (i+j < len) + sprintf(buffer, "%02x", p[i+j]); + else + sprintf(buffer, " "); + if (j % 4 == 3) + sprintf(buffer+strlen(buffer), " "); + stream.Write(buffer, strlen(buffer)); + } + sprintf(buffer, " '"); + stream.Write(buffer, strlen(buffer)); + for (j=0; j<16; j++) { + if (i+j >= len) + sprintf(buffer, " "); + //else if (p[i+j] < 255 && p[i+j] >= 0x20) + else if (isalpha(p[i+j])) + sprintf(buffer, "%c", p[i+j]); + else + sprintf(buffer, "."); + stream.Write(buffer, 1); + } + sprintf(buffer, "'\n"); + stream.Write(buffer, strlen(buffer)); + } + return B_OK; +} + +/* look up human readable names from an other BMessage */ +bool LookUpFieldName(const char **name, const char *field_name, BMessage *names) +{ + if (names == NULL) + return false; + if (names->FindString(field_name, name) == B_OK) + return true; + return false; +} + +status_t DumpMessageToStream(BMessage *message, BDataIO &stream, int tabCount, BMessage *names) +{ + int32 index; + void *cookie = NULL; + const char *field_name; + type_code field_code; + int32 field_count; + char buffer[80]; + char tabs[20]; + const char *easy_name; + + if (message == NULL) + return EINVAL; + + if (tabCount < 1) + stream.Write(msg_header_comment, strlen(msg_header_comment)); + + memset(tabs, '\t', (++tabCount) + 1); + tabs[tabCount+1] = '\0'; + //tabCount; + +#ifndef WHAT_ALWAYS_HEX + if ( myisprint(message->what & 0x0ff) && + myisprint((message->what >> 8) & 0x0ff) && + myisprint((message->what >> 16) & 0x0ff) && + myisprint((message->what >> 24) & 0x0ff)) + sprintf(buffer, "BMessage('%c%c%c%c') {\n", + (char)(message->what >> 24) & 0x0ff, + (char)(message->what >> 16) & 0x0ff, + (char)(message->what >> 8) & 0x0ff, + (char)message->what & 0x0ff); + else +#endif + sprintf(buffer, "BMessage(0x%08lx) {\n", message->what); +// stream.Write(tabs+2, tabCount-2); + stream.Write(buffer, strlen(buffer)); + +#ifdef B_BEOS_VERSION_DANO + while (message->GetNextName(&cookie, + &field_name, + &field_code, + &field_count) == B_OK) { +#else +#warning mem leak likely! (name=char *) + for (int which=0; message->GetInfo(B_ANY_TYPE, which, + (char **)&field_name, &field_code, &field_count) == B_OK; which++) { +#endif + if (LookUpFieldName(&easy_name, field_name, names)) { + stream.Write(tabs+1, tabCount); + stream.Write("// ", 3); + stream.Write(easy_name, strlen(easy_name)); + stream.Write("\n", 1); + } + + for (index=0; index < field_count; index++) { + stream.Write(tabs+1, tabCount); + stream.Write(field_name, strlen(field_name)); + if (field_count > 1) { + sprintf(buffer, "[%ld]", index); + stream.Write(buffer, strlen(buffer)); + } + stream.Write(" = ", 3); + + switch (field_code) { + case 'MSGG': + { + BMessage m; + if (message->FindMessage(field_name, index, &m) >= B_OK) + DumpMessageToStream(&m, stream, tabCount, names); + } + break; +#ifdef B_BEOS_VERSION_DANO + case 'FONt': + { + BFont f; + if (message->FindFlat(field_name, index, &f) >= B_OK) + stream << f; + stream.Write("\n", 1); + } + break; + case B_RGB_COLOR_TYPE: + { + rgb_color c; + if (message->FindRGBColor(field_name, index, &c) >= B_OK) { + sprintf(buffer, "rgb_color(%d,%d,%d,%d)", + c.red, c.green, c.blue, c.alpha); + stream.Write(buffer, strlen(buffer)); + } + stream.Write("\n", 1); + } + break; +#else +#warning IMPLEMENT ME +#endif + case B_BOOL_TYPE: + { + bool value; + if (message->FindBool(field_name, index, &value) >= B_OK) { + sprintf(buffer, "bool(%s)", value?"true":"false"); + stream.Write(buffer, strlen(buffer)); + } + stream.Write("\n", 1); + } + break; + case B_INT32_TYPE: + { + int32 value; + if (message->FindInt32(field_name, index, &value) >= B_OK) { +#if 1 + if (value == 0) + sprintf(buffer, "int32(0 or (nil))"); + else +#endif +// sprintf(buffer, "int32(%d)", value); + sprintf(buffer, "int32(%ld or 0x%lx)", value, value); + stream.Write(buffer, strlen(buffer)); + } + stream.Write("\n", 1); + } + break; + case B_FLOAT_TYPE: + { + float value; + if (message->FindFloat(field_name, index, &value) >= B_OK) { + sprintf(buffer, "float(%f)", value); + stream.Write(buffer, strlen(buffer)); + } + stream.Write("\n", 1); + } + break; + case B_STRING_TYPE: + { + const char *value; + if (message->FindString(field_name, index, &value) >= B_OK) { + BString str(value); + str.CharacterEscape("\\\"\n", '\\'); + //sprintf(buffer, "string(\"%s\", %ld bytes)", str.String(), strlen(value)); + // DO NOT use buffer! + str.Prepend("string(\""); + str << "\", " << strlen(value) << " bytes)"; + stream.Write(str.String(), strlen(str.String())); + } + stream.Write("\n", 1); + } + break; + case B_POINT_TYPE: + { + BPoint value; + if (message->FindPoint(field_name, index, &value) >= B_OK) { + sprintf(buffer, "BPoint(%1.1f, %1.1f)", value.x, value.y); + stream.Write(buffer, strlen(buffer)); + } + stream.Write("\n", 1); + } + break; + default: + { + const void *data; + ssize_t numBytes = 0; + if (message->FindData(field_name, field_code, index, &data, &numBytes) != B_OK) { + //stream.Write("\n", 1); + break; + } + + if ( isalnum(field_code & 0x0ff) && + isalnum((field_code >> 8) & 0x0ff) && + isalnum((field_code >> 16) & 0x0ff) && + isalnum((field_code >> 24) & 0x0ff)) + sprintf(buffer, "'%c%c%c%c' %ld bytes:\n", + (char)(field_code >> 24) & 0x0ff, + (char)(field_code >> 16) & 0x0ff, + (char)(field_code >> 8) & 0x0ff, + (char)field_code & 0x0ff, + numBytes); + else + sprintf(buffer, "0x%08lx %ld bytes:\n", field_code, numBytes); + stream.Write(buffer, strlen(buffer)); + stream.Write("\n", 1); + HexDumpToStream(data, numBytes, stream, tabs); + } + break; + } + } + } + stream.Write(tabs+2, tabCount-1); + stream.Write("}\n", 2); + return B_OK; +} + Added: haiku/trunk/src/add-ons/input_server/methods/pen/DumpMessage.h =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/pen/DumpMessage.h 2008-06-17 16:32:42 UTC (rev 25996) +++ haiku/trunk/src/add-ons/input_server/methods/pen/DumpMessage.h 2008-06-17 16:36:54 UTC (rev 25997) @@ -0,0 +1,10 @@ +#ifndef _DUMP_MESSAGE_H +#define _DUMP_MESSAGE_H + +class BMessage; +class BDataIO; + +status_t DumpMessageToStream(BMessage *message, BDataIO &stream, int tabCount = 0, BMessage *names = NULL); + +#endif /* _DUMP_MESSAGE_H */ + Added: haiku/trunk/src/add-ons/input_server/methods/pen/PenIcon.h =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/pen/PenIcon.h 2008-06-17 16:32:42 UTC (rev 25996) +++ haiku/trunk/src/add-ons/input_server/methods/pen/PenIcon.h 2008-06-17 16:36:54 UTC (rev 25997) @@ -0,0 +1,21 @@ +// will need better, stippi ? +// should have icons showing modes (word/char/num + caps) +const uchar PenIconData[] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x4b, 0x4b, 0x4b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x4b, 0x4b, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x4b, 0x4b, 0x00, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x4b, 0xff, 0xff, 0xff, 0xff, 0x00, 0x4b, 0x4b, 0x4b, 0x00, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x4b, 0xff, 0xff, 0xff, 0x00, 0x4b, 0x4b, 0x4b, 0x00, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x4b, 0x4b, 0xff, 0xff, 0x00, 0x4b, 0x4b, 0x4b, 0x00, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x4b, 0x4b, 0x4b, 0xff, 0xff, 0x00, 0x4b, 0x4b, 0x4b, 0x00, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x4b, 0xff, 0xff, 0xff, 0x00, 0x4b, 0x4b, 0x4b, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x4b, 0x4b, 0xff, 0xff, 0x00, 0x4b, 0x4b, 0x4b, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x4b, 0x4b, 0xff, 0xff, 0x00, 0x4b, 0x4b, 0x4b, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x4b, 0xff, 0xff, 0x00, 0x4b, 0x4b, 0x4b, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x4b, 0xff, 0xff, 0x00, 0x4b, 0x4b, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x4b, 0x4b, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x4b, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +}; + Added: haiku/trunk/src/add-ons/input_server/methods/pen/PenInputBackend.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/pen/PenInputBackend.cpp 2008-06-17 16:32:42 UTC (rev 25996) +++ haiku/trunk/src/add-ons/input_server/methods/pen/PenInputBackend.cpp 2008-06-17 16:36:54 UTC (rev 25997) @@ -0,0 +1,15 @@ +#include <OS.h> +#include "PenInputBackend.h" + + +PenInputBackend::PenInputBackend(const char *name) + : BHandler(name) +{ +} + +PenInputBackend::~PenInputBackend() +{ +} + + + Added: haiku/trunk/src/add-ons/input_server/methods/pen/PenInputBackend.h =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/pen/PenInputBackend.h 2008-06-17 16:32:42 UTC (rev 25996) +++ haiku/trunk/src/add-ons/input_server/methods/pen/PenInputBackend.h 2008-06-17 16:36:54 UTC (rev 25997) @@ -0,0 +1,19 @@ +#ifndef _PEN_INPUT_BACKEND_H +#define _PEN_INPUT_BACKEND_H + +#include <Handler.h> + + +class PenInputBackend : public BHandler { +protected: + PenInputBackend(const char *name); + virtual ~PenInputBackend(); + +public: + status_t InitCheck() const { return fInitStatus; }; + +private: + status_t fInitStatus; +}; + +#endif /* _PEN_INPUT_BACKEND_H */ Added: haiku/trunk/src/add-ons/input_server/methods/pen/PenInputInkWindow.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/pen/PenInputInkWindow.cpp 2008-06-17 16:32:42 UTC (rev 25996) +++ haiku/trunk/src/add-ons/input_server/methods/pen/PenInputInkWindow.cpp 2008-06-17 16:36:54 UTC (rev 25997) @@ -0,0 +1,126 @@ +/* + Copyright 2007, Francois Revol. All Rights Reserved. + This file may be used under the terms of the Be Sample Code License. +*/ + +#include <OS.h> +#include <Debug.h> +#include <View.h> + +#if DEBUG +//#include <File.h> +#include <Alert.h> +#include <Button.h> +#include <TextView.h> +#include <StringIO.h> +#include "DumpMessage.h" +#endif + +#include "PenInputInkWindow.h" +#include "PenInputLooper.h" +#include "PenInputStrings.h" + +const rgb_color kInkColor = { 100, 100, 255, 0 }; + +class PenInputInkView : public BView { +public: + PenInputInkView(BRect frame, PenInputInkWindow *window); + virtual ~PenInputInkView(); + virtual void Draw(BRect udpateRect); +private: + PenInputInkWindow *fWindow; +}; + +PenInputInkView::PenInputInkView(BRect frame, PenInputInkWindow *window) + : BView(frame, "PenInkView", B_FOLLOW_ALL, B_WILL_DRAW), + fWindow(window) +{ + +} + +PenInputInkView::~PenInputInkView() +{ +} +void PenInputInkView::Draw(BRect udpateRect) +{ + /* ugh ? */ + if (!fWindow) + return; + + StrokeShape(&fWindow->fStrokes); + //DEBUG:StrokeRect(fWindow->fStrokes.Bounds()); +} + + + +PenInputInkWindow::PenInputInkWindow(BRect frame) + : BWindow(frame, "PenInputInkWindow", + B_NO_BORDER_WINDOW_LOOK, + B_FLOATING_ALL_WINDOW_FEEL, + B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | + B_NOT_MINIMIZABLE | B_NOT_RESIZABLE | B_AVOID_FOCUS, + B_ALL_WORKSPACES), + fStrokeCount(0) +{ + PRINT(("%s\n", __FUNCTION__)); + fInkView = new PenInputInkView(Bounds(), this); + fInkView->SetViewColor(B_TRANSPARENT_32_BIT); + fInkView->SetLowColor(B_TRANSPARENT_32_BIT); + //fInkView->SetHighColor(0,255,0); + fInkView->SetHighColor(kInkColor); + fInkView->SetPenSize(2.0); + AddChild(fInkView); +} + +PenInputInkWindow::~PenInputInkWindow() +{ + PRINT(("%s\n", __FUNCTION__)); +} + +void PenInputInkWindow::MessageReceived(BMessage *message) +{ + BPoint where; + switch (message->what) { + case MSG_BEGIN_INK: + fStrokeCount = 0; + fStrokes.Clear(); + // fall through + case MSG_SHOW_WIN: + if (IsHidden()) + Show(); + break; + case MSG_END_INK: + case MSG_HIDE_WIN: + if (!IsHidden()) + Hide(); + break; + case B_MOUSE_MOVED: + if (message->FindPoint("where", &where) == B_OK) { + fStrokes.LineTo(where); + fStrokeCount++; + //fInkView->Invalidate(fStrokes.Bounds()); // XXX + fInkView->Invalidate(Bounds()); // XXX + } + break; + case B_MOUSE_UP: + if (message->FindPoint("where", &where) == B_OK) { + fStrokes.LineTo(where); + fStrokeCount++; + //fInkView->Invalidate(fStrokes.Bounds()); // XXX + fInkView->Invalidate(Bounds()); // XXX + } + break; + case B_MOUSE_DOWN: + if (message->FindPoint("where", &where) == B_OK) { + fStrokes.MoveTo(where); + //fStrokeCount++; + //fInkView->Invalidate(fStrokes.Bounds()); // XXX + fInkView->Invalidate(Bounds()); // XXX + } + break; + default: + BWindow::MessageReceived(message); + return; + } +} + Added: haiku/trunk/src/add-ons/input_server/methods/pen/PenInputInkWindow.h =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/pen/PenInputInkWindow.h 2008-06-17 16:32:42 UTC (rev 25996) +++ haiku/trunk/src/add-ons/input_server/methods/pen/PenInputInkWindow.h 2008-06-17 16:36:54 UTC (rev 25997) @@ -0,0 +1,26 @@ +/* + Copyright 2005, Francois Revol. All Rights Reserved. + This file may be used under the terms of the Be Sample Code License. +*/ + +#include <Window.h> +#include <Shape.h> + +class PenInputInkView; + +class PenInputInkWindow : public BWindow +{ +public: + PenInputInkWindow(BRect frame); + virtual ~PenInputInkWindow(); + void MessageReceived(BMessage *message); + +private: + friend class PenInputInkView; + friend class PenInputLooper;//DEBUG + void ClearStrokes(); + PenInputInkView *fInkView; + BShape fStrokes; + int32 fStrokeCount; +}; + Added: haiku/trunk/src/add-ons/input_server/methods/pen/PenInputLooper.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/pen/PenInputLooper.cpp 2008-06-17 16:32:42 UTC (rev 25996) +++ haiku/trunk/src/add-ons/input_server/methods/pen/PenInputLooper.cpp 2008-06-17 16:36:54 UTC (rev 25997) @@ -0,0 +1,255 @@ +/* + Copyright 2007, Francois Revol. All Rights Reserved. + This file may be used under the terms of the Be Sample Code License. +*/ + +#define DEBUG 1 + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +#include <Debug.h> +#include <List.h> +#include <Message.h> +#include <OS.h> + +#include <Application.h> +#include <Menu.h> +#include <MenuItem.h> +#include <MessageRunner.h> +#include <Region.h> +#include <Screen.h> + +#if DEBUG +//#include <File.h> +#include <Alert.h> +#include <Button.h> +#include <TextView.h> +#include <StringIO.h> +#include "DumpMessage.h" +#endif + +#include "PenInputLooper.h" +#include "PenInputBackend.h" +#include "PenInputInkWindow.h" +#include "PenInputServerMethod.h" +#include "PenInputStrings.h" + +PenInputLooper::PenInputLooper(PenInputServerMethod *method) + : BLooper("PenInputLooper", B_NORMAL_PRIORITY), + fOwner(method), + fInkWindow(NULL), + fBackend(NULL), + fDeskbarMenu(NULL), + fMouseDown(false), + fStroking(false), + fThresholdRunner(NULL), + fCachedMouseDown(NULL), + fShowInk(true), + fMouseDownThreshold(100000) +{ + PRINT(("%s\n", __FUNCTION__)); + + // + fDeskbarMenu = new BMenu(_T("Options")); + BMenu *subMenu; + + + subMenu = new BMenu(_T("Backend")); + + BMessage *msg; + msg = new BMessage(MSG_SET_BACKEND); + BMenuItem *item; + // for (i = 0; i < fBackends.CountItems(); i++) ... + item = new BMenuItem(_T("Default"), msg); + item->SetMarked(true); + subMenu->AddItem(item); + + item = new BMenuItem(subMenu); + fDeskbarMenu->AddItem(item); + + msg = new BMessage(MSG_SHOW_INK); + item = new BMenuItem(_T("Show Ink"), msg); + item->SetMarked(true); + fDeskbarMenu->AddItem(item); + + fDeskbarMenu->SetFont(be_plain_font); + fOwner->SetMenu(fDeskbarMenu, BMessenger(NULL, this)); + +#if 0 + BRegion region; + fOwner->GetScreenRegion(®ion); + fInkWindow = new PenInputInkWindow(region.Frame()); +#endif + BScreen screen; + fInkWindow = new PenInputInkWindow(screen.Frame()); + fInkWindow->Show(); + fInkWindow->Lock(); + fInkWindow->Hide(); + fInkWindow->Unlock(); + fInkWindowMsgr = BMessenger(NULL, fInkWindow); + + BMessage m(MSG_CHECK_PEN_DOWN); + fThresholdRunner = new BMessageRunner(BMessenger(NULL, this), &m, fMouseDownThreshold, 0); + + Run(); +} + +void PenInputLooper::Quit() +{ + PRINT(("%s\n", __FUNCTION__)); + delete fThresholdRunner; + fInkWindow->Lock(); + fInkWindow->Quit(); + fOwner->SetMenu(NULL, BMessenger()); + delete fDeskbarMenu; + BLooper::Quit(); +} + + +void PenInputLooper::DispatchMessage(BMessage *message, BHandler *handler) +{ + switch (message->what) { +#if 0 + case B_MOUSE_MOVED: + case B_MOUSE_DOWN: + case B_MOUSE_UP: + + case B_INPUT_METHOD_EVENT: + //case B_REPLY: + if (fBackend) { + fBackend->MessageReceived(message); + return; + } +#endif + default: + return BLooper::DispatchMessage(message, handler); + } +} + +void PenInputLooper::MessageReceived(BMessage *message) +{ + int32 v; + int32 buttons; + bool b; +#if 1 + { + //message->Flatten(&fDebugFile); + BStringIO sio; + DumpMessageToStream(message, sio); + fInkWindow->Lock(); + sio << BString("StrokesCount: "); + BString tmp; + tmp << fInkWindow->fStrokeCount; + sio << tmp; + sio << BString("\nStrokes.Bounds: "); + sio << (fInkWindow->fStrokes.Bounds()); + sio << BString("\n"); + fInkWindow->Unlock(); + fOwner->fDebugAlert->Lock(); + fOwner->fDebugAlert->TextView()->Insert("Looper:\n"); + fOwner->fDebugAlert->TextView()->Insert(sio.String()); + fOwner->fDebugAlert->Unlock(); + } +#endif + switch (message->what) { + case MSG_CHECK_PEN_DOWN: + if (fCachedMouseDown) { + /* nothing happened, we want to move the mouse */ + EnqueueMessage(fCachedMouseDown); + fCachedMouseDown = NULL; + } + break; + case B_MOUSE_MOVED: + if (!fMouseDown) { /* definitely not writing */ + /* pass it along */ + EnqueueMessage(DetachCurrentMessage()); + break; + } + if (fShowInk) { + BMessage *msg = new BMessage(*message); + fInkWindowMsgr.SendMessage(msg); + } + if (fBackend) + fBackend->MessageReceived(message); + else + EnqueueMessage(DetachCurrentMessage()); + break; + case B_MOUSE_DOWN: + if (message->FindInt32("buttons", &buttons) == B_OK) { + if (!(buttons & B_PRIMARY_MOUSE_BUTTON)) { + /* pass it along */ + EnqueueMessage(DetachCurrentMessage()); + break; + } + } + fMouseDown = true; + if (fShowInk) { + { + BMessage *msg = new BMessage(MSG_BEGIN_INK); + fInkWindowMsgr.SendMessage(msg); + } + BMessage *msg = new BMessage(*message); + fInkWindowMsgr.SendMessage(msg); + } + if (fBackend) + fBackend->MessageReceived(message); + break; + case B_MOUSE_UP: + if (message->FindInt32("buttons", &buttons) == B_OK) { + if (!fMouseDown || (buttons & B_PRIMARY_MOUSE_BUTTON)) { + /* pass it along */ + EnqueueMessage(DetachCurrentMessage()); + break; + } + } + fMouseDown = false; + if (fShowInk) { + BMessage *msg = new BMessage(*message); + fInkWindowMsgr.SendMessage(msg); + { + BMessage *msg = new BMessage(MSG_END_INK); + fInkWindowMsgr.SendMessage(msg); + } + } + if (fBackend) + fBackend->MessageReceived(message); + break; + case B_INPUT_METHOD_EVENT: + if (fBackend) + fBackend->MessageReceived(message); + break; + case MSG_METHOD_ACTIVATED: + if (message->FindBool(MSGF_ACTIVE, &b) < B_OK) + b = false; + HandleMethodActivated(b); + break; + case B_REPLY: + + default: + BLooper::MessageReceived(message); + break; + } +} + +void PenInputLooper::EnqueueMessage(BMessage *message) +{ + fOwner->EnqueueMessage(message); +} + +status_t PenInputLooper::InitCheck() +{ + return B_OK; +} + +void PenInputLooper::HandleMethodActivated(bool active) +{ +/* + if (fShowInk && active) + fInkWindowMsgr.SendMessage(MSG_SHOW_WIN); + if (fShowInk && !active) + fInkWindowMsgr.SendMessage(MSG_END_INK); +*/ +} + Added: haiku/trunk/src/add-ons/input_server/methods/pen/PenInputLooper.h =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/pen/PenInputLooper.h 2008-06-17 16:32:42 UTC (rev 25996) +++ haiku/trunk/src/add-ons/input_server/methods/pen/PenInputLooper.h 2008-06-17 16:36:54 UTC (rev 25997) @@ -0,0 +1,69 @@ +/* + Copyright 2007, Francois Revol. All Rights Reserved. + This file may be used under the terms of the Be Sample Code License. +*/ +#ifndef _PEN_INPUT_LOOPER_H +#define _PEN_INPUT_LOOPER_H + +#include <MessageRunner.h> +#include <Messenger.h> +#include <Looper.h> + +/* internal messages */ + +#define MSG_METHOD_ACTIVATED 'IMAc' +#define MSGF_ACTIVE "active" /* bool */ + +#define MSG_BEGIN_INK 'InkB' +#define MSG_END_INK 'InkE' + +#define MSG_SHOW_WIN 'ShoW' +#define MSG_HIDE_WIN 'HidW' + +#define MSG_CHECK_PEN_DOWN 'ChkP' + +/* menu messages */ + +#define MSG_SET_BACKEND 'SetB' +#define MSGF_BACKEND "backend" /* string */ + +#define MSG_SHOW_INK 'InkS' /* toggle */ + + +class BMenu; +class BWindow; +class PenInputServerMethod; +class PenInputInkWindow; +class PenInputBackend; + +class PenInputLooper : public BLooper +{ +public: + PenInputLooper(PenInputServerMethod *method); + virtual void Quit(); + void DispatchMessage(BMessage *message, BHandler *handler); + void MessageReceived(BMessage *message); + void EnqueueMessage(BMessage *message); + status_t InitCheck(); + +// virtual ~PenInputLooper(); + void MethodActivated(bool active); + +private: + friend class PenInputInkWindow; + void HandleMethodActivated(bool active); + PenInputServerMethod *fOwner; + PenInputInkWindow *fInkWindow; + PenInputBackend *fBackend; + BMenu *fDeskbarMenu; + BMessenger fInkWindowMsgr; + bool fMouseDown; + bool fStroking; + BMessageRunner *fThresholdRunner; + BMessage *fCachedMouseDown; + /* config */ + bool fShowInk; + bigtime_t fMouseDownThreshold; +}; + +#endif /* _PEN_INPUT_LOOPER_H */ Added: haiku/trunk/src/add-ons/input_server/methods/pen/PenInputServerMethod.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/pen/PenInputServerMethod.cpp 2008-06-17 16:32:42 UTC (rev 25996) +++ haiku/trunk/src/add-ons/input_server/methods/pen/PenInputServerMethod.cpp 2008-06-17 16:36:54 UTC (rev 25997) @@ -0,0 +1,217 @@ +/* + Copyright 2007, Francois Revol. All Rights Reserved. + This file may be used under the terms of the Be Sample Code License. +*/ + +//#define DEBUG 1 + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +#include <Debug.h> +#include <List.h> +#include <Message.h> +#include <OS.h> + +#include <Application.h> +#include <Menu.h> +#include <MenuItem.h> +#include <Region.h> + +#if DEBUG +//#include <File.h> +#include <Alert.h> +#include <Button.h> +#include <TextView.h> +#include <StringIO.h> +#include "DumpMessage.h" +#endif + +#include <add-ons/input_server/InputServerDevice.h> +#include <add-ons/input_server/InputServerMethod.h> + +#include "PenIcon.h" + +#include "PenInputServerMethod.h" +#include "PenInputLooper.h" +#include "PenInputStrings.h" + +BInputServerMethod* instantiate_input_method() +{ + PRINT(("%s\n", __FUNCTION__)); + return (new PenInputServerMethod()); +} + + +PenInputServerMethod::PenInputServerMethod() + : BInputServerMethod("Pen", PenIconData), + fEnabled(false) +{ + PRINT(("%s\n", __FUNCTION__)); +#if DEBUG + //fDebugFile.SetTo("/tmp/PenInputMethodMessages.txt", B_READ_WRITE|B_CREATE_FILE); + fDebugAlert = new BAlert("PenInput Debug", "Plip \n\n\n\n\n\n\n\n\n\n\n\n\n", "Ok"); + fDebugAlert->SetLook(B_TITLED_WINDOW_LOOK); + fDebugAlert->TextView()->MakeSelectable(); + fDebugAlert->TextView()->SelectAll(); + fDebugAlert->TextView()->Delete(); + fDebugAlert->ButtonAt(0)->SetEnabled(false); + BRegion r; + GetScreenRegion(&r); + BString s; + s << r.CountRects() << " rects\n"; + fDebugAlert->TextView()->Insert(s.String()); + fDebugAlert->Go(NULL); + + +#endif +} + +PenInputServerMethod::~PenInputServerMethod() +{ + PRINT(("%s\n", __FUNCTION__)); + SetMenu(NULL, BMessenger()); +#if DEBUG + fDebugAlert->Lock(); + fDebugAlert->Quit(); +#endif + BLooper *looper = NULL; + fLooper.Target(&looper); + if (looper != NULL) + { + if (looper->Lock()) + looper->Quit(); + } +} + +status_t PenInputServerMethod::InitCheck() +{ + PenInputLooper *looper; + status_t err; + PRINT(("%s\n", __FUNCTION__)); + looper = new PenInputLooper(this); + looper->Lock(); + err = looper->InitCheck(); + looper->Unlock(); + fLooper = BMessenger(NULL, looper); + return err; +} + + +filter_result PenInputServerMethod::Filter(BMessage *message, BList *outList) +{ + status_t err; + filter_result res = B_DISPATCH_MESSAGE; + + if (!IsEnabled()) + return B_DISPATCH_MESSAGE; + + +#if 0//DEBUG + //message->Flatten(&fDebugFile); + BStringIO sio; + DumpMessageToStream(message, sio); + fDebugAlert->Lock(); + fDebugAlert->TextView()->Insert(sio.String()); + fDebugAlert->Unlock(); +#endif + switch (message->what) { + case B_KEY_UP: + case B_KEY_DOWN: + case B_UNMAPPED_KEY_UP: + case B_UNMAPPED_KEY_DOWN: + case B_MODIFIERS_CHANGED: + case B_MOUSE_WHEEL_CHANGED: + return B_DISPATCH_MESSAGE; + default: + //case B_MOUSE_MOVED: + fLooper.SendMessage(message); + return B_SKIP_MESSAGE; + } + + +#if 0 + if (message->what == B_MOUSE_MOVED) { + BMessage *mDown = new BMessage(B_KEY_DOWN); + BMessage *mUp; + char states[16]; + mDown->AddInt32("modifiers", 0x0); + mDown->AddInt32("key", 94); + mDown->AddInt32("raw_char", 32); + mDown->AddData("states", 'UBYT', states, sizeof(states)); + mDown->AddString("bytes", " "); + mDown->AddData("byte", 'BYTE', " ", 1); [... truncated: 535 lines follow ...] From mmu_man at mail.berlios.de Tue Jun 17 18:45:21 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 17 Jun 2008 18:45:21 +0200 Subject: [Haiku-commits] r25998 - in haiku/trunk/src/add-ons/input_server/methods: . t9 Message-ID: <200806171645.m5HGjLKs002836@sheep.berlios.de> Author: mmu_man Date: 2008-06-17 18:45:20 +0200 (Tue, 17 Jun 2008) New Revision: 25998 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25998&view=rev Added: haiku/trunk/src/add-ons/input_server/methods/t9/Jamfile Modified: haiku/trunk/src/add-ons/input_server/methods/Jamfile haiku/trunk/src/add-ons/input_server/methods/t9/T9InputServerMethod.cpp Log: - Add jamfile, - fix warning. Note T9 could still be of use on the desktop, for ex by disabled people with enough mobility to access a numeric keypad... Modified: haiku/trunk/src/add-ons/input_server/methods/Jamfile =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/Jamfile 2008-06-17 16:36:54 UTC (rev 25997) +++ haiku/trunk/src/add-ons/input_server/methods/Jamfile 2008-06-17 16:45:20 UTC (rev 25998) @@ -1,3 +1,4 @@ SubDir HAIKU_TOP src add-ons input_server methods ; SubInclude HAIKU_TOP src add-ons input_server methods canna ; +SubInclude HAIKU_TOP src add-ons input_server methods t9 ; Added: haiku/trunk/src/add-ons/input_server/methods/t9/Jamfile =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/t9/Jamfile 2008-06-17 16:36:54 UTC (rev 25997) +++ haiku/trunk/src/add-ons/input_server/methods/t9/Jamfile 2008-06-17 16:45:20 UTC (rev 25998) @@ -0,0 +1,17 @@ +SubDir HAIKU_TOP src add-ons input_server methods t9 ; + +SetSubDirSupportedPlatformsBeOSCompatible ; + +UsePrivateHeaders interface ; + +SubDirSysHdrs $(SUBDIR) ; +SubDirHdrs [ FDirName $(SUBDIR) t9 ] ; + +if $(TARGET_PLATFORM) != haiku { + SubDirC++Flags -fmultiple-symbol-spaces ; +} + +Addon t9 : + T9InputServerMethod.cpp + : be textencoding input_server ; + Modified: haiku/trunk/src/add-ons/input_server/methods/t9/T9InputServerMethod.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/t9/T9InputServerMethod.cpp 2008-06-17 16:36:54 UTC (rev 25997) +++ haiku/trunk/src/add-ons/input_server/methods/t9/T9InputServerMethod.cpp 2008-06-17 16:45:20 UTC (rev 25998) @@ -127,7 +127,7 @@ filter_result T9InputServerMethod::Filter(BMessage *message, BList *outList) { - status_t err; + //status_t err; filter_result res = B_DISPATCH_MESSAGE; bool keyUp = false; BString bytes; From emitrax at gmail.com Tue Jun 17 18:47:15 2008 From: emitrax at gmail.com (Salvatore Benedetto) Date: Tue, 17 Jun 2008 16:47:15 +0000 Subject: [Haiku-commits] r25997 - in haiku/trunk/src/add-ons/input_server/methods: . pen pen/compat In-Reply-To: <200806171636.m5HGavGr025187@sheep.berlios.de> References: <200806171636.m5HGavGr025187@sheep.berlios.de> Message-ID: <b6b105e70806170947s70218a0p6f8472745dc64a98@mail.gmail.com> I shouldn't comment about the style programming error, but I'm just wondering how many beers do you plan to buy at next BeGeistert after this commit? :-) > + for (i=0; i<len; i+=16) { Space between operators. > +#ifndef WHAT_ALWAYS_HEX > + if ( myisprint(message->what & 0x0ff) && No space after the ( ... and many others. ;-) Regards -- Salvatore Benedetto (a.k.a. emitrax) Student of Computer Engineer University of Pisa www.haiku-os.it From kaoutsis at sch.gr Tue Jun 17 20:17:23 2008 From: kaoutsis at sch.gr (kaoutsis) Date: Tue, 17 Jun 2008 21:17:23 +0300 Subject: [Haiku-commits] r25994 - haiku/trunk/src/apps/aboutsystem In-Reply-To: <200806171425.m5HEPkhP002527@sheep.berlios.de> References: <200806171425.m5HEPkhP002527@sheep.berlios.de> Message-ID: <4857FFB3.8040407@sch.gr> Hi Axel, axeld at BerliOS wrote: > Author: axeld > Date: 2008-06-17 16:25:46 +0200 (Tue, 17 Jun 2008) > New Revision: 25994 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25994&view=rev > > Modified: > haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp > i got this warning: src/apps/aboutsystem/AboutSystem.cpp:241: warning: garbage at end of `#ifdef' argument which i eliminated this way: see attached AboutSystem.cpp.diff goodbye, Vasilis -------------- next part -------------- A non-text attachment was scrubbed... Name: AboutSystem.cpp.diff Type: text/x-diff Size: 407 bytes Desc: not available URL: <https://lists.berlios.de/pipermail/haiku-commits/attachments/20080617/ab9672ca/attachment.diff> From rudolfc at mail.berlios.de Tue Jun 17 21:16:54 2008 From: rudolfc at mail.berlios.de (rudolfc at mail.berlios.de) Date: Tue, 17 Jun 2008 21:16:54 +0200 Subject: [Haiku-commits] r25999 - in haiku/trunk: headers/private/graphics/nvidia_gpgpu src/add-ons/accelerants/nvidia_gpgpu src/add-ons/accelerants/nvidia_gpgpu/engine Message-ID: <200806171916.m5HJGs7M018559@sheep.berlios.de> Author: rudolfc Date: 2008-06-17 21:16:40 +0200 (Tue, 17 Jun 2008) New Revision: 25999 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25999&view=rev Removed: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/Overlay.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_bes.c Modified: haiku/trunk/headers/private/graphics/nvidia_gpgpu/DriverInterface.h haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/Cursor.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/GetAccelerantHook.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/InitAccelerant.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/Jamfile haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/ProposeDisplayMode.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/SetDisplayMode.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/Jamfile haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_acc_dma.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_crtc.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_dac.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_dac2.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_general.c haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_info.c Log: removed all pre-NV40refs, removed all overlay code (no info on the current engine known). Driver cleanup mostly done now I hope. Modified: haiku/trunk/headers/private/graphics/nvidia_gpgpu/DriverInterface.h =================================================================== --- haiku/trunk/headers/private/graphics/nvidia_gpgpu/DriverInterface.h 2008-06-17 16:45:20 UTC (rev 25998) +++ haiku/trunk/headers/private/graphics/nvidia_gpgpu/DriverInterface.h 2008-06-17 19:16:40 UTC (rev 25999) @@ -73,16 +73,7 @@ /* card_type in order of date of NV chip design */ enum { - NV20, - NV25, - NV28, - NV30, - NV31, - NV34, - NV35, - NV36, - NV38, - NV40, + NV40 = 0, NV41, NV43, NV44, @@ -98,11 +89,7 @@ /* card_arch in order of date of NV chip design */ enum { - NV04A = 0, - NV10A, - NV20A, - NV30A, - NV40A, + NV40A = 0, NV50A }; @@ -124,28 +111,13 @@ */ //#define NV3_GDI_RECTANGLE_TEXT 0x00000012 /* 2D */ #define NV4_GDI_RECTANGLE_TEXT 0x00000012 /* 2D */ -#define NV4_CONTEXT_SURFACES_ARGB_ZS 0x00000013 /* 3D */ -#define NV10_CONTEXT_SURFACES_ARGB_ZS 0x00000013 /* 3D */ -#define NV4_DX5_TEXTURE_TRIANGLE 0x00000014 /* 3D */ -#define NV10_DX5_TEXTURE_TRIANGLE 0x00000014 /* 3D */ -#define NV4_DX6_MULTI_TEXTURE_TRIANGLE 0x00000015 /* unused (yet?) */ -#define NV10_DX6_MULTI_TEXTURE_TRIANGLE 0x00000015 /* unused (yet?) */ #define NV1_RENDER_SOLID_LIN 0x00000016 /* 2D: unused */ -/* max. number of overlay buffers */ -#define MAXBUFFERS 3 - //----------------------------------------------------------------------------------- /* safety byte-offset from end of cardRAM for preventing acceleration engine crashes * caused by the existance of DMA engine command buffers in cardRAM and/or fifo * channel engine command re-assigning on-the-fly */ -/* pre-NV40 notes: - * - we need at least 70kB distance from the end of RAM for fifo-reassigning 'bug' - * (confirmed on a TNT1); - * - keep extra failsafe room to prevent malfunctioning apps from crashing engine. */ -#define PRE_NV40_OFFSET 80 * 1024 - /* NV40 and higher notes: * - we need at least 416kB distance from the DMA command buffer: * If you get too close to the DMA command buffer on NV40 and NV43 at least (both @@ -346,22 +318,6 @@ /* some configuration settings from ~/config/settings/kernel/drivers/nv.settings if exists */ nv_settings settings; - struct - { - overlay_buffer myBuffer[MAXBUFFERS];/* scaler input buffers */ - int_buf_info myBufInfo[MAXBUFFERS]; /* extra info on scaler input buffers */ - overlay_token myToken; /* scaler is free/in use */ - benaphore lock; /* for creating buffers and aquiring overlay unit routines */ - bool crtc; /* location of overlay unit */ - /* variables needed for virtualscreens (move_overlay()): */ - bool active; /* true is overlay currently in use */ - overlay_window ow; /* current position of overlay output window */ - overlay_buffer ob; /* current inputbuffer in use */ - overlay_view my_ov; /* current corrected view in inputbuffer */ - uint32 h_ifactor; /* current 'unclipped' horizontal inverse scaling factor */ - uint32 v_ifactor; /* current 'unclipped' vertical inverse scaling factor */ - } overlay; - } shared_info; /* Read or write a value in PCI configuration space */ Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/Cursor.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/Cursor.c 2008-06-17 16:45:20 UTC (rev 25998) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/Cursor.c 2008-06-17 19:16:40 UTC (rev 25999) @@ -4,7 +4,7 @@ Other authors: Mark Watson, - Rudolf Cornelissen 4/2003-5/2004 + Rudolf Cornelissen 4/2003-6/2008 */ #define MODULE_BIT 0x20000000 @@ -96,7 +96,6 @@ if ((hds!=si->dm.h_display_start) || (vds!=si->dm.v_display_start)) { MOVE_DISPLAY(hds,vds); - nv_bes_move_overlay(); } /* put cursor in correct physical position, so stay onscreen (rel. to CRTC) */ Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/GetAccelerantHook.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/GetAccelerantHook.c 2008-06-17 16:45:20 UTC (rev 25998) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/GetAccelerantHook.c 2008-06-17 19:16:40 UTC (rev 25999) @@ -24,8 +24,6 @@ /* These definitions are out of pure lazyness. */ -#define CHKO(x) case B_##x: \ - if (check_overlay_capability(B_##x) == B_OK) return (void *)x; else return (void *)0 #define CHKA(x) case B_##x: \ if (check_acc_capability(B_##x) == B_OK) \ return (void *)x##_DMA; \ @@ -93,16 +91,7 @@ Note: These hooks are re-acquired by the app_server after each mode switch. */ - /* only export video overlay functions if card is capable of it */ - //CHKO(OVERLAY_COUNT); - //CHKO(OVERLAY_SUPPORTED_SPACES); - //CHKO(OVERLAY_SUPPORTED_FEATURES); - //CHKO(ALLOCATE_OVERLAY_BUFFER); - //CHKO(RELEASE_OVERLAY_BUFFER); - //CHKO(GET_OVERLAY_CONSTRAINTS); - //CHKO(ALLOCATE_OVERLAY); - //CHKO(RELEASE_OVERLAY); - //CHKO(CONFIGURE_OVERLAY); + /* video overlay functions are not supported */ /* When requesting an acceleration hook, the calling application provides a @@ -129,65 +118,12 @@ /* Return a null pointer for any feature we don't understand. */ return 0; } -#undef CHKO #undef CHKA #undef CHKD #undef HOOK #undef ZERO #undef HRDC -status_t check_overlay_capability(uint32 feature) -{ - char *msg = ""; - - /* setup logmessage text */ - switch (feature) - { - case B_OVERLAY_COUNT: - msg = "B_OVERLAY_COUNT"; - break; - case B_OVERLAY_SUPPORTED_SPACES: - msg = "B_OVERLAY_SUPPORTED_SPACES"; - break; - case B_OVERLAY_SUPPORTED_FEATURES: - msg = "B_OVERLAY_SUPPORTED_FEATURES"; - break; - case B_ALLOCATE_OVERLAY_BUFFER: - msg = "B_ALLOCATE_OVERLAY_BUFFER"; - break; - case B_RELEASE_OVERLAY_BUFFER: - msg = "B_RELEASE_OVERLAY_BUFFER"; - break; - case B_GET_OVERLAY_CONSTRAINTS: - msg = "B_GET_OVERLAY_CONSTRAINTS"; - break; - case B_ALLOCATE_OVERLAY: - msg = "B_ALLOCATE_OVERLAY"; - break; - case B_RELEASE_OVERLAY: - msg = "B_RELEASE_OVERLAY"; - break; - case B_CONFIGURE_OVERLAY: - msg = "B_CONFIGURE_OVERLAY"; - break; - default: - msg = "UNKNOWN"; - break; - } - - /* all older cards have a supported bes */ - if ((si->ps.card_type <= NV40) || (si->ps.card_type == NV45)) - { - LOG(4, ("Overlay: Exporting hook %s.\n", msg)); - return B_OK; - } - - /* all newer NV40 architecture cards have a new HDTV capable bes except for - * GeForce 6800's. Unfortunately we have no info about the new bes yet. */ - LOG(4, ("Overlay: Not exporting hook %s.\n", msg)); - return B_ERROR; -} - status_t check_acc_capability(uint32 feature) { char *msg = ""; Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/InitAccelerant.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/InitAccelerant.c 2008-06-17 16:45:20 UTC (rev 25998) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/InitAccelerant.c 2008-06-17 19:16:40 UTC (rev 25999) @@ -97,7 +97,6 @@ { status_t result; int pointer_reservation; //mem reserved for pointer - int cnt; //used for iteration through the overlay buffers if (0) { time_t now = time (NULL); @@ -174,20 +173,6 @@ si->engine.threeD.reload = 0xffffffff; INIT_BEN(si->engine.lock); - INIT_BEN(si->overlay.lock); - for (cnt = 0; cnt < MAXBUFFERS; cnt++) - { - /* make sure overlay buffers are 'marked' as being free */ - si->overlay.myBuffer[cnt].buffer = NULL; - si->overlay.myBuffer[cnt].buffer_dma = NULL; - } - - /* make sure overlay unit is 'marked' as being free */ - si->overlay.myToken = NULL; - - /* note that overlay is not in use (for nv_bes_move_overlay()) */ - si->overlay.active = false; - /* bail out if something failed */ if (result != B_OK) goto error1; @@ -347,7 +332,6 @@ /* delete benaphores ONLY if we are the primary accelerant */ DELETE_BEN(si->engine.lock); - DELETE_BEN(si->overlay.lock); /* ensure that INIT_ACCELERANT can be executed again */ si->accelerant_in_use = false; Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/Jamfile =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/Jamfile 2008-06-17 16:45:20 UTC (rev 25998) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/Jamfile 2008-06-17 19:16:40 UTC (rev 25999) @@ -15,7 +15,6 @@ GetModeInfo.c GetTimingConstraints.c InitAccelerant.c - Overlay.c ProposeDisplayMode.c SetDisplayMode.c : libnvidia_gpgpu_engine.a Deleted: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/Overlay.c Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/ProposeDisplayMode.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/ProposeDisplayMode.c 2008-06-17 16:45:20 UTC (rev 25998) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/ProposeDisplayMode.c 2008-06-17 19:16:40 UTC (rev 25999) @@ -343,10 +343,7 @@ /* Reserve extra space as a workaround for certain bugs (see DriverInterface.h * for an explanation). */ - if (si->ps.card_arch < NV40A) - mem_reservation += PRE_NV40_OFFSET; - else - mem_reservation += NV40_PLUS_OFFSET; + mem_reservation += NV40_PLUS_OFFSET; /* memory requirement for frame buffer */ if (row_bytes * target->virtual_height > si->ps.memory_size - mem_reservation) { Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/SetDisplayMode.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/SetDisplayMode.c 2008-06-17 16:45:20 UTC (rev 25998) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/SetDisplayMode.c 2008-06-17 19:16:40 UTC (rev 25999) @@ -288,13 +288,8 @@ si->engine.threeD.mem_high = si->ps.memory_size - 1; /* Keep some extra distance as a workaround for certain bugs (see * DriverInterface.h for an explanation). */ - if (si->ps.card_arch < NV40A) - si->engine.threeD.mem_high -= PRE_NV40_OFFSET; - else - si->engine.threeD.mem_high -= NV40_PLUS_OFFSET; + si->engine.threeD.mem_high -= NV40_PLUS_OFFSET; - si->engine.threeD.mem_high -= (MAXBUFFERS * 1024 * 1024 * 2); /* see overlay.c file */ - /* restore screen(s) output state(s) */ // SET_DPMS_MODE(si->dpms_flags); Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/Jamfile =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/Jamfile 2008-06-17 16:45:20 UTC (rev 25998) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/Jamfile 2008-06-17 19:16:40 UTC (rev 25999) @@ -7,7 +7,6 @@ StaticLibrary libnvidia_gpgpu_engine.a : nv_acc_dma.c - nv_bes.c nv_crtc.c nv_crtc2.c nv_dac.c Modified: haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_acc_dma.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_acc_dma.c 2008-06-17 16:45:20 UTC (rev 25998) +++ haiku/trunk/src/add-ons/accelerants/nvidia_gpgpu/engine/nv_acc_dma.c 2008-06-17 19:16:40 UTC (rev 25999) @@ -21,7 +21,6 @@ blit */ -static void nv_init_for_3D_dma(void); static void nv_start_dma(void); static status_t nv_acc_fifofree_dma(uint16 cmd_size); static void nv_acc_cmd_dma(uint32 cmd, uint16 offset, uint16 size); @@ -85,27 +84,6 @@ snooze(1000); NV_REG32(NV32_PWRUPCTRL) = 0x13111111; - /* don't try this on NV20 and later.. */ - /* note: - * the specific register that's responsible for the speedfix on NV18 is - * $00400ed8: bit 6 needs to be zero for fastest rendering (confirmed). */ - /* note also: - * on NV28 the following ranges could be reset (confirmed): - * $00400000 upto/incl. $004002fc; - * $00400400 upto/incl. $004017fc; - * $0040180c upto/incl. $00401948; - * $00401994 upto/incl. $00401a80; - * $00401a94 upto/incl. $00401ffc. - * The intermediate ranges hang the engine upon resetting. */ - if (si->ps.card_arch < NV20A) - { - /* actively reset the PGRAPH registerset (acceleration engine) */ - for (cnt = 0x00400000; cnt < 0x00402000; cnt +=4) - { - NV_REG32(cnt) = 0x00000000; - } - } - /* setup PTIMER: */ //fixme? how about NV28 setup as just after coldstarting? (see nv_info.c) /* set timer numerator to 8 (in b0-15) */ @@ -118,72 +96,63 @@ /* reset timer-alarm INT status bit (b0) */ ACCW(PT_INTSTAT, 0xffffffff); - /* enable PRAMIN write access on pre NV10 before programming it! */ - if (si->ps.card_arch == NV04A) + /* setup acc engine 'source' tile adressranges */ + if ((si->ps.card_type == NV40) || (si->ps.card_type == NV45)) { - /* set framebuffer config: type = notiling, PRAMIN write access enabled */ - NV_REG32(NV32_PFB_CONFIG_0) = 0x00001114; + ACCW(NV10_FBTIL0AD, 0); + ACCW(NV10_FBTIL1AD, 0); + ACCW(NV10_FBTIL2AD, 0); + ACCW(NV10_FBTIL3AD, 0); + ACCW(NV10_FBTIL4AD, 0); + ACCW(NV10_FBTIL5AD, 0); + ACCW(NV10_FBTIL6AD, 0); + ACCW(NV10_FBTIL7AD, 0); + ACCW(NV10_FBTIL0ED, (si->ps.memory_size - 1)); + ACCW(NV10_FBTIL1ED, (si->ps.memory_size - 1)); + ACCW(NV10_FBTIL2ED, (si->ps.memory_size - 1)); + ACCW(NV10_FBTIL3ED, (si->ps.memory_size - 1)); + ACCW(NV10_FBTIL4ED, (si->ps.memory_size - 1)); + ACCW(NV10_FBTIL5ED, (si->ps.memory_size - 1)); + ACCW(NV10_FBTIL6ED, (si->ps.memory_size - 1)); + ACCW(NV10_FBTIL7ED, (si->ps.memory_size - 1)); } else { - /* setup acc engine 'source' tile adressranges */ - if ((si->ps.card_type <= NV40) || (si->ps.card_type == NV45)) + /* NV41, 43, 44, G70 and up */ + ACCW(NV41_FBTIL0AD, 0); + ACCW(NV41_FBTIL1AD, 0); + ACCW(NV41_FBTIL2AD, 0); + ACCW(NV41_FBTIL3AD, 0); + ACCW(NV41_FBTIL4AD, 0); + ACCW(NV41_FBTIL5AD, 0); + ACCW(NV41_FBTIL6AD, 0); + ACCW(NV41_FBTIL7AD, 0); + ACCW(NV41_FBTIL8AD, 0); + ACCW(NV41_FBTIL9AD, 0); + ACCW(NV41_FBTILAAD, 0); + ACCW(NV41_FBTILBAD, 0); + ACCW(NV41_FBTIL0ED, (si->ps.memory_size - 1)); + ACCW(NV41_FBTIL1ED, (si->ps.memory_size - 1)); + ACCW(NV41_FBTIL2ED, (si->ps.memory_size - 1)); + ACCW(NV41_FBTIL3ED, (si->ps.memory_size - 1)); + ACCW(NV41_FBTIL4ED, (si->ps.memory_size - 1)); + ACCW(NV41_FBTIL5ED, (si->ps.memory_size - 1)); + ACCW(NV41_FBTIL6ED, (si->ps.memory_size - 1)); + ACCW(NV41_FBTIL7ED, (si->ps.memory_size - 1)); + ACCW(NV41_FBTIL8ED, (si->ps.memory_size - 1)); + ACCW(NV41_FBTIL9ED, (si->ps.memory_size - 1)); + ACCW(NV41_FBTILAED, (si->ps.memory_size - 1)); + ACCW(NV41_FBTILBED, (si->ps.memory_size - 1)); + + if (si->ps.card_type >= G70) { - ACCW(NV10_FBTIL0AD, 0); - ACCW(NV10_FBTIL1AD, 0); - ACCW(NV10_FBTIL2AD, 0); - ACCW(NV10_FBTIL3AD, 0); - ACCW(NV10_FBTIL4AD, 0); - ACCW(NV10_FBTIL5AD, 0); - ACCW(NV10_FBTIL6AD, 0); - ACCW(NV10_FBTIL7AD, 0); - ACCW(NV10_FBTIL0ED, (si->ps.memory_size - 1)); - ACCW(NV10_FBTIL1ED, (si->ps.memory_size - 1)); - ACCW(NV10_FBTIL2ED, (si->ps.memory_size - 1)); - ACCW(NV10_FBTIL3ED, (si->ps.memory_size - 1)); - ACCW(NV10_FBTIL4ED, (si->ps.memory_size - 1)); - ACCW(NV10_FBTIL5ED, (si->ps.memory_size - 1)); - ACCW(NV10_FBTIL6ED, (si->ps.memory_size - 1)); - ACCW(NV10_FBTIL7ED, (si->ps.memory_size - 1)); + ACCW(G70_FBTILCAD, 0); + ACCW(G70_FBTILDAD, 0); + ACCW(G70_FBTILEAD, 0); + ACCW(G70_FBTILCED, (si->ps.memory_size - 1)); + ACCW(G70_FBTILDED, (si->ps.memory_size - 1)); + ACCW(G70_FBTILEED, (si->ps.memory_size - 1)); } - else - { - /* NV41, 43, 44, G70 and up */ - ACCW(NV41_FBTIL0AD, 0); - ACCW(NV41_FBTIL1AD, 0); - ACCW(NV41_FBTIL2AD, 0); - ACCW(NV41_FBTIL3AD, 0); - ACCW(NV41_FBTIL4AD, 0); - ACCW(NV41_FBTIL5AD, 0); - ACCW(NV41_FBTIL6AD, 0); - ACCW(NV41_FBTIL7AD, 0); - ACCW(NV41_FBTIL8AD, 0); - ACCW(NV41_FBTIL9AD, 0); - ACCW(NV41_FBTILAAD, 0); - ACCW(NV41_FBTILBAD, 0); - ACCW(NV41_FBTIL0ED, (si->ps.memory_size - 1)); - ACCW(NV41_FBTIL1ED, (si->ps.memory_size - 1)); - ACCW(NV41_FBTIL2ED, (si->ps.memory_size - 1)); - ACCW(NV41_FBTIL3ED, (si->ps.memory_size - 1)); - ACCW(NV41_FBTIL4ED, (si->ps.memory_size - 1)); - ACCW(NV41_FBTIL5ED, (si->ps.memory_size - 1)); - ACCW(NV41_FBTIL6ED, (si->ps.memory_size - 1)); - ACCW(NV41_FBTIL7ED, (si->ps.memory_size - 1)); - ACCW(NV41_FBTIL8ED, (si->ps.memory_size - 1)); - ACCW(NV41_FBTIL9ED, (si->ps.memory_size - 1)); - ACCW(NV41_FBTILAED, (si->ps.memory_size - 1)); - ACCW(NV41_FBTILBED, (si->ps.memory_size - 1)); - - if (si->ps.card_type >= G70) - { - ACCW(G70_FBTILCAD, 0); - ACCW(G70_FBTILDAD, 0); - ACCW(G70_FBTILEAD, 0); - ACCW(G70_FBTILCED, (si->ps.memory_size - 1)); - ACCW(G70_FBTILDED, (si->ps.memory_size - 1)); - ACCW(G70_FBTILEED, (si->ps.memory_size - 1)); - } - } } /*** PRAMIN ***/ @@ -207,71 +176,30 @@ * That command is linked to the handle noted here. This handle is then used to * tell the FIFO to which engine command it is connected! * (CTX registers are actually a sort of RAM space.) */ - if (si->ps.card_arch >= NV40A) - { - /* (first set) */ - ACCW(HT_HANDL_00, (0x80000000 | NV10_CONTEXT_SURFACES_2D)); /* 32bit handle (not used) */ - ACCW(HT_VALUE_00, 0x0010114c); /* instance $114c, engine = acc engine, CHID = $00 */ - ACCW(HT_HANDL_01, (0x80000000 | NV_IMAGE_BLIT)); /* 32bit handle */ - ACCW(HT_VALUE_01, 0x00101148); /* instance $1148, engine = acc engine, CHID = $00 */ + /* (first set) */ + ACCW(HT_HANDL_00, (0x80000000 | NV10_CONTEXT_SURFACES_2D)); /* 32bit handle (not used) */ + ACCW(HT_VALUE_00, 0x0010114c); /* instance $114c, engine = acc engine, CHID = $00 */ - ACCW(HT_HANDL_02, (0x80000000 | NV4_GDI_RECTANGLE_TEXT)); /* 32bit handle */ - ACCW(HT_VALUE_02, 0x0010114a); /* instance $114a, engine = acc engine, CHID = $00 */ + ACCW(HT_HANDL_01, (0x80000000 | NV_IMAGE_BLIT)); /* 32bit handle */ + ACCW(HT_VALUE_01, 0x00101148); /* instance $1148, engine = acc engine, CHID = $00 */ - /* (second set) */ - ACCW(HT_HANDL_10, (0x80000000 | NV_ROP5_SOLID)); /* 32bit handle */ - ACCW(HT_VALUE_10, 0x00101142); /* instance $1142, engine = acc engine, CHID = $00 */ + ACCW(HT_HANDL_02, (0x80000000 | NV4_GDI_RECTANGLE_TEXT)); /* 32bit handle */ + ACCW(HT_VALUE_02, 0x0010114a); /* instance $114a, engine = acc engine, CHID = $00 */ - ACCW(HT_HANDL_11, (0x80000000 | NV_IMAGE_BLACK_RECTANGLE)); /* 32bit handle */ - ACCW(HT_VALUE_11, 0x00101144); /* instance $1144, engine = acc engine, CHID = $00 */ + /* (second set) */ + ACCW(HT_HANDL_10, (0x80000000 | NV_ROP5_SOLID)); /* 32bit handle */ + ACCW(HT_VALUE_10, 0x00101142); /* instance $1142, engine = acc engine, CHID = $00 */ - ACCW(HT_HANDL_12, (0x80000000 | NV_IMAGE_PATTERN)); /* 32bit handle */ - ACCW(HT_VALUE_12, 0x00101146); /* instance $1146, engine = acc engine, CHID = $00 */ + ACCW(HT_HANDL_11, (0x80000000 | NV_IMAGE_BLACK_RECTANGLE)); /* 32bit handle */ + ACCW(HT_VALUE_11, 0x00101144); /* instance $1144, engine = acc engine, CHID = $00 */ - ACCW(HT_HANDL_13, (0x80000000 | NV_SCALED_IMAGE_FROM_MEMORY)); /* 32bit handle */ - ACCW(HT_VALUE_13, 0x0010114e); /* instance $114e, engine = acc engine, CHID = $00 */ - } - else - { - /* (first set) */ - ACCW(HT_HANDL_00, (0x80000000 | NV4_SURFACE)); /* 32bit handle */ - ACCW(HT_VALUE_00, 0x80011145); /* instance $1145, engine = acc engine, CHID = $00 */ + ACCW(HT_HANDL_12, (0x80000000 | NV_IMAGE_PATTERN)); /* 32bit handle */ + ACCW(HT_VALUE_12, 0x00101146); /* instance $1146, engine = acc engine, CHID = $00 */ - ACCW(HT_HANDL_01, (0x80000000 | NV_IMAGE_BLIT)); /* 32bit handle */ - ACCW(HT_VALUE_01, 0x80011146); /* instance $1146, engine = acc engine, CHID = $00 */ + ACCW(HT_HANDL_13, (0x80000000 | NV_SCALED_IMAGE_FROM_MEMORY)); /* 32bit handle */ + ACCW(HT_VALUE_13, 0x0010114e); /* instance $114e, engine = acc engine, CHID = $00 */ - ACCW(HT_HANDL_02, (0x80000000 | NV4_GDI_RECTANGLE_TEXT)); /* 32bit handle */ - ACCW(HT_VALUE_02, 0x80011147); /* instance $1147, engine = acc engine, CHID = $00 */ - - ACCW(HT_HANDL_03, (0x80000000 | NV4_CONTEXT_SURFACES_ARGB_ZS)); /* 32bit handle (3D) */ - ACCW(HT_VALUE_03, 0x80011148); /* instance $1148, engine = acc engine, CHID = $00 */ - - /* NV4_ and NV10_DX5_TEXTURE_TRIANGLE should be identical */ - ACCW(HT_HANDL_04, (0x80000000 | NV4_DX5_TEXTURE_TRIANGLE)); /* 32bit handle (3D) */ - ACCW(HT_VALUE_04, 0x80011149); /* instance $1149, engine = acc engine, CHID = $00 */ - - /* NV4_ and NV10_DX6_MULTI_TEXTURE_TRIANGLE should be identical */ - ACCW(HT_HANDL_05, (0x80000000 | NV4_DX6_MULTI_TEXTURE_TRIANGLE)); /* 32bit handle (not used) */ - ACCW(HT_VALUE_05, 0x8001114a); /* instance $114a, engine = acc engine, CHID = $00 */ - - ACCW(HT_HANDL_06, (0x80000000 | NV1_RENDER_SOLID_LIN)); /* 32bit handle (not used) */ - ACCW(HT_VALUE_06, 0x8001114c); /* instance $114c, engine = acc engine, CHID = $00 */ - - /* (second set) */ - ACCW(HT_HANDL_10, (0x80000000 | NV_ROP5_SOLID)); /* 32bit handle */ - ACCW(HT_VALUE_10, 0x80011142); /* instance $1142, engine = acc engine, CHID = $00 */ - - ACCW(HT_HANDL_11, (0x80000000 | NV_IMAGE_BLACK_RECTANGLE)); /* 32bit handle */ - ACCW(HT_VALUE_11, 0x80011143); /* instance $1143, engine = acc engine, CHID = $00 */ - - ACCW(HT_HANDL_12, (0x80000000 | NV_IMAGE_PATTERN)); /* 32bit handle */ - ACCW(HT_VALUE_12, 0x80011144); /* instance $1144, engine = acc engine, CHID = $00 */ - - ACCW(HT_HANDL_13, (0x80000000 | NV_SCALED_IMAGE_FROM_MEMORY)); /* 32bit handle */ - ACCW(HT_VALUE_13, 0x8001114b); /* instance $114b, engine = acc engine, CHID = $00 */ - } - /* program CTX registers: CTX1 is mostly done later (colorspace dependant) */ /* note: * CTX determines which HT handles point to what engine commands. */ @@ -279,433 +207,272 @@ * CTX registers are in fact in the same GPU internal RAM space as the engine's * hashtable. This means that stuff programmed in here also survives resets and * power-outages! (confirmed NV11) */ - if (si->ps.card_arch >= NV40A) - { - /* setup a DMA define for use by command defines below. */ - ACCW(PR_CTX0_R, 0x00003000); /* DMA page table present and of linear type; - * DMA target node is NVM (non-volatile memory?) - * (instead of doing PCI or AGP transfers) */ - ACCW(PR_CTX1_R, (si->ps.memory_size - 1)); /* DMA limit: size is all cardRAM */ - ACCW(PR_CTX2_R, ((0x00000000 & 0xfffff000) | 0x00000002)); - /* DMA access type is READ_AND_WRITE; - * memory starts at start of cardRAM (b12-31): - * It's adress needs to be at a 4kb boundary! */ - ACCW(PR_CTX3_R, 0x00000002); /* unknown (looks like this is rubbish/not needed?) */ - /* setup set '0' for cmd NV_ROP5_SOLID */ - ACCW(PR_CTX0_0, 0x02080043); /* NVclass $043, patchcfg ROP_AND, nv10+: little endian */ - ACCW(PR_CTX1_0, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ - ACCW(PR_CTX2_0, 0x00000000); /* DMA0 and DMA1 instance invalid */ - ACCW(PR_CTX3_0, 0x00000000); /* method traps disabled */ - ACCW(PR_CTX0_1, 0x00000000); /* extra */ - ACCW(PR_CTX1_1, 0x00000000); /* extra */ - /* setup set '1' for cmd NV_IMAGE_BLACK_RECTANGLE */ - ACCW(PR_CTX0_2, 0x02080019); /* NVclass $019, patchcfg ROP_AND, nv10+: little endian */ - ACCW(PR_CTX1_2, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ - ACCW(PR_CTX2_2, 0x00000000); /* DMA0 and DMA1 instance invalid */ - ACCW(PR_CTX3_2, 0x00000000); /* method traps disabled */ - ACCW(PR_CTX0_3, 0x00000000); /* extra */ - ACCW(PR_CTX1_3, 0x00000000); /* extra */ - /* setup set '2' for cmd NV_IMAGE_PATTERN */ - ACCW(PR_CTX0_4, 0x02080018); /* NVclass $018, patchcfg ROP_AND, nv10+: little endian */ - ACCW(PR_CTX1_4, 0x02000000); /* colorspace not set, notify instance is $0200 (b16-31) */ - ACCW(PR_CTX2_4, 0x00000000); /* DMA0 and DMA1 instance invalid */ - ACCW(PR_CTX3_4, 0x00000000); /* method traps disabled */ - ACCW(PR_CTX0_5, 0x00000000); /* extra */ - ACCW(PR_CTX1_5, 0x00000000); /* extra */ - /* setup set '4' for cmd NV12_IMAGE_BLIT */ - ACCW(PR_CTX0_6, 0x0208009f); /* NVclass $09f, patchcfg ROP_AND, nv10+: little endian */ - ACCW(PR_CTX1_6, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ - ACCW(PR_CTX2_6, 0x00001140); /* DMA0 instance is $1140, DMA1 instance invalid */ - ACCW(PR_CTX3_6, 0x00001140); /* method trap 0 is $1140, trap 1 disabled */ - ACCW(PR_CTX0_7, 0x00000000); /* extra */ - ACCW(PR_CTX1_7, 0x00000000); /* extra */ - /* setup set '5' for cmd NV4_GDI_RECTANGLE_TEXT */ - ACCW(PR_CTX0_8, 0x0208004a); /* NVclass $04a, patchcfg ROP_AND, nv10+: little endian */ - ACCW(PR_CTX1_8, 0x02000000); /* colorspace not set, notify instance is $0200 (b16-31) */ - ACCW(PR_CTX2_8, 0x00000000); /* DMA0 and DMA1 instance invalid */ - ACCW(PR_CTX3_8, 0x00000000); /* method traps disabled */ - ACCW(PR_CTX0_9, 0x00000000); /* extra */ - ACCW(PR_CTX1_9, 0x00000000); /* extra */ - /* setup set '6' for cmd NV10_CONTEXT_SURFACES_2D */ - ACCW(PR_CTX0_A, 0x02080062); /* NVclass $062, nv10+: little endian */ - ACCW(PR_CTX1_A, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ - ACCW(PR_CTX2_A, 0x00001140); /* DMA0 instance is $1140, DMA1 instance invalid */ - ACCW(PR_CTX3_A, 0x00001140); /* method trap 0 is $1140, trap 1 disabled */ - ACCW(PR_CTX0_B, 0x00000000); /* extra */ - ACCW(PR_CTX1_B, 0x00000000); /* extra */ - /* setup set '7' for cmd NV_SCALED_IMAGE_FROM_MEMORY */ - ACCW(PR_CTX0_C, 0x02080077); /* NVclass $077, nv10+: little endian */ - ACCW(PR_CTX1_C, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ - ACCW(PR_CTX2_C, 0x00001140); /* DMA0 instance is $1140, DMA1 instance invalid */ - ACCW(PR_CTX3_C, 0x00001140); /* method trap 0 is $1140, trap 1 disabled */ - ACCW(PR_CTX0_D, 0x00000000); /* extra */ - ACCW(PR_CTX1_D, 0x00000000); /* extra */ - /* setup DMA set pointed at by PF_CACH1_DMAI */ - ACCW(PR_CTX0_E, 0x00003002); /* DMA page table present and of linear type; - * DMA class is $002 (b0-11); - * DMA target node is NVM (non-volatile memory?) - * (instead of doing PCI or AGP transfers) */ - ACCW(PR_CTX1_E, 0x00007fff); /* DMA limit: tablesize is 32k bytes */ - ACCW(PR_CTX2_E, (((si->ps.memory_size - 1) & 0xffff8000) | 0x00000002)); - /* DMA access type is READ_AND_WRITE; - * table is located at end of cardRAM (b12-31): - * It's adress needs to be at a 4kb boundary! */ - } - if (si->ps.card_arch == NV04A) - { - /* do a explicit engine reset */ - ACCW(DEBUG0, 0x000001ff); + /* setup a DMA define for use by command defines below. */ + ACCW(PR_CTX0_R, 0x00003000); /* DMA page table present and of linear type; + * DMA target node is NVM (non-volatile memory?) + * (instead of doing PCI or AGP transfers) */ + ACCW(PR_CTX1_R, (si->ps.memory_size - 1)); /* DMA limit: size is all cardRAM */ + ACCW(PR_CTX2_R, ((0x00000000 & 0xfffff000) | 0x00000002)); + /* DMA access type is READ_AND_WRITE; + * memory starts at start of cardRAM (b12-31): + * It's adress needs to be at a 4kb boundary! */ + ACCW(PR_CTX3_R, 0x00000002); /* unknown (looks like this is rubbish/not needed?) */ + /* setup set '0' for cmd NV_ROP5_SOLID */ + ACCW(PR_CTX0_0, 0x02080043); /* NVclass $043, patchcfg ROP_AND, nv10+: little endian */ + ACCW(PR_CTX1_0, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ + ACCW(PR_CTX2_0, 0x00000000); /* DMA0 and DMA1 instance invalid */ + ACCW(PR_CTX3_0, 0x00000000); /* method traps disabled */ + ACCW(PR_CTX0_1, 0x00000000); /* extra */ + ACCW(PR_CTX1_1, 0x00000000); /* extra */ + /* setup set '1' for cmd NV_IMAGE_BLACK_RECTANGLE */ + ACCW(PR_CTX0_2, 0x02080019); /* NVclass $019, patchcfg ROP_AND, nv10+: little endian */ + ACCW(PR_CTX1_2, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ + ACCW(PR_CTX2_2, 0x00000000); /* DMA0 and DMA1 instance invalid */ + ACCW(PR_CTX3_2, 0x00000000); /* method traps disabled */ + ACCW(PR_CTX0_3, 0x00000000); /* extra */ + ACCW(PR_CTX1_3, 0x00000000); /* extra */ + /* setup set '2' for cmd NV_IMAGE_PATTERN */ + ACCW(PR_CTX0_4, 0x02080018); /* NVclass $018, patchcfg ROP_AND, nv10+: little endian */ + ACCW(PR_CTX1_4, 0x02000000); /* colorspace not set, notify instance is $0200 (b16-31) */ + ACCW(PR_CTX2_4, 0x00000000); /* DMA0 and DMA1 instance invalid */ + ACCW(PR_CTX3_4, 0x00000000); /* method traps disabled */ + ACCW(PR_CTX0_5, 0x00000000); /* extra */ + ACCW(PR_CTX1_5, 0x00000000); /* extra */ + /* setup set '4' for cmd NV12_IMAGE_BLIT */ + ACCW(PR_CTX0_6, 0x0208009f); /* NVclass $09f, patchcfg ROP_AND, nv10+: little endian */ + ACCW(PR_CTX1_6, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ + ACCW(PR_CTX2_6, 0x00001140); /* DMA0 instance is $1140, DMA1 instance invalid */ + ACCW(PR_CTX3_6, 0x00001140); /* method trap 0 is $1140, trap 1 disabled */ + ACCW(PR_CTX0_7, 0x00000000); /* extra */ + ACCW(PR_CTX1_7, 0x00000000); /* extra */ + /* setup set '5' for cmd NV4_GDI_RECTANGLE_TEXT */ + ACCW(PR_CTX0_8, 0x0208004a); /* NVclass $04a, patchcfg ROP_AND, nv10+: little endian */ + ACCW(PR_CTX1_8, 0x02000000); /* colorspace not set, notify instance is $0200 (b16-31) */ + ACCW(PR_CTX2_8, 0x00000000); /* DMA0 and DMA1 instance invalid */ + ACCW(PR_CTX3_8, 0x00000000); /* method traps disabled */ + ACCW(PR_CTX0_9, 0x00000000); /* extra */ + ACCW(PR_CTX1_9, 0x00000000); /* extra */ + /* setup set '6' for cmd NV10_CONTEXT_SURFACES_2D */ + ACCW(PR_CTX0_A, 0x02080062); /* NVclass $062, nv10+: little endian */ + ACCW(PR_CTX1_A, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ + ACCW(PR_CTX2_A, 0x00001140); /* DMA0 instance is $1140, DMA1 instance invalid */ + ACCW(PR_CTX3_A, 0x00001140); /* method trap 0 is $1140, trap 1 disabled */ + ACCW(PR_CTX0_B, 0x00000000); /* extra */ + ACCW(PR_CTX1_B, 0x00000000); /* extra */ + /* setup set '7' for cmd NV_SCALED_IMAGE_FROM_MEMORY */ + ACCW(PR_CTX0_C, 0x02080077); /* NVclass $077, nv10+: little endian */ + ACCW(PR_CTX1_C, 0x00000000); /* colorspace not set, notify instance invalid (b16-31) */ + ACCW(PR_CTX2_C, 0x00001140); /* DMA0 instance is $1140, DMA1 instance invalid */ + ACCW(PR_CTX3_C, 0x00001140); /* method trap 0 is $1140, trap 1 disabled */ + ACCW(PR_CTX0_D, 0x00000000); /* extra */ + ACCW(PR_CTX1_D, 0x00000000); /* extra */ + /* setup DMA set pointed at by PF_CACH1_DMAI */ + ACCW(PR_CTX0_E, 0x00003002); /* DMA page table present and of linear type; + * DMA class is $002 (b0-11); + * DMA target node is NVM (non-volatile memory?) + * (instead of doing PCI or AGP transfers) */ + ACCW(PR_CTX1_E, 0x00007fff); /* DMA limit: tablesize is 32k bytes */ + ACCW(PR_CTX2_E, (((si->ps.memory_size - 1) & 0xffff8000) | 0x00000002)); + /* DMA access type is READ_AND_WRITE; + * table is located at end of cardRAM (b12-31): + * It's adress needs to be at a 4kb boundary! */ - /* init some function blocks */ - /* DEBUG0, b20 and b21 should be high, this has a big influence on - * 3D rendering speed! (on all cards, confirmed) */ - ACCW(DEBUG0, 0x1230c000); - /* DEBUG1, b19 = 1 increases 3D rendering speed on TNT2 (M64) a bit, - * TNT1 rendering speed stays the same (all cards confirmed) */ - ACCW(DEBUG1, 0x72191101); - ACCW(DEBUG2, 0x11d5f071); - ACCW(DEBUG3, 0x0004ff31); - /* init OP methods */ - ACCW(DEBUG3, 0x4004ff31); + /* do a explicit engine reset */ + ACCW(DEBUG0, 0xffffffff); + ACCW(DEBUG0, 0x00000000); + /* disable all acceleration engine INT reguests */ + ACCW(ACC_INTE, 0x00000000); + /* reset all acceration engine INT status bits */ + ACCW(ACC_INTS, 0xffffffff); + /* context control enabled */ + ACCW(NV10_CTX_CTRL, 0x10010100); + /* all acceleration buffers, pitches and colors are valid */ + ACCW(NV10_ACC_STAT, 0xffffffff); + /* enable acceleration engine command FIFO */ + ACCW(FIFO_EN, 0x00000001); + /* setup surface type: + * b1-0 = %01 = surface type is non-swizzle; + * this is needed to enable 3D on NV1x (confirmed) and maybe others? */ + ACCW(NV10_SURF_TYP, ((ACCR(NV10_SURF_TYP)) & 0x0007ff00)); + ACCW(NV10_SURF_TYP, ((ACCR(NV10_SURF_TYP)) | 0x00020101)); - /* disable all acceleration engine INT reguests */ - ACCW(ACC_INTE, 0x00000000); - /* reset all acceration engine INT status bits */ - ACCW(ACC_INTS, 0xffffffff); - /* context control enabled */ - ACCW(NV04_CTX_CTRL, 0x10010100); - /* all acceleration buffers, pitches and colors are valid */ - ACCW(NV04_ACC_STAT, 0xffffffff); - /* enable acceleration engine command FIFO */ - ACCW(FIFO_EN, 0x00000001); + /* init some function blocks */ + ACCW(DEBUG1, 0x401287c0); + ACCW(DEBUG3, 0x60de8051); + /* disable specific functions, but enable SETUP_SPARE2 register */ + ACCW(NV10_DEBUG4, 0x00008000); + /* set limit_viol_pix_adress(?): more likely something unknown.. */ + ACCW(NV25_WHAT0, 0x00be3c5f); - /* setup location of active screen in framebuffer */ - ACCW(OFFSET0, ((uint8*)si->fbc.frame_buffer - (uint8*)si->framebuffer)); - ACCW(OFFSET1, ((uint8*)si->fbc.frame_buffer - (uint8*)si->framebuffer)); - /* setup accesible card memory range */ - ACCW(BLIMIT0, (si->ps.memory_size - 1)); - ACCW(BLIMIT1, (si->ps.memory_size - 1)); - - /* pattern shape value = 8x8, 2 color */ - //fixme: not needed, unless the engine has a hardware fault (setting via cmd)! - //ACCW(PAT_SHP, 0x00000000); - /* Pgraph Beta AND value (fraction) b23-30 */ - ACCW(BETA_AND_VAL, 0xffffffff); - } - else + /* setup some unknown serially accessed registers (?) */ + tmp = (NV_REG32(NV32_NV4X_WHAT0) & 0x000000ff); + for (cnt = 0; (tmp && !(tmp & 0x00000001)); tmp >>= 1, cnt++); { - /* do a explicit engine reset */ - ACCW(DEBUG0, 0xffffffff); - ACCW(DEBUG0, 0x00000000); - /* disable all acceleration engine INT reguests */ - ACCW(ACC_INTE, 0x00000000); - /* reset all acceration engine INT status bits */ - ACCW(ACC_INTS, 0xffffffff); - /* context control enabled */ - ACCW(NV10_CTX_CTRL, 0x10010100); - /* all acceleration buffers, pitches and colors are valid */ - ACCW(NV10_ACC_STAT, 0xffffffff); - /* enable acceleration engine command FIFO */ - ACCW(FIFO_EN, 0x00000001); - /* setup surface type: - * b1-0 = %01 = surface type is non-swizzle; - * this is needed to enable 3D on NV1x (confirmed) and maybe others? */ - ACCW(NV10_SURF_TYP, ((ACCR(NV10_SURF_TYP)) & 0x0007ff00)); - ACCW(NV10_SURF_TYP, ((ACCR(NV10_SURF_TYP)) | 0x00020101)); + ACCW(NV4X_WHAT2, cnt); } - if (si->ps.card_arch == NV10A) + /* unknown.. */ + switch (si->ps.card_type) { - /* init some function blocks */ - ACCW(DEBUG1, 0x00118700); - /* DEBUG2 has a big influence on 3D speed for NV11 and NV15 - * (confirmed b3 and b18 should both be '1' on both cards!) - * (b16 should also be '1', increases 3D speed on NV11 a bit more) */ - ACCW(DEBUG2, 0x24fd2ad9); - ACCW(DEBUG3, 0x55de0030); - /* NV10_DEBUG4 has a big influence on 3D speed for NV11, NV15 and NV18 - * (confirmed b14 and b15 should both be '1' on these cards!) - * (confirmed b8 should be '0' on NV18 to prevent complete engine crash!) */ - ACCW(NV10_DEBUG4, 0x0000c000); + case NV40: + case NV45: + /* and NV48: but these are pgm'd as NV45 currently */ + ACCW(NV40_WHAT0, 0x83280fff); + ACCW(NV40_WHAT1, 0x000000a0); + ACCW(NV40_WHAT2, 0x0078e366); + ACCW(NV40_WHAT3, 0x0000014c); + break; + case NV41: + /* and ID == 0x012x: but no cards defined yet */ + ACCW(NV40P_WHAT0, 0x83280eff); + ACCW(NV40P_WHAT1, 0x000000a0); + ACCW(NV40P_WHAT2, 0x007596ff); + ACCW(NV40P_WHAT3, 0x00000108); + break; + case NV43: + ACCW(NV40P_WHAT0, 0x83280eff); + ACCW(NV40P_WHAT1, 0x000000a0); + ACCW(NV40P_WHAT2, 0x0072cb77); + ACCW(NV40P_WHAT3, 0x00000108); + break; + case NV44: + case G72: + ACCW(NV40P_WHAT0, 0x83280eff); + ACCW(NV40P_WHAT1, 0x000000a0); - /* copy tile setup stuff from 'source' to acc engine */ - for (cnt = 0; cnt < 32; cnt++) - { - NV_REG32(NVACC_NV10_TIL0AD + (cnt << 2)) = - NV_REG32(NVACC_NV10_FBTIL0AD + (cnt << 2)); - } + NV_REG32(NV32_NV44_WHAT10) = NV_REG32(NV32_NV10STRAPINFO); + NV_REG32(NV32_NV44_WHAT11) = 0x00000000; + NV_REG32(NV32_NV44_WHAT12) = 0x00000000; + NV_REG32(NV32_NV44_WHAT13) = NV_REG32(NV32_NV10STRAPINFO); - /* setup location of active screen in framebuffer */ - ACCW(OFFSET0, ((uint8*)si->fbc.frame_buffer - (uint8*)si->framebuffer)); - ACCW(OFFSET1, ((uint8*)si->fbc.frame_buffer - (uint8*)si->framebuffer)); - /* setup accesible card memory range */ - ACCW(BLIMIT0, (si->ps.memory_size - 1)); - ACCW(BLIMIT1, (si->ps.memory_size - 1)); + ACCW(NV44_WHAT2, 0x00000000); + ACCW(NV44_WHAT3, 0x00000000); + break; +/* case NV44 type 2: (cardID 0x022x) + //fixme if needed: doesn't seem to need the strapinfo thing.. + ACCW(NV40P_WHAT0, 0x83280eff); + ACCW(NV40P_WHAT1, 0x000000a0); - /* pattern shape value = 8x8, 2 color */ - //fixme: not needed, unless the engine has a hardware fault (setting via cmd)! - //ACCW(PAT_SHP, 0x00000000); - /* Pgraph Beta AND value (fraction) b23-30 */ - ACCW(BETA_AND_VAL, 0xffffffff); + ACCW(NV44_WHAT2, 0x00000000); + ACCW(NV44_WHAT3, 0x00000000); + break; +*/ case G70: + case G71: + case G73: + ACCW(NV40P_WHAT0, 0x83280eff); + ACCW(NV40P_WHAT1, 0x000000a0); + ACCW(NV40P_WHAT2, 0x07830610); + ACCW(NV40P_WHAT3, 0x0000016a); + break; + default: + ACCW(NV40P_WHAT0, 0x83280eff); + ACCW(NV40P_WHAT1, 0x000000a0); + break; } - if (si->ps.card_arch >= NV20A) + ACCW(NV10_TIL3PT, 0x2ffff800); + ACCW(NV10_TIL3ST, 0x00006000); + ACCW(NV4X_WHAT1, 0x01000000); + /* engine data source DMA instance = $1140 */ + ACCW(NV4X_DMA_SRC, 0x00001140); + + /* copy tile setup stuff from previous setup 'source' to acc engine + * (pattern colorRAM?) */ + if ((si->ps.card_type == NV40) || (si->ps.card_type == NV45)) { - switch (si->ps.card_arch) + for (cnt = 0; cnt < 32; cnt++) { - case NV40A: - /* init some function blocks */ - ACCW(DEBUG1, 0x401287c0); - ACCW(DEBUG3, 0x60de8051); - /* disable specific functions, but enable SETUP_SPARE2 register */ - ACCW(NV10_DEBUG4, 0x00008000); - /* set limit_viol_pix_adress(?): more likely something unknown.. */ - ACCW(NV25_WHAT0, 0x00be3c5f); + /* copy NV10_FBTIL0AD upto/including NV10_FBTIL7ST */ + NV_REG32(NVACC_NV20_WHAT0 + (cnt << 2)) = + NV_REG32(NVACC_NV10_FBTIL0AD + (cnt << 2)); - /* setup some unknown serially accessed registers (?) */ - tmp = (NV_REG32(NV32_NV4X_WHAT0) & 0x000000ff); - for (cnt = 0; (tmp && !(tmp & 0x00000001)); tmp >>= 1, cnt++); - { - ACCW(NV4X_WHAT2, cnt); - } - - /* unknown.. */ - switch (si->ps.card_type) - { - case NV40: - case NV45: - /* and NV48: but these are pgm'd as NV45 currently */ - ACCW(NV40_WHAT0, 0x83280fff); - ACCW(NV40_WHAT1, 0x000000a0); - ACCW(NV40_WHAT2, 0x0078e366); - ACCW(NV40_WHAT3, 0x0000014c); - break; - case NV41: - /* and ID == 0x012x: but no cards defined yet */ - ACCW(NV40P_WHAT0, 0x83280eff); - ACCW(NV40P_WHAT1, 0x000000a0); - ACCW(NV40P_WHAT2, 0x007596ff); - ACCW(NV40P_WHAT3, 0x00000108); - break; - case NV43: - ACCW(NV40P_WHAT0, 0x83280eff); - ACCW(NV40P_WHAT1, 0x000000a0); - ACCW(NV40P_WHAT2, 0x0072cb77); - ACCW(NV40P_WHAT3, 0x00000108); - break; - case NV44: - case G72: - ACCW(NV40P_WHAT0, 0x83280eff); - ACCW(NV40P_WHAT1, 0x000000a0); - - NV_REG32(NV32_NV44_WHAT10) = NV_REG32(NV32_NV10STRAPINFO); - NV_REG32(NV32_NV44_WHAT11) = 0x00000000; - NV_REG32(NV32_NV44_WHAT12) = 0x00000000; - NV_REG32(NV32_NV44_WHAT13) = NV_REG32(NV32_NV10STRAPINFO); - - ACCW(NV44_WHAT2, 0x00000000); - ACCW(NV44_WHAT3, 0x00000000); - break; -/* case NV44 type 2: (cardID 0x022x) - //fixme if needed: doesn't seem to need the strapinfo thing.. - ACCW(NV40P_WHAT0, 0x83280eff); - ACCW(NV40P_WHAT1, 0x000000a0); - - ACCW(NV44_WHAT2, 0x00000000); - ACCW(NV44_WHAT3, 0x00000000); - break; -*/ case G70: - case G71: - case G73: - ACCW(NV40P_WHAT0, 0x83280eff); - ACCW(NV40P_WHAT1, 0x000000a0); - ACCW(NV40P_WHAT2, 0x07830610); - ACCW(NV40P_WHAT3, 0x0000016a); - break; - default: - ACCW(NV40P_WHAT0, 0x83280eff); - ACCW(NV40P_WHAT1, 0x000000a0); - break; - } - - ACCW(NV10_TIL3PT, 0x2ffff800); - ACCW(NV10_TIL3ST, 0x00006000); - ACCW(NV4X_WHAT1, 0x01000000); - /* engine data source DMA instance = $1140 */ - ACCW(NV4X_DMA_SRC, 0x00001140); - break; - case NV30A: - /* init some function blocks, but most is unknown.. */ - ACCW(DEBUG1, 0x40108700); - ACCW(NV25_WHAT1, 0x00140000); - ACCW(DEBUG3, 0xf00e0431); - ACCW(NV10_DEBUG4, 0x00008000); - ACCW(NV25_WHAT0, 0xf04b1f36); - ACCW(NV20_WHAT3, 0x1002d888); - ACCW(NV25_WHAT2, 0x62ff007f); [... truncated: 1389 lines follow ...] From revol at free.fr Tue Jun 17 21:19:15 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Tue, 17 Jun 2008 21:19:15 +0200 CEST Subject: [Haiku-commits] =?windows-1252?q?r25997_-_in_haiku/trunk/src/add-?= =?windows-1252?q?ons/input=5Fserver/methods=3A_=2E_pen_pen/compat?= In-Reply-To: <b6b105e70806170947s70218a0p6f8472745dc64a98@mail.gmail.com> Message-ID: <290774785-BeMail@laptop> > I shouldn't comment about the style programming error, but I'm > just wondering how many beers do you plan to buy at next BeGeistert > after this commit? :-) > I suppose I'll have to order a truck to bring them all... > > + for (i=0; i<len; i+=16) { > Space between operators. > > > +#ifndef WHAT_ALWAYS_HEX > > + if ( myisprint(message->what & 0x0ff) && > No space after the ( That's old code that was written long ago and needs style cleanup. Fran?ois From rudolfc at mail.berlios.de Tue Jun 17 21:27:40 2008 From: rudolfc at mail.berlios.de (rudolfc at mail.berlios.de) Date: Tue, 17 Jun 2008 21:27:40 +0200 Subject: [Haiku-commits] r26000 - haiku/trunk/headers/private/graphics/nvidia Message-ID: <200806171927.m5HJReEj020023@sheep.berlios.de> Author: rudolfc Date: 2008-06-17 21:27:38 +0200 (Tue, 17 Jun 2008) New Revision: 26000 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26000&view=rev Modified: haiku/trunk/headers/private/graphics/nvidia/DriverInterface.h Log: removed last G8x defines. Modified: haiku/trunk/headers/private/graphics/nvidia/DriverInterface.h =================================================================== --- haiku/trunk/headers/private/graphics/nvidia/DriverInterface.h 2008-06-17 19:16:40 UTC (rev 25999) +++ haiku/trunk/headers/private/graphics/nvidia/DriverInterface.h 2008-06-17 19:27:38 UTC (rev 26000) @@ -105,10 +105,7 @@ G70, G71, G72, - G73, - G80, - G84, - G86 + G73 }; /* card_arch in order of date of NV chip design */ From mmu_man at mail.berlios.de Tue Jun 17 21:38:58 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 17 Jun 2008 21:38:58 +0200 Subject: [Haiku-commits] r26001 - haiku/trunk/src/apps/aboutsystem Message-ID: <200806171938.m5HJcwrS021134@sheep.berlios.de> Author: mmu_man Date: 2008-06-17 21:38:57 +0200 (Tue, 17 Jun 2008) New Revision: 26001 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26001&view=rev Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp Log: Fix boggus ifdef. Thanks Vasilis. Parens shouldn't be needed though. Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp =================================================================== --- haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-06-17 19:27:38 UTC (rev 26000) +++ haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-06-17 19:38:57 UTC (rev 26001) @@ -238,7 +238,7 @@ stringView->ResizeToPreferred(); // GCC version -#ifdef __GNUC__ != 2 +#if __GNUC__ != 2 r.OffsetBy(0, textHeight); r.bottom = r.top + textHeight; From revol at free.fr Tue Jun 17 21:40:17 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Tue, 17 Jun 2008 21:40:17 +0200 CEST Subject: [Haiku-commits] r25994 - haiku/trunk/src/apps/aboutsystem In-Reply-To: <4857FFB3.8040407@sch.gr> Message-ID: <1552181977-BeMail@laptop> > i got this warning: > src/apps/aboutsystem/AboutSystem.cpp:241: warning: garbage at end of > `#ifdef' argument > > which i eliminated this way: > see attached AboutSystem.cpp.diff Fixed, thanks. () shouldn't be required though. Fran?ois. From kaoutsis at sch.gr Tue Jun 17 21:45:31 2008 From: kaoutsis at sch.gr (kaoutsis) Date: Tue, 17 Jun 2008 22:45:31 +0300 Subject: [Haiku-commits] r25994 - haiku/trunk/src/apps/aboutsystem In-Reply-To: <1552181977-BeMail@laptop> References: <1552181977-BeMail@laptop> Message-ID: <4858145B.9020902@sch.gr> Hi Fran?ois, Fran?ois Revol wrote: > () shouldn't be required though. > OK, thanks, goodbye, Vasilis From julun at mail.berlios.de Tue Jun 17 22:00:51 2008 From: julun at mail.berlios.de (julun at BerliOS) Date: Tue, 17 Jun 2008 22:00:51 +0200 Subject: [Haiku-commits] r26002 - haiku/trunk/src/kits/interface Message-ID: <200806172000.m5HK0pNv023097@sheep.berlios.de> Author: julun Date: 2008-06-17 22:00:51 +0200 (Tue, 17 Jun 2008) New Revision: 26002 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26002&view=rev Modified: haiku/trunk/src/kits/interface/PrintJob.cpp Log: * update the chart as the first one was not entirely right Thanks Michael for pointing this out :) Modified: haiku/trunk/src/kits/interface/PrintJob.cpp =================================================================== --- haiku/trunk/src/kits/interface/PrintJob.cpp 2008-06-17 19:38:57 UTC (rev 26001) +++ haiku/trunk/src/kits/interface/PrintJob.cpp 2008-06-17 20:00:51 UTC (rev 26002) @@ -38,27 +38,44 @@ * * Summery of R5 spool file: * - * |-------------------------| - * | print_file_header | - * |-------------------------| - * | BMessage | - * |-------------------------| - * | _page_header_ | - * | BPoint | - * | BRect | - * | BPicture | - * |-------------------------| - * | _page_header_ | - * | BPoint | - * | BRect | - * | BPicture | - * |-------------------------| - * | _page_header_ | - * |-------------------------| + * |-----------------------------------| + * | print_file_header | + * |-----------------------------------| + * | BMessage print_job_settings | + * |-----------------------------------| + * | | + * | ********** (first page) ********* | + * | * * | + * | * _page_header_ * | + * | * ----------------------------- * | + * | * |---------------------------| * | + * | * | BPoint where | * | + * | * | BRect bounds | * | + * | * | BPicture pic | * | + * | * |---------------------------| * | + * | * |---------------------------| * | + * | * | BPoint where | * | + * | * | BRect bounds | * | + * | * | BPicture pic | * | + * | * |---------------------------| * | + * | ********************************* | + * | | + * | ********* (second page) ********* | + * | * * | + * | * _page_header_ * | + * | * ----------------------------- * | + * | * |---------------------------| * | + * | * | BPoint where | * | + * | * | BRect bounds | * | + * | * | BPicture pic | * | + * | * |---------------------------| * | + * | ********************************* | + * |-----------------------------------| * * BeOS R5 print_file_header.version is 1 << 16 * BeOS R5 print_file_header.first_page is -1 * + * each page can consist of a collection of picture structures * remaining pages start at _page_header_.next_page of previous _page_header_ * * See also: "How to Write a BeOS R5 Printer Driver" for description of spool From axeld at pinc-software.de Tue Jun 17 23:09:40 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 17 Jun 2008 23:09:40 +0200 CEST Subject: [Haiku-commits] r26001 - haiku/trunk/src/apps/aboutsystem In-Reply-To: <200806171938.m5HJcwrS021134@sheep.berlios.de> Message-ID: <46619138309-BeMail@zon> mmu_man at BerliOS <mmu_man at mail.berlios.de> wrote: > Log: > Fix boggus ifdef. Thanks Vasilis. Parens shouldn't be needed though. Thanks! That's the price to pay for last minute changes... (it was an if-block before) Bye, Axel. From bonefish at mail.berlios.de Wed Jun 18 00:49:08 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 18 Jun 2008 00:49:08 +0200 Subject: [Haiku-commits] r26003 - haiku/trunk/src/apps/terminal Message-ID: <200806172249.m5HMn8pH027870@sheep.berlios.de> Author: bonefish Date: 2008-06-18 00:49:06 +0200 (Wed, 18 Jun 2008) New Revision: 26003 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26003&view=rev Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h haiku/trunk/src/apps/terminal/TermParse.cpp haiku/trunk/src/apps/terminal/TermParse.h haiku/trunk/src/apps/terminal/TermView.cpp haiku/trunk/src/apps/terminal/TerminalBuffer.cpp haiku/trunk/src/apps/terminal/TerminalBuffer.h Log: * Some preparations for DEC private mode settings support. * Implemented alternate screen buffer support. Not used by any program yet, since we still use the beterm termcap entry. Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-17 20:00:51 UTC (rev 26002) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-17 22:49:06 UTC (rev 26003) @@ -120,6 +120,7 @@ fScreenOffset = 0; fOverwriteMode = true; + fAlternateScreenActive = false; fScreen = _AllocateLines(width, height); if (fScreen == NULL) @@ -162,12 +163,10 @@ if (width == fWidth && height == fHeight) return SetHistoryCapacity(historyCapacity); - // TODO: When alternate screen support is implemented, do that only when - // not using the alternate screen. - if (true) - return _ResizeRewrap(width, height, historyCapacity); + if (fAlternateScreenActive) + return _ResizeSimple(width, height, historyCapacity); - return _ResizeSimple(width, height, historyCapacity); + return _ResizeRewrap(width, height, historyCapacity); } @@ -179,12 +178,14 @@ void -BasicTerminalBuffer::Clear() +BasicTerminalBuffer::Clear(bool resetCursor) { fScreenOffset = 0; _ClearLines(0, fHeight - 1); - fCursor.SetTo(0, 0); + if (resetCursor) + fCursor.SetTo(0, 0); + if (fHistory != NULL) fHistory->Clear(); @@ -585,7 +586,8 @@ if (fCursor.y == fScrollBottom) { _Scroll(fScrollTop, fScrollBottom, 1); } else { - fCursor.y++; + if (fCursor.y < fHeight - 1) + fCursor.y++; _CursorChanged(); } } @@ -731,7 +733,7 @@ { //debug_printf("BasicTerminalBuffer::SetCursor(%d, %d)\n", x, y); x = restrict_value(x, 0, fWidth - 1); - y = restrict_value(y, fScrollTop, fScrollBottom); + y = restrict_value(y, 0, fHeight - 1); if (x != fCursor.x || y != fCursor.y) { fCursor.x = x; fCursor.y = y; @@ -775,6 +777,18 @@ // #pragma mark - private methods +void +BasicTerminalBuffer::_InvalidateAll() +{ + fDirtyInfo.invalidateAll = true; + + if (!fDirtyInfo.messageSent) { + NotifyListener(); + fDirtyInfo.messageSent = true; + } +} + + /* static */ TerminalLine** BasicTerminalBuffer::_AllocateLines(int32 width, int32 count) { Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h =================================================================== --- haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h 2008-06-17 20:00:51 UTC (rev 26002) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h 2008-06-17 22:49:06 UTC (rev 26003) @@ -21,6 +21,7 @@ int32 linesScrolled; // number of lines added to the history int32 dirtyTop; // dirty line range int32 dirtyBottom; // + bool invalidateAll; bool messageSent; // listener has been notified bool IsDirtyRegionValid() const @@ -41,6 +42,7 @@ linesScrolled = 0; dirtyTop = INT_MAX; dirtyBottom = INT_MIN; + invalidateAll = false; messageSent = false; } }; @@ -61,11 +63,11 @@ TerminalBufferDirtyInfo& DirtyInfo() { return fDirtyInfo; } - status_t ResizeTo(int32 width, int32 height); - status_t ResizeTo(int32 width, int32 height, + virtual status_t ResizeTo(int32 width, int32 height); + virtual status_t ResizeTo(int32 width, int32 height, int32 historyCapacity); status_t SetHistoryCapacity(int32 historyCapacity); - void Clear(); + void Clear(bool resetCursor); void SynchronizeWith( const BasicTerminalBuffer* other, @@ -139,6 +141,7 @@ inline void _Invalidate(int32 top, int32 bottom); inline void _CursorChanged(); + void _InvalidateAll(); static TerminalLine** _AllocateLines(int32 width, int32 count); static void _FreeLines(TerminalLine** lines, int32 count); @@ -182,6 +185,7 @@ TermPos fSavedCursor; bool fOverwriteMode; // false for insert + bool fAlternateScreenActive; int fEncoding; Modified: haiku/trunk/src/apps/terminal/TermParse.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-17 20:00:51 UTC (rev 26002) +++ haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-17 22:49:06 UTC (rev 26003) @@ -790,13 +790,15 @@ case CASE_DECSET: /* DECSET */ - // dpmodes(term, bitset); + for (int i = 0; i < nparam; i++) + _DecPrivateModeSet(param[i]); parsestate = groundtable; break; case CASE_DECRST: /* DECRST */ - // dpmodes(term, bitclr); + for (int i = 0; i < nparam; i++) + _DecPrivateModeReset(param[i]); parsestate = groundtable; break; @@ -1070,3 +1072,80 @@ return; } } + + +void +TermParse::_DecPrivateModeSet(int value) +{ + switch (value) { + case 1: + // Application Cursor Keys (whatever that means). + // Not supported yet. + break; + case 5: + // Reverse Video (inverses colors for the complete screen + // -- when followed by normal video, that's shortly flashes the + // screen). + // Not supported yet. + break; + case 12: + // Start Blinking Cursor. + // Not supported yet. + break; + case 25: + // Show Cursor + // Not supported yet. + break; + case 1034: + // Interpret "meta" key, sets eighth bit. + // Not supported yet. + break; + case 1049: + // Save cursor as in DECSC and use Alternate Screen Buffer, clearing + // it first. + fBuffer->SaveCursor(); + fBuffer->UseAlternateScreenBuffer(); + break; + } +} + + +void +TermParse::_DecPrivateModeReset(int value) +{ + switch (value) { + case 1: + // Normal Cursor Keys (whatever that means). + // Not supported yet. + break; + case 3: + // 80 Column Mode. + // Not supported yet. + break; + case 4: + // Jump (Fast) Scroll. + // Not supported yet. + break; + case 5: + // Normal Video (Leaves Reverse Video, cf. there). + // Not supported yet. + break; + case 12: + // Stop Blinking Cursor. + // Not supported yet. + break; + case 25: + // Hide Cursor + // Not supported yet. + break; + case 1034: + // Don?t interpret "meta" key. + // Not supported yet. + break; + case 1049: + // Use Normal Screen Buffer and restore cursor as in DECRC. + fBuffer->RestoreCursor(); + fBuffer->UseNormalScreenBuffer(); + break; + } +} Modified: haiku/trunk/src/apps/terminal/TermParse.h =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.h 2008-06-17 20:00:51 UTC (rev 26002) +++ haiku/trunk/src/apps/terminal/TermParse.h 2008-06-17 22:49:06 UTC (rev 26003) @@ -76,6 +76,8 @@ status_t _ReadParserBuffer(); void _DeviceStatusReport(int n); + void _DecPrivateModeSet(int value); + void _DecPrivateModeReset(int value); int fFd; Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-17 20:00:51 UTC (rev 26002) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-17 22:49:06 UTC (rev 26003) @@ -710,9 +710,9 @@ { BAutolock _(fTextBuffer); - fTextBuffer->Clear(); + fTextBuffer->Clear(true); } - fVisibleTextBuffer->Clear(); + fVisibleTextBuffer->Clear(true); //debug_printf("Invalidate()\n"); Invalidate(); @@ -1563,10 +1563,6 @@ { TerminalBufferDirtyInfo& info = fTextBuffer->DirtyInfo(); int32 linesScrolled = info.linesScrolled; - BRect bounds = Bounds(); - int32 firstVisible = _LineAt(0); - int32 lastVisible = _LineAt(bounds.bottom); - int32 historySize = fTextBuffer->HistorySize(); //debug_printf("TermView::_SynchronizeWithTextBuffer(): dirty: %ld - %ld, " //"scrolled: %ld, visible dirty: %ld - %ld\n", info.dirtyTop, info.dirtyBottom, @@ -1630,6 +1626,22 @@ fScrolledSinceLastSync = 0; } + // Simple case first -- complete invalidation. + if (info.invalidateAll) { + Invalidate(); + _UpdateScrollBarRange(); + int32 offset = _LineAt(0); + fVisibleTextBuffer->SynchronizeWith(fTextBuffer, offset, offset, + offset + fTextBuffer->Height() + 2); + info.Reset(); + return; + } + + BRect bounds = Bounds(); + int32 firstVisible = _LineAt(0); + int32 lastVisible = _LineAt(bounds.bottom); + int32 historySize = fTextBuffer->HistorySize(); + bool doScroll = false; if (linesScrolled > 0) { _UpdateScrollBarRange(); Modified: haiku/trunk/src/apps/terminal/TerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TerminalBuffer.cpp 2008-06-17 20:00:51 UTC (rev 26002) +++ haiku/trunk/src/apps/terminal/TerminalBuffer.cpp 2008-06-17 22:49:06 UTC (rev 26003) @@ -5,6 +5,8 @@ #include "TerminalBuffer.h" +#include <algorithm> + #include <Message.h> #include "Coding.h" @@ -18,6 +20,9 @@ : BLocker("terminal buffer"), fEncoding(M_UTF8), + fAlternateScreen(NULL), + fAlternateHistory(NULL), + fAlternateScreenOffset(0), fListenerValid(false) { } @@ -25,6 +30,8 @@ TerminalBuffer::~TerminalBuffer() { + delete fAlternateScreen; + delete fAlternateHistory; } @@ -34,6 +41,10 @@ if (Sem() < 0) return Sem(); + fAlternateScreen = _AllocateLines(width, height); + if (fAlternateScreen == NULL) + return B_NO_MEMORY; + return BasicTerminalBuffer::Init(width, height, historySize); } @@ -95,3 +106,100 @@ if (fListenerValid) fListener.SendMessage(MSG_TERMINAL_BUFFER_CHANGED); } + + +status_t +TerminalBuffer::ResizeTo(int32 width, int32 height) +{ + int32 historyCapacity = 0; + if (!fAlternateScreenActive) + historyCapacity = HistoryCapacity(); + else if (fAlternateHistory != NULL) + historyCapacity = fAlternateHistory->Capacity(); + + return ResizeTo(width, height, historyCapacity); +} + + +status_t +TerminalBuffer::ResizeTo(int32 width, int32 height, int32 historyCapacity) +{ + // switch to the normal screen buffer first + bool alternateScreenActive = fAlternateScreenActive; + if (alternateScreenActive) + _SwitchScreenBuffer(); + + int32 oldWidth = fWidth; + int32 oldHeight = fHeight; + + // Resize the normal screen buffer/history. + status_t error = BasicTerminalBuffer::ResizeTo(width, height, + historyCapacity); + if (error != B_OK) { + if (alternateScreenActive) + _SwitchScreenBuffer(); + return error; + } + + TermPos cursor = fCursor; + + // Switch to the alternate screen buffer and resize it. + if (fAlternateScreen != NULL) { + _SwitchScreenBuffer(); + + fWidth = oldWidth; + fHeight = oldHeight; + fCursor.SetTo(0, 0); + + error = BasicTerminalBuffer::ResizeTo(width, height, 0); + if (error != B_OK) { + // This sucks -- we can't do anything about it. Delete the + // alternate screen buffer. + _FreeLines(fAlternateScreen, oldHeight); + fAlternateScreen = NULL; + } + + // Switch back. + if (!alternateScreenActive) + _SwitchScreenBuffer(); + + fWidth = width; + fHeight = height; + fCursor = cursor; + } + + return error; +} + + +void +TerminalBuffer::UseAlternateScreenBuffer() +{ + if (fAlternateScreenActive || fAlternateScreen == NULL) + return; + + _SwitchScreenBuffer(); + Clear(false); + _InvalidateAll(); +} + + +void +TerminalBuffer::UseNormalScreenBuffer() +{ + if (!fAlternateScreenActive) + return; + + _SwitchScreenBuffer(); + _InvalidateAll(); +} + + +void +TerminalBuffer::_SwitchScreenBuffer() +{ + std::swap(fScreen, fAlternateScreen); + std::swap(fHistory, fAlternateHistory); + std::swap(fScreenOffset, fAlternateScreenOffset); + fAlternateScreenActive = !fAlternateScreenActive; +} Modified: haiku/trunk/src/apps/terminal/TerminalBuffer.h =================================================================== --- haiku/trunk/src/apps/terminal/TerminalBuffer.h 2008-06-17 20:00:51 UTC (rev 26002) +++ haiku/trunk/src/apps/terminal/TerminalBuffer.h 2008-06-17 22:49:06 UTC (rev 26003) @@ -28,12 +28,26 @@ void SetTitle(const char* title); void NotifyQuit(int32 reason); + virtual status_t ResizeTo(int32 width, int32 height); + virtual status_t ResizeTo(int32 width, int32 height, + int32 historyCapacity); + + void UseAlternateScreenBuffer(); + void UseNormalScreenBuffer(); + protected: virtual void NotifyListener(); private: + void _SwitchScreenBuffer(); + +private: int fEncoding; + TerminalLine** fAlternateScreen; + HistoryBuffer* fAlternateHistory; + int32 fAlternateScreenOffset; + // listener/dirty region management BMessenger fListener; bool fListenerValid; From leavengood at gmail.com Wed Jun 18 01:20:03 2008 From: leavengood at gmail.com (Ryan Leavengood) Date: Tue, 17 Jun 2008 19:20:03 -0400 Subject: [Haiku-commits] r25997 - in haiku/trunk/src/add-ons/input_server/methods: . pen pen/compat In-Reply-To: <290774785-BeMail@laptop> References: <b6b105e70806170947s70218a0p6f8472745dc64a98@mail.gmail.com> <290774785-BeMail@laptop> Message-ID: <a4855ac50806171620w36709cf9x3abd948b9565614@mail.gmail.com> On Tue, Jun 17, 2008 at 3:19 PM, Fran?ois Revol <revol at free.fr> wrote: > > That's old code that was written long ago and needs style cleanup. I think adding code and cleaning it up later is fine. This makes a good project for newbies anyhow. If we waited until the code was cleaned up before committing it might never get committed. That probably happens too much already anyhow ;) Ryan From bonefish at mail.berlios.de Wed Jun 18 06:12:47 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 18 Jun 2008 06:12:47 +0200 Subject: [Haiku-commits] r26004 - haiku/trunk/src/apps/terminal Message-ID: <200806180412.m5I4ClAJ028146@sheep.berlios.de> Author: bonefish Date: 2008-06-18 06:12:46 +0200 (Wed, 18 Jun 2008) New Revision: 26004 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26004&view=rev Modified: haiku/trunk/src/apps/terminal/TerminalBuffer.cpp Log: * Forgot to clear the lines of the alternate screen buffer on initialization. This would lead to crashes when resizing. * Shuffled code in ResizeTo() a bit to make it more robust in case of error (out of memory). Modified: haiku/trunk/src/apps/terminal/TerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TerminalBuffer.cpp 2008-06-17 22:49:06 UTC (rev 26003) +++ haiku/trunk/src/apps/terminal/TerminalBuffer.cpp 2008-06-18 04:12:46 UTC (rev 26004) @@ -45,6 +45,9 @@ if (fAlternateScreen == NULL) return B_NO_MEMORY; + for (int32 i = 0; i < height; i++) + fAlternateScreen[i]->Clear(); + return BasicTerminalBuffer::Init(width, height, historySize); } @@ -141,31 +144,31 @@ return error; } - TermPos cursor = fCursor; - // Switch to the alternate screen buffer and resize it. if (fAlternateScreen != NULL) { - _SwitchScreenBuffer(); - + TermPos cursor = fCursor; + fCursor.SetTo(0, 0); fWidth = oldWidth; fHeight = oldHeight; - fCursor.SetTo(0, 0); + _SwitchScreenBuffer(); + error = BasicTerminalBuffer::ResizeTo(width, height, 0); + + fWidth = width; + fHeight = height; + fCursor = cursor; + + // Switch back. + if (!alternateScreenActive) + _SwitchScreenBuffer(); + if (error != B_OK) { // This sucks -- we can't do anything about it. Delete the // alternate screen buffer. _FreeLines(fAlternateScreen, oldHeight); fAlternateScreen = NULL; } - - // Switch back. - if (!alternateScreenActive) - _SwitchScreenBuffer(); - - fWidth = width; - fHeight = height; - fCursor = cursor; } return error; From bonefish at mail.berlios.de Wed Jun 18 06:14:06 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 18 Jun 2008 06:14:06 +0200 Subject: [Haiku-commits] r26005 - haiku/trunk/src/apps/terminal Message-ID: <200806180414.m5I4E6fh028437@sheep.berlios.de> Author: bonefish Date: 2008-06-18 06:14:06 +0200 (Wed, 18 Jun 2008) New Revision: 26005 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26005&view=rev Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp Log: * The old screen buffer wasn't freed in _ResizeSimple(). * Updated some debug output. Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-18 04:12:46 UTC (rev 26004) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-18 04:14:06 UTC (rev 26005) @@ -941,6 +941,9 @@ for (int32 i = endLine - firstLine; i < height; i++) lines[i]->Clear(); + _FreeLines(fScreen, fHeight); + fScreen = lines; + fWidth = width; fHeight = height; @@ -953,8 +956,6 @@ fCursor.x = width; fCursor.y -= firstLine; - fScreen = lines; - return B_OK; } @@ -1123,24 +1124,23 @@ _FreeLines(fScreen, fHeight); delete fHistory; + fScreen = screen; + fHistory = history; + //debug_printf(" cursor: (%ld, %ld) -> (%ld, %ld)\n", fCursor.x, fCursor.y, //cursor.x, cursor.y); fCursor.x = cursor.x; fCursor.y = cursor.y; -//debug_printf(" screen offset: %ld -> %ld\n", fScreenOffset, -//destScreenOffset % fHistoryCapacity); +//debug_printf(" screen offset: %ld -> %ld\n", fScreenOffset, destScreenOffset % height); fScreenOffset = destScreenOffset % height; -//debug_printf(" history size: %ld -> %ld\n", fHistorySize, destTotalLines - fHeight); -//debug_printf(" height %ld -> %ld\n", fHeight, tempHeight); +//debug_printf(" height %ld -> %ld\n", fHeight, height); +//debug_printf(" width %ld -> %ld\n", fWidth, width); fHeight = height; fWidth = width; fScrollTop = 0; fScrollBottom = fHeight - 1; - fScreen = screen; - fHistory = history; - return B_OK; } From bonefish at mail.berlios.de Wed Jun 18 15:02:42 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 18 Jun 2008 15:02:42 +0200 Subject: [Haiku-commits] r26006 - haiku/trunk/build/scripts Message-ID: <200806181302.m5ID2gBr023150@sheep.berlios.de> Author: bonefish Date: 2008-06-18 15:02:41 +0200 (Wed, 18 Jun 2008) New Revision: 26006 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26006&view=rev Modified: haiku/trunk/build/scripts/build_haiku_image Log: If it contains symlinks, resolve the image path. This avoids problems with certain Linux setups. Modified: haiku/trunk/build/scripts/build_haiku_image =================================================================== --- haiku/trunk/build/scripts/build_haiku_image 2008-06-18 04:14:06 UTC (rev 26005) +++ haiku/trunk/build/scripts/build_haiku_image 2008-06-18 13:02:41 UTC (rev 26006) @@ -30,6 +30,15 @@ shift fi +# If the haiku image path is a symlink resolve it now (makebootable needs the +# path of the actual device path under Linux). +if which readlink &> /dev/null; then + normalizedImagePath=$(readlink -e "$imagePath") + if [ $normalizedImagePath ]; then + imagePath="$normalizedImagePath" + fi +fi + # this adds the build library dir to LD_LIBRARY_PATH eval "$addBuildCompatibilityLibDir" From laplace at mail.berlios.de Wed Jun 18 20:25:16 2008 From: laplace at mail.berlios.de (laplace at mail.berlios.de) Date: Wed, 18 Jun 2008 20:25:16 +0200 Subject: [Haiku-commits] r26007 - in haiku/trunk/src/tests/add-ons/print: . ppd ppd/doc ppd/model ppd/parser ppd/shared ppd/test ppd/ui Message-ID: <200806181825.m5IIPG3R021319@sheep.berlios.de> Author: laplace Date: 2008-06-18 20:24:54 +0200 (Wed, 18 Jun 2008) New Revision: 26007 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26007&view=rev Added: haiku/trunk/src/tests/add-ons/print/ppd/ haiku/trunk/src/tests/add-ons/print/ppd/Jamfile haiku/trunk/src/tests/add-ons/print/ppd/doc/ haiku/trunk/src/tests/add-ons/print/ppd/doc/PPD_Object_Model.txt haiku/trunk/src/tests/add-ons/print/ppd/doc/TODO.txt haiku/trunk/src/tests/add-ons/print/ppd/model/ haiku/trunk/src/tests/add-ons/print/ppd/model/Jamfile haiku/trunk/src/tests/add-ons/print/ppd/model/PPD.cpp haiku/trunk/src/tests/add-ons/print/ppd/model/PPD.h haiku/trunk/src/tests/add-ons/print/ppd/model/Statement.cpp haiku/trunk/src/tests/add-ons/print/ppd/model/Statement.h haiku/trunk/src/tests/add-ons/print/ppd/model/StatementList.cpp haiku/trunk/src/tests/add-ons/print/ppd/model/StatementList.h haiku/trunk/src/tests/add-ons/print/ppd/model/StatementListVisitor.cpp haiku/trunk/src/tests/add-ons/print/ppd/model/StatementListVisitor.h haiku/trunk/src/tests/add-ons/print/ppd/model/StatementWrapper.cpp haiku/trunk/src/tests/add-ons/print/ppd/model/StatementWrapper.h haiku/trunk/src/tests/add-ons/print/ppd/model/Value.cpp haiku/trunk/src/tests/add-ons/print/ppd/model/Value.h haiku/trunk/src/tests/add-ons/print/ppd/parser/ haiku/trunk/src/tests/add-ons/print/ppd/parser/CharacterClasses.h haiku/trunk/src/tests/add-ons/print/ppd/parser/Jamfile haiku/trunk/src/tests/add-ons/print/ppd/parser/PPDFile.cpp haiku/trunk/src/tests/add-ons/print/ppd/parser/PPDFile.h haiku/trunk/src/tests/add-ons/print/ppd/parser/PPDParser.cpp haiku/trunk/src/tests/add-ons/print/ppd/parser/PPDParser.h haiku/trunk/src/tests/add-ons/print/ppd/parser/Parser.cpp haiku/trunk/src/tests/add-ons/print/ppd/parser/Parser.h haiku/trunk/src/tests/add-ons/print/ppd/parser/Scanner.cpp haiku/trunk/src/tests/add-ons/print/ppd/parser/Scanner.h haiku/trunk/src/tests/add-ons/print/ppd/shared/ haiku/trunk/src/tests/add-ons/print/ppd/shared/AutoDelete.h haiku/trunk/src/tests/add-ons/print/ppd/test/ haiku/trunk/src/tests/add-ons/print/ppd/test/Jamfile haiku/trunk/src/tests/add-ons/print/ppd/test/MsgConsts.h haiku/trunk/src/tests/add-ons/print/ppd/test/PPDConfigApplication.cpp haiku/trunk/src/tests/add-ons/print/ppd/test/PPDConfigApplication.h haiku/trunk/src/tests/add-ons/print/ppd/test/PPDConfigApplication.rsrc haiku/trunk/src/tests/add-ons/print/ppd/test/Test.cpp haiku/trunk/src/tests/add-ons/print/ppd/test/Test.h haiku/trunk/src/tests/add-ons/print/ppd/test/TestParser.cpp haiku/trunk/src/tests/add-ons/print/ppd/test/TestScanner.cpp haiku/trunk/src/tests/add-ons/print/ppd/test/aptollw1.ppd haiku/trunk/src/tests/add-ons/print/ppd/test/header.txt haiku/trunk/src/tests/add-ons/print/ppd/test/include.ppd haiku/trunk/src/tests/add-ons/print/ppd/test/main.ppd haiku/trunk/src/tests/add-ons/print/ppd/test/readme.txt haiku/trunk/src/tests/add-ons/print/ppd/ui/ haiku/trunk/src/tests/add-ons/print/ppd/ui/Jamfile haiku/trunk/src/tests/add-ons/print/ppd/ui/PPDConfigView.cpp haiku/trunk/src/tests/add-ons/print/ppd/ui/PPDConfigView.h haiku/trunk/src/tests/add-ons/print/ppd/ui/PrinterSelection.cpp haiku/trunk/src/tests/add-ons/print/ppd/ui/PrinterSelection.h haiku/trunk/src/tests/add-ons/print/ppd/ui/UIUtils.cpp haiku/trunk/src/tests/add-ons/print/ppd/ui/UIUtils.h Modified: haiku/trunk/src/tests/add-ons/print/Jamfile Log: PPD parser and configuration UI prototype from 2004. Maybe it can be of some use for the CUPS port HCD 2008 project. Modified: haiku/trunk/src/tests/add-ons/print/Jamfile =================================================================== --- haiku/trunk/src/tests/add-ons/print/Jamfile 2008-06-18 13:02:41 UTC (rev 26006) +++ haiku/trunk/src/tests/add-ons/print/Jamfile 2008-06-18 18:24:54 UTC (rev 26007) @@ -1,5 +1,8 @@ SubDir HAIKU_TOP src tests add-ons print ; +# Skip PCL6 as jetlib.h is not in repository any more +# TODO if there are no license issues add it to directory "pcl6" +#SubInclude HAIKU_TOP src tests add-ons print pcl6 ; SubInclude HAIKU_TOP src tests add-ons print pdf ; -SubInclude HAIKU_TOP src tests add-ons print pcl6 ; +SubInclude HAIKU_TOP src tests add-ons print ppd ; SubInclude HAIKU_TOP src tests add-ons print transports ; Added: haiku/trunk/src/tests/add-ons/print/ppd/Jamfile =================================================================== --- haiku/trunk/src/tests/add-ons/print/ppd/Jamfile 2008-06-18 13:02:41 UTC (rev 26006) +++ haiku/trunk/src/tests/add-ons/print/ppd/Jamfile 2008-06-18 18:24:54 UTC (rev 26007) @@ -0,0 +1,6 @@ +SubDir HAIKU_TOP src tests add-ons print ppd ; + +SubInclude HAIKU_TOP src tests add-ons print ppd model ; +SubInclude HAIKU_TOP src tests add-ons print ppd parser ; +SubInclude HAIKU_TOP src tests add-ons print ppd ui ; +SubInclude HAIKU_TOP src tests add-ons print ppd test ; Added: haiku/trunk/src/tests/add-ons/print/ppd/doc/PPD_Object_Model.txt =================================================================== --- haiku/trunk/src/tests/add-ons/print/ppd/doc/PPD_Object_Model.txt 2008-06-18 13:02:41 UTC (rev 26006) +++ haiku/trunk/src/tests/add-ons/print/ppd/doc/PPD_Object_Model.txt 2008-06-18 18:24:54 UTC (rev 26007) @@ -0,0 +1,78 @@ +PPD + +# translationKeyword only if stand-alone = no *Keyword statements +"*Default"Keyword ":" StringValue ["/" translationString ]. +"*"Keyword [Option ["/" translationString ]] ":" Value ["/" translationString ]. +"*?"Keyword ":" InvocationValue ["/" translationString ]. +"*Param"Keyword [Option ["/" translationString ]] ":" Value ["/" translationString ]. + +Line comments start with "*%". + +*Include + +Keyword = ident. # ,'.',/ +Option = ident {"." ident}. +# translationString must not follow SymbolValue! +# translationString is terminated by ":" if it follows a Option +# or CR if it follows a Value. +Value = InvocationValue | QuotedValue | SymbolValue | StringValue | NoValue. + +# ps code +# requires statement with option keyword! +# Must end with in separate line *End if multiline. +InvocationValue = '"' printable '"' ["/" translationString ]. + +# requires statement without an option keyword! +# *JCL can have an option keyword! +# Must end with in separate line *End if multiline. +QuotedValue = '"' literalSubstring '"'. + +SymbolValue = "^" printable. # without whitespaces + +# In case of translation string it is separated by newline or slash. +StringValue = printable . # first char must not be " or ^ + +literalSubstring = { hexadecimalSubstring | char }. + +hexadecimalSubstring = "<" { whitespace* hexdigit hexdigit} ">". +hexdigit = ['0'..'9','a'..'f','A'..'F']. + +# No option keyword present. Keyword stands alone. +NoValue =. + +ident = identChar+. +identChar = [33..126]. + +printable = printableChar+. +printableChar = [32..126] | tab | lf | cr. # " belongs not to printableChar! + +translationString = literalSubstring. # without lf and cr. + +char = [32..255] | tab | lf | cr. + +whitespace= space | tab. + +tab=9. +lf=10. +cr=13. +space=32. + +max size of MainKeyword = 40 characters + +File Structure see 3.8 + +Standard Option Values: +True | False | None | Unknown + + +OpenUI Keyword: PickOne | PickMany | Boolean +CloseUI: Keyword +Open[Sub]Group: string +# InstallableOptions is a registered option! +Close[Sub]Group: string + +UIConstraints: keyword1 option1 keyword2 option2 +# option 1 can be omitted see page 57 + +# Unique name +ModelName: "text" \ No newline at end of file Added: haiku/trunk/src/tests/add-ons/print/ppd/doc/TODO.txt =================================================================== --- haiku/trunk/src/tests/add-ons/print/ppd/doc/TODO.txt 2008-06-18 13:02:41 UTC (rev 26006) +++ haiku/trunk/src/tests/add-ons/print/ppd/doc/TODO.txt 2008-06-18 18:24:54 UTC (rev 26007) @@ -0,0 +1,17 @@ +Scanner/Parser: + Handle JCLKeywords correctly. + Convert strings according to LanguageEncoding. + +PPDConfigView.cpp: + Add outline sub items in reverse order + Provide UI for single and multiple choice + Read settings + Write settings + Read default settings + Revert and OK button + Handle constraints + +Integrate to PS driver + - Page setup dialog + - Job setup dialog + - Provide PS driver setup model selection dialog Added: haiku/trunk/src/tests/add-ons/print/ppd/model/Jamfile =================================================================== --- haiku/trunk/src/tests/add-ons/print/ppd/model/Jamfile 2008-06-18 13:02:41 UTC (rev 26006) +++ haiku/trunk/src/tests/add-ons/print/ppd/model/Jamfile 2008-06-18 18:24:54 UTC (rev 26007) @@ -0,0 +1,12 @@ +SubDir HAIKU_TOP src tests add-ons print ppd model ; + +# SetSubDirSupportedPlatformsBeOSCompatible ; + +StaticLibrary libppdtest.a : + PPD.cpp + Statement.cpp + StatementList.cpp + StatementListVisitor.cpp + StatementWrapper.cpp + Value.cpp +; Added: haiku/trunk/src/tests/add-ons/print/ppd/model/PPD.cpp =================================================================== --- haiku/trunk/src/tests/add-ons/print/ppd/model/PPD.cpp 2008-06-18 13:02:41 UTC (rev 26006) +++ haiku/trunk/src/tests/add-ons/print/ppd/model/PPD.cpp 2008-06-18 18:24:54 UTC (rev 26007) @@ -0,0 +1,28 @@ +/* + * Copyright 2008, Haiku. + * Distributed under the terms of the MIT license. + * + * Authors: + * Michael Pfeiffer <laplace at users.sourceforge.net> + */ + +#include "PPD.h" + +#include <stdio.h> + +PPD::PPD() + : StatementList(true) + , fSymbols(false) +{ +} + +PPD::~PPD() +{ +} + +void PPD::Print() +{ + printf("<ppd>\n"); + StatementList::Print(); + printf("</ppd>\n"); +} Added: haiku/trunk/src/tests/add-ons/print/ppd/model/PPD.h =================================================================== --- haiku/trunk/src/tests/add-ons/print/ppd/model/PPD.h 2008-06-18 13:02:41 UTC (rev 26006) +++ haiku/trunk/src/tests/add-ons/print/ppd/model/PPD.h 2008-06-18 18:24:54 UTC (rev 26007) @@ -0,0 +1,28 @@ +/* + * Copyright 2008, Haiku. + * Distributed under the terms of the MIT license. + * + * Authors: + * Michael Pfeiffer <laplace at users.sourceforge.net> + */ + +#ifndef _PPD_H +#define _PPD_H + +#include "Statement.h" + +// PostScript Printer Definiton +class PPD : public StatementList { +private: + StatementList fSymbols; + +public: + PPD(); + virtual ~PPD(); + + // Prints the PPD to stdout in XML + void Print(); +}; + +#endif + Added: haiku/trunk/src/tests/add-ons/print/ppd/model/Statement.cpp =================================================================== --- haiku/trunk/src/tests/add-ons/print/ppd/model/Statement.cpp 2008-06-18 13:02:41 UTC (rev 26006) +++ haiku/trunk/src/tests/add-ons/print/ppd/model/Statement.cpp 2008-06-18 18:24:54 UTC (rev 26007) @@ -0,0 +1,187 @@ +/* + * Copyright 2008, Haiku. + * Distributed under the terms of the MIT license. + * + * Authors: + * Michael Pfeiffer <laplace at users.sourceforge.net> + */ + +#include "Statement.h" + +#include <stdio.h> + + +Statement::Statement() + : fType(kUnknown) + , fKeyword(NULL) + , fOption(NULL) + , fValue(NULL) + , fChildren(NULL) +{ +} + +Statement::~Statement() +{ + delete fKeyword; + delete fOption; + delete fValue; + delete fChildren; +} + +void Statement::SetType(Type type) +{ + fType = type; +} + +Statement::Type Statement::GetType() +{ + return fType; +} + +void Statement::SetKeyword(BString* keyword) +{ + fKeyword = keyword; +} + +BString* Statement::GetKeyword() +{ + return fKeyword; +} + +void Statement::SetOption(Value* option) +{ + fOption = option; +} + +Value* Statement::GetOption() +{ + return fOption; +} + + +void Statement::SetValue(Value* value) +{ + fValue = value; +} + +Value* Statement::GetValue() +{ + return fValue; +} + +StatementList* Statement::GetChildren() +{ + return fChildren; +} + +void Statement::AddChild(Statement* statement) +{ + if (fChildren == NULL) { + fChildren = new StatementList(true); + } + fChildren->Add(statement); +} + +const char* Statement::GetKeywordString() +{ + if (fKeyword != NULL) { + return fKeyword->String(); + } + return NULL; +} + +const char* Statement::GetOptionString() +{ + Value* option = GetOption(); + if (option != NULL) { + return option->GetValueString(); + } + return NULL; +} + +const char* Statement::GetTranslationString() +{ + Value* option = GetOption(); + if (option != NULL) { + return option->GetTranslationString(); + } + return NULL; +} + +const char* Statement::GetValueString() +{ + Value* value = GetValue(); + if (value != NULL) { + return value->GetValueString(); + } + return NULL; +} + +const char* Statement::GetValueTranslationString() +{ + Value* value = GetValue(); + if (value != NULL) { + return value->GetTranslationString(); + } + return NULL; +} + + +const char* Statement::ElementForType() { + switch (fType) { + case kDefault: return "Default"; + break; + case kParam: return "Param"; + break; + case kQuery: return "Query"; + break; + case kValue: return "Value"; + break; + case kUnknown: return "Unknown"; + break; + } + return NULL; +} + +void Statement::Print() +{ + bool hasValue = fValue != NULL; + bool hasOption = fOption != NULL; + + printf("<%s", ElementForType()); + + if (fKeyword != NULL) { + printf(" keyword=\"%s\"", fKeyword->String()); + } + + if (hasValue || hasOption) { + printf(">\n"); + } else { + printf("/>\n"); + } + + + if (hasOption) { + printf("\t<option>\n"); + fOption->Print(); + printf("\t</option>\n"); + } + + + if (hasValue) { + printf("\t<value>\n"); + fValue->Print(); + printf("\t</value>\n"); + } + + if (GetChildren() != NULL) { + printf("\t<children>\n"); + GetChildren()->Print(); + printf("\t</children>\n"); + } + + if (hasValue || hasOption) { + printf("</%s>\n\n", ElementForType()); + } +} + Added: haiku/trunk/src/tests/add-ons/print/ppd/model/Statement.h =================================================================== --- haiku/trunk/src/tests/add-ons/print/ppd/model/Statement.h 2008-06-18 13:02:41 UTC (rev 26006) +++ haiku/trunk/src/tests/add-ons/print/ppd/model/Statement.h 2008-06-18 18:24:54 UTC (rev 26007) @@ -0,0 +1,74 @@ +/* + * Copyright 2008, Haiku. + * Distributed under the terms of the MIT license. + * + * Authors: + * Michael Pfeiffer <laplace at users.sourceforge.net> + */ + +#ifndef _STATEMENT_H +#define _STATEMENT_H + +#include "StatementList.h" +#include "Value.h" + +class Statement +{ +public: + enum Type { + kDefault, + kQuery, + kValue, + kParam, + kUnknown + }; + +private: + Type fType; + BString* fKeyword; + Value* fOption; + Value* fValue; + StatementList* fChildren; + + const char* ElementForType(); + +public: + Statement(); + virtual ~Statement(); + + void SetType(Type type); + Type GetType(); + + void SetKeyword(BString* keyword); + // mandatory in a valid statement + BString* GetKeyword(); + + void SetOption(Value* value); + // optional in a valid statement + Value* GetOption(); + + void SetValue(Value* value); + // optional in a valid statement + Value* GetValue(); + + void AddChild(Statement* statement); + // optional in a valid statement + StatementList* GetChildren(); + + // convenience methods + bool IsDefaultStatement() { return fType == kDefault; } + bool IsQueryStatement() { return fType == kQuery; } + bool IsValueStatement() { return fType == kValue; } + bool IsParamStatement() { return fType == kParam; } + bool IsUnknownStatement() { return fType == kUnknown; } + + const char* GetKeywordString(); + const char* GetOptionString(); + const char* GetTranslationString(); + const char* GetValueString(); + const char* GetValueTranslationString(); + + void Print(); +}; + +#endif Added: haiku/trunk/src/tests/add-ons/print/ppd/model/StatementList.cpp =================================================================== --- haiku/trunk/src/tests/add-ons/print/ppd/model/StatementList.cpp 2008-06-18 13:02:41 UTC (rev 26006) +++ haiku/trunk/src/tests/add-ons/print/ppd/model/StatementList.cpp 2008-06-18 18:24:54 UTC (rev 26007) @@ -0,0 +1,74 @@ +/* + * Copyright 2008, Haiku. + * Distributed under the terms of the MIT license. + * + * Authors: + * Michael Pfeiffer <laplace at users.sourceforge.net> + */ + +#include "StatementList.h" +#include "Statement.h" + +#include <stdio.h> + +StatementList::StatementList(bool ownsStatements) + : fOwnsStatements(ownsStatements) +{ +} + +StatementList::~StatementList() +{ + if (fOwnsStatements) { + for (int32 i = 0; i < Size(); i ++) { + Statement* statement = StatementAt(i); + delete statement; + } + } + fList.MakeEmpty(); +} + +void StatementList::Add(Statement* statement) +{ + fList.AddItem(statement); +} + +void StatementList::Remove(Statement* statement) +{ + fList.RemoveItem(statement); +} + +int32 StatementList::Size() +{ + return fList.CountItems(); +} + +Statement* StatementList::StatementAt(int32 index) +{ + return (Statement*)fList.ItemAt(index); +} + +Statement* StatementList::GetStatement(const char* keyword) +{ + for (int32 i = 0; i < fList.CountItems(); i ++) { + if (strcmp(keyword, StatementAt(i)->GetKeywordString()) == 0) { + return StatementAt(i); + } + } + return NULL; +} + +const char* StatementList::GetValue(const char* keyword) +{ + Statement* statement = GetStatement(keyword); + if (statement != NULL) { + return statement->GetValueString(); + } + return NULL; +} + +void StatementList::Print() +{ + for (int32 i = 0; i < Size(); i ++) { + StatementAt(i)->Print(); + } +} Added: haiku/trunk/src/tests/add-ons/print/ppd/model/StatementList.h =================================================================== --- haiku/trunk/src/tests/add-ons/print/ppd/model/StatementList.h 2008-06-18 13:02:41 UTC (rev 26006) +++ haiku/trunk/src/tests/add-ons/print/ppd/model/StatementList.h 2008-06-18 18:24:54 UTC (rev 26007) @@ -0,0 +1,36 @@ +/* + * Copyright 2008, Haiku. + * Distributed under the terms of the MIT license. + * + * Authors: + * Michael Pfeiffer <laplace at users.sourceforge.net> + */ + +#ifndef _STATEMENT_LIST_H +#define _STATEMENT_LIST_H + +#include <List.h> + +class Statement; + +class StatementList { +private: + BList fList; + bool fOwnsStatements; + +public: + StatementList(bool ownsStatements); + ~StatementList(); + + void Add(Statement* statement); + void Remove(Statement* statement); + int32 Size(); + Statement* StatementAt(int32 index); + + Statement* GetStatement(const char* keyword); + const char* GetValue(const char* keyword); + + void Print(); +}; + +#endif Added: haiku/trunk/src/tests/add-ons/print/ppd/model/StatementListVisitor.cpp =================================================================== --- haiku/trunk/src/tests/add-ons/print/ppd/model/StatementListVisitor.cpp 2008-06-18 13:02:41 UTC (rev 26006) +++ haiku/trunk/src/tests/add-ons/print/ppd/model/StatementListVisitor.cpp 2008-06-18 18:24:54 UTC (rev 26007) @@ -0,0 +1,43 @@ +/* + * Copyright 2008, Haiku. + * Distributed under the terms of the MIT license. + * + * Authors: + * Michael Pfeiffer <laplace at users.sourceforge.net> + */ + +#include "StatementListVisitor.h" + +void StatementListVisitor::Visit(StatementList* list) +{ + if (list == NULL) return; + + const int32 n = list->Size(); + for (int32 i = 0; i < n; i ++) { + Statement* statement = list->StatementAt(i); + GroupStatement group(statement); + if (group.IsOpenGroup()) { + BeginGroup(&group); + fLevel ++; + } else if (statement->IsValueStatement()) { + DoValue(statement); + } else if (statement->IsDefaultStatement()) { + DoDefault(statement); + } else if (statement->IsQueryStatement()) { + DoQuery(statement); + } else if (statement->IsParamStatement()) { + DoParam(statement); + } + + StatementList* children = statement->GetChildren(); + if (children != NULL) { + Visit(children); + } + + // Close statements have been removed + if (group.IsOpenGroup()) { + fLevel --; + EndGroup(&group); + } + } +} Added: haiku/trunk/src/tests/add-ons/print/ppd/model/StatementListVisitor.h =================================================================== --- haiku/trunk/src/tests/add-ons/print/ppd/model/StatementListVisitor.h 2008-06-18 13:02:41 UTC (rev 26006) +++ haiku/trunk/src/tests/add-ons/print/ppd/model/StatementListVisitor.h 2008-06-18 18:24:54 UTC (rev 26007) @@ -0,0 +1,36 @@ +/* + * Copyright 2008, Haiku. + * Distributed under the terms of the MIT license. + * + * Authors: + * Michael Pfeiffer <laplace at users.sourceforge.net> + */ + +#ifndef _STATEMENT_LIST_VISITOR_H +#define _STATEMENT_LIST_VISITOR_H + +#include "StatementWrapper.h" +#include "StatementList.h" + +class StatementListVisitor { +private: + int32 fLevel; +public: + StatementListVisitor() : fLevel(0) {} + virtual ~StatementListVisitor() {} + + virtual void Visit(StatementList* list); + + // the nesting level + int32 GetLevel() const { return fLevel; } + + virtual void BeginGroup(GroupStatement* group) {}; + virtual void DoDefault(Statement* statement) {}; + virtual void DoQuery(Statement* statement) {}; + virtual void DoValue(Statement* statement) {}; + virtual void DoParam(Statement* statement) {}; + virtual void EndGroup(GroupStatement* group) {}; +}; + + +#endif Added: haiku/trunk/src/tests/add-ons/print/ppd/model/StatementWrapper.cpp =================================================================== --- haiku/trunk/src/tests/add-ons/print/ppd/model/StatementWrapper.cpp 2008-06-18 13:02:41 UTC (rev 26006) +++ haiku/trunk/src/tests/add-ons/print/ppd/model/StatementWrapper.cpp 2008-06-18 18:24:54 UTC (rev 26007) @@ -0,0 +1,120 @@ +/* + * Copyright 2008, Haiku. + * Distributed under the terms of the MIT license. + * + * Authors: + * Michael Pfeiffer <laplace at users.sourceforge.net> + */ + +#include "StatementWrapper.h" + +static const char* kOpenUIStatement = "OpenUI"; +static const char* kCloseUIStatement = "CloseUI"; + +static const char* kOpenGroupStatement = "OpenGroup"; +static const char* kCloseGroupStatement = "CloseGroup"; +static const char* kOpenSubGroupStatement = "OpenSubGroup"; +static const char* kCloseSubGroupStatement = "CloseSubGroup"; + +// JCL +static const char* kJCL = "JCL"; +static const char* kJCLOpenUIStatement = "JCLOpenUI"; +static const char* kJCLCloseUIStatement = "JCLCloseUI"; + + +StatementWrapper::StatementWrapper(Statement* statement) + : fStatement(statement) +{ + // nothing to do +} + +GroupStatement::GroupStatement(Statement* statement) + : StatementWrapper(statement) +{ + // nothing to do +} + +bool GroupStatement::IsUIGroup() +{ + return strcmp(GetKeyword(), kOpenUIStatement) == 0; +} + +bool GroupStatement::IsGroup() +{ + return strcmp(GetKeyword(), kOpenGroupStatement) == 0; +} + +bool GroupStatement::IsSubGroup() +{ + return strcmp(GetKeyword(), kOpenSubGroupStatement) == 0; +} + +bool GroupStatement::IsJCL() +{ + return strstr(GetKeyword(), kJCL) == GetKeyword(); +} + +bool GroupStatement::IsOpenGroup() +{ + const char* keyword = GetKeyword(); + + return strcmp(keyword, kOpenUIStatement) == 0 || + strcmp(keyword, kOpenGroupStatement) == 0 || + strcmp(keyword, kOpenSubGroupStatement) == 0 || + strcmp(keyword, kJCLOpenUIStatement) == 0; +} + +bool GroupStatement::IsCloseGroup() +{ + const char* keyword = GetKeyword(); + + return strcmp(keyword, kCloseUIStatement) == 0 || + strcmp(keyword, kCloseGroupStatement) == 0 || + strcmp(keyword, kCloseSubGroupStatement) == 0 || + strcmp(keyword, kJCLCloseUIStatement) == 0; +} + +Value* GroupStatement::GetValue() +{ + if (strcmp(GetKeyword(), kOpenUIStatement) == 0 || + strcmp(GetKeyword(), kJCLOpenUIStatement) == 0) { + return GetStatement()->GetOption(); + } else { + return GetStatement()->GetValue(); + } +} + +const char* GroupStatement::GetGroupName() +{ + Value* value = GetValue(); + if (value == NULL) return NULL; + BString* string = value->GetValue(); + if (string == NULL) return NULL; + const char* name = string->String(); + if (name != NULL && *name == '*') { + // skip '*' + name ++; + } + return name; +} + +const char* GroupStatement::GetGroupTranslation() +{ + Value* value = GetValue(); + if (value == NULL) return NULL; + BString* string = value->GetTranslation(); + if (string == NULL) return NULL; + return string->String(); +} + +GroupStatement::Type GroupStatement::GetType() +{ + const char* type = GetStatement()->GetValueString(); + if (type == NULL) return kUnknown; + + if (strstr(type, "PickOne") != NULL) return kPickOne; + if (strstr(type, "PickMany") != NULL) return kPickMany; + if (strstr(type, "Boolean") != NULL) return kBoolean; + + return kUnknown; +} Added: haiku/trunk/src/tests/add-ons/print/ppd/model/StatementWrapper.h =================================================================== --- haiku/trunk/src/tests/add-ons/print/ppd/model/StatementWrapper.h 2008-06-18 13:02:41 UTC (rev 26006) +++ haiku/trunk/src/tests/add-ons/print/ppd/model/StatementWrapper.h 2008-06-18 18:24:54 UTC (rev 26007) @@ -0,0 +1,92 @@ +/* + * Copyright 2008, Haiku. + * Distributed under the terms of the MIT license. + * + * Authors: + * Michael Pfeiffer <laplace at users.sourceforge.net> + */ + +#ifndef _STATEMENT_WRAPPER_H +#define _STATEMENT_WRAPPER_H + +#include "Statement.h" + +// wrapper classes to provide specific access to +// statement members + +class StatementWrapper +{ +private: + Statement* fStatement; + +public: + StatementWrapper(Statement* statement); + + Statement* GetStatement() { return fStatement; } + const char* GetKeyword() { return fStatement->GetKeyword()->String(); } +}; + +class GroupStatement : public StatementWrapper +{ +private: + Value* GetValue(); + +public: + GroupStatement(Statement* statement); + + // test methods if the wrapped statement is a group statement + bool IsUIGroup(); + bool IsGroup(); + bool IsSubGroup(); + + bool IsOpenGroup(); + bool IsCloseGroup(); + + bool IsJCL(); + + // accessors + const char* GetGroupName(); + const char* GetGroupTranslation(); + + enum Type { + kPickOne, + kPickMany, + kBoolean, + kUnknown + }; + + Type GetType(); +}; + +class ConstraintsStatement : public StatementWrapper +{ +public: + ConstraintsStatement(Statement* statement); + + // is this realy a constraints statement + bool IsConstraints(); + + const char* GetFirstKeyword(); + const char* GetFirstOption(); + const char* GetSecondKeyword(); + const char* GetSecondOption(); +}; + +class OrderDependencyStatement : public StatementWrapper +{ +public: + OrderDependencyStatement(Statement* statement); + + // is this realy a order dependency statement + bool IsOrderDependency(); + + // is this a NonUIOrderDependencyStatement + bool IsNonUI(); + + float GetOrder(); + const char* GetSection(); + const char* GetKeyword(); + const char* GetOption(); +}; + +#endif Added: haiku/trunk/src/tests/add-ons/print/ppd/model/Value.cpp =================================================================== --- haiku/trunk/src/tests/add-ons/print/ppd/model/Value.cpp 2008-06-18 13:02:41 UTC (rev 26006) +++ haiku/trunk/src/tests/add-ons/print/ppd/model/Value.cpp 2008-06-18 18:24:54 UTC (rev 26007) @@ -0,0 +1,100 @@ +/* + * Copyright 2008, Haiku. + * Distributed under the terms of the MIT license. + * + * Authors: + * Michael Pfeiffer <laplace at users.sourceforge.net> + */ + +#include "Value.h" + +#include <stdio.h> + +Value::Value(BString* value, Type type) + : fType(type) + , fValue(value) + , fTranslation(NULL) +{ +} + +Value::~Value() +{ + delete fValue; + delete fTranslation; +} + +void Value::SetType(Type type) +{ + fType = type; +} + +Value::Type Value::GetType() +{ + return fType; +} + +void Value::SetValue(BString* value) +{ + fValue = value; +} + +BString* Value::GetValue() +{ + return fValue; +} + +void Value::SetTranslation(BString* translation) +{ + fTranslation = translation; +} + +BString* Value::GetTranslation() +{ + return fTranslation; +} + +const char* Value::GetValueString() +{ + if (fValue != NULL) { + return fValue->String(); + } + return NULL; +} + +const char* Value::GetTranslationString() [... truncated: 6981 lines follow ...] From oruizdorantes at mail.berlios.de Wed Jun 18 21:17:42 2008 From: oruizdorantes at mail.berlios.de (oruizdorantes at mail.berlios.de) Date: Wed, 18 Jun 2008 21:17:42 +0200 Subject: [Haiku-commits] r26008 - in haiku/trunk: headers/private/bluetooth src/kits/bluetooth Message-ID: <200806181917.m5IJHgVg025540@sheep.berlios.de> Author: oruizdorantes Date: 2008-06-18 21:17:35 +0200 (Wed, 18 Jun 2008) New Revision: 26008 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26008&view=rev Modified: haiku/trunk/headers/private/bluetooth/CommandManager.h haiku/trunk/src/kits/bluetooth/CommandManager.cpp Log: -Wrong header for function, indenting... Modified: haiku/trunk/headers/private/bluetooth/CommandManager.h =================================================================== --- haiku/trunk/headers/private/bluetooth/CommandManager.h 2008-06-18 18:24:54 UTC (rev 26007) +++ haiku/trunk/headers/private/bluetooth/CommandManager.h 2008-06-18 19:17:35 UTC (rev 26008) @@ -21,7 +21,7 @@ void* buildInquiry(uint32 lap, uint8 length, uint8 num_rsp, size_t* outsize); void* buildInquiryCancel(size_t* outsize); void* buildPinCodeRequestReply(bdaddr_t bdaddr, uint8 length, char pincode[16], size_t* outsize); -void* buildPinCodeRequestNegativeReply(bdaddr_t bdaddr, uint8 length, char pincode[16], size_t* outsize); +void* buildPinCodeRequestNegativeReply(bdaddr_t bdaddr, size_t* outsize); /* OGF_INFORMATIONAL_PARAM */ void* buildReadBufferSize(size_t* outsize); Modified: haiku/trunk/src/kits/bluetooth/CommandManager.cpp =================================================================== --- haiku/trunk/src/kits/bluetooth/CommandManager.cpp 2008-06-18 18:24:54 UTC (rev 26007) +++ haiku/trunk/src/kits/bluetooth/CommandManager.cpp 2008-06-18 19:17:35 UTC (rev 26008) @@ -146,8 +146,8 @@ if (command != NULL) { - param->lap[2] = (lap >> 16) & 0xFF; - param->lap[1] = (lap >> 8) & 0xFF; + param->lap[2] = (lap >> 16) & 0xFF; + param->lap[1] = (lap >> 8) & 0xFF; param->lap[0] = (lap >> 0) & 0xFF; param->length = length; param->num_rsp = num_rsp; @@ -186,7 +186,7 @@ } -void* buildPinCodeRequestNegativeReply(bdaddr_t bdaddr, uint8 length, char pincode[16], size_t* outsize) +void* buildPinCodeRequestNegativeReply(bdaddr_t bdaddr, size_t* outsize) { struct hci_cp_pin_code_neg_reply* param; @@ -196,7 +196,7 @@ if (command != NULL) { - param->bdaddr = bdaddr; + param->bdaddr = bdaddr; } From mmlr at mail.berlios.de Wed Jun 18 21:55:53 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Wed, 18 Jun 2008 21:55:53 +0200 Subject: [Haiku-commits] r26009 - in haiku/trunk: headers/private/kernel src/system/kernel src/system/kernel/vm Message-ID: <200806181955.m5IJtrUa028948@sheep.berlios.de> Author: mmlr Date: 2008-06-18 21:55:51 +0200 (Wed, 18 Jun 2008) New Revision: 26009 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26009&view=rev Modified: haiku/trunk/headers/private/kernel/heap.h haiku/trunk/src/system/kernel/heap.cpp haiku/trunk/src/system/kernel/vm/vm.cpp haiku/trunk/src/system/kernel/vm/vm_address_space.cpp haiku/trunk/src/system/kernel/vm/vm_cache.cpp haiku/trunk/src/system/kernel/vm/vm_store_anonymous_noswap.cpp haiku/trunk/src/system/kernel/vm/vm_store_device.c haiku/trunk/src/system/kernel/vm/vm_store_null.c Log: * Added malloc_nogrow() function that does allocation without triggering or waiting for a heap grow. * Use that nogrow version in the VM code to avoid a deadlock with the address space lock when a grow operation would try to create an area while a malloc happened from such a function in the VM. * When waiting for a grow to happen, notify the waiting thread from the grower also if it failed to allocate a new heap. Otherwise a thread would just sit there and wait until another thread requested growing too and that one succeeded (or just forever in the worst case). * Make the dedicated grow heap growable too. If the current grow heaps run low on memory it will instruct the grower to allocate a new grow heap. This reduces the likelyhood of running out of memory with no way to grow to a minimum. As the growing is done asynchronously it is still possible to happen, but it is highly unlikely as the grow heap is solely used to allocate memory in the process of creating new heap areas and it will even try using normal public memory if the dedicated memory has run out. * Reduced the dedicated grow heap from 2 to 1MB. As it can now grow itself, it doesn't need to last so long. * Extract heap creation into it's own function that does area creation and heap attach and use this function for growing normal and grow heaps. Modified: haiku/trunk/headers/private/kernel/heap.h =================================================================== --- haiku/trunk/headers/private/kernel/heap.h 2008-06-18 19:17:35 UTC (rev 26008) +++ haiku/trunk/headers/private/kernel/heap.h 2008-06-18 19:55:51 UTC (rev 26009) @@ -14,14 +14,18 @@ #define INITIAL_HEAP_SIZE 16 * 1024 * 1024 // grow by another 8MB each time the heap runs out of memory #define HEAP_GROW_SIZE 8 * 1024 * 1024 -// allocate a dedicated 2MB area for dynamic growing -#define HEAP_DEDICATED_GROW_SIZE 2 * 1024 * 1024 +// allocate a dedicated 1MB area for dynamic growing +#define HEAP_DEDICATED_GROW_SIZE 1 * 1024 * 1024 #ifdef __cplusplus extern "C" { #endif +// malloc_nogrow disallows waiting for a grow to happen - only to be used by +// vm functions that may deadlock on a triggered area creation +void *malloc_nogrow(size_t size); + void *memalign(size_t alignment, size_t size); void deferred_free(void* block); Modified: haiku/trunk/src/system/kernel/heap.cpp =================================================================== --- haiku/trunk/src/system/kernel/heap.cpp 2008-06-18 19:17:35 UTC (rev 26008) +++ haiku/trunk/src/system/kernel/heap.cpp 2008-06-18 19:55:51 UTC (rev 26009) @@ -101,10 +101,11 @@ static heap_allocator *sHeapList = NULL; static heap_allocator *sLastGrowRequest = NULL; -static heap_allocator *sGrowHeap = NULL; +static heap_allocator *sGrowHeapList = NULL; static thread_id sHeapGrowThread = -1; static sem_id sHeapGrowSem = -1; static sem_id sHeapGrownNotify = -1; +static bool sAddGrowHeap = false; static DeferredFreeList sDeferredFreeList; static spinlock sDeferredFreeListLock; @@ -257,8 +258,12 @@ if (argc == 2) { if (strcmp(argv[1], "grow") == 0) { // only dump dedicated grow heap info - dprintf("dedicated grow heap:\n"); - dump_allocator(sGrowHeap); + dprintf("dedicated grow heap(s):\n"); + heap_allocator *heap = sGrowHeapList; + while (heap) { + dump_allocator(heap); + heap = heap->next; + } } else if (strcmp(argv[1], "stats") == 0) { uint32 heapCount = 0; heap_allocator *heap = sHeapList; @@ -1177,15 +1182,61 @@ // #pragma mark - +static heap_allocator * +heap_create_new_heap(const char *name, size_t size) +{ + void *heapAddress = NULL; + area_id heapArea = create_area(name, &heapAddress, + B_ANY_KERNEL_BLOCK_ADDRESS, size, B_FULL_LOCK, + B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA); + if (heapArea < B_OK) { + TRACE(("heap: couldn't allocate heap \"%s\"\n", name)); + return NULL; + } + + heap_allocator *newHeap = heap_attach((addr_t)heapAddress, size); + if (newHeap == NULL) { + panic("heap: could not attach heap to area!\n"); + delete_area(heapArea); + return NULL; + } + +#if PARANOID_VALIDATION + heap_validate_heap(newHeap); +#endif + return newHeap; +} + + static int32 heap_grow_thread(void *) { heap_allocator *heap = sHeapList; + heap_allocator *growHeap = sGrowHeapList; while (true) { // wait for a request to grow the heap list if (acquire_sem(sHeapGrowSem) < B_OK) continue; + if (sAddGrowHeap) { + while (growHeap->next) + growHeap = growHeap->next; + + // the last grow heap is going to run full soon, try to allocate + // a new one to make some room. + TRACE(("heap_grower: grow heaps will run out of memory soon\n")); + heap_allocator *newHeap = heap_create_new_heap( + "additional grow heap", HEAP_DEDICATED_GROW_SIZE); + if (newHeap != NULL) { +#if PARANOID_VALIDATION + heap_validate_heap(newHeap); +#endif + growHeap->next = newHeap; + sAddGrowHeap = false; + TRACE(("heap_grower: new grow heap %p linked in\n", newHeap)); + } + } + // find the last heap while (heap->next) heap = heap->next; @@ -1196,28 +1247,15 @@ } TRACE(("heap_grower: kernel heap will run out of memory soon, allocating new one\n")); - void *heapAddress = NULL; - area_id heapArea = create_area("additional heap", &heapAddress, - B_ANY_KERNEL_BLOCK_ADDRESS, HEAP_GROW_SIZE, B_FULL_LOCK, - B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA); - if (heapArea < B_OK) { - panic("heap_grower: couldn't allocate additional heap area\n"); - continue; - } - - heap_allocator *newHeap = heap_attach((addr_t)heapAddress, + heap_allocator *newHeap = heap_create_new_heap("additional heap", HEAP_GROW_SIZE); - if (newHeap == NULL) { - panic("heap_grower: could not attach additional heap!\n"); - delete_area(heapArea); - continue; - } - + if (newHeap != NULL) { #if PARANOID_VALIDATION - heap_validate_heap(newHeap); + heap_validate_heap(newHeap); #endif - heap->next = newHeap; - TRACE(("heap_grower: new heap linked in\n")); + heap->next = newHeap; + TRACE(("heap_grower: new heap linked in\n")); + } // notify anyone waiting for this request release_sem_etc(sHeapGrownNotify, -1, B_RELEASE_ALL); @@ -1282,19 +1320,10 @@ status_t heap_init_post_thread() { - void *dedicated = NULL; - area_id area = create_area("heap dedicated grow", &dedicated, - B_ANY_KERNEL_BLOCK_ADDRESS, HEAP_DEDICATED_GROW_SIZE, B_FULL_LOCK, - B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA); - if (area < 0) { - panic("heap_init_post_thread(): cannot allocate dedicated grow memory\n"); - return area; - } - - sGrowHeap = heap_attach((addr_t)dedicated, HEAP_DEDICATED_GROW_SIZE); - if (sGrowHeap == NULL) { + sGrowHeapList = heap_create_new_heap("dedicated grow heap", + HEAP_DEDICATED_GROW_SIZE); + if (sGrowHeapList == NULL) { panic("heap_init_post_thread(): failed to attach dedicated grow heap\n"); - delete_area(area); return B_ERROR; } @@ -1302,7 +1331,6 @@ B_URGENT_PRIORITY, NULL); if (sHeapGrowThread < 0) { panic("heap_init_post_thread(): cannot create heap grow thread\n"); - delete_area(area); return sHeapGrowThread; } @@ -1331,17 +1359,6 @@ return NULL; } - if (thread_get_current_thread_id() == sHeapGrowThread) { - // this is the grower thread, allocate from our dedicated memory - void *result = heap_memalign(sGrowHeap, alignment, size, NULL); - if (result == NULL) { - panic("heap: grow thread ran out of dedicated memory!\n"); - return NULL; - } - - return result; - } - heap_allocator *heap = sHeapList; while (heap) { bool shouldGrow = false; @@ -1352,6 +1369,10 @@ if (result == NULL) { // urgent request, do the request and wait switch_sem(sHeapGrowSem, sHeapGrownNotify); + if (heap->next == NULL) { + // the grower didn't manage to add a new heap + return NULL; + } } else { // not so urgent, just notify the grower release_sem_etc(sHeapGrowSem, 1, B_DO_NOT_RESCHEDULE); @@ -1376,6 +1397,46 @@ void * +malloc_nogrow(size_t size) +{ + // use dedicated memory in the grow thread by default + if (thread_get_current_thread_id() == sHeapGrowThread) { + bool shouldGrow = false; + heap_allocator *heap = sGrowHeapList; + while (heap) { + void *result = heap_memalign(heap, 0, size, &shouldGrow); + if (shouldGrow && heap->next == NULL && !sAddGrowHeap) { + // hopefully the heap grower will manage to create a new heap + // before running out of private memory... + dprintf("heap: requesting new grow heap\n"); + sAddGrowHeap = true; + release_sem_etc(sHeapGrowSem, 1, B_DO_NOT_RESCHEDULE); + } + + if (result != NULL) + return result; + + heap = heap->next; + } + } + + // try public memory, there might be something available + heap_allocator *heap = sHeapList; + while (heap) { + void *result = heap_memalign(heap, 0, size, NULL); + if (result != NULL) + return result; + + heap = heap->next; + } + + // no memory available + panic("heap: all heaps have run out of memory\n"); + return NULL; +} + + +void * malloc(size_t size) { return memalign(0, size); @@ -1402,10 +1463,15 @@ heap = heap->next; } - // maybe it was allocated from the dedicated grow heap - if (heap_free(sGrowHeap, address) == B_OK) - return; + // maybe it was allocated from a dedicated grow heap + heap = sGrowHeapList; + while (heap) { + if (heap_free(heap, address) == B_OK) + return; + heap = heap->next; + } + panic("free(): free failed for address %p\n", address); } Modified: haiku/trunk/src/system/kernel/vm/vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm.cpp 2008-06-18 19:17:35 UTC (rev 26008) +++ haiku/trunk/src/system/kernel/vm/vm.cpp 2008-06-18 19:55:51 UTC (rev 26009) @@ -810,7 +810,7 @@ static vm_area * create_reserved_area_struct(vm_address_space *addressSpace, uint32 flags) { - vm_area *reserved = (vm_area *)malloc(sizeof(vm_area)); + vm_area *reserved = (vm_area *)malloc_nogrow(sizeof(vm_area)); if (reserved == NULL) return NULL; @@ -833,11 +833,11 @@ if (length > B_OS_NAME_LENGTH) length = B_OS_NAME_LENGTH; - vm_area *area = (vm_area *)malloc(sizeof(vm_area)); + vm_area *area = (vm_area *)malloc_nogrow(sizeof(vm_area)); if (area == NULL) return NULL; - area->name = (char *)malloc(length); + area->name = (char *)malloc_nogrow(length); if (area->name == NULL) { free(area); return NULL; @@ -2856,7 +2856,7 @@ vm_page_mapping *mapping = NULL; if (area->wiring == B_NO_LOCK) { - mapping = (vm_page_mapping *)malloc(sizeof(vm_page_mapping)); + mapping = (vm_page_mapping *)malloc_nogrow(sizeof(vm_page_mapping)); if (mapping == NULL) return B_NO_MEMORY; Modified: haiku/trunk/src/system/kernel/vm/vm_address_space.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_address_space.cpp 2008-06-18 19:17:35 UTC (rev 26008) +++ haiku/trunk/src/system/kernel/vm/vm_address_space.cpp 2008-06-18 19:55:51 UTC (rev 26009) @@ -12,6 +12,7 @@ #include <vm.h> #include <vm_address_space.h> #include <vm_priv.h> +#include <heap.h> #include <thread.h> #include <util/khash.h> @@ -263,7 +264,7 @@ vm_address_space *addressSpace; status_t status; - addressSpace = (vm_address_space *)malloc(sizeof(vm_address_space)); + addressSpace = (vm_address_space *)malloc_nogrow(sizeof(vm_address_space)); if (addressSpace == NULL) return B_NO_MEMORY; Modified: haiku/trunk/src/system/kernel/vm/vm_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_cache.cpp 2008-06-18 19:17:35 UTC (rev 26008) +++ haiku/trunk/src/system/kernel/vm/vm_cache.cpp 2008-06-18 19:55:51 UTC (rev 26009) @@ -14,6 +14,7 @@ #include <arch/cpu.h> #include <condition_variable.h> #include <debug.h> +#include <heap.h> #include <int.h> #include <kernel.h> #include <lock.h> @@ -543,7 +544,7 @@ return NULL; } - cache = (vm_cache*)malloc(sizeof(vm_cache)); + cache = (vm_cache*)malloc_nogrow(sizeof(vm_cache)); if (cache == NULL) return NULL; Modified: haiku/trunk/src/system/kernel/vm/vm_store_anonymous_noswap.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_store_anonymous_noswap.cpp 2008-06-18 19:17:35 UTC (rev 26008) +++ haiku/trunk/src/system/kernel/vm/vm_store_anonymous_noswap.cpp 2008-06-18 19:55:51 UTC (rev 26009) @@ -9,6 +9,7 @@ #include "vm_store_anonymous_noswap.h" +#include <heap.h> #include <KernelExport.h> #include <vm_priv.h> #include <arch_config.h> @@ -165,7 +166,7 @@ vm_store_create_anonymous_noswap(bool canOvercommit, int32 numPrecommittedPages, int32 numGuardPages) { - anonymous_store *store = (anonymous_store *)malloc( + anonymous_store *store = (anonymous_store *)malloc_nogrow( sizeof(anonymous_store)); if (store == NULL) return NULL; Modified: haiku/trunk/src/system/kernel/vm/vm_store_device.c =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_store_device.c 2008-06-18 19:17:35 UTC (rev 26008) +++ haiku/trunk/src/system/kernel/vm/vm_store_device.c 2008-06-18 19:55:51 UTC (rev 26009) @@ -9,6 +9,7 @@ #include "vm_store_device.h" +#include <heap.h> #include <KernelExport.h> #include <vm_priv.h> @@ -87,7 +88,7 @@ struct vm_store * vm_store_create_device(addr_t baseAddress) { - struct device_store *store = malloc(sizeof(struct device_store)); + struct device_store *store = malloc_nogrow(sizeof(struct device_store)); if (store == NULL) return NULL; Modified: haiku/trunk/src/system/kernel/vm/vm_store_null.c =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_store_null.c 2008-06-18 19:17:35 UTC (rev 26008) +++ haiku/trunk/src/system/kernel/vm/vm_store_null.c 2008-06-18 19:55:51 UTC (rev 26009) @@ -9,6 +9,7 @@ #include "vm_store_null.h" +#include <heap.h> #include <stdlib.h> @@ -78,7 +79,7 @@ { struct vm_store *store; - store = malloc(sizeof(struct vm_store)); + store = malloc_nogrow(sizeof(struct vm_store)); if (store == NULL) return NULL; From revol at free.fr Wed Jun 18 22:13:23 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Wed, 18 Jun 2008 22:13:23 +0200 CEST Subject: [Haiku-commits] =?windows-1252?q?r26007_-_in_haiku/trunk/src/test?= =?windows-1252?q?s/add-ons/print=3A_=2E_ppd_ppd/doc_ppd/model_ppd/parser_?= =?windows-1252?q?ppd/shared_ppd/test_ppd/ui?= In-Reply-To: <200806181825.m5IIPG3R021319@sheep.berlios.de> Message-ID: <1454891589-BeMail@laptop> > PPD parser and configuration UI prototype from 2004. Maybe it can be > of some use for the CUPS port HCD 2008 project. Sadly CUPS has its own parser AFAIK (foomatic-rip or something), but maybe it can be stripped off along with some other needlessly large parts. Btw I once wrote a script once to download the PPDs from the lexmark website and convert them to the BeOS parser (it had some bugs with them), as I have a lexmark printer around. Distributing them directly might bring copyright issues, but maybe we could ask them for permission. OTH I think CUPS has its own large set of PPDs. Fran?ois. From oruizdorantes at mail.berlios.de Wed Jun 18 22:57:33 2008 From: oruizdorantes at mail.berlios.de (oruizdorantes at mail.berlios.de) Date: Wed, 18 Jun 2008 22:57:33 +0200 Subject: [Haiku-commits] r26010 - in haiku/trunk: headers/private/bluetooth src/kits/bluetooth src/kits/bluetooth/UI Message-ID: <200806182057.m5IKvXKo003496@sheep.berlios.de> Author: oruizdorantes Date: 2008-06-18 22:57:27 +0200 (Wed, 18 Jun 2008) New Revision: 26010 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26010&view=rev Added: haiku/trunk/headers/private/bluetooth/ConnectionIncoming.h haiku/trunk/headers/private/bluetooth/PincodeWindow.h haiku/trunk/src/kits/bluetooth/UI/ haiku/trunk/src/kits/bluetooth/UI/ConnectionIncoming.cpp haiku/trunk/src/kits/bluetooth/UI/PincodeWindow.cpp Log: Add UI classes for handling incoming connections and pincode requests Added: haiku/trunk/headers/private/bluetooth/ConnectionIncoming.h =================================================================== --- haiku/trunk/headers/private/bluetooth/ConnectionIncoming.h 2008-06-18 19:55:51 UTC (rev 26009) +++ haiku/trunk/headers/private/bluetooth/ConnectionIncoming.h 2008-06-18 20:57:27 UTC (rev 26010) @@ -0,0 +1,51 @@ +/* + * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * + * All rights reserved. Distributed under the terms of the MIT License. + * + */ + +#ifndef _CONNECTION_INCOMING_H_ +#define _CONNECTION_INCOMING_H_ + + +//----------------------- Global includes ---------------------- +#include <AppKit.h> +#include <SupportKit.h> +#include <InterfaceKit.h> +#include <iostream.h> +#include <stdio.h> +#include <stdlib.h> + +class RemoteDevice; + +class ConnectionView + : public BView +{ +public: + ConnectionView(BRect frame, const char *name, uint32 resizeMask, uint32 flags); + ~ConnectionView(); + virtual void MessageReceived(BMessage *message); + void Draw(BRect update); + void Pulse(); + +private: + + +}; + + +class ConnectionIncoming + : public BWindow +{ +public: + ConnectionIncoming(RemoteDevice* rDevice); + ~ConnectionIncoming(); + virtual void MessageReceived(BMessage *message); + virtual bool QuitRequested(); + +private: + ConnectionView* _ConnectionView; +}; + +#endif Added: haiku/trunk/headers/private/bluetooth/PincodeWindow.h =================================================================== --- haiku/trunk/headers/private/bluetooth/PincodeWindow.h 2008-06-18 19:55:51 UTC (rev 26009) +++ haiku/trunk/headers/private/bluetooth/PincodeWindow.h 2008-06-18 20:57:27 UTC (rev 26010) @@ -0,0 +1,61 @@ +/* + * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * + * All rights reserved. Distributed under the terms of the MIT License. + * + */ + +#ifndef _PINCODE_REQUEST_WINDOW_H +#define _PINCODE_REQUEST_WINDOW_H + + +#include <View.h> +#include <Window.h> + +#include <bluetooth/bluetooth.h> + +class BStringView; +class BButton; +class BTextControls; + +namespace Bluetooth { + +class RemoteDevice; + +class PincodeView : public BView +{ + public: + /* Constructors & Destructor*/ + PincodeView(BRect rect); + + void SetBDaddr(const char* address); + + BStringView* fMessage; + BStringView* fRemoteInfo; + BButton* fAcceptButton; + BButton* fCancelButton; + BTextControl* fPincodeText; + +}; + +class PincodeWindow : public BWindow +{ + public: + PincodeWindow(RemoteDevice* rDevice); + virtual void MessageReceived(BMessage *msg); + virtual bool QuitRequested(); + + private: + PincodeView* fView; + bdaddr_t bdaddr; + RemoteDevice* fRemoteDevice; + BMessenger* fMessenger; +}; + +} + +#ifndef _BT_USE_EXPLICIT_NAMESPACE +using Bluetooth::PincodeWindow; +#endif + +#endif \ No newline at end of file Added: haiku/trunk/src/kits/bluetooth/UI/ConnectionIncoming.cpp =================================================================== --- haiku/trunk/src/kits/bluetooth/UI/ConnectionIncoming.cpp 2008-06-18 19:55:51 UTC (rev 26009) +++ haiku/trunk/src/kits/bluetooth/UI/ConnectionIncoming.cpp 2008-06-18 20:57:27 UTC (rev 26010) @@ -0,0 +1,91 @@ +/* + * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * + * All rights reserved. Distributed under the terms of the MIT License. + * + */ + +#include <ConnectionIncoming.h> + +#define B_PULSES_BY_SECOND(x) (2*x) + + +ConnectionView::ConnectionView(BRect frame, const char *name, uint32 resizeMask, uint32 flags) + : BView(BRect(0, 0, 400, 400), "MyViewName", B_FOLLOW_LEFT | B_FOLLOW_TOP, + B_WILL_DRAW | B_PULSE_NEEDED) +{ + + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + +} + +ConnectionView::~ConnectionView() +{ + +} + + +void ConnectionView::MessageReceived(BMessage *message) +{ + switch(message->what) + { + default: + + break; + } +} + + +void ConnectionView::Draw(BRect update) +{ + +} + + +void ConnectionView::Pulse() +{ + static int a = 0; + if (a++ == B_PULSES_BY_SECOND(5)) + Window()->QuitRequested(); + +} + + + +//--------------------------------------------------------------- +//--------------------------------------------------------------- +//--------------------------------------------------------------- +ConnectionIncoming::ConnectionIncoming(RemoteDevice* rDevice) + : BWindow(BRect(700, 100, 900, 150), "Incomming Connection", + B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, + B_NOT_ZOOMABLE | B_NOT_RESIZABLE) +{ +_ConnectionView = new ConnectionView(BRect(0, 0, 400, 400),"mViewName", B_FOLLOW_TOP | B_FOLLOW_LEFT, B_WILL_DRAW); + +AddChild(_ConnectionView); +} + +//--------------------------------------------------------------- +ConnectionIncoming::~ConnectionIncoming() +{ + +} + +//--------------------------------------------------------------- +void ConnectionIncoming::MessageReceived(BMessage *message) +{ + switch(message->what) + { + default: + + break; + } +} + +//--------------------------------------------------------------- +bool ConnectionIncoming::QuitRequested() +{ + Quit(); + return BWindow::QuitRequested(); +} + Added: haiku/trunk/src/kits/bluetooth/UI/PincodeWindow.cpp =================================================================== --- haiku/trunk/src/kits/bluetooth/UI/PincodeWindow.cpp 2008-06-18 19:55:51 UTC (rev 26009) +++ haiku/trunk/src/kits/bluetooth/UI/PincodeWindow.cpp 2008-06-18 20:57:27 UTC (rev 26010) @@ -0,0 +1,203 @@ + +/* + * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * + * All rights reserved. Distributed under the terms of the MIT License. + * + */ + +#include <stdio.h> +#include <unistd.h> +#include <malloc.h> + +#include <String.h> +#include <Message.h> +#include <Application.h> + +#include <Button.h> +#include <InterfaceDefs.h> +#include <StringView.h> +#include <TextControl.h> + +#include <bluetooth/RemoteDevice.h> +#include <bluetooth/LocalDevice.h> +#include <bluetooth/bdaddrUtils.h> +#include <bluetooth/bluetooth_error.h> + +#include <bluetooth/HCI/btHCI_command.h> +#include <bluetooth/HCI/btHCI_event.h> + +#include <PincodeWindow.h> +#include <bluetoothserver_p.h> +#include <CommandManager.h> + +#define MSG_ACCEPT_BUTTON 'acCp' +#define MSG_CANCEL_BUTTON 'mVch' + +#define H_SEPARATION 15 +#define V_SEPARATION 10 +#define BD_ADDR_LABEL "BD_ADDR: " + +namespace Bluetooth { + +PincodeView::PincodeView(BRect rect) : BView(rect,"View", B_FOLLOW_NONE, B_WILL_DRAW ), fMessage(NULL) +{ + BRect rect; + BRect rect2; + + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + + fMessage = new BStringView(BRect(0,0,5,5),"Pincode","Please enter the pincode ...", B_FOLLOW_ALL_SIDES); + fMessage->SetFont(be_bold_font); + fMessage->ResizeToPreferred(); + fMessage->MoveBy(20, 20); + rect = fMessage->Frame(); + + fRemoteInfo = new BStringView(BRect(rect.left, rect.bottom + V_SEPARATION , 0 , 0), + "bdaddr","BD_ADDR: ", B_FOLLOW_ALL_SIDES); + fRemoteInfo->ResizeToPreferred(); + rect = fRemoteInfo->Frame(); + + // TODO: IT CANNOT BE MORE THAN 16 BYTES + fPincodeText = new BTextControl(BRect(rect.left, rect.bottom + V_SEPARATION , 0, 0), + "pincode TextControl","PIN code:", "", NULL); + fPincodeText->ResizeToPreferred(); + rect = fPincodeText->Frame(); + + fAcceptButton = new BButton(BRect(rect.left , rect.bottom + V_SEPARATION ,0, 0 ), + "fAcceptButton","Pair",new BMessage(MSG_ACCEPT_BUTTON)); + fAcceptButton->ResizeToPreferred(); + rect = fAcceptButton->Frame(); + + fCancelButton = new BButton(BRect(rect.right + H_SEPARATION , rect.top , 0 , 0 ), + "fCancelButton","Cancel",new BMessage(MSG_CANCEL_BUTTON)); + fCancelButton->ResizeToPreferred(); + rect = fCancelButton->Frame(); + + this->AddChild(fMessage); + this->AddChild(fPincodeText); + this->AddChild(fAcceptButton); + this->AddChild(fCancelButton); + + this->AddChild(fRemoteInfo); + + // Now resize the the view according all what we found here + rect = fMessage->Frame(); + rect2 = fCancelButton->Frame(); + ResizeTo(rect.right + 15 , rect2.bottom +15 ); + +} + +void PincodeView::SetBDaddr(const char* address){ + + BString label; + + label << BD_ADDR_LABEL << address; + printf("++ %s\n",label.String()); + fRemoteInfo->SetText(label.String()); + fRemoteInfo->ResizeToPreferred(); + Invalidate(); + +} + +#if 0 +#pragma mark - +#endif + +PincodeWindow::PincodeWindow(RemoteDevice* rDevice) : + BWindow(BRect(700, 100, 900, 150), "Pincode Request", B_MODAL_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL, + B_WILL_ACCEPT_FIRST_CLICK | B_NOT_RESIZABLE , + B_ALL_WORKSPACES), fRemoteDevice(rDevice) +{ + fView = new PincodeView(Bounds()); + AddChild(fView); + // readapt ourselves to what the view needs + ResizeTo( fView->Bounds().right , fView->Bounds().bottom ); + + // TODO: Get more info about device" ote name/features/encry/auth... etc + fView->SetBDaddr( bdaddrUtils::ToString(rDevice->GetBluetoothAddress()) ); +}; + +void PincodeWindow::MessageReceived(BMessage *msg) +{ +// status_t err = B_OK; + + switch(msg->what) + { + case MSG_ACCEPT_BUTTON: + { + BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST); + BMessage reply; + size_t size; + int8 bt_status = BT_ERROR; + + void* command = buildPinCodeRequestReply(fRemoteDevice->GetBluetoothAddress(), strlen(fView->fPincodeText->Text()), + (char[16])fView->fPincodeText->Text(), &size); + + if (command == NULL) { + break; + } + + request.AddInt32("hci_id", (fRemoteDevice->GetLocalDeviceOwner())->GetID()); + request.AddData("raw command", B_ANY_TYPE, command, size); + request.AddInt16("eventExpected", HCI_EVENT_CMD_COMPLETE); + request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_LINK_CONTROL, OCF_PIN_CODE_REPLY)); + + if (fMessenger->SendMessage(&request, &reply) == B_OK) { + if (reply.FindInt8("status", &bt_status ) == B_OK ) { + break; + } + // TODO: something failed here + } + + QuitRequested(); + } + break; + + + case MSG_CANCEL_BUTTON: + { + BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST); + BMessage reply; + size_t size; + int8 bt_status = BT_ERROR; + + void* command = buildPinCodeRequestNegativeReply(fRemoteDevice->GetBluetoothAddress(), &size); + + if (command == NULL) { + break; + } + + request.AddInt32("hci_id", (fRemoteDevice->GetLocalDeviceOwner())->GetID()); + request.AddData("raw command", B_ANY_TYPE, command, size); + request.AddInt16("eventExpected", HCI_EVENT_CMD_COMPLETE); + request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_LINK_CONTROL, OCF_PIN_CODE_NEG_REPLY)); + + if (fMessenger->SendMessage(&request, &reply) == B_OK) { + if (reply.FindInt8("status", &bt_status ) == B_OK ) { + break; + } + // TODO: something failed here + } + + QuitRequested(); + } + break; + + default: + BWindow::MessageReceived(msg); + break; + } +} + + + +bool PincodeWindow::QuitRequested() +{ + Lock(); + Quit(); + return (true); +}; + +} + From oruizdorantes at mail.berlios.de Wed Jun 18 23:01:35 2008 From: oruizdorantes at mail.berlios.de (oruizdorantes at mail.berlios.de) Date: Wed, 18 Jun 2008 23:01:35 +0200 Subject: [Haiku-commits] r26011 - in haiku/trunk: headers/os/bluetooth src/kits/bluetooth Message-ID: <200806182101.m5IL1ZVL003922@sheep.berlios.de> Author: oruizdorantes Date: 2008-06-18 23:01:26 +0200 (Wed, 18 Jun 2008) New Revision: 26011 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26011&view=rev Modified: haiku/trunk/headers/os/bluetooth/LocalDevice.h haiku/trunk/headers/os/bluetooth/RemoteDevice.h haiku/trunk/src/kits/bluetooth/Jamfile haiku/trunk/src/kits/bluetooth/LocalDevice.cpp haiku/trunk/src/kits/bluetooth/RemoteDevice.cpp Log: Add UI classes to the build. Adding some helper methods to the Local and remote devices Modified: haiku/trunk/headers/os/bluetooth/LocalDevice.h =================================================================== --- haiku/trunk/headers/os/bluetooth/LocalDevice.h 2008-06-18 20:57:27 UTC (rev 26010) +++ haiku/trunk/headers/os/bluetooth/LocalDevice.h 2008-06-18 21:01:26 UTC (rev 26011) @@ -28,42 +28,43 @@ public: /* Possible throwing */ - static LocalDevice* GetLocalDevice(); - static uint32 GetLocalDeviceCount(); - - static LocalDevice* GetLocalDevice(hci_id hid); - static LocalDevice* GetLocalDevice(bdaddr_t bdaddr); - - DiscoveryAgent* GetDiscoveryAgent(); - BString GetFriendlyName(); - DeviceClass GetDeviceClass(); + static LocalDevice* GetLocalDevice(); + static uint32 GetLocalDeviceCount(); + + static LocalDevice* GetLocalDevice(hci_id hid); + static LocalDevice* GetLocalDevice(bdaddr_t bdaddr); + + DiscoveryAgent* GetDiscoveryAgent(); + BString GetFriendlyName(); + DeviceClass GetDeviceClass(); /* Possible throwing */ - status_t SetDiscoverable(int mode); - - BString GetProperty(const char* property); - void GetProperty(const char* property, uint32* value); - - int GetDiscoverable(); - bdaddr_t GetBluetoothAddress(); - /* - ServiceRecord getRecord(Connection notifier); - void updateRecord(ServiceRecord srvRecord); - */ + status_t SetDiscoverable(int mode); + + BString GetProperty(const char* property); + void GetProperty(const char* property, uint32* value); + + int GetDiscoverable(); + bdaddr_t GetBluetoothAddress(); + /* + ServiceRecord getRecord(Connection notifier); + void updateRecord(ServiceRecord srvRecord); + */ + private: - LocalDevice(hci_id hid); - - static LocalDevice* RequestLocalDeviceID(BMessage* request); - - static BMessenger* sfMessenger; - BMessenger* fMessenger; + LocalDevice(hci_id hid); + hci_id GetID(void) {return hid;} + static LocalDevice* RequestLocalDeviceID(BMessage* request); + + static BMessenger* sfMessenger; + BMessenger* fMessenger; - hci_id hid; - hci_id GetID(void) {return hid;} + hci_id hid; friend class DiscoveryAgent; friend class RemoteDevice; + friend class PincodeWindow; }; - + } #ifndef _BT_USE_EXPLICIT_NAMESPACE Modified: haiku/trunk/headers/os/bluetooth/RemoteDevice.h =================================================================== --- haiku/trunk/headers/os/bluetooth/RemoteDevice.h 2008-06-18 20:57:27 UTC (rev 26010) +++ haiku/trunk/headers/os/bluetooth/RemoteDevice.h 2008-06-18 21:01:26 UTC (rev 26011) @@ -25,18 +25,17 @@ class RemoteDevice : public BluetoothDevice { public: - static const int WAIT = B_BT_WAIT; static const int SUCCEEDED = B_BT_SUCCEEDED; - + bool IsTrustedDevice(); BString GetFriendlyName(bool alwaysAsk); /* Throwing */ BString GetFriendlyName(void); /* Throwing */ bdaddr_t GetBluetoothAddress(); DeviceClass GetDeviceClass(); - + bool Equals(RemoteDevice* obj); - + /*static RemoteDevice* GetRemoteDevice(Connection conn); Throwing */ bool Authenticate(); /* Throwing */ /* bool Authorize(Connection conn); Throwing */ @@ -44,29 +43,28 @@ bool IsAuthenticated(); /* Throwing */ /*bool IsAuthorized(Connection conn); Throwing */ bool IsEncrypted(); /* Throwing */ - + BString GetProperty(const char* property); /* Throwing */ void GetProperty(const char* property, uint32* value); /* Throwing */ - + LocalDevice* GetLocalDeviceOwner(); protected: RemoteDevice(BString address); - RemoteDevice(bdaddr_t address); - - /* Instances of this class only will be done by Discovery[Listener|Agent] TODO */ - friend class DiscoveryListener; - + RemoteDevice(bdaddr_t address); + + /* Instances of this class only would be instantiated by Discovery[Listener|Agent] */ + friend class DiscoveryListener; + void SetLocalDeviceOwner(LocalDevice* ld); + private: - void SetLocalDeviceOwner(LocalDevice* ld); - - + LocalDevice* fDiscovererLocalDevice; - - uint8 fPageRepetitionMode; - uint8 fScanPeriodMode; - uint8 fScanMode; - uint16 fClockOffset; - + + uint8 fPageRepetitionMode; + uint8 fScanPeriodMode; + uint8 fScanMode; + uint16 fClockOffset; + }; } Modified: haiku/trunk/src/kits/bluetooth/Jamfile =================================================================== --- haiku/trunk/src/kits/bluetooth/Jamfile 2008-06-18 20:57:27 UTC (rev 26010) +++ haiku/trunk/src/kits/bluetooth/Jamfile 2008-06-18 21:01:26 UTC (rev 26011) @@ -2,12 +2,17 @@ SetSubDirSupportedPlatformsBeOSCompatible ; -if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { - UseHeaders [ FDirName $(HAIKU_TOP) headers os ] : true ; -} +#if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { +# UseHeaders [ FDirName $(HAIKU_TOP) headers os ] : true ; +#} -UsePrivateHeaders bluetooth shared ; +UsePrivateHeaders shared bluetooth ; +SubDirHdrs [ FDirName $(SUBDIR) UI ] ; + +SEARCH_SOURCE += [ FDirName $(SUBDIR) UI ] ; + + SharedLibrary libbluetooth.so : LocalDevice.cpp DiscoveryListener.cpp @@ -15,5 +20,8 @@ RemoteDevice.cpp CommandManager.cpp KitSupport.cpp + #UI + PincodeWindow.cpp + ConnectionIncoming.cpp : be ; Modified: haiku/trunk/src/kits/bluetooth/LocalDevice.cpp =================================================================== --- haiku/trunk/src/kits/bluetooth/LocalDevice.cpp 2008-06-18 20:57:27 UTC (rev 26010) +++ haiku/trunk/src/kits/bluetooth/LocalDevice.cpp 2008-06-18 21:01:26 UTC (rev 26011) @@ -152,10 +152,10 @@ BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST); BMessage reply; - size_t size; + size_t size; int8 bt_status = BT_ERROR; - - + + request.AddInt32("hci_id", hid); @@ -170,12 +170,12 @@ request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_CONTROL_BASEBAND, OCF_WRITE_SCAN_ENABLE)); if (fMessenger->SendMessage(&request, &reply) == B_OK) { - if (reply.FindInt8("status", &bt_status ) == B_OK ) { - return bt_status; + if (reply.FindInt8("status", &bt_status ) == B_OK ) { + return bt_status; } - } + } return B_ERROR; } Modified: haiku/trunk/src/kits/bluetooth/RemoteDevice.cpp =================================================================== --- haiku/trunk/src/kits/bluetooth/RemoteDevice.cpp 2008-06-18 20:57:27 UTC (rev 26010) +++ haiku/trunk/src/kits/bluetooth/RemoteDevice.cpp 2008-06-18 21:01:26 UTC (rev 26011) @@ -134,6 +134,11 @@ return true; } +LocalDevice* +RemoteDevice::GetLocalDeviceOwner() +{ + return fDiscovererLocalDevice; +} /* Private */ void From oruizdorantes at mail.berlios.de Wed Jun 18 23:05:38 2008 From: oruizdorantes at mail.berlios.de (oruizdorantes at mail.berlios.de) Date: Wed, 18 Jun 2008 23:05:38 +0200 Subject: [Haiku-commits] r26012 - haiku/trunk/src/servers/bluetooth Message-ID: <200806182105.m5IL5cQ6004426@sheep.berlios.de> Author: oruizdorantes Date: 2008-06-18 23:05:33 +0200 (Wed, 18 Jun 2008) New Revision: 26012 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26012&view=rev Modified: haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.cpp haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.h Log: Identation and handling of the pincode and incoming connection events Modified: haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.cpp =================================================================== --- haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.cpp 2008-06-18 21:01:26 UTC (rev 26011) +++ haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.cpp 2008-06-18 21:05:33 UTC (rev 26012) @@ -16,6 +16,8 @@ #include <bluetooth/HCI/btHCI_event.h> #include <bluetoothserver_p.h> +#include <ConnectionIncoming.h> +#include <PincodeWindow.h> #include <stdio.h> @@ -78,6 +80,16 @@ break; + case HCI_EVENT_CONN_COMPLETE: + ConnectionComplete((struct hci_ev_conn_complete*)(event+1), NULL); // should belong to a request? + + break; + + case HCI_EVENT_PIN_CODE_REQ: + PinCodeRequest((struct hci_ev_pin_code_req*)(event+1), NULL); + break; + + default: // lets go on break; @@ -111,17 +123,15 @@ // we are waiting for a reply switch (event->ecode) { case HCI_EVENT_INQUIRY_COMPLETE: - InquiryComplete((uint8*)(event+1), request); + InquiryComplete((uint8*)(event+1), request); break; case HCI_EVENT_INQUIRY_RESULT: InquiryResult((uint8*)(event+1), request); break; - - case HCI_EVENT_CONN_COMPLETE: - break; - + case HCI_EVENT_DISCONNECTION_COMPLETE: + break; case HCI_EVENT_AUTH_COMPLETE: @@ -171,10 +181,7 @@ case HCI_EVENT_RETURN_LINK_KEYS: break; - - case HCI_EVENT_PIN_CODE_REQ: - break; - + case HCI_EVENT_LINK_KEY_REQ: break; @@ -239,70 +246,67 @@ if (request->IsSourceWaiting() == false) Output::Instance()->Post("Nobody waiting for the event\n", BLACKBOARD_KIT); - - + switch (opcodeExpected) { - + case PACK_OPCODE(OGF_INFORMATIONAL_PARAM, OCF_READ_BD_ADDR): - { + { struct hci_rp_read_bd_addr* readbdaddr = (struct hci_rp_read_bd_addr*)(event+1); - + if (readbdaddr->status == BT_OK) { - - - reply.AddData("bdaddr", B_ANY_TYPE, &readbdaddr->bdaddr, sizeof(bdaddr_t)); + + reply.AddData("bdaddr", B_ANY_TYPE, &readbdaddr->bdaddr, sizeof(bdaddr_t)); reply.AddInt32("status", readbdaddr->status); - printf("Sending reply ... %ld\n",request->SendReply(&reply)); + printf("Sending reply ... %ld\n",request->SendReply(&reply)); reply.PrintToStream(); - Output::Instance()->Post("Positive reply for getAdress\n", BLACKBOARD_KIT); } else { reply.AddInt8("status", readbdaddr->status); - request->SendReply(&reply); - Output::Instance()->Post("Negative reply for getAdress\n", BLACKBOARD_KIT); + request->SendReply(&reply); + Output::Instance()->Post("Negative reply for getAdress\n", BLACKBOARD_KIT); } - // This request is not genna be used anymore + // This request is not genna be used anymore ClearWantedEvent(request); - } + } break; case PACK_OPCODE(OGF_CONTROL_BASEBAND, OCF_READ_LOCAL_NAME): - { + { struct hci_rp_read_local_name* readLocalName = (struct hci_rp_read_local_name*)(event+1); - + reply.AddInt8("status", readLocalName->status); - + if (readLocalName->status == BT_OK) { - - reply.AddString("friendlyname", (const char*)readLocalName->local_name ); + + reply.AddString("friendlyname", (const char*)readLocalName->local_name ); Output::Instance()->Post("Positive reply for friendly name\n", BLACKBOARD_KIT); } else { - Output::Instance()->Post("Negative reply for friendly name\n", BLACKBOARD_KIT); + Output::Instance()->Post("Negative reply for friendly name\n", BLACKBOARD_KIT); } - printf("Sending reply ... %ld\n",request->SendReply(&reply)); + printf("Sending reply ... %ld\n",request->SendReply(&reply)); reply.PrintToStream(); - - // This request is not genna be used anymore + + // This request is not genna be used anymore ClearWantedEvent(request); - } + } break; case PACK_OPCODE(OGF_CONTROL_BASEBAND, OCF_WRITE_SCAN_ENABLE): - { + { uint8* statusReply = (uint8*)(event+1); - + reply.AddInt8("status", *statusReply); - + if (*statusReply == BT_OK) { - + Output::Instance()->Post("Positive reply for scanmode\n", BLACKBOARD_KIT); } else { @@ -311,20 +315,19 @@ } - printf("Sending reply ... %ld\n",request->SendReply(&reply)); + printf("Sending reply ... %ld\n",request->SendReply(&reply)); reply.PrintToStream(); - - // This request is not genna be used anymore + + // This request is not genna be used anymore ClearWantedEvent(request); - } + } break; default: - Output::Instance()->Post("Command Complete not handled\n", BLACKBOARD_KIT); + Output::Instance()->Post("Command Complete not handled\n", BLACKBOARD_KIT); break; - - - } + + } } @@ -383,7 +386,7 @@ reply.AddData("info", B_ANY_TYPE, numberOfResponses+1 // skiping here the number of responses , (*numberOfResponses) * sizeof(struct inquiry_info) ); - printf("%s: Sending reply ... %ld\n",__FUNCTION__, request->SendReply(&reply)); + printf("%s: Sending reply ... %ld\n",__FUNCTION__, request->SendReply(&reply)); } @@ -396,10 +399,10 @@ reply.AddInt8("status", *status); - printf("%s: Sending reply ... %ld\n",__FUNCTION__, request->SendReply(&reply)); + printf("%s: Sending reply ... %ld\n",__FUNCTION__, request->SendReply(&reply)); // (request->ReturnAddress()).SendMessage(&reply); - - ClearWantedEvent(request); + + ClearWantedEvent(request); } @@ -423,14 +426,31 @@ printf("Sending reply ... %ld\n", request->SendReply(&reply)); reply.PrintToStream(); - + // This request is not genna be used anymore - // Although there are many middle events that should be tracked + // Although there are many middle events that should be tracked todo: ticket 2377 ClearWantedEvent(request); } +void +LocalDeviceImpl::ConnectionComplete(struct hci_ev_conn_complete* event, BMessage* request) +{ + ConnectionIncoming* iConnection = new ConnectionIncoming(NULL); + iConnection->Show(); + +} + + +void +LocalDeviceImpl::PinCodeRequest(struct hci_ev_pin_code_req* event, BMessage* request) +{ + PincodeWindow* iPincode = new PincodeWindow(NULL); + iPincode->Show(); + +} + #if 0 #pragma mark - Request Methods - #endif Modified: haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.h =================================================================== --- haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.h 2008-06-18 21:01:26 UTC (rev 26011) +++ haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.h 2008-06-18 21:05:33 UTC (rev 26012) @@ -44,6 +44,10 @@ void InquiryResult(uint8* numberOfResponses, BMessage* request); void InquiryComplete(uint8* status, BMessage* request); void RemoteNameRequestComplete(struct hci_remote_name_request_complete_reply* remotename, BMessage* request); + + // Connection + void ConnectionComplete(struct hci_ev_conn_complete* event, BMessage* request); + void PinCodeRequest(struct hci_ev_pin_code_req* event, BMessage* request); }; #endif From anevilyak at mail.berlios.de Thu Jun 19 00:04:15 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Thu, 19 Jun 2008 00:04:15 +0200 Subject: [Haiku-commits] r26013 - haiku/trunk/src/bin/coreutils/src Message-ID: <200806182204.m5IM4F9T012244@sheep.berlios.de> Author: anevilyak Date: 2008-06-19 00:04:15 +0200 (Thu, 19 Jun 2008) New Revision: 26013 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26013&view=rev Modified: haiku/trunk/src/bin/coreutils/src/copy.c Log: The attribute copy operation was nested inside a conditional block which wouldn't be executed if the file being copied was zero bytes in length. Moved outside the block to where permissions and other optional operations are handled. This fixes bug #2259. Modified: haiku/trunk/src/bin/coreutils/src/copy.c =================================================================== --- haiku/trunk/src/bin/coreutils/src/copy.c 2008-06-18 21:05:33 UTC (rev 26012) +++ haiku/trunk/src/bin/coreutils/src/copy.c 2008-06-18 22:04:15 UTC (rev 26013) @@ -440,10 +440,6 @@ #endif } - if (x->ignore_attributes == 0 - && copy_attributes(source_desc, dest_desc) != 0) - fprintf(stderr, "%s: could not copy attributes\n", src_name); - /* If not making a sparse file, try to use a more-efficient buffer size. */ if (! make_holes) @@ -644,6 +640,11 @@ } } + if (x->ignore_attributes == 0 + && copy_attributes(source_desc, dest_desc) != 0) + fprintf(stderr, "%s: could not copy attributes\n", src_name); + + close_src_and_dst_desc: if (close (dest_desc) < 0) { From superstippi at gmx.de Thu Jun 19 00:28:25 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Thu, 19 Jun 2008 00:28:25 +0200 Subject: [Haiku-commits] r26010 - in haiku/trunk: headers/private/bluetooth src/kits/bluetooth src/kits/bluetooth/UI In-Reply-To: <200806182057.m5IKvXKo003496@sheep.berlios.de> References: <200806182057.m5IKvXKo003496@sheep.berlios.de> Message-ID: <20080619002825.65708.4@stippis2.1213777455.fake> Hi Oliver, > +void PincodeWindow::MessageReceived(BMessage *msg) > +{ > +// status_t err = B_OK; > + > + switch(msg->what) > + { > + case MSG_ACCEPT_BUTTON: > + { > + BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST); > + BMessage reply; > + size_t size; > + int8 bt_status = BT_ERROR; > + > + void* command = > buildPinCodeRequestReply(fRemoteDevice->GetBluetoothAddress(), > strlen(fView->fPincodeText->Text()), > + > (char[16])fView->fPincodeText->Text(), &size); > + > + if (command == NULL) { > + break; > + } > + > + request.AddInt32("hci_id", > (fRemoteDevice->GetLocalDeviceOwner())->GetID()); > + request.AddData("raw command", B_ANY_TYPE, command, size); > + request.AddInt16("eventExpected", HCI_EVENT_CMD_COMPLETE); > + request.AddInt16("opcodeExpected", > PACK_OPCODE(OGF_LINK_CONTROL, OCF_PIN_CODE_REPLY)); > + > + if (fMessenger->SendMessage(&request, &reply) == B_OK) { > + if (reply.FindInt8("status", &bt_status ) == B_OK ) { > + break; > + } > + // TODO: something failed here > + } > + > + QuitRequested(); You should use PostMessage(B_QUIT_REQUESTED); instead I think. [...] > +bool PincodeWindow::QuitRequested() > +{ > + Lock(); > + Quit(); > + return (true); > +}; This implementation looks really weird. I am not sure what happens if the window indeed receives a normal B_QUIT_REQUESTED message. This implementation should simply be removed, since the default implementation of QuitRequested() is to return "true". The interface kit that uses QuitRequested() should not expect the object to self-destruct in a getter method. Nice progress, though! Although I think you should follow the style guide more closely. ;-) Best regards, -Stephan From revol at free.fr Thu Jun 19 00:41:54 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Thu, 19 Jun 2008 00:41:54 +0200 CEST Subject: [Haiku-commits] r26010 - in haiku/trunk: headers/private/bluetooth src/kits/bluetooth src/kits/bluetooth/UI In-Reply-To: <20080619002825.65708.4@stippis2.1213777455.fake> Message-ID: <10365360084-BeMail@laptop> > > +bool PincodeWindow::QuitRequested() > > +{ > > + Lock(); > > + Quit(); > > + return (true); > > +}; > > This implementation looks really weird. I am not sure what happens if > the > window indeed receives a normal B_QUIT_REQUESTED message. This > implementation should simply be removed, since the default > implementation > of QuitRequested() is to return "true". The interface kit that uses > QuitRequested() should not expect the object to self-destruct in a > getter > method. Indeed, this seems strange. > Nice progress, though! Although I think you should follow the style > guide > more closely. ;-) At least I won't be alone buying beer at next BeGeistert. Fran?ois. From bonefish at mail.berlios.de Thu Jun 19 02:03:57 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 19 Jun 2008 02:03:57 +0200 Subject: [Haiku-commits] r26014 - haiku/trunk/headers/build Message-ID: <200806190003.m5J03vmQ019831@sheep.berlios.de> Author: bonefish Date: 2008-06-19 02:03:56 +0200 (Thu, 19 Jun 2008) New Revision: 26014 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26014&view=rev Modified: haiku/trunk/headers/build/HaikuBuildCompatibility.h Log: Define INT32_MAX, if not defined. Modified: haiku/trunk/headers/build/HaikuBuildCompatibility.h =================================================================== --- haiku/trunk/headers/build/HaikuBuildCompatibility.h 2008-06-18 22:04:15 UTC (rev 26013) +++ haiku/trunk/headers/build/HaikuBuildCompatibility.h 2008-06-19 00:03:56 UTC (rev 26014) @@ -159,8 +159,13 @@ # define IFF_AUTO_CONFIGURED 0 #endif +#include <limits.h> + +#ifndef INT32_MAX +# define INT32_MAX INT_MAX +#endif + #ifndef INT64_MAX -# include <limits.h> # define INT64_MAX LONGLONG_MAX #endif From bonefish at mail.berlios.de Thu Jun 19 02:05:02 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 19 Jun 2008 02:05:02 +0200 Subject: [Haiku-commits] r26015 - in haiku/trunk/headers: posix private/system Message-ID: <200806190005.m5J052Y5019875@sheep.berlios.de> Author: bonefish Date: 2008-06-19 02:05:01 +0200 (Thu, 19 Jun 2008) New Revision: 26015 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26015&view=rev Modified: haiku/trunk/headers/posix/semaphore.h haiku/trunk/headers/private/system/syscalls.h Log: Removed <syscalls.h>' dependency to <semaphore.h> by giving the sem_t structure a name. Modified: haiku/trunk/headers/posix/semaphore.h =================================================================== --- haiku/trunk/headers/posix/semaphore.h 2008-06-19 00:03:56 UTC (rev 26014) +++ haiku/trunk/headers/posix/semaphore.h 2008-06-19 00:05:01 UTC (rev 26015) @@ -10,7 +10,7 @@ #include <time.h> -typedef struct { +typedef struct _sem_t { int32_t id; int32_t _padding[3]; } sem_t; Modified: haiku/trunk/headers/private/system/syscalls.h =================================================================== --- haiku/trunk/headers/private/system/syscalls.h 2008-06-19 00:03:56 UTC (rev 26014) +++ haiku/trunk/headers/private/system/syscalls.h 2008-06-19 00:05:01 UTC (rev 26015) @@ -11,7 +11,6 @@ #include <OS.h> #include <DiskDeviceDefs.h> -#include <semaphore.h> #include <signal.h> #include <sys/socket.h> @@ -30,6 +29,7 @@ struct rlimit; struct sigaction; struct stat; +struct _sem_t; struct disk_device_job_progress_info; struct partitionable_space_data; @@ -80,9 +80,9 @@ /* POSIX realtime sem syscalls */ extern status_t _kern_realtime_sem_open(const char* name, int openFlagsOrShared, mode_t mode, uint32 semCount, - sem_t* userSem, sem_t** _usedUserSem); + struct _sem_t* userSem, struct _sem_t** _usedUserSem); extern status_t _kern_realtime_sem_close(sem_id semID, - sem_t** _deleteUserSem); + struct _sem_t** _deleteUserSem); extern status_t _kern_realtime_sem_unlink(const char* name); extern status_t _kern_realtime_sem_get_value(sem_id semID, int* value); From bonefish at mail.berlios.de Thu Jun 19 02:05:49 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 19 Jun 2008 02:05:49 +0200 Subject: [Haiku-commits] r26016 - haiku/trunk/build/jam Message-ID: <200806190005.m5J05nb3019969@sheep.berlios.de> Author: bonefish Date: 2008-06-19 02:05:48 +0200 (Thu, 19 Jun 2008) New Revision: 26016 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26016&view=rev Modified: haiku/trunk/build/jam/BuildSetup Log: Define TARGET_PRIVATE_SYSTEM_HEADERS for target libbe_test. Modified: haiku/trunk/build/jam/BuildSetup =================================================================== --- haiku/trunk/build/jam/BuildSetup 2008-06-19 00:05:01 UTC (rev 26015) +++ haiku/trunk/build/jam/BuildSetup 2008-06-19 00:05:48 UTC (rev 26016) @@ -852,6 +852,9 @@ [ PrivateHeaders $(DOT) ] ; TARGET_DEFINES += __HAIKU__ ; + TARGET_PRIVATE_SYSTEM_HEADERS = + [ PrivateHeaders $(DOT) system system/arch/$(TARGET_ARCH) ] ; + # directories TARGET_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) $(TARGET_PLATFORM) ] ; From bonefish at mail.berlios.de Thu Jun 19 02:06:52 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 19 Jun 2008 02:06:52 +0200 Subject: [Haiku-commits] r26017 - in haiku/trunk/src: kits tests/servers/app tests/servers/registrar Message-ID: <200806190006.m5J06qc4020037@sheep.berlios.de> Author: bonefish Date: 2008-06-19 02:06:50 +0200 (Thu, 19 Jun 2008) New Revision: 26017 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26017&view=rev Modified: haiku/trunk/src/kits/Jamfile haiku/trunk/src/tests/servers/app/Jamfile haiku/trunk/src/tests/servers/registrar/Jamfile Log: Fixed libbe_test build. Modified: haiku/trunk/src/kits/Jamfile =================================================================== --- haiku/trunk/src/kits/Jamfile 2008-06-19 00:05:48 UTC (rev 26016) +++ haiku/trunk/src/kits/Jamfile 2008-06-19 00:06:50 UTC (rev 26017) @@ -71,6 +71,7 @@ libbeadapter.so $(TARGET_NETWORK_LIBS) + libpng.so # For dumping the screen to PNG in the Interface Kit $(TARGET_LIBSTDC++) ; Modified: haiku/trunk/src/tests/servers/app/Jamfile =================================================================== --- haiku/trunk/src/tests/servers/app/Jamfile 2008-06-19 00:05:48 UTC (rev 26016) +++ haiku/trunk/src/tests/servers/app/Jamfile 2008-06-19 00:06:50 UTC (rev 26017) @@ -118,6 +118,7 @@ # AccelerantBuffer.cpp # AccelerantHWInterface.cpp BitmapBuffer.cpp + BitmapDrawingEngine.cpp drawing_support.cpp DrawingEngine.cpp MallocBuffer.cpp Modified: haiku/trunk/src/tests/servers/registrar/Jamfile =================================================================== --- haiku/trunk/src/tests/servers/registrar/Jamfile 2008-06-19 00:05:48 UTC (rev 26016) +++ haiku/trunk/src/tests/servers/registrar/Jamfile 2008-06-19 00:06:50 UTC (rev 26017) @@ -60,10 +60,10 @@ # the registrar itself UsePrivateHeaders app ; -UsePrivateHeaders kernel ; UsePrivateHeaders shared ; UsePrivateHeaders storage ; UsePrivateHeaders tracker ; +UsePrivateSystemHeaders ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src servers registrar ] ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src servers registrar mime ] ; From bonefish at mail.berlios.de Thu Jun 19 02:23:22 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 19 Jun 2008 02:23:22 +0200 Subject: [Haiku-commits] r26018 - haiku/trunk/build/scripts Message-ID: <200806190023.m5J0NM3A023159@sheep.berlios.de> Author: bonefish Date: 2008-06-19 02:23:20 +0200 (Thu, 19 Jun 2008) New Revision: 26018 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26018&view=rev Modified: haiku/trunk/build/scripts/build_haiku_image Log: Use "readlink -f" which seems to be more portable. Also check whether invoking it this way works at all; this avoids problems with readlink programs that don't support the option. Modified: haiku/trunk/build/scripts/build_haiku_image =================================================================== --- haiku/trunk/build/scripts/build_haiku_image 2008-06-19 00:06:50 UTC (rev 26017) +++ haiku/trunk/build/scripts/build_haiku_image 2008-06-19 00:23:20 UTC (rev 26018) @@ -32,8 +32,8 @@ # If the haiku image path is a symlink resolve it now (makebootable needs the # path of the actual device path under Linux). -if which readlink &> /dev/null; then - normalizedImagePath=$(readlink -e "$imagePath") +if readlink -f "$imagePath" &> /dev/null; then + normalizedImagePath=$(readlink -f "$imagePath") if [ $normalizedImagePath ]; then imagePath="$normalizedImagePath" fi From oliver.ruiz.dorantes at gmail.com Thu Jun 19 09:12:15 2008 From: oliver.ruiz.dorantes at gmail.com (Oliver Ruiz Dorantes) Date: Thu, 19 Jun 2008 09:12:15 +0200 Subject: [Haiku-commits] r26010 - in haiku/trunk: headers/private/bluetooth src/kits/bluetooth src/kits/bluetooth/UI In-Reply-To: <20080619002825.65708.4@stippis2.1213777455.fake> References: <200806182057.m5IKvXKo003496@sheep.berlios.de> <20080619002825.65708.4@stippis2.1213777455.fake> Message-ID: <d953bae20806190012pda4ce5bsabe3dd19f1c2468a@mail.gmail.com> Thanks guys, All inside bluetooth/UI for the moment is a fast way for me provide me a fast user response data flow. Those windows should look really ugly as it is now. So these classes are not really accurate, feel free to suggest or modify the code. Regards 2008/6/19, Stephan Assmus <superstippi at gmx.de>: > > This implementation looks really weird. I am not sure what happens if the > window indeed receives a normal B_QUIT_REQUESTED message. This > implementation should simply be removed, since the default implementation > of QuitRequested() is to return "true". > > Nice progress, though! Although I think you should follow the style guide > more closely. ;-) > > Best regards, > > -Stephan > > _______________________________________________ > Haiku-commits mailing list > Haiku-commits at lists.berlios.de > https://lists.berlios.de/mailman/listinfo/haiku-commits > -- Oliver, http://urnenfeld.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.berlios.de/pipermail/haiku-commits/attachments/20080619/879859c3/attachment.html> From mmu_man at mail.berlios.de Thu Jun 19 14:39:48 2008 From: mmu_man at mail.berlios.de (mmu_man at mail.berlios.de) Date: Thu, 19 Jun 2008 14:39:48 +0200 Subject: [Haiku-commits] r26019 - haiku/trunk/build/jam Message-ID: <200806191239.m5JCdmh1003226@sheep.berlios.de> Author: mmu_man Date: 2008-06-19 14:39:41 +0200 (Thu, 19 Jun 2008) New Revision: 26019 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26019&view=rev Modified: haiku/trunk/build/jam/FloppyBootImage Log: Fix floppy/CD build, though it's untested; not sure it still works with the device manager changes... Modified: haiku/trunk/build/jam/FloppyBootImage =================================================================== --- haiku/trunk/build/jam/FloppyBootImage 2008-06-19 00:23:20 UTC (rev 26018) +++ haiku/trunk/build/jam/FloppyBootImage 2008-06-19 12:39:41 UTC (rev 26019) @@ -31,7 +31,7 @@ } BEOS_ADD_ONS_BUS_MANAGERS = pci $(X86_ONLY)isa ide scsi - config_manager agp_gart + config_manager agp_gart usb ; BEOS_ADD_ONS_FILE_SYSTEMS = bfs ; #cdda fat googlefs iso9660 nfs ; @@ -43,23 +43,26 @@ AddFilesToFloppyBootArchive beos system add-ons kernel busses agp_gart : $(X86_ONLY)<agp_gart>intel ; AddFilesToFloppyBootArchive beos system add-ons kernel busses ide - : ahci generic_ide_pci $(X86_ONLY)ide_isa silicon_image_3112 legacy_sata ; + : ahci generic_ide_pci $(X86_ONLY)ide_isa silicon_image_3112 legacy_sata it8211 ; AddFilesToFloppyBootArchive beos system add-ons kernel console : vga_text ; AddFilesToFloppyBootArchive beos system add-ons kernel file_systems : $(BEOS_ADD_ONS_FILE_SYSTEMS) ; AddFilesToFloppyBootArchive beos system add-ons kernel generic - : block_io fast_log ide_adapter locked_pool scsi_periph ; + : block_io ide_adapter locked_pool scsi_periph ; AddFilesToFloppyBootArchive beos system add-ons kernel partitioning_systems : intel session ; AddFilesToFloppyBootArchive beos system add-ons kernel interrupt_controllers : $(PPC_ONLY)openpic ; +AddFilesToFloppyBootArchive beos system add-ons kernel busses usb + : <usb>uhci <usb>ohci <usb>ehci ; if $(TARGET_ARCH) = x86 { AddFilesToFloppyBootArchive beos system add-ons kernel cpu : generic_x86 ; } # drivers -AddDriversToFloppyBootArchive disk scsi : scsi_cd scsi_dsk ; +AddDriversToFloppyBootArchive disk scsi : scsi_cd scsi_disk usb_disk ; +AddDriversToFloppyBootArchive disk usb : usb_disk ; if $(NET_BOOT) = 1 { #AddDriversToFloppyBootArchive disk virtual : nbd ; AddDriversToFloppyBootArchive disk virtual : remote_disk ; @@ -95,10 +98,11 @@ AddBootModuleSymlinksToFloppyBootArchive $(BEOS_ADD_ONS_BUS_MANAGERS) $(PPC_ONLY)openpic - block_io fast_log ide_adapter locked_pool scsi_periph + block_io ide_adapter locked_pool scsi_periph $(X86_ONLY)generic_x86 - ahci generic_ide_pci $(X86_ONLY)ide_isa silicon_image_3112 legacy_sata - scsi_cd scsi_dsk + ahci generic_ide_pci $(X86_ONLY)ide_isa silicon_image_3112 legacy_sata it8211 + <usb>uhci <usb>ohci <usb>ehci + scsi_cd scsi_disk usb_disk intel session $(BEOS_ADD_ONS_FILE_SYSTEMS) $(BOOT_ADD_ONS_NET) From stippi at mail.berlios.de Thu Jun 19 15:08:08 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Thu, 19 Jun 2008 15:08:08 +0200 Subject: [Haiku-commits] r26020 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200806191308.m5JD88CL011761@sheep.berlios.de> Author: stippi Date: 2008-06-19 15:07:44 +0200 (Thu, 19 Jun 2008) New Revision: 26020 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26020&view=rev Modified: haiku/trunk/headers/os/interface/Window.h haiku/trunk/src/kits/interface/View.cpp haiku/trunk/src/kits/interface/Window.cpp Log: Use a flag in BWindow to store whether an update to a view (Invalidate()) has been requested. The first call to a BView::Invalidate() will flush the link so that app_server is notified as soon as possible. It makes no sense for further calls to Invalidate() to flush also, since Flush() is not cheap. This trick makes Invalidate() about 3.2 times faster, making it a cheaper operation. I could not see any negative effects, I tested with apps that invalidate multiple different parts inside a window in reaction to something. Thanks go to Ingo who had the idea. Modified: haiku/trunk/headers/os/interface/Window.h =================================================================== --- haiku/trunk/headers/os/interface/Window.h 2008-06-19 12:39:41 UTC (rev 26019) +++ haiku/trunk/headers/os/interface/Window.h 2008-06-19 13:07:44 UTC (rev 26020) @@ -332,6 +332,7 @@ char* fTitle; int32 _unused0; bool fInTransaction; + bool fUpdateRequested; bool fActive; short fShowLevel; uint32 fFlags; @@ -344,7 +345,6 @@ BButton* fDefaultButton; BList fShortcuts; int32 fTopViewToken; - bool _unused2; bool _unused3; bool fIsFilePanel; bool _unused4; Modified: haiku/trunk/src/kits/interface/View.cpp =================================================================== --- haiku/trunk/src/kits/interface/View.cpp 2008-06-19 12:39:41 UTC (rev 26019) +++ haiku/trunk/src/kits/interface/View.cpp 2008-06-19 13:07:44 UTC (rev 26020) @@ -3371,7 +3371,11 @@ fOwner->fLink->StartMessage(AS_VIEW_INVALIDATE_RECT); fOwner->fLink->Attach<BRect>(invalRect); - fOwner->fLink->Flush(); + + if (!fOwner->fUpdateRequested) { + fOwner->fLink->Flush(); + fOwner->fUpdateRequested = true; + } } @@ -3386,7 +3390,10 @@ fOwner->fLink->StartMessage(AS_VIEW_INVALIDATE_REGION); fOwner->fLink->AttachRegion(*region); - fOwner->fLink->Flush(); + if (!fOwner->fUpdateRequested) { + fOwner->fLink->Flush(); + fOwner->fUpdateRequested = true; + } } Modified: haiku/trunk/src/kits/interface/Window.cpp =================================================================== --- haiku/trunk/src/kits/interface/Window.cpp 2008-06-19 12:39:41 UTC (rev 26019) +++ haiku/trunk/src/kits/interface/Window.cpp 2008-06-19 13:07:44 UTC (rev 26020) @@ -1245,6 +1245,7 @@ fLink->StartMessage(AS_END_UPDATE); fLink->Flush(); fInTransaction = false; + fUpdateRequested = false; //printf("BWindow(%s) - UPDATE took %lld usecs\n", Title(), system_time() - now); break; @@ -2460,6 +2461,7 @@ fFlags = flags | B_ASYNCHRONOUS_CONTROLS; fInTransaction = false; + fUpdateRequested = false; fActive = false; fShowLevel = 0; From ingo_weinhold at gmx.de Thu Jun 19 16:10:06 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Thu, 19 Jun 2008 16:10:06 +0200 Subject: [Haiku-commits] r26020 - in haiku/trunk: headers/os/interface src/kits/interface In-Reply-To: <200806191308.m5JD88CL011761@sheep.berlios.de> References: <200806191308.m5JD88CL011761@sheep.berlios.de> Message-ID: <20080619161006.457.1@knochen-vm.1213875053.fake> On 2008-06-19 at 15:08:08 [+0200], stippi at mail.berlios.de wrote: > Modified: haiku/trunk/headers/os/interface/Window.h > =================================================================== > --- haiku/trunk/headers/os/interface/Window.h 2008-06-19 12:39:41 UTC > (rev 26019) > +++ haiku/trunk/headers/os/interface/Window.h 2008-06-19 13:07:44 UTC > (rev 26020) > @@ -332,6 +332,7 @@ > char* fTitle; > int32 _unused0; > bool fInTransaction; > + bool fUpdateRequested; > bool fActive; > short fShowLevel; > uint32 fFlags; > @@ -344,7 +345,6 @@ > BButton* fDefaultButton; > BList fShortcuts; > int32 fTopViewToken; > - bool _unused2; > bool _unused3; > bool fIsFilePanel; > bool _unused4; This doesn't look right. The insertion of fUpdateRequested causes additional padding to be inserted (to align for the following short). The removal of _unused2 also causes insertion of padding. I'm afraid the class is now at least 2 bytes (probably even 4) bigger than before. CU, Ingo From stippi at mail.berlios.de Thu Jun 19 16:18:00 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Thu, 19 Jun 2008 16:18:00 +0200 Subject: [Haiku-commits] r26021 - haiku/trunk/headers/os/interface Message-ID: <200806191418.m5JEI0P4019938@sheep.berlios.de> Author: stippi Date: 2008-06-19 16:17:56 +0200 (Thu, 19 Jun 2008) New Revision: 26021 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26021&view=rev Modified: haiku/trunk/headers/os/interface/Window.h Log: Move the now used boolean to the old place in order to avoid different padding to happen and therefor changing the object size. Modified: haiku/trunk/headers/os/interface/Window.h =================================================================== --- haiku/trunk/headers/os/interface/Window.h 2008-06-19 13:07:44 UTC (rev 26020) +++ haiku/trunk/headers/os/interface/Window.h 2008-06-19 14:17:56 UTC (rev 26021) @@ -332,7 +332,6 @@ char* fTitle; int32 _unused0; bool fInTransaction; - bool fUpdateRequested; bool fActive; short fShowLevel; uint32 fFlags; @@ -345,6 +344,7 @@ BButton* fDefaultButton; BList fShortcuts; int32 fTopViewToken; + bool fUpdateRequested; bool _unused3; bool fIsFilePanel; bool _unused4; From bonefish at mail.berlios.de Thu Jun 19 16:18:35 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Thu, 19 Jun 2008 16:18:35 +0200 Subject: [Haiku-commits] r26022 - haiku/trunk/src/apps/terminal Message-ID: <200806191418.m5JEIZ3r020033@sheep.berlios.de> Author: bonefish Date: 2008-06-19 16:18:31 +0200 (Thu, 19 Jun 2008) New Revision: 26022 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26022&view=rev Modified: haiku/trunk/src/apps/terminal/Shell.cpp haiku/trunk/src/apps/terminal/TermView.cpp haiku/trunk/src/apps/terminal/VTKeyTbl.c haiku/trunk/src/apps/terminal/VTkeymap.h Log: * Changed generated key sequences to be more ANSI/xterm. * Set TERM to "xterm". * Removed unnecessary {Begin,End}ViewTransaction() in TermView::Draw(). Modified: haiku/trunk/src/apps/terminal/Shell.cpp =================================================================== --- haiku/trunk/src/apps/terminal/Shell.cpp 2008-06-19 14:17:56 UTC (rev 26021) +++ haiku/trunk/src/apps/terminal/Shell.cpp 2008-06-19 14:18:31 UTC (rev 26022) @@ -496,7 +496,7 @@ /* * setenv TERM and TTY. */ - setenv("TERM", "beterm", true); + setenv("TERM", "xterm", true); setenv("TTY", ttyName, true); setenv("TTYPE", encoding, true); setenv("SHELL", argv[0], true); Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-19 14:17:56 UTC (rev 26021) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-19 14:18:31 UTC (rev 26022) @@ -1019,8 +1019,6 @@ //debug_printf("TermView::Draw(): (%ld, %ld) - (%ld, %ld), top: %f, fontHeight: %d, scrollOffset: %f\n", //x1, y1, x2, y2, updateRect.top, fFontHeight, fScrollOffset); - Window()->BeginViewTransaction(); - for (int32 j = y1; j <= y2; j++) { int32 k = x1; char buf[fTermColumns * 4 + 1]; @@ -1062,8 +1060,6 @@ if (fCursor >= TermPos(x1, y1) && fCursor <= TermPos(x2, y2)) _DrawCursor(); - - Window()->EndViewTransaction(); } @@ -1162,7 +1158,15 @@ if (rawChar == B_RETURN) toWrite = "\r"; break; - + + case B_DELETE: + toWrite = DELETE_KEY_CODE; + break; + + case B_BACKSPACE: + toWrite = BACKSPACE_KEY_CODE; + break; + case B_LEFT_ARROW: if (rawChar == B_LEFT_ARROW) { if (mod & B_SHIFT_KEY) { @@ -1251,7 +1255,6 @@ break; case B_FUNCTION_KEY: - // TODO: Why not just fShell->Write(key) ? for (int32 i = 0; i < 12; i++) { if (key == function_keycode_table[i]) { fShell->Write(function_key_char_table[i], 5); Modified: haiku/trunk/src/apps/terminal/VTKeyTbl.c =================================================================== --- haiku/trunk/src/apps/terminal/VTKeyTbl.c 2008-06-19 14:17:56 UTC (rev 26021) +++ haiku/trunk/src/apps/terminal/VTKeyTbl.c 2008-06-19 14:18:31 UTC (rev 26022) @@ -48,10 +48,10 @@ char *function_key_char_table [] = { -"\033[11~", -"\033[12~", -"\033[13~", -"\033[14~", +"\033OP", +"\033OQ", +"\033OR", +"\033OS", "\033[15~", "\033[16~", "\033[17~", Modified: haiku/trunk/src/apps/terminal/VTkeymap.h =================================================================== --- haiku/trunk/src/apps/terminal/VTkeymap.h 2008-06-19 14:17:56 UTC (rev 26021) +++ haiku/trunk/src/apps/terminal/VTkeymap.h 2008-06-19 14:18:31 UTC (rev 26022) @@ -64,22 +64,22 @@ #define PAGE_DOWN_KEY 0x36 +#define LEFT_ARROW_KEY_CODE "\033OD" +#define RIGHT_ARROW_KEY_CODE "\033OC" +#define UP_ARROW_KEY_CODE "\033OA" +#define DOWN_ARROW_KEY_CODE "\033OB" -#define LEFT_ARROW_KEY_CODE "\033[D" -#define RIGHT_ARROW_KEY_CODE "\033[C" -#define UP_ARROW_KEY_CODE "\033[A" -#define DOWN_ARROW_KEY_CODE "\033[B" - #define CTRL_LEFT_ARROW_KEY_CODE "\033[5D" #define CTRL_RIGHT_ARROW_KEY_CODE "\033[5C" #define CTRL_UP_ARROW_KEY_CODE "\033[5A" #define CTRL_DOWN_ARROW_KEY_CODE "\033[5B" -//#define HOME_KEY_CODE "\033[@" -#define HOME_KEY_CODE "\033[1~" +#define DELETE_KEY_CODE "\033[3~" +#define BACKSPACE_KEY_CODE "\177" + +#define HOME_KEY_CODE "\033OH" #define INSERT_KEY_CODE "\033[2~" -//#define END_KEY_CODE "\033[[" -#define END_KEY_CODE "\033[4~" +#define END_KEY_CODE "\033OF" #define PAGE_UP_KEY_CODE "\033[5~" #define PAGE_DOWN_KEY_CODE "\033[6~" From superstippi at gmx.de Thu Jun 19 16:20:04 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Thu, 19 Jun 2008 16:20:04 +0200 Subject: [Haiku-commits] r26020 - in haiku/trunk: headers/os/interface src/kits/interface In-Reply-To: <20080619161006.457.1@knochen-vm.1213875053.fake> References: <200806191308.m5JD88CL011761@sheep.berlios.de> <20080619161006.457.1@knochen-vm.1213875053.fake> Message-ID: <20080619162004.19585.5@stippis2.1213860124.fake> Ingo Weinhold wrote: > > On 2008-06-19 at 15:08:08 [+0200], stippi at mail.berlios.de wrote: > > Modified: haiku/trunk/headers/os/interface/Window.h > > =================================================================== > > --- haiku/trunk/headers/os/interface/Window.h 2008-06-19 12:39:41 > > UTC > > (rev 26019) > > +++ haiku/trunk/headers/os/interface/Window.h 2008-06-19 13:07:44 > > UTC > > (rev 26020) > > @@ -332,6 +332,7 @@ > > char* fTitle; > > int32 _unused0; > > bool fInTransaction; > > + bool fUpdateRequested; > > bool fActive; > > short fShowLevel; > > uint32 fFlags; > > @@ -344,7 +345,6 @@ > > BButton* fDefaultButton; > > BList fShortcuts; > > int32 fTopViewToken; > > - bool _unused2; > > bool _unused3; > > bool fIsFilePanel; > > bool _unused4; > > This doesn't look right. The insertion of fUpdateRequested causes > additional padding to be inserted (to align for the following short). The > removal of _unused2 also causes insertion of padding. I'm afraid the > class is now at least 2 bytes (probably even 4) bigger than before. Thanks for clarifying, indeed I was not sure if this was ok. I didn't see any problems with R5 binaries I tested, but fixed it just in case. Best regards, -Stephan From bonefish at mail.berlios.de Thu Jun 19 16:21:04 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Thu, 19 Jun 2008 16:21:04 +0200 Subject: [Haiku-commits] r26023 - haiku/trunk/src/libs/termcap Message-ID: <200806191421.m5JEL4mL020356@sheep.berlios.de> Author: bonefish Date: 2008-06-19 16:21:01 +0200 (Thu, 19 Jun 2008) New Revision: 26023 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26023&view=rev Modified: haiku/trunk/src/libs/termcap/termcap.c Log: Hack to avoid problems with termcap entries that take more space than 2KB. That's the currently recommended size of the buffer passed to tgetent(). Our xterm entry is bigger, though. Modified: haiku/trunk/src/libs/termcap/termcap.c =================================================================== --- haiku/trunk/src/libs/termcap/termcap.c 2008-06-19 14:18:31 UTC (rev 26022) +++ haiku/trunk/src/libs/termcap/termcap.c 2008-06-19 14:21:01 UTC (rev 26023) @@ -461,6 +461,11 @@ char *indirect = NULL; /* Terminal type in :tc= in TERMCAP value. */ int filep; +// bonefish: HACK to avoid problems. Our termcap entries are longer than the +// 2KB that are advised as the size of the buffer to be passed to tgetent(). +// This leads to nasty problems, so just always allocate a buffer. +bp = NULL; + #ifdef INTERNAL_TERMINAL /* For the internal terminal we don't want to read any termcap file, so fake it. */ From bonefish at mail.berlios.de Thu Jun 19 16:21:48 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Thu, 19 Jun 2008 16:21:48 +0200 Subject: [Haiku-commits] r26024 - haiku/trunk/src/libs/termcap Message-ID: <200806191421.m5JELmRc020482@sheep.berlios.de> Author: bonefish Date: 2008-06-19 16:21:45 +0200 (Thu, 19 Jun 2008) New Revision: 26024 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26024&view=rev Modified: haiku/trunk/src/libs/termcap/termcap.src Log: Added home and end key xterm capabilities. Modified: haiku/trunk/src/libs/termcap/termcap.src =================================================================== --- haiku/trunk/src/libs/termcap/termcap.src 2008-06-19 14:21:01 UTC (rev 26023) +++ haiku/trunk/src/libs/termcap/termcap.src 2008-06-19 14:21:45 UTC (rev 26024) @@ -3571,7 +3571,7 @@ xterm|xterm terminal emulator (X Window System):\ :am:bs:km:mi:ms:xn:\ :co#80:it#8:li#24:\ - :*6=\E[4~:@0=\E[1~:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:\ + :*6=\E[4~:@0=\E[1~:@7=\EOF:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:\ :DO=\E[%dB:F1=\E[23~:F2=\E[24~:F3=\E[25~:F4=\E[26~:\ :F5=\E[28~:F6=\E[29~:F7=\E[31~:F8=\E[32~:F9=\E[33~:\ :FA=\E[34~:Km=\E[M:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:\ @@ -3582,7 +3582,7 @@ :is=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>:k1=\EOP:\ :k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:k7=\E[18~:\ :k8=\E[19~:k9=\E[20~:k;=\E[21~:kD=\E[3~:kI=\E[2~:kN=\E[6~:\ - :kP=\E[5~:kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:kr=\EOC:\ + :kP=\E[5~:kb=^H:kd=\EOB:ke=\E[?1l\E>:kh=\EOH:kl=\EOD:kr=\EOC:\ :ks=\E[?1h\E=:ku=\EOA:le=^H:md=\E[1m:me=\E[m:ml=\El:\ :mr=\E[7m:mu=\Em:nd=\E[C:rc=\E8:\ :rs=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>:sc=\E7:\ From bonefish at mail.berlios.de Thu Jun 19 16:24:15 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Thu, 19 Jun 2008 16:24:15 +0200 Subject: [Haiku-commits] r26025 - haiku/trunk/src/bin/bash/lib/readline Message-ID: <200806191424.m5JEOFb5020697@sheep.berlios.de> Author: bonefish Date: 2008-06-19 16:24:12 +0200 (Thu, 19 Jun 2008) New Revision: 26025 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26025&view=rev Modified: haiku/trunk/src/bin/bash/lib/readline/emacs_keymap.c haiku/trunk/src/bin/bash/lib/readline/keymaps.c haiku/trunk/src/bin/bash/lib/readline/readline.c Log: Reverted r22488 and part of r23783. This makes the backspace key work again in the shell. Modified: haiku/trunk/src/bin/bash/lib/readline/emacs_keymap.c =================================================================== --- haiku/trunk/src/bin/bash/lib/readline/emacs_keymap.c 2008-06-19 14:21:45 UTC (rev 26024) +++ haiku/trunk/src/bin/bash/lib/readline/emacs_keymap.c 2008-06-19 14:24:12 UTC (rev 26025) @@ -174,7 +174,7 @@ { ISFUNC, rl_insert }, /* | */ { ISFUNC, rl_insert }, /* } */ { ISFUNC, rl_insert }, /* ~ */ - { ISFUNC, rl_delete }, /* RUBOUT */ + { ISFUNC, rl_rubout }, /* RUBOUT */ #if KEYMAP_SIZE > 128 /* Pure 8-bit characters (128 - 159). Modified: haiku/trunk/src/bin/bash/lib/readline/keymaps.c =================================================================== --- haiku/trunk/src/bin/bash/lib/readline/keymaps.c 2008-06-19 14:21:45 UTC (rev 26024) +++ haiku/trunk/src/bin/bash/lib/readline/keymaps.c 2008-06-19 14:24:12 UTC (rev 26025) @@ -105,7 +105,7 @@ newmap[i].function = rl_insert; newmap[TAB].function = rl_insert; - newmap[RUBOUT].function = rl_delete; /* RUBOUT == 127 */ + newmap[RUBOUT].function = rl_rubout; /* RUBOUT == 127 */ newmap[CTRL('H')].function = rl_rubout; #if KEYMAP_SIZE > 128 Modified: haiku/trunk/src/bin/bash/lib/readline/readline.c =================================================================== --- haiku/trunk/src/bin/bash/lib/readline/readline.c 2008-06-19 14:21:45 UTC (rev 26024) +++ haiku/trunk/src/bin/bash/lib/readline/readline.c 2008-06-19 14:24:12 UTC (rev 26025) @@ -885,23 +885,12 @@ _rl_keymap = xkeymap; } -/* Bind some default keys in the standard keymap. */ -static void -bind_default_keys_internal () -{ - _rl_bind_if_unbound ("\033[[", rl_end_of_line); - _rl_bind_if_unbound ("\033[@", rl_beg_of_line); - _rl_bind_if_unbound ("\033[5~", rl_history_search_backward); - _rl_bind_if_unbound ("\033[6~", rl_history_search_forward); -} - /* Try and bind the common arrow key prefixes after giving termcap and the inputrc file a chance to bind them and create `real' keymaps for the arrow key prefix. */ static void bind_arrow_keys () { - bind_default_keys_internal (); bind_arrow_keys_internal (emacs_standard_keymap); #if defined (VI_MODE) From bonefish at mail.berlios.de Thu Jun 19 16:25:27 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Thu, 19 Jun 2008 16:25:27 +0200 Subject: [Haiku-commits] r26026 - haiku/trunk/data/etc Message-ID: <200806191425.m5JEPRkE020757@sheep.berlios.de> Author: bonefish Date: 2008-06-19 16:25:26 +0200 (Thu, 19 Jun 2008) New Revision: 26026 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26026&view=rev Modified: haiku/trunk/data/etc/profile Log: Removed superfluous and wrong (history forward and backward search was swapped) key bindings. Modified: haiku/trunk/data/etc/profile =================================================================== --- haiku/trunk/data/etc/profile 2008-06-19 14:24:12 UTC (rev 26025) +++ haiku/trunk/data/etc/profile 2008-06-19 14:25:26 UTC (rev 26026) @@ -11,12 +11,6 @@ export PS1="\w> " export HISTFILESIZE=50 -bind '"\e[2~":paste-from-clipboard' -bind '"\e[3~":delete-char' -bind '"\e[4~":end-of-line' -bind '"\e[5~":history-search-forward' -bind '"\e[6~":history-search-backward' - alias ls="ls --color" alias ll="ls -l" alias la="ls -A" From bonefish at mail.berlios.de Thu Jun 19 16:26:34 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Thu, 19 Jun 2008 16:26:34 +0200 Subject: [Haiku-commits] r26027 - haiku/trunk/data/etc Message-ID: <200806191426.m5JEQYFY020824@sheep.berlios.de> Author: bonefish Date: 2008-06-19 16:26:32 +0200 (Thu, 19 Jun 2008) New Revision: 26027 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26027&view=rev Modified: haiku/trunk/data/etc/inputrc Log: Removed superfluous entries and map the correct delete key string. Modified: haiku/trunk/data/etc/inputrc =================================================================== --- haiku/trunk/data/etc/inputrc 2008-06-19 14:25:26 UTC (rev 26026) +++ haiku/trunk/data/etc/inputrc 2008-06-19 14:26:32 UTC (rev 26027) @@ -2,6 +2,4 @@ "\e[5~": history-search-backward "\e[6~": history-search-forward -"\e[@": beginning-of-line -"\e[[": end-of-line -DEL: delete-char +"\e[3~": delete-char From bonefish at mail.berlios.de Thu Jun 19 16:32:29 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Thu, 19 Jun 2008 16:32:29 +0200 Subject: [Haiku-commits] r26028 - in haiku/trunk: build/jam data/etc data/etc/vim src/data/etc Message-ID: <200806191432.m5JEWT99021402@sheep.berlios.de> Author: bonefish Date: 2008-06-19 16:32:25 +0200 (Thu, 19 Jun 2008) New Revision: 26028 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26028&view=rev Added: haiku/trunk/data/etc/vim/ haiku/trunk/data/etc/vim/vimrc haiku/trunk/src/data/etc/sysless.in Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/src/data/etc/Jamfile Log: * Added /etc/sysless with settings to make backspace work correctly in less. * Added /etc/vim/vimrc. Besides fixing key mappings it also disables compatibility mode and adjusts some settings to make using vi a more pleasant experience. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-06-19 14:26:32 UTC (rev 26027) +++ haiku/trunk/build/jam/HaikuImage 2008-06-19 14:32:25 UTC (rev 26028) @@ -288,9 +288,12 @@ local etcFiles = inputrc profile teapot.data ; etcFiles = $(etcFiles:G=etc) ; SEARCH on $(etcFiles) = [ FDirName $(HAIKU_TOP) data etc ] ; -etcFiles += <etc>termcap ; +etcFiles += <etc>termcap <etc>sysless <etc>sysless.in ; AddFilesToHaikuImage beos etc : $(etcFiles) ; +SEARCH on <etc>vimrc = [ FDirName $(HAIKU_TOP) data etc vim ] ; +AddFilesToHaikuImage beos etc vim : <etc>vimrc ; + local fortuneFiles = Art Computers Education Food Fortunes Goedel Haiku Humorists Kids Law "Linux cookies" Love Magic Medicine Miscellaneous News "One Liners" "OS Fortunes" Pets Platitudes Riddles "Songs & Poems" Added: haiku/trunk/data/etc/vim/vimrc =================================================================== --- haiku/trunk/data/etc/vim/vimrc 2008-06-19 14:26:32 UTC (rev 26027) +++ haiku/trunk/data/etc/vim/vimrc 2008-06-19 14:32:25 UTC (rev 26028) @@ -0,0 +1,29 @@ +" highlight matching brackets +set showmatch + +" status line: show line/column and current mode +set ruler +set showmode + +" required to be able to use keypad keys and map missed escape sequences +set esckeys + +" be user-friendly instead of compatible +set nocompatible + +" backspace shall remove anything in insert mode +set backspace=indent,eol,start + +" keys in insert mode +map! <Esc>OA <Up> +map! <Esc>OB <Down> +map! <Esc>OC <Right> +map! <Esc>OD <Left> +map! <Esc>OH <Home> +map! <Esc>OF <End> +map! <Esc>[5~ <PageUp> +map! <Esc>[6~ <PageDown> +map!  <BS> + +" keys in command mode +map  X Modified: haiku/trunk/src/data/etc/Jamfile =================================================================== --- haiku/trunk/src/data/etc/Jamfile 2008-06-19 14:26:32 UTC (rev 26027) +++ haiku/trunk/src/data/etc/Jamfile 2008-06-19 14:32:25 UTC (rev 26028) @@ -1,4 +1,18 @@ SubDir HAIKU_TOP src data etc ; +# generate /etc/sysless +actions LessKey +{ + lesskey -o $(1) $(2) +} + +local syslessIn = <etc>sysless.in ; +SEARCH on $(syslessIn) = $(SUBDIR) ; +local sysless = <etc>sysless ; +MakeLocateArch $(sysless) ; +Depends $(sysless) : $(syslessIn) ; +LessKey $(sysless) : $(syslessIn) ; + + SubInclude HAIKU_TOP src data etc keymaps ; SubInclude HAIKU_TOP src data etc timezones ; Added: haiku/trunk/src/data/etc/sysless.in =================================================================== --- haiku/trunk/src/data/etc/sysless.in 2008-06-19 14:26:32 UTC (rev 26027) +++ haiku/trunk/src/data/etc/sysless.in 2008-06-19 14:32:25 UTC (rev 26028) @@ -0,0 +1,6 @@ +#command +\177 back-screen +^H back-screen +#line-edit +\177 backspace +^H backspace From umccullough at gmail.com Thu Jun 19 20:06:32 2008 From: umccullough at gmail.com (Urias McCullough) Date: Thu, 19 Jun 2008 11:06:32 -0700 Subject: [Haiku-commits] r25833 - in haiku/trunk: headers/private/system src/bin/listdev src/system/kernel/device_manager In-Reply-To: <200806062223.m56MNQdq018807@sheep.berlios.de> References: <200806062223.m56MNQdq018807@sheep.berlios.de> Message-ID: <1e80d8750806191106g1ace492axbc376ac0edba1cfe@mail.gmail.com> 2008/6/6 korli at BerliOS <korli at mail.berlios.de>: > Author: korli > Date: 2008-06-07 00:23:25 +0200 (Sat, 07 Jun 2008) > New Revision: 25833 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=25833&view=rev > > Modified: > haiku/trunk/headers/private/system/device_manager_defs.h > haiku/trunk/src/bin/listdev/dm_wrapper.c > haiku/trunk/src/bin/listdev/dm_wrapper.h > haiku/trunk/src/bin/listdev/listdev.c > haiku/trunk/src/system/kernel/device_manager/device_manager.cpp > Log: > fixed listdev and device_manager syscalls Is there a reason that listdev still hasn't been added back to HaikuImage? See ticket #2404: http://dev.haiku-os.org/ticket/2404 From mmlr at mail.berlios.de Thu Jun 19 21:21:03 2008 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Thu, 19 Jun 2008 21:21:03 +0200 Subject: [Haiku-commits] r26029 - haiku/trunk/build/jam Message-ID: <200806191921.m5JJL3TX000790@sheep.berlios.de> Author: mmlr Date: 2008-06-19 21:21:00 +0200 (Thu, 19 Jun 2008) New Revision: 26029 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26029&view=rev Modified: haiku/trunk/build/jam/FloppyBootImage Log: Remove double entry of usb_disk in the floppy image. Modified: haiku/trunk/build/jam/FloppyBootImage =================================================================== --- haiku/trunk/build/jam/FloppyBootImage 2008-06-19 14:32:25 UTC (rev 26028) +++ haiku/trunk/build/jam/FloppyBootImage 2008-06-19 19:21:00 UTC (rev 26029) @@ -61,7 +61,7 @@ } # drivers -AddDriversToFloppyBootArchive disk scsi : scsi_cd scsi_disk usb_disk ; +AddDriversToFloppyBootArchive disk scsi : scsi_cd scsi_disk ; AddDriversToFloppyBootArchive disk usb : usb_disk ; if $(NET_BOOT) = 1 { #AddDriversToFloppyBootArchive disk virtual : nbd ; From bonefish at mail.berlios.de Thu Jun 19 22:57:37 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Thu, 19 Jun 2008 22:57:37 +0200 Subject: [Haiku-commits] r26030 - haiku/trunk/src/apps/terminal Message-ID: <200806192057.m5JKvbQa008561@sheep.berlios.de> Author: bonefish Date: 2008-06-19 22:57:35 +0200 (Thu, 19 Jun 2008) New Revision: 26030 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26030&view=rev Modified: haiku/trunk/src/apps/terminal/TermView.cpp Log: Also update the cursor on full invalidation. Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-19 19:21:00 UTC (rev 26029) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-19 20:57:35 UTC (rev 26030) @@ -1633,9 +1633,14 @@ if (info.invalidateAll) { Invalidate(); _UpdateScrollBarRange(); + + fCursor = fTextBuffer->Cursor(); + _ActivateCursor(false); + int32 offset = _LineAt(0); fVisibleTextBuffer->SynchronizeWith(fTextBuffer, offset, offset, offset + fTextBuffer->Height() + 2); + info.Reset(); return; } From bonefish at mail.berlios.de Thu Jun 19 23:10:23 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Thu, 19 Jun 2008 23:10:23 +0200 Subject: [Haiku-commits] r26031 - haiku/trunk/src/apps/terminal Message-ID: <200806192110.m5JLANXi009120@sheep.berlios.de> Author: bonefish Date: 2008-06-19 23:10:21 +0200 (Thu, 19 Jun 2008) New Revision: 26031 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26031&view=rev Modified: haiku/trunk/src/apps/terminal/TermParse.cpp haiku/trunk/src/apps/terminal/TerminalBuffer.cpp haiku/trunk/src/apps/terminal/TerminalBuffer.h Log: Implemented \ESC[?47h and \ESC[?47l (use alternative/normal screen buffer). These are the sequences our /etc/termcap uses (local less and vim use the alternative screen buffer now). The ones already implemented are used e.g. by the termcap of my Linux installation. A bit weird all those different termcap files, some even with the same version number. Modified: haiku/trunk/src/apps/terminal/TermParse.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-19 20:57:35 UTC (rev 26030) +++ haiku/trunk/src/apps/terminal/TermParse.cpp 2008-06-19 21:10:21 UTC (rev 26031) @@ -1093,9 +1093,13 @@ // Not supported yet. break; case 25: - // Show Cursor + // Show Cursor. // Not supported yet. break; + case 47: + // Use Alternate Screen Buffer. + fBuffer->UseAlternateScreenBuffer(false); + break; case 1034: // Interpret "meta" key, sets eighth bit. // Not supported yet. @@ -1104,7 +1108,7 @@ // Save cursor as in DECSC and use Alternate Screen Buffer, clearing // it first. fBuffer->SaveCursor(); - fBuffer->UseAlternateScreenBuffer(); + fBuffer->UseAlternateScreenBuffer(true); break; } } @@ -1138,14 +1142,18 @@ // Hide Cursor // Not supported yet. break; + case 47: + // Use Normal Screen Buffer. + fBuffer->UseNormalScreenBuffer(); + break; case 1034: // Don?t interpret "meta" key. // Not supported yet. break; case 1049: // Use Normal Screen Buffer and restore cursor as in DECRC. + fBuffer->UseNormalScreenBuffer(); fBuffer->RestoreCursor(); - fBuffer->UseNormalScreenBuffer(); break; } } Modified: haiku/trunk/src/apps/terminal/TerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TerminalBuffer.cpp 2008-06-19 20:57:35 UTC (rev 26030) +++ haiku/trunk/src/apps/terminal/TerminalBuffer.cpp 2008-06-19 21:10:21 UTC (rev 26031) @@ -176,13 +176,16 @@ void -TerminalBuffer::UseAlternateScreenBuffer() +TerminalBuffer::UseAlternateScreenBuffer(bool clear) { if (fAlternateScreenActive || fAlternateScreen == NULL) return; _SwitchScreenBuffer(); - Clear(false); + + if (clear) + Clear(false); + _InvalidateAll(); } Modified: haiku/trunk/src/apps/terminal/TerminalBuffer.h =================================================================== --- haiku/trunk/src/apps/terminal/TerminalBuffer.h 2008-06-19 20:57:35 UTC (rev 26030) +++ haiku/trunk/src/apps/terminal/TerminalBuffer.h 2008-06-19 21:10:21 UTC (rev 26031) @@ -32,7 +32,7 @@ virtual status_t ResizeTo(int32 width, int32 height, int32 historyCapacity); - void UseAlternateScreenBuffer(); + void UseAlternateScreenBuffer(bool clear); void UseNormalScreenBuffer(); protected: From revol at free.fr Thu Jun 19 23:27:19 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Thu, 19 Jun 2008 23:27:19 +0200 CEST Subject: [Haiku-commits] r26031 - haiku/trunk/src/apps/terminal In-Reply-To: <200806192110.m5JLANXi009120@sheep.berlios.de> Message-ID: <11690246030-BeMail@laptop> > Log: > Implemented \ESC[?47h and \ESC[?47l (use alternative/normal screen > buffer). These are the sequences our /etc/termcap uses (local less > and > vim use the alternative screen buffer now). The ones already > implemented Hmm is that what makes vim, more and others to restore what was before them (the shell) on exit in linux ? It looks nice but in case of more it's really annoying when you more a file to select from it to paste back, but you quit and it goes away so the selection is screwed up... > are used e.g. by the termcap of my Linux installation. A bit weird > all > those different termcap files, some even with the same version > number. Go figure :) Fran?ois. From ingo_weinhold at gmx.de Fri Jun 20 00:20:08 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Fri, 20 Jun 2008 00:20:08 +0200 Subject: [Haiku-commits] r26031 - haiku/trunk/src/apps/terminal In-Reply-To: <11690246030-BeMail@laptop> References: <11690246030-BeMail@laptop> Message-ID: <20080620002008.684.4@knochen-vm.1213903597.fake> On 2008-06-19 at 23:27:19 [+0200], Fran?ois Revol <revol at free.fr> wrote: > > Log: > > Implemented \ESC[?47h and \ESC[?47l (use alternative/normal screen > > buffer). These are the sequences our /etc/termcap uses (local less > > and > > vim use the alternative screen buffer now). The ones already > > implemented > > Hmm is that what makes vim, more and others to restore what was before > them (the shell) on exit in linux ? Yep. > It looks nice but in case of more > it's really annoying when you more a file to select from it to paste > back, but you quit and it goes away so the selection is screwed up... At least in Linux that's not a problem. The selection will be gone, but you can still paste the formerly selected text. In Haiku mouse copy'n'paste is quite suboptimal ATM. You can only paste currently selected text (and only into the same window). This should be fixed, of course, but unlike Linux Haiku supports Command-C/V as an alternative that is consistently available in every app. CU, Ingo From bonefish at mail.berlios.de Fri Jun 20 00:24:01 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 20 Jun 2008 00:24:01 +0200 Subject: [Haiku-commits] r26032 - haiku/trunk/src/apps/terminal Message-ID: <200806192224.m5JMO1ZZ013637@sheep.berlios.de> Author: bonefish Date: 2008-06-20 00:23:59 +0200 (Fri, 20 Jun 2008) New Revision: 26032 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26032&view=rev Modified: haiku/trunk/src/apps/terminal/TermView.cpp Log: Also clear the selection when invalidating all. Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-19 21:10:21 UTC (rev 26031) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-19 22:23:59 UTC (rev 26032) @@ -1633,6 +1633,7 @@ if (info.invalidateAll) { Invalidate(); _UpdateScrollBarRange(); + _Deselect(); fCursor = fTextBuffer->Cursor(); _ActivateCursor(false); From bonefish at mail.berlios.de Fri Jun 20 02:30:16 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 20 Jun 2008 02:30:16 +0200 Subject: [Haiku-commits] r26033 - haiku/trunk/src/apps/terminal Message-ID: <200806200030.m5K0UG2Q020649@sheep.berlios.de> Author: bonefish Date: 2008-06-20 02:30:13 +0200 (Fri, 20 Jun 2008) New Revision: 26033 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26033&view=rev Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h Log: Squashed TODO: When writing a character in the last column of a line we wrapped to the next line and a subsequent LF would advance another line. We behave like xterm now, i.e. visually the cursor stays on the same line (on the last character), but the next character will be wrapped to the next line. Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-19 22:23:59 UTC (rev 26032) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2008-06-20 00:30:13 UTC (rev 26033) @@ -116,6 +116,7 @@ fCursor.x = 0; fCursor.y = 0; + fSoftWrappedCursor = false; fScreenOffset = 0; @@ -180,6 +181,7 @@ void BasicTerminalBuffer::Clear(bool resetCursor) { + fSoftWrappedCursor = false; fScreenOffset = 0; _ClearLines(0, fHeight - 1); @@ -541,11 +543,13 @@ if (width == FULL_WIDTH) attributes |= A_WIDTH; - if (fCursor.x + width > fWidth) + if (fSoftWrappedCursor || fCursor.x + width > fWidth) _SoftBreakLine(); else _PadLineToCursor(); + fSoftWrappedCursor = false; + if (!fOverwriteMode) _InsertGap(width); @@ -563,9 +567,10 @@ // TODO: Deal correctly with full-width chars! We must take care not to // overwrite half of a full-width char. This holds also for other methods. - if (fCursor.x == fWidth) - _SoftBreakLine(); - // TODO: Handle a subsequent CR correctly! + if (fCursor.x == fWidth) { + fCursor.x -= width; + fSoftWrappedCursor = true; + } } @@ -573,6 +578,7 @@ BasicTerminalBuffer::InsertCR() { _LineAt(fCursor.y)->softBreak = false; + fSoftWrappedCursor = false; fCursor.x = 0; _CursorChanged(); } @@ -581,6 +587,8 @@ void BasicTerminalBuffer::InsertLF() { + fSoftWrappedCursor = false; + // If we're at the end of the scroll region, scroll. Otherwise just advance // the cursor. if (fCursor.y == fScrollBottom) { @@ -596,8 +604,10 @@ void BasicTerminalBuffer::InsertLines(int32 numLines) { - if (fCursor.y >= fScrollTop && fCursor.y < fScrollBottom) + if (fCursor.y >= fScrollTop && fCursor.y < fScrollBottom) { + fSoftWrappedCursor = false; _Scroll(fCursor.y, fScrollBottom, -numLines); + } } @@ -616,6 +626,7 @@ num = fWidth - fCursor.x; if (num > 0) { + fSoftWrappedCursor = false; _PadLineToCursor(); _InsertGap(num); @@ -637,6 +648,8 @@ if (fCursor.y >= line->length) return; + fSoftWrappedCursor = false; + int32 first = fCursor.x; int32 end = min_c(fCursor.x + numChars, line->length); if (first > 0 && IS_WIDTH(line->cells[first - 1].attributes)) @@ -660,6 +673,8 @@ if (fCursor.y > 0) _ClearLines(0, fCursor.y - 1); + fSoftWrappedCursor = false; + // Delete the chars on the cursor line before (and including) the cursor. TerminalLine* line = _LineAt(fCursor.y); if (fCursor.x < line->length) { @@ -680,6 +695,8 @@ void BasicTerminalBuffer::EraseBelow() { + fSoftWrappedCursor = false; + // Clear the following lines. if (fCursor.y < fHeight - 1) _ClearLines(fCursor.y + 1, fHeight - 1); @@ -692,6 +709,8 @@ void BasicTerminalBuffer::DeleteChars(int32 numChars) { + fSoftWrappedCursor = false; + TerminalLine* line = _LineAt(fCursor.y); if (fCursor.x < line->length) { if (fCursor.x + numChars < line->length) { @@ -712,6 +731,8 @@ void BasicTerminalBuffer::DeleteColumns() { + fSoftWrappedCursor = false; + TerminalLine* line = _LineAt(fCursor.y); if (fCursor.x < line->length) { line->length = fCursor.x; @@ -723,8 +744,10 @@ void BasicTerminalBuffer::DeleteLines(int32 numLines) { - if (fCursor.y >= fScrollTop && fCursor.y <= fScrollBottom) + if (fCursor.y >= fScrollTop && fCursor.y <= fScrollBottom) { + fSoftWrappedCursor = false; _Scroll(fCursor.y, fScrollBottom, numLines); + } } @@ -732,6 +755,7 @@ BasicTerminalBuffer::SetCursor(int32 x, int32 y) { //debug_printf("BasicTerminalBuffer::SetCursor(%d, %d)\n", x, y); + fSoftWrappedCursor = false; x = restrict_value(x, 0, fWidth - 1); y = restrict_value(y, 0, fHeight - 1); if (x != fCursor.x || y != fCursor.y) { @@ -955,6 +979,7 @@ if (fCursor.x > width) fCursor.x = width; fCursor.y -= firstLine; + fSoftWrappedCursor = false; return B_OK; } @@ -1131,6 +1156,7 @@ //cursor.x, cursor.y); fCursor.x = cursor.x; fCursor.y = cursor.y; + fSoftWrappedCursor = false; //debug_printf(" screen offset: %ld -> %ld\n", fScreenOffset, destScreenOffset % height); fScreenOffset = destScreenOffset % height; //debug_printf(" height %ld -> %ld\n", fHeight, height); @@ -1266,7 +1292,6 @@ BasicTerminalBuffer::_SoftBreakLine() { TerminalLine* line = _LineAt(fCursor.y); - line->length = fCursor.x; line->softBreak = true; fCursor.x = 0; Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h =================================================================== --- haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h 2008-06-19 22:23:59 UTC (rev 26032) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h 2008-06-20 00:30:13 UTC (rev 26033) @@ -183,6 +183,7 @@ // cursor position (origin: (0, 0)) TermPos fCursor; TermPos fSavedCursor; + bool fSoftWrappedCursor; bool fOverwriteMode; // false for insert bool fAlternateScreenActive; From bonefish at mail.berlios.de Fri Jun 20 02:56:07 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 20 Jun 2008 02:56:07 +0200 Subject: [Haiku-commits] r26034 - haiku/trunk/src/bin/vim/src Message-ID: <200806200056.m5K0u7ET022815@sheep.berlios.de> Author: bonefish Date: 2008-06-20 02:56:05 +0200 (Fri, 20 Jun 2008) New Revision: 26034 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26034&view=rev Modified: haiku/trunk/src/bin/vim/src/gui_beos.cc Log: The main thread was used as BApplication thread and a new thread as worker thread. That sounds somehow reasonable, but has the problem that signals to the process hit a thread that doesn't know how to handle them. Fortunately the author already prepared the code to switch the thread tasks. In the Terminal vim does now correctly react on window resizes. Probably also fixes #2393. Modified: haiku/trunk/src/bin/vim/src/gui_beos.cc =================================================================== --- haiku/trunk/src/bin/vim/src/gui_beos.cc 2008-06-20 00:30:13 UTC (rev 26033) +++ haiku/trunk/src/bin/vim/src/gui_beos.cc 2008-06-20 00:56:05 UTC (rev 26034) @@ -1892,7 +1892,7 @@ gui.vimWindow->Unlock(); } -#define RUN_BAPPLICATION_IN_NEW_THREAD 0 +#define RUN_BAPPLICATION_IN_NEW_THREAD 1 #if RUN_BAPPLICATION_IN_NEW_THREAD From mmu_man at mail.berlios.de Fri Jun 20 03:21:09 2008 From: mmu_man at mail.berlios.de (mmu_man at mail.berlios.de) Date: Fri, 20 Jun 2008 03:21:09 +0200 Subject: [Haiku-commits] r26035 - haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/atari Message-ID: <200806200121.m5K1L9tn024307@sheep.berlios.de> Author: mmu_man Date: 2008-06-20 03:20:29 +0200 (Fri, 20 Jun 2008) New Revision: 26035 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26035&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/atari/pci_atari.cpp Log: Fix building the pci bus manager. Still quite stubbed out though. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/atari/pci_atari.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/atari/pci_atari.cpp 2008-06-20 00:56:05 UTC (rev 26034) +++ haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/atari/pci_atari.cpp 2008-06-20 01:20:29 UTC (rev 26035) @@ -13,6 +13,20 @@ #include "pci_controller.h" +/* + * Here we fake a PCI bus that maps the physical memory + * (which is also I/O on 68k), and fake some system devices. + * Some other devices are faked as ISA because they need DMA + * notification. + * + * TODO: anything to be done to support VME cards ? + * I don't think they are PnP at all anyway. + * + * TODO: On Hades/Milan clones a real PCI bus is accessible + * through PAE-like extra bits in page descriptors. This one + * should be handled in a separate file. + */ + //XXX:find one and put in shared priv header! // 0x68xx is free according to pci.ids // 68fx (f=fake) x = 0:amiga, 1:apple, 2:atari @@ -28,7 +42,7 @@ // default bist #define DB 0 -#define PEI {0} +#define PEI 0 #define INVV 0xffff //0x0000 ?? #define INVD 0xffff @@ -41,16 +55,21 @@ static struct fake_pci_device gFakePCIDevices[] = { { {FAKEV, 0x0000, BN, 0, 0, 0, 0xff, PCI_host, PCI_bridge, DLL, DL, DB, 0, PEI }}, /* cpu */ { {FAKEV, 0x0001, BN, 1, 0, 0, 0xff, 0x68/*fake*/, PCI_processor, DLL, DL, DB, 0, PEI }}, /* cpu */ -{ {FAKEV, 0x0002, BN, 2, 0, 0, 0xff, PCI_display_other, PCI_display, DLL, DL, DB, 0, $FFFF8200, PEI }}, /* gfx */ -{ {FAKEV, 0x0003, BN, 3, 0, 0, 0xff, PCI_ide, PCI_mass_storage, DLL, DL, DB, 0, $FFF00000, PEI }}, /* ide */ +{ {FAKEV, 0x0002, BN, 2, 0, 0, 0xff, PCI_display_other, PCI_display, DLL, DL, DB, 0, 0xFFFF8200, PEI }}, /* gfx */ +{ {FAKEV, 0x0003, BN, 3, 0, 0, 0xff, PCI_ide, PCI_mass_storage, DLL, DL, DB, 0, 0xFFF00000, PEI }}, /* ide */ { {FAKEV, 0x0004, BN, 4, 0, 0, 0xff, PCI_scsi, PCI_mass_storage, DLL, DL, DB, 0, PEI }}, /* scsi */ -{ {FAKEV, 0x0005, BN, 5, 0, 0, 0xff, 0x, PCI_multimedia, DLL, DL, DB, 0x00, 0, $FFFF8900, PEI }}, /* snd */ +{ {FAKEV, 0x0005, BN, 5, 0, 0, 0xff, 0x0/*CHANGEME*/, PCI_multimedia, DLL, DL, DB, 0x00, 0, 0xFFFF8900, PEI }}, /* snd */ //UART ? //centronics? { {INVV, INVD} } }; -#define FAKE_DEVICES_COUNT ((sizeof(gFakePCIDevices)/sizeof(struct fake_pci_device)-1) +#define FAKE_DEVICES_COUNT (sizeof(gFakePCIDevices)/sizeof(struct fake_pci_device)-1) +struct m68k_atari_fake_host_bridge { + uint32 bus; +}; + + #define out8rb(address, value) m68k_out8((vuint8*)(address), value) #define out16rb(address, value) m68k_out16_reverse((vuint16*)(address), value) #define out32rb(address, value) m68k_out32_reverse((vuint32*)(address), value) @@ -59,7 +78,7 @@ #define in32rb(address) m68k_in32_reverse((const vuint32*)(address)) -static int m68k_atari_enable_config(struct m68k_atari_host_bridge *bridge, +static int m68k_atari_enable_config(struct m68k_atari_fake_host_bridge *bridge, uint8 bus, uint8 slot, uint8 function, uint8 offset); static status_t m68k_atari_read_pci_config(void *cookie, uint8 bus, uint8 device, @@ -102,7 +121,8 @@ if (size != s) { \ panic("invalid pci config size %d for offset %d", size, offset); \ return EINVAL; \ - *value = dev->n; \ + } \ + *value = dev->info.n; \ return B_OK if (1) { @@ -125,30 +145,33 @@ #define PCI_status 0x06 /* (2 byte) status */ #endif - if (dev->header_type == 0x00 || dev->header_type == 0x01) { + if (dev->info.header_type == 0x00 || dev->info.header_type == 0x01) { switch (offset) { case PCI_base_registers: return EINVAL; - O(PCI_interrupt_line, h0.interrupt_line, 1); - O(PCI_interrupt_pin, h0.interrupt_pin, 1); - default: - break; + O(PCI_interrupt_line, u.h0.interrupt_line, 1); + O(PCI_interrupt_pin, u.h0.interrupt_pin, 1); + default: + break; + } } - if (dev->header_type == 0x00) { + if (dev->info.header_type == 0x00) { switch (offset) { - default: - break; + default: + break; + } } - if (dev->header_type == 0x01) { + if (dev->info.header_type == 0x01) { switch (offset) { - O(PCI_primary_bus, h1.primary_bus, 1); - O(PCI_secondary_bus, h1.secondary_bus, 1); - O(PCI_subordinate_bus, h1.subordinate_bus, 1); - O(PCI_secondary_latency, h1.secondary_latency, 1); - default: - break; + O(PCI_primary_bus, u.h1.primary_bus, 1); + O(PCI_secondary_bus, u.h1.secondary_bus, 1); + O(PCI_subordinate_bus, u.h1.subordinate_bus, 1); + O(PCI_secondary_latency, u.h1.secondary_latency, 1); + default: + break; + } } *value = 0xffffffff; @@ -158,7 +181,8 @@ } -static status_t m68k_atari_write_pci_config(void *cookie, uint8 bus, uint8 device, +static status_t +m68k_atari_write_pci_config(void *cookie, uint8 bus, uint8 device, uint8 function, uint8 offset, uint8 size, uint32 value) { #if 0 @@ -181,27 +205,33 @@ #endif panic("write pci config dev %d offset %d", device, offset); + return B_ERROR; return B_OK; } -static status_t m68k_atari_get_max_bus_devices(void *cookie, int32 *count) +static status_t +m68k_atari_get_max_bus_devices(void *cookie, int32 *count) { *count = 32; return B_OK; } -static status_t m68k_atari_read_pci_irq(void *cookie, uint8 bus, uint8 device, +static status_t +m68k_atari_read_pci_irq(void *cookie, uint8 bus, uint8 device, uint8 function, uint8 pin, uint8 *irq) { +#warning M68K: WRITEME return B_ERROR; } -static status_t m68k_atari_write_pci_irq(void *cookie, uint8 bus, uint8 device, +static status_t +m68k_atari_write_pci_irq(void *cookie, uint8 bus, uint8 device, uint8 function, uint8 pin, uint8 irq) { +#warning M68K: WRITEME return B_ERROR; } @@ -210,35 +240,11 @@ static int -m68k_atari_enable_config(struct m68k_atari_host_bridge *bridge, uint8 bus, +m68k_atari_enable_config(struct m68k_atari_fake_host_bridge *bridge, uint8 bus, uint8 slot, uint8 function, uint8 offset) { -// uint32 pass; -// if (resource_int_value(device_get_name(sc->sc_dev), -// device_get_unit(sc->sc_dev), "skipslot", &pass) == 0) { -// if (pass == slot) -// return (0); -// } - - uint32 cfgval; - if (bridge->bus == bus) { - /* - * No slots less than 11 on the primary bus - */ - if (slot < 11) - return (0); - - cfgval = (1 << slot) | (function << 8) | (offset & 0xfc); - } else { - cfgval = (bus << 16) | (slot << 11) | (function << 8) | - (offset & 0xfc) | 1; - } - - do { - out32rb(bridge->address_registers, cfgval); - } while (in32rb(bridge->address_registers) != cfgval); - - return (1); +#warning M68K: WRITEME + return 0; } @@ -250,9 +256,20 @@ status_t m68k_atari_pci_controller_init(void) { - status_t error = pci_controller_add(&sM68kAtariPCIController, /*cookie*/); -/* if (error != B_OK) - free(bridge);*/ + struct m68k_atari_fake_host_bridge *bridge; + bridge = (struct m68k_atari_fake_host_bridge *) + malloc(sizeof(struct m68k_atari_fake_host_bridge)); + if (!bridge) + return B_NO_MEMORY; + + bridge->bus = 0; + + status_t error = pci_controller_add(&sM68kAtariPCIController, bridge); + + if (error != B_OK) + free(bridge); + + // TODO: probe Hades & Milan bridges return error; } From mmu_man at mail.berlios.de Fri Jun 20 03:23:21 2008 From: mmu_man at mail.berlios.de (mmu_man at mail.berlios.de) Date: Fri, 20 Jun 2008 03:23:21 +0200 Subject: [Haiku-commits] r26036 - haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/atari Message-ID: <200806200123.m5K1NLAM024400@sheep.berlios.de> Author: mmu_man Date: 2008-06-20 03:23:20 +0200 (Fri, 20 Jun 2008) New Revision: 26036 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26036&view=rev Removed: haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/atari/pci_openfirmware_priv.h Log: Remove leftover OF header Deleted: haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/atari/pci_openfirmware_priv.h From mmu_man at mail.berlios.de Fri Jun 20 03:24:28 2008 From: mmu_man at mail.berlios.de (mmu_man at mail.berlios.de) Date: Fri, 20 Jun 2008 03:24:28 +0200 Subject: [Haiku-commits] r26037 - haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/atari Message-ID: <200806200124.m5K1OSew024438@sheep.berlios.de> Author: mmu_man Date: 2008-06-20 03:24:27 +0200 (Fri, 20 Jun 2008) New Revision: 26037 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26037&view=rev Removed: haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/atari/uninorth.cpp Log: Remove another OF leftover. If we ever support hades or milan we'll add something else there. Deleted: haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/atari/uninorth.cpp From bonefish at mail.berlios.de Fri Jun 20 03:33:20 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 20 Jun 2008 03:33:20 +0200 Subject: [Haiku-commits] r26038 - haiku/trunk/src/apps/terminal Message-ID: <200806200133.m5K1XKe1025042@sheep.berlios.de> Author: bonefish Date: 2008-06-20 03:33:18 +0200 (Fri, 20 Jun 2008) New Revision: 26038 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26038&view=rev Modified: haiku/trunk/src/apps/terminal/TermView.cpp haiku/trunk/src/apps/terminal/VTkeymap.h Log: * Generate the same escape sequence when pressing control or command and the left/right cursor keys. * Normalized the Ctrl-<cursor> escape sequences. Makes word navigation in vim work. Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-20 01:24:27 UTC (rev 26037) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-20 01:33:18 UTC (rev 26038) @@ -1173,7 +1173,7 @@ BMessage message(MSG_PREVIOUS_TAB); message.AddPointer("termView", this); Window()->PostMessage(&message); - } else if (mod & B_CONTROL_KEY) { + } else if ((mod & B_CONTROL_KEY) || (mod & B_COMMAND_KEY)) { toWrite = CTRL_LEFT_ARROW_KEY_CODE; } else toWrite = LEFT_ARROW_KEY_CODE; @@ -1186,7 +1186,7 @@ BMessage message(MSG_NEXT_TAB); message.AddPointer("termView", this); Window()->PostMessage(&message); - } else if (mod & B_CONTROL_KEY) { + } else if ((mod & B_CONTROL_KEY) || (mod & B_COMMAND_KEY)) { toWrite = CTRL_RIGHT_ARROW_KEY_CODE; } else toWrite = RIGHT_ARROW_KEY_CODE; Modified: haiku/trunk/src/apps/terminal/VTkeymap.h =================================================================== --- haiku/trunk/src/apps/terminal/VTkeymap.h 2008-06-20 01:24:27 UTC (rev 26037) +++ haiku/trunk/src/apps/terminal/VTkeymap.h 2008-06-20 01:33:18 UTC (rev 26038) @@ -69,10 +69,10 @@ #define UP_ARROW_KEY_CODE "\033OA" #define DOWN_ARROW_KEY_CODE "\033OB" -#define CTRL_LEFT_ARROW_KEY_CODE "\033[5D" -#define CTRL_RIGHT_ARROW_KEY_CODE "\033[5C" -#define CTRL_UP_ARROW_KEY_CODE "\033[5A" -#define CTRL_DOWN_ARROW_KEY_CODE "\033[5B" +#define CTRL_LEFT_ARROW_KEY_CODE "\033O5D" +#define CTRL_RIGHT_ARROW_KEY_CODE "\033O5C" +#define CTRL_UP_ARROW_KEY_CODE "\033O5A" +#define CTRL_DOWN_ARROW_KEY_CODE "\033O5B" #define DELETE_KEY_CODE "\033[3~" #define BACKSPACE_KEY_CODE "\177" From bonefish at mail.berlios.de Fri Jun 20 03:34:34 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 20 Jun 2008 03:34:34 +0200 Subject: [Haiku-commits] r26039 - haiku/trunk/data/etc Message-ID: <200806200134.m5K1YYlN025075@sheep.berlios.de> Author: bonefish Date: 2008-06-20 03:34:33 +0200 (Fri, 20 Jun 2008) New Revision: 26039 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26039&view=rev Modified: haiku/trunk/data/etc/inputrc Log: Enable word navigation in readline based programs (bash most notably). Modified: haiku/trunk/data/etc/inputrc =================================================================== --- haiku/trunk/data/etc/inputrc 2008-06-20 01:33:18 UTC (rev 26038) +++ haiku/trunk/data/etc/inputrc 2008-06-20 01:34:33 UTC (rev 26039) @@ -3,3 +3,5 @@ "\e[5~": history-search-backward "\e[6~": history-search-forward "\e[3~": delete-char +"\eO5D": backward-word +"\eO5C": forward-word From revol at free.fr Fri Jun 20 03:37:29 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Fri, 20 Jun 2008 03:37:29 +0200 CEST Subject: [Haiku-commits] r26038 - haiku/trunk/src/apps/terminal In-Reply-To: <200806200133.m5K1XKe1025042@sheep.berlios.de> Message-ID: <5045504707-BeMail@laptop> > Author: bonefish > Date: 2008-06-20 03:33:18 +0200 (Fri, 20 Jun 2008) > New Revision: 26038 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26038&view=rev > > Modified: > haiku/trunk/src/apps/terminal/TermView.cpp > haiku/trunk/src/apps/terminal/VTkeymap.h > Log: > * Generate the same escape sequence when pressing control or command > and > the left/right cursor keys. Note xterm or some other actually have different escapes for either left, alt-left, ctrl-left and alt-ctrl-left... but it should be enough. Fran?ois. From revol at free.fr Fri Jun 20 03:39:35 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Fri, 20 Jun 2008 03:39:35 +0200 CEST Subject: [Haiku-commits] r26039 - haiku/trunk/data/etc In-Reply-To: <200806200134.m5K1YYlN025075@sheep.berlios.de> Message-ID: <5171873790-BeMail@laptop> > Author: bonefish > Date: 2008-06-20 03:34:33 +0200 (Fri, 20 Jun 2008) > New Revision: 26039 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26039&view=rev > > Modified: > haiku/trunk/data/etc/inputrc > Log: > Enable word navigation in readline based programs (bash most > notably). > Great, that's very handy :) Note ubuntu maps "\e[1;5C" "\e[5C" and "\e\e[C" alltogether to it. That's the different results depending on mods on some terminals. Fran?ois. From mmu_man at mail.berlios.de Fri Jun 20 03:41:02 2008 From: mmu_man at mail.berlios.de (mmu_man at mail.berlios.de) Date: Fri, 20 Jun 2008 03:41:02 +0200 Subject: [Haiku-commits] r26040 - haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k Message-ID: <200806200141.m5K1f2X9027785@sheep.berlios.de> Author: mmu_man Date: 2008-06-20 03:40:58 +0200 (Fri, 20 Jun 2008) New Revision: 26040 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26040&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/pci_controller.cpp Log: bviously M68KPlatform makes more sense here :) Modified: haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/pci_controller.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/pci_controller.cpp 2008-06-20 01:34:33 UTC (rev 26039) +++ haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/m68k/pci_controller.cpp 2008-06-20 01:40:58 UTC (rev 26040) @@ -27,7 +27,7 @@ status_t pci_controller_init(void) { - switch (PPCPlatform::Default()->PlatformType()) { + switch (M68KPlatform::Default()->PlatformType()) { /* case M68K_PLATFORM_AMIGA: return m68k_amiga_pci_controller_init(); break; From mmu_man at mail.berlios.de Fri Jun 20 04:11:49 2008 From: mmu_man at mail.berlios.de (mmu_man at mail.berlios.de) Date: Fri, 20 Jun 2008 04:11:49 +0200 Subject: [Haiku-commits] r26041 - in haiku/trunk: headers/private/kernel/arch/m68k src/system/kernel/arch/m68k Message-ID: <200806200211.m5K2Bn4m002276@sheep.berlios.de> Author: mmu_man Date: 2008-06-20 04:11:45 +0200 (Fri, 20 Jun 2008) New Revision: 26041 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26041&view=rev Modified: haiku/trunk/headers/private/kernel/arch/m68k/arch_cpu.h haiku/trunk/headers/private/kernel/arch/m68k/arch_kernel_args.h haiku/trunk/src/system/kernel/arch/m68k/arch_030_cpu.cpp haiku/trunk/src/system/kernel/arch/m68k/arch_cpu.cpp haiku/trunk/src/system/kernel/arch/m68k/arch_platform.cpp Log: - some cpu and platform fixes. - we'll just use decimal chip number (68030, ...) to identify cpu, fpu, and mmu for simplicity. Modified: haiku/trunk/headers/private/kernel/arch/m68k/arch_cpu.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/m68k/arch_cpu.h 2008-06-20 01:40:58 UTC (rev 26040) +++ haiku/trunk/headers/private/kernel/arch/m68k/arch_cpu.h 2008-06-20 02:11:45 UTC (rev 26041) @@ -357,9 +357,9 @@ void (*flush_insn_pipeline)(void); void (*flush_atc_all)(void); void (*flush_atc_user)(void); - void (*flush_atc_addr)(void *addr); - void (*flush_dcache)(void *address, size_t len); - void (*flush_icache)(void *address, size_t len); + void (*flush_atc_addr)(addr_t addr); + void (*flush_dcache)(addr_t address, size_t len); + void (*flush_icache)(addr_t address, size_t len); void (*idle)(void); }; @@ -376,6 +376,10 @@ #define tlbie(addr) asm volatile("tlbie %0" :: "r" (addr)) #endif +#if 0 + +// XXX: not used: we just use decimal chip number, like 68030 + // m68k processor version. enum m68k_processor_version { /* those two we don't support */ @@ -410,6 +414,7 @@ MMU_68060 = 0x0600, MMU_MASK = 0x0F00 }; +#endif extern int arch_cpu_type; extern int arch_fpu_type; Modified: haiku/trunk/headers/private/kernel/arch/m68k/arch_kernel_args.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/m68k/arch_kernel_args.h 2008-06-20 01:40:58 UTC (rev 26040) +++ haiku/trunk/headers/private/kernel/arch/m68k/arch_kernel_args.h 2008-06-20 02:11:45 UTC (rev 26041) @@ -15,9 +15,9 @@ // kernel args typedef struct { - int cpu_type; - int fpu_type; - int mmu_type; + int cpu_type; // decimal: 68030, ... + int fpu_type; // decimal: 68030, ... + int mmu_type; // decimal: 68030, ... int platform; bool has_lpstop; //XXX: use bit flags // architecture specific Modified: haiku/trunk/src/system/kernel/arch/m68k/arch_030_cpu.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/m68k/arch_030_cpu.cpp 2008-06-20 01:40:58 UTC (rev 26040) +++ haiku/trunk/src/system/kernel/arch/m68k/arch_030_cpu.cpp 2008-06-20 02:11:45 UTC (rev 26041) @@ -20,7 +20,7 @@ /* from arch_030_asm.S */ extern void flush_insn_pipeline_030(void); extern void flush_atc_all_030(void); -extern void flush_atc_addr_030(void *addr); +extern void flush_atc_addr_030(addr_t addr); #ifdef __cplusplus } @@ -31,7 +31,7 @@ #define CACHELINE 16 static void -sync_icache_030(void *address, size_t len) +sync_icache_030(addr_t address, size_t len) { int l, off; char *p; Modified: haiku/trunk/src/system/kernel/arch/m68k/arch_cpu.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/m68k/arch_cpu.cpp 2008-06-20 01:40:58 UTC (rev 26040) +++ haiku/trunk/src/system/kernel/arch/m68k/arch_cpu.cpp 2008-06-20 02:11:45 UTC (rev 26041) @@ -23,11 +23,6 @@ struct m68k_cpu_ops cpu_ops; -int cpu_type; -int fpu_type; -int mmu_type; -int platform; - status_t arch_cpu_preboot_init_percpu(kernel_args *args, int curr_cpu) { @@ -45,47 +40,55 @@ status_t arch_cpu_init(kernel_args *args) { - cpu_type = args->arch_args.cpu_type; - fpu_type = args->arch_args.fpu_type; - mmu_type = args->arch_args.mmu_type; - platform = args->arch_args.platform; + arch_cpu_type = args->arch_args.cpu_type; + arch_fpu_type = args->arch_args.fpu_type; + arch_mmu_type = args->arch_args.mmu_type; + arch_platform = args->arch_args.platform; + void (*flush_insn_pipeline)(void); + void (*flush_atc_all)(void); + void (*flush_atc_user)(void); + void (*flush_atc_addr)(void *addr); + void (*flush_dcache)(void *address, size_t len); + void (*flush_icache)(void *address, size_t len); + void (*idle)(void); - switch (cpu_type) { - case CPU_68020: - case CPU_68030: - cpu_ops.flush_insn_pipeline = cpu_ops_030.flush_insn_pipeline; - cpu_ops.flush_atc_all = cpu_ops_030.flush_atc_all; - cpu_ops.flush_atc_user = cpu_ops_030.flush_atc_user; - cpu_ops.flush_atc_addr = cpu_ops_030.flush_atc_addr; - cpu_ops.flush_cache_line = cpu_ops_030.flush_cache_line; - cpu_ops.idle = cpu_ops_030.idle; // NULL - //cpu_ops. = cpu_ops_030.; - break; + switch (arch_cpu_type) { + case 68020: + case 68030: + cpu_ops.flush_insn_pipeline = cpu_ops_030.flush_insn_pipeline; + cpu_ops.flush_atc_all = cpu_ops_030.flush_atc_all; + cpu_ops.flush_atc_user = cpu_ops_030.flush_atc_user; + cpu_ops.flush_atc_addr = cpu_ops_030.flush_atc_addr; + cpu_ops.flush_dcache = cpu_ops_030.flush_dcache; + cpu_ops.flush_icache = cpu_ops_030.flush_icache; + cpu_ops.idle = cpu_ops_030.idle; // NULL + break; #ifdef SUPPORTS_040 - case CPU_68040: - cpu_ops.flush_insn_pipeline = cpu_ops_040.flush_insn_pipeline; - cpu_ops.flush_atc_all = cpu_ops_040.flush_atc_all; - cpu_ops.flush_atc_user = cpu_ops_040.flush_atc_user; - cpu_ops.flush_atc_addr = cpu_ops_040.flush_atc_addr; - cpu_ops.flush_cache_line = cpu_ops_040.flush_cache_line; - cpu_ops.idle = cpu_ops_040.idle; // NULL - //cpu_ops. = cpu_ops_040.; - break; + case 68040: + cpu_ops.flush_insn_pipeline = cpu_ops_040.flush_insn_pipeline; + cpu_ops.flush_atc_all = cpu_ops_040.flush_atc_all; + cpu_ops.flush_atc_user = cpu_ops_040.flush_atc_user; + cpu_ops.flush_atc_addr = cpu_ops_040.flush_atc_addr; + cpu_ops.flush_dcache = cpu_ops_040.flush_dcache; + cpu_ops.flush_icache = cpu_ops_040.flush_icache; + cpu_ops.idle = cpu_ops_040.idle; // NULL + break; #endif #ifdef SUPPORTS_060 - case CPU_68060: - cpu_ops.flush_insn_pipeline = cpu_ops_060.flush_insn_pipeline; - cpu_ops.flush_atc_all = cpu_ops_060.flush_atc_all; - cpu_ops.flush_atc_user = cpu_ops_060.flush_atc_user; - cpu_ops.flush_atc_addr = cpu_ops_060.flush_atc_addr; - cpu_ops.flush_cache_line = cpu_ops_060.flush_cache_line; - cpu_ops.idle = cpu_ops_060.idle; - //cpu_ops. = cpu_ops_060.; + case 68060: + cpu_ops.flush_insn_pipeline = cpu_ops_060.flush_insn_pipeline; + cpu_ops.flush_atc_all = cpu_ops_060.flush_atc_all; + cpu_ops.flush_atc_user = cpu_ops_060.flush_atc_user; + cpu_ops.flush_atc_addr = cpu_ops_060.flush_atc_addr; + cpu_ops.flush_dcache = cpu_ops_060.flush_dcache; + cpu_ops.flush_icache = cpu_ops_060.flush_icache; + cpu_ops.idle = cpu_ops_060.idle; break; #endif - default: - panic("unknown cpu_type 0x%08lx\n", args->arch_args.cpu_type); + default: + panic("unknown cpu_type %d\n", arch_cpu_type); } + return B_OK; } @@ -106,7 +109,7 @@ void arch_cpu_sync_icache(void *address, size_t len) { - cpu_ops.flush_icache(address, len); + cpu_ops.flush_icache((addr_t)address, len); } Modified: haiku/trunk/src/system/kernel/arch/m68k/arch_platform.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/m68k/arch_platform.cpp 2008-06-20 01:40:58 UTC (rev 26040) +++ haiku/trunk/src/system/kernel/arch/m68k/arch_platform.cpp 2008-06-20 02:11:45 UTC (rev 26041) @@ -76,7 +76,7 @@ // constructor M68KApple::M68KApple() - : M68KPlatform(M68K_PLATFORM_OPEN_FIRMWARE), + : M68KPlatform(M68K_PLATFORM_MAC), fRTC(-1) { } @@ -134,12 +134,14 @@ void M68KApple::ShutDown(bool reboot) { +#if 0 if (reboot) { of_interpret("reset-all", 0, 0); } else { // not standardized, so it might fail of_interpret("shut-down", 0, 0); } +#endif } @@ -279,8 +281,22 @@ { #warning M68K: switch platform from kernel args // only Atari supported for now - if (true) - sM68KPlatform = new(sM68KPlatformBuffer) M68KAtari; + switch (args->arch_args.platform) { + case M68K_PLATFORM_AMIGA: + sM68KPlatform = new(sM68KPlatformBuffer) M68KAmiga; + break; + case M68K_PLATFORM_ATARI: + sM68KPlatform = new(sM68KPlatformBuffer) M68KAtari; + break; + case M68K_PLATFORM_MAC: + sM68KPlatform = new(sM68KPlatformBuffer) M68KApple; + break; + case M68K_PLATFORM_NEXT: + sM68KPlatform = new(sM68KPlatformBuffer) M68KNext; + break; + default: + panic("unknown platform d\n", args->arch_args.platform); + } return sM68KPlatform->Init(kernelArgs); } From mmu_man at mail.berlios.de Fri Jun 20 04:22:30 2008 From: mmu_man at mail.berlios.de (mmu_man at mail.berlios.de) Date: Fri, 20 Jun 2008 04:22:30 +0200 Subject: [Haiku-commits] r26042 - in haiku/trunk: headers/private/kernel/arch/m68k src/system/kernel/arch/m68k Message-ID: <200806200222.m5K2MUBP003191@sheep.berlios.de> Author: mmu_man Date: 2008-06-20 04:22:26 +0200 (Fri, 20 Jun 2008) New Revision: 26042 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26042&view=rev Modified: haiku/trunk/headers/private/kernel/arch/m68k/arch_platform.h haiku/trunk/src/system/kernel/arch/m68k/arch_debug.cpp Log: - comment - fix building arch_debug. Misses many regs still. Modified: haiku/trunk/headers/private/kernel/arch/m68k/arch_platform.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/m68k/arch_platform.h 2008-06-20 02:11:45 UTC (rev 26041) +++ haiku/trunk/headers/private/kernel/arch/m68k/arch_platform.h 2008-06-20 02:22:26 UTC (rev 26042) @@ -11,7 +11,7 @@ enum m68k_platform_type { M68K_PLATFORM_AMIGA = 0, - M68K_PLATFORM_ATARI, /* Falcon */ + M68K_PLATFORM_ATARI, /* TT, Falcon, Hades, Milan... */ M68K_PLATFORM_MAC, M68K_PLATFORM_NEXT }; Modified: haiku/trunk/src/system/kernel/arch/m68k/arch_debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/m68k/arch_debug.cpp 2008-06-20 02:11:45 UTC (rev 26041) +++ haiku/trunk/src/system/kernel/arch/m68k/arch_debug.cpp 2008-06-20 02:22:26 UTC (rev 26042) @@ -205,22 +205,23 @@ if (frame) { kprintf("iframe at %p\n", frame); kprintf(" d0 0x%08lx d1 0x%08lx d2 0x%08lx d3 0x%08lx\n", - frame->d0, frame->d1, frame->d2, frame->d3); + frame->d[0], frame->d[1], frame->d[2], frame->d[3]); kprintf(" d4 0x%08lx d5 0x%08lx d6 0x%08lx d7 0x%08lx\n", - frame->d4, frame->d5, frame->d6, frame->d7); + frame->d[4], frame->d[5], frame->d[6], frame->d[7]); kprintf(" a0 0x%08lx a1 0x%08lx a2 0x%08lx a3 0x%08lx\n", - frame->a0, frame->a1, frame->a2, frame->a3); + frame->a[0], frame->a[1], frame->a[2], frame->a[3]); kprintf(" a4 0x%08lx a5 0x%08lx a6 0x%08lx a7 0x%08lx (sp)\n", - frame->a4, frame->a5, frame->a6, frame->a7); +#warning M68K: a7 in iframe ?? + frame->a[4], frame->a[5], frame->a[6], -1/*frame->a[7]*/); /*kprintf(" pc 0x%08lx ccr 0x%02x\n", frame->pc, frame->ccr);*/ kprintf(" pc 0x%08lx sr 0x%04x\n", - frame->pc, frame->sr); + frame->cpu.pc, frame->cpu.sr); #warning M68K: missing regs - print_stack_frame(thread, frame->pc, framePointer, frame->a6); - framePointer = frame->a6; + print_stack_frame(thread, frame->cpu.pc, framePointer, frame->a[6]); + framePointer = frame->a[6]; } else { addr_t ip, nextFramePointer; From aldeck at mail.berlios.de Fri Jun 20 04:39:37 2008 From: aldeck at mail.berlios.de (aldeck at BerliOS) Date: Fri, 20 Jun 2008 04:39:37 +0200 Subject: [Haiku-commits] r26043 - in haiku/trunk/src/kits: interface tracker Message-ID: <200806200239.m5K2dbaJ005395@sheep.berlios.de> Author: aldeck Date: 2008-06-20 04:39:33 +0200 (Fri, 20 Jun 2008) New Revision: 26043 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26043&view=rev Modified: haiku/trunk/src/kits/interface/View.cpp haiku/trunk/src/kits/tracker/ContainerWindow.cpp Log: - Since r21336, BView::ScrollBy was checking the values against the ScrollBar ranges but ScrollBy is often called before updating the scroll range (ie: in ContainerWindow.cpp). IMO, the programatic ScrollBy method shouldn't depend on the ScrollBars ranges or state. The original fix in r21336 was apparently hiding other BScrollBar or BView bugs that have been fixed in the mean time. The content was offseted when going back to list mode after moving icons on the left/up in icon mode. This fixes Tracker bug #2312. - Revert and fix changes to ContainerWindow.cpp in r18481 (cvs 1.37). The condition was broken, but it wouldn't ScrollBy() anyway due to the previous problem. Fixing BView made the content autoscroll even if the lefttop corner of the extent was already visible. - Probably unrelated, fix changes to ContainerWindow.cpp in r18993 (cvs 1.38). PoseView()->Bounds().left/top < 0 is expected, if for example in icon mode you move an icon close or crossing the left side of the window and then scroll left to adjust. This fix ResizeToFit that wouldn't scroll the view correctly in some cases. So we had a Tracker Bug uncovering a BView fix that was hiding another Tracker bug, everything is fixed hopefully, phew :-) Modified: haiku/trunk/src/kits/interface/View.cpp =================================================================== --- haiku/trunk/src/kits/interface/View.cpp 2008-06-20 02:22:26 UTC (rev 26042) +++ haiku/trunk/src/kits/interface/View.cpp 2008-06-20 02:39:33 UTC (rev 26043) @@ -1507,26 +1507,6 @@ if (where.x == fBounds.left && where.y == fBounds.top) return; - // make sure scrolling is within valid bounds - if (fHorScroller) { - float min, max; - fHorScroller->GetRange(&min, &max); - - if (where.x < min) - where.x = min; - else if (where.x > max) - where.x = max; - } - if (fVerScroller) { - float min, max; - fVerScroller->GetRange(&min, &max); - - if (where.y < min) - where.y = min; - else if (where.y > max) - where.y = max; - } - _CheckLockAndSwitchCurrent(); // if we're attached to a window tell app_server about this change Modified: haiku/trunk/src/kits/tracker/ContainerWindow.cpp =================================================================== --- haiku/trunk/src/kits/tracker/ContainerWindow.cpp 2008-06-20 02:22:26 UTC (rev 26042) +++ haiku/trunk/src/kits/tracker/ContainerWindow.cpp 2008-06-20 02:39:33 UTC (rev 26043) @@ -1077,17 +1077,20 @@ BContainerWindow::FrameResized(float, float) { if (PoseView() && dynamic_cast<BDeskWindow *>(this) == NULL) { - BRect extent = PoseView()->Extent(); - if (extent.bottom < PoseView()->Bounds().bottom - && fPreviousBounds.Height() < Bounds().Height()) { - PoseView()->ScrollBy(0, max_c(extent.bottom - PoseView()->Bounds().bottom, - fPreviousBounds.Height() - Bounds().Height())); - } - if (extent.right < PoseView()->Bounds().right - && fPreviousBounds.Width() < Bounds().Width()) { - PoseView()->ScrollBy(max_c(extent.right - PoseView()->Bounds().right, - fPreviousBounds.Width() - Bounds().Width()), 0); - } + BRect extent = PoseView()->Extent(); + float offsetX = extent.left - PoseView()->Bounds().left; + float offsetY = extent.top - PoseView()->Bounds().top; + + // scroll when the size augmented, there is a negative offset + // and we have resized over the bottom right corner of the extent + if (offsetX < 0 && PoseView()->Bounds().right > extent.right + && Bounds().Width() > fPreviousBounds.Width()) + PoseView()->ScrollBy(max_c(fPreviousBounds.Width() - Bounds().Width(), offsetX), 0); + + if (offsetY < 0 && PoseView()->Bounds().bottom > extent.bottom + && Bounds().Height() > fPreviousBounds.Height()) + PoseView()->ScrollBy(0, max_c(fPreviousBounds.Height() - Bounds().Height(), offsetY)); + PoseView()->UpdateScrollRange(); PoseView()->ResetPosePlacementHint(); } @@ -1336,11 +1339,11 @@ MoveTo(frame.LeftTop()); PoseView()->DisableScrollBars(); - if (PoseView()->Bounds().bottom > extent.bottom && PoseView()->Bounds().top < 0) - PoseView()->ScrollBy(0, extent.bottom - PoseView()->Bounds().bottom); - if (PoseView()->Bounds().right > extent.right && PoseView()->Bounds().left < 0) - PoseView()->ScrollBy(extent.right - PoseView()->Bounds().right, 0); - + // scroll if there is an offset + PoseView()->ScrollBy( + extent.left - PoseView()->Bounds().left, + extent.top - PoseView()->Bounds().top); + PoseView()->UpdateScrollRange(); PoseView()->EnableScrollBars(); } From anevilyak at gmail.com Fri Jun 20 04:59:43 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Thu, 19 Jun 2008 21:59:43 -0500 Subject: [Haiku-commits] r26043 - in haiku/trunk/src/kits: interface tracker In-Reply-To: <200806200239.m5K2dbaJ005395@sheep.berlios.de> References: <200806200239.m5K2dbaJ005395@sheep.berlios.de> Message-ID: <f019d2f30806191959s192a0cc3gf7a4d0b203a36e7c@mail.gmail.com> On Thu, Jun 19, 2008 at 9:39 PM, aldeck at BerliOS <aldeck at mail.berlios.de> wrote: > Author: aldeck > Date: 2008-06-20 04:39:33 +0200 (Fri, 20 Jun 2008) > New Revision: 26043 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26043&view=rev > > Modified: > haiku/trunk/src/kits/interface/View.cpp > haiku/trunk/src/kits/tracker/ContainerWindow.cpp > Log: > - Since r21336, BView::ScrollBy was checking the values against the ScrollBar ranges but ScrollBy is often called before > updating the scroll range I'm not sure this is the right way to go...you'll notice it only does the range check *if* a scrollbar is attached, which is correct, you shouldn't be able to scroll it outside of the range of the bar. If you're trying to do this because you're about to update the range of the bar, then you're imo doing the operations in the wrong order. Regards, Rene From alex at zappotek.com Fri Jun 20 13:00:28 2008 From: alex at zappotek.com (Alexandre Deckner) Date: Fri, 20 Jun 2008 13:00:28 +0200 Subject: [Haiku-commits] r26043 - in haiku/trunk/src/kits: interface tracker In-Reply-To: <f019d2f30806191959s192a0cc3gf7a4d0b203a36e7c@mail.gmail.com> References: <200806200239.m5K2dbaJ005395@sheep.berlios.de> <f019d2f30806191959s192a0cc3gf7a4d0b203a36e7c@mail.gmail.com> Message-ID: <485B8DCC.7010400@zappotek.com> Rene Gollent wrote: > On Thu, Jun 19, 2008 at 9:39 PM, aldeck at BerliOS > <aldeck at mail.berlios.de> wrote: > >> Author: aldeck >> Date: 2008-06-20 04:39:33 +0200 (Fri, 20 Jun 2008) >> New Revision: 26043 >> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26043&view=rev >> >> Modified: >> haiku/trunk/src/kits/interface/View.cpp >> haiku/trunk/src/kits/tracker/ContainerWindow.cpp >> Log: >> - Since r21336, BView::ScrollBy was checking the values against the ScrollBar ranges but ScrollBy is often called before >> updating the scroll range >> > > I'm not sure this is the right way to go...you'll notice it only does > the range check *if* a scrollbar is attached, which is correct, you > shouldn't be able to scroll it outside of the range of the bar. If > you're trying to do this because you're about to update the range of > the bar, then you're imo doing the operations in the wrong order. > > Well, the scrollrange is only there to limit the (visual) bars to whatever content on the view you'd like. In my understanding, calling ScrollBy directly takes priority over the scrollbars, at least that was the R5 behaviour. I think it is your responsability to adjust the range, and it shouldn't block a programatic scroll, the thumb movement is limited anyway. I can try to fix the "order" in tracker code, but it seems to be working like this for some time already. Reagards, Alex From bonefish at mail.berlios.de Fri Jun 20 14:23:00 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 20 Jun 2008 14:23:00 +0200 Subject: [Haiku-commits] r26044 - haiku/trunk/src/apps/terminal Message-ID: <200806201223.m5KCN0jI009131@sheep.berlios.de> Author: bonefish Date: 2008-06-20 14:22:52 +0200 (Fri, 20 Jun 2008) New Revision: 26044 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26044&view=rev Added: haiku/trunk/src/apps/terminal/Globals.cpp haiku/trunk/src/apps/terminal/Globals.h Modified: haiku/trunk/src/apps/terminal/Jamfile haiku/trunk/src/apps/terminal/TermApp.cpp haiku/trunk/src/apps/terminal/TermConst.h haiku/trunk/src/apps/terminal/TermView.cpp haiku/trunk/src/apps/terminal/TermView.h Log: Fixed mouse copy'n'paste support. We use a separate clipboard for mouse selection which we update whenever the first mouse button is released. This also enables copy'n'paste between Terminals. Added: haiku/trunk/src/apps/terminal/Globals.cpp =================================================================== --- haiku/trunk/src/apps/terminal/Globals.cpp 2008-06-20 02:39:33 UTC (rev 26043) +++ haiku/trunk/src/apps/terminal/Globals.cpp 2008-06-20 12:22:52 UTC (rev 26044) @@ -0,0 +1,11 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ + +#include <stddef.h> + +#include "Globals.h" + + +BClipboard* gMouseClipboard = NULL; Added: haiku/trunk/src/apps/terminal/Globals.h =================================================================== --- haiku/trunk/src/apps/terminal/Globals.h 2008-06-20 02:39:33 UTC (rev 26043) +++ haiku/trunk/src/apps/terminal/Globals.h 2008-06-20 12:22:52 UTC (rev 26044) @@ -0,0 +1,15 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef GLOBALS_H +#define GLOBALS_H + + +class BClipboard; + +extern BClipboard* gMouseClipboard; + // clipboard used for mouse copy'n'paste + + +#endif // GLOBALS_H Modified: haiku/trunk/src/apps/terminal/Jamfile =================================================================== --- haiku/trunk/src/apps/terminal/Jamfile 2008-06-20 02:39:33 UTC (rev 26043) +++ haiku/trunk/src/apps/terminal/Jamfile 2008-06-20 12:22:52 UTC (rev 26044) @@ -11,6 +11,7 @@ CodeConv.cpp Coding.cpp FindWindow.cpp + Globals.cpp HistoryBuffer.cpp MenuUtil.cpp Terminal.cpp Modified: haiku/trunk/src/apps/terminal/TermApp.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermApp.cpp 2008-06-20 02:39:33 UTC (rev 26043) +++ haiku/trunk/src/apps/terminal/TermApp.cpp 2008-06-20 12:22:52 UTC (rev 26044) @@ -26,6 +26,7 @@ #include "Arguments.h" #include "CodeConv.h" +#include "Globals.h" #include "PrefHandler.h" #include "TermWindow.h" #include "TermConst.h" @@ -94,6 +95,9 @@ // continue anyway } + // init the mouse copy'n'paste clipboard + gMouseClipboard = new BClipboard(MOUSE_CLIPBOARD_NAME, true); + status_t status = _MakeTermWindow(fTermFrame); // failed spawn, print stdout and open alert panel Modified: haiku/trunk/src/apps/terminal/TermConst.h =================================================================== --- haiku/trunk/src/apps/terminal/TermConst.h 2008-06-20 02:39:33 UTC (rev 26043) +++ haiku/trunk/src/apps/terminal/TermConst.h 2008-06-20 12:22:52 UTC (rev 26044) @@ -31,13 +31,16 @@ #ifndef TERMCONST_H_INCLUDED #define TERMCONST_H_INCLUDED -// Application signature (Must same in Muterminal.rsrc)// +// Application signature (Must same in Muterminal.rsrc) #define TERM_SIGNATURE "application/x-vnd.Haiku-Terminal" #define PREFFILE_MIMETYPE "text/x-terminal-pref" // Signature of R5's Terminal. Needed for proper drop-in window count support #define R5_TERM_SIGNATURE "application/x-vnd.Be-SHEL" +// Name of the clipboard used for mouse copy'n'paste. +#define MOUSE_CLIPBOARD_NAME TERM_SIGNATURE "/mouse" + // Message constants for menu items #include <SupportDefs.h> Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-20 02:39:33 UTC (rev 26043) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-20 12:22:52 UTC (rev 26044) @@ -41,6 +41,7 @@ #include <Window.h> #include "CodeConv.h" +#include "Globals.h" #include "Shell.h" #include "TermConst.h" #include "TerminalCharClassifier.h" @@ -949,6 +950,8 @@ void TermView::AttachedToWindow() { + fMouseButtons = 0; + MakeFocus(true); if (fScrollBar) { fScrollBar->SetSteps(fFontHeight, fFontHeight * fTermRows); @@ -1801,19 +1804,11 @@ int32 buttons; Window()->CurrentMessage()->FindInt32("buttons", &buttons); + fMouseButtons = buttons; + // paste button if ((buttons & (B_SECONDARY_MOUSE_BUTTON | B_TERTIARY_MOUSE_BUTTON)) != 0) { - if (_HasSelection()) { - // copy text from region - BString copy; - fTextBuffer->Lock(); - fTextBuffer->GetStringFromRegion(copy, fSelStart, fSelEnd); - fTextBuffer->Unlock(); - _WritePTY(copy.String(), copy.Length()); - } else { - // copy text from clipboard. - Paste(be_clipboard); - } + Paste(gMouseClipboard); return; } @@ -1956,6 +1951,17 @@ delete fAutoScrollRunner; fAutoScrollRunner = NULL; } + + // When releasing the first mouse button, we copy the selected text to the + // clipboard. + int32 buttons; + Window()->CurrentMessage()->FindInt32("buttons", &buttons); + if ((buttons & B_PRIMARY_MOUSE_BUTTON) == 0 + && (fMouseButtons & B_PRIMARY_MOUSE_BUTTON) != 0) { + Copy(gMouseClipboard); + } + + fMouseButtons = buttons; } Modified: haiku/trunk/src/apps/terminal/TermView.h =================================================================== --- haiku/trunk/src/apps/terminal/TermView.h 2008-06-20 02:39:33 UTC (rev 26043) +++ haiku/trunk/src/apps/terminal/TermView.h 2008-06-20 12:22:52 UTC (rev 26044) @@ -191,6 +191,8 @@ // Cursor position. TermPos fCursor; + int32 fMouseButtons; + // Terminal rows and columns. int fTermRows; int fTermColumns; From bonefish at mail.berlios.de Fri Jun 20 14:35:44 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 20 Jun 2008 14:35:44 +0200 Subject: [Haiku-commits] r26045 - haiku/trunk/src/apps/terminal Message-ID: <200806201235.m5KCZiVr010666@sheep.berlios.de> Author: bonefish Date: 2008-06-20 14:35:42 +0200 (Fri, 20 Jun 2008) New Revision: 26045 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26045&view=rev Modified: haiku/trunk/src/apps/terminal/TermView.h haiku/trunk/src/apps/terminal/TermWindow.cpp Log: Use the preferred history size. It's not settable via GUI yet, but one can edit the settings file. The default are 10000 lines BTW. Modified: haiku/trunk/src/apps/terminal/TermView.h =================================================================== --- haiku/trunk/src/apps/terminal/TermView.h 2008-06-20 12:22:52 UTC (rev 26044) +++ haiku/trunk/src/apps/terminal/TermView.h 2008-06-20 12:35:42 UTC (rev 26045) @@ -30,8 +30,9 @@ class TermView : public BView { public: - TermView(BRect frame, int32 argc, const char **argv, int32 historySize = 1000); - TermView(int rows, int columns, int32 argc, const char **argv, int32 historySize = 1000); + TermView(BRect frame, int32 argc, const char **argv, int32 historySize); + TermView(int rows, int columns, int32 argc, const char **argv, + int32 historySize); TermView(BMessage *archive); ~TermView(); Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.cpp 2008-06-20 12:22:52 UTC (rev 26044) +++ haiku/trunk/src/apps/terminal/TermWindow.cpp 2008-06-20 12:35:42 UTC (rev 26045) @@ -687,10 +687,11 @@ // Note: I don't pass the Arguments class directly to the termview, // only to avoid adding it as a dependency: in other words, to keep // the TermView class as agnostic as possible about the surrounding world. - CustomTermView *view = - new CustomTermView(PrefHandler::Default()->getInt32(PREF_ROWS), - PrefHandler::Default()->getInt32(PREF_COLS), - argc, (const char **)argv); + CustomTermView *view = new CustomTermView( + PrefHandler::Default()->getInt32(PREF_ROWS), + PrefHandler::Default()->getInt32(PREF_COLS), + argc, (const char **)argv, + PrefHandler::Default()->getInt32(PREF_HISTORY_SIZE)); TermViewContainerView *containerView = new TermViewContainerView(view); BScrollView *scrollView = new TermScrollView("scrollView", From bonefish at mail.berlios.de Fri Jun 20 14:38:53 2008 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 20 Jun 2008 14:38:53 +0200 Subject: [Haiku-commits] r26046 - haiku/trunk/src/apps/terminal Message-ID: <200806201238.m5KCcrDO010890@sheep.berlios.de> Author: bonefish Date: 2008-06-20 14:38:52 +0200 (Fri, 20 Jun 2008) New Revision: 26046 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26046&view=rev Modified: haiku/trunk/src/apps/terminal/TermView.cpp Log: Also scroll to the cursor when pasting something. Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-20 12:35:42 UTC (rev 26045) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2008-06-20 12:38:52 UTC (rev 26046) @@ -690,6 +690,8 @@ } clipboard->Unlock(); + + _ScrollTo(0, true); } } From aldeck at mail.berlios.de Fri Jun 20 22:04:11 2008 From: aldeck at mail.berlios.de (aldeck at BerliOS) Date: Fri, 20 Jun 2008 22:04:11 +0200 Subject: [Haiku-commits] r26047 - haiku/trunk/src/kits/interface Message-ID: <200806202004.m5KK4B4L011815@sheep.berlios.de> Author: aldeck Date: 2008-06-20 22:04:10 +0200 (Fri, 20 Jun 2008) New Revision: 26047 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26047&view=rev Modified: haiku/trunk/src/kits/interface/View.cpp Log: - revert my last changes to ScrollBy, this temporarily bring back #2312 and the previously mentioned ResizeToFit issue. Modified: haiku/trunk/src/kits/interface/View.cpp =================================================================== --- haiku/trunk/src/kits/interface/View.cpp 2008-06-20 12:38:52 UTC (rev 26046) +++ haiku/trunk/src/kits/interface/View.cpp 2008-06-20 20:04:10 UTC (rev 26047) @@ -1506,7 +1506,27 @@ // no reason to process this further if no scroll is intended. if (where.x == fBounds.left && where.y == fBounds.top) return; + + // make sure scrolling is within valid bounds + if (fHorScroller) { + float min, max; + fHorScroller->GetRange(&min, &max); + if (where.x < min) + where.x = min; + else if (where.x > max) + where.x = max; + } + if (fVerScroller) { + float min, max; + fVerScroller->GetRange(&min, &max); + + if (where.y < min) + where.y = min; + else if (where.y > max) + where.y = max; + } + _CheckLockAndSwitchCurrent(); // if we're attached to a window tell app_server about this change From sbenedetto at mail.berlios.de Sat Jun 21 00:40:19 2008 From: sbenedetto at mail.berlios.de (sbenedetto at BerliOS) Date: Sat, 21 Jun 2008 00:40:19 +0200 Subject: [Haiku-commits] r26048 - in haiku/trunk: build/config_headers headers/private/kernel Message-ID: <200806202240.m5KMeJUC007441@sheep.berlios.de> Author: sbenedetto Date: 2008-06-21 00:40:15 +0200 (Sat, 21 Jun 2008) New Revision: 26048 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26048&view=rev Modified: haiku/trunk/build/config_headers/kernel_debugger_config.h haiku/trunk/headers/private/kernel/debugger_keymaps.h Log: * Added italian keymap Modified: haiku/trunk/build/config_headers/kernel_debugger_config.h =================================================================== --- haiku/trunk/build/config_headers/kernel_debugger_config.h 2008-06-20 20:04:10 UTC (rev 26047) +++ haiku/trunk/build/config_headers/kernel_debugger_config.h 2008-06-20 22:40:15 UTC (rev 26048) @@ -3,6 +3,7 @@ // Available keymaps: // 'dv' dvorak keymap +// 'it' italian keymap // 'fr' french keymap // 'sg' swiss-german keymap // 'us' default US keymap Modified: haiku/trunk/headers/private/kernel/debugger_keymaps.h =================================================================== --- haiku/trunk/headers/private/kernel/debugger_keymaps.h 2008-06-20 20:04:10 UTC (rev 26047) +++ haiku/trunk/headers/private/kernel/debugger_keymaps.h 2008-06-20 22:40:15 UTC (rev 26048) @@ -47,6 +47,41 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +#elif KDL_KEYMAP == 'it' + +static const char kUnshiftedKeymap[128] = { + 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '\'', '^', 8, '\t', + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 0, '+', '\n', 0, 'a', 's', + 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0, 0, '\\', 0, '<', 'z', 'x', 'c', 'v', + 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static const char kShiftedKeymap[128] = { + 0, 27, '!', '"', 0, '$', '%', '&', '/', '(', ')', '=', '?', '^', 8, '\t', + 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 0, '*', '\n', 0, 'A', 'S', + 'D', 'F', 'G', 'H', 'J', 'K', 'L', 0, 0, '|', 0, '>', 'Z', 'X', 'C', 'V', + 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static const char kAltedKeymap[128] = { + 0, 27, 0, 0, 0, 0, 0, 0, '|', 0, 0, 0, 0, '~', 8, '\t', + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '[', ']', 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, '{', 0, 0, '}', 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, '\\', 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + #elif KDL_KEYMAP == 'fr' static const char kUnshiftedKeymap[128] = { From sbenedetto at mail.berlios.de Sat Jun 21 00:45:34 2008 From: sbenedetto at mail.berlios.de (sbenedetto at BerliOS) Date: Sat, 21 Jun 2008 00:45:34 +0200 Subject: [Haiku-commits] r26049 - in haiku/trunk: build/config_headers headers/private/kernel Message-ID: <200806202245.m5KMjYtn016891@sheep.berlios.de> Author: sbenedetto Date: 2008-06-21 00:45:33 +0200 (Sat, 21 Jun 2008) New Revision: 26049 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26049&view=rev Modified: haiku/trunk/build/config_headers/kernel_debugger_config.h haiku/trunk/headers/private/kernel/debugger_keymaps.h Log: * Let's keep the alphabetical order Modified: haiku/trunk/build/config_headers/kernel_debugger_config.h =================================================================== --- haiku/trunk/build/config_headers/kernel_debugger_config.h 2008-06-20 22:40:15 UTC (rev 26048) +++ haiku/trunk/build/config_headers/kernel_debugger_config.h 2008-06-20 22:45:33 UTC (rev 26049) @@ -3,11 +3,11 @@ // Available keymaps: // 'dv' dvorak keymap +// 'fr' french keymap // 'it' italian keymap -// 'fr' french keymap // 'sg' swiss-german keymap // 'us' default US keymap -#define KDL_KEYMAP 'us' +#define KDL_KEYMAP 'it' #endif // KERNEL_DEBUGGER_CONFIG_H Modified: haiku/trunk/headers/private/kernel/debugger_keymaps.h =================================================================== --- haiku/trunk/headers/private/kernel/debugger_keymaps.h 2008-06-20 22:40:15 UTC (rev 26048) +++ haiku/trunk/headers/private/kernel/debugger_keymaps.h 2008-06-20 22:45:33 UTC (rev 26049) @@ -47,34 +47,34 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -#elif KDL_KEYMAP == 'it' +#elif KDL_KEYMAP == 'fr' static const char kUnshiftedKeymap[128] = { - 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '\'', '^', 8, '\t', - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 0, '+', '\n', 0, 'a', 's', - 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0, 0, '\\', 0, '<', 'z', 'x', 'c', 'v', - 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 0, '+', 8, '\t', + 'a', 'z', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 0, '$', '\n', 0, 'q', 's', + 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 0, '*', 0, '$', 'w', 'x', 'c', 'v', + 'b', 'n', ',', ';', ':', '!', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '-', 0, 0, 0, '+', 0, + 0, 0, 0, 0, 0, 0, '<', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const char kShiftedKeymap[128] = { - 0, 27, '!', '"', 0, '$', '%', '&', '/', '(', ')', '=', '?', '^', 8, '\t', - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 0, '*', '\n', 0, 'A', 'S', - 'D', 'F', 'G', 'H', 'J', 'K', 'L', 0, 0, '|', 0, '>', 'Z', 'X', 'C', 'V', - 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 27, '&', 0, '"', '\'', '(', '-', 0, '_', 0, 0, ')', '=', 8, '\t', + 'A', 'Z', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 0, 0, '\n', 0, 'Q', 'S', + 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', '%', 0, 0, 0, 'W', 'X', 'C', 'V', + 'B', 'N', '?', '.', '/', 0, 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, '>', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const char kAltedKeymap[128] = { - 0, 27, 0, 0, 0, 0, 0, 0, '|', 0, 0, 0, 0, '~', 8, '\t', - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '[', ']', 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, '{', 0, 0, '}', 0, 0, 0, 0, + 0, 27, 0, '~', '#', '{', '[', '|', '`', '\\', '^', '@', ']', '}', 8, '\t', + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '\\', 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -82,34 +82,34 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -#elif KDL_KEYMAP == 'fr' +#elif KDL_KEYMAP == 'it' static const char kUnshiftedKeymap[128] = { - 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 0, '+', 8, '\t', - 'a', 'z', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 0, '$', '\n', 0, 'q', 's', - 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 0, '*', 0, '$', 'w', 'x', 'c', 'v', - 'b', 'n', ',', ';', ':', '!', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '-', 0, 0, 0, '+', 0, - 0, 0, 0, 0, 0, 0, '<', 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '\'', '^', 8, '\t', + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 0, '+', '\n', 0, 'a', 's', + 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0, 0, '\\', 0, '<', 'z', 'x', 'c', 'v', + 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const char kShiftedKeymap[128] = { - 0, 27, '&', 0, '"', '\'', '(', '-', 0, '_', 0, 0, ')', '=', 8, '\t', - 'A', 'Z', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 0, 0, '\n', 0, 'Q', 'S', - 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', '%', 0, 0, 0, 'W', 'X', 'C', 'V', - 'B', 'N', '?', '.', '/', 0, 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 27, '!', '"', 0, '$', '%', '&', '/', '(', ')', '=', '?', '^', 8, '\t', + 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 0, '*', '\n', 0, 'A', 'S', + 'D', 'F', 'G', 'H', 'J', 'K', 'L', 0, 0, '|', 0, '>', 'Z', 'X', 'C', 'V', + 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, '>', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const char kAltedKeymap[128] = { - 0, 27, 0, '~', '#', '{', '[', '|', '`', '\\', '^', '@', ']', '}', 8, '\t', - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 27, 0, 0, 0, 0, 0, 0, '|', 0, 0, 0, 0, '~', 8, '\t', + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '[', ']', 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, '{', 0, 0, '}', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '\\', 0, 0, 0, 0, 0, 0, 0, 0, 0, From mmu_man at mail.berlios.de Sat Jun 21 00:58:18 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 21 Jun 2008 00:58:18 +0200 Subject: [Haiku-commits] r26050 - haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy Message-ID: <200806202258.m5KMwIZa003396@sheep.berlios.de> Author: mmu_man Date: 2008-06-21 00:58:15 +0200 (Sat, 21 Jun 2008) New Revision: 26050 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26050&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/Jamfile haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/device_icons.c haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/floppy.c haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/floppy.h haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/floppy_ctrl.c Log: Make the floppy driver buildable again... even under Haiku. Modified: haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/Jamfile 2008-06-20 22:45:33 UTC (rev 26049) +++ haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/Jamfile 2008-06-20 22:58:15 UTC (rev 26050) @@ -1,32 +1,12 @@ SubDir HAIKU_TOP src add-ons kernel drivers arch x86 floppy ; +SetSubDirSupportedPlatformsBeOSCompatible ; + +UsePrivateHeaders drivers kernel ; + KernelAddon floppy : floppy.c floppy_ctrl.c device_icons.c ; -# Not ready for prime-time yet: R5 floppy driver replacement at the moment. - -# KernelObjects -# floppy.c -# floppy_ctrl.c -# device_icons.c -# : -# -fno-pic -D_KERNEL_MODE -# ; -# -# KernelLd floppy : -# <$(SOURCE_GRIST)>floppy.o -# <$(SOURCE_GRIST)>floppy_ctrl.o -# <$(SOURCE_GRIST)>device_icons.o -# kernel.so -# : -# $(HAIKU_TOP)/src/kernel/ldscripts/$(TARGET_ARCH)/add-on.ld -# : -# -Bdynamic -shared -# : -# : -# drivers/dev/floppy -# ; - Modified: haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/device_icons.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/device_icons.c 2008-06-20 22:45:33 UTC (rev 26049) +++ haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/device_icons.c 2008-06-20 22:58:15 UTC (rev 26050) @@ -1,7 +1,9 @@ /* - * OpenBeOS floppy driver - * (c) 2003, OpenBeOS project. - * Fran?ois Revol, revol at free.fr + * Copyright 2003-2008, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Fran?ois Revol <revol at free.fr> */ const char floppy_icon[] = { Modified: haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/floppy.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/floppy.c 2008-06-20 22:45:33 UTC (rev 26049) +++ haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/floppy.c 2008-06-20 22:58:15 UTC (rev 26050) @@ -1,7 +1,9 @@ /* - * OpenBeOS floppy driver - * (c) 2003, OpenBeOS project. - * Fran?ois Revol, revol at free.fr + * Copyright 2003-2008, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Fran?ois Revol <revol at free.fr> */ /* Modified: haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/floppy.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/floppy.h 2008-06-20 22:45:33 UTC (rev 26049) +++ haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/floppy.h 2008-06-20 22:58:15 UTC (rev 26050) @@ -1,7 +1,9 @@ /* - * OpenBeOS floppy driver - * (c) 2003, OpenBeOS project. - * Fran?ois Revol, revol at free.fr + * Copyright 2003-2008, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Fran?ois Revol <revol at free.fr> */ #ifndef _FLOPPY_H @@ -10,7 +12,21 @@ #include <Drivers.h> #include <ISA.h> #include <KernelExport.h> + +// TODO: switch to native lock. +#ifdef __HAIKU__ +#include <lock.h> +typedef recursive_lock lock; +#define new_lock recursive_lock_init +#define free_lock recursive_lock_destroy +#define LOCK(l) recursive_lock_lock(&l); +#define UNLOCK(l) recursive_lock_unlock(&l); +#else +#ifndef _IMPEXP_KERNEL +#define _IMPEXP_KERNEL +#endif #include "lock.h" +#endif #define FLO "floppy: " #if defined(DEBUG) && DEBUG > 0 Modified: haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/floppy_ctrl.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/floppy_ctrl.c 2008-06-20 22:45:33 UTC (rev 26049) +++ haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/floppy_ctrl.c 2008-06-20 22:58:15 UTC (rev 26050) @@ -1,7 +1,9 @@ /* - * OpenBeOS floppy driver - * (c) 2003, OpenBeOS project. - * Fran?ois Revol, revol at free.fr + * Copyright 2003-2008, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Fran?ois Revol <revol at free.fr> */ From mmlr at mlotz.ch Sat Jun 21 00:58:51 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Sat, 21 Jun 2008 00:58:51 +0200 Subject: [Haiku-commits] =?windows-1252?q?r26049_-_in_haiku/trunk=3A_build?= =?windows-1252?q?/config=5Fheaders_headers/private/kernel?= In-Reply-To: <200806202245.m5KMjYtn016891@sheep.berlios.de> Message-ID: <14056073819-BeMail@primary> > Author: sbenedetto > Date: 2008-06-21 00:45:33 +0200 (Sat, 21 Jun 2008) > New Revision: 26049 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26049&view=rev > Log: > * Let's keep the alphabetical order Yes, that was how it was intended. > Modified: haiku/trunk/build/config_headers/kernel_debugger_config.h > =================================================================== > // 'us' default US keymap > -#define KDL_KEYMAP 'us' > +#define KDL_KEYMAP 'it' That probably not though? Regards Michael From mmu_man at mail.berlios.de Sat Jun 21 01:01:17 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 21 Jun 2008 01:01:17 +0200 Subject: [Haiku-commits] r26051 - haiku/trunk/src/add-ons/kernel/drivers/arch/x86 Message-ID: <200806202301.m5KN1H3k006194@sheep.berlios.de> Author: mmu_man Date: 2008-06-21 01:01:16 +0200 (Sat, 21 Jun 2008) New Revision: 26051 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26051&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/arch/x86/Jamfile Log: Prepare for move. Modified: haiku/trunk/src/add-ons/kernel/drivers/arch/x86/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/arch/x86/Jamfile 2008-06-20 22:58:15 UTC (rev 26050) +++ haiku/trunk/src/add-ons/kernel/drivers/arch/x86/Jamfile 2008-06-20 23:01:16 UTC (rev 26051) @@ -2,4 +2,3 @@ SubInclude HAIKU_TOP src add-ons kernel drivers arch x86 keyboard ; SubInclude HAIKU_TOP src add-ons kernel drivers arch x86 ps2mouse ; -SubInclude HAIKU_TOP src add-ons kernel drivers arch x86 floppy ; From mmu_man at mail.berlios.de Sat Jun 21 01:05:21 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 21 Jun 2008 01:05:21 +0200 Subject: [Haiku-commits] r26052 - in haiku/trunk/src/add-ons/kernel/drivers: arch/x86 disk disk/floppy disk/floppy/pc_floppy Message-ID: <200806202305.m5KN5LPW010328@sheep.berlios.de> Author: mmu_man Date: 2008-06-21 01:05:19 +0200 (Sat, 21 Jun 2008) New Revision: 26052 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26052&view=rev Added: haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/ haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/ haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/Jamfile haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/device_icons.c haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/floppy.c haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/floppy.h haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/floppy_ctrl.c Removed: haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/ haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/Jamfile haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/device_icons.c haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/floppy.c haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/floppy.h haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/floppy_ctrl.c Log: Move the floppy driver to disk/floppy/pc_floppy, it will be named pc_floppy, as it handles PC-style controllers, but not only PCs have those, so it doesn't belong to arch anymore. Copied: haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy (from rev 26046, haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy) Deleted: haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/Jamfile Copied: haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/Jamfile (from rev 26050, haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/Jamfile) Deleted: haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/device_icons.c Copied: haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/device_icons.c (from rev 26050, haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/device_icons.c) Deleted: haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/floppy.c Copied: haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/floppy.c (from rev 26050, haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/floppy.c) Deleted: haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/floppy.h Copied: haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/floppy.h (from rev 26050, haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/floppy.h) Deleted: haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/floppy_ctrl.c Copied: haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/floppy_ctrl.c (from rev 26050, haiku/trunk/src/add-ons/kernel/drivers/arch/x86/floppy/floppy_ctrl.c) From emitrax at gmail.com Sat Jun 21 01:11:49 2008 From: emitrax at gmail.com (Salvatore Benedetto) Date: Fri, 20 Jun 2008 23:11:49 +0000 Subject: [Haiku-commits] r26049 - in haiku/trunk: build/config_headers headers/private/kernel In-Reply-To: <14056073819-BeMail@primary> References: <200806202245.m5KMjYtn016891@sheep.berlios.de> <14056073819-BeMail@primary> Message-ID: <b6b105e70806201611q2887b15cjc313d9292a4f1f52@mail.gmail.com> 2008/6/20 Michael Lotz <mmlr at mlotz.ch>: >> Author: sbenedetto >> Date: 2008-06-21 00:45:33 +0200 (Sat, 21 Jun 2008) >> New Revision: 26049 >> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26049&view=rev >> Log: >> * Let's keep the alphabetical order > > Yes, that was how it was intended. > >> Modified: haiku/trunk/build/config_headers/kernel_debugger_config.h >> =================================================================== >> // 'us' default US keymap >> -#define KDL_KEYMAP 'us' >> +#define KDL_KEYMAP 'it' Damn! I remembered it the first time, but not the second one! :) > > That probably not though? > > Regards > Michael > _______________________________________________ > Haiku-commits mailing list > Haiku-commits at lists.berlios.de > https://lists.berlios.de/mailman/listinfo/haiku-commits > -- Salvatore Benedetto (a.k.a. emitrax) Student of Computer Engineer University of Pisa www.haiku-os.it From mmu_man at mail.berlios.de Sat Jun 21 01:14:25 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 21 Jun 2008 01:14:25 +0200 Subject: [Haiku-commits] r26053 - in haiku/trunk/src/add-ons/kernel/drivers/disk: . floppy floppy/pc_floppy Message-ID: <200806202314.m5KNEPsM020733@sheep.berlios.de> Author: mmu_man Date: 2008-06-21 01:14:18 +0200 (Sat, 21 Jun 2008) New Revision: 26053 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26053&view=rev Added: haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/Jamfile Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/Jamfile haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/Jamfile Log: Rename floppy target to pc_floppy, add to the build. Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/disk/Jamfile 2008-06-20 23:05:19 UTC (rev 26052) +++ haiku/trunk/src/add-ons/kernel/drivers/disk/Jamfile 2008-06-20 23:14:18 UTC (rev 26053) @@ -1,6 +1,7 @@ SubDir HAIKU_TOP src add-ons kernel drivers disk ; SubInclude HAIKU_TOP src add-ons kernel drivers disk acpi_loader ; +SubInclude HAIKU_TOP src add-ons kernel drivers disk floppy ; SubInclude HAIKU_TOP src add-ons kernel drivers disk scsi ; SubInclude HAIKU_TOP src add-ons kernel drivers disk usb ; SubInclude HAIKU_TOP src add-ons kernel drivers disk virtual ; Added: haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/Jamfile 2008-06-20 23:05:19 UTC (rev 26052) +++ haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/Jamfile 2008-06-20 23:14:18 UTC (rev 26053) @@ -0,0 +1,3 @@ +SubDir HAIKU_TOP src add-ons kernel drivers disk floppy ; + +SubInclude HAIKU_TOP src add-ons kernel drivers disk floppy pc_floppy ; Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/Jamfile 2008-06-20 23:05:19 UTC (rev 26052) +++ haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/Jamfile 2008-06-20 23:14:18 UTC (rev 26053) @@ -1,10 +1,10 @@ -SubDir HAIKU_TOP src add-ons kernel drivers arch x86 floppy ; +SubDir HAIKU_TOP src add-ons kernel drivers disk floppy pc_floppy ; SetSubDirSupportedPlatformsBeOSCompatible ; UsePrivateHeaders drivers kernel ; -KernelAddon floppy : +KernelAddon pc_floppy : floppy.c floppy_ctrl.c device_icons.c From sbenedetto at mail.berlios.de Sat Jun 21 01:29:56 2008 From: sbenedetto at mail.berlios.de (sbenedetto at BerliOS) Date: Sat, 21 Jun 2008 01:29:56 +0200 Subject: [Haiku-commits] r26054 - haiku/trunk/build/config_headers Message-ID: <200806202329.m5KNTuNQ020940@sheep.berlios.de> Author: sbenedetto Date: 2008-06-21 01:29:56 +0200 (Sat, 21 Jun 2008) New Revision: 26054 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26054&view=rev Modified: haiku/trunk/build/config_headers/kernel_debugger_config.h Log: * Forgot to put us keymap as the default one Modified: haiku/trunk/build/config_headers/kernel_debugger_config.h =================================================================== --- haiku/trunk/build/config_headers/kernel_debugger_config.h 2008-06-20 23:14:18 UTC (rev 26053) +++ haiku/trunk/build/config_headers/kernel_debugger_config.h 2008-06-20 23:29:56 UTC (rev 26054) @@ -7,7 +7,7 @@ // 'it' italian keymap // 'sg' swiss-german keymap // 'us' default US keymap -#define KDL_KEYMAP 'it' +#define KDL_KEYMAP 'us' #endif // KERNEL_DEBUGGER_CONFIG_H From alex at zappotek.com Sat Jun 21 02:12:53 2008 From: alex at zappotek.com (Alexandre Deckner) Date: Sat, 21 Jun 2008 02:12:53 +0200 Subject: [Haiku-commits] r26043 - in haiku/trunk/src/kits: interface tracker In-Reply-To: <485B8DCC.7010400@zappotek.com> References: <200806200239.m5K2dbaJ005395@sheep.berlios.de> <f019d2f30806191959s192a0cc3gf7a4d0b203a36e7c@mail.gmail.com> <485B8DCC.7010400@zappotek.com> Message-ID: <485C4785.1060307@zappotek.com> Alexandre Deckner wrote: > Rene Gollent wrote: > >> On Thu, Jun 19, 2008 at 9:39 PM, aldeck at BerliOS >> <aldeck at mail.berlios.de> wrote: >> >> >>> Author: aldeck >>> Date: 2008-06-20 04:39:33 +0200 (Fri, 20 Jun 2008) >>> New Revision: 26043 >>> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26043&view=rev >>> >>> Modified: >>> haiku/trunk/src/kits/interface/View.cpp >>> haiku/trunk/src/kits/tracker/ContainerWindow.cpp >>> Log: >>> - Since r21336, BView::ScrollBy was checking the values against the ScrollBar ranges but ScrollBy is often called before >>> updating the scroll range >>> >>> >> I'm not sure this is the right way to go...you'll notice it only does >> the range check *if* a scrollbar is attached, which is correct, you >> shouldn't be able to scroll it outside of the range of the bar. If >> you're trying to do this because you're about to update the range of >> the bar, then you're imo doing the operations in the wrong order. >> >> >> > Well, the scrollrange is only there to limit the (visual) bars to > whatever content on the view you'd like. In my understanding, calling > ScrollBy directly takes priority over the scrollbars, at least that was > the R5 behaviour. I think it is your responsability to adjust the range, > and it shouldn't block a programatic scroll, the thumb movement is > limited anyway. > I can try to fix the "order" in tracker code, but it seems to be working > like this for some time already. > > > Sorry, the discussion went accidentally private.. missing parts follows: ---------------------------------------------------------------------------------------- > Stephan Assmus wrote: >> >> In BeOS, there is indeed no check for the limit of the scroll bars in >> BView. But the limit is enforced anyways by the "feedback" of the >> scrollbar. It used to work like this in Haiku, until Stefano >> introduced the check in BView. The result was that no visual >> jittering was visible anymore like in BeOS, where a view could flick >> forth and back between the programmatic scroll position and the >> scrollbar limits. With the new changes, the feedback from the >> scrollbars seems not to be enforced either, this is not the BeOS >> behavior. I think how the code worked before your change was more >> logical. I don't see the reason why programmatic scrolling should >> ignore the scrollbar limits, and this is definitely not the *end >> result* in BeOS either. Like I said, while BView ignores it at first, >> it still notifies the scrollbars and those scroll the view back to be >> in their range (visual jerking in BeOS). >> >> You can test this behavior with Playground. When you drag the object >> view with the middle mouse button, programmatic scrolling happens and >> you can compare the behavior. >> > Hmm, i see then. I'm gonna put back this check and fix the Tracker > side of things, no problemo :-) > Seeing that #2312 appeared with r21336, i was pretty sure that BView > was faulty! > > We should not forget to note that in the docs though, like "ScrollBy > won't scroll if the values are out of the range set by SetRange". >> A change which I did to BView::ScrollBy() got left out when it was >> moved to BView::ScrollTo(), which was that I prevented the scrollbar >> notification when no scrolling happened in that direction. I observed >> an undesired feedback loop when an application was setting up the >> scrollbars and scrolled the view first in one direction and then in >> the other. I think that my fix may have hidden another bug, I cannot >> put my finger on it. My change fixed for example horizontal scrolling >> in Pe, and also restoring of the previous scroll position when a file >> was opened. In current Haiku SVN, Pe scrolling is broken again. >> > I'll have a look eventually, but i'm not sure i follow you completely > :) Was is my last change or the fact that your fix got left out that > broke scrolling in Pe? > Stephan wrote: No, that was before, I think when Rene moved the implementation from ScrollBy() to ScrollTo(). I am not sure, that what I did there was even correct. ----------------------------------------------------------------------------------------- From alex at zappotek.com Sat Jun 21 02:15:15 2008 From: alex at zappotek.com (Alexandre Deckner) Date: Sat, 21 Jun 2008 02:15:15 +0200 Subject: [Haiku-commits] r26043 - in haiku/trunk/src/kits: interface tracker In-Reply-To: <485C4785.1060307@zappotek.com> References: <200806200239.m5K2dbaJ005395@sheep.berlios.de> <f019d2f30806191959s192a0cc3gf7a4d0b203a36e7c@mail.gmail.com> <485B8DCC.7010400@zappotek.com> <485C4785.1060307@zappotek.com> Message-ID: <485C4813.4030400@zappotek.com> In Tracker, BPoseView::Disable/EnableScrollBars() are used before and after calls to ScrollTo/By(). What DisableScrollbars does is setting the scrollbars target to NULL. I'm not sure what is the expected behaviour with a NULL target WRT our problem. So what about that? : Index: src/kits/interface/View.cpp =================================================================== --- src/kits/interface/View.cpp (revision 26047) +++ src/kits/interface/View.cpp (working copy) @@ -1508,7 +1508,7 @@ return; // make sure scrolling is within valid bounds - if (fHorScroller) { + if (fHorScroller && fHorScroller->Target() != NULL) { float min, max; fHorScroller->GetRange(&min, &max); @@ -1517,7 +1517,7 @@ else if (where.x > max) where.x = max; } - if (fVerScroller) { + if (fVerScroller && fVerScroller->Target() != NULL) { float min, max; fVerScroller->GetRange(&min, &max); It fixes my problem at least :) Regards, Alex From mmu_man at mail.berlios.de Sat Jun 21 02:35:08 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 21 Jun 2008 02:35:08 +0200 Subject: [Haiku-commits] r26055 - haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy Message-ID: <200806210035.m5L0Z8HG026767@sheep.berlios.de> Author: mmu_man Date: 2008-06-21 02:35:07 +0200 (Sat, 21 Jun 2008) New Revision: 26055 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26055&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/floppy.c Log: Better handle incorrect io ranges, it should only be fixed for PC (around 0x3f0). Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/floppy.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/floppy.c 2008-06-20 23:29:56 UTC (rev 26054) +++ haiku/trunk/src/add-ons/kernel/drivers/disk/floppy/pc_floppy/floppy.c 2008-06-21 00:35:07 UTC (rev 26055) @@ -141,6 +141,8 @@ struct floppy *last = NULL; int flops; if ((info.config_status != B_OK) || + ((info.flags & B_DEVICE_INFO_ENABLED) == 0) || + ((info.flags & B_DEVICE_INFO_CONFIGURED) == 0) || (info.devtype.base != PCI_mass_storage) || (info.devtype.subtype != PCI_floppy) || (info.devtype.interface != 0) /* XXX: needed ?? */) @@ -157,8 +159,9 @@ } master = &(floppies[current]); for (i = 0; i < conf->num_resources; i++) { - if (conf->resources[i].type == B_IO_PORT_RESOURCE) - master->iobase = conf->resources[i].d.r.minbase & 0x0FFF8; + if (conf->resources[i].type == B_IO_PORT_RESOURCE) { + int32 iobase = conf->resources[i].d.r.minbase; + int32 len = conf->resources[i].d.r.len; /* WTF do I get * min 3f2 max 3f2 align 0 len 4 ? * on my K6-2, I even get 2 bytes at 3f2 + 2 bytes at 3f4 ! @@ -166,6 +169,19 @@ * answer: because the 8th byte is also for the IDE controller... * good old PC stuff... PPC here I come ! */ + // XXX: maybe we shouldn't use DIGITAL_IN if register window + // is only 6 bytes ? + if (len != 8) { + if ((master->iobase & 0xfffffff8) == 0x3f0) + iobase = 0x3f0; + else { + dprintf(FLO "controller has weird register window len %ld !?\n", + len); + break; + } + } + master->iobase = iobase; + } if (conf->resources[i].type == B_IRQ_RESOURCE) { int val; for (val = 0; val < 32; val++) { From mmu_man at mail.berlios.de Sat Jun 21 02:53:52 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 21 Jun 2008 02:53:52 +0200 Subject: [Haiku-commits] r26056 - haiku/trunk/build/jam Message-ID: <200806210053.m5L0rqJj028378@sheep.berlios.de> Author: mmu_man Date: 2008-06-21 02:53:51 +0200 (Sat, 21 Jun 2008) New Revision: 26056 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26056&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: Add pc_floppy to the image. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-06-21 00:35:07 UTC (rev 26055) +++ haiku/trunk/build/jam/HaikuImage 2008-06-21 00:53:51 UTC (rev 26056) @@ -172,6 +172,7 @@ AddDriversToHaikuImage audio hmulti : $(BEOS_ADD_ONS_DRIVERS_AUDIO) ; AddDriversToHaikuImage midi : $(BEOS_ADD_ONS_DRIVERS_MIDI) ; AddDriversToHaikuImage bus : usb_raw ; # fw_raw +AddDriversToHaikuImage disk floppy : $(X86_ONLY)pc_floppy ; AddDriversToHaikuImage disk scsi : scsi_cd scsi_disk ; AddDriversToHaikuImage disk usb : usb_disk ; AddDriversToHaikuImage disk virtual : nbd ; From anevilyak at gmail.com Sat Jun 21 04:36:00 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Fri, 20 Jun 2008 21:36:00 -0500 Subject: [Haiku-commits] r26043 - in haiku/trunk/src/kits: interface tracker In-Reply-To: <485C4813.4030400@zappotek.com> References: <200806200239.m5K2dbaJ005395@sheep.berlios.de> <f019d2f30806191959s192a0cc3gf7a4d0b203a36e7c@mail.gmail.com> <485B8DCC.7010400@zappotek.com> <485C4785.1060307@zappotek.com> <485C4813.4030400@zappotek.com> Message-ID: <f019d2f30806201936s1891a5a9qcd068cd7b113bdc5@mail.gmail.com> On Fri, Jun 20, 2008 at 7:15 PM, Alexandre Deckner <alex at zappotek.com> wrote: > In Tracker, BPoseView::Disable/EnableScrollBars() are used before and > after calls to ScrollTo/By(). > What DisableScrollbars does is setting the scrollbars target to NULL. > I'm not sure what is the expected behaviour with a NULL target WRT our > problem. > So what about that? : I'm not certain if that's the right way to go about it....Stephan, thoughts? Regards, Rene From superstippi at gmx.de Sat Jun 21 10:02:28 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 21 Jun 2008 10:02:28 +0200 Subject: [Haiku-commits] r26043 - in haiku/trunk/src/kits: interface tracker In-Reply-To: <485C4813.4030400@zappotek.com> References: <200806200239.m5K2dbaJ005395@sheep.berlios.de> <f019d2f30806191959s192a0cc3gf7a4d0b203a36e7c@mail.gmail.com> <485B8DCC.7010400@zappotek.com> <485C4785.1060307@zappotek.com> <485C4813.4030400@zappotek.com> Message-ID: <20080621100228.778.1@stippis2.1214034914.fake> Alexandre Deckner wrote: > In Tracker, BPoseView::Disable/EnableScrollBars() are used before and > after calls to ScrollTo/By(). > What DisableScrollbars does is setting the scrollbars target to NULL. I'm > not sure what is the expected behaviour with a NULL target WRT our > problem. > So what about that? : > > Index: src/kits/interface/View.cpp > =================================================================== > --- src/kits/interface/View.cpp (revision 26047) > +++ src/kits/interface/View.cpp (working copy) > @@ -1508,7 +1508,7 @@ > return; > > // make sure scrolling is within valid bounds > - if (fHorScroller) { > + if (fHorScroller && fHorScroller->Target() != NULL) { > float min, max; > fHorScroller->GetRange(&min, &max); > > @@ -1517,7 +1517,7 @@ > else if (where.x > max) > where.x = max; > } > - if (fVerScroller) { > + if (fVerScroller && fVerScroller->Target() != NULL) { > float min, max; > fVerScroller->GetRange(&min, &max); > > > It fixes my problem at least :) That it really weird. ScrollBar::SetTarget() is supposed to modify the BView scroller members. So fXXScrollbar != NULL && fXXScrollBar->Target() == this *shouldn't* be possible. That's a bug in BScrollBar::SetTarget() then. Best regards, -Stephan From superstippi at gmx.de Sat Jun 21 10:22:53 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 21 Jun 2008 10:22:53 +0200 Subject: [Haiku-commits] r26043 - in haiku/trunk/src/kits: interface tracker In-Reply-To: <20080621100228.778.1@stippis2.1214034914.fake> References: <200806200239.m5K2dbaJ005395@sheep.berlios.de> <f019d2f30806191959s192a0cc3gf7a4d0b203a36e7c@mail.gmail.com> <485B8DCC.7010400@zappotek.com> <485C4785.1060307@zappotek.com> <485C4813.4030400@zappotek.com> <20080621100228.778.1@stippis2.1214034914.fake> Message-ID: <20080621102253.1200.4@stippis2.1214034914.fake> Stephan Assmus wrote: > > Alexandre Deckner wrote: > > In Tracker, BPoseView::Disable/EnableScrollBars() are used before and > > after calls to ScrollTo/By(). > > What DisableScrollbars does is setting the scrollbars target to NULL. > > I'm not sure what is the expected behaviour with a NULL target WRT our > > problem. > > So what about that? : > > > > Index: src/kits/interface/View.cpp > > =================================================================== > > --- src/kits/interface/View.cpp (revision 26047) > > +++ src/kits/interface/View.cpp (working copy) > > @@ -1508,7 +1508,7 @@ > > return; > > > > // make sure scrolling is within valid bounds > > - if (fHorScroller) { > > + if (fHorScroller && fHorScroller->Target() != NULL) { > > float min, max; > > fHorScroller->GetRange(&min, &max); > > > > @@ -1517,7 +1517,7 @@ > > else if (where.x > max) > > where.x = max; > > } > > - if (fVerScroller) { > > + if (fVerScroller && fVerScroller->Target() != NULL) { > > float min, max; > > fVerScroller->GetRange(&min, &max); > > > > > > It fixes my problem at least :) > > That it really weird. ScrollBar::SetTarget() is supposed to modify the > BView scroller members. So fXXScrollbar != NULL && fXXScrollBar->Target() > == this *shouldn't* be possible. That's a bug in BScrollBar::SetTarget() > then. Oh yeah, BScrollBar::SetTarget() is very buggy for the NULL case (both versions). Do you want to fix it or shall I? The BeOS const char* version should be checked for behavior with regard to NULL argument. Best regards, -Stephan From stippi at mail.berlios.de Sat Jun 21 10:39:18 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 21 Jun 2008 10:39:18 +0200 Subject: [Haiku-commits] r26057 - haiku/trunk/src/kits/interface Message-ID: <200806210839.m5L8dIvs023384@sheep.berlios.de> Author: stippi Date: 2008-06-21 10:39:14 +0200 (Sat, 21 Jun 2008) New Revision: 26057 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26057&view=rev Modified: haiku/trunk/src/kits/interface/ScrollBar.cpp Log: * SetTarget((BView*)NULL) needs to unset the previous target's pointer to the scrollbar. * Added notes about BeOS behavior to SetTarget(const char*). * Reuse SetTarget(NULL) in the destructor. * Initialize fTarget and fTargetName in the archive constructor. * Added TODO about possibly restoring the target in the archive constructor. Modified: haiku/trunk/src/kits/interface/ScrollBar.cpp =================================================================== --- haiku/trunk/src/kits/interface/ScrollBar.cpp 2008-06-21 00:53:51 UTC (rev 26056) +++ haiku/trunk/src/kits/interface/ScrollBar.cpp 2008-06-21 08:39:14 UTC (rev 26057) @@ -205,9 +205,13 @@ } -BScrollBar::BScrollBar(BMessage *data) - : BView(data) +BScrollBar::BScrollBar(BMessage* data) + : BView(data), + fTarget(NULL), + fTargetName(NULL) { + // TODO: Does the BeOS implementation try to find the target + // by name again? Does it archive the name at all? if (data->FindFloat("_range", 0, &fMin) < B_OK) fMin = 0.0; if (data->FindFloat("_range", 1, &fMax) < B_OK) @@ -231,14 +235,8 @@ BScrollBar::~BScrollBar() { - if (fTarget) { - if (fOrientation == B_VERTICAL) - fTarget->fVerScroller = NULL; - else - fTarget->fHorScroller = NULL; - } + SetTarget((BView*)NULL); delete fPrivateData; - free(fTargetName); } @@ -488,8 +486,16 @@ void -BScrollBar::SetTarget(BView *target) +BScrollBar::SetTarget(BView* target) { + if (fTarget) { + // unset the previous target's scrollbar pointer + if (fOrientation == B_VERTICAL) + fTarget->fVerScroller = NULL; + else + fTarget->fHorScroller = NULL; + } + fTarget = target; free(fTargetName); @@ -508,6 +514,9 @@ void BScrollBar::SetTarget(const char* targetName) { + // NOTE 1: BeOS implementation crashes for targetName == NULL + // NOTE 2: BeOS implementation also does not modify the target + // if it can't be found if (!targetName) return; From alex at zappotek.com Sat Jun 21 13:22:02 2008 From: alex at zappotek.com (Alexandre Deckner) Date: Sat, 21 Jun 2008 13:22:02 +0200 Subject: [Haiku-commits] r26043 - in haiku/trunk/src/kits: interface tracker In-Reply-To: <20080621102253.1200.4@stippis2.1214034914.fake> References: <200806200239.m5K2dbaJ005395@sheep.berlios.de> <f019d2f30806191959s192a0cc3gf7a4d0b203a36e7c@mail.gmail.com> <485B8DCC.7010400@zappotek.com> <485C4785.1060307@zappotek.com> <485C4813.4030400@zappotek.com> <20080621100228.778.1@stippis2.1214034914.fake> <20080621102253.1200.4@stippis2.1214034914.fake> Message-ID: <485CE45A.1030203@zappotek.com> Stephan Assmus wrote: > Stephan Assmus wrote: > >> Alexandre Deckner wrote: >> >>> In Tracker, BPoseView::Disable/EnableScrollBars() are used before and >>> after calls to ScrollTo/By(). >>> What DisableScrollbars does is setting the scrollbars target to NULL. >>> I'm not sure what is the expected behaviour with a NULL target WRT our >>> problem. >>> So what about that? : >>> >>> Index: src/kits/interface/View.cpp >>> =================================================================== >>> --- src/kits/interface/View.cpp (revision 26047) >>> +++ src/kits/interface/View.cpp (working copy) >>> @@ -1508,7 +1508,7 @@ >>> return; >>> >>> // make sure scrolling is within valid bounds >>> - if (fHorScroller) { >>> + if (fHorScroller && fHorScroller->Target() != NULL) { >>> float min, max; >>> fHorScroller->GetRange(&min, &max); >>> >>> @@ -1517,7 +1517,7 @@ >>> else if (where.x > max) >>> where.x = max; >>> } >>> - if (fVerScroller) { >>> + if (fVerScroller && fVerScroller->Target() != NULL) { >>> float min, max; >>> fVerScroller->GetRange(&min, &max); >>> >>> >>> It fixes my problem at least :) >>> >> That it really weird. ScrollBar::SetTarget() is supposed to modify the >> BView scroller members. So fXXScrollbar != NULL && fXXScrollBar->Target() >> == this *shouldn't* be possible. That's a bug in BScrollBar::SetTarget() >> then. >> Sure it was just a suggestion to explain the problem. I was thinking about the case of a scrollbar that doesn't have a target. PoseView apparently expect some behaviour when scrollbar->Target()==NULL. It uses that to "disable?" the scrollbar before scrolling programatically. What do you think? Changing how tracker does this might be more difficult than i thought, it would be nice to be compatible with R5 here. > Oh yeah, BScrollBar::SetTarget() is very buggy for the NULL case (both > versions). Do you want to fix it or shall I? The BeOS const char* version > should be checked for behavior with regard to NULL argument. > > Cool that you fixed that :) Regardds, Alex From mmu_man at mail.berlios.de Sat Jun 21 14:12:17 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 21 Jun 2008 14:12:17 +0200 Subject: [Haiku-commits] r26058 - in haiku/trunk/src/add-ons/input_server/methods: . pen Message-ID: <200806211212.m5LCCHHL031966@sheep.berlios.de> Author: mmu_man Date: 2008-06-21 14:12:17 +0200 (Sat, 21 Jun 2008) New Revision: 26058 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26058&view=rev Added: haiku/trunk/src/add-ons/input_server/methods/pen/Jamfile Modified: haiku/trunk/src/add-ons/input_server/methods/Jamfile Log: Add to the build. Modified: haiku/trunk/src/add-ons/input_server/methods/Jamfile =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/Jamfile 2008-06-21 08:39:14 UTC (rev 26057) +++ haiku/trunk/src/add-ons/input_server/methods/Jamfile 2008-06-21 12:12:17 UTC (rev 26058) @@ -1,4 +1,5 @@ SubDir HAIKU_TOP src add-ons input_server methods ; SubInclude HAIKU_TOP src add-ons input_server methods canna ; +SubInclude HAIKU_TOP src add-ons input_server methods pen ; SubInclude HAIKU_TOP src add-ons input_server methods t9 ; Added: haiku/trunk/src/add-ons/input_server/methods/pen/Jamfile =================================================================== --- haiku/trunk/src/add-ons/input_server/methods/pen/Jamfile 2008-06-21 08:39:14 UTC (rev 26057) +++ haiku/trunk/src/add-ons/input_server/methods/pen/Jamfile 2008-06-21 12:12:17 UTC (rev 26058) @@ -0,0 +1,23 @@ +SubDir HAIKU_TOP src add-ons input_server methods pen ; + +SetSubDirSupportedPlatformsBeOSCompatible ; + +UsePrivateHeaders interface ; + +#SubDirSysHdrs $(SUBDIR) ; +#SubDirHdrs [ FDirName $(SUBDIR) pen ] ; + +if $(TARGET_PLATFORM) != haiku { + SubDirC++Flags -fmultiple-symbol-spaces ; +} + +Addon pen : + PenInputServerMethod.cpp + PenInputLooper.cpp + PenInputInkWindow.cpp + PenInputBackend.cpp + DumpMessage.cpp + StringIO.cpp + : be