xwayland: Drop xwl_window_buffers_recycle
Use xwl_window_buffers_dispose instead. The pixmaps will need to be re-created anyway, so keeping around the xwl_window_buffers doesn't buy much. And dropping this makes the next commit simpler. Also fold xwl_window_buffer_destroy_pixmap into its only remaining caller, xwl_window_buffer_maybe_dispose. v2: (Olivier Fourdan) * Fix up indentation in xwl_window_set_window_pixmap * Leave xwl_window_buffer_destroy_pixmap helper
This commit is contained in:
parent
2879032ecc
commit
2b577c2e3b
|
@ -788,10 +788,10 @@ xwl_window_dmabuf_feedback_done(void *data,
|
||||||
xwl_window->window->drawable.id,
|
xwl_window->window->drawable.id,
|
||||||
xwl_window->has_implicit_scanout_support ? "" : "not");
|
xwl_window->has_implicit_scanout_support ? "" : "not");
|
||||||
|
|
||||||
/* If the linux-dmabuf v4 per-surface feedback changed, recycle the
|
/* If the linux-dmabuf v4 per-surface feedback changed, dispose of the
|
||||||
* window buffers so that they get re-created with appropriate parameters.
|
* window buffers so that they get re-created with appropriate parameters.
|
||||||
*/
|
*/
|
||||||
xwl_window_buffers_recycle(xwl_window);
|
xwl_window_buffers_dispose(xwl_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -39,7 +39,6 @@ struct xwl_window_buffer {
|
||||||
struct xwl_window *xwl_window;
|
struct xwl_window *xwl_window;
|
||||||
PixmapPtr pixmap;
|
PixmapPtr pixmap;
|
||||||
RegionPtr damage_region;
|
RegionPtr damage_region;
|
||||||
Bool recycle_on_release;
|
|
||||||
int refcnt;
|
int refcnt;
|
||||||
uint32_t time;
|
uint32_t time;
|
||||||
struct xorg_list link_buffer;
|
struct xorg_list link_buffer;
|
||||||
|
@ -114,16 +113,6 @@ xwl_window_buffer_maybe_dispose(struct xwl_window_buffer *xwl_window_buffer)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
xwl_window_buffer_recycle(struct xwl_window_buffer *xwl_window_buffer)
|
|
||||||
{
|
|
||||||
RegionEmpty(xwl_window_buffer->damage_region);
|
|
||||||
xwl_window_buffer->recycle_on_release = FALSE;
|
|
||||||
|
|
||||||
if (xwl_window_buffer->pixmap)
|
|
||||||
xwl_window_buffer_destroy_pixmap (xwl_window_buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xwl_window_buffer_add_damage_region(struct xwl_window *xwl_window,
|
xwl_window_buffer_add_damage_region(struct xwl_window *xwl_window,
|
||||||
RegionPtr damage_region)
|
RegionPtr damage_region)
|
||||||
|
@ -199,9 +188,6 @@ xwl_window_buffer_release_callback(void *data)
|
||||||
if (xwl_window_buffer_maybe_dispose(xwl_window_buffer))
|
if (xwl_window_buffer_maybe_dispose(xwl_window_buffer))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (xwl_window_buffer->recycle_on_release)
|
|
||||||
xwl_window_buffer_recycle(xwl_window_buffer);
|
|
||||||
|
|
||||||
/* We append the buffers to the end of the list, as we pick the last
|
/* We append the buffers to the end of the list, as we pick the last
|
||||||
* entry again when looking for new available buffers, that means the
|
* entry again when looking for new available buffers, that means the
|
||||||
* least used buffers will remain at the beginning of the list so that
|
* least used buffers will remain at the beginning of the list so that
|
||||||
|
@ -234,29 +220,6 @@ xwl_window_buffers_init(struct xwl_window *xwl_window)
|
||||||
xorg_list_init(&xwl_window->window_buffers_unavailable);
|
xorg_list_init(&xwl_window->window_buffers_unavailable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
xwl_window_buffers_recycle(struct xwl_window *xwl_window)
|
|
||||||
{
|
|
||||||
struct xwl_window_buffer *xwl_window_buffer, *tmp;
|
|
||||||
|
|
||||||
/* Dispose available buffers */
|
|
||||||
xorg_list_for_each_entry_safe(xwl_window_buffer, tmp,
|
|
||||||
&xwl_window->window_buffers_available,
|
|
||||||
link_buffer) {
|
|
||||||
xwl_window_buffer_maybe_dispose(xwl_window_buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xwl_window->window_buffers_timer)
|
|
||||||
TimerCancel(xwl_window->window_buffers_timer);
|
|
||||||
|
|
||||||
/* Mark the others for recycle on release */
|
|
||||||
xorg_list_for_each_entry(xwl_window_buffer,
|
|
||||||
&xwl_window->window_buffers_unavailable,
|
|
||||||
link_buffer) {
|
|
||||||
xwl_window_buffer->recycle_on_release = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
xwl_window_buffers_dispose(struct xwl_window *xwl_window)
|
xwl_window_buffers_dispose(struct xwl_window *xwl_window)
|
||||||
{
|
{
|
||||||
|
@ -280,10 +243,8 @@ xwl_window_buffers_dispose(struct xwl_window *xwl_window)
|
||||||
xwl_window_buffer_maybe_dispose(xwl_window_buffer);
|
xwl_window_buffer_maybe_dispose(xwl_window_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xwl_window->window_buffers_timer) {
|
if (xwl_window->window_buffers_timer)
|
||||||
TimerFree(xwl_window->window_buffers_timer);
|
TimerCancel(xwl_window->window_buffers_timer);
|
||||||
xwl_window->window_buffers_timer = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PixmapPtr
|
PixmapPtr
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include "regionstr.h"
|
#include "regionstr.h"
|
||||||
|
|
||||||
void xwl_window_buffers_init(struct xwl_window *xwl_window);
|
void xwl_window_buffers_init(struct xwl_window *xwl_window);
|
||||||
void xwl_window_buffers_recycle(struct xwl_window *xwl_window);
|
|
||||||
void xwl_window_buffers_dispose(struct xwl_window *xwl_window);
|
void xwl_window_buffers_dispose(struct xwl_window *xwl_window);
|
||||||
PixmapPtr xwl_window_buffers_get_pixmap(struct xwl_window *xwl_window,
|
PixmapPtr xwl_window_buffers_get_pixmap(struct xwl_window *xwl_window,
|
||||||
RegionPtr damage_region);
|
RegionPtr damage_region);
|
||||||
|
|
|
@ -1192,6 +1192,9 @@ xwl_unrealize_window(WindowPtr window)
|
||||||
|
|
||||||
xwl_window_buffers_dispose(xwl_window);
|
xwl_window_buffers_dispose(xwl_window);
|
||||||
|
|
||||||
|
if (xwl_window->window_buffers_timer)
|
||||||
|
TimerFree(xwl_window->window_buffers_timer);
|
||||||
|
|
||||||
if (xwl_window->frame_callback)
|
if (xwl_window->frame_callback)
|
||||||
wl_callback_destroy(xwl_window->frame_callback);
|
wl_callback_destroy(xwl_window->frame_callback);
|
||||||
|
|
||||||
|
@ -1229,7 +1232,7 @@ xwl_window_set_window_pixmap(WindowPtr window,
|
||||||
|
|
||||||
xwl_window = xwl_window_get(window);
|
xwl_window = xwl_window_get(window);
|
||||||
if (xwl_window)
|
if (xwl_window)
|
||||||
xwl_window_buffers_recycle(xwl_window);
|
xwl_window_buffers_dispose(xwl_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
|
|
Loading…
Reference in New Issue