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 DRM_MODE_CONNECTOR_MIPI    15
48#define HDMI_MODE_OFF           0
49#define HDMI_MODE_CLONE         1
50#define HDMI_MODE_EXT_VIDEO         2
51#define HDMI_MODE_EXT_DESKTOP       3
52#define HDMI_MODE_CLONE_ROTATION    4
53
54typedef enum _psb_hdmi_mode {
55    OFF,
56    CLONE,
57    EXTENDED_VIDEO,
58    EXTENDED_DESKTOP,
59    UNDEFINED,
60} psb_hdmi_mode;
61
62typedef struct _psb_extvideo_prop_s {
63    psb_hdmi_mode ExtVideoMode;
64
65    unsigned short ExtVideoMode_XRes;
66    unsigned short ExtVideoMode_YRes;
67    short ExtVideoMode_X_Offset;
68    short ExtVideoMode_Y_Offset;
69} psb_extvideo_prop_s, *psb_extvideo_prop_p;
70
71typedef struct _psb_HDMIExt_info_s {
72    /*MIPI infos*/
73    uint32_t mipi_crtc_id;
74    /*hdmi infos*/
75    uint32_t hdmi_connector_id;
76    uint32_t hdmi_encoder_id;
77    uint32_t hdmi_crtc_id;
78
79    psb_hdmi_mode hdmi_mode;
80    int hdmi_state;
81    psb_extvideo_prop_p hdmi_extvideo_prop;
82} psb_HDMIExt_info_s, *psb_HDMIExt_info_p;
83
84VAStatus psb_HDMIExt_get_prop(psb_android_output_p output, unsigned short *xres, unsigned short *yres);
85
86psb_hdmi_mode psb_HDMIExt_get_mode(psb_android_output_p output);
87VAStatus psb_HDMIExt_update(VADriverContextP ctx, psb_HDMIExt_info_p psb_HDMIExt_info);
88
89psb_HDMIExt_info_p psb_HDMIExt_init(VADriverContextP ctx, psb_android_output_p output);
90VAStatus psb_HDMIExt_deinit(psb_android_output_p output);
91
92#endif /* _PSB_HDMIEXTMODE_H_*/
93