Fix a compositor race condition that can result in the most recent buffer not being painted.

This commit is contained in:
Glenn Watson 2015-05-12 10:34:05 +10:00
parent 885068207f
commit 79942f0920
4 changed files with 44 additions and 22 deletions

View file

@ -20,7 +20,7 @@ use layers::platform::surface::{NativeGraphicsMetadata, NativePaintingGraphicsCo
use layers::platform::surface::NativeSurface;
use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet};
use layers;
use msg::compositor_msg::{Epoch, PaintState, LayerId};
use msg::compositor_msg::{Epoch, FrameTreeId, PaintState, LayerId};
use msg::compositor_msg::{LayerMetadata, PaintListener, ScrollPolicy};
use msg::constellation_msg::Msg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
@ -68,7 +68,7 @@ pub struct PaintRequest {
pub enum Msg {
PaintInit(Arc<StackingContext>),
Paint(Vec<PaintRequest>),
Paint(Vec<PaintRequest>, FrameTreeId),
UnusedBuffer(Vec<Box<LayerBuffer>>),
PaintPermissionGranted,
PaintPermissionRevoked,
@ -210,7 +210,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send + 'static {
self.epoch.next();
self.initialize_layers();
}
Msg::Paint(requests) => {
Msg::Paint(requests, frame_tree_id) => {
if !self.paint_permission {
debug!("PaintTask: paint ready msg");
let ConstellationChan(ref mut c) = self.constellation_chan;
@ -238,7 +238,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send + 'static {
}
debug!("PaintTask: returning surfaces");
self.compositor.assign_painted_buffers(self.id, self.epoch, replies);
self.compositor.assign_painted_buffers(self.id, self.epoch, replies, frame_tree_id);
}
Msg::UnusedBuffer(unused_buffers) => {
debug!("PaintTask: Received {} unused buffers", unused_buffers.len());