History

wayland: rename gpu_formats to planar_formats

The old name is misleading. We do want these formats, but it is not accurate to call them "gpu formats". Call it "planar" instead so it's more obvious these come from drm primary planes.

Dudemanguy committed 2 years ago

Commit 99d4dec1 parent c5aa7d83 files · +18 −18Browse files

Unified · Split

3 files
  1. video/out/wayland_common.c +9 −9
  2. video/out/wayland_common.h +2 −2
  3. video/out/wldmabuf/ra_wldmabuf.c +7 −7
video/out/wayland_common.c+9−9
@@ -212,7 +212,7 @@ static int spawn_cursor(struct vo_wayland_state *wl); · 211 unmodified lines
212static void add_feedback(struct vo_wayland_feedback_pool *fback_pool,212static void add_feedback(struct vo_wayland_feedback_pool *fback_pool,
213 struct wp_presentation_feedback *fback);213 struct wp_presentation_feedback *fback);
214static void apply_keepaspect(struct vo_wayland_state *wl, int *width, int *height);214static void apply_keepaspect(struct vo_wayland_state *wl, int *width, int *height);
215static void get_gpu_drm_formats(struct vo_wayland_state *wl);215static void get_planar_drm_formats(struct vo_wayland_state *wl);
216static void get_shape_device(struct vo_wayland_state *wl, struct vo_wayland_seat *s);216static void get_shape_device(struct vo_wayland_state *wl, struct vo_wayland_seat *s);
217static void guess_focus(struct vo_wayland_state *wl);217static void guess_focus(struct vo_wayland_state *wl);
218static void handle_key_input(struct vo_wayland_seat *s, uint32_t key, uint32_t state, bool no_emit);218static void handle_key_input(struct vo_wayland_seat *s, uint32_t key, uint32_t state, bool no_emit);
@@ -1406,7 +1406,7 @@ static void tranche_target_device(void *data, · 1187 unmodified lines
1406 memcpy(&wl->target_device_id, id, sizeof(dev_t));1406 memcpy(&wl->target_device_id, id, sizeof(dev_t));
1407 break;1407 break;
1408 }1408 }
1409 get_gpu_drm_formats(wl);1409 get_planar_drm_formats(wl);
1410 }1410 }
1411}1411}
1412 1412
@@ -1828,7 +1828,7 @@ static char **get_displays_spanned(struct vo_wayland_state *wl) · 415 unmodified lines
1828 return names;1828 return names;
1829}1829}
1830 1830
1831static void get_gpu_drm_formats(struct vo_wayland_state *wl)1831static void get_planar_drm_formats(struct vo_wayland_state *wl)
1832{1832{
1833#if HAVE_DRM1833#if HAVE_DRM
1834 drmDevice *device = NULL;1834 drmDevice *device = NULL;
@@ -1913,15 +1913,15 @@ static void get_gpu_drm_formats(struct vo_wayland_state *wl) · 78 unmodified lines
1913 }1913 }
1914 1914
1915 plane = drmModeGetPlane(fd, res->planes[index]);1915 plane = drmModeGetPlane(fd, res->planes[index]);
1916 wl->num_gpu_formats = plane->count_formats;1916 wl->num_planar_formats = plane->count_formats;
1917 1917
1918 if (wl->gpu_formats)1918 if (wl->planar_formats)
1919 talloc_free(wl->gpu_formats);1919 talloc_free(wl->planar_formats);
1920 1920
1921 wl->gpu_formats = talloc_zero_array(wl, int, wl->num_gpu_formats);1921 wl->planar_formats = talloc_zero_array(wl, int, wl->num_planar_formats);
1922 for (int i = 0; i < wl->num_gpu_formats; ++i) {1922 for (int i = 0; i < wl->num_planar_formats; ++i) {
1923 MP_DBG(wl, "DRM primary plane supports drm format: %s\n", mp_tag_str(plane->formats[i]));1923 MP_DBG(wl, "DRM primary plane supports drm format: %s\n", mp_tag_str(plane->formats[i]));
1924 wl->gpu_formats[i] = plane->formats[i];1924 wl->planar_formats[i] = plane->formats[i];
1925 }1925 }
1926 1926
1927done:1927done:
video/out/wayland_common.h+2−2
@@ -115,8 +115,8 @@ struct vo_wayland_state { · 114 unmodified lines
115 uint32_t compositor_format_size;115 uint32_t compositor_format_size;
116 struct drm_format *compositor_formats;116 struct drm_format *compositor_formats;
117 int num_compositor_formats;117 int num_compositor_formats;
118 uint32_t *gpu_formats;118 uint32_t *planar_formats;
119 int num_gpu_formats;119 int num_planar_formats;
120 120
121 /* presentation-time */121 /* presentation-time */
122 struct wp_presentation *presentation;122 struct wp_presentation *presentation;
video/out/wldmabuf/ra_wldmabuf.c+7−7
@@ -35,17 +35,17 @@ bool ra_compatible_format(struct ra *ra, int imgfmt, uint32_t drm_format, uint64 · 34 unmodified lines
35 struct drm_format *formats = wl->compositor_formats;35 struct drm_format *formats = wl->compositor_formats;
36 36
37 37
38 // If we were able to make the DRM query, filter out the GPU formats.38 // If we were able to make the DRM query, filter out the planar formats.
39 // If not, just assume they all work and hope for the best.39 // If not, just assume they all work and hope for the best.
40 if (wl->gpu_formats) {40 if (wl->planar_formats) {
41 bool supported_gpu_format = false;41 bool supported_planar_format = false;
42 for (int i = 0; i < wl->num_gpu_formats; i++) {42 for (int i = 0; i < wl->num_planar_formats; i++) {
43 if (drm_format == wl->gpu_formats[i]) {43 if (drm_format == wl->planar_formats[i]) {
44 supported_gpu_format = true;44 supported_planar_format = true;
45 break;45 break;
46 }46 }
47 }47 }
48 if (!supported_gpu_format)48 if (!supported_planar_format)
49 return false;49 return false;
50 }50 }
51 51

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t