Skip to content

Commit 6882420

Browse files
author
bors-servo
authored
Auto merge of #440 - mmatyas:cfgflags, r=glennw
Fix Android and ARM compilation options This fixes Android build issues caused by [missing GL calls](https://github.com/servo/gleam/blob/master/src/gl.rs#L206) in the profiling code. It seems these *are* available on ARM though, so I enabled building the profile code for ARM devices. (This is a fix for servo/servo#13154) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/440) <!-- Reviewable:end -->
2 parents 6d95014 + 39a4fa1 commit 6882420

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

webrender/src/device.rs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ pub struct GpuFrameProfile<T> {
524524
}
525525

526526
impl<T> GpuFrameProfile<T> {
527+
#[cfg(not(target_os = "android"))]
527528
fn new() -> GpuFrameProfile<T> {
528529
let queries = gl::gen_queries(MAX_EVENTS_PER_FRAME as gl::GLint);
529530

@@ -535,24 +536,34 @@ impl<T> GpuFrameProfile<T> {
535536
}
536537
}
537538

539+
#[cfg(target_os = "android")]
540+
fn new() -> GpuFrameProfile<T> {
541+
GpuFrameProfile {
542+
queries: Vec::new(),
543+
samples: Vec::new(),
544+
next_query: 0,
545+
pending_query: 0,
546+
}
547+
}
548+
538549
fn begin_frame(&mut self) {
539550
self.next_query = 0;
540551
self.pending_query = 0;
541552
self.samples.clear();
542553
}
543554

544-
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))]
555+
#[cfg(not(target_os = "android"))]
545556
fn end_frame(&mut self) {
546557
if self.pending_query != 0 {
547558
gl::end_query(gl::TIME_ELAPSED);
548559
}
549560
}
550561

551-
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
562+
#[cfg(target_os = "android")]
552563
fn end_frame(&mut self) {
553564
}
554565

555-
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))]
566+
#[cfg(not(target_os = "android"))]
556567
fn add_marker(&mut self, tag: T) {
557568
if self.pending_query != 0 {
558569
gl::end_query(gl::TIME_ELAPSED);
@@ -572,7 +583,7 @@ impl<T> GpuFrameProfile<T> {
572583
self.next_query += 1;
573584
}
574585

575-
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
586+
#[cfg(target_os = "android")]
576587
fn add_marker(&mut self, tag: T) {
577588
self.samples.push(GpuSample {
578589
tag: tag,
@@ -584,7 +595,7 @@ impl<T> GpuFrameProfile<T> {
584595
self.next_query <= MAX_EVENTS_PER_FRAME
585596
}
586597

587-
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))]
598+
#[cfg(not(target_os = "android"))]
588599
fn build_samples(&mut self) -> Vec<GpuSample<T>> {
589600
for (index, sample) in self.samples.iter_mut().enumerate() {
590601
sample.time_ns = gl::get_query_object_ui64v(self.queries[index], gl::QUERY_RESULT)
@@ -593,16 +604,21 @@ impl<T> GpuFrameProfile<T> {
593604
mem::replace(&mut self.samples, Vec::new())
594605
}
595606

596-
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
607+
#[cfg(target_os = "android")]
597608
fn build_samples(&mut self) -> Vec<GpuSample<T>> {
598609
mem::replace(&mut self.samples, Vec::new())
599610
}
600611
}
601612

602613
impl<T> Drop for GpuFrameProfile<T> {
614+
#[cfg(not(target_os = "android"))]
603615
fn drop(&mut self) {
604616
gl::delete_queries(&self.queries);
605617
}
618+
619+
#[cfg(target_os = "android")]
620+
fn drop(&mut self) {
621+
}
606622
}
607623

608624
pub struct GpuProfiler<T> {

0 commit comments

Comments
 (0)