examples: Use output mode instead of arbitrary size 46/278146/1
authorSeunghun Lee <shiin.lee@samsung.com>
Thu, 3 Mar 2022 09:03:25 +0000 (18:03 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 18 Jul 2022 05:58:14 +0000 (14:58 +0900)
Change-Id: I46b576bccbd469ed386dc4d284a7a71311e557af

src/examples/tinyds-tdm.c

index 4207fb1c573c2c44a3c39eb99105b5d238152a01..3841b841fe4a082a5529dd19635c455225dfa85b 100644 (file)
@@ -22,9 +22,6 @@
 
 #define TINYDS_UNUSED   __attribute__((unused))
 
-#define OUTPUT_WIDTH   1280
-#define OUTPUT_HEIGHT  720
-
 struct tinyds_output
 {
     struct tinyds_server *server;
@@ -223,6 +220,7 @@ backend_handle_new_output(struct wl_listener *listener, void *data)
     struct tinyds_server *server;
     struct tinyds_output *output;
     struct ds_output *ds_output;
+    const struct ds_output_mode *mode;
 
     server = wl_container_of(listener, server, new_output);
     ds_output = data;
@@ -232,6 +230,9 @@ backend_handle_new_output(struct wl_listener *listener, void *data)
     if (server->output)
         return;
 
+    mode = ds_output_preferred_mode(ds_output);
+    ds_output_set_mode(ds_output, mode);
+
     output = calloc(1, sizeof *output);
     if (!output)
         return;
@@ -243,7 +244,7 @@ backend_handle_new_output(struct wl_listener *listener, void *data)
     }
 
     output->swapchain = ds_swapchain_create(output->allocator,
-            OUTPUT_WIDTH, OUTPUT_HEIGHT, DRM_FORMAT_XRGB8888); // FIXME output mode
+            mode->width, mode->height, DRM_FORMAT_XRGB8888);
     if (!output->swapchain) {
         ds_allocator_destroy(output->allocator);
         free(output);