• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得cocoawindowspythonrubyphpgameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdombtronvb.netdirectxarduinopreviewerゲームエンジン

external/gbm_gralloc


Commit MetaInfo

Revision2004d793a40781d533250c2e6a1b6a8e88c31622 (tree)
Time2016-04-23 02:50:35
AuthorRob Herring <robh@kern...>
CommiterRob Herring

Log Message

Update usage flag handling

Add missing support for GRALLOC_USAGE_SW_READ_OFTEN,
GRALLOC_USAGE_SW_WRITE_OFTEN, GRALLOC_USAGE_HW_TEXTURE, and
GRALLOC_USAGE_CURSOR usage flags mapping them to GBM flags.

For now, cursor flag is commented out because the Android side doesn't seem
to honor a larger stride.

Signed-off-by: Rob Herring <robh@kernel.org>

Change Summary

Incremental Difference

--- a/gralloc_gbm.cpp
+++ b/gralloc_gbm.cpp
@@ -92,22 +92,18 @@ static uint32_t get_gbm_format(int format)
9292 return fmt;
9393 }
9494
95-static unsigned get_pipe_bind(int usage)
95+static unsigned int get_pipe_bind(int usage)
9696 {
97- unsigned bind = 0;
98-#if 0
99- if (usage & GRALLOC_USAGE_SW_READ_MASK)
100- bind |= PIPE_BIND_TRANSFER_READ;
101- if (usage & GRALLOC_USAGE_SW_WRITE_MASK)
102- bind |= PIPE_BIND_TRANSFER_WRITE;
103- if (usage & GRALLOC_USAGE_HW_TEXTURE)
104- bind |= PIPE_BIND_SAMPLER_VIEW;
105-#endif
106- if (usage & GRALLOC_USAGE_HW_RENDER)
97+ unsigned int bind = 0;
98+
99+ if (usage & (GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN))
100+ bind |= GBM_BO_USE_LINEAR;
101+ if (usage & GRALLOC_USAGE_CURSOR)
102+ ;//bind |= GBM_BO_USE_CURSOR;
103+ if (usage & (GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE))
107104 bind |= GBM_BO_USE_RENDERING;
108- if (usage & GRALLOC_USAGE_HW_FB) {
105+ if (usage & GRALLOC_USAGE_HW_FB)
109106 bind |= GBM_BO_USE_SCANOUT;
110- }
111107
112108 return bind;
113109 }
@@ -149,6 +145,7 @@ static struct gralloc_gbm_bo_t *gbm_alloc(struct gbm_device *gbm,
149145 struct gralloc_gbm_bo_t *buf;
150146 int format = get_gbm_format(handle->format);
151147 int usage = get_pipe_bind(handle->usage);
148+ int width, height;
152149
153150 buf = new struct gralloc_gbm_bo_t();
154151 if (!buf) {
@@ -156,8 +153,21 @@ static struct gralloc_gbm_bo_t *gbm_alloc(struct gbm_device *gbm,
156153 return NULL;
157154 }
158155
159- buf->bo = gbm_bo_create(gbm, handle->width, handle->height, format, usage);
156+ width = handle->width;
157+ height = handle->height;
158+ if (usage & GBM_BO_USE_CURSOR) {
159+ if (handle->width < 64)
160+ width = 64;
161+ if (handle->height < 64)
162+ height = 64;
163+ }
164+
165+ ALOGD("create BO, size=%dx%d, fmt=%d, usage=%x",
166+ handle->width, handle->height, handle->format, usage);
167+ buf->bo = gbm_bo_create(gbm, width, height, format, usage);
160168 if (!buf->bo) {
169+ ALOGE("failed to create BO, size=%dx%d, fmt=%d, usage=%x",
170+ handle->width, handle->height, handle->format, usage);
161171 delete buf;
162172 return NULL;
163173 }