libvideorender: CB2 add a key to get crtc index of weston [1/1]
PD#SWPL-144424
Problem:
add a key to get crtc index of weston
Solution:
add a key to get crtc index of weston
Verify:
ap222
Change-Id: I1079cf6b7bc1eabf14c188d3492841ea54713173
Signed-off-by: fei.deng <fei.deng@amlogic.com>
diff --git a/render_plugin.h b/render_plugin.h
index 550e567..0419fd0 100644
--- a/render_plugin.h
+++ b/render_plugin.h
@@ -47,6 +47,7 @@
PLUGIN_KEY_IMMEDIATELY_OUTPUT, //set/get immediately output video frame to display, 0 is default value off, 1 is on
PLUGIN_KEY_CROP_FRAME_SIZE, //set/get crop frame size,value type is PluginRect
PLUGIN_KEY_PIXEL_ASPECT_RATIO, //set/get pixel aspect ratio,value type is double
+ PLUGIN_KEY_CURRENT_OUTPUT, //set/get signal output,value type is int
PLUGIN_KEY_VIDEO_FRAME_RATE, //set/get video frame rate,value type is RenderFraction
} PluginKey;
diff --git a/weston/wayland-protocol/wayland.xml b/weston/wayland-protocol/wayland.xml
index 5b5b426..ed7b151 100644
--- a/weston/wayland-protocol/wayland.xml
+++ b/weston/wayland-protocol/wayland.xml
@@ -2546,6 +2546,13 @@
<arg name="factor" type="int" summary="scaling factor of output"/>
</event>
+ <event name="crtc_index" since="2">
+ <description summary="crtc index of output">
+ This event contains crtc index information of the current
+ output.
+ </description>
+ <arg name="index" type="int" summary="crtc index of output"/>
+ </event>
<!-- Version 3 additions -->
<request name="release" type="destructor" since="3">
diff --git a/weston/wayland_display.cpp b/weston/wayland_display.cpp
index eb06a22..2b2831a 100644
--- a/weston/wayland_display.cpp
+++ b/weston/wayland_display.cpp
@@ -148,6 +148,8 @@
void WaylandDisplay::outputHandleDone( void *data,
struct wl_output *output )
{
+ WaylandDisplay *self = static_cast<WaylandDisplay *>(data);
+ DEBUG(self->mLogCategory,"wl_output: %p",output);
UNUSED_PARAM(data);
UNUSED_PARAM(output);
}
@@ -156,16 +158,33 @@
struct wl_output *output,
int32_t scale )
{
+ WaylandDisplay *self = static_cast<WaylandDisplay *>(data);
+ DEBUG(self->mLogCategory,"wl_output: %p scale %d",output, scale);
UNUSED_PARAM(data);
UNUSED_PARAM(output);
UNUSED_PARAM(scale);
}
+void WaylandDisplay::outputHandleCrtcIndex( void *data,
+ struct wl_output *output,
+ int32_t index )
+{
+ WaylandDisplay *self = static_cast<WaylandDisplay *>(data);
+ DEBUG(self->mLogCategory,"wl_output: %p crtc index %d",output, index);
+ Tls::Mutex::Autolock _l(self->mMutex);
+ for (int i = 0; i < DEFAULT_DISPLAY_OUTPUT_NUM; i++) {
+ if (output == self->mOutput[i].wlOutput) {
+ self->mOutput[i].crtcIndex = index;
+ }
+ }
+}
+
static const struct wl_output_listener outputListener = {
WaylandDisplay::outputHandleGeometry,
WaylandDisplay::outputHandleMode,
WaylandDisplay::outputHandleDone,
- WaylandDisplay::outputHandleScale
+ WaylandDisplay::outputHandleScale,
+ WaylandDisplay::outputHandleCrtcIndex,
};
void WaylandDisplay::pointerHandleEnter(void *data, struct wl_pointer *pointer,
diff --git a/weston/wayland_display.h b/weston/wayland_display.h
index bf03ca6..78f4679 100644
--- a/weston/wayland_display.h
+++ b/weston/wayland_display.h
@@ -111,6 +111,13 @@
*/
int getDisplayOutput();
+ int getCurrentOutputCrtcIndex() {
+ if (mCurrentDisplayOutput) {
+ return mCurrentDisplayOutput->crtcIndex;
+ }
+ return 0; //default crtc index
+ };
+
/**
* @brief set pip video
* @param pip if set to 1, the video data will display in pip video plane
@@ -177,6 +184,9 @@
static void outputHandleScale( void *data,
struct wl_output *output,
int32_t scale );
+ static void outputHandleCrtcIndex( void *data,
+ struct wl_output *output,
+ int32_t index );
static void pointerHandleEnter(void *data, struct wl_pointer *pointer,
uint32_t serial, struct wl_surface *surface,
wl_fixed_t sx, wl_fixed_t sy);
@@ -225,6 +235,7 @@
int refreshRate;
bool isPrimary;
uint32_t name;
+ int32_t crtcIndex;
} DisplayOutput;
struct Rectangle {
int x;
diff --git a/weston/wayland_plugin.cpp b/weston/wayland_plugin.cpp
index 50eb3ac..37fcace 100644
--- a/weston/wayland_plugin.cpp
+++ b/weston/wayland_plugin.cpp
@@ -191,6 +191,10 @@
*(int *)(value) = mDisplay->getDisplayOutput();
TRACE(mLogCategory,"get select display output:%d",*(int *)value);
} break;
+ case PLUGIN_KEY_CURRENT_OUTPUT: {
+ *(int *)(value) = mDisplay->getCurrentOutputCrtcIndex();
+ //DEBUG(mLogCategory,"get current crtc output index:%d",*(int *)value);
+ } break;
}
return NO_ERROR;
}