1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef GPU_IPC_COMMON_COMMAND_BUFFER_ID_H_ 6 #define GPU_IPC_COMMON_COMMAND_BUFFER_ID_H_ 7 8 #include "gpu/command_buffer/common/command_buffer_id.h" 9 10 namespace gpu { 11 12 enum class GpuChannelReservedRoutes : int32_t { 13 kSharedImageInterface = 0, 14 kImageDecodeAccelerator = 1, 15 kMaxValue = kImageDecodeAccelerator, 16 }; 17 CommandBufferIdFromChannelAndRoute(int channel_id,int32_t route_id)18inline CommandBufferId CommandBufferIdFromChannelAndRoute(int channel_id, 19 int32_t route_id) { 20 return CommandBufferId::FromUnsafeValue( 21 (static_cast<uint64_t>(channel_id) << 32) | route_id); 22 } 23 ChannelIdFromCommandBufferId(gpu::CommandBufferId command_buffer_id)24inline int ChannelIdFromCommandBufferId( 25 gpu::CommandBufferId command_buffer_id) { 26 return static_cast<int>(command_buffer_id.GetUnsafeValue() >> 32); 27 } 28 RouteIdFromCommandBufferId(gpu::CommandBufferId command_buffer_id)29inline int32_t RouteIdFromCommandBufferId( 30 gpu::CommandBufferId command_buffer_id) { 31 return 0xffffffff & command_buffer_id.GetUnsafeValue(); 32 } 33 34 } // namespace gpu 35 36 #endif // GPU_IPC_COMMON_COMMAND_BUFFER_ID_H_ 37