1 /*
2  * Copyright (c) 2011 Intel Corporation. All Rights Reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sub license, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the
13  * next paragraph) shall be included in all copies or substantial portions
14  * of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19  * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
20  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  * Authors:
25  *    Jason Hu <jason.hu@intel.com>
26  */
27 
28 #ifndef _PSB_HDMIEXTMODE_H_
29 #define _PSB_HDMIEXTMODE_H_
30 
31 #include <assert.h>
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <stdint.h>
35 #include <unistd.h>
36 #include <string.h>
37 #include <errno.h>
38 #include <sys/types.h>
39 #include <sys/stat.h>
40 #include <fcntl.h>
41 #include "va/va.h"
42 #include "va/va_backend.h"
43 #include "xf86drm.h"
44 #include "xf86drmMode.h"
45 #include "psb_output_android.h"
46 
47 #define HDMI_MODE_OFF           0
48 #define HDMI_MODE_CLONE         1
49 #define HDMI_MODE_EXT_VIDEO         2
50 #define HDMI_MODE_EXT_DESKTOP       3
51 #define HDMI_MODE_CLONE_ROTATION    4
52 
53 typedef enum _psb_hdmi_mode {
54     OFF,
55     CLONE,
56     EXTENDED_VIDEO,
57     EXTENDED_DESKTOP,
58     UNDEFINED,
59 } psb_hdmi_mode;
60 
61 typedef struct _psb_extvideo_prop_s {
62     psb_hdmi_mode ExtVideoMode;
63 
64     unsigned short ExtVideoMode_XRes;
65     unsigned short ExtVideoMode_YRes;
66     short ExtVideoMode_X_Offset;
67     short ExtVideoMode_Y_Offset;
68 } psb_extvideo_prop_s, *psb_extvideo_prop_p;
69 
70 typedef struct _psb_HDMIExt_info_s {
71     /*MIPI infos*/
72     uint32_t mipi_crtc_id;
73     /*hdmi infos*/
74     uint32_t hdmi_connector_id;
75     uint32_t hdmi_encoder_id;
76     uint32_t hdmi_crtc_id;
77 
78     psb_hdmi_mode hdmi_mode;
79     int hdmi_state;
80     psb_extvideo_prop_p hdmi_extvideo_prop;
81 } psb_HDMIExt_info_s, *psb_HDMIExt_info_p;
82 
83 VAStatus psb_HDMIExt_get_prop(psb_android_output_p output, unsigned short *xres, unsigned short *yres);
84 
85 psb_hdmi_mode psb_HDMIExt_get_mode(psb_android_output_p output);
86 VAStatus psb_HDMIExt_update(VADriverContextP ctx, psb_HDMIExt_info_p psb_HDMIExt_info);
87 
88 psb_HDMIExt_info_p psb_HDMIExt_init(VADriverContextP ctx, psb_android_output_p output);
89 VAStatus psb_HDMIExt_deinit(psb_android_output_p output);
90 
91 #endif /* _PSB_HDMIEXTMODE_H_*/
92