Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rotate screen on the sink device. #6

Open
kkangs opened this issue Feb 24, 2015 · 1 comment
Open

rotate screen on the sink device. #6

kkangs opened this issue Feb 24, 2015 · 1 comment

Comments

@kkangs
Copy link

kkangs commented Feb 24, 2015

when using normally (not fix), screen like pressed side by side.
(Source : Nexus 4(left img), Sink : Galaxy Nexus(right img), Screen : Vertical)

i want to display the original image(display) when portrait mode.
e.g. sink Nexus5, source Nexus5 -> like equally mode(portrait or landscape) wanna equal image display!

but, now when rotating a screen, it's equall mode. how to fix?

@kensuke
Copy link
Owner

kensuke commented Feb 24, 2015

// Sink side modify

/frameworks/native/libs/gui/GLConsumer.cpp

status_t GLConsumer::updateAndReleaseLocked(const BufferQueue::BufferItem& item)
{
    status_t err = NO_ERROR;

// ...

    // for Miracast Sink, screen rotation
    BufferQueue::BufferItem newrot;
    newrot.mTransform = item.mTransform;
    if (mName == "A Sink Surface") {

// ...

        if (mSinkRotate) {
            newrot.mTransform = item.mTransform | 0x04; //
/system/core/include/system/graphics.h HAL_TRANSFORM_ROT_90    = 0x04,
            //ST_LOGW("updateAndReleaseLocked() Force
Transform::ROT_90 [%d, %d]", mSlots[buf].mGraphicBuffer->getWidth(),
mSlots[buf].mGraphicBuffer->getHeight());
        }

        // add this
        newrot.mScalingMode = NATIVE_WINDOW_SCALING_MODE_SCALE_CROP;
        ST_LOGW("updateAndReleaseLocked() item.mScalingMode[%d, %d]",
item.mScalingMode, newrot.mScalingMode);
    }
   // /system/core/include/system/window.h
   //NATIVE_WINDOW_SCALING_MODE_FREEZE           = 0,
   //NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW  = 1,
   //NATIVE_WINDOW_SCALING_MODE_SCALE_CROP       = 2,
   //NATIVE_WINDOW_SCALING_MODE_NO_SCALE_CROP    = 3,

    // Update the GLConsumer state.
    mCurrentTexture = buf;
    mCurrentTextureBuf = mSlots[buf].mGraphicBuffer;
    mCurrentCrop = item.mCrop;
    //mCurrentTransform = item.mTransform;
    mCurrentTransform = newrot.mTransform; // control rotation
    //mCurrentScalingMode = item.mScalingMode;
    mCurrentScalingMode = newrot.mScalingMode; // control scaling // add this

this works only Source side resolution 800x480

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants