Skip to content

Commit

Permalink
Correct gralloc usage flags for renderer and some code style improvem…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
Alexious-sh committed Nov 19, 2012
1 parent 850bd1b commit c9a1797
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion media/libstagefright/OMXCodec.cpp
Expand Up @@ -1294,7 +1294,7 @@ static size_t getFrameSize(

#ifdef QCOM_LEGACY_OMX
case OMX_QCOM_COLOR_FormatYVU420SemiPlanar:
return (((width + 15) & -16) * ((height + 15) & -16) * 3) / 2;
return ALIGN(width, 16) * ALIGN(height, 16) * 3 / 2;

This comment has been minimized.

Copy link
@Alexious-sh

Alexious-sh Nov 19, 2012

Author Owner

This line change gives compilation error now, sorry. You can use old line without problems.

This comment has been minimized.

Copy link
@ItachiSan

ItachiSan Dec 15, 2012

Thanks mate! This works :)
Will try to understand why it doesn't work...

#endif

#ifdef SAMSUNG_CODEC_SUPPORT
Expand Down
1 change: 1 addition & 0 deletions media/libstagefright/colorconversion/Android.mk
Expand Up @@ -11,6 +11,7 @@ LOCAL_C_INCLUDES := \

ifeq ($(BOARD_USES_QCOM_HARDWARE),true)
LOCAL_C_INCLUDES += $(TOP)/vendor/qcom/opensource/omx/mm-core/omxcore/inc
LOCAL_C_INCLUDES += $(TOP)/hardware/qcom/display/libgralloc
endif

LOCAL_MODULE:= libstagefright_color_conversion
Expand Down
14 changes: 11 additions & 3 deletions media/libstagefright/colorconversion/SoftwareRenderer.cpp
Expand Up @@ -28,6 +28,10 @@
#include <ui/GraphicBufferMapper.h>
#include <gui/ISurfaceTexture.h>

#ifdef QCOM_LEGACY_OMX
#include <gralloc_priv.h>
#endif

namespace android {

#ifdef QCOM_HARDWARE
Expand Down Expand Up @@ -83,7 +87,7 @@ SoftwareRenderer::SoftwareRenderer(
halFormat = HAL_PIXEL_FORMAT_YCrCb_420_SP;
bufWidth = (mCropWidth + 1) & ~1;
bufHeight = (mCropHeight + 1) & ~1;
mAlign = ((mWidth + 15) & -16) * ((mHeight + 15) & -16);
mAlign = ALIGN(mWidth, 16) * ALIGN(mHeight, 16);

This comment has been minimized.

Copy link
@ItachiSan

ItachiSan Dec 15, 2012

Should revert also here (building error)
JTK what does '& ~' do in '#define ALIGN'?

break;
}
#endif
Expand Down Expand Up @@ -112,7 +116,11 @@ SoftwareRenderer::SoftwareRenderer(
native_window_set_usage(
mNativeWindow.get(),
GRALLOC_USAGE_SW_READ_NEVER | GRALLOC_USAGE_SW_WRITE_OFTEN
| GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP));
| GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP
#ifdef QCOM_LEGACY_OMX
| GRALLOC_USAGE_PRIVATE_ADSP_HEAP | GRALLOC_USAGE_PRIVATE_UNCACHED
#endif
));

CHECK_EQ(0,
native_window_set_scaling_mode(
Expand Down Expand Up @@ -289,4 +297,4 @@ void SoftwareRenderer::render(
buf = NULL;
}

} // namespace android
} // namespace android

0 comments on commit c9a1797

Please sign in to comment.