summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2011-04-18 10:00:52 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2011-04-18 10:00:52 +0200
commitfd7bdf88bb89b02b617e26b8fdcc48513ebf79f8 (patch)
treea47c64399381967ca65401fbef4c631044f88f8d
parentb7b93de1d339262abf78d3bc4e2a118d25b11f61 (diff)
wfdport: Handle FILL_PORT_AREA and BACKGROUND_COLOR attributes
-rw-r--r--src/wfdapi.c79
-rw-r--r--src/wfdport.c62
-rw-r--r--src/wfdport.h20
3 files changed, 147 insertions, 14 deletions
diff --git a/src/wfdapi.c b/src/wfdapi.c
index f2198b5..75fd1c6 100644
--- a/src/wfdapi.c
+++ b/src/wfdapi.c
@@ -596,19 +596,36 @@ wfdGetPortAttribiv(WFDDevice device_handle,
}
wfd_port_get_attribiv(device, port, attrib, count, value);
-
- /* FIXME */
- wfd_device_set_error(device, WFD_ERROR_NONE);
}
WFD_API_CALL void WFD_APIENTRY
-wfdGetPortAttribfv(WFDDevice device,
- WFDPort port,
+wfdGetPortAttribfv(WFDDevice device_handle,
+ WFDPort port_handle,
WFDPortConfigAttrib attrib,
WFDint count,
WFDfloat *value) WFD_APIEXIT
{
+ struct wfd_device *device;
+ struct wfd_port *port;
+
+ device = wf_handle_get_object(device_handle, DEVICE_HANDLE);
+ if (device == NULL)
+ return;
+ 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;
+ }
+
+ if (count <= 0 || value == NULL) {
+ wfd_device_set_error(device, WFD_ERROR_ILLEGAL_ARGUMENT);
+ return;
+ }
+
+ wfd_port_get_attribfv(device, port, attrib, count, value);
}
@@ -623,13 +640,13 @@ wfdSetPortAttribi(WFDDevice device_handle,
device = wf_handle_get_object(device_handle, DEVICE_HANDLE);
if (device == NULL)
- return 0;
+ return;
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 0;
+ return;
}
wfd_port_set_attribi(device, port, attrib, value);
@@ -646,22 +663,62 @@ wfdSetPortAttribf(WFDDevice device,
WFD_API_CALL void WFD_APIENTRY
-wfdSetPortAttribiv(WFDDevice device,
- WFDPort port,
+wfdSetPortAttribiv(WFDDevice device_handle,
+ WFDPort port_handle,
WFDPortConfigAttrib attrib,
WFDint count,
const WFDint *value) WFD_APIEXIT
{
+ struct wfd_device *device;
+ struct wfd_port *port;
+
+ device = wf_handle_get_object(device_handle, DEVICE_HANDLE);
+ if (device == NULL)
+ return;
+ 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;
+ }
+
+ if (count <= 0 || value == NULL) {
+ wfd_device_set_error(device, WFD_ERROR_ILLEGAL_ARGUMENT);
+ return;
+ }
+
+ wfd_port_set_attribiv(device, port, attrib, count, value);
}
WFD_API_CALL void WFD_APIENTRY
-wfdSetPortAttribfv(WFDDevice device,
- WFDPort port,
+wfdSetPortAttribfv(WFDDevice device_handle,
+ WFDPort port_handle,
WFDPortConfigAttrib attrib,
WFDint count,
const WFDfloat *value) WFD_APIEXIT
{
+ struct wfd_device *device;
+ struct wfd_port *port;
+
+ device = wf_handle_get_object(device_handle, DEVICE_HANDLE);
+ if (device == NULL)
+ return;
+ 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;
+ }
+
+ if (count <= 0 || value == NULL) {
+ wfd_device_set_error(device, WFD_ERROR_ILLEGAL_ARGUMENT);
+ return;
+ }
+
+ wfd_port_set_attribfv(device, port, attrib, count, value);
}
WFD_API_CALL void WFD_APIENTRY
diff --git a/src/wfdport.c b/src/wfdport.c
index 0409215..ba8178c 100644
--- a/src/wfdport.c
+++ b/src/wfdport.c
@@ -269,6 +269,11 @@ wfd_port_get_attribi(struct wfd_device *device,
}
case WFD_PORT_ATTACHED:
return port->connector->connection == DRM_MODE_CONNECTED;
+ case WFD_PORT_FILL_PORT_AREA:
+ return WFD_TRUE;
+ /* no effect as FILL_PORT_AREA = true */
+ case WFD_PORT_BACKGROUND_COLOR:
+ return 0;
case WFD_PORT_PIPELINE_ID_COUNT:
return wfd_port_choose_pipeline(device, port) != 0 ? 1 : 0;
default:
@@ -306,13 +311,18 @@ wfd_port_get_attribiv(struct wfd_device *device,
case WFD_PORT_NATIVE_RESOLUTION:
if (count != 2)
return;
- if (port->connector-count_modes > 0) {
+ if (port->connector->count_modes > 0) {
value[0] = port->connector->modes[0].hdisplay;
value[1] = port->connector->modes[0].vdisplay;
} else {
value[0] = value[1] = 0;
}
break;
+ case WFD_PORT_BACKGROUND_COLOR:
+ if (count != 3)
+ return;
+ value[0] = 0;
+ break;
case WFD_PORT_BINDABLE_PIPELINE_IDS:
wfd_port_get_bindable_pipelines(device, port, count, value);
break;
@@ -322,6 +332,24 @@ wfd_port_get_attribiv(struct wfd_device *device,
}
void
+wfd_port_get_attribfv(struct wfd_device *device,
+ struct wfd_port *port,
+ WFDPortConfigAttrib attribute,
+ WFDint count,
+ WFDfloat *value)
+{
+ switch (attribute) {
+ case WFD_PORT_BACKGROUND_COLOR:
+ if (count != 3)
+ return;
+ value[0] = value[1] = value[2] = 0.0;
+ break;
+ default:
+ break;
+ }
+}
+
+void
wfd_port_set_attribi(struct wfd_device *device,
struct wfd_port *port,
WFDPortConfigAttrib attribute,
@@ -340,6 +368,38 @@ wfd_port_set_attribi(struct wfd_device *device,
}
port->power_mode = value;
break;
+ /* ignored as FILL_PORT_AREA = true */
+ case WFD_PORT_BACKGROUND_COLOR:
+ default:
+ break;
+ }
+}
+
+void
+wfd_port_set_attribiv(struct wfd_device *device,
+ struct wfd_port *port,
+ WFDPortConfigAttrib attribute,
+ WFDint count,
+ const WFDint *value)
+{
+ switch (attribute) {
+ /* ignored as FILL_PORT_AREA = true */
+ case WFD_PORT_BACKGROUND_COLOR:
+ default:
+ break;
+ }
+}
+
+void
+wfd_port_set_attribfv(struct wfd_device *device,
+ struct wfd_port *port,
+ WFDPortConfigAttrib attribute,
+ WFDint count,
+ const WFDfloat *value)
+{
+ switch (attribute) {
+ /* ignored as FILL_PORT_AREA = true */
+ case WFD_PORT_BACKGROUND_COLOR:
default:
break;
}
diff --git a/src/wfdport.h b/src/wfdport.h
index 0276cca..1aac67d 100644
--- a/src/wfdport.h
+++ b/src/wfdport.h
@@ -54,19 +54,35 @@ wfd_port_get_attribiv(struct wfd_device *device,
WFDPortConfigAttrib attribute,
WFDint count,
WFDint *value);
+void
+wfd_port_get_attribfv(struct wfd_device *device,
+ struct wfd_port *port,
+ WFDPortConfigAttrib attribute,
+ WFDint count,
+ WFDfloat *value);
void
wfd_port_set_attribi(struct wfd_device *device,
struct wfd_port *port,
WFDPortConfigAttrib attribute,
WFDint value);
-
+void
+wfd_port_set_attribiv(struct wfd_device *device,
+ struct wfd_port *port,
+ WFDPortConfigAttrib attribute,
+ WFDint count,
+ const WFDint *value);
+void
+wfd_port_set_attribfv(struct wfd_device *device,
+ struct wfd_port *port,
+ WFDPortConfigAttrib attribute,
+ WFDint count,
+ const WFDfloat *value);
WFDint
wfd_port_get_modes(struct wfd_device *device,
struct wfd_port *port,
WFDPortMode *modes,
WFDint modes_count);
-
void
wfd_port_set_mode(struct wfd_device *device,
struct wfd_port *port,