165174cf623a03bf5ce819778f8bca002674c2e7eAustin Yuan/*
2f91c8768670386683a281cc39141e21bdda9c97fKun Wang * Copyright (c) 2011 Intel Corporation. All Rights Reserved.
365174cf623a03bf5ce819778f8bca002674c2e7eAustin Yuan *
4f91c8768670386683a281cc39141e21bdda9c97fKun Wang * Permission is hereby granted, free of charge, to any person obtaining a
5f91c8768670386683a281cc39141e21bdda9c97fKun Wang * copy of this software and associated documentation files (the
6f91c8768670386683a281cc39141e21bdda9c97fKun Wang * "Software"), to deal in the Software without restriction, including
7f91c8768670386683a281cc39141e21bdda9c97fKun Wang * without limitation the rights to use, copy, modify, merge, publish,
8f91c8768670386683a281cc39141e21bdda9c97fKun Wang * distribute, sub license, and/or sell copies of the Software, and to
9f91c8768670386683a281cc39141e21bdda9c97fKun Wang * permit persons to whom the Software is furnished to do so, subject to
10f91c8768670386683a281cc39141e21bdda9c97fKun Wang * the following conditions:
113f3d1e8746d2b793c982ac19a73061e006b1b178Kun Wang *
12f91c8768670386683a281cc39141e21bdda9c97fKun Wang * The above copyright notice and this permission notice (including the
13f91c8768670386683a281cc39141e21bdda9c97fKun Wang * next paragraph) shall be included in all copies or substantial portions
14f91c8768670386683a281cc39141e21bdda9c97fKun Wang * of the Software.
153f3d1e8746d2b793c982ac19a73061e006b1b178Kun Wang *
16f91c8768670386683a281cc39141e21bdda9c97fKun Wang * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17f91c8768670386683a281cc39141e21bdda9c97fKun Wang * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18f91c8768670386683a281cc39141e21bdda9c97fKun Wang * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19f91c8768670386683a281cc39141e21bdda9c97fKun Wang * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
20f91c8768670386683a281cc39141e21bdda9c97fKun Wang * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21f91c8768670386683a281cc39141e21bdda9c97fKun Wang * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22f91c8768670386683a281cc39141e21bdda9c97fKun Wang * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2365174cf623a03bf5ce819778f8bca002674c2e7eAustin Yuan *
2465174cf623a03bf5ce819778f8bca002674c2e7eAustin Yuan * Authors:
2565174cf623a03bf5ce819778f8bca002674c2e7eAustin Yuan *    Jason Hu <jason.hu@intel.com>
2665174cf623a03bf5ce819778f8bca002674c2e7eAustin Yuan */
2765174cf623a03bf5ce819778f8bca002674c2e7eAustin Yuan
2865174cf623a03bf5ce819778f8bca002674c2e7eAustin Yuan#ifndef _PSB_HDMIEXTMODE_H_
2965174cf623a03bf5ce819778f8bca002674c2e7eAustin Yuan#define _PSB_HDMIEXTMODE_H_
3065174cf623a03bf5ce819778f8bca002674c2e7eAustin Yuan
3154752e65b02b1a84c491e3f9c964046faeea306eKun Wang#include <assert.h>
3254752e65b02b1a84c491e3f9c964046faeea306eKun Wang#include <stdio.h>
3354752e65b02b1a84c491e3f9c964046faeea306eKun Wang#include <stdlib.h>
3454752e65b02b1a84c491e3f9c964046faeea306eKun Wang#include <stdint.h>
3554752e65b02b1a84c491e3f9c964046faeea306eKun Wang#include <unistd.h>
3654752e65b02b1a84c491e3f9c964046faeea306eKun Wang#include <string.h>
3754752e65b02b1a84c491e3f9c964046faeea306eKun Wang#include <errno.h>
3854752e65b02b1a84c491e3f9c964046faeea306eKun Wang#include <sys/types.h>
3954752e65b02b1a84c491e3f9c964046faeea306eKun Wang#include <sys/stat.h>
4054752e65b02b1a84c491e3f9c964046faeea306eKun Wang#include <fcntl.h>
4154752e65b02b1a84c491e3f9c964046faeea306eKun Wang#include "va/va.h"
4254752e65b02b1a84c491e3f9c964046faeea306eKun Wang#include "va/va_backend.h"
4354752e65b02b1a84c491e3f9c964046faeea306eKun Wang#include "xf86drm.h"
4454752e65b02b1a84c491e3f9c964046faeea306eKun Wang#include "xf86drmMode.h"
4565174cf623a03bf5ce819778f8bca002674c2e7eAustin Yuan#include "psb_output_android.h"
4654752e65b02b1a84c491e3f9c964046faeea306eKun Wang
473f3d1e8746d2b793c982ac19a73061e006b1b178Kun Wang#define HDMI_MODE_OFF           0
483f3d1e8746d2b793c982ac19a73061e006b1b178Kun Wang#define HDMI_MODE_CLONE         1
493f3d1e8746d2b793c982ac19a73061e006b1b178Kun Wang#define HDMI_MODE_EXT_VIDEO         2
503f3d1e8746d2b793c982ac19a73061e006b1b178Kun Wang#define HDMI_MODE_EXT_DESKTOP       3
513f3d1e8746d2b793c982ac19a73061e006b1b178Kun Wang#define HDMI_MODE_CLONE_ROTATION    4
5254752e65b02b1a84c491e3f9c964046faeea306eKun Wang
5354752e65b02b1a84c491e3f9c964046faeea306eKun Wangtypedef enum _psb_hdmi_mode {
5454752e65b02b1a84c491e3f9c964046faeea306eKun Wang    OFF,
5554752e65b02b1a84c491e3f9c964046faeea306eKun Wang    CLONE,
5654752e65b02b1a84c491e3f9c964046faeea306eKun Wang    EXTENDED_VIDEO,
5754752e65b02b1a84c491e3f9c964046faeea306eKun Wang    EXTENDED_DESKTOP,
58dd4b7893a4762e97aab7d10fbe32c16da494cbddShuduo Sang    UNDEFINED,
5954752e65b02b1a84c491e3f9c964046faeea306eKun Wang} psb_hdmi_mode;
6054752e65b02b1a84c491e3f9c964046faeea306eKun Wang
6154752e65b02b1a84c491e3f9c964046faeea306eKun Wangtypedef struct _psb_extvideo_prop_s {
6254752e65b02b1a84c491e3f9c964046faeea306eKun Wang    psb_hdmi_mode ExtVideoMode;
6354752e65b02b1a84c491e3f9c964046faeea306eKun Wang
6454752e65b02b1a84c491e3f9c964046faeea306eKun Wang    unsigned short ExtVideoMode_XRes;
6554752e65b02b1a84c491e3f9c964046faeea306eKun Wang    unsigned short ExtVideoMode_YRes;
6654752e65b02b1a84c491e3f9c964046faeea306eKun Wang    short ExtVideoMode_X_Offset;
6754752e65b02b1a84c491e3f9c964046faeea306eKun Wang    short ExtVideoMode_Y_Offset;
6854752e65b02b1a84c491e3f9c964046faeea306eKun Wang} psb_extvideo_prop_s, *psb_extvideo_prop_p;
6954752e65b02b1a84c491e3f9c964046faeea306eKun Wang
7054752e65b02b1a84c491e3f9c964046faeea306eKun Wangtypedef struct _psb_HDMIExt_info_s {
7154752e65b02b1a84c491e3f9c964046faeea306eKun Wang    /*MIPI infos*/
72dd4b7893a4762e97aab7d10fbe32c16da494cbddShuduo Sang    uint32_t mipi_crtc_id;
7354752e65b02b1a84c491e3f9c964046faeea306eKun Wang    /*hdmi infos*/
7454752e65b02b1a84c491e3f9c964046faeea306eKun Wang    uint32_t hdmi_connector_id;
7554752e65b02b1a84c491e3f9c964046faeea306eKun Wang    uint32_t hdmi_encoder_id;
7654752e65b02b1a84c491e3f9c964046faeea306eKun Wang    uint32_t hdmi_crtc_id;
7754752e65b02b1a84c491e3f9c964046faeea306eKun Wang
7854752e65b02b1a84c491e3f9c964046faeea306eKun Wang    psb_hdmi_mode hdmi_mode;
79fa6f2e9012a890942a47eae9f6f1a0ddcd97e9a4Fei Jiang    int hdmi_state;
8054752e65b02b1a84c491e3f9c964046faeea306eKun Wang    psb_extvideo_prop_p hdmi_extvideo_prop;
8154752e65b02b1a84c491e3f9c964046faeea306eKun Wang} psb_HDMIExt_info_s, *psb_HDMIExt_info_p;
8254752e65b02b1a84c491e3f9c964046faeea306eKun Wang
83dd4b7893a4762e97aab7d10fbe32c16da494cbddShuduo SangVAStatus psb_HDMIExt_get_prop(psb_android_output_p output, unsigned short *xres, unsigned short *yres);
8454752e65b02b1a84c491e3f9c964046faeea306eKun Wang
8565174cf623a03bf5ce819778f8bca002674c2e7eAustin Yuanpsb_hdmi_mode psb_HDMIExt_get_mode(psb_android_output_p output);
8665174cf623a03bf5ce819778f8bca002674c2e7eAustin YuanVAStatus psb_HDMIExt_update(VADriverContextP ctx, psb_HDMIExt_info_p psb_HDMIExt_info);
8765174cf623a03bf5ce819778f8bca002674c2e7eAustin Yuan
8865174cf623a03bf5ce819778f8bca002674c2e7eAustin Yuanpsb_HDMIExt_info_p psb_HDMIExt_init(VADriverContextP ctx, psb_android_output_p output);
8965174cf623a03bf5ce819778f8bca002674c2e7eAustin YuanVAStatus psb_HDMIExt_deinit(psb_android_output_p output);
9054752e65b02b1a84c491e3f9c964046faeea306eKun Wang
9165174cf623a03bf5ce819778f8bca002674c2e7eAustin Yuan#endif /* _PSB_HDMIEXTMODE_H_*/
92