| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file contains the command parser class. | 5 // This file contains the command parser class. |
| 6 | 6 |
| 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CMD_PARSER_H_ | 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CMD_PARSER_H_ |
| 8 #define GPU_COMMAND_BUFFER_SERVICE_CMD_PARSER_H_ | 8 #define GPU_COMMAND_BUFFER_SERVICE_CMD_PARSER_H_ |
| 9 | 9 |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // Processes one command, updating the get pointer. This will return an error | 61 // Processes one command, updating the get pointer. This will return an error |
| 62 // if there are no commands in the buffer. | 62 // if there are no commands in the buffer. |
| 63 error::Error ProcessCommands(int num_commands); | 63 error::Error ProcessCommands(int num_commands); |
| 64 | 64 |
| 65 // Processes all commands until get == put. | 65 // Processes all commands until get == put. |
| 66 error::Error ProcessAllCommands(); | 66 error::Error ProcessAllCommands(); |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 CommandBufferOffset get_; | 69 CommandBufferOffset get_; |
| 70 CommandBufferOffset put_; | 70 CommandBufferOffset put_; |
| 71 CommandBufferEntry* buffer_; | 71 volatile CommandBufferEntry* buffer_; |
| 72 int32_t entry_count_; | 72 int32_t entry_count_; |
| 73 AsyncAPIInterface* handler_; | 73 AsyncAPIInterface* handler_; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 // This class defines the interface for an asynchronous API handler, that | 76 // This class defines the interface for an asynchronous API handler, that |
| 77 // is responsible for de-multiplexing commands and their arguments. | 77 // is responsible for de-multiplexing commands and their arguments. |
| 78 class GPU_EXPORT AsyncAPIInterface { | 78 class GPU_EXPORT AsyncAPIInterface { |
| 79 public: | 79 public: |
| 80 AsyncAPIInterface() {} | 80 AsyncAPIInterface() {} |
| 81 virtual ~AsyncAPIInterface() {} | 81 virtual ~AsyncAPIInterface() {} |
| 82 | 82 |
| 83 // Executes a single command. | 83 // Executes a single command. |
| 84 // Parameters: | 84 // Parameters: |
| 85 // command: the command index. | 85 // command: the command index. |
| 86 // arg_count: the number of CommandBufferEntry arguments. | 86 // arg_count: the number of CommandBufferEntry arguments. |
| 87 // cmd_data: the command data. | 87 // cmd_data: the command data. |
| 88 // Returns: | 88 // Returns: |
| 89 // error::kNoError if no error was found, one of | 89 // error::kNoError if no error was found, one of |
| 90 // error::Error otherwise. | 90 // error::Error otherwise. |
| 91 virtual error::Error DoCommand( | 91 virtual error::Error DoCommand(unsigned int command, |
| 92 unsigned int command, | 92 unsigned int arg_count, |
| 93 unsigned int arg_count, | 93 const volatile void* cmd_data) = 0; |
| 94 const void* cmd_data) = 0; | |
| 95 | 94 |
| 96 // Executes multiple commands. | 95 // Executes multiple commands. |
| 97 // Parameters: | 96 // Parameters: |
| 98 // num_commands: maximum number of commands to execute from buffer. | 97 // num_commands: maximum number of commands to execute from buffer. |
| 99 // buffer: pointer to first command entry to process. | 98 // buffer: pointer to first command entry to process. |
| 100 // num_entries: number of sequential command buffer entries in buffer. | 99 // num_entries: number of sequential command buffer entries in buffer. |
| 101 // entries_processed: if not 0, is set to the number of entries processed. | 100 // entries_processed: if not 0, is set to the number of entries processed. |
| 102 virtual error::Error DoCommands(unsigned int num_commands, | 101 virtual error::Error DoCommands(unsigned int num_commands, |
| 103 const void* buffer, | 102 const volatile void* buffer, |
| 104 int num_entries, | 103 int num_entries, |
| 105 int* entries_processed); | 104 int* entries_processed); |
| 106 | 105 |
| 107 // Returns a name for a command. Useful for logging / debuging. | 106 // Returns a name for a command. Useful for logging / debuging. |
| 108 virtual const char* GetCommandName(unsigned int command_id) const = 0; | 107 virtual const char* GetCommandName(unsigned int command_id) const = 0; |
| 109 }; | 108 }; |
| 110 | 109 |
| 111 } // namespace gpu | 110 } // namespace gpu |
| 112 | 111 |
| 113 #endif // GPU_COMMAND_BUFFER_SERVICE_CMD_PARSER_H_ | 112 #endif // GPU_COMMAND_BUFFER_SERVICE_CMD_PARSER_H_ |
| OLD | NEW |