blob: 1bef7638389c0671eb79264f54aaec6cb0f26067 [file] [log] [blame]
Siva Velusamy0469dd62011-11-30 15:05:37 -08001/*
2 * Copyright 2011, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <cutils/log.h>
18
19#include "gltrace.pb.h"
20#include "gltrace_context.h"
21#include "gltrace_fixup.h"
22#include "gltrace_transport.h"
23
24namespace android {
25namespace gltrace {
26
Siva Velusamy93a826f2011-12-14 12:19:56 -080027void GLTrace_eglCreateContext(int version, int contextId) {
28 GLMessage glmessage;
29 GLTraceContext *glContext = getGLTraceContext();
30
31 glmessage.set_context_id(contextId);
32 glmessage.set_function(GLMessage::eglCreateContext);
33
34 // copy argument version
35 GLMessage_DataType *arg_version = glmessage.add_args();
36 arg_version->set_isarray(false);
37 arg_version->set_type(GLMessage::DataType::INT);
38 arg_version->add_intvalue(version);
39
40 // copy argument context
41 GLMessage_DataType *arg_context = glmessage.add_args();
42 arg_context->set_isarray(false);
43 arg_context->set_type(GLMessage::DataType::INT);
44 arg_context->add_intvalue(contextId);
45
46 glContext->traceGLMessage(&glmessage);
47}
48
49void GLTrace_eglMakeCurrent(int contextId) {
50 GLMessage glmessage;
51 GLTraceContext *glContext = getGLTraceContext();
52
53 glmessage.set_context_id(contextId);
54 glmessage.set_function(GLMessage::eglMakeCurrent);
55
56 // copy argument context
57 GLMessage_DataType *arg_context = glmessage.add_args();
58 arg_context->set_isarray(false);
59 arg_context->set_type(GLMessage::DataType::INT);
60 arg_context->add_intvalue(contextId);
61
62 glContext->traceGLMessage(&glmessage);
63}
64
Siva Velusamy0469dd62011-11-30 15:05:37 -080065void GLTrace_eglSwapBuffers(void *dpy, void *draw) {
66 GLMessage glmessage;
67 GLTraceContext *glContext = getGLTraceContext();
68
Siva Velusamy93a826f2011-12-14 12:19:56 -080069 glmessage.set_context_id(glContext->getId());
Siva Velusamy0469dd62011-11-30 15:05:37 -080070 glmessage.set_function(GLMessage::eglSwapBuffers);
71
Siva Velusamyf132ac32011-12-07 16:00:58 -080072 // read FB0 since that is what is displayed on the screen
Siva Velusamy93a826f2011-12-14 12:19:56 -080073 fixup_addFBContents(glContext, &glmessage, FB0);
74 glContext->traceGLMessage(&glmessage);
Siva Velusamy0469dd62011-11-30 15:05:37 -080075}
76
77};
78};