OSDN Git Service

Fix black screen in apps
authorLingfeng Yang <lfy@google.com>
Wed, 14 Dec 2016 21:13:51 +0000 (13:13 -0800)
committerLingfeng Yang <lfy@google.com>
Wed, 14 Dec 2016 21:14:43 +0000 (21:14 +0000)
- multi-line for loop body :)
- distinguish locked vs unlocked cb width

Change-Id: I4d978011a1b7a7aa5efb244a56353857285e3a03

system/OpenglSystemCommon/FormatConversions.cpp
system/OpenglSystemCommon/FormatConversions.h
system/gralloc/gralloc.cpp

index 5fcffa3..8213602 100644 (file)
@@ -312,15 +312,18 @@ void yuv420p_to_rgb888(char* dest, char* src, int width, int height,
     }
 }
 
-void copy_rgb_buffer(char* _dst, char* raw_data,
-                            int width, int height, int top, int left,
-                            int bpp) {
+void copy_rgb_buffer_from_unlocked(
+        char* _dst, char* raw_data,
+        int unlockedWidth,
+        int width, int height, int top, int left,
+        int bpp) {
     char* dst = _dst;
     int dst_line_len = width * bpp;
-    int src_line_len = width * bpp;
+    int src_line_len = unlockedWidth * bpp;
     char *src = (char *)raw_data + top*src_line_len + left*bpp;
-    for (int y = 0; y < height; y++)
+    for (int y = 0; y < height; y++) {
         memcpy(dst, src, dst_line_len);
-    src += src_line_len;
-    dst += dst_line_len;
+        src += src_line_len;
+        dst += dst_line_len;
+    }
 }
index e844be8..6e15f36 100644 (file)
@@ -39,7 +39,8 @@ void yv12_to_rgb888(char* dest, char* src, int width, int height,
                     int left, int top, int right, int bottom);
 void yuv420p_to_rgb888(char* dest, char* src, int width, int height,
                        int left, int top, int right, int bottom);
-void copy_rgb_buffer(char* _dst, char* raw_data,
-                            int width, int height, int top, int left,
-                            int bpp);
+void copy_rgb_buffer_from_unlocked(char* _dst, char* raw_data,
+                                   int unlockedWidth,
+                                   int width, int height, int top, int left,
+                                   int bpp);
 #endif
index 5e590a6..5104e2f 100644 (file)
@@ -156,7 +156,10 @@ static void updateHostColorBuffer(cb_handle_t* cb,
     }
 
     if (doLocked && is_rgb_format) {
-        copy_rgb_buffer(to_send, pixels, width, height, top, left, bpp);
+        copy_rgb_buffer_from_unlocked(
+                to_send, pixels,
+                cb->width,
+                width, height, top, left, bpp);
     }
 
     if (cb->goldfish_dma.fd > 0) {