summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2011-04-18 12:08:19 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2011-04-18 12:08:19 +0200
commit2482bf4ef312f54ff4272f70f2a8934b86937219 (patch)
treee447f986b6a8acbc2fb166435e33b55ab7f3073e
parent6974c0c3a00912185c58237f8ec2f7a822629929 (diff)
wfdport: Implement wfdGetCurrentPortMode
-rw-r--r--src/wfdapi.c18
-rw-r--r--src/wfdport.c14
-rw-r--r--src/wfdport.h3
3 files changed, 33 insertions, 2 deletions
diff --git a/src/wfdapi.c b/src/wfdapi.c
index 6c1ffae..0475514 100644
--- a/src/wfdapi.c
+++ b/src/wfdapi.c
@@ -532,9 +532,23 @@ wfdSetPortMode(WFDDevice device_handle,
}
WFD_API_CALL WFDPortMode WFD_APIENTRY
-wfdGetCurrentPortMode(WFDDevice device, WFDPort port) WFD_APIEXIT
+wfdGetCurrentPortMode(WFDDevice device_handle, WFDPort port_handle) WFD_APIEXIT
{
- return WFD_INVALID_HANDLE;
+ struct wfd_device *device;
+ struct wfd_port *port;
+
+ device = wf_handle_get_object(device_handle, DEVICE_HANDLE);
+ if (device == NULL)
+ return WFD_INVALID_HANDLE;
+ wfd_device_set_error(device, WFD_ERROR_NONE);
+
+ port = wf_handle_get_object(port_handle, PORT_HANDLE);
+ if (port == NULL) {
+ wfd_device_set_error(device, WFD_ERROR_BAD_HANDLE);
+ return WFD_INVALID_HANDLE;
+ }
+
+ return wfd_port_get_current_mode(device, port);
}
diff --git a/src/wfdport.c b/src/wfdport.c
index c65ed1d..1b86a22 100644
--- a/src/wfdport.c
+++ b/src/wfdport.c
@@ -41,7 +41,9 @@ struct wfd_port {
WFDPortMode *modes;
uint32_t possible_crtcs;
+
drmModeModeInfoPtr mode;
+ WFDPortMode mode_handle;
struct wfd_pipeline *pipeline;
int pipeline_updated;
@@ -190,6 +192,7 @@ wfd_port_create(struct wfd_device *device,
}
port->mode = NULL;
+ port->mode_handle = WFD_INVALID_HANDLE;
return port;
}
@@ -466,6 +469,17 @@ wfd_port_set_mode(struct wfd_device *device,
return;
port->mode = mode;
+ port->mode_handle = mode_handle;
+}
+
+WFDPortMode
+wfd_port_get_current_mode(struct wfd_device *device,
+ struct wfd_port *port)
+{
+ if (port->mode_handle == WFD_INVALID_HANDLE)
+ wfd_device_set_error(device, WFD_ERROR_NOT_SUPPORTED);
+
+ return port->mode_handle;
}
int
diff --git a/src/wfdport.h b/src/wfdport.h
index 6e488f0..64f358f 100644
--- a/src/wfdport.h
+++ b/src/wfdport.h
@@ -87,6 +87,9 @@ void
wfd_port_set_mode(struct wfd_device *device,
struct wfd_port *port,
WFDPortMode mode);
+WFDPortMode
+wfd_port_get_current_mode(struct wfd_device *device,
+ struct wfd_port *port);
int
wfd_port_mode_get_attribi(struct wfd_device *device,