xref: /aosp_15_r20/external/intel-media-driver/media_driver/linux/common/cm/hal/cm_debug_os.cpp (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2017, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 //!
23 //! \file      cm_debug.h
24 //! \brief     Contains CM debug definitions
25 //!
26 
27 #include  <sstream>
28 #include "cm_debug.h"
29 
30 static int32_t commandBufferCounter = 0;
31 static int32_t surfaceStateCounter = 0;
32 static int32_t IDDCounter = 0;
33 
GetLogFileLocation(const char * filename,char fileNamePrefix[],MOS_CONTEXT * mosContext)34 uint32_t GetLogFileLocation(const char *filename,
35                             char fileNamePrefix[],
36                             MOS_CONTEXT *mosContext)
37 {
38     //Get driver persistent location
39     MOS_SecureStrcpy(fileNamePrefix, 260, filename);
40     return 0;
41 }
42 
GetCommandBufferDumpCounter(uint32_t valueID,MOS_CONTEXT * mosContext)43 int32_t GetCommandBufferDumpCounter(uint32_t valueID,
44                                     MOS_CONTEXT *mosContext)
45 {
46     return commandBufferCounter;
47 }
48 
RecordCommandBufferDumpCounter(int32_t count,uint32_t ValueID,MOS_CONTEXT * mosContext)49 int32_t RecordCommandBufferDumpCounter(int32_t count,
50                                        uint32_t ValueID,
51                                        MOS_CONTEXT *mosContext)
52 {
53     commandBufferCounter = count;
54     return 0;
55 }
56 
GetSurfaceStateDumpCounter(uint32_t valueID,MOS_CONTEXT * mosContext)57 int32_t GetSurfaceStateDumpCounter(uint32_t valueID, MOS_CONTEXT *mosContext)
58 {
59     return surfaceStateCounter;
60 }
61 
RecordSurfaceStateDumpCounter(int32_t count,uint32_t ValueID,MOS_CONTEXT * mosContext)62 int32_t RecordSurfaceStateDumpCounter(int32_t count,
63                                       uint32_t ValueID,
64                                       MOS_CONTEXT *mosContext)
65 {
66     surfaceStateCounter = count;
67     return 0;
68 }
69 
GetInterfaceDescriptorDataDumpCounter(uint32_t valueID,MOS_CONTEXT * mosContext)70 int32_t GetInterfaceDescriptorDataDumpCounter(uint32_t valueID,
71                                               MOS_CONTEXT *mosContext)
72 {
73     return IDDCounter;
74 }
75 
RecordInterfaceDescriptorDataDumpCounter(int32_t count,uint32_t ValueID,MOS_CONTEXT * mosContext)76 int32_t RecordInterfaceDescriptorDataDumpCounter(int32_t count,
77                                                  uint32_t ValueID,
78                                                  MOS_CONTEXT *mosContext)
79 {
80     IDDCounter = count;
81     return 0;
82 }
GetCommandBufferHeaderDWords(PMOS_INTERFACE osInterface)83 uint32_t GetCommandBufferHeaderDWords(PMOS_INTERFACE osInterface)
84 {
85     return 0;
86 }
87