openwfd: Combine native_resolution/rect/width,height into union
This commit is contained in:
@@ -70,6 +70,15 @@ struct wfd_output {
|
|||||||
uint32_t current;
|
uint32_t current;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
union wfd_geometry {
|
||||||
|
struct {
|
||||||
|
WFDint x, y;
|
||||||
|
WFDint width, height;
|
||||||
|
} g;
|
||||||
|
|
||||||
|
WFDint array[4];
|
||||||
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
wfd_output_prepare_render(struct wlsc_output *output_base)
|
wfd_output_prepare_render(struct wlsc_output *output_base)
|
||||||
{
|
{
|
||||||
@@ -211,9 +220,7 @@ create_output_for_port(struct wfd_compositor *ec,
|
|||||||
int i;
|
int i;
|
||||||
WFDint num_pipelines, *pipelines;
|
WFDint num_pipelines, *pipelines;
|
||||||
WFDint num_modes;
|
WFDint num_modes;
|
||||||
WFDint rect[4] = { 0, 0, 0, 0 };
|
union wfd_geometry geometry;
|
||||||
int width, height;
|
|
||||||
WFDint native_resolution[2];
|
|
||||||
struct wfd_mode *mode;
|
struct wfd_mode *mode;
|
||||||
WFDPortMode *modes;
|
WFDPortMode *modes;
|
||||||
WFDfloat physical_size[2];
|
WFDfloat physical_size[2];
|
||||||
@@ -223,6 +230,7 @@ create_output_for_port(struct wfd_compositor *ec,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memset(output, 0, sizeof *output);
|
memset(output, 0, sizeof *output);
|
||||||
|
memset(&geometry, 0, sizeof geometry);
|
||||||
|
|
||||||
output->port = port;
|
output->port = port;
|
||||||
wl_list_init(&output->base.mode_list);
|
wl_list_init(&output->base.mode_list);
|
||||||
@@ -249,18 +257,16 @@ create_output_for_port(struct wfd_compositor *ec,
|
|||||||
|
|
||||||
wfdGetPortAttribiv(ec->dev, output->port,
|
wfdGetPortAttribiv(ec->dev, output->port,
|
||||||
WFD_PORT_NATIVE_RESOLUTION,
|
WFD_PORT_NATIVE_RESOLUTION,
|
||||||
2, native_resolution);
|
2, &geometry.array[2]);
|
||||||
width = native_resolution[0];
|
|
||||||
height = native_resolution[1];
|
|
||||||
|
|
||||||
output->base.current = NULL;
|
output->base.current = NULL;
|
||||||
wl_list_for_each(mode, &output->base.mode_list, base.link) {
|
wl_list_for_each(mode, &output->base.mode_list, base.link) {
|
||||||
if (mode->base.width == width && mode->base.height == height) {
|
if (mode->base.width == geometry.g.width &&
|
||||||
|
mode->base.height == geometry.g.height) {
|
||||||
output->base.current = &mode->base;
|
output->base.current = &mode->base;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (output->base.current == NULL) {
|
if (output->base.current == NULL) {
|
||||||
fprintf(stderr, "failed to find a native mode\n");
|
fprintf(stderr, "failed to find a native mode\n");
|
||||||
goto cleanup_port;
|
goto cleanup_port;
|
||||||
@@ -348,12 +354,12 @@ create_output_for_port(struct wfd_compositor *ec,
|
|||||||
GL_RENDERBUFFER,
|
GL_RENDERBUFFER,
|
||||||
output->rbo[output->current]);
|
output->rbo[output->current]);
|
||||||
|
|
||||||
rect[2] = width;
|
|
||||||
rect[3] = height;
|
|
||||||
wfdSetPipelineAttribiv(ec->dev, output->pipeline,
|
wfdSetPipelineAttribiv(ec->dev, output->pipeline,
|
||||||
WFD_PIPELINE_SOURCE_RECTANGLE, 4, rect);
|
WFD_PIPELINE_SOURCE_RECTANGLE,
|
||||||
|
4, geometry.array);
|
||||||
wfdSetPipelineAttribiv(ec->dev, output->pipeline,
|
wfdSetPipelineAttribiv(ec->dev, output->pipeline,
|
||||||
WFD_PIPELINE_DESTINATION_RECTANGLE, 4, rect);
|
WFD_PIPELINE_DESTINATION_RECTANGLE,
|
||||||
|
4, geometry.array);
|
||||||
|
|
||||||
wfdBindSourceToPipeline(ec->dev, output->pipeline,
|
wfdBindSourceToPipeline(ec->dev, output->pipeline,
|
||||||
output->source[output->current ^ 1],
|
output->source[output->current ^ 1],
|
||||||
|
|||||||
Reference in New Issue
Block a user