vl/dri3: add support for resizing
When drawable size changed, PresentConfigureNotify event will be emitted, by handling the event to re-allocate resized buffer. Signed-off-by: Leo Liu <leo.liu@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com>
This commit is contained in:
parent
96580ad593
commit
858b329c2c
|
@ -91,7 +91,9 @@ dri3_handle_present_event(struct vl_dri3_screen *scrn,
|
||||||
{
|
{
|
||||||
switch (ge->evtype) {
|
switch (ge->evtype) {
|
||||||
case XCB_PRESENT_CONFIGURE_NOTIFY: {
|
case XCB_PRESENT_CONFIGURE_NOTIFY: {
|
||||||
/* TODO */
|
xcb_present_configure_notify_event_t *ce = (void *) ge;
|
||||||
|
scrn->width = ce->width;
|
||||||
|
scrn->height = ce->height;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case XCB_PRESENT_COMPLETE_NOTIFY: {
|
case XCB_PRESENT_COMPLETE_NOTIFY: {
|
||||||
|
@ -249,12 +251,19 @@ dri3_get_back_buffer(struct vl_dri3_screen *scrn)
|
||||||
return NULL;
|
return NULL;
|
||||||
buffer = scrn->back_buffers[scrn->cur_back];
|
buffer = scrn->back_buffers[scrn->cur_back];
|
||||||
|
|
||||||
if (!buffer) {
|
if (!buffer || buffer->width != scrn->width ||
|
||||||
buffer = dri3_alloc_back_buffer(scrn);
|
buffer->height != scrn->height) {
|
||||||
if (!buffer)
|
struct vl_dri3_buffer *new_buffer;
|
||||||
|
|
||||||
|
new_buffer = dri3_alloc_back_buffer(scrn);
|
||||||
|
if (!new_buffer)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (buffer)
|
||||||
|
dri3_free_back_buffer(scrn, buffer);
|
||||||
|
|
||||||
vl_compositor_reset_dirty_area(&scrn->dirty_areas[scrn->cur_back]);
|
vl_compositor_reset_dirty_area(&scrn->dirty_areas[scrn->cur_back]);
|
||||||
|
buffer = new_buffer;
|
||||||
scrn->back_buffers[scrn->cur_back] = buffer;
|
scrn->back_buffers[scrn->cur_back] = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue