129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/*
2d551ebe2cb65d9da47d3e25f6004b8870afec8b4Naseer Ahmed* Copyright (c) 2011, The Linux Foundation. All rights reserved.
329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed*
429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* Redistribution and use in source and binary forms, with or without
529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* modification, are permitted provided that the following conditions are
629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* met:
729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed*    * Redistributions of source code must retain the above copyright
829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed*      notice, this list of conditions and the following disclaimer.
929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed*    * Redistributions in binary form must reproduce the above
1029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed*      copyright notice, this list of conditions and the following
1129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed*      disclaimer in the documentation and/or other materials provided
1229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed*      with the distribution.
13d551ebe2cb65d9da47d3e25f6004b8870afec8b4Naseer Ahmed*    * Neither the name of The Linux Foundation nor the names of its
1429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed*      contributors may be used to endorse or promote products derived
1529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed*      from this software without specific prior written permission.
1629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed*
1729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
1829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
2029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
2129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
2429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
2529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
2629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
2729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed*/
2929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
3029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#ifndef MDP_WRAPPER_H
3129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#define MDP_WRAPPER_H
3229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
3329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/*
3429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* In order to make overlay::mdp_wrapper shorter, please do something like:
3529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* namespace mdpwrap = overlay::mdp_wrapper;
3629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed* */
3729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
3829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include <linux/msm_mdp.h>
3929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include <linux/msm_rotator.h>
4029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include <sys/ioctl.h>
4129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include <utils/Log.h>
4229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include <errno.h>
4329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include "overlayUtils.h"
4429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
4529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmednamespace overlay{
4629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
4729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmednamespace mdp_wrapper{
4829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* FBIOGET_FSCREENINFO */
4929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedbool getFScreenInfo(int fd, fb_fix_screeninfo& finfo);
5029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
5129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* FBIOGET_VSCREENINFO */
5229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedbool getVScreenInfo(int fd, fb_var_screeninfo& vinfo);
5329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
5429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* FBIOPUT_VSCREENINFO */
5529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedbool setVScreenInfo(int fd, fb_var_screeninfo& vinfo);
5629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
5729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* MSM_ROTATOR_IOCTL_START */
5829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedbool startRotator(int fd, msm_rotator_img_info& rot);
5929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
6029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* MSM_ROTATOR_IOCTL_ROTATE */
6129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedbool rotate(int fd, msm_rotator_data_info& rot);
6229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
6329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* MSMFB_OVERLAY_SET */
6429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedbool setOverlay(int fd, mdp_overlay& ov);
6529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
6629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* MSM_ROTATOR_IOCTL_FINISH */
6729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedbool endRotator(int fd, int sessionId);
6829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
6929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* MSMFB_OVERLAY_UNSET */
7029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedbool unsetOverlay(int fd, int ovId);
7129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
7229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* MSMFB_OVERLAY_GET */
7329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedbool getOverlay(int fd, mdp_overlay& ov);
7429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
7529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* MSMFB_OVERLAY_PLAY */
7629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedbool play(int fd, msmfb_overlay_data& od);
7729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
7829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* MSMFB_OVERLAY_3D */
7929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedbool set3D(int fd, msmfb_overlay_3d& ov);
8029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
8129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* the following are helper functions for dumping
8229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * msm_mdp and friends*/
8329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedvoid dump(const char* const s, const msmfb_overlay_data& ov);
8429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedvoid dump(const char* const s, const msmfb_data& ov);
8529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedvoid dump(const char* const s, const mdp_overlay& ov);
8629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedvoid dump(const char* const s, const msmfb_overlay_3d& ov);
8729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedvoid dump(const char* const s, const uint32_t u[], uint32_t cnt);
8829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedvoid dump(const char* const s, const msmfb_img& ov);
8929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedvoid dump(const char* const s, const mdp_rect& ov);
9029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
9129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* and rotator */
9229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedvoid dump(const char* const s, const msm_rotator_img_info& rot);
9329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedvoid dump(const char* const s, const msm_rotator_data_info& rot);
9429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
9529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* info */
9629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedvoid dump(const char* const s, const fb_fix_screeninfo& finfo);
9729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedvoid dump(const char* const s, const fb_var_screeninfo& vinfo);
9829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
9929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed//---------------Inlines -------------------------------------
10029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
10129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool getFScreenInfo(int fd, fb_fix_screeninfo& finfo) {
102f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed    if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo) < 0) {
103f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed        ALOGE("Failed to call ioctl FBIOGET_FSCREENINFO err=%s",
104f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed                strerror(errno));
10529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed        return false;
10629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    }
10729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    return true;
10829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
10929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
11029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool getVScreenInfo(int fd, fb_var_screeninfo& vinfo) {
111f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed    if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0) {
112f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed        ALOGE("Failed to call ioctl FBIOGET_VSCREENINFO err=%s",
113f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed                strerror(errno));
11429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed        return false;
11529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    }
11629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    return true;
11729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
11829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
11929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool setVScreenInfo(int fd, fb_var_screeninfo& vinfo) {
120f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed    if (ioctl(fd, FBIOPUT_VSCREENINFO, &vinfo) < 0) {
121f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed        ALOGE("Failed to call ioctl FBIOPUT_VSCREENINFO err=%s",
122f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed                strerror(errno));
12329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed        return false;
12429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    }
12529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    return true;
12629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
12729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
12829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool startRotator(int fd, msm_rotator_img_info& rot) {
129f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed    if (ioctl(fd, MSM_ROTATOR_IOCTL_START, &rot) < 0){
130f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed        ALOGE("Failed to call ioctl MSM_ROTATOR_IOCTL_START err=%s",
131f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed                strerror(errno));
13229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed        return false;
13329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    }
13429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    return true;
13529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
13629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
13729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool rotate(int fd, msm_rotator_data_info& rot) {
138f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed    if (ioctl(fd, MSM_ROTATOR_IOCTL_ROTATE, &rot) < 0) {
139f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed        ALOGE("Failed to call ioctl MSM_ROTATOR_IOCTL_ROTATE err=%s",
140f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed                strerror(errno));
14129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed        return false;
14229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    }
14329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    return true;
14429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
14529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
14629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool setOverlay(int fd, mdp_overlay& ov) {
147f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed    if (ioctl(fd, MSMFB_OVERLAY_SET, &ov) < 0) {
148f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed        ALOGE("Failed to call ioctl MSMFB_OVERLAY_SET err=%s",
149f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed                strerror(errno));
15029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed        return false;
15129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    }
15229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    return true;
15329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
15429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
155d551ebe2cb65d9da47d3e25f6004b8870afec8b4Naseer Ahmedinline bool endRotator(int fd, uint32_t sessionId) {
156f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed    if (ioctl(fd, MSM_ROTATOR_IOCTL_FINISH, &sessionId) < 0) {
157f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed        ALOGE("Failed to call ioctl MSM_ROTATOR_IOCTL_FINISH err=%s",
158f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed                strerror(errno));
15929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed        return false;
16029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    }
16129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    return true;
16229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
16329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
16429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool unsetOverlay(int fd, int ovId) {
165f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed    if (ioctl(fd, MSMFB_OVERLAY_UNSET, &ovId) < 0) {
166f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed        ALOGE("Failed to call ioctl MSMFB_OVERLAY_UNSET err=%s",
167f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed                strerror(errno));
16829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed        return false;
16929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    }
17029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    return true;
17129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
17229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
17329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool getOverlay(int fd, mdp_overlay& ov) {
174f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed    if (ioctl(fd, MSMFB_OVERLAY_GET, &ov) < 0) {
175f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed        ALOGE("Failed to call ioctl MSMFB_OVERLAY_GET err=%s",
176f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed                strerror(errno));
17729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed        return false;
17829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    }
17929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    return true;
18029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
18129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
18229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool play(int fd, msmfb_overlay_data& od) {
183f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed    if (ioctl(fd, MSMFB_OVERLAY_PLAY, &od) < 0) {
184f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed        ALOGE("Failed to call ioctl MSMFB_OVERLAY_PLAY err=%s",
185f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed                strerror(errno));
18629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed        return false;
18729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    }
18829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    return true;
18929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
19029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
19129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline bool set3D(int fd, msmfb_overlay_3d& ov) {
192f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed    if (ioctl(fd, MSMFB_OVERLAY_3D, &ov) < 0) {
193f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed        ALOGE("Failed to call ioctl MSMFB_OVERLAY_3D err=%s",
194f48aef64b218d42bd2ede62dcb03a3d7831ebbf9Naseer Ahmed                strerror(errno));
19529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed        return false;
19629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    }
19729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    return true;
19829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
19929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
20029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/* dump funcs */
20129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline void dump(const char* const s, const msmfb_overlay_data& ov) {
20229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    ALOGE("%s msmfb_overlay_data id=%d",
20329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed            s, ov.id);
20429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    dump("data", ov.data);
20529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
20629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline void dump(const char* const s, const msmfb_data& ov) {
20729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    ALOGE("%s msmfb_data offset=%d memid=%d id=%d flags=0x%x priv=%d",
20829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed            s, ov.offset, ov.memory_id, ov.id, ov.flags, ov.priv);
20929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
21029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline void dump(const char* const s, const mdp_overlay& ov) {
21129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    ALOGE("%s mdp_overlay z=%d fg=%d alpha=%d mask=%d flags=0x%x id=%d",
21229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed            s, ov.z_order, ov.is_fg, ov.alpha,
21329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed            ov.transp_mask, ov.flags, ov.id);
21429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    dump("src", ov.src);
21529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    dump("src_rect", ov.src_rect);
21629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    dump("dst_rect", ov.dst_rect);
217d551ebe2cb65d9da47d3e25f6004b8870afec8b4Naseer Ahmed    /*
218d551ebe2cb65d9da47d3e25f6004b8870afec8b4Naseer Ahmed    Commented off to prevent verbose logging, since user_data could have 8 or so
219d551ebe2cb65d9da47d3e25f6004b8870afec8b4Naseer Ahmed    fields which are mostly 0
22029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    dump("user_data", ov.user_data,
22129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed            sizeof(ov.user_data)/sizeof(ov.user_data[0]));
222d551ebe2cb65d9da47d3e25f6004b8870afec8b4Naseer Ahmed    */
22329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
22429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline void dump(const char* const s, const msmfb_img& ov) {
22529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    ALOGE("%s msmfb_img w=%d h=%d format=%d %s",
22629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed            s, ov.width, ov.height, ov.format,
22729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed            overlay::utils::getFormatString(ov.format));
22829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
22929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline void dump(const char* const s, const mdp_rect& ov) {
23029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    ALOGE("%s mdp_rect x=%d y=%d w=%d h=%d",
23129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed            s, ov.x, ov.y, ov.w, ov.h);
23229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
23329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
23429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline void dump(const char* const s, const msmfb_overlay_3d& ov) {
23529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    ALOGE("%s msmfb_overlay_3d 3d=%d w=%d h=%d",
23629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed            s, ov.is_3d, ov.width, ov.height);
23729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
23829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
23929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline void dump(const char* const s, const uint32_t u[], uint32_t cnt) {
24029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    ALOGE("%s user_data cnt=%d", s, cnt);
24129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    for(uint32_t i=0; i < cnt; ++i) {
24229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed        ALOGE("i=%d val=%d", i, u[i]);
24329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    }
24429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
24529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline void dump(const char* const s, const msm_rotator_img_info& rot) {
246d82ce1da8ebdba46e6d0119fac1aa8d4b9b033b7Ramkumar Radhakrishnan    ALOGE("%s msm_rotator_img_info sessid=%u dstx=%d dsty=%d rot=%d, ena=%d scale=%d",
24729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed            s, rot.session_id, rot.dst_x, rot.dst_y,
248d82ce1da8ebdba46e6d0119fac1aa8d4b9b033b7Ramkumar Radhakrishnan            rot.rotations, rot.enable, rot.downscale_ratio);
24929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    dump("src", rot.src);
25029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    dump("dst", rot.dst);
25129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    dump("src_rect", rot.src_rect);
25229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
25329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline void dump(const char* const s, const msm_rotator_data_info& rot) {
254d551ebe2cb65d9da47d3e25f6004b8870afec8b4Naseer Ahmed    ALOGE("%s msm_rotator_data_info sessid=%u verkey=%d",
25529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed            s, rot.session_id, rot.version_key);
25629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    dump("src", rot.src);
25729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    dump("dst", rot.dst);
25829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    dump("src_chroma", rot.src_chroma);
25929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    dump("dst_chroma", rot.dst_chroma);
26029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
26129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline void dump(const char* const s, const fb_fix_screeninfo& finfo) {
26229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    ALOGE("%s fb_fix_screeninfo type=%d", s, finfo.type);
26329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
26429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedinline void dump(const char* const s, const fb_var_screeninfo& vinfo) {
26529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed    ALOGE("%s fb_var_screeninfo xres=%d yres=%d",
26629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed            s, vinfo.xres, vinfo.yres);
26729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed}
26829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
26929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} // mdp_wrapper
27029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
27129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed} // overlay
27229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
27329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#endif // MDP_WRAPPER_H
274